diff options
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/tegra20_timer.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c index d1869f02051c..d2616ef16770 100644 --- a/drivers/clocksource/tegra20_timer.c +++ b/drivers/clocksource/tegra20_timer.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/of_address.h> | 27 | #include <linux/of_address.h> |
28 | #include <linux/of_irq.h> | 28 | #include <linux/of_irq.h> |
29 | #include <linux/sched_clock.h> | 29 | #include <linux/sched_clock.h> |
30 | #include <linux/delay.h> | ||
30 | 31 | ||
31 | #include <asm/mach/time.h> | 32 | #include <asm/mach/time.h> |
32 | #include <asm/smp_twd.h> | 33 | #include <asm/smp_twd.h> |
@@ -53,6 +54,8 @@ static void __iomem *rtc_base; | |||
53 | static struct timespec persistent_ts; | 54 | static struct timespec persistent_ts; |
54 | static u64 persistent_ms, last_persistent_ms; | 55 | static u64 persistent_ms, last_persistent_ms; |
55 | 56 | ||
57 | static struct delay_timer tegra_delay_timer; | ||
58 | |||
56 | #define timer_writel(value, reg) \ | 59 | #define timer_writel(value, reg) \ |
57 | __raw_writel(value, timer_reg_base + (reg)) | 60 | __raw_writel(value, timer_reg_base + (reg)) |
58 | #define timer_readl(reg) \ | 61 | #define timer_readl(reg) \ |
@@ -139,6 +142,11 @@ static void tegra_read_persistent_clock(struct timespec *ts) | |||
139 | *ts = *tsp; | 142 | *ts = *tsp; |
140 | } | 143 | } |
141 | 144 | ||
145 | static unsigned long tegra_delay_timer_read_counter_long(void) | ||
146 | { | ||
147 | return readl(timer_reg_base + TIMERUS_CNTR_1US); | ||
148 | } | ||
149 | |||
142 | static irqreturn_t tegra_timer_interrupt(int irq, void *dev_id) | 150 | static irqreturn_t tegra_timer_interrupt(int irq, void *dev_id) |
143 | { | 151 | { |
144 | struct clock_event_device *evt = (struct clock_event_device *)dev_id; | 152 | struct clock_event_device *evt = (struct clock_event_device *)dev_id; |
@@ -206,6 +214,11 @@ static void __init tegra20_init_timer(struct device_node *np) | |||
206 | BUG(); | 214 | BUG(); |
207 | } | 215 | } |
208 | 216 | ||
217 | tegra_delay_timer.read_current_timer = | ||
218 | tegra_delay_timer_read_counter_long; | ||
219 | tegra_delay_timer.freq = 1000000; | ||
220 | register_current_timer_delay(&tegra_delay_timer); | ||
221 | |||
209 | ret = setup_irq(tegra_timer_irq.irq, &tegra_timer_irq); | 222 | ret = setup_irq(tegra_timer_irq.irq, &tegra_timer_irq); |
210 | if (ret) { | 223 | if (ret) { |
211 | pr_err("Failed to register timer IRQ: %d\n", ret); | 224 | pr_err("Failed to register timer IRQ: %d\n", ret); |