Skip to content

Commit

Permalink
arch/arm64/imx9: Fix cntrfrq_el0 to correct value
Browse files Browse the repository at this point in the history
Read frequency from system counter and write it
to arm register.

Signed-off-by: Jouni Ukkonen <[email protected]>
  • Loading branch information
joukkone committed Sep 5, 2024
1 parent 78ef433 commit eda5f3c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/arm64/src/imx9/imx9_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ void arm64_el_init(void)
#if (CONFIG_ARCH_ARM64_EXCEPTION_LEVEL == 3)
/* At EL3, cntfrq_el0 is uninitialized. It must be set. */

write_sysreg(CONFIG_BOOTLOADER_SYS_CLOCK, cntfrq_el0);
uint32_t freq;

freq = getreg32(IMX9_SYS_CTR_CONTROL_BASE + SYS_CTR_CNTFID0);
write_sysreg(freq, cntfrq_el0);
modifyreg32(IMX9_SYS_CTR_CONTROL_BASE + SYS_CTR_CNTCR, SC_CNTCR_FREQ0 |
SC_CNTCR_FREQ1, SC_CNTCR_FREQ0 | SC_CNTCR_ENABLE | SC_CNTCR_HDBG);
#endif
}

Expand Down

0 comments on commit eda5f3c

Please sign in to comment.