Skip to content

Commit 60e1246

Browse files
committed
[nrf noup] 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. This is a noup because the TF-M service for system off is currently located in sdk-nrf only. Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent ca9ae7f commit 60e1246

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

soc/nordic/common/poweroff.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#include <zephyr/toolchain.h>
88
#include <zephyr/drivers/retained_mem/nrf_retained_mem.h>
99

10-
#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X)
10+
#if defined(CONFIG_TFM_NRF_SYSTEM_OFF_SERVICE)
11+
#include "tfm_platform_api.h"
12+
#elif defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X)
1113
#include <hal/nrf_power.h>
1214
#elif defined(CONFIG_SOC_SERIES_NRF54HX)
1315
#include <power.h>
@@ -30,6 +32,10 @@
3032

3133
void z_sys_poweroff(void)
3234
{
35+
#if defined(CONFIG_TFM_NRF_SYSTEM_OFF_SERVICE)
36+
tfm_platform_system_off();
37+
#else
38+
3339
#if defined(CONFIG_HAS_NORDIC_RAM_CTRL)
3440
uint8_t *ram_start;
3541
size_t ram_size;
@@ -70,6 +76,7 @@ void z_sys_poweroff(void)
7076

7177
nrfx_reset_reason_clear(UINT32_MAX);
7278
#endif
79+
7380
#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X)
7481
nrf_power_system_off(NRF_POWER);
7582
#elif defined(CONFIG_SOC_SERIES_NRF54HX)
@@ -78,5 +85,7 @@ void z_sys_poweroff(void)
7885
nrf_regulators_system_off(NRF_REGULATORS);
7986
#endif
8087

88+
#endif /* CONFIG_TFM_NRF_SYSTEM_OFF_SERVICE */
89+
8190
CODE_UNREACHABLE;
8291
}

0 commit comments

Comments
 (0)