summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-09-21 14:28:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-21 22:12:41 -0700
commitc6deb911399ee6ec5e747b3f403c0c44fbf0eef4 (patch)
tree38ecb99646699237092d69953f8d99ab0a4a1773
parent95ea672601681d01166cf2b8c6cbd297dcc9295a (diff)
downloadchrome-ec-c6deb911399ee6ec5e747b3f403c0c44fbf0eef4.tar.gz
tcpc: don't allow tcpc write command until initialized
Don't act on a TCPC write command until we are done initializing. This fixes an issue where if the TCPC reboots while the TCPM (EC in our case) is still functioning, then we can get into a weird state where we are changing the CC termination as we are still initializing, which can cause us to get stuck with a phantom connection (we apply one CC termination, but think we are applying the opposite termination, causing us to 'see' a connected device). BUG=none BRANCH=none TEST=load on glados. make sure dual-role toggling is on on the EC and reboot PD MCU a bunch of times and make sure the EC doesn't detect a phantom connection. Change-Id: I2dffc3c2a1ca70903e17db0e012e994835cb9962 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/300681 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/usb_pd_tcpc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c
index 73a0447fae..494eea4913 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -1078,6 +1078,11 @@ void pd_vbus_evt_p1(enum gpio_signal signal)
static void tcpc_i2c_write(int port, int reg, int len, uint8_t *payload)
{
uint16_t alert;
+
+ /* If we are not yet initialized, ignore any write command */
+ if (pd[port].power_status & TCPC_REG_POWER_STATUS_UNINIT)
+ return;
+
switch (reg) {
case TCPC_REG_ROLE_CTRL:
tcpc_set_cc(port, TCPC_REG_ROLE_CTRL_CC1(payload[1]));