diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-04-30 15:06:25 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-07 20:45:49 -0700 |
commit | abbde30dd527568d04f6baf2557e668bb0597f35 (patch) | |
tree | e55c43791f073fd2b516aeb2a6790051f4fe8ffc | |
parent | 8ba6446d97ea81acaf1fd8e3754295b4e3f33f31 (diff) | |
download | chrome-ec-abbde30dd527568d04f6baf2557e668bb0597f35.tar.gz |
anx7447: Set mux for USB3.0 devices
This patch makes the EC configure the mux for USB3.0 devices correctly.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:77976249,b:78239795
BRANCH=none
TEST=Verify on Nami USB3.0 devices are recognized reliably on anx7447 port.
Flip the device and verify the same.
Change-Id: I3813bc6631d9a971a7d04a0593b9381c00c3ae5e
Reviewed-on: https://chromium-review.googlesource.com/1036470
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | driver/tcpm/anx7447.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c index cb4e4522fa..f4f5684cc0 100644 --- a/driver/tcpm/anx7447.c +++ b/driver/tcpm/anx7447.c @@ -16,6 +16,9 @@ #include "usb_pd.h" #include "util.h" +#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) +#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) + #define ANX7447_VENDOR_ALERT (1 << 15) #define ANX7447_REG_STATUS 0x82 @@ -422,47 +425,57 @@ static int anx7447_mux_init(int port) return EC_SUCCESS; } +/* + * Set mux. + * + * sstx and ssrx are the USB superspeed transmit and receive pairs. ml is the + * DisplayPort Main Link. There are four lanes total. For example, DP cases + * connect them all and dock cases connect 2 DP and USB. + * + * a2, a3, a10, a11, b2, b3, b10, b11 are pins on the USB-C connector. + */ static int anx7447_mux_set(int port, mux_state_t mux_state) { int cc_direction; mux_state_t mux_type; - int sw_sel = 0x30, aux_sw = 0x00; - int rv = EC_SUCCESS; + int sw_sel = 0x00, aux_sw = 0x00; + int rv; cc_direction = mux_state & MUX_POLARITY_INVERTED; mux_type = mux_state & TYPEC_MUX_DOCK; - ccprintf("mux_state = 0x%x, mux_type = 0x%x\n", mux_state, mux_type); + CPRINTS("mux_state = 0x%x, mux_type = 0x%x\n", mux_state, mux_type); - if (mux_type == TYPEC_MUX_NONE) { - /* set MUX control as no connection */ - sw_sel = 0x00; - } - - /* type-C interface detect cable plug direction - * is positive orientation - */ - /* CC1_CONNECTED */ if (cc_direction == 0) { /* cc1 connection */ if (mux_type == TYPEC_MUX_DOCK) { - /* L0-a10/11,L1-b2/b3, sstx-a2/a3, ssrx-b10/11 */ + /* ml0-a10/11, ml1-b2/b3, sstx-a2/a3, ssrx-b10/11 */ sw_sel = 0x21; + /* aux+ <-> sbu1, aux- <-> sbu2 */ aux_sw = 0x03; } else if (mux_type == TYPEC_MUX_DP) { - /* L0-a10/11,L1-b2/b3, L2-a2/a3, L3-b10/11 */ + /* ml0-a10/11, ml1-b2/b3, ml2-a2/a3, ml3-b10/11 */ sw_sel = 0x09; + /* aux+ <-> sbu1, aux- <-> sbu2 */ aux_sw = 0x03; + } else if (mux_type == TYPEC_MUX_USB) { + /* ssrxp<->b11, ssrxn<->b10, sstxp<->a2, sstxn<->a3 */ + sw_sel = 0x20; } } else { /* cc2 connection */ if (mux_type == TYPEC_MUX_DOCK) { - /* L0-b10/11,L1-a2/b3, sstx-b2/a3, ssrx-a10/11 */ + /* ml0-b10/11, ml1-a2/b3, sstx-b2/a3, ssrx-a10/11 */ sw_sel = 0x12; + /* aux+ <-> sbu2, aux- <-> sbu1 */ aux_sw = 0x0C; } else if (mux_type == TYPEC_MUX_DP) { - /* L0-b10/11,L1-a2/b3, L2-b2/a3, L3-a10/11 */ + /* ml0-b10/11, ml1-a2/b3, ml2-b2/a3, ml3-a10/11 */ sw_sel = 0x06; + /* aux+ <-> sbu2, aux- <-> sbu1 */ aux_sw = 0x0C; + } else if (mux_type == TYPEC_MUX_USB) { + /* ssrxp<->a11, ssrxn<->a10, sstxp<->b2, sstxn<->b3 */ + sw_sel = 0x10; } } rv = tcpc_write(port, ANX7447_REG_TCPC_SWITCH_0, sw_sel); |