diff options
author | Scott Chao <scott_chao@wistron.corp-partner.google.com> | 2023-01-12 16:01:36 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-01-18 22:56:20 +0000 |
commit | f18eeff0fc684bd4240258b2a35327d66725232b (patch) | |
tree | a0af38c5c50639ca05431bf05a48eac6f5fdb1ed /driver | |
parent | bcdc60f600c507d99cab3dc9b98c3b8987b90411 (diff) | |
download | chrome-ec-f18eeff0fc684bd4240258b2a35327d66725232b.tar.gz |
tcpci: handle tcpc tx discarded event
In Revision 2.0, Version 1.3 USB Type-C® Port Controller
Interface Specification 4.7.1. If the transmission was discarded
due to an incoming received message, the TCPC sets the
TransmitSOP*MessageDiscarded bit in the ALERT register.
In the old process, TCPM will always send soft reset if TCPC
did not set TransmitSOP*MessageSuccessful. It will cause the pending
message be cleared.
For example, when TCPC get ATTENTION from USB-C dock and TCPM send
GET_SINK_CAP to TCPC at the same time. The TCPC will set
TransmitSOP*MessageDiscarded and TCPM will send soft reset and
cause TCPM did not get ATTENTION message.
BUG=b:265247056
BRANCH=none
TEST=make sure dock can display.
TEST=make buildall
TEST=./twister -v -T zephyr/test
Change-Id: I2597894c1f7abceea3c352ba1066d270d2d01ba0
Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4160814
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/tcpm/tcpci.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index 7924f653b7..84fdbe8cbc 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -1221,10 +1221,18 @@ void tcpci_tcpc_alert(int port) * completion events. This will send an event to the PD tasks * immediately */ - if (alert & TCPC_REG_ALERT_TX_COMPLETE) - pd_transmit_complete(port, alert & TCPC_REG_ALERT_TX_SUCCESS ? - TCPC_TX_COMPLETE_SUCCESS : - TCPC_TX_COMPLETE_FAILED); + if (alert & TCPC_REG_ALERT_TX_COMPLETE) { + int tx_status; + + if (alert & TCPC_REG_ALERT_TX_SUCCESS) + tx_status = TCPC_TX_COMPLETE_SUCCESS; + else if (alert & TCPC_REG_ALERT_TX_DISCARDED) + tx_status = TCPC_TX_COMPLETE_DISCARDED; + else + tx_status = TCPC_TX_COMPLETE_FAILED; + + pd_transmit_complete(port, tx_status); + } tcpc_get_bist_test_mode(port, &bist_mode); |