Skip to content

Commit

Permalink
[nrf fromlist] dts: arm: nordic: Add power states for nRF54H20
Browse files Browse the repository at this point in the history
Upstream PR #: 79067

Add `idle` and `s2ram` power states for nRF54H20 cpuapp and cpurad.
Also the substate `idle_cache_disable` added.

Signed-off-by: Adam Kondraciuk <[email protected]>
(cherry picked from commit 19a2be222d94985e349766a1e1ba7264d6d2bc0a)
  • Loading branch information
adamkondraciuk authored and 57300 committed Oct 28, 2024
1 parent df138f4 commit 696bfea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions dts/common/nordic/nrf54h20.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
device_type = "cpu";
clocks = <&cpuapp_hsfll>;
clock-frequency = <DT_FREQ_M(320)>;
cpu-power-states = <&idle &s2ram>;
cpu-power-states = <&idle_cache_disabled &s2ram>;
};

cpurad: cpu@3 {
Expand All @@ -39,6 +39,7 @@
device_type = "cpu";
clocks = <&cpurad_hsfll>;
clock-frequency = <DT_FREQ_M(256)>;
cpu-power-states = <&idle_cache_disabled>;
};

cpuppr: cpu@d {
Expand Down Expand Up @@ -127,12 +128,14 @@
};

power-states {
idle: idle {
// substate-id = <0>; is reserved for "idle", cache powered on
// substate-id = <1>; is reserved for "idle-cache-retained"
idle_cache_disabled: idle_cache_disabled {
compatible = "zephyr,power-state";
power-state-name = "suspend-to-idle";
substate-id = <2>;
min-residency-us = <100000>;
};

s2ram: s2ram {
compatible = "zephyr,power-state";
power-state-name = "suspend-to-ram";
Expand Down
10 changes: 5 additions & 5 deletions soc/nordic/nrf54h/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void nrf_poweroff(void)
nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, 0);
nrf_resetinfo_restore_valid_set(NRF_RESETINFO, false);

#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
#if !defined(NRF_RADIOCORE)
/* Disable retention */
nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, false);
nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false);
Expand Down Expand Up @@ -98,7 +98,7 @@ static void s2idle_enter(uint8_t substate_id)
case 1: /* Substate for idle with cache retained - not implemented yet. */
break;
case 2: /* Substate for idle with cache disabled. */
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
#if !defined(NRF_RADIOCORE)
soc_lrcconf_poweron_request(node, NRF_LRCCONF_POWER_MAIN);
#endif
common_suspend();
Expand Down Expand Up @@ -127,7 +127,7 @@ static void s2idle_exit(uint8_t substate_id)
break;
case 2: /* Substate for idle with cache disabled. */
common_resume();
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
#if !defined(NRF_RADIOCORE)
soc_lrcconf_poweron_release(node, NRF_LRCCONF_POWER_MAIN);
#endif
default: /* Unknown substate. */
Expand All @@ -140,7 +140,7 @@ static void s2idle_exit(uint8_t substate_id)
static void s2ram_exit(void)
{
common_resume();
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
#if !defined(NRF_RADIOCORE)
/* Re-enable domain retention. */
nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true);
#endif
Expand All @@ -156,7 +156,7 @@ static int sys_suspend_to_ram(void)
NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK);
nrf_resetinfo_restore_valid_set(NRF_RESETINFO, true);

#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
#if !defined(NRF_RADIOCORE)
/* Disable retention */
nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false);
#endif
Expand Down

0 comments on commit 696bfea

Please sign in to comment.