2 * Copyright (C) 2009-2010 Pengutronix
3 * Sascha Hauer <s.hauer@pengutronix.de>
4 * Juergen Beisert <j.beisert@pengutronix.de>
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation.
11 #include <linux/init.h>
12 #include <linux/err.h>
13 #include <linux/kernel.h>
15 #include <asm/hardware/cache-l2x0.h>
17 #include <mach/hardware.h>
19 static int mxc_init_l2x0(void)
21 void __iomem
*l2x0_base
;
22 void __iomem
*clkctl_base
;
24 if (!cpu_is_mx31() && !cpu_is_mx35())
28 * First of all, we must repair broken chip settings. There are some
29 * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These
30 * misconfigured CPUs will run amok immediately when the L2 cache gets enabled.
31 * Workaraound is to setup the correct register setting prior enabling the
32 * L2 cache. This should not hurt already working CPUs, as they are using the
35 #define L2_MEM_VAL 0x10
37 clkctl_base
= ioremap(MX35_CLKCTL_BASE_ADDR
, 4096);
38 if (clkctl_base
!= NULL
) {
39 writel(0x00000515, clkctl_base
+ L2_MEM_VAL
);
42 pr_err("L2 cache: Cannot fix timing. Trying to continue without\n");
45 l2x0_base
= ioremap(MX3x_L2CC_BASE_ADDR
, 4096);
46 if (IS_ERR(l2x0_base
)) {
47 printk(KERN_ERR
"remapping L2 cache area failed with %ld\n",
52 l2x0_init(l2x0_base
, 0x00030024, 0x00000000);
56 arch_initcall(mxc_init_l2x0
);