summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2017-05-10 15:56:10 +0200
committerchrome-bot <chrome-bot@chromium.org>2017-05-12 13:09:55 -0700
commit4ecdf787938fc8d0124c07a05e34c59cd2fcc79e (patch)
treeb8e658d98c45b9730ac7d24b873d84d17a380bc2
parentfb6b933def1e94749463423ee69d762613954975 (diff)
downloadchrome-ec-4ecdf787938fc8d0124c07a05e34c59cd2fcc79e.tar.gz
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 <vpalatin@chromium.org> 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 <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--chip/g/usb.c6
-rw-r--r--include/config.h2
2 files changed, 7 insertions, 1 deletions
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