Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294328
b: refs/heads/master
c: 1e434f9
h: refs/heads/master
v: v3
  • Loading branch information
Tomi Valkeinen committed Feb 23, 2012
1 parent bd82097 commit cdcb78e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 142 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6651b0ea9202541091f6c23ec8715122ea8cc1b0
refs/heads/master: 1e434f9318efc3dddc0c0b8d2071712668154c2b
2 changes: 0 additions & 2 deletions trunk/arch/arm/plat-omap/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/init.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/omapfb.h>

#include <plat/common.h>
#include <plat/board.h>
Expand Down Expand Up @@ -65,7 +64,6 @@ const void *__init omap_get_var_config(u16 tag, size_t *len)

void __init omap_reserve(void)
{
omapfb_reserve_sdram_memblock();
omap_vram_reserve_sdram_memblock();
omap_dsp_reserve_sdram_memblock();
omap_secure_ram_reserve_memblock();
Expand Down
140 changes: 2 additions & 138 deletions trunk/arch/arm/plat-omap/fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)

static struct omapfb_platform_data omapfb_config;
static int config_invalid;
static int configured_regions;

static u64 omap_fb_dma_mask = ~(u32)0;

Expand All @@ -58,140 +56,14 @@ void omapfb_set_platform_data(struct omapfb_platform_data *data)
{
}

static inline int ranges_overlap(unsigned long start1, unsigned long size1,
unsigned long start2, unsigned long size2)
{
return (start1 >= start2 && start1 < start2 + size2) ||
(start2 >= start1 && start2 < start1 + size1);
}

static inline int range_included(unsigned long start1, unsigned long size1,
unsigned long start2, unsigned long size2)
{
return start1 >= start2 && start1 + size1 <= start2 + size2;
}

/*
* Get the region_idx`th region from board config/ATAG and convert it to
* our internal format.
*/
static int __init get_fbmem_region(int region_idx, struct omapfb_mem_region *rg)
{
const struct omap_fbmem_config *conf;
u32 paddr;

conf = omap_get_nr_config(OMAP_TAG_FBMEM,
struct omap_fbmem_config, region_idx);
if (conf == NULL)
return -ENOENT;

paddr = conf->start;
/*
* Low bits encode the page allocation mode, if high bits
* are zero. Otherwise we need a page aligned fixed
* address.
*/
memset(rg, 0, sizeof(*rg));
rg->type = paddr & ~PAGE_MASK;
rg->paddr = paddr & PAGE_MASK;
rg->size = PAGE_ALIGN(conf->size);
return 0;
}

static int valid_sdram(unsigned long addr, unsigned long size)
{
return memblock_is_region_memory(addr, size);
}

static int reserve_sdram(unsigned long addr, unsigned long size)
{
if (memblock_is_region_reserved(addr, size))
return -EBUSY;
if (memblock_reserve(addr, size))
return -ENOMEM;
return 0;
}

/*
* Called from map_io. We need to call to this early enough so that we
* can reserve the fixed SDRAM regions before VM could get hold of them.
*/
void __init omapfb_reserve_sdram_memblock(void)
{
unsigned long reserved = 0;
int i;

if (config_invalid)
return;

for (i = 0; ; i++) {
struct omapfb_mem_region rg;

if (get_fbmem_region(i, &rg) < 0)
break;

if (i == OMAPFB_PLANE_NUM) {
pr_err("Extraneous FB mem configuration entries\n");
config_invalid = 1;
return;
}

/* Check if it's our memory type. */
if (rg.type != OMAPFB_MEMTYPE_SDRAM)
continue;

/* Check if the region falls within SDRAM */
if (rg.paddr && !valid_sdram(rg.paddr, rg.size))
continue;

if (rg.size == 0) {
pr_err("Zero size for FB region %d\n", i);
config_invalid = 1;
return;
}

if (rg.paddr) {
if (reserve_sdram(rg.paddr, rg.size)) {
pr_err("Trying to use reserved memory for FB region %d\n",
i);
config_invalid = 1;
return;
}
reserved += rg.size;
}

if (omapfb_config.mem_desc.region[i].size) {
pr_err("FB region %d already set\n", i);
config_invalid = 1;
return;
}

omapfb_config.mem_desc.region[i] = rg;
configured_regions++;
}
omapfb_config.mem_desc.region_cnt = i;
if (reserved)
pr_info("Reserving %lu bytes SDRAM for frame buffer\n",
reserved);
}

static int __init omap_init_fb(void)
{
const struct omap_lcd_config *conf;

if (config_invalid)
return 0;
if (configured_regions != omapfb_config.mem_desc.region_cnt) {
printk(KERN_ERR "Invalid FB mem configuration entries\n");
return 0;
}
conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
if (conf == NULL) {
if (configured_regions)
/* FB mem config, but no LCD config? */
printk(KERN_ERR "Missing LCD configuration\n");
if (conf == NULL)
return 0;
}

omapfb_config.lcd = *conf;

return platform_device_register(&omap_fb_device);
Expand Down Expand Up @@ -227,18 +99,10 @@ static int __init omap_init_fb(void)

arch_initcall(omap_init_fb);

void omapfb_reserve_sdram_memblock(void)
{
}

#else

void omapfb_set_platform_data(struct omapfb_platform_data *data)
{
}

void omapfb_reserve_sdram_memblock(void)
{
}

#endif
1 change: 0 additions & 1 deletion trunk/include/linux/omapfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ struct omapfb_platform_data {

/* in arch/arm/plat-omap/fb.c */
extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
extern void omapfb_reserve_sdram_memblock(void);

#endif

Expand Down

0 comments on commit cdcb78e

Please sign in to comment.