Skip to content

Commit 7477212

Browse files
mathieuchopstmfabiobaltieri
authored andcommitted
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 a14f0b8 commit 7477212

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
@@ -79,43 +79,14 @@ config STM32_WKUP_PINS
7979
choice POWER_SUPPLY_CHOICE
8080
prompt "STM32 power supply configuration"
8181
default POWER_SUPPLY_LDO
82-
depends on SOC_SERIES_STM32H7RSX || \
83-
SOC_SERIES_STM32U5X || SOC_STM32WBA55XX || SOC_STM32WBA65XX
82+
depends on SOC_SERIES_STM32U5X || SOC_STM32WBA55XX || SOC_STM32WBA65XX
8483

8584
config POWER_SUPPLY_LDO
8685
bool "LDO supply"
8786

8887
config POWER_SUPPLY_DIRECT_SMPS
8988
bool "Direct SMPS supply"
9089

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

12192
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)