diff options
Diffstat (limited to 'board/morphius')
-rw-r--r-- | board/morphius/board.c | 26 | ||||
-rw-r--r-- | board/morphius/board.h | 12 |
2 files changed, 27 insertions, 11 deletions
diff --git a/board/morphius/board.c b/board/morphius/board.c index 164b96c762..7ff0049413 100644 --- a/board/morphius/board.c +++ b/board/morphius/board.c @@ -255,10 +255,34 @@ BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); /***************************************************************************** * Use FW_CONFIG to set correct configuration. */ - static uint32_t board_ver; enum gpio_signal gpio_ec_ps2_reset = GPIO_EC_PS2_RESET_V1; +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 EC_DP1_HPD + * version_3 uses DP1_HPD via RTD2141B MST hub, EC does + * not drive HPD. + * + * This would have been ec_config_has_usbc1_retimer_ps8802 + * on version_2 hardware but the result is the same and + * this will be removed when version_2 hardware is retired. + */ + else if (ec_config_has_mst_hub_rtd2141b()) + return (board_ver >= 3) + ? GPIO_NO_HPD + : GPIO_EC_DP1_HPD; + + /* USB-C1 OPT1 DB uses DP2_HPD. */ + return GPIO_DP2_HPD; +} + static void board_remap_gpio(void) { if (board_ver >= 3) { diff --git a/board/morphius/board.h b/board/morphius/board.h index cb40678305..60c0033b9d 100644 --- a/board/morphius/board.h +++ b/board/morphius/board.h @@ -198,16 +198,8 @@ static inline bool ec_config_has_mst_hub_rtd2141b(void) HAS_MST_HUB_RTD2141B); } -/* - * USB-C0 always uses USB_C0_HPD (= DP3_HPD). - * USB-C1 OPT1 DB uses DP2_HPD. - * USB-C1 OPT3 DB uses DP1_HPD via RTD2141B MST hub, EC does not drive HPD. - */ -#define PORT_TO_HPD(port) ((port == 0) \ - ? GPIO_USB_C0_HPD \ - : (ec_config_has_mst_hub_rtd2141b()) \ - ? GPIO_NO_HPD \ - : 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; |