summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2014-10-20 16:58:56 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-31 06:29:28 +0000
commitaac88442d7bbc76ec5116fdb3019af09cc522938 (patch)
tree5fb6bbe02b0b78e3837cecea41574e08382c3aee /chip
parent13579c3570df0b7f3535d8c5499468761a482734 (diff)
downloadchrome-ec-aac88442d7bbc76ec5116fdb3019af09cc522938.tar.gz
pd: dingdong/hoho: inhibit USB Billboard.
USB Billboard class can be used to advertise an alternate mode capable device that hasn't entered a mode. Additionally it can remain after mode entry providing its Billboard capabilities descriptor is updated. This CL postpones enumeration which previously occurred after boot until tAMETimeout has passed and alternate mode has NOT been entered. Future CL could choose to also (re)enumerate with mode capabilities although this is not required by the USB PD specification. BRANCH=none BUG=chrome-os-partner:31192,chrome-os-partner:31193 TEST=manual, With DFP_U which does not enter mode see Billboard class enumerate else it does not. Change-Id: I59a0815cd0ea551ba9a878907c0184df4ba9480c Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224663 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/stm32/usb.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index b9f69ec848..409cb4f69d 100644
--- a/chip/stm32/usb.c
+++ b/chip/stm32/usb.c
@@ -297,20 +297,37 @@ void usb_init(void)
/* set interrupts mask : reset/correct tranfer/errors */
STM32_USB_CNTR = 0xe400;
- /* set pull-up on DP for FS mode */
-#ifdef CHIP_VARIANT_STM32L15X
- STM32_SYSCFG_PMC |= 1;
-#elif defined(CHIP_FAMILY_STM32F0)
- STM32_USB_BCDR |= 1 << 15 /* DPPU */;
-#else
- /* hardwired or regular GPIO on other platforms */
+#ifndef CONFIG_USB_INHIBIT
+ usb_connect();
#endif
CPRINTF("USB init done\n");
}
-#ifndef CONFIG_USB_INHIBIT
DECLARE_HOOK(HOOK_INIT, usb_init, HOOK_PRIO_DEFAULT);
+
+void usb_disconnect(void)
+{
+ /* disable pull-up on DP to disconnect */
+#ifdef CHIP_VARIANT_STM32L15X
+ STM32_SYSCFG_PMC &= ~1;
+#elif defined(CHIP_FAMILY_STM32F0)
+ STM32_USB_BCDR &= ~(1 << 15) /* DPPU */;
+#else
+#warn "usb disconnect not implemented for this chip family"
#endif
+}
+
+void usb_connect(void)
+{
+ /* enable pull-up on DP to connect */
+#ifdef CHIP_VARIANT_STM32L15X
+ STM32_SYSCFG_PMC |= 1;
+#elif defined(CHIP_FAMILY_STM32F0)
+ STM32_USB_BCDR |= (1 << 15) /* DPPU */;
+#else
+#warn "usb connect not implemented for this chip family"
+#endif
+}
void usb_release(void)
{