diff options
-rw-r--r-- | baseboard/zork/baseboard.c | 21 | ||||
-rw-r--r-- | baseboard/zork/baseboard.h | 19 | ||||
-rw-r--r-- | baseboard/zork/cbi_ec_fw_config.c | 10 | ||||
-rw-r--r-- | baseboard/zork/cbi_ec_fw_config.h | 3 | ||||
-rw-r--r-- | baseboard/zork/variant_trembyle.c | 189 | ||||
-rw-r--r-- | board/ezkinil/board.c | 26 | ||||
-rw-r--r-- | board/ezkinil/board.h | 8 | ||||
-rw-r--r-- | board/morphius/board.c | 81 | ||||
-rw-r--r-- | board/morphius/board.h | 12 | ||||
-rw-r--r-- | board/trembyle/board.c | 83 | ||||
-rw-r--r-- | board/trembyle/board.h | 12 | ||||
-rw-r--r-- | driver/retimer/ps8802.c | 1 | ||||
-rw-r--r-- | driver/retimer/ps8802.h | 2 | ||||
-rw-r--r-- | driver/retimer/ps8818.c | 1 | ||||
-rw-r--r-- | driver/retimer/ps8818.h | 1 |
15 files changed, 249 insertions, 220 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index 412a2e4c2d..e5761f4e5b 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -577,7 +577,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); #ifndef TEST_BUILD void lid_angle_peripheral_enable(int enable) { - if (board_is_convertible()) + if (ec_config_has_lid_angle_tablet_mode()) keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); } #endif @@ -585,6 +585,11 @@ void lid_angle_peripheral_enable(int enable) /* Unprovisioned magic value. */ static uint32_t sku_id = 0x7fffffff; +uint32_t system_get_sku_id(void) +{ + return sku_id; +} + static void cbi_init(void) { uint32_t board_version = 0; @@ -612,25 +617,13 @@ static void cbi_init(void) } DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); -/* TODO(b/151075885) Base initialization off the fw_config */ -uint32_t system_get_sku_id(void) -{ - return sku_id; -} - /* * Returns 1 for boards that are convertible into tablet mode, and zero for * clamshells. */ -int board_is_convertible(void) -{ - /* TODO: Add convertible SKU values */ - return 0; -} - int board_is_lid_angle_tablet_mode(void) { - return board_is_convertible(); + return ec_config_has_lid_angle_tablet_mode(); } void board_overcurrent_event(int port, int is_overcurrented) diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h index e9c34c8318..43d4b33a3e 100644 --- a/baseboard/zork/baseboard.h +++ b/baseboard/zork/baseboard.h @@ -293,24 +293,7 @@ enum sensor_id { SENSOR_COUNT, }; -#if defined(VARIANT_ZORK_TREMBYLE) - /* 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) -#elif defined(VARIANT_ZORK_DALBOZ) +#if defined(VARIANT_ZORK_DALBOZ) #define PORT_TO_HPD(port) ((port == 0) \ ? GPIO_USB3_C0_DP2_HPD \ : GPIO_DP1_HPD) diff --git a/baseboard/zork/cbi_ec_fw_config.c b/baseboard/zork/cbi_ec_fw_config.c index d8101855f7..1845fa1718 100644 --- a/baseboard/zork/cbi_ec_fw_config.c +++ b/baseboard/zork/cbi_ec_fw_config.c @@ -10,9 +10,17 @@ /**************************************************************************** * CBI Zork EC FW Configuration */ +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ +static uint32_t cached_fw_config = UNINITIALIZED_FW_CONFIG; +void set_cbi_fw_config(uint32_t val) +{ + cached_fw_config = val; +} + uint32_t get_cbi_fw_config(void) { - static uint32_t cached_fw_config = UNINITIALIZED_FW_CONFIG; + /* TODO(b:151232257) Remove probe code when hardware supports CBI */ + /* static uint32_t cached_fw_config = UNINITIALIZED_FW_CONFIG; */ if (cached_fw_config == UNINITIALIZED_FW_CONFIG) { uint32_t val; diff --git a/baseboard/zork/cbi_ec_fw_config.h b/baseboard/zork/cbi_ec_fw_config.h index 9222dd9f45..7b49464320 100644 --- a/baseboard/zork/cbi_ec_fw_config.h +++ b/baseboard/zork/cbi_ec_fw_config.h @@ -98,6 +98,9 @@ enum ec_cfg_lid_angle_tablet_mode_type { EC_CFG_LID_ANGLE_TABLET_MODE_L) +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ +void set_cbi_fw_config(uint32_t val); + uint32_t get_cbi_fw_config(void); enum ec_cfg_usb_db_type ec_config_get_usb_db(void); enum ec_cfg_usb_mb_type ec_config_get_usb_mb(void); diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c index 7abba856fd..d50eecc3b5 100644 --- a/baseboard/zork/variant_trembyle.c +++ b/baseboard/zork/variant_trembyle.c @@ -106,7 +106,7 @@ void mst_hpd_interrupt(enum ioex_signal signal) */ /* - * PS8802 set mux tuning. + * PS8802 set mux board tuning. * Adds in board specific gain and DP lane count configuration */ static int board_ps8802_mux_set(const struct usb_mux *me, @@ -153,7 +153,7 @@ static int board_ps8802_mux_set(const struct usb_mux *me, } /* - * PS8818 set mux tuning. + * PS8818 set mux board tuning. * Adds in board specific gain and DP lane count configuration */ static int board_ps8818_mux_set(const struct usb_mux *me, @@ -218,164 +218,6 @@ static int board_ps8818_mux_set(const struct usb_mux *me, return rv; } -/* - * To support both OPT1 DB with PS8818 retimer, and OPT3 DB with PS8802 - * retimer, Try both, and remember the first one that succeeds. - */ -const struct usb_mux usbc1_ps8802; -const struct usb_mux usbc1_ps8818; -struct usb_mux usbc1_amd_fp5_usb_mux; - -enum zork_c1_retimer zork_c1_retimer = C1_RETIMER_UNKNOWN; -static int zork_c1_detect(const struct usb_mux *me, int err_if_power_off) -{ - int rv; - - /* - * Retimers are not powered in G3 so return success if setting mux to - * none and error otherwise. - */ - if (chipset_in_state(CHIPSET_STATE_HARD_OFF)) - return (err_if_power_off) ? EC_ERROR_NOT_POWERED - : EC_SUCCESS; - - /* - * Identifying a PS8818 is faster than the PS8802, - * so do it first. - */ - rv = ps8818_detect(&usbc1_ps8818); - if (rv == EC_SUCCESS) { - zork_c1_retimer = C1_RETIMER_PS8818; - ccprints("C1 PS8818 detected"); - - /* Main MUX is FP5, secondary MUX is PS8818 */ - memcpy(&usb_muxes[USBC_PORT_C1], - &usbc1_amd_fp5_usb_mux, - sizeof(struct usb_mux)); - usb_muxes[USBC_PORT_C1].next_mux = &usbc1_ps8818; - return rv; - } - - rv = ps8802_detect(&usbc1_ps8802); - if (rv == EC_SUCCESS) { - zork_c1_retimer = C1_RETIMER_PS8802; - ccprints("C1 PS8802 detected"); - - /* Main MUX is PS8802, secondary MUX is modified FP5 */ - memcpy(&usb_muxes[USBC_PORT_C1], - &usbc1_ps8802, - sizeof(struct usb_mux)); - usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux; - usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP; - } - - return rv; -} - -/* - * We start off not sure which configuration we are using. We set - * the interface to be this special primary MUX driver in order to - * determine the actual hardware and then we patch the jump tables - * to go to the actual drivers instead. - * - * "me" will always point to usb_muxes[0]. If detection is made - * on the real device, then detect will change the tables so the - * content of me is the real driver configuration and will setup - * next_mux appropriately. So all we have to do on detection is - * perform the actual call for this entry and then let the generic - * chain traverse mechanism in usb_mux.c do any following calls. - */ -static int zork_c1_init_mux(const struct usb_mux *me) -{ - int rv; - - /* Try to detect, but don't give an error if no power */ - rv = zork_c1_detect(me, 0); - if (rv) - return rv; - - /* - * If we detected the hardware, then call the real routine. - * We only do this one time, after that time we will go direct - * and avoid this special driver. - */ - if (zork_c1_retimer != C1_RETIMER_UNKNOWN) - if (me->driver && me->driver->init) - rv = me->driver->init(me); - - return rv; -} - -static int zork_c1_set_mux(const struct usb_mux *me, mux_state_t mux_state) -{ - int rv; - - /* - * Try to detect, give an error if we are setting to a - * MUX value that is not NONE when we have no power. - */ - rv = zork_c1_detect(me, mux_state != USB_PD_MUX_NONE); - if (rv) - return rv; - - /* - * If we detected the hardware, then call the real routine. - * We only do this one time, after that time we will go direct - * and avoid this special driver. - */ - if (zork_c1_retimer != C1_RETIMER_UNKNOWN) { - const struct usb_mux_driver *drv = me->driver; - - if (drv && drv->set) { - mux_state_t state = mux_state; - - if (me->flags & USB_MUX_FLAG_SET_WITHOUT_FLIP) - state &= ~USB_PD_MUX_POLARITY_INVERTED; - - /* Apply Driver generic settings */ - rv = drv->set(me, state); - if (rv) - return rv; - - /* Apply Board specific settings */ - if (me->board_set) - rv = me->board_set(me, state); - } - } - - return rv; -} - -static int zork_c1_get_mux(const struct usb_mux *me, mux_state_t *mux_state) -{ - int rv; - - /* Try to detect the hardware */ - rv = zork_c1_detect(me, 1); - if (rv) { - /* - * Not powered is MUX_NONE, so change the values - * and make it a good status - */ - if (rv == EC_ERROR_NOT_POWERED) { - *mux_state = USB_PD_MUX_NONE; - rv = EC_SUCCESS; - } - return rv; - } - - /* - * If we detected the hardware, then call the real routine. - * We only do this one time, after that time we will go direct - * and avoid this special driver. - */ - if (zork_c1_retimer != C1_RETIMER_UNKNOWN) - if (me->driver && me->driver->get) - rv = me->driver->get(me, mux_state); - - return rv; -} - const struct pi3dpx1207_usb_control pi3dpx1207_controls[] = { [USBC_PORT_C0] = { #ifdef VARIANT_ZORK_TREMBYLE @@ -388,12 +230,6 @@ const struct pi3dpx1207_usb_control pi3dpx1207_controls[] = { }; BUILD_ASSERT(ARRAY_SIZE(pi3dpx1207_controls) == USBC_PORT_COUNT); -const struct usb_mux_driver zork_c1_usb_mux_driver = { - .init = zork_c1_init_mux, - .set = zork_c1_set_mux, - .get = zork_c1_get_mux, -}; - const struct usb_mux usbc0_pi3dpx1207_usb_retimer = { .usb_port = USBC_PORT_C0, .i2c_port = I2C_PORT_TCPC0, @@ -421,24 +257,3 @@ struct usb_mux usbc1_amd_fp5_usb_mux = { .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, .driver = &amd_fp5_usb_mux_driver, }; - -struct usb_mux usb_muxes[] = { - [USBC_PORT_C0] = { - .usb_port = USBC_PORT_C0, - .i2c_port = I2C_PORT_USB_AP_MUX, - .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, - .driver = &amd_fp5_usb_mux_driver, - .next_mux = &usbc0_pi3dpx1207_usb_retimer, - }, - [USBC_PORT_C1] = { - /* - * This is the detection driver. Once the hardware - * has been detected, the driver will change to the - * detected hardware driver table. - */ - .usb_port = USBC_PORT_C1, - .i2c_port = I2C_PORT_TCPC1, - .driver = &zork_c1_usb_mux_driver, - } -}; -BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c index 08ec79df5a..b710c60700 100644 --- a/board/ezkinil/board.c +++ b/board/ezkinil/board.c @@ -13,6 +13,7 @@ #include "fan.h" #include "fan_chip.h" #include "gpio.h" +#include "hooks.h" #include "lid_switch.h" #include "power.h" #include "power_button.h" @@ -22,6 +23,7 @@ #include "system.h" #include "task.h" #include "usb_charge.h" +#include "usb_mux.h" #include "gpio_list.h" @@ -162,3 +164,27 @@ const struct mft_t mft_channels[] = { }, }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); + +/***************************************************************************** + * USB-C MUX/Retimer dynamic configuration + */ + +/* TODO: Fill in with real mux table updates */ +static void setup_mux(void) +{ + if (ec_config_has_usbc1_retimer_tusb544()) + ccprints("C1 TUSB544 detected"); + else if (ec_config_has_usbc1_retimer_ps8743()) + ccprints("C1 PS8743 detected"); +} +DECLARE_HOOK(HOOK_INIT, setup_mux, HOOK_PRIO_DEFAULT); + +struct usb_mux usb_muxes[] = { + [USBC_PORT_C0] = { + /* USB-C0 does not have a retimer/mux */ + }, + [USBC_PORT_C1] = { + /* Filled in dynamically at startup */ + }, +}; +BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); diff --git a/board/ezkinil/board.h b/board/ezkinil/board.h index 305a0651ec..00acf228dc 100644 --- a/board/ezkinil/board.h +++ b/board/ezkinil/board.h @@ -159,6 +159,14 @@ static inline bool ec_config_has_usbc1_retimer_tusb544(void) HAS_USBC1_RETIMER_TUSB544); } + +/* TODO: Fill in with GPIO values */ +#define PORT_TO_HPD(port) ((port == 0) \ + ? GPIO_USB_C0_HPD \ + : (ec_config_has_usbc1_retimer_ps8743()) \ + ? GPIO_DP1_HPD \ + : GPIO_DP2_HPD) + #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */ diff --git a/board/morphius/board.c b/board/morphius/board.c index 00d54bdcd5..e88e7c0ed0 100644 --- a/board/morphius/board.c +++ b/board/morphius/board.c @@ -9,6 +9,7 @@ #include "driver/accelgyro_bmi160.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" +#include "driver/usb_mux/amd_fp5.h" #include "extpower.h" #include "gpio.h" #include "fan.h" @@ -24,6 +25,7 @@ #include "switch.h" #include "system.h" #include "task.h" +#include "usb_mux.h" #include "usb_charge.h" #include "gpio_list.h" @@ -199,3 +201,82 @@ const struct mft_t mft_channels[] = { }, }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); + +/***************************************************************************** + * USB-C MUX/Retimer dynamic configuration + */ +static void setup_mux(void) +{ + if (ec_config_has_usbc1_retimer_ps8802()) { + ccprints("C1 PS8802 detected"); + + /* + * Main MUX is PS8802, secondary MUX is modified FP5 + * + * Replace usb_muxes[USBC_PORT_C1] with the PS8802 + * table entry. + */ + memcpy(&usb_muxes[USBC_PORT_C1], + &usbc1_ps8802, + sizeof(struct usb_mux)); + + /* Set the AMD FP5 as the secondary MUX */ + usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux; + + /* Don't have the AMD FP5 flip */ + usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP; + + } else if (ec_config_has_usbc1_retimer_ps8818()) { + ccprints("C1 PS8818 detected"); + + /* + * Main MUX is FP5, secondary MUX is PS8818 + * + * Replace usb_muxes[USBC_PORT_C1] with the AMD FP5 + * table entry. + */ + memcpy(&usb_muxes[USBC_PORT_C1], + &usbc1_amd_fp5_usb_mux, + sizeof(struct usb_mux)); + + /* Set the PS8818 as the secondary MUX */ + usb_muxes[USBC_PORT_C1].next_mux = &usbc1_ps8818; + } +} +DECLARE_HOOK(HOOK_INIT, setup_mux, HOOK_PRIO_DEFAULT); + +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ +#include "driver/retimer/ps8802.h" +#include "driver/retimer/ps8818.h" +static void probe_setup_mux_backup(void) +{ + if (usb_muxes[USBC_PORT_C1].driver != NULL) + return; + + /* + * Identifying a PS8818 is faster than the PS8802, + * so do it first. + */ + if (ps8818_detect(&usbc1_ps8818) == EC_SUCCESS) { + set_cbi_fw_config(0x00004000); + setup_mux(); + } else if (ps8802_detect(&usbc1_ps8802) == EC_SUCCESS) { + set_cbi_fw_config(0x00004001); + setup_mux(); + } +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, probe_setup_mux_backup, HOOK_PRIO_DEFAULT); + +struct usb_mux usb_muxes[] = { + [USBC_PORT_C0] = { + .usb_port = USBC_PORT_C0, + .i2c_port = I2C_PORT_USB_AP_MUX, + .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, + .driver = &amd_fp5_usb_mux_driver, + .next_mux = &usbc0_pi3dpx1207_usb_retimer, + }, + [USBC_PORT_C1] = { + /* Filled in dynamically at startup */ + }, +}; +BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); diff --git a/board/morphius/board.h b/board/morphius/board.h index bd017988c6..95e5bda88f 100644 --- a/board/morphius/board.h +++ b/board/morphius/board.h @@ -159,6 +159,18 @@ static inline bool ec_config_has_usbc1_retimer_ps8818(void) HAS_USBC1_RETIMER_PS8818); } + +#define PORT_TO_HPD(port) ((port == 0) \ + ? GPIO_USB_C0_HPD \ + : (ec_config_has_usbc1_retimer_ps8802()) \ + ? GPIO_DP1_HPD \ + : GPIO_DP2_HPD) + +extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer; +extern const struct usb_mux usbc1_ps8802; +extern const struct usb_mux usbc1_ps8818; +extern struct usb_mux usbc1_amd_fp5_usb_mux; + #endif /* !__ASSEMBLER__ */ diff --git a/board/trembyle/board.c b/board/trembyle/board.c index 0f476e047f..7454acd4e7 100644 --- a/board/trembyle/board.c +++ b/board/trembyle/board.c @@ -6,10 +6,12 @@ /* Trembyle board configuration */ #include "button.h" +#include "cbi_ec_fw_config.h" #include "driver/accelgyro_bmi160.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" #include "driver/retimer/ps8811.h" +#include "driver/usb_mux/amd_fp5.h" #include "extpower.h" #include "fan.h" #include "fan_chip.h" @@ -24,6 +26,8 @@ #include "system.h" #include "task.h" #include "usb_charge.h" +#include "usb_mux.h" + #include "gpio_list.h" #define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args) @@ -221,3 +225,82 @@ static void ps8811_retimer_off(void) ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); } DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, ps8811_retimer_off, HOOK_PRIO_DEFAULT); + +/***************************************************************************** + * USB-C MUX/Retimer dynamic configuration + */ +static void setup_mux(void) +{ + if (ec_config_has_usbc1_retimer_ps8802()) { + ccprints("C1 PS8802 detected"); + + /* + * Main MUX is PS8802, secondary MUX is modified FP5 + * + * Replace usb_muxes[USBC_PORT_C1] with the PS8802 + * table entry. + */ + memcpy(&usb_muxes[USBC_PORT_C1], + &usbc1_ps8802, + sizeof(struct usb_mux)); + + /* Set the AMD FP5 as the secondary MUX */ + usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux; + + /* Don't have the AMD FP5 flip */ + usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP; + + } else if (ec_config_has_usbc1_retimer_ps8818()) { + ccprints("C1 PS8818 detected"); + + /* + * Main MUX is FP5, secondary MUX is PS8818 + * + * Replace usb_muxes[USBC_PORT_C1] with the AMD FP5 + * table entry. + */ + memcpy(&usb_muxes[USBC_PORT_C1], + &usbc1_amd_fp5_usb_mux, + sizeof(struct usb_mux)); + + /* Set the PS8818 as the secondary MUX */ + usb_muxes[USBC_PORT_C1].next_mux = &usbc1_ps8818; + } +} +DECLARE_HOOK(HOOK_INIT, setup_mux, HOOK_PRIO_DEFAULT); + +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ +#include "driver/retimer/ps8802.h" +#include "driver/retimer/ps8818.h" +static void probe_setup_mux_backup(void) +{ + if (usb_muxes[USBC_PORT_C1].driver != NULL) + return; + + /* + * Identifying a PS8818 is faster than the PS8802, + * so do it first. + */ + if (ps8818_detect(&usbc1_ps8818) == EC_SUCCESS) { + set_cbi_fw_config(0x00004000); + setup_mux(); + } else if (ps8802_detect(&usbc1_ps8802) == EC_SUCCESS) { + set_cbi_fw_config(0x00004001); + setup_mux(); + } +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, probe_setup_mux_backup, HOOK_PRIO_DEFAULT); + +struct usb_mux usb_muxes[] = { + [USBC_PORT_C0] = { + .usb_port = USBC_PORT_C0, + .i2c_port = I2C_PORT_USB_AP_MUX, + .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, + .driver = &amd_fp5_usb_mux_driver, + .next_mux = &usbc0_pi3dpx1207_usb_retimer, + }, + [USBC_PORT_C1] = { + /* Filled in dynamically at startup */ + }, +}; +BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); diff --git a/board/trembyle/board.h b/board/trembyle/board.h index c8202c8747..28c6a33bdb 100644 --- a/board/trembyle/board.h +++ b/board/trembyle/board.h @@ -163,6 +163,18 @@ static inline bool ec_config_has_usbc1_retimer_ps8818(void) HAS_USBC1_RETIMER_PS8818); } + +#define PORT_TO_HPD(port) ((port == 0) \ + ? GPIO_USB_C0_HPD \ + : (ec_config_has_usbc1_retimer_ps8802()) \ + ? GPIO_DP1_HPD \ + : GPIO_DP2_HPD) + +extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer; +extern const struct usb_mux usbc1_ps8802; +extern const struct usb_mux usbc1_ps8818; +extern struct usb_mux usbc1_amd_fp5_usb_mux; + #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */ diff --git a/driver/retimer/ps8802.c b/driver/retimer/ps8802.c index c4a9a5478b..27ec41c31d 100644 --- a/driver/retimer/ps8802.c +++ b/driver/retimer/ps8802.c @@ -189,6 +189,7 @@ int ps8802_i2c_wake(const struct usb_mux *me) return rv; } +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ int ps8802_detect(const struct usb_mux *me) { int rv = EC_ERROR_NOT_POWERED; diff --git a/driver/retimer/ps8802.h b/driver/retimer/ps8802.h index 2e4a301275..8a370d6950 100644 --- a/driver/retimer/ps8802.h +++ b/driver/retimer/ps8802.h @@ -68,6 +68,8 @@ extern const struct usb_mux_driver ps8802_usb_mux_driver; int ps8802_i2c_wake(const struct usb_mux *me); + +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ int ps8802_detect(const struct usb_mux *me); int ps8802_i2c_read(const struct usb_mux *me, int page, int offset, int *data); diff --git a/driver/retimer/ps8818.c b/driver/retimer/ps8818.c index e70b8bf986..c652673986 100644 --- a/driver/retimer/ps8818.c +++ b/driver/retimer/ps8818.c @@ -98,6 +98,7 @@ int ps8818_i2c_field_update8(const struct usb_mux *me, int page, int offset, return rv; } +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ int ps8818_detect(const struct usb_mux *me) { int rv = EC_ERROR_NOT_POWERED; diff --git a/driver/retimer/ps8818.h b/driver/retimer/ps8818.h index c761284cf8..8847e54291 100644 --- a/driver/retimer/ps8818.h +++ b/driver/retimer/ps8818.h @@ -80,6 +80,7 @@ extern const struct usb_mux_driver ps8818_usb_retimer_driver; +/* TODO(b:151232257) Remove probe code when hardware supports CBI */ int ps8818_detect(const struct usb_mux *me); int ps8818_i2c_read(const struct usb_mux *me, |