summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-11-25 09:35:33 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-25 22:17:25 +0000
commit121a96efec30ca9b5fc4b34bbade26eaceb714b9 (patch)
tree38035c0de652e98fbd20b3dd1b0a742f3b8f283f
parentf9fd94f64d3294c2005048164361e3697d63a7bb (diff)
downloadchrome-ec-121a96efec30ca9b5fc4b34bbade26eaceb714b9.tar.gz
trembyle: tcpc fault needs to be cleared
We currently do not use the TCPCI fault for anything but need to clear any faults to stop an alert storm. Added debug output so we can see what is coming out in times of fault, just as an FYI. BUG=b:144126745 BRANCH=none TEST=insert-extract charger from USB-C0 and verify AC on/off Change-Id: Ifc5ffc4e18790e6fc9763bbeb334cbdff901ad43 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1934045 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--driver/tcpm/tcpci.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 21aa13cd5e..001a7ee579 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -642,6 +642,28 @@ void tcpci_tcpc_alert(int port)
if (status & TCPC_REG_ALERT_ALERT_EXT)
tcpm_alert_ext_status(port, &alert_ext);
+ /* Clear any pending faults */
+ if (status & TCPC_REG_ALERT_FAULT) {
+ int fault;
+ int fault_rv;
+
+ fault_rv = tcpc_read(port, TCPC_REG_FAULT_STATUS, &fault);
+ if (!fault_rv) {
+ CPRINTS("C%d FAULT=0x%02X", port, fault);
+
+ /* Clear any faults that are set */
+ fault_rv = tcpc_write(port,
+ TCPC_REG_FAULT_STATUS,
+ fault);
+ if (fault_rv)
+ CPRINTS("C%d Writing FAULT failed, rv=%d",
+ port, fault_rv);
+ } else {
+ CPRINTS("C%d Reading FAULT failed, rv=%d",
+ port, fault_rv);
+ }
+ }
+
/*
* Check for TX complete first b/c PD state machine waits on TX
* completion events. This will send an event to the PD tasks