diff options
-rw-r--r-- | baseboard/zork/variant_dalboz.c | 22 | ||||
-rw-r--r-- | board/berknip/board.c | 25 | ||||
-rw-r--r-- | board/dalboz/board.c | 22 | ||||
-rw-r--r-- | board/ezkinil/board.c | 25 | ||||
-rw-r--r-- | driver/usb_mux/ps8743.c | 8 |
5 files changed, 23 insertions, 79 deletions
diff --git a/baseboard/zork/variant_dalboz.c b/baseboard/zork/variant_dalboz.c index 6c7efda481..517532a7bb 100644 --- a/baseboard/zork/variant_dalboz.c +++ b/baseboard/zork/variant_dalboz.c @@ -174,34 +174,12 @@ const struct usb_mux usbc0_sbu_mux = { .driver = &usbc0_sbu_mux_driver, }; -static int usbc1_hpd_set_mux(const struct usb_mux *me, mux_state_t mux_state) -{ - if (mux_state & USB_PD_MUX_DP_ENABLED) - /* Enable IN_HPD on the DB */ - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); - else - /* Disable IN_HPD on the DB */ - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); - - return EC_SUCCESS; -} - -const struct usb_mux_driver usbc1_hpd_mux_driver = { - .set = usbc1_hpd_set_mux, -}; - -const struct usb_mux usbc1_hpd_mux = { - .usb_port = USBC_PORT_C1, - .driver = &usbc1_hpd_mux_driver, -}; - struct usb_mux usbc1_amd_fp5_usb_mux = { .usb_port = USBC_PORT_C1, .i2c_port = I2C_PORT_USB_AP_MUX, .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, .driver = &amd_fp5_usb_mux_driver, .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP, - .next_mux = &usbc1_hpd_mux, }; struct usb_mux usb_muxes[] = { diff --git a/board/berknip/board.c b/board/berknip/board.c index 709e1436c5..025a77ad95 100644 --- a/board/berknip/board.c +++ b/board/berknip/board.c @@ -245,31 +245,14 @@ static int board_tusb544_mux_set(const struct usb_mux *me, static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state) { - int rv = EC_SUCCESS; - int reg = 0; - - rv = ps8743_read(me, PS8743_REG_MODE, ®); - if (rv) - return rv; - - /* Disable FLIP pin, enable I2C control. */ - reg |= PS8743_MODE_FLIP_REG_CONTROL; - /* Disable CE_DP pin, enable I2C control. */ - reg |= PS8743_MODE_DP_REG_CONTROL; - - /* DP specific config */ - if (mux_state & USB_PD_MUX_DP_ENABLED) { + if (mux_state & USB_PD_MUX_DP_ENABLED) /* Enable IN_HPD on the DB */ ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); - /* Disable USB mode on DB */ - ioex_set_level(IOEX_USB_C1_DATA_EN, 0); - } else { + else /* Disable IN_HPD on the DB */ ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); - /* Enable USB mode on DB */ - ioex_set_level(IOEX_USB_C1_DATA_EN, 1); - } - return ps8743_write(me, PS8743_REG_MODE, reg); + + return EC_SUCCESS; } const struct usb_mux usbc1_tusb544 = { diff --git a/board/dalboz/board.c b/board/dalboz/board.c index 85d7f32b11..3de145881c 100644 --- a/board/dalboz/board.c +++ b/board/dalboz/board.c @@ -161,21 +161,14 @@ void pcal6408_interrupt(enum gpio_signal signal) static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state) { - int rv = EC_SUCCESS; - int reg = 0; + if (mux_state & USB_PD_MUX_DP_ENABLED) + /* Enable IN_HPD on the DB */ + ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); + else + /* Disable IN_HPD on the DB */ + ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); - rv = ps8743_read(me, PS8743_REG_MODE, ®); - if (rv) - return rv; - - /* Disable FLIP pin, enable I2C control. */ - reg |= PS8743_MODE_FLIP_REG_CONTROL; - /* Disable CE_USB pin, enable I2C control. */ - reg |= PS8743_MODE_USB_REG_CONTROL; - /* Disable CE_DP pin, enable I2C control. */ - reg |= PS8743_MODE_DP_REG_CONTROL; - - return ps8743_write(me, PS8743_REG_MODE, reg); + return EC_SUCCESS; } static void setup_fw_config(void) @@ -192,6 +185,7 @@ static void setup_fw_config(void) ccprints("PS8740 USB MUX"); usb_muxes[USBC_PORT_C1].i2c_addr_flags = PS8740_I2C_ADDR0_FLAG; usb_muxes[USBC_PORT_C1].driver = &ps8740_usb_mux_driver; + usb_muxes[USBC_PORT_C1].board_set = NULL; } if (ec_config_get_usb_db() == DALBOZ_DB_D_OPT2_USBA_HDMI) { diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c index 330322eef7..d3e5e15e5e 100644 --- a/board/ezkinil/board.c +++ b/board/ezkinil/board.c @@ -269,31 +269,14 @@ static int board_tusb544_mux_set(const struct usb_mux *me, static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state) { - int rv = EC_SUCCESS; - int reg = 0; - - rv = ps8743_read(me, PS8743_REG_MODE, ®); - if (rv) - return rv; - - /* Disable FLIP pin, enable I2C control. */ - reg |= PS8743_MODE_FLIP_REG_CONTROL; - /* Disable CE_DP pin, enable I2C control. */ - reg |= PS8743_MODE_DP_REG_CONTROL; - - /* DP specific config */ - if (mux_state & USB_PD_MUX_DP_ENABLED) { + if (mux_state & USB_PD_MUX_DP_ENABLED) /* Enable IN_HPD on the DB */ ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); - /* Disable USB mode on DB */ - ioex_set_level(IOEX_USB_C1_DATA_EN, 0); - } else { + else /* Disable IN_HPD on the DB */ ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); - /* Enable USB mode on DB */ - ioex_set_level(IOEX_USB_C1_DATA_EN, 1); - } - return ps8743_write(me, PS8743_REG_MODE, reg); + + return EC_SUCCESS; } const struct usb_mux usbc1_tusb544 = { diff --git a/driver/usb_mux/ps8743.c b/driver/usb_mux/ps8743.c index 413b37e322..982bfbd91e 100644 --- a/driver/usb_mux/ps8743.c +++ b/driver/usb_mux/ps8743.c @@ -74,7 +74,13 @@ static int ps8743_init(const struct usb_mux *me) /* Writes control register to set switch mode */ static int ps8743_set_mux(const struct usb_mux *me, mux_state_t mux_state) { - uint8_t reg = 0; + /* + * For CE_DP, CE_USB, and FLIP, disable pin control and enable I2C + * control. + */ + uint8_t reg = (PS8743_MODE_DP_REG_CONTROL | + PS8743_MODE_USB_REG_CONTROL | + PS8743_MODE_FLIP_REG_CONTROL); if (mux_state & USB_PD_MUX_USB_ENABLED) reg |= PS8743_MODE_USB_ENABLE; |