[U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
Tom Rini
trini at ti.com
Wed Jul 11 13:43:19 CEST 2012
On 07/11/2012 04:05 AM, Sughosh Ganu wrote:
> On Wed Jul 11, 2012 at 03:46:46AM -0700, Tom Rini wrote:
>> On 07/11/2012 03:40 AM, Sughosh Ganu wrote:
>>> On Wed Jul 11, 2012 at 01:19:40AM -0700, Tom Rini wrote:
>>>> On 07/10/2012 11:38 PM, Sughosh Ganu wrote:
>>>>> On Tue Jul 10, 2012 at 11:20:53PM +0400, Mikhail Kshevetskiy wrote:
>>>>>> On Wed, 11 Jul 2012 00:09:06 +0530
>>>>>> Sughosh Ganu <urwithsughosh at gmail.com> wrote:
>>>>>>>> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>>>> b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
>>>>>>>> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>>>> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>>>
>>>>>>> <snip>
>>>>>>>
>>>>>>>> void board_init_r(gd_t *id, ulong dummy)
>>>>>>>> {
>>>>>>>> -#ifdef CONFIG_SPL_NAND_LOAD
>>>>>>>> - nand_init();
>>>>>>>> - puts("Nand boot...\n");
>>>>>>>> - nand_boot();
>>>>>>>> -#endif
>>>>>>>> -#ifdef CONFIG_SPL_SPI_LOAD
>>>>>>>> - mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
>>>>>>>> - CONFIG_SYS_MALLOC_LEN);
>>>>>>>> + u32 boot_device;
>>>>>>>> + void (*uboot)(void) __noreturn;
>>>>>>>> +
>>>>>>>> + mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
>>>>>>>> + CONFIG_SYS_SPL_MALLOC_SIZE);
>>>>>>>
>>>>>>> We do not need any heap for the spl on the hawkboard, so can you
>>>>>>> please explain why do we need the heap allocation for all spl
>>>>>>> images. Can't this be made configurable.
>>>>>>
>>>>>> this is needed at least for:
>>>>>> * MMC support
>>>>>> * SPI support
>>>>>> * gunzip support (see next patch)
>>>>>>
>>>>>> it can be configurable, but is it reasonable?
>>>>>
>>>>> I would think so -- i guess it should be fine to include this only for
>>>>> boards/configurations that actually need the heap.
>>>>
>>>> Shouldn't "load u-boot.img from vfat SD card" be a common case at least
>>>> for developers?
>>>
>>> Yes, it should be, but what i meant was that things that are not
>>> needed for certain boards or configurations need not be made
>>> common. Like in this case, why does setting up a heap, which is not
>>> needed at least on my board need to be common for all spl images. If a
>>> particular board/configuration needs it, then use it.
>>
>> Wouldn't load from SD be a common case on hawkboard, esp once the ones
>> that can load from SD, from the ROM become more available?
>
> Yes, loading from SD could be supported on any board in the future,
> but in that case, should it not be just a matter of adding something
> like CONFIG_SPL_MMC_LOAD to the board's config file.
Yes, along with adding the defines for the heap. And unless you end up
being severely space constrained for the SPL file, it's usually the case
you build in support for a few modes, when it's possible to detect at
run time where you came from.
>> I'm fine saying that we should wrap the call around an #if, but I
>> would expect it to be set in the common case and only not set in
>> custom production boards.
>
> Correct, so all that is needed for SD/MMC loading can still be kept
> separate from, say nand load in the spl.c file, isn't it. So if sd/mmc
> spl load needs heap to be set up, can't it be done only for that
> case.
Yes, but we don't want to have N locations that set up the heap. We
want one location that will, if the board has defined a heap area, we
set it up. Or to put it another way, calling mem_malloc_init isn't part
of the mmc boot-flow, it's part of the general boot flow.
--
Tom
More information about the U-Boot
mailing list