From 4b3943cf6851f19b73b8b271e231631f36ff201d Mon Sep 17 00:00:00 2001 From: Tomaz Zaman Date: Wed, 4 Mar 2026 21:01:42 +0100 Subject: [PATCH] arm64: GATEWAY kernel config, device tree, and platform support Add the MONO-GATEWAY kernel configuration for the NXP LS1046A-based Mono Gateway Development Kit. Based on GENERIC with OPNsense standard features, DPAA1 build infrastructure (empty file list for now), and early printf via QorIQ ns16550. Add the mono-gateway-dk.dts device tree covering the full SoC and board peripherals (DPAA1 FMan/QMan/BMan, I2C mux tree, GPIO, UART, eMMC, QSPI, SFP+ cages, and reserved memory regions). Add ARM64 I/O stubs (pio.h) for NCSW compatibility, EARLY_PRINTF qoriq type registration, CAAM RNG entropy source enum, and qoriq_therm build fix (remove spurious pci dependency). --- sys/arm64/arm64/machdep.c | 1 + sys/arm64/conf/GATEWAY | 84 ++++ sys/arm64/conf/dpaa/config.dpaa_arm64 | 29 ++ sys/arm64/conf/dpaa/files.dpaa_arm64 | 6 + sys/arm64/include/pio.h | 237 ++++++++++ sys/conf/files.arm64 | 4 +- sys/conf/options | 1 + .../src/arm64/freescale/mono-gateway-dk.dts | 444 ++++++++++++++++++ sys/dev/uart/uart_dev_ns8250.c | 24 + sys/modules/dtb/freescale/Makefile | 40 +- sys/sys/random.h | 1 + sys/sys/systm.h | 11 + 12 files changed, 878 insertions(+), 4 deletions(-) create mode 100644 sys/arm64/conf/GATEWAY create mode 100644 sys/arm64/conf/dpaa/config.dpaa_arm64 create mode 100644 sys/arm64/conf/dpaa/files.dpaa_arm64 create mode 100644 sys/arm64/include/pio.h create mode 100644 sys/contrib/device-tree/src/arm64/freescale/mono-gateway-dk.dts diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index cdc81226954..2c2fc14dd10 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -131,6 +131,7 @@ static struct trapframe proc0_tf; int early_boot = 1; int cold = 1; static int boot_el; +uintptr_t socdev_va; static uint64_t hcr_el2; struct kva_md_info kmi; diff --git a/sys/arm64/conf/GATEWAY b/sys/arm64/conf/GATEWAY new file mode 100644 index 00000000000..11f83e117d8 --- /dev/null +++ b/sys/arm64/conf/GATEWAY @@ -0,0 +1,84 @@ +# +# MONO-GATEWAY -- NXP LS1046A with DPAA1 + CAAM for OPNsense +# +# Based on GENERIC (like SMP-ARM) with hardware-specific additions: +# - DPAA1 packet acceleration (FMan/QMan/BMan) +# - CAAM crypto accelerator (JR + QI paths) +# - GPY115 PHY, SFP+, I2C sensors +# - Early printf via QorIQ ns16550 +# + +include GENERIC + +ident MONO-GATEWAY + +# Disable debug for production +nooptions INVARIANTS +nooptions INVARIANT_SUPPORT +nooptions WITNESS +nooptions WITNESS_SKIPSPIN +nooptions LOCK_PROFILING + +# OPNsense standard features (from SMP-ARM) +options DDB +options GEOM_BDE +options GEOM_ELI +options GEOM_MIRROR +options IPFIREWALL_DEFAULT_TO_ACCEPT +options IPFIREWALL_VERBOSE +options IPSTEALTH +options MROUTING +options PPS_SYNC +options TCP_SIGNATURE + +# Platform +options SOC_NXP_LS + +# Root filesystem (label set by opnsense-build arm.sh) +options ROOTDEVNAME=\"ufs:/dev/ufs/OPNsense_ARM\" + +# Early printf for debugging +options SOCDEV_PA=0x2000000 +options EARLY_PRINTF=qoriq + +# eMMC (QorIQ ESDHC) +device sdhci + +# I2C (board-specific) +device vf_i2c # Freescale Vybrid / QorIQ I2C controller +device pca954x # NXP PCA9545/9546/9548 I2C mux/switch +# pcf2131 is built as an out-of-tree module in opnsense-deps/drivers/pcf2131/ + +# GPIO power-off (STUSB4500 USB-C PD reset) +device gpiopower + +device sff # Small Form Factor Transceivers (SFP+) + +# caam is built as an out-of-tree module in opnsense-deps/drivers/caam/ + +# Packet filter +device pf +device pflog +device pfsync +device carp + +# Networking +device lagg # Link aggregation +device if_bridge # Bridge interface +device enc # IPsec enc(4) interface +device gif # IPv6/IPv4 tunneling +device gre # GRE tunneling +device tuntap # Tunnel/TAP + +# OPNsense extras +device wlan_acl +device wlan_xauth +device u3g +device uftdi +device umodem +device uplcom +device uvisor +device uvscom + +# DTBs +makeoptions MODULES_EXTRA+="dtb/freescale" diff --git a/sys/arm64/conf/dpaa/config.dpaa_arm64 b/sys/arm64/conf/dpaa/config.dpaa_arm64 new file mode 100644 index 00000000000..4b4756753b5 --- /dev/null +++ b/sys/arm64/conf/dpaa/config.dpaa_arm64 @@ -0,0 +1,29 @@ + +files "dpaa/files.dpaa_arm64" + +makeoptions DPAA_COMPILE_CMD="${LINUXKPI_C} ${DPAAWARNFLAGS} \ + -Wno-cast-qual -Wno-unused-function -Wno-init-self -fms-extensions \ + -include $S/contrib/ncsw/build/dflags_arm64.h \ + -Wno-error=missing-prototypes \ + -I$S/contrib/ncsw/build/ \ + -I$S/contrib/ncsw/inc \ + -I$S/contrib/ncsw/inc/cores \ + -I$S/contrib/ncsw/inc/etc \ + -I$S/contrib/ncsw/inc/Peripherals \ + -I$S/contrib/ncsw/etc \ + -I$S/contrib/ncsw/Peripherals/BM \ + -I$S/contrib/ncsw/Peripherals/FM \ + -I$S/contrib/ncsw/Peripherals/FM/HC \ + -I$S/contrib/ncsw/Peripherals/FM/inc \ + -I$S/contrib/ncsw/Peripherals/FM/MAC \ + -I$S/contrib/ncsw/Peripherals/FM/Pcd \ + -I$S/contrib/ncsw/Peripherals/FM/Port \ + -I$S/contrib/ncsw/Peripherals/FM/Rtc \ + -I$S/contrib/ncsw/Peripherals/QM \ + -I$S/contrib/ncsw/inc/flib \ + -I$S/contrib/ncsw/inc/integrations" + +makeoptions FMCD_COMPILE_CMD="${DPAA_COMPILE_CMD} \ + -I$S/../../ASK/freebsd/fmlib/include/fmd \ + -I$S/../../ASK/freebsd/fmlib/include/fmd/Peripherals \ + -I$S/../../ASK/freebsd/fmlib/include/fmd/integrations" diff --git a/sys/arm64/conf/dpaa/files.dpaa_arm64 b/sys/arm64/conf/dpaa/files.dpaa_arm64 new file mode 100644 index 00000000000..16ce67284eb --- /dev/null +++ b/sys/arm64/conf/dpaa/files.dpaa_arm64 @@ -0,0 +1,6 @@ + +# NetCommSW drivers — ARM64 variant +# Identical source list to powerpc/conf/dpaa/files.dpaa except: +# - core.c -> core_arm64.c (ARM64 CORE_GetId etc.) +# - xx.c -> xx_arm64.c (no PowerPC ccsrbar/LAW/TLB deps) +# - if_dtsec* excluded (LS1046A uses mEMAC, not dTSEC) diff --git a/sys/arm64/include/pio.h b/sys/arm64/include/pio.h new file mode 100644 index 00000000000..b33dc78bfdf --- /dev/null +++ b/sys/arm64/include/pio.h @@ -0,0 +1,237 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 Mono Technologies Inc. + * + * I/O macros for ARM64 — equivalent to powerpc/include/pio.h. + * Provides in8/out8/../in64/out64 used by the NetCommSW (ncsw) DPAA1 driver. + * All accesses are memory-mapped volatile loads/stores with a DSB barrier + * to match the ordering semantics of the PowerPC "sync" in the original. + */ + +#ifndef _MACHINE_PIO_H_ +#define _MACHINE_PIO_H_ + +#include + +/* + * Full system data synchronisation barrier. + * Ensures completion of all preceding memory accesses before any + * subsequent access can begin. Equivalent to PowerPC "sync". + */ +#define arm64_iomb() __asm __volatile("dsb sy" : : : "memory") + +static __inline void +__outb(volatile u_int8_t *a, u_int8_t v) +{ + *a = v; + arm64_iomb(); +} + +static __inline void +__outw(volatile u_int16_t *a, u_int16_t v) +{ + *a = v; + arm64_iomb(); +} + +static __inline void +__outl(volatile u_int32_t *a, u_int32_t v) +{ + *a = v; + arm64_iomb(); +} + +static __inline void +__outll(volatile u_int64_t *a, u_int64_t v) +{ + *a = v; + arm64_iomb(); +} + +static __inline u_int8_t +__inb(volatile u_int8_t *a) +{ + u_int8_t v; + + v = *a; + arm64_iomb(); + return (v); +} + +static __inline u_int16_t +__inw(volatile u_int16_t *a) +{ + u_int16_t v; + + v = *a; + arm64_iomb(); + return (v); +} + +static __inline u_int32_t +__inl(volatile u_int32_t *a) +{ + u_int32_t v; + + v = *a; + arm64_iomb(); + return (v); +} + +static __inline u_int64_t +__inll(volatile u_int64_t *a) +{ + u_int64_t v; + + v = *a; + arm64_iomb(); + return (v); +} + +#define outb(a,v) (__outb((volatile u_int8_t *)(a), v)) +#define out8(a,v) outb(a,v) +#define outw(a,v) (__outw((volatile u_int16_t *)(a), v)) +#define out16(a,v) outw(a,v) +#define outl(a,v) (__outl((volatile u_int32_t *)(a), v)) +#define out32(a,v) outl(a,v) +#define outll(a,v) (__outll((volatile u_int64_t *)(a), v)) +#define out64(a,v) outll(a,v) +#define inb(a) (__inb((volatile u_int8_t *)(a))) +#define in8(a) inb(a) +#define inw(a) (__inw((volatile u_int16_t *)(a))) +#define in16(a) inw(a) +#define inl(a) (__inl((volatile u_int32_t *)(a))) +#define in32(a) inl(a) +#define inll(a) (__inll((volatile u_int64_t *)(a))) +#define in64(a) inll(a) + +/* Reverse-byte variants — ARM64 is LE, so these byte-swap for BE regs */ +static __inline void +__outwrb(volatile u_int16_t *a, u_int16_t v) +{ + *a = __builtin_bswap16(v); + arm64_iomb(); +} + +static __inline void +__outlrb(volatile u_int32_t *a, u_int32_t v) +{ + *a = __builtin_bswap32(v); + arm64_iomb(); +} + +static __inline u_int16_t +__inwrb(volatile u_int16_t *a) +{ + u_int16_t v; + + v = *a; + arm64_iomb(); + return (__builtin_bswap16(v)); +} + +static __inline u_int32_t +__inlrb(volatile u_int32_t *a) +{ + u_int32_t v; + + v = *a; + arm64_iomb(); + return (__builtin_bswap32(v)); +} + +#define out8rb(a,v) outb(a,v) +#define outwrb(a,v) (__outwrb((volatile u_int16_t *)(a), v)) +#define out16rb(a,v) outwrb(a,v) +#define outlrb(a,v) (__outlrb((volatile u_int32_t *)(a), v)) +#define out32rb(a,v) outlrb(a,v) +#define in8rb(a) inb(a) +#define inwrb(a) (__inwrb((volatile u_int16_t *)(a))) +#define in16rb(a) inwrb(a) +#define inlrb(a) (__inlrb((volatile u_int32_t *)(a))) +#define in32rb(a) inlrb(a) + +/* Bulk accessors */ +static __inline void +__outsb(volatile u_int8_t *a, const u_int8_t *s, size_t c) +{ + while (c--) + *a = *s++; + arm64_iomb(); +} + +static __inline void +__outsw(volatile u_int16_t *a, const u_int16_t *s, size_t c) +{ + while (c--) + *a = *s++; + arm64_iomb(); +} + +static __inline void +__outsl(volatile u_int32_t *a, const u_int32_t *s, size_t c) +{ + while (c--) + *a = *s++; + arm64_iomb(); +} + +static __inline void +__outsll(volatile u_int64_t *a, const u_int64_t *s, size_t c) +{ + while (c--) + *a = *s++; + arm64_iomb(); +} + +static __inline void +__insb(volatile u_int8_t *a, u_int8_t *d, size_t c) +{ + while (c--) + *d++ = *a; + arm64_iomb(); +} + +static __inline void +__insw(volatile u_int16_t *a, u_int16_t *d, size_t c) +{ + while (c--) + *d++ = *a; + arm64_iomb(); +} + +static __inline void +__insl(volatile u_int32_t *a, u_int32_t *d, size_t c) +{ + while (c--) + *d++ = *a; + arm64_iomb(); +} + +static __inline void +__insll(volatile u_int64_t *a, u_int64_t *d, size_t c) +{ + while (c--) + *d++ = *a; + arm64_iomb(); +} + +#define outsb(a,s,c) (__outsb((volatile u_int8_t *)(a), s, c)) +#define outs8(a,s,c) outsb(a,s,c) +#define outsw(a,s,c) (__outsw((volatile u_int16_t *)(a), s, c)) +#define outs16(a,s,c) outsw(a,s,c) +#define outsl(a,s,c) (__outsl((volatile u_int32_t *)(a), s, c)) +#define outs32(a,s,c) outsl(a,s,c) +#define outsll(a,s,c) (__outsll((volatile u_int64_t *)(a), s, c)) +#define outs64(a,s,c) outsll(a,s,c) +#define insb(a,d,c) (__insb((volatile u_int8_t *)(a), d, c)) +#define ins8(a,d,c) insb(a,d,c) +#define insw(a,d,c) (__insw((volatile u_int16_t *)(a), d, c)) +#define ins16(a,d,c) insw(a,d,c) +#define insl(a,d,c) (__insl((volatile u_int32_t *)(a), d, c)) +#define ins32(a,d,c) insl(a,d,c) +#define insll(a,d,c) (__insll((volatile u_int64_t *)(a), d, c)) +#define ins64(a,d,c) insll(a,d,c) + +#endif /* _MACHINE_PIO_H_ */ diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index cf2e1d22da8..b22a047f8f5 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -636,8 +636,8 @@ dev/iicbus/controller/vybrid/vf_i2c_acpi.c optional vf_i2c iicbus acpi soc_nxp_l dev/iicbus/controller/vybrid/vf_i2c_fdt.c optional vf_i2c iicbus fdt soc_nxp_ls arm64/qoriq/qoriq_dw_pci.c optional pci fdt soc_nxp_ls arm64/qoriq/qoriq_gpio_pic.c optional gpio fdt soc_nxp_ls -arm64/qoriq/qoriq_therm.c optional pci fdt soc_nxp_ls -arm64/qoriq/qoriq_therm_if.m optional pci fdt soc_nxp_ls +arm64/qoriq/qoriq_therm.c optional fdt soc_nxp_ls +arm64/qoriq/qoriq_therm_if.m optional fdt soc_nxp_ls arm64/qoriq/clk/ls1028a_clkgen.c optional clk soc_nxp_ls fdt arm64/qoriq/clk/ls1028a_flexspi_clk.c optional clk soc_nxp_ls fdt arm64/qoriq/clk/ls1046a_clkgen.c optional clk soc_nxp_ls fdt diff --git a/sys/conf/options b/sys/conf/options index e201f8a4bdb..42045dd1141 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -52,6 +52,7 @@ DDB_CAPTURE_DEFAULTBUFSIZE opt_ddb.h DDB_CAPTURE_MAXBUFSIZE opt_ddb.h DDB_CTF opt_ddb.h DDB_NUMSYM opt_ddb.h +QMAN_CEETM_SUPPORT opt_dpaa.h EARLY_PRINTF opt_global.h FULL_BUF_TRACKING opt_global.h GDB diff --git a/sys/contrib/device-tree/src/arm64/freescale/mono-gateway-dk.dts b/sys/contrib/device-tree/src/arm64/freescale/mono-gateway-dk.dts new file mode 100644 index 00000000000..3e3a9839fd5 --- /dev/null +++ b/sys/contrib/device-tree/src/arm64/freescale/mono-gateway-dk.dts @@ -0,0 +1,444 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree for Mono Gateway DK (NXP LS1046A) + * + * Copyright (c) 2026 Mono Technologies Inc. + * Author: Tomaz Zaman + */ + +/dts-v1/; + +#include "fsl-ls1046a.dtsi" + +/ { + model = "Mono Gateway Development Kit"; + compatible = "mono,gateway-dk", "fsl,ls1046a"; + freebsd,dts-version = "6.4"; + + aliases { + serial0 = &duart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + /* + * SFP LED GPIO definitions — referenced by sfp-led-controller via + * the "leds" property on each SFP node. These are NOT children of + * gpio-leds so the gpioled driver won't claim the pins (sfp-led + * module owns them). + */ + led_sfp0_link: sfp0_link { + gpios = <&gpio2 17 GPIO_ACTIVE_HIGH>; + }; + + led_sfp0_activity: sfp0_activity { + gpios = <&gpio2 18 GPIO_ACTIVE_HIGH>; + }; + + led_sfp1_link: sfp1_link { + gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>; + }; + + led_sfp1_activity: sfp1_activity { + gpios = <&gpio2 16 GPIO_ACTIVE_HIGH>; + }; + + sfp_xfi0: sfp-xfi0 { + compatible = "sff,sfp"; + i2c-bus = <&sfp0_i2c>; + tx-disable-gpios = <&gpio2 14 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; + los-gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; + leds = <&led_sfp0_link>, <&led_sfp0_activity>; + }; + + sfp_xfi1: sfp-xfi1 { + compatible = "sff,sfp"; + i2c-bus = <&sfp1_i2c>; + tx-disable-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; + los-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; + leds = <&led_sfp1_link>, <&led_sfp1_activity>; + }; + + sfp_led_controller: sfp-led-controller { + compatible = "mono,sfp-led"; + sfp-ports = <&sfp_xfi0>, <&sfp_xfi1>; + }; + +}; + +&soc { + gpio-poweroff { + compatible = "gpio-poweroff"; + gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>; + }; +}; + +&duart0 { + status = "okay"; +}; + +&esdhc { + status = "okay"; + mmc-hs200-1_8v; + bus-width = <4>; +}; + +&i2c0 { + status = "okay"; + + /* Thermal sensors, retimer, clock generator, PWM fan */ + i2c-mux@70 { + compatible = "nxp,pca9545"; + reg = <0x70>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + retimer: retimer@18 { + compatible = "ti,ds100df410"; + reg = <0x18>; + status = "okay"; + }; + }; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + temp-sensor@4c { + compatible = "ti,tmp431"; + reg = <0x4c>; + label = "cpu-board"; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + temp-sensor@4c { + compatible = "ti,tmp431"; + reg = <0x4c>; + label = "network-board"; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + fan_controller: fan-controller@2e { + compatible = "microchip,emc2305"; + reg = <0x2e>; + #address-cells = <1>; + #size-cells = <0>; + #pwm-cells = <3>; + + fan0: fan@0 { + reg = <0>; + label = "System Fan 1"; + pwms = <&fan_controller 26000 1 1>; + #cooling-cells = <2>; + }; + + fan1: fan@1 { + reg = <1>; + label = "System Fan 2"; + pwms = <&fan_controller 26000 1 1>; + #cooling-cells = <2>; + }; + }; + }; + }; +}; + +&i2c1 { + status = "okay"; + + /* SFP+ I2C mux */ + sfpmux: i2c-mux@70 { + compatible = "nxp,pca9545"; + reg = <0x70>; + #address-cells = <1>; + #size-cells = <0>; + + sfp0_i2c: i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + }; + + sfp1_i2c: i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + }; + }; +}; + +&i2c2 { + status = "okay"; + + i2c-mux@70 { + compatible = "nxp,pca9545"; + reg = <0x70>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + power_sensor@40 { + compatible = "ti,ina234"; + reg = <0x40>; + label = "USB Power Delivery"; + #io-channel-cells = <1>; + shunt-resistor = <1000>; + }; + power_sensor@41 { + compatible = "ti,ina234"; + reg = <0x41>; + label = "5V PSU"; + #io-channel-cells = <1>; + shunt-resistor = <1000>; + }; + power_sensor@42 { + compatible = "ti,ina234"; + reg = <0x42>; + label = "1V Core PSU"; + #io-channel-cells = <1>; + shunt-resistor = <1000>; + }; + power_sensor@43 { + compatible = "ti,ina234"; + reg = <0x43>; + label = "1.2V DDR PSU"; + #io-channel-cells = <1>; + shunt-resistor = <5000>; + }; + }; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + power_sensor@40 { + compatible = "ti,ina234"; + reg = <0x40>; + label = "1.35V SerDes PSU"; + #io-channel-cells = <1>; + shunt-resistor = <5000>; + }; + power_sensor@41 { + compatible = "ti,ina234"; + reg = <0x41>; + label = "1.8V PSU"; + #io-channel-cells = <1>; + shunt-resistor = <5000>; + }; + power_sensor@42 { + compatible = "ti,ina234"; + reg = <0x42>; + label = "2.5V DDR PSU"; + #io-channel-cells = <1>; + shunt-resistor = <5000>; + }; + power_sensor@43 { + compatible = "ti,ina234"; + reg = <0x43>; + label = "3.3V PSU"; + #io-channel-cells = <1>; + shunt-resistor = <1000>; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + rtc@53 { + compatible = "nxp,pcf2131"; + reg = <0x53>; + status = "okay"; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + lp5810@6c { + compatible = "ti,lp5812"; + reg = <0x6c>; + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + label = "status:white"; + led-max-microamp = <25500>; + }; + + led@1 { + reg = <1>; + label = "status:blue"; + led-max-microamp = <25500>; + }; + + led@2 { + reg = <2>; + label = "status:green"; + led-max-microamp = <25500>; + }; + + led@3 { + reg = <3>; + label = "status:red"; + led-max-microamp = <25500>; + }; + }; + }; + }; +}; + +&i2c3 { + status = "okay"; +}; + +#include "fsl-ls1046-post.dtsi" + +/* Override portal bus compatible from "simple-bus" to prevent simplebus + * from claiming these nodes before the DPAA portal drivers attach. + * The portal drivers match on these specific compatible strings. */ +&qportals { + compatible = "fsl,qman-portals"; +}; + +&bportals { + compatible = "fsl,bman-portals"; +}; + +/* CEETM: Channel Egress Enhancement and Traffic Management + * QMan hardware egress QoS — hierarchical traffic shaping with + * sub-portals, LNIs, channels, and class queues. + * LFQID range extracted from Linux SDK DTS for LS1046A. */ +&qman { + qman-ceetm@0 { + compatible = "fsl,qman-ceetm"; + fsl,ceetm-lfqid-range = <0xf00000 0x1000>; + fsl,ceetm-sp-range = <0 16>; + fsl,ceetm-lni-range = <0 8>; + fsl,ceetm-channel-range = <0 32>; + }; +}; + +/* port@82000 (cell-index 2) is reserved for Host Command — disable for OP use. + * Keep 0x3 (IPsec) and 0x4 (WiFi), matching Linux SDK port assignment. */ +&fman0_oh_0x2 { status = "disabled"; }; +&fman0_oh_0x5 { status = "disabled"; }; +&fman0_oh_0x6 { status = "disabled"; }; +&fman0_oh_0x7 { status = "disabled"; }; + +&fman0 { + /* Unused 1G ports */ + ethernet@e0000 { + status = "disabled"; + }; + + ethernet@e4000 { + status = "disabled"; + }; + + ethernet@e6000 { + status = "disabled"; + }; + + /* SGMII 1GbE ports */ + ethernet@e8000 { + phy-handle = <&sgmii_phy0>; + phy-connection-type = "sgmii"; + status = "okay"; + }; + + ethernet@ea000 { + phy-handle = <&sgmii_phy1>; + phy-connection-type = "sgmii"; + status = "okay"; + }; + + ethernet@e2000 { + phy-handle = <&sgmii_phy2>; + phy-connection-type = "sgmii"; + status = "okay"; + }; + + /* 10GbE XFI ports */ + ethernet@f0000 { + sfp = <&sfp_xfi0>; + phy-connection-type = "10gbase-r"; + managed = "in-band-status"; + }; + + ethernet@f2000 { + sfp = <&sfp_xfi1>; + phy-connection-type = "10gbase-r"; + managed = "in-band-status"; + }; + + /* Internal MDIO disabled (no PHYs on this bus) */ + mdio@fc000 { + status = "disabled"; + }; + + /* External MDIO — SGMII PHYs */ + mdio@fd000 { + sgmii_phy0: ethernet-phy@0 { + reg = <0x0>; + }; + + sgmii_phy1: ethernet-phy@1 { + reg = <0x1>; + }; + + sgmii_phy2: ethernet-phy@2 { + reg = <0x2>; + }; + }; +}; + +/* + * Override reserved-memory nodes with fixed physical addresses. + * FreeBSD excludes no-map + reg regions from phys_avail[] at early boot, + * giving QBMan dedicated memory that the VM system never touches. + * Addresses are in DDR range (0x80000000-0xFFFFFFFF), naturally aligned. + */ +&qman_pfdr { + reg = <0 0xc0000000 0 0x2000000>; /* 32MB at 0xC0000000 */ +}; + +&bman_fbpr { + reg = <0 0xc2000000 0 0x1000000>; /* 16MB at 0xC2000000 */ +}; + +&qman_fqd { + reg = <0 0xc3000000 0 0x800000>; /* 8MB at 0xC3000000 */ +}; + diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index ced3b44b574..ac760b064b2 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -78,6 +78,30 @@ static int broken_txfifo = 0; SYSCTL_INT(_hw, OID_AUTO, broken_txfifo, CTLFLAG_RWTUN, &broken_txfifo, 0, "UART FIFO has QEMU emulation bug"); +/* + * To use early printf on NXP QorIQ (LS1046A, etc.), add to kernel config: + * + * options SOCDEV_PA=0x2000000 + * options EARLY_PRINTF=qoriq + * + * SOCDEV_PA must be 2MB-aligned (L2 block constraint in locore.S). + * The DUART is at SOCDEV_PA + 0x1c0500. + */ +#if CHECK_EARLY_PRINTF(qoriq) +extern uintptr_t socdev_va; +static void +uart_qoriq_early_putc(int c) +{ + volatile uint8_t *base = (volatile uint8_t *)(socdev_va + 0x1c0500); + int limit = 10000; + + while ((base[5] & 0x20) == 0 && --limit > 0) + continue; + base[0] = c; +} +early_putc_t *early_putc = uart_qoriq_early_putc; +#endif /* CHECK_EARLY_PRINTF(qoriq) */ + /* * Clear pending interrupts. THRE is cleared by reading IIR. Data * that may have been received gets lost here. diff --git a/sys/modules/dtb/freescale/Makefile b/sys/modules/dtb/freescale/Makefile index 871c15330fe..22712ad7bb3 100644 --- a/sys/modules/dtb/freescale/Makefile +++ b/sys/modules/dtb/freescale/Makefile @@ -1,8 +1,44 @@ # All the dts files for Freescale (now NXP) systems we support. -DTS= freescale/fsl-ls1028a-rdb.dts \ +DTS= freescale/fsl-ls1012a-frdm.dts \ + freescale/fsl-ls1012a-frwy.dts \ + freescale/fsl-ls1012a-oxalis.dts \ + freescale/fsl-ls1012a-qds.dts \ + freescale/fsl-ls1012a-rdb.dts \ + freescale/fsl-ls1028a-kontron-kbox-a-230-ls.dts \ + freescale/fsl-ls1028a-kontron-sl28.dts \ + freescale/fsl-ls1028a-kontron-sl28-var1.dts \ + freescale/fsl-ls1028a-kontron-sl28-var2.dts \ + freescale/fsl-ls1028a-kontron-sl28-var3-ads2.dts \ + freescale/fsl-ls1028a-kontron-sl28-var4.dts \ + freescale/fsl-ls1028a-qds-13bb.dts \ + freescale/fsl-ls1028a-qds-65bb.dts \ + freescale/fsl-ls1028a-qds-7777.dts \ + freescale/fsl-ls1028a-qds-85bb.dts \ + freescale/fsl-ls1028a-qds-899b.dts \ + freescale/fsl-ls1028a-qds-9999.dts \ + freescale/fsl-ls1028a-qds.dts \ + freescale/fsl-ls1028a-rdb.dts \ + freescale/fsl-ls1043a-qds.dts \ + freescale/fsl-ls1043a-rdb.dts \ + freescale/fsl-ls1046a-frwy.dts \ + freescale/fsl-ls1046a-qds.dts \ + freescale/fsl-ls1046a-rdb.dts \ + freescale/fsl-ls1088a-qds.dts \ + freescale/fsl-ls1088a-rdb.dts \ + freescale/fsl-ls1088a-ten64.dts \ + freescale/fsl-ls2080a-qds.dts \ + freescale/fsl-ls2080a-rdb.dts \ + freescale/fsl-ls2080a-simu.dts \ + freescale/fsl-ls2081a-rdb.dts \ + freescale/fsl-ls2088a-qds.dts \ + freescale/fsl-ls2088a-rdb.dts \ + freescale/fsl-lx2160a-bluebox3.dts \ + freescale/fsl-lx2160a-bluebox3-rev-a.dts \ freescale/fsl-lx2160a-clearfog-cx.dts \ freescale/fsl-lx2160a-honeycomb.dts \ freescale/fsl-lx2160a-qds.dts \ - freescale/fsl-lx2160a-rdb.dts + freescale/fsl-lx2160a-rdb.dts \ + freescale/fsl-lx2162a-qds.dts \ + freescale/mono-gateway-dk.dts .include diff --git a/sys/sys/random.h b/sys/sys/random.h index aa4457fc8c2..6ff4f163f32 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -103,6 +103,7 @@ enum random_entropy_source { RANDOM_PURE_VMGENID, RANDOM_PURE_QUALCOMM, RANDOM_PURE_ARMV8, + RANDOM_PURE_CAAM, ENTROPYSOURCE }; _Static_assert(ENTROPYSOURCE <= 32, diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 973a7604fe5..88cd70878b3 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -212,6 +212,17 @@ critical_exit(void) #ifdef EARLY_PRINTF typedef void early_putc_t(int ch); extern early_putc_t *early_putc; +#define CHECK_EARLY_PRINTF(x) \ + __CONCAT(early_printf_, EARLY_PRINTF) == __CONCAT(early_printf_, x) +#define early_printf_1 1 +#define early_printf_mvebu 2 +#define early_printf_ns8250 3 +#define early_printf_pl011 4 +#define early_printf_snps 5 +#define early_printf_sbi 6 +#define early_printf_qoriq 7 +#else +#define CHECK_EARLY_PRINTF(x) 0 #endif int kvprintf(char const *, void (*)(int, void*), void *, int, __va_list) __printflike(1, 0);