[openwrt/openwrt] layerscape: armv8_64b: add Traverse Ten64 NAND variant

LEDE Commits lede-commits at lists.infradead.org
Sun Jun 25 07:04:22 PDT 2023


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/af0546da3440dba24217949527e503820350ff05

commit af0546da3440dba24217949527e503820350ff05
Author: Mathew McBride <matt at traverse.com.au>
AuthorDate: Tue Jun 6 06:24:11 2023 +0000

    layerscape: armv8_64b: add Traverse Ten64 NAND variant
    
    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 at 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
---
 package/boot/uboot-envtools/files/layerscape       |  3 ++
 target/linux/layerscape/armv8_64b/config-5.15      |  3 +-
 .../linux/layerscape/base-files/etc/board.d/01_led |  4 +++
 .../layerscape/base-files/etc/board.d/02_network   |  4 +++
 .../base-files/etc/board.d/03_gpio_switches        |  8 ++++++
 .../layerscape/base-files/lib/upgrade/platform.sh  | 27 ++++++++++++++++++
 target/linux/layerscape/image/Makefile             | 13 +++++++++
 target/linux/layerscape/image/armv8_64b.mk         | 32 ++++++++++++++++++++++
 8 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-envtools/files/layerscape b/package/boot/uboot-envtools/files/layerscape
index b11587d876..bc7dcf24f9 100644
--- a/package/boot/uboot-envtools/files/layerscape
+++ b/package/boot/uboot-envtools/files/layerscape
@@ -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
diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15
index 69edc7a3f0..0e8ab0c253 100644
--- a/target/linux/layerscape/armv8_64b/config-5.15
+++ b/target/linux/layerscape/armv8_64b/config-5.15
@@ -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
diff --git a/target/linux/layerscape/base-files/etc/board.d/01_led b/target/linux/layerscape/base-files/etc/board.d/01_led
index 7fddfa0824..a21c21980a 100644
--- a/target/linux/layerscape/base-files/etc/board.d/01_led
+++ b/target/linux/layerscape/base-files/etc/board.d/01_led
@@ -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
diff --git a/target/linux/layerscape/base-files/etc/board.d/02_network b/target/linux/layerscape/base-files/etc/board.d/02_network
index 172172c12c..7bc5f9b502 100644
--- a/target/linux/layerscape/base-files/etc/board.d/02_network
+++ b/target/linux/layerscape/base-files/etc/board.d/02_network
@@ -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
diff --git a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches
index df3b759916..5e0e24ef28 100644
--- a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches
@@ -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
diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
index e88dfdf145..c63cf05e5c 100644
--- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh
+++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
@@ -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 | \
diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile
index 52dc532c34..1463a3eaea 100644
--- a/target/linux/layerscape/image/Makefile
+++ b/target/linux/layerscape/image/Makefile
@@ -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. \
diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk
index f5a6a055fb..0016e3bde8 100644
--- a/target/linux/layerscape/image/armv8_64b.mk
+++ b/target/linux/layerscape/image/armv8_64b.mk
@@ -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
+




More information about the lede-commits mailing list