snappy: 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

Follow reef setting.

BUG=none
BRANCH=reef
TEST=make buildall

Change-Id: If951f4b9e0022e83526071c2fa378abb3e91151f
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/451083
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Bruce
2017-03-08 20:59:09 +08:00
committed by chrome-bot
parent 0de92e2616
commit a9fa6ea515

View File

@@ -62,6 +62,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) &&
@@ -88,7 +91,7 @@ static void anx74xx_cable_det_handler(void)
* handle only the attach event.
*/
if (level)
anx74xx_handle_power_mode(NPCX_I2C_PORT0_0,
anx74xx_handle_power_mode(USB_PD_PORT_ANX74XX,
ANX74XX_NORMAL_MODE);
/* confirm if cable_det is asserted */
@@ -234,10 +237,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, TCPC_PORT0_I2C_ADDR, &anx74xx_tcpm_drv,
TCPC_ALERT_ACTIVE_LOW},
{NPCX_I2C_PORT0_1, TCPC_PORT1_I2C_ADDR, &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)
@@ -277,12 +288,12 @@ static int ps8751_tune_mux(const struct usb_mux *mux)
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 # not i2c address */
.port_addr = USB_PD_PORT_PS8751, /* port # not i2c address */
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8751_tcpc_update_hpd_status,
.board_init = &ps8751_tune_mux,
@@ -524,8 +535,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:
@@ -561,8 +572,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;