summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-05-07 21:49:24 -0700
committerKeith Packard <keithp@keithp.com>2012-05-07 21:49:24 -0700
commitdd7699cf8daded17ac41abf5c5170cfb599b6ff5 (patch)
tree065f70d89c9459eb78d4022ca4df9845899dea06
parent744d05e6037ffc11688a9faa9c7b5dcda4065ee3 (diff)
altos: stm: delay during USB config with pull-up off
This makes sure that a reboot will reliably cause the device to disconnect from the USB bus. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/stm/ao_usb_stm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stm/ao_usb_stm.c b/src/stm/ao_usb_stm.c
index 71bf1bc7..c093f526 100644
--- a/src/stm/ao_usb_stm.c
+++ b/src/stm/ao_usb_stm.c
@@ -937,7 +937,7 @@ ao_usb_disable(void)
void
ao_usb_enable(void)
{
- uint16_t tick;
+ int t;
/* Enable SYSCFG */
stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SYSCFGEN);
@@ -985,6 +985,8 @@ ao_usb_enable(void)
(0 << STM_USB_CNTR_PDWN) |
(0 << STM_USB_CNTR_FRES));
+ for (t = 0; t < 1000; t++)
+ ao_arch_nop();
/* Enable USB pull-up */
stm_syscfg.pmc |= (1 << STM_SYSCFG_PMC_USB_PU);
}