diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2014-05-13 19:01:00 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2014-05-19 05:30:11 -0400 |
commit | 013be5adf5cd6e6d58eb72f3bb0137a78be152c8 (patch) | |
tree | 944758bb49bb291d6fec0a945f37bcaaa1a7419e /drivers/clocksource/qcom-timer.c | |
parent | 3f04e3d3eb77ac9df70619b9c87da71b0eeddc36 (diff) |
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>
Diffstat (limited to 'drivers/clocksource/qcom-timer.c')
-rw-r--r-- | drivers/clocksource/qcom-timer.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/clocksource/qcom-timer.c b/drivers/clocksource/qcom-timer.c index e807acf4c665..8d115db1e651 100644 --- a/drivers/clocksource/qcom-timer.c +++ b/drivers/clocksource/qcom-timer.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/of_irq.h> | 26 | #include <linux/of_irq.h> |
27 | #include <linux/sched_clock.h> | 27 | #include <linux/sched_clock.h> |
28 | 28 | ||
29 | #include <asm/delay.h> | ||
30 | |||
29 | #define TIMER_MATCH_VAL 0x0000 | 31 | #define TIMER_MATCH_VAL 0x0000 |
30 | #define TIMER_COUNT_VAL 0x0004 | 32 | #define TIMER_COUNT_VAL 0x0004 |
31 | #define TIMER_ENABLE 0x0008 | 33 | #define TIMER_ENABLE 0x0008 |
@@ -179,6 +181,15 @@ static u64 notrace msm_sched_clock_read(void) | |||
179 | return msm_clocksource.read(&msm_clocksource); | 181 | return msm_clocksource.read(&msm_clocksource); |
180 | } | 182 | } |
181 | 183 | ||
184 | static unsigned long msm_read_current_timer(void) | ||
185 | { | ||
186 | return msm_clocksource.read(&msm_clocksource); | ||
187 | } | ||
188 | |||
189 | static struct delay_timer msm_delay_timer = { | ||
190 | .read_current_timer = msm_read_current_timer, | ||
191 | }; | ||
192 | |||
182 | static void __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq, | 193 | static void __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq, |
183 | bool percpu) | 194 | bool percpu) |
184 | { | 195 | { |
@@ -217,6 +228,8 @@ err: | |||
217 | if (res) | 228 | if (res) |
218 | pr_err("clocksource_register failed\n"); | 229 | pr_err("clocksource_register failed\n"); |
219 | sched_clock_register(msm_sched_clock_read, sched_bits, dgt_hz); | 230 | sched_clock_register(msm_sched_clock_read, sched_bits, dgt_hz); |
231 | msm_delay_timer.freq = dgt_hz; | ||
232 | register_current_timer_delay(&msm_delay_timer); | ||
220 | } | 233 | } |
221 | 234 | ||
222 | #ifdef CONFIG_ARCH_QCOM | 235 | #ifdef CONFIG_ARCH_QCOM |