From b9fbc80fa332f2869539ce4fb49b3dda8fc0515c Mon Sep 17 00:00:00 2001 From: Divya Sasidharan Date: Fri, 29 Dec 2017 14:44:12 -0800 Subject: [PATCH] usb_mux: Fix incorrect revision check at init for ps874x This patch fixes revision check for ps8xxx usb mux and thereby removing print "Error initializing mux port(x)" at bootup. This is just a cosmetic change and should not affect any functionality. BUG=none BRANCH=glkrvp TEST=On glkrvp: Boot up the system to verify the error message setting mux is gone at init. Change-Id: I0926077d50e818bd93aaa4214106b2f8067d9710 Signed-off-by: Divya Sasidharan Reviewed-on: https://chromium-review.googlesource.com/846291 Commit-Ready: Divya S Sasidharan Tested-by: Divya S Sasidharan Reviewed-by: Vijay P Hiremath Reviewed-by: Scott Collyer Reviewed-by: Jett Rink --- driver/usb_mux_ps874x.c | 17 ++++++++++++----- driver/usb_mux_ps874x.h | 9 +++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/driver/usb_mux_ps874x.c b/driver/usb_mux_ps874x.c index 76b7eb26c3..900ae0763a 100644 --- a/driver/usb_mux_ps874x.c +++ b/driver/usb_mux_ps874x.c @@ -33,20 +33,27 @@ static int ps874x_init(int i2c_addr) /* * Verify revision / chip ID registers. - * From Parade: PS8743 may have REVISION_ID1 as 0 or 1, - * PS8740 may have REVISION_ID2 as 0 or 1, - * 1 is derived from 0 and have same functionality. */ res = ps874x_read(i2c_addr, PS874X_REG_REVISION_ID1, &val); if (res) return res; - if (val < PS874X_REVISION_ID1) + +#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(i2c_addr, PS874X_REG_REVISION_ID2, &val); if (res) return res; - if (val < PS874X_REVISION_ID2) + if (val != PS874X_REVISION_ID2) return EC_ERROR_UNKNOWN; res = ps874x_read(i2c_addr, PS874X_REG_CHIP_ID1, &val); diff --git a/driver/usb_mux_ps874x.h b/driver/usb_mux_ps874x.h index 8092e448bb..e9d4c1ff36 100644 --- a/driver/usb_mux_ps874x.h +++ b/driver/usb_mux_ps874x.h @@ -40,11 +40,12 @@ #define PS874X_REG_CHIP_ID1 0xf2 #define PS874X_REG_CHIP_ID2 0xf3 #ifdef CONFIG_USB_MUX_PS8740 - #define PS874X_REVISION_ID1 0x00 - #define PS874X_REVISION_ID2 0x0a - #define PS874X_CHIP_ID1 0x40 + #define PS874X_REVISION_ID1 0x00 + #define PS874X_REVISION_ID2 0x0a + #define PS874X_CHIP_ID1 0x40 #elif defined(CONFIG_USB_MUX_PS8743) - #define PS874X_REVISION_ID1 0x01 + #define PS874X_REVISION_ID1_0 0x00 + #define PS874X_REVISION_ID1_1 0x01 #define PS874X_REVISION_ID2 0x0b #define PS874X_CHIP_ID1 0x41 #endif