Patchwork [U-Boot] LCD Support on mx51 vision2

login
register
mail settings
Submitter Fabio Estevam
Date May 8, 2012, 9:24 p.m.
Message ID <CAOMZO5BwNLbbwU42tpN9ELS+yqzB+GF-G+NiBLdABQ=EutgcMg@mail.gmail.com>
Download mbox | patch
Permalink /patch/157822/
State Changes Requested
Headers show

Comments

Fabio Estevam - May 8, 2012, 9:24 p.m.
Anatolij,

On Tue, May 8, 2012 at 4:35 PM, Fabio Estevam <festevam@gmail.com> wrote:

> Thanks for your suggestion. Increasing  CONFIG_SYS_MALLOC_LEN does not
> fix the issue.

Below is my patch and some more debug information.

As you can see mode->xres is getting a weird value instead of '800'
that I pass in the fb_videomode struct.
Anatolij Gustschin - May 8, 2012, 10:40 p.m.
Hi Fabio,

On Tue, 8 May 2012 18:24:38 -0300
Fabio Estevam <festevam@gmail.com> wrote:

> Anatolij,
> 
> On Tue, May 8, 2012 at 4:35 PM, Fabio Estevam <festevam@gmail.com> wrote:
> 
> > Thanks for your suggestion. Increasing  CONFIG_SYS_MALLOC_LEN does not
> > fix the issue.
> 
> Below is my patch and some more debug information.
> 
> As you can see mode->xres is getting a weird value instead of '800'
> that I pass in the fb_videomode struct.

Thanks for the info. I think you additionally need to call lcd_enable()
in your board_init(). The mode struct will be initialized then. From
your patch I do not see that you call lcd_enable().

Thanks,
Anatolij
Fabio Estevam - May 8, 2012, 10:59 p.m.
Hi Anatolij,

On Tue, May 8, 2012 at 7:40 PM, Anatolij Gustschin <agust@denx.de> wrote:

> Thanks for the info. I think you additionally need to call lcd_enable()
> in your board_init(). The mode struct will be initialized then. From
> your patch I do not see that you call lcd_enable().

You are clearly right! Now I see the console output on my LCD :-)

Will submit the patch soon.

Now I will try to load some splashscreen.

Thanks a lot for your help,

Fabio Estevam
Fabio Estevam - May 9, 2012, 3:59 p.m.
Hi Anatolij,

On Tue, May 8, 2012 at 7:59 PM, Fabio Estevam <festevam@gmail.com> wrote:

> You are clearly right! Now I see the console output on my LCD :-)
>
> Will submit the patch soon.

I am using the following LCD configuration on my board file (same as vision2.h):

#define CONFIG_PREBOOT
#define CONFIG_VIDEO
#define CONFIG_VIDEO_MX5
#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
#define CONFIG_VIDEO_LOGO

,and this directs the console to the LCD as expected.

I would like to keep only the video logo on screen and keep the
console into the serial port.

Is this possible?

If I remove "#define CONFIG_CFB_CONSOLE" the build fails (This can be
reproduced with vision2 config).

If I keep "#define CONFIG_CFB_CONSOLE" and pass "set console serial"
the console output still goes to the LCD.

Any suggestions?

Thanks,

Fabio Estevam
Stefano Babic - May 9, 2012, 4:19 p.m.
On 09/05/2012 17:59, Fabio Estevam wrote:
> Hi Anatolij,
> 
> On Tue, May 8, 2012 at 7:59 PM, Fabio Estevam <festevam@gmail.com> wrote:
> 
>> You are clearly right! Now I see the console output on my LCD :-)
>>
>> Will submit the patch soon.
> 
> I am using the following LCD configuration on my board file (same as vision2.h):
> 
> #define CONFIG_PREBOOT
> #define CONFIG_VIDEO
> #define CONFIG_VIDEO_MX5
> #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
> #define CONFIG_VIDEO_LOGO
> 
> ,and this directs the console to the LCD as expected.
> 
> I would like to keep only the video logo on screen and keep the
> console into the serial port.

