summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-03-03 16:45:43 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-04 17:09:22 +0000
commit756dc91b0a57aa6d557ee4cb486972d8a7b8106a (patch)
tree801c453015abf569995045735b2da79c9f4ab402
parentebc185ff354d01da6182397790c6d886153f439c (diff)
downloadchrome-ec-756dc91b0a57aa6d557ee4cb486972d8a7b8106a.tar.gz
RAA489000: Clear debug accessory state on init
During our first boot, clear out any residual state left from past debug accessory connections. In most cases, the TC state machine or PD task init can set open in order to ensure the TCPC doesn't get wedged. However, there is still a lingering corner case when the EC is reset through the security chip on ITE platforms. Always set open during init if we have the power to survive it to catch this case. BRANCH=None BUG=b:177870522 TEST=on galtic, run refresh+power resets with servo_v4 sink plugged in and verify the port does not become stuck. Also run refresh+power resets with a charger and hub plugged in to verify they connect fine after the reset. Also verify battery-less boot still works Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ia25959cae4d42163ac03280a319d785193e29422 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2733916 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/tcpm/raa489000.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/driver/tcpm/raa489000.c b/driver/tcpm/raa489000.c
index 2ba9f44d10..11f38b5893 100644
--- a/driver/tcpm/raa489000.c
+++ b/driver/tcpm/raa489000.c
@@ -60,6 +60,7 @@ int raa489000_init(int port)
int device_id;
int i2c_port;
struct charge_port_info chg = { 0 };
+ static bool first_init_done[CONFIG_USB_PD_PORT_MAX_COUNT];
/* Perform unlock sequence */
rv = tcpc_write16(port, 0xAA, 0xDAA0);
@@ -212,6 +213,20 @@ int raa489000_init(int port)
if (rv)
CPRINTS("c%d: failed to set Vbus Target Voltage", port);
+ if (!first_init_done[port]) {
+ first_init_done[port] = true;
+
+ /*
+ * Ensure we detach from any previous debug connections if we
+ * have enough battery to survive Vbus loss. The PD task will
+ * often start with open CC lines, however this is not the case
+ * for ITE ECs when they are reset by the security chip since
+ * they cannot distinguish power on from a reset.
+ */
+ if (pd_is_battery_capable())
+ tcpm_debug_detach(port);
+ }
+
return rv;
}