From 4ecdf787938fc8d0124c07a05e34c59cd2fcc79e Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Wed, 10 May 2017 15:56:10 +0200 Subject: [PATCH] g: allow to select the default USB PHY at startup. When (USB-)resuming from deep-sleep, ensure that we avoid switching back and forth the selected USB PHY at boot, in order to avoid having a short disconnection at resume. To achieve this, allow the board configuration to select the PHY it is really using with the CONFIG_USB_SELECT_PHY_DEFAULT configuration variable, still keep the default USB_SEL_PHY1 as before. Signed-off-by: Vincent Palatin BRANCH=none BUG=b:38160821 TEST=manual: build 'proto2' firmware with CONFIG_LOW_POWER_IDLE defined, with the chip connected to the host on PHY A, make the host issue a USB Suspend then resume and see no disconnection. Change-Id: I7abd5e338e5c688c2dd486293f520049cdfd273b Reviewed-on: https://chromium-review.googlesource.com/501947 Commit-Ready: Vincent Palatin Tested-by: Vincent Palatin Reviewed-by: Marius Schilder Reviewed-by: Vadim Bendebury --- chip/g/usb.c | 6 +++++- include/config.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/chip/g/usb.c b/chip/g/usb.c index 32b347e3ab..2562461b2e 100644 --- a/chip/g/usb.c +++ b/chip/g/usb.c @@ -331,8 +331,12 @@ static enum { } device_state; static uint8_t configuration_value; +#ifndef CONFIG_USB_SELECT_PHY_DEFAULT +#define CONFIG_USB_SELECT_PHY_DEFAULT USB_SEL_PHY1 +#endif + /* Default PHY to use */ -static uint32_t which_phy = USB_SEL_PHY1; +static uint32_t which_phy = CONFIG_USB_SELECT_PHY_DEFAULT; void usb_select_phy(uint32_t phy) { diff --git a/include/config.h b/include/config.h index 9248b5185c..90f13b3dcc 100644 --- a/include/config.h +++ b/include/config.h @@ -2483,6 +2483,8 @@ /* Support control of multiple PHY */ #undef CONFIG_USB_SELECT_PHY +/* Select which USB PHY will be used at startup */ +#undef CONFIG_USB_SELECT_PHY_DEFAULT /* Support simple control of power to the device's USB ports */ #undef CONFIG_USB_PORT_POWER_DUMB