Skip to content

Commit 19f5e78

Browse files
JiafeiPangmarull
authored andcommitted
[nrf fromtree] soc: imx8m: change RDC configuration based on device tree
Can disable RDC configuration if RDC node is disabled. Signed-off-by: Jiafei Pan <[email protected]> (cherry picked from commit bd03883)
1 parent 9179e10 commit 19f5e78

File tree

1 file changed

+15
-5
lines changed
  • soc/nxp/imx/imx8m/a53

1 file changed

+15
-5
lines changed

soc/nxp/imx/imx8m/a53/soc.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,50 @@
1212
#include <fsl_common.h>
1313
#include <fsl_rdc.h>
1414

15+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(rdc), okay)
16+
17+
#define rdc_inst ((RDC_Type *)DT_REG_ADDR(DT_NODELABEL(rdc)))
18+
1519
/* set RDC permission for peripherals */
1620
static void soc_rdc_init(void)
1721
{
1822
rdc_domain_assignment_t assignment = {0};
1923
rdc_periph_access_config_t periphConfig;
2024

21-
RDC_Init(RDC);
25+
RDC_Init(rdc_inst);
2226
assignment.domainId = A53_DOMAIN_ID;
23-
RDC_SetMasterDomainAssignment(RDC, kRDC_Master_A53, &assignment);
27+
RDC_SetMasterDomainAssignment(rdc_inst, kRDC_Master_A53, &assignment);
2428

2529
RDC_GetDefaultPeriphAccessConfig(&periphConfig);
2630

2731
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc)
2832
periphConfig.periph = kRDC_Periph_UART2;
2933
periphConfig.policy = RDC_DT_VAL(uart2);
30-
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
34+
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
3135
#endif
3236

3337
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc)
3438
periphConfig.periph = kRDC_Periph_UART4;
3539
periphConfig.policy = RDC_DT_VAL(uart4);
36-
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
40+
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
3741
#endif
3842

3943
#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc)
4044
periphConfig.periph = kRDC_Periph_ENET1;
4145
periphConfig.policy = RDC_DT_VAL(enet);
42-
RDC_SetPeriphAccessConfig(RDC, &periphConfig);
46+
RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig);
4347
#endif
4448
}
49+
#else
50+
51+
#define soc_rdc_init() do { } while (false)
52+
53+
#endif
4554

4655
static int soc_init(void)
4756
{
4857
soc_rdc_init();
58+
4959
return 0;
5060
}
5161

0 commit comments

Comments
 (0)