From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ARM: atmel: at91sam9m10g45ek: enable SPL
Date: Mon, 19 Jan 2015 07:07:18 +0100 [thread overview]
Message-ID: <54BC9F16.6090704@denx.de> (raw)
In-Reply-To: <54BC5FF9.6010109@atmel.com>
Hello Bo,
Am 19.01.2015 02:38, schrieb Bo Shen:
> Hi Heiko,
>
> On 01/16/2015 07:35 PM, Heiko Schocher wrote:
>> Hello Bo
>>
>> Am 16.01.2015 03:53, schrieb Bo Shen:
>>> 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@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
>>
>> Acked-by: Heiko Schocher <hs@denx.de>
>
> Thanks.
>
>> but it does not boot on the corvus board ... please add this fix to
>> your patch:
>>
>> diff --git a/include/configs/corvus.h b/include/configs/corvus.h
>> index efc8ce5..dc25d95 100644
>> --- a/include/configs/corvus.h
>> +++ b/include/configs/corvus.h
>> @@ -90,7 +90,7 @@
>> #define CONFIG_SYS_SDRAM_SIZE 0x08000000
>>
>> #ifdef CONFIG_SPL_BUILD
>> -#define CONFIG_SYS_INIT_SP_ADDR 0x310000
>> +#define CONFIG_SYS_INIT_SP_ADDR (16 * 1024)
>> #else
>> #define CONFIG_SYS_INIT_SP_ADDR \
>> (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
>>
>>
>> Tested your patch also on the taurus board, there it boots fine!
>>
>> so, after you fixed the corvus board, you can add my:
>> Tested-by: Heiko Schocher <hs@denx.de>
>
> Thanks, I will add this fix into next version.
Thanks!
>> Thanks! And one question ...
>>
>> [...]
>>> 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@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
>>
>> Could we use here a new define (saying CONFIG_SYS_INIT_SP_LOWLEVEL)?
>>
>> Benefit would be, we can setup first the stack in sram, and after RAM
>> init, which is done with your patch very early, we can set the stack
>> with CONFIG_SYS_INIT_SP_ADDR into RAM!
>>
>> With using CONFIG_SYS_INIT_SP_ADDR here, the stack gets set twice
>> to CONFIG_SYS_INIT_SP_ADDR ... I just try to get SPL on an atsam9260
>> based board working with only 4k sram ... so it would be nice to
>> have stack also optionally in RAM ... but we have problems with the
>> debugger adapter on the board ... so I have to wait some more days to
>> try this part ...
>
> This just for the at91sam9260 based boards, not for others. Or else, we also need to add this definition for other boards. Can you do the following check?
>
> #ifdef CONFIG_SYS_INIT_SP_LOWLEVEL
> ldr sp, =CONFIG_SYS_INIT_SP_LOWLEVEL
> #else
> ldr sp, =CONFIG_SYS_INIT_SP_ADDR
> #endif
>
> If it is acceptable, can you add through your patches, as I my patch nowhere will use it.
Or we check if "CONFIG_SYS_INIT_SP_LOWLEVEL" is defined, if not
we set default to:
#define CONFIG_SYS_INIT_SP_LOWLEVEL CONFIG_SYS_INIT_SP_ADDR
so, something like:
diff --git a/arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S b/arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
index f1b2ec9..ed9adc7 100644
--- a/arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
+++ b/arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
@@ -15,11 +15,15 @@
#include <config.h>
#include <linux/linkage.h>
+#ifndef CONFIG_SYS_INIT_SP_ADDR_LOWLEVEL
+#define CONFIG_SYS_INIT_SP_ADDR_LOWLEVEL CONFIG_SYS_INIT_SP_ADDR
+#endif
+
ENTRY(lowlevel_init)
/*
* Setup a temporary stack
*/
- ldr sp, =CONFIG_SYS_INIT_SP_ADDR
+ ldr sp, =CONFIG_SYS_INIT_SP_ADDR_LOWLEVEL
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
ldr r9, =gdata
so we do not need to adapt existing boards, just add an entry
in README, that we have such a possibility now for at91 boards ...
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
prev parent reply other threads:[~2015-01-19 6:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 2:53 [U-Boot] [PATCH] ARM: atmel: at91sam9m10g45ek: enable SPL Bo Shen
2015-01-16 9:10 ` Andreas Bießmann
2015-01-16 9:30 ` Bo Shen
2015-01-16 10:16 ` Andreas Bießmann
2015-01-19 1:41 ` Bo Shen
2015-01-19 6:15 ` Heiko Schocher
2015-01-19 19:32 ` Simon Glass
2015-01-16 11:35 ` Heiko Schocher
2015-01-19 1:38 ` Bo Shen
2015-01-19 6:07 ` Heiko Schocher [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54BC9F16.6090704@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.