Skip to content

Commit e16a326

Browse files
Zhiqiang-Houkartben
authored andcommitted
soc: nxp: add SoC imx91 support
The i.MX 91 SoC’s integrated EdgeLock® Secure Enclave provides security features including lifecycle management, tamper detection, secure boot and a simplified path to certifications. The i.MX 91 family features an Arm® Cortex®-A55 running at up to 1.4GHz, support for modern LPDDR4 memory to enable platform longevity, dual Gigabit Ethernet and dual USB ports, along with a rich set of peripherals targeting medical, industrial and consumer IoT market segments. Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
1 parent d72d3c5 commit e16a326

File tree

9 files changed

+192
-2
lines changed

9 files changed

+192
-2
lines changed

soc/nxp/imx/imx9/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Copyright 2024 NXP
1+
# Copyright 2024-2025 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if(CONFIG_SOC_MIMX9352)
4+
if(CONFIG_SOC_MIMX9131)
5+
add_subdirectory(imx91)
6+
elseif(CONFIG_SOC_MIMX9352)
57
add_subdirectory(imx93)
68
elseif(CONFIG_SOC_MIMX9596)
79
add_subdirectory(imx95)

soc/nxp/imx/imx9/imx91/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
zephyr_compile_options(-Wno-misleading-indentation)
3+
4+
zephyr_include_directories(.)
5+
6+
zephyr_sources_ifdef(CONFIG_ARM_MMU mmu_regions.c)
7+
8+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm64/scripts/linker.ld CACHE INTERNAL "")

soc/nxp/imx/imx9/imx91/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2025 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_MIMX9131
5+
select ARM64
6+
select CPU_CORTEX_A55
7+
select ARM_ARCH_TIMER if SYS_CLOCK_EXISTS
8+
select HAS_MCUX if CLOCK_CONTROL
9+
select HAS_MCUX_CCM_REV2 if CLOCK_CONTROL
10+
select HAS_MCUX_IOMUXC if PINCTRL
11+
select HAS_MCUX_CACHE
12+
select KERNEL_DIRECT_MAP if HAS_MCUX
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2025 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_IMX9
5+
6+
rsource "Kconfig.defconfig.*"
7+
8+
endif # SOC_SERIES_IMX9
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_MIMX9131
5+
6+
# Workaround for not being able to have commas in macro arguments
7+
DT_CHOSEN_Z_FLASH := zephyr,flash
8+
9+
config FLASH_SIZE
10+
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0,K)
11+
12+
config FLASH_BASE_ADDRESS
13+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))
14+
15+
config NUM_IRQS
16+
default 300
17+
18+
config SYS_CLOCK_HW_CYCLES_PER_SEC
19+
default 24000000
20+
21+
endif

soc/nxp/imx/imx9/imx91/Kconfig.soc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_MIMX9131
5+
bool
6+
select SOC_SERIES_IMX9
7+
help
8+
NXP i.MX91
9+
10+
config SOC_PART_NUMBER_MIMX9131CVVXJ
11+
bool
12+
13+
config SOC_PART_NUMBER_MIMX9131DVVXJ
14+
bool
15+
16+
config SOC_PART_NUMBER
17+
default "MIMX9131CVVXJ" if SOC_PART_NUMBER_MIMX9131CVVXJ
18+
default "MIMX9131DVVXJ" if SOC_PART_NUMBER_MIMX9131DVVXJ
19+
20+
config SOC
21+
default "mimx9131" if SOC_MIMX9131

soc/nxp/imx/imx9/imx91/mmu_regions.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/arch/arm64/arm_mmu.h>
8+
#include <zephyr/devicetree.h>
9+
#include <zephyr/sys/util.h>
10+
11+
static const struct arm_mmu_region mmu_regions[] = {
12+
MMU_REGION_FLAT_ENTRY("GIC", DT_REG_ADDR_BY_IDX(DT_NODELABEL(gic), 0),
13+
DT_REG_SIZE_BY_IDX(DT_NODELABEL(gic), 0),
14+
MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS),
15+
16+
MMU_REGION_FLAT_ENTRY("GIC", DT_REG_ADDR_BY_IDX(DT_NODELABEL(gic), 1),
17+
DT_REG_SIZE_BY_IDX(DT_NODELABEL(gic), 1),
18+
MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS),
19+
20+
MMU_REGION_FLAT_ENTRY("CCM", DT_REG_ADDR(DT_NODELABEL(ccm)), DT_REG_SIZE(DT_NODELABEL(ccm)),
21+
MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS),
22+
23+
MMU_REGION_FLAT_ENTRY("ANA_PLL", DT_REG_ADDR(DT_NODELABEL(ana_pll)),
24+
DT_REG_SIZE(DT_NODELABEL(ana_pll)),
25+
MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS),
26+
27+
MMU_REGION_FLAT_ENTRY("IOMUXC", DT_REG_ADDR(DT_NODELABEL(iomuxc)),
28+
DT_REG_SIZE(DT_NODELABEL(iomuxc)),
29+
MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS),
30+
31+
MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY(nxp_lpuart,
32+
(MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS))
33+
};
34+
35+
const struct arm_mmu_config mmu_config = {
36+
.num_regions = ARRAY_SIZE(mmu_regions),
37+
.mmu_regions = mmu_regions,
38+
};

