diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2014-04-14 09:47:00 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-04-24 01:00:36 -0400 |
commit | 501f928e009760f4987d4630265bb9fff28a6ecc (patch) | |
tree | eb45702a4085dde9f1eefb0737948c54f15b3a0e | |
parent | 924d38f404936495b59ef7fa3ff232d978d64b18 (diff) |
ARM: mvebu: add a coherency_available() call
This commit extends the coherency fabric code to provide a
coherency_available()function that the SoC code can call to be told
whether coherency support is available or not. On Armada 370/XP,
coherency support is available as soon as the relevant DT node is
present. On some upcoming SoCs, the DT node needs to be present *and*
the system running with CONFIG_SMP enabled.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Link: https://lkml.kernel.org/r/1397483228-25625-3-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r-- | arch/arm/mach-mvebu/coherency.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/coherency.h | 1 |
2 files changed, 23 insertions, 8 deletions
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 434cf5f90a80..296cf14f08a4 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c | |||
@@ -39,6 +39,7 @@ static void __iomem *coherency_cpu_base; | |||
39 | #define IO_SYNC_BARRIER_CTL_OFFSET 0x0 | 39 | #define IO_SYNC_BARRIER_CTL_OFFSET 0x0 |
40 | 40 | ||
41 | enum { | 41 | enum { |
42 | COHERENCY_FABRIC_TYPE_NONE, | ||
42 | COHERENCY_FABRIC_TYPE_ARMADA_370_XP, | 43 | COHERENCY_FABRIC_TYPE_ARMADA_370_XP, |
43 | }; | 44 | }; |
44 | 45 | ||
@@ -144,7 +145,7 @@ static void __init armada_370_coherency_init(struct device_node *np) | |||
144 | set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); | 145 | set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); |
145 | } | 146 | } |
146 | 147 | ||
147 | int __init coherency_init(void) | 148 | static int coherency_type(void) |
148 | { | 149 | { |
149 | struct device_node *np; | 150 | struct device_node *np; |
150 | 151 | ||
@@ -155,27 +156,40 @@ int __init coherency_init(void) | |||
155 | int type; | 156 | int type; |
156 | 157 | ||
157 | type = (int) match->data; | 158 | type = (int) match->data; |
158 | pr_info("Initializing Coherency fabric\n"); | ||
159 | 159 | ||
160 | /* Armada 370/XP coherency works in both UP and SMP */ | ||
160 | if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) | 161 | if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) |
161 | armada_370_coherency_init(np); | 162 | return type; |
162 | 163 | ||
163 | of_node_put(np); | 164 | of_node_put(np); |
164 | } | 165 | } |
165 | 166 | ||
166 | return 0; | 167 | return COHERENCY_FABRIC_TYPE_NONE; |
167 | } | 168 | } |
168 | 169 | ||
169 | static int __init coherency_late_init(void) | 170 | int coherency_available(void) |
170 | { | 171 | { |
172 | return coherency_type() != COHERENCY_FABRIC_TYPE_NONE; | ||
173 | } | ||
174 | |||
175 | int __init coherency_init(void) | ||
176 | { | ||
177 | int type = coherency_type(); | ||
171 | struct device_node *np; | 178 | struct device_node *np; |
172 | 179 | ||
173 | np = of_find_matching_node(NULL, of_coherency_table); | 180 | np = of_find_matching_node(NULL, of_coherency_table); |
174 | if (np) { | 181 | |
182 | if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) | ||
183 | armada_370_coherency_init(np); | ||
184 | |||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static int __init coherency_late_init(void) | ||
189 | { | ||
190 | if (coherency_available()) | ||
175 | bus_register_notifier(&platform_bus_type, | 191 | bus_register_notifier(&platform_bus_type, |
176 | &mvebu_hwcc_platform_nb); | 192 | &mvebu_hwcc_platform_nb); |
177 | of_node_put(np); | ||
178 | } | ||
179 | return 0; | 193 | return 0; |
180 | } | 194 | } |
181 | 195 | ||
diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h index 760226c41353..02f7ec34ced2 100644 --- a/arch/arm/mach-mvebu/coherency.h +++ b/arch/arm/mach-mvebu/coherency.h | |||
@@ -18,5 +18,6 @@ extern unsigned long coherency_phys_base; | |||
18 | 18 | ||
19 | int set_cpu_coherent(unsigned int cpu_id, int smp_group_id); | 19 | int set_cpu_coherent(unsigned int cpu_id, int smp_group_id); |
20 | int coherency_init(void); | 20 | int coherency_init(void); |
21 | int coherency_available(void); | ||
21 | 22 | ||
22 | #endif /* __MACH_370_XP_COHERENCY_H */ | 23 | #endif /* __MACH_370_XP_COHERENCY_H */ |