arm64: IMX8 platform (Cortex-A53) support
Summary Support for imx8 platform, this is a very initialize version Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
This commit is contained in:
parent
4b5910efc1
commit
30354e5767
@ -49,6 +49,14 @@ config ARCH_CHIP_FVP_ARMV8R
|
||||
---help---
|
||||
ARM FVP virt platform (ARMv8r)
|
||||
|
||||
config ARCH_CHIP_IMX8
|
||||
bool "NXP iMX.8 Platform (ARMv8a)"
|
||||
select ARCH_HAVE_ADDRENV
|
||||
select ARCH_HAVE_IRQTRIGGER
|
||||
select ARCH_NEED_ADDRENV_MAPPING
|
||||
---help---
|
||||
NXP iMX.8 (ARMv8a) applications processors
|
||||
|
||||
config ARCH_CHIP_ARM64_CUSTOM
|
||||
bool "Custom ARM64 chip"
|
||||
select ARCH_CHIP_CUSTOM
|
||||
@ -184,6 +192,7 @@ config ARCH_CHIP
|
||||
default "a64" if ARCH_CHIP_A64
|
||||
default "qemu" if ARCH_CHIP_QEMU
|
||||
default "fvp-v8r" if ARCH_CHIP_FVP_ARMV8R
|
||||
default "imx8" if ARCH_CHIP_IMX8
|
||||
|
||||
config ARM_HAVE_NEON
|
||||
bool
|
||||
@ -249,4 +258,9 @@ endif
|
||||
if ARCH_CHIP_FVP_ARMV8R
|
||||
source "arch/arm64/src/fvp-v8r/Kconfig"
|
||||
endif
|
||||
|
||||
if ARCH_CHIP_IMX8
|
||||
source "arch/arm64/src/imx8/Kconfig"
|
||||
endif
|
||||
|
||||
endif # ARCH_ARM64
|
||||
|
78
arch/arm64/include/imx8/chip.h
Normal file
78
arch/arm64/include/imx8/chip.h
Normal file
@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/include/imx8/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_IMX8_CHIP_H__
|
||||
#define __ARCH_ARM64_INCLUDE_IMX8_CHIP_H__
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Number of bytes in @p 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_IMX8_QUADMAX)
|
||||
|
||||
#if CONFIG_ARM_GIC_VERSION == 3 || CONFIG_ARM_GIC_VERSION == 4
|
||||
|
||||
#define CONFIG_GICD_BASE 0x51a00000
|
||||
#define CONFIG_GICR_BASE 0x51b00000
|
||||
#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 CONFIG_LOAD_BASE 0x80280000
|
||||
|
||||
#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_IMX8_CHIP_H */
|
34
arch/arm64/include/imx8/irq.h
Normal file
34
arch/arm64/include/imx8/irq.h
Normal file
@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/include/imx8/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_IMX8_IRQ_H__
|
||||
#define __ARCH_ARM64_INCLUDE_IMX8_IRQ_H__
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define NR_IRQS 512 /* Total number of interrupts */
|
||||
|
||||
#endif /* __ARCH_ARM64_INCLUDE_IMX8_IRQ_H__ */
|
31
arch/arm64/src/imx8/Kconfig
Normal file
31
arch/arm64/src/imx8/Kconfig
Normal file
@ -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_IMX8
|
||||
|
||||
menu "iMX.8 Chip Selection"
|
||||
|
||||
choice
|
||||
prompt "iMX.8 Core Configuration"
|
||||
default ARCH_CHIP_IMX8_QUADMAX
|
||||
|
||||
config ARCH_CHIP_IMX8_QUADMAX
|
||||
bool "iMX.8 QuadMax Application Processor"
|
||||
select ARCH_HAVE_MULTICPU
|
||||
select ARMV8A_HAVE_GICv3
|
||||
select ARCH_CORTEX_A53
|
||||
|
||||
endchoice # iMX.8 Chip Selection
|
||||
|
||||
endmenu # "iMX.8 Chip Selection"
|
||||
|
||||
menu "iMX.8 Peripheral Selection"
|
||||
config IMX8_UART1
|
||||
bool "UART1"
|
||||
default n
|
||||
select UART1_SERIALDRIVER
|
||||
endmenu # iMX Peripheral Selection
|
||||
|
||||
endif # ARCH_CHIP_IMX8
|
32
arch/arm64/src/imx8/Make.defs
Normal file
32
arch/arm64/src/imx8/Make.defs
Normal file
@ -0,0 +1,32 @@
|
||||
############################################################################
|
||||
# arch/arm64/src/imx8/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.MX8-specific C source files
|
||||
|
||||
CHIP_CSRCS = imx8_boot.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_CHIP_IMX8_QUADMAX),y)
|
||||
CHIP_CSRCS += imx8qm_serial.c
|
||||
ifeq ($(CONFIG_ARCH_EARLY_PRINT),y)
|
||||
CHIP_ASRCS = imx8qm_lowputc.S
|
||||
endif
|
||||
endif
|
42
arch/arm64/src/imx8/chip.h
Normal file
42
arch/arm64/src/imx8/chip.h
Normal file
@ -0,0 +1,42 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/imx8/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_IMX8_CHIP_H
|
||||
#define __ARCH_ARM64_SRC_IMX8_CHIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <nuttx/arch.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Macro Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM64_SRC_IMX8_CHIP_H */
|
115
arch/arm64/src/imx8/imx8_boot.c
Normal file
115
arch/arm64/src/imx8/imx8_boot.c
Normal file
@ -0,0 +1,115 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/imx8/imx8_boot.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/cache.h>
|
||||
#ifdef CONFIG_PAGING
|
||||
# include <nuttx/page.h>
|
||||
#endif
|
||||
|
||||
#include <arch/chip/chip.h>
|
||||
#include "arm64_arch.h"
|
||||
#include "arm64_internal.h"
|
||||
#include "arm64_mmu.h"
|
||||
#include "imx8_boot.h"
|
||||
#include "imx8_serial.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const struct arm_mmu_region g_mmu_regions[] =
|
||||
{
|
||||
MMU_REGION_FLAT_ENTRY("DEVICE_REGION",
|
||||
CONFIG_DEVICEIO_BASEADDR, MB(512),
|
||||
MT_DEVICE_NGNRNE | MT_RW | MT_SECURE),
|
||||
|
||||
MMU_REGION_FLAT_ENTRY("DRAM0_S0",
|
||||
CONFIG_RAMBANK1_ADDR, MB(512),
|
||||
MT_NORMAL | MT_RW | MT_SECURE),
|
||||
};
|
||||
|
||||
const struct arm_mmu_config g_mmu_config =
|
||||
{
|
||||
.num_regions = nitems(g_mmu_regions),
|
||||
.mmu_regions = g_mmu_regions,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm64_el_init
|
||||
*
|
||||
* Description:
|
||||
* The function called from arm64_head.S at very early stage for these
|
||||
* platform, it's use to:
|
||||
* - Handling special hardware initialize routine which is need to
|
||||
* run at high ELs
|
||||
* - Initialize system software such as hypervisor or security firmware
|
||||
* which is need to run at high ELs
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void arm64_el_init(void)
|
||||
{
|
||||
write_sysreg(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC, cntfrq_el0);
|
||||
|
||||
ARM64_ISB();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm64_chip_boot
|
||||
*
|
||||
* Description:
|
||||
* Complete boot operations started in arm64_head.S
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void arm64_chip_boot(void)
|
||||
{
|
||||
/* MAP IO and DRAM, enable MMU. */
|
||||
|
||||
arm64_mmu_init(true);
|
||||
|
||||
/* Perform board-specific device initialization. This would include
|
||||
* configuration of board specific resources such as GPIOs, LEDs, etc.
|
||||
*/
|
||||
|
||||
imx8_board_initialize();
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
/* Perform early serial initialization if we are going to use the serial
|
||||
* driver.
|
||||
*/
|
||||
|
||||
arm64_earlyserialinit();
|
||||
#endif
|
||||
}
|
81
arch/arm64/src/imx8/imx8_boot.h
Normal file
81
arch/arm64/src/imx8/imx8_boot.h
Normal file
@ -0,0 +1,81 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/imx8/imx8_boot.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_IMX8_IMX8_BOOT_H
|
||||
#define __ARCH_ARM64_SRC_IMX8_IMX8_BOOT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <arch/chip/chip.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC 62500000
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: imx8_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All i.MX8 architectures must provide the following entry point. This
|
||||
* entry point is called in the initialization phase -- after
|
||||
* imx_memory_initialize and after all memory has been configured and
|
||||
* mapped but before any devices have been initialized.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void imx8_board_initialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM64_SRC_IMX8_IMX8_BOOT_H */
|
105
arch/arm64/src/imx8/imx8_serial.h
Normal file
105
arch/arm64/src/imx8/imx8_serial.h
Normal file
@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/imx8/imx8_serial.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_IMX8_IMX8_SERIAL_H
|
||||
#define __ARCH_ARM64_SRC_IMX8_IMX8_SERIAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "arm64_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_CHIP_IMX8_QUADMAX
|
||||
#define SPI_OFFSET 32
|
||||
#define CONFIG_IMX8QM_UART1_BASE 0x5a060000
|
||||
#define CONFIG_IMX8QM_UART1_IRQ (SPI_OFFSET + 345)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: imx_earlyserialinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level UART initialization early in debug so that the
|
||||
* serial console will be available during bootup. This must be called
|
||||
* before arm_serialinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
void imx8_earlyserialinit(void);
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: uart_earlyserialinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level UART initialization early in debug so that the
|
||||
* serial console will be available during bootup. This must be called
|
||||
* before arm_serialinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(USE_EARLYSERIALINIT) && defined(IMX8_HAVE_UART)
|
||||
void uart_earlyserialinit(void);
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: uart_serialinit
|
||||
*
|
||||
* Description:
|
||||
* Register the UART serial console and serial ports. This assumes that
|
||||
* uart_earlyserialinit was called previously.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef IMX8_HAVE_UART
|
||||
void uart_serialinit(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM_SRC_IMX6_IMX_SERIAL_H */
|
89
arch/arm64/src/imx8/imx8qm_lowputc.S
Normal file
89
arch/arm64/src/imx8/imx8qm_lowputc.S
Normal file
@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/imx8/imx8_lowputs.S
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Wrapper for early printk
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "arm64_macro.inc"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Symbols
|
||||
****************************************************************************/
|
||||
|
||||
.file "imx8qm_lowputc.S"
|
||||
|
||||
/****************************************************************************
|
||||
* Assembly Macros
|
||||
****************************************************************************/
|
||||
|
||||
/* 32-bit register definition for imx8qm uart*/
|
||||
#define UART1_BASE_ADDRESS 0x5a060000
|
||||
|
||||
#define UARTSTAT (0x14)
|
||||
#define UARTDATA (0x1C)
|
||||
#define UARTSTAT_TDRE (1 << 23)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* PL011 UART initialization */
|
||||
|
||||
GTEXT(arm64_earlyprintinit)
|
||||
SECTION_FUNC(text, arm64_earlyprintinit)
|
||||
/* Already initialized in bootloader */
|
||||
ret
|
||||
|
||||
/* i.MX8QM wait LPUART to be ready to transmit
|
||||
* rb: register which contains the UART base address
|
||||
* rc: scratch register
|
||||
*/
|
||||
.macro early_uart_ready xb, c
|
||||
1:
|
||||
ldr w\c, [\xb, #UARTSTAT] /* <- Flag register */
|
||||
tst w\c, #UARTSTAT_TDRE /* Check FIFO EMPTY bit */
|
||||
beq 1b /* Wait for the UART to be ready */
|
||||
.endm
|
||||
|
||||
/* i.MX8QM LPUART transmit character
|
||||
* rb: register which contains the UART base address
|
||||
* rt: register which contains the character to transmit */
|
||||
.macro early_uart_transmit xb, wt
|
||||
str \wt, [\xb, #UARTDATA] /* -> Data Register */
|
||||
.endm
|
||||
|
||||
/*
|
||||
* Print a character on the UART - this function is called by C
|
||||
* x0: character to print
|
||||
*/
|
||||
GTEXT(arm64_lowputc)
|
||||
SECTION_FUNC(text, arm64_lowputc)
|
||||
ldr x15, =UART1_BASE_ADDRESS
|
||||
early_uart_ready x15, 1
|
||||
early_uart_transmit x15, w0
|
||||
ret
|
1096
arch/arm64/src/imx8/imx8qm_serial.c
Normal file
1096
arch/arm64/src/imx8/imx8qm_serial.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user