Skip to content

Commit

Permalink
arm64/imx9: Add support for imx9 series SoMs, imx93 implemented
Browse files Browse the repository at this point in the history
Adds support for NXP i.MX9-series System-on-Module chips.

- Support for i.MX93 is added
- CPU is Cortex A55 / ARMv8.2A
  - The chip also contains a Cortex M33, but no support is provided
- Supported drivers include lpuart only for now
  • Loading branch information
pussuw committed Mar 21, 2024
1 parent 680592c commit 0b061bd
Show file tree
Hide file tree
Showing 15 changed files with 2,265 additions and 0 deletions.
25 changes: 25 additions & 0 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ config ARCH_CHIP_IMX8
---help---
NXP i.MX8 (ARMv8a) applications processors

config ARCH_CHIP_IMX9
bool "NXP i.MX9 Platform (ARMv8.2a)"
select ARCH_HAVE_ADDRENV
select ARCH_HAVE_IRQTRIGGER
select ARCH_NEED_ADDRENV_MAPPING
---help---
NXP i.MX9 (ARMv8.2a) applications processors

config ARCH_CHIP_ARM64_CUSTOM
bool "Custom ARM64 chip"
select ARCH_CHIP_CUSTOM
Expand Down Expand Up @@ -181,6 +189,18 @@ config ARCH_CORTEX_A53
select ARCH_HAVE_TESTSET
select ARM_HAVE_NEON

config ARCH_CORTEX_A55
bool
default n
select ARCH_ARMV8A
select ARCH_HAVE_TRUSTZONE
select ARCH_DCACHE
select ARCH_ICACHE
select ARCH_HAVE_MMU
select ARCH_HAVE_FPU
select ARCH_HAVE_TESTSET
select ARM_HAVE_NEON

config ARCH_CORTEX_A57
bool
default n
Expand Down Expand Up @@ -229,6 +249,7 @@ config ARCH_CHIP
default "goldfish" if ARCH_CHIP_GOLDFISH
default "fvp-v8r" if ARCH_CHIP_FVP_ARMV8R
default "imx8" if ARCH_CHIP_IMX8
default "imx9" if ARCH_CHIP_IMX9

config ARM_HAVE_NEON
bool
Expand Down Expand Up @@ -311,6 +332,10 @@ if ARCH_CHIP_IMX8
source "arch/arm64/src/imx8/Kconfig"
endif

if ARCH_CHIP_IMX9
source "arch/arm64/src/imx9/Kconfig"
endif

if ARCH_CHIP_GOLDFISH
source "arch/arm64/src/goldfish/Kconfig"
endif
Expand Down
77 changes: 77 additions & 0 deletions arch/arm64/include/imx9/chip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/****************************************************************************
* arch/arm64/include/imx9/chip.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __ARCH_ARM64_INCLUDE_IMX9_CHIP_H
#define __ARCH_ARM64_INCLUDE_IMX9_CHIP_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/* Number of bytes in x kibibytes/mebibytes/gibibytes */

#define KB(x) ((x) << 10)
#define MB(x) (KB(x) << 10)
#define GB(x) (MB(UINT64_C(x)) << 10)

#if defined(CONFIG_ARCH_CHIP_IMX93)

#if CONFIG_ARM_GIC_VERSION == 3 || CONFIG_ARM_GIC_VERSION == 4

#define CONFIG_GICD_BASE 0x48000000
#define CONFIG_GICR_BASE 0x48040000
#define CONFIG_GICR_OFFSET 0x20000

#else

#error CONFIG_ARM_GIC_VERSION should be 2, 3 or 4

#endif /* CONFIG_ARM_GIC_VERSION */

#define CONFIG_RAMBANK1_ADDR 0x80000000
#define CONFIG_RAMBANK1_SIZE MB(128)

#define CONFIG_DEVICEIO_BASEADDR 0x40000000
#define CONFIG_DEVICEIO_SIZE MB(512)

#define MPID_TO_CLUSTER_ID(mpid) ((mpid) & ~0xff)

#endif

/****************************************************************************
* Assembly Macros
****************************************************************************/

#ifdef __ASSEMBLY__

.macro get_cpu_id xreg0
mrs \xreg0, mpidr_el1
ubfx \xreg0, \xreg0, #0, #8
.endm

#endif /* __ASSEMBLY__ */

#endif /* __ARCH_ARM64_INCLUDE_IMX9_CHIP_H */
298 changes: 298 additions & 0 deletions arch/arm64/include/imx9/imx93_irq.h

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions arch/arm64/include/imx9/irq.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/****************************************************************************
* arch/arm64/include/imx9/irq.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/* This file should never be included directly but, rather,
* only indirectly through nuttx/irq.h
*/

#ifndef __ARCH_ARM64_INCLUDE_IMX9_IRQ_H
#define __ARCH_ARM64_INCLUDE_IMX9_IRQ_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

