blob: 9da0b31b4b9447a033c7fc1f13787e5436ea587d [file] [log] [blame]
Macpaul Lin83dbca72011-10-11 22:33:18 +00001/*
2 * (C) Copyright 2002
3 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4 * Marius Groeger <mgroeger@sysgo.de>
5 *
6 * (C) Copyright 2002
7 * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
8 *
9 * Copyright (C) 2011 Andes Technology Corporation
10 * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
11 * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
12 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020013 * SPDX-License-Identifier: GPL-2.0+
Macpaul Lin83dbca72011-10-11 22:33:18 +000014 */
15
16/* CPU specific code */
17#include <common.h>
18#include <command.h>
19#include <watchdog.h>
20#include <asm/cache.h>
21
22#include <faraday/ftwdt010_wdt.h>
23
24/*
25 * cleanup_before_linux() is called just before we call linux
26 * it prepares the processor for linux
27 *
28 * we disable interrupt and caches.
29 */
30int cleanup_before_linux(void)
31{
Macpaul Lin83dbca72011-10-11 22:33:18 +000032 disable_interrupts();
33
Macpaul Lin83dbca72011-10-11 22:33:18 +000034 /* turn off I/D-cache */
rickf1113c92017-05-18 14:37:53 +080035 cache_flush();
Macpaul Lin83dbca72011-10-11 22:33:18 +000036 icache_disable();
37 dcache_disable();
Macpaul Lin83dbca72011-10-11 22:33:18 +000038 return 0;
39}
40
41int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
42{
43 disable_interrupts();
44
45 /*
46 * reset to the base addr of andesboot.
47 * currently no ROM loader at addr 0.
48 * do not use reset_cpu(0);
49 */
50#ifdef CONFIG_FTWDT010_WATCHDOG
51 /*
52 * workaround: if we use CONFIG_HW_WATCHDOG with ftwdt010, will lead
53 * automatic hardware reset when booting Linux.
54 * Please do not use CONFIG_HW_WATCHDOG and WATCHDOG_RESET() here.
55 */
56 ftwdt010_wdt_reset();
57 while (1)
58 ;
59#endif /* CONFIG_FTWDT010_WATCHDOG */
60
61 /*NOTREACHED*/
62}