On vision, the display was used for splashscreen and the console is set
to the serial line.

> 
> Is this possible?
> 
> If I remove "#define CONFIG_CFB_CONSOLE" the build fails (This can be
> reproduced with vision2 config).
> 
> If I keep "#define CONFIG_CFB_CONSOLE" and pass "set console serial"
> the console output still goes to the LCD.
> 
> Any suggestions?

You have to set stdin / stdout - maybe in late_init() ?

Stefano
Fabio Estevam - May 9, 2012, 4:23 p.m.
Hi Stefano,

On Wed, May 9, 2012 at 1:19 PM, Stefano Babic <sbabic@denx.de> wrote:
>
> You have to set stdin / stdout - maybe in late_init() ?

That did the trick! Thanks a lot

Patch

diff --git a/board/freescale/mx51evk/mx51evk.c
b/board/freescale/mx51evk/mx51evk.c
index b505a71..a6cf64a 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -36,6 +36,8 @@ 
 #include <fsl_pmic.h>
 #include <mc13892.h>
 #include <usb/ehci-fsl.h>
+#include <linux/fb.h>
+#include <ipu_pixfmt.h>

 DECLARE_GLOBAL_DATA_PTR;

@@ -453,6 +455,27 @@  int board_mmc_init(bd_t *bis)
 }
 #endif

+static struct fb_videomode claa_wvga = {
+	.name		= "CLAA07LC0ACW",
+	.refresh	= 57,
+	.xres		= 800,
+	.yres		= 480,
+	.pixclock	= 37037,
+	.left_margin	= 40,
+	.right_margin	= 60,
+	.upper_margin	= 10,
+	.lower_margin	= 10,
+	.hsync_len	= 20,
+	.vsync_len	= 10,
+	.sync		= 0,
+	.vmode		= FB_VMODE_NONINTERLACED
+};
+
+void lcd_enable(void)
+{
+	mx51_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
+}
+
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
diff --git a/drivers/video/mxc_ipuv3_fb.c b/drivers/video/mxc_ipuv3_fb.c
index 1bee54c..c640838 100644
--- a/drivers/video/mxc_ipuv3_fb.c
+++ b/drivers/video/mxc_ipuv3_fb.c
@@ -26,6 +26,7 @@ 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
+#define DEBUG

 #include <common.h>
 #include <asm/errno.h>
@@ -66,6 +67,8 @@  void fb_videomode_to_var(struct fb_var_screeninfo *var,
 	var->vsync_len = mode->vsync_len;
 	var->sync = mode->sync;
 	var->vmode = mode->vmode & FB_VMODE_MASK;
+
+	printf("%s mode->xres: %d\n", __func__, mode->xres);
 }

 /*
@@ -542,8 +545,15 @@  static int mxcfb_probe(u32 interface_pix_fmt, uint8_t disp,
 	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);
+
+	printf("fbi->var.xres: %d\n", fbi->var.xres);
+	printf("fbi->var.bits_per_pixel /8 : %d\n", fbi->var.bits_per_pixel / 8);
+	printf("fbi->fix.line_length: %d\n", fbi->fix.line_length);
+
 	fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length;

+	printf("fbi->fix.smem_len: %d\n", fbi->fix.smem_len);
+
 	mxcfb_check_var(&fbi->var, fbi);

 	/* Default Y virtual size is 2x panel size */
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index 1477b21..e4240ba 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -51,7 +51,7 @@ 
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 10 * 1024 * 1024)

 #define CONFIG_BOARD_LATE_INIT

@@ -123,6 +123,17 @@ 
 #define CONFIG_MXC_USB_PORTSC	PORT_PTS_ULPI
 #define CONFIG_MXC_USB_FLAGS	MXC_EHCI_POWER_PINS_ENABLED

+/* Framebuffer and LCD */
+#define CONFIG_PREBOOT
+#define CONFIG_VIDEO
+#define CONFIG_VIDEO_MX5
+#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
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX		1