aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mvebu
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-04-14 09:53:58 -0400
committerJason Cooper <jason@lakedaemon.net>2014-05-08 12:07:37 -0400
commit05ad690608098b469d6052c700d96c35e697a955 (patch)
treebf9cccb0090608a1f75cff887183983c65cb5735 /arch/arm/mach-mvebu
parentd269a36ae7002d96a5691cdef96b5bb6f41330f6 (diff)
ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c
The pmsu.c driver contained an armada_xp_boot_cpu() function that sets the boot address of a secondary CPUs and deasserts the reset. However, the Armada 375 needs a slightly different logic, so it makes more sense to move this code into the Armada XP specific platsmp.c. In order to achieve this, the mvebu_pmsu_set_cpu_boot_addr() function is exported. It will be needed for both the Armada XP and Armada 38x SMP implementations. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Link: https://lkml.kernel.org/r/1397483648-26611-2-git-send-email-thomas.petazzoni@free-electrons.com Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-mvebu')
-rw-r--r--arch/arm/mach-mvebu/common.h1
-rw-r--r--arch/arm/mach-mvebu/platsmp.c10
-rw-r--r--arch/arm/mach-mvebu/pmsu.c26
3 files changed, 11 insertions, 26 deletions
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index cfb129b144c0..2b88eb00de89 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -19,6 +19,7 @@
19 19
20void mvebu_restart(enum reboot_mode mode, const char *cmd); 20void mvebu_restart(enum reboot_mode mode, const char *cmd);
21int mvebu_cpu_reset_deassert(int cpu); 21int mvebu_cpu_reset_deassert(int cpu);
22void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr);
22 23
23void armada_xp_cpu_die(unsigned int cpu); 24void armada_xp_cpu_die(unsigned int cpu);
24 25
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index a6da03f5b24e..e98075f7175a 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -77,9 +77,17 @@ static void armada_xp_secondary_init(unsigned int cpu)
77 77
78static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle) 78static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
79{ 79{
80 int ret, hw_cpu;
81
80 pr_info("Booting CPU %d\n", cpu); 82 pr_info("Booting CPU %d\n", cpu);
81 83
82 armada_xp_boot_cpu(cpu, armada_xp_secondary_startup); 84 hw_cpu = cpu_logical_map(cpu);
85 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup);
86 ret = mvebu_cpu_reset_deassert(hw_cpu);
87 if (ret) {
88 pr_warn("unable to boot CPU: %d\n", ret);
89 return ret;
90 }
83 91
84 return 0; 92 return 0;
85} 93}
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 8361281f9180..a1508deecd26 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -41,36 +41,12 @@ static struct of_device_id of_pmsu_table[] = {
41 { /* end of list */ }, 41 { /* end of list */ },
42}; 42};
43 43
44static void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr) 44void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
45{ 45{
46 writel(virt_to_phys(boot_addr), pmsu_mp_base + 46 writel(virt_to_phys(boot_addr), pmsu_mp_base +
47 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); 47 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu));
48} 48}
49 49
50#ifdef CONFIG_SMP
51int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr)
52{
53 int hw_cpu, ret;
54
55 if (!pmsu_mp_base) {
56 pr_warn("Can't boot CPU. PMSU is uninitialized\n");
57 return -ENODEV;
58 }
59
60 hw_cpu = cpu_logical_map(cpu_id);
61
62 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, boot_addr);
63
64 ret = mvebu_cpu_reset_deassert(hw_cpu);
65 if (ret) {
66 pr_warn("unable to boot CPU: %d\n", ret);
67 return ret;
68 }
69
70 return 0;
71}
72#endif
73
74static int __init armada_370_xp_pmsu_init(void) 50static int __init armada_370_xp_pmsu_init(void)
75{ 51{
76 struct device_node *np; 52 struct device_node *np;