diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-08-12 22:00:52 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-14 01:44:08 +0000 |
commit | 80b43435ca89510e985481b725a470566fb65a05 (patch) | |
tree | a01d4bea6dca61a85e63e593f5058c360bc24e5d | |
parent | 892a77f7133c7b7df3922964466588eb1394ff16 (diff) | |
download | chrome-ec-80b43435ca89510e985481b725a470566fb65a05.tar.gz |
ps8xxx: Simplify firmware version logic
This removes a test that we know is always true before fetching the
firmware version number from the chip.
BRANCH=none
BUG=none
TEST=buildall passes
Change-Id: Ie3096f80cb229291681ebe6c48f69a4b7a4d7be3
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093036
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | driver/tcpm/ps8xxx.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 78b7464fcc..58fb109b3e 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -585,33 +585,30 @@ static int ps8xxx_get_chip_info(int port, int live, chip_info->product_id = product_id[port]; } - if (chip_info->fw_version_number == 0 || - chip_info->fw_version_number == -1 || live) { #ifdef CONFIG_USB_PD_TCPM_PS8805_FORCE_DID - if (chip_info->product_id == PS8805_PRODUCT_ID && - chip_info->device_id == 0x0001) { - rv = ps8805_make_device_id(port, &val); - if (rv != EC_SUCCESS) - return rv; - chip_info->device_id = val; - } + if (chip_info->product_id == PS8805_PRODUCT_ID && + chip_info->device_id == 0x0001) { + rv = ps8805_make_device_id(port, &val); + if (rv != EC_SUCCESS) + return rv; + chip_info->device_id = val; + } #endif #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 (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->fw_version_number = val; + 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) + return rv; + + chip_info->fw_version_number = val; /* Treat unexpected values as error (FW not initiated from reset) */ if (live && ( |