diff options
author | Tony Lindgren <tony@atomide.com> | 2010-08-04 07:43:45 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-08-04 07:43:45 -0400 |
commit | 7590d1defdc720a97a9e186f45f529c4ae1b40f7 (patch) | |
tree | e7ffdc043a2847f410d654d8e99e001f3138937a /arch/arm/plat-omap | |
parent | 7e788b4289bb025a96e327c604cb2db92e17108f (diff) | |
parent | 869fef41547db95df8523bf67845a21313709428 (diff) |
Merge branch 'devel-map-io' into omap-for-linus
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/common.c | 18 | ||||
-rw-r--r-- | arch/arm/plat-omap/fb.c | 77 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/common.h | 7 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/vram.h | 4 |
4 files changed, 76 insertions, 30 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 219c01e82bc5..3008e7104487 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/serial_reg.h> | 22 | #include <linux/serial_reg.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/omapfb.h> | ||
25 | 26 | ||
26 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
27 | #include <asm/system.h> | 28 | #include <asm/system.h> |
@@ -35,6 +36,7 @@ | |||
35 | #include <plat/mux.h> | 36 | #include <plat/mux.h> |
36 | #include <plat/fpga.h> | 37 | #include <plat/fpga.h> |
37 | #include <plat/serial.h> | 38 | #include <plat/serial.h> |
39 | #include <plat/vram.h> | ||
38 | 40 | ||
39 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
40 | 42 | ||
@@ -81,6 +83,12 @@ const void *omap_get_var_config(u16 tag, size_t *len) | |||
81 | } | 83 | } |
82 | EXPORT_SYMBOL(omap_get_var_config); | 84 | EXPORT_SYMBOL(omap_get_var_config); |
83 | 85 | ||
86 | void __init omap_reserve(void) | ||
87 | { | ||
88 | omapfb_reserve_sdram_memblock(); | ||
89 | omap_vram_reserve_sdram_memblock(); | ||
90 | } | ||
91 | |||
84 | /* | 92 | /* |
85 | * 32KHz clocksource ... always available, on pretty most chips except | 93 | * 32KHz clocksource ... always available, on pretty most chips except |
86 | * OMAP 730 and 1510. Other timers could be used as clocksources, with | 94 | * OMAP 730 and 1510. Other timers could be used as clocksources, with |
@@ -309,18 +317,18 @@ static struct omap_globals omap3_globals = { | |||
309 | .uart1_phys = OMAP3_UART1_BASE, | 317 | .uart1_phys = OMAP3_UART1_BASE, |
310 | .uart2_phys = OMAP3_UART2_BASE, | 318 | .uart2_phys = OMAP3_UART2_BASE, |
311 | .uart3_phys = OMAP3_UART3_BASE, | 319 | .uart3_phys = OMAP3_UART3_BASE, |
320 | .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */ | ||
312 | }; | 321 | }; |
313 | 322 | ||
314 | void __init omap2_set_globals_343x(void) | 323 | void __init omap2_set_globals_3xxx(void) |
315 | { | 324 | { |
316 | __omap2_set_globals(&omap3_globals); | 325 | __omap2_set_globals(&omap3_globals); |
317 | } | 326 | } |
318 | 327 | ||
319 | void __init omap2_set_globals_36xx(void) | 328 | void __init omap3_map_io(void) |
320 | { | 329 | { |
321 | omap3_globals.uart4_phys = OMAP3_UART4_BASE; | 330 | omap2_set_globals_3xxx(); |
322 | 331 | omap34xx_map_common_io(); | |
323 | __omap2_set_globals(&omap3_globals); | ||
324 | } | 332 | } |
325 | #endif | 333 | #endif |
326 | 334 | ||
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c index d3eea4f47533..0054b9501a53 100644 --- a/arch/arm/plat-omap/fb.c +++ b/arch/arm/plat-omap/fb.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/bootmem.h> | 29 | #include <linux/memblock.h> |
30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
31 | #include <linux/omapfb.h> | 31 | #include <linux/omapfb.h> |
32 | 32 | ||
@@ -171,49 +171,78 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg, | |||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | static int valid_sdram(unsigned long addr, unsigned long size) | ||
175 | { | ||
176 | struct memblock_property res; | ||
177 | |||
178 | res.base = addr; | ||
179 | res.size = size; | ||
180 | return !memblock_find(&res) && res.base == addr && res.size == size; | ||
181 | } | ||
182 | |||
183 | static int reserve_sdram(unsigned long addr, unsigned long size) | ||
184 | { | ||
185 | if (memblock_is_region_reserved(addr, size)) | ||
186 | return -EBUSY; | ||
187 | if (memblock_reserve(addr, size)) | ||
188 | return -ENOMEM; | ||
189 | return 0; | ||
190 | } | ||
191 | |||
174 | /* | 192 | /* |
175 | * Called from map_io. We need to call to this early enough so that we | 193 | * Called from map_io. We need to call to this early enough so that we |
176 | * can reserve the fixed SDRAM regions before VM could get hold of them. | 194 | * can reserve the fixed SDRAM regions before VM could get hold of them. |
177 | */ | 195 | */ |
178 | void __init omapfb_reserve_sdram(void) | 196 | void __init omapfb_reserve_sdram_memblock(void) |
179 | { | 197 | { |
180 | struct bootmem_data *bdata; | 198 | unsigned long reserved = 0; |
181 | unsigned long sdram_start, sdram_size; | 199 | int i; |
182 | unsigned long reserved; | ||
183 | int i; | ||
184 | 200 | ||
185 | if (config_invalid) | 201 | if (config_invalid) |
186 | return; | 202 | return; |
187 | 203 | ||
188 | bdata = NODE_DATA(0)->bdata; | ||
189 | sdram_start = bdata->node_min_pfn << PAGE_SHIFT; | ||
190 | sdram_size = (bdata->node_low_pfn << PAGE_SHIFT) - sdram_start; | ||
191 | reserved = 0; | ||
192 | for (i = 0; ; i++) { | 204 | for (i = 0; ; i++) { |
193 | struct omapfb_mem_region rg; | 205 | struct omapfb_mem_region rg; |
194 | 206 | ||
195 | if (get_fbmem_region(i, &rg) < 0) | 207 | if (get_fbmem_region(i, &rg) < 0) |
196 | break; | 208 | break; |
209 | |||
197 | if (i == OMAPFB_PLANE_NUM) { | 210 | if (i == OMAPFB_PLANE_NUM) { |
198 | printk(KERN_ERR | 211 | pr_err("Extraneous FB mem configuration entries\n"); |
199 | "Extraneous FB mem configuration entries\n"); | ||
200 | config_invalid = 1; | 212 | config_invalid = 1; |
201 | return; | 213 | return; |
202 | } | 214 | } |
215 | |||
203 | /* Check if it's our memory type. */ | 216 | /* Check if it's our memory type. */ |
204 | if (set_fbmem_region_type(&rg, OMAPFB_MEMTYPE_SDRAM, | 217 | if (rg.type != OMAPFB_MEMTYPE_SDRAM) |
205 | sdram_start, sdram_size) < 0 || | ||
206 | (rg.type != OMAPFB_MEMTYPE_SDRAM)) | ||
207 | continue; | 218 | continue; |
208 | BUG_ON(omapfb_config.mem_desc.region[i].size); | 219 | |
209 | if (check_fbmem_region(i, &rg, sdram_start, sdram_size) < 0) { | 220 | /* Check if the region falls within SDRAM */ |
221 | if (rg.paddr && !valid_sdram(rg.paddr, rg.size)) | ||
222 | continue; | ||
223 | |||
224 | if (rg.size == 0) { | ||
225 | pr_err("Zero size for FB region %d\n", i); | ||
210 | config_invalid = 1; | 226 | config_invalid = 1; |
211 | return; | 227 | return; |
212 | } | 228 | } |
229 | |||
213 | if (rg.paddr) { | 230 | if (rg.paddr) { |
214 | reserve_bootmem(rg.paddr, rg.size, BOOTMEM_DEFAULT); | 231 | if (reserve_sdram(rg.paddr, rg.size)) { |
232 | pr_err("Trying to use reserved memory for FB region %d\n", | ||
233 | i); | ||
234 | config_invalid = 1; | ||
235 | return; | ||
236 | } | ||
215 | reserved += rg.size; | 237 | reserved += rg.size; |
216 | } | 238 | } |
239 | |||
240 | if (omapfb_config.mem_desc.region[i].size) { | ||
241 | pr_err("FB region %d already set\n", i); | ||
242 | config_invalid = 1; | ||
243 | return; | ||
244 | } | ||
245 | |||
217 | omapfb_config.mem_desc.region[i] = rg; | 246 | omapfb_config.mem_desc.region[i] = rg; |
218 | configured_regions++; | 247 | configured_regions++; |
219 | } | 248 | } |
@@ -359,7 +388,10 @@ static inline int omap_init_fb(void) | |||
359 | 388 | ||
360 | arch_initcall(omap_init_fb); | 389 | arch_initcall(omap_init_fb); |
361 | 390 | ||
362 | void omapfb_reserve_sdram(void) {} | 391 | void omapfb_reserve_sdram_memblock(void) |
392 | { | ||
393 | } | ||
394 | |||
363 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, | 395 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, |
364 | unsigned long sram_vstart, | 396 | unsigned long sram_vstart, |
365 | unsigned long sram_size, | 397 | unsigned long sram_size, |
@@ -375,7 +407,10 @@ void omapfb_set_platform_data(struct omapfb_platform_data *data) | |||
375 | { | 407 | { |
376 | } | 408 | } |
377 | 409 | ||
378 | void omapfb_reserve_sdram(void) {} | 410 | void omapfb_reserve_sdram_memblock(void) |
411 | { | ||
412 | } | ||
413 | |||
379 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, | 414 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, |
380 | unsigned long sram_vstart, | 415 | unsigned long sram_vstart, |
381 | unsigned long sram_size, | 416 | unsigned long sram_size, |
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index fe83e901ba6c..9776b41ad76f 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h | |||
@@ -34,6 +34,8 @@ struct sys_timer; | |||
34 | extern void omap_map_common_io(void); | 34 | extern void omap_map_common_io(void); |
35 | extern struct sys_timer omap_timer; | 35 | extern struct sys_timer omap_timer; |
36 | 36 | ||
37 | extern void omap_reserve(void); | ||
38 | |||
37 | /* | 39 | /* |
38 | * IO bases for various OMAP processors | 40 | * IO bases for various OMAP processors |
39 | * Except the tap base, rest all the io bases | 41 | * Except the tap base, rest all the io bases |
@@ -56,8 +58,7 @@ struct omap_globals { | |||
56 | 58 | ||
57 | void omap2_set_globals_242x(void); | 59 | void omap2_set_globals_242x(void); |
58 | void omap2_set_globals_243x(void); | 60 | void omap2_set_globals_243x(void); |
59 | void omap2_set_globals_343x(void); | 61 | void omap2_set_globals_3xxx(void); |
60 | void omap2_set_globals_36xx(void); | ||
61 | void omap2_set_globals_443x(void); | 62 | void omap2_set_globals_443x(void); |
62 | 63 | ||
63 | /* These get called from omap2_set_globals_xxxx(), do not call these */ | 64 | /* These get called from omap2_set_globals_xxxx(), do not call these */ |
@@ -67,6 +68,8 @@ void omap2_set_globals_control(struct omap_globals *); | |||
67 | void omap2_set_globals_prcm(struct omap_globals *); | 68 | void omap2_set_globals_prcm(struct omap_globals *); |
68 | void omap2_set_globals_uart(struct omap_globals *); | 69 | void omap2_set_globals_uart(struct omap_globals *); |
69 | 70 | ||
71 | void omap3_map_io(void); | ||
72 | |||
70 | /** | 73 | /** |
71 | * omap_test_timeout - busy-loop, testing a condition | 74 | * omap_test_timeout - busy-loop, testing a condition |
72 | * @cond: condition to test until it evaluates to true | 75 | * @cond: condition to test until it evaluates to true |
diff --git a/arch/arm/plat-omap/include/plat/vram.h b/arch/arm/plat-omap/include/plat/vram.h index edd4987758a6..0aa4ecd12c7d 100644 --- a/arch/arm/plat-omap/include/plat/vram.h +++ b/arch/arm/plat-omap/include/plat/vram.h | |||
@@ -38,7 +38,7 @@ extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram, | |||
38 | extern void omap_vram_set_sdram_vram(u32 size, u32 start); | 38 | extern void omap_vram_set_sdram_vram(u32 size, u32 start); |
39 | extern void omap_vram_set_sram_vram(u32 size, u32 start); | 39 | extern void omap_vram_set_sram_vram(u32 size, u32 start); |
40 | 40 | ||
41 | extern void omap_vram_reserve_sdram(void); | 41 | extern void omap_vram_reserve_sdram_memblock(void); |
42 | extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | 42 | extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, |
43 | unsigned long sram_vstart, | 43 | unsigned long sram_vstart, |
44 | unsigned long sram_size, | 44 | unsigned long sram_size, |
@@ -48,7 +48,7 @@ extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | |||
48 | static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } | 48 | static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } |
49 | static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } | 49 | static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } |
50 | 50 | ||
51 | static inline void omap_vram_reserve_sdram(void) { } | 51 | static inline void omap_vram_reserve_sdram_memblock(void) { } |
52 | static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | 52 | static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, |
53 | unsigned long sram_vstart, | 53 | unsigned long sram_vstart, |
54 | unsigned long sram_size, | 54 | unsigned long sram_size, |