soc: arm: st_stm32: use SMPS power supply only if enabled

Use SMPS power supply only if enabled.

The default power supply configuration for the
NUCLEO board with -Q subfix is SMPS,
so it's essential to match with hardware configuration
to avoid deadlocks due to mismatch.

if a custom board with LDO configuration is in use,
then no need to enable `CONFIG_POWER_SUPPLY_SMPS`

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
This commit is contained in:
Manojkumar Subramaniam 2021-11-16 23:23:18 +08:00 committed by Carles Cufí
commit 22186c7c51

View file

@ -80,8 +80,10 @@ static int stm32h7_init(const struct device *arg)
SystemCoreClock = 64000000;
/* Power Configuration */
#ifdef SMPS
#if defined(SMPS) && defined(CONFIG_POWER_SUPPLY_SMPS)
LL_PWR_ConfigSupply(LL_PWR_DIRECT_SMPS_SUPPLY);
#elif defined(CONFIG_POWER_SUPPLY_SMPS)
#error Unsupported configuration: Selected SoC do not support SMPS
#else
LL_PWR_ConfigSupply(LL_PWR_LDO_SUPPLY);
#endif