diff options
author | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2014-07-23 09:00:41 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-07-24 07:46:10 -0400 |
commit | 305969fb629284bcd35065911179a79f41954b9a (patch) | |
tree | 90ef06b2ed317cd70d16824e8110c59d5845b045 /arch/arm/mach-mvebu | |
parent | 3076cc58c958090ad50acf50fc855845e3462523 (diff) |
ARM: mvebu: use the common function for Armada 375 SMP workaround
Use the common function mvebu_setup_boot_addr_wa() introduced in the
commit "ARM: mvebu: Add a common function for the boot address work
around" instead of the dedicated version for Armada 375.
This commit also moves the workaround in the system-controller
module. Indeed the workaround on 375 is really related to setting the
boot address which is done by the system controller.
As a bonus we no longer use an harcoded value to access the register
storing the boot address.
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Link: https://lkml.kernel.org/r/1406120453-29291-5-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/headsmp-a9.S | 15 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/platsmp-a9.c | 42 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/system-controller.c | 31 |
3 files changed, 34 insertions, 54 deletions
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S index da5bb292b91c..be51c998c0cd 100644 --- a/arch/arm/mach-mvebu/headsmp-a9.S +++ b/arch/arm/mach-mvebu/headsmp-a9.S | |||
@@ -18,21 +18,6 @@ | |||
18 | #include <asm/assembler.h> | 18 | #include <asm/assembler.h> |
19 | 19 | ||
20 | __CPUINIT | 20 | __CPUINIT |
21 | #define CPU_RESUME_ADDR_REG 0xf10182d4 | ||
22 | |||
23 | .global armada_375_smp_cpu1_enable_code_start | ||
24 | .global armada_375_smp_cpu1_enable_code_end | ||
25 | |||
26 | armada_375_smp_cpu1_enable_code_start: | ||
27 | ARM_BE8(setend be) | ||
28 | adr r0, 1f | ||
29 | ldr r0, [r0] | ||
30 | ldr r1, [r0] | ||
31 | ARM_BE8(rev r1, r1) | ||
32 | mov pc, r1 | ||
33 | 1: | ||
34 | .word CPU_RESUME_ADDR_REG | ||
35 | armada_375_smp_cpu1_enable_code_end: | ||
36 | 21 | ||
37 | ENTRY(mvebu_cortex_a9_secondary_startup) | 22 | ENTRY(mvebu_cortex_a9_secondary_startup) |
38 | ARM_BE8(setend be) | 23 | ARM_BE8(setend be) |
diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c index 43aaf3fa75ee..47a71a924b96 100644 --- a/arch/arm/mach-mvebu/platsmp-a9.c +++ b/arch/arm/mach-mvebu/platsmp-a9.c | |||
@@ -20,33 +20,8 @@ | |||
20 | #include <asm/smp_scu.h> | 20 | #include <asm/smp_scu.h> |
21 | #include <asm/smp_plat.h> | 21 | #include <asm/smp_plat.h> |
22 | #include "common.h" | 22 | #include "common.h" |
23 | #include "mvebu-soc-id.h" | ||
24 | #include "pmsu.h" | 23 | #include "pmsu.h" |
25 | 24 | ||
26 | #define CRYPT0_ENG_ID 41 | ||
27 | #define CRYPT0_ENG_ATTR 0x1 | ||
28 | #define SRAM_PHYS_BASE 0xFFFF0000 | ||
29 | |||
30 | #define BOOTROM_BASE 0xFFF00000 | ||
31 | #define BOOTROM_SIZE 0x100000 | ||
32 | |||
33 | extern unsigned char armada_375_smp_cpu1_enable_code_end; | ||
34 | extern unsigned char armada_375_smp_cpu1_enable_code_start; | ||
35 | |||
36 | static void armada_375_smp_cpu1_enable_wa(void) | ||
37 | { | ||
38 | void __iomem *sram_virt_base; | ||
39 | |||
40 | mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE); | ||
41 | mvebu_mbus_add_window_by_id(CRYPT0_ENG_ID, CRYPT0_ENG_ATTR, | ||
42 | SRAM_PHYS_BASE, SZ_64K); | ||
43 | sram_virt_base = ioremap(SRAM_PHYS_BASE, SZ_64K); | ||
44 | |||
45 | memcpy(sram_virt_base, &armada_375_smp_cpu1_enable_code_start, | ||
46 | &armada_375_smp_cpu1_enable_code_end | ||
47 | - &armada_375_smp_cpu1_enable_code_start); | ||
48 | } | ||
49 | |||
50 | extern void mvebu_cortex_a9_secondary_startup(void); | 25 | extern void mvebu_cortex_a9_secondary_startup(void); |
51 | 26 | ||
52 | static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu, | 27 | static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu, |
@@ -63,21 +38,10 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu, | |||
63 | * address. | 38 | * address. |
64 | */ | 39 | */ |
65 | hw_cpu = cpu_logical_map(cpu); | 40 | hw_cpu = cpu_logical_map(cpu); |
66 | 41 | if (of_machine_is_compatible("marvell,armada375")) | |
67 | if (of_machine_is_compatible("marvell,armada375")) { | ||
68 | u32 dev, rev; | ||
69 | |||
70 | if (mvebu_get_soc_id(&dev, &rev) == 0 && | ||
71 | rev == ARMADA_375_Z1_REV) | ||
72 | armada_375_smp_cpu1_enable_wa(); | ||
73 | |||
74 | mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup); | 42 | mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup); |
75 | } | 43 | else |
76 | else { | 44 | mvebu_pmsu_set_cpu_boot_addr(hw_cpu, mvebu_cortex_a9_secondary_startup); |
77 | mvebu_pmsu_set_cpu_boot_addr(hw_cpu, | ||
78 | mvebu_cortex_a9_secondary_startup); | ||
79 | } | ||
80 | |||
81 | smp_wmb(); | 45 | smp_wmb(); |
82 | ret = mvebu_cpu_reset_deassert(hw_cpu); | 46 | ret = mvebu_cpu_reset_deassert(hw_cpu); |
83 | if (ret) { | 47 | if (ret) { |
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c index b2b4e3d6558c..a068cb5c2ce8 100644 --- a/arch/arm/mach-mvebu/system-controller.c +++ b/arch/arm/mach-mvebu/system-controller.c | |||
@@ -28,8 +28,14 @@ | |||
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/reboot.h> | 29 | #include <linux/reboot.h> |
30 | #include "common.h" | 30 | #include "common.h" |
31 | #include "mvebu-soc-id.h" | ||
32 | #include "pmsu.h" | ||
33 | |||
34 | #define ARMADA_375_CRYPT0_ENG_TARGET 41 | ||
35 | #define ARMADA_375_CRYPT0_ENG_ATTR 1 | ||
31 | 36 | ||
32 | static void __iomem *system_controller_base; | 37 | static void __iomem *system_controller_base; |
38 | static phys_addr_t system_controller_phys_base; | ||
33 | 39 | ||
34 | struct mvebu_system_controller { | 40 | struct mvebu_system_controller { |
35 | u32 rstoutn_mask_offset; | 41 | u32 rstoutn_mask_offset; |
@@ -121,10 +127,32 @@ int mvebu_system_controller_get_soc_id(u32 *dev, u32 *rev) | |||
121 | } | 127 | } |
122 | 128 | ||
123 | #ifdef CONFIG_SMP | 129 | #ifdef CONFIG_SMP |
130 | void mvebu_armada375_smp_wa_init(void) | ||
131 | { | ||
132 | u32 dev, rev; | ||
133 | phys_addr_t resume_addr_reg; | ||
134 | |||
135 | if (mvebu_get_soc_id(&dev, &rev) != 0) | ||
136 | return; | ||
137 | |||
138 | if (rev != ARMADA_375_Z1_REV) | ||
139 | return; | ||
140 | |||
141 | resume_addr_reg = system_controller_phys_base + | ||
142 | mvebu_sc->resume_boot_addr; | ||
143 | mvebu_setup_boot_addr_wa(ARMADA_375_CRYPT0_ENG_TARGET, | ||
144 | ARMADA_375_CRYPT0_ENG_ATTR, | ||
145 | resume_addr_reg); | ||
146 | } | ||
147 | |||
124 | void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr) | 148 | void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr) |
125 | { | 149 | { |
126 | BUG_ON(system_controller_base == NULL); | 150 | BUG_ON(system_controller_base == NULL); |
127 | BUG_ON(mvebu_sc->resume_boot_addr == 0); | 151 | BUG_ON(mvebu_sc->resume_boot_addr == 0); |
152 | |||
153 | if (of_machine_is_compatible("marvell,armada375")) | ||
154 | mvebu_armada375_smp_wa_init(); | ||
155 | |||
128 | writel(virt_to_phys(boot_addr), system_controller_base + | 156 | writel(virt_to_phys(boot_addr), system_controller_base + |
129 | mvebu_sc->resume_boot_addr); | 157 | mvebu_sc->resume_boot_addr); |
130 | } | 158 | } |
@@ -138,7 +166,10 @@ static int __init mvebu_system_controller_init(void) | |||
138 | np = of_find_matching_node_and_match(NULL, of_system_controller_table, | 166 | np = of_find_matching_node_and_match(NULL, of_system_controller_table, |
139 | &match); | 167 | &match); |
140 | if (np) { | 168 | if (np) { |
169 | struct resource res; | ||
141 | system_controller_base = of_iomap(np, 0); | 170 | system_controller_base = of_iomap(np, 0); |
171 | of_address_to_resource(np, 0, &res); | ||
172 | system_controller_phys_base = res.start; | ||
142 | mvebu_sc = (struct mvebu_system_controller *)match->data; | 173 | mvebu_sc = (struct mvebu_system_controller *)match->data; |
143 | of_node_put(np); | 174 | of_node_put(np); |
144 | } | 175 | } |