diff options
| author | Jonathan Austin <Jonathan.Austin@arm.com> | 2012-09-21 13:51:44 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-09-26 17:57:52 -0400 |
| commit | 56942fec06efa0e17df0f4c3b438332c923b9014 (patch) | |
| tree | 89b604c987b7f6a0eaaa16af7a9d8f45711349a7 /arch/arm/kernel | |
| parent | a1b2dde70419ae947fd7c9c8fcad7da005dc600e (diff) | |
ARM: 7538/1: delay: add registration mechanism for delay timer sources
The current timer-based delay loop relies on the architected timer to
initiate the switch away from the polling-based implementation. This is
unfortunate for platforms without the architected timers but with a
suitable delay source (that is, constant frequency, always powered-up
and ticking as long as the CPUs are online).
This patch introduces a registration mechanism for the delay timer
(which provides an unconditional read_current_timer implementation) and
updates the architected timer code to use the new interface.
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Jonathan Austin <jonathan.austin@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
| -rw-r--r-- | arch/arm/kernel/arch_timer.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c index c04c2a6da470..c8ef20747ee7 100644 --- a/arch/arm/kernel/arch_timer.c +++ b/arch/arm/kernel/arch_timer.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
| 22 | 22 | ||
| 23 | #include <asm/cputype.h> | 23 | #include <asm/cputype.h> |
| 24 | #include <asm/delay.h> | ||
| 24 | #include <asm/localtimer.h> | 25 | #include <asm/localtimer.h> |
| 25 | #include <asm/arch_timer.h> | 26 | #include <asm/arch_timer.h> |
| 26 | #include <asm/system_info.h> | 27 | #include <asm/system_info.h> |
| @@ -39,8 +40,7 @@ enum ppi_nr { | |||
| 39 | static int arch_timer_ppi[MAX_TIMER_PPI]; | 40 | static int arch_timer_ppi[MAX_TIMER_PPI]; |
| 40 | 41 | ||
| 41 | static struct clock_event_device __percpu **arch_timer_evt; | 42 | static struct clock_event_device __percpu **arch_timer_evt; |
| 42 | 43 | static struct delay_timer arch_delay_timer; | |
| 43 | extern void init_current_timer_delay(unsigned long freq); | ||
| 44 | 44 | ||
| 45 | static bool arch_timer_use_virtual = true; | 45 | static bool arch_timer_use_virtual = true; |
| 46 | 46 | ||
| @@ -325,12 +325,9 @@ static cycle_t arch_counter_read(struct clocksource *cs) | |||
| 325 | return arch_counter_get_cntpct(); | 325 | return arch_counter_get_cntpct(); |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | int read_current_timer(unsigned long *timer_val) | 328 | static unsigned long arch_timer_read_current_timer(void) |
| 329 | { | 329 | { |
| 330 | if (!arch_timer_rate) | 330 | return arch_counter_get_cntpct(); |
| 331 | return -ENXIO; | ||
| 332 | *timer_val = arch_counter_get_cntpct(); | ||
| 333 | return 0; | ||
| 334 | } | 331 | } |
| 335 | 332 | ||
| 336 | static cycle_t arch_counter_read_cc(const struct cyclecounter *cc) | 333 | static cycle_t arch_counter_read_cc(const struct cyclecounter *cc) |
| @@ -441,11 +438,13 @@ static int __init arch_timer_register(void) | |||
| 441 | arch_timer_global_evt.cpumask = cpumask_of(0); | 438 | arch_timer_global_evt.cpumask = cpumask_of(0); |
| 442 | err = arch_timer_setup(&arch_timer_global_evt); | 439 | err = arch_timer_setup(&arch_timer_global_evt); |
| 443 | } | 440 | } |
| 444 | |||
| 445 | if (err) | 441 | if (err) |
| 446 | goto out_free_irq; | 442 | goto out_free_irq; |
| 447 | 443 | ||
| 448 | init_current_timer_delay(arch_timer_rate); | 444 | /* Use the architected timer for the delay loop. */ |
| 445 | arch_delay_timer.read_current_timer = &arch_timer_read_current_timer; | ||
| 446 | arch_delay_timer.freq = arch_timer_rate; | ||
| 447 | register_current_timer_delay(&arch_delay_timer); | ||
| 449 | return 0; | 448 | return 0; |
| 450 | 449 | ||
| 451 | out_free_irq: | 450 | out_free_irq: |
