Skip to content

Commit 7a0c31c

Browse files
FRASTMcarlescufi
authored andcommitted
drivers: usb: stm32 usb device controller in sleep mode
Force disabling the USB OTG HS and PHY clock during sleepmode By default, that clock is enabled by clock gating during sleep mode. Like stm32H7, it has to be kept running. Signed-off-by: Francois Ramu <francois.ramu@st.com>
1 parent 06662fc commit 7a0c31c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/usb/device/usb_dc_stm32.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ static int usb_dc_stm32_clock_enable(void)
244244
LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_PWR);
245245
}
246246

247+
/* Set the OTG PHY reference clock selection (through SYSCFG) block */
247248
LL_APB3_GRP1_EnableClock(LL_APB3_GRP1_PERIPH_SYSCFG);
248-
/* Set the OTG PHY reference clock selection */
249249
HAL_SYSCFG_SetOTGPHYReferenceClockSelection(SYSCFG_OTG_HS_PHY_CLK_SELECT_1);
250250
/* Configuring the SYSCFG registers OTG_HS PHY : OTG_HS PHY enable*/
251251
HAL_SYSCFG_EnableOTGPHY(SYSCFG_OTG_HS_PHY_ENABLE);
@@ -308,6 +308,11 @@ static int usb_dc_stm32_clock_enable(void)
308308
*/
309309
#if defined(CONFIG_SOC_SERIES_STM32H7X)
310310
LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_USB1OTGHSULPI);
311+
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
312+
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_USBPHY);
313+
/* Both OTG HS and USBPHY sleep clock MUST be disabled here at the same time */
314+
LL_AHB2_GRP1_DisableClockStopSleep(LL_AHB2_GRP1_PERIPH_OTG_HS ||
315+
LL_AHB2_GRP1_PERIPH_USBPHY);
311316
#else
312317
LL_AHB1_GRP1_DisableClockLowPower(LL_AHB1_GRP1_PERIPH_OTGHSULPI);
313318
#endif

0 commit comments

Comments
 (0)