diff options
author | H. Nikolaus Schaller <hns@goldelico.com> | 2010-11-25 14:00:34 +0100 |
---|---|---|
committer | H. Nikolaus Schaller <hns@goldelico.com> | 2010-11-25 14:00:34 +0100 |
commit | b51a1154bd43b458097fb76b065fbc0bd2cbd595 (patch) | |
tree | 705ad4532a8982554a5a15ff3f751e6a17b6fa9c /board/ti | |
parent | 72df8fcb44ffe40f0a1d8226977f6ec3d9019948 (diff) | |
download | bootable_bootloader_goldelico_gta04-b51a1154bd43b458097fb76b065fbc0bd2cbd595.zip bootable_bootloader_goldelico_gta04-b51a1154bd43b458097fb76b065fbc0bd2cbd595.tar.gz bootable_bootloader_goldelico_gta04-b51a1154bd43b458097fb76b065fbc0bd2cbd595.tar.bz2 |
rearranged beagle-hybrid and gta04 under goldelico subdirectory; added new gpio, mux, halt commands
Diffstat (limited to 'board/ti')
-rw-r--r-- | board/ti/beagle/Makefile | 2 | ||||
-rw-r--r-- | board/ti/gta04/COMMANDS | 22 | ||||
-rw-r--r-- | board/ti/gta04/TD028TTEC1.c | 236 | ||||
-rw-r--r-- | board/ti/gta04/TD028TTEC1.h | 21 | ||||
-rw-r--r-- | board/ti/gta04/backlight.c | 68 | ||||
-rw-r--r-- | board/ti/gta04/backlight.h | 7 | ||||
-rw-r--r-- | board/ti/gta04/commands.c | 486 | ||||
-rw-r--r-- | board/ti/gta04/dssfb.c | 271 | ||||
-rw-r--r-- | board/ti/gta04/dssfb.h | 32 | ||||
-rw-r--r-- | board/ti/gta04/gps.c | 88 | ||||
-rw-r--r-- | board/ti/gta04/gps.h | 11 | ||||
-rw-r--r-- | board/ti/gta04/jbt6k74.c | 326 | ||||
-rw-r--r-- | board/ti/gta04/jbt6k74.h | 19 | ||||
-rw-r--r-- | board/ti/gta04/status.c | 143 | ||||
-rw-r--r-- | board/ti/gta04/status.h | 9 | ||||
-rw-r--r-- | board/ti/gta04/tsc2007.c | 143 | ||||
-rw-r--r-- | board/ti/gta04/tsc2007.h | 8 |
17 files changed, 1 insertions, 1891 deletions
diff --git a/board/ti/beagle/Makefile b/board/ti/beagle/Makefile index 50650bf..eedc18b 100644 --- a/board/ti/beagle/Makefile +++ b/board/ti/beagle/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a COBJS := beagle.o -COBJS-y := $(BOARD).o ../gta04/TD028TTEC1.o ../gta04/jbt6k74.o ../gta04/backlight.o ../gta04/status.o ../gta04/tsc2007.o ../gta04/dssfb.o ../gta04/gps.o ../gta04/commands.o +COBJS-y := $(BOARD).o ../../goldelico/gta04/TD028TTEC1.o ../../goldelico/gta04/jbt6k74.o ../../goldelico/gta04/backlight.o ../../goldelico/gta04/status.o ../../goldelico/gta04/tsc2007.o ../../goldelico/gta04/dssfb.o ../../goldelico/gta04/gps.o ../../goldelico/gta04/commands.o COBJS := $(sort $(COBJS-y)) SRCS := $(COBJS:.o=.c) diff --git a/board/ti/gta04/COMMANDS b/board/ti/gta04/COMMANDS deleted file mode 100644 index 01fa68e..0000000 --- a/board/ti/gta04/COMMANDS +++ /dev/null @@ -1,22 +0,0 @@ -new uBoot commands: - -status in[it] setup GPIOs -status ge[t] get button status -status se[t] hh set LEDs to lower 4 bit -status se[t] increment last state, i.e. make LEDs count -status mi[rror] read button status and mirror to LEDs until a key is pressed -status bl[ink] blink LEDs - -lcm in[it] initialize subsystem (DSS, GPIOs etc.) -lcm ba[cklight] dd set backlight level (0..255) -lcm po[wer] dd set power level (0..2) -lcm on set lcm on -lcm of[f] set lcm off - -gps on | of[f] control GPS receiver (and initialize UART) -gps re[ad] read GPS NMEA from UART until a key is pressed - -tsc init initialize/enable TSC2007 through I2C2 -tsc get read current ADC values (incl. internal temp and AUX/photosensor) -tsc lo[op] read x/y coordinates -tsc ch[oose] somehow allow to define receptive fields and use the result to select different boot options diff --git a/board/ti/gta04/TD028TTEC1.c b/board/ti/gta04/TD028TTEC1.c deleted file mode 100644 index 217e088..0000000 --- a/board/ti/gta04/TD028TTEC1.c +++ /dev/null @@ -1,236 +0,0 @@ -/* u-boot driver for the tpo TD028TTEC1 LCM - * - * Copyright (C) 2006-2007 by OpenMoko, Inc. - * Author: Harald Welte <laforge@openmoko.org> - * All rights reserved. - * - * 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 - * - */ - -/* modified by hns@goldelico.com - * now is just a SPI/GPIO driver to the serial interface of the TD028TTEC1 - - *** should all this code be moved to drivers/misc or drivers/video ? - - */ - -#include <common.h> -#include <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include "TD028TTEC1.h" - -#if 0 -#define DEBUGP(x, args...) printf("%s: " x, __FUNCTION__, ## args); -#define DEBUGPC(x, args...) printf(x, ## args); -#define VERIFY(VAL) if(SPI_READ() != (VAL)) { printf("expected: %d found: %d\n", VAL, SPI_READ()); return 1; } -#else -#define DEBUGP(x, args...) do { } while (0) -#define DEBUGPC(x, args...) do { } while (0) -#define VERIFY(VAL) if(SPI_READ() != (VAL)) { return 1; } -#endif - -#if defined(_BEAGLE_) - -#define GPIO_CS 161 -#define GPIO_SCL 162 -#define GPIO_DIN 159 -#define GPIO_DOUT 158 - -#define SPI_READ() (omap_get_gpio_datain(GPIO_DIN)) -#define SPI_CS(bit) (omap_set_gpio_dataout(GPIO_CS, bit)) -#define SPI_SDA(bit) (omap_set_gpio_dataout(GPIO_DOUT, bit)) -#define SPI_SCL(bit) (omap_set_gpio_dataout(GPIO_SCL, bit)) - -#elif !defined(CONFIG_GTA02_REVISION) /* GTA01 */ - -#define GTA01_SCLK (1 << 7) /* GPG7 */ -#define GTA01_MOSI (1 << 6) /* GPG6 */ -#define GTA01_MISO (1 << 5) /* GPG5 */ -#define GTA01_CS (1 << 3) /* GPG3 */ - -#define SPI_READ ((immr->GPGDAT & GTA01_MISO) != 0) - -#define SPI_CS(bit) if (bit) gpio->GPGDAT |= GTA01_CS; \ - else gpio->GPGDAT &= ~GTA01_CS - -#define SPI_SDA(bit) if (bit) gpio->GPGDAT |= GTA01_MOSI; \ - else gpio->GPGDAT &= ~GTA01_MOSI - -#define SPI_SCL(bit) if (bit) gpio->GPGDAT |= GTA01_SCLK; \ - else gpio->GPGDAT &= ~GTA01_SCLK - -#else /* GTA02 */ - -extern void smedia3362_spi_cs(int); -extern void smedia3362_spi_sda(int); -extern void smedia3362_spi_scl(int); -extern void smedia3362_lcm_reset(int); - -#define SPI_READ $not$implemented$ -#define SPI_CS(b) smedia3362_spi_cs(b) -#define SPI_SDA(b) smedia3362_spi_sda(b) -#define SPI_SCL(b) smedia3362_spi_scl(b) - -#endif - - -/* 150uS minimum clock cycle, we have two of this plus our other - * instructions */ - -#define SPI_DELAY() udelay(150) - -static int jbt_spi_xfer(int wordnum, int bitlen, u_int16_t *dout) -{ -#if !defined(_BEAGLE_) - S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); -#endif - u_int16_t tmpdout = 0; - int i, j; - - DEBUGP("spi_xfer: dout %08X wordnum %u bitlen %d\n", - *(uint *)dout, wordnum, bitlen); - - SPI_CS(0); - - for (i = 0; i < wordnum; i ++) { - tmpdout = dout[i]; - - for (j = 0; j < bitlen; j++) { - SPI_SCL(0); - if (tmpdout & (1 << (bitlen-1))) { - SPI_SDA(1); - DEBUGPC("1"); - VERIFY(1); - } else { - SPI_SDA(0); - DEBUGPC("0"); - VERIFY(0); - } - SPI_DELAY(); - SPI_SCL(1); - SPI_DELAY(); - tmpdout <<= 1; - } - DEBUGPC(" "); - } - DEBUGPC("\n"); - - SPI_CS(1); - - return 0; -} - -#define JBT_COMMAND 0x000 -#define JBT_DATA 0x100 - -int jbt_reg_write_nodata(struct jbt_info *jbt, u_int8_t reg) -{ - int rc; - - jbt->tx_buf[0] = JBT_COMMAND | reg; - - rc = jbt_spi_xfer(1, 9, jbt->tx_buf); - - return rc; -} - - -int jbt_reg_write(struct jbt_info *jbt, u_int8_t reg, u_int8_t data) -{ - int rc; - - jbt->tx_buf[0] = JBT_COMMAND | reg; - jbt->tx_buf[1] = JBT_DATA | data; - - rc = jbt_spi_xfer(2, 9, jbt->tx_buf); - - return rc; -} - -int jbt_reg_write16(struct jbt_info *jbt, u_int8_t reg, u_int16_t data) -{ - int rc; - - jbt->tx_buf[0] = JBT_COMMAND | reg; - jbt->tx_buf[1] = JBT_DATA | (data >> 8); - jbt->tx_buf[2] = JBT_DATA | (data & 0xff); - - rc = jbt_spi_xfer(3, 9, jbt->tx_buf); - - return rc; -} - -int jbt_reg_init(void) -{ -#if defined(_BEAGLE_) - int i; - int failed=0; - - printf("jbt_reg_init()\n"); - omap_request_gpio(GPIO_CS); - SPI_CS(1); // unselect - omap_request_gpio(GPIO_SCL); - SPI_SCL(1); // default - omap_request_gpio(GPIO_DOUT); - SPI_SDA(0); - omap_request_gpio(GPIO_DIN); -#if 1 // should have been done by MUX settings! - omap_set_gpio_direction(GPIO_CS, 0); // output - omap_set_gpio_direction(GPIO_SCL, 0); // output - omap_set_gpio_direction(GPIO_DOUT, 0); // output - omap_set_gpio_direction(GPIO_DIN, 1); // input (for read back) -#endif - - // omap_free_gpio(GPIO_DIN); - // omap_free_gpio(GPIO_DOUT); - // omap_free_gpio(GPIO_CS); - // omap_free_gpio(GPIO_SCL); - -#endif - - /* according to data sheet: wait 50ms (Tpos of LCM). However, 50ms - * seems unreliable with later LCM batches, increasing to 90ms */ - udelay(90000); - -#if defined(_BEAGLE_) - for(i=0; i<16; i++) - { // check for connection between GPIO158 -> GPIO159; since we have 10 kOhm pse. make sure that the PUP/PDN is disabled in the MUX config! - int bit=i&1; - SPI_SDA(bit); // write bit - SPI_DELAY(); -#if 1 - printf("bit: %d out: %d in: %d (%d)\n", bit, omap_get_gpio_datain(GPIO_DOUT), omap_get_gpio_datain(GPIO_DIN), SPI_READ()); -#endif - if(SPI_READ() != bit) // did not read back - failed++; - } - if(failed > 0) - { - printf("jbt_reg_init() - no correct response, assuming no connection between GPIO158 and GPIO159\n"); - return 1; - } -#endif - - printf("did jbt_reg_init()\n"); - return 0; -} - - diff --git a/board/ti/gta04/TD028TTEC1.h b/board/ti/gta04/TD028TTEC1.h deleted file mode 100644 index be97640..0000000 --- a/board/ti/gta04/TD028TTEC1.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _TD028TTEC1_H -#define _TD028TTEC1_H - -#define _BEAGLE_ - -#define JBT_TX_BUF_SIZE -struct jbt_info { - u_int16_t tx_buf[4]; - struct spi_device *spi_dev; - int state; -}; - -#define JBT_COMMAND 0x000 -#define JBT_DATA 0x100 - -int jbt_reg_init(void); -int jbt_reg_write_nodata(struct jbt_info *jbt, u_int8_t reg); -int jbt_reg_write(struct jbt_info *jbt, u_int8_t reg, u_int8_t data); -int jbt_reg_write16(struct jbt_info *jbt, u_int8_t reg, u_int16_t data); - -#endif diff --git a/board/ti/gta04/backlight.c b/board/ti/gta04/backlight.c deleted file mode 100644 index 0e9ce24..0000000 --- a/board/ti/gta04/backlight.c +++ /dev/null @@ -1,68 +0,0 @@ -/* u-boot driver for the GTA04 backlight - * - * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG - * Author: H. Nikolaus Schaller <hns@goldelico.com> - * All rights reserved. - * - * 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 <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include "backlight.h" - -#define GPIO_BACKLIGHT 145 -#define USE_PWM 0 - -void backlight_set_level(int level) // 0..255 -{ -#if USE_PWM - struct gptimer *gpt_base = (struct gptimer *)OMAP34XX_GPT10; // use GPT11 for GTA04 - // writel(value, &gpt_base->registername); -#else - omap_set_gpio_dataout(GPIO_BACKLIGHT, level >= 128); // for simplicity we just have on/off - level=(level >= 128)?255:0; -#endif - printf("lcm backlight level set to %d (0..255)\n", level); -} - -int backlight_init(void) -{ -#if USE_PWM - struct gptimer *gpt_base = (struct gptimer *)OMAP34XX_GPT10; // use GPT11 for GTA04 - MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M2)) /* switch to GPT10 */ - // writel(value, &gpt_base->registername); - // program registers -#error todo -#else - MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M4)) /*GPIO_145*/ - omap_request_gpio(GPIO_BACKLIGHT); - omap_set_gpio_direction(GPIO_BACKLIGHT, 0); // output - - // omap_free_gpio(GPIO_BACKLIGHT); -#endif - printf("did backlight_init()\n"); - - return 0; -} - - diff --git a/board/ti/gta04/backlight.h b/board/ti/gta04/backlight.h deleted file mode 100644 index 5c299d9..0000000 --- a/board/ti/gta04/backlight.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _BACKLIGHT_H -#define _BACKLIGHT_H - -void backlight_set_level(int level); // 0..255 -int backlight_init(void); - -#endif diff --git a/board/ti/gta04/commands.c b/board/ti/gta04/commands.c deleted file mode 100644 index b5ee4ad..0000000 --- a/board/ti/gta04/commands.c +++ /dev/null @@ -1,486 +0,0 @@ -/* u-boot extended commands for GTA04 - * - * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG - * Author: H. Nikolaus Schaller <hns@goldelico.com> - * All rights reserved. - * - * 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 <command.h> -#include <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include "backlight.h" -#include "dssfb.h" -#include "jbt6k74.h" -#include "status.h" -#include "gps.h" -#include "tsc2007.h" - -/* LCM commands */ - -static int do_lcd_color(int argc, char *argv[]) -{ - unsigned int color; - if (argc < 3) { - printf ("lcm color: missing color (0..ffffff).\n"); - return (-1); - } - color=simple_strtoul(argv[2], NULL, 16); - omap3_set_color(color); - return 0; -} - -static int do_lcd_framebuffer(int argc, char *argv[]) -{ - void *addr; - if (argc < 3) { - printf ("lcm fb: missing address.\n"); - return (-1); - } - addr=(void *) simple_strtoul(argv[2], NULL, 16); - omap3_dss_set_fb(addr); - return 0; -} - -static int do_lcd_backlight(int argc, char *argv[]) -{ - unsigned char level; - if (argc < 3) { - printf ("lcm backlight: missing level (0..255).\n"); - return (-1); - } - level=simple_strtoul(argv[2], NULL, 10); - backlight_set_level(level); - return 0; -} - -static int do_lcd_power(int argc, char *argv[]) -{ - int state=JBT_STATE_NORMAL; - if (argc < 3) - { - printf ("lcm power: missing state (0..2).\n"); - return (-1); - } - state=simple_strtoul(argv[2], NULL, 10); - if(state > 2) - { - printf ("lcm power: invalid state (0..2).\n"); - return (-1); - } - jbt6k74_enter_state(state); - printf("lcm state set to %s\n", jbt_state()); - return 0; -} - -static int do_lcd_onoff(int argc, char *argv[], int flag) -{ - jbt6k74_display_onoff(flag); - printf("display power %s\n", flag?"on":"off"); - return 0; -} - -static int do_lcd_init(int argc, char *argv[]) -{ - return board_video_init(NULL); -} - -static int do_lcd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - int len; - - if (argc < 2) { - printf ("lcm: missing subcommand.\n"); - return (-1); - } - - len = strlen (argv[1]); - if (strncmp ("ba", argv[1], 2) == 0) { - return do_lcd_backlight (argc, argv); - } else if (strncmp ("po", argv[1], 2) == 0) { - return do_lcd_power (argc, argv); - } else if (strncmp ("of", argv[1], 2) == 0) { - return do_lcd_onoff (argc, argv, 0); - } else if (strncmp ("on", argv[1], 2) == 0) { - return do_lcd_onoff (argc, argv, 1); - } else if (strncmp ("in", argv[1], 2) == 0) { - return do_lcd_init (argc, argv); - } else if (strncmp ("co", argv[1], 2) == 0) { - return do_lcd_color (argc, argv); - } else if (strncmp ("fb", argv[1], 2) == 0) { - return do_lcd_framebuffer (argc, argv); - } else { - printf ("lcm: unknown operation: %s\n", argv[1]); - } - - return (0); -} - -U_BOOT_CMD(lcm, 3, 0, do_lcd, "LCM sub-system", - "init - initialize DSS, GPIOs and LCM controller\n" - "backlight level - set backlight level\n" - "off - switch off\n" - "on - switch on\n" - "power mode - set power mode\n" - "color hhhhhh - switch color (can be used without init)\n" - "fb address - set framebuffer address (can be used without init)\n" - ); - -/* TSC commands */ - -static int do_tsc_init(int argc, char *argv[]) -{ - tsc2007_init(); - return 0; -} - -static int do_tsc_get(int argc, char *argv[]) -{ - print_adc(); - printf("\n"); - return 0; -} - -static int do_tsc_loop(int argc, char *argv[]) -{ - printf("permanently reading ADCs of TSC.\n" - "Press any key to stop\n\n"); - while (!tstc()) - { - print_adc(); - printf("\r"); - } - getc(); - printf("\n"); - return 0; -} - -static int tsc_choice=0; - -static int do_tsc_selection(int argc, char *argv[]) -{ // tsc selection number - if (argc != 3) - { - printf ("tsc selection: missing number of selection to check for.\n"); - return (-1); - } - return tsc_choice == simple_strtoul(argv[2], NULL, 10)?0:1; -} - -static int pendown(int *x, int *y) -{ -#if 1 - int z; - int xx; - int yy; - xx=read_adc(0); - yy=read_adc(1); - z=read_adc(2); // read Z - if(z < 0) - return 0; // read error -#if 0 - printf("z=%04d x:%04d y:%04d\n", z, xx, yy); -#endif - if(x) *x=xx; - if(y) *y=yy; - udelay(10000); // reduce I2C traffic and debounce... - return z > 200; // was pressed -#else - // must be in PENIRQ mode... - return (led_get_buttons() & 0x08) == 0; -#endif -} - -static int do_tsc_choose(int argc, char *argv[]) -{ // tsc choose cols rows - int cols; - int rows; - int x; - int y; - tsc_choice=0; // reset choice - if (argc != 4) - { - printf ("tsc choose: missing number of cols and rows.\n"); - return (-1); - } - cols=simple_strtoul(argv[2], NULL, 10); - rows=simple_strtoul(argv[3], NULL, 10); - printf("Choosing by waiting for touch.\n"); - for(y=0; y<rows; y++) - for(x=0; x<cols; x++) - printf("%d%s", 1+x+y*cols, (x+1==cols)?"\n":" "); - printf("Press touch or any key to stop\n\n"); - while (!tstc()) - { - if(pendown(NULL, NULL) && pendown(&x, &y)) - { // still pressed - should now be stable -#if 0 - printf("xy: %d/%d\n", x, y); - printf("xy: %d/%d\n", x*cols, y*rows); -#endif - x=(x*cols)/4096; - y=((4095-y)*rows)/4096; // (0,0) is lower left corner in our hardware - tsc_choice=1+x+y*cols; // return 1..rows*cols -#if 0 - while(pendown(NULL, NULL)) - { // wait for pen-up - if(tstc()) - break; - } -#endif - if(tstc()) - break; -#if 1 - printf("did choose %d/%d -> %d\n", x, y, tsc_choice); -#endif - return 0; - } - } - getc(); - return 0; -} - -static int do_tsc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - int len; - - if (argc < 2) { - printf ("led: missing subcommand.\n"); - return (-1); - } - - len = strlen (argv[1]); - if (strncmp ("ge", argv[1], 2) == 0) { - return do_tsc_get (argc, argv); - } else if (strncmp ("lo", argv[1], 2) == 0) { - return do_tsc_loop (argc, argv); - } else if (strncmp ("ch", argv[1], 2) == 0) { - return do_tsc_choose (argc, argv); - } else if (strncmp ("se", argv[1], 2) == 0) { - return do_tsc_selection (argc, argv); - } else if (strncmp ("in", argv[1], 2) == 0) { - return do_tsc_init (argc, argv); - } else { - printf ("tsc: unknown operation: %s\n", argv[1]); - } - - return (0); -} - - -U_BOOT_CMD(tsc, 4, 0, do_tsc, "TSC2007 sub-system", - "in[it] - initialize TSC2007\n" - "ge[t] - read ADCs\n" - "lo[op] - loop and display x/y coordinates\n" - "ch[oose] cols rows - choose item\n" - "se[lection] p - check if item p (1 .. cols*rows) was selected\n" - ); - -/** LED commands */ - -static int do_led_init(int argc, char *argv[]) -{ - led_init(); - return 0; -} - -static void print_buttons(int status) -{ - printf("AUX: %s Power: %s Antenna: %s Pen: %s", (status&0x01)?"on":"off", (status&0x04)?"on":"off", (status&0x02)?"EXT":"INT", (status&0x08)?"1":"0"); -} - -static int do_led_check(int argc, char *argv[]) -{ // can be used in if construct - int state=led_get_buttons(); - if (argc < 3) - { - printf ("led check: missing mask.\n"); - return (-1); - } - state &= simple_strtoul(argv[2], NULL, 16); - return (state != 0)?0:1; -} - -static int do_led_get(int argc, char *argv[]) -{ - int status=led_get_buttons(); - printf("button status: %01x\n", status); - print_buttons(status); - printf("\n"); - return 0; -} - -static int do_led_set(int argc, char *argv[]) -{ // led set hh - static int state; - if(argc == 2) - state++; - else - state=simple_strtoul(argv[2], NULL, 16); - led_set_led(state); - return 0; -} - -static int do_led_loop(int argc, char *argv[]) -{ - printf("mirroring buttons to LEDs.\n" - "Press any key to stop\n\n"); - while (!tstc() && !pendown(NULL, NULL)) - { - int state=led_get_buttons(); - print_buttons(state); - printf("\r"); - led_set_led(state); // mirror to LEDs - udelay(100000); // 0.1 seconds - } - if(tstc()) - getc(); - printf("\n"); - return 0; -} - -static int do_led_blink(int argc, char *argv[]) -{ - int value=0; - printf("blinking LEDs.\n" - "Press any key to stop\n\n"); - while (!tstc() && !pendown(NULL, NULL)) - { - led_set_led(value++); // mirror to LEDs - udelay(100000); // 0.1 seconds - } - if(tstc()) - getc(); - return 0; -} - -static int do_led(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - int len; - - if (argc < 2) { - printf ("led: missing subcommand.\n"); - return (-1); - } - - len = strlen (argv[1]); - if (strncmp ("ge", argv[1], 2) == 0) { - return do_led_get (argc, argv); - } else if (strncmp ("se", argv[1], 2) == 0) { - return do_led_set (argc, argv); - } else if (strncmp ("mi", argv[1], 2) == 0) { - return do_led_loop (argc, argv); - } else if (strncmp ("bl", argv[1], 2) == 0) { - return do_led_blink (argc, argv); - } else if (strncmp ("in", argv[1], 2) == 0) { - return do_led_init (argc, argv); - } else if (strncmp ("ch", argv[1], 2) == 0) { - return do_led_check (argc, argv); - } else { - printf ("led: unknown operation: %s\n", argv[1]); - } - - return (0); -} - - -U_BOOT_CMD(status, 3, 0, do_led, "LED and Buttons sub-system", - "init - initialize GPIOs\n" - "get - print button status\n" - "check - check button status\n" - "set value - set LEDs state\n" - "mirror - read buttons and mirror to LEDs\n" - "blink - blink LEDs\n" - ); - -/** GPS commands */ - -static int do_gps_init(int argc, char *argv[]) -{ - return gps_init(); -} - -static int do_gps_on(int argc, char *argv[]) -{ - gps_on(); - printf("GPS on\n"); - return 0; -} - -static int do_gps_off(int argc, char *argv[]) -{ - gps_off(); - printf("GPS off\n"); - return 0; -} - -static int do_gps_echo(int argc, char *argv[]) -{ - gps_echo(); - return 0; -} - -// FIXME: gps cmd - -static int do_gps(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - int len; - - if (argc < 2) { - printf ("gps: missing subcommand.\n"); - return (-1); - } - - len = strlen (argv[1]); - if (strncmp ("on", argv[1], 2) == 0) { - return do_gps_on (argc, argv); - } else if (strncmp ("of", argv[1], 2) == 0) { - return do_gps_off (argc, argv); - } else if (strncmp ("in", argv[1], 2) == 0) { - return do_gps_init (argc, argv); - } else if (strncmp ("ec", argv[1], 2) == 0) { - return do_gps_echo (argc, argv); - } else { - printf ("gps: unknown operation: %s\n", argv[1]); - } - - return (0); -} - - -U_BOOT_CMD(gps, 3, 0, do_gps, "GPS sub-system", - "init - initialize GPIOs\n" - "on - enable GPS\n" - "off - disable GPS\n" - "cmd string - send string\n" - "echo - echo GPS out to console\n" - ); - -static int do_systest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - // do mixture of gps_echo, tsc_loop, status mirror status blink - return (0); -} - -U_BOOT_CMD(systest, 2, 0, do_systest, "System Test", ""); - diff --git a/board/ti/gta04/dssfb.c b/board/ti/gta04/dssfb.c deleted file mode 100644 index 582afc7..0000000 --- a/board/ti/gta04/dssfb.c +++ /dev/null @@ -1,271 +0,0 @@ -/* u-boot driver for the DSS and framebuffer - * - * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG - * Author: H. Nikolaus Schaller <hns@goldelico.com> - * All rights reserved. - * - * 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 <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include <asm/arch/dss.h> - -#define DVI_BACKGROUND_COLOR 0x00fadc29 // rgb(250, 220, 41) - -// configure beagle board DSS for the TD28TTEC1 - -#define DSS1_FCLK 432000000 // see figure 15-65 -#define PIXEL_CLOCK 22000000 // approx. 22 MHz (will be divided from 432 MHz) - -// all values are min ratings - -#define VDISP 640 // vertical active area -#define VFP 4 // vertical front porch -#define VS 2 // VSYNC pulse width (negative going) -#define VBP 2 // vertical back porch -#define VDS (VS+VBP) // vertical data start -#define VBL (VS+VBP+VFP) // vertical blanking period -#define VP (VDISP+VBL) // vertical cycle - -#define HDISP 480 // horizontal active area -#define HFP 24 // horizontal front porch -#define HS 8 // HSYNC pulse width (negative going) -#define HBP 8 // horizontal back porch -#define HDS (HS+HBP) // horizontal data start -#define HBL (HS+HBP+HFP) // horizontal blanking period -#define HP (HDISP+HBL) // horizontal cycle - -#if 0 -#define DEBUGP(x, args...) printf("%s: " x, __FUNCTION__, ## args); -#define DEBUGPC(x, args...) printf(x, ## args); -#else -#define DEBUGP(x, args...) do { } while (0) -#define DEBUGPC(x, args...) do { } while (0) -#endif - -static const struct panel_config lcm_cfg = -{ -.timing_h = ((HBP-1)<<20) | ((HFP-1)<<8) | ((HS-1)<<0), /* Horizantal timing */ -.timing_v = ((VBP+0)<<20) | ((VFP+0)<<8) | ((VS-1)<<0), /* Vertical timing */ -.pol_freq = (1<<17)|(0<<16)|(0<<15)|(1<<14)|(1<<13)|(1<<12)|0x28, /* Pol Freq */ -.divisor = (0x0001<<16)|(DSS1_FCLK/PIXEL_CLOCK), /* Pixel Clock divisor from dss1_fclk */ -.lcd_size = ((HDISP-1)<<0) | ((VDISP-1)<<16), /* as defined by LCM */ -.panel_type = 0x01, /* TFT */ -.data_lines = 0x03, /* 24 Bit RGB */ -.load_mode = 0x02, /* Frame Mode */ -.panel_color = DVI_BACKGROUND_COLOR -}; - -void omap3_dss_go(void) -{ // push changes from shadow register to display controller - struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE; - u32 l = 0; - l = readl(&dispc->control); - l |= GO_LCD | GO_DIG; - writel(l, &dispc->control); - while((readl(&dispc->control) & (GO_LCD | GO_DIG)) != 0) - udelay(1000); // udelay(1000) until the bit(s) are reset by Hardware! - DEBUGP("omap3_dss_go() dispc_control: %08x\n", readl(&dispc->control)); -} - -struct gfx_regs -{ - u32 gfx_ba[2]; /* 80 */ - u32 gfx_position; /* 88 */ - u32 gfx_size; /* 8c */ - u32 reserved1[4]; - u32 gfx_attributes; /* a0 */ -#define GFX_ENABLE 0x0001 - u32 gfx_fifo_threshold; /* a4 */ - u32 gfx_fifo_size_status; /* a8 */ - u32 gfx_row_inc; /* ac */ - u32 gfx_pixel_inc; /* b0 */ - u32 gfx_window_skip; /* b4 */ - u32 gfx_table_ba; /* b8 */ -}; - -#define OMAP3_GFX_BASE (0x48050480) - -int omap3_dss_enable_fb(int flag) -{ - struct gfx_regs *gfx = (struct gfx_regs *) OMAP3_GFX_BASE; - u32 l = readl(&gfx->gfx_attributes); - if(flag) - l |= GFX_ENABLE; - else - l &= ~GFX_ENABLE; - DEBUGP("write %x to gfx_attibutes: %08x\n", l, &gfx->gfx_attributes); - writel(l, &gfx->gfx_attributes); - omap3_dss_go(); - DEBUGP("framebuffer enabled: %d\n", flag); - DEBUGP("gfx_attibutes: %08x\n", readl(&gfx->gfx_attributes)); - return 0; -} - -int omap3_dss_set_fb(void *addr) -{ // set framebuffer address - struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE; - struct gfx_regs *gfx = (struct gfx_regs *) OMAP3_GFX_BASE; - if(addr != NULL) - { - // u32 l = readl(&dispc->control); - // l |= GO_LCD | GO_DIG; - // writel(l, &dispc->control); - // printf("write %x to gfx_attibutes: %08x\n", l, &gfx->gfx_attributes); - // writel(l, &gfx->gfx_attributes); - // printf("gfx_ba[0]: %08x\n", &gfx->gfx_ba[0]); - writel((u32) addr, &gfx->gfx_ba[0]); - writel((u32) addr, &gfx->gfx_ba[1]); - // printf("framebuffer address: %08x\n", addr); - writel(0, &gfx->gfx_position); - // printf("size_lcd: %08x\n", readl(&dispc->size_lcd)); - writel(readl(&dispc->size_lcd), &gfx->gfx_size); - writel(0x008c, &gfx->gfx_attributes); // 16x32 bit bursts + RGB16? - writel(((0x3fc << 16) + (0x3bc)), &gfx->gfx_fifo_threshold); // high & low - writel(1024, &gfx->gfx_fifo_size_status); // FIFO size in bytes - writel(1, &gfx->gfx_row_inc); - writel(1, &gfx->gfx_pixel_inc); - writel(0, &gfx->gfx_window_skip); - writel(0x807ff000, &gfx->gfx_table_ba); - omap3_dss_enable_fb(1); -#if DEBUG - { - u32 addr; - for(addr=0x48050010; addr <= 0x48050010; addr+=4) - printf("%08x: %08x\n", addr, readl(addr)); - for(addr=0x48050040; addr <= 0x48050058; addr+=4) - printf("%08x: %08x\n", addr, readl(addr)); - for(addr=0x48050410; addr <= 0x48050414; addr+=4) - printf("%08x: %08x\n", addr, readl(addr)); - for(addr=0x48050444; addr <= 0x4805048c; addr+=4) - printf("%08x: %08x\n", addr, readl(addr)); - for(addr=0x480504a0; addr <= 0x480504b8; addr+=4) - printf("%08x: %08x\n", addr, readl(addr)); - } -#endif - } - else - { // disable - omap3_dss_enable_fb(0); - } - return 0; -} - -int omap3_set_color(u32 color) -{ - struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE; - writel(color, &dispc->default_color0); - omap3_dss_go(); - printf("background color: %06x\n", color); - return 0; -} - -/* - * Display Configuration - */ - -#define DVI_BEAGLE_ORANGE_COL 0x00FF8000 -#define VENC_HEIGHT 0x00ef -#define VENC_WIDTH 0x027f - -/* - * Configure VENC in DSS for Beagle to generate Color Bar - * - * Kindly refer to OMAP TRM for definition of these values. - */ -static const struct venc_regs venc_config_std_tv = { - .status = 0x0000001B, - .f_control = 0x00000040, - .vidout_ctrl = 0x00000000, - .sync_ctrl = 0x00008000, - .llen = 0x00008359, - .flens = 0x0000020C, - .hfltr_ctrl = 0x00000000, - .cc_carr_wss_carr = 0x043F2631, - .c_phase = 0x00000024, - .gain_u = 0x00000130, - .gain_v = 0x00000198, - .gain_y = 0x000001C0, - .black_level = 0x0000006A, - .blank_level = 0x0000005C, - .x_color = 0x00000000, - .m_control = 0x00000001, - .bstamp_wss_data = 0x0000003F, - .s_carr = 0x21F07C1F, - .line21 = 0x00000000, - .ln_sel = 0x00000015, - .l21__wc_ctl = 0x00001400, - .htrigger_vtrigger = 0x00000000, - .savid__eavid = 0x069300F4, - .flen__fal = 0x0016020C, - .lal__phase_reset = 0x00060107, - .hs_int_start_stop_x = 0x008D034E, - .hs_ext_start_stop_x = 0x000F0359, - .vs_int_start_x = 0x01A00000, - .vs_int_stop_x__vs_int_start_y = 0x020501A0, - .vs_int_stop_y__vs_ext_start_x = 0x01AC0024, - .vs_ext_stop_x__vs_ext_start_y = 0x020D01AC, - .vs_ext_stop_y = 0x00000006, - .avid_start_stop_x = 0x03480079, - .avid_start_stop_y = 0x02040024, - .fid_int_start_x__fid_int_start_y = 0x0001008A, - .fid_int_offset_y__fid_ext_start_x = 0x01AC0106, - .fid_ext_start_y__fid_ext_offset_y = 0x01060006, - .tvdetgp_int_start_stop_x = 0x00140001, - .tvdetgp_int_start_stop_y = 0x00010001, - .gen_ctrl = 0x00FF0000, - .output_control = 0x0000000D, - .dac_b__dac_c = 0x00000000 -}; - -/* - * Configure Timings for DVI D - */ -static const struct panel_config dvid_cfg = { - .timing_h = 0x0ff03f31, /* Horizantal timing */ - .timing_v = 0x01400504, /* Vertical timing */ - .pol_freq = 0x00007028, /* Pol Freq */ - .divisor = 0x00010006, /* 72Mhz Pixel Clock */ - .lcd_size = 0x02ff03ff, /* 1024x768 */ - .panel_type = 0x01, /* TFT */ - .data_lines = 0x03, /* 24 Bit RGB */ - .load_mode = 0x02, /* Frame Mode */ - .panel_color = DVI_BEAGLE_ORANGE_COL /* ORANGE */ -}; - -void dssfb_init(void) -{ - omap3_dss_panel_config(&lcm_cfg); // set new config - omap3_dss_enable(); // and (re)enable -} - -/* - * Configure DSS to display background color on DVID - * Configure VENC to display color bar on S-Video - */ -void display_init(void) -{ - omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH); - omap3_dss_panel_config(&dvid_cfg); -} - diff --git a/board/ti/gta04/dssfb.h b/board/ti/gta04/dssfb.h deleted file mode 100644 index b4755dd..0000000 --- a/board/ti/gta04/dssfb.h +++ /dev/null @@ -1,32 +0,0 @@ -/* u-boot driver for the DSS and framebuffer - * - * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG - * Author: H. Nikolaus Schaller <hns@goldelico.com> - * All rights reserved. - * - * 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 - * - */ - -void dssfb_init(void); - -void omap3_dss_go(void); - -int omap3_dss_enable_fb(int flag); - -int omap3_dss_set_fb(void *addr); // set framebuffer address - -int omap3_set_color(u32 color); // set background color diff --git a/board/ti/gta04/gps.c b/board/ti/gta04/gps.c deleted file mode 100644 index d511d50..0000000 --- a/board/ti/gta04/gps.c +++ /dev/null @@ -1,88 +0,0 @@ -/* u-boot driver for the GTA04 LEDs and Buttons - * - * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG - * Author: H. Nikolaus Schaller <hns@goldelico.com> - * All rights reserved. - * - * 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 <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include <ns16550.h> -#include "gps.h" - -#define GPIO_GPSEXT 138 // external GPS antenna plugged in -#define GPIO_GPS_ON 156 - -int gps_init(void) -{ - omap_request_gpio(GPIO_GPS_ON); - omap_set_gpio_direction(GPIO_GPS_ON, 0); // output - omap_request_gpio(GPIO_GPSEXT); - omap_set_gpio_direction(GPIO_GPSEXT, 1); // input - return 0; -} - -void gps_on(void) -{ - omap_set_gpio_dataout(GPIO_GPS_ON, 1); - if(omap_get_gpio_datain(GPIO_GPSEXT)) - printf("external antenna\n"); - else - printf("internal antenna\n"); -} - -void gps_off(void) -{ - omap_set_gpio_dataout(GPIO_GPS_ON, 0); -} - -void gps_echo(void) -{ - #define MODE_X_DIV 16 - int baudrate=9600; - int divisor=(CONFIG_SYS_NS16550_CLK + (baudrate * (MODE_X_DIV / 2))) / (MODE_X_DIV * baudrate); - NS16550_reinit((NS16550_t)CONFIG_SYS_NS16550_COM2, divisor); // initialize UART - while (1) - { // echo in both directions - int ant=omap_get_gpio_datain(GPIO_GPSEXT); - static lastant=-1; - if(ant != lastant) - { // changed - if(ant) - printf("external antenna\n"); - else - printf("internal antenna\n"); - lastant=ant; - } - if(NS16550_tstc((NS16550_t)CONFIG_SYS_NS16550_COM2)) - putc(NS16550_getc((NS16550_t)CONFIG_SYS_NS16550_COM2)); // from GPS to console - // fixme: until we press ctl-C - if(tstc()) - break; // NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM2, getc()); - } - getc(); - printf("\n"); - return 0; -} - diff --git a/board/ti/gta04/gps.h b/board/ti/gta04/gps.h deleted file mode 100644 index 937beb0..0000000 --- a/board/ti/gta04/gps.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _GPS_H -#define _GPS_H - -int gps_init(void); - -void gps_on(void); -void gps_off(void); - -void gps_echo(void); - -#endif diff --git a/board/ti/gta04/jbt6k74.c b/board/ti/gta04/jbt6k74.c deleted file mode 100644 index 8a86b0b..0000000 --- a/board/ti/gta04/jbt6k74.c +++ /dev/null @@ -1,326 +0,0 @@ -/* u-boot driver for the tpo JBT6K74-AS LCM ASIC - * - * Copyright (C) 2006-2007 by OpenMoko, Inc. - * Author: Harald Welte <laforge@openmoko.org> - * All rights reserved. - * - * 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 - * - */ - -/* modified by hns@goldelico.com - * to separate jbt commands from communication (throgh SPI or GPIOs) - */ - -#include <common.h> -#include <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include <asm/arch/dss.h> -#include "dssfb.h" -#include "jbt6k74.h" - -#if 1 -#define DEBUGP(x, args...) printf("%s: " x, __FUNCTION__, ## args); -#define DEBUGPC(x, args...) printf(x, ## args); -#else -#define DEBUGP(x, args...) do { } while (0) -#define DEBUGPC(x, args...) do { } while (0) -#endif - - -enum jbt_register { - JBT_REG_SLEEP_IN = 0x10, - JBT_REG_SLEEP_OUT = 0x11, - - JBT_REG_DISPLAY_OFF = 0x28, - JBT_REG_DISPLAY_ON = 0x29, - - JBT_REG_RGB_FORMAT = 0x3a, - JBT_REG_QUAD_RATE = 0x3b, - - JBT_REG_POWER_ON_OFF = 0xb0, - JBT_REG_BOOSTER_OP = 0xb1, - JBT_REG_BOOSTER_MODE = 0xb2, - JBT_REG_BOOSTER_FREQ = 0xb3, - JBT_REG_OPAMP_SYSCLK = 0xb4, - JBT_REG_VSC_VOLTAGE = 0xb5, - JBT_REG_VCOM_VOLTAGE = 0xb6, - JBT_REG_EXT_DISPL = 0xb7, - JBT_REG_OUTPUT_CONTROL = 0xb8, - JBT_REG_DCCLK_DCEV = 0xb9, - JBT_REG_DISPLAY_MODE1 = 0xba, - JBT_REG_DISPLAY_MODE2 = 0xbb, - JBT_REG_DISPLAY_MODE = 0xbc, - JBT_REG_ASW_SLEW = 0xbd, - JBT_REG_DUMMY_DISPLAY = 0xbe, - JBT_REG_DRIVE_SYSTEM = 0xbf, - - JBT_REG_SLEEP_OUT_FR_A = 0xc0, - JBT_REG_SLEEP_OUT_FR_B = 0xc1, - JBT_REG_SLEEP_OUT_FR_C = 0xc2, - JBT_REG_SLEEP_IN_LCCNT_D = 0xc3, - JBT_REG_SLEEP_IN_LCCNT_E = 0xc4, - JBT_REG_SLEEP_IN_LCCNT_F = 0xc5, - JBT_REG_SLEEP_IN_LCCNT_G = 0xc6, - - JBT_REG_GAMMA1_FINE_1 = 0xc7, - JBT_REG_GAMMA1_FINE_2 = 0xc8, - JBT_REG_GAMMA1_INCLINATION = 0xc9, - JBT_REG_GAMMA1_BLUE_OFFSET = 0xca, - - JBT_REG_BLANK_CONTROL = 0xcf, - JBT_REG_BLANK_TH_TV = 0xd0, - JBT_REG_CKV_ON_OFF = 0xd1, - JBT_REG_CKV_1_2 = 0xd2, - JBT_REG_OEV_TIMING = 0xd3, - JBT_REG_ASW_TIMING_1 = 0xd4, - JBT_REG_ASW_TIMING_2 = 0xd5, - - JBT_REG_HCLOCK_VGA = 0xec, - JBT_REG_HCLOCK_QVGA = 0xed, - -}; - -static const char *jbt_state_names[] = { - [JBT_STATE_DEEP_STANDBY] = "deep-standby", - [JBT_STATE_SLEEP] = "sleep", - [JBT_STATE_NORMAL] = "normal", -}; - -static struct jbt_info _jbt, *jbt = &_jbt; - -const char *jbt_state(void) -{ - return jbt_state_names[jbt->state]; -} - -static int jbt_init_regs(struct jbt_info *jbt) -{ - int rc; - - DEBUGP("entering\n"); - - rc = jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE1, 0x01); - rc |= jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE2, 0x00); - rc |= jbt_reg_write(jbt, JBT_REG_RGB_FORMAT, 0x60); - rc |= jbt_reg_write(jbt, JBT_REG_DRIVE_SYSTEM, 0x10); - rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_OP, 0x56); - rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_MODE, 0x33); - rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_FREQ, 0x11); - rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_FREQ, 0x11); - rc |= jbt_reg_write(jbt, JBT_REG_OPAMP_SYSCLK, 0x02); - rc |= jbt_reg_write(jbt, JBT_REG_VSC_VOLTAGE, 0x2b); - rc |= jbt_reg_write(jbt, JBT_REG_VCOM_VOLTAGE, 0x40); - rc |= jbt_reg_write(jbt, JBT_REG_EXT_DISPL, 0x03); - rc |= jbt_reg_write(jbt, JBT_REG_DCCLK_DCEV, 0x04); - /* - * default of 0x02 in JBT_REG_ASW_SLEW responsible for 72Hz requirement - * to avoid red / blue flicker - */ - rc |= jbt_reg_write(jbt, JBT_REG_ASW_SLEW, 0x04); - rc |= jbt_reg_write(jbt, JBT_REG_DUMMY_DISPLAY, 0x00); - - rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_A, 0x11); - rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_B, 0x11); - rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_C, 0x11); - rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_D, 0x2040); - rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_E, 0x60c0); - rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_F, 0x1020); - rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_G, 0x60c0); - - rc |= jbt_reg_write16(jbt, JBT_REG_GAMMA1_FINE_1, 0x5533); - rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_FINE_2, 0x00); - rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_INCLINATION, 0x00); - rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_BLUE_OFFSET, 0x00); - rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_BLUE_OFFSET, 0x00); - - rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_VGA, 0x1f0); - rc |= jbt_reg_write(jbt, JBT_REG_BLANK_CONTROL, 0x02); - rc |= jbt_reg_write16(jbt, JBT_REG_BLANK_TH_TV, 0x0804); - rc |= jbt_reg_write16(jbt, JBT_REG_BLANK_TH_TV, 0x0804); - - rc |= jbt_reg_write(jbt, JBT_REG_CKV_ON_OFF, 0x01); - rc |= jbt_reg_write16(jbt, JBT_REG_CKV_1_2, 0x0000); - - rc |= jbt_reg_write16(jbt, JBT_REG_OEV_TIMING, 0x0d0e); - rc |= jbt_reg_write16(jbt, JBT_REG_ASW_TIMING_1, 0x11a4); - rc |= jbt_reg_write(jbt, JBT_REG_ASW_TIMING_2, 0x0e); - -#if 0 - rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_QVGA, 0x00ff); - rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_QVGA, 0x00ff); -#endif - - if(rc) - printf("jbt_init_regs() failed\n"); - else - printf("did jbt_init_regs()\n"); - return rc; -} - -static int standby_to_sleep(struct jbt_info *jbt) -{ - int rc; - - DEBUGP("entering\n"); - - /* three times command zero */ - rc = jbt_reg_write_nodata(jbt, 0x00); - udelay(1000); - rc = jbt_reg_write_nodata(jbt, 0x00); - udelay(1000); - rc = jbt_reg_write_nodata(jbt, 0x00); - udelay(1000); - - /* deep standby out */ - rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17); - - return rc; -} - -static int sleep_to_normal(struct jbt_info *jbt) -{ - int rc; - DEBUGP("entering\n"); - - /* RGB I/F on, RAM wirte off, QVGA through, SIGCON enable */ - rc = jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE, 0x80); - - /* Quad mode off */ - rc |= jbt_reg_write(jbt, JBT_REG_QUAD_RATE, 0x00); - - /* AVDD on, XVDD on */ - rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x16); - - /* Output control */ - rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0xfff9); - - /* Sleep mode off */ - rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_OUT); - - /* at this point we have like 50% grey */ - - /* initialize register set */ - rc |= jbt_init_regs(jbt); - return rc; -} - -static int normal_to_sleep(struct jbt_info *jbt) -{ - int rc; - DEBUGP("entering\n"); - - rc = jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF); - rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0x8002); - rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_IN); - - return rc; -} - -static int sleep_to_standby(struct jbt_info *jbt) -{ - DEBUGP("entering\n"); - return jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x00); -} - -/* frontend function */ -int jbt6k74_enter_state(enum jbt_state new_state) -{ - int rc = -EINVAL; - - DEBUGP("entering(old_state=%u, new_state=%u)\n", jbt->state, new_state); - - switch (jbt->state) { - case JBT_STATE_DEEP_STANDBY: - switch (new_state) { - case JBT_STATE_DEEP_STANDBY: - rc = 0; - break; - case JBT_STATE_SLEEP: - rc = standby_to_sleep(jbt); - break; - case JBT_STATE_NORMAL: - /* first transition into sleep */ - rc = standby_to_sleep(jbt); - /* then transition into normal */ - rc |= sleep_to_normal(jbt); - break; - } - break; - case JBT_STATE_SLEEP: - switch (new_state) { - case JBT_STATE_SLEEP: - rc = 0; - break; - case JBT_STATE_DEEP_STANDBY: - rc = sleep_to_standby(jbt); - break; - case JBT_STATE_NORMAL: - rc = sleep_to_normal(jbt); - break; - } - break; - case JBT_STATE_NORMAL: - switch (new_state) { - case JBT_STATE_NORMAL: - rc = 0; - break; - case JBT_STATE_DEEP_STANDBY: - /* first transition into sleep */ - rc = normal_to_sleep(jbt); - /* then transition into deep standby */ - rc |= sleep_to_standby(jbt); - break; - case JBT_STATE_SLEEP: - rc = normal_to_sleep(jbt); - break; - } - break; - } - if(rc) - printf("jbt6k74_enter_state() failed.\n"); - else - jbt->state=new_state; - return rc; -} - -int jbt6k74_display_onoff(int on) -{ - DEBUGP("entering\n"); - if (on) - return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON); - else - return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF); -} - -int board_video_init(GraphicDevice *pGD) -{ - if(jbt_reg_init()) // initialize SPI - { - printf("No LCM connected\n"); - return 1; - } - dssfb_init(); - backlight_init(); // initialize backlight - - printf("did board_video_init()\n"); - return 0; -} - diff --git a/board/ti/gta04/jbt6k74.h b/board/ti/gta04/jbt6k74.h deleted file mode 100644 index 170873f..0000000 --- a/board/ti/gta04/jbt6k74.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _JBT6K74_H -#define _JBT6K74_H - -#include <video_fb.h> -#include "TD028TTEC1.h" -#include "backlight.h" - -enum jbt_state { - JBT_STATE_DEEP_STANDBY, - JBT_STATE_SLEEP, - JBT_STATE_NORMAL, -}; - -int jbt6k74_display_onoff(int on); -int jbt6k74_enter_state(enum jbt_state new_state); -const char *jbt_state(void); -int board_video_init(GraphicDevice *pGD); - -#endif diff --git a/board/ti/gta04/status.c b/board/ti/gta04/status.c deleted file mode 100644 index db2f65e..0000000 --- a/board/ti/gta04/status.c +++ /dev/null @@ -1,143 +0,0 @@ -/* u-boot driver for the GTA04 LEDs and Buttons - * - * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG - * Author: H. Nikolaus Schaller <hns@goldelico.com> - * All rights reserved. - * - * 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 <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include "status.h" - -static int isGTA04 = 0; - -// we can't include "beagle.h" -/* BeagleBoard revisions */ -extern int get_board_revision(void); -#define REVISION_AXBX 0x7 -#define REVISION_CX 0x6 -#define REVISION_C4 0x5 -#define REVISION_XM 0x0 - -static int isXM = 0; - -// Note: on GTA04 the LEDs will be connected to TCA8418 and controlled through I2C -// Note: BB-XM has scrambled DSS assignment - -#define GPIO_LED_AUX_RED (isXM?88:70) // AUX -#define GPIO_LED_AUX_GREEN (isXM?89:71) // AUX -#define GPIO_LED_POWER_RED 78 // Power -#define GPIO_LED_POWER_GREEN 79 // Power -#define GPIO_LED_VIBRA (isXM?2:88) // Vibracall motor -#define GPIO_LED_UNUSED (isXM?3:89) // unused - -// Note: on GTA04 the GPIOs will be assigned differently and the state of the POWER button is only available through the TPS65950 - -#define GPIO_AUX (isGTA04?136:136) -#define GPIO_POWER 137 -#define GPIO_GPSEXT (isGTA04?138:138) // external GPS antenna is plugged in -#define GPIO_PENIRQ (isGTA04?157:157) // TSC must be set up to provide PENIRQ - -void led_set_led(int value) -{ - if(!isGTA04) { - omap_set_gpio_dataout(GPIO_LED_AUX_RED, (value&(1 << 0))); - omap_set_gpio_dataout(GPIO_LED_AUX_GREEN, (value&(1 << 1))); - omap_set_gpio_dataout(GPIO_LED_POWER_RED, (value&(1 << 3))); - omap_set_gpio_dataout(GPIO_LED_POWER_GREEN, (value&(1 << 4))); - omap_set_gpio_dataout(GPIO_LED_VIBRA, (value&(1 << 6))); - omap_set_gpio_dataout(GPIO_LED_UNUSED, (value&(1 << 7))); - } - else { - // initialize i2c controller - } -} - -int led_get_buttons(void) -{ // convert button state into led state - if(isGTA04) { - // read GPIOs and TPS65950 - } - return - ((!omap_get_gpio_datain(GPIO_AUX)) << 0) | - ((omap_get_gpio_datain(GPIO_GPSEXT)) << 1) | - ((!omap_get_gpio_datain(GPIO_POWER)) << 3) | - ((omap_get_gpio_datain(GPIO_PENIRQ)) << 4); -} - -int led_init(void) -{ - isXM = (get_board_revision() == REVISION_XM); - - if(!isGTA04) { - if(isXM) { // XM has scrambled dss assignment with respect to default ball name - MUX_VAL(CP(DSS_DATA18), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA19), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA8), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA9), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(SYS_BOOT0), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(SYS_BOOT1), (IEN | PTD | EN | M4)); /*GPIO */ - } - else { - MUX_VAL(CP(DSS_DATA0), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA1), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA8), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA9), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA16), (IEN | PTD | EN | M4)); /*GPIO */ - MUX_VAL(CP(DSS_DATA17), (IEN | PTD | EN | M4)); /*GPIO */ - } - - omap_request_gpio(GPIO_LED_AUX_GREEN); - omap_request_gpio(GPIO_LED_AUX_RED); - omap_request_gpio(GPIO_LED_POWER_GREEN); - omap_request_gpio(GPIO_LED_POWER_RED); - omap_request_gpio(GPIO_LED_VIBRA); - omap_request_gpio(GPIO_LED_UNUSED); - } - - omap_request_gpio(GPIO_AUX); - omap_request_gpio(GPIO_POWER); - omap_request_gpio(GPIO_GPSEXT); - omap_request_gpio(GPIO_PENIRQ); - - if(!isGTA04) { - omap_set_gpio_direction(GPIO_LED_AUX_GREEN, 0); // output - omap_set_gpio_direction(GPIO_LED_AUX_RED, 0); // output - omap_set_gpio_direction(GPIO_LED_POWER_GREEN, 0); // output - omap_set_gpio_direction(GPIO_LED_POWER_RED, 0); // output - omap_set_gpio_direction(GPIO_LED_VIBRA, 0); // output - omap_set_gpio_direction(GPIO_LED_UNUSED, 0); // output - } - - omap_set_gpio_direction(GPIO_AUX, 1); // input - omap_set_gpio_direction(GPIO_POWER, 1); // input - omap_set_gpio_direction(GPIO_AUX, 1); // input - omap_set_gpio_direction(GPIO_GPSEXT, 1); // input - - // when sould we do omap_free_gpio(GPIO_LED_AUX_GREEN); - printf("did led_init()\n"); - - return 0; -} - diff --git a/board/ti/gta04/status.h b/board/ti/gta04/status.h deleted file mode 100644 index 4e80753..0000000 --- a/board/ti/gta04/status.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _LED_H -#define _LED_H - -int led_init(void); - -void led_set_led(int value); -int led_get_buttons(void); - -#endif diff --git a/board/ti/gta04/tsc2007.c b/board/ti/gta04/tsc2007.c deleted file mode 100644 index 72e64bf..0000000 --- a/board/ti/gta04/tsc2007.c +++ /dev/null @@ -1,143 +0,0 @@ -/* u-boot driver for the TSC2007 connected to I2C2 - * - * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG - * Author: H. Nikolaus Schaller <hns@goldelico.com> - * All rights reserved. - * - * 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 <asm/errno.h> -#include <asm/io.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/gpio.h> -#include <asm/mach-types.h> -#include <i2c.h> -#include "tsc2007.h" - -#define TSC2007_BUS 2 // I2C2 -#define TSC2007_ADDRESS 0x48 - -// command byte definitions: -// channel selection and power down - -#define TSC2007_TEMP0 0x00 -#define TSC2007_AUX 0x20 -#define TSC2007_TEMP1 0x40 -#define TSC2007_ACTX 0x80 -#define TSC2007_ACTY 0x90 -#define TSC2007_ACTXY 0xA0 -#define TSC2007_X 0xc0 -#define TSC2007_Y 0xd0 -#define TSC2007_Z1 0xe0 -#define TSC2007_Z2 0xf0 - -#define TSC2007_POWER_DOWN 0x00 // must be sent once after power up -#define TSC2007_ADC_ON 0x04 -#define TSC2007_ADC_OFF_PENIRQ 0x08 - -#define TSC2007_12Bit2MHz 0x00 -#define TSC2007_8Bit4MHz 0x02 - -// setup command - -#define TSC2007_SETUP 0xb0 - -#define TSC2007_USE_MAV 0x00 -#define TSC2007_BYPASS_MAV 0x02 - -#define TSC2007_50kPUP 0x00 -#define TSC2007_90kPUP 0x01 - -/* - int i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len) - int i2c_write(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len) -*/ - -int tsc2007_cmd(int cmd) -{ // send command - unsigned char buf[16]; - buf[0]=cmd; - if (i2c_write(TSC2007_ADDRESS, cmd, 1, buf, 0)) // write 1 byte command - { - printf ("Error writing the TSC.\n"); - return 1; - } - return 0; -} - -int tsc2007_init(void) -{ - int rc=0; - if(i2c_set_bus_num(TSC2007_BUS-1)) - { - printf ("could not select I2C2\n"); - return 1; - } - - rc = tsc2007_cmd(TSC2007_SETUP|TSC2007_USE_MAV|TSC2007_50kPUP); - rc |= tsc2007_cmd(TSC2007_POWER_DOWN); - - if(rc) - printf("did tsc2007_init() failed.\n"); - else - printf("did tsc2007_init()\n"); - - return 0; -} - -int read_adc(int adcnum) -{ // read ADC and return value in range 0..4095 - unsigned char c; - unsigned char buf[16]; - static int cmd[]={ - TSC2007_X, - TSC2007_Y, - TSC2007_Z1, - TSC2007_Z2, - TSC2007_TEMP0, - TSC2007_TEMP1, - TSC2007_AUX, - TSC2007_AUX - }; - c=cmd[adcnum%8] | TSC2007_ADC_ON | TSC2007_12Bit2MHz; -// printf("send %02x\n", c); - if (i2c_read(TSC2007_ADDRESS, c, 1, buf, 1)) - { - printf ("Error reading the TSC.\n"); - return -1; - } - return ((unsigned)buf[0]) << 4; // read 1 byte only - -// return (buf[0]<<4)+(buf[1]>>4); // 12 bit -} - -void print_adc(void) -{ - printf("0:%04u 1:%04u 2:%04u 3:%04u 4:%04u 5:%04u 6:%04u 7:%04u", - read_adc(0), - read_adc(1), - read_adc(2), - read_adc(3), - read_adc(4), - read_adc(5), - read_adc(6), - read_adc(7)); -} - diff --git a/board/ti/gta04/tsc2007.h b/board/ti/gta04/tsc2007.h deleted file mode 100644 index fc85159..0000000 --- a/board/ti/gta04/tsc2007.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _TSC2007_H -#define _TSC2007_H - -int tsc2007_init(void); -int read_adc(int adcnum); -void print_adc(void); - -#endif |