From 5c0687e58b88013f032f2217798ce5b58e9c30f3 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Wed, 26 Feb 2020 09:05:40 +0100 Subject: [PATCH] driver: clock: stm32: boost voltage when clock exceeds 150MHz This patch activates the boost mode for the main regulator when the system frequency above 150MHz for stm32g4xx soc series. To save power, the boost mode should be disabled below 150MHz. Signed-off-by: Francois Ramu --- drivers/clock_control/clock_stm32g4.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clock_control/clock_stm32g4.c b/drivers/clock_control/clock_stm32g4.c index 635c264a5b..498b74c6aa 100644 --- a/drivers/clock_control/clock_stm32g4.c +++ b/drivers/clock_control/clock_stm32g4.c @@ -29,6 +29,11 @@ void config_pll_init(LL_UTILS_PLLInitTypeDef *pllinit) pllinit->PLLM = pllm(CONFIG_CLOCK_STM32_PLL_M_DIVISOR); pllinit->PLLN = CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER; pllinit->PLLR = pllr(CONFIG_CLOCK_STM32_PLL_R_DIVISOR); + + /* set power boost mode for sys clock greater than 150MHz */ + if (sys_clock_hw_cycles_per_sec() >= MHZ(150)) { + LL_PWR_EnableRange1BoostMode(); + } } #endif /* CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL */