From d181c052e5c90f78fa2dde64c82690962de39fb5 Mon Sep 17 00:00:00 2001 From: Ayushee Date: Tue, 28 Jan 2020 14:53:21 -0800 Subject: usb_pd TCPMv1: Maintain independent MessageID for SOP Prime This patchset enables storage of MessageId counter received from the cable plug. Since SOP*(Cable) communication and SOP(Port Partner) have separate MessageID counters, it is necessary to store separate messageIDs to avoid the the incoming packets from getting dropped. BUG=b:148481858 BRANCH=None TEST=Tested on Volteer, able to maintain separate MessageId count for SOP and SOP' communication. Change-Id: Iac2dc616f99a9e19914588e59441df8b09068afa Signed-off-by: Ayushee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2026650 Reviewed-by: Keith Short --- common/usb_pd_protocol.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'common/usb_pd_protocol.c') diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 6e29bf06b8..18a6afdfbb 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -700,6 +700,14 @@ static int consume_repeat_message(int port, uint16_t msg_header) if (PD_HEADER_TYPE(msg_header) == PD_CTRL_SOFT_RESET && PD_HEADER_CNT(msg_header) == 0) { return 0; + /* TODO: Check for incoming SOP'' messages */ + } else if (is_transmit_msg_sop_prime(port)) { + /* + * From USB PD version 1.3 section 6.7.1, the port which + * communicates using SOP* Packets Shall maintain copy + * of the last MessageID for each type of SOP* it uses. + */ + return cable_consume_repeat_message(port, msg_id); } else if (pd[port].last_msg_id != msg_id) { pd[port].last_msg_id = msg_id; } else if (pd[port].last_msg_id == msg_id) { -- cgit v1.2.1