99#include <zephyr/pm/policy.h>
1010#include <zephyr/arch/common/pm_s2ram.h>
1111#include <hal/nrf_resetinfo.h>
12- #include <hal/nrf_lrcconf.h>
1312#include <hal/nrf_memconf.h>
1413#include <zephyr/cache.h>
1514#include <power.h>
15+ #include <soc_lrcconf.h>
1616#include "pm_s2ram.h"
1717
18+ #if !IS_ENABLED (CONFIG_SOC_NRF54H20_CPURAD )
19+ static sys_snode_t pm_node ;
20+ #endif
21+
1822static void suspend_common (void )
1923{
2024
@@ -31,21 +35,20 @@ static void suspend_common(void)
3135 RAMBLOCK_CONTROL_BIT_ICACHE , false);
3236 }
3337
38+ #if !IS_ENABLED (CONFIG_SOC_NRF54H20_CPURAD )
3439 /* Disable retention */
3540 nrf_lrcconf_retain_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_DOMAIN_0 , false);
36- nrf_lrcconf_poweron_force_set ( NRF_LRCCONF010 , NRF_LRCCONF_POWER_DOMAIN_0 , false);
41+ #endif
3742}
3843
3944void nrf_poweroff (void )
4045{
4146 nrf_resetinfo_resetreas_local_set (NRF_RESETINFO , 0 );
4247 nrf_resetinfo_restore_valid_set (NRF_RESETINFO , false);
4348
49+ #if !IS_ENABLED (CONFIG_SOC_NRF54H20_CPURAD )
4450 nrf_lrcconf_retain_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_MAIN , false);
45-
46- /* TODO: Move it around k_cpu_idle() implementation. */
47- nrf_lrcconf_poweron_force_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_MAIN , false);
48- nrf_lrcconf_poweron_force_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_DOMAIN_0 , false);
51+ #endif
4952
5053 suspend_common ();
5154
@@ -77,12 +80,10 @@ static void sys_resume(void)
7780 sys_cache_data_enable ();
7881 }
7982
83+ #if !IS_ENABLED (CONFIG_SOC_NRF54H20_CPURAD )
8084 /* Re-enable domain retention. */
8185 nrf_lrcconf_retain_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_DOMAIN_0 , true);
82-
83- /* TODO: Move it around k_cpu_idle() implementation. */
84- nrf_lrcconf_poweron_force_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_MAIN ,
85- !IS_ENABLED (CONFIG_SOC_NRF54H20_CPURAD ));
86+ #endif
8687}
8788
8889/* Function called during local domain suspend to RAM. */
@@ -94,8 +95,6 @@ static int sys_suspend_to_ram(void)
9495 nrf_resetinfo_resetreas_local_set (NRF_RESETINFO ,
9596 NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK );
9697 nrf_resetinfo_restore_valid_set (NRF_RESETINFO , true);
97- nrf_lrcconf_poweron_force_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_DOMAIN_0 , false);
98- nrf_lrcconf_poweron_force_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_MAIN , false);
9998
10099 suspend_common ();
101100
@@ -141,5 +140,22 @@ void pm_state_set(enum pm_state state, uint8_t substate_id)
141140
142141void pm_state_exit_post_ops (enum pm_state state , uint8_t substate_id )
143142{
143+ #if !IS_ENABLED (CONFIG_SOC_NRF54H20_CPURAD )
144+ if (state == PM_STATE_SUSPEND_TO_IDLE ) {
145+ soc_lrcconf_poweron_release (& pm_node , NRF_LRCCONF_POWER_DOMAIN_0 );
146+ }
147+ #endif
144148 irq_unlock (0 );
145149}
150+
151+ #if !IS_ENABLED (CONFIG_SOC_NRF54H20_CPURAD )
152+ void pm_state_enter_idle_prepare (void )
153+ {
154+ soc_lrcconf_poweron_request (& pm_node , NRF_LRCCONF_POWER_DOMAIN_0 );
155+ }
156+
157+ sys_snode_t * pm_sys_node_id_get (void )
158+ {
159+ return & pm_node ;
160+ }
161+ #endif
0 commit comments