summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuibin Chang <Ruibin.Chang@ite.com.tw>2019-04-19 12:08:07 +0800
committerJett Rink <jettrink@chromium.org>2019-04-30 21:49:57 +0000
commitb7e78ed3873c250983437b28e182bfcfcd76d285 (patch)
treee60405cf248dca9c8d3bdf6592c004cef50dc412
parent7f55b1f708812d434119b38a23dcbe1e9f009b71 (diff)
downloadchrome-ec-b7e78ed3873c250983437b28e182bfcfcd76d285.tar.gz
tcpm/it83xx.c: Bx and Dx transmit status bit of pd register swap
Chip Bx and Dx transmit status bit (PD register offset 0x18, MTCR) swap. Bx: bit5, 1'b0 = none 1'b1 = goodcrc not received and retry times arrive bit1, 1'b0 = transmit OK 1'b1 = goodcrc not received or Tx discarded Dx: bit5, 1'b0 = transmit OK 1'b1 = goodcrc not received or Tx discarded bit1, 1'b0 = none 1'b1 = goodcrc not received and retry times arrive BRANCH=None BUG=None TEST=Test by device which do not respond goodcrc message Change-Id: Ia07ad4bdb7f4800b62a25eb88ac42e42311faa7d Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1545800 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--chip/it83xx/config_chip.h2
-rw-r--r--chip/it83xx/registers.h4
-rw-r--r--driver/tcpm/it83xx.c3
3 files changed, 9 insertions, 0 deletions
diff --git a/chip/it83xx/config_chip.h b/chip/it83xx/config_chip.h
index d0edfe6eb9..7522e89ade 100644
--- a/chip/it83xx/config_chip.h
+++ b/chip/it83xx/config_chip.h
@@ -119,6 +119,8 @@
#define IT83XX_INTC_GROUP_21_22_SUPPORT
/* Enable detect type-c plug in interrupt. */
#define IT83XX_INTC_PLUG_IN_SUPPORT
+/* Chip Dx transmit status bit of PD register is different from Bx. */
+#define IT83XX_PD_TX_ERROR_STATUS_BIT5
#else
#error "Unsupported chip variant!"
#endif
diff --git a/chip/it83xx/registers.h b/chip/it83xx/registers.h
index aff0b7cea0..13f6609662 100644
--- a/chip/it83xx/registers.h
+++ b/chip/it83xx/registers.h
@@ -1273,7 +1273,11 @@ enum i2c_channels {
#define USBPD_REG_MASK_SW_RESET_TX_STAT BIT(3)
#define USBPD_REG_MASK_TX_BUSY_STAT BIT(2)
#define USBPD_REG_MASK_TX_DISCARD_STAT BIT(2)
+#ifdef IT83XX_PD_TX_ERROR_STATUS_BIT5
+#define USBPD_REG_MASK_TX_ERR_STAT BIT(5)
+#else
#define USBPD_REG_MASK_TX_ERR_STAT BIT(1)
+#endif
#define USBPD_REG_MASK_TX_START BIT(0)
#define IT83XX_USBPD_MTSR0(p) REG8(IT83XX_USBPD_BASE(p)+0x19)
#define USBPD_REG_MASK_CABLE_ENABLE BIT(7)
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index b31a9192f7..da0cdf35e1 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -200,6 +200,9 @@ static enum tcpc_transmit_complete it83xx_tx_data(
*/
if (USBPD_IS_TX_DISCARD(port))
continue;
+ /*
+ * Or port partner doesn't respond GoodCRC
+ */
else
return TCPC_TX_COMPLETE_FAILED;
} else {