Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Coherency fabric (Aurora) support for Armada 370 and XP platforms. |
| 3 | * |
| 4 | * Copyright (C) 2012 Marvell |
| 5 | * |
| 6 | * Yehuda Yitschak <yehuday@marvell.com> |
| 7 | * Gregory Clement <gregory.clement@free-electrons.com> |
| 8 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> |
| 9 | * |
| 10 | * This file is licensed under the terms of the GNU General Public |
| 11 | * License version 2. This program is licensed "as is" without any |
| 12 | * warranty of any kind, whether express or implied. |
| 13 | * |
| 14 | * The Armada 370 and Armada XP SOCs have a coherency fabric which is |
| 15 | * responsible for ensuring hardware coherency between all CPUs and between |
| 16 | * CPUs and I/O masters. This file initializes the coherency fabric and |
| 17 | * supplies basic routines for configuring and controlling hardware coherency |
| 18 | */ |
| 19 | |
Thomas Petazzoni | 5ab5afd | 2014-04-14 15:47:05 +0200 | [diff] [blame] | 20 | #define pr_fmt(fmt) "mvebu-coherency: " fmt |
| 21 | |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 22 | #include <linux/kernel.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/of_address.h> |
| 25 | #include <linux/io.h> |
| 26 | #include <linux/smp.h> |
Gregory CLEMENT | e60304f | 2012-10-12 19:20:36 +0200 | [diff] [blame] | 27 | #include <linux/dma-mapping.h> |
| 28 | #include <linux/platform_device.h> |
Thomas Petazzoni | 5ab5afd | 2014-04-14 15:47:05 +0200 | [diff] [blame] | 29 | #include <linux/slab.h> |
| 30 | #include <linux/mbus.h> |
| 31 | #include <linux/clk.h> |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 32 | #include <asm/smp_plat.h> |
Thomas Petazzoni | 580ff0e | 2013-06-06 12:24:28 +0200 | [diff] [blame] | 33 | #include <asm/cacheflush.h> |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 34 | #include "armada-370-xp.h" |
Jisheng Zhang | b12634e | 2013-11-07 17:02:38 +0800 | [diff] [blame] | 35 | #include "coherency.h" |
Thomas Petazzoni | 3943856 | 2014-05-05 17:05:26 +0200 | [diff] [blame^] | 36 | #include "mvebu-soc-id.h" |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 37 | |
Paul Gortmaker | 8bd26e3 | 2013-06-17 15:43:14 -0400 | [diff] [blame] | 38 | unsigned long coherency_phys_base; |
Gregory CLEMENT | ccd6a13 | 2014-04-14 17:10:05 +0200 | [diff] [blame] | 39 | void __iomem *coherency_base; |
Gregory CLEMENT | e60304f | 2012-10-12 19:20:36 +0200 | [diff] [blame] | 40 | static void __iomem *coherency_cpu_base; |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 41 | |
| 42 | /* Coherency fabric registers */ |
| 43 | #define COHERENCY_FABRIC_CFG_OFFSET 0x4 |
| 44 | |
Gregory CLEMENT | e60304f | 2012-10-12 19:20:36 +0200 | [diff] [blame] | 45 | #define IO_SYNC_BARRIER_CTL_OFFSET 0x0 |
| 46 | |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 47 | enum { |
Thomas Petazzoni | 501f928 | 2014-04-14 15:47:00 +0200 | [diff] [blame] | 48 | COHERENCY_FABRIC_TYPE_NONE, |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 49 | COHERENCY_FABRIC_TYPE_ARMADA_370_XP, |
Thomas Petazzoni | 77fa4b9 | 2014-04-14 15:47:04 +0200 | [diff] [blame] | 50 | COHERENCY_FABRIC_TYPE_ARMADA_375, |
Thomas Petazzoni | d0de932 | 2014-04-14 15:47:06 +0200 | [diff] [blame] | 51 | COHERENCY_FABRIC_TYPE_ARMADA_380, |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 52 | }; |
| 53 | |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 54 | static struct of_device_id of_coherency_table[] = { |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 55 | {.compatible = "marvell,coherency-fabric", |
| 56 | .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_370_XP }, |
Thomas Petazzoni | 77fa4b9 | 2014-04-14 15:47:04 +0200 | [diff] [blame] | 57 | {.compatible = "marvell,armada-375-coherency-fabric", |
| 58 | .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_375 }, |
Thomas Petazzoni | d0de932 | 2014-04-14 15:47:06 +0200 | [diff] [blame] | 59 | {.compatible = "marvell,armada-380-coherency-fabric", |
| 60 | .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_380 }, |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 61 | { /* end of list */ }, |
| 62 | }; |
| 63 | |
Gregory CLEMENT | 2e8a594 | 2014-04-14 17:10:08 +0200 | [diff] [blame] | 64 | /* Functions defined in coherency_ll.S */ |
| 65 | int ll_enable_coherency(void); |
| 66 | void ll_add_cpu_to_smp_group(void); |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 67 | |
Gregory CLEMENT | 952f4ca | 2014-04-14 17:10:07 +0200 | [diff] [blame] | 68 | int set_cpu_coherent(void) |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 69 | { |
| 70 | if (!coherency_base) { |
Gregory CLEMENT | b41375f | 2014-04-14 17:10:06 +0200 | [diff] [blame] | 71 | pr_warn("Can't make current CPU cache coherent.\n"); |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 72 | pr_warn("Coherency fabric is not initialized\n"); |
| 73 | return 1; |
| 74 | } |
| 75 | |
Gregory CLEMENT | 2e8a594 | 2014-04-14 17:10:08 +0200 | [diff] [blame] | 76 | ll_add_cpu_to_smp_group(); |
| 77 | return ll_enable_coherency(); |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 78 | } |
| 79 | |
Thomas Petazzoni | 5ab5afd | 2014-04-14 15:47:05 +0200 | [diff] [blame] | 80 | /* |
| 81 | * The below code implements the I/O coherency workaround on Armada |
| 82 | * 375. This workaround consists in using the two channels of the |
| 83 | * first XOR engine to trigger a XOR transaction that serves as the |
| 84 | * I/O coherency barrier. |
| 85 | */ |
| 86 | |
| 87 | static void __iomem *xor_base, *xor_high_base; |
| 88 | static dma_addr_t coherency_wa_buf_phys[CONFIG_NR_CPUS]; |
| 89 | static void *coherency_wa_buf[CONFIG_NR_CPUS]; |
| 90 | static bool coherency_wa_enabled; |
| 91 | |
| 92 | #define XOR_CONFIG(chan) (0x10 + (chan * 4)) |
| 93 | #define XOR_ACTIVATION(chan) (0x20 + (chan * 4)) |
| 94 | #define WINDOW_BAR_ENABLE(chan) (0x240 + ((chan) << 2)) |
| 95 | #define WINDOW_BASE(w) (0x250 + ((w) << 2)) |
| 96 | #define WINDOW_SIZE(w) (0x270 + ((w) << 2)) |
| 97 | #define WINDOW_REMAP_HIGH(w) (0x290 + ((w) << 2)) |
| 98 | #define WINDOW_OVERRIDE_CTRL(chan) (0x2A0 + ((chan) << 2)) |
| 99 | #define XOR_DEST_POINTER(chan) (0x2B0 + (chan * 4)) |
| 100 | #define XOR_BLOCK_SIZE(chan) (0x2C0 + (chan * 4)) |
| 101 | #define XOR_INIT_VALUE_LOW 0x2E0 |
| 102 | #define XOR_INIT_VALUE_HIGH 0x2E4 |
| 103 | |
| 104 | static inline void mvebu_hwcc_armada375_sync_io_barrier_wa(void) |
| 105 | { |
| 106 | int idx = smp_processor_id(); |
| 107 | |
| 108 | /* Write '1' to the first word of the buffer */ |
| 109 | writel(0x1, coherency_wa_buf[idx]); |
| 110 | |
| 111 | /* Wait until the engine is idle */ |
| 112 | while ((readl(xor_base + XOR_ACTIVATION(idx)) >> 4) & 0x3) |
| 113 | ; |
| 114 | |
| 115 | dmb(); |
| 116 | |
| 117 | /* Trigger channel */ |
| 118 | writel(0x1, xor_base + XOR_ACTIVATION(idx)); |
| 119 | |
| 120 | /* Poll the data until it is cleared by the XOR transaction */ |
| 121 | while (readl(coherency_wa_buf[idx])) |
| 122 | ; |
| 123 | } |
| 124 | |
| 125 | static void __init armada_375_coherency_init_wa(void) |
| 126 | { |
| 127 | const struct mbus_dram_target_info *dram; |
| 128 | struct device_node *xor_node; |
| 129 | struct property *xor_status; |
| 130 | struct clk *xor_clk; |
| 131 | u32 win_enable = 0; |
| 132 | int i; |
| 133 | |
| 134 | pr_warn("enabling coherency workaround for Armada 375 Z1, one XOR engine disabled\n"); |
| 135 | |
| 136 | /* |
| 137 | * Since the workaround uses one XOR engine, we grab a |
| 138 | * reference to its Device Tree node first. |
| 139 | */ |
| 140 | xor_node = of_find_compatible_node(NULL, NULL, "marvell,orion-xor"); |
| 141 | BUG_ON(!xor_node); |
| 142 | |
| 143 | /* |
| 144 | * Then we mark it as disabled so that the real XOR driver |
| 145 | * will not use it. |
| 146 | */ |
| 147 | xor_status = kzalloc(sizeof(struct property), GFP_KERNEL); |
| 148 | BUG_ON(!xor_status); |
| 149 | |
| 150 | xor_status->value = kstrdup("disabled", GFP_KERNEL); |
| 151 | BUG_ON(!xor_status->value); |
| 152 | |
| 153 | xor_status->length = 8; |
| 154 | xor_status->name = kstrdup("status", GFP_KERNEL); |
| 155 | BUG_ON(!xor_status->name); |
| 156 | |
| 157 | of_update_property(xor_node, xor_status); |
| 158 | |
| 159 | /* |
| 160 | * And we remap the registers, get the clock, and do the |
| 161 | * initial configuration of the XOR engine. |
| 162 | */ |
| 163 | xor_base = of_iomap(xor_node, 0); |
| 164 | xor_high_base = of_iomap(xor_node, 1); |
| 165 | |
| 166 | xor_clk = of_clk_get_by_name(xor_node, NULL); |
| 167 | BUG_ON(!xor_clk); |
| 168 | |
| 169 | clk_prepare_enable(xor_clk); |
| 170 | |
| 171 | dram = mv_mbus_dram_info(); |
| 172 | |
| 173 | for (i = 0; i < 8; i++) { |
| 174 | writel(0, xor_base + WINDOW_BASE(i)); |
| 175 | writel(0, xor_base + WINDOW_SIZE(i)); |
| 176 | if (i < 4) |
| 177 | writel(0, xor_base + WINDOW_REMAP_HIGH(i)); |
| 178 | } |
| 179 | |
| 180 | for (i = 0; i < dram->num_cs; i++) { |
| 181 | const struct mbus_dram_window *cs = dram->cs + i; |
| 182 | writel((cs->base & 0xffff0000) | |
| 183 | (cs->mbus_attr << 8) | |
| 184 | dram->mbus_dram_target_id, xor_base + WINDOW_BASE(i)); |
| 185 | writel((cs->size - 1) & 0xffff0000, xor_base + WINDOW_SIZE(i)); |
| 186 | |
| 187 | win_enable |= (1 << i); |
| 188 | win_enable |= 3 << (16 + (2 * i)); |
| 189 | } |
| 190 | |
| 191 | writel(win_enable, xor_base + WINDOW_BAR_ENABLE(0)); |
| 192 | writel(win_enable, xor_base + WINDOW_BAR_ENABLE(1)); |
| 193 | writel(0, xor_base + WINDOW_OVERRIDE_CTRL(0)); |
| 194 | writel(0, xor_base + WINDOW_OVERRIDE_CTRL(1)); |
| 195 | |
| 196 | for (i = 0; i < CONFIG_NR_CPUS; i++) { |
| 197 | coherency_wa_buf[i] = kzalloc(PAGE_SIZE, GFP_KERNEL); |
| 198 | BUG_ON(!coherency_wa_buf[i]); |
| 199 | |
| 200 | /* |
| 201 | * We can't use the DMA mapping API, since we don't |
| 202 | * have a valid 'struct device' pointer |
| 203 | */ |
| 204 | coherency_wa_buf_phys[i] = |
| 205 | virt_to_phys(coherency_wa_buf[i]); |
| 206 | BUG_ON(!coherency_wa_buf_phys[i]); |
| 207 | |
| 208 | /* |
| 209 | * Configure the XOR engine for memset operation, with |
| 210 | * a 128 bytes block size |
| 211 | */ |
| 212 | writel(0x444, xor_base + XOR_CONFIG(i)); |
| 213 | writel(128, xor_base + XOR_BLOCK_SIZE(i)); |
| 214 | writel(coherency_wa_buf_phys[i], |
| 215 | xor_base + XOR_DEST_POINTER(i)); |
| 216 | } |
| 217 | |
| 218 | writel(0x0, xor_base + XOR_INIT_VALUE_LOW); |
| 219 | writel(0x0, xor_base + XOR_INIT_VALUE_HIGH); |
| 220 | |
| 221 | coherency_wa_enabled = true; |
| 222 | } |
| 223 | |
Gregory CLEMENT | e60304f | 2012-10-12 19:20:36 +0200 | [diff] [blame] | 224 | static inline void mvebu_hwcc_sync_io_barrier(void) |
| 225 | { |
Thomas Petazzoni | 5ab5afd | 2014-04-14 15:47:05 +0200 | [diff] [blame] | 226 | if (coherency_wa_enabled) { |
| 227 | mvebu_hwcc_armada375_sync_io_barrier_wa(); |
| 228 | return; |
| 229 | } |
| 230 | |
Gregory CLEMENT | e60304f | 2012-10-12 19:20:36 +0200 | [diff] [blame] | 231 | writel(0x1, coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET); |
| 232 | while (readl(coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET) & 0x1); |
| 233 | } |
| 234 | |
| 235 | static dma_addr_t mvebu_hwcc_dma_map_page(struct device *dev, struct page *page, |
| 236 | unsigned long offset, size_t size, |
| 237 | enum dma_data_direction dir, |
| 238 | struct dma_attrs *attrs) |
| 239 | { |
| 240 | if (dir != DMA_TO_DEVICE) |
| 241 | mvebu_hwcc_sync_io_barrier(); |
| 242 | return pfn_to_dma(dev, page_to_pfn(page)) + offset; |
| 243 | } |
| 244 | |
| 245 | |
| 246 | static void mvebu_hwcc_dma_unmap_page(struct device *dev, dma_addr_t dma_handle, |
| 247 | size_t size, enum dma_data_direction dir, |
| 248 | struct dma_attrs *attrs) |
| 249 | { |
| 250 | if (dir != DMA_TO_DEVICE) |
| 251 | mvebu_hwcc_sync_io_barrier(); |
| 252 | } |
| 253 | |
| 254 | static void mvebu_hwcc_dma_sync(struct device *dev, dma_addr_t dma_handle, |
| 255 | size_t size, enum dma_data_direction dir) |
| 256 | { |
| 257 | if (dir != DMA_TO_DEVICE) |
| 258 | mvebu_hwcc_sync_io_barrier(); |
| 259 | } |
| 260 | |
| 261 | static struct dma_map_ops mvebu_hwcc_dma_ops = { |
| 262 | .alloc = arm_dma_alloc, |
| 263 | .free = arm_dma_free, |
| 264 | .mmap = arm_dma_mmap, |
| 265 | .map_page = mvebu_hwcc_dma_map_page, |
| 266 | .unmap_page = mvebu_hwcc_dma_unmap_page, |
| 267 | .get_sgtable = arm_dma_get_sgtable, |
| 268 | .map_sg = arm_dma_map_sg, |
| 269 | .unmap_sg = arm_dma_unmap_sg, |
| 270 | .sync_single_for_cpu = mvebu_hwcc_dma_sync, |
| 271 | .sync_single_for_device = mvebu_hwcc_dma_sync, |
| 272 | .sync_sg_for_cpu = arm_dma_sync_sg_for_cpu, |
| 273 | .sync_sg_for_device = arm_dma_sync_sg_for_device, |
| 274 | .set_dma_mask = arm_dma_set_mask, |
| 275 | }; |
| 276 | |
| 277 | static int mvebu_hwcc_platform_notifier(struct notifier_block *nb, |
| 278 | unsigned long event, void *__dev) |
| 279 | { |
| 280 | struct device *dev = __dev; |
| 281 | |
| 282 | if (event != BUS_NOTIFY_ADD_DEVICE) |
| 283 | return NOTIFY_DONE; |
| 284 | set_dma_ops(dev, &mvebu_hwcc_dma_ops); |
| 285 | |
| 286 | return NOTIFY_OK; |
| 287 | } |
| 288 | |
| 289 | static struct notifier_block mvebu_hwcc_platform_nb = { |
| 290 | .notifier_call = mvebu_hwcc_platform_notifier, |
| 291 | }; |
| 292 | |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 293 | static void __init armada_370_coherency_init(struct device_node *np) |
| 294 | { |
| 295 | struct resource res; |
| 296 | |
| 297 | of_address_to_resource(np, 0, &res); |
| 298 | coherency_phys_base = res.start; |
| 299 | /* |
| 300 | * Ensure secondary CPUs will see the updated value, |
| 301 | * which they read before they join the coherency |
| 302 | * fabric, and therefore before they are coherent with |
| 303 | * the boot CPU cache. |
| 304 | */ |
| 305 | sync_cache_w(&coherency_phys_base); |
| 306 | coherency_base = of_iomap(np, 0); |
| 307 | coherency_cpu_base = of_iomap(np, 1); |
Gregory CLEMENT | 952f4ca | 2014-04-14 17:10:07 +0200 | [diff] [blame] | 308 | set_cpu_coherent(); |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 309 | } |
| 310 | |
Thomas Petazzoni | d0de932 | 2014-04-14 15:47:06 +0200 | [diff] [blame] | 311 | static void __init armada_375_380_coherency_init(struct device_node *np) |
Thomas Petazzoni | 77fa4b9 | 2014-04-14 15:47:04 +0200 | [diff] [blame] | 312 | { |
| 313 | coherency_cpu_base = of_iomap(np, 0); |
| 314 | } |
| 315 | |
Thomas Petazzoni | 501f928 | 2014-04-14 15:47:00 +0200 | [diff] [blame] | 316 | static int coherency_type(void) |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 317 | { |
| 318 | struct device_node *np; |
Thomas Petazzoni | 5fbba08 | 2014-04-14 15:47:02 +0200 | [diff] [blame] | 319 | const struct of_device_id *match; |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 320 | |
Thomas Petazzoni | 5fbba08 | 2014-04-14 15:47:02 +0200 | [diff] [blame] | 321 | np = of_find_matching_node_and_match(NULL, of_coherency_table, &match); |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 322 | if (np) { |
Thomas Petazzoni | 5fbba08 | 2014-04-14 15:47:02 +0200 | [diff] [blame] | 323 | int type = (int) match->data; |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 324 | |
Thomas Petazzoni | 501f928 | 2014-04-14 15:47:00 +0200 | [diff] [blame] | 325 | /* Armada 370/XP coherency works in both UP and SMP */ |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 326 | if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) |
Thomas Petazzoni | 501f928 | 2014-04-14 15:47:00 +0200 | [diff] [blame] | 327 | return type; |
Thomas Petazzoni | 924d38f | 2014-04-14 15:46:59 +0200 | [diff] [blame] | 328 | |
Thomas Petazzoni | 77fa4b9 | 2014-04-14 15:47:04 +0200 | [diff] [blame] | 329 | /* Armada 375 coherency works only on SMP */ |
| 330 | else if (type == COHERENCY_FABRIC_TYPE_ARMADA_375 && is_smp()) |
| 331 | return type; |
| 332 | |
Thomas Petazzoni | d0de932 | 2014-04-14 15:47:06 +0200 | [diff] [blame] | 333 | /* Armada 380 coherency works only on SMP */ |
| 334 | else if (type == COHERENCY_FABRIC_TYPE_ARMADA_380 && is_smp()) |
| 335 | return type; |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 336 | } |
| 337 | |
Thomas Petazzoni | 501f928 | 2014-04-14 15:47:00 +0200 | [diff] [blame] | 338 | return COHERENCY_FABRIC_TYPE_NONE; |
| 339 | } |
| 340 | |
| 341 | int coherency_available(void) |
| 342 | { |
| 343 | return coherency_type() != COHERENCY_FABRIC_TYPE_NONE; |
| 344 | } |
| 345 | |
| 346 | int __init coherency_init(void) |
| 347 | { |
| 348 | int type = coherency_type(); |
| 349 | struct device_node *np; |
| 350 | |
| 351 | np = of_find_matching_node(NULL, of_coherency_table); |
| 352 | |
| 353 | if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) |
| 354 | armada_370_coherency_init(np); |
Thomas Petazzoni | d0de932 | 2014-04-14 15:47:06 +0200 | [diff] [blame] | 355 | else if (type == COHERENCY_FABRIC_TYPE_ARMADA_375 || |
| 356 | type == COHERENCY_FABRIC_TYPE_ARMADA_380) |
| 357 | armada_375_380_coherency_init(np); |
Thomas Petazzoni | 501f928 | 2014-04-14 15:47:00 +0200 | [diff] [blame] | 358 | |
Gregory CLEMENT | 009f131 | 2012-08-02 11:16:29 +0300 | [diff] [blame] | 359 | return 0; |
| 360 | } |
Thomas Petazzoni | 865e052 | 2013-06-05 09:04:55 +0200 | [diff] [blame] | 361 | |
| 362 | static int __init coherency_late_init(void) |
| 363 | { |
Thomas Petazzoni | 5ab5afd | 2014-04-14 15:47:05 +0200 | [diff] [blame] | 364 | int type = coherency_type(); |
| 365 | |
| 366 | if (type == COHERENCY_FABRIC_TYPE_NONE) |
| 367 | return 0; |
| 368 | |
Thomas Petazzoni | 3943856 | 2014-05-05 17:05:26 +0200 | [diff] [blame^] | 369 | if (type == COHERENCY_FABRIC_TYPE_ARMADA_375) { |
| 370 | u32 dev, rev; |
| 371 | |
| 372 | if (mvebu_get_soc_id(&dev, &rev) == 0 && |
| 373 | rev == ARMADA_375_Z1_REV) |
| 374 | armada_375_coherency_init_wa(); |
| 375 | } |
Thomas Petazzoni | 5ab5afd | 2014-04-14 15:47:05 +0200 | [diff] [blame] | 376 | |
| 377 | bus_register_notifier(&platform_bus_type, |
| 378 | &mvebu_hwcc_platform_nb); |
| 379 | |
Thomas Petazzoni | 865e052 | 2013-06-05 09:04:55 +0200 | [diff] [blame] | 380 | return 0; |
| 381 | } |
| 382 | |
| 383 | postcore_initcall(coherency_late_init); |