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-09-11 01:46:09 +0000
commit40a66c255c207c5ed9c156057790a52c18276adf (patch)
treeeaae7f1f394bcb71cda31fe5a296d8912e7247b0
parent3f5511665af11ff9b027768d03b0b4b65fa3bdd3 (diff)
downloadchrome-ec-40a66c255c207c5ed9c156057790a52c18276adf.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> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2392237 Tested-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@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 498e31fe6b..f454661743 100644
--- a/driver/build.mk
+++ b/driver/build.mk
@@ -114,6 +114,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
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index 787489cf2a..0147739d02 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -20,6 +20,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."
@@ -170,7 +171,8 @@ static int ps8xxx_get_chip_info(int port, int live,
}
-#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.
@@ -193,7 +195,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)
@@ -230,6 +232,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 f030ea2724..708cc0d382 100644
--- a/driver/tcpm/ps8xxx.h
+++ b/driver/tcpm/ps8xxx.h
@@ -57,8 +57,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 512972fbc7..ac393a4c71 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3399,6 +3399,7 @@
#undef CONFIG_USB_PD_TCPM_ANX7447
#undef CONFIG_USB_PD_TCPM_ANX7688
#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