Skip to contentSkip to conversation

Nomadik: lcd and other stuff

PATCH New Alessandro Rubini 1 participant 8 messages Apr 15, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Nomadik: lcd and other stuff

From: Alessandro Rubini <[email protected]>

This patch set is the one from December, with one addition in documentation (last patch in the series). It is rebased to current master, although there was no dependency on the massive renames besides the "fix timer" patch which meanwhile got upstream.

Alessandro Rubini (7):
nhk8815: change the order of initialization drivers/misc: add stmpe2401 port extender and keypad controller nhk8815.h: define we need stmpe
nhk8815: added keypad
nhk8815: start lower in RAM, so the 800x480 frame buffer fits
nhk8815: added lcd support
nhk8815: documented how to replace u-boot on flash

 board/st/nhk8815/Makefile          |    6 +-
 board/st/nhk8815/config.mk         |    8 +-
 board/st/nhk8815/keypad.c          |   99 +++++++++++++++++++
 board/st/nhk8815/lcd.c             |   88 +++++++++++++++++
 board/st/nhk8815/nhk8815-devices.h |    8 ++
 board/st/nhk8815/nhk8815.c         |   38 +++++--
 doc/README.nhk8815                 |   20 ++++
 drivers/misc/Makefile              |    1 +
 drivers/misc/stmpe2401.c           |  191 ++++++++++++++++++++++++++++++++++++
 include/configs/nhk8815.h          |   20 ++++-
 include/stmpe2401.h                |   66 ++++++++++++
 11 files changed, 528 insertions(+), 17 deletions(-)
 create mode 100644 board/st/nhk8815/keypad.c
 create mode 100644 board/st/nhk8815/lcd.c
 create mode 100644 board/st/nhk8815/nhk8815-devices.h
 create mode 100644 drivers/misc/stmpe2401.c
 create mode 100644 include/stmpe2401.h
#1 lore raw

PATCH 1/7 nhk8815: change the order of initialization

From: Alessandro Rubini <[email protected]>

Some inizialization was in board_late_init(), but to satisfy drivers added in the next patches must be performed in normal board_init. This patch leaves board_late_init() empty, but later patches fill it.

---

 board/st/nhk8815/nhk8815.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)
board/st/nhk8815/nhk8815.c +21 -10
index faef810..eadce40 100644
@@ -60,22 +60,26 @@ int board_init(void)
 	writel(0x02100551, NOMADIK_FSMC_BASE + 0x04); /* FSMC_BTR0 */
 
 	icache_enable();
-	return 0;
-}
 
-int board_late_init(void)
-{
+	/*
+	 * Configure I2C pins, as we will use I2C in a later commit
+	 */
+
 	/* Set the two I2C gpio lines to be gpio high */
 	nmk_gpio_set(__SCL, 1);	nmk_gpio_set(__SDA, 1);
 	nmk_gpio_dir(__SCL, 1);	nmk_gpio_dir(__SDA, 1);
 	nmk_gpio_af(__SCL, GPIO_GPIO); nmk_gpio_af(__SDA, GPIO_GPIO);
 
-	/* Reset the I2C port expander, on GPIO77 */
-	nmk_gpio_af(77, GPIO_GPIO);
-	nmk_gpio_dir(77, 1);
-	nmk_gpio_set(77, 0);
-	udelay(10);
-	nmk_gpio_set(77, 1);
+	/* Put the two I2C port expanders out of reset, on GPIO77 and 79 */
+	{
+		int n[2]={77, 79};
+		int i;
+		for (i = 0; i < ARRAY_SIZE(n); i++) {
+			nmk_gpio_af(n[i], GPIO_GPIO);
+			nmk_gpio_dir(n[i], 1);
+			nmk_gpio_set(n[i], 1);
+		}
+	}
 
 	return 0;
 }
@@ -101,3 +105,10 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 #endif
+
+/* Initialization callback, from lib_arm/board.c */
+int board_late_init(void)
+{
+	return 0;
+}
+
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 2/7 drivers/misc: add stmpe2401 port extender and keypad controller

In reply to Alessandro Rubini

From: Alessandro Rubini <[email protected]>

This driver is an i2c device acting as a port extender. Since the keypad can be configured to act on specific row and column lines, the specific setup is passed by the board file. This is used by the Nomadik nhk8815, through a later patch in this series.

---
 drivers/misc/Makefile    |    1 +
 drivers/misc/stmpe2401.c |  191 ++++++++++++++++++++++++++++++++++++++++++++++
 include/stmpe2401.h      |   66 ++++++++++++++++
 3 files changed, 258 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/stmpe2401.c
 create mode 100644 include/stmpe2401.h
