diff options
author | Denis Brockus <dbrockus@google.com> | 2020-08-19 15:22:56 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-21 00:55:20 +0000 |
commit | 78e85a45ea8ce24041bce74bcc2f80422531eca5 (patch) | |
tree | e77e3f34174a46a657720a499370818432ad4be3 | |
parent | b8e8fd1a2757338a3b502f40e9aca442e5959f2e (diff) | |
download | chrome-ec-78e85a45ea8ce24041bce74bcc2f80422531eca5.tar.gz |
TCPMv2: PR_Swap SRC->SNK should send PS_RDY in current AMS
The SRC->SNK PR_Swap is currently starting a new AMS for the
SNK PS_RDY and this causes the partner to disconnect from the
bus instead of continuing with the swap.
BUG=b:165794652
BRANCH=none
TEST=DUT-DUT PR_Swap
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: Id953a9b6f78057777617d06f518eb17b061b6f92
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2365057
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | common/usbc/usb_prl_sm.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c index 6a065d0d31..41e1a6b58f 100644 --- a/common/usbc/usb_prl_sm.c +++ b/common/usbc/usb_prl_sm.c @@ -786,16 +786,26 @@ static void prl_tx_wait_for_message_request_run(const int port) */ if (IS_ENABLED(CONFIG_USB_PD_REV30) && is_sop_rev30(port) && pe_in_local_ams(port)) { - if (pd_get_power_role(port) == PD_ROLE_SOURCE) { + if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_SINK_NG)) { + /* + * Setting the TxSinkNG requires us to wait to allow + * the SNK a chance to receive the signal. If we are + * already in a source initiated AMS there is no + * reason to set that again and perform the wait. In + * the case of a multi-message AMS, like PR_Swap's + * PS_RDY, we want to continue the AMS even though + * our role may have changed. + * + * Fall through + */ + } else if (pd_get_power_role(port) == PD_ROLE_SOURCE) { /* * Start of SRC AMS notification received from * Policy Engine */ - if (!PRL_TX_CHK_FLAG(port, PRL_FLAGS_SINK_NG)) { - PRL_TX_SET_FLAG(port, PRL_FLAGS_SINK_NG); - set_state_prl_tx(port, PRL_TX_SRC_SOURCE_TX); - return; - } + PRL_TX_SET_FLAG(port, PRL_FLAGS_SINK_NG); + set_state_prl_tx(port, PRL_TX_SRC_SOURCE_TX); + return; } else { /* * Start of SNK AMS notification received from |