@@ -259,12 +259,28 @@ static uint32_t get_hclk_frequency(void)
259259
260260static int32_t prepare_regulator_voltage_scale (void )
261261{
262- /* Make sure to put the CPU in highest Voltage scale during clock configuration */
263- #if defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS )
262+ /* Apply system power supply configuration */
263+ #if defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_DIRECT_SMPS )
264264 LL_PWR_ConfigSupply (LL_PWR_DIRECT_SMPS_SUPPLY );
265+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_LDO )
266+ LL_PWR_ConfigSupply (LL_PWR_SMPS_1V8_SUPPLIES_LDO );
267+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_LDO )
268+ LL_PWR_ConfigSupply (LL_PWR_SMPS_2V5_SUPPLIES_LDO );
269+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT_AND_LDO )
270+ LL_PWR_ConfigSupply (LL_PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO );
271+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT_AND_LDO )
272+ LL_PWR_ConfigSupply (LL_PWR_SMPS_2V5_SUPPLIES_EXT_AND_LDO );
273+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT )
274+ LL_PWR_ConfigSupply (LL_PWR_SMPS_1V8_SUPPLIES_EXT );
275+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT )
276+ LL_PWR_ConfigSupply (LL_PWR_SMPS_2V5_SUPPLIES_EXT );
277+ #elif defined(CONFIG_POWER_SUPPLY_EXTERNAL_SOURCE )
278+ LL_PWR_ConfigSupply (LL_PWR_EXTERNAL_SOURCE_SUPPLY );
265279#else
266280 LL_PWR_ConfigSupply (LL_PWR_LDO_SUPPLY );
267281#endif
282+
283+ /* Make sure to put the CPU in highest Voltage scale during clock configuration */
268284 /* Highest voltage is SCALE0 */
269285 LL_PWR_SetRegulVoltageScaling (LL_PWR_REGU_VOLTAGE_SCALE0 );
270286 return 0 ;
@@ -280,8 +296,22 @@ static int32_t optimize_regulator_voltage_scale(uint32_t sysclk_freq)
280296 /* LL_PWR_REGULATOR_SCALE3 is lowest power consumption */
281297 /* Must be done in accordance to the Maximum allowed frequency vs VOS*/
282298 /* See RM0433 page 352 for more details */
283- #if defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS )
299+ #if defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_DIRECT_SMPS )
284300 LL_PWR_ConfigSupply (LL_PWR_DIRECT_SMPS_SUPPLY );
301+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_LDO )
302+ LL_PWR_ConfigSupply (LL_PWR_SMPS_1V8_SUPPLIES_LDO );
303+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_LDO )
304+ LL_PWR_ConfigSupply (LL_PWR_SMPS_2V5_SUPPLIES_LDO );
305+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT_AND_LDO )
306+ LL_PWR_ConfigSupply (LL_PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO );
307+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT_AND_LDO )
308+ LL_PWR_ConfigSupply (LL_PWR_SMPS_2V5_SUPPLIES_EXT_AND_LDO );
309+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT )
310+ LL_PWR_ConfigSupply (LL_PWR_SMPS_1V8_SUPPLIES_EXT );
311+ #elif defined(SMPS ) && defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT )
312+ LL_PWR_ConfigSupply (LL_PWR_SMPS_2V5_SUPPLIES_EXT );
313+ #elif defined(CONFIG_POWER_SUPPLY_EXTERNAL_SOURCE )
314+ LL_PWR_ConfigSupply (LL_PWR_EXTERNAL_SOURCE_SUPPLY );
285315#else
286316 LL_PWR_ConfigSupply (LL_PWR_LDO_SUPPLY );
287317#endif
0 commit comments