[U-Boot] [PATCH 1/7] mpc85xx: Support a board-specific processor reset routines

Wolfgang Denk wd at denx.de
Mon Feb 21 21:59:18 CET 2011


Dear Kyle Moffett,

In message <1298311199-18775-2-git-send-email-Kyle.D.Moffett at boeing.com> you wrote:
> Some board models (such as the submitted P2020-based HWW-1U-1A hardware)
> need specialized code to run when a reset is requested to ensure proper
> synchronization with other hardware.
> 
> In order to facilitate such board ports, we add a board_reset_r()
> routine which is called from the do_reset() command function instead of
> directly poking at the MPC85xx "RSTCR" (reset control) register.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett at boeing.com>
> ---
>  arch/powerpc/cpu/mpc85xx/cpu.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
> index 1aad2ba..dbc662f 100644
> --- a/arch/powerpc/cpu/mpc85xx/cpu.c
> +++ b/arch/powerpc/cpu/mpc85xx/cpu.c
> @@ -204,8 +204,10 @@ int checkcpu (void)
>  
>  int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  {
> -/* Everything after the first generation of PQ3 parts has RSTCR */
> -#if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
> +#if defined(CONFIG_BOARD_RESET_R)
> +	extern void board_reset_r(void);
> +	board_reset_r();
> +#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
>      defined(CONFIG_MPC8555) || defined(CONFIG_MPC8560)
>  	unsigned long val, msr;

Please implement without #ifdef's using a weak function - see
arch/powerpc/cpu/mpc86xx/cpu.c for an example.  Actually you might
want to facto this out into common code.

Side note: don't use ever "extern" function declarations in the code;
use proper prototype declarations in some header file instead.

> @@ -221,6 +223,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  	val |= 0x70000000;
>  	mtspr(DBCR0,val);
>  #else
> +	/* Everything after the first generation of PQ3 parts has RSTCR */
>  	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);

Note that this declaration is now basicy in the middle of code, which
is ugly at best.

What is the "volatile" needed for?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An Elephant is a mouse with an Operating System.              - Knuth


More information about the U-Boot mailing list