diff options
author | Denis Brockus <dbrockus@chromium.org> | 2020-03-09 14:11:12 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-11 16:27:23 +0000 |
commit | 5b86bf7592e4a27f505346913e6e1b072ef137d7 (patch) | |
tree | fd380555570672b271d23136167d677053fbf921 | |
parent | da4e343794782a124c09d669805718f91185dbd4 (diff) | |
download | chrome-ec-5b86bf7592e4a27f505346913e6e1b072ef137d7.tar.gz |
trembyle: move ps8811 from variant to board
The USBA retimer is only on the Zork:Trembyle:Trembyle
board so don't include it in the Zork:Trembyle vriant
BUG=b:151099955
BRANCH=none
TEST=make buildall -j
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Change-Id: I3dae1fee52255bdc6f51dc4225e46d8f7a254a15
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2095529
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r-- | baseboard/zork/variant_trembyle.c | 56 | ||||
-rw-r--r-- | board/trembyle/board.c | 60 |
2 files changed, 60 insertions, 56 deletions
diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c index 1df084e5df..e2e8607dee 100644 --- a/baseboard/zork/variant_trembyle.c +++ b/baseboard/zork/variant_trembyle.c @@ -8,7 +8,6 @@ #include "console.h" #include "driver/retimer/pi3dpx1207.h" #include "driver/retimer/ps8802.h" -#include "driver/retimer/ps8811.h" #include "driver/retimer/ps8818.h" #include "driver/usb_mux/amd_fp5.h" #include "fan.h" @@ -82,61 +81,6 @@ static void setup_fans(void) DECLARE_HOOK(HOOK_INIT, setup_fans, HOOK_PRIO_DEFAULT); /***************************************************************************** - * USB-A Retimer tuning - */ -#define PS8811_ACCESS_RETRIES 2 - -/* PS8811 gain tuning */ -static void ps8811_tuning_init(void) -{ - int rv; - int retry; - - /* Turn on the retimers */ - ioex_set_level(IOEX_USB_A0_RETIMER_EN, 1); - ioex_set_level(IOEX_USB_A1_RETIMER_EN, 1); - - /* USB-A0 can run with default settings */ - for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { - int val; - - rv = i2c_read8(I2C_PORT_USBA0, - PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, - PS8811_REG1_USB_BEQ_LEVEL, &val); - if (!rv) - break; - } - if (rv) { - ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); - CPRINTSUSB("C0: PS8811 not detected"); - } - - /* USB-A1 needs to increase gain to get over MB/DB connector */ - for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { - rv = i2c_write8(I2C_PORT_USBA1, - PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, - PS8811_REG1_USB_BEQ_LEVEL, - PS8811_BEQ_I2C_LEVEL_UP_13DB | - PS8811_BEQ_PIN_LEVEL_UP_18DB); - if (!rv) - break; - } - if (rv) { - ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); - CPRINTSUSB("C1: PS8811 not detected"); - } -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, ps8811_tuning_init, HOOK_PRIO_DEFAULT); - -static void ps8811_retimer_off(void) -{ - /* Turn on the retimers */ - ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); - ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); -} -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, ps8811_retimer_off, HOOK_PRIO_DEFAULT); - -/***************************************************************************** * MST hub */ diff --git a/board/trembyle/board.c b/board/trembyle/board.c index 77214eac86..0f476e047f 100644 --- a/board/trembyle/board.c +++ b/board/trembyle/board.c @@ -9,10 +9,12 @@ #include "driver/accelgyro_bmi160.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" +#include "driver/retimer/ps8811.h" #include "extpower.h" #include "fan.h" #include "fan_chip.h" #include "gpio.h" +#include "hooks.h" #include "lid_switch.h" #include "power.h" #include "power_button.h" @@ -24,6 +26,9 @@ #include "usb_charge.h" #include "gpio_list.h" +#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args) +#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args) + #ifdef HAS_TASK_MOTIONSENSE /* Motion sensors */ @@ -161,3 +166,58 @@ const struct mft_t mft_channels[] = { }, }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); + +/***************************************************************************** + * USB-A Retimer tuning + */ +#define PS8811_ACCESS_RETRIES 2 + +/* PS8811 gain tuning */ +static void ps8811_tuning_init(void) +{ + int rv; + int retry; + + /* Turn on the retimers */ + ioex_set_level(IOEX_USB_A0_RETIMER_EN, 1); + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 1); + + /* USB-A0 can run with default settings */ + for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { + int val; + + rv = i2c_read8(I2C_PORT_USBA0, + PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, + PS8811_REG1_USB_BEQ_LEVEL, &val); + if (!rv) + break; + } + if (rv) { + ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); + CPRINTSUSB("C0: PS8811 not detected"); + } + + /* USB-A1 needs to increase gain to get over MB/DB connector */ + for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { + rv = i2c_write8(I2C_PORT_USBA1, + PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, + PS8811_REG1_USB_BEQ_LEVEL, + PS8811_BEQ_I2C_LEVEL_UP_13DB | + PS8811_BEQ_PIN_LEVEL_UP_18DB); + if (!rv) + break; + } + if (rv) { + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); + CPRINTSUSB("C1: PS8811 not detected"); + } +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, ps8811_tuning_init, HOOK_PRIO_DEFAULT); + +static void ps8811_retimer_off(void) +{ + /* Turn on the retimers */ + ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); +} +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, ps8811_retimer_off, HOOK_PRIO_DEFAULT); |