Skip to content

Commit 8286144

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 8286144

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

soc/nordic/common/poweroff.c

Lines changed: 11 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_BUILD_WITH_TFM)
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,11 @@
3032

3133
void z_sys_poweroff(void)
3234
{
35+
#if defined(CONFIG_BUILD_WITH_TFM)
36+
tfm_platform_system_off();
37+
#else
38+
39+
3340
#if defined(CONFIG_HAS_NORDIC_RAM_CTRL)
3441
uint8_t *ram_start;
3542
size_t ram_size;
@@ -70,12 +77,15 @@ void z_sys_poweroff(void)
7077

7178
nrfx_reset_reason_clear(UINT32_MAX);
7279
#endif
80+
7381
#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X)
7482
nrf_power_system_off(NRF_POWER);
7583
#elif defined(CONFIG_SOC_SERIES_NRF54HX)
7684
nrf_poweroff();
7785
#else
7886
nrf_regulators_system_off(NRF_REGULATORS);
87+
#endif
88+
7989
#endif
8090

8191
CODE_UNREACHABLE;

0 commit comments

Comments
 (0)