diff options
Diffstat (limited to 'arch/arm/mach-mvebu/coherency.c')
-rw-r--r-- | arch/arm/mach-mvebu/coherency.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 8278960066c3..be117591f7f2 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c | |||
@@ -25,16 +25,11 @@ | |||
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 | ||
30 | /* | 31 | unsigned long __cpuinitdata coherency_phys_base; |
31 | * Some functions in this file are called very early during SMP | 32 | static void __iomem *coherency_base; |
32 | * initialization. At that time the device tree framework is not yet | ||
33 | * ready, and it is not possible to get the register address to | ||
34 | * ioremap it. That's why the pointer below is given with an initial | ||
35 | * value matching its virtual mapping | ||
36 | */ | ||
37 | static void __iomem *coherency_base = ARMADA_370_XP_REGS_VIRT_BASE + 0x20200; | ||
38 | static void __iomem *coherency_cpu_base; | 33 | static void __iomem *coherency_cpu_base; |
39 | 34 | ||
40 | /* Coherency fabric registers */ | 35 | /* Coherency fabric registers */ |
@@ -47,18 +42,6 @@ static struct of_device_id of_coherency_table[] = { | |||
47 | { /* end of list */ }, | 42 | { /* end of list */ }, |
48 | }; | 43 | }; |
49 | 44 | ||
50 | #ifdef CONFIG_SMP | ||
51 | int coherency_get_cpu_count(void) | ||
52 | { | ||
53 | int reg, cnt; | ||
54 | |||
55 | reg = readl(coherency_base + COHERENCY_FABRIC_CFG_OFFSET); | ||
56 | cnt = (reg & 0xF) + 1; | ||
57 | |||
58 | return cnt; | ||
59 | } | ||
60 | #endif | ||
61 | |||
62 | /* Function defined in coherency_ll.S */ | 45 | /* Function defined in coherency_ll.S */ |
63 | int ll_set_cpu_coherent(void __iomem *base_addr, unsigned int hw_cpu_id); | 46 | int ll_set_cpu_coherent(void __iomem *base_addr, unsigned int hw_cpu_id); |
64 | 47 | ||
@@ -143,13 +126,31 @@ int __init coherency_init(void) | |||
143 | 126 | ||
144 | np = of_find_matching_node(NULL, of_coherency_table); | 127 | np = of_find_matching_node(NULL, of_coherency_table); |
145 | if (np) { | 128 | if (np) { |
129 | struct resource res; | ||
146 | 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); | ||
147 | coherency_base = of_iomap(np, 0); | 140 | coherency_base = of_iomap(np, 0); |
148 | coherency_cpu_base = of_iomap(np, 1); | 141 | coherency_cpu_base = of_iomap(np, 1); |
149 | set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); | 142 | set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); |
150 | bus_register_notifier(&platform_bus_type, | ||
151 | &mvebu_hwcc_platform_nb); | ||
152 | } | 143 | } |
153 | 144 | ||
154 | return 0; | 145 | return 0; |
155 | } | 146 | } |
147 | |||
148 | static int __init coherency_late_init(void) | ||
149 | { | ||
150 | if (of_find_matching_node(NULL, of_coherency_table)) | ||
151 | bus_register_notifier(&platform_bus_type, | ||
152 | &mvebu_hwcc_platform_nb); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | postcore_initcall(coherency_late_init); | ||