From ab12a01cd78772b4cfc82db7d0002c05dc0f97b5 Mon Sep 17 00:00:00 2001 From: Sijia Huang Date: Sat, 26 Aug 2023 00:38:01 +0000 Subject: [PATCH 01/22] ramips: add support for WAVLINK WL-WN573HX1 Hardware -------- Specifications: - Device: WAVLINK WL-WN573HX1 Outdoor AP - SoC: MT7621AT - Flash: 16MB - RAM: 256MB - Switch:1 LAN (10/100/1000 Mbps) - WiFi: MT7905 2x2 2.4G + MT7975 2x2 5G - LEDs: 1x STATUS (blue, configurable) 1x LAN (green) Product link: https://www.wavlink.com/en_us/product/WL-WN573HX1.html Signed-off-by: Sijia Huang --- .../ramips/dts/mt7621_wavlink_wl-wn573hx1.dts | 133 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 14 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + 3 files changed, 148 insertions(+) create mode 100755 target/linux/ramips/dts/mt7621_wavlink_wl-wn573hx1.dts diff --git a/target/linux/ramips/dts/mt7621_wavlink_wl-wn573hx1.dts b/target/linux/ramips/dts/mt7621_wavlink_wl-wn573hx1.dts new file mode 100755 index 0000000000..d8a94c85b9 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_wavlink_wl-wn573hx1.dts @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "wavlink,wl-wn573hx1", "mediatek,mt7621-soc"; + model = "WAVLINK WL-WN573HX1"; + + aliases { + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue:status_led { + label = "blue:status_led"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_3fff4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&spi0 { + status = "okay"; + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <14000000>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x00000 0x30000>; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + }; + + factory:partition@50000 { + label = "factory"; + reg = <0x50000 0x40000>; + }; + + partition@90000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x90000 0xf70000>; + }; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_3fff4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch0 { + ports { + port@3 { + status = "okay"; + label = "lan"; + }; + }; +}; + + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_3fff4: macaddr@3fff4 { + reg = <0x3fff4 0x6>; + }; + +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 065a61de28..0710564fa5 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2546,6 +2546,20 @@ define Device/wavlink_ws-wn572hp3-4g endef TARGET_DEVICES += wavlink_ws-wn572hp3-4g + +define Device/wavlink_wl-wn573hx1 + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 15808k + DEVICE_VENDOR := Wavlink + DEVICE_MODEL := WL-WN573HX1 + DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools + IMAGES += factory.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + check-size | append-metadata + IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size +endef +TARGET_DEVICES += wavlink_wl-wn573hx1 + define Device/wevo_11acnas $(Device/dsa-migration) $(Device/uimage-lzma-loader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index a162cb9d1d..e0b229c7ee 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -55,6 +55,7 @@ ramips_setup_interfaces() ubnt,unifi-flexhd|\ ubnt,unifi-nanohd|\ yuncore,fap690|\ + wavlink,wl-wn573hx1|\ zyxel,nwa50ax|\ zyxel,nwa55axe) ucidef_set_interface_lan "lan" From bfd54529fac075eeb70f2408042e0da03b5ec8cc Mon Sep 17 00:00:00 2001 From: Ivan Pavlov Date: Sat, 23 Sep 2023 18:09:36 +0300 Subject: [PATCH 02/22] openssl: update to 3.0.11 Changes between 3.0.10 and 3.0.11 [19 Sep 2023] * Fix POLY1305 MAC implementation corrupting XMM registers on Windows. ([CVE-2023-4807]) Signed-off-by: Ivan Pavlov --- package/libs/openssl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 7bee249676..459d367372 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl -PKG_VERSION:=3.0.10 +PKG_VERSION:=3.0.11 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto @@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=1761d4f5b13a1028b9b6f3d4b8e17feb0cedc9370f6afe61d7193d2cdce83323 +PKG_HASH:=b3425d3bb4a2218d0697eb41f7fc0cdede016ed19ca49d168b78e8d947887f55 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE From 2368cafbd837fdfae2eb6bd536e17d02efc6b106 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 23 Sep 2023 07:39:00 -0400 Subject: [PATCH 03/22] kernel: bump 6.1 to 6.1.55 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.55 All patches automatically rebased. Build system: x86/64 Build-tested: x86/64/AMD Cezanne, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: x86/64/AMD Cezanne, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia --- include/kernel-6.1 | 4 ++-- ...CKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch | 6 +++--- target/linux/generic/hack-6.1/904-debloat_dma_buf.patch | 2 +- target/linux/generic/pending-6.1/834-ledtrig-libata.patch | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/kernel-6.1 b/include/kernel-6.1 index c1ea2089ca..c916b86dcc 100644 --- a/include/kernel-6.1 +++ b/include/kernel-6.1 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.1 = .54 -LINUX_KERNEL_HASH-6.1.54 = a3181e46d407cd6ab15f412402e8220684ff9659b0262b7a3de7384405ce4e27 +LINUX_VERSION-6.1 = .55 +LINUX_KERNEL_HASH-6.1.55 = a87e241ec15d53452c4efe219713a3769d88cc436b5b98cf6efb262c4aff15c0 diff --git a/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch b/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch index 0fd3699b61..ef98d52b78 100644 --- a/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch +++ b/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch @@ -335,7 +335,7 @@ Signed-off-by: T.J. Mercier if (order > 0) return 0; -@@ -5373,6 +5386,7 @@ static int mem_cgroup_css_online(struct +@@ -5383,6 +5396,7 @@ static int mem_cgroup_css_online(struct if (unlikely(mem_cgroup_is_root(memcg))) queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ); @@ -343,7 +343,7 @@ Signed-off-by: T.J. Mercier return 0; offline_kmem: memcg_offline_kmem(memcg); -@@ -5404,6 +5418,7 @@ static void mem_cgroup_css_offline(struc +@@ -5414,6 +5428,7 @@ static void mem_cgroup_css_offline(struc memcg_offline_kmem(memcg); reparent_shrinker_deferred(memcg); wb_memcg_offline(memcg); @@ -351,7 +351,7 @@ Signed-off-by: T.J. Mercier drain_all_stock(memcg); -@@ -5415,6 +5430,7 @@ static void mem_cgroup_css_released(stru +@@ -5425,6 +5440,7 @@ static void mem_cgroup_css_released(stru struct mem_cgroup *memcg = mem_cgroup_from_css(css); invalidate_reclaim_iterators(memcg); diff --git a/target/linux/generic/hack-6.1/904-debloat_dma_buf.patch b/target/linux/generic/hack-6.1/904-debloat_dma_buf.patch index 48c001bfab..8b6bd6a786 100644 --- a/target/linux/generic/hack-6.1/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-6.1/904-debloat_dma_buf.patch @@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau +dma-shared-buffer-objs := $(dma-buf-objs-y) --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c -@@ -1583,4 +1583,5 @@ static void __exit dma_buf_deinit(void) +@@ -1636,4 +1636,5 @@ static void __exit dma_buf_deinit(void) kern_unmount(dma_buf_mnt); dma_buf_uninit_sysfs_statistics(); } diff --git a/target/linux/generic/pending-6.1/834-ledtrig-libata.patch b/target/linux/generic/pending-6.1/834-ledtrig-libata.patch index f3c0b1802b..57fdb020f8 100644 --- a/target/linux/generic/pending-6.1/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-6.1/834-ledtrig-libata.patch @@ -134,7 +134,7 @@ Signed-off-by: Daniel Golle /* * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -857,6 +860,12 @@ struct ata_port { +@@ -861,6 +864,12 @@ struct ata_port { #ifdef CONFIG_ATA_ACPI struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ #endif From b61ac68b67427ce2eb2c81fa647a21d88ddd2a82 Mon Sep 17 00:00:00 2001 From: Oskari Rauta Date: Sun, 24 Sep 2023 11:29:39 +0300 Subject: [PATCH 04/22] ccache: add missing \ -DREDIS_STORAGE_BACKEND=OFF option is ignored due to missing \ Signed-off-by: Oskari Rauta --- tools/ccache/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 0571a994b8..7b89b44101 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -21,7 +21,7 @@ CMAKE_HOST_OPTIONS += \ -DCMAKE_CXX_COMPILER_LAUNCHER="" \ -DCMAKE_SKIP_RPATH=FALSE \ -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \ - -DENABLE_DOCUMENTATION=OFF + -DENABLE_DOCUMENTATION=OFF \ -DREDIS_STORAGE_BACKEND=OFF $(eval $(call HostBuild)) From f86415085b9172980ddc6cfbf852c33922792c4c Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 22 Sep 2023 21:38:54 +0000 Subject: [PATCH 05/22] armsr: ensure kmod-fs-vfat is selected for mounting ESP vfat support is needed to mount the EFI System Partition (ESP) during sysupgrade. If it is not available, the sysupgrade process will not complete Signed-off-by: Mathew McBride --- target/linux/armsr/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/linux/armsr/Makefile b/target/linux/armsr/Makefile index b34500ed8a..7de77decb5 100644 --- a/target/linux/armsr/Makefile +++ b/target/linux/armsr/Makefile @@ -15,7 +15,8 @@ include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += mkf2fs e2fsprogs # blkid used for resolving PARTUUID -# in sysupgrade -DEFAULT_PACKAGES += blkid +# in sysupgrade. vfat required for +# mounting ESP partition +DEFAULT_PACKAGES += blkid kmod-fs-vfat $(eval $(call BuildTarget)) From 76e419288fc237666faebb6548c2da92468a6133 Mon Sep 17 00:00:00 2001 From: Kristian Skramstad Date: Mon, 21 Aug 2023 17:45:36 +0200 Subject: [PATCH 06/22] ipq807x: add support for Netgear WAX620 ``` Specifications: * CPU: Qualcomm IPQ8072A, SoC Version: 2.0, Quad core Cortex-A53 1.6896 GHz * RAM: 1 GiB of DDR4 600 MHz * Flash: NAND 2x256 MiB (Macronix MX30UF2G18AC) * 4 RGB LEDs: Power, LAN, 2.4GHz and 5GHz * UART: Two 4-pin unpopulated headers under the LEDs. Use the header closest to LED 4 and 5. They are marked with a white stroke. TX RX GND, beginning from "4". 115200n8. Lan: * One 100/1000/2.5GBASE-T Gigabit Ethernet (QCA8081) Wlan: * 4x4 in 2.4GHz: 802.11b/g/n/ax * 4x4 in 5.0GHz: 802.11a/n/ac/ax * OFDM and OFDMA * Bidir and MU-MIMO * Internal antenna 3.1/4.3 dBi (2.4GHz/5GHz) Power: * PoE+ 802.3at/af 25.5W * DC 12V 2.5A ``` ``` Note: The OpenWrt image is setup with DHCP and not a static IP. 1. Download the OpenWrt initramfs image. Copy the image to a TFTP server 2. Connect to console on the AP, and connect the LAN port to your LAN 3. Stop auto boot to get to U-boot shell, interrupt the autoboot process by pressing '0' when prompted 4. Set active_fw in env # setenv active_fw 1 5. Transfer the initramfs image with TFTP # setenv serverip 192.168.1.10 (IP of TFTP server host) # setenv ipaddr 192.168.1.1 (IP used by the router for getting the image, must be in the same subnet as the TFTP host) # tftpboot openwrt-qualcommax-ipq807x-netgear_wax620-initramfs-uImage.itb 6. Reboot and load the image # bootm 7. SCP factory image to the AP # scp openwrt-qualcommax-ipq807x-netgear_wax620-squashfs-factory.ubi root@192.168.1.1:/tmp/ 8. Connect to device using SSH (use the LAN port) 9. Flash squashfs-factory.ubi from within the initramfs instance of OpenWRT Before you flash, please check your mtd partitions where mtdX is the right mtd rootfs partition. # cat /proc/mtd (To check MTD partitions) # ubiformat /dev/mtd19 -y -f /tmp/openwrt-qualcommax-ipq807x-netgear_wax620-squashfs-factory.ubi 10. Set active_fw to 0 # /usr/sbin/fw_setenv active_fw 0 11. Reboot the AP and your done # reboot ``` Signed-off-by: Kristian Skramstad --- .../uboot-envtools/files/qualcommax_ipq807x | 3 +- package/firmware/ipq-wifi/Makefile | 2 + .../arm64/boot/dts/qcom/ipq8072-wax620.dts | 201 ++++++++++++++++++ target/linux/qualcommax/image/ipq807x.mk | 14 ++ .../ipq807x/base-files/etc/board.d/01_leds | 3 + .../ipq807x/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/firmware/11-ath11k-caldata | 1 + .../base-files/lib/upgrade/platform.sh | 3 +- 8 files changed, 227 insertions(+), 3 deletions(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index 297c727857..106ba47c08 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -10,7 +10,8 @@ board=$(board_name) case "$board" in dynalink,dl-wrx36|\ netgear,rax120v2|\ -netgear,wax218) +netgear,wax218|\ +netgear,wax620) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 2fb40bea3b..6dd2260fac 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -35,6 +35,7 @@ ALLWIFIBOARDS:= \ edimax_cax1800 \ netgear_rax120v2 \ netgear_wax218 \ + netgear_wax620 \ prpl_haze \ qnap_301w \ redmi_ax6 \ @@ -126,6 +127,7 @@ $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) $(eval $(call generate-ipq-wifi-package,netgear_rax120v2,Netgear RAX120v2)) $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218)) +$(eval $(call generate-ipq-wifi-package,netgear_wax620,Netgear WAX620)) $(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w)) $(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts new file mode 100644 index 0000000000..d1c3245c8b --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq8074.dtsi" +#include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include + +/ { + model = "Netgear WAX620"; + compatible = "netgear,wax620", "qcom,ipq8074"; + + aliases { + serial0 = &blsp1_uart5; + ethernet0 = &dp6; + led-boot = &led_system_blue; + led-failsafe = &led_system_red; + led-running = &led_system_green; + led-upgrade = &led_system_blue; + }; + + chosen { + stdout-path = "serial0:115200n8"; + /* + * Netgear's U-Boot adds "ubi.mtd=rootfs root=mtd:ubi_rootfs" + * That fails to create a UBI block device, so add it here. + */ + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + led_spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + sck-gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&tlmm 19 GPIO_ACTIVE_HIGH>; + + led_gpio: led_gpio@0 { + compatible = "fairchild,74hc595"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + enable-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>; + spi-max-frequency = <1000000>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_system_red: system-red { + label = "system:red"; + gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; + }; + + led_system_green: system-green { + label = "system:green"; + gpios = <&tlmm 55 GPIO_ACTIVE_HIGH>; + }; + + led_system_blue: system-blue { + label = "system:blue"; + gpios = <&tlmm 56 GPIO_ACTIVE_HIGH>; + }; + + led_lan_g { + label = "lan:green"; + gpios = <&led_gpio 0 GPIO_ACTIVE_HIGH>; + }; + + led_lan_o { + label = "lan:orange"; + gpios = <&led_gpio 1 GPIO_ACTIVE_HIGH>; + }; + + led_2g_b { + label = "wlan2g:blue"; + gpios = <&led_gpio 2 GPIO_ACTIVE_HIGH>; + }; + + led_2g_g { + label = "wlan2g:green"; + gpios = <&led_gpio 3 GPIO_ACTIVE_HIGH>; + }; + + led_5g_b { + label = "wlan5g:blue"; + gpios = <&led_gpio 4 GPIO_ACTIVE_HIGH>; + }; + + led_5g_g { + label = "wlan5g:green"; + gpios = <&led_gpio 5 GPIO_ACTIVE_HIGH>; + }; + + }; +}; + +&edma { + status = "okay"; +}; + +&switch { + status = "okay"; + + switch_cpu_bmp = <0x01>; + switch_lan_bmp = <0x3e>; + switch_wan_bmp = <0x40>; + switch_mac_mode = <0x00>; + switch_mac_mode1 = <0xff>; + switch_mac_mode2 = <0x0f>; + bm_tick_mode = <0x00>; + tm_tick_mode = <0x00>; + + qcom,port_phyinfo { + port@5 { + port_id = <6>; + phy_address = <28>; + port_mac_sel = "QGMAC_PORT"; + }; + }; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; + + qca8081_28: ethernet-phy@28 { + reg = <28>; + }; +}; + +&dp6 { + status = "okay"; + phy-handle = <&qca8081_28>; + label = "lan"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Netgear-WAX620"; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 440a267497..b61b721f3a 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -115,6 +115,20 @@ define Device/netgear_rax120v2 endef TARGET_DEVICES += netgear_rax120v2 +define Device/netgear_wax620 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Netgear + DEVICE_MODEL := WAX620 + DEVICE_DTS_CONFIG := config@hk07 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq8072 + DEVICE_PACKAGES += kmod-spi-gpio kmod-gpio-nxp-74hc164 \ + ipq-wifi-netgear_wax620 +endef +TARGET_DEVICES += netgear_wax620 + define Device/netgear_wax218 $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds index 6e2ec60403..913b58750c 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds @@ -12,6 +12,9 @@ edgecore,eap102) netgear,rax120v2) ucidef_set_led_netdev "aqr" "AQR" "white:aqr" "lan5" ;; +netgear,wax620) + ucidef_set_led_netdev "lan" "LAN" "lan:green" "lan" + ;; netgear,wax218) ucidef_set_led_netdev "lan" "LAN" "blue:lan" "lan" ucidef_set_led_wlan "wlan5g" "WIFI 5GHz" "blue:wlan5g" "phy0radio" diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 3953ae8db2..ad8e34e9fe 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -25,7 +25,8 @@ ipq807x_setup_interfaces() netgear,rax120v2) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "wan" ;; - netgear,wax218) + netgear,wax218|\ + netgear,wax620) ucidef_set_interface_lan "lan" "dhcp" ;; prpl,haze) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 742730f476..cba1f84b7f 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -16,6 +16,7 @@ case "$FIRMWARE" in dynalink,dl-wrx36|\ netgear,rax120v2|\ netgear,wax218|\ + netgear,wax620|\ qnap,301w|\ redmi,ax6|\ xiaomi,ax3600|\ diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index a7af1cc1df..90ebff17d4 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -69,7 +69,8 @@ platform_do_upgrade() { compex,wpq873|\ edimax,cax1800|\ netgear,rax120v2|\ - netgear,wax218) + netgear,wax218|\ + netgear,wax620) nand_do_upgrade "$1" ;; prpl,haze|\ From 3ce909914a12647bec52bcee0a162dd6d158a4f6 Mon Sep 17 00:00:00 2001 From: Sebastian Pflieger Date: Wed, 20 Sep 2023 20:13:14 +0200 Subject: [PATCH 07/22] lldpd: add lldp_syscapabilities config option allow to overwrite the detected system capabilities e.g. if devices does not operate as bridge. Signed-off-by: Sebastian Pflieger --- package/network/services/lldpd/files/lldpd.init | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 5b39144921..e1e8ac9fd4 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -45,12 +45,16 @@ write_lldpd_conf() local lldp_mgmt_ip config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip' + local lldp_syscapabilities + config_get lldp_syscapabilities 'config' 'lldp_syscapabilities' + # Clear out the config file first echo -n > "$LLDPD_CONF" [ -n "$ifnames" ] && echo "configure system interface pattern" "$ifnames" >> "$LLDPD_CONF" [ -n "$lldp_description" ] && echo "configure system description" "\"$lldp_description\"" >> "$LLDPD_CONF" [ -n "$lldp_hostname" ] && echo "configure system hostname" "\"$lldp_hostname\"" >> "$LLDPD_CONF" [ -n "$lldp_mgmt_ip" ] && echo "configure system ip management pattern" "\"$lldp_mgmt_ip\"" >> "$LLDPD_CONF" + [ -n "$lldp_syscapabilities" ] && echo "configure system capabilities enabled" "\"$lldp_syscapabilities\"" >> "$LLDPD_CONF" # Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR [ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR From 191da235510ca572d37a7e05fd5ec647d2df22a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Mon, 18 Sep 2023 11:55:57 +0200 Subject: [PATCH 08/22] ramips: fix Mercusys MR70X LAN port assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bug report in the forum found that the MR70X lists four LAN ports in LuCI while it has only three. This adds the device to the network setup file to fix the issue. Identified-by: Forum User "Lexeyko" Signed-off-by: Andreas Böhler --- target/linux/ramips/mt7621/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index e0b229c7ee..4496bf8f9f 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -17,6 +17,7 @@ ramips_setup_interfaces() h3c,tx1806|\ haier,har-20s2u1|\ hiwifi,hc5962|\ + mercusys,mr70x-v1|\ netgear,wax202|\ sim,simax1800t|\ xiaomi,mi-router-3-pro|\ From 03123a3ae5431a6ed3ac805cbe5d08f7b3202fc4 Mon Sep 17 00:00:00 2001 From: Sebastian Pflieger Date: Mon, 18 Sep 2023 15:02:13 +0200 Subject: [PATCH 09/22] arm-trusted-firmware-sunxi: update to version 2.9 - detect die revision used in variants of the Allwinner H616 SoC (H313, T507) - support for H6 boards without PMIC Tested on Pine64+ and Orange PI Zero2 Signed-off-by: Sebastian Pflieger --- package/boot/arm-trusted-firmware-sunxi/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/arm-trusted-firmware-sunxi/Makefile b/package/boot/arm-trusted-firmware-sunxi/Makefile index c9d5668122..f15357d357 100644 --- a/package/boot/arm-trusted-firmware-sunxi/Makefile +++ b/package/boot/arm-trusted-firmware-sunxi/Makefile @@ -7,10 +7,10 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2.8 +PKG_VERSION:=2.9 PKG_RELEASE:=1 -PKG_HASH:=df4e0f3803479df0ea4cbf3330b59731bc2efc2112c951f9adb3685229163af9 +PKG_HASH:=76a66a1de0c01aeb83dfc7b72b51173fe62c6e51d6fca17cc562393117bed08b PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=license.md From 75ee5546e9b7cfa5bbfd6f844ab8c5fffd5bb594 Mon Sep 17 00:00:00 2001 From: Elbert Mai Date: Sun, 17 Sep 2023 07:59:48 -0700 Subject: [PATCH 10/22] mediatek: filogic: add support for Ubiquiti UniFi 6 Plus (U6+) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ubiquiti U6+ is a dual-band WiFi 6 PoE access point. It is a drop-in upgrade of the U6 lite. Specifications --- - SoC: MediaTek MT7981A dual-core ARM Cortex-A53 1.3 GHz - RAM: 256 MB DDR3-2133 RAM - Flash: 16 MB SPI NOR and 4 GB eMMC - LAN: 1x Gigabit Ethernet with 802.3af/at support - WLAN: MediaTek MT7976C 2x2 MIMO dual-band WiFi 6 - LEDs: 1x blue and 1x white - Buttons: 1x reset button Installation --- 1. Power device using a PoE injector or switch 2. Connect via Ethernet to the device with static IP 192.168.1.2 3. SSH into the device with password: ubnt $ ssh ubnt@192.168.1.20 4. Unlock kernel partitions for writing $ echo 5edfacbf > /proc/ubnthal/.uf 5. Confirm correct partitions $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p6/uevent PARTNAME=kernel0 $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p7/uevent PARTNAME=kernel1 $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p8/uevent PARTNAME=bs 6. Set and confirm bootloader environment $ fw_setenv boot_openwrt "fdt addr \$(fdtcontroladdr); fdt rm /signature; bootubnt" $ fw_setenv bootcmd_real "run boot_openwrt" $ fw_printenv 7. Copy sysupgrade image to /tmp/openwrt.bin via scp 8. Copy kernel and rootfs to mmcblk0p6 and mmcblk0p7, respectively $ tar xf /tmp/openwrt.bin sysupgrade-ubnt_unifi-6-plus/kernel -O | dd of=/dev/mmcblk0p6 $ tar xf /tmp/openwrt.bin sysupgrade-ubnt_unifi-6-plus/root -O | dd of=/dev/mmcblk0p7 9. Ensure device boots from mmcblk0p6 $ echo -ne "\x00\x00\x00\x00\x2b\xe8\x4d\xa3" > /dev/mmcblk0p8 10. Reboot the device $ reboot Signed-off-by: Elbert Mai Signed-off-by: Bjørn Mork --- .../uboot-envtools/files/mediatek_filogic | 3 + .../dts/mt7981a-ubnt-unifi-6-plus.dts | 168 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-mt76-caldata | 7 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 8 + target/linux/mediatek/image/filogic.mk | 10 ++ 7 files changed, 202 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index d7d6bbf05c..803800ce1c 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -48,6 +48,9 @@ cetron,ct3003|\ netgear,wax220) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; +ubnt,unifi-6-plus) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000" + ;; xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) diff --git a/target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts b/target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts new file mode 100644 index 0000000000..ece78ee50e --- /dev/null +++ b/target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981.dtsi" + +/ { + model = "Ubiquiti UniFi 6 Plus"; + compatible = "ubnt,unifi-6-plus", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_white; + led-failsafe = &led_white; + led-running = &led_blue; + led-upgrade = &led_blue; + label-mac-device = &gmac1; + }; + + chosen { + bootargs-override = "console=ttyS0,115200n8 rootwait root=/dev/mmcblk0p7"; + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + + leds { + compatible = "gpio-leds"; + + led_blue: dome-blue { + label = "blue:dome"; + gpios = <&pio 9 GPIO_ACTIVE_HIGH>; + }; + + led_white: dome-white { + label = "white:dome"; + gpios = <&pio 34 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&pio { + spi2_flash_pins: spi2-pins { + mux { + function = "spi"; + groups = "spi2", "spi2_wp_hold"; + }; + + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + bias-pull-up = <103>; + }; + + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + bias-pull-down = <103>; + }; + }; + + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; +}; + +&spi2 { + pinctrl-names = "default"; + pinctrl-0 = <&spi2_flash_pins>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom: partition@00000 { + label = "EEPROM"; + reg = <0x00000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_eeprom_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_eeprom_6: macaddr@6 { + reg = <0x6 0x6>; + }; + }; + + partition@10000 { + label = "u-boot-env"; + reg = <0x10000 0x80000>; + }; + }; + }; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <8>; + max-frequency = <52000000>; + cap-mmc-highspeed; + vmmc-supply = <®_3p3v>; + non-removable; + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_eeprom_0>; + }; +}; + +&wifi { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 72bbf351c2..42490cf8b3 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -16,6 +16,7 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; netgear,wax220|\ + ubnt,unifi-6-plus|\ zyxel,nwa50ax-pro) ucidef_set_interface_lan "eth0" ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index c3d7c09974..f6f18272cc 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -14,6 +14,13 @@ case "$FIRMWARE" in ;; esac ;; +"mediatek/mt7981_eeprom_mt7976_dbdc.bin") + case "$board" in + ubnt,unifi-6-plus) + caldata_extract_mmc "factory" 0x0 0x1000 + ;; + esac + ;; "mediatek/mt7986_eeprom_mt7976.bin") case "$board" in acer,predator-w6) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index ea85939068..0fc90bd41b 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -58,6 +58,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress ;; + ubnt,unifi-6-plus) + addr=$(mtd_get_mac_binary EEPROM 0x6) + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; qihoo,360t7) addr=$(mtd_get_mac_ascii factory lanMac) [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 005d4a70e9..6155ddab72 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -88,6 +88,11 @@ platform_do_upgrade() { CI_UBIPART="ubi0" nand_do_upgrade "$1" ;; + ubnt,unifi-6-plus) + CI_KERNPART="kernel0" + EMMC_ROOT_DEV="$(cmdline_get_var root)" + emmc_do_upgrade "$1" + ;; h3c,magic-nx30-pro|\ mediatek,mt7981-rfb|\ qihoo,360t7|\ @@ -145,6 +150,9 @@ platform_copy_config() { ;; esac ;; + ubnt,unifi-6-plus) + emmc_copy_config + ;; esac } diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 48f5946e4b..c9cf30b1ce 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -521,6 +521,16 @@ define Device/tplink_tl-xdr6088 endef TARGET_DEVICES += tplink_tl-xdr6088 +define Device/ubnt_unifi-6-plus + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi 6 Plus + DEVICE_DTS := mt7981a-ubnt-unifi-6-plus + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware e2fsprogs f2fsck mkf2fs fdisk partx-utils + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += ubnt_unifi-6-plus + define Device/xiaomi_mi-router-wr30u-112m-nmbm DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router WR30U (112M UBI with NMBM-Enabled layout) From 0250e4e4bc334fd5539cde5127f07eef616f72cd Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Sun, 3 Sep 2023 11:05:27 -0400 Subject: [PATCH 11/22] ipq806x: sync config-6.1 with latest kernel Ran "make kernel_oldconfig" to generate Signed-off-by: Glen Lee --- target/linux/ipq806x/config-6.1 | 40 +++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/target/linux/ipq806x/config-6.1 b/target/linux/ipq806x/config-6.1 index 4c9d09bc27..960e16ae74 100644 --- a/target/linux/ipq806x/config-6.1 +++ b/target/linux/ipq806x/config-6.1 @@ -35,9 +35,8 @@ CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE=y CONFIG_ARM_CPUIDLE=y CONFIG_ARM_CPU_SUSPEND=y # CONFIG_ARM_CPU_TOPOLOGY is not set -CONFIG_ARM_CRYPTO=y CONFIG_ARM_GIC=y -CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_ARM_HAS_GROUP_RELOCS=y CONFIG_ARM_IPQ806X_FAB_DEVFREQ=y CONFIG_ARM_KRAIT_CACHE_DEVFREQ=y CONFIG_ARM_L1_CACHE_SHIFT=6 @@ -57,12 +56,18 @@ CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_MQ_PCI=y CONFIG_BOUNCE=y # CONFIG_CACHE_L2X0 is not set +CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_QCOM=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE_OVERRIDE=y CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_QCOM=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_CPUFREQ_DT=y CONFIG_CPUFREQ_DT_PLATDEV=y CONFIG_CPU_32v6K=y @@ -74,7 +79,6 @@ CONFIG_CPU_COPY_V6=y CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y CONFIG_CPU_FREQ=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y @@ -113,15 +117,19 @@ CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_HW=y CONFIG_CRYPTO_JITTERENTROPY=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_SHA1=y CONFIG_CRYPTO_LIB_SHA256=y +CONFIG_CRYPTO_LIB_UTILS=y CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_SHA512=y CONFIG_CRYPTO_ZSTD=y +CONFIG_CURRENT_POINTER_IN_TPIDRURO=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_GPIO=y +CONFIG_DEBUG_INFO=y CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" CONFIG_DEVFREQ_GOV_PASSIVE=y # CONFIG_DEVFREQ_GOV_PERFORMANCE is not set @@ -133,7 +141,6 @@ CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y CONFIG_DMA_OF=y CONFIG_DMA_OPS=y -CONFIG_DMA_REMAP=y CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DTC=y CONFIG_DT_IDLE_STATES=y @@ -143,10 +150,13 @@ CONFIG_DWMAC_IPQ806X=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_ETHERNET_PACKET_MANGLE=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y +CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -179,7 +189,6 @@ CONFIG_GLOB=y CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_CDEV=y CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y @@ -212,6 +221,7 @@ CONFIG_IPQ_GCC_806X=y # CONFIG_IPQ_GCC_8074 is not set # CONFIG_IPQ_LCC_806X is not set CONFIG_IRQCHIP=y +CONFIG_IRQSTACKS=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS=y @@ -322,6 +332,8 @@ CONFIG_OLD_SIGSUSPEND3=y CONFIG_PADATA=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PCI=y CONFIG_PCIEAER=y CONFIG_PCIEPORTBUS=y @@ -355,9 +367,7 @@ CONFIG_PINCTRL=y # CONFIG_PINCTRL_APQ8064 is not set # CONFIG_PINCTRL_APQ8084 is not set # CONFIG_PINCTRL_IPQ4019 is not set -# CONFIG_PINCTRL_IPQ6018 is not set CONFIG_PINCTRL_IPQ8064=y -# CONFIG_PINCTRL_IPQ8074 is not set # CONFIG_PINCTRL_MDM9615 is not set CONFIG_PINCTRL_MSM=y # CONFIG_PINCTRL_MSM8226 is not set @@ -365,19 +375,9 @@ CONFIG_PINCTRL_MSM=y # CONFIG_PINCTRL_MSM8909 is not set # CONFIG_PINCTRL_MSM8916 is not set # CONFIG_PINCTRL_MSM8960 is not set -# CONFIG_PINCTRL_MSM8976 is not set -# CONFIG_PINCTRL_MSM8994 is not set -# CONFIG_PINCTRL_MSM8996 is not set -# CONFIG_PINCTRL_MSM8998 is not set # CONFIG_PINCTRL_QCOM_SPMI_PMIC is not set # CONFIG_PINCTRL_QCOM_SSBI_PMIC is not set -# CONFIG_PINCTRL_QCS404 is not set -# CONFIG_PINCTRL_SC7180 is not set -# CONFIG_PINCTRL_SDM660 is not set -# CONFIG_PINCTRL_SDM845 is not set # CONFIG_PINCTRL_SDX65 is not set -# CONFIG_PINCTRL_SM8150 is not set -# CONFIG_PINCTRL_SM8250 is not set CONFIG_PM_DEVFREQ=y # CONFIG_PM_DEVFREQ_EVENT is not set CONFIG_PM_OPP=y @@ -385,6 +385,7 @@ CONFIG_POWER_RESET=y CONFIG_POWER_RESET_MSM=y CONFIG_POWER_SUPPLY=y CONFIG_PPS=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PRINTK_TIME=y CONFIG_PTP_1588_CLOCK=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y @@ -413,6 +414,7 @@ CONFIG_QCOM_SCM=y CONFIG_QCOM_SMEM=y # CONFIG_QCOM_SMSM is not set CONFIG_QCOM_SOCINFO=y +CONFIG_QCOM_SPM=y # CONFIG_QCOM_STATS is not set CONFIG_QCOM_TCSR=y CONFIG_QCOM_TSENS=y @@ -420,6 +422,7 @@ CONFIG_QCOM_WDT=y # CONFIG_QCS_GCC_404 is not set # CONFIG_QCS_Q6SSTOP_404 is not set # CONFIG_QCS_TURING_404 is not set +CONFIG_RANDSTRUCT_NONE=y CONFIG_RAS=y CONFIG_RATIONAL=y CONFIG_RCU_CPU_STALL_TIMEOUT=21 @@ -478,6 +481,7 @@ CONFIG_SMP_ON_UP=y # CONFIG_SM_VIDEOCC_8250 is not set CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SOC_BUS=y +CONFIG_SOFTIRQ_ON_OWN_STACK=y CONFIG_SPARSE_IRQ=y CONFIG_SPI=y CONFIG_SPI_MASTER=y @@ -501,6 +505,7 @@ CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THERMAL_HWMON=y CONFIG_THERMAL_OF=y +CONFIG_THREAD_INFO_IN_TASK=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y @@ -527,5 +532,6 @@ CONFIG_ZBOOT_ROM_BSS=0 CONFIG_ZBOOT_ROM_TEXT=0 CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y CONFIG_ZSTD_COMPRESS=y CONFIG_ZSTD_DECOMPRESS=y From 2970d4b6cc5c7dd23fcde884ed82b27f1b8d9363 Mon Sep 17 00:00:00 2001 From: Sebastian Pflieger Date: Mon, 18 Sep 2023 14:04:09 +0200 Subject: [PATCH 12/22] sunxi: generalize top-level BOARDNAME and update suported SoCs Allwinner created to may SoC variants to list them all at top-level. Signed-off-by: Sebastian Pflieger --- target/linux/sunxi/Makefile | 3 ++- target/linux/sunxi/cortexa53/target.mk | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/target/linux/sunxi/Makefile b/target/linux/sunxi/Makefile index acca20f123..74caebd7b1 100644 --- a/target/linux/sunxi/Makefile +++ b/target/linux/sunxi/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=sunxi -BOARDNAME:=Allwinner A1x/A20/A3x/H3/H5/R40 +BOARDNAME:=Allwinner ARM SoCs FEATURES:=fpu usb ext4 display rootfs-part rtc squashfs SUBTARGETS:=cortexa8 cortexa7 cortexa53 @@ -21,6 +21,7 @@ KERNELNAME:=zImage dtbs # A80: octa Cortex-A15/A7 # H3: quad Cortex-A7 # R40: quad Cortex-A7 +# A64/H5/H6/H616: quad Cortex-A53 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/sunxi/cortexa53/target.mk b/target/linux/sunxi/cortexa53/target.mk index 9e3a4064be..771e07d29f 100644 --- a/target/linux/sunxi/cortexa53/target.mk +++ b/target/linux/sunxi/cortexa53/target.mk @@ -5,6 +5,6 @@ include $(TOPDIR)/rules.mk ARCH:=aarch64 -BOARDNAME:=Allwinner A64/H5 +BOARDNAME:=Allwinner A64/H5/H6/H616 CPU_TYPE:=cortex-a53 KERNELNAME:=Image dtbs From 6b8e7144c8863686a8ddef6f4fcebb3b8cf85f36 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 14:49:41 +0900 Subject: [PATCH 13/22] mediatek: update LED/Key bindings for Buffalo WSR-2533DHP2 Update LED and key nodes with newer DeviceTree bindings for WSR-2533DHP2. - LED - use led-[0-9] for node name of LEDs - add "color" and "function" properties - drop default-state = "on" from green:power LED - this LED will be turned on by led-running alias - key - drop unnecessary poll-interval property - use key-[0-9] for node name of keys Signed-off-by: INAGAKI Hiroshi --- .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index 6d77be532b..fec559c8af 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -2,6 +2,7 @@ /dts-v1/; #include #include +#include #include "mt7622.dtsi" #include "mt6380.dtsi" @@ -29,43 +30,53 @@ leds { compatible = "gpio-leds"; - wireless_amber { + led-0 { label = "amber:wireless"; gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; }; - power_amber: power_amber { + power_amber: led-1 { label = "amber:power"; gpios = <&pio 3 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; }; - power_green: power_green { + power_green: led-2 { label = "green:power"; gpios = <&pio 4 GPIO_ACTIVE_LOW>; - default-state = "on"; + color = ; + function = LED_FUNCTION_POWER; }; - wireless_green { + led-3 { label = "green:wireless"; gpios = <&pio 15 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; }; - internet { + led-4 { label = "green:internet"; gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WAN; }; - router { + led-5 { label = "green:router"; gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_INDICATOR; }; }; keys { compatible = "gpio-keys"; - poll-interval = <100>; - reset { + key-reset { label = "reset"; gpios = <&pio 0 GPIO_ACTIVE_LOW>; linux,code = ; @@ -74,14 +85,14 @@ /* GPIO 1 and 16 are a tri-state switch button with * ROUTER / AP / WB. */ - router { + key-router { label = "router"; gpios = <&pio 1 GPIO_ACTIVE_LOW>; linux,code = ; linux,input-type = ; }; - bridge { + key-bridge { label = "wb"; gpios = <&pio 16 GPIO_ACTIVE_LOW>; linux,code = ; @@ -89,14 +100,14 @@ }; /* GPIO 18 is a switch button with AUTO / MANUAL. */ - manual { + key-manual { label = "manual"; gpios = <&pio 18 GPIO_ACTIVE_LOW>; linux,code = ; linux,input-type = ; }; - wps { + key-wps { label = "wps"; gpios = <&pio 102 GPIO_ACTIVE_LOW>; linux,code = ; From de62e0165264fb2872e87116ddceb8c7e12c5a5a Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 15:10:53 +0900 Subject: [PATCH 14/22] mediatek: update NVMEM bindings for Buffalo WSR-2533DHP2 Update NVMEM-related nodes and use newer binding for MAC addresses on Buffalo WSR-2533DHP2. Signed-off-by: INAGAKI Hiroshi --- .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index fec559c8af..9a44152a91 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -229,9 +229,8 @@ phy-connection-type = "2500base-x"; - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 (-1)>; nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; fixed-link { speed = <2500>; @@ -284,9 +283,22 @@ }; factory: partition@1c0000 { + compatible = "nvmem-cells"; label = "factory"; reg = <0x1c0000 0x40000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; }; partition@200000 { @@ -349,13 +361,3 @@ &rtc { status = "disabled"; }; - -&factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; - }; -}; From 94606abf63c22dfda9b9a63c603339505ed5f5b4 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 18:04:04 +0900 Subject: [PATCH 15/22] mediatek: add label-mac-device for Buffalo WSR-2533DHP2 Add label-mac-device with "&gmac0" phandle for Buffalo WSR-2533DHP2. Signed-off-by: INAGAKI Hiroshi --- target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index 9a44152a91..f8990b25cf 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -17,6 +17,7 @@ led-failsafe = &power_amber; led-running = &power_green; led-upgrade = &power_green; + label-mac-device = &gmac0; }; chosen { From 4d9113017b2d401e821fb008518cdd660dafb8a3 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 23:26:01 +0900 Subject: [PATCH 16/22] mediatek: drop pwm7_pins from Buffalo WSR-2533DHP2 MediaTek MT7622 doesn't support ch7 of PWM and pinctrl groups were dropped from driver source[0]. So pwm7-related groups are unavailable now, then, kernel shows a warning. [ 0.370264] mt7622-pinctrl 10211000.pinctrl: invalid group "pwm_ch7_2" for function "pwm" Drop that pinmux from pinctrl node. [0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/pinctrl/mediatek/pinctrl-mt7622.c?id=57972641810a97566ffd13e4be3f6a66d61eb3b5 Signed-off-by: INAGAKI Hiroshi --- .../linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index f8990b25cf..8b0dc1aa98 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -193,13 +193,6 @@ }; }; - pwm7_pins: pwm1-2-pins { - mux { - function = "pwm"; - groups = "pwm_ch7_2"; - }; - }; - uart0_pins: uart0-pins { mux { function = "uart"; @@ -330,8 +323,6 @@ }; &pwm { - pinctrl-names = "default"; - pinctrl-0 = <&pwm7_pins>; status = "okay"; }; From d0929006f2290307f6b9ba37d221f44a145d8d1b Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 17:29:12 +0900 Subject: [PATCH 17/22] mediatek: merge trx helpers in image/mt7622.mk Merge similar helpers of trx image generation, "buffalo-kernel-trx" and "trx-nand". Signed-off-by: INAGAKI Hiroshi --- target/linux/mediatek/image/mt7622.mk | 42 ++++++++++++--------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 53f5bd9d14..cf9534e2a5 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -6,19 +6,24 @@ define Image/Prepare echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark endef -define Build/buffalo-kernel-trx +define Build/buffalo-trx $(eval magic=$(word 1,$(1))) - $(eval dummy=$(word 2,$(1))) + $(eval kern_bin=$(if $(1),$(IMAGE_KERNEL),$@)) + $(eval rtfs_bin=$(word 2,$(1))) + $(eval apnd_bin=$(word 3,$(1))) $(eval kern_size=$(if $(KERNEL_SIZE),$(KERNEL_SIZE),0x400000)) - $(if $(dummy),touch $(dummy)) + $(if $(rtfs_bin),touch $(rtfs_bin)) $(STAGING_DIR_HOST)/bin/otrx create $@.new \ $(if $(magic),-M $(magic),) \ - -f $@ \ - $(if $(dummy),\ + -f $(kern_bin) \ + $(if $(rtfs_bin),\ -a 0x20000 \ -b $$(( $(subst k, * 1024,$(kern_size)) )) \ - -f $(dummy),) + -f $(rtfs_bin),) \ + $(if $(apnd_bin),\ + -A $(apnd_bin) \ + -a 0x20000) mv $@.new $@ endef @@ -51,19 +56,6 @@ define Build/mt7622-gpt rm $@.tmp endef -define Build/trx-nand - # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even - # if it grows up between releases - # root: UBI with one extra block containing UBI mark to trigger erasing - # rest of partition - $(STAGING_DIR_HOST)/bin/otrx create $@.new \ - -M 0x32504844 \ - -f $(IMAGE_KERNEL) -a 0x20000 -b 0x400000 \ - -f $@ \ - -A $(KDIR)/ubi_mark -a 0x20000 - mv $@.new $@ -endef - define Device/bananapi_bpi-r64 DEVICE_VENDOR := Bananapi DEVICE_MODEL := BPi-R64 @@ -120,13 +112,15 @@ define Device/buffalo_wsr-2533dhp2 IMAGES += factory.bin factory-uboot.bin KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \ - buffalo-kernel-trx - IMAGE/factory.bin := append-ubi | trx-nand | \ + buffalo-trx + IMAGE/factory.bin := append-ubi | \ + buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark | \ buffalo-enc WSR-2533DHP2 $$(BUFFALO_TAG_VERSION) -l | \ buffalo-tag-dhp WSR-2533DHP2 JP JP | buffalo-enc-tag -l | buffalo-dhp-image - IMAGE/factory-uboot.bin := append-ubi | trx-nand - IMAGE/sysupgrade.bin := append-kernel | \ - buffalo-kernel-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ + IMAGE/factory-uboot.bin := append-ubi | \ + buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark + IMAGE/sysupgrade.bin := \ + buffalo-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata DEVICE_PACKAGES := kmod-mt7615-firmware swconfig endef From e8646f5b3d050d61084b4cf373f8f64507ced8a6 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 18:37:15 +0900 Subject: [PATCH 18/22] mediatek: expand kernel size to 6MiB for WSR-2533DHP2 Expand kernel partition size on WSR-2533DHP2 for the kernel larger than 4 MiB. To prevent upgrading from old firmware before this commit, bump the compat version to 1.1 and add a message for forced sysupgrade using factory-uboot.bin image. Signed-off-by: INAGAKI Hiroshi --- target/linux/mediatek/image/mt7622.mk | 6 +++++- .../base-files/etc/uci-defaults/05_fix-compat-version | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index cf9534e2a5..6f64740628 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -101,7 +101,7 @@ define Device/buffalo_wsr-2533dhp2 DEVICE_DTS := mt7622-buffalo-wsr-2533dhp2 DEVICE_DTS_DIR := ../dts IMAGE_SIZE := 59392k - KERNEL_SIZE := 4096k + KERNEL_SIZE := 6144k BLOCKSIZE := 128k PAGESIZE := 2048 SUBPAGESIZE := 512 @@ -123,6 +123,10 @@ define Device/buffalo_wsr-2533dhp2 buffalo-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata DEVICE_PACKAGES := kmod-mt7615-firmware swconfig + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Partition table has been changed due to kernel size restrictions. \ + Please upgrade via sysupgrade with factory-uboot.bin image and '-F' option. \ + (Warning: your configurations will be erased!) endef TARGET_DEVICES += buffalo_wsr-2533dhp2 diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version index c77e1cb8bd..8331037869 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version @@ -1,7 +1,8 @@ . /lib/functions.sh case "$(board_name)" in - bananapi,bpi-r64) + bananapi,bpi-r64|\ + buffalo,wsr-2533dhp2) uci set system.@system[0].compat_version="1.1" uci commit system ;; From 9f640cae75ec987f29bf697cee559a0a4ff497e0 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 18:21:28 +0900 Subject: [PATCH 19/22] mediatek: separate dts/dtsi for Buffalo WSR series Separate dts/dtsi from the dts of Buffalo WSR-2533DHP2 to prepare adding suppport for WSR-3200AX4S. Signed-off-by: INAGAKI Hiroshi --- .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 230 +---------------- .../mediatek/dts/mt7622-buffalo-wsr.dtsi | 236 ++++++++++++++++++ 2 files changed, 240 insertions(+), 226 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index 8b0dc1aa98..a9f2959191 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -1,120 +1,20 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include -#include -#include "mt7622.dtsi" -#include "mt6380.dtsi" +#include "mt7622-buffalo-wsr.dtsi" / { model = "Buffalo WSR-2533DHP2"; compatible = "buffalo,wsr-2533dhp2", "mediatek,mt7622"; aliases { - serial0 = &uart0; - led-boot = &power_green; - led-failsafe = &power_amber; - led-running = &power_green; - led-upgrade = &power_green; label-mac-device = &gmac0; }; - chosen { - bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 swiotlb=512"; - }; - memory { reg = <0 0x40000000 0 0x0F000000>; }; - leds { - compatible = "gpio-leds"; - - led-0 { - label = "amber:wireless"; - gpios = <&pio 2 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_WLAN; - }; - - power_amber: led-1 { - label = "amber:power"; - gpios = <&pio 3 GPIO_ACTIVE_LOW>; - color = ; - function = LED_FUNCTION_POWER; - }; - - power_green: led-2 { - label = "green:power"; - gpios = <&pio 4 GPIO_ACTIVE_LOW>; - color = ; - function = LED_FUNCTION_POWER; - }; - - led-3 { - label = "green:wireless"; - gpios = <&pio 15 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_WLAN; - }; - - led-4 { - label = "green:internet"; - gpios = <&pio 19 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_WAN; - }; - - led-5 { - label = "green:router"; - gpios = <&pio 20 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_INDICATOR; - }; - }; - - keys { - compatible = "gpio-keys"; - - key-reset { - label = "reset"; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - /* GPIO 1 and 16 are a tri-state switch button with - * ROUTER / AP / WB. - */ - key-router { - label = "router"; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - - key-bridge { - label = "wb"; - gpios = <&pio 16 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - - /* GPIO 18 is a switch button with AUTO / MANUAL. */ - key-manual { - label = "manual"; - gpios = <&pio 18 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - - key-wps { - label = "wps"; - gpios = <&pio 102 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - rtkgsw: rtkgsw@0 { compatible = "mediatek,rtk-gsw"; mediatek,ethsys = <ðsys>; @@ -123,41 +23,7 @@ }; }; -&cpu0 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; -}; - -&cpu1 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; -}; - -&pcie0 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie0_pins>; - status = "okay"; -}; - -&slot0 { - status = "okay"; - - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x5000>; - ieee80211-freq-limit = <5000000 6000000>; - }; -}; - &pio { - eth_pins: eth-pins { - mux { - function = "eth"; - groups = "mdc_mdio", "rgmii_via_gmac2"; - }; - }; - /* Parallel nand is shared pin with eMMC */ parallel_nand_pins: parallel-nand-pins { mux { @@ -176,67 +42,11 @@ bias-pull-up; }; }; - - pcie0_pins: pcie0-pins { - mux { - function = "pcie"; - groups = "pcie0_pad_perst", - "pcie0_1_waken", - "pcie0_1_clkreq"; - }; - }; - - pmic_bus_pins: pmic-bus-pins { - mux { - function = "pmic"; - groups = "pmic_bus"; - }; - }; - - uart0_pins: uart0-pins { - mux { - function = "uart"; - groups = "uart0_0_tx_rx" ; - }; - }; - - watchdog_pins: watchdog-pins { - mux { - function = "watchdog"; - groups = "watchdog"; - }; - }; }; -&bch { - status = "okay"; -}; - -ð { - pinctrl-names = "default"; - pinctrl-0 = <ð_pins>; - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - - phy-connection-type = "2500base-x"; - - nvmem-cells = <&macaddr_factory_4 (-1)>; - nvmem-cell-names = "mac-address"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - }; +&gmac0 { + nvmem-cells = <&macaddr_factory_4 (-1)>; + nvmem-cell-names = "mac-address"; }; &nandc { @@ -321,35 +131,3 @@ }; }; }; - -&pwm { - status = "okay"; -}; - -&pwrap { - pinctrl-names = "default"; - pinctrl-0 = <&pmic_bus_pins>; - status = "okay"; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins>; - status = "okay"; -}; - -&watchdog { - pinctrl-names = "default"; - pinctrl-0 = <&watchdog_pins>; - status = "okay"; -}; - -&wmac { - status = "okay"; - - mediatek,mtd-eeprom = <&factory 0x0>; -}; - -&rtc { - status = "disabled"; -}; diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi b/target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi new file mode 100644 index 0000000000..e77f83d354 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi @@ -0,0 +1,236 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include +#include + +#include "mt7622.dtsi" +#include "mt6380.dtsi" + +/ { + aliases { + serial0 = &uart0; + led-boot = &power_green; + led-failsafe = &power_amber; + led-running = &power_green; + led-upgrade = &power_green; + }; + + chosen { + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 swiotlb=512"; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "amber:wireless"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; + }; + + power_amber: led-1 { + label = "amber:power"; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + }; + + power_green: led-2 { + label = "green:power"; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + }; + + led-3 { + label = "green:wireless"; + gpios = <&pio 15 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; + }; + + led-4 { + label = "green:internet"; + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led-5 { + label = "green:router"; + gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_INDICATOR; + }; + }; + + keys { + compatible = "gpio-keys"; + + key-reset { + label = "reset"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + /* GPIO 1 and 16 are a tri-state switch button with + * ROUTER / AP / WB. + */ + key-router { + label = "router"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + key-bridge { + label = "wb"; + gpios = <&pio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + /* GPIO 18 is a switch button with AUTO / MANUAL. */ + key-manual { + label = "manual"; + gpios = <&pio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + key-wps { + label = "wps"; + gpios = <&pio 102 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&cpu0 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; +}; + +&cpu1 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; +}; + +&pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; +}; + +&slot0 { + status = "okay"; + + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x5000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&pio { + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio", "rgmii_via_gmac2"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie0_pad_perst", + "pcie0_1_waken", + "pcie0_1_clkreq"; + }; + }; + + pmic_bus_pins: pmic-bus-pins { + mux { + function = "pmic"; + groups = "pmic_bus"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_0_tx_rx" ; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + + phy-connection-type = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&bch { + status = "okay"; +}; + +&pwm { + status = "okay"; +}; + +&pwrap { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_bus_pins>; + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&rtc { + status = "disabled"; +}; From 7383eb266b64f374c7109ad1db5360bf91dc11c3 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 23:23:20 +0900 Subject: [PATCH 20/22] mediatek: add support for Buffalo WSR-3200AX4S MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Buffalo WSR-3200AX4S is a 2.4/5 GHz band 11ax (Wi-Fi 6) router, based on MT7622B. Specification: - SoC : MediaTek MT7622B - RAM : DDR3 512 MiB - Flash : SPI-NAND 128 MiB (Winbond W25N01GVZEIG) - WLAN : 2.4/5 GHz 4T4R - 2.4 GHz : MediaTek MT7622B (SoC) - 5 GHz : MediaTek MT7915 - Ethernet : 5x 10/100/1000 Mbps - Switch : MediaTek MT7531 - LEDs/Keys : 6x/5x (2x: buttons, 3x: slide-switches) - UART : through-hole on PCB (J4) - assignment: 3.3V, GND, TX, RX from tri-angle marking - settings : 115200n8 - Power : 12 VDC, 1.5 A Flash instruction using factory.bin image: 1. Boot WSR-3200AX4S with "Router" mode 2. Access to "http://192.168.11.1/" and open firmware update page ("ファームウェア更新") 3. Select the OpenWrt factory.bin image and click update ("更新実行") button 4. Wait ~120 seconds to complete flashing Note: - This device has 2x OS images on flash. The first one will always be used for booting and the secondary is for backup. - This support generates multiple factory*.bin image: - factory.bin : for flashing from OEM WebUI - factory-uboot.bin: for flashing from U-Boot or clean installation via sysupgrade (don't use for normal sysupgrade) Known issues: - Wi-Fi MAC addresses won't be applied to each adapter. MAC Addresses: LAN : C4:3C:EA:xx:xx:60 (board_data, mac (text)) WAN : C4:3C:EA:xx:xx:60 (board_data, mac (text)) 2.4 GHz: C4:3C:EA:xx:xx:61 5 GHz : C4:3C:EA:xx:xx:68 Signed-off-by: INAGAKI Hiroshi --- .../dts/mt7622-buffalo-wsr-3200ax4s.dts | 175 ++++++++++++++++++ target/linux/mediatek/image/mt7622.mk | 41 ++-- .../mt7622/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/etc/uci-defaults/09_fix_crc | 4 + .../mt7622/base-files/lib/upgrade/platform.sh | 6 +- 6 files changed, 223 insertions(+), 14 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts new file mode 100644 index 0000000000..678c31b711 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts @@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7622-buffalo-wsr.dtsi" + +/ { + model = "Buffalo WSR-3200AX4S"; + compatible = "buffalo,wsr-3200ax4s", "mediatek,mt7622"; + + memory { + reg = <0 0x40000000 0 0x1f000000>; + }; +}; + +&pio { + /* Serial NAND is shared pin with SPI-NOR */ + serial_nand_pins: serial-nand-pins { + mux { + function = "flash"; + groups = "snfi"; + }; + + conf-cmd-dat { + pins = "SPI_WP", "SPI_HOLD", "SPI_MOSI", + "SPI_MISO", "SPI_CS"; + input-enable; + drive-strength = <16>; + bias-pull-up; + }; + + conf-clk { + pins = "SPI_CLK"; + drive-strength = <16>; + bias-pull-down; + }; + }; +}; + +&mdio { + switch@1f { + compatible = "mediatek,mt7531"; + reg = <0x1f>; + reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan4"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-connection-type = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; +}; + +&snfi { + pinctrl-names = "default"; + pinctrl-0 = <&serial_nand_pins>; + status = "okay"; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <104000000>; + nand-ecc-engine = <&snfi>; + mediatek,bmt-v2; + mediatek,bmt-table-size = <0x1000>; + /* + * - Preloader - (kernel (6MiB, in firmware)) + * - Kernel2 - WTB + */ + mediatek,bmt-remap-range = <0x0 0x8c0000>, + <0x1ac0000 0x5200000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "ATF"; + reg = <0x80000 0x40000>; + read-only; + }; + + partition@c0000 { + label = "u-boot"; + reg = <0xc0000 0x80000>; + read-only; + }; + + partition@140000 { + label = "u-boot-env"; + reg = <0x140000 0x80000>; + read-only; + }; + + factory: partition@1c0000 { + label = "factory"; + reg = <0x1c0000 0x100000>; + read-only; + }; + + partition@2c0000 { + compatible = "brcm,trx"; + brcm,trx-magic = <0x33504844>; + label = "firmware"; + reg = <0x2c0000 0x1800000>; + }; + + partition@1ac0000 { + label = "Kernel2"; + reg = <0x1ac0000 0x1800000>; + }; + + partition@32c0000 { + label = "glbcfg"; + reg = <0x32c0000 0x200000>; + read-only; + }; + + partition@34c0000 { + label = "board_data"; + reg = <0x34c0000 0x200000>; + read-only; + }; + + partition@36c0000 { + label = "WTB"; + reg = <0x36c0000 0x3600000>; + read-only; + }; + }; + }; +}; diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 6f64740628..65db1ebe2e 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -1,5 +1,7 @@ DTS_DIR := $(DTS_DIR)/mediatek +DEVICE_VARS += BUFFALO_TRX_MAGIC + define Image/Prepare # For UBI we want only one extra block rm -f $(KDIR)/ubi_mark @@ -95,33 +97,38 @@ define Device/bananapi_bpi-r64 endef TARGET_DEVICES += bananapi_bpi-r64 -define Device/buffalo_wsr-2533dhp2 +define Device/buffalo_wsr DEVICE_VENDOR := Buffalo - DEVICE_MODEL := WSR-2533DHP2 - DEVICE_DTS := mt7622-buffalo-wsr-2533dhp2 DEVICE_DTS_DIR := ../dts - IMAGE_SIZE := 59392k KERNEL_SIZE := 6144k BLOCKSIZE := 128k PAGESIZE := 2048 - SUBPAGESIZE := 512 UBINIZE_OPTS := -E 5 BUFFALO_TAG_PLATFORM := MTK BUFFALO_TAG_VERSION := 9.99 BUFFALO_TAG_MINOR := 9.99 IMAGES += factory.bin factory-uboot.bin - KERNEL_INITRAMFS := kernel-bin | lzma | \ + KERNEL_INITRAMFS = kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \ buffalo-trx - IMAGE/factory.bin := append-ubi | \ - buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark | \ - buffalo-enc WSR-2533DHP2 $$(BUFFALO_TAG_VERSION) -l | \ - buffalo-tag-dhp WSR-2533DHP2 JP JP | buffalo-enc-tag -l | buffalo-dhp-image + IMAGE/factory.bin = append-ubi | \ + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $$$$@ $(KDIR)/ubi_mark | \ + buffalo-enc $$(DEVICE_MODEL) $$(BUFFALO_TAG_VERSION) -l | \ + buffalo-tag-dhp $$(DEVICE_MODEL) JP JP | buffalo-enc-tag -l | buffalo-dhp-image IMAGE/factory-uboot.bin := append-ubi | \ - buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $$$$@ $(KDIR)/ubi_mark IMAGE/sysupgrade.bin := \ - buffalo-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata +endef + +define Device/buffalo_wsr-2533dhp2 + $(Device/buffalo_wsr) + DEVICE_MODEL := WSR-2533DHP2 + DEVICE_DTS := mt7622-buffalo-wsr-2533dhp2 + IMAGE_SIZE := 59392k + SUBPAGESIZE := 512 + BUFFALO_TRX_MAGIC := 0x32504844 DEVICE_PACKAGES := kmod-mt7615-firmware swconfig DEVICE_COMPAT_VERSION := 1.1 DEVICE_COMPAT_MESSAGE := Partition table has been changed due to kernel size restrictions. \ @@ -130,6 +137,16 @@ define Device/buffalo_wsr-2533dhp2 endef TARGET_DEVICES += buffalo_wsr-2533dhp2 +define Device/buffalo_wsr-3200ax4s + $(Device/buffalo_wsr) + DEVICE_MODEL := WSR-3200AX4S + DEVICE_DTS := mt7622-buffalo-wsr-3200ax4s + IMAGE_SIZE := 24576k + BUFFALO_TRX_MAGIC := 0x33504844 + DEVICE_PACKAGES := kmod-mt7915-firmware +endef +TARGET_DEVICES += buffalo_wsr-3200ax4s + define Device/elecom_wrc-2533gent DEVICE_VENDOR := Elecom DEVICE_MODEL := WRC-2533GENT diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network index 38db921f5c..d1341099bc 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -9,6 +9,7 @@ mediatek_setup_interfaces() case $board in bananapi,bpi-r64|\ + buffalo,wsr-3200ax4s|\ elecom,wrc-x3200gst3|\ linksys,e8450|\ linksys,e8450-ubi|\ @@ -55,6 +56,11 @@ mediatek_setup_macs() local label_mac="" case $board in + buffalo,wsr-3200ax4s) + lan_mac=$(mtd_get_mac_ascii board_data "mac") + wan_mac=$lan_mac + label_mac=$lan_mac + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) lan_mac=$(macaddr_add $(get_mac_label) 1) diff --git a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index f8639e9f40..7ee9f24071 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -13,6 +13,11 @@ case "$board" in bananapi,bpi-r64) [ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress ;; + buffalo,wsr-3200ax4s) + basemac=$(mtd_get_mac_ascii board_data "mac") + [ "$PHYNBR" = "0" ] && macaddr_add $basemac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $basemac 8 > /sys${DEVPATH}/macaddress + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc index 81cb6b18b7..59b00a6e69 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc @@ -7,4 +7,8 @@ buffalo,wsr-2533dhp2) mtd -M 0x44485032 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 exit 1 ;; +buffalo,wsr-3200ax4s) + mtd -M 0x44485033 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 + exit 1 + ;; esac diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index b37b7b1c6e..ea3176d2d1 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -21,7 +21,8 @@ platform_do_upgrade() { ;; esac ;; - buffalo,wsr-2533dhp2) + buffalo,wsr-2533dhp2|\ + buffalo,wsr-3200ax4s) local magic="$(get_magic_long "$1")" # use "mtd write" if the magic is "DHP2 (0x44485032)" @@ -67,7 +68,8 @@ platform_check_image() { [ "$#" -gt 1 ] && return 1 case "$board" in - buffalo,wsr-2533dhp2) + buffalo,wsr-2533dhp2|\ + buffalo,wsr-3200ax4s) buffalo_check_image "$board" "$magic" "$1" || return 1 ;; elecom,wrc-x3200gst3|\ From 98d325aaf8bef992cc92e94feb14fe271d370dc0 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Sat, 22 Jul 2023 10:29:56 +0200 Subject: [PATCH 21/22] ipq40xx: wpj428: panic on squashfs error to work around boot limbo Apparently, a few ipq40xx devices have sporadic problems when reading the flash over SPI. When that happens, the result of the faulty SPI read is cached and it isn't re-attempted. Depending on when it happens, the router either panics and reboots or is left in a partially broken state (an application wont start). The data on the flash is alright. This wasn't the case with Openwrt with Linux < 5.x but I wasn't able to work out which software change was responsible. Github user karlpip created a patch for testing that disabled the cache entirely and added logs. Typically, only one or two SPI operations fail at a time: [689200.631152] spi-nor spi0.0: SPI transfer failed: -110 [689200.631280] spi_master spi0: failed to transfer one message from queue [689200.635369] jffs2: Write of 68 bytes at 0x00ffccf4 failed. returned -110, retlen 0 [689200.642014] jffs2: Not marking the space at 0x00ffccf4 as dirty because the flash driver returned retlen zero Because reads aren't re-attempted, squashfs can't recover: [3171844.279235] SQUASHFS error: Failed to read block 0x2bb912: -5 [3171844.279284] SQUASHFS error: Unable to read fragment cache entry [2bb912] [3171844.283980] SQUASHFS error: Unable to read page, block 2bb912, size 14e6c [3171844.291650] SQUASHFS error: Unable to read fragment cache entry [2bb912] [3171844.297831] SQUASHFS error: Unable to read page, block 2bb912, size 14e6c I assume there to be some kind of underlying electrical problem because, in my experience, this happens a lot more when PoE is used. NoTengoBattery has made an in-depth investigation: https://forum.openwrt.org/t/patch-squashfs-data-probably-corrupt/70480 .. and created a patch that evicts the page cache and retries reading: https://github.com/NoTengoBattery/openwrt/blob/linksys-ea6350v3-mastertrack/target/linux/ipq40xx/patches-5.4/9996-fs_squashfs_improve_squashfs_error_resistance.patch The patch also works well with the WPJ428 but NoTengoBattery didn't try to upstream it ("This is not the solution that should be used"). In 2020, I tried and failed to create a working patch that prevents faulty pages to be cached in the first place. Because I needed a solution, I backported "squashfs: add option to panic on errors " (10dde05b89980ef) which has since become available in Openwrt. The 'error=panic' option has been tested on a fleet of multiple hundred WPJ428s over multiple years. Without this patch, devices regularly went into 'limbo' on reboot or update and required a manual reboot. Devices with this patch don't. I was initially concerned that the kernel panic would leave devices with a real corrupted data but I haven't seen a case of actual corruption since (outside of people turning off the power during upgrades). The WPJ428 is the only device I tested this patch on - others might also benefit. Reviewed-by: Robert Marko Signed-off-by: Leon M. Busch-George --- .../files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts index 48b5cd53d8..d84d54e39b 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts @@ -25,6 +25,15 @@ model = "Compex WPJ428"; compatible = "compex,wpj428"; + chosen { + /* + * There's a chance that SPI reads fail even though the data itself is alright. + * The read result is cached and squashfs can't recover. + * Just panic when that happens and hope that next time it doesn't. + */ + bootargs-append = " rootflags=errors=panic"; + }; + soc { rng@22000 { status = "okay"; From 658549837282d0ca9decfdaf599fc67bf90418c6 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 8 Sep 2023 14:01:15 +0200 Subject: [PATCH 22/22] build: replace SourceName with PKG_NAME compile unit name Currently, the same information is stored at the Packages.manifest in the 'Package:' variable and also additionally in the 'SourceName:' variable. So we have for Packages.manifest for strongswan-charon-cmd: ``` Package: strongswan-charon-cmd Version: 5.9.11-1 SourceName: strongswan-charon-cmd License: GPL-2.0-or-later Section: net ``` This is not correct. Several installable packages are built from the same strongswan source. Therefore it makes more sense that the source name is really the source name. In this case the it is 'strongswan'. After this change the Packages.manifest for strongswan-charon-cmd: ``` Package: strongswan-charon-cmd Version: 5.9.11-1 SourceName: strongswan License: GPL-2.0-or-later Section: net ``` In summary. The 'Package' name is the name of the package to be installed on the target system. The 'SourceName' is the compile unit from which the package was build from. This must be the same for all installable packages built from the same compile unit. This commit fixes that. Signed-off-by: Florian Eckert --- include/package-ipkg.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 3063a86a28..afa2b81eb9 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -179,7 +179,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS) )$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1)))))) )$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES)) )$$(call addfield,Source,$(SOURCE) -)$$(call addfield,SourceName,$(1) +)$$(call addfield,SourceName,$(PKG_NAME) )$$(call addfield,License,$(LICENSE) )$$(call addfield,LicenseFiles,$(LICENSE_FILES) )$$(call addfield,Section,$(SECTION)