Skip to content

Commit

Permalink
[nrf fromtree] drivers: udc_dwc2: Wait for USBHS clock start
Browse files Browse the repository at this point in the history
Accessing DWC2 otg core registers before the clock starts results in
complete system hang. Add a 1 us busy wait to make sure that software
won't access registers before the clock is started.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit df36b16)
  • Loading branch information
tmon-nordic authored and gmarull committed Dec 2, 2024
1 parent 070d76e commit 581e638
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/udc/udc_dwc2_vendor_quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ static inline int usbhs_enable_core(const struct device *dev)
wrapper->ENABLE = USBHS_ENABLE_PHY_Msk | USBHS_ENABLE_CORE_Msk;
wrapper->TASKS_START = 1UL;

/* Wait for clock to start to avoid hang on too early register read */
k_busy_wait(1);

/* Enable interrupts */
wrapper->INTENSET = 1UL;

Expand Down

0 comments on commit 581e638

Please sign in to comment.