layerscape: armv8_64b: add Traverse Ten64 NAND variant
authorMathew McBride <matt@traverse.com.au>
Tue, 6 Jun 2023 06:24:11 +0000 (06:24 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 26 Jul 2023 11:36:58 +0000 (13:36 +0200)
The Ten64 board[1] is based around NXP's Layerscape LS1088A SoC.
It is capable of booting both standard Linux distributions
from disk devices, using EFI, and booting OpenWrt
from NAND.

See the online manual for more information, including the
flash layout[2].

This patchset adds support for generating Ten64 images
for NAND boot.
For disk boot, one can use the EFI support that was
recently added to the armvirt target.

We previously supported NAND users by building
inside our armvirt/EFI target[3], but this approach
is not suitable for OpenWrt upstream. Users who
used our supplied NAND images will be able to upgrade
to this via sysupgrade.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] - https://www.traverse.com.au/hardware/ten64
[2] - https://ten64doc.traverse.com.au/hardware/flash/
[3] - Example:
https://gitlab.com/traversetech/ls1088firmware/openwrt/-/commit/285e4360e1604eb466880d245d48efd9962143a5
(cherry picked from commit af0546da3440dba24217949527e503820350ff05)

package/boot/uboot-envtools/files/layerscape
target/linux/layerscape/armv8_64b/config-5.15
target/linux/layerscape/base-files/etc/board.d/01_led
target/linux/layerscape/base-files/etc/board.d/02_network
target/linux/layerscape/base-files/etc/board.d/03_gpio_switches
target/linux/layerscape/base-files/lib/upgrade/platform.sh
target/linux/layerscape/image/Makefile
target/linux/layerscape/image/armv8_64b.mk

index b11587d8765fd0c892e9479639099f65240c1d13..bc7dcf24f9edbe098a87b53eea0e5976b6821644 100644 (file)
@@ -16,6 +16,9 @@ case "$board" in
        traverse,ls1043s)
                ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000"  "0x20000"
        ;;
+       traverse,ten64)
+               ubootenv_add_uci_config "/dev/mtd3" "0x0000" "0x80000" "0x80000"
+       ;;
 esac
 
 config_load ubootenv
index 69edc7a3f0703aceae0b5538a6c017c91d914d0b..0e8ab0c25340e4da8863fadd9e0cf2caa4905196 100644 (file)
@@ -508,6 +508,7 @@ CONFIG_MTD_NAND_ECC_SW_HAMMING=y
 CONFIG_MTD_NAND_FSL_IFC=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_MTD_SPI_NAND=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
 CONFIG_MTD_SPLIT_FIRMWARE=y
@@ -515,7 +516,7 @@ CONFIG_MTD_SPLIT_FIT_FW=y
 CONFIG_MTD_SST25L=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
-# CONFIG_MTD_UBI_BLOCK is not set
+CONFIG_MTD_UBI_BLOCK=y
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
 CONFIG_MULTIPLEXER=y
 CONFIG_MUTEX_SPIN_ON_OWNER=y
index 7fddfa08245569303c8914bdcb75682f79df140c..a21c21980abb7d85d2e0b5ca7aa7e5db9f4a330c 100644 (file)
@@ -17,6 +17,10 @@ traverse,ls1043s)
        ucidef_set_led_netdev "xgact" "10G Activity" "ls1043s:yellow:10gact" "eth6"
        ucidef_set_led_netdev "xglink" "10G Link" "ls1043s:green:10glink" "eth6"
        ;;
+traverse,ten64)
+       ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx"
+       ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx"
+       ;;
 esac
 
 board_config_flush
index 172172c12c6760e19d12b0946cdc95d1b61cffa3..7bc5f9b50296b6be7cfcb04189283eaca353577a 100644 (file)
@@ -17,6 +17,10 @@ case "$(board_name)" in
                ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth6"
                ucidef_set_interface_wan "eth4"
                ;;
+       traverse,ten64)
+               ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
+               ucidef_set_interface_wan "eth6"
+               ;;
 esac
 
 board_config_flush
index df3b759916d59464b8893abefc3766f024922e8f..5e0e24ef28726ecaa6955b2f090206a0d6e0f65d 100644 (file)
@@ -20,6 +20,14 @@ traverse,ls1043s)
        ucidef_add_gpio_switch "lte_disable" "LTE Airplane Mode" "394"
        ucidef_add_gpio_switch "lte_power" "LTE Power" "395"
        ;;
+traverse,ten64)
+       ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376"
+       ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377"
+       ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "378"
+       ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "379"
+       ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "369"
+       ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "373"
+       ;;
 esac
 
 board_config_flush
