diff options
author | Diana Z <dzigterman@chromium.org> | 2020-03-19 15:11:38 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-20 22:07:16 +0000 |
commit | 9ce65e72ce2ad6207fba220e78aab69afc2f6ee9 (patch) | |
tree | 2e611171ee8e3ec5185fb36c7bf1d7fba0b5ddca | |
parent | 97abc2628c00a7b1a0e97af00c9a42a38af9fb72 (diff) | |
download | chrome-ec-9ce65e72ce2ad6207fba220e78aab69afc2f6ee9.tar.gz |
TCPMv2: Process protocol errors within vcs_send_ps_rdy_swap
Since transmit errors may mean different things in this state based on
whether the message sent was PS_RDY or a cable SOFT_RESET, handle errors
within the state itself. Absence of a PS_RDY GoodCRC should cause a
SOFT_RESET, while absence of a cable SOFT_RESET GoodCRC may simply
indicate the cable isn't present.
BUG=b:151445255
BRANCH=None
TEST=on Trogdor, HooToo hub can complete discovery and enter DP mode
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I5bf45d28d4332c4c5d30eddabab82fef5bab2a3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2111190
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index bdca3c6512..c058c39c99 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -736,7 +736,8 @@ void pe_report_error(int port, enum pe_error e) get_state_pe(port) == PE_SRC_DISABLED || get_state_pe(port) == PE_SRC_DISCOVERY || get_state_pe(port) == PE_VDM_REQUEST || - get_state_pe(port) == PE_VDM_IDENTITY_REQUEST_CBL) { + get_state_pe(port) == PE_VDM_IDENTITY_REQUEST_CBL || + get_state_pe(port) == PE_VCS_SEND_PS_RDY_SWAP) { PE_SET_FLAG(port, PE_FLAGS_PROTOCOL_ERROR); return; } @@ -4776,6 +4777,24 @@ static void pe_vcs_send_ps_rdy_swap_run(int port) break; } } + + if (PE_CHK_FLAG(port, PE_FLAGS_PROTOCOL_ERROR)) { + PE_CLR_FLAG(port, PE_FLAGS_PROTOCOL_ERROR); + + if (pe[port].sub == PE_SUB0) { + /* PS_RDY didn't send, soft reset */ + set_state_pe(port, PE_SEND_SOFT_RESET); + } else { + /* + * Cable plug wasn't present, + * return to ready state + */ + if (pe[port].power_role == PD_ROLE_SOURCE) + set_state_pe(port, PE_SRC_READY); + else + set_state_pe(port, PE_SNK_READY); + } + } } /* |