summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2020-09-30 16:50:18 +0800
committerCommit Bot <commit-bot@chromium.org>2020-10-16 11:55:52 +0000
commit932abf5c9c9f46ef8428e889c4380b6cbfa55062 (patch)
treeec42690b97c641fb9a1111ca920ec3436d39085d /common
parent94b07b000f55eb8922014b4a09a91a6d9866b70f (diff)
downloadchrome-ec-932abf5c9c9f46ef8428e889c4380b6cbfa55062.tar.gz
TCPMv2: clear TC_FLAGS_PR_IN_PROGRESS if ProtocolError
While doing PRS_SNK_SRC on a DRP hub by unpluging the charger, if the port-partner can't hold tSrcTransition, and it might brown out at any time in PR_SWAP AMS (e.g. brown out and can't reply GoodCRC to Accept), and this will cause a ProtocolError. In that case, we should clear the TC_FLAGS_PR_IN_PROGRESS so that the TC sm could start to monitor the VBUS level and restart the PD state machine. BUG=b:169113820 TEST=unplug the charger from a DRP hub, and DUT starts to source the hub instead of staying at SNK_READY. BRANCH=none Change-Id: Iccb85a13731004a214446ce4d915fea58170ea00 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2440015 Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usbc/usb_pe_drp_sm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 2f61b2efe3..f6d150c47d 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -1156,6 +1156,7 @@ void pe_report_error(int port, enum pe_error e, enum tcpm_transmit_type type)
*/
if ((get_state_pe(port) == PE_SRC_SEND_CAPABILITIES ||
get_state_pe(port) == PE_SRC_TRANSITION_SUPPLY ||
+ get_state_pe(port) == PE_PRS_SNK_SRC_EVALUATE_SWAP ||
get_state_pe(port) == PE_PRS_SRC_SNK_WAIT_SOURCE_ON ||
get_state_pe(port) == PE_SRC_DISABLED ||
get_state_pe(port) == PE_SRC_DISCOVERY ||
@@ -4131,6 +4132,19 @@ static void pe_prs_snk_src_evaluate_swap_run(int port)
set_state_pe(port, PE_SNK_READY);
}
}
+
+ if (PE_CHK_FLAG(port, PE_FLAGS_PROTOCOL_ERROR)) {
+ PE_CLR_FLAG(port, PE_FLAGS_PROTOCOL_ERROR);
+ /*
+ * Protocol Error occurs while PR swap, this may
+ * brown out if the port-parnter can't hold VBUS
+ * for tSrcTransition. Notify TC that we end the PR
+ * swap and start to watch VBUS.
+ *
+ * TODO(b:155181980): issue soft reset on protocol error.
+ */
+ tc_pr_swap_complete(port, 0);
+ }
}
/**