diff options
author | philipchen <philipchen@google.com> | 2017-01-21 21:22:33 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-06 17:09:27 -0700 |
commit | f7930038a1028776d6159b79178f394d2c76578e (patch) | |
tree | 08013315a2a50e1ad0b8916c805b28891799919b /board/scarlet | |
parent | 1861f5695a3663e5e1f7fa9470fe27fef3a58671 (diff) | |
download | chrome-ec-f7930038a1028776d6159b79178f394d2c76578e.tar.gz |
scarlet: Remove one usb type-c port
BUG=chrome-os-partner:62207, b:62307687
CQ-DEPEND=CL:524981, CL:524987, CL:524034
BRANCH=gru
TEST=make BOARD=scarlet
TEST=manually test on gru - only one type-c port works.
Change-Id: I0b1735d3da11ee9432ce97467036e2a6cf2b8dbe
Reviewed-on: https://chromium-review.googlesource.com/431000
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524973
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'board/scarlet')
-rw-r--r-- | board/scarlet/board.c | 49 | ||||
-rw-r--r-- | board/scarlet/board.h | 3 | ||||
-rw-r--r-- | board/scarlet/ec.tasklist | 3 | ||||
-rw-r--r-- | board/scarlet/gpio.inc | 5 | ||||
-rw-r--r-- | board/scarlet/usb_pd_policy.c | 21 |
5 files changed, 22 insertions, 59 deletions
diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 7f2e4d5b8b..188ed30371 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -99,7 +99,6 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* I2C ports */ const struct i2c_port_t i2c_ports[] = { {"tcpc0", NPCX_I2C_PORT0_0, 1000, GPIO_I2C0_SCL0, GPIO_I2C0_SDA0}, - {"tcpc1", NPCX_I2C_PORT0_1, 1000, GPIO_I2C0_SCL1, GPIO_I2C0_SDA1}, {"sensors", NPCX_I2C_PORT1, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, {"charger", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, {"battery", NPCX_I2C_PORT3, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA}, @@ -153,7 +152,6 @@ const struct button_config buttons[CONFIG_BUTTON_COUNT] = { const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { {I2C_PORT_TCPC0, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv}, - {I2C_PORT_TCPC1, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv}, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { @@ -162,11 +160,6 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }, - { - .port_addr = 1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - }, }; void board_reset_pd_mcu(void) @@ -179,8 +172,6 @@ uint16_t tcpc_get_alert_status(void) if (!gpio_get_level(GPIO_USB_C0_PD_INT_L)) status |= PD_STATUS_TCPC_ALERT_0; - if (!gpio_get_level(GPIO_USB_C1_PD_INT_L)) - status |= PD_STATUS_TCPC_ALERT_1; return status; } @@ -206,12 +197,11 @@ int board_set_active_charge_port(int charge_port) CPRINTS("New chg p%d", charge_port); switch (charge_port) { - case 0: case 1: + case 0: /* Don't charge from a source port */ if (board_vbus_source_enabled(charge_port)) return -1; - - bd99955_port = bd99955_pd_port_to_chg_port(charge_port); + bd99955_port = BD99955_CHARGE_PORT_VBUS; break; case CHARGE_PORT_NONE: bd99955_port = BD99955_CHARGE_PORT_NONE; @@ -245,39 +235,22 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma) int extpower_is_present(void) { - int port; - int p0_src = board_vbus_source_enabled(0); - int p1_src = board_vbus_source_enabled(1); - /* * The charger will indicate VBUS presence if we're sourcing 5V, * so exclude such ports. */ - if (p0_src && p1_src) + if (board_vbus_source_enabled(0)) return 0; - else if (!p0_src && !p1_src) - port = BD99955_CHARGE_PORT_BOTH; else - port = bd99955_pd_port_to_chg_port(p0_src); - - return bd99955_is_vbus_provided(port); + return bd99955_is_vbus_provided(BD99955_CHARGE_PORT_VBUS); } int pd_snk_is_vbus_provided(int port) { - enum bd99955_charge_port bd99955_port; - - switch (port) { - case 0: - case 1: - bd99955_port = bd99955_pd_port_to_chg_port(port); - break; - default: + if (port) panic("Invalid charge port\n"); - break; - } - return bd99955_is_vbus_provided(bd99955_port); + return bd99955_is_vbus_provided(BD99955_CHARGE_PORT_VBUS); } static void board_spi_enable(void) @@ -315,7 +288,6 @@ static void board_init(void) { /* Enable TCPC alert interrupts */ gpio_enable_interrupt(GPIO_USB_C0_PD_INT_L); - gpio_enable_interrupt(GPIO_USB_C1_PD_INT_L); /* Enable charger interrupt for BC1.2 detection on attach / detach */ gpio_enable_interrupt(GPIO_CHARGER_INT_L); @@ -335,7 +307,6 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_hibernate(void) { - int i; int rv; /* @@ -344,11 +315,9 @@ void board_hibernate(void) * EC. Upon init, we'll reinitialize the TCPCs to be at full power. */ CPRINTS("Set TCPCs to low power"); - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { - rv = tcpc_write(i, TCPC_REG_POWER, TCPC_REG_POWER_PWR_LOW); - if (rv) - CPRINTS("Error setting TCPC %d", i); - } + rv = tcpc_write(0, TCPC_REG_POWER, TCPC_REG_POWER_PWR_LOW); + if (rv) + CPRINTS("Error setting TCPC %d", 0); cflush(); } diff --git a/board/scarlet/board.h b/board/scarlet/board.h index 8d3fecd741..132e43e2ac 100644 --- a/board/scarlet/board.h +++ b/board/scarlet/board.h @@ -115,7 +115,7 @@ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_LOG_SIZE 512 -#define CONFIG_USB_PD_PORT_COUNT 2 +#define CONFIG_USB_PD_PORT_COUNT 1 #define CONFIG_USB_PD_TCPM_FUSB302 #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER @@ -183,7 +183,6 @@ #undef CONFIG_TASK_PROFILING #define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0 -#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1 #define I2C_PORT_ACCEL NPCX_I2C_PORT1 #define I2C_PORT_CHARGER NPCX_I2C_PORT2 #define I2C_PORT_BATTERY NPCX_I2C_PORT3 diff --git a/board/scarlet/ec.tasklist b/board/scarlet/ec.tasklist index b5fc47f0e9..3b2217ea07 100644 --- a/board/scarlet/ec.tasklist +++ b/board/scarlet/ec.tasklist @@ -26,6 +26,5 @@ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C1, pd_task, NULL, LARGER_TASK_STACK_SIZE) + TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/board/scarlet/gpio.inc b/board/scarlet/gpio.inc index 407937cfe0..7f60a6713c 100644 --- a/board/scarlet/gpio.inc +++ b/board/scarlet/gpio.inc @@ -16,8 +16,6 @@ GPIO_INT(SHI_CS_L, PIN(5, 3), GPIO_INT_FALLING | GPIO_PULL_DOWN, shi_cs_event) GPIO_INT(USB_C0_PD_INT_L, PIN(6, 0), GPIO_INT_FALLING | GPIO_PULL_UP, tcpc_alert_event) -GPIO_INT(USB_C1_PD_INT_L, PIN(6, 2), GPIO_INT_FALLING | GPIO_PULL_UP, - tcpc_alert_event) GPIO_INT(VOLUME_UP_L, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) GPIO_INT(VOLUME_DOWN_L, PIN(8, 3), GPIO_INT_BOTH | GPIO_PULL_UP, @@ -80,8 +78,6 @@ GPIO(PP5000_EN, PIN(C, 6), GPIO_OUT_LOW) */ GPIO(I2C0_SCL0, PIN(B, 5), GPIO_ODR_HIGH | GPIO_SEL_1P8V) GPIO(I2C0_SDA0, PIN(B, 4), GPIO_ODR_HIGH | GPIO_SEL_1P8V) -GPIO(I2C0_SCL1, PIN(B, 3), GPIO_ODR_HIGH | GPIO_SEL_1P8V) -GPIO(I2C0_SDA1, PIN(B, 2), GPIO_ODR_HIGH | GPIO_SEL_1P8V) GPIO(I2C1_SCL, PIN(9, 0), GPIO_ODR_HIGH | GPIO_SEL_1P8V) GPIO(I2C1_SDA, PIN(8, 7), GPIO_ODR_HIGH | GPIO_SEL_1P8V) GPIO(I2C2_SCL, PIN(9, 2), GPIO_ODR_HIGH) @@ -96,7 +92,6 @@ GPIO(LID_ACCEL_INT_L, PIN(C, 7), GPIO_INPUT) GPIO(KBD_KSO2, PIN(1, 7), GPIO_OUT_LOW) GPIO(USB_C0_5V_EN, PIN(D, 3), GPIO_OUT_LOW | GPIO_PULL_UP) -GPIO(USB_C1_5V_EN, PIN(D, 2), GPIO_OUT_LOW | GPIO_PULL_UP) GPIO(ENTERING_RW, PIN(7, 6), GPIO_OUT_LOW) GPIO(SYS_RST_L, PIN(6, 1), GPIO_OUT_HIGH | GPIO_OPEN_DRAIN) diff --git a/board/scarlet/usb_pd_policy.c b/board/scarlet/usb_pd_policy.c index 0c3753c9dc..5b425dde6c 100644 --- a/board/scarlet/usb_pd_policy.c +++ b/board/scarlet/usb_pd_policy.c @@ -52,18 +52,19 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; +static uint8_t vbus_en; +static uint8_t vbus_rp = TYPEC_RP_1A5; int board_vbus_source_enabled(int port) { - return vbus_en[port]; + return vbus_en; } static void board_vbus_update_source_current(int port) { - enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN; - int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ? + /* There is only one usb type-c port on Scarlet. */ + enum gpio_signal gpio = GPIO_USB_C0_5V_EN; + int flags = (vbus_rp == TYPEC_RP_1A5 && vbus_en) ? (GPIO_INPUT | GPIO_PULL_UP) : (GPIO_OUTPUT | GPIO_PULL_UP); /* @@ -73,7 +74,7 @@ static void board_vbus_update_source_current(int port) * Putting an internal pull-up on USB_Cx_5V_EN, effectively put a 33k * resistor on ILIM, setting a minimum OCP current of 1505 mA. */ - gpio_set_level(gpio, vbus_en[port]); + gpio_set_level(gpio, vbus_en); gpio_set_flags(gpio, flags); } @@ -88,7 +89,7 @@ int pd_set_power_supply_ready(int port) pd_set_vbus_discharge(port, 0); /* Provide VBUS */ - vbus_en[port] = 1; + vbus_en = 1; board_vbus_update_source_current(port); /* notify host of power info change */ @@ -101,9 +102,9 @@ void pd_power_supply_reset(int port) { int prev_en; - prev_en = vbus_en[port]; + prev_en = vbus_en; /* Disable VBUS */ - vbus_en[port] = 0; + vbus_en = 0; board_vbus_update_source_current(port); /* Enable discharge if we were previously sourcing 5V */ if (prev_en) @@ -142,7 +143,7 @@ void typec_set_input_current_limit(int port, uint32_t max_ma, void typec_set_source_current_limit(int port, int rp) { - vbus_rp[port] = rp; + vbus_rp = rp; /* change the GPIO driving the load switch if needed */ board_vbus_update_source_current(port); |