blob: e7a9b7f13b525d59acce1b337c4dd731d2e59955 [file] [log] [blame]
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -07001/*
2 * OMAP4 specific common source file.
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Author:
6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 *
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.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18
19#include <asm/hardware/gic.h>
20#include <asm/hardware/cache-l2x0.h>
21
22#include <mach/hardware.h>
23#include <mach/omap4-common.h>
24
25#ifdef CONFIG_CACHE_L2X0
26void __iomem *l2cache_base;
27#endif
28
29void __iomem *gic_cpu_base_addr;
30void __iomem *gic_dist_base_addr;
31
32
33void __init gic_init_irq(void)
34{
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);
39
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);
44}
45
46#ifdef CONFIG_CACHE_L2X0
Santosh Shilimkar4e803c42010-07-31 21:40:10 +053047
48static void omap4_l2x0_disable(void)
49{
50 /* Disable PL310 L2 Cache controller */
51 omap_smc1(0x102, 0x0);
52}
53
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070054static int __init omap_l2_cache_init(void)
55{
Santosh Shilimkar1773e602010-11-19 23:01:03 +053056 u32 aux_ctrl = 0;
57
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070058 /*
59 * To avoid code running on other OMAPs in
60 * multi-omap builds
61 */
62 if (!cpu_is_omap44xx())
63 return -ENODEV;
64
65 /* Static mapping, never released */
66 l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
67 BUG_ON(!l2cache_base);
68
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070069 /*
Santosh Shilimkara777b722010-09-16 18:44:47 +053070 * 16-way associativity, parity disabled
71 * Way size - 32KB (es1.0)
72 * Way size - 64KB (es2.0 +)
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070073 */
Santosh Shilimkar1773e602010-11-19 23:01:03 +053074 aux_ctrl = ((1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT) |
75 (0x1 << 25) |
76 (0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) |
77 (0x1 << L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT));
78
Mans Rullgard11e02642010-11-19 23:01:04 +053079 if (omap_rev() == OMAP4430_REV_ES1_0) {
Santosh Shilimkar1773e602010-11-19 23:01:03 +053080 aux_ctrl |= 0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT;
Mans Rullgard11e02642010-11-19 23:01:04 +053081 } else {
82 aux_ctrl |= ((0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) |
Santosh Shilimkarb0f20ff2010-11-19 23:01:05 +053083 (1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) |
Mans Rullgard11e02642010-11-19 23:01:04 +053084 (1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) |
Santosh Shilimkarb89cd712010-11-19 23:01:06 +053085 (1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) |
86 (1 << L2X0_AUX_CTRL_EARLY_BRESP_SHIFT));
Mans Rullgard11e02642010-11-19 23:01:04 +053087 }
88 if (omap_rev() != OMAP4430_REV_ES1_0)
89 omap_smc1(0x109, aux_ctrl);
90
91 /* Enable PL310 L2 Cache controller */
92 omap_smc1(0x102, 0x1);
Santosh Shilimkar1773e602010-11-19 23:01:03 +053093
94 l2x0_init(l2cache_base, aux_ctrl, L2X0_AUX_CTRL_MASK);
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070095
Santosh Shilimkar4e803c42010-07-31 21:40:10 +053096 /*
97 * Override default outer_cache.disable with a OMAP4
98 * specific one
99 */
100 outer_cache.disable = omap4_l2x0_disable;
101
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -0700102 return 0;
103}
104early_initcall(omap_l2_cache_init);
105#endif