diff options
author | Sam Hurst <shurst@google.com> | 2019-11-01 18:03:31 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-02 04:34:57 +0000 |
commit | 6beb3ea38ae9ce61ab4c3b92044d57d3101ff26e (patch) | |
tree | 9a458d7182ae5b134310d65d2d379de358f2fb6c /common/usbc/usb_prl_sm.c | |
parent | 3c1eff2e293adeca40c0c919e63db4c62b89de41 (diff) | |
download | chrome-ec-6beb3ea38ae9ce61ab4c3b92044d57d3101ff26e.tar.gz |
Revert "usbc: update CRCReceiveTimer"
This reverts commit 1092c786f7876745ec0d68dd52284d252e1abee5.
Reason for revert: <Several Fluffy tests failed due to this CL>
Original change's description:
> 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>
Bug: none
Change-Id: I2051b6c2f3f36d5d0612f24ba08f9843f9487f66
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1894765
Reviewed-by: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Commit-Queue: Sean Abraham <seanabraham@chromium.org>
Diffstat (limited to 'common/usbc/usb_prl_sm.c')
-rw-r--r-- | common/usbc/usb_prl_sm.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c index c92faec8ac..a700ee6f2a 100644 --- a/common/usbc/usb_prl_sm.c +++ b/common/usbc/usb_prl_sm.c @@ -156,11 +156,11 @@ static struct protocol_layer_tx { uint32_t flags; /* protocol timer */ uint64_t sink_tx_timer; - /* GoodCRC receive timeout */ - uint64_t crc_receive_timer; + /* tcpc transmit timeout */ + uint64_t tcpc_tx_timeout; /* last message type we transmitted */ enum tcpm_transmit_type last_xmit_type; - /* message id counters for all 6 SOP* message types */ + /* message id counters for all 6 port partners */ uint32_t msg_id_counter[NUM_SOP_STAR_TYPES]; /* message retry counter */ uint32_t retry_counter; @@ -646,12 +646,16 @@ static void prl_tx_construct_message(const 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); - /* - * 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); + 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; } static void prl_tx_wait_for_phy_response_run(const int port) @@ -661,11 +665,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 satisfies the PRL_Tx_Match_MessageID state + * This condition satifies the PRL_Tx_Match_MessageID state * requirement. */ - if (get_time().val > prl_tx[port].crc_receive_timer || + if (get_time().val > prl_tx[port].tcpc_tx_timeout || prl_tx[port].xmit_status == TCPC_TX_COMPLETE_FAILED || prl_tx[port].xmit_status == TCPC_TX_COMPLETE_DISCARDED) { @@ -1619,6 +1623,7 @@ 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, }, |