Skip to content

Commit

Permalink
drivers: clock_control: stm32wb: Lock CLK48 hsem
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
erwango authored and fabiobaltieri committed Jan 16, 2023
1 parent c896b1e commit bef7a89
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/clock_control/clock_stm32_ll_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
Expand Down

0 comments on commit bef7a89

Please sign in to comment.