summaryrefslogtreecommitdiff
path: root/board/ezkinil
diff options
context:
space:
mode:
Diffstat (limited to 'board/ezkinil')
-rw-r--r--board/ezkinil/board.c37
-rw-r--r--board/ezkinil/gpio.inc1
2 files changed, 37 insertions, 1 deletions
diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c
index 9dbf2fbb34..7a23f5cde3 100644
--- a/board/ezkinil/board.c
+++ b/board/ezkinil/board.c
@@ -168,6 +168,37 @@ const struct mft_t mft_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
+/*
+ * USB C0 port SBU mux use standalone FSUSB42UMX
+ * chip and it need a board specific driver.
+ * Overall, it will use chained mux framework.
+ */
+static int fsusb42umx_set_mux(const struct usb_mux *me, mux_state_t mux_state)
+{
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
+ ioex_set_level(IOEX_USB_C0_SBU_FLIP, 1);
+ else
+ ioex_set_level(IOEX_USB_C0_SBU_FLIP, 0);
+ return EC_SUCCESS;
+}
+/*
+ * .init is not necessary here because it has nothing
+ * to do. Primary mux will handle mux state so .get is
+ * not needed as well. usb_mux.c can handle the situation
+ * properly.
+ */
+const struct usb_mux_driver usbc0_sbu_mux_driver = {
+ .set = fsusb42umx_set_mux,
+};
+/*
+ * Since FSUSB42UMX is not a i2c device, .i2c_port and
+ * .i2c_addr_flags are not required here.
+ */
+const struct usb_mux usbc0_sbu_mux = {
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+};
+
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration
*/
@@ -208,7 +239,11 @@ 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 */
+ .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_sbu_mux,
},
[USBC_PORT_C1] = {
/* Filled in dynamically at startup */
diff --git a/board/ezkinil/gpio.inc b/board/ezkinil/gpio.inc
index f927021899..a4c284f951 100644
--- a/board/ezkinil/gpio.inc
+++ b/board/ezkinil/gpio.inc
@@ -68,6 +68,7 @@ IOEX(KB_BL_EN, EXPIN(USBC_PORT_C0, 1, 3), GPIO_OUT_LOW) /* KB Backlight Enable
IOEX(USB_C0_DATA_EN, EXPIN(USBC_PORT_C0, 1, 4), GPIO_OUT_LOW) /* C0 Data Enable */
IOEX(EN_USB_A0_5V, EXPIN(USBC_PORT_C0, 1, 5), GPIO_OUT_LOW) /* A0 5V Source Enable */
IOEX(USB_A0_CHARGE_EN_L, EXPIN(USBC_PORT_C0, 1, 6), GPIO_OUT_HIGH) /* A0 5V High Current Enable */
+IOEX(USB_C0_SBU_FLIP, EXPIN(USBC_PORT_C0, 1, 7), GPIO_OUT_LOW) /* C0 SBU Flip */
IOEX(USB_A1_RETIMER_EN, EXPIN(USBC_PORT_C1, 0, 0), GPIO_OUT_LOW) /* A1 Retimer Enable */
IOEX(USB_A1_RETIMER_RST_DB, EXPIN(USBC_PORT_C1, 0, 1), GPIO_OUT_LOW) /* A1 Retimer Reset */