From 238e9abf0a900abdfba9a08ef972e4138adc0176 Mon Sep 17 00:00:00 2001 From: Piyush Patle Date: Wed, 20 May 2026 08:01:01 +0530 Subject: [PATCH 1/5] arm64/common: enable EL1 GICv3 sysreg access from EL2 AM62x enters NuttX through EL2 before dropping to EL1. Enable the GICv3 system register interface for lower exception levels during the EL2 handoff so EL1 can use the CPU interface without depending on firmware state. Signed-off-by: Piyush Patle --- arch/arm64/src/common/arm64_arch.h | 3 ++- arch/arm64/src/common/arm64_boot.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm64/src/common/arm64_arch.h b/arch/arm64/src/common/arm64_arch.h index fa891ae636188..9ec953800a29f 100644 --- a/arch/arm64/src/common/arm64_arch.h +++ b/arch/arm64/src/common/arm64_arch.h @@ -214,7 +214,8 @@ #define ICC_SRE_ELX_SRE_BIT BIT(0) #define ICC_SRE_ELX_DFB_BIT BIT(1) #define ICC_SRE_ELX_DIB_BIT BIT(2) -#define ICC_SRE_EL3_EN_BIT BIT(3) +#define ICC_SRE_ELX_EN_BIT BIT(3) +#define ICC_SRE_EL3_EN_BIT ICC_SRE_ELX_EN_BIT #define ICC_CTLR_EOIMODE_BIT BIT(1) /* ICC SGI macros */ diff --git a/arch/arm64/src/common/arm64_boot.c b/arch/arm64/src/common/arm64_boot.c index 480bfda740fe2..790bc8b71ea08 100644 --- a/arch/arm64/src/common/arm64_boot.c +++ b/arch/arm64/src/common/arm64_boot.c @@ -152,6 +152,17 @@ void arm64_boot_el2_init(void) write_sysreg(reg, hcr_el2); +#if CONFIG_ARM64_GIC_VERSION > 2 + /* Enable EL1 access to the GICv3 system register interface. */ + + reg = read_sysreg(ICC_SRE_EL2); + reg |= (ICC_SRE_ELX_DFB_BIT | /* Disable FIQ bypass */ + ICC_SRE_ELX_DIB_BIT | /* Disable IRQ bypass */ + ICC_SRE_ELX_SRE_BIT | /* System register interface is used */ + ICC_SRE_ELX_EN_BIT); /* Enable lower EL access */ + write_sysreg(reg, ICC_SRE_EL2); +#endif + reg = 0U; /* RES0 */ reg |= CPTR_EL2_RES1; /* RES1 */ reg &= ~(CPTR_TFP_BIT | /* Do not trap SVE, SIMD and FP */ From 291ea80a7d0b61c7ccb684463c714530408ee89c Mon Sep 17 00:00:00 2001 From: Piyush Patle Date: Wed, 20 May 2026 08:01:01 +0530 Subject: [PATCH 2/5] drivers/serial/16550: fix AM62x console bring-up Adjust the generic 16550 driver for the AM62x console path. Preserve the FIFO programming sequence needed by the TI UART, keep the bootloader owned early console state when requested, and drain the transmit buffer correctly when polling mode is enabled. Signed-off-by: Piyush Patle --- drivers/serial/uart_16550.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/serial/uart_16550.c b/drivers/serial/uart_16550.c index 176250a922f70..6278cab0728c2 100644 --- a/drivers/serial/uart_16550.c +++ b/drivers/serial/uart_16550.c @@ -807,11 +807,6 @@ static int u16550_setup(FAR struct uart_dev_s *dev) return -EPERM; } - /* Clear fifos */ - - u16550_serialout(priv, UART_FCR_OFFSET, - (UART_FCR_RXRST | UART_FCR_TXRST)); - /* Set up the IER */ priv->ier = u16550_serialin(priv, UART_IER_OFFSET); @@ -892,10 +887,16 @@ static int u16550_setup(FAR struct uart_dev_s *dev) /* Configure the FIFOs */ + /* Some 16550-compatible UARTs, including the AM62x console block, need + * FIFO enable, reset, and trigger configuration as separate writes. + */ + + u16550_serialout(priv, UART_FCR_OFFSET, UART_FCR_FIFOEN); + u16550_serialout(priv, UART_FCR_OFFSET, + UART_FCR_FIFOEN | UART_FCR_TXRST | UART_FCR_RXRST); u16550_serialout(priv, UART_FCR_OFFSET, - (priv->rxtrigger << UART_FCR_RXTRIGGER_SHIFT | - UART_FCR_TXRST | UART_FCR_RXRST | - UART_FCR_FIFOEN)); + UART_FCR_FIFOEN | + (priv->rxtrigger << UART_FCR_RXTRIGGER_SHIFT)); #ifdef CONFIG_16550_SET_MCR_OUT2 /* Set OUT2 bit in MCR register */ @@ -1616,7 +1617,14 @@ static void u16550_txint(struct uart_dev_s *dev, bool enable) #ifdef CONFIG_16550_POLLING /* In polling mode, we loop until the buffer is empty */ - uart_xmitchars(dev); + while (dev->xmit.head != dev->xmit.tail) + { + while (!u16550_txready(dev)) + { + } + + uart_xmitchars(dev); + } #else flags = enter_critical_section(); priv->ier |= UART_IER_ETBEI; @@ -1690,7 +1698,8 @@ void u16550_earlyserialinit(void) #ifdef CONSOLE_DEV CONSOLE_DEV.isconsole = true; -#ifndef CONFIG_16550_SUPRESS_INITIAL_CONFIG +#if !defined(CONFIG_16550_SUPRESS_INITIAL_CONFIG) && \ + !defined(CONFIG_16550_SUPRESS_CONFIG) u16550_setup(&CONSOLE_DEV); #endif #endif From 833eccef5e8074304c50d2922b7f50d59eabc56a Mon Sep 17 00:00:00 2001 From: Piyush Patle Date: Wed, 20 May 2026 08:01:01 +0530 Subject: [PATCH 3/5] arm64/am62x: add core boot and serial support Add the AM62x architecture support needed to boot NuttX on TI K3 AM62x platforms. This includes the chip integration, memory map, IRQ definitions, low-level console support, boot code, and the AM62x 16550 serial lower half. Signed-off-by: Piyush Patle --- arch/arm64/Kconfig | 22 +++ arch/arm64/include/am62x/chip.h | 107 +++++++++++ arch/arm64/include/am62x/irq.h | 105 +++++++++++ arch/arm64/src/am62x/CMakeLists.txt | 34 ++++ arch/arm64/src/am62x/Kconfig | 12 ++ arch/arm64/src/am62x/Make.defs | 39 ++++ arch/arm64/src/am62x/am62x_16550serial.c | 148 +++++++++++++++ arch/arm64/src/am62x/am62x_boot.c | 161 ++++++++++++++++ arch/arm64/src/am62x/am62x_boot.h | 85 +++++++++ arch/arm64/src/am62x/am62x_lowputc.S | 172 ++++++++++++++++++ arch/arm64/src/am62x/am62x_serial.h | 71 ++++++++ arch/arm64/src/am62x/chip.h | 48 +++++ .../src/am62x/hardware/am62x_memorymap.h | 117 ++++++++++++ arch/arm64/src/am62x/hardware/am62x_uart.h | 167 +++++++++++++++++ 14 files changed, 1288 insertions(+) create mode 100644 arch/arm64/include/am62x/chip.h create mode 100644 arch/arm64/include/am62x/irq.h create mode 100644 arch/arm64/src/am62x/CMakeLists.txt create mode 100644 arch/arm64/src/am62x/Kconfig create mode 100644 arch/arm64/src/am62x/Make.defs create mode 100644 arch/arm64/src/am62x/am62x_16550serial.c create mode 100644 arch/arm64/src/am62x/am62x_boot.c create mode 100644 arch/arm64/src/am62x/am62x_boot.h create mode 100644 arch/arm64/src/am62x/am62x_lowputc.S create mode 100644 arch/arm64/src/am62x/am62x_serial.h create mode 100644 arch/arm64/src/am62x/chip.h create mode 100644 arch/arm64/src/am62x/hardware/am62x_memorymap.h create mode 100644 arch/arm64/src/am62x/hardware/am62x_uart.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b67086be94372..2f0251ec54614 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -26,6 +26,23 @@ choice prompt "ARM64 chip selection" default ARCH_CHIP_QEMU +config ARCH_CHIP_AM62X + bool "TI AM62x" + select ARCH_CORTEX_A53 + select ARCH_HAVE_ADDRENV + select ARCH_HAVE_RESET + select ARCH_HAVE_IRQTRIGGER + select ARCH_NEED_ADDRENV_MAPPING + select ARCH_USE_MMU + select ARMV8A_HAVE_GICv3 + select ARM64_HAVE_PSCI + select ARCH_HAVE_IRQPRIO + select ARCH_HAVE_LOWPUTC + ---help--- + Texas Instruments AM62x family (AM6232, AM6252, AM6254). + Quad Cortex-A53 @ up to 1.4 GHz. Supported boards: + PocketBeagle 2, BeaglePlay. + config ARCH_CHIP_A64 bool "Allwinner A64" select ARCH_CORTEX_A53 @@ -362,6 +379,7 @@ config ARCH_FAMILY config ARCH_CHIP string + default "am62x" if ARCH_CHIP_AM62X default "a64" if ARCH_CHIP_A64 default "a527" if ARCH_CHIP_SUNXI_A527 default "rk3399" if ARCH_CHIP_RK3399 @@ -502,6 +520,10 @@ config ARM64_PA_BITS The choice could be: 32, 36, 42, 48 +if ARCH_CHIP_AM62X +source "arch/arm64/src/am62x/Kconfig" +endif + if ARCH_CHIP_A64 source "arch/arm64/src/a64/Kconfig" endif diff --git a/arch/arm64/include/am62x/chip.h b/arch/arm64/include/am62x/chip.h new file mode 100644 index 0000000000000..a4ac627f0ac64 --- /dev/null +++ b/arch/arm64/include/am62x/chip.h @@ -0,0 +1,107 @@ +/**************************************************************************** + * arch/arm64/include/am62x/chip.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* Reference: AM62x TRM (SPRSP43) §2.1 Memory Map §9.2 GIC-600 */ + +#ifndef __ARCH_ARM64_INCLUDE_AM62X_CHIP_H +#define __ARCH_ARM64_INCLUDE_AM62X_CHIP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Size macros used in assembly and C */ + +#define KB(x) ((x) << 10) +#define MB(x) (KB(x) << 10) +#define GB(x) (MB(UINT64_C(x)) << 10) + +/* GIC-600 addresses (TRM §9.2) ********************************************/ + +/* Distributor — one per system */ + +#define CONFIG_GICD_BASE 0x01800000 + +/* Redistributor — one 128 KB frame per Cortex-A53 core */ + +#define CONFIG_GICR_BASE 0x01880000 + +/* Stride between consecutive per-core redistributor frames (128 KB) */ + +#define CONFIG_GICR_OFFSET 0x20000 + +/* Extract cluster ID from MPIDR_EL1. + * AM62x has a single cluster (Aff1=0); mask off Aff0 (bits[7:0]). + */ + +#define MPID_TO_CLUSTER_ID(mpid) ((mpid) & ~0xffUL) + +/* NuttX load address — must match U-Boot kernel_addr_r and the linker + * script origin. 0x8200_0000 avoids U-Boot's reserved region at the + * bottom of DDR (0x8000_0000–0x81FF_FFFF). + */ + +#define CONFIG_LOAD_BASE 0x82000000 + +/* Memory map constants — used by am62x_boot.c MMU region table and by + * the common arm64 linker/boot code. These are NOT Kconfig symbols; + * they are chip-level C macros, following the same pattern as a64/chip.h. + * Board-specific DDR sizes are overridden in defconfig via CONFIG_RAM_SIZE + * (decimal bytes) — these macros describe the default mapped window. + */ + +/* DDR: 512 MB at 0x8000_0000 (common minimum for both boards) */ + +#define CONFIG_RAMBANK1_ADDR 0x80000000 +#define CONFIG_RAMBANK1_SIZE MB(512) + +/* Device I/O flat-map: all peripherals in the lower 2 GB */ + +#define CONFIG_DEVICEIO_BASEADDR 0x00000000 +#define CONFIG_DEVICEIO_SIZE GB(2) + +/**************************************************************************** + * Assembly Macros + ****************************************************************************/ + +#ifdef __ASSEMBLY__ + +/* get_cpu_id xreg0 + * + * Read current CPU ID from MPIDR_EL1 Aff0 field [7:0]. + * On AM62x the four A53 cores are numbered 0-3 in Aff0. + */ + +.macro get_cpu_id xreg0 + mrs \xreg0, mpidr_el1 + ubfx \xreg0, \xreg0, #0, #8 +.endm + +#endif /* __ASSEMBLY__ */ + +#endif /* __ARCH_ARM64_INCLUDE_AM62X_CHIP_H */ diff --git a/arch/arm64/include/am62x/irq.h b/arch/arm64/include/am62x/irq.h new file mode 100644 index 0000000000000..ca643a65f464c --- /dev/null +++ b/arch/arm64/include/am62x/irq.h @@ -0,0 +1,105 @@ +/**************************************************************************** + * arch/arm64/include/am62x/irq.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 + */ + +/* Reference: AM62x TRM (SPRSP43), Chapter 9 — Interrupt Architecture + * + * The AM62x GIC-600 supports: + * - 16 SGIs (Software Generated Interrupts) IRQ 0 – 15 + * - 16 PPIs (Private Peripheral Interrupts) IRQ 16 – 31 + * - 480 SPIs (Shared Peripheral Interrupts) IRQ 32 – 511 + * + * Total: 512 interrupt lines. + * + * All INTIDs listed here are INTID = GIC_SPI_number + 32. + * E.g. UART0 GIC_SPI 178 -> INTID 210. + */ + +#ifndef __ARCH_ARM64_INCLUDE_AM62X_IRQ_H +#define __ARCH_ARM64_INCLUDE_AM62X_IRQ_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Total number of interrupt IDs allocated in the GIC INTID space. + * NuttX arrays are sized to NR_IRQS entries, so set this to the maximum + * INTID we actually use + 1. 512 covers all AM62x SPIs. + */ + +#define NR_IRQS 512 + +/* SGI interrupts (per-core, software-generated) */ + +#define AM62X_IRQ_SGI0 0 +#define AM62X_IRQ_SGI1 1 +#define AM62X_IRQ_SGI2 2 +#define AM62X_IRQ_SGI3 3 +#define AM62X_IRQ_SGI4 4 +#define AM62X_IRQ_SGI5 5 +#define AM62X_IRQ_SGI6 6 +#define AM62X_IRQ_SGI7 7 +#define AM62X_IRQ_SGI8 8 +#define AM62X_IRQ_SGI9 9 +#define AM62X_IRQ_SGI10 10 +#define AM62X_IRQ_SGI11 11 +#define AM62X_IRQ_SGI12 12 +#define AM62X_IRQ_SGI13 13 +#define AM62X_IRQ_SGI14 14 +#define AM62X_IRQ_SGI15 15 + +/* PPI interrupts (per-core, private peripherals) + * + * Generic timer PPIs follow the architected GIC assignments: + * - Hypervisor timer PPI 10 -> INTID 26 + * - Virtual timer PPI 11 -> INTID 27 + * - Secure physical timer PPI 13 -> INTID 29 + * - Non-secure physical timer PPI 14 -> INTID 30 + */ + +#define AM62X_IRQ_PPI_HYPTIMER 26 /* Hypervisor timer */ +#define AM62X_IRQ_PPI_VTIMER 27 /* Virtual timer (EL1) */ +#define AM62X_IRQ_PPI_PTIMER 30 /* Physical timer NS EL1/EL0 */ +#define AM62X_IRQ_PPI_PTIMER_S 29 /* Physical timer secure EL3 */ +#define AM62X_IRQ_PPI_PTIMER_NS 30 /* Physical timer NS EL1/EL0 */ + +/* Main domain SPI interrupts (INTID = SPI_offset + 32). + * Source: AM62x TRM Table 9-17 (Interrupt Map). + */ + +/* UART (main domain, 16550-compatible) + * Source: Linux arch/arm64/boot/dts/ti/k3-am62.dtsi + * UART0 GIC_SPI 178 -> INTID 210, UART6 GIC_SPI 184 -> INTID 216 + */ + +#define AM62X_IRQ_UART0 210 /* GIC_SPI 178: UART0 main domain */ +#define AM62X_IRQ_UART1 211 /* GIC_SPI 179 */ +#define AM62X_IRQ_UART2 212 /* GIC_SPI 180 */ +#define AM62X_IRQ_UART3 213 /* GIC_SPI 181 */ +#define AM62X_IRQ_UART4 214 /* GIC_SPI 182 */ +#define AM62X_IRQ_UART5 215 /* GIC_SPI 183 */ +#define AM62X_IRQ_UART6 216 /* GIC_SPI 184 */ + +#endif /* __ARCH_ARM64_INCLUDE_AM62X_IRQ_H */ diff --git a/arch/arm64/src/am62x/CMakeLists.txt b/arch/arm64/src/am62x/CMakeLists.txt new file mode 100644 index 0000000000000..9ff3612e59449 --- /dev/null +++ b/arch/arm64/src/am62x/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# arch/arm64/src/am62x/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +# ############################################################################## + +# AM62x SoC sources that are always compiled + +list(APPEND SRCS am62x_boot.c am62x_16550serial.c) + +# Early UART assembly (needed for CONFIG_ARCH_EARLY_PRINT / semihosting console +# before the full serial driver is up) + +if(CONFIG_ARCH_EARLY_PRINT) + list(APPEND SRCS am62x_lowputc.S) +endif() + +target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm64/src/am62x/Kconfig b/arch/arm64/src/am62x/Kconfig new file mode 100644 index 0000000000000..3a0618e5a147f --- /dev/null +++ b/arch/arm64/src/am62x/Kconfig @@ -0,0 +1,12 @@ +# +# arch/arm64/src/am62x/Kconfig +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_CHIP_AM62X + +comment "AM62x peripheral selection is provided by board defconfig for now." + +endif # ARCH_CHIP_AM62X diff --git a/arch/arm64/src/am62x/Make.defs b/arch/arm64/src/am62x/Make.defs new file mode 100644 index 0000000000000..6f849b82ad41a --- /dev/null +++ b/arch/arm64/src/am62x/Make.defs @@ -0,0 +1,39 @@ +############################################################################ +# arch/arm64/src/am62x/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +############################################################################ + +# Pull in arch/arm64/src/common/Make.defs which contributes the shared +# AArch64 C and assembly sources (head.S, mmu, gic, arch_timer, etc.) + +include common/Make.defs + +# AM62x SoC-specific C sources (always compiled) + +CHIP_CSRCS = am62x_boot.c +CHIP_CSRCS += am62x_16550serial.c + +# Early UART assembly (only when CONFIG_ARCH_EARLY_PRINT is set, which +# is selected automatically when CONFIG_ARCH_HAVE_LOWPUTC is enabled +# and the common arch layer needs early console output). + +ifeq ($(CONFIG_ARCH_EARLY_PRINT),y) +CHIP_ASRCS = am62x_lowputc.S +endif diff --git a/arch/arm64/src/am62x/am62x_16550serial.c b/arch/arm64/src/am62x/am62x_16550serial.c new file mode 100644 index 0000000000000..f2e79e60a8e43 --- /dev/null +++ b/arch/arm64/src/am62x/am62x_16550serial.c @@ -0,0 +1,148 @@ +/**************************************************************************** + * arch/arm64/src/am62x/am62x_16550serial.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 + +#ifdef CONFIG_16550_UART + +#include +#include +#include + +#include "arm64_arch.h" +#include "arm64_internal.h" + +/* TI AM62x-specific register byte offsets and bits not in uart_16550.h */ + +#define AM62X_UART_IER_OFF 0x04 /* IER byte offset */ +#define AM62X_UART_FCR_OFF 0x08 /* FCR byte offset */ +#define AM62X_UART_LSR_OFF 0x14 /* LSR byte offset */ +#define AM62X_UART_EFR2_OFF 0x8c /* EFR2 byte offset (K3 extension) */ + +/* K3 Errata i2310: resets RX timeout counter on each FIFO read */ + +#define AM62X_EFR2_TIMEOUT_BEHAVE (1 << 6) + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* Wait for the TX FIFO to drain completely before touching FCR. + * Called before am62x_uart_hw_init to ensure TXRST doesn't discard + * characters that are still in the FIFO (e.g. debug prints from boot). + */ + +static void am62x_uart_drain_tx(uintptr_t base) +{ + int tries = 1000000; + + while (tries-- > 0 && + !(getreg32(base + AM62X_UART_LSR_OFF) & UART_LSR_TEMT)) + { + } +} + +/* TI AM62x-specific UART hardware initialisation. + * + * 1. TX drain: wait for TX shift register empty (TEMT) so TXRST does not + * discard characters still in flight. + * 2. FCR 3-step: TI K3 UARTs require FIFOEN asserted first, then + * RXRST|TXRST, then the desired trigger level. The generic 16550 + * sequence (RXRST|TXRST without FIFOEN) disables the FIFO on TI + * hardware. + * 3. RX trigger = 0 (1-char): RDA fires on every received byte, keeping + * the FIFO empty and preventing the spurious CTI path (K3 i2310). + * 4. EFR2 TIMEOUT_BEHAVE (bit 6, offset 0x8c): resets the RX timeout + * counter each time data is read from the FIFO, so a post-drain CTI + * never fires with an empty FIFO. + * + * MDR1 is intentionally not touched -- U-Boot has already placed the UART + * in 16x mode and writing MDR1 causes THRE to read 0 for several µs. + */ + +static void am62x_uart_hw_init(uintptr_t base) +{ + am62x_uart_drain_tx(base); + + putreg32(UART_FCR_FIFOEN, + base + AM62X_UART_FCR_OFF); + + putreg32(UART_FCR_FIFOEN | UART_FCR_RXRST | UART_FCR_TXRST, + base + AM62X_UART_FCR_OFF); + + putreg32(UART_FCR_FIFOEN | UART_FCR_RXTRIGGER_1, + base + AM62X_UART_FCR_OFF); + + /* Keep the UART quiet until the full 16550 driver attaches later in + * up_initialize(). U-Boot can leave UART6 interrupt sources armed on + * PocketBeagle2, which causes an immediate trap as soon as NuttX enables + * global interrupts in irq_initialize(). + */ + + putreg32(0, base + AM62X_UART_IER_OFF); + putreg32(AM62X_EFR2_TIMEOUT_BEHAVE, base + AM62X_UART_EFR2_OFF); +} + +static void am62x_uartirq_setup(void) +{ +#ifdef CONFIG_16550_UART0 +# ifdef CONFIG_ARCH_IRQPRIO + (void)up_prioritize_irq(CONFIG_16550_UART0_IRQ, 0); +# endif + +# ifdef CONFIG_ARCH_HAVE_IRQTRIGGER + /* TI's AM62 main-domain UARTs are level-high SPIs in the upstream + * device tree. PocketBeagle2 uses UART6 (GIC_SPI 184 -> INTID 216). + */ + + (void)up_set_irq_type(CONFIG_16550_UART0_IRQ, IRQ_HIGH_LEVEL); +# endif +#endif +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void arm64_earlyserialinit(void) +{ + /* U-Boot already leaves the AM62x console UART configured at 115200 8N1. + * Keep that early console state intact until /dev/console is opened, but + * apply the TI-specific FIFO sequence and timeout behavior immediately so + * interactive input is safe as soon as the full 16550 driver takes over. + */ + + am62x_uart_hw_init(CONFIG_16550_UART0_BASE); + u16550_earlyserialinit(); +} + +void arm64_serialinit(void) +{ + am62x_uartirq_setup(); + u16550_serialinit(); +} + +#endif /* CONFIG_16550_UART */ diff --git a/arch/arm64/src/am62x/am62x_boot.c b/arch/arm64/src/am62x/am62x_boot.c new file mode 100644 index 0000000000000..987b5f95e6d44 --- /dev/null +++ b/arch/arm64/src/am62x/am62x_boot.c @@ -0,0 +1,161 @@ +/**************************************************************************** + * arch/arm64/src/am62x/am62x_boot.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 + +#include +#include +#include + +#include + +#include + +#ifdef CONFIG_SMP +# include "arm64_smp.h" +#endif + +#include "arm64_arch.h" +#include "arm64_internal.h" +#include "arm64_mmu.h" +#include "am62x_boot.h" +#include "am62x_serial.h" + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* MMU region table. + * + * Two flat-mapped regions are required: + * + * 1. DEVICE_REGION — peripheral space 0x0000_0000 – 0x7FFF_FFFF. + * Mapped as device-nGnRnE, read-write, secure. This covers UART, GIC, + * GPIO, I2C, SPI, USB, MMC, etc. in one shot without needing to list + * each peripheral separately. + * + * 2. DRAM0_S0 — the main DDR window starting at 0x8000_0000. + * Mapped as normal cacheable memory, read-write, secure. + * Size comes from CONFIG_RAMBANK1_SIZE (512 MB for PocketBeagle 2). + * + * Both addresses and sizes must be page-aligned (4 KB minimum). + */ + +static const struct arm_mmu_region g_mmu_regions[] = +{ + MMU_REGION_FLAT_ENTRY("DEVICE_REGION", + CONFIG_DEVICEIO_BASEADDR, + CONFIG_DEVICEIO_SIZE, + MT_DEVICE_NGNRNE | MT_RW | MT_SECURE), + + MMU_REGION_FLAT_ENTRY("DRAM0_S0", + CONFIG_RAMBANK1_ADDR, + CONFIG_RAMBANK1_SIZE, + 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: + * Called from arm64_head.S at EL2 or EL3 (whichever is the entry EL) + * before dropping to EL1. Use this hook for: + * - Early platform-level hardware that must be touched at high EL. + * - Hypervisor / secure monitor initialisation. + * + * On AM62x the TI R5 SYSFW (TIFS) runs in the MCU domain and has already + * completed secure world setup before releasing the Cortex-A53 cluster. + * U-Boot then sets up DDR, clocks, and UART before loading NuttX. + * There is nothing left for us to do at EL2/EL3. + * + ****************************************************************************/ + +void arm64_el_init(void) +{ + /* Nothing to do — SYSFW and U-Boot have completed all high-EL init. */ +} + +/**************************************************************************** + * Name: arm64_chip_boot + * + * Description: + * Called from arm64_boot.c (common layer) after the C runtime is ready. + * This is the SoC-level continuation of the boot sequence: + * 1. Initialise the MMU with the region table above. + * 2. Optionally initialise PSCI for SMP bring-up. + * 3. Call the board-specific initialisation hook. + * 4. Initialise the early serial console so boot messages work. + * + ****************************************************************************/ + +void arm64_chip_boot(void) +{ +#ifdef CONFIG_ARCH_USE_MMU + arm64_mmu_init(true); +#endif + +#if defined(CONFIG_ARM64_PSCI) && defined(CONFIG_SMP) + /* Keep PSCI out of the initial UP bring-up path until the basic + * boot-to-NSH flow is stable on AM62x. PSCI is still available for + * future SMP enablement. + */ + + arm64_psci_init("smc"); +#endif + + am62x_board_initialize(); + +#ifdef USE_EARLYSERIALINIT + arm64_earlyserialinit(); +#endif +} + +/**************************************************************************** + * Name: arm64_netinitialize (stub) + * + * Description: + * Network device initialisation hook called by the common layer when + * CONFIG_NET is enabled and CONFIG_NETDEV_LATEINIT is not set. + * Ethernet support is not part of the initial port. + * + ****************************************************************************/ + +#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) +void arm64_netinitialize(void) +{ + /* TODO: add CPSW / MDIO Ethernet support in a later phase. */ +} +#endif diff --git a/arch/arm64/src/am62x/am62x_boot.h b/arch/arm64/src/am62x/am62x_boot.h new file mode 100644 index 0000000000000..ba5291878cfcd --- /dev/null +++ b/arch/arm64/src/am62x/am62x_boot.h @@ -0,0 +1,85 @@ +/**************************************************************************** + * arch/arm64/src/am62x/am62x_boot.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_AM62X_AM62X_BOOT_H +#define __ARCH_ARM64_SRC_AM62X_AM62X_BOOT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include "arm64_internal.h" +#include "arm64_arch.h" + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Name: am62x_board_initialize + * + * Description: + * Board-specific initialization called from am62x_boot.c after the MMU + * and common peripherals are set up. Board code in + * boards/arm64/am62x//src/ provides this function. + * + ****************************************************************************/ + +void am62x_board_initialize(void); + +/**************************************************************************** + * Name: am62x_memory_initialize + * + * Description: + * Called very early, before .bss is zeroed or .data is copied, to + * perform any board-level memory initialization (e.g. DRAM training). + * For boards where U-Boot already initialises DRAM this is a no-op. + * + ****************************************************************************/ + +void am62x_memory_initialize(void); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM64_SRC_AM62X_AM62X_BOOT_H */ diff --git a/arch/arm64/src/am62x/am62x_lowputc.S b/arch/arm64/src/am62x/am62x_lowputc.S new file mode 100644 index 0000000000000..7587b0ab88dca --- /dev/null +++ b/arch/arm64/src/am62x/am62x_lowputc.S @@ -0,0 +1,172 @@ +/**************************************************************************** + * arch/arm64/src/am62x/am62x_lowputc.S + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 + * Low-level UART output for TI AM62x, used before the C serial driver + * is initialised (CONFIG_ARCH_EARLY_PRINT path). + * + * The AM62x console UART is a 16550-compatible peripheral. The base + * address is selected at build time either by the generic 16550 console + * configuration or by the legacy AM62X UART selection. U-Boot + * configures it at 115200-8N1 before handing off to NuttX, so + * arm64_earlyprintinit is a no-op — we simply inherit U-Boot's config. + * + * Register usage in arm64_lowputc follows the AAPCS64 ABI: + * x0 — character to transmit (caller-provided, preserved across call) + * x15 — UART base address (scratch, callee-save not required for leaf) + * w2 — LSR value (scratch) + * + * All other callee-saved registers are untouched because arm64_lowputc + * is a leaf function. + * + ***************************************************************************/ + +#include +#include "arm64_macro.inc" + +/**************************************************************************** + * Public Symbols + ****************************************************************************/ + + .file "am62x_lowputc.S" + +/**************************************************************************** + * Assembly Macros + ****************************************************************************/ + +/* Console UART base address. + * + * Prefer the configured serial console device. Fall back to enabled UARTs + * only if no *_SERIAL_CONSOLE option is set. + */ + +#if defined(CONFIG_16550_UART0_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE CONFIG_16550_UART0_BASE +#elif defined(CONFIG_UART6_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE 0x02860000 +#elif defined(CONFIG_UART5_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE 0x02850000 +#elif defined(CONFIG_UART4_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE 0x02840000 +#elif defined(CONFIG_UART3_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE 0x02830000 +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE 0x02820000 +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE 0x02810000 +#elif defined(CONFIG_UART0_SERIAL_CONSOLE) +# define CONSOLE_UART_BASE 0x02800000 +#elif defined(CONFIG_AM62X_UART6) +# define CONSOLE_UART_BASE 0x02860000 +#elif defined(CONFIG_AM62X_UART5) +# define CONSOLE_UART_BASE 0x02850000 +#elif defined(CONFIG_AM62X_UART4) +# define CONSOLE_UART_BASE 0x02840000 +#elif defined(CONFIG_AM62X_UART3) +# define CONSOLE_UART_BASE 0x02830000 +#elif defined(CONFIG_AM62X_UART2) +# define CONSOLE_UART_BASE 0x02820000 +#elif defined(CONFIG_AM62X_UART1) +# define CONSOLE_UART_BASE 0x02810000 +#else +# define CONSOLE_UART_BASE 0x02800000 /* Default: UART0 */ +#endif + +/* 16550 register offsets */ + +#define UART_THR_OFF 0x00 /* Transmit Holding Register */ +#define UART_LSR_OFF 0x14 /* Line Status Register */ +#define UART_LSR_THRE (1 << 5)/* TX Holding Register Empty bit */ + +/**************************************************************************** + * Private Macros + ****************************************************************************/ + +/* early_uart_ready xb, wt + * Spin until the TX holding register is empty. + * xb — register holding the UART base address + * wt — scratch word register for LSR read + */ + +.macro early_uart_ready xb, wt +1: + ldr \wt, [\xb, #UART_LSR_OFF] /* Read LSR */ + tst \wt, #UART_LSR_THRE /* Test THRE bit */ + b.eq 1b /* Loop while THRE == 0 */ +.endm + +/* early_uart_transmit xb, wt + * Write one byte to the THR. + * xb — register holding the UART base address + * wt — word register containing the byte to transmit + */ + +.macro early_uart_transmit xb, wt + strb \wt, [\xb, #UART_THR_OFF] /* Write byte to THR */ +.endm + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: arm64_earlyprintinit + * + * Description: + * Hardware-specific UART initialisation for early print. + * On AM62x, U-Boot has already configured UART0 (clocks, baud rate, + * pin mux) before the image is loaded. Nothing to do here. + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +GTEXT(arm64_earlyprintinit) +SECTION_FUNC(text, arm64_earlyprintinit) + ret /* U-Boot already initialised UART */ + +/**************************************************************************** + * Name: arm64_lowputc + * + * Description: + * Output one character to UART0 by polling the LSR THRE bit. + * This function is safe to call before the MMU is enabled (flat map) + * and before the C runtime is up. + * + * Input Parameters: + * x0 - character to transmit + * + * Returned Value: + * None + * + ****************************************************************************/ + +GTEXT(arm64_lowputc) +SECTION_FUNC(text, arm64_lowputc) + ldr x15, =CONSOLE_UART_BASE /* Load console UART base into x15 */ + early_uart_ready x15, w2 /* Wait for TX holding reg empty */ + early_uart_transmit x15, w0 /* Write character */ + ret diff --git a/arch/arm64/src/am62x/am62x_serial.h b/arch/arm64/src/am62x/am62x_serial.h new file mode 100644 index 0000000000000..dccefb1d372a2 --- /dev/null +++ b/arch/arm64/src/am62x/am62x_serial.h @@ -0,0 +1,71 @@ +/**************************************************************************** + * arch/arm64/src/am62x/am62x_serial.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_AM62X_AM62X_SERIAL_H +#define __ARCH_ARM64_SRC_AM62X_AM62X_SERIAL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include "arm64_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* IRQ numbers for the main-domain UARTs are defined in + * arch/arm64/include/am62x/irq.h (AM62X_IRQ_UARTx) and in + * hardware/am62x_uart.h (AM62X_UARTx_IRQ). No re-definition needed here. + */ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/* Called from am62x_boot.c / USE_EARLYSERIALINIT path */ + +void arm64_earlyserialinit(void); + +/* Called from arm64_initialize (common layer, up_initialize) */ + +void arm64_serialinit(void); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM64_SRC_AM62X_AM62X_SERIAL_H */ diff --git a/arch/arm64/src/am62x/chip.h b/arch/arm64/src/am62x/chip.h new file mode 100644 index 0000000000000..5f9c0b404115c --- /dev/null +++ b/arch/arm64/src/am62x/chip.h @@ -0,0 +1,48 @@ +/**************************************************************************** + * arch/arm64/src/am62x/chip.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_AM62X_CHIP_H +#define __ARCH_ARM64_SRC_AM62X_CHIP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#ifndef __ASSEMBLY__ +# include +#endif + +/* All GIC addresses and memory-map constants live in the include-layer + * chip.h (arch/arm64/include/am62x/chip.h) which is pulled in via + * . Nothing extra needed here. + * + * The hardware register headers are in hardware/ and are included + * directly by the driver files that need them. + */ + +/* Number of GIC SPI target registers for AM62x (480 SPIs / 32 = 15) */ + +#define CONFIG_NUM_GIC_ITARGETS_REGS 15 + +#endif /* __ARCH_ARM64_SRC_AM62X_CHIP_H */ diff --git a/arch/arm64/src/am62x/hardware/am62x_memorymap.h b/arch/arm64/src/am62x/hardware/am62x_memorymap.h new file mode 100644 index 0000000000000..4ff25cd3a8c42 --- /dev/null +++ b/arch/arm64/src/am62x/hardware/am62x_memorymap.h @@ -0,0 +1,117 @@ +/**************************************************************************** + * arch/arm64/src/am62x/hardware/am62x_memorymap.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* Reference: AM62x TRM (SPRSP43), Chapter 2 - Memory Map */ + +#ifndef __ARCH_ARM64_SRC_AM62X_HARDWARE_AM62X_MEMORYMAP_H +#define __ARCH_ARM64_SRC_AM62X_HARDWARE_AM62X_MEMORYMAP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Main Domain Peripheral Base Addresses (TRM §2.1) ************************/ + +/* UART (16550-compatible, main domain) */ + +#define AM62X_UART0_BASE 0x02800000ul /* UART0 main domain console */ +#define AM62X_UART1_BASE 0x02810000ul +#define AM62X_UART2_BASE 0x02820000ul +#define AM62X_UART3_BASE 0x02830000ul +#define AM62X_UART4_BASE 0x02840000ul +#define AM62X_UART5_BASE 0x02850000ul +#define AM62X_UART6_BASE 0x02860000ul + +/* MCU Domain UART (used by R5 firmware, do not use from A53 without care) */ + +#define AM62X_MCU_UART0_BASE 0x04a00000ul + +/* GIC-600 (TRM §9.2) */ + +#define AM62X_GIC_BASE 0x01800000ul /* GIC top-level */ +#define AM62X_GICD_BASE 0x01800000ul /* Distributor */ +#define AM62X_GICR_BASE 0x01880000ul /* Redistributor (4 cores) */ +#define AM62X_GICR_STRIDE 0x00020000ul /* Per-core stride */ + +/* Timers */ + +#define AM62X_DMTIMER0_BASE 0x2400000ul +#define AM62X_DMTIMER1_BASE 0x2410000ul +#define AM62X_DMTIMER2_BASE 0x2420000ul +#define AM62X_DMTIMER3_BASE 0x2430000ul + +/* GPIO */ + +#define AM62X_GPIO0_BASE 0x00600000ul +#define AM62X_GPIO1_BASE 0x00601000ul + +/* I2C */ + +#define AM62X_I2C0_BASE 0x20000000ul +#define AM62X_I2C1_BASE 0x20010000ul +#define AM62X_I2C2_BASE 0x20020000ul +#define AM62X_I2C3_BASE 0x20030000ul + +/* SPI (McSPI) */ + +#define AM62X_SPI0_BASE 0x20100000ul +#define AM62X_SPI1_BASE 0x20110000ul +#define AM62X_SPI2_BASE 0x20120000ul + +/* USB */ + +#define AM62X_USB0_BASE 0x31100000ul +#define AM62X_USB1_BASE 0x31200000ul + +/* MMC/SD */ + +#define AM62X_MMCSD0_BASE 0xfa10000ul +#define AM62X_MMCSD1_BASE 0xfa00000ul +#define AM62X_MMCSD2_BASE 0xfa20000ul + +/* Watchdog */ + +#define AM62X_WDT0_BASE 0x23100000ul +#define AM62X_WDT1_BASE 0x23110000ul + +/* CTRL_MMR (Pad config / system control) */ + +#define AM62X_CTRLMMR_BASE 0x000f0000ul +#define AM62X_PADCFG_BASE 0x000f0000ul + +/* DDR Base (512 MB on PocketBeagle 2 / BeaglePlay) */ + +#define AM62X_DDR_BASE 0x80000000ul +#define AM62X_DDR_SIZE 0x20000000ul /* 512 MB */ + +/* Device I/O region for MMU flat mapping */ + +#define AM62X_DEVICEIO_BASE 0x00000000ul +#define AM62X_DEVICEIO_SIZE 0x80000000ul /* Peripheral space below DDR */ + +#endif /* __ARCH_ARM64_SRC_AM62X_HARDWARE_AM62X_MEMORYMAP_H */ diff --git a/arch/arm64/src/am62x/hardware/am62x_uart.h b/arch/arm64/src/am62x/hardware/am62x_uart.h new file mode 100644 index 0000000000000..1c022affdd237 --- /dev/null +++ b/arch/arm64/src/am62x/hardware/am62x_uart.h @@ -0,0 +1,167 @@ +/**************************************************************************** + * arch/arm64/src/am62x/hardware/am62x_uart.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* Reference: AM62x TRM (SPRSP43), Chapter 12 - UART. + * The AM62x UART is a 16550-compatible peripheral with TI K3 extensions. + * Register layout matches the industry-standard 16550 at offsets + * 0x00-0x1c. TI-specific registers begin at 0x20 (MDR1) and beyond. + */ + +#ifndef __ARCH_ARM64_SRC_AM62X_HARDWARE_AM62X_UART_H +#define __ARCH_ARM64_SRC_AM62X_HARDWARE_AM62X_UART_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* UART register offsets (standard 16550 layout) ****************************/ + +#define UART_RHR_OFFSET 0x00 /* Receiver Holding Register (read) */ +#define UART_THR_OFFSET 0x00 /* Transmitter Holding Register (wr) */ +#define UART_IER_OFFSET 0x04 /* Interrupt Enable Register */ +#define UART_IIR_OFFSET 0x08 /* Interrupt Identification Reg (rd) */ +#define UART_FCR_OFFSET 0x08 /* FIFO Control Register (write) */ +#define UART_EFR_OFFSET 0x08 /* Enhanced Feature Register (Mode B)*/ +#define UART_LCR_OFFSET 0x0c /* Line Control Register */ +#define UART_MCR_OFFSET 0x10 /* Modem Control Register */ +#define UART_LSR_OFFSET 0x14 /* Line Status Register */ +#define UART_MSR_OFFSET 0x18 /* Modem Status Register */ +#define UART_DLL_OFFSET 0x00 /* Divisor Latch Low (LCR[7]=1) */ +#define UART_DLH_OFFSET 0x04 /* Divisor Latch High (LCR[7]=1) */ + +/* UART register offsets (TI-specific extensions) ***************************/ + +#define UART_MDR1_OFFSET 0x20 /* Mode Definition Register 1 */ +#define UART_SYSC_OFFSET 0x54 /* System Configuration Register */ +#define UART_SYSS_OFFSET 0x58 /* System Status Register */ +#define UART_RFL_OFFSET 0x64 /* RX FIFO level register */ +#define UART_EFR2_OFFSET 0x8c /* Enhanced Feature Register 2 (K3) */ +#define UART_TO_L_OFFSET 0x98 /* RX timeout low register (K3) */ +#define UART_TO_H_OFFSET 0x9c /* RX timeout high register (K3) */ + +/* IER bits *****************************************************************/ + +#define UART_IER_RHR (1 << 0) /* RX data available + CTI */ +#define UART_IER_THR (1 << 1) /* TX holding register empty */ +#define UART_IER_LINE (1 << 2) /* Receiver line status */ +#define UART_IER_MODEM (1 << 3) /* Modem status */ + +/* IIR bits (read) **********************************************************/ + +#define UART_IIR_PENDING (1 << 0) /* 1 = no interrupt pending */ +#define UART_IIR_ID_MASK 0x3e /* Interrupt ID bits [5:1] */ +#define UART_IIR_ID_RLS 0x06 /* Receiver line status */ +#define UART_IIR_ID_RDA 0x04 /* Received data available */ +#define UART_IIR_ID_CTI 0x0c /* Character timeout indication */ +#define UART_IIR_ID_THRE 0x02 /* THR empty */ +#define UART_IIR_ID_MSR 0x00 /* Modem status */ + +/* FCR bits *****************************************************************/ + +#define UART_FCR_FIFOEN (1 << 0) /* Enable TX/RX FIFOs */ +#define UART_FCR_RXRST (1 << 1) /* Reset RX FIFO */ +#define UART_FCR_TXRST (1 << 2) /* Reset TX FIFO */ +#define UART_FCR_TXTRIG_SHIFT 4 +#define UART_FCR_RXTRIG_SHIFT 6 +#define UART_FCR_TXTRIG(n) (((n) & 3) << UART_FCR_TXTRIG_SHIFT) +#define UART_FCR_RXTRIG(n) (((n) & 3) << UART_FCR_RXTRIG_SHIFT) + +/* LCR bits *****************************************************************/ + +#define UART_LCR_WLS_5 0x00 /* 5-bit word length */ +#define UART_LCR_WLS_6 0x01 /* 6-bit word length */ +#define UART_LCR_WLS_7 0x02 /* 7-bit word length */ +#define UART_LCR_WLS_8 0x03 /* 8-bit word length */ +#define UART_LCR_STB (1 << 2) /* 2 stop bits */ +#define UART_LCR_PEN (1 << 3) /* Parity enable */ +#define UART_LCR_EPS (1 << 4) /* Even parity select */ +#define UART_LCR_BRK (1 << 6) /* Break control */ +#define UART_LCR_CONFIG_MODE_A 0x80 /* TI config mode A (DLAB=1) */ +#define UART_LCR_CONFIG_MODE_B 0xbf /* TI config mode B (EFR access) */ + +/* MCR bits *****************************************************************/ + +#define UART_MCR_DTR (1 << 0) /* Data terminal ready */ +#define UART_MCR_RTS (1 << 1) /* Request to send */ +#define UART_MCR_OUT2 (1 << 3) /* IRQ output enable (OUT2) */ + +/* LSR bits *****************************************************************/ + +#define UART_LSR_DR (1 << 0) /* Data ready in RX FIFO */ +#define UART_LSR_OE (1 << 1) /* Overrun error */ +#define UART_LSR_PE (1 << 2) /* Parity error */ +#define UART_LSR_FE (1 << 3) /* Framing error */ +#define UART_LSR_BI (1 << 4) /* Break interrupt */ +#define UART_LSR_THRE (1 << 5) /* TX holding register empty */ +#define UART_LSR_TEMT (1 << 6) /* TX shift register empty */ +#define UART_LSR_RXFE (1 << 7) /* RX FIFO error */ + +/* EFR bits *****************************************************************/ + +#define UART_EFR_ENHANCEDEN (1 << 4) /* Enable enhanced functions */ + +/* EFR2 bits (K3-specific) **************************************************/ + +/* K3 Errata i2310: set this bit to allow clearing a spurious CTI that + * fires with an empty RX FIFO. The bit changes how the timeout counter + * resets; momentarily asserting it together with a max timeout value and + * reading IIR deasserts the stuck interrupt. + */ + +#define UART_EFR2_TIMEOUT_BEHAVE (1 << 6) + +/* MDR1 bits ****************************************************************/ + +#define UART_MDR1_MODE_16X 0x00 /* UART 16x mode (normal) */ +#define UART_MDR1_MODE_DISABLE 0x07 /* Disable UART */ + +/* SYSC bits ****************************************************************/ + +#define UART_SYSC_SOFTRESET (1 << 1) /* Software reset */ +#define UART_SYSC_IDLEMODE_NO (1 << 3) /* No-idle mode */ + +/* SYSS bits ****************************************************************/ + +#define UART_SYSS_RESETDONE (1 << 0) /* Reset complete */ + +/* UART functional clock. + * AM62x UART is clocked from HSDIV4_CLKOUT1, configured by TIFS to 48 MHz. + * Reference: AM62x TRM section 12.3.1 and TIFS documentation. + */ + +#define AM62X_UART_SCLK 48000000ul + +/* UART IRQ numbers (raw GIC INTIDs = GIC_SPI_number + 32). + * Source: Linux kernel arch/arm64/boot/dts/ti/k3-am62.dtsi. + * UART0 → GIC_SPI 178 → INTID 210 + * UART6 → GIC_SPI 184 → INTID 216 + */ + +#define AM62X_UART0_IRQ 210 /* GIC_SPI 178 */ +#define AM62X_UART1_IRQ 211 /* GIC_SPI 179 */ +#define AM62X_UART2_IRQ 212 /* GIC_SPI 180 */ +#define AM62X_UART3_IRQ 213 /* GIC_SPI 181 */ +#define AM62X_UART4_IRQ 214 /* GIC_SPI 182 */ +#define AM62X_UART5_IRQ 215 /* GIC_SPI 183 */ +#define AM62X_UART6_IRQ 216 /* GIC_SPI 184 */ + +#endif /* __ARCH_ARM64_SRC_AM62X_HARDWARE_AM62X_UART_H */ From b95f4eafbfb2bbc54d6fd289a412163f72aab918 Mon Sep 17 00:00:00 2001 From: Piyush Patle Date: Wed, 20 May 2026 08:01:01 +0530 Subject: [PATCH 4/5] boards/arm64/am62x: add BeaglePlay and PocketBeagle2 Add initial board support for BeaglePlay and PocketBeagle2, including defconfigs, linker scripts, board initialization, procfs bring-up, and LED stubs. BeaglePlay provides the validated runtime target for this bring-up series. Signed-off-by: Piyush Patle --- boards/Kconfig | 26 +++ boards/arm64/am62x/beagleplay/CMakeLists.txt | 23 ++ boards/arm64/am62x/beagleplay/Kconfig | 9 + .../am62x/beagleplay/configs/nsh/defconfig | 63 ++++++ .../am62x/beagleplay/configs/ostest/defconfig | 60 ++++++ boards/arm64/am62x/beagleplay/include/board.h | 76 +++++++ .../beagleplay/include/board_memorymap.h | 30 +++ .../arm64/am62x/beagleplay/scripts/Make.defs | 44 ++++ .../am62x/beagleplay/scripts/dramboot.ld | 96 +++++++++ .../arm64/am62x/beagleplay/src/CMakeLists.txt | 29 +++ boards/arm64/am62x/beagleplay/src/Makefile | 35 +++ .../arm64/am62x/beagleplay/src/beagleplay.h | 80 +++++++ .../beagleplay/src/beagleplay_autoleds.c | 82 +++++++ .../beagleplay/src/beagleplay_boardinit.c | 94 ++++++++ .../am62x/beagleplay/src/beagleplay_bringup.c | 77 +++++++ .../arm64/am62x/pocketbeagle2/CMakeLists.txt | 23 ++ boards/arm64/am62x/pocketbeagle2/Kconfig | 12 ++ .../am62x/pocketbeagle2/configs/nsh/defconfig | 65 ++++++ .../pocketbeagle2/configs/ostest/defconfig | 60 ++++++ .../arm64/am62x/pocketbeagle2/include/board.h | 97 +++++++++ .../pocketbeagle2/include/board_memorymap.h | 60 ++++++ .../am62x/pocketbeagle2/scripts/Make.defs | 44 ++++ .../am62x/pocketbeagle2/scripts/dramboot.ld | 202 ++++++++++++++++++ .../am62x/pocketbeagle2/scripts/uEnv.txt | 10 + .../am62x/pocketbeagle2/src/CMakeLists.txt | 29 +++ boards/arm64/am62x/pocketbeagle2/src/Makefile | 35 +++ .../am62x/pocketbeagle2/src/pocketbeagle2.h | 80 +++++++ .../src/pocketbeagle2_autoleds.c | 82 +++++++ .../src/pocketbeagle2_boardinit.c | 94 ++++++++ .../pocketbeagle2/src/pocketbeagle2_bringup.c | 86 ++++++++ 30 files changed, 1803 insertions(+) create mode 100644 boards/arm64/am62x/beagleplay/CMakeLists.txt create mode 100644 boards/arm64/am62x/beagleplay/Kconfig create mode 100644 boards/arm64/am62x/beagleplay/configs/nsh/defconfig create mode 100644 boards/arm64/am62x/beagleplay/configs/ostest/defconfig create mode 100644 boards/arm64/am62x/beagleplay/include/board.h create mode 100644 boards/arm64/am62x/beagleplay/include/board_memorymap.h create mode 100644 boards/arm64/am62x/beagleplay/scripts/Make.defs create mode 100644 boards/arm64/am62x/beagleplay/scripts/dramboot.ld create mode 100644 boards/arm64/am62x/beagleplay/src/CMakeLists.txt create mode 100644 boards/arm64/am62x/beagleplay/src/Makefile create mode 100644 boards/arm64/am62x/beagleplay/src/beagleplay.h create mode 100644 boards/arm64/am62x/beagleplay/src/beagleplay_autoleds.c create mode 100644 boards/arm64/am62x/beagleplay/src/beagleplay_boardinit.c create mode 100644 boards/arm64/am62x/beagleplay/src/beagleplay_bringup.c create mode 100644 boards/arm64/am62x/pocketbeagle2/CMakeLists.txt create mode 100644 boards/arm64/am62x/pocketbeagle2/Kconfig create mode 100644 boards/arm64/am62x/pocketbeagle2/configs/nsh/defconfig create mode 100644 boards/arm64/am62x/pocketbeagle2/configs/ostest/defconfig create mode 100644 boards/arm64/am62x/pocketbeagle2/include/board.h create mode 100644 boards/arm64/am62x/pocketbeagle2/include/board_memorymap.h create mode 100644 boards/arm64/am62x/pocketbeagle2/scripts/Make.defs create mode 100644 boards/arm64/am62x/pocketbeagle2/scripts/dramboot.ld create mode 100644 boards/arm64/am62x/pocketbeagle2/scripts/uEnv.txt create mode 100644 boards/arm64/am62x/pocketbeagle2/src/CMakeLists.txt create mode 100644 boards/arm64/am62x/pocketbeagle2/src/Makefile create mode 100644 boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2.h create mode 100644 boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_autoleds.c create mode 100644 boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_boardinit.c create mode 100644 boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_bringup.c diff --git a/boards/Kconfig b/boards/Kconfig index 65d6d76cc970d..7e89c45aa18f0 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -2495,6 +2495,24 @@ config ARCH_BOARD_PINEPHONE This options selects support for NuttX on PINE64 PinePhone based on Allwinner A64 SoC with ARM Cortex-A53. +config ARCH_BOARD_POCKETBEAGLE2 + bool "BeagleBoard.org PocketBeagle 2" + depends on ARCH_CHIP_AM62X + select ARCH_HAVE_LEDS + ---help--- + BeagleBoard.org PocketBeagle 2 based on TI AM6254 SoC. + Quad Cortex-A53, 512 MB DDR4, USB-UART console on UART0. + https://docs.beagleboard.org/boards/pocketbeagle-2/ + +config ARCH_BOARD_BEAGLEPLAY + bool "BeagleBoard.org BeaglePlay" + depends on ARCH_CHIP_AM62X + select ARCH_HAVE_LEDS + ---help--- + BeagleBoard.org BeaglePlay based on TI AM6254 SoC. + Quad Cortex-A53, 2 GB LPDDR4, GbE, WiFi/BT, mikro-BUS. + https://docs.beagleboard.org/boards/beagleplay/ + config ARCH_BOARD_PINEPHONE_PRO bool "PINE64 PinePhonePro" depends on ARCH_CHIP_RK3399 @@ -3881,6 +3899,8 @@ config ARCH_BOARD default "qemu-armv8a" if ARCH_BOARD_QEMU_ARMV8A default "pinephone" if ARCH_BOARD_PINEPHONE default "pinephonepro" if ARCH_BOARD_PINEPHONE_PRO + default "pocketbeagle2" if ARCH_BOARD_POCKETBEAGLE2 + default "beagleplay" if ARCH_BOARD_BEAGLEPLAY default "nanopi_m4" if ARCH_BOARD_NANOPI_M4 default "fvp-armv8r" if ARCH_BOARD_FVP_ARMV8R default "fvp-armv8r-aarch32" if ARCH_BOARD_FVP_ARMV8R_AARCH32 @@ -4116,6 +4136,12 @@ endif if ARCH_BOARD_PINEPHONE_PRO source "boards/arm64/rk3399/pinephonepro/Kconfig" endif +if ARCH_BOARD_POCKETBEAGLE2 +source "boards/arm64/am62x/pocketbeagle2/Kconfig" +endif +if ARCH_BOARD_BEAGLEPLAY +source "boards/arm64/am62x/beagleplay/Kconfig" +endif if ARCH_BOARD_FVP_ARMV8R source "boards/arm64/fvp-v8r/fvp-armv8r/Kconfig" endif diff --git a/boards/arm64/am62x/beagleplay/CMakeLists.txt b/boards/arm64/am62x/beagleplay/CMakeLists.txt new file mode 100644 index 0000000000000..25c7af7ab7bee --- /dev/null +++ b/boards/arm64/am62x/beagleplay/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# boards/arm64/am62x/pocketbeagle2/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +# ############################################################################## + +add_subdirectory(src) diff --git a/boards/arm64/am62x/beagleplay/Kconfig b/boards/arm64/am62x/beagleplay/Kconfig new file mode 100644 index 0000000000000..fc24291947837 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/Kconfig @@ -0,0 +1,9 @@ +# +# boards/arm64/am62x/beagleplay/Kconfig +# + +if ARCH_BOARD_BEAGLEPLAY + +comment "BeaglePlay Configuration" + +endif # ARCH_BOARD_BEAGLEPLAY diff --git a/boards/arm64/am62x/beagleplay/configs/nsh/defconfig b/boards/arm64/am62x/beagleplay/configs/nsh/defconfig new file mode 100644 index 0000000000000..649e9eefff883 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/configs/nsh/defconfig @@ -0,0 +1,63 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_16550_ADDRWIDTH=0 +CONFIG_16550_POLLING=y +CONFIG_16550_SET_MCR_OUT2=y +CONFIG_16550_SUPRESS_INITIAL_CONFIG=y +CONFIG_16550_UART0=y +CONFIG_16550_UART0_BASE=0x02800000 +CONFIG_16550_UART0_CLOCK=48000000 +CONFIG_16550_UART0_IRQ=210 +CONFIG_16550_UART0_RX_TRIGGER=0 +CONFIG_16550_UART0_SERIAL_CONSOLE=y +CONFIG_16550_UART=y +CONFIG_ARCH="arm64" +CONFIG_ARCH_ARM64=y +CONFIG_ARCH_BOARD="beagleplay" +CONFIG_ARCH_BOARD_BEAGLEPLAY=y +CONFIG_ARCH_CHIP="am62x" +CONFIG_ARCH_CHIP_AM62X=y +CONFIG_ARCH_EARLY_PRINT=y +CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_IRQPRIO=y +CONFIG_BOARD_LOOPSPERMSEC=100000 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SCHED=y +CONFIG_DEBUG_SCHED_ERROR=y +CONFIG_DEBUG_SCHED_WARN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=8192 +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_STACK_MIN=8192 +CONFIG_RAMLOG=y +CONFIG_RAM_SIZE=536870912 +CONFIG_RAM_START=0x80000000 +CONFIG_RAW_BINARY=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_WAITPID=y +CONFIG_SERIAL_UART_ARCH_MMIO=y +CONFIG_SPINLOCK=y +CONFIG_STACK_COLORATION=y +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_SYSTEM_NSH=y +CONFIG_USEC_PER_TICK=1000 diff --git a/boards/arm64/am62x/beagleplay/configs/ostest/defconfig b/boards/arm64/am62x/beagleplay/configs/ostest/defconfig new file mode 100644 index 0000000000000..b176934628a26 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/configs/ostest/defconfig @@ -0,0 +1,60 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_16550_ADDRWIDTH=0 +CONFIG_16550_POLLING=y +CONFIG_16550_SET_MCR_OUT2=y +CONFIG_16550_SUPRESS_INITIAL_CONFIG=y +CONFIG_16550_UART0=y +CONFIG_16550_UART0_BASE=0x02800000 +CONFIG_16550_UART0_CLOCK=48000000 +CONFIG_16550_UART0_IRQ=210 +CONFIG_16550_UART0_RX_TRIGGER=0 +CONFIG_16550_UART0_SERIAL_CONSOLE=y +CONFIG_16550_UART=y +CONFIG_ARCH="arm64" +CONFIG_ARCH_ARM64=y +CONFIG_ARCH_BOARD="beagleplay" +CONFIG_ARCH_BOARD_BEAGLEPLAY=y +CONFIG_ARCH_CHIP="am62x" +CONFIG_ARCH_CHIP_AM62X=y +CONFIG_ARCH_EARLY_PRINT=y +CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_IRQPRIO=y +CONFIG_BOARD_LOOPSPERMSEC=100000 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SCHED=y +CONFIG_DEBUG_SCHED_ERROR=y +CONFIG_DEBUG_SCHED_WARN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=8192 +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_INIT_ENTRYPOINT="ostest_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_STACK_MIN=8192 +CONFIG_RAMLOG=y +CONFIG_RAM_SIZE=536870912 +CONFIG_RAM_START=0x80000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_WAITPID=y +CONFIG_SERIAL_UART_ARCH_MMIO=y +CONFIG_SPINLOCK=y +CONFIG_STACK_COLORATION=y +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_TESTING_OSTEST=y +CONFIG_TESTING_OSTEST_STACKSIZE=16384 +CONFIG_USEC_PER_TICK=1000 diff --git a/boards/arm64/am62x/beagleplay/include/board.h b/boards/arm64/am62x/beagleplay/include/board.h new file mode 100644 index 0000000000000..deb50cf9177a4 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/include/board.h @@ -0,0 +1,76 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/include/board.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* BeaglePlay board definitions */ + +#ifndef __BOARDS_ARM64_AM62X_BEAGLEPLAY_INCLUDE_BOARD_H +#define __BOARDS_ARM64_AM62X_BEAGLEPLAY_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +#define BOARD_UART_SCLK 48000000ul /* 48 MHz UART functional clock */ +#define BOARD_ARCH_TIMER_FREQ 200000000ul /* 200 MHz ARM generic timer */ + +/* LED definitions ********************************************************* + * + * BeaglePlay user LEDs + * + * LED index Net name GPIO + * 0 USR0 GPIO1_22 (green) + * 1 USR1 GPIO1_23 (yellow) + * 2 USR2 GPIO1_24 (red) + * 3 USR3 GPIO1_25 (blue) + */ + +#define BOARD_LED_USR0 0 +#define BOARD_LED_USR1 1 +#define BOARD_LED_USR2 2 +#define BOARD_LED_USR3 3 +#define BOARD_NLEDS 4 + +#define BOARD_LED_USR0_BIT (1 << BOARD_LED_USR0) +#define BOARD_LED_USR1_BIT (1 << BOARD_LED_USR1) +#define BOARD_LED_USR2_BIT (1 << BOARD_LED_USR2) +#define BOARD_LED_USR3_BIT (1 << BOARD_LED_USR3) + +/* LED encoded OS states */ + +#define LED_STARTED 0 +#define LED_HEAPALLOCATE 1 +#define LED_IRQSENABLED 2 +#define LED_STACKCREATED 3 +#define LED_INIRQ 4 +#define LED_SIGNAL 5 +#define LED_ASSERTION 6 +#define LED_PANIC 7 + +#endif /* __BOARDS_ARM64_AM62X_BEAGLEPLAY_INCLUDE_BOARD_H */ diff --git a/boards/arm64/am62x/beagleplay/include/board_memorymap.h b/boards/arm64/am62x/beagleplay/include/board_memorymap.h new file mode 100644 index 0000000000000..feae2717055ef --- /dev/null +++ b/boards/arm64/am62x/beagleplay/include/board_memorymap.h @@ -0,0 +1,30 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/include/board_memorymap.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * BeaglePlay (AM6254) — 2 GB LPDDR4 at 0x8000_0000. + * NuttX load address = 0x8200_0000 to avoid the DDR region reserved by + * the BeagleBoard.org U-Boot environment. + * Device space = 0x0000_0000 – 0x7FFF_FFFF (2 GB). + * + * defconfig uses only the first 512 MB so images are portable between + * BeaglePlay and PocketBeagle 2. Increase CONFIG_RAM_SIZE to use more. + ****************************************************************************/ + +#ifndef __BOARDS_ARM64_AM62X_BEAGLEPLAY_INCLUDE_BOARD_MEMORYMAP_H +#define __BOARDS_ARM64_AM62X_BEAGLEPLAY_INCLUDE_BOARD_MEMORYMAP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#define BEAGLEPLAY_DEVICEIO_BASE 0x00000000ul +#define BEAGLEPLAY_DEVICEIO_SIZE 0x80000000ul +#define BEAGLEPLAY_DDR_BASE 0x80000000ul +#define BEAGLEPLAY_DDR_SIZE 0x20000000ul /* 512 MB window */ +#define BEAGLEPLAY_LOAD_ADDR 0x82000000ul + +#endif /* __BOARDS_ARM64_AM62X_BEAGLEPLAY_INCLUDE_BOARD_MEMORYMAP_H */ diff --git a/boards/arm64/am62x/beagleplay/scripts/Make.defs b/boards/arm64/am62x/beagleplay/scripts/Make.defs new file mode 100644 index 0000000000000..eabe705e9e232 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/scripts/Make.defs @@ -0,0 +1,44 @@ +############################################################################ +# boards/arm64/am62x/pocketbeagle2/scripts/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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 $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/arm64/src/Toolchain.defs + +LDSCRIPT = dramboot.ld + +ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) + +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) \ + $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) \ + $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \ + -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld \ + -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 diff --git a/boards/arm64/am62x/beagleplay/scripts/dramboot.ld b/boards/arm64/am62x/beagleplay/scripts/dramboot.ld new file mode 100644 index 0000000000000..36a47d4aba6eb --- /dev/null +++ b/boards/arm64/am62x/beagleplay/scripts/dramboot.ld @@ -0,0 +1,96 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/scripts/dramboot.ld + * + * SPDX-License-Identifier: Apache-2.0 + * + * BeaglePlay (AM6254) linker script. + * Load address 0x8200_0000 avoids U-Boot reserved region at DDR base. + * Identical in structure to the PocketBeagle 2 script; kept separate so + * each board can diverge independently. + * + ****************************************************************************/ + +OUTPUT_ARCH(aarch64) +ENTRY(__start) + +PHDRS { text PT_LOAD ; } + +SECTIONS +{ + . = 0x82000000; + _start = .; + + .text : + { + _stext = .; + *(.start .start.*) + *(.text) *(.text.*) *(.text.cold) *(.text.unlikely) + *(.fixup) *(.gnu.warning) + } :text = 0x9090 + + . = ALIGN(4096); + + .init_section : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors)) + _einit = ABSOLUTE(.); + } :text + + . = ALIGN(4096); + + .vector : + { + _vector_start = .; + KEEP(*(.exc_vector_table)) KEEP(*(.exc_vector_table.*)) KEEP(*(.vectors)) + _vector_end = .; + } :text + + . = ALIGN(4096); + _etext = .; _sztext = _etext - _stext; + + . = ALIGN(4096); + .rodata : + { + _srodata = .; + *(.rodata) *(.rodata.*) *(.data.rel.ro) *(.data.rel.ro.*) + } :text + . = ALIGN(4096); + _erodata = .; _szrodata = _erodata - _srodata; _eronly = .; + + . = ALIGN(4096); + .data : + { + _sdata = .; + *(.data.page_aligned) *(.data) *(.data.*) + . = ALIGN(8); + *(.data.rel) *(.data.rel.*) + CONSTRUCTORS + } :text + _edata = .; + + .bss : + { + . = ALIGN(8); _sbss = .; + *(.bss) *(.bss.*) *(COMMON) + . = ALIGN(8); + } :text + . = ALIGN(4096); + _ebss = .; _szbss = _ebss - _sbss; + + .initstack : + { + _s_initstack = .; + *(.initstack) + . = ALIGN(16); + } :text + . = ALIGN(4096); + _e_initstack = .; g_idle_topstack = .; + _szdata = _e_initstack - _sdata; + + /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) *(.eh_frame) } + + .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } + .comment 0 : { *(.comment) } +} diff --git a/boards/arm64/am62x/beagleplay/src/CMakeLists.txt b/boards/arm64/am62x/beagleplay/src/CMakeLists.txt new file mode 100644 index 0000000000000..f89fba7c2af11 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/src/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# boards/arm64/am62x/beagleplay/src/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +# ############################################################################## + +list(APPEND SRCS beagleplay_boardinit.c beagleplay_bringup.c) + +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS beagleplay_autoleds.c) +endif() + +target_sources(board PRIVATE ${SRCS}) diff --git a/boards/arm64/am62x/beagleplay/src/Makefile b/boards/arm64/am62x/beagleplay/src/Makefile new file mode 100644 index 0000000000000..dd2af2cd73db0 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/src/Makefile @@ -0,0 +1,35 @@ +############################################################################ +# boards/arm64/am62x/beagleplay/src/Makefile +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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 $(TOPDIR)/Make.defs + +# Board-specific C sources (always compiled) + +CSRCS = beagleplay_boardinit.c beagleplay_bringup.c + +# Automatic LED support + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += beagleplay_autoleds.c +endif + +include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm64/am62x/beagleplay/src/beagleplay.h b/boards/arm64/am62x/beagleplay/src/beagleplay.h new file mode 100644 index 0000000000000..60bbbfd7e610c --- /dev/null +++ b/boards/arm64/am62x/beagleplay/src/beagleplay.h @@ -0,0 +1,80 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/src/beagleplay.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 __BOARDS_ARM64_AM62X_BEAGLEPLAY_SRC_BEAGLEPLAY_H +#define __BOARDS_ARM64_AM62X_BEAGLEPLAY_SRC_BEAGLEPLAY_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Name: beagleplay_bringup + * + * Description: + * Bring up board-level drivers and subsystems. Called from + * board_late_initialize(). + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +int beagleplay_bringup(void); +#endif + +/**************************************************************************** + * Name: beagleplay_led_initialize + * + * Description: + * Configure the user LEDs as GPIO outputs. Called from + * am62x_board_initialize() when CONFIG_ARCH_LEDS is set. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_LEDS +void beagleplay_led_initialize(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM64_AM62X_BEAGLEPLAY_SRC_BEAGLEPLAY_H */ diff --git a/boards/arm64/am62x/beagleplay/src/beagleplay_autoleds.c b/boards/arm64/am62x/beagleplay/src/beagleplay_autoleds.c new file mode 100644 index 0000000000000..f1fdaddef9208 --- /dev/null +++ b/boards/arm64/am62x/beagleplay/src/beagleplay_autoleds.c @@ -0,0 +1,82 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/src/beagleplay_autoleds.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* GPIO-backed LED support is not implemented yet for the AM62x boards. + * Keep the ARCH_LEDS hooks as explicit no-ops until the GPIO work lands. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include "beagleplay.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: beagleplay_led_initialize + * + * Description: + * Configure LED GPIO pins as outputs, all OFF initially. + * Stubbed until the GPIO driver is available. + * + ****************************************************************************/ + +void beagleplay_led_initialize(void) +{ + /* TODO: configure GPIO pins for the user LEDs once GPIO support exists. */ +} + +/**************************************************************************** + * Name: board_autoled_on + * + * Description: + * Turn ON the LED(s) associated with the OS event 'led'. + * + ****************************************************************************/ + +void board_autoled_on(int led) +{ + UNUSED(led); +} + +/**************************************************************************** + * Name: board_autoled_off + * + * Description: + * Turn OFF the LED(s) associated with the OS event 'led'. + * + ****************************************************************************/ + +void board_autoled_off(int led) +{ + UNUSED(led); +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/boards/arm64/am62x/beagleplay/src/beagleplay_boardinit.c b/boards/arm64/am62x/beagleplay/src/beagleplay_boardinit.c new file mode 100644 index 0000000000000..5b9b6c4992d0b --- /dev/null +++ b/boards/arm64/am62x/beagleplay/src/beagleplay_boardinit.c @@ -0,0 +1,94 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/src/beagleplay_boardinit.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 +#include +#include +#include "beagleplay.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: am62x_memory_initialize + * + * Description: + * Called from the very early boot path (before .bss is zeroed or .data + * is initialised) to perform any board-level memory bring-up such as + * DRAM training. + * + * On BeaglePlay, U-Boot trains and initialises the 512 MB DDR4 + * before loading NuttX, so there is nothing left to do here. + * + * IMPORTANT: This function must not use any global variables because + * they are not yet initialised when it is called. + * + ****************************************************************************/ + +void am62x_memory_initialize(void) +{ + /* DRAM has been initialised by U-Boot / SYSFW before NuttX is loaded. */ +} + +/**************************************************************************** + * Name: am62x_board_initialize + * + * Description: + * Called from am62x_boot.c (arm64_chip_boot) after the MMU is enabled + * and the C runtime is ready, but before any device drivers are + * registered. Use this hook to configure on-board resources that must + * be ready before up_initialize() runs. + * + ****************************************************************************/ + +void am62x_board_initialize(void) +{ +#ifdef CONFIG_ARCH_LEDS + /* Initialise the user LED GPIO outputs. LEDs are left OFF. */ + + beagleplay_led_initialize(); +#endif +} + +/**************************************************************************** + * Name: board_late_initialize + * + * Description: + * When CONFIG_BOARD_LATE_INITIALIZE is selected this function is called + * immediately after up_initialize() completes and just before the initial + * application task is created. All device drivers are available at this + * point so we use it to bring up higher-level board subsystems (procfs, + * I2C bus registration, etc.). + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + beagleplay_bringup(); +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm64/am62x/beagleplay/src/beagleplay_bringup.c b/boards/arm64/am62x/beagleplay/src/beagleplay_bringup.c new file mode 100644 index 0000000000000..545242ba0b83d --- /dev/null +++ b/boards/arm64/am62x/beagleplay/src/beagleplay_bringup.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/src/beagleplay_bringup.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 +#include +#include +#include +#include +#include "beagleplay.h" + +#ifdef CONFIG_FS_PROCFS +# include +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: beagleplay_bringup + * + * Description: + * Bring up board features after the scheduler and device drivers are + * initialised. This is the right place to: + * - Mount pseudo file systems (procfs, etc.) + * - Register I2C / SPI bus instances + * - Attach sensor drivers + * + * Phase 1 only mounts procfs — additional drivers will be added as the + * port matures. + * + * Returned Value: + * Zero (OK) on success; a negated errno on failure. Non-fatal errors + * are logged but do not abort the boot. + * + ****************************************************************************/ + +int beagleplay_bringup(void) +{ + int ret = OK; + +#ifdef CONFIG_FS_PROCFS + /* Mount the process filesystem at /proc */ + + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount procfs at /proc: %d\n", ret); + } +#endif + + return ret; +} diff --git a/boards/arm64/am62x/pocketbeagle2/CMakeLists.txt b/boards/arm64/am62x/pocketbeagle2/CMakeLists.txt new file mode 100644 index 0000000000000..25c7af7ab7bee --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# boards/arm64/am62x/pocketbeagle2/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +# ############################################################################## + +add_subdirectory(src) diff --git a/boards/arm64/am62x/pocketbeagle2/Kconfig b/boards/arm64/am62x/pocketbeagle2/Kconfig new file mode 100644 index 0000000000000..f2eb65f7fbd45 --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/Kconfig @@ -0,0 +1,12 @@ +# +# boards/arm64/am62x/pocketbeagle2/Kconfig +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_POCKETBEAGLE2 + +comment "PocketBeagle 2 Configuration" + +endif # ARCH_BOARD_POCKETBEAGLE2 diff --git a/boards/arm64/am62x/pocketbeagle2/configs/nsh/defconfig b/boards/arm64/am62x/pocketbeagle2/configs/nsh/defconfig new file mode 100644 index 0000000000000..49c8c45affd3f --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/configs/nsh/defconfig @@ -0,0 +1,65 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_16550_ADDRWIDTH=0 +CONFIG_16550_POLLING=y +CONFIG_16550_REGWIDTH=32 +CONFIG_16550_SET_MCR_OUT2=y +CONFIG_16550_SUPRESS_INITIAL_CONFIG=y +CONFIG_16550_UART0=y +CONFIG_16550_UART0_BASE=0x02860000 +CONFIG_16550_UART0_CLOCK=48000000 +CONFIG_16550_UART0_IRQ=216 +CONFIG_16550_UART0_RX_TRIGGER=0 +CONFIG_16550_UART0_SERIAL_CONSOLE=y +CONFIG_16550_UART=y +CONFIG_ARCH="arm64" +CONFIG_ARCH_ARM64=y +CONFIG_ARCH_BOARD="pocketbeagle2" +CONFIG_ARCH_BOARD_POCKETBEAGLE2=y +CONFIG_ARCH_CHIP="am62x" +CONFIG_ARCH_CHIP_AM62X=y +CONFIG_ARCH_EARLY_PRINT=y +CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_IRQPRIO=y +CONFIG_BOARD_LOOPSPERMSEC=100000 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SCHED=y +CONFIG_DEBUG_SCHED_ERROR=y +CONFIG_DEBUG_SCHED_WARN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=8192 +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_STACK_MIN=8192 +CONFIG_RAMLOG=y +CONFIG_RAM_SIZE=536870912 +CONFIG_RAM_START=0x80000000 +CONFIG_RAM_VSTART=0x80000000 +CONFIG_RAW_BINARY=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_WAITPID=y +CONFIG_SERIAL_UART_ARCH_MMIO=y +CONFIG_SPINLOCK=y +CONFIG_STACK_COLORATION=y +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_SYSTEM_NSH=y +CONFIG_USEC_PER_TICK=1000 diff --git a/boards/arm64/am62x/pocketbeagle2/configs/ostest/defconfig b/boards/arm64/am62x/pocketbeagle2/configs/ostest/defconfig new file mode 100644 index 0000000000000..762343f5c5168 --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/configs/ostest/defconfig @@ -0,0 +1,60 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_16550_ADDRWIDTH=0 +CONFIG_16550_POLLING=y +CONFIG_16550_REGWIDTH=32 +CONFIG_16550_SUPRESS_CONFIG=y +CONFIG_16550_UART0=y +CONFIG_16550_UART0_BASE=0x02860000 +CONFIG_16550_UART0_CLOCK=48000000 +CONFIG_16550_UART0_IRQ=216 +CONFIG_16550_UART0_RX_TRIGGER=0 +CONFIG_16550_UART0_SERIAL_CONSOLE=y +CONFIG_16550_UART=y +CONFIG_ARCH="arm64" +CONFIG_ARCH_ARM64=y +CONFIG_ARCH_BOARD="pocketbeagle2" +CONFIG_ARCH_BOARD_POCKETBEAGLE2=y +CONFIG_ARCH_CHIP="am62x" +CONFIG_ARCH_CHIP_AM62X=y +CONFIG_ARCH_EARLY_PRINT=y +CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_IRQPRIO=y +CONFIG_BOARD_LOOPSPERMSEC=100000 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SCHED=y +CONFIG_DEBUG_SCHED_ERROR=y +CONFIG_DEBUG_SCHED_WARN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=8192 +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_INIT_ENTRYPOINT="ostest_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_STACK_MIN=8192 +CONFIG_RAMLOG=y +CONFIG_RAM_SIZE=536870912 +CONFIG_RAM_START=0x80000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_WAITPID=y +CONFIG_SERIAL_UART_ARCH_MMIO=y +CONFIG_SPINLOCK=y +CONFIG_STACK_COLORATION=y +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_TESTING_OSTEST=y +CONFIG_TESTING_OSTEST_STACKSIZE=16384 +CONFIG_USEC_PER_TICK=1000 diff --git a/boards/arm64/am62x/pocketbeagle2/include/board.h b/boards/arm64/am62x/pocketbeagle2/include/board.h new file mode 100644 index 0000000000000..a89fe5ddc18dc --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/include/board.h @@ -0,0 +1,97 @@ +/**************************************************************************** + * boards/arm64/am62x/pocketbeagle2/include/board.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* PocketBeagle 2 board definitions */ + +#ifndef __BOARDS_ARM64_AM62X_POCKETBEAGLE2_INCLUDE_BOARD_H +#define __BOARDS_ARM64_AM62X_POCKETBEAGLE2_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +/* UART functional clock, sourced from HSDIV4_CLKOUT1 as configured by the + * R5 SYSFW. Matches AM62X_UART_SCLK in hardware/am62x_uart.h. + */ + +#define BOARD_UART_SCLK 48000000ul /* 48 MHz */ + +/* ARM Generic Timer (CNTPCT_EL0) reference clock. + * On AM62x this is driven by the 200 MHz SYSCLK0 / 4 path. + * Configured in defconfig via CONFIG_ARCH_TIMER_FREQ. + */ + +#define BOARD_ARCH_TIMER_FREQ 200000000ul /* 200 MHz */ + +/* LED definitions ********************************************************* + * + * PocketBeagle 2 user LEDs are connected to GPIO pins on the AM6254. + * The exact GPIO numbers will be finalised when the GPIO driver is added; + * these defines are placeholders so board code can compile now. + * + * LED index Colour Net name + * 0 USR0 Green + * 1 USR1 Yellow/Amber + * 2 USR2 Red + */ + +#define BOARD_LED_USR0 0 +#define BOARD_LED_USR1 1 +#define BOARD_LED_USR2 2 +#define BOARD_NLEDS 3 + +#define BOARD_LED_USR0_BIT (1 << BOARD_LED_USR0) +#define BOARD_LED_USR1_BIT (1 << BOARD_LED_USR1) +#define BOARD_LED_USR2_BIT (1 << BOARD_LED_USR2) + +/* LED encoded OS states (used when CONFIG_ARCH_LEDS is set) *************** + * + * SYMBOL Meaning USR0 USR1 USR2 + * ---------------------- -------------------------- ---- ---- ---- + * LED_STARTED NuttX has been started ON OFF OFF + * LED_HEAPALLOCATE Heap has been allocated ON ON OFF + * LED_IRQSENABLED Interrupts enabled ON ON ON + * LED_STACKCREATED Idle stack created OFF ON OFF + * LED_INIRQ In an interrupt (no change) + * LED_SIGNAL In a signal handler (no change) + * LED_ASSERTION Assertion failed OFF OFF ON + * LED_PANIC Board panicked Blinking USR2 + */ + +#define LED_STARTED 0 +#define LED_HEAPALLOCATE 1 +#define LED_IRQSENABLED 2 +#define LED_STACKCREATED 3 +#define LED_INIRQ 4 +#define LED_SIGNAL 5 +#define LED_ASSERTION 6 +#define LED_PANIC 7 + +#endif /* __BOARDS_ARM64_AM62X_POCKETBEAGLE2_INCLUDE_BOARD_H */ diff --git a/boards/arm64/am62x/pocketbeagle2/include/board_memorymap.h b/boards/arm64/am62x/pocketbeagle2/include/board_memorymap.h new file mode 100644 index 0000000000000..4325563b8523e --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/include/board_memorymap.h @@ -0,0 +1,60 @@ +/**************************************************************************** + * boards/arm64/am62x/pocketbeagle2/include/board_memorymap.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* Board memory map */ + +#ifndef __BOARDS_ARM64_AM62X_POCKETBEAGLE2_INCLUDE_BOARD_MEMORYMAP_H +#define __BOARDS_ARM64_AM62X_POCKETBEAGLE2_INCLUDE_BOARD_MEMORYMAP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Device I/O flat-map region — covers all AM62x peripheral space. + * Must be page-aligned. Used by CONFIG_DEVICEIO_BASEADDR / SIZE in + * defconfig and by g_mmu_regions in am62x_boot.c. + */ + +#define POCKETBEAGLE2_DEVICEIO_BASE 0x00000000ul +#define POCKETBEAGLE2_DEVICEIO_SIZE 0x80000000ul /* 2 GB peripheral space */ + +/* DDR region — 512 MB on PocketBeagle 2. + * RAM_START and RAM_SIZE go into defconfig as CONFIG_RAMBANK1_ADDR/SIZE + * and are also used by the linker script to place the heap. + */ + +#define POCKETBEAGLE2_DDR_BASE 0x80000000ul +#define POCKETBEAGLE2_DDR_SIZE 0x20000000ul /* 512 MB */ + +/* NuttX load address — must match U-Boot's kernel_addr_r. + * The linker script uses this as the origin of the .text section. + */ + +#define POCKETBEAGLE2_LOAD_ADDR 0x82000000ul + +#endif /* __BOARDS_ARM64_AM62X_POCKETBEAGLE2_INCLUDE_BOARD_MEMORYMAP_H */ diff --git a/boards/arm64/am62x/pocketbeagle2/scripts/Make.defs b/boards/arm64/am62x/pocketbeagle2/scripts/Make.defs new file mode 100644 index 0000000000000..eabe705e9e232 --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/scripts/Make.defs @@ -0,0 +1,44 @@ +############################################################################ +# boards/arm64/am62x/pocketbeagle2/scripts/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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 $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/arm64/src/Toolchain.defs + +LDSCRIPT = dramboot.ld + +ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) + +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) \ + $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) \ + $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \ + -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld \ + -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 diff --git a/boards/arm64/am62x/pocketbeagle2/scripts/dramboot.ld b/boards/arm64/am62x/pocketbeagle2/scripts/dramboot.ld new file mode 100644 index 0000000000000..6bb0f4e35e9db --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/scripts/dramboot.ld @@ -0,0 +1,202 @@ +/**************************************************************************** + * boards/arm64/am62x/pocketbeagle2/scripts/dramboot.ld + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* PocketBeagle 2 — NuttX loaded into DDR by U-Boot. + * + * Memory layout: + * 0x8000_0000 DDR start (512 MB physically installed) + * 0x8200_0000 NuttX load address (avoids U-Boot reserved region) + * 0x9FFF_FFFF DDR end + * + * U-Boot loads the raw binary and jumps to the first instruction + * (_start in arm64_head.S which is placed in the .start section). + * + * The heap begins at _e_initstack and extends upward; its size is + * determined by CONFIG_RAM_SIZE minus the image footprint. + */ + +OUTPUT_ARCH(aarch64) + +ENTRY(__start) + +PHDRS +{ + text PT_LOAD ; +} + +SECTIONS +{ + /* NuttX is loaded at the kernel_addr_r address */ + + . = 0x82000000; + + _start = .; + + /* ----------------------------------------------------------------------- + * Read-only / executable sections + * --------------------------------------------------------------------- */ + + .text : + { + _stext = .; + *(.start .start.*) /* arm64_head.S __start must be first */ + *(.text) + *(.text.*) + *(.text.cold) + *(.text.unlikely) + *(.fixup) + *(.gnu.warning) + } :text = 0x9090 + + . = ALIGN(4096); + + /* C++ constructor / destructor init arrays */ + + .init_section : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) + SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array + EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) + .ctors)) + _einit = ABSOLUTE(.); + } :text + + . = ALIGN(4096); + + /* Exception vector table — must be 4 KB aligned per AArch64 spec */ + + .vector : + { + _vector_start = .; + KEEP(*(.exc_vector_table)) + KEEP(*(.exc_vector_table.*)) + KEEP(*(.vectors)) + _vector_end = .; + } :text + + . = ALIGN(4096); + + _etext = .; + _sztext = _etext - _stext; + + /* ----------------------------------------------------------------------- + * Read-only data + * --------------------------------------------------------------------- */ + + . = ALIGN(4096); + + .rodata : + { + _srodata = .; + *(.rodata) + *(.rodata.*) + *(.data.rel.ro) + *(.data.rel.ro.*) + } :text + + . = ALIGN(4096); + + _erodata = .; + _szrodata = _erodata - _srodata; + _eronly = .; + + /* ----------------------------------------------------------------------- + * Initialised data (copied from flash / loaded image at boot) + * --------------------------------------------------------------------- */ + + . = ALIGN(4096); + + .data : + { + _sdata = .; + *(.data.page_aligned) + *(.data) + *(.data.*) + . = ALIGN(8); + *(.data.rel) + *(.data.rel.*) + CONSTRUCTORS + } :text + + _edata = .; + + /* ----------------------------------------------------------------------- + * Zero-initialised data (BSS) + * --------------------------------------------------------------------- */ + + .bss : + { + . = ALIGN(8); + _sbss = .; + *(.bss) + *(.bss.*) + *(COMMON) + . = ALIGN(8); + } :text + + . = ALIGN(4096); + + _ebss = .; + _szbss = _ebss - _sbss; + + /* ----------------------------------------------------------------------- + * Boot/idle stack (placed immediately after BSS) + * --------------------------------------------------------------------- */ + + .initstack : + { + _s_initstack = .; + *(.initstack) + . = ALIGN(16); + } :text + + . = ALIGN(4096); + + _e_initstack = .; + g_idle_topstack = .; /* arm64 common layer uses this symbol */ + + _szdata = _e_initstack - _sdata; + + /* ----------------------------------------------------------------------- + * Discarded sections + * --------------------------------------------------------------------- */ + + /DISCARD/ : + { + *(.exit.text) + *(.exit.data) + *(.exitcall.exit) + *(.eh_frame) + } + + /* Debugging sections */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } +} diff --git a/boards/arm64/am62x/pocketbeagle2/scripts/uEnv.txt b/boards/arm64/am62x/pocketbeagle2/scripts/uEnv.txt new file mode 100644 index 0000000000000..7d09c1812daf5 --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/scripts/uEnv.txt @@ -0,0 +1,10 @@ +# uEnv.txt -- NuttX boot script for PocketBeagle 2 +# +# Copy this file and nuttx.bin to the root of a FAT32-formatted microSD card. +# U-Boot reads uEnv.txt automatically on boot; no manual commands are needed. +# +# Load address 0x82000000 matches the NuttX linker script origin and +# CONFIG_LOAD_BASE in arch/arm64/include/am62x/chip.h. +# 0x82000000 avoids U-Boot's reserved region at the DDR base. + +uenvcmd=fatload mmc 1:1 0x82000000 nuttx.bin; go 0x82000000 diff --git a/boards/arm64/am62x/pocketbeagle2/src/CMakeLists.txt b/boards/arm64/am62x/pocketbeagle2/src/CMakeLists.txt new file mode 100644 index 0000000000000..597a32711ed3c --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/src/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# boards/arm64/am62x/pocketbeagle2/src/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +# ############################################################################## + +list(APPEND SRCS pocketbeagle2_boardinit.c pocketbeagle2_bringup.c) + +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS pocketbeagle2_autoleds.c) +endif() + +target_sources(board PRIVATE ${SRCS}) diff --git a/boards/arm64/am62x/pocketbeagle2/src/Makefile b/boards/arm64/am62x/pocketbeagle2/src/Makefile new file mode 100644 index 0000000000000..4b1f0e1cb4b98 --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/src/Makefile @@ -0,0 +1,35 @@ +############################################################################ +# boards/arm64/am62x/pocketbeagle2/src/Makefile +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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 $(TOPDIR)/Make.defs + +# Board-specific C sources (always compiled) + +CSRCS = pocketbeagle2_boardinit.c pocketbeagle2_bringup.c + +# Automatic LED support + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += pocketbeagle2_autoleds.c +endif + +include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2.h b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2.h new file mode 100644 index 0000000000000..fe1f462d65daa --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2.h @@ -0,0 +1,80 @@ +/**************************************************************************** + * boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 __BOARDS_ARM64_AM62X_POCKETBEAGLE2_SRC_POCKETBEAGLE2_H +#define __BOARDS_ARM64_AM62X_POCKETBEAGLE2_SRC_POCKETBEAGLE2_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Name: pocketbeagle2_bringup + * + * Description: + * Bring up board-level drivers and subsystems. Called from + * board_late_initialize(). + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +int pocketbeagle2_bringup(void); +#endif + +/**************************************************************************** + * Name: pocketbeagle2_led_initialize + * + * Description: + * Configure the user LEDs as GPIO outputs. Called from + * am62x_board_initialize() when CONFIG_ARCH_LEDS is set. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_LEDS +void pocketbeagle2_led_initialize(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM64_AM62X_POCKETBEAGLE2_SRC_POCKETBEAGLE2_H */ diff --git a/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_autoleds.c b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_autoleds.c new file mode 100644 index 0000000000000..216c61d63a4b9 --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_autoleds.c @@ -0,0 +1,82 @@ +/**************************************************************************** + * boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_autoleds.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/* GPIO-backed LED support is not implemented yet for the AM62x boards. + * Keep the ARCH_LEDS hooks as explicit no-ops until the GPIO work lands. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include "pocketbeagle2.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: pocketbeagle2_led_initialize + * + * Description: + * Configure LED GPIO pins as outputs, all OFF initially. + * Stubbed until the GPIO driver is available. + * + ****************************************************************************/ + +void pocketbeagle2_led_initialize(void) +{ + /* TODO: configure GPIO pins for the user LEDs once GPIO support exists. */ +} + +/**************************************************************************** + * Name: board_autoled_on + * + * Description: + * Turn ON the LED(s) associated with the OS event 'led'. + * + ****************************************************************************/ + +void board_autoled_on(int led) +{ + UNUSED(led); +} + +/**************************************************************************** + * Name: board_autoled_off + * + * Description: + * Turn OFF the LED(s) associated with the OS event 'led'. + * + ****************************************************************************/ + +void board_autoled_off(int led) +{ + UNUSED(led); +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_boardinit.c b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_boardinit.c new file mode 100644 index 0000000000000..34b46415d16e1 --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_boardinit.c @@ -0,0 +1,94 @@ +/**************************************************************************** + * boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_boardinit.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 +#include +#include +#include "pocketbeagle2.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: am62x_memory_initialize + * + * Description: + * Called from the very early boot path (before .bss is zeroed or .data + * is initialised) to perform any board-level memory bring-up such as + * DRAM training. + * + * On PocketBeagle 2, U-Boot trains and initialises the 512 MB DDR4 + * before loading NuttX, so there is nothing left to do here. + * + * IMPORTANT: This function must not use any global variables because + * they are not yet initialised when it is called. + * + ****************************************************************************/ + +void am62x_memory_initialize(void) +{ + /* DRAM has been initialised by U-Boot / SYSFW before NuttX is loaded. */ +} + +/**************************************************************************** + * Name: am62x_board_initialize + * + * Description: + * Called from am62x_boot.c (arm64_chip_boot) after the MMU is enabled + * and the C runtime is ready, but before any device drivers are + * registered. Use this hook to configure on-board resources that must + * be ready before up_initialize() runs. + * + ****************************************************************************/ + +void am62x_board_initialize(void) +{ +#ifdef CONFIG_ARCH_LEDS + /* Initialise the user LED GPIO outputs. LEDs are left OFF. */ + + pocketbeagle2_led_initialize(); +#endif +} + +/**************************************************************************** + * Name: board_late_initialize + * + * Description: + * When CONFIG_BOARD_LATE_INITIALIZE is selected this function is called + * immediately after up_initialize() completes and just before the initial + * application task is created. All device drivers are available at this + * point so we use it to bring up higher-level board subsystems (procfs, + * I2C bus registration, etc.). + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + pocketbeagle2_bringup(); +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_bringup.c b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_bringup.c new file mode 100644 index 0000000000000..60334ad15668e --- /dev/null +++ b/boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_bringup.c @@ -0,0 +1,86 @@ +/**************************************************************************** + * boards/arm64/am62x/pocketbeagle2/src/pocketbeagle2_bringup.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 +#include +#include +#include +#include + +#include "pocketbeagle2.h" + +#ifdef CONFIG_FS_PROCFS +# include +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: pocketbeagle2_bringup + * + * Description: + * Bring up board features after the scheduler and device drivers are + * initialised. This is the right place to: + * - Mount pseudo file systems (procfs, etc.) + * - Register I2C / SPI bus instances + * - Attach sensor drivers + * + * Phase 1 only mounts procfs — additional drivers will be added as the + * port matures. + * + * Returned Value: + * Zero (OK) on success; a negated errno on failure. Non-fatal errors + * are logged but do not abort the boot. + * + ****************************************************************************/ + +int pocketbeagle2_bringup(void) +{ + int ret = OK; + +#ifdef CONFIG_FS_PROCFS + /* Mount the process filesystem at /proc */ + + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount procfs at /proc: %d\n", ret); + } +#endif + + /* TODO Phase 2: + * I2C bus registration (am62x I2C0/I2C1) + * SPI bus registration (am62x SPI0) + * MMC/SD registration (am62x MMCSD0 / MMCSD1) + * GPIO driver registration + * USB device/host registration + */ + + return ret; +} From f3ce813e725b58f8d9b86043205686951c245133 Mon Sep 17 00:00:00 2001 From: Piyush Patle Date: Wed, 20 May 2026 08:01:01 +0530 Subject: [PATCH 5/5] Documentation/arm64: add AM62x board bring-up guides Document the AM62x platform and add board guides for BeaglePlay and PocketBeagle2. The BeaglePlay guide includes the validated manual U-Boot boot flow used for hardware testing. Signed-off-by: Piyush Patle --- .../arm64/am62x/boards/beagleplay/index.rst | 120 ++++++++++++++++++ .../am62x/boards/pocketbeagle2/index.rst | 110 ++++++++++++++++ Documentation/platforms/arm64/am62x/index.rst | 21 +++ 3 files changed, 251 insertions(+) create mode 100644 Documentation/platforms/arm64/am62x/boards/beagleplay/index.rst create mode 100644 Documentation/platforms/arm64/am62x/boards/pocketbeagle2/index.rst create mode 100644 Documentation/platforms/arm64/am62x/index.rst diff --git a/Documentation/platforms/arm64/am62x/boards/beagleplay/index.rst b/Documentation/platforms/arm64/am62x/boards/beagleplay/index.rst new file mode 100644 index 0000000000000..7b87f6b3628b5 --- /dev/null +++ b/Documentation/platforms/arm64/am62x/boards/beagleplay/index.rst @@ -0,0 +1,120 @@ +========== +BeaglePlay +========== + +.. tags:: chip:am62x, arch:arm64, vendor:beagleboard + +`BeaglePlay `_ is an +open-hardware single-board computer from BeagleBoard.org based on the +TI AM6254 SoC. + +Features +======== + +* TI AM6254 quad-core Arm Cortex-A53 SoC +* 2 GiB DDR4 +* microSD and on-board eMMC boot options +* USB-C debug port with serial console access +* Four user LEDs +* Gigabit Ethernet, USB, Wi-Fi, and Bluetooth hardware on the board + +Current NuttX support is limited to early boot, the 16550 serial console, +interactive NSH, and ``procfs`` mount during board bring-up. GPIO, LEDs, +I2C, SPI, MMC/SD, Ethernet, Wi-Fi, Bluetooth, and USB runtime support are +not implemented yet. + +Buttons and LEDs +================ + +BeaglePlay exposes four user LEDs connected to the AM62x main GPIO block: + +====== ======== ================== +LED GPIO Notes +====== ======== ================== +USR0 GPIO1_22 Green user LED +USR1 GPIO1_23 Yellow user LED +USR2 GPIO1_24 Red user LED +USR3 GPIO1_25 Blue user LED +====== ======== ================== + +The current NuttX port does not yet provide functional GPIO-backed LED +control. The ``CONFIG_ARCH_LEDS`` hooks are present as placeholders only. + +Serial Console +============== + +Use the BeaglePlay **DEBUG** USB-C port and a host serial terminal at +**115200 8N1**. + +Pin Mapping +=========== + +The current bring-up uses the on-board debug interfaces rather than the +expansion headers: + +=========== ====================== ======================================= +Interface SoC signal Notes +=========== ====================== ======================================= +DEBUG USB-C UART0 Default NuttX serial console +microSD MMC1 Validated boot media for ``nuttx.bin`` +USR0-3 GPIO1_22 through 1_25 User LEDs, not yet driven by NuttX +=========== ====================== ======================================= + +Power Supply +============ + +Follow the BeagleBoard.org board documentation for the supported USB-C power +inputs and peripherals. For NuttX bring-up, use the dedicated **DEBUG** +USB-C port for the serial console and the normal power path for board power. + +Installation +============ + +Install an ``aarch64-none-elf`` bare-metal toolchain and make sure its +``bin`` directory is on your ``PATH``. + +One option is the +`Arm GNU Toolchain `_. + +Building NuttX +============== + +.. code:: console + + $ ./tools/configure.sh beagleplay:nsh + $ make -j$(nproc) CROSS_COMPILE=aarch64-none-elf- + +A successful build produces ``nuttx`` and ``nuttx.bin``. + +Flashing +======== + +The currently validated boot path loads ``nuttx.bin`` from a FAT partition on +microSD using the BeaglePlay U-Boot prompt. + +1. Format a microSD card with a single FAT32 partition. +2. Copy ``nuttx.bin`` to the root of the card. +3. Insert the card and connect the **DEBUG** USB-C serial cable. +4. Stop at the U-Boot prompt and run: + + .. code:: console + + => mmc dev 1 0 + => fatload mmc 1:1 0x82000000 nuttx.bin + => go 0x82000000 + +5. Confirm the board reaches the NuttX prompt: + + .. code:: text + + NuttShell (NSH) NuttX-12.x + nsh> + +Configurations +============== + +``beagleplay:nsh`` + Interactive NSH configuration for serial bring-up and shell access. + +``beagleplay:ostest`` + Hardware validation configuration that boots directly into ``ostest_main``. diff --git a/Documentation/platforms/arm64/am62x/boards/pocketbeagle2/index.rst b/Documentation/platforms/arm64/am62x/boards/pocketbeagle2/index.rst new file mode 100644 index 0000000000000..85941e44214f3 --- /dev/null +++ b/Documentation/platforms/arm64/am62x/boards/pocketbeagle2/index.rst @@ -0,0 +1,110 @@ +============== +PocketBeagle 2 +============== + +.. tags:: chip:am62x, arch:arm64, vendor:beagleboard + +`PocketBeagle 2 `_ is a +compact open-hardware board from BeagleBoard.org based on the TI AM6254 SoC. + +Features +======== + +* TI AM6254 quad-core Arm Cortex-A53 SoC +* 512 MiB DDR4 +* microSD boot with on-board QSPI boot firmware +* USB-C debug/power connection with serial console access +* Expansion headers for GPIO, I2C, SPI, UART, PWM, and ADC +* User LEDs exposed by the board port + +Current NuttX support is limited to early boot, the 16550 serial console, +interactive NSH, and ``procfs`` mount during board bring-up. GPIO, functional +LED control, I2C, SPI, MMC/SD runtime support, Ethernet, and USB runtime +support are not implemented yet. + +Buttons and LEDs +================ + +The current NuttX board port defines three logical user LEDs: + +====== ======== ===================== +LED Colour Notes +====== ======== ===================== +USR0 Green ``CONFIG_ARCH_LEDS`` placeholder +USR1 Amber ``CONFIG_ARCH_LEDS`` placeholder +USR2 Red ``CONFIG_ARCH_LEDS`` placeholder +====== ======== ===================== + +These LEDs are not driven yet because AM62x GPIO support has not been added. + +Serial Console +============== + +AM62x UART6 is routed to the USB-C debug interface. In the current NuttX +configuration it is exposed as the first 16550 console device. Connect the +USB-C cable to your host and open the enumerated serial port at **115200 8N1**. + +Pin Mapping +=========== + +The current bring-up primarily relies on the on-board debug path: + +=========== ====================== ======================================= +Interface SoC signal Notes +=========== ====================== ======================================= +USB-C debug UART6 Default NuttX serial console +microSD MMC1 Validated boot media for ``nuttx.bin`` +USR0-2 Board user LEDs Not yet driven by NuttX GPIO support +=========== ====================== ======================================= + +Power Supply +============ + +PocketBeagle 2 can be powered through its USB-C connector. Follow the vendor +documentation for external peripherals and header power limits during bring-up. + +Installation +============ + +Install an ``aarch64-none-elf`` bare-metal toolchain and make sure its +``bin`` directory is on your ``PATH``. + +One option is the +`Arm GNU Toolchain `_. + +Building NuttX +============== + +.. code:: console + + $ ./tools/configure.sh pocketbeagle2:nsh + $ make -j$(nproc) CROSS_COMPILE=aarch64-none-elf- + +A successful build produces ``nuttx`` and ``nuttx.bin``. + +Flashing +======== + +PocketBeagle 2 boots NuttX from microSD using the U-Boot firmware already +present in on-board flash. + +1. Format a microSD card with a single FAT32 partition. +2. Copy ``nuttx.bin`` and ``boards/arm64/am62x/pocketbeagle2/scripts/uEnv.txt`` + to the root of the card. +3. Insert the card and connect the USB-C debug cable. +4. Power on the board and let U-Boot load the image automatically. +5. Confirm the board reaches the NuttX prompt: + + .. code:: text + + NuttShell (NSH) NuttX-12.x + nsh> + +Configurations +============== + +``pocketbeagle2:nsh`` + Interactive NSH configuration for serial bring-up and shell access. + +``pocketbeagle2:ostest`` + Hardware validation configuration that boots directly into ``ostest_main``. diff --git a/Documentation/platforms/arm64/am62x/index.rst b/Documentation/platforms/arm64/am62x/index.rst new file mode 100644 index 0000000000000..acb2457aee2b5 --- /dev/null +++ b/Documentation/platforms/arm64/am62x/index.rst @@ -0,0 +1,21 @@ +============ +TI AM62x +============ + +`TI AM62x `_ is a family of ARM64 SoCs from +Texas Instruments featuring: + +- **CPU:** Quad-Core ARM Cortex-A53 (up to 1.4 GHz) +- **Interrupt Controller:** ARM GIC-600 (GICv3), 480 SPIs +- **Boot:** ROM → R5 SYSFW (TIFS) → U-Boot SPL → U-Boot → NuttX +- **Memory:** External DDR4/LPDDR4 (512 MB – 2 GB depending on board) +- **UART:** Seven 16550-compatible UARTs (48 MHz clock) + +Supported Boards +================ + +.. toctree:: + :glob: + :maxdepth: 1 + + boards/*/*