arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
/*
|
2018-05-15 03:06:14 -08:00
|
|
|
* Copyright (c) 2017,2018, NXP
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <kernel.h>
|
|
|
|
#include <device.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <soc.h>
|
|
|
|
#include <linker/sections.h>
|
|
|
|
#include <fsl_clock.h>
|
|
|
|
#include <arch/cpu.h>
|
2019-11-09 17:49:36 +00:00
|
|
|
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
2018-12-27 08:09:53 -06:00
|
|
|
#include <fsl_flexspi_nor_boot.h>
|
2019-05-05 13:20:04 +08:00
|
|
|
#if CONFIG_USB_DC_NXP_EHCI
|
|
|
|
#include "usb_phy.h"
|
|
|
|
#include "usb_dc_mcux.h"
|
|
|
|
#endif
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
2018-05-14 07:45:32 +08:00
|
|
|
#ifdef CONFIG_INIT_ARM_PLL
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
/* ARM PLL configuration for RUN mode */
|
|
|
|
const clock_arm_pll_config_t armPllConfig = {
|
|
|
|
.loopDivider = 100U
|
|
|
|
};
|
2018-05-14 07:45:32 +08:00
|
|
|
#endif
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
2018-05-14 07:45:32 +08:00
|
|
|
#ifdef CONFIG_INIT_SYS_PLL
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
/* SYS PLL configuration for RUN mode */
|
|
|
|
const clock_sys_pll_config_t sysPllConfig = {
|
|
|
|
.loopDivider = 1U
|
|
|
|
};
|
2018-05-14 07:45:32 +08:00
|
|
|
#endif
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
2018-05-14 07:45:32 +08:00
|
|
|
#ifdef CONFIG_INIT_USB1_PLL
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
/* USB1 PLL configuration for RUN mode */
|
|
|
|
const clock_usb_pll_config_t usb1PllConfig = {
|
|
|
|
.loopDivider = 0U
|
|
|
|
};
|
2018-05-14 07:45:32 +08:00
|
|
|
#endif
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
2019-05-05 13:20:04 +08:00
|
|
|
#if CONFIG_USB_DC_NXP_EHCI
|
|
|
|
/* USB PHY condfiguration */
|
|
|
|
#define BOARD_USB_PHY_D_CAL (0x0CU)
|
|
|
|
#define BOARD_USB_PHY_TXCAL45DP (0x06U)
|
|
|
|
#define BOARD_USB_PHY_TXCAL45DM (0x06U)
|
|
|
|
#endif
|
|
|
|
|
2019-01-09 14:01:41 +08:00
|
|
|
#ifdef CONFIG_INIT_ENET_PLL
|
|
|
|
/* ENET PLL configuration for RUN mode */
|
2018-11-15 18:28:47 +02:00
|
|
|
const clock_enet_pll_config_t ethPllConfig = {
|
2019-09-24 08:52:39 +08:00
|
|
|
#if defined(CONFIG_SOC_MIMXRT1021) || defined(CONFIG_SOC_MIMXRT1015) || defined(CONFIG_SOC_MIMXRT1011)
|
2019-01-08 08:27:52 +08:00
|
|
|
.enableClkOutput500M = true,
|
2019-01-20 21:14:08 +01:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_ETH_MCUX
|
2019-01-04 09:15:37 -06:00
|
|
|
.enableClkOutput = true,
|
2019-01-08 08:27:52 +08:00
|
|
|
#endif
|
2019-01-04 09:15:37 -06:00
|
|
|
.enableClkOutput25M = false,
|
|
|
|
.loopDivider = 1,
|
2018-11-15 18:28:47 +02:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2019-05-05 13:20:04 +08:00
|
|
|
#if CONFIG_USB_DC_NXP_EHCI
|
|
|
|
usb_phy_config_struct_t usbPhyConfig = {
|
|
|
|
BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2019-01-02 13:11:28 -06:00
|
|
|
#ifdef CONFIG_INIT_VIDEO_PLL
|
|
|
|
const clock_video_pll_config_t videoPllConfig = {
|
|
|
|
.loopDivider = 31,
|
|
|
|
.postDivider = 8,
|
|
|
|
.numerator = 0,
|
|
|
|
.denominator = 0,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2018-12-27 08:09:53 -06:00
|
|
|
#ifdef CONFIG_NXP_IMX_RT_BOOT_HEADER
|
|
|
|
const __imx_boot_data_section BOOT_DATA_T boot_data = {
|
|
|
|
.start = CONFIG_FLASH_BASE_ADDRESS,
|
|
|
|
.size = CONFIG_FLASH_SIZE,
|
|
|
|
.plugin = PLUGIN_FLAG,
|
|
|
|
.placeholder = 0xFFFFFFFF,
|
|
|
|
};
|
|
|
|
|
|
|
|
const __imx_boot_ivt_section ivt image_vector_table = {
|
|
|
|
.hdr = IVT_HEADER,
|
|
|
|
.entry = CONFIG_FLASH_BASE_ADDRESS + CONFIG_TEXT_SECTION_OFFSET,
|
|
|
|
.reserved1 = IVT_RSVD,
|
2018-12-28 08:43:48 -06:00
|
|
|
#ifdef CONFIG_DEVICE_CONFIGURATION_DATA
|
|
|
|
.dcd = (uint32_t) dcd_data,
|
|
|
|
#else
|
2018-12-27 08:09:53 -06:00
|
|
|
.dcd = (uint32_t) NULL,
|
2018-12-28 08:43:48 -06:00
|
|
|
#endif
|
2018-12-27 08:09:53 -06:00
|
|
|
.boot_data = (uint32_t) &boot_data,
|
|
|
|
.self = (uint32_t) &image_vector_table,
|
|
|
|
.csf = (uint32_t)CSF_ADDRESS,
|
|
|
|
.reserved2 = IVT_RSVD,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Initialize the system clock
|
|
|
|
*
|
|
|
|
* @return N/A
|
|
|
|
*
|
|
|
|
*/
|
2019-09-30 12:31:07 -07:00
|
|
|
static ALWAYS_INLINE void clock_init(void)
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
{
|
|
|
|
/* Boot ROM did initialize the XTAL, here we only sets external XTAL
|
|
|
|
* OSC freq
|
|
|
|
*/
|
|
|
|
CLOCK_SetXtalFreq(24000000U);
|
|
|
|
CLOCK_SetRtcXtalFreq(32768U);
|
|
|
|
|
|
|
|
/* Set PERIPH_CLK2 MUX to OSC */
|
|
|
|
CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 0x1);
|
|
|
|
|
|
|
|
/* Set PERIPH_CLK MUX to PERIPH_CLK2 */
|
|
|
|
CLOCK_SetMux(kCLOCK_PeriphMux, 0x1);
|
|
|
|
|
|
|
|
/* Setting the VDD_SOC to 1.5V. It is necessary to config AHB to 600Mhz
|
|
|
|
*/
|
|
|
|
DCDC->REG3 = (DCDC->REG3 & (~DCDC_REG3_TRG_MASK)) | DCDC_REG3_TRG(0x12);
|
2018-05-14 07:45:59 +08:00
|
|
|
/* Waiting for DCDC_STS_DC_OK bit is asserted */
|
|
|
|
while (DCDC_REG0_STS_DC_OK_MASK !=
|
|
|
|
(DCDC_REG0_STS_DC_OK_MASK & DCDC->REG0)) {
|
|
|
|
;
|
|
|
|
}
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
2018-05-14 07:45:32 +08:00
|
|
|
#ifdef CONFIG_INIT_ARM_PLL
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
CLOCK_InitArmPll(&armPllConfig); /* Configure ARM PLL to 1200M */
|
2018-05-14 07:45:32 +08:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_INIT_SYS_PLL
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
CLOCK_InitSysPll(&sysPllConfig); /* Configure SYS PLL to 528M */
|
2018-05-14 07:45:32 +08:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_INIT_USB1_PLL
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
CLOCK_InitUsb1Pll(&usb1PllConfig); /* Configure USB1 PLL to 480M */
|
2018-05-14 07:45:32 +08:00
|
|
|
#endif
|
2019-01-09 14:01:41 +08:00
|
|
|
#ifdef CONFIG_INIT_ENET_PLL
|
2018-11-15 18:28:47 +02:00
|
|
|
CLOCK_InitEnetPll(ðPllConfig);
|
|
|
|
#endif
|
2019-01-02 13:11:28 -06:00
|
|
|
#ifdef CONFIG_INIT_VIDEO_PLL
|
|
|
|
CLOCK_InitVideoPll(&videoPllConfig);
|
|
|
|
#endif
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
2019-09-24 08:52:39 +08:00
|
|
|
#ifdef CONFIG_HAS_ARM_DIV
|
2018-05-14 07:45:32 +08:00
|
|
|
CLOCK_SetDiv(kCLOCK_ArmDiv, CONFIG_ARM_DIV); /* Set ARM PODF */
|
2019-09-24 08:52:39 +08:00
|
|
|
#endif
|
2018-05-14 07:45:32 +08:00
|
|
|
CLOCK_SetDiv(kCLOCK_AhbDiv, CONFIG_AHB_DIV); /* Set AHB PODF */
|
|
|
|
CLOCK_SetDiv(kCLOCK_IpgDiv, CONFIG_IPG_DIV); /* Set IPG PODF */
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
|
|
|
/* Set PRE_PERIPH_CLK to PLL1, 1200M */
|
|
|
|
CLOCK_SetMux(kCLOCK_PrePeriphMux, 0x3);
|
|
|
|
|
|
|
|
/* Set PERIPH_CLK MUX to PRE_PERIPH_CLK */
|
|
|
|
CLOCK_SetMux(kCLOCK_PeriphMux, 0x0);
|
|
|
|
|
|
|
|
#ifdef CONFIG_UART_MCUX_LPUART
|
|
|
|
/* Configure UART divider to default */
|
|
|
|
CLOCK_SetMux(kCLOCK_UartMux, 0); /* Set UART source to PLL3 80M */
|
|
|
|
CLOCK_SetDiv(kCLOCK_UartDiv, 0); /* Set UART divider to 1 */
|
|
|
|
#endif
|
2018-05-15 03:06:14 -08:00
|
|
|
|
2019-01-16 15:22:22 -06:00
|
|
|
#ifdef CONFIG_I2C_MCUX_LPI2C
|
|
|
|
CLOCK_SetMux(kCLOCK_Lpi2cMux, 0); /* Set I2C source as USB1 PLL 480M */
|
|
|
|
CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 5); /* Set I2C divider to 6 */
|
|
|
|
#endif
|
|
|
|
|
2018-09-14 16:18:41 -05:00
|
|
|
#ifdef CONFIG_SPI_MCUX_LPSPI
|
|
|
|
CLOCK_SetMux(kCLOCK_LpspiMux, 1); /* Set SPI source to USB1 PFD0 720M */
|
|
|
|
CLOCK_SetDiv(kCLOCK_LpspiDiv, 7); /* Set SPI divider to 8 */
|
|
|
|
#endif
|
|
|
|
|
2019-01-02 13:11:28 -06:00
|
|
|
#ifdef CONFIG_DISPLAY_MCUX_ELCDIF
|
|
|
|
CLOCK_SetMux(kCLOCK_LcdifPreMux, 2);
|
|
|
|
CLOCK_SetDiv(kCLOCK_LcdifPreDiv, 4);
|
|
|
|
CLOCK_SetDiv(kCLOCK_LcdifDiv, 1);
|
|
|
|
#endif
|
|
|
|
|
2019-05-05 13:20:04 +08:00
|
|
|
#if CONFIG_USB_DC_NXP_EHCI
|
|
|
|
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usb480M,
|
2019-07-25 07:56:51 -05:00
|
|
|
DT_INST_0_NXP_KINETIS_USBD_CLOCKS_CLOCK_FREQUENCY);
|
2019-05-05 13:20:04 +08:00
|
|
|
CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M,
|
2019-07-25 07:56:51 -05:00
|
|
|
DT_INST_0_NXP_KINETIS_USBD_CLOCKS_CLOCK_FREQUENCY);
|
2019-05-05 13:20:04 +08:00
|
|
|
USB_EhciPhyInit(kUSB_ControllerEhci0, CPU_XTAL_CLK_HZ, &usbPhyConfig);
|
|
|
|
#endif
|
2019-07-03 21:28:35 -07:00
|
|
|
|
|
|
|
#if defined(CONFIG_DISK_ACCESS_USDHC1) || \
|
|
|
|
defined(CONFIG_DISK_ACCESS_USDHC2)
|
|
|
|
CLOCK_InitSysPfd(kCLOCK_Pfd0, 0x12U);
|
|
|
|
/* Configure USDHC clock source and divider */
|
|
|
|
#ifdef CONFIG_DISK_ACCESS_USDHC1
|
|
|
|
CLOCK_SetDiv(kCLOCK_Usdhc1Div, 0U);
|
|
|
|
CLOCK_SetMux(kCLOCK_Usdhc1Mux, 1U);
|
|
|
|
CLOCK_EnableClock(kCLOCK_Usdhc1);
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_DISK_ACCESS_USDHC2
|
|
|
|
CLOCK_SetDiv(kCLOCK_Usdhc2Div, 0U);
|
|
|
|
CLOCK_SetMux(kCLOCK_Usdhc2Mux, 1U);
|
|
|
|
CLOCK_EnableClock(kCLOCK_Usdhc2);
|
|
|
|
#endif
|
|
|
|
#endif
|
2019-07-01 14:47:14 +02:00
|
|
|
#ifdef CONFIG_VIDEO_MCUX_CSI
|
|
|
|
CLOCK_EnableClock(kCLOCK_Csi); /* Disable CSI clock gate */
|
|
|
|
CLOCK_SetDiv(kCLOCK_CsiDiv, 0); /* Set CSI divider to 1 */
|
|
|
|
CLOCK_SetMux(kCLOCK_CsiMux, 0); /* Set CSI source to OSC 24M */
|
|
|
|
#endif
|
2019-05-05 13:20:04 +08:00
|
|
|
|
2018-06-22 08:14:32 -05:00
|
|
|
/* Keep the system clock running so SYSTICK can wake up the system from
|
|
|
|
* wfi.
|
|
|
|
*/
|
|
|
|
CLOCK_SetMode(kCLOCK_ModeRun);
|
|
|
|
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
}
|
|
|
|
|
2019-07-03 21:23:35 -07:00
|
|
|
#if defined(CONFIG_DISK_ACCESS_USDHC1) || \
|
|
|
|
defined(CONFIG_DISK_ACCESS_USDHC2)
|
|
|
|
|
|
|
|
/* Usdhc driver needs to re-configure pinmux
|
|
|
|
* Pinmux depends on board design.
|
|
|
|
* From the perspective of Usdhc driver,
|
|
|
|
* it can't access board specific function.
|
|
|
|
* So SoC provides this for board to register
|
|
|
|
* its usdhc pinmux and for usdhc to access
|
|
|
|
* pinmux.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static usdhc_pin_cfg_cb g_usdhc_pin_cfg_cb;
|
|
|
|
|
|
|
|
void imxrt_usdhc_pinmux_cb_register(usdhc_pin_cfg_cb cb)
|
|
|
|
{
|
|
|
|
g_usdhc_pin_cfg_cb = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
void imxrt_usdhc_pinmux(u16_t nusdhc, bool init,
|
|
|
|
u32_t speed, u32_t strength)
|
|
|
|
{
|
|
|
|
if (g_usdhc_pin_cfg_cb)
|
|
|
|
g_usdhc_pin_cfg_cb(nusdhc, init,
|
|
|
|
speed, strength);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Perform basic hardware initialization
|
|
|
|
*
|
|
|
|
* Initialize the interrupt controller device drivers.
|
|
|
|
* Also initialize the timer device driver, if required.
|
|
|
|
*
|
|
|
|
* @return 0
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int imxrt_init(struct device *arg)
|
|
|
|
{
|
|
|
|
ARG_UNUSED(arg);
|
|
|
|
|
2018-08-14 17:57:08 -07:00
|
|
|
unsigned int oldLevel; /* old interrupt lock level */
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
|
|
|
/* disable interrupts */
|
|
|
|
oldLevel = irq_lock();
|
|
|
|
|
|
|
|
/* Watchdog disable */
|
2018-12-17 16:15:20 -08:00
|
|
|
if ((WDOG1->WCR & WDOG_WCR_WDE_MASK) != 0) {
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
WDOG1->WCR &= ~WDOG_WCR_WDE_MASK;
|
|
|
|
}
|
|
|
|
|
2018-12-17 16:15:20 -08:00
|
|
|
if ((WDOG2->WCR & WDOG_WCR_WDE_MASK) != 0) {
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
WDOG2->WCR &= ~WDOG_WCR_WDE_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
RTWDOG->CNT = 0xD928C520U; /* 0xD928C520U is the update key */
|
|
|
|
RTWDOG->TOVAL = 0xFFFF;
|
|
|
|
RTWDOG->CS = (uint32_t) ((RTWDOG->CS) & ~RTWDOG_CS_EN_MASK)
|
|
|
|
| RTWDOG_CS_UPDATE_MASK;
|
|
|
|
|
|
|
|
/* Disable Systick which might be enabled by bootrom */
|
2018-12-17 16:15:20 -08:00
|
|
|
if ((SysTick->CTRL & SysTick_CTRL_ENABLE_Msk) != 0) {
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCB_EnableICache();
|
2018-12-17 16:15:20 -08:00
|
|
|
if ((SCB->CCR & SCB_CCR_DC_Msk) == 0) {
|
2018-05-14 07:54:53 +08:00
|
|
|
SCB_EnableDCache();
|
|
|
|
}
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
2018-05-15 03:06:14 -08:00
|
|
|
/* Initialize system clock */
|
2019-09-30 12:31:07 -07:00
|
|
|
clock_init();
|
arm: Introduce NXP i.MX family, RT series, and mimxrt1052 SoC
Adds the mimxrt1052 SoC, which belongs to a new family (nxp_imx) and
series (rt) of SoCs. The mimxrt1052 integrates an Arm Cortex-M7 core,
512 KB TCM, and many peripherals including 2D graphics, an LCD display
controller, camera interface, SPDIF and I2S. Unlike other SoCs in
Zephyr, the mimxrt1052 has no internal flash.
This initial port to mimxrt1052 configures the system clock to operate
at 528 MHz, and enables the serial/uart and gpio interfaces to support
the hello_world and blinky samples. Support for additional Zephyr driver
interfaces will come later.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-11 14:42:40 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* install default handler that simply resets the CPU
|
|
|
|
* if configured in the kernel, NOP otherwise
|
|
|
|
*/
|
|
|
|
NMI_INIT();
|
|
|
|
|
|
|
|
/* restore interrupt state */
|
|
|
|
irq_unlock(oldLevel);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SYS_INIT(imxrt_init, PRE_KERNEL_1, 0);
|