From 22fa59074f88150744c4dee7845177f4e61bb685 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 16 Jan 2023 14:52:44 +1300 Subject: [PATCH] stm32h7: add SMPS PWR option for STM32H7X7 The dual core STM32H747 / STM32H757 there is an additional option to select SMPS rather than LDO as the power selection. This commit adds this option to the STM32H747 config and the stm32h7x7xx source. Signed-off-by: Julian Oes --- arch/arm/src/stm32h7/Kconfig | 1 + arch/arm/src/stm32h7/stm32h7x7xx_rcc.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/arm/src/stm32h7/Kconfig b/arch/arm/src/stm32h7/Kconfig index 8be129fdc7..74acefccdf 100644 --- a/arch/arm/src/stm32h7/Kconfig +++ b/arch/arm/src/stm32h7/Kconfig @@ -149,6 +149,7 @@ config ARCH_CHIP_STM32H747XI select STM32H7_IO_CONFIG_X select STM32H7_HAVE_FDCAN1 select STM32H7_HAVE_FDCAN2 + select STM32H7_HAVE_SMPS ---help--- Dual core STM32 H7 Cortex M7+M4, 2048 Kb FLASH, 1024K Kb SRAM TFBGA240 diff --git a/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c b/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c index 81e7e8a627..f1bb765a2b 100644 --- a/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c +++ b/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c @@ -826,9 +826,17 @@ void stm32_stdclockconfig(void) * N.B. The system shall be power cycled before writing a new value. */ +#if defined(CONFIG_STM32H7_PWR_DIRECT_SMPS_SUPPLY) + regval = getreg32(STM32_PWR_CR3); + regval &= ~(STM32_PWR_CR3_BYPASS | STM32_PWR_CR3_LDOEN | + STM32_PWR_CR3_SMPSEXTHP | STM32_PWR_CR3_SMPSLEVEL_MASK); + regval |= STM32_PWR_CR3_LDOESCUEN; + putreg32(regval, STM32_PWR_CR3); +#else regval = getreg32(STM32_PWR_CR3); regval |= STM32_PWR_CR3_LDOEN | STM32_PWR_CR3_LDOESCUEN; putreg32(regval, STM32_PWR_CR3); +#endif /* Set the voltage output scale */