From cd881e05620b1d9af8e2e1a3565e42d1c2e54346 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Mon, 12 Jul 2021 10:53:15 +0200 Subject: [PATCH] soc: arm: stm32l1: set voltage scaling to range1 Default Voltage scaling range selection (range2) doesn't allow to configure Max frequency switch to range1 to match any frequency Signed-off-by: Alexandre Bourdiol --- soc/arm/st_stm32/stm32l1/soc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/soc/arm/st_stm32/stm32l1/soc.c b/soc/arm/st_stm32/stm32l1/soc.c index b6baba07a17..3798c68e135 100644 --- a/soc/arm/st_stm32/stm32l1/soc.c +++ b/soc/arm/st_stm32/stm32l1/soc.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include /** * @brief Perform basic hardware initialization at boot. @@ -43,6 +45,13 @@ static int stm32l1_init(const struct device *arg) /* At reset, system core clock is set to 2.1 MHz from MSI */ SystemCoreClock = 2097000; + /* Default Voltage scaling range selection (range2) + * doesn't allow to configure Max frequency + * switch to range1 to match any frequency + */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); + return 0; }