summaryrefslogtreecommitdiff
path: root/common/usb_pd_tcpc.c
diff options
context:
space:
mode:
authorYilun Lin <yllin@chromium.org>2019-08-15 11:16:20 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-25 14:00:29 +0000
commite52f9b778894f07d67e76f2516193fa4c8c995b2 (patch)
treeddb0f26b66df2fcce06c5abdb522724d54d95165 /common/usb_pd_tcpc.c
parent1830e59046b7f1482c8effb3e3541441499dddaa (diff)
downloadchrome-ec-e52f9b778894f07d67e76f2516193fa4c8c995b2.tar.gz
tcpm: ignore repeated MessageID
Ignore repeated MessageID in TCPM rather than TCPC[1]. https://crrev.com/c/1513033 implemented the logic in TCPC, but according to spec[2], TCPC should pass repeated messages to TCPM. This CL simply moves the logic from TCPC to TCPM. [1] USB PD spec rev3.0 6.7.1.2 MessageID Counter Receiver Usage [2] USB Port Controller spec rev2.0 3.3 USB-PD Message Delivery * MessageID is not checked in the TCPC when a non-GoodCRC message is received. Retried messages that are received are passed to the TCPM via I2C BUG=b:134556286, b:129337537 BRANCH=None TEST=make buildall -j; See Krane boots; See servo_v4 boots. Ensure repeat request message triggered artificially are dropped without any side-effects. Cq-Depend: chromium:1763895 Change-Id: I362056d973a71f0940b1287511ffe9180f566fac Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1757596 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/usb_pd_tcpc.c')
-rw-r--r--common/usb_pd_tcpc.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c
index ae8c2746a6..5decbb0dec 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -257,7 +257,6 @@ static struct pd_port_controller {
int rx_head[RX_BUFFER_SIZE+1];
uint32_t rx_payload[RX_BUFFER_SIZE+1][7];
int rx_buf_head, rx_buf_tail;
- uint8_t msg_id_last;
/* Next transmit */
enum tcpm_transmit_type tx_type;
@@ -266,34 +265,6 @@ static struct pd_port_controller {
const uint32_t *tx_data;
} pd[CONFIG_USB_PD_PORT_COUNT];
-void invalidate_last_message_id(int port)
-{
- /*
- * Message id starts from 0 to 7. If msg_id_last is initialized to 0,
- * it will lead to repetitive message id with first received packet,
- * so initialize it with an invalid value 0xff.
- */
- pd[port].msg_id_last = 0xff;
-}
-
-int consume_repeat_message(int port, uint16_t msg_header)
-{
- uint8_t msg_id = PD_HEADER_ID(msg_header);
-
- /* If repeat message ignore, except softreset control request. */
- if (PD_HEADER_TYPE(msg_header) == PD_CTRL_SOFT_RESET &&
- PD_HEADER_CNT(msg_header) == 0) {
- invalidate_last_message_id(port);
- } else if (pd[port].msg_id_last != msg_id) {
- pd[port].msg_id_last = msg_id;
- } else if (pd[port].msg_id_last == msg_id) {
- CPRINTF("Repeat msg_id[%d] port[%d]\n", msg_id, port);
- return 1;
- }
-
- return 0;
-}
-
static int rx_buf_is_full(int port)
{
/*
@@ -680,7 +651,6 @@ int pd_analyze_rx(int port, uint32_t *payload)
bit = pd_find_preamble(port);
if (bit == PD_RX_ERR_HARD_RESET || bit == PD_RX_ERR_CABLE_RESET) {
/* Hard reset or cable reset */
- invalidate_last_message_id(port);
return bit;
} else if (bit < 0) {
msg = "Preamble";
@@ -1215,7 +1185,6 @@ void tcpc_init(int port)
/* make sure PD monitoring is disabled initially */
pd[port].rx_enabled = 0;
- invalidate_last_message_id(port);
/* make initial readings of CC voltages */
for (i = 0; i < 2; i++) {