diff options
-rw-r--r-- | arch/arm/include/asm/localtimer.h | 15 | ||||
-rw-r--r-- | arch/arm/kernel/smp.c | 27 |
2 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h index 7e1b2c5f7d17..f088d63b92c7 100644 --- a/arch/arm/include/asm/localtimer.h +++ b/arch/arm/include/asm/localtimer.h | |||
@@ -15,6 +15,11 @@ | |||
15 | 15 | ||
16 | struct clock_event_device; | 16 | struct clock_event_device; |
17 | 17 | ||
18 | struct local_timer_ops { | ||
19 | int (*setup)(struct clock_event_device *); | ||
20 | void (*stop)(struct clock_event_device *); | ||
21 | }; | ||
22 | |||
18 | /* | 23 | /* |
19 | * Setup a per-cpu timer, whether it be a local timer or dummy broadcast | 24 | * Setup a per-cpu timer, whether it be a local timer or dummy broadcast |
20 | */ | 25 | */ |
@@ -38,6 +43,11 @@ void local_timer_stop(struct clock_event_device *); | |||
38 | */ | 43 | */ |
39 | int local_timer_setup(struct clock_event_device *); | 44 | int local_timer_setup(struct clock_event_device *); |
40 | 45 | ||
46 | /* | ||
47 | * Register a local timer driver | ||
48 | */ | ||
49 | int local_timer_register(struct local_timer_ops *); | ||
50 | |||
41 | #else | 51 | #else |
42 | 52 | ||
43 | static inline int local_timer_setup(struct clock_event_device *evt) | 53 | static inline int local_timer_setup(struct clock_event_device *evt) |
@@ -48,6 +58,11 @@ static inline int local_timer_setup(struct clock_event_device *evt) | |||
48 | static inline void local_timer_stop(struct clock_event_device *evt) | 58 | static inline void local_timer_stop(struct clock_event_device *evt) |
49 | { | 59 | { |
50 | } | 60 | } |
61 | |||
62 | static inline int local_timer_register(struct local_timer_ops *ops) | ||
63 | { | ||
64 | return -ENXIO; | ||
65 | } | ||
51 | #endif | 66 | #endif |
52 | 67 | ||
53 | #endif | 68 | #endif |
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) | |||
459 | clockevents_register_device(evt); | 459 | clockevents_register_device(evt); |
460 | } | 460 | } |
461 | 461 | ||
462 | static struct local_timer_ops *lt_ops; | ||
463 | |||
464 | #ifdef CONFIG_LOCAL_TIMERS | ||
465 | int local_timer_register(struct local_timer_ops *ops) | ||
466 | { | ||
467 | if (lt_ops) | ||
468 | return -EBUSY; | ||
469 | |||
470 | lt_ops = ops; | ||
471 | return 0; | ||
472 | } | ||
473 | #endif | ||
474 | |||
475 | int __cpuinit __attribute__ ((weak)) local_timer_setup(struct clock_event_device *clk) | ||
476 | { | ||
477 | if (lt_ops) | ||
478 | return lt_ops->setup(clk); | ||
479 | |||
480 | return -ENXIO; | ||
481 | } | ||
482 | |||
483 | void __attribute__ ((weak)) local_timer_stop(struct clock_event_device *clk) | ||
484 | { | ||
485 | if (lt_ops) | ||
486 | lt_ops->stop(clk); | ||
487 | } | ||
488 | |||
462 | void __cpuinit percpu_timer_setup(void) | 489 | void __cpuinit percpu_timer_setup(void) |
463 | { | 490 | { |
464 | unsigned int cpu = smp_processor_id(); | 491 | unsigned int cpu = smp_processor_id(); |