Skip to content

Commit

Permalink
Merge branch 'nrfconnect:main' into NRFX-6619_Enable-PDM-driver-test-…
Browse files Browse the repository at this point in the history
…on-nrf54l15
  • Loading branch information
nordic-segl authored Dec 3, 2024
2 parents 9cea3d5 + 9548301 commit 338a6c9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 41 deletions.
1 change: 1 addition & 0 deletions soc/nordic/common/soc_lrcconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void soc_lrcconf_poweron_request(sys_snode_t *node, nrf_lrcconf_power_domain_mas
} else {
return;
}

K_SPINLOCK(&lock) {
if (sys_slist_len(poweron_list) == 0) {
nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, domain, true);
Expand Down
36 changes: 11 additions & 25 deletions soc/nordic/nrf54h/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
#include "soc.h"
#include "pm_s2ram.h"

extern sys_snode_t soc_node;

static void common_suspend(void)
{
sys_snode_t *node;

node = soc_pd_sys_snode_get();

if (IS_ENABLED(CONFIG_DCACHE)) {
/* Flush, disable and power down DCACHE */
sys_cache_data_flush_all();
Expand All @@ -37,15 +35,11 @@ static void common_suspend(void)
RAMBLOCK_CONTROL_BIT_ICACHE, false);
}

soc_lrcconf_poweron_release(node, NRF_LRCCONF_POWER_DOMAIN_0);
soc_lrcconf_poweron_release(&soc_node, NRF_LRCCONF_POWER_DOMAIN_0);
}

static void common_resume(void)
{
sys_snode_t *node;

node = soc_pd_sys_snode_get();

if (IS_ENABLED(CONFIG_ICACHE)) {
/* Power up and re-enable ICACHE */
nrf_memconf_ramblock_control_enable_set(NRF_MEMCONF, RAMBLOCK_POWER_ID,
Expand All @@ -60,15 +54,15 @@ static void common_resume(void)
sys_cache_data_enable();
}

soc_lrcconf_poweron_request(node, NRF_LRCCONF_POWER_DOMAIN_0);
soc_lrcconf_poweron_request(&soc_node, NRF_LRCCONF_POWER_DOMAIN_0);
}

void nrf_poweroff(void)
{
nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, 0);
nrf_resetinfo_restore_valid_set(NRF_RESETINFO, false);

#if !defined(NRF_RADIOCORE)
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
/* 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 All @@ -87,19 +81,15 @@ void nrf_poweroff(void)

static void s2idle_enter(uint8_t substate_id)
{
sys_snode_t *node;

node = soc_pd_sys_snode_get();

switch (substate_id) {
case 0:
/* Substate for idle with cache powered on - not implemented yet. */
break;
case 1: /* Substate for idle with cache retained - not implemented yet. */
break;
case 2: /* Substate for idle with cache disabled. */
#if !defined(NRF_RADIOCORE)
soc_lrcconf_poweron_request(node, NRF_LRCCONF_POWER_MAIN);
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
soc_lrcconf_poweron_request(&soc_node, NRF_LRCCONF_POWER_MAIN);
#endif
common_suspend();
break;
Expand All @@ -115,10 +105,6 @@ static void s2idle_enter(uint8_t substate_id)

static void s2idle_exit(uint8_t substate_id)
{
sys_snode_t *node;

node = soc_pd_sys_snode_get();

switch (substate_id) {
case 0:
/* Substate for idle with cache powered on - not implemented yet. */
Expand All @@ -127,8 +113,8 @@ static void s2idle_exit(uint8_t substate_id)
break;
case 2: /* Substate for idle with cache disabled. */
common_resume();
#if !defined(NRF_RADIOCORE)
soc_lrcconf_poweron_release(node, NRF_LRCCONF_POWER_MAIN);
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
soc_lrcconf_poweron_release(&soc_node, NRF_LRCCONF_POWER_MAIN);
#endif
default: /* Unknown substate. */
return;
Expand All @@ -140,7 +126,7 @@ static void s2idle_exit(uint8_t substate_id)
static void s2ram_exit(void)
{
common_resume();
#if !defined(NRF_RADIOCORE)
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
/* Re-enable domain retention. */
nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true);
#endif
Expand All @@ -156,7 +142,7 @@ static int sys_suspend_to_ram(void)
NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK);
nrf_resetinfo_restore_valid_set(NRF_RESETINFO, true);

#if !defined(NRF_RADIOCORE)
#if !defined(CONFIG_SOC_NRF54H20_CPURAD)
/* Disable retention */
nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, false);
#endif
Expand Down
6 changes: 1 addition & 5 deletions soc/nordic/nrf54h/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
#define HSFLL_NODE DT_NODELABEL(cpurad_hsfll)
#endif

static sys_snode_t soc_node;
sys_snode_t soc_node;

#define FICR_ADDR_GET(node_id, name) \
DT_REG_ADDR(DT_PHANDLE_BY_NAME(node_id, nordic_ficrs, name)) + \
Expand All @@ -41,10 +41,6 @@ static sys_snode_t soc_node;
ADDRESS_SECURITY_Msk | \
ADDRESS_DOMAIN_Msk | \
ADDRESS_BUS_Msk)))
sys_snode_t *soc_pd_sys_snode_get(void)
{
return &soc_node;
}

static void power_domain_init(void)
{
Expand Down
11 changes: 0 additions & 11 deletions soc/nordic/nrf54h/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_

#include <soc_nrf_common.h>
#include <zephyr/sys/slist.h>

#if defined(CONFIG_SOC_NRF54H20_CPUAPP)
#define RAMBLOCK_CONTROL_BIT_ICACHE MEMCONF_POWER_CONTROL_MEM1_Pos
Expand Down Expand Up @@ -37,14 +36,4 @@
#define RAMBLOCK_RET2_BIT_DCACHE MEMCONF_POWER_RET2_MEM7_Pos
#endif

/**
* @brief Get the ID of the node used by the power domain management.
*
* This function returns the node ID to be shared with other dependent modules.
*
* @return The pointer to the node assigned to the SOC module
* used for the power domain management purposes.
*/
sys_snode_t *soc_pd_sys_snode_get(void);

#endif /* SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ */

0 comments on commit 338a6c9

Please sign in to comment.