Skip to content

Commit

Permalink
soc: imx8m: change RDC configuration based on device tree
Browse files Browse the repository at this point in the history
Can disable RDC configuration if RDC node is disabled.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
  • Loading branch information
JiafeiPan authored and nashif committed Sep 19, 2024
1 parent b26d21f commit bd03883
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions soc/nxp/imx/imx8m/a53/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,50 @@
#include <fsl_common.h>
#include <fsl_rdc.h>

#if DT_NODE_HAS_STATUS(DT_NODELABEL(rdc), okay)

#define rdc_inst ((RDC_Type *)DT_REG_ADDR(DT_NODELABEL(rdc)))

/* set RDC permission for peripherals */
static void soc_rdc_init(void)
{
rdc_domain_assignment_t assignment = {0};
rdc_periph_access_config_t periphConfig;

RDC_Init(RDC);
RDC_Init(rdc_inst);
assignment.domainId = A53_DOMAIN_ID;
RDC_SetMasterDomainAssignment(RDC, kRDC_Master_A53, &assignment);
RDC_SetMasterDomainAssignment(rdc_inst, kRDC_Master_A53, &assignment);

RDC_GetDefaultPeriphAccessConfig(&periphConfig);

#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc)
periphConfig.periph = kRDC_Periph_UART2;
periphConfig.policy = RDC_DT_VAL(uart2);
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc)
periphConfig.periph = kRDC_Periph_UART4;
periphConfig.policy = RDC_DT_VAL(uart4);
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc)
periphConfig.periph = kRDC_Periph_ENET1;
periphConfig.policy = RDC_DT_VAL(enet);
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
#endif
}
#else

#define soc_rdc_init() do { } while (false)

#endif

static int soc_init(void)
{
soc_rdc_init();

return 0;
}

Expand Down

0 comments on commit bd03883

Please sign in to comment.