diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-10-24 11:18:47 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-25 01:32:15 +0000 |
commit | df541c6ffdc3ecf2802bad1c235e730cd29f8bfb (patch) | |
tree | 5de1078e831ec5e3f3f7437b6e5e8c96b4156a69 | |
parent | 4a1ecb67f9ff1745422aecdd5cc70a9f630d7dc8 (diff) | |
download | chrome-ec-df541c6ffdc3ecf2802bad1c235e730cd29f8bfb.tar.gz |
cleanup: rename I2C_PORT_HOST to I2C_PORT_MASTER
Previously, it was really confusing whether I2C_PORT_HOST meant the
port where the EC was the master, or the port used to talk to the AP.
No functional changes, just a global find/replace and some tidying of
unused comments.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; pass unit tests
Change-Id: Ia591ba4577d3399729556e0234ba0db3a0e3c5ea
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174546
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | board/daisy/board.h | 6 | ||||
-rw-r--r-- | board/kirby/board.c | 2 | ||||
-rw-r--r-- | board/kirby/board.h | 18 | ||||
-rw-r--r-- | board/mccroskey/board.h | 2 | ||||
-rw-r--r-- | board/nyan/board.c | 2 | ||||
-rw-r--r-- | board/nyan/board.h | 20 | ||||
-rw-r--r-- | board/pit/board.c | 2 | ||||
-rw-r--r-- | board/pit/board.h | 19 | ||||
-rw-r--r-- | board/puppy/board.c | 2 | ||||
-rw-r--r-- | board/puppy/board.h | 19 | ||||
-rw-r--r-- | board/snow/board.c | 2 | ||||
-rw-r--r-- | board/snow/board.h | 6 | ||||
-rw-r--r-- | board/spring/board.c | 2 | ||||
-rw-r--r-- | board/spring/board.h | 6 | ||||
-rw-r--r-- | chip/stm32/i2c-stm32f.c | 22 | ||||
-rw-r--r-- | chip/stm32/i2c-stm32l.c | 2 | ||||
-rw-r--r-- | common/i2c_arbitration.c | 4 | ||||
-rw-r--r-- | driver/battery/bq27541.c | 6 | ||||
-rw-r--r-- | driver/charger/bq24192.c | 4 | ||||
-rw-r--r-- | driver/led/lp5562.c | 4 | ||||
-rw-r--r-- | driver/usb_switch_tsu6721.c | 4 | ||||
-rw-r--r-- | test/led_spring.c | 2 | ||||
-rw-r--r-- | test/sbs_charging.c | 2 | ||||
-rw-r--r-- | test/test_config.h | 6 |
24 files changed, 60 insertions, 104 deletions
diff --git a/board/daisy/board.h b/board/daisy/board.h index 99fc555a9e..92f998aa5e 100644 --- a/board/daisy/board.h +++ b/board/daisy/board.h @@ -47,9 +47,9 @@ enum module_id { #define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ -#define I2C_PORT_HOST 0 /* Note: some Daisy systems used port 1 */ -#define I2C_PORT_BATTERY I2C_PORT_HOST -#define I2C_PORT_CHARGER I2C_PORT_HOST +#define I2C_PORT_MASTER 0 /* Note: some Daisy systems used port 1 */ +#define I2C_PORT_BATTERY I2C_PORT_MASTER +#define I2C_PORT_CHARGER I2C_PORT_MASTER #define I2C_PORT_SLAVE 1 /* Timer selection */ diff --git a/board/kirby/board.c b/board/kirby/board.c index 3d91057cc3..bfad9648e9 100644 --- a/board/kirby/board.c +++ b/board/kirby/board.c @@ -136,7 +136,7 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"host", I2C_PORT_HOST, 100}, + {"master", I2C_PORT_MASTER, 100}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/kirby/board.h b/board/kirby/board.h index 1fa62bfa88..592bc8d856 100644 --- a/board/kirby/board.h +++ b/board/kirby/board.h @@ -46,20 +46,10 @@ enum module_id { /* Keyboard output port list */ #define KB_OUT_PORT_LIST GPIO_D -/* - * Charging. - * - * "HOST" means the port where the EC is the master, which has the battery, - * charger and PMU. - * - * "SLAVE" means the port where the EC is the slave, which has the AP (host - * processor). - * - * TODO: In this context, "host" is badly overloaded and confusing. - */ -#define I2C_PORT_HOST 0 -#define I2C_PORT_BATTERY I2C_PORT_HOST -#define I2C_PORT_CHARGER I2C_PORT_HOST +/* Single I2C port, where the EC is the master. */ +#define I2C_PORT_MASTER 0 +#define I2C_PORT_BATTERY I2C_PORT_MASTER +#define I2C_PORT_CHARGER I2C_PORT_MASTER /* Timer selection */ #define TIM_CLOCK_MSB 2 diff --git a/board/mccroskey/board.h b/board/mccroskey/board.h index ceee19ce45..9d8ea06eab 100644 --- a/board/mccroskey/board.h +++ b/board/mccroskey/board.h @@ -45,7 +45,7 @@ enum module_id { #define KB_OUT_PORT_LIST GPIO_C /* EC is I2C master */ -#define I2C_PORT_HOST 0 +#define I2C_PORT_MASTER 0 #define I2C_PORT_SLAVE 0 /* needed for DMAC macros (ugh) */ #define GPIO_I2C2_SCL 0 /* unused, but must be defined anyway */ #define GPIO_I2C2_SDA 0 /* unused, but must be defined anyway */ diff --git a/board/nyan/board.c b/board/nyan/board.c index caa8ca188b..b158460a07 100644 --- a/board/nyan/board.c +++ b/board/nyan/board.c @@ -92,7 +92,7 @@ const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"host", I2C_PORT_HOST, 100}, + {"master", I2C_PORT_MASTER, 100}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/nyan/board.h b/board/nyan/board.h index 6ea63a06dd..c43c664943 100644 --- a/board/nyan/board.h +++ b/board/nyan/board.h @@ -38,22 +38,10 @@ enum module_id { /* Keyboard output port list */ #define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C -/* - * Charging. - * - * "HOST" means the port where the EC is the master, which has the battery, - * charger and PMU. - * - * "SLAVE" means the port where the EC is the slave, which has the AP (host - * processor). - * - * TODO: In this context, "host" is badly overloaded and confusing. - */ -#define I2C_PORT_HOST 0 -#define I2C_PORT_BATTERY I2C_PORT_HOST -#define I2C_PORT_CHARGER I2C_PORT_HOST -#define I2C_PORT_SLAVE 1 -#define I2C_PORTS_USED 1 +/* Single I2C port, where the EC is the master. */ +#define I2C_PORT_MASTER 0 +#define I2C_PORT_BATTERY I2C_PORT_MASTER +#define I2C_PORT_CHARGER I2C_PORT_MASTER /* Timer selection */ #define TIM_CLOCK_MSB 3 diff --git a/board/pit/board.c b/board/pit/board.c index b4c5cc0d6e..a54bfac6ba 100644 --- a/board/pit/board.c +++ b/board/pit/board.c @@ -107,7 +107,7 @@ const struct battery_temperature_ranges bat_temp_ranges = { /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"host", I2C_PORT_HOST, 100}, + {"master", I2C_PORT_MASTER, 100}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/pit/board.h b/board/pit/board.h index c9c82e5048..2f95545e90 100644 --- a/board/pit/board.h +++ b/board/pit/board.h @@ -43,21 +43,10 @@ enum module_id { /* Keyboard output port list */ #define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C -/* - * Charging. - * - * "HOST" means the port where the EC is the master, which has the battery, - * charger and PMU. - * - * "SLAVE" means the port where the EC is the slave, which has the AP (host - * processor). - * - * TODO: In this context, "host" is badly overloaded and confusing. - */ -#define I2C_PORT_HOST 0 -#define I2C_PORT_BATTERY I2C_PORT_HOST -#define I2C_PORT_CHARGER I2C_PORT_HOST -#define I2C_PORT_SLAVE 1 +/* Single I2C port, where the EC is the master. */ +#define I2C_PORT_MASTER 0 +#define I2C_PORT_BATTERY I2C_PORT_MASTER +#define I2C_PORT_CHARGER I2C_PORT_MASTER /* Charger sense resistors */ #define CONFIG_CHARGER_SENSE_RESISTOR_AC 12 diff --git a/board/puppy/board.c b/board/puppy/board.c index 970ecc6b8a..0e9e62b429 100644 --- a/board/puppy/board.c +++ b/board/puppy/board.c @@ -105,7 +105,7 @@ const struct battery_temperature_ranges bat_temp_ranges = { /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"host", I2C_PORT_HOST, 100}, + {"master", I2C_PORT_MASTER, 100}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/puppy/board.h b/board/puppy/board.h index 23d783cdce..79a993dd54 100644 --- a/board/puppy/board.h +++ b/board/puppy/board.h @@ -41,21 +41,10 @@ enum module_id { /* Keyboard output port list */ #define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C -/* - * Charging. - * - * "HOST" means the port where the EC is the master, which has the battery, - * charger and PMU. - * - * "SLAVE" means the port where the EC is the slave, which has the AP (host - * processor). - * - * TODO: In this context, "host" is badly overloaded and confusing. - */ -#define I2C_PORT_HOST 0 -#define I2C_PORT_BATTERY I2C_PORT_HOST -#define I2C_PORT_CHARGER I2C_PORT_HOST -#define I2C_PORT_SLAVE 1 +/* Single I2C port, where the EC is the master. */ +#define I2C_PORT_MASTER 0 +#define I2C_PORT_BATTERY I2C_PORT_MASTER +#define I2C_PORT_CHARGER I2C_PORT_MASTER /* Timer selection */ #define TIM_CLOCK_MSB 3 diff --git a/board/snow/board.c b/board/snow/board.c index 8db32d31c1..1ae884830b 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -117,7 +117,7 @@ const struct battery_temperature_ranges bat_temp_ranges = { /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"host", I2C_PORT_HOST, 100}, + {"master", I2C_PORT_MASTER, 100}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/snow/board.h b/board/snow/board.h index b5cd0b6637..0a29e18a3b 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -51,9 +51,9 @@ enum module_id { #define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ -#define I2C_PORT_HOST 1 -#define I2C_PORT_BATTERY I2C_PORT_HOST -#define I2C_PORT_CHARGER I2C_PORT_HOST +#define I2C_PORT_MASTER 1 +#define I2C_PORT_BATTERY I2C_PORT_MASTER +#define I2C_PORT_CHARGER I2C_PORT_MASTER #define I2C_PORT_SLAVE 1 #define GPIO_AP_CLAIM GPIO_SPI1_NSS /* AP claims bus */ diff --git a/board/spring/board.c b/board/spring/board.c index 51447737f5..13cbeee1f3 100644 --- a/board/spring/board.c +++ b/board/spring/board.c @@ -127,7 +127,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"host", I2C_PORT_HOST, 100}, + {"master", I2C_PORT_MASTER, 100}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/spring/board.h b/board/spring/board.h index 82d86d6034..f2c27605b2 100644 --- a/board/spring/board.h +++ b/board/spring/board.h @@ -52,9 +52,9 @@ enum module_id { #define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ -#define I2C_PORT_HOST 0 -#define I2C_PORT_BATTERY I2C_PORT_HOST -#define I2C_PORT_CHARGER I2C_PORT_HOST +#define I2C_PORT_MASTER 0 +#define I2C_PORT_BATTERY I2C_PORT_MASTER +#define I2C_PORT_CHARGER I2C_PORT_MASTER #define I2C_PORT_SLAVE 1 /* Low battery threshold. In mAh. */ diff --git a/chip/stm32/i2c-stm32f.c b/chip/stm32/i2c-stm32f.c index baac384121..1809b7cd3f 100644 --- a/chip/stm32/i2c-stm32f.c +++ b/chip/stm32/i2c-stm32f.c @@ -65,10 +65,10 @@ ((I2C_PORT_SLAVE) ? STM32_DMAC_I2C2_TX : STM32_DMAC_I2C1_TX) #define DMAC_SLAVE_RX \ ((I2C_PORT_SLAVE) ? STM32_DMAC_I2C2_RX : STM32_DMAC_I2C1_RX) -#define DMAC_HOST_TX \ - ((I2C_PORT_HOST) ? STM32_DMAC_I2C2_TX : STM32_DMAC_I2C1_TX) -#define DMAC_HOST_RX \ - ((I2C_PORT_HOST) ? STM32_DMAC_I2C2_RX : STM32_DMAC_I2C1_RX) +#define DMAC_MASTER_TX \ + ((I2C_PORT_MASTER) ? STM32_DMAC_I2C2_TX : STM32_DMAC_I2C1_TX) +#define DMAC_MASTER_RX \ + ((I2C_PORT_MASTER) ? STM32_DMAC_I2C2_RX : STM32_DMAC_I2C1_RX) enum { /* @@ -728,10 +728,10 @@ static int i2c_master_transmit(int port, int slave_addr, const uint8_t *data, /* Configure DMA channel for TX to host */ dma_prepare_tx(dma_tx_option + port, size, data); - dma_enable_tc_interrupt(DMAC_HOST_TX); + dma_enable_tc_interrupt(DMAC_MASTER_TX); /* Start the DMA */ - dma_go(dma_get_channel(DMAC_HOST_TX)); + dma_go(dma_get_channel(DMAC_MASTER_TX)); /* Configuring i2c2 to use DMA */ STM32_I2C_CR2(port) |= CR2_DMAEN; @@ -743,8 +743,8 @@ static int i2c_master_transmit(int port, int slave_addr, const uint8_t *data, if (!rv_start) rv = task_wait_event(DMA_TRANSFER_TIMEOUT_US); - dma_disable(DMAC_HOST_TX); - dma_disable_tc_interrupt(DMAC_HOST_TX); + dma_disable(DMAC_MASTER_TX); + dma_disable_tc_interrupt(DMAC_MASTER_TX); STM32_I2C_CR2(port) &= ~CR2_DMAEN; if (rv_start) @@ -777,7 +777,7 @@ static int i2c_master_receive(int port, int slave_addr, uint8_t *data, enable_ack(port); dma_start_rx(dma_rx_option + port, size, data); - dma_enable_tc_interrupt(DMAC_HOST_RX); + dma_enable_tc_interrupt(DMAC_MASTER_RX); STM32_I2C_CR2(port) |= CR2_DMAEN; STM32_I2C_CR2(port) |= CR2_LAST; @@ -786,8 +786,8 @@ static int i2c_master_receive(int port, int slave_addr, uint8_t *data, if (!rv_start) rv = task_wait_event(DMA_TRANSFER_TIMEOUT_US); - dma_disable(DMAC_HOST_RX); - dma_disable_tc_interrupt(DMAC_HOST_RX); + dma_disable(DMAC_MASTER_RX); + dma_disable_tc_interrupt(DMAC_MASTER_RX); STM32_I2C_CR2(port) &= ~CR2_DMAEN; disable_ack(port); diff --git a/chip/stm32/i2c-stm32l.c b/chip/stm32/i2c-stm32l.c index 8e02f693cd..5b4f05fed5 100644 --- a/chip/stm32/i2c-stm32l.c +++ b/chip/stm32/i2c-stm32l.c @@ -534,7 +534,7 @@ DECLARE_HOOK(HOOK_INIT, i2c_init, HOOK_PRIO_DEFAULT); static int command_i2cdump(int argc, char **argv) { - dump_i2c_reg(I2C_PORT_HOST, "dump"); + dump_i2c_reg(I2C_PORT_MASTER, "dump"); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(i2cdump, command_i2cdump, diff --git a/common/i2c_arbitration.c b/common/i2c_arbitration.c index 70b4b81dcd..128ef16287 100644 --- a/common/i2c_arbitration.c +++ b/common/i2c_arbitration.c @@ -31,7 +31,7 @@ int i2c_claim(int port) { timestamp_t start; - if (port != I2C_PORT_HOST) + if (port != I2C_PORT_MASTER) return EC_SUCCESS; /* If AP is off, we have the bus */ @@ -79,7 +79,7 @@ int i2c_claim(int port) void i2c_release(int port) { - if (port == I2C_PORT_HOST) { + if (port == I2C_PORT_MASTER) { /* Release our claim */ gpio_set_level(GPIO_EC_CLAIM, 1); usleep(BUS_SLEW_DELAY_US); diff --git a/driver/battery/bq27541.c b/driver/battery/bq27541.c index 3dce19ea54..42397135d0 100644 --- a/driver/battery/bq27541.c +++ b/driver/battery/bq27541.c @@ -42,17 +42,17 @@ static int bq27541_read(int offset, int *data) { - return i2c_read16(I2C_PORT_HOST, BQ27541_ADDR, offset, data); + return i2c_read16(I2C_PORT_BATTERY, BQ27541_ADDR, offset, data); } static int bq27541_read8(int offset, int *data) { - return i2c_read8(I2C_PORT_HOST, BQ27541_ADDR, offset, data); + return i2c_read8(I2C_PORT_BATTERY, BQ27541_ADDR, offset, data); } static int bq27541_write(int offset, int data) { - return i2c_write16(I2C_PORT_HOST, BQ27541_ADDR, offset, data); + return i2c_write16(I2C_PORT_BATTERY, BQ27541_ADDR, offset, data); } int bq27541_probe(void) diff --git a/driver/charger/bq24192.c b/driver/charger/bq24192.c index 17297cd9ce..9f9bae1533 100644 --- a/driver/charger/bq24192.c +++ b/driver/charger/bq24192.c @@ -38,12 +38,12 @@ static const int input_current_steps[] = { int bq24192_read(int reg, int *value) { - return i2c_read8(I2C_PORT_HOST, BQ24192_ADDR, reg, value); + return i2c_read8(I2C_PORT_CHARGER, BQ24192_ADDR, reg, value); } int bq24192_write(int reg, int value) { - return i2c_write8(I2C_PORT_HOST, BQ24192_ADDR, reg, value); + return i2c_write8(I2C_PORT_CHARGER, BQ24192_ADDR, reg, value); } static int bq24192_watchdog_reset(void) diff --git a/driver/led/lp5562.c b/driver/led/lp5562.c index fd92fae26f..1f5bc8b9d5 100644 --- a/driver/led/lp5562.c +++ b/driver/led/lp5562.c @@ -17,12 +17,12 @@ inline int lp5562_write(uint8_t reg, uint8_t val) { - return i2c_write8(I2C_PORT_HOST, LP5562_I2C_ADDR, reg, val); + return i2c_write8(I2C_PORT_MASTER, LP5562_I2C_ADDR, reg, val); } inline int lp5562_read(uint8_t reg, int *val) { - return i2c_read8(I2C_PORT_HOST, LP5562_I2C_ADDR, reg, val); + return i2c_read8(I2C_PORT_MASTER, LP5562_I2C_ADDR, reg, val); } int lp5562_set_color(uint32_t rgb) diff --git a/driver/usb_switch_tsu6721.c b/driver/usb_switch_tsu6721.c index 1eaa74de55..dc089561be 100644 --- a/driver/usb_switch_tsu6721.c +++ b/driver/usb_switch_tsu6721.c @@ -36,7 +36,7 @@ uint8_t tsu6721_read(uint8_t reg) int res; int val; - res = i2c_read8(I2C_PORT_HOST, TSU6721_I2C_ADDR, reg, &val); + res = i2c_read8(I2C_PORT_MASTER, TSU6721_I2C_ADDR, reg, &val); if (res) return 0xee; @@ -47,7 +47,7 @@ int tsu6721_write(uint8_t reg, uint8_t val) { int res; - res = i2c_write8(I2C_PORT_HOST, TSU6721_I2C_ADDR, reg, val); + res = i2c_write8(I2C_PORT_MASTER, TSU6721_I2C_ADDR, reg, val); if (res) CPRINTF("[%T TSU6721 I2C write failed]\n"); return res; diff --git a/test/led_spring.c b/test/led_spring.c index 8abda2bc07..e5778b4690 100644 --- a/test/led_spring.c +++ b/test/led_spring.c @@ -59,7 +59,7 @@ static void set_battery_soc(int soc) static int lp5562_i2c_write8(int port, int slave_addr, int offset, int data) { - if (port != I2C_PORT_HOST || slave_addr != LP5562_I2C_ADDR) + if (port != I2C_PORT_MASTER || slave_addr != LP5562_I2C_ADDR) return EC_ERROR_INVAL; if (offset == lp5562_failed_i2c_reg) return EC_ERROR_UNKNOWN; diff --git a/test/sbs_charging.c b/test/sbs_charging.c index fc74cc8624..77a6237394 100644 --- a/test/sbs_charging.c +++ b/test/sbs_charging.c @@ -105,7 +105,7 @@ static int test_charge_state(void) /* Attach battery again, charging */ ccprintf("[CHARGING TEST] Attach battery\n"); - test_attach_i2c(I2C_PORT_HOST, BATTERY_ADDR); + test_attach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR); state = wait_charging_state(); TEST_ASSERT(state == PWR_STATE_CHARGE); diff --git a/test/test_config.h b/test/test_config.h index 9de2e0db8c..53144073e4 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -32,7 +32,7 @@ #define CONFIG_BATTERY_SMART #define CONFIG_CHARGER_INPUT_CURRENT 4032 #define CONFIG_LED_DRIVER_LP5562 -#define I2C_PORT_HOST 1 +#define I2C_PORT_MASTER 1 #define I2C_PORT_BATTERY 1 #define I2C_PORT_CHARGER 1 #endif @@ -44,7 +44,7 @@ #define CONFIG_CHARGER_INPUT_CURRENT 4032 #define CONFIG_CHARGER_DISCHARGE_ON_AC int board_discharge_on_ac(int enabled); -#define I2C_PORT_HOST 1 +#define I2C_PORT_MASTER 1 #define I2C_PORT_BATTERY 1 #define I2C_PORT_CHARGER 1 #endif @@ -70,7 +70,7 @@ int board_discharge_on_ac(int enabled); #define CONFIG_TEMP_SENSOR #define I2C_PORT_BATTERY 1 #define I2C_PORT_CHARGER 1 -#define I2C_PORT_HOST 1 +#define I2C_PORT_MASTER 1 #endif #endif /* __CROS_EC_TEST_CONFIG_H */ |