From ad27263e82e91a99d87065f39c52a2b3c8ef079a Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 30 Sep 2025 10:48:18 +0200 Subject: [PATCH 1/2] [hopefully_fromtree] soc: nordic: Support TF-M for poweroff Enable going to system off when TF-M is enabled. This calls the relevant TF-M platform API to enable going to system off using TF-M. Signed-off-by: Georgios Vasilakis --- soc/nordic/common/poweroff.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/soc/nordic/common/poweroff.c b/soc/nordic/common/poweroff.c index ebce3aae77c..c5a3d01ae51 100644 --- a/soc/nordic/common/poweroff.c +++ b/soc/nordic/common/poweroff.c @@ -7,7 +7,9 @@ #include #include -#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) +#if defined(CONFIG_BUILD_WITH_TFM) +#include "tfm_platform_api.h" +#elif defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) #include #elif defined(CONFIG_SOC_SERIES_NRF54HX) #include @@ -65,12 +67,17 @@ void z_sys_poweroff(void) #endif #if defined(CONFIG_SOC_SERIES_NRF54LX) +#if !defined(CONFIG_BUILD_WITH_TFM) /* Set VPR to remain in its reset state when waking from OFF */ nrf_memconf_ramblock_ret_enable_set(NRF_MEMCONF, VPR_POWER_IDX, VPR_RET_BIT, false); +#endif nrfx_reset_reason_clear(UINT32_MAX); #endif -#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) + +#if defined(CONFIG_BUILD_WITH_TFM) + tfm_platform_system_off(); +#elif defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) nrf_power_system_off(NRF_POWER); #elif defined(CONFIG_SOC_SERIES_NRF54HX) nrf_poweroff(); From b6b388a2ab83e89fd25bd9b8be9bf419460b20be Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 30 Sep 2025 10:51:31 +0200 Subject: [PATCH 2/2] [hopefully_fromtree]soc: nordic: nrf54l: Disable NORDIC_RAM_CTRL for TF-M builds Disable the option HAS_NORDIC_RAM_CTRL when TF-M used because the it is currently incompatible with TF-M. The file soc/nordic/common/poweroff.c which impelements the system off functionality in NRF devices configures the memory retetion and the way that it is done is incompatible with TF-M since it tries to configure the memory blocks which are secure. Signed-off-by: Georgios Vasilakis --- soc/nordic/nrf54l/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index a3473c96745..7ab1bda0dde 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -21,7 +21,7 @@ config SOC_NRF54L_CPUAPP_COMMON select CPU_HAS_FPU select HAS_HW_NRF_RADIO_IEEE802154 select HAS_POWEROFF - select HAS_NORDIC_RAM_CTRL + select HAS_NORDIC_RAM_CTRL if !BUILD_WITH_TFM select HAS_SWO config SOC_NRF54L05_CPUAPP