mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 10:31:02 +00:00
Plankton: reset USB hub on POR
On power-on reset, the USB hub might get stuck in a locked state due to a race condition in hardware. Let's reset the hub after 0.5 seconds to make sure this doesn't happen. BUG=chrome-os-partner:32163 TEST=Power on the board. Measure the reset signal. BRANCH=None Change-Id: I0f89883c5db7c5376f3612da1615ba4f86b5efa6 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219199 Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
cc0843d270
commit
4fda01ca91
@@ -13,6 +13,7 @@
|
||||
#include "i2c.h"
|
||||
#include "ioexpander_pca9534.h"
|
||||
#include "registers.h"
|
||||
#include "system.h"
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
#include "usb_pd.h"
|
||||
@@ -200,7 +201,7 @@ DECLARE_CONSOLE_COMMAND(usbc_action, cmd_usbc_action,
|
||||
"Set Plankton type-C port state",
|
||||
NULL);
|
||||
|
||||
static int cmd_usb_hub_reset(int argc, char *argv[])
|
||||
static int board_usb_hub_reset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -213,5 +214,23 @@ static int cmd_usb_hub_reset(int argc, char *argv[])
|
||||
usleep(100 * MSEC);
|
||||
return pca9534_set_level(I2C_PORT_MASTER, 0x40, 7, 1);
|
||||
}
|
||||
|
||||
static int cmd_usb_hub_reset(int argc, char *argv[])
|
||||
{
|
||||
return board_usb_hub_reset();
|
||||
}
|
||||
DECLARE_CONSOLE_COMMAND(hub_reset, cmd_usb_hub_reset,
|
||||
NULL, "Reset USB hub", NULL);
|
||||
|
||||
static void board_usb_hub_reset_no_return(void)
|
||||
{
|
||||
board_usb_hub_reset();
|
||||
}
|
||||
DECLARE_DEFERRED(board_usb_hub_reset_no_return);
|
||||
|
||||
static void board_init_usb_hub(void)
|
||||
{
|
||||
if (system_get_reset_flags() & RESET_FLAG_POWER_ON)
|
||||
hook_call_deferred(board_usb_hub_reset_no_return, 500 * MSEC);
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, board_init_usb_hub, HOOK_PRIO_DEFAULT);
|
||||
|
||||
Reference in New Issue
Block a user