drivers/misc/Makefile +1 -0
index f6df60f..76c009a 100644
@@ -30,6 +30,7 @@ COBJS-$(CONFIG_DS4510)  += ds4510.o
 COBJS-$(CONFIG_FSL_LAW) += fsl_law.o
 COBJS-$(CONFIG_NS87308) += ns87308.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
+COBJS-$(CONFIG_STMPE2401) += stmpe2401.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
 
 COBJS	:= $(COBJS-y)
drivers/misc/stmpe2401.c new file +191 -0

191 lines not on this page · raw message

include/stmpe2401.h new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#3 lore raw

PATCH 3/7 nhk8815.h: define we need stmpe

In reply to Alessandro Rubini

From: Alessandro Rubini <[email protected]>

---
 include/configs/nhk8815.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
include/configs/nhk8815.h +6 -1
index 2b640dc..fcb1b20 100644
@@ -109,7 +109,7 @@
 #define CONFIG_PL01x_PORTS	{ (void *)CFG_SERIAL0, (void *)CFG_SERIAL1 }
 #define CONFIG_PL011_CLOCK	48000000
 
-/* i2c, for the port extenders (uses gpio.c in board directory) */
+/* i2c, for the stmpe2401 port extenders (uses gpio.c in board directory) */
 #ifndef __ASSEMBLY__
 #include <asm/arch/gpio.h>
 #define CONFIG_CMD_I2C
@@ -125,6 +125,11 @@
 #define I2C_DELAY     (udelay(2))
 #endif /* __ASSEMBLY__ */
 
+/* Activate port extenders and define their i2c address */
+#define CONFIG_STMPE2401
+#define STMPE0  0x43
+#define STMPE1  0x44
+
 /* Ethernet */
 #define PCI_MEMORY_VADDR	0xe8000000
 #define PCI_IO_VADDR		0xee000000
Signature · 1 line
1.6.0.2
#4 lore raw

PATCH 4/7 nhk8815: added keypad

In reply to Alessandro Rubini

From: Alessandro Rubini <[email protected]>

This patch adds keypad support for the nhk8815 board, based on the stmpe2401 driver. The keypad hosts 16 keys, so each of them sends a string instead of a single key. The provided keymap is only an example and must be customized according to the use case.

---
 board/st/nhk8815/Makefile          |    5 ++-
 board/st/nhk8815/keypad.c          |   99 ++++++++++++++++++++++++++++++++++++
 board/st/nhk8815/nhk8815-devices.h |    7 +++
 board/st/nhk8815/nhk8815.c         |    4 ++
 include/configs/nhk8815.h          |    3 +
 5 files changed, 117 insertions(+), 1 deletions(-)
 create mode 100644 board/st/nhk8815/keypad.c
 create mode 100644 board/st/nhk8815/nhk8815-devices.h
board/st/nhk8815/Makefile +4 -1
index b37fe53..1bb1d2c 100644
@@ -29,7 +29,10 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= nhk8815.o
+COBJS-y	:= nhk8815.o
+COBJS-$(CONFIG_NHK8815_KEYPAD) += keypad.o
+
+COBJS	:= $(COBJS-y)
 SOBJS	:= platform.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
board/st/nhk8815/keypad.c new file +99 -0

99 lines not on this page · raw message

board/st/nhk8815/nhk8815-devices.h new file +7 -0
new file mode 100644
index 0000000..78252ed
@@ -0,0 +1,7 @@
+#ifndef __NHK8815_DEVICES__
+#define __NHK8815_DEVICES__
+
+/* Prototypes for functions exported by device files in this directory */
+extern int nhk8815_keypad_init(void);          /* ./keypad.c */
+
+#endif /* __NHK8815_DEVICES__ */
board/st/nhk8815/nhk8815.c +4 -0
index eadce40..fbabd15 100644
@@ -29,6 +29,7 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/gpio.h>
+#include "nhk8815-devices.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -109,6 +110,9 @@ int board_eth_init(bd_t *bis)
 /* Initialization callback, from lib_arm/board.c */
 int board_late_init(void)
 {
+#ifdef CONFIG_NHK8815_KEYPAD
+	nhk8815_keypad_init();
+#endif
 	return 0;
 }
 
include/configs/nhk8815.h +3 -0
index fcb1b20..5eb3cbc 100644
@@ -130,6 +130,9 @@
 #define STMPE0  0x43
 #define STMPE1  0x44
 
