Skip to content

Commit

Permalink
[nrf_noup] soc: nordic: nrf54h20: Add LRC around idle
Browse files Browse the repository at this point in the history
Add LRC domain power management around idle. The Fast Clock Domain needs to be
forced-on during CPU idle. Also the force needs to be disabled on idle-exit.

Signed-off-by: Adam Kondraciuk <[email protected]>
  • Loading branch information
adamkondraciuk committed Sep 18, 2024
1 parent 96aa87c commit 4ea4b03
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions soc/nordic/nrf54h/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config SOC_NRF54H20
bool
select SOC_SERIES_NRF54HX
select ARM_ON_ENTER_CPU_IDLE_HOOK if PM_S2RAM
help
nRF54H20

Expand Down
13 changes: 7 additions & 6 deletions soc/nordic/nrf54h/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ 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);
}

Expand All @@ -43,10 +47,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);
Expand Down Expand Up @@ -94,8 +94,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();

Expand Down Expand Up @@ -141,5 +139,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) {
nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false);
}
irq_unlock(0);
}
2 changes: 2 additions & 0 deletions soc/nordic/nrf54h/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4ea4b03

Please sign in to comment.