diff mbox

[U-Boot,v2] mx53loco: Add support for SEIKO 4.3'' WVGA panel

Message ID 1357162453-25259-1-git-send-email-festevam@gmail.com
State Superseded
Delegated to: Stefano Babic
Headers show

Commit Message

Fabio Estevam Jan. 2, 2013, 9:34 p.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

Add support for the Seiko 4.3'' WVGA panel on mx53loco.

By default, the CLAA WVGA panel is selected.

In order to support the Seiko panel, the enviroment variable 'panel' must be
set to 'seiko'.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Allow a single binary to support both CLAA and Seiko panels

 board/freescale/mx53loco/mx53loco.c       |    2 --
 board/freescale/mx53loco/mx53loco_video.c |   53 ++++++++++++++++++++++++++---
 2 files changed, 49 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index 63a4f8b..9635e62 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -463,8 +463,6 @@  int board_init(void)
 	mxc_set_sata_internal_clock();
 	setup_iomux_i2c();
 
-	lcd_enable();
-
 	return 0;
 }
 
diff --git a/board/freescale/mx53loco/mx53loco_video.c b/board/freescale/mx53loco/mx53loco_video.c
index 69991e8..f02c0e5 100644
--- a/board/freescale/mx53loco/mx53loco_video.c
+++ b/board/freescale/mx53loco/mx53loco_video.c
@@ -46,6 +46,21 @@  static struct fb_videomode const claa_wvga = {
 	.vmode		= FB_VMODE_NONINTERLACED
 };
 
+static struct fb_videomode const seiko_wvga = {
+	.name		= "Seiko-43WVF1G",
+	.refresh	= 60,
+	.xres		= 800,
+	.yres		= 480,
+	.pixclock	= 29851, /* picosecond (33.5 MHz) */
+	.left_margin	= 89,
+	.right_margin	= 164,
+	.upper_margin	= 23,
+	.lower_margin	= 10,
+	.hsync_len	= 10,
+	.vsync_len	= 10,
+	.sync		= 0,
+};
+
 void setup_iomux_lcd(void)
 {
 	mxc_request_iomux(MX53_PIN_DI0_DISP_CLK, IOMUX_CONFIG_ALT0);
@@ -86,9 +101,39 @@  void setup_iomux_lcd(void)
 	gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_GPIO_1), 1);
 }
 
-void lcd_enable(void)
+int board_video_skip(void)
 {
-	int ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
-	if (ret)
-		printf("LCD cannot be configured: %d\n", ret);
+	int ret;
+	char const *e = getenv("panel");
+
+	if (!e) {
+		/* 'panel' env variable not found. Default to 'claa' lcd */
+		ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
+		if (ret)
+			printf("LCD cannot be configured: %d\n", ret);
+		return ret;
+
+	} else { /* 'panel' env variable is found */
+		if (strcmp(e, "claa") == 0) {
+			ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
+			if (ret)
+				printf("LCD cannot be configured: %d\n", ret);
+			return ret;
+		}
+
+		if (strcmp(e, "seiko") == 0) {
+			ret = ipuv3_fb_init(&seiko_wvga, 0, IPU_PIX_FMT_RGB24);
+			if (ret)
+				printf("LCD cannot be configured: %d\n", ret);
+			return ret;
+		}
+		/*
+		 * If 'panel' variable has a value different then
+		 * 'claa' or 'seiko' then setup as 'claa' lcd by default
+		 */
+		ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
+		if (ret)
+			printf("LCD cannot be configured: %d\n", ret);
+		return ret;
+	}
 }