[U-Boot] [PATCH v7 3/4] mpc85xx: Add a board-specific restart hook

Kyle Moffett Kyle.D.Moffett at boeing.com
Mon Mar 28 17:35:50 CEST 2011


The HWW-1U-1A board needs to be able to override the "reset" command due
to hardware design limitations.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett at boeing.com>
Cc: Andy Fleming <afleming at gmail.com>
Cc: Kumar Gala <kumar.gala at freescale.com>

--
Changelog:
v2: Removed in favor of more involved reset rework
v6: Resurrected again (the more involved rework was NAKed)
v7: Fixed remaining checkpatch errors

 arch/powerpc/cpu/mpc85xx/cpu.c |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index 49ea6cc..6776468 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -203,11 +203,17 @@ int checkcpu (void)
 
 /* ------------------------------------------------------------------------- */
 
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+/* Board-specific reset stub */
+__attribute__((__weak__))
+int __board_restart(void)
 {
-/* Everything after the first generation of PQ3 parts has RSTCR */
+	return 0;
+}
+
 #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
     defined(CONFIG_MPC8555) || defined(CONFIG_MPC8560)
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
 	unsigned long val, msr;
 
 	/*
@@ -221,14 +227,25 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	val = mfspr(DBCR0);
 	val |= 0x70000000;
 	mtspr(DBCR0,val);
+}
 #else
-	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	/* Everything after the first generation of PQ3 parts has RSTCR */
+	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+	/* Allow boards to override the reset */
+	int err = __board_restart();
+	if (err)
+		return err;
+
 	out_be32(&gur->rstcr, 0x2);	/* HRESET_REQ */
 	udelay(100);
-#endif
-
 	return 1;
 }
+#endif
+
+
 
 
 /*
-- 
1.7.2.5



More information about the U-Boot mailing list