drivers: clock_control: stm32wb: Lock CLK48 hsem
On stm32wb, M0 core may enable and disable CLK48 when using RNG.
Lock related hsem to prevent M0 to disable CLK48 when it doesn't need it
anymore.
@@ -640,6 +640,13 @@ static void set_up_fixed_clock_sources(void)
LL_SYSCFG_VREFINT_EnableHSI48();
#endif /* CONFIG_SOC_SERIES_STM32L0X */
+ /*
+ * STM32WB: Lock the CLK48 HSEM and do not release to prevent
+ * M0 core to disable this clock (used for RNG on M0).
+ * No-op on other series.
+ */
+ z_stm32_hsem_lock(CFG_HW_CLK48_CONFIG_SEMID, HSEM_LOCK_DEFAULT_RETRY);
+
LL_RCC_HSI48_Enable();
while (LL_RCC_HSI48_IsReady() != 1) {
}
