]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
VIDEO: MX5: Switch MX5 to CONFIG_VIDEO
authorStefano Babic <sbabic@denx.de>
Wed, 28 Sep 2011 09:21:15 +0000 (11:21 +0200)
committerAnatolij Gustschin <agust@denx.de>
Thu, 13 Oct 2011 10:26:30 +0000 (12:26 +0200)
The framebuffer driver for MX5 is based on CONFIG_LCD.
In the current implementation, there is a serious bug
because the required memory is allocated before
relocation, but the driver knows only later which is
the resolution of the display. The patch switches the driver
to CONFIG_VIDEO and the memory is allocated by the driver itself.

We also need to switch the vision2 board code and config file
in the same commit so that this commit will be bisectable.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Anatolij Gustschin <agust@denx.de>
Tested-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
board/ttcontrol/vision2/vision2.c
drivers/video/mxc_ipuv3_fb.c
include/configs/vision2.h

index ebca7b6f368cfc07289c6ca26b0112b2f958037c..ca0c100d1136da66ae37001aedfdce7e32d2624a 100644 (file)
@@ -600,6 +600,21 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+void lcd_enable(void)
+{
+       int ret;
+
+       mxc_request_iomux(MX51_PIN_DI1_PIN2, IOMUX_CONFIG_ALT0);
+       mxc_request_iomux(MX51_PIN_DI1_PIN3, IOMUX_CONFIG_ALT0);
+
+       gpio_set_value(2, 1);
+       mxc_request_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT0);
+
+       ret = mx51_fb_init(&nec_nl6448bc26_09c);
+       if (ret)
+               puts("LCD cannot be configured\n");
+}
+
 int board_early_init_f(void)
 {
 
@@ -636,26 +651,15 @@ static void backlight(int on)
        }
 }
 
-void lcd_enable(void)
-{
-       int ret;
-
-       mxc_request_iomux(MX51_PIN_DI1_PIN2, IOMUX_CONFIG_ALT0);
-       mxc_request_iomux(MX51_PIN_DI1_PIN3, IOMUX_CONFIG_ALT0);
-
-       gpio_set_value(2, 1);
-       mxc_request_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT0);
-
-       ret = mx51_fb_init(&nec_nl6448bc26_09c);
-       if (ret)
-               puts("LCD cannot be configured\n");
-}
-
 int board_init(void)
 {
        /* address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
+       lcd_enable();
+
+       backlight(1);
+
        return 0;
 }
 
@@ -676,6 +680,8 @@ int board_late_init(void)
        udelay(2000);
 #endif
 
+       setenv("stdout", "serial");
+
        return 0;
 }
 
index a66981c27c9f86bedaf3d719aedc4ad8352f120d..eafacef5306c1cda37f30c9542f6e1d5b7b86c84 100644 (file)
@@ -27,7 +27,6 @@
  * MA 02111-1307 USA
  */
 
-/* #define DEBUG */
 #include <common.h>
 #include <asm/errno.h>
 #include <linux/string.h>
 #include <linux/fb.h>
 #include <asm/io.h>
 #include <malloc.h>
-#include <lcd.h>
+#include <video_fb.h>
 #include "videomodes.h"
 #include "ipu.h"
 #include "mxcfb.h"
 
-DECLARE_GLOBAL_DATA_PTR;
-
-void *lcd_base;                        /* Start of framebuffer memory  */
-void *lcd_console_address;     /* Start of console buffer      */
-
-int lcd_line_length;
-int lcd_color_fg;
-int lcd_color_bg;
-
-short console_col;
-short console_row;
-
-vidinfo_t panel_info;
-
 static int mxcfb_map_video_memory(struct fb_info *fbi);
 static int mxcfb_unmap_video_memory(struct fb_info *fbi);
 
-void lcd_initcolregs(void)
-{
-}
-
-void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
-{
-}
-
-void lcd_disable(void)
-{
-}
-
-void lcd_panel_disable(void)
-{
-}
+/* graphics setup */
+static GraphicDevice panel;
+struct fb_videomode *gmode;
 
 void fb_videomode_to_var(struct fb_var_screeninfo *var,
                         const struct fb_videomode *mode)
@@ -440,8 +413,8 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
                                    fbi->fix.line_length;
        }
 
-       fbi->screen_base = (char *)lcd_base;
-       fbi->fix.smem_start = (unsigned long)lcd_base;
+       fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
+       fbi->fix.smem_start = (unsigned long)fbi->screen_base;
        if (fbi->screen_base == 0) {
                puts("Unable to allocate framebuffer memory\n");
                fbi->fix.smem_len = 0;
@@ -561,12 +534,12 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode)
        mxcfb_info[mxcfbi->ipu_di] = fbi;
 
        /* Need dummy values until real panel is configured */
