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.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2023-01-03 14:27:26 +01:00 committed by Fabio Baltieri
commit bef7a89823

View file

@ -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) {
}