diff --git a/soc/nordic/nrf54h/Kconfig.soc b/soc/nordic/nrf54h/Kconfig.soc index 100923206fd..ee3a84fcd84 100644 --- a/soc/nordic/nrf54h/Kconfig.soc +++ b/soc/nordic/nrf54h/Kconfig.soc @@ -6,6 +6,7 @@ config SOC_NRF54H20 bool select SOC_SERIES_NRF54HX + select ARM_ON_ENTER_CPU_IDLE_HOOK help nRF54H20 diff --git a/soc/nordic/nrf54h/power.c b/soc/nordic/nrf54h/power.c index d55cd556e31..6b7af67b896 100644 --- a/soc/nordic/nrf54h/power.c +++ b/soc/nordic/nrf54h/power.c @@ -33,6 +33,9 @@ static void suspend_common(void) /* Disable retention */ nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false); + + /* TODO: Move it around k_cpu_idle() implementation. */ + nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, false); nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false); } @@ -43,10 +46,6 @@ void nrf_poweroff(void) nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, false); - /* TODO: Move it around k_cpu_idle() implementation. */ - nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, false); - nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false); - suspend_common(); nrf_lrcconf_task_trigger(NRF_LRCCONF010, NRF_LRCCONF_TASK_SYSTEMOFFREADY); @@ -94,8 +93,6 @@ static int sys_suspend_to_ram(void) nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK); nrf_resetinfo_restore_valid_set(NRF_RESETINFO, true); - nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false); - nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, false); suspend_common(); @@ -141,5 +138,8 @@ void pm_state_set(enum pm_state state, uint8_t substate_id) void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) { + if (state == PM_STATE_SUSPEND_TO_IDLE && !IS_ENABLED(CONFIG_SOC_NRF54H20_CPURAD)) { + nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false); + } irq_unlock(0); } diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index b93658b55d4..61a1561f1e5 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -122,6 +122,8 @@ bool z_arm_on_enter_cpu_idle(void) #ifdef CONFIG_LOG_FRONTEND_STMESP log_frontend_stmesp_pre_sleep(); #endif + nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, + !IS_ENABLED(CONFIG_SOC_NRF54H20_CPURAD)); return true; }