qoriq: add support for NXP T4240RDB board
authorPawel Dembicki <[email protected]>
Wed, 19 Nov 2025 21:58:54 +0000 (22:58 +0100)
committerStijn Tintel <[email protected]>
Fri, 5 Dec 2025 21:57:41 +0000 (23:57 +0200)
Hardware specs:
  - NXP T4240, 12C/24T @ 1.67 GHz
  - 3 × 2 GB DDR3 SO-DIMM
  - 128 MB NOR flash
  - 2 GB SLC NAND
  - SD card interface
  - PCIe: x4 and x8
  - SATA 3 Gbps
  - 8 × 1 GbE
  - 4 × 10 GbE SFP
  - RTC

This commit adds two sysupgrade image types:
  - nor:    boot and run the entire system from NOR
  - sdboot: boot and run the entire system from SD card

How to obtain and install factory images:
  - At the moment U-Boot support is not mergeable because it requires
    the mpc85xx toolchain to build.
  - Please follow the instructions in the GitHub PR:
    https://github.com/openwrt/openwrt/pull/10941

Signed-off-by: Pawel Dembicki <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/10941
Signed-off-by: Stijn Tintel <[email protected]>
package/boot/uboot-tools/uboot-envtools/files/qoriq
target/linux/qoriq/base-files/lib/upgrade/platform.sh
target/linux/qoriq/config-6.12
target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-nor.dts [new file with mode: 0644]
target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-sdboot.dts [new file with mode: 0644]
target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb.dtsi [new file with mode: 0644]
target/linux/qoriq/image/generic.mk
target/linux/qoriq/patches-6.12/001-Revert-powerpc-dts-mpc85xx-remove-simple-bus-compatible-from-ifc-node.patch [new file with mode: 0644]

index d024a7f00868e26c9d095671ef7282d54b2acc6f..09851cfa4a2c47f378b9622514dd73585fd321e7 100644 (file)
@@ -8,6 +8,12 @@ touch /etc/config/ubootenv
 board=$(board_name)
 
 case "$board" in
+fsl,t4240rdb-nor)
+       ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x2000" "0x20000"
+       ;;
+fsl,t4240rdb-sdboot)
+       ubootenv_add_uci_config "/dev/mmcblk0" "0x101000" "0x2000" "0x1000"
+       ;;
 watchguard,firebox-m300)
        ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x2000" "0x10000"
        ;;
index 1392d5eb22d28386cbff1f38b702ed30c2ddfeb3..838f158ad6386e6135d3b94032ff0ac7899c70f6 100755 (executable)
@@ -3,8 +3,52 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
+platform_copy_config_sdboot() {
+       local diskdev partdev parttype=ext4
+
+       export_bootdevice && export_partdevice diskdev 0 || {
+               echo "Unable to determine upgrade device"
+               return 1
+       }
+
+       if export_partdevice partdev 1; then
+               mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt 2>&1
+               echo "Saving config backup..."
+               cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
+               umount /mnt
+       fi
+}
+
+platform_do_upgrade_sdboot() {
+       local diskdev partdev parttype=ext4
+       local tar_file="$1"
+       local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+       board_dir=${board_dir%/}
+
+       export_bootdevice && export_partdevice diskdev 0 || {
+               echo "Unable to determine upgrade device"
+               return 1
+       }
+
+       if export_partdevice partdev 1; then
+               mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt 2>&1
+               echo "Writing kernel..."
+               tar xf $tar_file ${board_dir}/kernel -O > /mnt/fitImage
+               umount /mnt
+       fi
+
+       echo "Erasing rootfs..."
+       dd if=/dev/zero of=/dev/mmcblk0p2 bs=1M > /dev/null 2>&1
+       echo "Writing rootfs..."
+       tar xf $tar_file ${board_dir}/root -O  | dd of=/dev/mmcblk0p2 bs=512k > /dev/null 2>&1
+
+}
+
 platform_check_image() {
        case "$(board_name)" in
+       fsl,t4240rdb-sdboot)
+               return 0
+               ;;
        watchguard,firebox-m300)
                legacy_sdcard_check_image "$1"
                ;;
@@ -16,6 +60,9 @@ platform_check_image() {
 
 platform_copy_config() {
        case "$(board_name)" in
+       fsl,t4240rdb-sdboot)
+               platform_copy_config_sdboot
+               ;;
        watchguard,firebox-m300)
                legacy_sdcard_copy_config "$1"
                ;;
@@ -26,6 +73,10 @@ platform_copy_config() {
 
 platform_do_upgrade() {
        case "$(board_name)" in
+       fsl,t4240rdb-sdboot)
+               platform_do_upgrade_sdboot "$1"
+               return 0
+               ;;
        watchguard,firebox-m300)
                legacy_sdcard_do_upgrade "$1"
                ;;
@@ -34,3 +85,4 @@ platform_do_upgrade() {
                ;;
        esac
 }
