Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 6759/1: smp: Select local timers vs broadcast timer support runtime

The current code support of dummy timers in absence of local
timer is compile time. This is an attempt to convert it to runtime
so that on few SOC version if the local timers aren't supported
kernel can switch to dummy timers. OMAP4430 ES1.0 does suffer from
this limitation.

This patch should not have any functional impact on affected
files.

Cc: Daniel Walker <dwalker@codeaurora.org>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Colin Cross <ccross@android.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Santosh Shilimkar and committed by
Russell King
af90f10d d77e270c

+24 -12
+7 -1
arch/arm/include/asm/localtimer.h
··· 44 44 /* 45 45 * Setup a local timer interrupt for a CPU. 46 46 */ 47 - void local_timer_setup(struct clock_event_device *); 47 + int local_timer_setup(struct clock_event_device *); 48 48 49 + #else 50 + 51 + static inline int local_timer_setup(struct clock_event_device *evt) 52 + { 53 + return -ENXIO; 54 + } 49 55 #endif 50 56 51 57 #endif
+3 -4
arch/arm/kernel/smp.c
··· 474 474 #define smp_timer_broadcast NULL 475 475 #endif 476 476 477 - #ifndef CONFIG_LOCAL_TIMERS 478 477 static void broadcast_timer_set_mode(enum clock_event_mode mode, 479 478 struct clock_event_device *evt) 480 479 { 481 480 } 482 481 483 - static void local_timer_setup(struct clock_event_device *evt) 482 + static void broadcast_timer_setup(struct clock_event_device *evt) 484 483 { 485 484 evt->name = "dummy_timer"; 486 485 evt->features = CLOCK_EVT_FEAT_ONESHOT | ··· 491 492 492 493 clockevents_register_device(evt); 493 494 } 494 - #endif 495 495 496 496 void __cpuinit percpu_timer_setup(void) 497 497 { ··· 500 502 evt->cpumask = cpumask_of(cpu); 501 503 evt->broadcast = smp_timer_broadcast; 502 504 503 - local_timer_setup(evt); 505 + if (local_timer_setup(evt)) 506 + broadcast_timer_setup(evt); 504 507 } 505 508 506 509 #ifdef CONFIG_HOTPLUG_CPU
+2 -1
arch/arm/mach-msm/timer.c
··· 255 255 } 256 256 257 257 #ifdef CONFIG_SMP 258 - void __cpuinit local_timer_setup(struct clock_event_device *evt) 258 + int __cpuinit local_timer_setup(struct clock_event_device *evt) 259 259 { 260 260 struct msm_clock *clock = &msm_clocks[MSM_GLOBAL_TIMER]; 261 261 ··· 287 287 gic_enable_ppi(clock->irq.irq); 288 288 289 289 clockevents_register_device(evt); 290 + return 0; 290 291 } 291 292 292 293 inline int local_timer_ack(void)
+2 -1
arch/arm/mach-omap2/timer-mpu.c
··· 26 26 /* 27 27 * Setup the local clock events for a CPU. 28 28 */ 29 - void __cpuinit local_timer_setup(struct clock_event_device *evt) 29 + int __cpuinit local_timer_setup(struct clock_event_device *evt) 30 30 { 31 31 evt->irq = OMAP44XX_IRQ_LOCALTIMER; 32 32 twd_timer_setup(evt); 33 + return 0; 33 34 } 34 35
+2 -1
arch/arm/mach-s5pv310/localtimer.c
··· 18 18 /* 19 19 * Setup the local clock events for a CPU. 20 20 */ 21 - void __cpuinit local_timer_setup(struct clock_event_device *evt) 21 + int __cpuinit local_timer_setup(struct clock_event_device *evt) 22 22 { 23 23 evt->irq = IRQ_LOCALTIMER; 24 24 twd_timer_setup(evt); 25 + return 0; 25 26 }
+2 -1
arch/arm/mach-shmobile/localtimer.c
··· 18 18 /* 19 19 * Setup the local clock events for a CPU. 20 20 */ 21 - void __cpuinit local_timer_setup(struct clock_event_device *evt) 21 + int __cpuinit local_timer_setup(struct clock_event_device *evt) 22 22 { 23 23 evt->irq = 29; 24 24 twd_timer_setup(evt); 25 + return 0; 25 26 }
+2 -1
arch/arm/mach-tegra/localtimer.c
··· 18 18 /* 19 19 * Setup the local clock events for a CPU. 20 20 */ 21 - void __cpuinit local_timer_setup(struct clock_event_device *evt) 21 + int __cpuinit local_timer_setup(struct clock_event_device *evt) 22 22 { 23 23 evt->irq = IRQ_LOCALTIMER; 24 24 twd_timer_setup(evt); 25 + return 0; 25 26 }
+2 -1
arch/arm/mach-ux500/localtimer.c
··· 21 21 /* 22 22 * Setup the local clock events for a CPU. 23 23 */ 24 - void __cpuinit local_timer_setup(struct clock_event_device *evt) 24 + int __cpuinit local_timer_setup(struct clock_event_device *evt) 25 25 { 26 26 evt->irq = IRQ_LOCALTIMER; 27 27 twd_timer_setup(evt); 28 + return 0; 28 29 }
+2 -1
arch/arm/plat-versatile/localtimer.c
··· 19 19 /* 20 20 * Setup the local clock events for a CPU. 21 21 */ 22 - void __cpuinit local_timer_setup(struct clock_event_device *evt) 22 + int __cpuinit local_timer_setup(struct clock_event_device *evt) 23 23 { 24 24 evt->irq = IRQ_LOCALTIMER; 25 25 twd_timer_setup(evt); 26 + return 0; 26 27 }