diff options
author | H. Nikolaus Schaller <hns@goldelico.com> | 2011-02-24 13:10:59 +0100 |
---|---|---|
committer | H. Nikolaus Schaller <hns@goldelico.com> | 2011-02-24 13:10:59 +0100 |
commit | 15ad01487ec97c01ddd8e8a52675c2c6ce1a818b (patch) | |
tree | 436fddffbefba661fb5899c324d2cf92d8b0af74 | |
parent | df3931f8429a58b199597b084a66fbbee751c0e6 (diff) | |
download | bootable_bootloader_goldelico_gta04-15ad01487ec97c01ddd8e8a52675c2c6ce1a818b.zip bootable_bootloader_goldelico_gta04-15ad01487ec97c01ddd8e8a52675c2c6ce1a818b.tar.gz bootable_bootloader_goldelico_gta04-15ad01487ec97c01ddd8e8a52675c2c6ce1a818b.tar.bz2 |
added some more systest commands
-rw-r--r-- | board/goldelico/gta04/commands.c | 128 | ||||
-rw-r--r-- | board/goldelico/gta04/status.c | 35 | ||||
-rw-r--r-- | board/goldelico/gta04/status.h | 13 | ||||
-rw-r--r-- | board/goldelico/gta04/systest.c | 11 | ||||
-rw-r--r-- | include/configs/omap3_beagleexpander.h | 35 | ||||
-rw-r--r-- | include/configs/omap3_beaglehyb.h | 6 |
6 files changed, 177 insertions, 51 deletions
diff --git a/board/goldelico/gta04/commands.c b/board/goldelico/gta04/commands.c index cb85b4c..339857c 100644 --- a/board/goldelico/gta04/commands.c +++ b/board/goldelico/gta04/commands.c @@ -1,4 +1,4 @@ -/* u-boot extended commands for GTA04 +/* u-boot extended commands for flash * * Copyright (C) 2010 by Golden Delicious Computers GmbH&Co. KG * Author: H. Nikolaus Schaller <hns@goldelico.com> @@ -181,7 +181,7 @@ static int do_tsc_loop(int argc, char *const argv[]) { printf("permanently reading ADCs of TSC.\n" "Press any key to stop\n\n"); - while (!tstc() && (led_get_buttons()&0x09) == 0) + while (!tstc() && (status_get_buttons()&0x09) == 0) { print_adc(); printf("\r"); @@ -194,11 +194,11 @@ static int do_tsc_loop(int argc, char *const argv[]) static int do_tsc_gloop(int argc, char *const argv[]) { - unsigned short *fb=0x81000000; // RGB16 + unsigned short *fb=(void *) 0x81000000; // base address to be used as RGB16 framebuffer printf("permanently reading ADCs of TSC to framebuffer.\n" "Press any key to stop\n\n"); omap3_dss_set_fb(fb); - while (!tstc() && (led_get_buttons()&0x09) == 0) + while (!tstc() && (status_get_buttons()&0x09) == 0) { int i; for(i=0; i<8; i++) @@ -253,7 +253,7 @@ static int pendown(int *x, int *y) return z > 200; // was pressed #else // must be in PENIRQ mode... - return (led_get_buttons() & (1 << 4)) == 0; + return (status_get_buttons() & (1 << 4)) == 0; #endif } @@ -312,7 +312,7 @@ static int do_tsc(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) int len; if (argc < 2) { - printf ("led: missing subcommand.\n"); + printf ("tsc: missing subcommand.\n"); return (-1); } @@ -346,11 +346,11 @@ U_BOOT_CMD(tsc, 4, 0, do_tsc, "TSC2007 sub-system", "se[lection] p - check if item p (1 .. cols*rows) was selected\n" ); -/** LED commands */ +/** Status commands */ -static int do_led_init(int argc, char *const argv[]) +static int do_status_init(int argc, char *const argv[]) { - led_init(); + status_init(); return 0; } @@ -359,48 +359,48 @@ static void print_buttons(int status) 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[]) +static int do_status_check(int argc, char *const argv[]) { // can be used in if construct - int state=led_get_buttons(); + int state=status_get_buttons(); if (argc < 3) { - printf ("led check: missing mask.\n"); + printf ("status 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 *const argv[]) +static int do_status_get(int argc, char *const argv[]) { - int status=led_get_buttons(); + int status=status_get_buttons(); printf("button status: %02x\n", status); print_buttons(status); printf("\n"); return 0; } -static int do_led_set(int argc, char *const argv[]) -{ // led set hh +static int do_status_set(int argc, char *const argv[]) +{ // status set hh static int state; if(argc == 2) state++; else state=simple_strtoul(argv[2], NULL, 16); - led_set_led(state); + status_set_status(state); return 0; } -static int do_led_loop(int argc, char *const argv[]) +static int do_status_loop(int argc, char *const argv[]) { printf("mirroring buttons to LEDs.\n" "Press any key to stop\n\n"); while (!tstc() && !pendown(NULL, NULL)) { - int state=led_get_buttons(); + int state=status_get_buttons(); print_buttons(state); printf("\r"); - led_set_led(state); // mirror to LEDs + status_set_status(state); // mirror to LEDs udelay(100000); // 0.1 seconds } if(tstc()) @@ -409,14 +409,14 @@ static int do_led_loop(int argc, char *const argv[]) return 0; } -static int do_led_blink(int argc, char *const argv[]) +static int do_status_blink(int argc, char *const 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 + status_set_status(value++); // mirror to LEDs udelay(100000); // 0.1 seconds } if(tstc()) @@ -424,43 +424,95 @@ static int do_led_blink(int argc, char *const argv[]) return 0; } -static int do_led(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +static int do_status_flash(int argc, char *const argv[]) +{ + int len; + + if (argc < 3) { + printf ("status flash: missing subcommand.\n"); + return (-1); + } + + len = strlen (argv[2]); + if (strncmp ("of", argv[2], 2) == 0) { + return status_set_flash (0); + } else if (strncmp ("on", argv[2], 2) == 0) { + return status_set_flash (1); + } else if (strncmp ("fl", argv[2], 2) == 0) { + return status_set_flash (2); + } else { + printf ("status: unknown operation: %s\n", argv[1]); + return 1; + } + return (0); +} + +static int do_status_vibra(int argc, char *const argv[]) +{ + int len; + + if (argc < 3) { + printf ("status flash: missing subcommand.\n"); + return (-1); + } + + len = strlen (argv[2]); + if (strncmp ("of", argv[2], 2) == 0) { + return status_set_vibra (0); + } else if (strncmp ("on", argv[2], 2) == 0) { + return status_set_vibra (1); + } else if (strncmp ("fl", argv[2], 2) == 0) { + return status_set_vibra (2); + } else { + printf ("status: unknown operation: %s\n", argv[1]); + return 1; + } + return (0); +} + +static int do_status(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { int len; if (argc < 2) { - printf ("led: missing subcommand.\n"); + printf ("status: missing subcommand.\n"); return (-1); } len = strlen (argv[1]); if (strncmp ("ge", argv[1], 2) == 0) { - return do_led_get (argc, argv); + return do_status_get (argc, argv); } else if (strncmp ("se", argv[1], 2) == 0) { - return do_led_set (argc, argv); + return do_status_set (argc, argv); } else if (strncmp ("mi", argv[1], 2) == 0) { - return do_led_loop (argc, argv); + return do_status_loop (argc, argv); } else if (strncmp ("bl", argv[1], 2) == 0) { - return do_led_blink (argc, argv); + return do_status_blink (argc, argv); } else if (strncmp ("in", argv[1], 2) == 0) { - return do_led_init (argc, argv); + return do_status_init (argc, argv); } else if (strncmp ("ch", argv[1], 2) == 0) { - return do_led_check (argc, argv); + return do_status_check (argc, argv); + } else if (strncmp ("fl", argv[1], 2) == 0) { + return do_status_flash (argc, argv); + } else if (strncmp ("vi", argv[1], 2) == 0) { + return do_status_vibra (argc, argv); } else { - printf ("led: unknown operation: %s\n", argv[1]); + printf ("status: 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" +U_BOOT_CMD(status, 3, 0, do_status, "LED and Buttons sub-system", + "in[it] - initialize GPIOs\n" + "ge[t] - print button status\n" + "ch[eck] - check button status\n" + "se[t] value - set LEDs state\n" + "mi[rror] - read buttons and mirror to LEDs\n" + "bl[ink] - blink LEDs\n" + "fl[ash] of[f] | on | fl[ash] - switch torch / flashlight\n" + "vi[bra] of[f] | le[ft] | ri[ght] - switch vibracall motor\n" ); /** GPS commands */ diff --git a/board/goldelico/gta04/status.c b/board/goldelico/gta04/status.c index afb4488..8d0dba1 100644 --- a/board/goldelico/gta04/status.c +++ b/board/goldelico/gta04/status.c @@ -43,6 +43,7 @@ static int hasTCA6507=0; #endif +#define TWL4030_I2C_BUS 1 // I2C1 #define TCA6507_BUS 2 // I2C2 #define TCA6507_ADDRESS 0x45 @@ -101,7 +102,7 @@ static int isXM = 0; #define GPIO_LED_VIBRA (isXM?2:88) // Vibracall motor #define GPIO_LED_UNUSED (isXM?3:89) // unused -void led_set_led(int value) +void status_set_status(int value) { if(!hasTCA6507) { omap_set_gpio_dataout(GPIO_LED_AUX_RED, (value&(1 << 0))); @@ -113,7 +114,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 + i2c_set_bus_num(TCA6507_BUS-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); @@ -122,11 +123,11 @@ void led_set_led(int value) } } -int led_get_buttons(void) +int status_get_buttons(void) { // convert button state into led state #if defined(CONFIG_OMAP3_GTA04) u8 val; - i2c_set_bus_num(0); // read I2C1 + i2c_set_bus_num(TWL4030_I2C_BUS-1); // 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) | @@ -147,7 +148,7 @@ int led_get_buttons(void) #endif } -int led_init(void) +int status_init(void) { isXM = (get_board_revision() == REVISION_XM); #if !defined(CONFIG_OMAP3_GTA04) @@ -214,3 +215,27 @@ int led_init(void) return 0; } + +int status_set_flash (int mode) +{ // 0: off, 1: torch, 2: flash + if(i2c_set_bus_num(TCA6507_BUS-1)) + { + printf ("could not select I2C2\n"); + return 1; + } + // initialize if needed + // set flash controller mode + return 0; +} + +int status_set_vibra (int mode) +{ // 0: off, 1: left, 2: right + if(i2c_set_bus_num(TWL4030_I2C_BUS-1)) + { + printf ("could not select I2C1\n"); + return 1; + } + // initialize if needed + // set vibra controller mode + return 0; +} diff --git a/board/goldelico/gta04/status.h b/board/goldelico/gta04/status.h index 4e80753..d60fc8a 100644 --- a/board/goldelico/gta04/status.h +++ b/board/goldelico/gta04/status.h @@ -1,9 +1,12 @@ -#ifndef _LED_H -#define _LED_H +#ifndef _STATUS_H +#define _STATUS_H -int led_init(void); +int status_init (void); -void led_set_led(int value); -int led_get_buttons(void); +void status_set_status (int value); +int status_get_buttons (void); + +int status_set_flash (int mode); // 0: off, 1: torch, 2: flash +int status_set_vibra (int mode); // 0: off, 1: left, 2: right #endif diff --git a/board/goldelico/gta04/systest.c b/board/goldelico/gta04/systest.c index 480fcb4..7d16350 100644 --- a/board/goldelico/gta04/systest.c +++ b/board/goldelico/gta04/systest.c @@ -37,7 +37,7 @@ int systest(void) { // do mixture of gps_echo, tsc_loop, status mirror status blink int r; i2c_set_bus_num(0); // I2C1 - printf("TPS65950: %s\n", (r=!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; @@ -86,11 +86,15 @@ int systest(void) printf("LIS302 TOP: %s\n", !i2c_probe(0x1c)?"found":"-"); printf("LIS302 BOTTOM: %s\n", !i2c_probe(0x1d)?"found":"-"); printf("LSM303: %s\n", !i2c_probe(0x19)?"found":"-"); - printf("HMC5843: %s\n", !i2c_probe(0x1e)?"found":"-"); + printf("HMC58xx: %s\n", !i2c_probe(0x1e)?"found":"-"); + printf("BMA180: %s\n", !i2c_probe(0x41)?"found":"-"); printf("BMP085: %s\n", !i2c_probe(0x77)?"found":"-"); printf("ITG3200: %s\n", !i2c_probe(0x68)?"found":"-"); - printf("Si4721: %s\n", !i2c_probe(0x21)?"found":"-"); + printf("Si47xx: %s\n", !i2c_probe(0x21)?"found":"-"); printf("TCA8418: %s\n", !i2c_probe(0x64)?"found":"-"); + printf("OV9655: %s\n", !i2c_probe(0x30)?"found":"-"); + printf("TPS61050: %s\n", !i2c_probe(0x33)?"found":"-"); + printf("EEPROM: %s\n", !i2c_probe(0x50)?"found":"-"); i2c_set_bus_num(2); // I2C3 // LEDs // GPS UART @@ -103,6 +107,7 @@ int systest(void) printf("DISPLAY: ok\n"); else printf("DISPLAY: failed\n"); + i2c_set_bus_num(0); // I2C1 return (0); } diff --git a/include/configs/omap3_beagleexpander.h b/include/configs/omap3_beagleexpander.h new file mode 100644 index 0000000..f52bad4 --- /dev/null +++ b/include/configs/omap3_beagleexpander.h @@ -0,0 +1,35 @@ +/* + * (C) Copyright 2010 + * Nikolaus Schaller <hns@goldelico.com> + * + * Configuration settings for the TI OMAP3530 Beagle board with + * Openmoko Hybrid Display extension. + * + * 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 + */ + +#define CONFIG_OMAP3_BEAGLE_HYBRID 1 /* working with BEAGLE and OMB Hybrid */ + +#include "omap3_beagle.h" /* share config */ + +#undef CONFIG_SYS_PROMPT +#define CONFIG_SYS_PROMPT "Openmoko Beagle Expander # " + + +/* __CONFIG_H */ diff --git a/include/configs/omap3_beaglehyb.h b/include/configs/omap3_beaglehyb.h index 993f577..4f82622 100644 --- a/include/configs/omap3_beaglehyb.h +++ b/include/configs/omap3_beaglehyb.h @@ -28,6 +28,12 @@ #include "omap3_beagle.h" /* share config */ +#define CONFIG_CMD_UNZIP 1 /* for reducing size of splash image */ +// #undef CONFIG_CMD_JFFS2 +// #define CONFIG_CMD_JFFS2 1 /* to access the rootfs in NAND flash */ + +// FIXME: add configs for the partitions so that JFFS2 runs in the correct NAND partition + #undef CONFIG_SYS_PROMPT #define CONFIG_SYS_PROMPT "Openmoko Beagle Hybrid # " |