Commit 06853ae4 authored by Marc Zyngier's avatar Marc Zyngier Committed by Arnd Bergmann

ARM: SoC: convert Exynos4 to SMP operations

Convert Exynos4 to use struct smp_operations to provide its SMP
and CPU hotplug operations.
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Acked-by: default avatarNicolas Pitre <nico@linaro.org>
Tested-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent a1725732
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
extern struct sys_timer exynos4_timer; extern struct sys_timer exynos4_timer;
struct map_desc;
void exynos_init_io(struct map_desc *mach_desc, int size); void exynos_init_io(struct map_desc *mach_desc, int size);
void exynos4_init_irq(void); void exynos4_init_irq(void);
void exynos5_init_irq(void); void exynos5_init_irq(void);
...@@ -59,4 +60,8 @@ void exynos4212_register_clocks(void); ...@@ -59,4 +60,8 @@ void exynos4212_register_clocks(void);
#define exynos4212_register_clocks() #define exynos4212_register_clocks()
#endif #endif
extern struct smp_operations exynos_smp_ops;
extern void exynos_cpu_die(unsigned int cpu);
#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <mach/regs-pmu.h> #include <mach/regs-pmu.h>
#include "common.h"
extern volatile int pen_release; extern volatile int pen_release;
static inline void cpu_enter_lowpower(void) static inline void cpu_enter_lowpower(void)
...@@ -95,17 +97,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) ...@@ -95,17 +97,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
} }
} }
int platform_cpu_kill(unsigned int cpu)
{
return 1;
}
/* /*
* platform-specific code to shutdown a CPU * platform-specific code to shutdown a CPU
* *
* Called with IRQs disabled * Called with IRQs disabled
*/ */
void platform_cpu_die(unsigned int cpu) void __ref exynos_cpu_die(unsigned int cpu)
{ {
int spurious = 0; int spurious = 0;
...@@ -124,12 +121,3 @@ void platform_cpu_die(unsigned int cpu) ...@@ -124,12 +121,3 @@ void platform_cpu_die(unsigned int cpu)
if (spurious) if (spurious)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
} }
int platform_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
* e.g. clock tick interrupts)
*/
return cpu == 0 ? -EPERM : 0;
}
...@@ -199,6 +199,7 @@ static void __init armlex4210_machine_init(void) ...@@ -199,6 +199,7 @@ static void __init armlex4210_machine_init(void)
MACHINE_START(ARMLEX4210, "ARMLEX4210") MACHINE_START(ARMLEX4210, "ARMLEX4210")
/* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */ /* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = armlex4210_map_io, .map_io = armlex4210_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
......
...@@ -79,6 +79,7 @@ static char const *exynos5250_dt_compat[] __initdata = { ...@@ -79,6 +79,7 @@ static char const *exynos5250_dt_compat[] __initdata = {
DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
.init_irq = exynos5_init_irq, .init_irq = exynos5_init_irq,
.smp = smp_ops(exynos_smp_ops),
.map_io = exynos5250_dt_map_io, .map_io = exynos5250_dt_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
.init_machine = exynos5250_dt_machine_init, .init_machine = exynos5250_dt_machine_init,
......
...@@ -1383,6 +1383,7 @@ static void __init nuri_machine_init(void) ...@@ -1383,6 +1383,7 @@ static void __init nuri_machine_init(void)
MACHINE_START(NURI, "NURI") MACHINE_START(NURI, "NURI")
/* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = nuri_map_io, .map_io = nuri_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
......
...@@ -806,6 +806,7 @@ static void __init origen_machine_init(void) ...@@ -806,6 +806,7 @@ static void __init origen_machine_init(void)
MACHINE_START(ORIGEN, "ORIGEN") MACHINE_START(ORIGEN, "ORIGEN")
/* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */ /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = origen_map_io, .map_io = origen_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
......
...@@ -370,6 +370,7 @@ static void __init smdk4x12_machine_init(void) ...@@ -370,6 +370,7 @@ static void __init smdk4x12_machine_init(void)
MACHINE_START(SMDK4212, "SMDK4212") MACHINE_START(SMDK4212, "SMDK4212")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = smdk4x12_map_io, .map_io = smdk4x12_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
...@@ -383,6 +384,7 @@ MACHINE_START(SMDK4412, "SMDK4412") ...@@ -383,6 +384,7 @@ MACHINE_START(SMDK4412, "SMDK4412")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
/* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */ /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = smdk4x12_map_io, .map_io = smdk4x12_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
......
...@@ -417,6 +417,7 @@ MACHINE_START(SMDKV310, "SMDKV310") ...@@ -417,6 +417,7 @@ MACHINE_START(SMDKV310, "SMDKV310")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
/* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */ /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = smdkv310_map_io, .map_io = smdkv310_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
...@@ -429,6 +430,7 @@ MACHINE_END ...@@ -429,6 +430,7 @@ MACHINE_END
MACHINE_START(SMDKC210, "SMDKC210") MACHINE_START(SMDKC210, "SMDKC210")
/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = smdkv310_map_io, .map_io = smdkv310_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
......
...@@ -1155,6 +1155,7 @@ static void __init universal_machine_init(void) ...@@ -1155,6 +1155,7 @@ static void __init universal_machine_init(void)
MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
/* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(exynos_smp_ops),
.init_irq = exynos4_init_irq, .init_irq = exynos4_init_irq,
.map_io = universal_map_io, .map_io = universal_map_io,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <plat/cpu.h> #include <plat/cpu.h>
#include "common.h"
extern void exynos4_secondary_startup(void); extern void exynos4_secondary_startup(void);
#define CPU1_BOOT_REG (samsung_rev() == EXYNOS4210_REV_1_1 ? \ #define CPU1_BOOT_REG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
...@@ -64,7 +66,7 @@ static void __iomem *scu_base_addr(void) ...@@ -64,7 +66,7 @@ static void __iomem *scu_base_addr(void)
static DEFINE_SPINLOCK(boot_lock); static DEFINE_SPINLOCK(boot_lock);
void __cpuinit platform_secondary_init(unsigned int cpu) static void __cpuinit exynos_secondary_init(unsigned int cpu)
{ {
/* /*
* if any interrupts are already enabled for the primary * if any interrupts are already enabled for the primary
...@@ -86,7 +88,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu) ...@@ -86,7 +88,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
spin_unlock(&boot_lock); spin_unlock(&boot_lock);
} }
int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
{ {
unsigned long timeout; unsigned long timeout;
...@@ -161,7 +163,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) ...@@ -161,7 +163,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
* which may be present or become present in the system. * which may be present or become present in the system.
*/ */
void __init smp_init_cpus(void) static void __init exynos_smp_init_cpus(void)
{ {
void __iomem *scu_base = scu_base_addr(); void __iomem *scu_base = scu_base_addr();
unsigned int i, ncores; unsigned int i, ncores;
...@@ -184,7 +186,7 @@ void __init smp_init_cpus(void) ...@@ -184,7 +186,7 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq); set_smp_cross_call(gic_raise_softirq);
} }
void __init platform_smp_prepare_cpus(unsigned int max_cpus) static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
{ {
if (!soc_is_exynos5250()) if (!soc_is_exynos5250())
scu_enable(scu_base_addr()); scu_enable(scu_base_addr());
...@@ -198,3 +200,13 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus) ...@@ -198,3 +200,13 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
__raw_writel(virt_to_phys(exynos4_secondary_startup), __raw_writel(virt_to_phys(exynos4_secondary_startup),
CPU1_BOOT_REG); CPU1_BOOT_REG);
} }
struct smp_operations exynos_smp_ops __initdata = {
.smp_init_cpus = exynos_smp_init_cpus,
.smp_prepare_cpus = exynos_smp_prepare_cpus,
.smp_secondary_init = exynos_secondary_init,
.smp_boot_secondary = exynos_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_die = exynos_cpu_die,
#endif
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment