Skip to content

Commit

Permalink
soc: nordic: nrf54h: set DMASEC for CCM030 if enabled
Browse files Browse the repository at this point in the history
DMASEC is set to non-secure by default, which prevents CCM from
accessing secure memory. Change DMASEC to secure.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
  • Loading branch information
gmarull authored and carlescufi committed Apr 5, 2024
1 parent 17ed60f commit 37f9958
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions soc/nordic/nrf54h/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <hal/nrf_hsfll.h>
#include <hal/nrf_lrcconf.h>
#include <hal/nrf_spu.h>
#include <soc/nrfx_coredep.h>

LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
Expand All @@ -26,6 +27,12 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
DT_REG_ADDR(DT_PHANDLE_BY_NAME(node_id, nordic_ficrs, name)) + \
DT_PHA_BY_NAME(node_id, nordic_ficrs, name, offset)

#define SPU_INSTANCE_GET(p_addr) \
((NRF_SPU_Type *)((p_addr) & (ADDRESS_REGION_Msk | \
ADDRESS_SECURITY_Msk | \
ADDRESS_DOMAIN_Msk | \
ADDRESS_BUS_Msk)))

static void power_domain_init(void)
{
/*
Expand Down Expand Up @@ -83,6 +90,16 @@ static int nordicsemi_nrf54h_init(void)

trim_hsfll();

#if DT_NODE_HAS_STATUS(DT_NODELABEL(ccm030), okay)
/* DMASEC is set to non-secure by default, which prevents CCM from
* accessing secure memory. Change DMASEC to secure.
*/
uint32_t ccm030_addr = DT_REG_ADDR(DT_NODELABEL(ccm030));
NRF_SPU_Type *spu = SPU_INSTANCE_GET(ccm030_addr);

nrf_spu_periph_perm_dmasec_set(spu, nrf_address_slave_get(ccm030_addr), true);
#endif

return 0;
}

Expand Down

0 comments on commit 37f9958

Please sign in to comment.