[U-Boot] [PATCH] ARM: atmel: at91sam9m10g45ek: enable SPL

Andreas Bießmann andreas.devel at googlemail.com
Fri Jan 16 10:10:03 CET 2015


Hi Bo,

just a short review, more will follow this weekend.

On 01/16/2015 03:53 AM, Bo Shen wrote:
> Supports boot up from NAND flash with software ECC eanbled.
> And supports boot up from SD/MMC card with FAT file system.
> 
> As the boot from SD/MMC card with FAT file system, the BSS
> segment is too big to fit into SRAM, so, use the lds to put
> it into SDRAM. So, we need to initialize the SDRAM as soon
> as possible. Borrow the low level init code from
> <arm/arm/cpu/armv7/lowlevel_init.S> for this purpose.
> 
> As there is a little change, which need lowlevel init, so
> also change taurus board based on at91sam9260, corvus board
> based on at91sam9g45.
> (CONFIG_SPL_STACK is replaced by CONFIG_SYS_INIT_SP_ADDR)
> 
> Signed-off-by: Bo Shen <voice.shen at atmel.com>
> ---
> 
>  arch/arm/Kconfig                                |  1 +
>  arch/arm/cpu/arm926ejs/at91/Makefile            |  4 ++
>  arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S | 37 ++++++++++++
>  arch/arm/cpu/at91-common/spl_at91.c             |  7 +--
>  arch/arm/cpu/at91-common/u-boot-spl-arm9.lds    | 48 +++++++++++++++
>  board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 80 +++++++++++++++++++++++++
>  configs/at91sam9m10g45ek_mmc_defconfig          |  5 +-
>  configs/at91sam9m10g45ek_nandflash_defconfig    |  5 +-
>  include/configs/at91sam9m10g45ek.h              | 65 ++++++++++++++++++++
>  include/configs/corvus.h                        |  7 ++-
>  include/configs/taurus.h                        |  7 ++-
>  11 files changed, 256 insertions(+), 10 deletions(-)
>  create mode 100644 arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
>  create mode 100644 arch/arm/cpu/at91-common/u-boot-spl-arm9.lds
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 5eb1d03..f4788c6 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -141,6 +141,7 @@ config TARGET_AT91SAM9263EK
>  config TARGET_AT91SAM9M10G45EK
>  	bool "Support at91sam9m10g45ek"
>  	select CPU_ARM926EJS
> +	select SUPPORT_SPL
>  
>  config TARGET_AT91SAM9N12EK
>  	bool "Support at91sam9n12ek"
> diff --git a/arch/arm/cpu/arm926ejs/at91/Makefile b/arch/arm/cpu/arm926ejs/at91/Makefile
> index 698a28d..238434b 100644
> --- a/arch/arm/cpu/arm926ejs/at91/Makefile
> +++ b/arch/arm/cpu/arm926ejs/at91/Makefile
> @@ -25,5 +25,9 @@ obj-y	+= reset.o
>  obj-y	+= timer.o
>  
>  ifndef CONFIG_SKIP_LOWLEVEL_INIT
> +ifdef CONFIG_SPL_BUILD
> +obj-y	+= spl_lowlevel_init.o
> +else
>  obj-y	+= lowlevel_init.o
>  endif
> +endif

I'm fine with having two variants of lowlevel_init for a time, but we
should consolidate this and use C-style initialisation of SDRAM and
stuff for the other armv5 at91 devices in future. AFAIK the
a/a/c/arm926ejs/at91/lowlevel_init.S is mainly used for NOR Flash boots,
so using the SPL code (but not necessarily the two binary mechanism) for
the NOR Flash boots in future is appreciated.

> diff --git a/arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S b/arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
> new file mode 100644
> index 0000000..f1b2ec9
> --- /dev/null
> +++ b/arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
> @@ -0,0 +1,37 @@
> +/*
> + * A lowlevel_init function that sets up the stack to call a C function to
> + * perform further init.
> + *
> + * (C) Copyright 2010
> + * Texas Instruments, <www.ti.com>
> + *
> + * Author :
> + *	Aneesh V	<aneesh at ti.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <asm-offsets.h>
> +#include <config.h>
> +#include <linux/linkage.h>
> +
> +ENTRY(lowlevel_init)
> +	/*
> +	 * Setup a temporary stack
> +	 */
> +	ldr	sp, =CONFIG_SYS_INIT_SP_ADDR
> +	bic	sp, sp, #7 /* 8-byte alignment for ABI compliance */
> +
> +	ldr	r9, =gdata

I remember some patches removing the SPL gdata stuff, is that true?

> +
> +	/*
> +	 * Save the old lr(passed in ip) and the current lr to stack
> +	 */
> +	push	{ip, lr}
> +
> +	/*
> +	 * go setup pll, mux, memory
> +	 */
> +	bl	s_init
> +	pop	{ip, pc}
> +ENDPROC(lowlevel_init)

Rest of this patch will be reviewed later.

Best regards

Andreas Bießmann



More information about the U-Boot mailing list