diff options
author | Fabio Baltieri <fabio.baltieri@linaro.org> | 2012-12-04 05:10:44 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-01-07 10:03:35 -0500 |
commit | 6f179b724b1488ead0acc1a04f2adade99ca0736 (patch) | |
tree | 0c66122c28f5535a83777bf294b072eed4397a05 /drivers/clocksource/nomadik-mtu.c | |
parent | 0baf066fcbc408c75dc161a9298fc4bfdde6051f (diff) |
clocksource: nomadik-mtu: support timer-based delay
This patch adds support to use Nomadik MTU for timer-based delay.
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/clocksource/nomadik-mtu.c')
-rw-r--r-- | drivers/clocksource/nomadik-mtu.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c index 8914c3c1c88b..5f3c8dbf360f 100644 --- a/drivers/clocksource/nomadik-mtu.c +++ b/drivers/clocksource/nomadik-mtu.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/clocksource.h> | 15 | #include <linux/clocksource.h> |
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/jiffies.h> | 17 | #include <linux/jiffies.h> |
18 | #include <linux/delay.h> | ||
18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
19 | #include <linux/platform_data/clocksource-nomadik-mtu.h> | 20 | #include <linux/platform_data/clocksource-nomadik-mtu.h> |
20 | #include <asm/mach/time.h> | 21 | #include <asm/mach/time.h> |
@@ -64,6 +65,7 @@ static void __iomem *mtu_base; | |||
64 | static bool clkevt_periodic; | 65 | static bool clkevt_periodic; |
65 | static u32 clk_prescale; | 66 | static u32 clk_prescale; |
66 | static u32 nmdk_cycle; /* write-once */ | 67 | static u32 nmdk_cycle; /* write-once */ |
68 | static struct delay_timer mtu_delay_timer; | ||
67 | 69 | ||
68 | #ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK | 70 | #ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK |
69 | /* | 71 | /* |
@@ -80,6 +82,11 @@ static u32 notrace nomadik_read_sched_clock(void) | |||
80 | } | 82 | } |
81 | #endif | 83 | #endif |
82 | 84 | ||
85 | static unsigned long nmdk_timer_read_current_timer(void) | ||
86 | { | ||
87 | return ~readl_relaxed(mtu_base + MTU_VAL(0)); | ||
88 | } | ||
89 | |||
83 | /* Clockevent device: use one-shot mode */ | 90 | /* Clockevent device: use one-shot mode */ |
84 | static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev) | 91 | static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev) |
85 | { | 92 | { |
@@ -227,4 +234,8 @@ void __init nmdk_timer_init(void __iomem *base, int irq) | |||
227 | setup_irq(irq, &nmdk_timer_irq); | 234 | setup_irq(irq, &nmdk_timer_irq); |
228 | nmdk_clkevt.cpumask = cpumask_of(0); | 235 | nmdk_clkevt.cpumask = cpumask_of(0); |
229 | clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU); | 236 | clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU); |
237 | |||
238 | mtu_delay_timer.read_current_timer = &nmdk_timer_read_current_timer; | ||
239 | mtu_delay_timer.freq = rate; | ||
240 | register_current_timer_delay(&mtu_delay_timer); | ||
230 | } | 241 | } |