drivers: entropy: stm32: Add support for STM32L0 SoCs
Add the necessary clock configuration to support STM32L-based SoCs. This change likely adds support for other STM32 SoCs as well since the HSI48 clock is configured for all SoCs that support it (except the STM32L4x) instead of just the STM32G4X. Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
This commit is contained in:
parent
f1d80b3f02
commit
19c165a119
2 changed files with 15 additions and 1 deletions
|
@ -176,7 +176,17 @@ static int entropy_stm32_rng_init(struct device *dev)
|
|||
* Linear Feedback Shift Register
|
||||
*/
|
||||
LL_RCC_SetRNGClockSource(LL_RCC_RNG_CLKSOURCE_PLLSAI1);
|
||||
#elif CONFIG_SOC_SERIES_STM32G4X
|
||||
#elif defined(RCC_HSI48_SUPPORT)
|
||||
|
||||
#if CONFIG_SOC_SERIES_STM32L0X
|
||||
/* We need SYSCFG to control VREFINT, so make sure it is clocked */
|
||||
if (!LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_SYSCFG)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
/* HSI48 requires VREFINT (see RM0376 section 7.2.4). */
|
||||
LL_SYSCFG_VREFINT_EnableHSI48();
|
||||
#endif /* CONFIG_SOC_SERIES_STM32L0X */
|
||||
|
||||
/* Use the HSI48 for the RNG */
|
||||
LL_RCC_HSI48_Enable();
|
||||
while (!LL_RCC_HSI48_IsReady()) {
|
||||
|
|
|
@ -82,6 +82,10 @@
|
|||
#include <stm32l0xx_ll_dma.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ENTROPY_STM32_RNG
|
||||
#include <stm32l0xx_ll_rng.h>
|
||||
#endif
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
||||
#endif /* _STM32L0_SOC_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue