diff options
author | Jett Rink <jettrink@chromium.org> | 2019-09-25 13:54:27 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-10 22:49:32 +0000 |
commit | 1092c786f7876745ec0d68dd52284d252e1abee5 (patch) | |
tree | f01f92fee6104f41c2aa3ba9752e2f023cf55c3b /common/usbc | |
parent | 552f9e9ce218718629b8178ef12823958b2044fa (diff) | |
download | chrome-ec-1092c786f7876745ec0d68dd52284d252e1abee5.tar.gz |
usbc: update CRCReceiveTimer
Shorten the CRCReceiveTimer and document that either the pe send or
error function will get called in response to a prl_ send message.
BRANCH=none
BUG=none
TEST=build;
Change-Id: Icc43886cadfdcd67c943b25aebfdfb55b2693ade
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825514
Tested-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common/usbc')
-rw-r--r-- | common/usbc/usb_prl_sm.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c index fa6759edaf..411ec61ad6 100644 --- a/common/usbc/usb_prl_sm.c +++ b/common/usbc/usb_prl_sm.c @@ -156,8 +156,8 @@ static struct protocol_layer_tx { uint32_t flags; /* protocol timer */ uint64_t sink_tx_timer; - /* tcpc transmit timeout */ - uint64_t tcpc_tx_timeout; + /* GoodCRC receive timeout */ + uint64_t crc_receive_timer; /* Last SOP* we transmitted to */ uint8_t sop; /* message id counters for all 6 port partners */ @@ -630,16 +630,12 @@ static void prl_tx_construct_message(int port) PDMSG_CLR_FLAG(port, PRL_FLAGS_TX_COMPLETE); /* Pass message to PHY Layer */ - tcpm_transmit(port, pdmsg[port].xmit_type, header, - pdmsg[port].chk_buf); -} - -/* - * PrlTxWaitForPhyResponse - */ -static void prl_tx_wait_for_phy_response_entry(const int port) -{ - prl_tx[port].tcpc_tx_timeout = get_time().val + PD_T_TCPC_TX_TIMEOUT; + tcpm_transmit(port, pdmsg[port].xmit_type, header, pdmsg[port].chk_buf); + /* + * tReceive is 0.9ms to 1.1ms, but we need to account for round trip + * communication delay over I2C with the TCPC + */ + prl_tx[port].crc_receive_timer = get_time().val + (10 * MSEC); } static void prl_tx_wait_for_phy_response_run(const int port) @@ -649,11 +645,11 @@ static void prl_tx_wait_for_phy_response_run(const int port) /* * NOTE: The TCPC will set xmit_status to TCPC_TX_COMPLETE_DISCARDED * when a GoodCRC containing an incorrect MessageID is received. - * This condition satifies the PRL_Tx_Match_MessageID state + * This condition satisfies the PRL_Tx_Match_MessageID state * requirement. */ - if (get_time().val > prl_tx[port].tcpc_tx_timeout || + if (get_time().val > prl_tx[port].crc_receive_timer || prl_tx[port].xmit_status == TCPC_TX_COMPLETE_FAILED || prl_tx[port].xmit_status == TCPC_TX_COMPLETE_DISCARDED) { @@ -1607,7 +1603,6 @@ static const struct usb_state prl_tx_states[] = { .run = prl_tx_layer_reset_for_transmit_run, }, [PRL_TX_WAIT_FOR_PHY_RESPONSE] = { - .entry = prl_tx_wait_for_phy_response_entry, .run = prl_tx_wait_for_phy_response_run, .exit = prl_tx_wait_for_phy_response_exit, }, |