diff options
author | Denis Brockus <dbrockus@chromium.org> | 2020-02-13 13:38:27 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-14 02:00:15 +0000 |
commit | c45b854a78cc6e8b08d64d3bc4ab69986fdb97b3 (patch) | |
tree | 02a84ed5a2bcc437f99cf4593198d040c15725fb /baseboard | |
parent | 423d9e5462757de7d4d06a76ef031247fd1fecbe (diff) | |
download | chrome-ec-c45b854a78cc6e8b08d64d3bc4ab69986fdb97b3.tar.gz |
zork: allow for the PS8811 needing a retry
Added a retry to the PS8811 initialization because
I was seeing it fail on occasion the first time.
Also turned off the GPIO tied to either PS8811
that is not detected
BUG=none
BRANCH=none
TEST=verify starting correctly
Change-Id: If461b5434c7229dc06f0a95d032269fc97a45bd9
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2055764
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/zork/baseboard.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index 27286d72ab..881c449a82 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -452,27 +452,46 @@ void bc12_interrupt(enum gpio_signal signal) /***************************************************************************** * 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 */ - 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); + 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) { - CPRINTSUSB("C1: PS8811 not present or failing to set gain"); - return; + 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); |