clock_control: stm32_ll_clock: Enable MSI autocal when PLL source
Allow for the MSI to be auto-cal'd via an LSE when enabled, even when
being used as a source for the PLL as the sysclock.
Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
diff --git a/drivers/clock_control/stm32_ll_clock.c b/drivers/clock_control/stm32_ll_clock.c
index b81bb43..cf9bb1b 100644
--- a/drivers/clock_control/stm32_ll_clock.c
+++ b/drivers/clock_control/stm32_ll_clock.c
@@ -273,6 +273,12 @@
#endif /* CONFIG_CLOCK_STM32_PLL_Q_DIVISOR */
#ifdef CONFIG_CLOCK_STM32_PLL_SRC_MSI
+
+#ifdef CONFIG_CLOCK_STM32_MSI_PLL_MODE
+ /* Enable MSI hardware auto calibration */
+ LL_RCC_MSI_EnablePLLMode();
+#endif
+
/* Switch to PLL with MSI as clock source */
LL_PLL_ConfigSystemClock_MSI(&s_PLLInitStruct, &s_ClkInitStruct);