diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-08-20 18:27:59 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-22 00:52:38 +0000 |
commit | 7b1a0dc7959e83d202fefb1a4c3079ec2edd35e5 (patch) | |
tree | 57e8572fb035b1d8f4f48792605e15f9221c52e7 | |
parent | 4ec6babda0bce0cae6978a0d5d5c9eb44087224f (diff) | |
download | chrome-ec-7b1a0dc7959e83d202fefb1a4c3079ec2edd35e5.tar.gz |
pd: fix bug in pd transmit retry mechanism
This fixes a bug in the PD transmit retry mechanism. In the retry
mechanism, we were assuming that only a pd rx interrupt will wake
up this event. But, there are other events that could potentially
wake us up, so we need to check to make sure that pd rx started
when we first wake up.
BUG=chrome-os-partner:30135
BRANCH=none
TEST=load onto samus and zinger. run "pd 0 flash rw_hash" a bunch of
times manually from the console. Observe that we nearly always fail
the first receive, but succeed on next try, which prevents us from
dropping the negotiation.
Change-Id: I5f7261176c151c3185d76aa374b9b83ac9df9a7d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/213369
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index bf77755941..91575052fe 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -371,6 +371,14 @@ static int send_validate_message(int port, uint16_t header, if (task_wait_event(USB_PD_RX_TMOUT_US) == TASK_EVENT_TIMER) continue; + /* + * Make sure we woke up due to rx recd, otherwise + * we need to manually start + */ + if (!pd_rx_started(port)) { + pd_rx_disable_monitoring(port); + pd_rx_start(port); + } } else { /* starting waiting for GoodCrc */ pd_rx_start(port); |