diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-02-22 11:32:33 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-02-22 21:42:28 -0800 |
commit | 3ce5e5d8b3ebdd9abf9d182082a81e29bd899d2b (patch) | |
tree | ddb71f22af17b9b6c0bb48ee11f4f0a571864b52 /board | |
parent | fe89f7f5c7104167c46fca5f9f00508f09b1eb99 (diff) | |
download | chrome-ec-3ce5e5d8b3ebdd9abf9d182082a81e29bd899d2b.tar.gz |
Reef: Name USB port numbers appropriately
Some USB PD port numbers are not named. Some numbers are named using
I2C port names. This patch fixes them
BUG=none
BRANCH=none
TEST=make buildall
Change-Id: I0c413d2112f8ad5b584d7037519c74cd8cebf54a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/445866
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/reef/board.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/board/reef/board.c b/board/reef/board.c index 141a1cd3e0..2a0850da78 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -61,6 +61,9 @@ #define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300) #define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000) +#define USB_PD_PORT_ANX74XX 0 +#define USB_PD_PORT_PS8751 1 + static void tcpc_alert_event(enum gpio_signal signal) { if ((signal == GPIO_USB_C0_PD_INT_ODL) && @@ -87,8 +90,8 @@ static void anx74xx_cable_det_handler(void) * handle only the attach event. */ if (level) - anx74xx_handle_power_mode(NPCX_I2C_PORT0_0, - ANX74XX_NORMAL_MODE); + anx74xx_handle_power_mode(USB_PD_PORT_ANX74XX, + ANX74XX_NORMAL_MODE); /* confirm if cable_det is asserted */ if (!level || gpio_get_level(GPIO_USB_C0_PD_RST_L)) @@ -237,8 +240,18 @@ const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); #endif /* CONFIG_CMD_I2C_STRESS_TEST */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {NPCX_I2C_PORT0_0, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, - {NPCX_I2C_PORT0_1, 0x16, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, + [USB_PD_PORT_ANX74XX] = { + .i2c_host_port = NPCX_I2C_PORT0_0, + .i2c_slave_addr = 0x50, + .drv = &anx74xx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, + [USB_PD_PORT_PS8751] = { + .i2c_host_port = NPCX_I2C_PORT0_1, + .i2c_slave_addr = 0x16, + .drv = &tcpci_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, }; uint16_t tcpc_get_alert_status(void) @@ -268,12 +281,12 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, /* don't care / unused */ + .port_addr = USB_PD_PORT_ANX74XX, /* don't care / unused */ .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, { - .port_addr = 1, + .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8751_tcpc_update_hpd_status, } @@ -507,8 +520,8 @@ int pd_snk_is_vbus_provided(int port) enum bd9995x_charge_port bd9995x_port; switch (port) { - case 0: - case 1: + case USB_PD_PORT_ANX74XX: + case USB_PD_PORT_PS8751: bd9995x_port = bd9995x_pd_port_to_chg_port(port); break; default: @@ -544,8 +557,8 @@ int board_set_active_charge_port(int charge_port) return -1; switch (charge_port) { - case 0: - case 1: + case USB_PD_PORT_ANX74XX: + case USB_PD_PORT_PS8751: /* Don't charge from a source port */ if (board_vbus_source_enabled(charge_port)) return -1; |