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>
This commit is contained in:
Alec Berg
2015-09-21 14:28:40 -07:00
committed by chrome-bot
parent 95ea672601
commit c6deb91139

View File

@@ -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]));