diff options
author | Rob Herring <rob.herring@calxeda.com> | 2011-12-12 16:29:08 -0500 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2012-02-09 23:42:55 -0500 |
commit | a7bf61620831c5578e434429bc7fa0fd0219c40c (patch) | |
tree | b0e67eeebdd3cc87894022cf2da43b4624ebc9ea /arch/arm/common | |
parent | d65b4e98d7ea3038b767b70fe8be959b2913f16d (diff) |
ARM: timer-sp: add sched_clock support
Add a sched_clock support for the sp804 timer. The clocksource timer
can optionally initialize itself as sched_clock timer.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'arch/arm/common')
-rw-r--r-- | arch/arm/common/timer-sp.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c index 8794a34eae61..df13a3ffff35 100644 --- a/arch/arm/common/timer-sp.c +++ b/arch/arm/common/timer-sp.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | 28 | ||
29 | #include <asm/sched_clock.h> | ||
29 | #include <asm/hardware/arm_timer.h> | 30 | #include <asm/hardware/arm_timer.h> |
30 | 31 | ||
31 | static long __init sp804_get_clock_rate(const char *name) | 32 | static long __init sp804_get_clock_rate(const char *name) |
@@ -67,7 +68,16 @@ static long __init sp804_get_clock_rate(const char *name) | |||
67 | return rate; | 68 | return rate; |
68 | } | 69 | } |
69 | 70 | ||
70 | void __init sp804_clocksource_init(void __iomem *base, const char *name) | 71 | static void __iomem *sched_clock_base; |
72 | |||
73 | static u32 sp804_read(void) | ||
74 | { | ||
75 | return ~readl_relaxed(sched_clock_base + TIMER_VALUE); | ||
76 | } | ||
77 | |||
78 | void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base, | ||
79 | const char *name, | ||
80 | int use_sched_clock) | ||
71 | { | 81 | { |
72 | long rate = sp804_get_clock_rate(name); | 82 | long rate = sp804_get_clock_rate(name); |
73 | 83 | ||
@@ -83,6 +93,11 @@ void __init sp804_clocksource_init(void __iomem *base, const char *name) | |||
83 | 93 | ||
84 | clocksource_mmio_init(base + TIMER_VALUE, name, | 94 | clocksource_mmio_init(base + TIMER_VALUE, name, |
85 | rate, 200, 32, clocksource_mmio_readl_down); | 95 | rate, 200, 32, clocksource_mmio_readl_down); |
96 | |||
97 | if (use_sched_clock) { | ||
98 | sched_clock_base = base; | ||
99 | setup_sched_clock(sp804_read, 32, rate); | ||
100 | } | ||
86 | } | 101 | } |
87 | 102 | ||
88 | 103 | ||