+/* Keypad using stmpe2401 */
+#define CONFIG_NHK8815_KEYPAD
+
 /* Ethernet */
 #define PCI_MEMORY_VADDR	0xe8000000
 #define PCI_IO_VADDR		0xee000000
Signature · 1 line
1.6.0.2
#5 lore raw

PATCH 5/7 nhk8815: start lower in RAM, so the 800x480 frame buffer fits

In reply to Alessandro Rubini

From: Alessandro Rubini <[email protected]>

This simply moves u-boot to a lower address, as the frame buffer is allocated after u-boot itself in memory.

---
 board/st/nhk8815/config.mk |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
board/st/nhk8815/config.mk +3 -5
index 590393b..6e5e358 100644
@@ -18,9 +18,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
-#
-#
-# image should be loaded at 0x01000000
-#
 
-TEXT_BASE = 0x03F80000
+# Start 4MB before the end, as the frame buffer is allocate after
+# u-boot. 800x480 @ 32bpp takes 1.5MB alone, so let's play safe.
+TEXT_BASE = 0x03c00000
Signature · 1 line
1.6.0.2
#6 lore raw

PATCH 6/7 nhk8815: added lcd support

In reply to Alessandro Rubini

From: Alessandro Rubini <[email protected]>

This adds lcd support for the board. It includes defines for 32-bit parameter as well, although support for LCD_COLOR32 is not yet in u-boot. This uses the stmpe2401 to turn on display backlight.

---
 board/st/nhk8815/Makefile          |    1 +
 board/st/nhk8815/lcd.c             |   88 ++++++++++++++++++++++++++++++++++++
 board/st/nhk8815/nhk8815-devices.h |    1 +
 board/st/nhk8815/nhk8815.c         |    3 +
 include/configs/nhk8815.h          |   10 ++++
 5 files changed, 103 insertions(+), 0 deletions(-)
 create mode 100644 board/st/nhk8815/lcd.c
board/st/nhk8815/Makefile +1 -0
index 1bb1d2c..7155f12 100644
@@ -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
board/st/nhk8815/lcd.c new file +88 -0

88 lines not on this page · raw message

board/st/nhk8815/nhk8815-devices.h +1 -0
index 78252ed..aec5825 100644
@@ -3,5 +3,6 @@
 
 /* Prototypes for functions exported by device files in this directory */
 extern int nhk8815_keypad_init(void);          /* ./keypad.c */
+extern int nhk8815_backlight_on(void);		/* in ./lcd.c */
 
 #endif /* __NHK8815_DEVICES__ */
board/st/nhk8815/nhk8815.c +3 -0
index fbabd15..fedb3c0 100644
@@ -113,6 +113,9 @@ int board_late_init(void)
 #ifdef CONFIG_NHK8815_KEYPAD
 	nhk8815_keypad_init();
 #endif
+#ifdef CONFIG_LCD
+	nhk8815_backlight_on();
+#endif
 	return 0;
 }
 
include/configs/nhk8815.h +10 -0
index 5eb3cbc..bbeea91 100644
@@ -133,6 +133,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
Signature · 1 line
1.6.0.2
#7 lore raw

PATCH 7/7 nhk8815: documented how to replace u-boot on flash

In reply to Alessandro Rubini

From: Alessandro Rubini <[email protected]>

---
 doc/README.nhk8815 |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
doc/README.nhk8815 +20 -0
index 9008e39..365d7e1 100644
@@ -26,6 +26,26 @@ where it was loaded from, the configurations differ in where the filesystem
 is looked for by default.
 
 
+** How to replace U-Boot with your own
+
+Due to the "secure" boot described above, The U-Boot binary isn't
+expected to live at the beginning of the NAND flash but rather at
+0x80800 (offset 2kB within /dev/mtd).
+
+To replace it with your own binary you should either use the serial
+flasher the vendor distributes (there is a version running on
+GNU/Linux too) or with the following commands from U-Boot.
+These commands read 256kB from the are that will be /dev/mtd2 and
+overwrite U-Boot at offset 2kB:
+
+    nand read  100000 80000 40000
+    bootp      100800 u-boot-nhl8815.bin
+    nand erase  80000 40000
+    nand write 100000 80000 40000
+
+
+** Further documentation
+
 On www.st.com/nomadik and on www.stnwireless.com there are documents,
 summary data and white papers on Nomadik. The full datasheet for
 STn8815 is not currently available on line but under specific request
Signature · 1 line
1.6.0.2