drivers/entropy: stm32: selecting the right rng clock source

This commit selects LL_RCC_RNG_CLKSOURCE_CLK48 as a clock source
to rng peripheral. LL_RCC_RNG_CLKSOURCE_CLK48 is CLK48 divided by 3.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
This commit is contained in:
Krishna Mohan Dani 2021-07-07 17:29:46 +05:30 committed by Kumar Gala
commit b09e6fb3c5

View file

@ -401,12 +401,17 @@ static int entropy_stm32_rng_init(const struct device *dev)
/* Wait for HSI48 to become ready */
}
LL_RCC_SetRNGClockSource(LL_RCC_RNG_CLKSOURCE_HSI48);
#if defined(CONFIG_SOC_SERIES_STM32WBX)
LL_RCC_SetRNGClockSource(LL_RCC_RNG_CLKSOURCE_CLK48);
LL_RCC_SetCLK48ClockSource(LL_RCC_CLK48_CLKSOURCE_HSI48);
#if !defined(CONFIG_SOC_SERIES_STM32WBX)
/* Specially for STM32WB, don't unlock the HSEM to prevent M0 core
/* Don't unlock the HSEM to prevent M0 core
* to disable HSI48 clock used for RNG.
*/
#else
LL_RCC_SetRNGClockSource(LL_RCC_RNG_CLKSOURCE_HSI48);
/* Unlock the HSEM if it is not STM32WB */
z_stm32_hsem_unlock(CFG_HW_CLK48_CONFIG_SEMID);
#endif /* CONFIG_SOC_SERIES_STM32WBX */