[U-Boot] [PATCH 14/21] mips: Generic system restart support

Kyle Moffett Kyle.D.Moffett at boeing.com
Mon Mar 7 18:37:35 CET 2011


The MIPS port appears to use no generic hardware capability for
performing a CPU reset, therefore the do_reset() function can completely
go away.

Existing _machine_restart() functions are renamed __board_restart() to
allow the generic code to find them.

Two of the board ports just directly jump back to their FLASH reset
vector, therefore they have no-op __board_emergency_restart() functions.
(If the CPU is in an invalid state then that probably won't work).

Signed-off-by: Kyle Moffett <Kyle.D.Moffett at boeing.com>
Cc: Shinya Kuribayashi <skuribay at pobox.com>
---
 arch/mips/cpu/cpu.c            |   13 -------------
 arch/mips/include/asm/reboot.h |   14 --------------
 board/incaip/incaip.c          |    4 ++--
 board/micronas/vct/vct.c       |    2 +-
 board/purple/purple.c          |   16 +++++++++++++---
 board/tb0229/tb0229.c          |   16 +++++++++++++---
 6 files changed, 29 insertions(+), 36 deletions(-)
 delete mode 100644 arch/mips/include/asm/reboot.h

diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c
index 3ae397c..37ed1f1 100644
--- a/arch/mips/cpu/cpu.c
+++ b/arch/mips/cpu/cpu.c
@@ -26,7 +26,6 @@
 #include <netdev.h>
 #include <asm/mipsregs.h>
 #include <asm/cacheops.h>
-#include <asm/reboot.h>
 
 #define cache_op(op,addr)						\
 	__asm__ __volatile__(						\
@@ -38,18 +37,6 @@
 	:								\
 	: "i" (op), "R" (*(unsigned char *)(addr)))
 
-void __attribute__((weak)) _machine_restart(void)
-{
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	_machine_restart();
-
-	fprintf(stderr, "*** reset failed ***\n");
-	return 0;
-}
-
 void flush_cache(ulong start_addr, ulong size)
 {
 	unsigned long lsize = CONFIG_SYS_CACHELINE_SIZE;
diff --git a/arch/mips/include/asm/reboot.h b/arch/mips/include/asm/reboot.h
deleted file mode 100644
index 978d206..0000000
--- a/arch/mips/include/asm/reboot.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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 */
diff --git a/board/incaip/incaip.c b/board/incaip/incaip.c
index 3b30970..7eaf10e 100644
--- a/board/incaip/incaip.c
+++ b/board/incaip/incaip.c
@@ -27,13 +27,13 @@
 #include <asm/addrspace.h>
 #include <asm/inca-ip.h>
 #include <asm/io.h>
-#include <asm/reboot.h>
 
 extern uint incaip_get_cpuclk(void);
 
-void _machine_restart(void)
+int __board_restart(void)
 {
 	*INCA_IP_WDT_RST_REQ = 0x3f;
+	return -1;
 }
 
 static ulong max_sdram_size(void)
diff --git a/board/micronas/vct/vct.c b/board/micronas/vct/vct.c
index 7fc3507..06b7042 100644
--- a/board/micronas/vct/vct.c
+++ b/board/micronas/vct/vct.c
@@ -56,7 +56,7 @@ int board_early_init_f(void)
 	return 0;
 }
 
-void _machine_restart(void)
+void __board_restart(void)
 {
 	reg_write(DCGU_EN_WDT_RESET(DCGU_BASE), DCGU_MAGIC_WDT);
 	reg_write(WDT_TORR(WDT_BASE), 0x00);
diff --git a/board/purple/purple.c b/board/purple/purple.c
index 4e9e700..2ce9715 100644
--- a/board/purple/purple.c
+++ b/board/purple/purple.c
@@ -30,7 +30,6 @@
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/cacheops.h>
-#include <asm/reboot.h>
 
 #include "sconsole.h"
 
@@ -54,11 +53,22 @@ extern int	asc_serial_getc		(void);
 extern int	asc_serial_tstc		(void);
 extern void	asc_serial_setbrg	(void);
 
-void _machine_restart(void)
+int __board_restart(void)
 {
+	/* Jump to software-reset vector */
 	void (*f)(void) = (void *) 0xbfc00000;
-
 	f();
+	return 0;
+}
+
+/*
+ * The __board_restart() just jumps back to flash, which isn't safe to do in
+ * emergency conditions.  Since we don't have anything better to do, just
+ * fall through into the default hang().
+ */
+void __board_emergency_restart(void)
+{
+	return;
 }
 
 static void sdram_timing_init (ulong size)
diff --git a/board/tb0229/tb0229.c b/board/tb0229/tb0229.c
index d3f05b2..4684574 100644
--- a/board/tb0229/tb0229.c
+++ b/board/tb0229/tb0229.c
@@ -13,14 +13,24 @@
 #include <command.h>
 #include <asm/addrspace.h>
 #include <asm/io.h>
-#include <asm/reboot.h>
 #include <pci.h>
 
-void _machine_restart(void)
+int __board_restart(void)
 {
+	/* Jump to software-reset vector */
 	void (*f)(void) = (void *) 0xbfc00000;
-
 	f();
+	return 0;
+}
+
+/*
+ * The __board_restart() just jumps back to flash, which isn't safe to do in
+ * emergency conditions.  Since we don't have anything better to do, just
+ * fall through into the default hang().
+ */
+void __board_emergency_restart(void)
+{
+	return;
 }
 
 #if defined(CONFIG_PCI)
-- 
1.7.2.3



More information about the U-Boot mailing list