Commit 4741bf3a authored by Imre Deak's avatar Imre Deak Committed by Juha Yrjola

ARM: OMAP: omapfb platform file changes

- OMAP ATAG changes:
        FBMEM - support for per plane memory configurations
        LCD   -  add data_lines, reset GPIO line params

- FB memory configuration:
        Support for per-plane memory configurations with FB location
        either in SRAM or SDRAM.

- DMA consistent memory size:
        Make the ARM DMA consistent memory size overridable. The default
        is 2MB, but for larger frame buffers we may need more. Kconfig
        option is added in the next patch.
Signed-off-by: default avatarImre Deak <ext-imre.deak@nokia.com>
Signed-off-by: default avatarJuha Yrjola <juha.yrjola@solidboot.com>
parent f1b5e5a8
/*
* File: arch/arm/plat-omap/fb.c
*
* Framebuffer device registration for TI OMAP platforms
*
* Copyright (C) 2006 Nokia Corporation
* Author: Imre Deak <imre.deak@nokia.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
......@@ -35,25 +58,42 @@ static struct platform_device omap_fb_device = {
void omapfb_reserve_mem(void)
{
const struct omap_fbmem_config *fbmem_conf;
unsigned long total_size;
int i;
if (!omap_fb_sram_valid) {
/* FBMEM SRAM configuration was already found to be invalid.
* Ignore the whole configuration block. */
omapfb_config.mem_desc.region_cnt = 0;
return;
}
i = 0;
total_size = 0;
while ((fbmem_conf = omap_get_nr_config(OMAP_TAG_FBMEM,
struct omap_fbmem_config, i)) != NULL) {
unsigned long start;
unsigned long size;
omapfb_config.fbmem.fb_sram_start = omap_fb_sram_start;
omapfb_config.fbmem.fb_sram_size = omap_fb_sram_size;
fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config);
if (fbmem_conf != NULL) {
/* indicate that the bootloader already initialized the
* fb device, so we'll skip that part in the fb driver
*/
omapfb_config.fbmem.fb_sdram_start = fbmem_conf->fb_sdram_start;
omapfb_config.fbmem.fb_sdram_size = fbmem_conf->fb_sdram_size;
if (fbmem_conf->fb_sdram_size) {
pr_info("Reserving %u bytes SDRAM for frame buffer\n",
fbmem_conf->fb_sdram_size);
reserve_bootmem(fbmem_conf->fb_sdram_start,
fbmem_conf->fb_sdram_size);
if (i == OMAPFB_PLANE_NUM) {
printk(KERN_ERR "ignoring extra plane info\n");
break;
}
start = fbmem_conf->start;
size = fbmem_conf->size;
omapfb_config.mem_desc.region[i].paddr = start;
omapfb_config.mem_desc.region[i].size = size;
if (omap_fb_sram_plane != i && start) {
reserve_bootmem(start, size);
total_size += size;
}
i++;
}
omapfb_config.mem_desc.region_cnt = i;
if (total_size)
pr_info("Reserving %lu bytes SDRAM for frame buffer\n",
total_size);
}
static inline int omap_init_fb(void)
......
......@@ -47,12 +47,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
......@@ -78,30 +79,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;
}
/*
......@@ -112,16 +126,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())
......@@ -129,7 +143,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 */
......@@ -145,12 +159,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;
}
......
......@@ -100,13 +100,13 @@ struct omap_usb_config {
struct omap_lcd_config {
char panel_name[16];
char ctrl_name[16];
s16 nreset_gpio;
u8 data_lines;
};
struct omap_fbmem_config {
u32 fb_sram_start;
u32 fb_sram_size;
u32 fb_sdram_start;
u32 fb_sdram_size;
u32 start;
u32 size;
};
/* Cover:
......
......@@ -86,5 +86,18 @@
#endif /* CONFIG_ARCH_OMAP15XX */
/* Override the ARM default */
#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0)
#undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2
#endif
#define CONSISTENT_DMA_SIZE \
(((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
#endif
#endif
......@@ -20,8 +20,8 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
u32 mem_type);
extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
extern unsigned long omap_fb_sram_start;
extern unsigned long omap_fb_sram_size;
extern int omap_fb_sram_plane;
extern int omap_fb_sram_valid;
/* Do not use these */
extern void sram_reprogram_clock(u32 ckctl, u32 dpllctl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment