summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usbc/usb_prl_sm.c27
-rw-r--r--include/usb_prl_sm.h9
2 files changed, 19 insertions, 17 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,
},
diff --git a/include/usb_prl_sm.h b/include/usb_prl_sm.h
index 7f580741e5..447cbb994f 100644
--- a/include/usb_prl_sm.h
+++ b/include/usb_prl_sm.h
@@ -58,8 +58,7 @@ void prl_set_rev(int port, enum pd_rev_type rev);
enum pd_rev_type prl_get_rev(int port);
/**
- * Sends a PD control message. Either pe_message_sent() or pe_report_error() is
- * guaranteed to be called in response to this call.
+ * Sends a PD control message
*
* @param port USB-C port number
* @param type Transmit type
@@ -70,8 +69,7 @@ void prl_send_ctrl_msg(int port, enum tcpm_transmit_type type,
enum pd_ctrl_msg_type msg);
/**
- * Sends a PD data message. Either pe_message_sent() or pe_report_error() is
- * guaranteed to be called in response to this call.
+ * Sends a PD data message
*
* @param port USB-C port number
* @param type Transmit type
@@ -82,8 +80,7 @@ void prl_send_data_msg(int port, enum tcpm_transmit_type type,
enum pd_data_msg_type msg);
/**
- * Sends a PD extended data message. Either pe_message_sent() or
- * pe_report_error() is guaranteed to be called in response to this call.
+ * Sends a PD extended data message
*
* @param port USB-C port number
* @param type Transmit type