diff options
-rw-r--r-- | arch/arm/mach-omap1/devices.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap1/io.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/io.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-omap2/io.h | 7 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/common.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/sram.c | 69 |
6 files changed, 28 insertions, 76 deletions
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index 36f26c3fa25e..38e1142ba71f 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
22 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
23 | 23 | ||
24 | #include <plat/common.h> | ||
24 | #include <plat/tc.h> | 25 | #include <plat/tc.h> |
25 | #include <plat/board.h> | 26 | #include <plat/board.h> |
26 | #include <plat/mux.h> | 27 | #include <plat/mux.h> |
@@ -291,6 +292,8 @@ static int __init omap1_init_devices(void) | |||
291 | if (!cpu_class_is_omap1()) | 292 | if (!cpu_class_is_omap1()) |
292 | return -ENODEV; | 293 | return -ENODEV; |
293 | 294 | ||
295 | omap_sram_init(); | ||
296 | |||
294 | /* please keep these calls, and their implementations above, | 297 | /* please keep these calls, and their implementations above, |
295 | * in alphabetical order so they're easier to sort through. | 298 | * in alphabetical order so they're easier to sort through. |
296 | */ | 299 | */ |
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c index a16aab71922c..8140a4ed66e4 100644 --- a/arch/arm/mach-omap1/io.c +++ b/arch/arm/mach-omap1/io.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include "clock.h" | 21 | #include "clock.h" |
22 | 22 | ||
23 | extern void omap_check_revision(void); | 23 | extern void omap_check_revision(void); |
24 | extern void omap_sram_init(void); | ||
25 | 24 | ||
26 | /* | 25 | /* |
27 | * The machine specific code may provide the extra mapping besides the | 26 | * The machine specific code may provide the extra mapping besides the |
@@ -133,7 +132,6 @@ void omap1_init_early(void) | |||
133 | */ | 132 | */ |
134 | omap1_clk_init(); | 133 | omap1_clk_init(); |
135 | omap1_mux_init(); | 134 | omap1_mux_init(); |
136 | omap_sram_init(); | ||
137 | } | 135 | } |
138 | 136 | ||
139 | /* | 137 | /* |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index e8123d010307..b42bbb8f252d 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -35,8 +35,8 @@ | |||
35 | #include "clock2xxx.h" | 35 | #include "clock2xxx.h" |
36 | #include "clock3xxx.h" | 36 | #include "clock3xxx.h" |
37 | #include "clock44xx.h" | 37 | #include "clock44xx.h" |
38 | #include "io.h" | ||
39 | 38 | ||
39 | #include <plat/common.h> | ||
40 | #include <plat/omap-pm.h> | 40 | #include <plat/omap-pm.h> |
41 | #include "voltage.h" | 41 | #include "voltage.h" |
42 | #include "powerdomain.h" | 42 | #include "powerdomain.h" |
@@ -240,22 +240,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = { | |||
240 | }; | 240 | }; |
241 | #endif | 241 | #endif |
242 | 242 | ||
243 | static void __init _omap2_map_common_io(void) | ||
244 | { | ||
245 | /* Normally devicemaps_init() would flush caches and tlb after | ||
246 | * mdesc->map_io(), but we must also do it here because of the CPU | ||
247 | * revision check below. | ||
248 | */ | ||
249 | local_flush_tlb_all(); | ||
250 | flush_cache_all(); | ||
251 | } | ||
252 | |||
253 | #ifdef CONFIG_SOC_OMAP2420 | 243 | #ifdef CONFIG_SOC_OMAP2420 |
254 | void __init omap242x_map_common_io(void) | 244 | void __init omap242x_map_common_io(void) |
255 | { | 245 | { |
256 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); | 246 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); |
257 | iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); | 247 | iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); |
258 | _omap2_map_common_io(); | ||
259 | } | 248 | } |
260 | #endif | 249 | #endif |
261 | 250 | ||
@@ -264,7 +253,6 @@ void __init omap243x_map_common_io(void) | |||
264 | { | 253 | { |
265 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); | 254 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); |
266 | iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); | 255 | iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); |
267 | _omap2_map_common_io(); | ||
268 | } | 256 | } |
269 | #endif | 257 | #endif |
270 | 258 | ||
@@ -272,7 +260,6 @@ void __init omap243x_map_common_io(void) | |||
272 | void __init omap34xx_map_common_io(void) | 260 | void __init omap34xx_map_common_io(void) |
273 | { | 261 | { |
274 | iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); | 262 | iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); |
275 | _omap2_map_common_io(); | ||
276 | } | 263 | } |
277 | #endif | 264 | #endif |
278 | 265 | ||
@@ -280,7 +267,6 @@ void __init omap34xx_map_common_io(void) | |||
280 | void __init omapti816x_map_common_io(void) | 267 | void __init omapti816x_map_common_io(void) |
281 | { | 268 | { |
282 | iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc)); | 269 | iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc)); |
283 | _omap2_map_common_io(); | ||
284 | } | 270 | } |
285 | #endif | 271 | #endif |
286 | 272 | ||
@@ -288,7 +274,6 @@ void __init omapti816x_map_common_io(void) | |||
288 | void __init omap44xx_map_common_io(void) | 274 | void __init omap44xx_map_common_io(void) |
289 | { | 275 | { |
290 | iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); | 276 | iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); |
291 | _omap2_map_common_io(); | ||
292 | } | 277 | } |
293 | #endif | 278 | #endif |
294 | 279 | ||
@@ -337,7 +322,6 @@ void __iomem *omap_irq_base; | |||
337 | static void __init omap_common_init_early(void) | 322 | static void __init omap_common_init_early(void) |
338 | { | 323 | { |
339 | omap2_check_revision(); | 324 | omap2_check_revision(); |
340 | omap_sram_init(); | ||
341 | } | 325 | } |
342 | 326 | ||
343 | static void __init omap_hwmod_init_postsetup(void) | 327 | static void __init omap_hwmod_init_postsetup(void) |
@@ -449,11 +433,12 @@ void __init omap4430_init_early(void) | |||
449 | void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | 433 | void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, |
450 | struct omap_sdrc_params *sdrc_cs1) | 434 | struct omap_sdrc_params *sdrc_cs1) |
451 | { | 435 | { |
436 | omap_sram_init(); | ||
437 | |||
452 | if (cpu_is_omap24xx() || omap3_has_sdrc()) { | 438 | if (cpu_is_omap24xx() || omap3_has_sdrc()) { |
453 | omap2_sdrc_init(sdrc_cs0, sdrc_cs1); | 439 | omap2_sdrc_init(sdrc_cs0, sdrc_cs1); |
454 | _omap2_init_reprogram_sdrc(); | 440 | _omap2_init_reprogram_sdrc(); |
455 | } | 441 | } |
456 | |||
457 | } | 442 | } |
458 | 443 | ||
459 | /* | 444 | /* |
diff --git a/arch/arm/mach-omap2/io.h b/arch/arm/mach-omap2/io.h index fd230c6cded5..e69de29bb2d1 100644 --- a/arch/arm/mach-omap2/io.h +++ b/arch/arm/mach-omap2/io.h | |||
@@ -1,7 +0,0 @@ | |||
1 | |||
2 | #ifndef __MACH_OMAP2_IO_H__ | ||
3 | #define __MACH_OMAP2_IO_H__ | ||
4 | |||
5 | extern int __init omap_sram_init(void); | ||
6 | |||
7 | #endif /* __MACH_OMAP2_IO_H__ */ | ||
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index 5eac3553f96d..ed85720c59c7 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h | |||
@@ -55,6 +55,8 @@ void am35xx_init_early(void); | |||
55 | void ti816x_init_early(void); | 55 | void ti816x_init_early(void); |
56 | void omap4430_init_early(void); | 56 | void omap4430_init_early(void); |
57 | 57 | ||
58 | void omap_sram_init(void); | ||
59 | |||
58 | /* | 60 | /* |
59 | * IO bases for various OMAP processors | 61 | * IO bases for various OMAP processors |
60 | * Except the tap base, rest all the io bases | 62 | * Except the tap base, rest all the io bases |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index 3c8aa44f14da..8b28664d1c62 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -38,16 +38,9 @@ | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #define OMAP1_SRAM_PA 0x20000000 | 40 | #define OMAP1_SRAM_PA 0x20000000 |
41 | #define OMAP1_SRAM_VA VMALLOC_END | ||
42 | #define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800) | 41 | #define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800) |
43 | #define OMAP2_SRAM_VA 0xfe400000 | ||
44 | #define OMAP2_SRAM_PUB_VA (OMAP2_SRAM_VA + 0x800) | ||
45 | #define OMAP3_SRAM_VA 0xfe400000 | ||
46 | #define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000) | 42 | #define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000) |
47 | #define OMAP3_SRAM_PUB_VA (OMAP3_SRAM_VA + 0x8000) | ||
48 | #define OMAP4_SRAM_VA 0xfe400000 | ||
49 | #define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000) | 43 | #define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000) |
50 | #define OMAP4_SRAM_PUB_VA (OMAP4_SRAM_VA + 0x4000) | ||
51 | 44 | ||
52 | #if defined(CONFIG_ARCH_OMAP2PLUS) | 45 | #if defined(CONFIG_ARCH_OMAP2PLUS) |
53 | #define SRAM_BOOTLOADER_SZ 0x00 | 46 | #define SRAM_BOOTLOADER_SZ 0x00 |
@@ -70,9 +63,9 @@ | |||
70 | #define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) | 63 | #define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) |
71 | 64 | ||
72 | static unsigned long omap_sram_start; | 65 | static unsigned long omap_sram_start; |
73 | static unsigned long omap_sram_base; | 66 | static void __iomem *omap_sram_base; |
74 | static unsigned long omap_sram_size; | 67 | static unsigned long omap_sram_size; |
75 | static unsigned long omap_sram_ceil; | 68 | static void __iomem *omap_sram_ceil; |
76 | 69 | ||
77 | /* | 70 | /* |
78 | * Depending on the target RAMFS firewall setup, the public usable amount of | 71 | * Depending on the target RAMFS firewall setup, the public usable amount of |
@@ -112,7 +105,6 @@ static void __init omap_detect_sram(void) | |||
112 | if (cpu_class_is_omap2()) { | 105 | if (cpu_class_is_omap2()) { |
113 | if (is_sram_locked()) { | 106 | if (is_sram_locked()) { |
114 | if (cpu_is_omap34xx()) { | 107 | if (cpu_is_omap34xx()) { |
115 | omap_sram_base = OMAP3_SRAM_PUB_VA; | ||
116 | omap_sram_start = OMAP3_SRAM_PUB_PA; | 108 | omap_sram_start = OMAP3_SRAM_PUB_PA; |
117 | if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) || | 109 | if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) || |
118 | (omap_type() == OMAP2_DEVICE_TYPE_SEC)) { | 110 | (omap_type() == OMAP2_DEVICE_TYPE_SEC)) { |
@@ -121,25 +113,20 @@ static void __init omap_detect_sram(void) | |||
121 | omap_sram_size = 0x8000; /* 32K */ | 113 | omap_sram_size = 0x8000; /* 32K */ |
122 | } | 114 | } |
123 | } else if (cpu_is_omap44xx()) { | 115 | } else if (cpu_is_omap44xx()) { |
124 | omap_sram_base = OMAP4_SRAM_PUB_VA; | ||
125 | omap_sram_start = OMAP4_SRAM_PUB_PA; | 116 | omap_sram_start = OMAP4_SRAM_PUB_PA; |
126 | omap_sram_size = 0xa000; /* 40K */ | 117 | omap_sram_size = 0xa000; /* 40K */ |
127 | } else { | 118 | } else { |
128 | omap_sram_base = OMAP2_SRAM_PUB_VA; | ||
129 | omap_sram_start = OMAP2_SRAM_PUB_PA; | 119 | omap_sram_start = OMAP2_SRAM_PUB_PA; |
130 | omap_sram_size = 0x800; /* 2K */ | 120 | omap_sram_size = 0x800; /* 2K */ |
131 | } | 121 | } |
132 | } else { | 122 | } else { |
133 | if (cpu_is_omap34xx()) { | 123 | if (cpu_is_omap34xx()) { |
134 | omap_sram_base = OMAP3_SRAM_VA; | ||
135 | omap_sram_start = OMAP3_SRAM_PA; | 124 | omap_sram_start = OMAP3_SRAM_PA; |
136 | omap_sram_size = 0x10000; /* 64K */ | 125 | omap_sram_size = 0x10000; /* 64K */ |
137 | } else if (cpu_is_omap44xx()) { | 126 | } else if (cpu_is_omap44xx()) { |
138 | omap_sram_base = OMAP4_SRAM_VA; | ||
139 | omap_sram_start = OMAP4_SRAM_PA; | 127 | omap_sram_start = OMAP4_SRAM_PA; |
140 | omap_sram_size = 0xe000; /* 56K */ | 128 | omap_sram_size = 0xe000; /* 56K */ |
141 | } else { | 129 | } else { |
142 | omap_sram_base = OMAP2_SRAM_VA; | ||
143 | omap_sram_start = OMAP2_SRAM_PA; | 130 | omap_sram_start = OMAP2_SRAM_PA; |
144 | if (cpu_is_omap242x()) | 131 | if (cpu_is_omap242x()) |
145 | omap_sram_size = 0xa0000; /* 640K */ | 132 | omap_sram_size = 0xa0000; /* 640K */ |
@@ -148,7 +135,6 @@ static void __init omap_detect_sram(void) | |||
148 | } | 135 | } |
149 | } | 136 | } |
150 | } else { | 137 | } else { |
151 | omap_sram_base = OMAP1_SRAM_VA; | ||
152 | omap_sram_start = OMAP1_SRAM_PA; | 138 | omap_sram_start = OMAP1_SRAM_PA; |
153 | 139 | ||
154 | if (cpu_is_omap7xx()) | 140 | if (cpu_is_omap7xx()) |
@@ -165,24 +151,14 @@ static void __init omap_detect_sram(void) | |||
165 | omap_sram_size = 0x4000; | 151 | omap_sram_size = 0x4000; |
166 | } | 152 | } |
167 | } | 153 | } |
168 | |||
169 | omap_sram_ceil = omap_sram_base + omap_sram_size; | ||
170 | } | 154 | } |
171 | 155 | ||
172 | static struct map_desc omap_sram_io_desc[] __initdata = { | ||
173 | { /* .length gets filled in at runtime */ | ||
174 | .virtual = OMAP1_SRAM_VA, | ||
175 | .pfn = __phys_to_pfn(OMAP1_SRAM_PA), | ||
176 | .type = MT_MEMORY | ||
177 | } | ||
178 | }; | ||
179 | |||
180 | /* | 156 | /* |
181 | * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early. | 157 | * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early. |
182 | */ | 158 | */ |
183 | static void __init omap_map_sram(void) | 159 | static void __init omap_map_sram(void) |
184 | { | 160 | { |
185 | unsigned long base; | 161 | int cached = 1; |
186 | 162 | ||
187 | if (omap_sram_size == 0) | 163 | if (omap_sram_size == 0) |
188 | return; | 164 | return; |
@@ -195,28 +171,18 @@ static void __init omap_map_sram(void) | |||
195 | * the ARM may attempt to write cache lines back to SDRAM | 171 | * the ARM may attempt to write cache lines back to SDRAM |
196 | * which will cause the system to hang. | 172 | * which will cause the system to hang. |
197 | */ | 173 | */ |
198 | omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED; | 174 | cached = 0; |
199 | } | 175 | } |
200 | 176 | ||
201 | omap_sram_io_desc[0].virtual = omap_sram_base; | 177 | omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE); |
202 | base = omap_sram_start; | 178 | omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size, |
203 | base = ROUND_DOWN(base, PAGE_SIZE); | 179 | cached); |
204 | omap_sram_io_desc[0].pfn = __phys_to_pfn(base); | 180 | if (!omap_sram_base) { |
205 | omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE); | 181 | pr_err("SRAM: Could not map\n"); |
206 | iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc)); | 182 | return; |
207 | 183 | } | |
208 | pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n", | ||
209 | (long long) __pfn_to_phys(omap_sram_io_desc[0].pfn), | ||
210 | omap_sram_io_desc[0].virtual, | ||
211 | omap_sram_io_desc[0].length); | ||
212 | 184 | ||
213 | /* | 185 | omap_sram_ceil = omap_sram_base + omap_sram_size; |
214 | * Normally devicemaps_init() would flush caches and tlb after | ||
215 | * mdesc->map_io(), but since we're called from map_io(), we | ||
216 | * must do it here. | ||
217 | */ | ||
218 | local_flush_tlb_all(); | ||
219 | flush_cache_all(); | ||
220 | 186 | ||
221 | /* | 187 | /* |
222 | * Looks like we need to preserve some bootloader code at the | 188 | * Looks like we need to preserve some bootloader code at the |
@@ -235,13 +201,18 @@ static void __init omap_map_sram(void) | |||
235 | */ | 201 | */ |
236 | void *omap_sram_push_address(unsigned long size) | 202 | void *omap_sram_push_address(unsigned long size) |
237 | { | 203 | { |
238 | if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) { | 204 | unsigned long available, new_ceil = (unsigned long)omap_sram_ceil; |
205 | |||
206 | available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ); | ||
207 | |||
208 | if (size > available) { | ||
239 | pr_err("Not enough space in SRAM\n"); | 209 | pr_err("Not enough space in SRAM\n"); |
240 | return NULL; | 210 | return NULL; |
241 | } | 211 | } |
242 | 212 | ||
243 | omap_sram_ceil -= size; | 213 | new_ceil -= size; |
244 | omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN); | 214 | new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN); |
215 | omap_sram_ceil = IOMEM(new_ceil); | ||
245 | 216 | ||
246 | return (void *)omap_sram_ceil; | 217 | return (void *)omap_sram_ceil; |
247 | } | 218 | } |