summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorMarc Zyngier2012-01-10 20:26:45 +0100
committerMarc Zyngier2012-03-13 14:27:50 +0100
commit0ef330e10dcdbca8f4566e9eaf77015f8ce039d3 (patch)
treeb6adfb473921a37bf73372dd3dfec23a1e450d67 /arch/arm/kernel
parentARM: smp_twd: make local_timer_stop a symbol instead of a #define (diff)
downloadkernel-qcow2-linux-0ef330e10dcdbca8f4566e9eaf77015f8ce039d3.tar.gz
kernel-qcow2-linux-0ef330e10dcdbca8f4566e9eaf77015f8ce039d3.tar.xz
kernel-qcow2-linux-0ef330e10dcdbca8f4566e9eaf77015f8ce039d3.zip
ARM: local timers: introduce a new registration interface
In order to switch to a runtime selectable local timer, add a registration interface that timer drivers can use to register to the core. local_timer_setup() and local_timer_stop() are made weak symbols in order not to break existing setups. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/smp.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index cdeb727527d3..89bb02c90ae1 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -459,6 +459,33 @@ static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt)
clockevents_register_device(evt);
}
+static struct local_timer_ops *lt_ops;
+
+#ifdef CONFIG_LOCAL_TIMERS
+int local_timer_register(struct local_timer_ops *ops)
+{
+ if (lt_ops)
+ return -EBUSY;
+
+ lt_ops = ops;
+ return 0;
+}
+#endif
+
+int __cpuinit __attribute__ ((weak)) local_timer_setup(struct clock_event_device *clk)
+{
+ if (lt_ops)
+ return lt_ops->setup(clk);
+
+ return -ENXIO;
+}
+
+void __attribute__ ((weak)) local_timer_stop(struct clock_event_device *clk)
+{
+ if (lt_ops)
+ lt_ops->stop(clk);
+}
+
void __cpuinit percpu_timer_setup(void)
{
unsigned int cpu = smp_processor_id();