]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: imx: let L2 initialization be a common function
authorShawn Guo <shawn.guo@freescale.com>
Mon, 8 Jul 2013 13:45:20 +0000 (21:45 +0800)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:53:42 +0000 (09:53 +0800)
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@freescale.com>
arch/arm/mach-imx/common.h
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-imx/system.c

index ee78847abf4708c98bff9d91bb2e123917ea39c8..32c751df75653b909284d7fdbfe95965e7467fd2 100644 (file)
@@ -159,6 +159,12 @@ extern int mx51_neon_fixup(void);
 static inline int mx51_neon_fixup(void) { return 0; }
 #endif
 
+#ifdef CONFIG_CACHE_L2X0
+extern void imx_init_l2cache(void);
+#else
+static inline void imx_init_l2cache(void) {}
+#endif
+
 extern struct smp_operations imx_smp_ops;
 
 #endif
index 5ab972567ef63633eea9bd1c3f37573a83240744..f3c521f20b7d1f687819dfe7af0525e474762d08 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/micrel_phy.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
-#include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
@@ -257,44 +256,10 @@ static void __init imx6q_map_io(void)
        imx_scu_map_io();
 }
 
-#ifdef CONFIG_CACHE_L2X0
-static void __init imx6q_init_l2cache(void)
-{
-       void __iomem *l2x0_base;
-       struct device_node *np;
-       unsigned int val;
-
-       np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache");
-       if (!np)
-               goto out;
-
-       l2x0_base = of_iomap(np, 0);
-       if (!l2x0_base) {
-               of_node_put(np);
-               goto out;
-       }
-
-       /* Configure the L2 PREFETCH and POWER registers */
-       val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
-       val |= 0x70800000;
-       writel_relaxed(val, l2x0_base + L2X0_PREFETCH_CTRL);
-       val = L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN;
-       writel_relaxed(val, l2x0_base + L2X0_POWER_CTRL);
-
-       iounmap(l2x0_base);
-       of_node_put(np);
-
-out:
-       l2x0_of_init(0, ~0UL);
-}
-#else
-static inline void imx6q_init_l2cache(void) {}
-#endif
-
 static void __init imx6q_init_irq(void)
 {
        imx6q_init_revision();
-       imx6q_init_l2cache();
+       imx_init_l2cache();
        imx_src_init();
        imx_gpc_init();
        irqchip_init();
index 7cdc79a9657c64bc7bbdab1236ab1f78736732dc..6fbe5563c50fc5bd12fb486b71f8cb5fa348bcad 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1999 ARM Limited
  * Copyright (C) 2000 Deep Blue Solutions Ltd
- * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2006-2013 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  * Copyright 2009 Ilya Yanok, Emcraft Systems Ltd, yanok@emcraft.com
  *
@@ -27,6 +27,7 @@
 #include <asm/system_misc.h>
 #include <asm/proc-fns.h>
 #include <asm/mach-types.h>
+#include <asm/hardware/cache-l2x0.h>
 
 #include "common.h"
 #include "hardware.h"
@@ -95,3 +96,35 @@ void __init mxc_arch_reset_init_dt(void)
 
        clk_prepare(wdog_clk);
 }
+
+#ifdef CONFIG_CACHE_L2X0
+static void __init imx_init_l2cache(void)
+{
+       void __iomem *l2x0_base;
+       struct device_node *np;
+       unsigned int val;
+
+       np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache");
+       if (!np)
+               goto out;
+
+       l2x0_base = of_iomap(np, 0);
+       if (!l2x0_base) {
+               of_node_put(np);
+               goto out;
+       }
+
+       /* Configure the L2 PREFETCH and POWER registers */
+       val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
+       val |= 0x70800000;
+       writel_relaxed(val, l2x0_base + L2X0_PREFETCH_CTRL);
+       val = L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN;
+       writel_relaxed(val, l2x0_base + L2X0_POWER_CTRL);
+
+       iounmap(l2x0_base);
+       of_node_put(np);
+
+out:
+       l2x0_of_init(0, ~0UL);
+}
+#endif