Commit 5062c51c authored by Hou Zhiqiang's avatar Hou Zhiqiang Committed by David Leach
Browse files

soc: mimx8m: set the UART devices RDC permission



Add SoC initialization to set the UART RDC permission in the early
phase, so that the it can be used by Zephyr on Cortex-A cores.

Signed-off-by: default avatarHou Zhiqiang <Zhiqiang.Hou@nxp.com>
parent 657e7edd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ if(CONFIG_SOC_MIMX8ML8_A53 OR CONFIG_SOC_MIMX8MM6_A53 OR CONFIG_SOC_MIMX8MN6_A53

  zephyr_sources(
    a53/pinctrl_soc.h
    a53/soc.c
  )

  zephyr_sources_ifdef(CONFIG_ARM_MMU a53/mmu_regions.c)
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ config SOC_MIMX8MM6_A53
	select HAS_MCUX if CLOCK_CONTROL
	select HAS_MCUX_CCM if CLOCK_CONTROL
	select HAS_MCUX_IOMUXC if PINCTRL
	select HAS_MCUX_RDC

config SOC_MIMX8MM6_M4
	select ARM
@@ -27,6 +28,7 @@ config SOC_MIMX8ML8_A53
	select HAS_MCUX if CLOCK_CONTROL
	select HAS_MCUX_CCM if CLOCK_CONTROL
	select HAS_MCUX_IOMUXC if PINCTRL
	select HAS_MCUX_RDC

config SOC_MIMX8MN6_A53
	select ARM64
@@ -35,6 +37,7 @@ config SOC_MIMX8MN6_A53
	select HAS_MCUX if CLOCK_CONTROL
	select HAS_MCUX_CCM if CLOCK_CONTROL
	select HAS_MCUX_IOMUXC if PINCTRL
	select HAS_MCUX_RDC

config SOC_MIMX8MP_ADSP
	select XTENSA
+46 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 NXP
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <stdio.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/dt-bindings/rdc/imx_rdc.h>
#include <fsl_common.h>
#include <fsl_rdc.h>

/* 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);
	assignment.domainId = A53_DOMAIN_ID;
	RDC_SetMasterDomainAssignment(RDC, 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);
#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);
#endif
}

static int soc_init(void)
{
	soc_rdc_init();
	return 0;
}

SYS_INIT(soc_init, EARLY, 1);