Hello!
How do I modify the CNTFRQ_el0 value of the A72 core on the im8QM? It's currently 8000000, and I want to change it to 16M.
Thanks!
On the i.MX8QM, it is not recommended, and it is practically impossible, to change the actual counting frequency corresponding to CNTFRQ_EL0 of the A72 from 8 MHz to 16 MHz. The reason is that CNTFRQ_EL0 is just a register that allows the software to "discover" the System Counter frequency; even if the software can write this register value, it will not change the actual frequency of the hardware System Counter.
For the i.MX8QM, the reference manual states that the SCU ROM will enable the System Counter and input a 24 MHz clock; the System Counter internally divides this to generate an 8 MHz clock. The relevant clock root also belongs to the clock domain managed by the System Controller Firmware. The documentation shows that SCU_MSLICE0_CLK_ROOT / SCU_MSLICE1_CLK_ROOT can be used as the root clock for the SYS COUNTER, and the root clock generation is controlled by the SC FW.
So if you are reading this now:
CNTFRQ_EL0 = 8000000
I want to change it to:
CNTFRQ_EL0 = 16000000
Two things need to be distinguished:
If your goal is to get Linux/RTOS using the correct frequency, it's recommended to keep CNTFRQ_EL0 = 8000000 and check if the device tree/firmware/bootloader is incorrectly overriding the timer frequency. Don't modify CNTFRQ_EL0 just to meet a 16 MHz requirement unless you're specifically doing an experiment with a non-real frequency.
Conclusion: The A72 CNTFRQ_EL0 of the i.MX8QM should not be changed from 8 MHz to 16 MHz; the actual System Counter is initialized by the SCU/SCFW and is actually 8 MHz. Changing the register value alone will not change the hardware frequency, but will instead disrupt the system time base.
Hello:
Thank you for your reply!
Could you provide a method or demo code for setting the System Counter to 16MHz in an SCU or SCFW?
Thanks!