File tree 4 files changed +30
-4
lines changed
4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -419,12 +419,16 @@ static void start_ble_rf(void)
419
419
LL_RCC_SetRTCClockSource (LL_RCC_RTC_CLKSOURCE_LSI );
420
420
#endif
421
421
422
- /* Set RNG on HSI48 */
422
+ /* HSI48 clock and CLK48 clock source are enabled using the device tree */
423
+ #if !STM32_HSI48_ENABLED
424
+ /* Deprecated: enable HSI48 using device tree */
425
+ #warning Bluetooth IPM requires HSI48 clock to be enabled using device tree
426
+ /* Keeping this sequence for legacy: */
423
427
LL_RCC_HSI48_Enable ();
424
428
while (!LL_RCC_HSI48_IsReady ()) {
425
429
}
426
430
427
- LL_RCC_SetCLK48ClockSource ( LL_RCC_CLK48_CLKSOURCE_HSI48 );
431
+ #endif /* !STM32_HSI48_ENABLED */
428
432
}
429
433
430
434
#ifdef CONFIG_BT_HCI_HOST
Original file line number Diff line number Diff line change @@ -154,13 +154,22 @@ static int stm32_sdmmc_clock_enable(struct stm32_sdmmc_priv *priv)
154
154
155
155
#if defined(CONFIG_SOC_SERIES_STM32L5X ) || \
156
156
defined(CONFIG_SOC_SERIES_STM32U5X )
157
- /* By default the SDMMC clock source is set to 0 --> 48MHz, must be enabled */
157
+ #if !STM32_HSI48_ENABLED
158
+ /* Deprecated: enable HSI48 using device tree */
159
+ #warning USB device requires HSI48 clock to be enabled using device tree
160
+ /*
161
+ * Keeping this sequence for legacy :
162
+ * By default the SDMMC clock source is set to 0 --> 48MHz, must be enabled
163
+ */
158
164
LL_RCC_HSI48_Enable ();
159
165
while (!LL_RCC_HSI48_IsReady ()) {
160
166
}
167
+ #endif /* !STM32_HSI48_ENABLED */
161
168
#endif /* CONFIG_SOC_SERIES_STM32L5X ||
162
169
* CONFIG_SOC_SERIES_STM32U5X
163
170
*/
171
+
172
+ /* HSI48 Clock is enabled through using the device tree */
164
173
clock = DEVICE_DT_GET (STM32_CLOCK_CONTROL_NODE );
165
174
166
175
/* Enable the APB clock for stm32_sdmmc */
Original file line number Diff line number Diff line change @@ -603,7 +603,11 @@ static int entropy_stm32_rng_init(const struct device *dev)
603
603
LL_RCC_SetRNGClockSource (LL_RCC_RNG_CLKSOURCE_PLL );
604
604
#elif defined(RCC_CR2_HSI48ON ) || defined(RCC_CR_HSI48ON ) \
605
605
|| defined(RCC_CRRCR_HSI48ON )
606
+ #if !STM32_HSI48_ENABLED
607
+ /* Deprecated: enable HSI48 using device tree */
608
+ #warning RNG requires HSI48 clock to be enabled using device tree
606
609
610
+ /* Keeping this sequence for legacy: */
607
611
#if CONFIG_SOC_SERIES_STM32L0X
608
612
/* We need SYSCFG to control VREFINT, so make sure it is clocked */
609
613
if (!LL_APB2_GRP1_IsEnabledClock (LL_APB2_GRP1_PERIPH_SYSCFG )) {
@@ -619,7 +623,12 @@ static int entropy_stm32_rng_init(const struct device *dev)
619
623
while (!LL_RCC_HSI48_IsReady ()) {
620
624
/* Wait for HSI48 to become ready */
621
625
}
626
+ #else /* !STM32_HSI48_ENABLED */
627
+ /* HSI48 is enabled by the DTS : lock the HSI48 clock for RNG use */
628
+ z_stm32_hsem_lock (CFG_HW_CLK48_CONFIG_SEMID , HSEM_LOCK_DEFAULT_RETRY );
629
+ #endif /* !STM32_HSI48_ENABLED */
622
630
631
+ /* HSI48 Clock is enabled through the DTS: set as RNG clock source */
623
632
#if defined(CONFIG_SOC_SERIES_STM32WBX )
624
633
LL_RCC_SetRNGClockSource (LL_RCC_RNG_CLKSOURCE_CLK48 );
625
634
LL_RCC_SetCLK48ClockSource (LL_RCC_CLK48_CLKSOURCE_HSI48 );
Original file line number Diff line number Diff line change @@ -207,7 +207,10 @@ static int usb_dc_stm32_clock_enable(void)
207
207
defined(CONFIG_SOC_SERIES_STM32H7X ) || \
208
208
defined(CONFIG_SOC_SERIES_STM32L5X ) || \
209
209
defined(CONFIG_SOC_SERIES_STM32U5X )
210
-
210
+ #if !STM32_HSI48_ENABLED
211
+ /* Deprecated: enable HSI48 using device tree */
212
+ #warning USB device requires HSI48 clock to be enabled using device tree
213
+ #endif /* ! STM32_HSI48_ENABLED*/
211
214
/*
212
215
* In STM32L0 series, HSI48 requires VREFINT and its buffer
213
216
* with 48 MHz RC to be enabled.
@@ -226,6 +229,7 @@ static int usb_dc_stm32_clock_enable(void)
226
229
227
230
z_stm32_hsem_lock (CFG_HW_CLK48_CONFIG_SEMID , HSEM_LOCK_DEFAULT_RETRY );
228
231
232
+ /* Keeping this sequence for legacy: */
229
233
LL_RCC_HSI48_Enable ();
230
234
while (!LL_RCC_HSI48_IsReady ()) {
231
235
/* Wait for HSI48 to become ready */
You can’t perform that action at this time.
0 commit comments