summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baseboard/volteer/baseboard.h1
-rw-r--r--driver/tcpm/ps8xxx.c45
-rw-r--r--include/config.h6
-rw-r--r--util/config_allowed.txt1
-rw-r--r--zephyr/shim/include/config_chip.h1
5 files changed, 54 insertions, 0 deletions
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h
index 6faa68ab1c..53cfa7b95f 100644
--- a/baseboard/volteer/baseboard.h
+++ b/baseboard/volteer/baseboard.h
@@ -170,6 +170,7 @@
#define CONFIG_USB_PD_TCPM_RT1715
#define CONFIG_USB_PD_TCPM_TUSB422 /* USBC port C0 */
#define CONFIG_USB_PD_TCPM_PS8815 /* USBC port USB3 DB */
+#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_HOSTCMD_PD_CONTROL /* Needed for TCPC FW update */
#define CONFIG_CMD_USB_PD_PE
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index c2ffad3c69..dfcede84e2 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -444,6 +444,42 @@ static int ps8xxx_tcpc_drp_toggle(int port)
}
#endif
+#ifdef CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+/*
+ * Early ps8815 A1 firmware reports 0x0001 in the TCPCI Device ID
+ * registers which makes it indistinguishable from A0. This
+ * overrides the Device ID based if vendor specific registers
+ * identify the chip as A1.
+ *
+ * See b/159289062.
+ */
+static int ps8815_make_device_id(int port, int *id)
+{
+ int p1_addr;
+ int val;
+ int status;
+
+ /* P1 registers are always accessible on PS8815 */
+ p1_addr = PS8751_P3_TO_P1_FLAGS(tcpc_config[port].i2c_info.addr_flags);
+
+ status = tcpc_addr_read16(port, p1_addr, PS8815_P1_REG_HW_REVISION,
+ &val);
+ if (status != EC_SUCCESS)
+ return status;
+ switch (val) {
+ case 0x0a00:
+ *id = 1;
+ break;
+ case 0x0a01:
+ *id = 2;
+ break;
+ default:
+ return EC_ERROR_UNKNOWN;
+ }
+ return EC_SUCCESS;
+}
+#endif
+
static int ps8xxx_get_chip_info(int port, int live,
struct ec_response_pd_chip_info_v1 *chip_info)
{
@@ -462,6 +498,15 @@ static int ps8xxx_get_chip_info(int port, int live,
if (chip_info->fw_version_number == 0 ||
chip_info->fw_version_number == -1 || live) {
+#ifdef CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+ if (chip_info->product_id == PS8815_PRODUCT_ID &&
+ chip_info->device_id == 0x0001) {
+ rv = ps8815_make_device_id(port, &val);
+ if (rv != EC_SUCCESS)
+ return rv;
+ chip_info->device_id = val;
+ }
+#endif
reg = get_reg_by_product(port, REG_FW_VER);
rv = tcpc_read(port, reg, &val);
if (rv != EC_SUCCESS)
diff --git a/include/config.h b/include/config.h
index fa82fc5242..7e0e277c78 100644
--- a/include/config.h
+++ b/include/config.h
@@ -4452,6 +4452,12 @@
#undef CONFIG_USB_PD_TCPM_ANX7447_AUX_PU_PD
/*
+ * Use this to override the TCPCI Device ID value to be 0x0002 for
+ * chip rev A1. Early A1 firmware misreports the DID as 0x0001.
+ */
+#undef CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+
+/*
* Use this option if the TCPC port controller supports the optional register
* 18h CONFIG_STANDARD_OUTPUT to steer the high-speed muxes.
*/
diff --git a/util/config_allowed.txt b/util/config_allowed.txt
index 556bdd9041..c5380cb8ed 100644
--- a/util/config_allowed.txt
+++ b/util/config_allowed.txt
@@ -1272,6 +1272,7 @@ CONFIG_USB_PD_TCPM_PS8751_CUSTOM_MUX_DRIVER
CONFIG_USB_PD_TCPM_PS8755
CONFIG_USB_PD_TCPM_PS8805
CONFIG_USB_PD_TCPM_PS8815
+CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
CONFIG_USB_PD_TCPM_RAA489000
CONFIG_USB_PD_TCPM_RT1715
CONFIG_USB_PD_TCPM_STM32GX
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 2601278141..a2a38f212d 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -804,6 +804,7 @@
#undef CONFIG_USB_PD_TCPM_PS8815
#ifdef CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8815
#define CONFIG_USB_PD_TCPM_PS8815
+#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
#endif
#undef CONFIG_USB_PD_TCPM_MULTI_PS8XXX