drivers/clock_control: stm32: msi: Enable MSI range config in PLL mode

When MSI clock is used a source of PLL, it should be possible to
select its frequency range. Fix this.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2020-03-16 09:56:26 +01:00 committed by Kumar Gala
parent 6d31b1075a
commit c4d9de1850
2 changed files with 7 additions and 1 deletions

View file

@ -65,7 +65,7 @@ config CLOCK_STM32_HSE_CLOCK
config CLOCK_STM32_MSI_RANGE
int "MSI frequency range"
depends on CLOCK_STM32_SYSCLK_SRC_MSI
depends on CLOCK_STM32_SYSCLK_SRC_MSI || CLOCK_STM32_PLL_SRC_MSI
default 8
help
Frequency range of MSI when MSI range is provided in RCC_CR register

View file

@ -329,6 +329,12 @@ static int stm32_clock_control_init(struct device *dev)
#ifdef CONFIG_CLOCK_STM32_PLL_SRC_MSI
/* Set MSI Range */
LL_RCC_MSI_EnableRangeSelection();
LL_RCC_MSI_SetRange(CONFIG_CLOCK_STM32_MSI_RANGE
<< RCC_CR_MSIRANGE_Pos);
LL_RCC_MSI_SetCalibTrimming(0);
#ifdef CONFIG_CLOCK_STM32_MSI_PLL_MODE
/* Enable MSI hardware auto calibration */
LL_RCC_MSI_EnablePLLMode();