Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294323
b: refs/heads/master
c: 2a803c8
h: refs/heads/master
i:
  294321: 87e34a2
  294319: a0ff11a
v: v3
  • Loading branch information
Tomi Valkeinen committed Feb 23, 2012
1 parent a41a697 commit 4f0194b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 119 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: 8dc50ec7755650859a7bfc17de8846ef1efa24a4
refs/heads/master: 2a803c887b654bad7d6699f1270eaac31361afc9
21 changes: 1 addition & 20 deletions trunk/arch/arm/plat-omap/include/plat/vram.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,21 @@

#include <linux/types.h>

#define OMAP_VRAM_MEMTYPE_SDRAM 0
#define OMAP_VRAM_MEMTYPE_SRAM 1
#define OMAP_VRAM_MEMTYPE_MAX 1

extern int omap_vram_add_region(unsigned long paddr, size_t size);
extern int omap_vram_free(unsigned long paddr, size_t size);
extern int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr);
extern int omap_vram_alloc(size_t size, unsigned long *paddr);
extern int omap_vram_reserve(unsigned long paddr, size_t size);
extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram,
unsigned long *largest_free_block);

#ifdef CONFIG_OMAP2_VRAM
extern void omap_vram_set_sdram_vram(u32 size, u32 start);
extern void omap_vram_set_sram_vram(u32 size, u32 start);

extern void omap_vram_reserve_sdram_memblock(void);
extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail);
#else
static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { }
static inline void omap_vram_set_sram_vram(u32 size, u32 start) { }

static inline void omap_vram_reserve_sdram_memblock(void) { }
static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail)
{
return 0;
}
#endif

#endif
1 change: 0 additions & 1 deletion trunk/drivers/video/omap2/dss/dispc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>

#include <plat/sram.h>
#include <plat/clock.h>

#include <video/omapdss.h>
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/video/omap2/omapfb/omapfb-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
int r = 0, i;
size_t size;

if (mi->type > OMAPFB_MEMTYPE_MAX)
if (mi->type != OMAPFB_MEMTYPE_SDRAM)
return -EINVAL;

size = PAGE_ALIGN(mi->size);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/video/omap2/omapfb/omapfb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size,

