/*1* Copyright (C) 2009-2010 Pengutronix2* Sascha Hauer <[email protected]>3* Juergen Beisert <[email protected]>4*5* This program is free software; you can redistribute it and/or modify it under6* the terms of the GNU General Public License version 2 as published by the7* Free Software Foundation.8*/910#include <linux/init.h>11#include <linux/err.h>12#include <linux/kernel.h>1314#include <asm/hardware/cache-l2x0.h>1516#include <mach/hardware.h>1718static int mxc_init_l2x0(void)19{20void __iomem *l2x0_base;21void __iomem *clkctl_base;2223if (!cpu_is_mx31() && !cpu_is_mx35())24return 0;2526/*27* First of all, we must repair broken chip settings. There are some28* i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These29* misconfigured CPUs will run amok immediately when the L2 cache gets enabled.30* Workaraound is to setup the correct register setting prior enabling the31* L2 cache. This should not hurt already working CPUs, as they are using the32* same value.33*/34#define L2_MEM_VAL 0x103536clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096);37if (clkctl_base != NULL) {38writel(0x00000515, clkctl_base + L2_MEM_VAL);39iounmap(clkctl_base);40} else {41pr_err("L2 cache: Cannot fix timing. Trying to continue without\n");42}4344l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096);45if (IS_ERR(l2x0_base)) {46printk(KERN_ERR "remapping L2 cache area failed with %ld\n",47PTR_ERR(l2x0_base));48return 0;49}5051l2x0_init(l2x0_base, 0x00030024, 0x00000000);5253return 0;54}55arch_initcall(mxc_init_l2x0);565758