[U-Boot] SAMA5D2 xplained SD/eMMC boot

Marek Vasut marex at denx.de
Tue Apr 26 14:42:40 CEST 2016


On 04/26/2016 03:47 AM, Yang, Wenyou wrote:
> 
> 
>> -----Original Message-----
>> From: Marek Vasut [mailto:marex at denx.de]
>> Sent: 2016年4月25日 18:30
>> To: Yang, Wenyou <Wenyou.Yang at atmel.com>
>> Cc: u-boot at lists.denx.de
>> Subject: Re: SAMA5D2 xplained SD/eMMC boot
>>
>> On 04/25/2016 02:55 AM, Yang, Wenyou wrote:
>>> Hi Marek,
>>>
>>>> -----Original Message-----
>>>> From: Marek Vasut [mailto:marex at denx.de]
>>>> Sent: 2016年4月22日 20:18
>>>> To: Yang, Wenyou <Wenyou.Yang at atmel.com>
>>>> Cc: u-boot at lists.denx.de
>>>> Subject: Re: SAMA5D2 xplained SD/eMMC boot
>>>>
>>>> On 04/22/2016 02:54 AM, Yang, Wenyou wrote:
>>>>> Hi Marek,
>>>>
>>>> Hi!
>>>>
>>>>>> -----Original Message-----
>>>>>> From: Marek Vasut [mailto:marex at denx.de]
>>>>>> Sent: 2016年4月21日 10:59
>>>>>> To: Yang, Wenyou <Wenyou.Yang at atmel.com>
>>>>>> Cc: u-boot at lists.denx.de
>>>>>> Subject: Re: SAMA5D2 xplained SD/eMMC boot
>>>>>>
>>>>>> On 04/21/2016 04:46 AM, Yang, Wenyou wrote:
>>>>>>> Hi,
>>>>>>
>>>>>> Hi!
>>>>>>
>>>>>> [...]
>>>>>> pile of unnecessary email headers redacted.
>>>>>> [...]
>>>>>>
>>>>>>>>>>>>>> Hi!
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I've been playing around with latest mainline u-boot on
>>>>>>>>>>>>>> sama5d2 xplained ultra. I noticed that if I want to boot
>>>>>>>>>>>>>> the board from SD card (SDHCI1), the board will indeed load
>>>>>>>>>>>>>> the SPL from it, but SPL will try to load u-boot.img from
>>>>>>>>>>>>>> eMMC
>>>>>>>>>>>>>> (SDHCI0) and fail, as my eMMC is blank.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Yes, there is some issue to load u-boot.img. I found there
>>>>>>>>>>>>> is something to do on
>>>>>>>>>>>> sdhci.c.
>>>>>>>>>>>>>
>>>>>>>>>>>>> You can try this branch, it should works.
>>>>>>>>>>>>>
>>>>>>>>>>>>> https://github.com/linux4sam/u-boot-at91/commits/u-boot-2016
>>>>>>>>>>>>> .0
>>>>>>>>>>>>> 3-
>>>>>>>>>>>>> at
>>>>>>>>>>>>> 91
>>>>>>>>>>>>
>>>>>>>>>>>> I am not interested in using non-mainline stuff. Do you have
>>>>>>>>>>>> any particular patch/commit which I can refer to ? I do not
>>>>>>>>>>>> think this has anything to do with sdhci.c driver at all, it
>>>>>>>>>>>> has to do with detecting the boot device from which SPL was
>>>>>>>>>>>> started and loading u-boot.img from the same boot device
>>>>>>>>>>>> instead of always using
>>>>>> SDHCI0.
>>>>>>>>>>>
>>>>>>>>>>> I will test the mainline code. I will let you know when I get something.
>>>>>>>>>>
>>>>>>>>>> OK.
>>>>>>>>>>
>>>>>>>>>> Does the SoC have any sort of register which lists the current
>>>>>>>>>> boot
>>>> device ?
>>>>>>>>>
>>>>>>>>> In this SoC, there is not register to list the current boot device.
>>>>>>>>
>>>>>>>> And thus, it is not possible to detect at runtime from which
>>>>>>>> device the SoC booted and thus load u-boot.img from the same device.
>> Correct ?
>>>>>>>
>>>>>>> Yes,
>>>>>>
>>>>>> Ha, thanks for confirming.
>>>>>
>>>>> Sorry, can I correct what I said yesterday?
>>>>
>>>> What if I said "no" ? :-)
>>>>
>>>>> There is a register to list the boot information exported by ROMCode.
>>>>>
>>>>> The boot information is stored in R4 register when the ROMCode jumps
>>>>> to the
>>>> bootstrap.
>>>>
>>>> Ha, so the U-Boot SPL can save the r4 register early in the boot and
>>>> extract the boot device from it. That's neat. Thanks!
>>>>
>>>>> Here is the contents definitions R4 on the SAMA5D2 (improved
>>>>> compared to old
>>>> MPUs to take care of IOSet features).
>>>>
>>>> Is this stuff somewhere in the SAMA5Dx datasheet ? It'd be nice to
>>>> know/have this information for other SAMA5Dx too (d3 and d4).
>>>
>>> It seems it is not included in the in the SAMA5Dx datasheet.
>>
>> So where did you get these numbers from ?
> 
> Yes, it is not included in the datasheet now. We are not recommend to use them.
> 
> If it is helpful for you,  please reference the previous mail.

It is helpful, I sent a patch for SAMA5D2 which makes it behave sane.
I will have to battle SAMA5D4 board soon, so I will most likely extend
that patch for SAMA5D4.

>>
>>> This feature is available since AT91SAM9G45, inclusive d3 and d4.
>>
>> Oh cool, so the numbers are the same for all these chips ?
> 
> Yes, basically same, only d2 includes additional ioset information.

OK, the IOSET is not interesting for now.

It'd be cool to have this documented somewhere :)

Best regards,
Marek Vasut


More information about the U-Boot mailing list