From adf54799a4643a20867ea1c3f9720b7f74041262 Mon Sep 17 00:00:00 2001 From: Caveh Jalali Date: Tue, 27 Apr 2021 18:35:46 -0700 Subject: ps8xxx: Add support for ps8815 A2 with bad FW This adds the low level chip ID of the ps8815 A2 so we can recognize the chip when its main firmware is inoperative. BRANCH=none BUG=b:186189039 TEST=with next patch in series, verified the brya EC reports the correct device ID when the firmware is corrupted. Change-Id: I2696b9c20fdefd8afd02f7394a45f1c4c5636d71 Signed-off-by: Caveh Jalali Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2857796 Reviewed-by: Boris Mittelberg Reviewed-by: Keith Short --- driver/tcpm/ps8xxx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 3bc85f48e8..4643c669c0 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -560,6 +560,9 @@ static int ps8805_make_device_id(int port, int *id) * identify the chip as A1. * * See b/159289062. + * + * The ps8815 A2 reports device ID 0x0001 instead of 0x0003 when the + * firmware is bad (mis-programmed). */ static int ps8815_make_device_id(int port, int *id) { @@ -574,6 +577,7 @@ static int ps8815_make_device_id(int port, int *id) &val); if (status != EC_SUCCESS) return status; + switch (val) { case 0x0a00: *id = 1; @@ -581,6 +585,9 @@ static int ps8815_make_device_id(int port, int *id) case 0x0a01: *id = 2; break; + case 0x0a02: + *id = 3; + break; default: return EC_ERROR_UNKNOWN; } -- cgit v1.2.1