From b0c66af53ec9385ac2d1cc2e5d7d1ecdc81caf34 Mon Sep 17 00:00:00 2001 From: Shinya Kuribayashi Date: Tue, 25 Mar 2008 21:30:07 +0900 Subject: [PATCH] [MIPS] Introduce _machine_restart Handles machine specific functions by using weak functions. Signed-off-by: Shinya Kuribayashi --- board/incaip/incaip.c | 6 ++++++ board/purple/purple.c | 8 ++++++++ board/tb0229/tb0229.c | 9 ++++++++- cpu/mips/cpu.c | 13 ++++++------- include/asm-mips/reboot.h | 14 ++++++++++++++ 5 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 include/asm-mips/reboot.h diff --git a/board/incaip/incaip.c b/board/incaip/incaip.c index dbf0ecc5af..c624b3d82e 100644 --- a/board/incaip/incaip.c +++ b/board/incaip/incaip.c @@ -26,9 +26,15 @@ #include #include #include +#include extern uint incaip_get_cpuclk(void); +void _machine_restart(void) +{ + *INCA_IP_WDT_RST_REQ = 0x3f; +} + static ulong max_sdram_size(void) { /* The only supported SDRAM data width is 16bit. diff --git a/board/purple/purple.c b/board/purple/purple.c index 74718afb48..13a14556ba 100644 --- a/board/purple/purple.c +++ b/board/purple/purple.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "sconsole.h" @@ -52,6 +53,13 @@ extern int asc_serial_getc (void); extern int asc_serial_tstc (void); extern void asc_serial_setbrg (void); +void _machine_restart(void) +{ + void (*f)(void) = (void *) 0xbfc00000; + + f(); +} + static void sdram_timing_init (ulong size) { register uint pass; diff --git a/board/tb0229/tb0229.c b/board/tb0229/tb0229.c index 61c2e9bd36..d08b422451 100644 --- a/board/tb0229/tb0229.c +++ b/board/tb0229/tb0229.c @@ -12,10 +12,17 @@ #include #include #include -#include #include +#include #include +void _machine_restart(void) +{ + void (*f)(void) = (void *) 0xbfc00000; + + f(); +} + #if defined(CONFIG_PCI) static struct pci_controller hose; diff --git a/cpu/mips/cpu.c b/cpu/mips/cpu.c index de70c4d614..8b43d8eb36 100644 --- a/cpu/mips/cpu.c +++ b/cpu/mips/cpu.c @@ -23,9 +23,9 @@ #include #include -#include #include #include +#include #define cache_op(op,addr) \ __asm__ __volatile__( \ @@ -37,15 +37,14 @@ : \ : "i" (op), "R" (*(unsigned char *)(addr))) +void __attribute__((weak)) _machine_restart(void) +{ +} + int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { -#if defined(CONFIG_INCA_IP) - *INCA_IP_WDT_RST_REQ = 0x3f; -#elif defined(CONFIG_PURPLE) || defined(CONFIG_TB0229) - void (*f)(void) = (void *) 0xbfc00000; + _machine_restart(); - f(); -#endif fprintf(stderr, "*** reset failed ***\n"); return 0; } diff --git a/include/asm-mips/reboot.h b/include/asm-mips/reboot.h new file mode 100644 index 0000000000..978d206816 --- /dev/null +++ b/include/asm-mips/reboot.h @@ -0,0 +1,14 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1997, 1999, 2001, 06 by Ralf Baechle + * Copyright (C) 2001 MIPS Technologies, Inc. + */ +#ifndef _ASM_REBOOT_H +#define _ASM_REBOOT_H + +extern void _machine_restart(void); + +#endif /* _ASM_REBOOT_H */ -- 2.30.2