diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-01-19 10:23:54 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-19 22:19:17 +0000 |
commit | 476e1cedae2e48e7a8865593bb3f5f18d9d3d309 (patch) | |
tree | 5b6d50c81c4df2a23689a8d3ca38e9dbc6327c71 /common | |
parent | cea3f26d5d4e9160c1e628b29abd74d74ca36c04 (diff) | |
download | chrome-ec-476e1cedae2e48e7a8865593bb3f5f18d9d3d309.tar.gz |
pd: set previous protocol state appropriately after a hard reset
Set the PD protocol last state to hard reset when executing a
hard reset. This fixes a bug in which if we receive a hard reset
while in one of the hard reset recovery states the last state
doesn't change, which means we don't restart timeout periods and
it is possible to be indefinitely stuck in the hard reset recovery
state until PD MCU reboots.
BUG=none
BRANCH=samus
TEST=when connecting samus port 0 to port 1 we get a very crappy
PD connection and about 1 in 5 times it causes us to get stuck in
SNK_HARD_RESET_RECOVER until a reboot. with this fix, we never get
stuck.
Change-Id: I294462ffa56a804ca613535ab9bdc466175f8066
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/241871
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_protocol.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index fe844ce136..a04dada1aa 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -809,6 +809,12 @@ static void execute_hard_reset(int port) pd_dfp_pe_init(port); #endif + /* + * Fake set last state to hard reset to make sure that the next + * state to run knows that we just did a hard reset. + */ + pd[port].last_state = PD_STATE_HARD_RESET_EXECUTE; + #ifdef CONFIG_USB_PD_DUAL_ROLE /* * If we are swapping to a source and have changed to Rp, restore back |