diff options
Diffstat (limited to 'arch/arm/mach-omap2/omap4-common.c')
-rw-r--r-- | arch/arm/mach-omap2/omap4-common.c | 94 |
1 files changed, 92 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index beecfdd56ea3..bc16c818c6b7 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -15,18 +15,73 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/memblock.h> | ||
18 | 19 | ||
19 | #include <asm/hardware/gic.h> | 20 | #include <asm/hardware/gic.h> |
20 | #include <asm/hardware/cache-l2x0.h> | 21 | #include <asm/hardware/cache-l2x0.h> |
22 | #include <asm/mach/map.h> | ||
21 | 23 | ||
22 | #include <plat/irqs.h> | 24 | #include <plat/irqs.h> |
25 | #include <plat/sram.h> | ||
23 | 26 | ||
24 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | #include <mach/omap-wakeupgen.h> | ||
25 | 29 | ||
26 | #include "common.h" | 30 | #include "common.h" |
31 | #include "omap4-sar-layout.h" | ||
27 | 32 | ||
28 | #ifdef CONFIG_CACHE_L2X0 | 33 | #ifdef CONFIG_CACHE_L2X0 |
29 | void __iomem *l2cache_base; | 34 | static void __iomem *l2cache_base; |
35 | #endif | ||
36 | |||
37 | static void __iomem *sar_ram_base; | ||
38 | |||
39 | #ifdef CONFIG_OMAP4_ERRATA_I688 | ||
40 | /* Used to implement memory barrier on DRAM path */ | ||
41 | #define OMAP4_DRAM_BARRIER_VA 0xfe600000 | ||
42 | |||
43 | void __iomem *dram_sync, *sram_sync; | ||
44 | |||
45 | void omap_bus_sync(void) | ||
46 | { | ||
47 | if (dram_sync && sram_sync) { | ||
48 | writel_relaxed(readl_relaxed(dram_sync), dram_sync); | ||
49 | writel_relaxed(readl_relaxed(sram_sync), sram_sync); | ||
50 | isb(); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | static int __init omap_barriers_init(void) | ||
55 | { | ||
56 | struct map_desc dram_io_desc[1]; | ||
57 | phys_addr_t paddr; | ||
58 | u32 size; | ||
59 | |||
60 | if (!cpu_is_omap44xx()) | ||
61 | return -ENODEV; | ||
62 | |||
63 | size = ALIGN(PAGE_SIZE, SZ_1M); | ||
64 | paddr = memblock_alloc(size, SZ_1M); | ||
65 | if (!paddr) { | ||
66 | pr_err("%s: failed to reserve 4 Kbytes\n", __func__); | ||
67 | return -ENOMEM; | ||
68 | } | ||
69 | memblock_free(paddr, size); | ||
70 | memblock_remove(paddr, size); | ||
71 | dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; | ||
72 | dram_io_desc[0].pfn = __phys_to_pfn(paddr); | ||
73 | dram_io_desc[0].length = size; | ||
74 | dram_io_desc[0].type = MT_MEMORY_SO; | ||
75 | iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); | ||
76 | dram_sync = (void __iomem *) dram_io_desc[0].virtual; | ||
77 | sram_sync = (void __iomem *) OMAP4_SRAM_VA; | ||
78 | |||
79 | pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n", | ||
80 | (long long) paddr, dram_io_desc[0].virtual); | ||
81 | |||
82 | return 0; | ||
83 | } | ||
84 | core_initcall(omap_barriers_init); | ||
30 | #endif | 85 | #endif |
31 | 86 | ||
32 | void __init gic_init_irq(void) | 87 | void __init gic_init_irq(void) |
@@ -42,11 +97,18 @@ void __init gic_init_irq(void) | |||
42 | omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); | 97 | omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); |
43 | BUG_ON(!omap_irq_base); | 98 | BUG_ON(!omap_irq_base); |
44 | 99 | ||
100 | omap_wakeupgen_init(); | ||
101 | |||
45 | gic_init(0, 29, gic_dist_base_addr, omap_irq_base); | 102 | gic_init(0, 29, gic_dist_base_addr, omap_irq_base); |
46 | } | 103 | } |
47 | 104 | ||
48 | #ifdef CONFIG_CACHE_L2X0 | 105 | #ifdef CONFIG_CACHE_L2X0 |
49 | 106 | ||
107 | void __iomem *omap4_get_l2cache_base(void) | ||
108 | { | ||
109 | return l2cache_base; | ||
110 | } | ||
111 | |||
50 | static void omap4_l2x0_disable(void) | 112 | static void omap4_l2x0_disable(void) |
51 | { | 113 | { |
52 | /* Disable PL310 L2 Cache controller */ | 114 | /* Disable PL310 L2 Cache controller */ |
@@ -72,7 +134,8 @@ static int __init omap_l2_cache_init(void) | |||
72 | 134 | ||
73 | /* Static mapping, never released */ | 135 | /* Static mapping, never released */ |
74 | l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K); | 136 | l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K); |
75 | BUG_ON(!l2cache_base); | 137 | if (WARN_ON(!l2cache_base)) |
138 | return -ENOMEM; | ||
76 | 139 | ||
77 | /* | 140 | /* |
78 | * 16-way associativity, parity disabled | 141 | * 16-way associativity, parity disabled |
@@ -112,3 +175,30 @@ static int __init omap_l2_cache_init(void) | |||
112 | } | 175 | } |
113 | early_initcall(omap_l2_cache_init); | 176 | early_initcall(omap_l2_cache_init); |
114 | #endif | 177 | #endif |
178 | |||
179 | void __iomem *omap4_get_sar_ram_base(void) | ||
180 | { | ||
181 | return sar_ram_base; | ||
182 | } | ||
183 | |||
184 | /* | ||
185 | * SAR RAM used to save and restore the HW | ||
186 | * context in low power modes | ||
187 | */ | ||
188 | static int __init omap4_sar_ram_init(void) | ||
189 | { | ||
190 | /* | ||
191 | * To avoid code running on other OMAPs in | ||
192 | * multi-omap builds | ||
193 | */ | ||
194 | if (!cpu_is_omap44xx()) | ||
195 | return -ENOMEM; | ||
196 | |||
197 | /* Static mapping, never released */ | ||
198 | sar_ram_base = ioremap(OMAP44XX_SAR_RAM_BASE, SZ_16K); | ||
199 | if (WARN_ON(!sar_ram_base)) | ||
200 | return -ENOMEM; | ||
201 | |||
202 | return 0; | ||
203 | } | ||
204 | early_initcall(omap4_sar_ram_init); | ||