[PATCH] clocksource/drivers/arm_global_timer: Add auto-detection for initial prescaler values
Kevin Hilman
khilman at baylibre.com
Fri Aug 8 10:27:22 PDT 2025
Markus Schneider-Pargmann <msp at baylibre.com> writes:
> am43xx has a clock tree where the global timer clock is an indirect child
> of the CPU clock used for frequency scaling:
>
> dpll_mpu_ck -- CPU/cpufreq
> |
> v
> dpll_mpu_m2_ck -- divider
> |
> v
> mpu_periphclk -- fixed divider by 2 used for global timer
>
> When CPU frequency changes, the global timer's clock notifier rejects
> the change because the hardcoded prescaler (1 or 2) cannot accommodate
> the frequency range across all CPU OPPs (300, 600, 720, 800, 1000 MHz).
>
> Add platform-specific prescaler auto-detection to solve this issue:
>
> - am43xx: prescaler = 50 (calculated as initial_freq/GCD of all OPP
> freqs) This allows the timer to work across all CPU frequencies after
> the fixed divider by 2. Tested on am4372-idk-evm.
>
> - zynq-7000: prescaler = 2 (preserves previous Kconfig default)
>
> - Other platforms: prescaler = 1 (previous default)
>
> The Kconfig option now defaults to 0 (auto-detection) but can still
> override the auto-detected value when set to a non-zero value,
> preserving existing customization workflows.
>
> Signed-off-by: Markus Schneider-Pargmann <msp at baylibre.com>
Reviewed-by: Kevin Hilman <khilman at baylibre.com>
Tested-by: Kevin Hilman <khilman at baylibre.com>
Tested this on my am437x-gp-evm board, and confirm that all the noise
from CPUfreq failing to change frequencies is gone.
Thanks for fixing this!
Kevin
More information about the linux-arm-kernel
mailing list