[PATCH v7 4/4] configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER

Clément Léger clement.leger at bootlin.com
Wed Mar 30 17:49:56 CEST 2022

Le Tue, 22 Mar 2022 13:35:08 +0100,
Clément Léger <clement.leger at bootlin.com> a écrit :

> Le Tue, 22 Mar 2022 11:18:39 +0000,
> <Eugen.Hristev at 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

By the way, do you have any documentation which explains how to use
U-Boot SPL on sama5d2_xplained (or other) board ?



Clément Léger,
Embedded Linux and Kernel engineer at Bootlin

More information about the U-Boot mailing list