Skip to content

Commit 7556439

Browse files
committed
drivers: usb: udc: imporve usb code maintainability
Replace the direct call to LL_AHB2_GRP1_EnableClock with the clock control API. Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
1 parent 5d59175 commit 7556439

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/usb/udc/udc_stm32.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,19 +1143,19 @@ static int priv_clock_enable(void)
11431143
#endif /* RCC_CFGR_OTGFSPRE / RCC_CFGR_USBPRE */
11441144

11451145
#if USB_OTG_HS_ULPI_PHY
1146-
#if defined(CONFIG_SOC_SERIES_STM32H7X)
1147-
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_USB1OTGHSULPI);
1148-
#else
1149-
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_OTGHSULPI);
1150-
#endif
1146+
#if defined(CONFIG_SOC_SERIES_STM32H7X)
1147+
clock_control_on(clk, (clock_control_subsys_t)&phy_pclken[0]);
1148+
#else
1149+
clock_control_on(clk, (clock_control_subsys_t)&phy_pclken[0]);
1150+
#endif
11511151
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) /* USB_OTG_HS_ULPI_PHY */
11521152
/* Disable ULPI interface (for external high-speed PHY) clock in sleep/low-power mode.
11531153
* It is disabled by default in run power mode, no need to disable it.
11541154
*/
11551155
#if defined(CONFIG_SOC_SERIES_STM32H7X)
11561156
LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_USB1OTGHSULPI);
11571157
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
1158-
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_USBPHY);
1158+
clock_control_on(clk, (clock_control_subsys_t)&phy_pclken[0]);
11591159
/* Both OTG HS and USBPHY sleep clock MUST be disabled here at the same time */
11601160
LL_AHB2_GRP1_DisableClockStopSleep(LL_AHB2_GRP1_PERIPH_OTG_HS ||
11611161
LL_AHB2_GRP1_PERIPH_USBPHY);
@@ -1164,7 +1164,7 @@ static int priv_clock_enable(void)
11641164
#endif /* defined(CONFIG_SOC_SERIES_STM32H7X) */
11651165

11661166
#if USB_OTG_HS_EMB_PHY
1167-
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_OTGPHYC);
1167+
clock_control_on(clk, (clock_control_subsys_t)&phy_pclken[0]);
11681168
#endif
11691169
#elif defined(CONFIG_SOC_SERIES_STM32H7X) && DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otgfs)
11701170
/* The USB2 controller only works in FS mode, but the ULPI clock needs

0 commit comments

Comments
 (0)