diff -uprN u-boot-orig/board/atstk1000/ltv350qv.c u-boot/board/atstk1000/ltv350qv.c --- u-boot-orig/board/atstk1000/ltv350qv.c 1970-01-01 01:00:00.000000000 +0100 +++ u-boot/board/atstk1000/ltv350qv.c 2007-01-02 15:17:32.000000000 +0100 @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2005-2006 Atmel Corporation + * + * 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 + +#ifdef CONFIG_LCD +#ifndef CONFIG_SPI +#error No SPI controller for LCD setup, enable CFG_SPI +#endif + +#include + +#ifdef CONFIG_ATMEL_SPI +#include +#endif + +static int ltv350qv_write_reg(u8 reg, u16 val) +{ + int ret; + u8 buffer[3]; + + buffer[0] = 0x74; + buffer[1] = 0x00; + buffer[2] = reg & 0x7f; + + ret = spi_write(&buffer[0], 1, &buffer[1], 2); + if (ret != 3) { + printf("spi_write returned %d\n", ret); + return -1; + } + + buffer[0] = 0x76; + buffer[1] = val >> 8; + buffer[2] = val; + + ret = spi_write(&buffer[0], 1, &buffer[1], 2); + if (ret != 3) { + printf("spi_write returned %d\n", ret); + return -1; + } + + return 0; +} + +#define write_reg(reg, val) \ + do { \ + ret = ltv350qv_write_reg(reg, val); \ + if (ret) \ + goto out; \ + } while (0) + +void ltv350qv_power_on(void) +{ + int ret; + +#ifdef CONFIG_ATMEL_SPI + spi_select_chip(1); +#endif + + debug ("ltv350qv: do power on sequence\n"); + + /* write startup procedure */ + write_reg(9, 0x0000); + udelay(15000); + write_reg(9, 0x4000); + write_reg(10, 0x2000); + write_reg(9, 0x4055); + udelay(55000); + write_reg(1, 0x409d); + write_reg(2, 0x0204); + write_reg(3, 0x0100); + write_reg(4, 0x3000); + write_reg(5, 0x4003); + write_reg(6, 0x000a); + write_reg(7, 0x0021); + write_reg(8, 0x0c00); + write_reg(10, 0x0103); + write_reg(11, 0x0301); + write_reg(12, 0x1f0f); + write_reg(13, 0x1f0f); + write_reg(14, 0x0707); + write_reg(15, 0x0307); + write_reg(16, 0x0707); + write_reg(17, 0x0000); + write_reg(18, 0x0004); + write_reg(19, 0x0000); + + udelay(20000); + write_reg(9, 0x4a55); + write_reg(5, 0x5003); + + debug ("ltv350qv: power on sequence done\n"); +out: + return; +} + +void ltv350qv_power_off(void) +{ + int ret; + +#ifdef CONFIG_ATMEL_SPI + spi_select_chip(1); +#endif + + debug ("ltv350qv: do power off sequence\n"); + /* GON -> 0, POC -> 0 */ + write_reg(9, 0x4055); + /* DSC -> 0 */ + write_reg(5, 0x4003); + /* VCOMG -> 0 */ + write_reg(10, 0x2103); + + udelay(1000000); + + /* AP[2:0] -> 000 */ + write_reg(9, 0x4050); + + debug ("ltv350qv: power off sequence done\n"); +out: + return; +} + +void ltv350qv_init(void) +{ + debug ("ltv350qv: initializing LTV350QV panel\n"); + ltv350qv_power_on(); +} + +#endif diff -uprN u-boot-orig/board/atstk1000/Makefile u-boot/board/atstk1000/Makefile --- u-boot-orig/board/atstk1000/Makefile 2007-01-01 19:26:46.000000000 +0100 +++ u-boot/board/atstk1000/Makefile 2007-01-01 16:23:12.000000000 +0100 @@ -30,7 +30,7 @@ endif LIB := lib$(BOARD).a -SRC := $(BOARD).c $(DAUGHTERBOARD).c eth.c flash.c +SRC := $(BOARD).c $(DAUGHTERBOARD).c eth.c flash.c ltv350qv.c SRC += spi.c OBJS := $(addsuffix .o,$(basename $(SRC)))