diff options
author | Nicolas Boichat <drinkcat@google.com> | 2017-02-22 16:47:27 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-03-01 07:25:03 -0800 |
commit | b8c255484c59161217becdc29e353424d1f7a364 (patch) | |
tree | 9599cc58c41139ddfcae5f8e39dd36ac797cfedb /chip/stm32/usb-stm32f3.c | |
parent | c425cbae0be48cf9a9a5b30610c282ced1328d70 (diff) | |
download | chrome-ec-b8c255484c59161217becdc29e353424d1f7a364.tar.gz |
stm32/usb: Add support for USB suspend
This follows the basics of what is decribed in
RM0091 Reference Manual 30.5.5 Suspend/Resume events .
We call enable/disable_sleep at suspend/resume, to make
sure the EC stays awake when USB is connected and active.
We also call clock_enable/disable_module, which is stubbed on
stm32f0, but can be used on other devices in the family.
This also fixes interrupt handling in usb_interrupt, by only
clearing interrupt bits that were handled instead of resetting
them all, which is racy, and can potentially lead to issues
if reset comes soon after a resume event.
BRANCH=none
BUG=chrome-os-partner:62325
TEST=build and flash hammer, connect to chell, suspend/resume,
and see that hammer prints USB suspend and USB resume lines.
Change-Id: Ie9d02fd4a114add3ebc98dc9393680bc9a64a522
Reviewed-on: https://chromium-review.googlesource.com/446239
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/stm32/usb-stm32f3.c')
-rw-r--r-- | chip/stm32/usb-stm32f3.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chip/stm32/usb-stm32f3.c b/chip/stm32/usb-stm32f3.c index 8c16bd6b4a..d81548729b 100644 --- a/chip/stm32/usb-stm32f3.c +++ b/chip/stm32/usb-stm32f3.c @@ -7,14 +7,21 @@ #include "usb-stm32f3.h" +#include "system.h" #include "usb_api.h" void usb_connect(void) { + /* USB is in use */ + disable_sleep(SLEEP_MASK_USB_DEVICE); + usb_board_connect(); } void usb_disconnect(void) { usb_board_disconnect(); + + /* USB is off, so sleep whenever */ + enable_sleep(SLEEP_MASK_USB_DEVICE); } |