Skip to content

Commit a718a92

Browse files
committed
[nrf fromtree] soc: nordic: common: vpr: Option to select the default sleep mode
VPR after boot has default sleep mode set to WAIT which is the most power hungry sleep mode. Typically, user expects to see low current when system enters system-on-idle state. Set sleep mode that is more suitable: DEEPSLEEP by default for nRF54H20 PPR which allows to reach <5 uA idle current and has almost the same wake up time as WAIT, HIBERNATE for other VPRs on non-NRF54H20. It allows to get <5 uA currents in system-on-idle. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit f28e027)
1 parent cea63b3 commit a718a92

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

soc/nordic/common/vpr/Kconfig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,33 @@ config RISCV_CORE_NORDIC_VPR
1717
imply XIP
1818
help
1919
Enable support for the RISC-V Nordic VPR core.
20+
21+
choice NORDIC_VPR_SLEEP_MODE
22+
prompt "Default sleep mode"
23+
depends on RISCV_CORE_NORDIC_VPR
24+
default NORDIC_VPR_SLEEP if SOC_NRF54H20_CPUFLPR
25+
default NORDIC_VPR_DEEPSLEEP if SOC_NRF54H20_CPUPPR
26+
default NORDIC_VPR_HIBERNATE
27+
28+
config NORDIC_VPR_SLEEP
29+
bool "Sleep"
30+
help
31+
Significantly higher power consumption but very short wake up time.
32+
33+
config NORDIC_VPR_DEEPSLEEP
34+
bool "Deep sleep"
35+
depends on SOC_NRF54H20_CPUPPR
36+
help
37+
Deep sleep can reach less than 5 uA in system-on-idle state only on nRF54H20.
38+
Wake up time is comparable to the 'sleep' mode.
39+
40+
config NORDIC_VPR_HIBERNATE
41+
bool "Hibernation"
42+
depends on !SOC_NRF54H20
43+
help
44+
It has the lowest power consumption and it must be used to reach less than 5 uA in
45+
the system-on-idle state on targets other than nRF54H20. It has slightly longer
46+
wake up time (additional 1 us). Hibernation is using a RAM block to store the VPR
47+
state and parent core must configure the memory so that it is powered on and retained.
48+
49+
endchoice

soc/nordic/common/vpr/soc_init.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88

99
static int vpr_init(void)
1010
{
11+
uint32_t sleep_mode;
12+
13+
if (IS_ENABLED(CONFIG_NORDIC_VPR_DEEPSLEEP)) {
14+
sleep_mode = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_DEEPSLEEP;
15+
} else if (IS_ENABLED(CONFIG_NORDIC_VPR_HIBERNATE)) {
16+
sleep_mode = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_HIBERNATE;
17+
} else {
18+
sleep_mode = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_SLEEP;
19+
}
20+
21+
csr_write(VPRCSR_NORDIC_VPRNORDICSLEEPCTRL, sleep_mode);
22+
1123
/* RT peripherals for VPR all share one enable.
1224
* To prevent redundant calls, do it here once.
1325
*/

0 commit comments

Comments
 (0)