summaryrefslogtreecommitdiff
path: root/driver/tcpm
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2020-12-07 15:42:04 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-15 15:39:20 +0000
commit4c6709899bc811fa9c07f04f4bb826d7025f19c2 (patch)
treefd0882990c07a54ee4521ef13fbcb6f79863f56b /driver/tcpm
parent0a561def48d4e673c834f4d01506ba8b9886cdd4 (diff)
downloadchrome-ec-4c6709899bc811fa9c07f04f4bb826d7025f19c2.tar.gz
tcpci: Base retry count on active PD rev
Retry twice when operating at PD 3.0 and thrice when operating at PD 2.0. Provide a TCPM-agnostic interface to get the number of retries. BUG=b:173025773,b:173025737 TEST=Pass TD.PD.LL.E3 Soft Reset Usage and TD.PD.LL.E4 Hard Reset Usage BRANCH=firmware-volteer-13521.B-master Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I422447718f1bfc9a9d4f8ffc5b284723a5332833 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578201 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'driver/tcpm')
-rw-r--r--driver/tcpm/tcpci.c3
-rw-r--r--driver/tcpm/tcpci.h4
2 files changed, 4 insertions, 3 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index c667f4b896..be1a0766dc 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -1004,7 +1004,8 @@ int tcpci_tcpm_transmit(int port, enum tcpm_transmit_type type,
* supported at build time.
*/
return tcpc_write(port, TCPC_REG_TRANSMIT,
- TCPC_REG_TRANSMIT_SET_WITH_RETRY(type));
+ TCPC_REG_TRANSMIT_SET_WITH_RETRY(
+ pd_get_retry_count(port, type), type));
}
/*
diff --git a/driver/tcpm/tcpci.h b/driver/tcpm/tcpci.h
index 594e3adc3c..309c7c654b 100644
--- a/driver/tcpm/tcpci.h
+++ b/driver/tcpm/tcpci.h
@@ -183,8 +183,8 @@
#define TCPC_REG_RX_BUFFER 0x30
#define TCPC_REG_TRANSMIT 0x50
-#define TCPC_REG_TRANSMIT_SET_WITH_RETRY(type) \
- (CONFIG_PD_RETRY_COUNT << 4 | (type))
+#define TCPC_REG_TRANSMIT_SET_WITH_RETRY(retries, type) \
+ ((retries) << 4 | (type))
#define TCPC_REG_TRANSMIT_SET_WITHOUT_RETRY(type) (type)
#define TCPC_REG_TRANSMIT_RETRY(reg) (((reg) & 0x30) >> 4)
#define TCPC_REG_TRANSMIT_TYPE(reg) ((reg) & 0x7)