diff options
author | Mark Rutland <mark.rutland@arm.com> | 2012-11-20 10:06:00 +0000 |
---|---|---|
committer | Mark Rutland <mark.rutland@arm.com> | 2013-01-31 15:51:59 +0000 |
commit | 1aee5d7a8120cbe3eca9180ef9276d75a4f51dd2 (patch) | |
tree | ac02d4cdc545251cb9197456c7fbd41a64a4dbe0 /arch/arm64/kernel/time.c | |
parent | 1dac0dd71cdda2bd7395dd47a6b617ed296d4901 (diff) | |
download | linux-stable-1aee5d7a8120cbe3eca9180ef9276d75a4f51dd2.tar.gz linux-stable-1aee5d7a8120cbe3eca9180ef9276d75a4f51dd2.tar.bz2 linux-stable-1aee5d7a8120cbe3eca9180ef9276d75a4f51dd2.zip |
arm64: move from arm_generic to arm_arch_timer
The arch_timer driver supports a superset of the functionality of the
arm_generic driver, and is not tied to a particular arch.
This patch moves arm64 to use the arch_timer driver, gaining additional
functionality in doing so, and removes the (now unused) arm_generic
driver. Timer-related hooks specific to arm64 are moved into
arch/arm64/kernel/time.c.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm64/kernel/time.c')
-rw-r--r-- | arch/arm64/kernel/time.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c index 3b4b7258f492..b0ef18d14c3b 100644 --- a/arch/arm64/kernel/time.c +++ b/arch/arm64/kernel/time.c @@ -31,8 +31,9 @@ #include <linux/syscore_ops.h> #include <linux/timer.h> #include <linux/irq.h> +#include <linux/delay.h> -#include <clocksource/arm_generic.h> +#include <clocksource/arm_arch_timer.h> #include <asm/thread_info.h> #include <asm/stacktrace.h> @@ -59,7 +60,31 @@ unsigned long profile_pc(struct pt_regs *regs) EXPORT_SYMBOL(profile_pc); #endif +static u64 sched_clock_mult __read_mostly; + +unsigned long long notrace sched_clock(void) +{ + return arch_timer_read_counter() * sched_clock_mult; +} + +int read_current_timer(unsigned long *timer_value) +{ + *timer_value = arch_timer_read_counter(); + return 0; +} + void __init time_init(void) { - arm_generic_timer_init(); + u32 arch_timer_rate; + + if (arch_timer_init()) + panic("Unable to initialise architected timer.\n"); + + arch_timer_rate = arch_timer_get_rate(); + + /* Cache the sched_clock multiplier to save a divide in the hot path. */ + sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; + + /* Calibrate the delay loop directly */ + lpj_fine = arch_timer_rate / HZ; } |