if (!paddr) {
DBG("allocating %lu bytes for fb %d\n", size, ofbi->id);
r = omap_vram_alloc(OMAP_VRAM_MEMTYPE_SDRAM, size, &paddr);
r = omap_vram_alloc(size, &paddr);
} else {
DBG("reserving %lu bytes at %lx for fb %d\n", size, paddr,
ofbi->id);
Expand Down Expand Up @@ -1669,7 +1669,7 @@ int omapfb_realloc_fbmem(struct fb_info *fbi, unsigned long size, int type)
int old_type = rg->type;
int r;

if (type > OMAPFB_MEMTYPE_MAX)
if (type != OMAPFB_MEMTYPE_SDRAM)
return -EINVAL;

size = PAGE_ALIGN(size);
Expand Down
99 changes: 5 additions & 94 deletions trunk/drivers/video/omap2/vram.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include <asm/setup.h>

#include <plat/sram.h>
#include <plat/vram.h>
#include <plat/dma.h>

Expand All @@ -43,10 +42,6 @@
#define DBG(format, ...)
#endif

#define OMAP2_SRAM_START 0x40200000
/* Maximum size, in reality this is smaller if SRAM is partially locked. */
#define OMAP2_SRAM_SIZE 0xa0000 /* 640k */

/* postponed regions are used to temporarily store region information at boot
* time when we cannot yet allocate the region list */
#define MAX_POSTPONED_REGIONS 10
Expand Down Expand Up @@ -74,15 +69,6 @@ struct vram_region {
static DEFINE_MUTEX(region_mutex);
static LIST_HEAD(region_list);

static inline int region_mem_type(unsigned long paddr)
{
if (paddr >= OMAP2_SRAM_START &&
paddr < OMAP2_SRAM_START + OMAP2_SRAM_SIZE)
return OMAP_VRAM_MEMTYPE_SRAM;
else
return OMAP_VRAM_MEMTYPE_SDRAM;
}

static struct vram_region *omap_vram_create_region(unsigned long paddr,
unsigned pages)
{
Expand Down Expand Up @@ -212,9 +198,6 @@ static int _omap_vram_reserve(unsigned long paddr, unsigned pages)

DBG("checking region %lx %d\n", rm->paddr, rm->pages);

if (region_mem_type(rm->paddr) != region_mem_type(paddr))
continue;

start = rm->paddr;
end = start + (rm->pages << PAGE_SHIFT) - 1;
if (start > paddr || end < paddr + size - 1)
Expand Down Expand Up @@ -320,7 +303,7 @@ static int _omap_vram_clear(u32 paddr, unsigned pages)
return r;
}

static int _omap_vram_alloc(int mtype, unsigned pages, unsigned long *paddr)
static int _omap_vram_alloc(unsigned pages, unsigned long *paddr)
{
struct vram_region *rm;
struct vram_alloc *alloc;
Expand All @@ -330,9 +313,6 @@ static int _omap_vram_alloc(int mtype, unsigned pages, unsigned long *paddr)

DBG("checking region %lx %d\n", rm->paddr, rm->pages);

if (region_mem_type(rm->paddr) != mtype)
continue;

start = rm->paddr;

list_for_each_entry(alloc, &rm->alloc_list, list) {
Expand Down Expand Up @@ -365,21 +345,21 @@ static int _omap_vram_alloc(int mtype, unsigned pages, unsigned long *paddr)
return -ENOMEM;
}

int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr)
int omap_vram_alloc(size_t size, unsigned long *paddr)
{
unsigned pages;
int r;

BUG_ON(mtype > OMAP_VRAM_MEMTYPE_MAX || !size);
BUG_ON(!size);

DBG("alloc mem type %d size %d\n", mtype, size);
DBG("alloc mem size %d\n", size);

size = PAGE_ALIGN(size);
pages = size >> PAGE_SHIFT;

mutex_lock(&region_mutex);

r = _omap_vram_alloc(mtype, pages, paddr);
r = _omap_vram_alloc(pages, paddr);

mutex_unlock(&region_mutex);

Expand Down Expand Up @@ -500,10 +480,6 @@ arch_initcall(omap_vram_init);

/* boottime vram alloc stuff */

/* set from board file */
static u32 omap_vram_sram_start __initdata;
static u32 omap_vram_sram_size __initdata;

/* set from board file */
static u32 omap_vram_sdram_start __initdata;
static u32 omap_vram_sdram_size __initdata;
Expand Down Expand Up @@ -587,73 +563,8 @@ void __init omap_vram_reserve_sdram_memblock(void)
pr_info("Reserving %u bytes SDRAM for VRAM\n", size);
}

/*
* Called at sram init time, before anything is pushed to the SRAM stack.
* Because of the stack scheme, we will allocate everything from the
* start of the lowest address region to the end of SRAM. This will also
* include padding for page alignment and possible holes between regions.
*
* As opposed to the SDRAM case, we'll also do any dynamic allocations at
* this point, since the driver built as a module would have problem with
* freeing / reallocating the regions.
*/
unsigned long __init omap_vram_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail)
{
unsigned long pend_avail;
unsigned long reserved;
u32 paddr;
u32 size;

paddr = omap_vram_sram_start;
size = omap_vram_sram_size;

if (!size)
return 0;

reserved = 0;
pend_avail = pstart_avail + size_avail;

if (!paddr) {
/* Dynamic allocation */
if ((size_avail & PAGE_MASK) < size) {
pr_err("Not enough SRAM for VRAM\n");
return 0;
}
size_avail = (size_avail - size) & PAGE_MASK;
paddr = pstart_avail + size_avail;
}

if (paddr < sram_pstart ||
paddr + size > sram_pstart + sram_size) {
pr_err("Illegal SRAM region for VRAM\n");
return 0;
}

/* Reserve everything above the start of the region. */
if (pend_avail - paddr > reserved)
reserved = pend_avail - paddr;
size_avail = pend_avail - reserved - pstart_avail;

omap_vram_add_region(paddr, size);

if (reserved)
pr_info("Reserving %lu bytes SRAM for VRAM\n", reserved);

return reserved;
}

void __init omap_vram_set_sdram_vram(u32 size, u32 start)
{
omap_vram_sdram_start = start;
omap_vram_sdram_size = size;
}

void __init omap_vram_set_sram_vram(u32 size, u32 start)
{
omap_vram_sram_start = start;
omap_vram_sram_size = size;
}

0 comments on commit 4f0194b

Please sign in to comment.