Skip to content

Commit 86a6280

Browse files
manoj153carlescufi
authored andcommitted
drivers: clock_control: stm32h7: Add logic to handle SMPS config
Some STM32 SoC supports an internal SMPS Signed-off-by: Manojkumar Subramaniam <[email protected]>
1 parent 7a690a5 commit 86a6280

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/clock_control/clock_stm32_ll_h7.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ static uint32_t get_hclk_frequency(void)
260260
static int32_t prepare_regulator_voltage_scale(void)
261261
{
262262
/* Make sure to put the CPU in highest Voltage scale during clock configuration */
263+
#if defined(SMPS) && defined(CONFIG_POWER_SUPPLY_SMPS)
264+
LL_PWR_ConfigSupply(LL_PWR_DIRECT_SMPS_SUPPLY);
265+
#else
263266
LL_PWR_ConfigSupply(LL_PWR_LDO_SUPPLY);
267+
#endif
264268
/* Highest voltage is SCALE0 */
265269
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE0);
266270
return 0;
@@ -276,7 +280,11 @@ static int32_t optimize_regulator_voltage_scale(uint32_t sysclk_freq)
276280
/* LL_PWR_REGULATOR_SCALE3 is lowest power consumption */
277281
/* Must be done in accordance to the Maximum allowed frequency vs VOS*/
278282
/* See RM0433 page 352 for more details */
283+
#if defined(SMPS) && defined(CONFIG_POWER_SUPPLY_SMPS)
284+
LL_PWR_ConfigSupply(LL_PWR_DIRECT_SMPS_SUPPLY);
285+
#else
279286
LL_PWR_ConfigSupply(LL_PWR_LDO_SUPPLY);
287+
#endif
280288
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE0);
281289
return 0;
282290
}

0 commit comments

Comments
 (0)