diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2011-09-08 08:15:22 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-09-14 05:14:58 -0400 |
commit | 5ac21a943e4052ef6743b09b6a06fbb683a3519d (patch) | |
tree | e47d3289d14ebe936ecf720137f0a70b6258b7d7 /arch/arm | |
parent | 44ea349f5b7e0b4865de9ca6b4437c746eede40c (diff) |
ARM: SoC: convert ux500 to SMP operations
Convert ux500 platforms to use struct smp_operations to provide
their SMP and CPU hotplug operations.
Cc: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-ux500/hotplug.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/setup.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-ux500/platsmp.c | 18 |
4 files changed, 30 insertions, 31 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index a534d8880de1..1c6f74b62dfa 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -694,6 +694,7 @@ static void __init hrefv60_init_machine(void) | |||
694 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | 694 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |
695 | /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */ | 695 | /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */ |
696 | .atag_offset = 0x100, | 696 | .atag_offset = 0x100, |
697 | .smp = smp_ops(ux500_smp_ops), | ||
697 | .map_io = u8500_map_io, | 698 | .map_io = u8500_map_io, |
698 | .init_irq = ux500_init_irq, | 699 | .init_irq = ux500_init_irq, |
699 | /* we re-use nomadik timer here */ | 700 | /* we re-use nomadik timer here */ |
@@ -705,6 +706,7 @@ MACHINE_END | |||
705 | 706 | ||
706 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") | 707 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") |
707 | .atag_offset = 0x100, | 708 | .atag_offset = 0x100, |
709 | .smp = smp_ops(ux500_smp_ops), | ||
708 | .map_io = u8500_map_io, | 710 | .map_io = u8500_map_io, |
709 | .init_irq = ux500_init_irq, | 711 | .init_irq = ux500_init_irq, |
710 | .timer = &ux500_timer, | 712 | .timer = &ux500_timer, |
@@ -715,6 +717,7 @@ MACHINE_END | |||
715 | 717 | ||
716 | MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") | 718 | MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") |
717 | .atag_offset = 0x100, | 719 | .atag_offset = 0x100, |
720 | .smp = smp_ops(ux500_smp_ops), | ||
718 | .map_io = u8500_map_io, | 721 | .map_io = u8500_map_io, |
719 | .init_irq = ux500_init_irq, | 722 | .init_irq = ux500_init_irq, |
720 | /* we re-use nomadik timer here */ | 723 | /* we re-use nomadik timer here */ |
@@ -844,6 +847,7 @@ static const char * u8500_dt_board_compat[] = { | |||
844 | 847 | ||
845 | 848 | ||
846 | DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)") | 849 | DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)") |
850 | .smp = smp_ops(ux500_smp_ops), | ||
847 | .map_io = u8500_map_io, | 851 | .map_io = u8500_map_io, |
848 | .init_irq = ux500_init_irq, | 852 | .init_irq = ux500_init_irq, |
849 | /* we re-use nomadik timer here */ | 853 | /* we re-use nomadik timer here */ |
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c index c76f0f456f04..b8e4d9ed62d8 100644 --- a/arch/arm/mach-ux500/hotplug.c +++ b/arch/arm/mach-ux500/hotplug.c | |||
@@ -15,13 +15,20 @@ | |||
15 | #include <asm/cacheflush.h> | 15 | #include <asm/cacheflush.h> |
16 | #include <asm/smp_plat.h> | 16 | #include <asm/smp_plat.h> |
17 | 17 | ||
18 | #include <mach/setup.h> | ||
19 | |||
18 | extern volatile int pen_release; | 20 | extern volatile int pen_release; |
19 | 21 | ||
20 | static inline void platform_do_lowpower(unsigned int cpu) | 22 | /* |
23 | * platform-specific code to shutdown a CPU | ||
24 | * | ||
25 | * Called with IRQs disabled | ||
26 | */ | ||
27 | void __ref ux500_cpu_die(unsigned int cpu) | ||
21 | { | 28 | { |
22 | flush_cache_all(); | 29 | flush_cache_all(); |
23 | 30 | ||
24 | /* we put the platform to just WFI */ | 31 | /* directly enter low power state, skipping secure registers */ |
25 | for (;;) { | 32 | for (;;) { |
26 | __asm__ __volatile__("dsb\n\t" "wfi\n\t" | 33 | __asm__ __volatile__("dsb\n\t" "wfi\n\t" |
27 | : : : "memory"); | 34 | : : : "memory"); |
@@ -33,28 +40,3 @@ static inline void platform_do_lowpower(unsigned int cpu) | |||
33 | } | 40 | } |
34 | } | 41 | } |
35 | } | 42 | } |
36 | |||
37 | int platform_cpu_kill(unsigned int cpu) | ||
38 | { | ||
39 | return 1; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * platform-specific code to shutdown a CPU | ||
44 | * | ||
45 | * Called with IRQs disabled | ||
46 | */ | ||
47 | void platform_cpu_die(unsigned int cpu) | ||
48 | { | ||
49 | /* directly enter low power state, skipping secure registers */ | ||
50 | platform_do_lowpower(cpu); | ||
51 | } | ||
52 | |||
53 | int platform_cpu_disable(unsigned int cpu) | ||
54 | { | ||
55 | /* | ||
56 | * we don't allow CPU 0 to be shutdown (it is still too special | ||
57 | * e.g. clock tick interrupts) | ||
58 | */ | ||
59 | return cpu == 0 ? -EPERM : 0; | ||
60 | } | ||
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h index 7914e5eaa9c7..6be4c4d2ab88 100644 --- a/arch/arm/mach-ux500/include/mach/setup.h +++ b/arch/arm/mach-ux500/include/mach/setup.h | |||
@@ -45,4 +45,7 @@ extern struct sys_timer ux500_timer; | |||
45 | .type = MT_MEMORY, \ | 45 | .type = MT_MEMORY, \ |
46 | } | 46 | } |
47 | 47 | ||
48 | extern struct smp_operations ux500_smp_ops; | ||
49 | extern void ux500_cpu_die(unsigned int cpu); | ||
50 | |||
48 | #endif /* __ASM_ARCH_SETUP_H */ | 51 | #endif /* __ASM_ARCH_SETUP_H */ |
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index da1d5ad5bd45..b6f4e0e787ec 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
@@ -58,7 +58,7 @@ static void __iomem *scu_base_addr(void) | |||
58 | 58 | ||
59 | static DEFINE_SPINLOCK(boot_lock); | 59 | static DEFINE_SPINLOCK(boot_lock); |
60 | 60 | ||
61 | void __cpuinit platform_secondary_init(unsigned int cpu) | 61 | static void __cpuinit ux500_secondary_init(unsigned int cpu) |
62 | { | 62 | { |
63 | /* | 63 | /* |
64 | * if any interrupts are already enabled for the primary | 64 | * if any interrupts are already enabled for the primary |
@@ -80,7 +80,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu) | |||
80 | spin_unlock(&boot_lock); | 80 | spin_unlock(&boot_lock); |
81 | } | 81 | } |
82 | 82 | ||
83 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | 83 | static int __cpuinit ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) |
84 | { | 84 | { |
85 | unsigned long timeout; | 85 | unsigned long timeout; |
86 | 86 | ||
@@ -145,7 +145,7 @@ static void __init wakeup_secondary(void) | |||
145 | * Initialise the CPU possible map early - this describes the CPUs | 145 | * Initialise the CPU possible map early - this describes the CPUs |
146 | * which may be present or become present in the system. | 146 | * which may be present or become present in the system. |
147 | */ | 147 | */ |
148 | void __init smp_init_cpus(void) | 148 | static void __init ux500_smp_init_cpus(void) |
149 | { | 149 | { |
150 | void __iomem *scu_base = scu_base_addr(); | 150 | void __iomem *scu_base = scu_base_addr(); |
151 | unsigned int i, ncores; | 151 | unsigned int i, ncores; |
@@ -165,9 +165,19 @@ void __init smp_init_cpus(void) | |||
165 | set_smp_cross_call(gic_raise_softirq); | 165 | set_smp_cross_call(gic_raise_softirq); |
166 | } | 166 | } |
167 | 167 | ||
168 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 168 | static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) |
169 | { | 169 | { |
170 | 170 | ||
171 | scu_enable(scu_base_addr()); | 171 | scu_enable(scu_base_addr()); |
172 | wakeup_secondary(); | 172 | wakeup_secondary(); |
173 | } | 173 | } |
174 | |||
175 | struct smp_operations ux500_smp_ops __initdata = { | ||
176 | .smp_init_cpus = ux500_smp_init_cpus, | ||
177 | .smp_prepare_cpus = ux500_smp_prepare_cpus, | ||
178 | .smp_secondary_init = ux500_secondary_init, | ||
179 | .smp_boot_secondary = ux500_boot_secondary, | ||
180 | #ifdef CONFIG_HOTPLUG_CPU | ||
181 | .cpu_die = ux500_cpu_die, | ||
182 | #endif | ||
183 | }; | ||