From patchwork Thu Apr 15 11:12:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Rubini X-Patchwork-Id: 71760 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 9E7E8EEE8D9 for ; Thu, 15 Apr 2010 13:16:45 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 90FFFC912DD7 for ; Thu, 15 Apr 2010 13:16:45 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.9) for (single-drop); Thu, 15 Apr 2010 13:16:45 +0200 (CEST) Received: from murder (svr19.m-online.net [192.168.3.147]) by backend2 (Cyrus v2.2.12) with LMTPA; Thu, 15 Apr 2010 13:13:59 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.pop.m-online.net (Cyrus v2.2.13) with LMTPA; Thu, 15 Apr 2010 13:13:58 +0200 Received: from scanner-4.m-online.net (scanner-4.m-online.net [192.168.1.18]) by mail.m-online.net (Postfix) with ESMTP id 90AE0200088; Thu, 15 Apr 2010 13:13:58 +0200 (CEST) Received: from mxin-3.m-online.net ([192.168.6.165]) by scanner-4.m-online.net (scanner-4.m-online.net [192.168.1.18]) (amavisd-new, port 10026) with ESMTP id 20167-05-2; Thu, 15 Apr 2010 13:13:56 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-3.m-online.net (Postfix) with ESMTP id 2EFA246F3E7; Thu, 15 Apr 2010 13:13:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AE089280F1; Thu, 15 Apr 2010 13:13:06 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id whDOUiYFMWOV; Thu, 15 Apr 2010 13:13:06 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DBBB6280A7; Thu, 15 Apr 2010 13:12:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D24DB280DE for ; Thu, 15 Apr 2010 13:12:55 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 67+XADNVqAQE for ; Thu, 15 Apr 2010 13:12:55 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.gnudd.com (mail2.gnudd.com [213.203.150.91]) by theia.denx.de (Postfix) with ESMTPS id 2051C280E3 for ; Thu, 15 Apr 2010 13:12:51 +0200 (CEST) Received: from mail.gnudd.com (localhost [127.0.0.1]) by mail.gnudd.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o3FBCmkv029211; Thu, 15 Apr 2010 13:12:48 +0200 Received: (from rubini@localhost) by mail.gnudd.com (8.14.3/8.14.3/Submit) id o3FBClMV029210; Thu, 15 Apr 2010 13:12:47 +0200 Date: Thu, 15 Apr 2010 13:12:47 +0200 From: Alessandro Rubini To: u-boot@lists.denx.de Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Face: #Q; A)@_4.#>0+_%y]7aBr:c"ndLp&#+2?]J; lkse\^)FP^Lr5@O0{)J; 'nny4%74.fM'n)M >ISCj.KmsL/HTxz!:Ju'pnj'Gz&. Organization: GnuDD, Device Drivers, Embedded Systems, Courses References: In-Reply-To: Cc: STEricsson_nomadik_linux@list.st.com, andrea.gallo@stericsson.com Subject: [U-Boot] [PATCH 6/7] nhk8815: added lcd support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net From: Alessandro Rubini 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. Signed-off-by: Alessandro Rubini Acked-by: Andrea Gallo --- 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 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..d3acb48 --- /dev/null +++ b/board/st/nhk8815/lcd.c @@ -0,0 +1,88 @@ +/* + * board/st/nhk8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset + * + * Copyright 2009 Alessandro Rubini + * + * 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 +#include +#include +#include + +/* 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_config nhk8815_clcd_config = { + .address = (struct clcd_registers *)NOMADIK_CLCDC_BASE, + .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_config, +}; + +/* Don't turn on (too early), but configure data lines and remove reset */ +void lcd_enable(void) +{ + 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) +{ + 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-devices.h b/board/st/nhk8815/nhk8815-devices.h index 78252ed..aec5825 100644 --- a/board/st/nhk8815/nhk8815-devices.h +++ b/board/st/nhk8815/nhk8815-devices.h @@ -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__ */ diff --git a/board/st/nhk8815/nhk8815.c b/board/st/nhk8815/nhk8815.c index fbabd15..fedb3c0 100644 --- a/board/st/nhk8815/nhk8815.c +++ b/board/st/nhk8815/nhk8815.c @@ -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; } diff --git a/include/configs/nhk8815.h b/include/configs/nhk8815.h index 5eb3cbc..bbeea91 100644 --- a/include/configs/nhk8815.h +++ b/include/configs/nhk8815.h @@ -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