summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-06-12 09:48:39 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-17 02:11:09 +0000
commit4b8dcbe55b34cf58ad52767f3fd92824a865c42c (patch)
tree787cb8cd3798a25b023feb4aad10c277188000fa
parente947cf156f38f78e852c2978fc5e43f5acd5173f (diff)
downloadchrome-ec-4b8dcbe55b34cf58ad52767f3fd92824a865c42c.tar.gz
driver/tcpm: Add support for PS8705
The commit adds support for the Parade Tech PS8705 TCPC/SuperSpeed mux. It is similar to other Parade TCPCs in its family. BUG=b:158760026 BRANCH=None TEST=`make -j buildall` Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I23288757f2baf56742958357b5ee6bac5cffa02f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2243314 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/build.mk1
-rw-r--r--driver/tcpm/ps8xxx.c38
-rw-r--r--driver/tcpm/ps8xxx.h10
-rw-r--r--include/config.h1
4 files changed, 48 insertions, 2 deletions
diff --git a/driver/build.mk b/driver/build.mk
index 220873eeeb..9a7107b066 100644
--- a/driver/build.mk
+++ b/driver/build.mk
@@ -137,6 +137,7 @@ driver-$(CONFIG_USB_PD_TCPM_ANX74XX)+=tcpm/anx74xx.o
driver-$(CONFIG_USB_PD_TCPM_ANX7688)+=tcpm/anx7688.o
driver-$(CONFIG_USB_PD_TCPM_ANX7447)+=tcpm/anx7447.o
driver-$(CONFIG_USB_PD_TCPM_PS8751)+=tcpm/ps8xxx.o
+driver-$(CONFIG_USB_PD_TCPM_PS8705)+=tcpm/ps8xxx.o
driver-$(CONFIG_USB_PD_TCPM_PS8805)+=tcpm/ps8xxx.o
driver-$(CONFIG_USB_PD_TCPM_PS8815)+=tcpm/ps8xxx.o
driver-$(CONFIG_USB_PD_TCPM_TUSB422)+=tcpm/tusb422.o
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index fc2aa08646..881d366e33 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -21,6 +21,7 @@
#include "usb_pd.h"
#if !defined(CONFIG_USB_PD_TCPM_PS8751) && \
+ !defined(CONIFG_USB_PD_TCPM_PS8705) && \
!defined(CONFIG_USB_PD_TCPM_PS8805) && \
!defined(CONFIG_USB_PD_TCPM_PS8815)
#error "Unsupported PS8xxx TCPC."
@@ -242,7 +243,8 @@ static int ps8xxx_enter_low_power_mode(int port)
}
#endif
-#if defined(CONFIG_USB_PD_TCPM_PS8751) || defined(CONFIG_USB_PD_TCPM_PS8805)
+#if defined(CONFIG_USB_PD_TCPM_PS8751) || defined(CONFIG_USB_PD_TCPM_PS8805) \
+ || defined(CONFIG_USB_PD_TCPM_PS8705)
/*
* DCI is enabled by default and burns about 40 mW when the port is in
* USB2 mode or when a C-to-A dongle is attached, so force it off.
@@ -265,7 +267,7 @@ static int ps8xxx_addr_dci_disable(int port, int i2c_addr, int i2c_reg)
}
return EC_SUCCESS;
}
-#endif /* CONFIG_USB_PD_TCPM_PS8751 || CONFIG_USB_PD_TCPM_PS8805 */
+#endif /* CONFIG_USB_PD_TCPM_PS8751 || CONFIG_USB_PD_TCPM_PS8[78]05 */
#ifdef CONFIG_USB_PD_TCPM_PS8815
static int ps8xxx_dci_disable(int port)
@@ -288,6 +290,38 @@ static int ps8xxx_dci_disable(int port)
}
#endif /* CONFIG_USB_PD_TCPM_PS8805 */
+#ifdef CONFIG_USB_PD_TCPM_PS8705
+static int ps8xxx_dci_disable(int port)
+{
+ int p1_addr;
+ int p3_addr;
+ int regval;
+ int rv;
+
+ /* Enable access to debug pages. */
+ p3_addr = tcpc_config[port].i2c_info.addr_flags;
+ rv = tcpc_addr_read(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
+ &regval);
+ if (rv)
+ return rv;
+
+ rv = tcpc_addr_write(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
+ PS8XXX_REG_I2C_DEBUGGING_ENABLE_ON);
+
+ /* Disable Auto DCI */
+ p1_addr = p3_addr -
+ (PS8751_I2C_ADDR1_FLAGS - PS8751_I2C_ADDR1_P1_FLAGS);
+ rv = ps8xxx_addr_dci_disable(port, p1_addr,
+ PS8705_P1_REG_MUX_USB_DCI_CFG);
+
+ /* Turn off access to debug pages. */
+ rv |= tcpc_addr_write(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
+ PS8XXX_REG_I2C_DEBUGGING_ENABLE_OFF);
+
+ return rv;
+}
+#endif /* CONFIG_USB_PD_TCPM_PS8705 */
+
#ifdef CONFIG_USB_PD_TCPM_PS8751
static int ps8xxx_dci_disable(int port)
{
diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h
index f543568036..9bd1cbd389 100644
--- a/driver/tcpm/ps8xxx.h
+++ b/driver/tcpm/ps8xxx.h
@@ -78,8 +78,18 @@
#define PS8XXX_REG_MUX_USB_C2SS_HS_THRESHOLD 0xE8
#define PS8751_REG_MUX_USB_DCI_CFG 0xED
+#elif defined(CONFIG_USB_PD_TCPM_PS8705)
+/* Vendor defined registers */
+/* NOTE: The Product ID will read as 0x8803 if the firmware has malfunctioned */
+#define PS8XXX_PRODUCT_ID 0x8705
+
+#define PS8705_P1_REG_MUX_USB_DCI_CFG 0x4B
+/* NOTE: The revision will read as 0x00 if the firmware has malfunctioned. */
+#define FW_VER_REG 0x82
+
#elif defined(CONFIG_USB_PD_TCPM_PS8805)
/* Vendor defined registers */
+/* NOTE: The Product ID will read as 0x8803 if the firmware has malfunctioned */
#define PS8XXX_PRODUCT_ID 0x8805
#define PS8805_P1_REG_MUX_USB_DCI_CFG 0x4B
diff --git a/include/config.h b/include/config.h
index 763b932c0e..53f5ac9052 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3941,6 +3941,7 @@
#undef CONFIG_USB_PD_TCPM_ANX7688
#undef CONFIG_USB_PD_TCPM_NCT38XX
#undef CONFIG_USB_PD_TCPM_PS8751
+#undef CONFIG_USB_PD_TCPM_PS8705
#undef CONFIG_USB_PD_TCPM_PS8805
#undef CONFIG_USB_PD_TCPM_PS8815
#undef CONFIG_USB_PD_TCPM_MT6370