summaryrefslogtreecommitdiff
path: root/chip/stm32/usb.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-11-20 12:43:46 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-21 02:44:07 +0000
commitb16bcb0eb08167c263aa8b53e23625e690331a7a (patch)
treea077c8e6342715d02e63fbb0fe0825860ab8b787 /chip/stm32/usb.c
parent1728af5b83a09a85945589ef639783ffe035023f (diff)
downloadchrome-ec-b16bcb0eb08167c263aa8b53e23625e690331a7a.tar.gz
stm32: Do not wait for USB host if USB is disabled
For USB console, we wait for USB host to grab the data before writing the next chunk of characters. However, if the USB peripheral is disabled, the current implementation is confused as to whether the host has grabbed the previous chunk of data. Fix this by explicitly checking for USB peripheral enabled. BRANCH=ryu BUG=None TEST=Boot on Ryu and check console isn't slow. Signed-off-by: Vic Yang <victoryang@chromium.org> Change-Id: I438c95835e56707b7ca1796734f2e47062799f44 Reviewed-on: https://chromium-review.googlesource.com/231115 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/stm32/usb.c')
-rw-r--r--chip/stm32/usb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index a0a37524be..b4dfb31fb5 100644
--- a/chip/stm32/usb.c
+++ b/chip/stm32/usb.c
@@ -326,3 +326,8 @@ void usb_release(void)
/* disable USB device clock */
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_USB;
}
+
+int usb_is_enabled(void)
+{
+ return (STM32_RCC_APB1ENR & STM32_RCC_PB1_USB) ? 1 : 0;
+}