index e88dfdf145c9d442b77f4d5267b11385b6d1fd1e..c63cf05e5cc1e0b7d19f05bb0508735d841db27b 100644 (file)
@@ -49,6 +49,26 @@ platform_do_upgrade_traverse_nandubi() {
        nand_do_upgrade "$1" || (echo "Upgrade failed, setting bootsys ${bootsys}" && fw_setenv bootsys $bootsys)
 
 }
+
+platform_do_upgrade_traverse_slotubi() {
+       part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')"
+       echo "Active boot slot: ${part}"
+       new_active_sys="b"
+
+       if [ ! -z "${part}" ]; then
+               if [ "${part}" = "ubia" ]; then
+                       CI_UBIPART="ubib"
+               else
+                       CI_UBIPART="ubia"
+                       new_active_sys="a"
+               fi
+       fi
+       echo "Updating UBI part ${CI_UBIPART}"
+       fw_setenv "openwrt_active_sys" "${new_active_sys}"
+       nand_do_upgrade "$1"
+       return $?
+}
+
 platform_copy_config_sdboot() {
        local diskdev partdev parttype=ext4
 
@@ -90,6 +110,10 @@ platform_check_image() {
                nand_do_platform_check "traverse-ls1043" $1
                return $?
                ;;
+       traverse,ten64)
+               nand_do_platform_check "ten64-mtd" $1
+               return $?
+               ;;
        fsl,ls1012a-frdm | \
        fsl,ls1012a-frwy-sdboot | \
        fsl,ls1012a-rdb | \
@@ -130,6 +154,9 @@ platform_do_upgrade() {
        traverse,ls1043s)
                platform_do_upgrade_traverse_nandubi "$1"
                ;;
+       traverse,ten64)
+               platform_do_upgrade_traverse_slotubi "${1}"
+               ;;
        fsl,ls1012a-frdm | \
        fsl,ls1012a-rdb | \
        fsl,ls1021a-twr | \
index 52dc532c34f299ed8e3d686e4981085b4c1e9962..1463a3eaea05866ed29315839958c3445af5ac71 100644 (file)
@@ -64,6 +64,19 @@ define Build/traverse-fit
        @mv -f $@.new $@
 endef
 
+define Build/traverse-fit-ls1088
+    ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) \
+       -v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \
+       -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+       -C gzip -c 1 -c 2 \
+       -d $(DTS_DIR)/freescale/fsl-ls1088a-ten64.dtb \
+       -D "TEN64" -n "ten64" -a $(FDT_LOADADDR) -c 1 \
+       -d $(DTS_DIR)/freescale/fsl-ls1088a-rdb.dtb \
+       -D "LS1088ARDB" -n "ls1088ardb" -a $(FDT_LOADADDR) -c 2
+       PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+       @mv -f $@.new $@
+endef
+
 define Device/fix-sysupgrade
   DEVICE_COMPAT_VERSION := 2.0
   DEVICE_COMPAT_MESSAGE := DTB was added to sysupgrade. Image format is different. \
index f5a6a055fb20a5b0bc269c472c5373449842b215..0016e3bde8253fb5b21559d81317a5dbccfcf61f 100644 (file)
@@ -451,3 +451,35 @@ define Device/traverse_ls1043
   SUPPORTED_DEVICES := traverse,ls1043s traverse,ls1043v
 endef
 TARGET_DEVICES += traverse_ls1043
+
+define Device/traverse_ten64_mtd
+  DEVICE_VENDOR := Traverse
+  DEVICE_MODEL := Ten64 (NAND boot)
+  DEVICE_NAME := ten64-mtd
+  DEVICE_PACKAGES += \
+    uboot-envtools \
+    kmod-rtc-rx8025 \
+    kmod-sfp \
+    kmod-i2c-mux-pca954x \
+    restool
+  DEVICE_DESCRIPTION = \
+    Generate images for booting from NAND/ubifs on Traverse Ten64 (LS1088A) \
+    family boards. For disk (NVMe/USB/SD) boot, use the armvirt target instead.
+  FILESYSTEMS := squashfs
+  KERNEL_LOADADDR := 0x80000000
+  KERNEL_ENTRY_POINT := 0x80000000
+  FDT_LOADADDR := 0x90000000
+  KERNEL_SUFFIX := -kernel.itb
+  DEVICE_DTS := freescale/fsl-ls1088a-ten64
+  IMAGES := nand.ubi sysupgrade.bin
+  KERNEL := kernel-bin | gzip | traverse-fit-ls1088 gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  IMAGE/nand.ubi := append-ubi
+  KERNEL_IN_UBI := 1
+  BLOCKSIZE := 128KiB
+  PAGESIZE := 2048
+  MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 600
+  SUPPORTED_DEVICES = traverse,ten64
+endef
+TARGET_DEVICES += traverse_ten64_mtd
+