diff options
author | Myles Watson <mylesgw@chromium.org> | 2015-02-27 10:23:01 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-19 16:31:59 -0700 |
commit | 858cba298caa7047a76d477691ef1fcf62a3ac68 (patch) | |
tree | a22056db407932925b582d3edcad28918d449329 | |
parent | 4cf11cb152f7a097e097a52398c9ed93a5425f29 (diff) | |
download | chrome-ec-858cba298caa7047a76d477691ef1fcf62a3ac68.tar.gz |
hadoken: Remove I2C and add ADC
As of EVT2, remove I2C (TWI).
Use the pins for analog sensing of the battery level.
BUG=None
BRANCH=None
TEST=Sense the battery level and use the serial port.
Change-Id: I3d5d2401e61e6e7d203e933d2566f6f3cd65c054
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361546
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Levi Oliver <levio@google.com>
-rw-r--r-- | board/hadoken/board.c | 8 | ||||
-rw-r--r-- | board/hadoken/board.h | 32 | ||||
-rw-r--r-- | board/hadoken/gpio.inc | 30 |
3 files changed, 18 insertions, 52 deletions
diff --git a/board/hadoken/board.c b/board/hadoken/board.c index 24c71882e5..895974efee 100644 --- a/board/hadoken/board.c +++ b/board/hadoken/board.c @@ -4,17 +4,9 @@ */ #include "gpio.h" #include "registers.h" -#include "i2c.h" #include "util.h" /* To define the gpio_list[] instance. */ #include "gpio_list.h" -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"master", 0 /*Port*/, 100 /*Kbps*/, GPIO_MCU_SCL, GPIO_MCU_SDA}, -}; - -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - diff --git a/board/hadoken/board.h b/board/hadoken/board.h index cd9784d98a..5d5a7acec7 100644 --- a/board/hadoken/board.h +++ b/board/hadoken/board.h @@ -15,44 +15,16 @@ #undef CONFIG_WATCHDOG #undef CONFIG_LID_SWITCH -#define CONFIG_I2C -#define CONFIG_I2C_MASTER -#define CONFIG_I2C_DEBUG - /* * nRF51 board specific configuration. */ -#define NRF51_UART_TX_PIN 25 -#define NRF51_UART_RX_PIN 29 - -#define NRF51_TWI_PORT 0 -#define NRF51_TWI0_SCL_PIN 23 -#define NRF51_TWI0_SDA_PIN 22 - -#define NRF51_TWI0_SCL_GPIO MCU_SCL -#define NRF51_TWI0_SDA_GPIO MCU_SDA - -#define NRF51_TWI_SCL_PIN(port) NRF51_TWI0_SCL_PIN -#define NRF51_TWI_SDA_PIN(port) NRF51_TWI0_SDA_PIN -#define NRF51_TWI_FREQ(port) NRF51_TWI_100KBPS -#define NRF51_TWI_PPI_CHAN(port) 0 +#define NRF51_UART_TX_PIN 24 +#define NRF51_UART_RX_PIN 28 #define BATTERY_VOLTAGE_MAX 4425 /* mV */ #define BATTERY_VOLTAGE_NORMAL 3800 /* mV */ #define BATTERY_VOLTAGE_MIN 3000 /* mV */ -#define CONFIG_BATTERY_BQ27621 -#define BQ27621_CHEM_ID 0x0354 /* 4.35V maximum charge */ -#define BQ27621_TOGGLE_POWER_MIN 0 - -#define BQ27621_DESIGN_CAPACITY 120 /* mAh */ -#define BQ27621_DESIGN_ENERGY 444 /* mWh */ -#define BQ27621_TERMINATE_VOLTAGE BATTERY_VOLTAGE_MIN /* mV */ -#define BQ27621_TAPER_CURRENT 6 /* mA */ - -#define I2C_PORT_BATTERY NRF51_TWI_PORT - - #include "gpio_signal.h" #endif /* !__ASSEMBLER__ */ diff --git a/board/hadoken/gpio.inc b/board/hadoken/gpio.inc index 33e6ab6a7a..2c85d0d021 100644 --- a/board/hadoken/gpio.inc +++ b/board/hadoken/gpio.inc @@ -16,13 +16,13 @@ * TODO(yjlou): call keyboard_raw_gpio_interrupt() in chip/nrf51/keyboard_raw.c */ GPIO(KB_IN00, PIN(0, 6), GPIO_KB_INPUT) -GPIO(KB_IN01, PIN(0, 24), GPIO_KB_INPUT) +GPIO(KB_IN01, PIN(0, 23), GPIO_KB_INPUT) GPIO(KB_IN02, PIN(0, 1), GPIO_KB_INPUT) GPIO(KB_IN03, PIN(0, 4), GPIO_KB_INPUT) GPIO(KB_IN04, PIN(0, 0), GPIO_KB_INPUT) -GPIO(KB_IN05, PIN(0, 30), GPIO_KB_INPUT) -GPIO(KB_IN06, PIN(0, 27), GPIO_KB_INPUT) -GPIO(KB_IN07, PIN(0, 26), GPIO_KB_INPUT) +GPIO(KB_IN05, PIN(0, 29), GPIO_KB_INPUT) +GPIO(KB_IN06, PIN(0, 22), GPIO_KB_INPUT) +GPIO(KB_IN07, PIN(0, 25), GPIO_KB_INPUT) /* Other inputs */ GPIO(MCU_GPIO_13, PIN(0, 13), GPIO_INPUT) /* PAIR on the debug board */ @@ -30,10 +30,10 @@ GPIO(MCU_GPIO_14, PIN(0, 14), GPIO_INPUT) /* TP 4 */ GPIO(MCU_GPIO_17, PIN(0, 17), GPIO_INPUT) /* TP 5 */ GPIO(MCU_GPIO_19, PIN(0, 19), GPIO_INPUT) /* TP 6 */ GPIO(BQ27621_GPOUT, PIN(0, 20), GPIO_INPUT) /* Fuel Gauge */ -GPIO(LID_PRESENT_L, PIN(0, 31), GPIO_INPUT) /* Hall sensor */ +GPIO(LID_PRESENT_L, PIN(0, 30), GPIO_INPUT) /* Hall sensor */ -/* Will be an output at some point */ -GPIO(IND_CHRG_DISABLE, PIN(0, 21), GPIO_INPUT) /* Control for charging */ +/* Useful for test software */ +GPIO(IND_CHRG_DISABLE, PIN(0, 20), GPIO_INPUT) /* Outputs */ GPIO(KB_OUT00, PIN(0, 2), GPIO_KB_OUTPUT) @@ -43,20 +43,22 @@ GPIO(KB_OUT03, PIN(0, 5), GPIO_KB_OUTPUT) GPIO(KB_OUT04, PIN(0, 3), GPIO_KB_OUTPUT) GPIO(KB_OUT05, PIN(0, 9), GPIO_KB_OUTPUT) GPIO(KB_OUT06, PIN(0, 8), GPIO_KB_OUTPUT) -GPIO(KB_OUT07, PIN(0, 28), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(0, 27), GPIO_KB_OUTPUT) GPIO(KB_OUT08, PIN(0, 18), GPIO_KB_OUTPUT) GPIO(KB_OUT09, PIN(0, 16), GPIO_KB_OUTPUT) GPIO(KB_OUT10, PIN(0, 12), GPIO_KB_OUTPUT) GPIO(KB_OUT11, PIN(0, 15), GPIO_KB_OUTPUT) GPIO(KB_OUT12, PIN(0, 11), GPIO_KB_OUTPUT) -/* Configure the TWI (I2C) interface in the init function. */ -GPIO(MCU_SCL, PIN(0, 23), GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) -GPIO(MCU_SDA, PIN(0, 22), GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) +/* SPI */ +GPIO(MCU_SPI_MOSI, PIN(0, 13), GPIO_OUTPUT) +GPIO(MCU_SPI_MISO, PIN(0, 14), GPIO_INPUT) +GPIO(MCU_SPI_SCLK, PIN(0, 17), GPIO_OUTPUT) +GPIO(MCU_SPI_CS_L, PIN(0, 19), GPIO_OUT_HIGH) -/* Use port 0 for I2C (TWI0), Pins 22 & 23 */ -ALTERNATE(PIN_MASK(0, 0x800000), NRF51_TWI0_ALT_FUNC_SCL, MODULE_I2C, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) -ALTERNATE(PIN_MASK(0, 0x400000), NRF51_TWI0_ALT_FUNC_SDA, MODULE_I2C, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) +/* VBATT_SENSE */ +GPIO(VBATT_SENSE, PIN(0, 26), GPIO_ANALOG) +GPIO(VBATT_SENSE_EN, PIN(0, 21), GPIO_OUT_LOW) /* Unimplemented */ UNIMPLEMENTED(ENTERING_RW) |