summaryrefslogtreecommitdiff
path: root/board/ezkinil/board.c
diff options
context:
space:
mode:
authorDavid Huang <david.huang@quanta.corp-partner.google.com>2020-04-16 09:23:43 +0800
committerCommit Bot <commit-bot@chromium.org>2020-04-16 10:56:45 +0000
commitf6bed060ec8abbf438c2f774525c23925ed0c2ba (patch)
treea05a80a91dd13670a599afe4a07c51819b9f7702 /board/ezkinil/board.c
parentda8728f5d2eb767f7419a5e913ba3009732ad185 (diff)
downloadchrome-ec-f6bed060ec8abbf438c2f774525c23925ed0c2ba.tar.gz
Ezkinil: Set mux board tuning for TUSB544 and PS8743
Set correct mode and HPD_IN_DB for TUSB544/PS8743. BUG=b:152736880 BRANCH=ezkinil TEST=Check typec both side usb speed shows 5G in "lsusb -t" and display is workable. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: I9b16e650f15eedbcd7b35b69fdfe93c3268942f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2141371 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'board/ezkinil/board.c')
-rw-r--r--board/ezkinil/board.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c
index 6191c3403c..8859701416 100644
--- a/board/ezkinil/board.c
+++ b/board/ezkinil/board.c
@@ -254,6 +254,68 @@ struct usb_mux usb_muxes[] = {
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
+static int board_tusb544_mux_set(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;
+}
+
+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, &reg);
+ if (rv)
+ return rv;
+ /*
+ * TODO(b:152736880) Due to Ezkinil doesn't have FLIP_PIN and
+ * CE_DP_PIN, we need set 1 to this two BIT, but the name of
+ * these two bits are confusing. Need fix the name in other patch.
+ */
+ /* Disable FLIP pin detect since ezkinil don't have FLIP. */
+ reg |= PS8743_MODE_FLIP_PIN_ENABLED;
+ /* Disable CE_DP pin detect, since ezkinil don't have CE_DP. */
+ reg |= PS8743_MODE_CE_DP_ENABLED;
+
+ /* DP specific config */
+ 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 {
+ /* 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);
+}
+
+const struct usb_mux usbc1_tusb544 = {
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS1,
+ .driver = &tusb544_drv,
+ .board_set = &board_tusb544_mux_set,
+};
+const struct usb_mux usbc1_ps8743 = {
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ .board_set = &board_ps8743_mux_set,
+};
+
/*****************************************************************************
* Use FW_CONFIG to set correct configuration.
*/