diff options
author | Zick Wei <zick.wei@quanta.corp-partner.google.com> | 2020-05-27 11:58:23 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-03 05:19:33 +0000 |
commit | 2bff632b24f48533b54cf900096a40c2bf1699fa (patch) | |
tree | e88aad143fc93002f304aef130d8cad2098da122 /board/berknip | |
parent | 7d953f420f17c84078f85bc61561ff20fb835464 (diff) | |
download | chrome-ec-2bff632b24f48533b54cf900096a40c2bf1699fa.tar.gz |
berknip: add pi3usb221 driver
Add pi3usb221 support on berknip,
this chip use as SBU mux of usb c0 port.
BUG=b:148757952
BRANCH=none
TEST=verify USB type C monitor can work on both side cable on USBC0 port.
Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Change-Id: Ie800682fe12db3d2df1eb2da40fe9c39c996a580
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2216138
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'board/berknip')
-rw-r--r-- | board/berknip/board.c | 32 | ||||
-rw-r--r-- | board/berknip/gpio.inc | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/board/berknip/board.c b/board/berknip/board.c index c7a99339cb..709e1436c5 100644 --- a/board/berknip/board.c +++ b/board/berknip/board.c @@ -148,6 +148,37 @@ const struct mft_t mft_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); +/* + * USB C0 port SBU mux use standalone PI3USB221 + * chip and it need a board specific driver. + * Overall, it will use chained mux framework. + */ +static int pi3usb221_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, 0); + else + ioex_set_level(IOEX_USB_C0_SBU_FLIP, 1); + 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 = pi3usb221_set_mux, +}; +/* + * Since PI3USB221 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 */ @@ -190,6 +221,7 @@ struct usb_mux usb_muxes[] = { .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/berknip/gpio.inc b/board/berknip/gpio.inc index 461f2e26cc..f9d7a502ae 100644 --- a/board/berknip/gpio.inc +++ b/board/berknip/gpio.inc @@ -74,6 +74,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 */ |