From a6591e9d5c7caa04f94e604d8a649d9f8e6d5b5b Mon Sep 17 00:00:00 2001 From: Denis Brockus Date: Mon, 6 Jan 2020 11:11:05 -0700 Subject: zork: add DP1_HPD support for DB options The GPIO to use for DP_HPD is different depending on which retimer is being used. Added to select the correct one. BUG=b:139432598 BRANCH=none TEST=make buildall -j Change-Id: I11c30b37e148ecd958a5ef199739a90dd2b17dd8 Signed-off-by: Denis Brockus Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1988627 Reviewed-by: Jett Rink Reviewed-by: Edward Hill --- baseboard/zork/baseboard.c | 14 ++++---------- baseboard/zork/baseboard.h | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'baseboard') diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index e8d483487c..002d11d0b6 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -471,18 +471,12 @@ struct usb_mux usb_muxes[] = { }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); -enum zork_c1_retimer { - C1_RETIMER_UNKNOWN, - C1_RETIMER_PS8802, - C1_RETIMER_PS8818, -}; - -static enum zork_c1_retimer zork_c1_retimer = C1_RETIMER_UNKNOWN; - /* - * To support both OPT1 DB with PS8818 retimer, and OPT3 DB with PS8802 retimer, - * try both, and remember the first one that succeeds. + * To support both OPT1 DB with PS8818 retimer, and OPT3 DB with PS8802 + * retimer, Try both, and remember the first one that succeeds. */ +enum zork_c1_retimer zork_c1_retimer = C1_RETIMER_UNKNOWN; + static int zork_c1_set_mux(int port, mux_state_t mux_state) { int rv = EC_ERROR_UNKNOWN; diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h index 1ed4bee22b..58d19f86cb 100644 --- a/baseboard/zork/baseboard.h +++ b/baseboard/zork/baseboard.h @@ -280,6 +280,23 @@ enum sensor_id { SENSOR_COUNT, }; +/* Private + * Main intent is to indicate the retimer type attached + * but is also needed to determine the HPD from the port + */ +enum zork_c1_retimer { + C1_RETIMER_UNKNOWN, + C1_RETIMER_PS8802, + C1_RETIMER_PS8818, +}; +extern enum zork_c1_retimer zork_c1_retimer; + +#define PORT_TO_HPD(port) ((port == 0) \ + ? GPIO_USB_C0_HPD \ + : (zork_c1_retimer == C1_RETIMER_PS8802) \ + ? GPIO_DP1_HPD \ + : GPIO_DP2_HPD) + /* * Matrix to rotate accelerators into the standard reference frame. The default * is the identity which is correct for the reference design. Variations of @@ -314,8 +331,6 @@ void board_update_sensor_config_from_sku(void); int board_tcpc_fast_role_swap_enable(int port, int enable); #endif -#define PORT_TO_HPD(port) ((port) ? GPIO_DP2_HPD : GPIO_USB_C0_HPD) - #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BASEBOARD_H */ -- cgit v1.2.1