aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-realview/localtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-realview/localtimer.c')
-rw-r--r--arch/arm/mach-realview/localtimer.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/arm/mach-realview/localtimer.c b/arch/arm/mach-realview/localtimer.c
index c7bdf04ab094..529eb6979e61 100644
--- a/arch/arm/mach-realview/localtimer.c
+++ b/arch/arm/mach-realview/localtimer.c
@@ -14,6 +14,8 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/jiffies.h> 16#include <linux/jiffies.h>
17#include <linux/percpu.h>
18#include <linux/clockchips.h>
17 19
18#include <asm/mach/time.h> 20#include <asm/mach/time.h>
19#include <asm/hardware/arm_twd.h> 21#include <asm/hardware/arm_twd.h>
@@ -25,6 +27,20 @@
25#define TWD_BASE(cpu) (__io_address(REALVIEW_TWD_BASE) + \ 27#define TWD_BASE(cpu) (__io_address(REALVIEW_TWD_BASE) + \
26 ((cpu) * REALVIEW_TWD_SIZE)) 28 ((cpu) * REALVIEW_TWD_SIZE))
27 29
30static DEFINE_PER_CPU(struct clock_event_device, local_clockevent);
31
32/*
33 * Used on SMP for either the local timer or IPI_TIMER
34 */
35void local_timer_interrupt(void)
36{
37 struct clock_event_device *clk = &__get_cpu_var(local_clockevent);
38
39 clk->event_handler(clk);
40}
41
42#ifdef CONFIG_LOCAL_TIMERS
43
28static unsigned long mpcore_timer_rate; 44static unsigned long mpcore_timer_rate;
29 45
30/* 46/*
@@ -127,3 +143,26 @@ void __cpuexit local_timer_stop(unsigned int cpu)
127{ 143{
128 __raw_writel(0, TWD_BASE(cpu) + TWD_TIMER_CONTROL); 144 __raw_writel(0, TWD_BASE(cpu) + TWD_TIMER_CONTROL);
129} 145}
146
147#else /* CONFIG_LOCAL_TIMERS */
148
149static void dummy_timer_set_mode(enum clock_event_mode mode,
150 struct clock_event_device *clk)
151{
152}
153
154void __cpuinit local_timer_setup(unsigned int cpu)
155{
156 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
157
158 clk->name = "dummy_timer";
159 clk->features = CLOCK_EVT_FEAT_DUMMY;
160 clk->rating = 200;
161 clk->set_mode = dummy_timer_set_mode;
162 clk->broadcast = smp_timer_broadcast;
163 clk->cpumask = cpumask_of_cpu(cpu);
164
165 clockevents_register_device(clk);
166}
167
168#endif /* !CONFIG_LOCAL_TIMERS */