diff options
Diffstat (limited to 'drivers/clocksource/timer-stm32.c')
-rw-r--r-- | drivers/clocksource/timer-stm32.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c index 21b7492c963a..c7d1dae27067 100644 --- a/drivers/clocksource/timer-stm32.c +++ b/drivers/clocksource/timer-stm32.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/clocksource.h> | 10 | #include <linux/clocksource.h> |
11 | #include <linux/clockchips.h> | 11 | #include <linux/clockchips.h> |
12 | #include <linux/delay.h> | ||
12 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
13 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
14 | #include <linux/of.h> | 15 | #include <linux/of.h> |
@@ -88,6 +89,13 @@ static u64 notrace stm32_read_sched_clock(void) | |||
88 | return readl_relaxed(stm32_timer_cnt); | 89 | return readl_relaxed(stm32_timer_cnt); |
89 | } | 90 | } |
90 | 91 | ||
92 | static struct delay_timer stm32_timer_delay; | ||
93 | |||
94 | static unsigned long stm32_read_delay(void) | ||
95 | { | ||
96 | return readl_relaxed(stm32_timer_cnt); | ||
97 | } | ||
98 | |||
91 | static void stm32_clock_event_disable(struct timer_of *to) | 99 | static void stm32_clock_event_disable(struct timer_of *to) |
92 | { | 100 | { |
93 | writel_relaxed(0, timer_of_base(to) + TIM_DIER); | 101 | writel_relaxed(0, timer_of_base(to) + TIM_DIER); |
@@ -230,6 +238,11 @@ static int __init stm32_clocksource_init(struct timer_of *to) | |||
230 | stm32_timer_cnt = timer_of_base(to) + TIM_CNT; | 238 | stm32_timer_cnt = timer_of_base(to) + TIM_CNT; |
231 | sched_clock_register(stm32_read_sched_clock, bits, timer_of_rate(to)); | 239 | sched_clock_register(stm32_read_sched_clock, bits, timer_of_rate(to)); |
232 | pr_info("%s: STM32 sched_clock registered\n", name); | 240 | pr_info("%s: STM32 sched_clock registered\n", name); |
241 | |||
242 | stm32_timer_delay.read_current_timer = stm32_read_delay; | ||
243 | stm32_timer_delay.freq = timer_of_rate(to); | ||
244 | register_current_timer_delay(&stm32_timer_delay); | ||
245 | pr_info("%s: STM32 delay timer registered\n", name); | ||
233 | } | 246 | } |
234 | 247 | ||
235 | return clocksource_mmio_init(timer_of_base(to) + TIM_CNT, name, | 248 | return clocksource_mmio_init(timer_of_base(to) + TIM_CNT, name, |