[PATCH v3 5/8] ARM: layerscape: re-init pbl clocksource

Stefan Kerkmann s.kerkmann at pengutronix.de
Thu Aug 20 01:06:30 PDT 2026


Hi Sascha,

On 8/20/26 08:59, Sascha Hauer wrote:
> On 2026-08-17 16:01, Stefan Kerkmann wrote:
>> After setting the cntfrq the global PBL clocksource must be
>> re-initialized to function correctly.
>>
>> Signed-off-by: Stefan Kerkmann <s.kerkmann at pengutronix.de>
>> ---
>>  arch/arm/mach-layerscape/lowlevel-ls1028a.c | 6 +++++-
>>  arch/arm/mach-layerscape/lowlevel-ls1046a.c | 5 ++++-
>>  2 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-layerscape/lowlevel-ls1028a.c b/arch/arm/mach-layerscape/lowlevel-ls1028a.c
>> index fd013b2b52..ed9284d55a 100644
>> --- a/arch/arm/mach-layerscape/lowlevel-ls1028a.c
>> +++ b/arch/arm/mach-layerscape/lowlevel-ls1028a.c
>> @@ -1,6 +1,7 @@
>>  // SPDX-License-Identifier: GPL-2.0+
>>  #include <common.h>
>>  #include <io.h>
>> +#include <asm/hardware/arm_architected_timer.h>
>>  #include <asm/syscounter.h>
>>  #include <asm/system.h>
>>  #include <mach/layerscape/errata.h>
>> @@ -35,8 +36,11 @@ static void ls1028a_timer_init(void)
>>  
>>  void ls1028a_init_lowlevel(void)
>>  {
>> +	const uint64_t cntfrq = 25000000;
>> +
>>  	scfg_init(SCFG_ENDIANESS_LITTLE);
>> -	set_cntfrq(25000000);
>> +	set_cntfrq(cntfrq);
>> +	arm_arch_timer_init(cntfrq);
>>  	ls1028a_timer_init();
>>  	ls1028a_errata();
>>  }
> 
> I had to squash this patch together with the next two to avoid
> intermediate compile breakage. Otherwise we get an undefined reference
> to clocksource_hz2mult().
> 
> One thing that strikes me here is that first arm_arch_timer_init() is
> called and afterwards ls1028a_timer_init(). I have no idea what timer
> ls1028a_timer_init() initializes and if that has anything to do with
> the architected timer, but if it has the order should likely be the
> other way round.
> 

>From my understanding this function enables the per-core timers which are driven
by the global system counter (cntfrq/cntpct) but distinct from it[1]. So the
order should be correct?

[1]: https://support.arm.com/documentation/102379/0104/System-Counter

> Sascha
> 
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

Best regards,
Stefan

-- 
Pengutronix e.K.                       | Stefan Kerkmann             |
Steuerwalder Str. 21                   | https://www.pengutronix.de/ |
31137 Hildesheim, Germany              | Phone: +49-5121-206917-128  |
Amtsgericht Hildesheim, HRA 2686       | Fax:   +49-5121-206917-9    |




More information about the barebox mailing list