diff mbox

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

Message ID 1300208664-18339-4-git-send-email-Kyle.D.Moffett@boeing.com
State Superseded
Headers show

Commit Message

Kyle Moffett March 15, 2011, 5:04 p.m. UTC
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@boeing.com>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <kumar.gala@freescale.com>

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

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

Comments

Wolfgang Denk March 15, 2011, 7:12 p.m. UTC | #1
Dear Kyle Moffett,

In message <1300208664-18339-4-git-send-email-Kyle.D.Moffett@boeing.com> you wrote:
> 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@boeing.com>
> Cc: Andy Fleming <afleming@gmail.com>
> Cc: Kumar Gala <kumar.gala@freescale.com>

Please run checkpatch on your submissions!

>  #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;

WARNING: space prohibited between function name and open parenthesis '('
#114: FILE: arch/powerpc/cpu/mpc85xx/cpu.c:215:
+int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

> -	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[])
> +{

WARNING: space prohibited between function name and open parenthesis '('
#126: FILE: arch/powerpc/cpu/mpc85xx/cpu.c:232:
+int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

> +#endif
> +
> +

Please don't add trailing empty lines.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index 49ea6cc..75e4aab 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
+
+
 
 
 /*