diff options
author | H. Nikolaus Schaller <hns@goldelico.com> | 2010-12-20 15:57:35 +0100 |
---|---|---|
committer | H. Nikolaus Schaller <hns@goldelico.com> | 2010-12-20 15:57:35 +0100 |
commit | faf6e26641941a22353b169a6e7dd5845e5bb685 (patch) | |
tree | f8b25634603bd56b2b44e398dc5506213881019d /board | |
parent | 6ee5bbdcc8e0605537d7a2a66e38812213e6c632 (diff) | |
download | bootable_bootloader_goldelico_gta04-faf6e26641941a22353b169a6e7dd5845e5bb685.zip bootable_bootloader_goldelico_gta04-faf6e26641941a22353b169a6e7dd5845e5bb685.tar.gz bootable_bootloader_goldelico_gta04-faf6e26641941a22353b169a6e7dd5845e5bb685.tar.bz2 |
fixed some minor issues and added readout of PWRON-Button status
Diffstat (limited to 'board')
-rw-r--r-- | board/goldelico/gta04/commands.c | 4 | ||||
-rw-r--r-- | board/goldelico/gta04/gta04.c | 4 | ||||
-rw-r--r-- | board/goldelico/gta04/status.c | 7 | ||||
-rw-r--r-- | board/goldelico/gta04/systest.c | 48 |
4 files changed, 56 insertions, 7 deletions
diff --git a/board/goldelico/gta04/commands.c b/board/goldelico/gta04/commands.c index 17b1ac7..f3ddedd 100644 --- a/board/goldelico/gta04/commands.c +++ b/board/goldelico/gta04/commands.c @@ -210,7 +210,7 @@ static int pendown(int *x, int *y) return z > 200; // was pressed #else // must be in PENIRQ mode... - return (led_get_buttons() & 0x08) == 0; + return (led_get_buttons() & (1 << 4)) == 0; #endif } @@ -309,7 +309,7 @@ static int do_led_init(int argc, char *const argv[]) 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"); + printf("AUX: %s Power: %s Antenna: %s Pen: %s", (status&0x01)?"on":"off", (status&0x08)?"on":"off", (status&0x02)?"EXT":"INT", (status&0x10)?"1":"0"); } static int do_led_check(int argc, char *const argv[]) diff --git a/board/goldelico/gta04/gta04.c b/board/goldelico/gta04/gta04.c index 845c7bc..fa9e9d0 100644 --- a/board/goldelico/gta04/gta04.c +++ b/board/goldelico/gta04/gta04.c @@ -278,7 +278,9 @@ int misc_init_r(void) #endif twl4030_power_init(); -// twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); // we have no LEDs on TPS on GTA04 +#ifndef CONFIG_OMAP3_GTA04A2 // we have no LEDs on TPS on GTA04 + twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); +#endif /* Configure GPIOs to output */ writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe); diff --git a/board/goldelico/gta04/status.c b/board/goldelico/gta04/status.c index 01b2881..db2a5c2 100644 --- a/board/goldelico/gta04/status.c +++ b/board/goldelico/gta04/status.c @@ -29,6 +29,7 @@ #include <asm/arch/gpio.h> #include <asm/mach-types.h> #include <i2c.h> +#include <twl4030.h> #include "status.h" #ifdef CONFIG_OMAP3_GTA04 @@ -94,6 +95,7 @@ void led_set_led(int value) } else { value &= 0x3f; // 6 LEDs only - 7th is reserved to reset the WLAN/BT chip + i2c_set_bus_num(1); // write I2C2 // we could write a autoincrement address and all 3 bytes in a single message // we could set the TCA to do smooth transitions i2c_reg_write(TCA6507_ADDRESS, TCA6507_SELECT0, 0); @@ -105,9 +107,12 @@ void led_set_led(int value) int led_get_buttons(void) { // convert button state into led state if(isGTA04) { - // should read power button state from TPS65950 + u8 val; + i2c_set_bus_num(0); // read I2C1 + twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val, TWL4030_PM_MASTER_STS_HW_CONDITIONS); // read state of power button (bit 0) from TPS65950 return ((omap_get_gpio_datain(GPIO_AUX)) << 0) | ((omap_get_gpio_datain(GPIO_GPSEXT)) << 1) | + (((val&0x01) != 0) << 3) | ((omap_get_gpio_datain(GPIO_PENIRQ)) << 4); } return diff --git a/board/goldelico/gta04/systest.c b/board/goldelico/gta04/systest.c index 0f2043b..7657910 100644 --- a/board/goldelico/gta04/systest.c +++ b/board/goldelico/gta04/systest.c @@ -33,10 +33,52 @@ #include "systest.h" int systest(void) -{ - // do mixture of gps_echo, tsc_loop, status mirror status blink +{ // do mixture of gps_echo, tsc_loop, status mirror status blink + int r; i2c_set_bus_num(0); // I2C1 - printf("TPS65950: %s\n", i2c_probe(TWL4030_CHIP_USB)?"-":"found"); // responds on 4 addresses 0x48..0x4b + printf("TPS65950: %s\n", (r=i2c_probe(TWL4030_CHIP_USB))?"-":"found"); // responds on 4 addresses 0x48..0x4b + if(!r) + { // was ok, ask for details + u8 val; + u8 val2; + twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val, TWL4030_PM_MASTER_STS_HW_CONDITIONS); + printf(" STS_HW_CND: %02x", val); // decode bits + if(val & 0x80) printf(" VBUS"); + if(val & 0x08) printf(" NRESWARM"); + if(val & 0x04) printf(" USB"); + if(val & 0x02) printf(" CHG"); + if(val & 0x01) printf(" PWRON"); + printf("\n"); + twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val, 0x2e); + printf(" PWR_ISR: %02x", val); + // decode bits + printf("\n"); + twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &val, TWL4030_PM_MASTER_SC_DETECT1); + printf(" SC_DETECT: 1:%02x", val); + twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &val, TWL4030_PM_MASTER_SC_DETECT1); + printf(" 2:%02x\n", val); + twl4030_i2c_read_u8(TWL4030_CHIP_MAIN_CHARGE, &val, 0x82); + printf(" BCIMFSTS2: %02x\n", val); + twl4030_i2c_read_u8(TWL4030_CHIP_MAIN_CHARGE, &val, 0x83); + printf(" BCIMFSTS3: %02x\n", val); + twl4030_i2c_read_u8(TWL4030_CHIP_MAIN_CHARGE, &val, 0x84); + printf(" BCIMFSTS4: %02x\n", val); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val, 0x57); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val2, 0x58); + printf(" BTEMP: %d\n", (val2<<2)+(val>>6)); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val, 0x59); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val2, 0x5a); + printf(" USBVBUS: %d\n", (val2<<2)+(val>>6)); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val, 0x5b); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val2, 0x5c); + printf(" ICHG: %d\n", (val2<<2)+(val>>6)); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val, 0x5d); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val2, 0x5e); + printf(" VCHG: %d\n", (val2<<2)+(val>>6)); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val, 0x5f); + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, &val2, 0x60); + printf(" VBAT: %d\n", (val2<<2)+(val>>6)); + } i2c_set_bus_num(1); // I2C2 printf("TSC2007: %s\n", i2c_probe(0x48)?"-":"found"); printf("TCA6507: %s\n", i2c_probe(0x45)?"-":"found"); |