diff options
author | Jan Dabros <jsd@semihalf.com> | 2021-01-27 22:30:06 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-09 10:35:12 +0000 |
commit | a57b6020ae50c474886f7ed591a6e0dbdb1bc950 (patch) | |
tree | b8330adbe3573c051e7d421db9fe5f02562cd54c /board | |
parent | b4fcacdda8df6b738025361d3edea337129594e9 (diff) | |
download | chrome-ec-a57b6020ae50c474886f7ed591a6e0dbdb1bc950.tar.gz |
servo_v4p1: Defer all transactions to host hub i2c
We shouldn't issue any I2C transactions to the gl3590 host hub until
INTR# signal is deasserted.
BUG=b:178125550
BRANCH=main
TEST=Verify host hub functionality on servo_v4p1 board. All USB ports
should be usable. Check console logs for any possible error messages.
Signed-off-by: Jan Dabros <jsd@semihalf.com>
Change-Id: Ia49510ca080f38931fd6c809103997e3748e9988
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2674003
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/servo_v4p1/board.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/board/servo_v4p1/board.c b/board/servo_v4p1/board.c index 6e83f20a09..6e0264d913 100644 --- a/board/servo_v4p1/board.c +++ b/board/servo_v4p1/board.c @@ -400,11 +400,32 @@ int board_get_version(void) } #ifdef SECTION_IS_RO +/* Forward declaration */ +static void evaluate_input_power_def(void); +DECLARE_DEFERRED(evaluate_input_power_def); + static void evaluate_input_power_def(void) { + int state; + static int retry = 3; + + /* Wait until host hub INTR# signal is asserted */ + state = gpio_get_level(GPIO_USBH_I2C_BUSY_INT); + if ((state == 0) && retry--) { + hook_call_deferred(&evaluate_input_power_def_data, 100 * MSEC); + return; + } + + if (retry == 0) + CPRINTF("Host hub I2C isn't online, expect issues with its " + "behaviour\n"); + + gpio_enable_interrupt(GPIO_USBH_I2C_BUSY_INT); + + gl3590_init(HOST_HUB); + evaluate_input_power(); } -DECLARE_DEFERRED(evaluate_input_power_def); #endif static void board_init(void) @@ -444,14 +465,12 @@ static void board_init(void) init_fusb302b(1); /* - * Get data about available input power. Add additional check after a - * delay, since we need to wait for USB2/USB3 enumeration on host hub - * as well as I2C interface of this hub needs to be initialized. - * 3 seconds is experimentally selected value, by this time hub should - * be up and running. + * Get data about available input power. Defer this check, since we need + * to wait for USB2/USB3 enumeration on host hub as well as I2C + * interface of this hub needs to be initialized. Genesys recommends at + * least 100ms. */ - evaluate_input_power(); - hook_call_deferred(&evaluate_input_power_def_data, 3 * SECOND); + hook_call_deferred(&evaluate_input_power_def_data, 100 * MSEC); /* Enable DUT USB2.0 pair. */ gpio_set_level(GPIO_FASTBOOT_DUTHUB_MUX_EN_L, 0); @@ -462,7 +481,6 @@ static void board_init(void) gpio_enable_interrupt(GPIO_STM_FAULT_IRQ_L); gpio_enable_interrupt(GPIO_DP_HPD); - gpio_enable_interrupt(GPIO_USBH_I2C_BUSY_INT); gpio_enable_interrupt(GPIO_DUT_PWR_IRQ_ODL); /* Disable power to DUT by default */ |