diff options
Diffstat (limited to 'driver')
-rw-r--r-- | driver/tcpm/it83xx.c | 11 | ||||
-rw-r--r-- | driver/tcpm/it83xx_pd.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c index f4783c1725..447ba7fd1d 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -210,6 +210,10 @@ static enum tcpc_transmit_complete it83xx_tx_data( if (r > PD_RETRY_COUNT) return TCPC_TX_COMPLETE_DISCARDED; + /* Transmit softreset, invalidate last received message id variable */ + if (PD_HEADER_TYPE(header) == PD_CTRL_SOFT_RESET && length == 0) + invalidate_last_message_id(port); + return TCPC_TX_COMPLETE_SUCCESS; } @@ -228,6 +232,9 @@ static enum tcpc_transmit_complete it83xx_send_hw_reset(enum usbpd_port port, if (IT83XX_USBPD_MTSR0(port) & USBPD_REG_MASK_SEND_HW_RESET) return TCPC_TX_COMPLETE_FAILED; + /* Transmit hardreset, invalidate last received message id variable */ + invalidate_last_message_id(port); + return TCPC_TX_COMPLETE_SUCCESS; } @@ -328,6 +335,8 @@ static void it83xx_set_data_role(enum usbpd_port port, int pd_role) static void it83xx_init(enum usbpd_port port, int role) { + /* Invalidate last received message id variable */ + invalidate_last_message_id(port); /* bit7: Reload CC parameter setting. */ IT83XX_USBPD_CCPSR0(port) |= (1 << 7); /* reset and disable HW auto generate message header */ @@ -570,6 +579,8 @@ static int it83xx_tcpm_get_chip_info(int port, int renew, static void it83xx_tcpm_sw_reset(void) { int port = TASK_ID_TO_PD_PORT(task_get_current()); + /* Invalidate last received message id variable */ + invalidate_last_message_id(port); /* exit BIST test data mode */ USBPD_SW_RESET(port); } diff --git a/driver/tcpm/it83xx_pd.h b/driver/tcpm/it83xx_pd.h index 8eb5cab00b..c0714dd9b1 100644 --- a/driver/tcpm/it83xx_pd.h +++ b/driver/tcpm/it83xx_pd.h @@ -106,5 +106,7 @@ extern const struct usbpd_ctrl_t usbpd_ctrl_regs[]; extern const struct tcpm_drv it83xx_tcpm_drv; /* Disable integrated pd module */ void it83xx_disable_pd_module(int port); +/* Invalidate last received message id variable */ +extern void invalidate_last_message_id(int port); #endif /* __CROS_EC_DRIVER_TCPM_IT83XX_H */ |