blob: 666e852988d5d21dfcda20e8ea7779a17fe94d97 [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
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070029void __iomem *gic_dist_base_addr;
30
31
32void __init gic_init_irq(void)
33{
Russell Kingff2e27a2010-12-04 16:13:29 +000034 void __iomem *gic_cpu_base;
35
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070036 /* Static mapping, never released */
37 gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
38 BUG_ON(!gic_dist_base_addr);
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070039
40 /* Static mapping, never released */
Russell Kingff2e27a2010-12-04 16:13:29 +000041 gic_cpu_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
42 BUG_ON(!gic_cpu_base);
Russell Kingb580b892010-12-04 15:55:14 +000043
Russell Kingff2e27a2010-12-04 16:13:29 +000044 gic_init(0, 29, gic_dist_base_addr, gic_cpu_base);
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070045}
46
47#ifdef CONFIG_CACHE_L2X0
Santosh Shilimkar4e803c42010-07-31 21:40:10 +053048
49static void omap4_l2x0_disable(void)
50{
51 /* Disable PL310 L2 Cache controller */
52 omap_smc1(0x102, 0x0);
53}
54
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070055static int __init omap_l2_cache_init(void)
56{
57 /*
58 * To avoid code running on other OMAPs in
59 * multi-omap builds
60 */
61 if (!cpu_is_omap44xx())
62 return -ENODEV;
63
64 /* Static mapping, never released */
65 l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
66 BUG_ON(!l2cache_base);
67
68 /* Enable PL310 L2 Cache controller */
69 omap_smc1(0x102, 0x1);
70
71 /*
Santosh Shilimkara777b722010-09-16 18:44:47 +053072 * 16-way associativity, parity disabled
73 * Way size - 32KB (es1.0)
74 * Way size - 64KB (es2.0 +)
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070075 */
Santosh Shilimkara777b722010-09-16 18:44:47 +053076 if (omap_rev() == OMAP4430_REV_ES1_0)
77 l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff);
78 else
79 l2x0_init(l2cache_base, 0x0e070000, 0xc0000fff);
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070080
Santosh Shilimkar4e803c42010-07-31 21:40:10 +053081 /*
82 * Override default outer_cache.disable with a OMAP4
83 * specific one
84 */
85 outer_cache.disable = omap4_l2x0_disable;
86
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070087 return 0;
88}
89early_initcall(omap_l2_cache_init);
90#endif