aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/plat-omap/sram.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2006-12-07 13:58:10 -0800
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-05-08 20:36:31 +0100
commitc40fae9525e6c29c87a4f4361ff0a8d67a36e448 (patch)
tree00c3e0008b3e963c5a622245b951f1135e456c24 /arch/arm/plat-omap/sram.c
parentf4e4c324a5f81f18156499d1ade3732ba1f5b523 (diff)
ARM: OMAP: Sync core code with linux-omap
This patch syncs omap specific core code with linux-omap. Most of the changes are needed to fix bitrot caused by driver updates in linux-omap tree. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-omap/sram.c')
-rw-r--r--arch/arm/plat-omap/sram.c77
1 files changed, 46 insertions, 31 deletions
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 19014b2ff4c..7e5f8877e05 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -46,12 +46,13 @@
#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
+static unsigned long omap_sram_start;
static unsigned long omap_sram_base;
static unsigned long omap_sram_size;
static unsigned long omap_sram_ceil;
-unsigned long omap_fb_sram_start;
-unsigned long omap_fb_sram_size;
+int omap_fb_sram_plane = -1;
+int omap_fb_sram_valid;
/* Depending on the target RAMFS firewall setup, the public usable amount of
* SRAM varies. The default accessable size for all device types is 2k. A GP
@@ -77,30 +78,43 @@ static int is_sram_locked(void)
return 1; /* assume locked with no PPA or security driver */
}
-void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
- unsigned long *start, unsigned long *size)
+static int get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
+ unsigned long *start, int *plane_idx)
{
const struct omap_fbmem_config *fbmem_conf;
-
- fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config);
- if (fbmem_conf != NULL) {
- *start = fbmem_conf->fb_sram_start;
- *size = fbmem_conf->fb_sram_size;
- } else {
- *size = 0;
- *start = 0;
+ unsigned long size = 0;
+ int i;
+
+ i = 0;
+ *start = 0;
+ *plane_idx = -1;
+ while ((fbmem_conf = omap_get_nr_config(OMAP_TAG_FBMEM,
+ struct omap_fbmem_config, i)) != NULL) {
+ u32 paddr, end;
+
+ paddr = fbmem_conf->start;
+ end = fbmem_conf->start + fbmem_conf->size;
+ if (paddr > omap_sram_start &&
+ paddr < omap_sram_start + omap_sram_size) {
+ if (*plane_idx != -1 || paddr < start_avail ||
+ paddr == end ||
+ end > start_avail + size_avail) {
+ printk(KERN_ERR "invalid FB SRAM configuration");
+ *start = 0;
+ return -1;
+ }
+ *plane_idx = i;
+ *start = fbmem_conf->start;
+ size = fbmem_conf->size;
+ }
+ i++;
}
- if (*size && (
- *start < start_avail ||
- *start + *size > start_avail + size_avail)) {
- printk(KERN_ERR "invalid FB SRAM configuration\n");
- *start = start_avail;
- *size = size_avail;
- }
+ if (*plane_idx >= 0)
+ pr_info("Reserving %lu bytes SRAM frame buffer "
+ "for plane %d\n", size, *plane_idx);
- if (*size)
- pr_info("Reserving %lu bytes SRAM for frame buffer\n", *size);
+ return 0;
}
/*
@@ -111,16 +125,16 @@ void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
*/
void __init omap_detect_sram(void)
{
- unsigned long sram_start;
+ unsigned long fb_sram_start;
if (cpu_is_omap24xx()) {
if (is_sram_locked()) {
omap_sram_base = OMAP2_SRAM_PUB_VA;
- sram_start = OMAP2_SRAM_PUB_PA;
+ omap_sram_start = OMAP2_SRAM_PUB_PA;
omap_sram_size = 0x800; /* 2K */
} else {
omap_sram_base = OMAP2_SRAM_VA;
- sram_start = OMAP2_SRAM_PA;
+ omap_sram_start = OMAP2_SRAM_PA;
if (cpu_is_omap242x())
omap_sram_size = 0xa0000; /* 640K */
else if (cpu_is_omap243x())
@@ -128,7 +142,7 @@ void __init omap_detect_sram(void)
}
} else {
omap_sram_base = OMAP1_SRAM_VA;
- sram_start = OMAP1_SRAM_PA;
+ omap_sram_start = OMAP1_SRAM_PA;
if (cpu_is_omap730())
omap_sram_size = 0x32000; /* 200K */
@@ -144,12 +158,13 @@ void __init omap_detect_sram(void)
omap_sram_size = 0x4000;
}
}
- get_fb_sram_conf(sram_start + SRAM_BOOTLOADER_SZ,
- omap_sram_size - SRAM_BOOTLOADER_SZ,
- &omap_fb_sram_start, &omap_fb_sram_size);
- if (omap_fb_sram_size)
- omap_sram_size -= sram_start + omap_sram_size -
- omap_fb_sram_start;
+ if (get_fb_sram_conf(omap_sram_start + SRAM_BOOTLOADER_SZ,
+ omap_sram_size - SRAM_BOOTLOADER_SZ,
+ &fb_sram_start, &omap_fb_sram_plane) == 0)
+ omap_fb_sram_valid = 1;
+ if (omap_fb_sram_valid && omap_fb_sram_plane >= 0)
+ omap_sram_size -= omap_sram_start + omap_sram_size -
+ fb_sram_start;
omap_sram_ceil = omap_sram_base + omap_sram_size;
}