From: <Eugen.Hristev@microchip.com>
To: <clement.leger@bootlin.com>
Cc: <Ludovic.Desroches@microchip.com>, <u-boot@lists.denx.de>,
<Nicolas.Ferre@microchip.com>, <thomas.petazzoni@bootlin.com>,
<Claudiu.Beznea@microchip.com>
Subject: Re: [PATCH v7 4/4] configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER
Date: Thu, 31 Mar 2022 07:53:09 +0000 [thread overview]
Message-ID: <7e2d1b24-67a8-fbf2-d6b2-be7be2cbfbf5@microchip.com> (raw)
In-Reply-To: <20220331094034.16883349@fixe.home>
On 3/31/22 10:40 AM, Clément Léger wrote:
> Le Thu, 31 Mar 2022 05:59:02 +0000,
> <Eugen.Hristev@microchip.com> a écrit :
>
>> On 3/30/22 6:49 PM, Clément Léger wrote:
>>> Le Tue, 22 Mar 2022 13:35:08 +0100,
>>> Clément Léger <clement.leger@bootlin.com> a écrit :
>>>
>>>> Le Tue, 22 Mar 2022 11:18:39 +0000,
>>>> <Eugen.Hristev@microchip.com> a écrit :
>>>>
>>>
>>> [...]
>>>
>>>>>
>>>>> Could not initialize timer (err -22)
>>>>>
>>>>> ...
>>>>>
>>>>>
>>>>>
>>>>> Could you investigate this please ?
>>>>
>>>> Hi Eugen,
>>>>
>>>> Ok, I'll try to debug that !
>>>
>>> Hi Eugen, while debugging it, I found that there was actually one major
>>> flaw. The clock that I used was the GLCK. If only this clock is
>>> enabled, the TCB can not work, the tcb0_clk must also be enabled for the
>>> TCB to start counting. It worked on my side because I forgot that I had
>>> a quirk in OP-TEE that was enabling the clocks before starting U-Boot.
>>> Without that, it actually could not work.
>>>
>>> Since the tcb0_clk is needed, I switched the driver to use this one
>>> only and it works well on a "bare" setup (ie without OP-TEE). I even
>>> think it could not work with the tcb0_gclk since this one does not
>>> correctly handles the case when the parent clock is the slow_clk (which
>>> might be the case after booting) and in this case, will return 0 as
>>> rate (this is by the way supported in your CCF branch).
>>>
>>> Anyway, I fixed the driver to use the tcb0_clk and thus it should work
>>> much better. I will send a V8 and it should work with U-Boot and the
>>> SPL.
>>>
>>> By the way, do you have any documentation which explains how to use
>>> U-Boot SPL on sama5d2_xplained (or other) board ?
>>
>> Hi Clement,
>>
>> I don't have any documentation at hand, but what I can say in a few
>> words is that once you build the SPL, you should have a file
>> spl/boot.bin and this binary should replace our stage2 at91 bootloader
>> at91bootstrap.
>>
>> Unlike at91bootstrap, the SPL has all the drivers inside and can boot
>> from all supported media, however, SPL will read a dedicated CPU
>> register where the stage1 has written some bits representing the index
>> of the NVM *used to copy the boot.bin from* . The SPL will then attempt
>> to read the u-boot.bin from the same media. (you can alter the file name
>> in defconfig ).
>
> Ok, I successfully booted a SPL < 64k from SD card by disabling MMC
> support after fixing the TCB driver:
>
> ;4��K3K{�KOp�C�0�
> U-Boot SPL 2022.04-rc3-00023-gf9da67b41a-dirty (Mar 31 2022 - 09:23:48
> +0200)
> SPL: Unsupported Boot Device!
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
>
> However, as soon as the size is greater than 64K, it does not boot
> anymore. Looks like you already had the same problem. Do you have any
> more documentation which would allow me to boot a u-boot.bin file from
> this SPL easily ?
Hi,
If size is above 64k, it won't fit into the SRAM, thus the stage1 won't
copy it at all, and abort booting it.
For arm926 there is a build time check for the size in the lds linker
script, but it looks like for the armv7 it's missing... No idea why , if
it was removed, I haven't checked.
I don't have any more documentation.
>
> By the way, since u-boot,dm-pre-reloc is needed in the device-tree to
> be used with the SPL, I will probably add them to my series
> (property which by the way is missing for the PIT timer
> device-tree node).
Yes, definitely. You can send a prequel or separate patch to add this to
the PIT timer if you like.
And have this property for your node yes.
Normally all u-boot properties should be in a separate dtsi file, but
this is an old DT in uboot so I think it's fine to have it in the base DT.
Eugen
>
> Thanks,
>
> Clément
>
> --
> Clément Léger,
> Embedded Linux and Kernel engineer at Bootlin
> https://bootlin.com
>
prev parent reply other threads:[~2022-03-31 7:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 9:35 [PATCH v7 0/4] add TCB driver for sama5d2 Clément Léger
2022-03-11 9:35 ` [PATCH v7 1/4] timer: atmel_tcb_timer: add atmel_tcb driver Clément Léger
2022-03-11 9:35 ` [PATCH v7 2/4] ARM: dts: at91: sama5d2: add AIC node Clément Léger
2022-03-11 9:35 ` [PATCH v7 3/4] ARM: dts: at91: sama5d2: add TCB node Clément Léger
2022-03-11 9:35 ` [PATCH v7 4/4] configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER Clément Léger
2022-03-22 11:18 ` Eugen.Hristev
2022-03-22 12:35 ` Clément Léger
2022-03-30 15:49 ` Clément Léger
2022-03-31 5:59 ` Eugen.Hristev
2022-03-31 7:40 ` Clément Léger
2022-03-31 7:53 ` Eugen.Hristev [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=7e2d1b24-67a8-fbf2-d6b2-be7be2cbfbf5@microchip.com \
--to=eugen.hristev@microchip.com \
--cc=Claudiu.Beznea@microchip.com \
--cc=Ludovic.Desroches@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=clement.leger@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox