Skip to content
Snippets Groups Projects
Commit dfba9c2b authored by Luis Gerhorst's avatar Luis Gerhorst
Browse files

raspi3b+: Fix arm_arch_timer's HW_CYCLES_PER_SEC

parent ebad73a6
Branches main
No related tags found
No related merge requests found
......@@ -58,6 +58,13 @@ int z_clock_driver_init(const struct device *device)
irq_enable(ARM_ARCH_TIMER_IRQ);
arm_arch_timer_set_irq_mask(false);
/* https://gitlab.cs.fau.de/i4/jitty/jitty-os/-/blob/master/arch-pc-aarch64/hw_timer.c#L235 */
uint64_t hw_cycles_per_sec = read_cntfrq_el0() * (0x400 / 256);
if (hw_cycles_per_sec != CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC) {
printk("Warning: cntfrq_el0 indicates that CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC should be %d, but configured value is %d.\n",
hw_cycles_per_sec, CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);
}
return 0;
}
......
......@@ -13,7 +13,9 @@ config NUM_IRQS
default 128
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 62500000
# https://gitlab.cs.fau.de/i4/jitty/jitty-os/-/blob/master/arch-pc-aarch64/hw_timer.c#L235
default 76800000
# QEMU's raspi3 machine: default 250000000
# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_FLASH := zephyr,flash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment