aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-05-22 18:59:11 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-27 03:48:23 -0400
commit98864ff58dd2b8ef9e72b0d2c70f34e7ff24a2ee (patch)
tree87f93ed777f090220acb3cc066c85abe4b863d12 /arch
parent8d717a52d1b0959128be5134dd12608e8e4f2115 (diff)
ARM: OMAP: Convert OMAPFB and VRAM SDRAM reservation to LMB
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-omap/common.c4
-rw-r--r--arch/arm/plat-omap/fb.c30
-rw-r--r--arch/arm/plat-omap/include/plat/vram.h4
3 files changed, 23 insertions, 15 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 9f6bbc178a74..ebed82699eb2 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -85,8 +85,8 @@ EXPORT_SYMBOL(omap_get_var_config);
85 85
86void __init omap_reserve(void) 86void __init omap_reserve(void)
87{ 87{
88 omapfb_reserve_sdram(); 88 omapfb_reserve_sdram_memblock();
89 omap_vram_reserve_sdram(); 89 omap_vram_reserve_sdram_memblock();
90} 90}
91 91
92/* 92/*
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index 97db493904fa..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
@@ -173,25 +173,27 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
173 173
174static int valid_sdram(unsigned long addr, unsigned long size) 174static int valid_sdram(unsigned long addr, unsigned long size)
175{ 175{
176 struct bootmem_data *bdata = NODE_DATA(0)->bdata; 176 struct memblock_property res;
177 unsigned long sdram_start, sdram_end;
178 177
179 sdram_start = bdata->node_min_pfn << PAGE_SHIFT; 178 res.base = addr;
180 sdram_end = bdata->node_low_pfn << PAGE_SHIFT; 179 res.size = size;
181 180 return !memblock_find(&res) && res.base == addr && res.size == size;
182 return addr >= sdram_start && sdram_end - addr >= size;
183} 181}
184 182
185static int reserve_sdram(unsigned long addr, unsigned long size) 183static int reserve_sdram(unsigned long addr, unsigned long size)
186{ 184{
187 return reserve_bootmem(addr, size, BOOTMEM_EXCLUSIVE); 185 if (memblock_is_region_reserved(addr, size))
186 return -EBUSY;
187 if (memblock_reserve(addr, size))
188 return -ENOMEM;
189 return 0;
188} 190}
189 191
190/* 192/*
191 * 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
192 * 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.
193 */ 195 */
194void __init omapfb_reserve_sdram(void) 196void __init omapfb_reserve_sdram_memblock(void)
195{ 197{
196 unsigned long reserved = 0; 198 unsigned long reserved = 0;
197 int i; 199 int i;
@@ -386,7 +388,10 @@ static inline int omap_init_fb(void)
386 388
387arch_initcall(omap_init_fb); 389arch_initcall(omap_init_fb);
388 390
389void omapfb_reserve_sdram(void) {} 391void omapfb_reserve_sdram_memblock(void)
392{
393}
394
390unsigned long omapfb_reserve_sram(unsigned long sram_pstart, 395unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
391 unsigned long sram_vstart, 396 unsigned long sram_vstart,
392 unsigned long sram_size, 397 unsigned long sram_size,
@@ -402,7 +407,10 @@ void omapfb_set_platform_data(struct omapfb_platform_data *data)
402{ 407{
403} 408}
404 409
405void omapfb_reserve_sdram(void) {} 410void omapfb_reserve_sdram_memblock(void)
411{
412}
413
406unsigned long omapfb_reserve_sram(unsigned long sram_pstart, 414unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
407 unsigned long sram_vstart, 415 unsigned long sram_vstart,
408 unsigned long sram_size, 416 unsigned long sram_size,
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,
38extern void omap_vram_set_sdram_vram(u32 size, u32 start); 38extern void omap_vram_set_sdram_vram(u32 size, u32 start);
39extern void omap_vram_set_sram_vram(u32 size, u32 start); 39extern void omap_vram_set_sram_vram(u32 size, u32 start);
40 40
41extern void omap_vram_reserve_sdram(void); 41extern void omap_vram_reserve_sdram_memblock(void);
42extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, 42extern 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,
48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } 48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { }
49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } 49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { }
50 50
51static inline void omap_vram_reserve_sdram(void) { } 51static inline void omap_vram_reserve_sdram_memblock(void) { }
52static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, 52static 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,