diff options
author | David Huang <david.huang@quanta.corp-partner.google.com> | 2020-03-24 15:21:41 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-26 11:04:46 +0000 |
commit | a88bd6dd2ce985f15cee44e95562639a4112f283 (patch) | |
tree | dd8f39f37585d5da510399411d445f33197930e9 | |
parent | c266c3c4429bddc7ce54c5a389c51b941ed1e1c4 (diff) | |
download | chrome-ec-a88bd6dd2ce985f15cee44e95562639a4112f283.tar.gz |
Ezkinil: Add FSUSB42UMX driver
Add FSUSB42UMX support. This chip is used as SBU mux of usb
c0 port.
BUG=none
BRANCH=ezkinil
TEST=make buildall -j
Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com>
Change-Id: I566723de6b996652dc611262b609c08fe0d4b124
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2115906
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | board/ezkinil/board.c | 37 | ||||
-rw-r--r-- | board/ezkinil/gpio.inc | 1 |
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 */ |