diff options
author | Tony Lindgren <tony@atomide.com> | 2005-06-29 14:59:48 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-06-29 14:59:48 -0400 |
commit | b3402cf50efead37dd9553b90fbf1486e09fb78e (patch) | |
tree | 75e2bf1533a10c7e4540cb7a925089a7fd3b6d91 /arch/arm/mach-omap/time.c | |
parent | 20f720ccce8864583365d844d48d3fe8d0d171ad (diff) |
[PATCH] ARM: 2771/1: Dynamic Tick support for OMAP, take 4
Patch from Tony Lindgren
This patch adds support for Dynamic Tick Timer for OMAP.
This patch is an updated version of ARM patch 2642/1 to
make it work with the already integrated generic ARM
dyntick support.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap/time.c')
-rw-r--r-- | arch/arm/mach-omap/time.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/arch/arm/mach-omap/time.c b/arch/arm/mach-omap/time.c index 589e8b2740dd..dd34e9f4c413 100644 --- a/arch/arm/mach-omap/time.c +++ b/arch/arm/mach-omap/time.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * OMAP Timers | 4 | * OMAP Timers |
5 | * | 5 | * |
6 | * Copyright (C) 2004 Nokia Corporation | 6 | * Copyright (C) 2004 Nokia Corporation |
7 | * Partial timer rewrite and additional VST timer support by | 7 | * Partial timer rewrite and additional dynamic tick timer support by |
8 | * Tony Lindgen <tony@atomide.com> and | 8 | * Tony Lindgen <tony@atomide.com> and |
9 | * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | 9 | * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> |
10 | * | 10 | * |
@@ -261,7 +261,6 @@ unsigned long long sched_clock(void) | |||
261 | * so with HZ = 100, TVR = 327.68. | 261 | * so with HZ = 100, TVR = 327.68. |
262 | */ | 262 | */ |
263 | #define OMAP_32K_TIMER_TICK_PERIOD ((32768 / HZ) - 1) | 263 | #define OMAP_32K_TIMER_TICK_PERIOD ((32768 / HZ) - 1) |
264 | #define MAX_SKIP_JIFFIES 25 | ||
265 | #define TIMER_32K_SYNCHRONIZED 0xfffbc410 | 264 | #define TIMER_32K_SYNCHRONIZED 0xfffbc410 |
266 | 265 | ||
267 | #define JIFFIES_TO_HW_TICKS(nr_jiffies, clock_rate) \ | 266 | #define JIFFIES_TO_HW_TICKS(nr_jiffies, clock_rate) \ |
@@ -347,6 +346,42 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id, | |||
347 | return IRQ_HANDLED; | 346 | return IRQ_HANDLED; |
348 | } | 347 | } |
349 | 348 | ||
349 | #ifdef CONFIG_NO_IDLE_HZ | ||
350 | /* | ||
351 | * Programs the next timer interrupt needed. Called when dynamic tick is | ||
352 | * enabled, and to reprogram the ticks to skip from pm_idle. Note that | ||
353 | * we can keep the timer continuous, and don't need to set it to run in | ||
354 | * one-shot mode. This is because the timer will get reprogrammed again | ||
355 | * after next interrupt. | ||
356 | */ | ||
357 | void omap_32k_timer_reprogram(unsigned long next_tick) | ||
358 | { | ||
359 | omap_32k_timer_start(JIFFIES_TO_HW_TICKS(next_tick, 32768) + 1); | ||
360 | } | ||
361 | |||
362 | static struct irqaction omap_32k_timer_irq; | ||
363 | extern struct timer_update_handler timer_update; | ||
364 | |||
365 | static int omap_32k_timer_enable_dyn_tick(void) | ||
366 | { | ||
367 | /* No need to reprogram timer, just use the next interrupt */ | ||
368 | return 0; | ||
369 | } | ||
370 | |||
371 | static int omap_32k_timer_disable_dyn_tick(void) | ||
372 | { | ||
373 | omap_32k_timer_start(OMAP_32K_TIMER_TICK_PERIOD); | ||
374 | return 0; | ||
375 | } | ||
376 | |||
377 | static struct dyn_tick_timer omap_dyn_tick_timer = { | ||
378 | .enable = omap_32k_timer_enable_dyn_tick, | ||
379 | .disable = omap_32k_timer_disable_dyn_tick, | ||
380 | .reprogram = omap_32k_timer_reprogram, | ||
381 | .handler = omap_32k_timer_interrupt, | ||
382 | }; | ||
383 | #endif /* CONFIG_NO_IDLE_HZ */ | ||
384 | |||
350 | static struct irqaction omap_32k_timer_irq = { | 385 | static struct irqaction omap_32k_timer_irq = { |
351 | .name = "32KHz timer", | 386 | .name = "32KHz timer", |
352 | .flags = SA_INTERRUPT | SA_TIMER, | 387 | .flags = SA_INTERRUPT | SA_TIMER, |
@@ -355,6 +390,11 @@ static struct irqaction omap_32k_timer_irq = { | |||
355 | 390 | ||
356 | static __init void omap_init_32k_timer(void) | 391 | static __init void omap_init_32k_timer(void) |
357 | { | 392 | { |
393 | |||
394 | #ifdef CONFIG_NO_IDLE_HZ | ||
395 | omap_timer.dyn_tick = &omap_dyn_tick_timer; | ||
396 | #endif | ||
397 | |||
358 | setup_irq(INT_OS_TIMER, &omap_32k_timer_irq); | 398 | setup_irq(INT_OS_TIMER, &omap_32k_timer_irq); |
359 | omap_timer.offset = omap_32k_timer_gettimeoffset; | 399 | omap_timer.offset = omap_32k_timer_gettimeoffset; |
360 | omap_32k_last_tick = omap_32k_sync_timer_read(); | 400 | omap_32k_last_tick = omap_32k_sync_timer_read(); |