diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-10-13 08:24:12 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-13 19:43:01 -0700 |
commit | 2e1ec23353c758a7553c86bfd224b3364f6504a6 (patch) | |
tree | c1e3e26f84edba743d3177d8067436895a96e423 | |
parent | 35ed69cde8346714bf58cd8deac42f76f3951b6b (diff) | |
download | chrome-ec-2e1ec23353c758a7553c86bfd224b3364f6504a6.tar.gz |
tcpc: Don't retry sending of source caps
TCPM will retry sending of source caps on failure and retrying in TCPC
will cause us to violate PD_T_SEND_SOURCE_CAP.
BUG=None
TEST=Attach servo_v4 to twinkie, verify source caps are sent in ~100ms
intervals and not in bursts of four.
BRANCH=servo_v4
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I3264e5578afbde7b9d2c003b6744974329a253d4
Reviewed-on: https://chromium-review.googlesource.com/719729
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/usb_pd_tcpc.c | 4 | ||||
-rw-r--r-- | test/usb_pd.c | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c index 99e3470e18..a540d6f67f 100644 --- a/common/usb_pd_tcpc.c +++ b/common/usb_pd_tcpc.c @@ -362,9 +362,11 @@ static int send_validate_message(int port, uint16_t header, static uint32_t payload[7]; uint8_t expected_msg_id = PD_HEADER_ID(header); uint8_t cnt = PD_HEADER_CNT(header); + int retries = PD_HEADER_TYPE(header) == PD_DATA_SOURCE_CAP ? + 0 : PD_RETRY_COUNT; /* retry 3 times if we are not getting a valid answer */ - for (r = 0; r <= PD_RETRY_COUNT; r++) { + for (r = 0; r <= retries; r++) { int bit_len, head; /* write the encoded packet in the transmission buffer */ bit_len = prepare_message(port, header, cnt, data); diff --git a/test/usb_pd.c b/test/usb_pd.c index 80c5d10885..7133af28e9 100644 --- a/test/usb_pd.c +++ b/test/usb_pd.c @@ -618,8 +618,14 @@ static int test_sink(void) TEST_ASSERT(pd_test_tx_msg_verify_crc(port)); TEST_ASSERT(pd_test_tx_msg_verify_eop(port)); + /* Wake from pd_start_tx */ + task_wake(PD_PORT_TO_TASK_ID(port)); + usleep(30 * MSEC); + /* Looks good. Ack the source cap. */ simulate_goodcrc(port, PD_ROLE_SINK, pd_port[port].msg_tx_id); + + /* Wake from pd_rx_start */ task_wake(PD_PORT_TO_TASK_ID(port)); usleep(30 * MSEC); inc_tx_id(port); |