soc/nxp/imx/imx9/imx91/pinctrl_soc.h

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_SOC_ARM64_NXP_IMX9_PINCTRL_SOC_H_
8+
#define ZEPHYR_SOC_ARM64_NXP_IMX9_PINCTRL_SOC_H_
9+
10+
#include <zephyr/devicetree.h>
11+
#include <zephyr/types.h>
12+
#include "fsl_common.h"
13+
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif
17+
18+
#define MCUX_IMX_INPUT_SCHMITT_ENABLE_SHIFT IOMUXC1_SW_PAD_CTL_PAD_HYS_SHIFT
19+
#define MCUX_IMX_DRIVE_OPEN_DRAIN_SHIFT IOMUXC1_SW_PAD_CTL_PAD_OD_SHIFT
20+
#define MCUX_IMX_BIAS_PULL_DOWN_SHIFT IOMUXC1_SW_PAD_CTL_PAD_PD_SHIFT
21+
#define MCUX_IMX_BIAS_PULL_UP_SHIFT IOMUXC1_SW_PAD_CTL_PAD_PU_SHIFT
22+
#define MCUX_IMX_SLEW_RATE_SHIFT IOMUXC1_SW_PAD_CTL_PAD_FSEL1_SHIFT
23+
#define MCUX_IMX_DRIVE_STRENGTH_SHIFT IOMUXC1_SW_PAD_CTL_PAD_DSE_SHIFT
24+
#define MCUX_IMX_INPUT_ENABLE_SHIFT 23 /* Shift to a bit not used by IOMUXC_SW_PAD_CTL */
25+
#define MCUX_IMX_INPUT_ENABLE(x) ((x >> MCUX_IMX_INPUT_ENABLE_SHIFT) & 0x1)
26+
27+
#define Z_PINCTRL_MCUX_IMX_PINCFG_INIT(node_id) \
28+
((DT_PROP(node_id, input_schmitt_enable) << MCUX_IMX_INPUT_SCHMITT_ENABLE_SHIFT) | \
29+
(DT_PROP(node_id, drive_open_drain) << MCUX_IMX_DRIVE_OPEN_DRAIN_SHIFT) | \
30+
(DT_PROP(node_id, bias_pull_down) << MCUX_IMX_BIAS_PULL_DOWN_SHIFT) | \
31+
(DT_PROP(node_id, bias_pull_up) << MCUX_IMX_BIAS_PULL_UP_SHIFT) | \
32+
(DT_ENUM_IDX(node_id, slew_rate) << MCUX_IMX_SLEW_RATE_SHIFT) | \
33+
((~(0xff << DT_ENUM_IDX(node_id, drive_strength))) << MCUX_IMX_DRIVE_STRENGTH_SHIFT) | \
34+
(DT_PROP(node_id, input_enable) << MCUX_IMX_INPUT_ENABLE_SHIFT))
35+
36+
/* This struct must be present. It is used by the mcux gpio driver */
37+
struct pinctrl_soc_pinmux {
38+
uint32_t mux_register; /*!< IOMUXC SW_PAD_MUX register */
39+
uint32_t config_register; /*!< IOMUXC SW_PAD_CTL register */
40+
uint32_t input_register; /*!< IOMUXC SELECT_INPUT DAISY register */
41+
uint8_t mux_mode: 4; /*!< Mux value for SW_PAD_MUX register */
42+
uint32_t input_daisy: 4; /*!< Mux value for SELECT_INPUT_DAISY register */
43+
};
44+
45+
struct pinctrl_soc_pin {
46+
struct pinctrl_soc_pinmux pinmux;
47+
uint32_t pin_ctrl_flags; /*!< value to write to IOMUXC_SW_PAD_CTL register */
48+
};
49+
50+
typedef struct pinctrl_soc_pin pinctrl_soc_pin_t;
51+
52+
/* This definition must be present. It is used by the mcux gpio driver */
53+
#define MCUX_IMX_PINMUX(node_id) \
54+
{ \
55+
.mux_register = DT_PROP_BY_IDX(node_id, pinmux, 0), \
56+
.config_register = DT_PROP_BY_IDX(node_id, pinmux, 4), \
57+
.input_register = DT_PROP_BY_IDX(node_id, pinmux, 2), \
58+
.mux_mode = DT_PROP_BY_IDX(node_id, pinmux, 1), \
59+
.input_daisy = DT_PROP_BY_IDX(node_id, pinmux, 3), \
60+
}
61+
62+
#define Z_PINCTRL_PINMUX(group_id, pin_prop, idx) \
63+
MCUX_IMX_PINMUX(DT_PHANDLE_BY_IDX(group_id, pin_prop, idx))
64+
65+
#define Z_PINCTRL_STATE_PIN_INIT(group_id, pin_prop, idx) \
66+
{ \
67+
.pinmux = Z_PINCTRL_PINMUX(group_id, pin_prop, idx), \
68+
.pin_ctrl_flags = Z_PINCTRL_MCUX_IMX_PINCFG_INIT(group_id), \
69+
},
70+
71+
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \
72+
{DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), DT_FOREACH_PROP_ELEM, pinmux, \
73+
Z_PINCTRL_STATE_PIN_INIT)};
74+
75+
#ifdef __cplusplus
76+
}
77+
#endif
78+
79+
#endif /* ZEPHYR_SOC_ARM64_NXP_IMX9_PINCTRL_SOC_H_ */

soc/nxp/imx/soc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ family:
3535
- name: m4
3636
- name: imx9
3737
socs:
38+
- name: mimx9131
3839
- name: mimx9352
3940
cpuclusters:
4041
- name: a55

0 commit comments

Comments
 (0)