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

clocksource: tegra: Use us counter as delay timer

All Tegra SoCs have a freerunning microsecond counter which can be used as a
delay timer.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

authored by

Peter De Schrijver and committed by
Stephen Warren
0ff36b4f 5930c1a1

+13
+13
drivers/clocksource/tegra20_timer.c
··· 27 27 #include <linux/of_address.h> 28 28 #include <linux/of_irq.h> 29 29 #include <linux/sched_clock.h> 30 + #include <linux/delay.h> 30 31 31 32 #include <asm/mach/time.h> 32 33 #include <asm/smp_twd.h> ··· 53 52 54 53 static struct timespec persistent_ts; 55 54 static u64 persistent_ms, last_persistent_ms; 55 + 56 + static struct delay_timer tegra_delay_timer; 56 57 57 58 #define timer_writel(value, reg) \ 58 59 __raw_writel(value, timer_reg_base + (reg)) ··· 142 139 *ts = *tsp; 143 140 } 144 141 142 + static unsigned long tegra_delay_timer_read_counter_long(void) 143 + { 144 + return readl(timer_reg_base + TIMERUS_CNTR_1US); 145 + } 146 + 145 147 static irqreturn_t tegra_timer_interrupt(int irq, void *dev_id) 146 148 { 147 149 struct clock_event_device *evt = (struct clock_event_device *)dev_id; ··· 213 205 pr_err("Failed to register clocksource\n"); 214 206 BUG(); 215 207 } 208 + 209 + tegra_delay_timer.read_current_timer = 210 + tegra_delay_timer_read_counter_long; 211 + tegra_delay_timer.freq = 1000000; 212 + register_current_timer_delay(&tegra_delay_timer); 216 213 217 214 ret = setup_irq(tegra_timer_irq.irq, &tegra_timer_irq); 218 215 if (ret) {