clock_gettime function doesn't scale to real time.. and changing CNTFRQ_EL0 doesn't make any change..(arm64)

Siddh Raman Pant code at siddh.me
Tue Nov 8 05:31:20 EST 2022


On Tue, 08 Nov 2022 10:45:55 +0530  Chan Kim  wrote:
> 
> Hello all,
> 
> I fixed this problem and now the time measurement and commands like sleep
> works just fine.
> 
> Two points I fixed : 
> - I had 'clock-frequency' property set with wrong frequency in my timer node
> in the device tree so I removed it. 
>    The document says when the boot loader sets CNTFRQ register correctly, we
> don't have to provide 'clock-frequency' property value.
> - The correct frequency of the system counter (arm464) was 10MHz in our
> board. Previously I set CNTFRQ register with 5MHz but I fixed it to 10MHz.
> 
> One more thing to note. The system counter has both system register view and
> memory mapped register view. 
> Previously I said even if I set cntfrq_el0 register with some values (using
> system register, "msr cntfrq_el0, COUNTER_FREQUENCY") it did not change
> anything.
> It was because I set the same register with old value (5MHz) using the
> memory mapped access later (like with "writel(COUNTER_FREQUENCY,
> 0x4c018020);").
> 
> Hope this helps someone later.
> Thank you!
> 
> Chan Kim
> 

Glad to know. Thanks for sharing the updates and the cause behind it!

Thanks,
Siddh




More information about the Kernelnewbies mailing list