#if defined(CONFIG_ARCH_CHIP_IMX93)
# include <arch/imx9/imx93_irq.h>
#else
# error "Unrecognized i.MX9 architecture"
#endif

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#define IMX9_IRQ_SOFTWARE0 (0) /* Cortex-A55 Software Generated Interrupt 0 */
#define IMX9_IRQ_SOFTWARE1 (1) /* Cortex-A55 Software Generated Interrupt 1 */
#define IMX9_IRQ_SOFTWARE2 (2) /* Cortex-A55 Software Generated Interrupt 2 */
#define IMX9_IRQ_SOFTWARE3 (3) /* Cortex-A55 Software Generated Interrupt 3 */
#define IMX9_IRQ_SOFTWARE4 (4) /* Cortex-A55 Software Generated Interrupt 4 */
#define IMX9_IRQ_SOFTWARE5 (5) /* Cortex-A55 Software Generated Interrupt 5 */
#define IMX9_IRQ_SOFTWARE6 (6) /* Cortex-A55 Software Generated Interrupt 6 */
#define IMX9_IRQ_SOFTWARE7 (7) /* Cortex-A55 Software Generated Interrupt 7 */
#define IMX9_IRQ_SOFTWARE8 (8) /* Cortex-A55 Software Generated Interrupt 8 */
#define IMX9_IRQ_SOFTWARE9 (9) /* Cortex-A55 Software Generated Interrupt 9 */
#define IMX9_IRQ_SOFTWARE10 (10) /* Cortex-A55 Software Generated Interrupt 10 */
#define IMX9_IRQ_SOFTWARE11 (11) /* Cortex-A55 Software Generated Interrupt 11 */
#define IMX9_IRQ_SOFTWARE12 (12) /* Cortex-A55 Software Generated Interrupt 12 */
#define IMX9_IRQ_SOFTWARE13 (13) /* Cortex-A55 Software Generated Interrupt 13 */
#define IMX9_IRQ_SOFTWARE14 (14) /* Cortex-A55 Software Generated Interrupt 14 */
#define IMX9_IRQ_SOFTWARE15 (15) /* Cortex-A55 Software Generated Interrupt 15 */
#define IMX9_IRQ_VIRTUALMAINTENANCE (25) /* Cortex-A55 Virtual Maintenance Interrupt */
#define IMX9_IRQ_HYPERVISORTIMER (26) /* Cortex-A55 Hypervisor Timer Interrupt */
#define IMX9_IRQ_VIRTUALTIMER (27) /* Cortex-A55 Virtual Timer Interrupt */
#define IMX9_IRQ_LEGACYFASTINT (28) /* Cortex-A55 Legacy nFIQ signal Interrupt */
#define IMX9_IRQ_SECUREPHYTIMER (29) /* Cortex-A55 Secure Physical Timer Interrupt */
#define IMX9_IRQ_NONSECUREPHYTIMER (30) /* Cortex-A55 Non-secure Physical Timer Interrupt */
#define IMX9_IRQ_LEGACYIRQ (31) /* Cortex-A55 Legacy nIRQ Interrupt */

#define IMX9_IRQ_EXT (32) /* Vector number of the first ext int */

#endif /* __ARCH_ARM64_INCLUDE_IMX9_IRQ_H */
31 changes: 31 additions & 0 deletions arch/arm64/src/imx9/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_CHIP_IMX9

menu "i.MX9 Chip Selection"

choice
prompt "i.MX9 Core Configuration"
default ARCH_CHIP_IMX93

config ARCH_CHIP_IMX93
bool "i.MX9 Application Processor"
select ARCH_HAVE_MULTICPU
select ARMV8A_HAVE_GICv3
select ARCH_CORTEX_A55

endchoice # i.MX9 Chip Selection

endmenu # "i.MX9 Chip Selection"

menu "i.MX9 Peripheral Selection"
config IMX9_UART1
bool "UART1"
default n
select UART1_SERIALDRIVER
endmenu # iMX Peripheral Selection

endif # ARCH_CHIP_IMX9
32 changes: 32 additions & 0 deletions arch/arm64/src/imx9/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
############################################################################
# arch/arm64/src/imx9/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

include common/Make.defs

# i.MX9-specific C source files

CHIP_CSRCS = imx9_boot.c

ifeq ($(CONFIG_ARCH_CHIP_IMX93),y)
CHIP_CSRCS += imx9_lpuart.c
ifeq ($(CONFIG_ARCH_EARLY_PRINT),y)
CHIP_ASRCS = imx93_lowputc.S
endif
endif
42 changes: 42 additions & 0 deletions arch/arm64/src/imx9/chip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/****************************************************************************
* arch/arm64/src/imx9/chip.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __ARCH_ARM64_SRC_IMX9_CHIP_H
#define __ARCH_ARM64_SRC_IMX9_CHIP_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

#ifndef __ASSEMBLY__
# include <nuttx/arch.h>
#endif

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/****************************************************************************
* Macro Definitions
****************************************************************************/

#endif /* __ARCH_ARM64_SRC_IMX9_CHIP_H */
Loading

0 comments on commit 0b061bd

Please sign in to comment.