aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2014-02-22 14:14:52 -0500
committerJason Cooper <jason@lakedaemon.net>2014-02-22 15:43:49 -0500
commit4b8f7a11c9fb680895e5079788653a59d6bdde16 (patch)
treed20f78bd55eb043f8f9e1be5e702301263b73079
parent3c317d00ba4a9489c161857a574432c61fde4a2a (diff)
ARM: MM: Add DT binding for Feroceon L2 cache
Instantiate the L2 cache from DT. Indicate in DT where the cache control register is so that it is possible to enable/disable write through on the CPU. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r--Documentation/devicetree/bindings/arm/mrvl/feroceon.txt16
-rw-r--r--arch/arm/include/asm/hardware/cache-feroceon-l2.h2
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c18
-rw-r--r--arch/arm/mm/cache-feroceon-l2.c43
4 files changed, 64 insertions, 15 deletions
diff --git a/Documentation/devicetree/bindings/arm/mrvl/feroceon.txt b/Documentation/devicetree/bindings/arm/mrvl/feroceon.txt
new file mode 100644
index 000000000000..0d244b999d10
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mrvl/feroceon.txt
@@ -0,0 +1,16 @@
1* Marvell Feroceon Cache
2
3Required properties:
4- compatible : Should be either "marvell,feroceon-cache" or
5 "marvell,kirkwood-cache".
6
7Optional properties:
8- reg : Address of the L2 cache control register. Mandatory for
9 "marvell,kirkwood-cache", not used by "marvell,feroceon-cache"
10
11
12Example:
13 l2: l2-cache@20128 {
14 compatible = "marvell,kirkwood-cache";
15 reg = <0x20128 0x4>;
16 };
diff --git a/arch/arm/include/asm/hardware/cache-feroceon-l2.h b/arch/arm/include/asm/hardware/cache-feroceon-l2.h
index 8edd330aabf6..12e1588dc4f1 100644
--- a/arch/arm/include/asm/hardware/cache-feroceon-l2.h
+++ b/arch/arm/include/asm/hardware/cache-feroceon-l2.h
@@ -9,3 +9,5 @@
9 */ 9 */
10 10
11extern void __init feroceon_l2_init(int l2_wt_override); 11extern void __init feroceon_l2_init(int l2_wt_override);
12extern int __init feroceon_of_init(void);
13
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 29c246858d5a..ec0702c02d6c 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -42,19 +42,6 @@ static void __init kirkwood_map_io(void)
42 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc)); 42 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
43} 43}
44 44
45static void __init kirkwood_l2_init(void)
46{
47#ifdef CONFIG_CACHE_FEROCEON_L2
48#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
49 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
50 feroceon_l2_init(1);
51#else
52 writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG);
53 feroceon_l2_init(0);
54#endif
55#endif
56}
57
58static struct resource kirkwood_cpufreq_resources[] = { 45static struct resource kirkwood_cpufreq_resources[] = {
59 [0] = { 46 [0] = {
60 .start = CPU_CONTROL_PHYS, 47 .start = CPU_CONTROL_PHYS,
@@ -211,8 +198,9 @@ static void __init kirkwood_dt_init(void)
211 198
212 BUG_ON(mvebu_mbus_dt_init()); 199 BUG_ON(mvebu_mbus_dt_init());
213 200
214 kirkwood_l2_init(); 201#ifdef CONFIG_CACHE_FEROCEON_L2
215 202 feroceon_of_init();
203#endif
216 kirkwood_cpufreq_init(); 204 kirkwood_cpufreq_init();
217 kirkwood_cpuidle_init(); 205 kirkwood_cpuidle_init();
218 206
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
index 898362e7972b..8dc1a2b5a8ed 100644
--- a/arch/arm/mm/cache-feroceon-l2.c
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -13,11 +13,16 @@
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 <asm/hardware/cache-feroceon-l2.h> 22#include <asm/hardware/cache-feroceon-l2.h>
20 23
24#define L2_WRITETHROUGH_KIRKWOOD BIT(4)
25
21/* 26/*
22 * Low-level cache maintenance operations. 27 * Low-level cache maintenance operations.
23 * 28 *
@@ -350,3 +355,41 @@ void __init feroceon_l2_init(int __l2_wt_override)
350 printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n", 355 printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n",
351 l2_wt_override ? ", in WT override mode" : ""); 356 l2_wt_override ? ", in WT override mode" : "");
352} 357}
358#ifdef CONFIG_OF
359static const struct of_device_id feroceon_ids[] __initconst = {
360 { .compatible = "marvell,kirkwood-cache"},
361 { .compatible = "marvell,feroceon-cache"},
362 {}
363};
364
365int __init feroceon_of_init(void)
366{
367 struct device_node *node;
368 void __iomem *base;
369 bool l2_wt_override = false;
370 struct resource res;
371
372#if defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH)
373 l2_wt_override = true;
374#endif
375
376 node = of_find_matching_node(NULL, feroceon_ids);
377 if (node && of_device_is_compatible(node, "marvell,kirkwood-cache")) {
378 if (of_address_to_resource(node, 0, &res))
379 return -ENODEV;
380
381 base = ioremap(res.start, resource_size(&res));
382 if (!base)
383 return -ENOMEM;
384
385 if (l2_wt_override)
386 writel(readl(base) | L2_WRITETHROUGH_KIRKWOOD, base);
387 else
388 writel(readl(base) & ~L2_WRITETHROUGH_KIRKWOOD, base);
389 }
390
391 feroceon_l2_init(l2_wt_override);
392
393 return 0;
394}
395#endif