soc: nordic: common: dmm: Initialize dmm as early as possible

DMM shall be initialized as early as possible to allow drivers to
use it. For example, uart may need it early since it starts
RX during initilization in some configurations.

Making dmm_init() public and calling it in soc init function.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruściński 2024-06-18 08:34:21 +02:00 committed by Carles Cufí
commit c84c2fc37d
3 changed files with 21 additions and 2 deletions

View file

@ -295,5 +295,3 @@ int dmm_init(void)
return 0; return 0;
} }
SYS_INIT(dmm_init, POST_KERNEL, 0);

View file

@ -155,6 +155,14 @@ int dmm_buffer_in_prepare(void *region, void *user_buffer, size_t user_length, v
*/ */
int dmm_buffer_in_release(void *region, void *user_buffer, size_t user_length, void *buffer_in); int dmm_buffer_in_release(void *region, void *user_buffer, size_t user_length, void *buffer_in);
/**
* @brief Initialize DMM.
*
* @retval 0 If succeeded.
* @retval -errno Negative errno code on failure.
*/
int dmm_init(void);
/** @endcond */ /** @endcond */
#else #else
@ -194,6 +202,11 @@ static ALWAYS_INLINE int dmm_buffer_in_release(void *region, void *user_buffer,
return 0; return 0;
} }
static ALWAYS_INLINE int dmm_init(void)
{
return 0;
}
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -14,6 +14,7 @@
#include <hal/nrf_lrcconf.h> #include <hal/nrf_lrcconf.h>
#include <hal/nrf_spu.h> #include <hal/nrf_spu.h>
#include <soc/nrfx_coredep.h> #include <soc/nrfx_coredep.h>
#include <dmm.h>
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
@ -88,6 +89,8 @@ static int trim_hsfll(void)
static int nordicsemi_nrf54h_init(void) static int nordicsemi_nrf54h_init(void)
{ {
int err;
sys_cache_instr_enable(); sys_cache_instr_enable();
sys_cache_data_enable(); sys_cache_data_enable();
@ -95,6 +98,11 @@ static int nordicsemi_nrf54h_init(void)
trim_hsfll(); trim_hsfll();
err = dmm_init();
if (err < 0) {
return err;
}
#if DT_NODE_HAS_STATUS(DT_NODELABEL(ccm030), okay) #if DT_NODE_HAS_STATUS(DT_NODELABEL(ccm030), okay)
/* DMASEC is set to non-secure by default, which prevents CCM from /* DMASEC is set to non-secure by default, which prevents CCM from
* accessing secure memory. Change DMASEC to secure. * accessing secure memory. Change DMASEC to secure.