aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-09-08 08:15:22 -0400
committerArnd Bergmann <arnd@arndb.de>2012-09-14 05:15:00 -0400
commit2d8b21d95f44989e09fd9b36ca9f061ad5bc567e (patch)
treea869e842cea511480f5cd8ecdedb109aa8c16072
parente4f2d97920f2256e5af035281e8ac35030493bf8 (diff)
ARM: SoC: convert spear13xx to SMP operations
Convert the spear13xx platform to use struct smp_operations to provide its SMP and CPU hotplug operations. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Nicolas Pitre <nico@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: Shiraz Hashim <shiraz.hashim@st.com> Cc: spear-devel@list.st.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--arch/arm/mach-spear13xx/hotplug.c20
-rw-r--r--arch/arm/mach-spear13xx/include/mach/generic.h3
-rw-r--r--arch/arm/mach-spear13xx/platsmp.c20
-rw-r--r--arch/arm/mach-spear13xx/spear1310.c1
-rw-r--r--arch/arm/mach-spear13xx/spear1340.c1
5 files changed, 23 insertions, 22 deletions
diff --git a/arch/arm/mach-spear13xx/hotplug.c b/arch/arm/mach-spear13xx/hotplug.c
index 5c6867b46d09..485fd4367bb1 100644
--- a/arch/arm/mach-spear13xx/hotplug.c
+++ b/arch/arm/mach-spear13xx/hotplug.c
@@ -56,7 +56,7 @@ static inline void cpu_leave_lowpower(void)
56 : "cc"); 56 : "cc");
57} 57}
58 58
59static inline void platform_do_lowpower(unsigned int cpu, int *spurious) 59static inline void spear13xx_do_lowpower(unsigned int cpu, int *spurious)
60{ 60{
61 for (;;) { 61 for (;;) {
62 wfi(); 62 wfi();
@@ -79,17 +79,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
79 } 79 }
80} 80}
81 81
82int platform_cpu_kill(unsigned int cpu)
83{
84 return 1;
85}
86
87/* 82/*
88 * platform-specific code to shutdown a CPU 83 * platform-specific code to shutdown a CPU
89 * 84 *
90 * Called with IRQs disabled 85 * Called with IRQs disabled
91 */ 86 */
92void __cpuinit platform_cpu_die(unsigned int cpu) 87void __ref spear13xx_cpu_die(unsigned int cpu)
93{ 88{
94 int spurious = 0; 89 int spurious = 0;
95 90
@@ -97,7 +92,7 @@ void __cpuinit platform_cpu_die(unsigned int cpu)
97 * we're ready for shutdown now, so do it 92 * we're ready for shutdown now, so do it
98 */ 93 */
99 cpu_enter_lowpower(); 94 cpu_enter_lowpower();
100 platform_do_lowpower(cpu, &spurious); 95 spear13xx_do_lowpower(cpu, &spurious);
101 96
102 /* 97 /*
103 * bring this CPU back into the world of cache 98 * bring this CPU back into the world of cache
@@ -108,12 +103,3 @@ void __cpuinit platform_cpu_die(unsigned int cpu)
108 if (spurious) 103 if (spurious)
109 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); 104 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
110} 105}
111
112int platform_cpu_disable(unsigned int cpu)
113{
114 /*
115 * we don't allow CPU 0 to be shutdown (it is still too special
116 * e.g. clock tick interrupts)
117 */
118 return cpu == 0 ? -EPERM : 0;
119}
diff --git a/arch/arm/mach-spear13xx/include/mach/generic.h b/arch/arm/mach-spear13xx/include/mach/generic.h
index dac57fd0cdfd..c33f4d9361bd 100644
--- a/arch/arm/mach-spear13xx/include/mach/generic.h
+++ b/arch/arm/mach-spear13xx/include/mach/generic.h
@@ -33,6 +33,9 @@ void __init spear13xx_l2x0_init(void);
33bool dw_dma_filter(struct dma_chan *chan, void *slave); 33bool dw_dma_filter(struct dma_chan *chan, void *slave);
34void spear_restart(char, const char *); 34void spear_restart(char, const char *);
35void spear13xx_secondary_startup(void); 35void spear13xx_secondary_startup(void);
36void __cpuinit spear13xx_cpu_die(unsigned int cpu);
37
38extern struct smp_operations spear13xx_smp_ops;
36 39
37#ifdef CONFIG_MACH_SPEAR1310 40#ifdef CONFIG_MACH_SPEAR1310
38void __init spear1310_clk_init(void); 41void __init spear1310_clk_init(void);
diff --git a/arch/arm/mach-spear13xx/platsmp.c b/arch/arm/mach-spear13xx/platsmp.c
index f5d07f2663d7..806343c7b5d8 100644
--- a/arch/arm/mach-spear13xx/platsmp.c
+++ b/arch/arm/mach-spear13xx/platsmp.c
@@ -19,6 +19,7 @@
19#include <asm/hardware/gic.h> 19#include <asm/hardware/gic.h>
20#include <asm/smp_scu.h> 20#include <asm/smp_scu.h>
21#include <mach/spear.h> 21#include <mach/spear.h>
22#include <mach/generic.h>
22 23
23/* 24/*
24 * control for which core is the next to come out of the secondary 25 * control for which core is the next to come out of the secondary
@@ -28,9 +29,8 @@ volatile int __cpuinitdata pen_release = -1;
28static DEFINE_SPINLOCK(boot_lock); 29static DEFINE_SPINLOCK(boot_lock);
29 30
30static void __iomem *scu_base = IOMEM(VA_SCU_BASE); 31static void __iomem *scu_base = IOMEM(VA_SCU_BASE);
31extern void spear13xx_secondary_startup(void);
32 32
33void __cpuinit platform_secondary_init(unsigned int cpu) 33static void __cpuinit spear13xx_secondary_init(unsigned int cpu)
34{ 34{
35 /* 35 /*
36 * if any interrupts are already enabled for the primary 36 * if any interrupts are already enabled for the primary
@@ -53,7 +53,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
53 spin_unlock(&boot_lock); 53 spin_unlock(&boot_lock);
54} 54}
55 55
56int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 56static int __cpuinit spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle)
57{ 57{
58 unsigned long timeout; 58 unsigned long timeout;
59 59
@@ -97,7 +97,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
97 * Initialise the CPU possible map early - this describes the CPUs 97 * Initialise the CPU possible map early - this describes the CPUs
98 * which may be present or become present in the system. 98 * which may be present or become present in the system.
99 */ 99 */
100void __init smp_init_cpus(void) 100static void __init spear13xx_smp_init_cpus(void)
101{ 101{
102 unsigned int i, ncores = scu_get_core_count(scu_base); 102 unsigned int i, ncores = scu_get_core_count(scu_base);
103 103
@@ -113,7 +113,7 @@ void __init smp_init_cpus(void)
113 set_smp_cross_call(gic_raise_softirq); 113 set_smp_cross_call(gic_raise_softirq);
114} 114}
115 115
116void __init platform_smp_prepare_cpus(unsigned int max_cpus) 116static void __init spear13xx_smp_prepare_cpus(unsigned int max_cpus)
117{ 117{
118 118
119 scu_enable(scu_base); 119 scu_enable(scu_base);
@@ -125,3 +125,13 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
125 */ 125 */
126 __raw_writel(virt_to_phys(spear13xx_secondary_startup), SYS_LOCATION); 126 __raw_writel(virt_to_phys(spear13xx_secondary_startup), SYS_LOCATION);
127} 127}
128
129struct smp_operations spear13xx_smp_ops __initdata = {
130 .smp_init_cpus = spear13xx_smp_init_cpus,
131 .smp_prepare_cpus = spear13xx_smp_prepare_cpus,
132 .smp_secondary_init = spear13xx_secondary_init,
133 .smp_boot_secondary = spear13xx_boot_secondary,
134#ifdef CONFIG_HOTPLUG_CPU
135 .cpu_die = spear13xx_cpu_die,
136#endif
137};
diff --git a/arch/arm/mach-spear13xx/spear1310.c b/arch/arm/mach-spear13xx/spear1310.c
index 732d29bc7330..9fbbfc5650aa 100644
--- a/arch/arm/mach-spear13xx/spear1310.c
+++ b/arch/arm/mach-spear13xx/spear1310.c
@@ -78,6 +78,7 @@ static void __init spear1310_map_io(void)
78} 78}
79 79
80DT_MACHINE_START(SPEAR1310_DT, "ST SPEAr1310 SoC with Flattened Device Tree") 80DT_MACHINE_START(SPEAR1310_DT, "ST SPEAr1310 SoC with Flattened Device Tree")
81 .smp = smp_ops(spear13xx_smp_ops),
81 .map_io = spear1310_map_io, 82 .map_io = spear1310_map_io,
82 .init_irq = spear13xx_dt_init_irq, 83 .init_irq = spear13xx_dt_init_irq,
83 .handle_irq = gic_handle_irq, 84 .handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-spear13xx/spear1340.c b/arch/arm/mach-spear13xx/spear1340.c
index 81e4ed76ad06..081014fb314a 100644
--- a/arch/arm/mach-spear13xx/spear1340.c
+++ b/arch/arm/mach-spear13xx/spear1340.c
@@ -182,6 +182,7 @@ static const char * const spear1340_dt_board_compat[] = {
182}; 182};
183 183
184DT_MACHINE_START(SPEAR1340_DT, "ST SPEAr1340 SoC with Flattened Device Tree") 184DT_MACHINE_START(SPEAR1340_DT, "ST SPEAr1340 SoC with Flattened Device Tree")
185 .smp = smp_ops(spear13xx_smp_ops),
185 .map_io = spear13xx_map_io, 186 .map_io = spear13xx_map_io,
186 .init_irq = spear13xx_dt_init_irq, 187 .init_irq = spear13xx_dt_init_irq,
187 .handle_irq = gic_handle_irq, 188 .handle_irq = gic_handle_irq,