[PATCH 1/2] mx28-evk: Add LCD support

esben.haabendal at gmail.com esben.haabendal at gmail.com
Mon Mar 26 14:02:02 EDT 2012


From: Allan Heldgaard <allan.heldgaard at prevas.dk>

Derived from TX28 board code (tx28-stk5.c).

Signed-off-by: Allan Heldgaard <allan.heldgaard at prevas.dk>
Signed-off-by: Esben Haabendal <esben.haabendal at prevas.dk>
---
 arch/arm/boards/freescale-mx28-evk/mx28-evk.c |   86 +++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
index b80b910..9168ed8 100644
--- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
+++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
@@ -31,6 +31,8 @@
 #include <asm/armlinux.h>
 #include <asm/mmu.h>
 
+#include <mach/fb.h>
+
 #include <generated/mach-types.h>
 
 #define MX28EVK_FEC_PHY_RESET_GPIO	141
@@ -73,6 +75,39 @@ static const uint32_t mx28evk_pads[] = {
 	PWM3_GPIO | VE_3_3V | GPIO_OUT | GPIO_VALUE(0),
 	/* MCI write protect 1 = not protected */
 	SSP1_SCK_GPIO | VE_3_3V | GPIO_IN,
+
+	/* lcd */
+	LCD_WR_RWN_LCD_HSYNC | VE_3_3V | STRENGTH(S8MA),
+	LCD_RD_E_LCD_VSYNC | VE_3_3V | STRENGTH(S8MA),
+	LCD_CS_LCD_ENABLE | VE_3_3V | STRENGTH(S8MA),
+	LCD_RS_LCD_DOTCLK | VE_3_3V | STRENGTH(S8MA),
+	LCD_D0 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D1 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D2 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D3 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D4 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D5 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D6 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D7 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D8 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D9 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D10 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D11 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D12 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D13 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D14 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D15 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D16 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D17 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D18 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D19 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D20 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D21 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D22 | VE_3_3V | STRENGTH(S8MA),
+	LCD_D23 | VE_3_3V | STRENGTH(S8MA),
+	LCD_RESET_GPIO | VE_3_3V | GPIO_OUT | GPIO_VALUE(0),
+	/* backlight  */
+	PWM2_GPIO | VE_3_3V | STRENGTH(S4MA) | SE | VE,
 };
 
 static struct mxs_mci_platform_data mci_pdata = {
@@ -95,6 +130,54 @@ static struct fec_platform_data fec_info = {
 	.phy_addr = 0,
 };
 
+/* LCD */
+static struct fb_videomode mx28_evk_vmodes[] = {
+	{
+		.name = "43WVF1G-0",
+		.refresh = 60,
+		.xres = 800,
+		.yres = 480,
+		.pixclock = 29851 /* (33,5 MHz) */,
+		.left_margin = 89,
+		.hsync_len = 10,
+		.right_margin = 164,
+		.upper_margin = 23,
+		.vsync_len = 10,
+		.lower_margin = 10,
+		.sync = FB_SYNC_DE_HIGH_ACT | FB_SYNC_CLK_INVERT,
+		.vmode = FB_VMODE_NONINTERLACED,
+		.flag = 0,
+	}
+};
+
+#define MAX_FB_SIZE SZ_2M
+
+#define GPIO_LCD_RESET	126 /* Reset  */
+#define GPIO_BACKLIGHT	114 /* Backlight active */
+
+static void mx28_evk_fb_enable(int enable)
+{
+	gpio_direction_output(GPIO_LCD_RESET, enable);
+
+	/* Give the display a chance to sync before we enable
+	 * the backlight to avoid flickering
+	 */
+	if (enable)
+		mdelay(200);
+
+	gpio_direction_output(GPIO_BACKLIGHT, enable);
+}
+
+static struct imx_fb_platformdata mx28_evk_fb_pdata = {
+	.mode_list = mx28_evk_vmodes,
+	.mode_cnt = ARRAY_SIZE(mx28_evk_vmodes),
+	.dotclk_delay = 0,			/* no adaption required */
+	.ld_intf_width = STMLCDIF_24BIT,	/* full 24 bit */
+	.bits_per_pixel = 32,
+	.fixed_screen = NULL,
+	.enable = mx28_evk_fb_enable,
+};
+
 static int mx28_evk_mem_init(void)
 {
 	arm_add_mem_device("ram0", IMX_MEMORY_BASE, 128 * 1024 * 1024);
@@ -122,6 +205,9 @@ static int mx28_evk_devices_init(void)
 	add_generic_device("mxs_mci", 0, NULL, IMX_SSP0_BASE, 0,
 			   IORESOURCE_MEM, &mci_pdata);
 
+	add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
+			   IORESOURCE_MEM, &mx28_evk_fb_pdata);
+
 	imx_enable_enetclk();
 	mx28_evk_fec_reset();
 	add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0,
-- 
1.7.5.4




More information about the barebox mailing list