[U-Boot] [PATCH 19/21] sparc: Unify duplicate reset code

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


Both Sparc processor variants have the same do_reset() and reset_cpu()
function implementations.  Furthermore, the only caller of the
reset_cpu() function on Sparc is do_reset().

To simplify and prepare for Sparc generic-restart support this patch
removes 26 lines of code by merging the functions together and moving
them into common code.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett at boeing.com>
Cc: Daniel Hellstrom <daniel at gaisler.com>
---
 arch/sparc/cpu/leon2/cpu.c |   18 ------------------
 arch/sparc/cpu/leon3/cpu.c |   19 -------------------
 arch/sparc/lib/board.c     |   11 +++++++++++
 3 files changed, 11 insertions(+), 37 deletions(-)

diff --git a/arch/sparc/cpu/leon2/cpu.c b/arch/sparc/cpu/leon2/cpu.c
index 46512c7..7d9ae4a 100644
--- a/arch/sparc/cpu/leon2/cpu.c
+++ b/arch/sparc/cpu/leon2/cpu.c
@@ -40,24 +40,6 @@ int checkcpu(void)
 
 /* ------------------------------------------------------------------------- */
 
-void cpu_reset(void)
-{
-	/* Interrupts off */
-	disable_interrupts();
-
-	/* jump to restart in flash */
-	_reset_reloc();
-}
-
-int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
-{
-	cpu_reset();
-
-	return 1;
-}
-
-/* ------------------------------------------------------------------------- */
-
 #ifdef CONFIG_GRETH
 int cpu_eth_init(bd_t *bis)
 {
diff --git a/arch/sparc/cpu/leon3/cpu.c b/arch/sparc/cpu/leon3/cpu.c
index a1646e2..58c97a7 100644
--- a/arch/sparc/cpu/leon3/cpu.c
+++ b/arch/sparc/cpu/leon3/cpu.c
@@ -41,25 +41,6 @@ int checkcpu(void)
 	return 0;
 }
 
-/* ------------------------------------------------------------------------- */
-
-void cpu_reset(void)
-{
-	/* Interrupts off */
-	disable_interrupts();
-
-	/* jump to restart in flash */
-	_reset_reloc();
-}
-
-int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
-{
-	cpu_reset();
-
-	return 1;
-
-}
-
 u64 flash_read64(void *addr)
 {
 	return __raw_readq(addr);
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index 386cd04..128ece7 100644
--- a/arch/sparc/lib/board.c
+++ b/arch/sparc/lib/board.c
@@ -445,4 +445,15 @@ void hang(void)
 	for (;;) ;
 }
 
+int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+{
+	/* Interrupts off */
+	disable_interrupts();
+
+	/* jump to restart in flash */
+	_reset_reloc();
+
+	return 1;
+}
+
 /************************************************************************/
-- 
1.7.2.3



More information about the U-Boot mailing list