summaryrefslogtreecommitdiff
path: root/driver/tcpm
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-09-02 09:01:37 -0600
committerCommit Bot <commit-bot@chromium.org>2021-09-02 17:34:42 +0000
commit92229de1df4976c93654709fdc164525356b266d (patch)
treeead7fc38ce5159e0b337bb3dabddeb33972f5327 /driver/tcpm
parent6d0f74cfeb8d77a39bdc1f48b5adb2bcd7496433 (diff)
downloadchrome-ec-92229de1df4976c93654709fdc164525356b266d.tar.gz
ps8xxx: Fix PD task hang if PS8xxx device is missing
CL:3084331 added logic to retry reading the PS8xxx FW version register to ensure the chip has woken up from low power mode. If the PS8xxx device is damaged/missing, there was an unbounded loop so the initialization never completed, hanging the corresponding PD task. BUG=b:198619831 BRANCH=none TEST=Verify herobrine boots AP when the battery and right I/O board are disconnected. Also observe "LPM recovery failed" reported on the console for the missing type-C port. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I578f20a9a63dd54fc777dcc0acc26a7540a1bb46 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139975 Reviewed-by: Michał Barnaś <mb@semihalf.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'driver/tcpm')
-rw-r--r--driver/tcpm/ps8xxx.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index 1742f19aeb..3bc85f48e8 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -614,6 +614,9 @@ static int ps8xxx_lpm_recovery_delay(int port)
val = 0;
for (;;) {
+ if (timestamp_expired(deadline, NULL))
+ return EC_ERROR_TIMEOUT;
+
status = tcpc_read(port, fw_reg, &val);
if (status != EC_SUCCESS) {
/* wait for chip to wake up */
@@ -623,8 +626,6 @@ static int ps8xxx_lpm_recovery_delay(int port)
if (val != 0)
break;
msleep(1);
- if (timestamp_expired(deadline, NULL))
- return EC_ERROR_TIMEOUT;
}
return EC_SUCCESS;