arm: soc: move arm SoCs to top-dir
Move the SoC outside of the architecture tree and put them at the same level as boards and architectures allowing both SoCs and boards to be maintained outside the tree. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
5744437d25
commit
70d819b405
426 changed files with 62 additions and 63 deletions
242
soc/arm/nxp_imx/mcimx7_m4/soc.c
Normal file
242
soc/arm/nxp_imx/mcimx7_m4/soc.c
Normal file
|
@ -0,0 +1,242 @@
|
|||
/*
|
||||
* Copyright (c) 2017, NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <init.h>
|
||||
#include <soc.h>
|
||||
#include <dt-bindings/rdc/imx_rdc.h>
|
||||
#include "wdog_imx.h"
|
||||
|
||||
/* Initialize clock. */
|
||||
void SOC_ClockInit(void)
|
||||
{
|
||||
/* OSC/PLL is already initialized by Cortex-A7 (u-boot) */
|
||||
|
||||
/*
|
||||
* Disable WDOG3
|
||||
* Note : The WDOG clock Root is shared by all the 4 WDOGs,
|
||||
* so Zephyr code should avoid closing it
|
||||
*/
|
||||
CCM_UpdateRoot(CCM, ccmRootWdog, ccmRootmuxWdogOsc24m, 0, 0);
|
||||
CCM_EnableRoot(CCM, ccmRootWdog);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateWdog3, ccmClockNeededRun);
|
||||
|
||||
RDC_SetPdapAccess(RDC, rdcPdapWdog3,
|
||||
RDC_DOMAIN_PERM(M4_DOMAIN_ID, RDC_DOMAIN_PERM_RW),
|
||||
false, false);
|
||||
|
||||
WDOG_DisablePowerdown(WDOG3);
|
||||
|
||||
CCM_ControlGate(CCM, ccmCcgrGateWdog3, ccmClockNotNeeded);
|
||||
|
||||
/* We need system PLL Div2 to run M4 core */
|
||||
CCM_ControlGate(CCM, ccmPllGateSys, ccmClockNeededRun);
|
||||
CCM_ControlGate(CCM, ccmPllGateSysDiv2, ccmClockNeededRun);
|
||||
|
||||
/* Enable clock gate for IP bridge and IO mux */
|
||||
CCM_ControlGate(CCM, ccmCcgrGateIpmux1, ccmClockNeededRun);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateIpmux2, ccmClockNeededRun);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateIpmux3, ccmClockNeededRun);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateIomux, ccmClockNeededRun);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateIomuxLpsr, ccmClockNeededRun);
|
||||
|
||||
/* Enable clock gate for RDC */
|
||||
CCM_ControlGate(CCM, ccmCcgrGateRdc, ccmClockNeededRun);
|
||||
}
|
||||
|
||||
void SOC_RdcInit(void)
|
||||
{
|
||||
/* Move M4 core to specific RDC domain */
|
||||
RDC_SetDomainID(RDC, rdcMdaM4, M4_DOMAIN_ID, false);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GPIO_IMX
|
||||
static void nxp_mcimx7_gpio_config(void)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_GPIO_IMX_PORT_1
|
||||
RDC_SetPdapAccess(RDC, rdcPdapGpio1, GPIO_1_RDC, false, false);
|
||||
/* Enable gpio clock gate */
|
||||
CCM_ControlGate(CCM, ccmCcgrGateGpio1, ccmClockNeededRunWait);
|
||||
#endif /* CONFIG_GPIO_IMX_PORT_1 */
|
||||
|
||||
|
||||
#ifdef CONFIG_GPIO_IMX_PORT_2
|
||||
RDC_SetPdapAccess(RDC, rdcPdapGpio2, GPIO_2_RDC, false, false);
|
||||
/* Enable gpio clock gate */
|
||||
CCM_ControlGate(CCM, ccmCcgrGateGpio2, ccmClockNeededRunWait);
|
||||
#endif /* CONFIG_GPIO_IMX_PORT_2 */
|
||||
|
||||
|
||||
#ifdef CONFIG_GPIO_IMX_PORT_7
|
||||
RDC_SetPdapAccess(RDC, rdcPdapGpio7, GPIO_7_RDC, false, false);
|
||||
/* Enable gpio clock gate */
|
||||
CCM_ControlGate(CCM, ccmCcgrGateGpio7, ccmClockNeededRunWait);
|
||||
#endif /* CONFIG_GPIO_IMX_PORT_2 */
|
||||
|
||||
}
|
||||
#endif /* CONFIG_GPIO_IMX */
|
||||
|
||||
#ifdef CONFIG_UART_IMX
|
||||
static void nxp_mcimx7_uart_config(void)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_UART_IMX_UART_2
|
||||
/* We need to grasp board uart exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapUart2, UART_2_RDC, false, false);
|
||||
/* Select clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootUart2, ccmRootmuxUartOsc24m, 0, 0);
|
||||
/* Enable uart clock */
|
||||
CCM_EnableRoot(CCM, ccmRootUart2);
|
||||
/*
|
||||
* IC Limitation
|
||||
* M4 stop will cause A7 UART lose functionality
|
||||
* So we need UART clock all the time
|
||||
*/
|
||||
CCM_ControlGate(CCM, ccmCcgrGateUart2, ccmClockNeededAll);
|
||||
#endif /* #ifdef CONFIG_UART_IMX_UART_2 */
|
||||
|
||||
#ifdef CONFIG_UART_IMX_UART_6
|
||||
/* We need to grasp board uart exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapUart6, UART_6_RDC, false, false);
|
||||
/* Select clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootUart6, ccmRootmuxUartOsc24m, 0, 0);
|
||||
/* Enable uart clock */
|
||||
CCM_EnableRoot(CCM, ccmRootUart6);
|
||||
/*
|
||||
* IC Limitation
|
||||
* M4 stop will cause A7 UART lose functionality
|
||||
* So we need UART clock all the time
|
||||
*/
|
||||
CCM_ControlGate(CCM, ccmCcgrGateUart6, ccmClockNeededAll);
|
||||
#endif /* #ifdef CONFIG_UART_IMX_UART_6 */
|
||||
}
|
||||
#endif /* CONFIG_UART_IMX */
|
||||
|
||||
|
||||
#ifdef CONFIG_I2C_IMX
|
||||
static void nxp_mcimx7_i2c_config(void)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_I2C_1
|
||||
/* In this example, we need to grasp board I2C exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapI2c1, I2C_1_RDC, false, false);
|
||||
/* Select I2C clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootI2c1, ccmRootmuxI2cOsc24m, 0, 0);
|
||||
/* Enable I2C clock */
|
||||
CCM_EnableRoot(CCM, ccmRootI2c1);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateI2c1, ccmClockNeededRunWait);
|
||||
#endif /* CONFIG_I2C_1 */
|
||||
|
||||
#ifdef CONFIG_I2C_2
|
||||
/* In this example, we need to grasp board I2C exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapI2c2, I2C_2_RDC, false, false);
|
||||
/* Select I2C clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootI2c2, ccmRootmuxI2cOsc24m, 0, 0);
|
||||
/* Enable I2C clock */
|
||||
CCM_EnableRoot(CCM, ccmRootI2c2);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateI2c2, ccmClockNeededRunWait);
|
||||
#endif /* CONFIG_I2C_2 */
|
||||
|
||||
#ifdef CONFIG_I2C_3
|
||||
/* In this example, we need to grasp board I2C exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapI2c3, I2C_3_RDC, false, false);
|
||||
/* Select I2C clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootI2c3, ccmRootmuxI2cOsc24m, 0, 0);
|
||||
/* Enable I2C clock */
|
||||
CCM_EnableRoot(CCM, ccmRootI2c3);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateI2c3, ccmClockNeededRunWait);
|
||||
#endif /* CONFIG_I2C_3 */
|
||||
|
||||
#ifdef CONFIG_I2C_4
|
||||
/* In this example, we need to grasp board I2C exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapI2c4, I2C_4_RDC, false, false);
|
||||
/* Select I2C clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootI2c4, ccmRootmuxI2cOsc24m, 0, 0);
|
||||
/* Enable I2C clock */
|
||||
CCM_EnableRoot(CCM, ccmRootI2c4);
|
||||
CCM_ControlGate(CCM, ccmCcgrGateI2c4, ccmClockNeededRunWait);
|
||||
#endif /* CONFIG_I2C_4 */
|
||||
|
||||
}
|
||||
#endif /* CONFIG_I2C_IMX */
|
||||
|
||||
#ifdef CONFIG_PWM_IMX
|
||||
static void nxp_mcimx7_pwm_config(void)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_PWM_1
|
||||
/* We need to grasp board pwm exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapPwm1, PWM_1_RDC, false, false);
|
||||
/* Select clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootPwm1, ccmRootmuxPwmOsc24m, 0, 0);
|
||||
/* Enable pwm clock */
|
||||
CCM_EnableRoot(CCM, ccmRootPwm1);
|
||||
CCM_ControlGate(CCM, ccmCcgrGatePwm1, ccmClockNeededAll);
|
||||
#endif /* #ifdef CONFIG_PWM_1 */
|
||||
|
||||
#ifdef CONFIG_PWM_2
|
||||
/* We need to grasp board pwm exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapPwm2, PWM_2_RDC, false, false);
|
||||
/* Select clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootPwm2, ccmRootmuxPwmOsc24m, 0, 0);
|
||||
/* Enable pwm clock */
|
||||
CCM_EnableRoot(CCM, ccmRootPwm2);
|
||||
CCM_ControlGate(CCM, ccmCcgrGatePwm2, ccmClockNeededAll);
|
||||
#endif /* #ifdef CONFIG_PWM_2 */
|
||||
|
||||
#ifdef CONFIG_PWM_3
|
||||
/* We need to grasp board pwm exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapPwm3, PWM_3_RDC, false, false);
|
||||
/* Select clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootPwm3, ccmRootmuxPwmOsc24m, 0, 0);
|
||||
/* Enable pwm clock */
|
||||
CCM_EnableRoot(CCM, ccmRootPwm3);
|
||||
CCM_ControlGate(CCM, ccmCcgrGatePwm3, ccmClockNeededAll);
|
||||
#endif /* #ifdef CONFIG_PWM_3 */
|
||||
|
||||
#ifdef CONFIG_PWM_4
|
||||
/* We need to grasp board pwm exclusively */
|
||||
RDC_SetPdapAccess(RDC, rdcPdapPwm4, PWM_4_RDC, false, false);
|
||||
/* Select clock derived from OSC clock(24M) */
|
||||
CCM_UpdateRoot(CCM, ccmRootPwm4, ccmRootmuxPwmOsc24m, 0, 0);
|
||||
/* Enable pwm clock */
|
||||
CCM_EnableRoot(CCM, ccmRootPwm4);
|
||||
CCM_ControlGate(CCM, ccmCcgrGatePwm4, ccmClockNeededAll);
|
||||
#endif /* #ifdef CONFIG_PWM_4 */
|
||||
|
||||
}
|
||||
#endif /* CONFIG_PWM_IMX */
|
||||
|
||||
static int nxp_mcimx7_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
|
||||
/* SoC specific RDC settings */
|
||||
SOC_RdcInit();
|
||||
|
||||
/* BoC specific clock settings */
|
||||
SOC_ClockInit();
|
||||
|
||||
#ifdef CONFIG_GPIO_IMX
|
||||
nxp_mcimx7_gpio_config();
|
||||
#endif /* CONFIG_GPIO_IMX */
|
||||
|
||||
#ifdef CONFIG_UART_IMX
|
||||
nxp_mcimx7_uart_config();
|
||||
#endif /* CONFIG_UART_IMX */
|
||||
|
||||
#ifdef CONFIG_I2C_IMX
|
||||
nxp_mcimx7_i2c_config();
|
||||
#endif /* CONFIG_I2C_IMX */
|
||||
|
||||
#ifdef CONFIG_PWM_IMX
|
||||
nxp_mcimx7_pwm_config();
|
||||
#endif /* CONFIG_PWM_IMX */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(nxp_mcimx7_init, PRE_KERNEL_1, 0);
|
Loading…
Add table
Add a link
Reference in a new issue