summaryrefslogtreecommitdiffstats
path: root/board
diff options
context:
space:
mode:
authorH. Nikolaus Schaller <hns@goldelico.com>2010-12-18 14:07:38 +0100
committerH. Nikolaus Schaller <hns@goldelico.com>2010-12-18 14:07:38 +0100
commitf14ddc0cf63a3e581a3df6872cef86109fe4c90a (patch)
treedc2ad1e11768f0388a66a5fb1757229a67770d5d /board
parent845fb0d476f033ff6e1bffe0527d894f2832e9d2 (diff)
downloadbootable_bootloader_goldelico_gta04-f14ddc0cf63a3e581a3df6872cef86109fe4c90a.zip
bootable_bootloader_goldelico_gta04-f14ddc0cf63a3e581a3df6872cef86109fe4c90a.tar.gz
bootable_bootloader_goldelico_gta04-f14ddc0cf63a3e581a3df6872cef86109fe4c90a.tar.bz2
fixed gpio assignment and added tsc6507 programming for GTA04 board
Diffstat (limited to 'board')
-rw-r--r--board/goldelico/gta04/TD028TTEC1.c13
-rw-r--r--board/goldelico/gta04/backlight.c13
-rw-r--r--board/goldelico/gta04/gps.c9
-rw-r--r--board/goldelico/gta04/gta04.c2
-rw-r--r--board/goldelico/gta04/status.c57
5 files changed, 82 insertions, 12 deletions
diff --git a/board/goldelico/gta04/TD028TTEC1.c b/board/goldelico/gta04/TD028TTEC1.c
index 217e088..09bb1b8 100644
--- a/board/goldelico/gta04/TD028TTEC1.c
+++ b/board/goldelico/gta04/TD028TTEC1.c
@@ -47,13 +47,24 @@
#define VERIFY(VAL) if(SPI_READ() != (VAL)) { return 1; }
#endif
-#if defined(_BEAGLE_)
+#ifdef CONFIG_OMAP3_BEAGLE
+
+#ifdef CONFIG_OMAP3_GTA04
+
+#define GPIO_CS 19
+#define GPIO_SCL 12
+#define GPIO_DIN 20
+#define GPIO_DOUT 18
+
+#else /* Beagle Hybrid */
#define GPIO_CS 161
#define GPIO_SCL 162
#define GPIO_DIN 159
#define GPIO_DOUT 158
+#endif
+
#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))
diff --git a/board/goldelico/gta04/backlight.c b/board/goldelico/gta04/backlight.c
index 0e9ce24..cc1a774 100644
--- a/board/goldelico/gta04/backlight.c
+++ b/board/goldelico/gta04/backlight.c
@@ -30,13 +30,20 @@
#include <asm/mach-types.h>
#include "backlight.h"
+#ifdef CONFIG_OMAP3_GTA04
+#define GPIO_BACKLIGHT 57 /* = GPT11_PWM */
+#define GPT_BACKLIGHT OMAP34XX_GPT11
+#else /* Beagle Hybrid */
#define GPIO_BACKLIGHT 145
+#define GPT_BACKLIGHT OMAP34XX_GPT10
+#endif
+
#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
+ struct gptimer *gpt_base = (struct gptimer *)GPT_BACKLIGHT;
// writel(value, &gpt_base->registername);
#else
omap_set_gpio_dataout(GPIO_BACKLIGHT, level >= 128); // for simplicity we just have on/off
@@ -48,13 +55,15 @@ void backlight_set_level(int level) // 0..255
int backlight_init(void)
{
#if USE_PWM
- struct gptimer *gpt_base = (struct gptimer *)OMAP34XX_GPT10; // use GPT11 for GTA04
+ struct gptimer *gpt_base = (struct gptimer *)GPT_BACKLIGHT;
MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M2)) /* switch to GPT10 */
// writel(value, &gpt_base->registername);
// program registers
#error todo
#else
+#ifndef CONFIG_OMAP3_GTA04
MUX_VAL(CP(UART2_RTS), (IEN | PTD | DIS | M4)) /*GPIO_145*/
+#endif
omap_request_gpio(GPIO_BACKLIGHT);
omap_set_gpio_direction(GPIO_BACKLIGHT, 0); // output
diff --git a/board/goldelico/gta04/gps.c b/board/goldelico/gta04/gps.c
index 3befeca..4b7ec06 100644
--- a/board/goldelico/gta04/gps.c
+++ b/board/goldelico/gta04/gps.c
@@ -32,9 +32,18 @@
#include <twl4030.h>
#include "gps.h"
+#ifdef CONFIG_OMAP3_GTA04
+
+#define GPIO_GPSEXT 144 // external GPS antenna plugged in
+#define GPIO_GPS_ON 145
+
+#else /* Beagle Hybrid */
+
#define GPIO_GPSEXT 138 // external GPS antenna plugged in
#define GPIO_GPS_ON 156
+#endif
+
int gps_init(void)
{
extern int get_board_revision(void);
diff --git a/board/goldelico/gta04/gta04.c b/board/goldelico/gta04/gta04.c
index 32e66c1..78e2b92 100644
--- a/board/goldelico/gta04/gta04.c
+++ b/board/goldelico/gta04/gta04.c
@@ -161,6 +161,8 @@ int get_board_revision(void)
*/
unsigned int get_expansion_id(void)
{
+ return BEAGLE_NO_EEPROM;
+
i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
/* return BEAGLE_NO_EEPROM if eeprom doesn't respond */
diff --git a/board/goldelico/gta04/status.c b/board/goldelico/gta04/status.c
index db2f65e..01b2881 100644
--- a/board/goldelico/gta04/status.c
+++ b/board/goldelico/gta04/status.c
@@ -28,9 +28,32 @@
#include <asm/arch/sys_proto.h>
#include <asm/arch/gpio.h>
#include <asm/mach-types.h>
+#include <i2c.h>
#include "status.h"
+#ifdef CONFIG_OMAP3_GTA04
+static int isGTA04 = 1;
+#define TCA6507 2 // I2C2
+#define TCA6507_ADDRESS 0x45
+
+/* register numbers */
+#define TCA6507_SELECT0 0
+#define TCA6507_SELECT1 1
+#define TCA6507_SELECT2 2
+#define TCA6507_FADE_ON_TIME 3
+#define TCA6507_FULLY_ON_TIME 4
+#define TCA6507_FADR_OFF_TIME 5
+#define TCA6507_FIRST_FULLY_OFF_TIME 6
+#define TCA6507_SECOND_FULLY_OFF_TIME 7
+#define TCA6507_MAXIMUM_INTENSITY 8
+#define TCA6507_ONE_SHOT_MASTER_INTENSITY 9
+#define TCA6507_INITIALIZATION 10
+
+#define TCA6507_AUTO_INCREMENT 16
+
+#else
static int isGTA04 = 0;
+#endif
// we can't include "beagle.h"
/* BeagleBoard revisions */
@@ -54,10 +77,10 @@ static int isXM = 0;
// 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
+#define GPIO_AUX (isGTA04?7:136) // AUX/User button
+#define GPIO_POWER (isGTA04?-1:137) // N/A on GTA04
+#define GPIO_GPSEXT (isGTA04?144:138) // external GPS antenna is plugged in
+#define GPIO_PENIRQ (isGTA04?160:157) // TSC must be set up to provide PENIRQ
void led_set_led(int value)
{
@@ -70,14 +93,22 @@ void led_set_led(int value)
omap_set_gpio_dataout(GPIO_LED_UNUSED, (value&(1 << 7)));
}
else {
- // initialize i2c controller
+ value &= 0x3f; // 6 LEDs only - 7th is reserved to reset the WLAN/BT chip
+ // 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);
+ i2c_reg_write(TCA6507_ADDRESS, TCA6507_SELECT1, 0);
+ i2c_reg_write(TCA6507_ADDRESS, TCA6507_SELECT2, value); // 1 = on
}
}
int led_get_buttons(void)
{ // convert button state into led state
if(isGTA04) {
- // read GPIOs and TPS65950
+ // should read power button state from TPS65950
+ return ((omap_get_gpio_datain(GPIO_AUX)) << 0) |
+ ((omap_get_gpio_datain(GPIO_GPSEXT)) << 1) |
+ ((omap_get_gpio_datain(GPIO_PENIRQ)) << 4);
}
return
((!omap_get_gpio_datain(GPIO_AUX)) << 0) |
@@ -114,10 +145,19 @@ int led_init(void)
omap_request_gpio(GPIO_LED_POWER_RED);
omap_request_gpio(GPIO_LED_VIBRA);
omap_request_gpio(GPIO_LED_UNUSED);
+ omap_request_gpio(GPIO_POWER);
+ }
+ else {
+ // initialize I2C controller
+ if(i2c_set_bus_num(TCA6507-1))
+ {
+ printf ("could not select I2C2\n");
+ return 1;
+ }
+ // send init command?
}
omap_request_gpio(GPIO_AUX);
- omap_request_gpio(GPIO_POWER);
omap_request_gpio(GPIO_GPSEXT);
omap_request_gpio(GPIO_PENIRQ);
@@ -128,10 +168,10 @@ int led_init(void)
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_POWER, 1); // input
}
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
@@ -140,4 +180,3 @@ int led_init(void)
return 0;
}
-