]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: omapfb platform file changes
authorImre Deak <imre.deak@solidboot.com>
Mon, 26 Jun 2006 12:52:36 +0000 (15:52 +0300)
committerJuha Yrjola <juha.yrjola@solidboot.com>
Mon, 26 Jun 2006 12:52:36 +0000 (15:52 +0300)
- 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: Imre Deak <ext-imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
arch/arm/plat-omap/fb.c
arch/arm/plat-omap/sram.c
include/asm-arm/arch-omap/board.h
include/asm-arm/arch-omap/memory.h
include/asm-arm/arch-omap/sram.h

index 305e9b990b7106666956f82be945a71bf97bb93d..adcc172ef7102016788f34356d268b471e9d5a6f 100644 (file)
@@ -1,3 +1,26 @@
+/*
+ * 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)
index aebd06faf2cfd4c6c59c622b538e04696aa058d2..7b0b9248051e4eca3a71e66cf02478bf0b473619 100644 (file)
 
 #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;
 }
 
index 88b77eef09962c0b193eac47cc78bfe8244109af..47e762131f5589ce8aaa4065bdec8b20899559d2 100644 (file)
@@ -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:
index df50dd53e1dde37f3733887e09e231173394eac0..a350f5fe8f6facac1b4f0f566d9cec8353968cc9 100644 (file)
 
 #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
 
index 6fc0dd57b7c383ae69c6aea14679e4f6c5bc1115..cc6161d639881c5d311a0036c15b9176bfe6306e 100644 (file)
@@ -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);