aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2011-09-08 08:15:22 -0400
committerArnd Bergmann <arnd@arndb.de>2012-09-13 09:35:49 -0400
commita17257322f5e6ca376c15908b55423369274fcad (patch)
treeeda0026c1ba985db6e9029d0d79d5f4ea5d86a9e
parent06915321e7935d2eb778f0a7f333b2603c1404df (diff)
ARM: SoC: convert Tegra to SMP operations
Convert Tegra to use struct smp_operations to provide its SMP and CPU hotplug operations. Tested on Harmony. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Stephen Warren <swarren@nvidia.com> Acked-by: Olof Johansson <olof@lixom.net> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c2
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra30.c2
-rw-r--r--arch/arm/mach-tegra/board-harmony.c2
-rw-r--r--arch/arm/mach-tegra/board-paz00.c2
-rw-r--r--arch/arm/mach-tegra/board-trimslice.c2
-rw-r--r--arch/arm/mach-tegra/common.c1
-rw-r--r--arch/arm/mach-tegra/common.h3
-rw-r--r--arch/arm/mach-tegra/hotplug.c16
-rw-r--r--arch/arm/mach-tegra/platsmp.c20
9 files changed, 31 insertions, 19 deletions
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index c0999633a9ab..a30537c8003d 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -45,6 +45,7 @@
45#include "board-harmony.h" 45#include "board-harmony.h"
46#include "clock.h" 46#include "clock.h"
47#include "devices.h" 47#include "devices.h"
48#include "common.h"
48 49
49struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { 50struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
50 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), 51 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL),
@@ -166,6 +167,7 @@ static const char *tegra20_dt_board_compat[] = {
166 167
167DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)") 168DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
168 .map_io = tegra_map_common_io, 169 .map_io = tegra_map_common_io,
170 .smp = smp_ops(tegra_smp_ops),
169 .init_early = tegra20_init_early, 171 .init_early = tegra20_init_early,
170 .init_irq = tegra_dt_init_irq, 172 .init_irq = tegra_dt_init_irq,
171 .handle_irq = gic_handle_irq, 173 .handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index 53bf60f11580..e4a676d4ddf7 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -37,6 +37,7 @@
37 37
38#include "board.h" 38#include "board.h"
39#include "clock.h" 39#include "clock.h"
40#include "common.h"
40 41
41struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = { 42struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
42 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL), 43 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL),
@@ -83,6 +84,7 @@ static const char *tegra30_dt_board_compat[] = {
83}; 84};
84 85
85DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)") 86DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
87 .smp = smp_ops(tegra_smp_ops),
86 .map_io = tegra_map_common_io, 88 .map_io = tegra_map_common_io,
87 .init_early = tegra30_init_early, 89 .init_early = tegra30_init_early,
88 .init_irq = tegra_dt_init_irq, 90 .init_irq = tegra_dt_init_irq,
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index e65e837f4013..c1a0c8d134df 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -45,6 +45,7 @@
45#include "clock.h" 45#include "clock.h"
46#include "devices.h" 46#include "devices.h"
47#include "gpio-names.h" 47#include "gpio-names.h"
48#include "common.h"
48 49
49static struct plat_serial8250_port debug_uart_platform_data[] = { 50static struct plat_serial8250_port debug_uart_platform_data[] = {
50 { 51 {
@@ -185,6 +186,7 @@ static void __init tegra_harmony_init(void)
185 186
186MACHINE_START(HARMONY, "harmony") 187MACHINE_START(HARMONY, "harmony")
187 .atag_offset = 0x100, 188 .atag_offset = 0x100,
189 .smp = smp_ops(tegra_smp_ops),
188 .fixup = tegra_harmony_fixup, 190 .fixup = tegra_harmony_fixup,
189 .map_io = tegra_map_common_io, 191 .map_io = tegra_map_common_io,
190 .init_early = tegra20_init_early, 192 .init_early = tegra20_init_early,
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 4b64af5cab27..2b25cc73681b 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -47,6 +47,7 @@
47#include "clock.h" 47#include "clock.h"
48#include "devices.h" 48#include "devices.h"
49#include "gpio-names.h" 49#include "gpio-names.h"
50#include "common.h"
50 51
51static struct plat_serial8250_port debug_uart_platform_data[] = { 52static struct plat_serial8250_port debug_uart_platform_data[] = {
52 { 53 {
@@ -223,6 +224,7 @@ static void __init tegra_paz00_init(void)
223 224
224MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ") 225MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
225 .atag_offset = 0x100, 226 .atag_offset = 0x100,
227 .smp = smp_ops(tegra_smp_ops),
226 .fixup = tegra_paz00_fixup, 228 .fixup = tegra_paz00_fixup,
227 .map_io = tegra_map_common_io, 229 .map_io = tegra_map_common_io,
228 .init_early = tegra20_init_early, 230 .init_early = tegra20_init_early,
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index 776aa9564d5d..6a1e0b2cb2c8 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -40,6 +40,7 @@
40#include "clock.h" 40#include "clock.h"
41#include "devices.h" 41#include "devices.h"
42#include "gpio-names.h" 42#include "gpio-names.h"
43#include "common.h"
43 44
44#include "board-trimslice.h" 45#include "board-trimslice.h"
45 46
@@ -171,6 +172,7 @@ static void __init tegra_trimslice_init(void)
171 172
172MACHINE_START(TRIMSLICE, "trimslice") 173MACHINE_START(TRIMSLICE, "trimslice")
173 .atag_offset = 0x100, 174 .atag_offset = 0x100,
175 .smp = smp_ops(tegra_smp_ops),
174 .fixup = tegra_trimslice_fixup, 176 .fixup = tegra_trimslice_fixup,
175 .map_io = tegra_map_common_io, 177 .map_io = tegra_map_common_io,
176 .init_early = tegra20_init_early, 178 .init_early = tegra20_init_early,
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 96fef6bcc651..990f275956eb 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -31,6 +31,7 @@
31 31
32#include "board.h" 32#include "board.h"
33#include "clock.h" 33#include "clock.h"
34#include "common.h"
34#include "fuse.h" 35#include "fuse.h"
35#include "pmc.h" 36#include "pmc.h"
36#include "apbio.h" 37#include "apbio.h"
diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
new file mode 100644
index 000000000000..301b35e2f890
--- /dev/null
+++ b/arch/arm/mach-tegra/common.h
@@ -0,0 +1,3 @@
1extern struct smp_operations tegra_smp_ops;
2
3extern void tegra_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index d8dc9ddd6d18..2440705438f4 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -87,17 +87,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
87 } 87 }
88} 88}
89 89
90int platform_cpu_kill(unsigned int cpu)
91{
92 return 1;
93}
94
95/* 90/*
96 * platform-specific code to shutdown a CPU 91 * platform-specific code to shutdown a CPU
97 * 92 *
98 * Called with IRQs disabled 93 * Called with IRQs disabled
99 */ 94 */
100void platform_cpu_die(unsigned int cpu) 95void __ref tegra_cpu_die(unsigned int cpu)
101{ 96{
102 int spurious = 0; 97 int spurious = 0;
103 98
@@ -116,12 +111,3 @@ void platform_cpu_die(unsigned int cpu)
116 if (spurious) 111 if (spurious)
117 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); 112 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
118} 113}
119
120int platform_cpu_disable(unsigned int cpu)
121{
122 /*
123 * we don't allow CPU 0 to be shutdown (it is still too special
124 * e.g. clock tick interrupts)
125 */
126 return cpu == 0 ? -EPERM : 0;
127}
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 1a208dbf682f..24bfb6534c21 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -32,6 +32,8 @@
32#include "flowctrl.h" 32#include "flowctrl.h"
33#include "reset.h" 33#include "reset.h"
34 34
35#include "common.h"
36
35extern void tegra_secondary_startup(void); 37extern void tegra_secondary_startup(void);
36 38
37static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE); 39static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
@@ -50,7 +52,7 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
50#define CPU_CLOCK(cpu) (0x1<<(8+cpu)) 52#define CPU_CLOCK(cpu) (0x1<<(8+cpu))
51#define CPU_RESET(cpu) (0x1111ul<<(cpu)) 53#define CPU_RESET(cpu) (0x1111ul<<(cpu))
52 54
53void __cpuinit platform_secondary_init(unsigned int cpu) 55static void __cpuinit tegra_secondary_init(unsigned int cpu)
54{ 56{
55 /* 57 /*
56 * if any interrupts are already enabled for the primary 58 * if any interrupts are already enabled for the primary
@@ -117,7 +119,7 @@ static int tegra30_power_up_cpu(unsigned int cpu)
117 return 0; 119 return 0;
118} 120}
119 121
120int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 122static int __cpuinit tegra_boot_secondary(unsigned int cpu, struct task_struct *idle)
121{ 123{
122 int status; 124 int status;
123 125
@@ -165,7 +167,7 @@ done:
165 * Initialise the CPU possible map early - this describes the CPUs 167 * Initialise the CPU possible map early - this describes the CPUs
166 * which may be present or become present in the system. 168 * which may be present or become present in the system.
167 */ 169 */
168void __init smp_init_cpus(void) 170static void __init tegra_smp_init_cpus(void)
169{ 171{
170 unsigned int i, ncores = scu_get_core_count(scu_base); 172 unsigned int i, ncores = scu_get_core_count(scu_base);
171 173
@@ -181,8 +183,18 @@ void __init smp_init_cpus(void)
181 set_smp_cross_call(gic_raise_softirq); 183 set_smp_cross_call(gic_raise_softirq);
182} 184}
183 185
184void __init platform_smp_prepare_cpus(unsigned int max_cpus) 186static void __init tegra_smp_prepare_cpus(unsigned int max_cpus)
185{ 187{
186 tegra_cpu_reset_handler_init(); 188 tegra_cpu_reset_handler_init();
187 scu_enable(scu_base); 189 scu_enable(scu_base);
188} 190}
191
192struct smp_operations tegra_smp_ops __initdata = {
193 .smp_init_cpus = tegra_smp_init_cpus,
194 .smp_prepare_cpus = tegra_smp_prepare_cpus,
195 .smp_secondary_init = tegra_secondary_init,
196 .smp_boot_secondary = tegra_boot_secondary,
197#ifdef CONFIG_HOTPLUG_CPU
198 .cpu_die = tegra_cpu_die,
199#endif
200};