+
index 464ddde934682d492047b673ab3307162f14dc9d..774737d5e56eec10fea204d3c47620e9cd0c2bb6 100644 (file)
@@ -21,6 +21,7 @@ CONFIG_ARCH_STACKWALK=y
 CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y
 CONFIG_ASN1=y
 CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
+CONFIG_ATA=y
 CONFIG_AUDIT_ARCH=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_SD=y
@@ -39,6 +40,7 @@ CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_CONTEXT_TRACKING=y
 CONFIG_CONTEXT_TRACKING_IDLE=y
 CONFIG_CORENET_GENERIC=y
+CONFIG_CORTINA_PHY=y
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_CPU_FREQ=y
 # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
@@ -253,6 +255,8 @@ CONFIG_MTD_NAND_ECC_SW_HAMMING=y
 CONFIG_MTD_NAND_FSL_IFC=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_MTD_SPLIT_FIRMWARE=y
+CONFIG_MTD_SPLIT_FIT_FW=y
 CONFIG_MUTEX_SPIN_ON_OWNER=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
@@ -357,6 +361,8 @@ CONFIG_RETHOOK=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
+CONFIG_SATA_FSL=y
+CONFIG_SATA_HOST=y
 # CONFIG_SCOM_DEBUGFS is not set
 CONFIG_SCSI=y
 CONFIG_SCSI_COMMON=y
@@ -414,6 +420,7 @@ CONFIG_USB_UAS=y
 CONFIG_VDSO_GETRANDOM=y
 CONFIG_VIRT_CPU_ACCOUNTING=y
 CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y
+CONFIG_VITESSE_PHY=y
 CONFIG_VT=y
 CONFIG_VT_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
diff --git a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-nor.dts b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-nor.dts
new file mode 100644 (file)
index 0000000..fb5957f
--- /dev/null
@@ -0,0 +1,37 @@
+/include/ "fsl-t4240rdb.dtsi"
+
+/ {
+       model = "NXP T4240RDB (NOR BOOT)";
+       compatible = "fsl,t4240rdb-nor", "fsl,T4240RDB";
+};
+
+&ifc {
+    nor@0,0 {
+        partitions {
+            compatible = "fixed-partitions";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            partition@0 {
+                reg = <0x0 0x7e00000>;
+                label = "firmware";
+            };
+            partition@7e00000 {
+                reg = <0x7e00000 0x100000>;
+                label = "cortina-ucode";
+            };
+            partition@7f00000 {
+                reg = <0x7f00000 0x20000>;
+                label = "fman";
+            };
+            partition@7f20000 {
+                reg = <0x7f20000 0x20000>;
+                label = "u-boot-env";
+            };
+            partition@7f40000 {
+                reg = <0x7f40000 0xc0000>;
+                label = "u-boot";
+            };
+        };
+    };
+};
diff --git a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-sdboot.dts b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-sdboot.dts
new file mode 100644 (file)
index 0000000..f1c6919
--- /dev/null
@@ -0,0 +1,21 @@
+/include/ "fsl-t4240rdb.dtsi"
+
+/ {
+       model = "NXP T4240RDB (SDCARD BOOT)";
+       compatible = "fsl,t4240rdb-sdboot", "fsl,T4240RDB";
+};
+
+&ifc {
+    nor@0,0 {
+        partitions {
+            compatible = "fixed-partitions";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            partition@0 {
+                reg = <0x0 0x8000000>;
+                label = "nor";
+            };
+        };
+    };
+};
\ No newline at end of file
diff --git a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb.dtsi b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb.dtsi
new file mode 100644 (file)
index 0000000..4fda7fc
--- /dev/null
@@ -0,0 +1,54 @@
+/include/ "t4240rdb.dts"
+
+/ {
+       aliases {
+        ethernet0 = "/soc@ffe000000/fman@400000/ethernet@e0000";
+        ethernet1 = "/soc@ffe000000/fman@400000/ethernet@e2000";
+        ethernet2 = "/soc@ffe000000/fman@400000/ethernet@e4000";
+        ethernet3 = "/soc@ffe000000/fman@400000/ethernet@e6000";
+        ethernet4 = "/soc@ffe000000/fman@500000/ethernet@f0000";
+        ethernet5 = "/soc@ffe000000/fman@500000/ethernet@f2000";
+        ethernet6 = "/soc@ffe000000/fman@500000/ethernet@e0000";
+        ethernet7 = "/soc@ffe000000/fman@500000/ethernet@e2000";
+        ethernet8 = "/soc@ffe000000/fman@500000/ethernet@e4000";
+        ethernet9 = "/soc@ffe000000/fman@500000/ethernet@e6000";
+        ethernet10 = "/soc@ffe000000/fman@400000/ethernet@f0000";
+        ethernet11 = "/soc@ffe000000/fman@400000/ethernet@f2000";
+       };
+};
+
+&ifc {
+    nand@2,0 {
+        partitions {
+            compatible = "fixed-partitions";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            partition@0 {
+                reg = <0x0 0x80000000>;
+                label = "nand";
+            };
+        };
+    };
+};
+
+&pci1 {
+    status = "disabled";
+};
+
+&pci3 {
+    status = "disabled";
+};
+
+&soc {
+    i2c@118000 {
+        eeprom@50 {
+            compatible = "atmel,24c02";
+            reg = <0x50>;
+        };
+    };
+
+    sata@221000 {
+        status = "disabled";
+    };
+};
index ade63ef8a062f940f2244f2adcd2fc3a0de42b91..2a84112c03d48f961da15d709126941e61074f68 100644 (file)
@@ -1,3 +1,31 @@
+define Device/fsl_t4240rdb
+  DEVICE_VENDOR := NXP
+  DEVICE_MODEL := T4240RDB
+  DEVICE_DTS_DIR := $(DTS_DIR)/fsl
+  DEVICE_PACKAGES := \
+    kmod-eeprom-at24 kmod-gpio-button-hotplug kmod-hwmon-w83793 kmod-leds-gpio \
+         kmod-ptp-qoriq kmod-rtc-ds1374
+  FILESYSTEMS := squashfs
+  KERNEL := kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+endef
+
+define Device/fsl_t4240rdb-nor
+  $(Device/fsl_t4240rdb)
+  DEVICE_MODEL := T4240RDB (SDCARD BOOT)
+  IMAGES := sysupgrade.bin
+  IMAGE/sysupgrade.bin := \
+    append-kernel | append-rootfs | pad-rootfs | append-metadata
+endef
+TARGET_DEVICES += fsl_t4240rdb-nor
+
+define Device/fsl_t4240rdb-sdboot
+  $(Device/fsl_t4240rdb)
+  DEVICE_MODEL := T4240RDB (NOR BOOT)
+  IMAGES := sysupgrade.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+TARGET_DEVICES += fsl_t4240rdb-sdboot
+
 define Device/watchguard_firebox-m300
   DEVICE_VENDOR := WatchGuard
   DEVICE_MODEL := Firebox M300
