Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource: qcom: Implement read_current_timer for udelay

Setup the same timer used as the clocksource to be used as the
read_current_timer implementation. This allows us to support a
stable udelay implementation on MSMs where it's possible for the
CPUs to scale speeds independently of one another.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Stephen Boyd and committed by
Daniel Lezcano
013be5ad 3f04e3d3

+13
+13
drivers/clocksource/qcom-timer.c
··· 26 26 #include <linux/of_irq.h> 27 27 #include <linux/sched_clock.h> 28 28 29 + #include <asm/delay.h> 30 + 29 31 #define TIMER_MATCH_VAL 0x0000 30 32 #define TIMER_COUNT_VAL 0x0004 31 33 #define TIMER_ENABLE 0x0008 ··· 181 179 return msm_clocksource.read(&msm_clocksource); 182 180 } 183 181 182 + static unsigned long msm_read_current_timer(void) 183 + { 184 + return msm_clocksource.read(&msm_clocksource); 185 + } 186 + 187 + static struct delay_timer msm_delay_timer = { 188 + .read_current_timer = msm_read_current_timer, 189 + }; 190 + 184 191 static void __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq, 185 192 bool percpu) 186 193 { ··· 228 217 if (res) 229 218 pr_err("clocksource_register failed\n"); 230 219 sched_clock_register(msm_sched_clock_read, sched_bits, dgt_hz); 220 + msm_delay_timer.freq = dgt_hz; 221 + register_current_timer_delay(&msm_delay_timer); 231 222 } 232 223 233 224 #ifdef CONFIG_ARCH_QCOM