Some platforms, like the Samsung Galaxy S8, leave CNTFRQ_EL0 unset in the previous stage bootloader. Therefore reading it causes a hang and the boot proccess is halted.
Since on such retail devices there is no way to set it without replacing the entire boot chain, allow setting a value from clock-frequency whenever it's passed. Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivan...@gmail.com> --- drivers/clocksource/arm_architected_timer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/arm_architected_timer.c b/drivers/clocksource/arm_architected_timer.c index 9a1f2d2b..daced94c 100644 --- a/drivers/clocksource/arm_architected_timer.c +++ b/drivers/clocksource/arm_architected_timer.c @@ -24,7 +24,16 @@ static struct clocksource cs = { static int arm_arch_timer_probe(struct device *dev) { - cs.mult = clocksource_hz2mult(get_cntfrq(), cs.shift); + u32 cntfrq; + int ret; + + /* Some platforms don't set CNTFRQ_EL0 before barebox */ + ret = of_property_read_u32(dev->of_node, "clock-frequency", &cntfrq); + + if (ret) + cntfrq = get_cntfrq(); + + cs.mult = clocksource_hz2mult(cntfrq, cs.shift); return init_clock(&cs); } -- 2.43.0