summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-02-04 15:02:01 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-09 17:16:52 +0000
commit0609536aeecda56224265ef91d3401eb40a014a7 (patch)
tree1963d540813ddaae9df77469d2e9278332480835
parent14b9c0fe159a3928697c92b35fba0bb2d1c6372a (diff)
downloadchrome-ec-0609536aeecda56224265ef91d3401eb40a014a7.tar.gz
TCPMv2: Check for discard in cable reset state
Check for message discard and restore DPM request if cable soft reset doesn't send, then return to Ready to handle the incoming message. BRANCH=None BUG=None TEST=connect Magolor and Madoo together repeatedly and observe the connection is able to stabilize Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I28787f802a8279d318170a304e5aeac6abb03b75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2676925 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2681289 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Tested-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usbc/usb_pe_drp_sm.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index ec94201e78..dbc6bbfe2d 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -6384,21 +6384,19 @@ static void pe_vcs_cbl_send_soft_reset_entry(int port)
}
send_ctrl_msg(port, TCPC_TX_SOP_PRIME, PD_CTRL_SOFT_RESET);
- pe[port].sender_response_timer = TIMER_DISABLED;
+ pe_sender_response_msg_entry(port);
}
static void pe_vcs_cbl_send_soft_reset_run(int port)
{
bool cable_soft_reset_complete = false;
+ enum pe_msg_check msg_check;
- if (PE_CHK_FLAG(port, PE_FLAGS_TX_COMPLETE)) {
- PE_CLR_FLAG(port, PE_FLAGS_TX_COMPLETE);
- pe[port].sender_response_timer = get_time().val +
- PD_T_SENDER_RESPONSE;
- }
+ msg_check = pe_sender_response_msg_run(port);
/* Got ACCEPT or REJECT from Cable Plug */
- if (PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) {
+ if ((msg_check & PE_MSG_SENT) &&
+ PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) {
PE_CLR_FLAG(port, PE_FLAGS_MSG_RECEIVED);
cable_soft_reset_complete = true;
@@ -6426,7 +6424,8 @@ static void pe_vcs_cbl_send_soft_reset_run(int port)
}
if (cable_soft_reset_complete ||
- get_time().val > pe[port].sender_response_timer) {
+ get_time().val > pe[port].sender_response_timer ||
+ (msg_check & PE_MSG_DISCARDED)) {
if (pe_is_explicit_contract(port)) {
/* Return to PE_{SRC,SNK}_Ready state */
pe_set_ready_state(port);