diff options
author | Edward Hill <ecgh@chromium.org> | 2020-02-28 13:28:44 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-29 19:54:21 +0000 |
commit | 7453e9b1f8515df35ceb141a771d049001f55d61 (patch) | |
tree | e4df2fccde98cad66ba72799b9b4298ff6588f44 /driver/usb_mux | |
parent | 7345fbc90603f8d0d9161dc18e5579487b346593 (diff) | |
download | chrome-ec-7453e9b1f8515df35ceb141a771d049001f55d61.tar.gz |
PS8740: Allow 0xa or 0xb for REVISION_ID2
BUG=b:150384642
BRANCH=none
TEST=ps874x_init succeeds on Dalboz
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: I9213a1f12d2412db4d38eaf75daaa27507787e90
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2080644
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'driver/usb_mux')
-rw-r--r-- | driver/usb_mux/ps874x.c | 50 | ||||
-rw-r--r-- | driver/usb_mux/ps874x.h | 3 |
2 files changed, 30 insertions, 23 deletions
diff --git a/driver/usb_mux/ps874x.c b/driver/usb_mux/ps874x.c index fedb06b27c..bbc041e9c9 100644 --- a/driver/usb_mux/ps874x.c +++ b/driver/usb_mux/ps874x.c @@ -27,7 +27,8 @@ static inline int ps874x_write(const struct usb_mux *me, static int ps874x_init(const struct usb_mux *me) { - int val; + int id1; + int id2; int res; /* Reset chip back to power-on state */ @@ -36,41 +37,46 @@ static int ps874x_init(const struct usb_mux *me) return res; /* - * Verify revision / chip ID registers. + * Verify chip ID registers. */ - res = ps874x_read(me, PS874X_REG_REVISION_ID1, &val); + res = ps874x_read(me, PS874X_REG_CHIP_ID1, &id1); if (res) return res; -#ifdef CONFIG_USB_MUX_PS8743 - /* - * From Parade: PS8743 may have REVISION_ID1 as 0 or 1 - * Rev 1 is derived from Rev 0 and have same functionality. - */ - if (val != PS874X_REVISION_ID1_0 && val != PS874X_REVISION_ID1_1) - return EC_ERROR_UNKNOWN; -#else - if (val != PS874X_REVISION_ID1) - return EC_ERROR_UNKNOWN; -#endif - - res = ps874x_read(me, PS874X_REG_REVISION_ID2, &val); + res = ps874x_read(me, PS874X_REG_CHIP_ID2, &id2); if (res) return res; - if (val != PS874X_REVISION_ID2) + + if (id1 != PS874X_CHIP_ID1 || id2 != PS874X_CHIP_ID2) return EC_ERROR_UNKNOWN; - res = ps874x_read(me, PS874X_REG_CHIP_ID1, &val); + /* + * Verify revision ID registers. + */ + res = ps874x_read(me, PS874X_REG_REVISION_ID1, &id1); if (res) return res; - if (val != PS874X_CHIP_ID1) - return EC_ERROR_UNKNOWN; - res = ps874x_read(me, PS874X_REG_CHIP_ID2, &val); + res = ps874x_read(me, PS874X_REG_REVISION_ID2, &id2); if (res) return res; - if (val != PS874X_CHIP_ID2) + +#ifdef CONFIG_USB_MUX_PS8740 + if (id1 != PS874X_REVISION_ID1) + return EC_ERROR_UNKNOWN; + /* PS8740 may have REVISION_ID2 as 0xa or 0xb */ + if (id2 != PS874X_REVISION_ID2_0 && id2 != PS874X_REVISION_ID2_1) return EC_ERROR_UNKNOWN; +#else + /* + * From Parade: PS8743 may have REVISION_ID1 as 0 or 1 + * Rev 1 is derived from Rev 0 and have same functionality. + */ + if (id1 != PS874X_REVISION_ID1_0 && id1 != PS874X_REVISION_ID1_1) + return EC_ERROR_UNKNOWN; + if (id2 != PS874X_REVISION_ID2) + return EC_ERROR_UNKNOWN; +#endif return EC_SUCCESS; } diff --git a/driver/usb_mux/ps874x.h b/driver/usb_mux/ps874x.h index e7bd185bcf..f0caf7610b 100644 --- a/driver/usb_mux/ps874x.h +++ b/driver/usb_mux/ps874x.h @@ -41,7 +41,8 @@ #define PS874X_REG_CHIP_ID2 0xf3 #ifdef CONFIG_USB_MUX_PS8740 #define PS874X_REVISION_ID1 0x00 - #define PS874X_REVISION_ID2 0x0a + #define PS874X_REVISION_ID2_0 0x0a + #define PS874X_REVISION_ID2_1 0x0b #define PS874X_CHIP_ID1 0x40 #elif defined(CONFIG_USB_MUX_PS8743) #define PS874X_REVISION_ID1_0 0x00 |