[U-Boot] [PATCH 1/3] arm: spl: Fix SPL booting for OMAP3

Albert ARIBAUD albert.u.boot at aribaud.net
Thu Jun 20 18:42:09 CEST 2013


Hi Stefan,

On Fri, 14 Jun 2013 10:54:59 +0200, Stefan Roese <sr at denx.de> wrote:

> SPL already has GD set to the correct location (in s_init), we mustn't
> move it around now since some data (clocks etc) is already present.
> 
> This error was detected on the SPL port for the Compulab CM-T35 board
> (OMAP3530).
> 
> Signed-off-by: Stefan Roese <sr at denx.de>
> Cc: Tom Rini <trini at ti.com>
> Cc: Albert ARIBAUD <albert.u.boot at aribaud.net>
> ---
>  arch/arm/lib/crt0.S | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
> index a9657d1..b05f66a 100644
> --- a/arch/arm/lib/crt0.S
> +++ b/arch/arm/lib/crt0.S
> @@ -85,7 +85,13 @@ ENTRY(_main)
>  	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
>  	sub	sp, #GD_SIZE	/* allocate one GD above SP */
>  	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
> +#if !defined(CONFIG_SPL_BUILD)
> +/*
> + * SPL already has GD set to the correct location (in s_init), we mustn't
> + * move it around now since some data (clocks etc) is already present.
> + */
>  	mov	r8, sp		/* GD is above SP */
> +#endif
>  	mov	r0, #0
>  	bl	board_init_f
>  

NAK in this form. I don't want gd to be set "somewhere in the code"
depending on the actual target; I want it set in crt0.S, period.

I see there are several locations in ARM architecture or board code
which set up GD themselves in the same manner as OMAP does. Luckily all
these locations set it to the same value, the address of gdata.

The correct fix (read: the one I won't NAK) is thus to add a #else
clause in the code above, in which r8 will be set to =gdata, and to
remove the corresponding assignments in the various places where they
reside.

(also, maybe not all SPLs want GD in gdata rather than on the stack;
for instance, those SPLs loaded in DDR by some ROM code. Therefore, the
whole gdata thing could possibly be placed under a specific condition
such as CONFIG_SPL_GD_GLOBAL)

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list