[U-Boot] [PATCH 8/8] nhk8815: added lcd support

Alessandro Rubini rubini-list at gnudd.com
Fri Oct 9 13:18:02 CEST 2009


From: Alessandro Rubini <rubini at unipv.it>

Signed-off-by: Alessandro Rubini <rubini at unipv.it>
Acked-by: Andrea Gallo <andrea.gallo at stericsson.com>
---
 board/st/nhk8815/Makefile  |    1 +
 board/st/nhk8815/lcd.c     |   89 ++++++++++++++++++++++++++++++++++++++++++++
 board/st/nhk8815/nhk8815.c |    4 ++
 include/configs/nhk8815.h  |   10 +++++
 4 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 board/st/nhk8815/lcd.c

diff --git a/board/st/nhk8815/Makefile b/board/st/nhk8815/Makefile
index 1bb1d2c..7155f12 100644
--- a/board/st/nhk8815/Makefile
+++ b/board/st/nhk8815/Makefile
@@ -31,6 +31,7 @@ LIB	= $(obj)lib$(BOARD).a
 
 COBJS-y	:= nhk8815.o
 COBJS-$(CONFIG_NHK8815_KEYPAD) += keypad.o
+COBJS-$(CONFIG_LCD) += lcd.o
 
 COBJS	:= $(COBJS-y)
 SOBJS	:= platform.o
diff --git a/board/st/nhk8815/lcd.c b/board/st/nhk8815/lcd.c
new file mode 100644
index 0000000..0f59b2b
--- /dev/null
+++ b/board/st/nhk8815/lcd.c
@@ -0,0 +1,89 @@
+/*
+ * board/st/nhk8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset
+ *
+ * Copyright 2009 Alessandro Rubini <rubini at unipv.it>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+#include <lcd.h>
+#include <amba_clcd.h>
+#include <stmpe2401.h>
+
+/* Two configurations are supported: 32bpp and 16bpp */
+#if LCD_BPP == LCD_COLOR32
+#  define			CLCD_CNTL_VAL		0x0019182b
+#  define			CLCD_BPIX_VAL		5 /* 1<<5 = 32 */
+#elif LCD_BPP == LCD_COLOR16
+#  define			CLCD_CNTL_VAL		0x001d1829
+#  define			CLCD_BPIX_VAL		4 /* 1<<4 = 16 */
+#else
+#  error "Invalid LCD_BPP in config file"
+#endif
+
+/* Horribly, these are precomputed registers */
+struct clcd_regs nhk8815_clcd_regs = {
+	.tim0 =		0xd52600c4, /* horizontal timings */
+	.tim1 =		0x220a01df, /* vertical timings */
+	.tim2 =		0x031f1821, /* clock and signal polarity */
+	.tim3 =		0, /* not used */
+	.cntl =		CLCD_CNTL_VAL, /* control, pixel size etc */
+	.pixclock =	18*1000*1000, /* 18 MHz */
+};
+
+/* This is the panel_info for generic boards. Too little info, actually */
+vidinfo_t panel_info = {
+	.vl_col = 800,
+	.vl_row = 480,
+	.vl_bpix = CLCD_BPIX_VAL,
+	.priv = &nhk8815_clcd_regs,
+};
+
+/* Don't turn on (too early), but configure data lines and remove reset */
+void lcd_enable(void)
+{
+	printf("%s:%s\n", __FILE__, __func__);
+	int i;
+
+	/* Turn the alternate functions as needed */
+	for (i = 32; i <= 39; i++)
+		nmk_gpio_af(i, GPIO_ALT_B);
+
+	/* EXP1_GPIO_5 = output high -- remove reset from display */
+	pe_gpio_af(STMPE1, 5, PE_GPIO_AF_GPIO);
+	pe_gpio_dir(STMPE1, 5, 1);
+	pe_gpio_set(STMPE1, 5, 1);
+}
+
+/* Called from late_init: we turn on the backlight through port expander */
+int nhk8815_backlight_on(void)
+{
+	printf("%s:%s\n", __FILE__, __func__);
+	int i;
+
+	/* Turn the alternate functions as needed */
+	for (i = 32; i <= 39; i++)
+		nmk_gpio_af(i, GPIO_ALT_B);
+
+	/* EXP0_GPIO_21 = output high -- backlight */
+	pe_gpio_af(STMPE0, 21, PE_GPIO_AF_GPIO);
+	pe_gpio_dir(STMPE0, 21, 1);
+	pe_gpio_set(STMPE0, 21, 1);
+	return 0;
+}
diff --git a/board/st/nhk8815/nhk8815.c b/board/st/nhk8815/nhk8815.c
index efeb0d2..ded7681 100644
--- a/board/st/nhk8815/nhk8815.c
+++ b/board/st/nhk8815/nhk8815.c
@@ -107,6 +107,7 @@ int board_eth_init(bd_t *bis)
 #endif
 
 extern int nhk8815_keypad_init(void);		/* ./keypad.c */
+extern int nhk8815_backlight_on(void);		/* in ./lcd.c */
 
 /* Initialization callback, from lib_arm/board.c */
 int board_late_init(void)
@@ -114,6 +115,9 @@ int board_late_init(void)
 #ifdef CONFIG_NHK8815_KEYPAD
 	nhk8815_keypad_init();
 #endif
+#ifdef CONFIG_LCD
+	nhk8815_backlight_on();
+#endif
 	return 0;
 }
 
diff --git a/include/configs/nhk8815.h b/include/configs/nhk8815.h
index f9dbd7a..ad098d9 100644
--- a/include/configs/nhk8815.h
+++ b/include/configs/nhk8815.h
@@ -134,6 +134,16 @@
 /* Keypad using stmpe2401 */
 #define CONFIG_NHK8815_KEYPAD
 
+/* Display support */
+#define CONFIG_LCD
+#define CONFIG_LCD_LOGO
+#define CONFIG_LCD_INFO_BELOW_LOGO
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define LCD_BPP				LCD_COLOR16
+#define CONFIG_VIDEO_AMBA
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV	1
+#define CONFIG_CONSOLE_MUX
+
 /* Ethernet */
 #define PCI_MEMORY_VADDR	0xe8000000
 #define PCI_IO_VADDR		0xee000000
-- 
1.6.0.2


More information about the U-Boot mailing list