2 * OMAP4 specific common source file.
4 * Copyright (C) 2010 Texas Instruments, Inc.
6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
9 * This program is free software,you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
17 #include <linux/platform_device.h>
19 #include <asm/hardware/gic.h>
20 #include <asm/hardware/cache-l2x0.h>
22 #include <mach/hardware.h>
23 #include <mach/omap4-common.h>
25 #ifdef CONFIG_CACHE_L2X0
26 void __iomem *l2cache_base;
29 void __iomem *gic_cpu_base_addr;
30 void __iomem *gic_dist_base_addr;
33 void __init gic_init_irq(void)
35 /* Static mapping, never released */
36 gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
37 BUG_ON(!gic_dist_base_addr);
38 gic_dist_init(0, gic_dist_base_addr, 29);
40 /* Static mapping, never released */
41 gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
42 BUG_ON(!gic_cpu_base_addr);
43 gic_cpu_init(0, gic_cpu_base_addr);
46 #ifdef CONFIG_CACHE_L2X0
48 static void omap4_l2x0_disable(void)
50 /* Disable PL310 L2 Cache controller */
51 omap_smc1(0x102, 0x0);
54 static int __init omap_l2_cache_init(void)
59 * To avoid code running on other OMAPs in
62 if (!cpu_is_omap44xx())
65 /* Static mapping, never released */
66 l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
67 BUG_ON(!l2cache_base);
70 * 16-way associativity, parity disabled
71 * Way size - 32KB (es1.0)
72 * Way size - 64KB (es2.0 +)
74 aux_ctrl = ((1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT) |
76 (0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) |
77 (0x1 << L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT));
79 if (omap_rev() == OMAP4430_REV_ES1_0) {
80 aux_ctrl |= 0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT;
82 aux_ctrl |= ((0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) |
83 (1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) |
84 (1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT));
86 if (omap_rev() != OMAP4430_REV_ES1_0)
87 omap_smc1(0x109, aux_ctrl);
89 /* Enable PL310 L2 Cache controller */
90 omap_smc1(0x102, 0x1);
92 l2x0_init(l2cache_base, aux_ctrl, L2X0_AUX_CTRL_MASK);
95 * Override default outer_cache.disable with a OMAP4
98 outer_cache.disable = omap4_l2x0_disable;
102 early_initcall(omap_l2_cache_init);