diff --git a/target/linux/qoriq/patches-6.12/001-Revert-powerpc-dts-mpc85xx-remove-simple-bus-compatible-from-ifc-node.patch b/target/linux/qoriq/patches-6.12/001-Revert-powerpc-dts-mpc85xx-remove-simple-bus-compatible-from-ifc-node.patch
new file mode 100644 (file)
index 0000000..31f15a5
--- /dev/null
@@ -0,0 +1,125 @@
+From patchwork Wed Nov  5 20:55:24 2025
+From: Rosen Penev <[email protected]>
+Subject: [PATCH] Revert "powerpc: dts: mpc85xx: remove "simple-bus" compatible
+ from ifc node"
+Date: Wed,  5 Nov 2025 12:55:24 -0800
+
+This reverts commit 0bf51cc9e9e57a751b4c5dacbfa499ba5cd8bd72.
+
+simple-bus is needed for legacy platforms such as P1010 so that nodes
+are populated properly.
+
+Fixes fsl,ifc-nand probing under at least P1010.
+
+Signed-off-by: Rosen Penev <[email protected]>
+---
+ arch/powerpc/boot/dts/fsl/b4si-post.dtsi      | 2 +-
+ arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi | 2 +-
+ arch/powerpc/boot/dts/fsl/bsc9132si-post.dtsi | 2 +-
+ arch/powerpc/boot/dts/fsl/c293si-post.dtsi    | 2 +-
+ arch/powerpc/boot/dts/fsl/p1010si-post.dtsi   | 2 +-
+ arch/powerpc/boot/dts/fsl/t1023si-post.dtsi   | 2 +-
+ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi   | 2 +-
+ arch/powerpc/boot/dts/fsl/t2081si-post.dtsi   | 2 +-
+ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi   | 2 +-
+ 9 files changed, 9 insertions(+), 9 deletions(-)
+
+--- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
+@@ -50,7 +50,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <25 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi
+@@ -35,7 +35,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <16 2 0 0 20 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/bsc9132si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/bsc9132si-post.dtsi
+@@ -35,7 +35,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       /* FIXME: Test whether interrupts are split */
+       interrupts = <16 2 0 0 20 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/c293si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/c293si-post.dtsi
+@@ -35,7 +35,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <19 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
+@@ -35,7 +35,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <16 2 0 0 19 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/t1023si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/t1023si-post.dtsi
+@@ -52,7 +52,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <25 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi
+@@ -52,7 +52,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <25 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
+@@ -50,7 +50,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <25 2 0 0>;
+ };
+--- a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
++++ b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
+@@ -50,7 +50,7 @@
+ &ifc {
+       #address-cells = <2>;
+       #size-cells = <1>;
+-      compatible = "fsl,ifc";
++      compatible = "fsl,ifc", "simple-bus";
+       interrupts = <25 2 0 0>;
+ };