diff options
author | Caveh Jalali <caveh@chromium.org> | 2020-06-17 19:08:00 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-29 03:55:46 +0000 |
commit | db3de77a474e2a0ffddcfc78822e5a74c5ae39f3 (patch) | |
tree | c54070918b2d69f17e1f7df06f8d3db5b78227ef | |
parent | ea103fe804e831443d4e192301084ce9112349a9 (diff) | |
download | chrome-ec-db3de77a474e2a0ffddcfc78822e5a74c5ae39f3.tar.gz |
ps8xxx: patch ps8815 A1 chip Device ID
this adds a config option for the ps8815 to override the TCPCI Device
ID field based on the chip hardware revision reported in vendor
defined registers. early ps8815 A1 firmware still reports the same
Device ID value as the A0 chip which makes the two chips
indistinguishable using standard methods. so, we check a vendor
defined register to distinguish the two parts and "patch" the Device
ID. newer ps8815 firmware will correct this, so after we have flushed
out early firmware, we can disable this override feature.
BRANCH=none
BUG=b:158857815,b:159289062
TEST=reflashed FW on ps8815 A0 and A1
Change-Id: I2db3150740c15a77836dea0e9db72e5d99fdc050
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2254992
Tested-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r-- | baseboard/volteer/baseboard.h | 1 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.c | 47 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.h | 1 | ||||
-rw-r--r-- | include/config.h | 6 |
4 files changed, 52 insertions, 3 deletions
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h index 677a988ac9..0e6e47bca8 100644 --- a/baseboard/volteer/baseboard.h +++ b/baseboard/volteer/baseboard.h @@ -163,6 +163,7 @@ #define CONFIG_USB_PD_TCPM_TCPCI #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 287e5f1467..6a4eb4e1c1 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -183,7 +183,41 @@ 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) @@ -191,7 +225,7 @@ static int ps8xxx_get_chip_info(int port, int live, int val; int rv = tcpci_get_chip_info(port, live, chip_info); - if (rv) + if (rv != EC_SUCCESS) return rv; if (!live) { @@ -201,9 +235,16 @@ 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->device_id == 0x0001) { + rv = ps8815_make_device_id(port, &val); + if (rv != EC_SUCCESS) + return rv; + chip_info->device_id = val; + } +#endif rv = tcpc_read(port, FW_VER_REG, &val); - - if (rv) + if (rv != EC_SUCCESS) return rv; chip_info->fw_version_number = val; diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h index 68d985fbf2..cfcf45b1a3 100644 --- a/driver/tcpm/ps8xxx.h +++ b/driver/tcpm/ps8xxx.h @@ -102,6 +102,7 @@ #define PS8XXX_PRODUCT_ID 0x8815 #define FW_VER_REG 0x82 +#define PS8815_P1_REG_HW_REVISION 0xF0 #endif diff --git a/include/config.h b/include/config.h index 52807501a7..93f8a437c4 100644 --- a/include/config.h +++ b/include/config.h @@ -4001,6 +4001,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. */ |