diff mbox

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

Message ID 1301326551-24996-4-git-send-email-Kyle.D.Moffett@boeing.com
State Changes Requested
Delegated to: Kumar Gala
Headers show

Commit Message

Kyle Moffett March 28, 2011, 3:35 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)
v7: Fixed remaining checkpatch errors

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

Comments

Kumar Gala Oct. 16, 2011, 3:22 p.m. UTC | #1
On Mar 28, 2011, at 10:35 AM, Kyle Moffett 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>
> 
> --
> 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(-)

What happened to more generic reset cleanup?

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

This concerns me because it means those cpu's don't support __board_restart(), we should be consistent.

> 	/*
> @@ -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
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

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
+
+
 
 
 /*