+++ /dev/null
-/*
- * Copyright (C) 2009-2010 Pengutronix
- * Sascha Hauer <s.hauer@pengutronix.de>
- * Juergen Beisert <j.beisert@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License version 2 as published by the
- * Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/kernel.h>
-
-#include <asm/hardware/cache-l2x0.h>
-
-#include <mach/hardware.h>
-
-static int mxc_init_l2x0(void)
-{
-       void __iomem *l2x0_base;
-       void __iomem *clkctl_base;
-
-       if (!cpu_is_mx31() && !cpu_is_mx35())
-               return 0;
-
-/*
- * First of all, we must repair broken chip settings. There are some
- * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These
- * misconfigured CPUs will run amok immediately when the L2 cache gets enabled.
- * Workaraound is to setup the correct register setting prior enabling the
- * L2 cache. This should not hurt already working CPUs, as they are using the
- * same value.
- */
-#define L2_MEM_VAL 0x10
-
-       clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096);
-       if (clkctl_base != NULL) {
-               writel(0x00000515, clkctl_base + L2_MEM_VAL);
-               iounmap(clkctl_base);
-       } else {
-               pr_err("L2 cache: Cannot fix timing. Trying to continue without\n");
-       }
-
-       l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096);
-       if (IS_ERR(l2x0_base)) {
-               printk(KERN_ERR "remapping L2 cache area failed with %ld\n",
-                               PTR_ERR(l2x0_base));
-               return 0;
-       }
-
-       l2x0_init(l2x0_base, 0x00030024, 0x00000000);
-
-       return 0;
-}
-arch_initcall(mxc_init_l2x0);
 
 #include <linux/err.h>
 
 #include <asm/pgtable.h>
+#include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/map.h>
 
 #include <mach/common.h>
 #include <mach/iomux-v3.h>
 #include <mach/irqs.h>
 
+void imx3_init_l2x0(void)
+{
+       void __iomem *l2x0_base;
+       void __iomem *clkctl_base;
+
+/*
+ * First of all, we must repair broken chip settings. There are some
+ * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These
+ * misconfigured CPUs will run amok immediately when the L2 cache gets enabled.
+ * Workaraound is to setup the correct register setting prior enabling the
+ * L2 cache. This should not hurt already working CPUs, as they are using the
+ * same value.
+ */
+#define L2_MEM_VAL 0x10
+
+       clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096);
+       if (clkctl_base != NULL) {
+               writel(0x00000515, clkctl_base + L2_MEM_VAL);
+               iounmap(clkctl_base);
+       } else {
+               pr_err("L2 cache: Cannot fix timing. Trying to continue without\n");
+       }
+
+       l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096);
+       if (IS_ERR(l2x0_base)) {
+               printk(KERN_ERR "remapping L2 cache area failed with %ld\n",
+                               PTR_ERR(l2x0_base));
+               return;
+       }
+
+       l2x0_init(l2x0_base, 0x00030024, 0x00000000);
+}
+
 static struct map_desc mx31_io_desc[] __initdata = {
        imx_map_entry(MX31, X_MEMC, MT_DEVICE),
        imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED),
 {
        int to_version = mx31_revision() >> 4;
 
+       imx3_init_l2x0();
+
        mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0);
        mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0);
        mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0);
 {
        int to_version = mx35_revision() >> 4;
 
+       imx3_init_l2x0();
+
        /* i.mx35 has the i.mx31 type gpio */
        mxc_register_gpio("imx31-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0);
        mxc_register_gpio("imx31-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0);