Skip to content

Commit 2d88889

Browse files
soc: st: stm32: h7rs: replace Kconfig power supply configuration with DT
Replace the existing infrastructure to specify power supply configuration through Kconfig with Devicetree. Also update all boards that were defining the Kconfig to no longer do so. Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
1 parent a54b1dd commit 2d88889

File tree

6 files changed

+18
-61
lines changed

6 files changed

+18
-61
lines changed

boards/ruiside/art_pi2/art_pi2_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Copyright (c) 2025 Shan Pen <bricle031@gmail.com>
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Enable SMPS
5-
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y
6-
74
# Enable MPU
85
CONFIG_ARM_MPU=y
96

boards/st/nucleo_h7s3l8/nucleo_h7s3l8_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Copyright (c) 2024 STMicroelectronics
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Disable SMPS
5-
CONFIG_POWER_SUPPLY_DIRECT_SMPS=n
6-
74
# Enable MPU
85
CONFIG_ARM_MPU=y
96

boards/st/stm32h7s78_dk/stm32h7s78_dk_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Copyright (c) 2024 STMicroelectronics
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Enable SMPS
5-
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y
6-
74
# Enable MPU
85
CONFIG_ARM_MPU=y
96

boards/st/stm32h7s78_dk/stm32h7s78_dk_stm32h7s7xx_ext_flash_app_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Copyright (c) 2024 STMicroelectronics
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Enable SMPS
5-
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y
6-
74
# Enable MPU
85
CONFIG_ARM_MPU=y
96

soc/st/stm32/Kconfig

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -78,43 +78,14 @@ config STM32_WKUP_PINS
7878
choice POWER_SUPPLY_CHOICE
7979
prompt "STM32 power supply configuration"
8080
default POWER_SUPPLY_LDO
81-
depends on SOC_SERIES_STM32H7RSX || \
82-
SOC_SERIES_STM32U5X || SOC_STM32WBA55XX || SOC_STM32WBA65XX
81+
depends on SOC_SERIES_STM32U5X || SOC_STM32WBA55XX || SOC_STM32WBA65XX
8382

8483
config POWER_SUPPLY_LDO
8584
bool "LDO supply"
8685

8786
config POWER_SUPPLY_DIRECT_SMPS
8887
bool "Direct SMPS supply"
8988

90-
config POWER_SUPPLY_SMPS_1V8_SUPPLIES_LDO
91-
bool "SMPS 1.8V supplies LDO (no external supply)"
92-
depends on SOC_SERIES_STM32H7RSX
93-
94-
config POWER_SUPPLY_SMPS_2V5_SUPPLIES_LDO
95-
bool "SMPS 2.5V supplies LDO (no external supply)"
96-
depends on SOC_SERIES_STM32H7RSX
97-
98-
config POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT_AND_LDO
99-
bool "External SMPS 1.8V supply, supplies LDO"
100-
depends on SOC_SERIES_STM32H7RSX
101-
102-
config POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT_AND_LDO
103-
bool "External SMPS 2.5V supply, supplies LDO"
104-
depends on SOC_SERIES_STM32H7RSX
105-
106-
config POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT
107-
bool "External SMPS 1.8V supply and bypass"
108-
depends on SOC_SERIES_STM32H7RSX
109-
110-
config POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT
111-
bool "External SMPS 2.5V supply and bypass"
112-
depends on SOC_SERIES_STM32H7RSX
113-
114-
config POWER_SUPPLY_EXTERNAL_SOURCE
115-
bool "Bypass"
116-
depends on SOC_SERIES_STM32H7RSX
117-
11889
endchoice
11990

12091
config STM32_BACKUP_PROTECTION

soc/st/stm32/stm32h7rsx/soc.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@
2020

2121
#include <cmsis_core.h>
2222

23+
#define PWR_NODE DT_INST(0, st_stm32h7rs_pwr)
24+
25+
/* Helper to simplify following #if chain */
26+
#define SELECTED_PSU(_x) DT_ENUM_HAS_VALUE(PWR_NODE, power_supply, _x)
27+
28+
#if SELECTED_PSU(ldo)
29+
#define SELECTED_POWER_SUPPLY LL_PWR_LDO_SUPPLY
30+
#elif SELECTED_PSU(external_source)
31+
#define SELECTED_POWER_SUPPLY LL_PWR_EXTERNAL_SOURCE_SUPPLY
32+
#elif SELECTED_PSU(smps_direct)
33+
#define SELECTED_POWER_SUPPLY LL_PWR_DIRECT_SMPS_SUPPLY
34+
#elif SELECTED_PSU(smps_ext_ldo)
35+
#define SELECTED_POWER_SUPPLY LL_PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO
36+
#elif SELECTED_PSU(smps_ext_bypass)
37+
#define SELECTED_POWER_SUPPLY LL_PWR_SMPS_1V8_SUPPLIES_EXT
38+
#endif
2339

2440
/**
2541
* @brief Perform basic hardware initialization at boot.
@@ -36,25 +52,7 @@ void soc_early_init_hook(void)
3652
SystemCoreClock = 64000000;
3753

3854
/* Power Configuration */
39-
#if defined(CONFIG_POWER_SUPPLY_DIRECT_SMPS)
40-
LL_PWR_ConfigSupply(LL_PWR_DIRECT_SMPS_SUPPLY);
41-
#elif defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_LDO)
42-
LL_PWR_ConfigSupply(LL_PWR_SMPS_1V8_SUPPLIES_LDO);
43-
#elif defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_LDO)
44-
LL_PWR_ConfigSupply(LL_PWR_SMPS_2V5_SUPPLIES_LDO);
45-
#elif defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT_AND_LDO)
46-
LL_PWR_ConfigSupply(LL_PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO);
47-
#elif defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT_AND_LDO)
48-
LL_PWR_ConfigSupply(LL_PWR_SMPS_2V5_SUPPLIES_EXT_AND_LDO);
49-
#elif defined(CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_EXT)
50-
LL_PWR_ConfigSupply(LL_PWR_SMPS_1V8_SUPPLIES_EXT);
51-
#elif defined(CONFIG_POWER_SUPPLY_SMPS_2V5_SUPPLIES_EXT)
52-
LL_PWR_ConfigSupply(LL_PWR_SMPS_2V5_SUPPLIES_EXT);
53-
#elif defined(CONFIG_POWER_SUPPLY_EXTERNAL_SOURCE)
54-
LL_PWR_ConfigSupply(LL_PWR_EXTERNAL_SOURCE_SUPPLY);
55-
#else
56-
LL_PWR_ConfigSupply(LL_PWR_LDO_SUPPLY);
57-
#endif
55+
LL_PWR_ConfigSupply(SELECTED_POWER_SUPPLY);
5856
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);
5957
while (LL_PWR_IsActiveFlag_VOSRDY() == 0) {
6058
}

0 commit comments

Comments
 (0)