-       fbi->var.xres = 640;
-       fbi->var.yres = 480;
-       fbi->var.bits_per_pixel = 16;
 
        mxcfbi->ipu_di_pix_fmt = interface_pix_fmt;
        fb_videomode_to_var(&fbi->var, mode);
+       fbi->var.bits_per_pixel = 16;
+       fbi->fix.line_length = fbi->var.xres * (fbi->var.bits_per_pixel / 8);
+       fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length;
 
        mxcfb_check_var(&fbi->var, fbi);
 
@@ -581,19 +554,16 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode)
 
        mxcfb_set_par(fbi);
 
-       /* Setting panel_info for lcd */
-       panel_info.cmap = NULL;
-       panel_info.vl_col = fbi->var.xres;
-       panel_info.vl_row = fbi->var.yres;
-       panel_info.vl_bpix = LCD_BPP;
+       panel.winSizeX = mode->xres;
+       panel.winSizeY = mode->yres;
+       panel.plnSizeX = mode->xres;
+       panel.plnSizeY = mode->yres;
 
-       lcd_line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
+       panel.frameAdrs = (u32)fbi->screen_base;
+       panel.memSize = fbi->screen_size;
 
-       debug("MXC IPUV3 configured\n"
-               "XRES = %d YRES = %d BitsXpixel = %d\n",
-               panel_info.vl_col,
-               panel_info.vl_row,
-               panel_info.vl_bpix);
+       panel.gdfBytesPP = 2;
+       panel.gdfIndex = GDF_16BIT_565RGB;
 
        ipu_dump_registers();
 
@@ -603,29 +573,7 @@ err0:
        return ret;
 }
 
-int overwrite_console(void)
-{
-       /* Keep stdout / stderr on serial, our LCD is for splashscreen only */
-       return 1;
-}
-
-void lcd_ctrl_init(void *lcdbase)
-{
-       u32 mem_len = panel_info.vl_col *
-               panel_info.vl_row *
-               NBITS(panel_info.vl_bpix) / 8;
-
-       /*
-        * We rely on lcdbase being a physical address, i.e., either MMU off,
-        * or 1-to-1 mapping. Might want to add some virt2phys here.
-        */
-       if (!lcdbase)
-               return;
-
-       memset(lcdbase, 0, mem_len);
-}
-
-int mx51_fb_init(struct fb_videomode *mode)
+void *video_hw_init(void)
 {
        int ret;
 
@@ -633,10 +581,24 @@ int mx51_fb_init(struct fb_videomode *mode)
        if (ret)
                puts("Error initializing IPU\n");
 
-       lcd_base += 56;
+       ret = mxcfb_probe(IPU_PIX_FMT_RGB666, gmode);
+       debug("Framebuffer at 0x%x\n", (unsigned int)panel.frameAdrs);
 
-       debug("Framebuffer at 0x%x\n", (unsigned int)lcd_base);
-       ret = mxcfb_probe(IPU_PIX_FMT_RGB666, mode);
+       return (void *)&panel;
+}
 
-       return ret;
+void video_set_lut(unsigned int index, /* color number */
+                       unsigned char r,    /* red */
+                       unsigned char g,    /* green */
+                       unsigned char b     /* blue */
+                       )
+{
+       return;
+}
+
+int mx51_fb_init(struct fb_videomode *mode)
+{
+       gmode = mode;
+
+       return 0;
 }
index 540dfa9f6b7b38d5ce3e5d0ef96e15cbc2d4a5da..3b42afc923445efc77a5096f0c904dc84cf82cf5 100644 (file)
@@ -46,7 +46,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN          (2048 * 1024)
+#define CONFIG_SYS_MALLOC_LEN          (10 * 1024 * 1024)
 
 /*
  * Hardware drivers
  * Framebuffer and LCD
  */
 #define CONFIG_PREBOOT
-#define CONFIG_LCD
+#define CONFIG_VIDEO
 #define CONFIG_VIDEO_MX5
-#define CONFIG_SYS_CONSOLE_ENV_OVERWRITE
-#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
-#define CONFIG_SYS_CONSOLE_IS_IN_ENV
-#define LCD_BPP                LCD_COLOR16
+#define CONFIG_CFB_CONSOLE
+#define CONFIG_VGA_AS_SINGLE_DEVICE
+#define CONFIG_VIDEO_BMP_RLE8
 #define CONFIG_SPLASH_SCREEN
 #define CONFIG_CMD_BMP
 #define CONFIG_BMP_16BPP