diff options
author | Patryk Duda <pdk@semihalf.com> | 2020-06-01 15:03:13 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-03 10:13:02 +0000 |
commit | 177bc365a4f266103ef7b6f45a313886198150bf (patch) | |
tree | 6e37f313879d8794d74b2f03ebc1e4a93280c752 /common/usb_pd_protocol.c | |
parent | cf228dfae6ae9106be7680a571155db454e41f85 (diff) | |
download | chrome-ec-177bc365a4f266103ef7b6f45a313886198150bf.tar.gz |
usb_pd_protocol: Don't reset msg_id on ACCEPT when in SOFT_RESET state
DUT is running new TCPMv2 stack. PD3.0 enabled
When ServoV4 sends PD_CTRL_SOFT_RESET message to DUT it assigns 0
to msg_id because PD_CTRL_SOFT_RESET always has msg_id equal to 0.
DUT performs soft reset and responds with PD_CTRL_ACCEPT message.
ServoV4 receives PD_CTRL_ACCEPT and calls execute_soft_reset() which
again resets msg_id to 0. Next message sent by ServoV4 is dropped by DUT
due to msg_id duplication.
This issue was found by running firmware_PDResetSoft test against
nocturne with TCPMv2/PD3.0 stack. Test was failing after power swap (DUT as SRC)
when soft reset was initiated by ServoV4. When DUT was SNK soft reset
from ServoV4 was passing, however debugging showed that it was going to
hard reset due to negotiation failure, eg.
pd 1 soft
C1 st33 SOFT_RESET
C1 CTRL[13]>1
C1 RECV 0063/0
C1 st18 SRC_DISCOVERY
C1 Soft Rst
C1 srcCAP>1
C1 st19 SRC_NEGOCIATE
C1 st34 HARD_RESET_SEND
C1 st35 HARD_RESET_EXECUTE
C1 HARD RST TX
C1 st16 SRC_HARD_RESET_RECOVER
BRANCH=none
BUG=b/157600843
TEST=Flash nocturne with EC compiled with TCPMv2/PD3.0 support.
Flash ServoV4 with this fix.
Run firmware_PDResetSoft, test should pass.
Check if ServoV4 is not entering hard reset states
Change-Id: Ifb7c031969eb48f740e16117de72ba8bdd36fc0b
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2224804
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r-- | common/usb_pd_protocol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 37c6803a7d..81f796c246 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1385,7 +1385,6 @@ void pd_execute_hard_reset(int port) static void execute_soft_reset(int port) { - pd[port].msg_id = 0; invalidate_last_message_id(port); set_state(port, DUAL_ROLE_IF_ELSE(port, PD_STATE_SNK_DISCOVERY, PD_STATE_SRC_DISCOVERY)); @@ -1906,6 +1905,7 @@ static void handle_ctrl_request(int port, uint16_t head, break; case PD_CTRL_SOFT_RESET: execute_soft_reset(port); + pd[port].msg_id = 0; /* We are done, acknowledge with an Accept packet */ send_control(port, PD_CTRL_ACCEPT); break; |