aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-07-08 09:45:20 -0400
committerShawn Guo <shawn.guo@linaro.org>2013-08-16 01:11:22 -0400
commite6a07569611daf4190c0fd2c2bb1e2189c0cb479 (patch)
tree26f52525e498ae233ca0a55a781541ab7aa8d539 /arch/arm
parent8bba8303b059ddcdcac647efa816b4c04ea42eee (diff)
ARM: imx: let L2 initialization be a common function
Move imx6q L2 initialization function imx6q_init_l2cache() into system.c, and rename it imx_init_l2cache(), so that other platforms other than imx6q can also use the function. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Dirk Behme <dirk.behme@de.bosch.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-imx/common.h6
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c37
-rw-r--r--arch/arm/mach-imx/system.c33
3 files changed, 40 insertions, 36 deletions
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index cb6c838b63ed..b96aff7476ea 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -161,6 +161,12 @@ extern int mx51_neon_fixup(void);
161static inline int mx51_neon_fixup(void) { return 0; } 161static inline int mx51_neon_fixup(void) { return 0; }
162#endif 162#endif
163 163
164#ifdef CONFIG_CACHE_L2X0
165extern void imx_init_l2cache(void);
166#else
167static inline void imx_init_l2cache(void) {}
168#endif
169
164extern struct smp_operations imx_smp_ops; 170extern struct smp_operations imx_smp_ops;
165 171
166#endif 172#endif
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 59218418fde3..9f06cc8789c6 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -32,7 +32,6 @@
32#include <linux/micrel_phy.h> 32#include <linux/micrel_phy.h>
33#include <linux/mfd/syscon.h> 33#include <linux/mfd/syscon.h>
34#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 34#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
35#include <asm/hardware/cache-l2x0.h>
36#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
37#include <asm/mach/map.h> 36#include <asm/mach/map.h>
38#include <asm/system_misc.h> 37#include <asm/system_misc.h>
@@ -352,44 +351,10 @@ static void __init imx6q_map_io(void)
352 imx_scu_map_io(); 351 imx_scu_map_io();
353} 352}
354 353
355#ifdef CONFIG_CACHE_L2X0
356static void __init imx6q_init_l2cache(void)
357{
358 void __iomem *l2x0_base;
359 struct device_node *np;
360 unsigned int val;
361
362 np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache");
363 if (!np)
364 goto out;
365
366 l2x0_base = of_iomap(np, 0);
367 if (!l2x0_base) {
368 of_node_put(np);
369 goto out;
370 }
371
372 /* Configure the L2 PREFETCH and POWER registers */
373 val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
374 val |= 0x70800000;
375 writel_relaxed(val, l2x0_base + L2X0_PREFETCH_CTRL);
376 val = L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN;
377 writel_relaxed(val, l2x0_base + L2X0_POWER_CTRL);
378
379 iounmap(l2x0_base);
380 of_node_put(np);
381
382out:
383 l2x0_of_init(0, ~0UL);
384}
385#else
386static inline void imx6q_init_l2cache(void) {}
387#endif
388
389static void __init imx6q_init_irq(void) 354static void __init imx6q_init_irq(void)
390{ 355{
391 imx6q_init_revision(); 356 imx6q_init_revision();
392 imx6q_init_l2cache(); 357 imx_init_l2cache();
393 imx_src_init(); 358 imx_src_init();
394 imx_gpc_init(); 359 imx_gpc_init();
395 irqchip_init(); 360 irqchip_init();
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index 6fe81bb4d3c9..e5592cab1f6a 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -27,6 +27,7 @@
27#include <asm/system_misc.h> 27#include <asm/system_misc.h>
28#include <asm/proc-fns.h> 28#include <asm/proc-fns.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/hardware/cache-l2x0.h>
30 31
31#include "common.h" 32#include "common.h"
32#include "hardware.h" 33#include "hardware.h"
@@ -95,3 +96,35 @@ void __init mxc_arch_reset_init_dt(void)
95 96
96 clk_prepare(wdog_clk); 97 clk_prepare(wdog_clk);
97} 98}
99
100#ifdef CONFIG_CACHE_L2X0
101static void __init imx_init_l2cache(void)
102{
103 void __iomem *l2x0_base;
104 struct device_node *np;
105 unsigned int val;
106
107 np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache");
108 if (!np)
109 goto out;
110
111 l2x0_base = of_iomap(np, 0);
112 if (!l2x0_base) {
113 of_node_put(np);
114 goto out;
115 }
116
117 /* Configure the L2 PREFETCH and POWER registers */
118 val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
119 val |= 0x70800000;
120 writel_relaxed(val, l2x0_base + L2X0_PREFETCH_CTRL);
121 val = L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN;
122 writel_relaxed(val, l2x0_base + L2X0_POWER_CTRL);
123
124 iounmap(l2x0_base);
125 of_node_put(np);
126
127out:
128 l2x0_of_init(0, ~0UL);
129}
130#endif