diff options
author | Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> | 2020-10-23 14:36:14 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-27 23:51:03 +0000 |
commit | 199d959772c7822cc30dec6c7fc1511e244b067a (patch) | |
tree | 68b7f08adb155196c903807c6f28f39985d36679 | |
parent | ca6368b8425548e6c3bdd67a1a0095d6a84cdc27 (diff) | |
download | chrome-ec-199d959772c7822cc30dec6c7fc1511e244b067a.tar.gz |
woomax: Change OPT3 USB HPD from TCPC1 GPIO02 to EC GPIOB1.
For board version 2, the OPT3 USB HPD change to EC GPIOB1.
BUG=b:160579667
BRANCH=firmware-zork-13434.B
TEST=make BOARD=woomax
Signed-off-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>
Change-Id: Ic7ea0d02bd8942779138402155e9941f36c6d9f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2494601
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: Edward Hill <ecgh@chromium.org>
-rw-r--r-- | board/woomax/board.c | 25 | ||||
-rw-r--r-- | board/woomax/board.h | 7 | ||||
-rw-r--r-- | board/woomax/gpio.inc | 3 |
3 files changed, 28 insertions, 7 deletions
diff --git a/board/woomax/board.c b/board/woomax/board.c index 2a88f43bf4..e70d1fcb1d 100644 --- a/board/woomax/board.c +++ b/board/woomax/board.c @@ -9,6 +9,7 @@ #include "adc_chip.h" #include "button.h" #include "cbi_ec_fw_config.h" +#include "cros_board_info.h" #include "driver/accelgyro_bmi_common.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" @@ -336,9 +337,14 @@ BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); */ int board_usbc1_retimer_inhpd = IOEX_USB_C1_HPD_IN_DB; - +static uint32_t board_ver; static void setup_fw_config(void) { + cbi_get_board_version(&board_ver); + + if (board_ver >= 2) + board_usbc1_retimer_inhpd = GPIO_USB_C1_HPD_IN_DB; + /* Enable Gyro interrupts */ gpio_enable_interrupt(GPIO_6AXIS_INT_L); @@ -530,3 +536,20 @@ void hdmi_hpd_interrupt(enum gpio_signal signal) hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC)); } +enum gpio_signal board_usbc_port_to_hpd_gpio(int port) +{ + /* USB-C0 always uses USB_C0_HPD */ + if (port == 0) + return GPIO_USB_C0_HPD; + /* + * USB-C1 OPT3 DB use IOEX_USB_C1_HPD_IN_DB for board version 1 + * USB-C1 OPT3 DB use GPIO_USB_C1_HPD_IN_DB for board version 2 + */ + else if (ec_config_has_mst_hub_rtd2141b()) + return (board_ver >= 2) + ? GPIO_USB_C1_HPD_IN_DB + : IOEX_USB_C1_HPD_IN_DB; + + /* USB-C1 OPT1 DB use DP2_HPD. */ + return GPIO_DP2_HPD; +} diff --git a/board/woomax/board.h b/board/woomax/board.h index 729731d78f..6bc09a7a47 100644 --- a/board/woomax/board.h +++ b/board/woomax/board.h @@ -196,11 +196,8 @@ static inline bool ec_config_has_mst_hub_rtd2141b(void) * HPD, EC drives MST hub HPD input from USB-PD messages. */ -#define PORT_TO_HPD(port) ((port == 0) \ - ? GPIO_USB_C0_HPD \ - : (ec_config_has_mst_hub_rtd2141b()) \ - ? IOEX_USB_C1_HPD_IN_DB \ - : GPIO_DP2_HPD) +enum gpio_signal board_usbc_port_to_hpd_gpio(int port); +#define PORT_TO_HPD(port) board_usbc_port_to_hpd_gpio(port) extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer; extern const struct usb_mux usbc1_ps8802; diff --git a/board/woomax/gpio.inc b/board/woomax/gpio.inc index 6654b88570..b377291f74 100644 --- a/board/woomax/gpio.inc +++ b/board/woomax/gpio.inc @@ -53,6 +53,7 @@ GPIO(EC_DP1_HPD, PIN(F, 4), GPIO_OUT_LOW) /* C1 DP Hotplug Detect */ GPIO(DP2_HPD, PIN(C, 1), GPIO_OUT_LOW) /* C1 DP Hotplug Detect */ GPIO(EC_H1_PACKET_MODE, PIN(8, 6), GPIO_OUT_LOW) /* H1 Packet Mode */ GPIO(EN_PWR_TOUCHPAD_PS2, PIN(C, 2), GPIO_INPUT) /* Touchpad Power */ +GPIO(USB_C1_HPD_IN_DB, PIN(B, 1), GPIO_OUT_LOW) /* C1 HPD for board version 2 */ UNIMPLEMENTED(NO_HPD) UNIMPLEMENTED(PCH_SMI_L) @@ -75,7 +76,7 @@ IOEX(USB_C0_DATA_EN, EXPIN(USBC_PORT_C0, 1, 4), GPIO_OUT_LOW) /* C0 Data Enable IOEX(EN_USB_A0_5V, EXPIN(USBC_PORT_C0, 1, 5), GPIO_OUT_LOW) /* A0 5V Source Enable */ IOEX(USB_A0_CHARGE_EN_L, EXPIN(USBC_PORT_C0, 1, 6), GPIO_OUT_HIGH) /* A0 5V High Current Enable */ -IOEX(USB_C1_HPD_IN_DB, EXPIN(USBC_PORT_C1, 0, 2), GPIO_OUT_LOW) /* C1 HPD */ +IOEX(USB_C1_HPD_IN_DB, EXPIN(USBC_PORT_C1, 0, 2), GPIO_OUT_LOW) /* C1 HPD for board version 1*/ IOEX(HDMI_POWER_EN_DB, EXPIN(USBC_PORT_C1, 0, 3), GPIO_OUT_LOW) /* HDMI retimer power enable */ IOEX(USB_C1_TCPC_FASTSW_CTL_EN, EXPIN(USBC_PORT_C1, 0, 4), GPIO_OUT_LOW) /* C1 FastSwitch Control */ IOEX(USB_C1_MUX_RST_DB, EXPIN(USBC_PORT_C1, 1, 1), GPIO_OUT_LOW) /* C1 Mux Reset */ |