soc: imx8m: change RDC configuration based on device tree
Can disable RDC configuration if RDC node is disabled. Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
This commit is contained in:
parent
b26d21fcfd
commit
bd03883744
1 changed files with 15 additions and 5 deletions
|
@ -12,40 +12,50 @@
|
||||||
#include <fsl_common.h>
|
#include <fsl_common.h>
|
||||||
#include <fsl_rdc.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 */
|
/* set RDC permission for peripherals */
|
||||||
static void soc_rdc_init(void)
|
static void soc_rdc_init(void)
|
||||||
{
|
{
|
||||||
rdc_domain_assignment_t assignment = {0};
|
rdc_domain_assignment_t assignment = {0};
|
||||||
rdc_periph_access_config_t periphConfig;
|
rdc_periph_access_config_t periphConfig;
|
||||||
|
|
||||||
RDC_Init(RDC);
|
RDC_Init(rdc_inst);
|
||||||
assignment.domainId = A53_DOMAIN_ID;
|
assignment.domainId = A53_DOMAIN_ID;
|
||||||
RDC_SetMasterDomainAssignment(RDC, kRDC_Master_A53, &assignment);
|
RDC_SetMasterDomainAssignment(rdc_inst, kRDC_Master_A53, &assignment);
|
||||||
|
|
||||||
RDC_GetDefaultPeriphAccessConfig(&periphConfig);
|
RDC_GetDefaultPeriphAccessConfig(&periphConfig);
|
||||||
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc)
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc)
|
||||||
periphConfig.periph = kRDC_Periph_UART2;
|
periphConfig.periph = kRDC_Periph_UART2;
|
||||||
periphConfig.policy = RDC_DT_VAL(uart2);
|
periphConfig.policy = RDC_DT_VAL(uart2);
|
||||||
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
|
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc)
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc)
|
||||||
periphConfig.periph = kRDC_Periph_UART4;
|
periphConfig.periph = kRDC_Periph_UART4;
|
||||||
periphConfig.policy = RDC_DT_VAL(uart4);
|
periphConfig.policy = RDC_DT_VAL(uart4);
|
||||||
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
|
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc)
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc)
|
||||||
periphConfig.periph = kRDC_Periph_ENET1;
|
periphConfig.periph = kRDC_Periph_ENET1;
|
||||||
periphConfig.policy = RDC_DT_VAL(enet);
|
periphConfig.policy = RDC_DT_VAL(enet);
|
||||||
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
|
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define soc_rdc_init() do { } while (false)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static int soc_init(void)
|
static int soc_init(void)
|
||||||
{
|
{
|
||||||
soc_rdc_init();
|
soc_rdc_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue