aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-06-06 06:24:28 -0400
committerJason Cooper <jason@lakedaemon.net>2013-06-13 13:48:40 -0400
commit580ff0eea15c341d17d564f7e5c519df37033d8e (patch)
treef3572705e6f41aab6d06fae867ed266ab7fbb0cc
parent488275beda149fe5cffdf5aa457344aa619d54f1 (diff)
arm: mvebu: don't hardcode a physical address in headsmp.S
Now that the coherency_init() function is called a bit earlier, we can actually read the physical address of the coherency unit registers from the Device Tree, and communicate that to the headsmp.S code, which avoids hardcoding a physical address. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Will Deacon <will.deacon@arm.com> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r--arch/arm/mach-mvebu/coherency.c12
-rw-r--r--arch/arm/mach-mvebu/headsmp.S16
2 files changed, 20 insertions, 8 deletions
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index d74794a590f1..32fcf69f4202 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -25,8 +25,10 @@
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <asm/smp_plat.h> 27#include <asm/smp_plat.h>
28#include <asm/cacheflush.h>
28#include "armada-370-xp.h" 29#include "armada-370-xp.h"
29 30
31unsigned long __cpuinitdata coherency_phys_base;
30static void __iomem *coherency_base; 32static void __iomem *coherency_base;
31static void __iomem *coherency_cpu_base; 33static void __iomem *coherency_cpu_base;
32 34
@@ -124,7 +126,17 @@ int __init coherency_init(void)
124 126
125 np = of_find_matching_node(NULL, of_coherency_table); 127 np = of_find_matching_node(NULL, of_coherency_table);
126 if (np) { 128 if (np) {
129 struct resource res;
127 pr_info("Initializing Coherency fabric\n"); 130 pr_info("Initializing Coherency fabric\n");
131 of_address_to_resource(np, 0, &res);
132 coherency_phys_base = res.start;
133 /*
134 * Ensure secondary CPUs will see the updated value,
135 * which they read before they join the coherency
136 * fabric, and therefore before they are coherent with
137 * the boot CPU cache.
138 */
139 sync_cache_w(&coherency_phys_base);
128 coherency_base = of_iomap(np, 0); 140 coherency_base = of_iomap(np, 0);
129 coherency_cpu_base = of_iomap(np, 1); 141 coherency_cpu_base = of_iomap(np, 1);
130 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); 142 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
diff --git a/arch/arm/mach-mvebu/headsmp.S b/arch/arm/mach-mvebu/headsmp.S
index a06e0ede8c08..7147300c8af2 100644
--- a/arch/arm/mach-mvebu/headsmp.S
+++ b/arch/arm/mach-mvebu/headsmp.S
@@ -21,12 +21,6 @@
21#include <linux/linkage.h> 21#include <linux/linkage.h>
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24/*
25 * At this stage the secondary CPUs don't have acces yet to the MMU, so
26 * we have to provide physical addresses
27 */
28#define ARMADA_XP_CFB_BASE 0xD0020200
29
30 __CPUINIT 24 __CPUINIT
31 25
32/* 26/*
@@ -35,15 +29,21 @@
35 * startup 29 * startup
36 */ 30 */
37ENTRY(armada_xp_secondary_startup) 31ENTRY(armada_xp_secondary_startup)
32 /* Get coherency fabric base physical address */
33 adr r0, 1f
34 ldr r1, [r0]
35 ldr r0, [r0, r1]
38 36
39 /* Read CPU id */ 37 /* Read CPU id */
40 mrc p15, 0, r1, c0, c0, 5 38 mrc p15, 0, r1, c0, c0, 5
41 and r1, r1, #0xF 39 and r1, r1, #0xF
42 40
43 /* Add CPU to coherency fabric */ 41 /* Add CPU to coherency fabric */
44 ldr r0, =ARMADA_XP_CFB_BASE
45
46 bl ll_set_cpu_coherent 42 bl ll_set_cpu_coherent
47 b secondary_startup 43 b secondary_startup
48 44
49ENDPROC(armada_xp_secondary_startup) 45ENDPROC(armada_xp_secondary_startup)
46
47 .align 2
481:
49 .long coherency_phys_base - .