From b1ad73daa077bbfdd333fed97a1dfcfb850d6f0a Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Wed, 19 Nov 2025 22:58:54 +0100 Subject: [PATCH] qoriq: add support for NXP T4240RDB board MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Link: https://github.com/openwrt/openwrt/pull/10941 Signed-off-by: Stijn Tintel --- .../uboot-tools/uboot-envtools/files/qoriq | 6 + .../qoriq/base-files/lib/upgrade/platform.sh | 52 ++++++++ target/linux/qoriq/config-6.12 | 7 + .../powerpc/boot/dts/fsl/fsl-t4240rdb-nor.dts | 37 ++++++ .../boot/dts/fsl/fsl-t4240rdb-sdboot.dts | 21 +++ .../powerpc/boot/dts/fsl/fsl-t4240rdb.dtsi | 54 ++++++++ target/linux/qoriq/image/generic.mk | 28 ++++ ...-simple-bus-compatible-from-ifc-node.patch | 125 ++++++++++++++++++ 8 files changed, 330 insertions(+) create mode 100644 target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-nor.dts create mode 100644 target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-sdboot.dts create mode 100644 target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb.dtsi create mode 100644 target/linux/qoriq/patches-6.12/001-Revert-powerpc-dts-mpc85xx-remove-simple-bus-compatible-from-ifc-node.patch diff --git a/package/boot/uboot-tools/uboot-envtools/files/qoriq b/package/boot/uboot-tools/uboot-envtools/files/qoriq index d024a7f008..09851cfa4a 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/qoriq +++ b/package/boot/uboot-tools/uboot-envtools/files/qoriq @@ -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" ;; diff --git a/target/linux/qoriq/base-files/lib/upgrade/platform.sh b/target/linux/qoriq/base-files/lib/upgrade/platform.sh index 1392d5eb22..838f158ad6 100755 --- a/target/linux/qoriq/base-files/lib/upgrade/platform.sh +++ b/target/linux/qoriq/base-files/lib/upgrade/platform.sh @@ -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 } + diff --git a/target/linux/qoriq/config-6.12 b/target/linux/qoriq/config-6.12 index 464ddde934..774737d5e5 100644 --- a/target/linux/qoriq/config-6.12 +++ b/target/linux/qoriq/config-6.12 @@ -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 index 0000000000..fb5957f8d3 --- /dev/null +++ b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-nor.dts @@ -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 index 0000000000..f1c691913f --- /dev/null +++ b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb-sdboot.dts @@ -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 index 0000000000..4fda7fcee4 --- /dev/null +++ b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/fsl-t4240rdb.dtsi @@ -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"; + }; +}; diff --git a/target/linux/qoriq/image/generic.mk b/target/linux/qoriq/image/generic.mk index ade63ef8a0..2a84112c03 100644 --- a/target/linux/qoriq/image/generic.mk +++ b/target/linux/qoriq/image/generic.mk @@ -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 index 0000000000..31f15a576f --- /dev/null +++ b/target/linux/qoriq/patches-6.12/001-Revert-powerpc-dts-mpc85xx-remove-simple-bus-compatible-from-ifc-node.patch @@ -0,0 +1,125 @@ +From patchwork Wed Nov 5 20:55:24 2025 +From: Rosen Penev +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 +--- + 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>; + }; + -- 2.30.2