diff options
author | Zick Wei <zick.wei@quanta.corp-partner.google.com> | 2020-09-01 13:28:07 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-05 02:45:51 +0000 |
commit | 652a52a7d20cfc4795f21101832635b21bf6ea11 (patch) | |
tree | df36049279e03b24b057cd81f59359a4e5c1aba3 /board/berknip/board.c | |
parent | ec743f4b565061208d33dfd36d8fd753197f998c (diff) | |
download | chrome-ec-652a52a7d20cfc4795f21101832635b21bf6ea11.tar.gz |
berknip: add mst function support
This patch add mst function support for
board version >=3 dali sku.
BUG=b:159304034
BRANCH=zork
TEST=verify on rework dali DUT mst hub can work
Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Change-Id: I09172b9355af8e50e636c84b564dd70bc86b1155
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2386693
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'board/berknip/board.c')
-rw-r--r-- | board/berknip/board.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/board/berknip/board.c b/board/berknip/board.c index c3ac5de4fc..083d8c612c 100644 --- a/board/berknip/board.c +++ b/board/berknip/board.c @@ -318,11 +318,10 @@ const struct usb_mux usbc1_ps8743 = { * Use FW_CONFIG to set correct configuration. */ enum gpio_signal GPIO_S0_PGOOD = GPIO_S0_PWROK_OD_V0; +static uint32_t board_ver; static void board_version_check(void) { - uint32_t board_ver = 0; - cbi_get_board_version(&board_ver); if (board_ver <= 2) @@ -339,12 +338,25 @@ static void board_version_check(void) */ DECLARE_HOOK(HOOK_INIT, board_version_check, HOOK_PRIO_INIT_I2C); +static void board_remap_gpio(void) +{ + if (board_ver >= 3) { + /* + * TODO: remove code when older version_2 + * hardware is retired and no longer needed + */ + gpio_set_flags(GPIO_USB_C1_HPD_IN_DB_V1, GPIO_OUT_LOW); + } +} + static void setup_fw_config(void) { /* Enable Gyro interrupts */ gpio_enable_interrupt(GPIO_6AXIS_INT_L); setup_mux(); + + board_remap_gpio(); } /* Use HOOK_PRIO_INIT_I2C + 2 to be after ioex_init(). */ DECLARE_HOOK(HOOK_INIT, setup_fw_config, HOOK_PRIO_INIT_I2C + 2); @@ -629,3 +641,25 @@ struct power_signal_info power_signal_list[] = { }, }; BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); + +enum gpio_signal board_usbc_port_to_hpd_gpio(int port) +{ + /* USB-C0 always uses USB_C0_HPD (= DP3_HPD). */ + if (port == 0) + return GPIO_USB_C0_HPD; + + /* + * USB-C1 OPT3 DB + * version_2 uses GPIO_NO_HPD + * version_3 uses USB_C1_HPD_IN_DB_V1 via RTD2141B MST hub + * to drive AP HPD, EC drives MST hub HPD input + * from USB-PD messages.. + */ + else if (ec_config_has_mst_hub_rtd2141b()) + return (board_ver >= 3) + ? GPIO_USB_C1_HPD_IN_DB_V1 + : GPIO_NO_HPD; + + /* USB-C1 OPT1 DB uses DP2_HPD. */ + return GPIO_DP2_HPD; +} |