summaryrefslogtreecommitdiff
path: root/chip/stm32/usb.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-11-11 12:05:08 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-13 03:14:26 +0000
commit079742b1ffb352cb0149d4fea232747e83dd6209 (patch)
treee0079651e3b04a07869d784547ec31eab22a628f /chip/stm32/usb.c
parent4340685cf9ab9335256d63a8a551faa85af4f892 (diff)
downloadchrome-ec-079742b1ffb352cb0149d4fea232747e83dd6209.tar.gz
USB: Enable finer grain control over init process
Previously enabling USB would automatically (using an init hook) initialize the USB peripheral. This would take over the GPIO lines assigned to the USB module. This is not OK on Ryu for Case Closed Debug because it interferes with the AP's access to the USB 2.0 lines even when not in Case Close Debug mode. This change adds a configuration option to inhibit this default initialization of the USB peripheral. It also renames the existing CONFIG_USB_INHIBIT to CONFIG_USB_INHIBIT_CONNECT now that there are two possible inhibitions. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Enable console on ryu_p2 and discovery-stm32f072 board Verify that it works on both Change-Id: I6734357131b4356e3d4164349d6c74deac196ce5 Reviewed-on: https://chromium-review.googlesource.com/229138 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'chip/stm32/usb.c')
-rw-r--r--chip/stm32/usb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index 425b768632..a0a37524be 100644
--- a/chip/stm32/usb.c
+++ b/chip/stm32/usb.c
@@ -295,13 +295,16 @@ void usb_init(void)
/* set interrupts mask : reset/correct tranfer/errors */
STM32_USB_CNTR = 0xe400;
-#ifndef CONFIG_USB_INHIBIT
+#ifndef CONFIG_USB_INHIBIT_CONNECT
usb_connect();
#endif
CPRINTF("USB init done\n");
}
+
+#ifndef CONFIG_USB_INHIBIT_INIT
DECLARE_HOOK(HOOK_INIT, usb_init, HOOK_PRIO_DEFAULT);
+#endif
void usb_release(void)
{