diff options
Diffstat (limited to 'arch/arm/mm/cache-feroceon-l2.c')
-rw-r--r-- | arch/arm/mm/cache-feroceon-l2.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c index 48bc3c0a87ce..dc814a548056 100644 --- a/arch/arm/mm/cache-feroceon-l2.c +++ b/arch/arm/mm/cache-feroceon-l2.c | |||
@@ -13,10 +13,15 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/of.h> | ||
17 | #include <linux/of_address.h> | ||
16 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
19 | #include <linux/io.h> | ||
17 | #include <asm/cacheflush.h> | 20 | #include <asm/cacheflush.h> |
18 | #include <asm/cp15.h> | 21 | #include <asm/cp15.h> |
19 | #include <plat/cache-feroceon-l2.h> | 22 | #include <asm/hardware/cache-feroceon-l2.h> |
23 | |||
24 | #define L2_WRITETHROUGH_KIRKWOOD BIT(4) | ||
20 | 25 | ||
21 | /* | 26 | /* |
22 | * Low-level cache maintenance operations. | 27 | * Low-level cache maintenance operations. |
@@ -331,7 +336,9 @@ static void __init enable_l2(void) | |||
331 | enable_icache(); | 336 | enable_icache(); |
332 | if (d) | 337 | if (d) |
333 | enable_dcache(); | 338 | enable_dcache(); |
334 | } | 339 | } else |
340 | pr_err(FW_BUG | ||
341 | "Feroceon L2: bootloader left the L2 cache on!\n"); | ||
335 | } | 342 | } |
336 | 343 | ||
337 | void __init feroceon_l2_init(int __l2_wt_override) | 344 | void __init feroceon_l2_init(int __l2_wt_override) |
@@ -350,3 +357,41 @@ void __init feroceon_l2_init(int __l2_wt_override) | |||
350 | printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n", | 357 | printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n", |
351 | l2_wt_override ? ", in WT override mode" : ""); | 358 | l2_wt_override ? ", in WT override mode" : ""); |
352 | } | 359 | } |
360 | #ifdef CONFIG_OF | ||
361 | static const struct of_device_id feroceon_ids[] __initconst = { | ||
362 | { .compatible = "marvell,kirkwood-cache"}, | ||
363 | { .compatible = "marvell,feroceon-cache"}, | ||
364 | {} | ||
365 | }; | ||
366 | |||
367 | int __init feroceon_of_init(void) | ||
368 | { | ||
369 | struct device_node *node; | ||
370 | void __iomem *base; | ||
371 | bool l2_wt_override = false; | ||
372 | struct resource res; | ||
373 | |||
374 | #if defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH) | ||
375 | l2_wt_override = true; | ||
376 | #endif | ||
377 | |||
378 | node = of_find_matching_node(NULL, feroceon_ids); | ||
379 | if (node && of_device_is_compatible(node, "marvell,kirkwood-cache")) { | ||
380 | if (of_address_to_resource(node, 0, &res)) | ||
381 | return -ENODEV; | ||
382 | |||
383 | base = ioremap(res.start, resource_size(&res)); | ||
384 | if (!base) | ||
385 | return -ENOMEM; | ||
386 | |||
387 | if (l2_wt_override) | ||
388 | writel(readl(base) | L2_WRITETHROUGH_KIRKWOOD, base); | ||
389 | else | ||
390 | writel(readl(base) & ~L2_WRITETHROUGH_KIRKWOOD, base); | ||
391 | } | ||
392 | |||
393 | feroceon_l2_init(l2_wt_override); | ||
394 | |||
395 | return 0; | ||
396 | } | ||
397 | #endif | ||