diff options
author | Edward Hill <ecgh@chromium.org> | 2020-07-06 09:46:18 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-08 00:29:14 +0000 |
commit | ea8153ff2ddb9aae62b32fc9440f11326468fca4 (patch) | |
tree | 07153ad5362c3808111c2023d791c0a39bceb353 /driver/tcpm/tcpci.c | |
parent | afd3bddc2b91717042c3e7b8bf3d1169c3fcd1c9 (diff) | |
download | chrome-ec-ea8153ff2ddb9aae62b32fc9440f11326468fca4.tar.gz |
tcpci: Set TCPC_REG_TCPC_CTRL_DEBUG_ACC_CONTROL
Set TCPC_CONTROL.DebugAccessoryControl = 1 to control by TCPM,
not TCPC. If TCPC is left in control, then it will enable VBus
when Sink Debug accessory device is detected (which is during
AttachWait.SRC). We want to instead control this ourselves from
TCPM.
BUG=b:160253746
BRANCH=none
TEST=dut-control servo_v4_role:snk (with CL:2276463 reverted)
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: Ib71f2b76949eeb25e24669e5bf297123d2685be3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2282691
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Amit Maoz <amit.maoz@nuvoton.corp-partner.google.com>
Diffstat (limited to 'driver/tcpm/tcpci.c')
-rw-r--r-- | driver/tcpm/tcpci.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index d714b4d636..f05d9868e9 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -1301,6 +1301,7 @@ int tcpci_tcpm_init(int port) int error; int power_status; int tries = TCPM_INIT_TRIES; + int tcpc_ctrl; if (port >= board_get_usb_pd_port_count()) return EC_ERROR_INVAL; @@ -1320,18 +1321,24 @@ int tcpci_tcpm_init(int port) } /* + * Set TCPC_CONTROL.DebugAccessoryControl = 1 to control by TCPM, + * not TCPC. + */ + tcpc_ctrl = TCPC_REG_TCPC_CTRL_DEBUG_ACC_CONTROL; + + /* * For TCPCI Rev 2.0, unless the TCPM sets * TCPC_CONTROL.EnableLooking4ConnectionAlert bit, TCPC by default masks * Alert assertion when CC_STATUS.Looking4Connection changes state. */ if (tcpc_config[port].flags & TCPC_FLAGS_TCPCI_REV2_0) { - error = tcpc_update8(port, TCPC_REG_TCPC_CTRL, - TCPC_REG_TCPC_CTRL_EN_LOOK4CONNECTION_ALERT, - MASK_SET); - if (error) - CPRINTS("C%d: Failed to init TCPC_CTRL!", port); + tcpc_ctrl |= TCPC_REG_TCPC_CTRL_EN_LOOK4CONNECTION_ALERT; } + error = tcpc_update8(port, TCPC_REG_TCPC_CTRL, tcpc_ctrl, MASK_SET); + if (error) + CPRINTS("C%d: Failed to init TCPC_CTRL!", port); + /* * Handle and clear any alerts, since we might be coming out of low * power mode in response to an alert interrupt from the TCPC. |