diff options
author | Ruibin Chang <Ruibin.Chang@ite.com.tw> | 2018-11-16 17:18:55 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-29 12:11:08 -0800 |
commit | bd19b03b128db664dfb5e6582810bd177b635408 (patch) | |
tree | 2c84666be1ae0377f787266e772dc8573c955244 /driver | |
parent | 4c3621ace087613604f6d5fb094da62434333893 (diff) | |
download | chrome-ec-bd19b03b128db664dfb5e6582810bd177b635408.tar.gz |
it83xx/intc:message id of pd packet repeat
According USB-PD spec ch.6.7.1, if transmitter sends
the repetitive message id packet, receiver does not respond
subsequent message(except softreset).
BRANCH=None
BUG=None
TEST=GRL USB-PD test
Change-Id: Ideea31cdf2e2d24dc70ac66f5cb830b4cb4b7d46
Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1309564
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
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 */ |