Skip to content

Commit

Permalink
soc: arm: nxp: fix USB w/ SPEED_OPTIMIZATIONS
Browse files Browse the repository at this point in the history
Fix USB w/ SPEED_OPTIMIZATIONS for LPC55xxx SoCs
Root cause was non-volatile register access,
which could get optimized by the compiler
(by -fschedule-insns, specifically)

Signed-off-by: Maxime Vincent <[email protected]>
  • Loading branch information
maximevince authored and nashif committed Sep 17, 2024
1 parent cdf18ba commit f86f98f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions soc/nxp/lpc/lpc55xxx/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static ALWAYS_INLINE void clock_init(void)
* According to reference mannual, device mode setting has to be set by access
* usb host register
*/
*((uint32_t *)(USBFSH_BASE + 0x5C)) |= USBFSH_PORTMODE_DEV_ENABLE_MASK;
USBFSH->PORTMODE |= USBFSH_PORTMODE_DEV_ENABLE_MASK;
/* disable usb0 host clock */
CLOCK_DisableClock(kCLOCK_Usbhsl0);

Expand All @@ -244,12 +244,12 @@ static ALWAYS_INLINE void clock_init(void)
/* enable usb1 host clock */
CLOCK_EnableClock(kCLOCK_Usbh1);
/* Put PHY powerdown under software control */
*((uint32_t *)(USBHSH_BASE + 0x50)) = USBHSH_PORTMODE_SW_PDCOM_MASK;
USBHSH->PORTMODE = USBHSH_PORTMODE_SW_PDCOM_MASK;
/*
* According to reference manual, device mode setting has to be set by
* access usb host register
*/
*((uint32_t *)(USBHSH_BASE + 0x50)) |= USBHSH_PORTMODE_DEV_ENABLE_MASK;
USBHSH->PORTMODE |= USBHSH_PORTMODE_DEV_ENABLE_MASK;
/* disable usb1 host clock */
CLOCK_DisableClock(kCLOCK_Usbh1);

Expand Down

0 comments on commit f86f98f

Please sign in to comment.