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