summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2020-06-05 16:28:10 +0200
committerCommit Bot <commit-bot@chromium.org>2020-06-09 22:03:22 +0000
commit9f95ab8d1655d141dcceec18d6730c9d6451e4a9 (patch)
treef9c2db8f050bc2454157c875a4ca5980fee402b8
parent5aebd36881a4c0d5be6bfeabc036aaf0ee68df79 (diff)
downloadchrome-ec-9f95ab8d1655d141dcceec18d6730c9d6451e4a9.tar.gz
usb_pd_protocol: Invalidate last message id in SRC_SWAP_STANDBY state
In SRC_SWAP_STANDBY state when PD_CTRL_PS_RDY message is received, message id counter is cleared, but last message id remain the same. Situation where last message before power swap had message id equal to 0, and first message after power swap had message id equal to 0, was reported as message duplication and as result hard reset was triggered. From ServoV4 perspective: C1 RECV 0e6a/0 <-- Received PR_SWAP with msg_id 7 C1 CTRL[3]>1 <-- Accept it C1 st27 SRC_SWAP_SNK_DISABLE C1 st28 SRC_SWAP_SRC_DISABLE C1 st29 SRC_SWAP_STANDBY C1 CTRL[6]>1 <-- Send PS_RDY C1 RECV 0166/0 <-- Received PS_RDY with msg_id 0 due to msg_id overflow C1 st5 SNK_DISCOVERY C1 Repeat msg_id 0 <-- DUT sent capabilities with msg_id 0 C1 HARD RST RX <-- DUT sent hard reset due to timeout BUG=none BRANCH=none TEST=Flash nocturne with EC compiled with TCPMv2/PD3.0 support. Flash ServoV4 with this fix. Run firmware_PDConnect, test should pass. During test check if ServoV4 is not receiving hard reset requests. TEST=Flash nocturne with EC compiled with TCPMv2/PD3.0 support. Flash ServoV4 with this fix. Run 'fakedisconnect 100 10000' in ServoV4 console. Run 'pd 0 swap power' in DUT console. During power swap no hard reset states should be entered. Change-Id: I902d153a4f427c6a7239f8ff8b70efc9418da31a Signed-off-by: Patryk Duda <pdk@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2231365 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/usb_pd_protocol.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 526769a8e2..442432890e 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1733,6 +1733,7 @@ static void handle_ctrl_request(int port, uint32_t head,
} else if (pd[port].task_state == PD_STATE_SRC_SWAP_STANDBY) {
/* reset message ID and swap roles */
pd[port].msg_id = 0;
+ invalidate_last_message_id(port);
pd_set_power_role(port, PD_ROLE_SINK);
pd_update_roles(port);
/*