soc: nordic: nrf54h: set DMASEC for CCM030 if enabled

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 <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2024-03-21 10:18:24 +01:00 committed by Carles Cufí
parent 17ed60f0b5
commit 37f9958fea
1 changed files with 17 additions and 0 deletions

View File

@ -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);
@ -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)
{
/*
@ -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;
}