From 1c178f364454c5b73eb453fa0b101ae2f6454d4c Mon Sep 17 00:00:00 2001 From: Kien Truong Date: Sat, 11 Jan 2025 12:20:12 +0700 Subject: [PATCH 01/32] rockchip: disable kernel preemption This setting is more suitable for device running OpenWRT. Most OpenWRT targets are already default to this configuration, and it has shown better performance in VPN (wireguard). Fix: #17454 Signed-off-by: Kien Truong Link: https://github.com/openwrt/openwrt/pull/17575 Signed-off-by: Robert Marko --- target/linux/rockchip/armv8/config-6.6 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index 56fb2f96a14..68eed3e5f9b 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -530,12 +530,7 @@ CONFIG_POWER_RESET=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_SUPPLY_HWMON=y CONFIG_PPS=y -CONFIG_PREEMPT=y -CONFIG_PREEMPTION=y -CONFIG_PREEMPT_BUILD=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PRINTK_TIME=y CONFIG_PROC_PAGE_MONITOR=y CONFIG_PROC_VMCORE=y From 5f54e17bae54f79541524b83fd72da102196fab8 Mon Sep 17 00:00:00 2001 From: Jack Sun Date: Sun, 12 Jan 2025 14:14:16 +0800 Subject: [PATCH 02/32] tools/cmake: update to 3.31.4 Release notes: https://cmake.org/cmake/help/latest/release/3.31.html No need refresh patch Signed-off-by: Jack Sun Link: https://github.com/openwrt/openwrt/pull/17587 Signed-off-by: Robert Marko --- tools/cmake/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index c204c7522e7..da6eb516b75 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.31.3 +PKG_VERSION:=3.31.4 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=fac45bc6d410b49b3113ab866074888d6c9e9dc81a141874446eb239ac38cb87 +PKG_HASH:=a6130bfe75f5ba5c73e672e34359f7c0a1931521957e8393a5c2922c8b0f7f25 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From 3f87c5ac4221deb37d4c3e730e692eef8f9c9ffe Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 10 Jan 2025 16:01:56 -0500 Subject: [PATCH 03/32] kernel: bump 6.6 to 6.6.71 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.71 Manually rebased: airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch All other patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712 Run-tested: bcm27xx/bcm2712 Signed-off-by: John Audia [ fix manually rebased patch ] Link: https://github.com/openwrt/openwrt/pull/17568 Signed-off-by: Christian Marangi --- include/kernel-6.6 | 4 ++-- ...Rework-clock-handling-for-different-clock.patch | 14 +++++++------- ...mc-mtk-sd-add-support-for-AN7581-MMC-Host.patch | 14 ++++++-------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 1cda04d0c58..f034d0754cc 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .70 -LINUX_KERNEL_HASH-6.6.70 = 84d23ee07fb26febbcb6d1295ba15efdc67ac382b4137b2c8853146c10fd2f97 +LINUX_VERSION-6.6 = .71 +LINUX_KERNEL_HASH-6.6.71 = 219715ba2dcfa6539fba09ad3f9212772f3507189eb60d77f8e89b06c32e724e diff --git a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch index 7333ebbdf26..187715a5cc3 100644 --- a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch +++ b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch @@ -26,15 +26,15 @@ Signed-off-by: Christian Marangi const struct clk_ops pcie_ops; int (*hw_init)(struct platform_device *pdev, struct clk_hw_onecell_data *clk_data); -@@ -525,8 +526,6 @@ static void en7523_register_clocks(struc +@@ -504,8 +505,6 @@ static void en7523_register_clocks(struc + u32 rate; + int i; - hw = en7523_register_pcie_clk(dev, np_base); - clk_data->hws[EN7523_CLK_PCIE] = hw; -- - clk_data->num = EN7523_NUM_CLOCKS; - } - - static int en7523_clk_hw_init(struct platform_device *pdev, +- + for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) { + const struct en_clk_desc *desc = &en7523_base_clks[i]; + u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg; @@ -587,8 +586,6 @@ static void en7581_register_clocks(struc hw = en7523_register_pcie_clk(dev, base); diff --git a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch index 24c4dbde786..d116bb9ee05 100644 --- a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch +++ b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch @@ -103,29 +103,27 @@ Signed-off-by: Christian Marangi host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk"); if (IS_ERR(host->bus_clk)) -@@ -2740,11 +2767,14 @@ static int msdc_drv_probe(struct platfor - goto host_free; +@@ -2731,10 +2758,13 @@ static int msdc_drv_probe(struct platfor + return PTR_ERR(host->pins_default); } - host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); - if (IS_ERR(host->pins_uhs)) { -- ret = PTR_ERR(host->pins_uhs); - dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -- goto host_free; +- return PTR_ERR(host->pins_uhs); + /* AN7581 doesn't have state_uhs pins */ + if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { + host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); + if (IS_ERR(host->pins_uhs)) { -+ ret = PTR_ERR(host->pins_uhs); + dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -+ goto host_free; ++ return PTR_ERR(host->pins_uhs); + } } /* Support for SDIO eint irq ? */ -@@ -2825,6 +2855,12 @@ static int msdc_drv_probe(struct platfor +@@ -2815,6 +2845,12 @@ static int msdc_drv_probe(struct platfor dev_err(&pdev->dev, "Cannot ungate clocks!\n"); - goto release_mem; + goto release_clk; } + + /* AN7581 without regulator require tune to OCR values */ From a00ff9f6d13f6ff5eae57be70a270ccd668d5240 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Sun, 7 Aug 2022 10:15:35 -0500 Subject: [PATCH 04/32] qualcommax: ipq60xx: add TP-Link EAP610-Outdoor support TP-Link EAP610-Outdoor is a 802.11ax AP claiming AX1800 support. It is wall or pole mountable, and rated for outdoor use. It can only be powered via PoE. Specifications: --------------- * CPU: Qualcomm IPQ6018 Quad core Cortex-A53 * RAM: 512 MB * Storage: ESMT PSR1GA30DT 128MB NAND * Ethernet: * Gigabit RJ45 port with PoE input * WLAN: * 2.4GHz/5GHz * LEDs: * Multi-color System LED (Green/Amber) * Buttons: * 1x Reset * UART: 4-pin unpopulated header * 1.8 V level, Pinout 1 - TX, 2 - RX, 3 - GND, 4 - 1.8V Installation: ============= Web UI method ------------- Set up the device using the vendor's web UI. After that go to Management->SSH and enable the "SSH Login" checkbox. Select "Save". The connect to the machine via SSH: ssh -o hostkeyalgorithms=ssh-rsa Disable signature verification: cliclientd stopcs Rename the "-web-ui-factory" image to something less than 63 characters, maintaining the ".bin" suffix. * Go to System -> Firmware Update. * Under "New Firmware File", click "Browse" and select the image * Select "Update" and confirm by clicking "OK". If the update fails, the web UI should show an error message. Otherwise, the device should reboot into OpenWRT. TFTP method ----------- To flash via tftp, first place the initramfs image on the TFTP server. setenv serverip setenv ipaddr tftpboot tplink_eap610-outdoor-initramfs-uImage.itb bootm This should boot OpenWRT. Once booted, flash the sysupgrade.bin image using either luci or the commandline. The tplink2022 image format ============================ The vendor images of this device are packaged in a format that does not match any previous tplink formats. In order for flashing to work from the vendor's web UI, firmware updates need to be packaged in this format. The `tplink-mkimage-2022.py` is provided for this purpose. This script can also analyze vendor images, and extract the required "support" string. This string is checked by the vendor firmware, and images with a missing or incorrect string are rejected. Signed-off-by: Alexandru Gagniuc Link: https://github.com/openwrt/openwrt/pull/14922 Signed-off-by: Robert Marko --- include/image-commands.mk | 8 + .../uboot-envtools/files/qualcommax_ipq60xx | 4 + package/firmware/ipq-wifi/Makefile | 2 + scripts/tplink-mkimage-2022.py | 198 ++++++++++++++++++ .../boot/dts/qcom/ipq6018-eap610-outdoor.dts | 151 +++++++++++++ target/linux/qualcommax/image/ipq60xx.mk | 18 ++ .../ipq60xx/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 7 + .../lib/preinit/09_mount_factory_data | 19 ++ .../base-files/lib/upgrade/platform.sh | 76 +++++++ 10 files changed, 490 insertions(+) create mode 100755 scripts/tplink-mkimage-2022.py create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts create mode 100644 target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data diff --git a/include/image-commands.mk b/include/image-commands.mk index 2e129e0347d..aa48e19399e 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -626,6 +626,14 @@ define Build/sysupgrade-tar $@ endef +define Build/tplink-image-2022 + $(TOPDIR)/scripts/tplink-mkimage-2022.py \ + --create $@.new \ + --rootfs $@ \ + --support "$(TPLINK_SUPPORT_STRING)" + @mv $@.new $@ +endef + define Build/tplink-safeloader -$(STAGING_DIR_HOST)/bin/tplink-safeloader \ -B $(TPLINK_BOARD_ID) \ diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx index eec99ce8f97..77c96da24ac 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq60xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -25,6 +25,10 @@ netgear,wax214) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" ;; +tplink,eap610-outdoor) + idx="$(find_mtd_index 0:appsblenv)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" yuncore,fap650) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 679a1442115..9821e39a85f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -55,6 +55,7 @@ ALLWIFIBOARDS:= \ redmi_ax6 \ skspruce_wia3300-20 \ spectrum_sax1v1k \ + tplink_eap610-outdoor \ tplink_eap620hd-v1 \ tplink_eap660hd-v1 \ wallys_dr40x9 \ @@ -185,6 +186,7 @@ $(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,skspruce_wia3300-20,SKSpruce WIA3300-20)) $(eval $(call generate-ipq-wifi-package,spectrum_sax1v1k,Spectrum SAX1V1K)) +$(eval $(call generate-ipq-wifi-package,tplink_eap610-outdoor,TPLink EAP610-Outdoor)) $(eval $(call generate-ipq-wifi-package,tplink_eap620hd-v1,TP-Link EAP620 HD v1)) $(eval $(call generate-ipq-wifi-package,tplink_eap660hd-v1,TP-Link EAP660 HD v1)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) diff --git a/scripts/tplink-mkimage-2022.py b/scripts/tplink-mkimage-2022.py new file mode 100755 index 00000000000..4db69409c9e --- /dev/null +++ b/scripts/tplink-mkimage-2022.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 + +'''A program for manipulating tplink2022 images. + +A tplink2022 is an image format encountered on TP-Link devices around the year +2022. This was seen at least on the EAP610-Outdoor. The format is a container +for a rootfs, and has optional fields for the "software" version. It also + requires a "support" string that describes the list of compatible devices. + +This module is intended for creating such images with an OpenWRT UBI image, but +also supports analysis and extraction of vendor images. Altough tplink2022 +images can be signed, this program does not support signing image. + +To get an explanation of the commandline arguments, run this program with the +"--help" argument. +''' + +import argparse +import hashlib +import os +import pprint +import struct + +def decode_header(datafile): + '''Read the tplink2022 image header anbd decode it into a dictionary''' + header = {} + fmt = '>2I' + + datafile.seek(0x1014) + raw_header = datafile.read(8) + fields = struct.unpack(fmt, raw_header) + + header['rootfs_size'] = fields[0] + header['num_items'] = fields[1] + header['items'] = [] + + rootfs = {} + rootfs['name'] = 'rootfs.ubi' + rootfs['offset'] = 0 + rootfs['size'] = header['rootfs_size'] + header['items'].append(rootfs) + + for _ in range(header['num_items']): + entry = datafile.read(0x2c) + fmt = '>I32s2I' + fields = struct.unpack(fmt, entry) + + section = {} + section['name'] = fields[1].decode("utf-8").rstrip('\0') + section['type'] = fields[0] + section['offset'] = fields[2] + section['size'] = fields[3] + header['items'].append(section) + return header + +def extract(datafile): + '''Extract the sections of the tplink2022 image to separate files''' + header = decode_header(datafile) + + pretty = pprint.PrettyPrinter(indent=4, sort_dicts=False) + pretty.pprint(header) + + for section in header['items']: + datafile.seek(0x1814 + section['offset']) + section_contents = datafile.read(section['size']) + + with open(f"{section['name']}.bin", 'wb') as section_file: + section_file.write(section_contents) + + with open('leftover.bin', 'wb') as extras_file: + extras_file.write(datafile.read()) + +def get_section_contents(section): + '''I don't remember what this does. It's been a year since I wrote this''' + if section.get('data'): + data = section['data'] + elif section.get('file'): + with open(section['file'], 'rb') as section_file: + data = section_file.read() + else: + data = bytes() + + if section['size'] != len(data): + raise ValueError("Wrong section size", len(data)) + + return data + +def write_image(output_image, header): + '''Write a tplink2022 image with the contents in the "header" dictionary''' + with open(output_image, 'w+b') as out_file: + # header MD5 + salt = [ 0x7a, 0x2b, 0x15, 0xed, + 0x9b, 0x98, 0x59, 0x6d, + 0xe5, 0x04, 0xab, 0x44, + 0xac, 0x2a, 0x9f, 0x4e + ] + + out_file.seek(4) + out_file.write(bytes(salt)) + + # unknown section + out_file.write(bytes([0xff] * 0x1000)) + + # Table of contents + raw_header = struct.pack('>2I', header['rootfs_size'], + header['num_items']) + out_file.write(raw_header) + + for section in header['items']: + if section['name'] == 'rootfs.ubi': + continue + + hdr = struct.pack('>I32s2I', + section.get('type', 0), + section['name'].encode('utf-8'), + section['offset'], + section['size'] + ) + + out_file.write(hdr) + + for section in header['items']: + out_file.seek(0x1814 + section['offset']) + out_file.write(get_section_contents(section)) + + size = out_file.tell() + + out_file.seek(4) + md5_sum = hashlib.md5(out_file.read()) + + out_file.seek(0) + out_file.write(struct.pack('>I16s', size, md5_sum.digest())) + +def encode_soft_verson(): + '''Not sure of the meaning of version. Also doesn't appear to be needed.''' + return struct.pack('>4B1I2I', 0xff, 1, 0 ,0, 0x2020202, 30000, 1) + +def create_image(output_image, root, support): + '''Create an image with a ubi "root" and a "support" string.''' + header = {} + + header['rootfs_size'] = os.path.getsize(root) + header['items'] = [] + + rootfs = {} + rootfs['name'] = 'rootfs.ubi' + rootfs['file'] = root + rootfs['offset'] = 0 + rootfs['size'] = header['rootfs_size'] + header['items'].append(rootfs) + + support_list = {} + support_list['name'] = 'support-list' + support_list['data'] = support.replace(" ", "\r\n").encode('utf-8') + support_list['offset'] = header['rootfs_size'] + support_list['size'] = len(support_list['data']) + header['items'].append(support_list) + + sw_version = {} + sw_version['name'] = 'soft-version' + sw_version['type'] = 1 + sw_version['data'] = encode_soft_verson() + sw_version['offset'] = support_list['offset'] + support_list['size'] + sw_version['size'] = len(sw_version['data']) + header['items'].append(sw_version) + + header['num_items'] = len(header['items']) - 1 + write_image(output_image, header) + +def main(args): + '''We support image analysis,extraction, and creation''' + if args.extract: + with open(args.image, 'rb') as image: + extract(image) + elif args.create: + if not args.rootfs or not args.support: + raise ValueError('To create an image, specify rootfs and support list') + create_image(args.image, args.rootfs, args.support) + else: + with open(args.image, 'rb') as image: + header = decode_header(image) + + pretty = pprint.PrettyPrinter(indent=4, sort_dicts=False) + pretty.pprint(header) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='EAP extractor') + parser.add_argument('--info', action='store_true') + parser.add_argument('--extract', action='store_true') + parser.add_argument('--create', action='store_true') + parser.add_argument('image', type=str, + help='Name of image to create or decode') + parser.add_argument('--rootfs', type=str, + help='When creating an EAP image, UBI image with rootfs and kernel') + parser.add_argument('--support', type=str, + help='String for the "support-list" section') + + main(parser.parse_args()) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts new file mode 100644 index 00000000000..165fc3ef1b1 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018.dtsi" +#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-ess.dtsi" + +#include +#include +#include + +/ { + model = "TP-Link EAP610-Outdoor"; + compatible = "tplink,eap610-outdoor", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + led-boot = &led_sys_green; + led-failsafe = &led_sys_amber; + led-running = &led_sys_green; + led-upgrade = &led_sys_amber; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " ubi.block=0,rootfs root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_sys_amber: led-0 { + function = "system"; + color = ; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + + led_sys_green: led-1 { + function = "system"; + color = ; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-restart { + compatible = "gpio-restart"; + gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; + open-source; + }; +}; + +&blsp1_uart3 { + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio64"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio65"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + led_enable { + gpio-hog; + output-high; + gpios = <36 GPIO_ACTIVE_HIGH>; + line-name = "enable-leds"; + }; +}; + +&dp5 { + phy-handle = <&rtl8211f_4>; + phy-mode = "sgmii"; + label = "lan"; + status = "okay"; +}; + +&edma { + status = "okay"; +}; + +&mdio { + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>; + reset-delay-us = <10000>; + reset-post-delay-us = <50000>; + status = "okay"; + + rtl8211f_4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch { + switch_lan_bmp = ; + switch_mac_mode1 = ; + status = "okay"; + + qcom,port_phyinfo { + port@4 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&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>; + }; +}; + +&wifi { + ieee80211-freq-limit = <2402000 5835000>; + qcom,ath11k-calibration-variant = "TP-Link-EAP610-Outdoor"; + status = "okay"; +}; diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index 0b7cd413c36..c7e0be1181e 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -68,6 +68,24 @@ define Device/qihoo_360v6 endef TARGET_DEVICES += qihoo_360v6 +define Device/tplink_eap610-outdoor + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := EAP610-Outdoor + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6018 + DEVICE_PACKAGES := ipq-wifi-tplink_eap610-outdoor + IMAGES += web-ui-factory.bin + IMAGE/web-ui-factory.bin := append-ubi | tplink-image-2022 + TPLINK_SUPPORT_STRING := SupportList: \ + EAP610-Outdoor(TP-Link|UN|AX1800-D):1.0 \ + EAP610-Outdoor(TP-Link|JP|AX1800-D):1.0 \ + EAP610-Outdoor(TP-Link|CA|AX1800-D):1.0 +endef +TARGET_DEVICES += tplink_eap610-outdoor + define Device/yuncore_fap650 $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network index ecc9e57117b..44c0ba7049e 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network @@ -23,6 +23,9 @@ ipq60xx_setup_interfaces() qihoo,360v6) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; + tplink,eap610-outdoor) + ucidef_set_interface_lan "lan" "dhcp" + ;; linksys,mr7350|\ yuncore,fap650) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" @@ -51,6 +54,10 @@ ipq60xx_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) label_mac=$lan_mac ;; + tplink,eap610-outdoor) + label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + lan_mac=$label_mac + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 3380cc8653f..cf3e400586b 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -32,6 +32,13 @@ case "$FIRMWARE" in ath11k_patch_mac $(macaddr_add $label_mac 2) 1 ath11k_set_macflag ;; + tplink,eap610-outdoor) + caldata_from_file "/tmp/factory_data/radio" 0 0x10000 + label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + ath11k_patch_mac $label_mac 1 + ath11k_patch_mac $(macaddr_add $label_mac 1) 0 + ath11k_set_macflag + ;; yuncore,fap650) caldata_extract "0:art" 0x1000 0x20000 ;; diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data b/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data new file mode 100644 index 00000000000..97608db55dd --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data @@ -0,0 +1,19 @@ +#!/bin/sh + +preinit_mount_factory_data() { + local mtd_path + + . /lib/functions.sh + . /lib/functions/system.sh + + case $(board_name) in + tplink,eap610-outdoor) + mtd_path=$(find_mtd_chardev "factory_data") + ubiattach --dev-path="$mtd_path" --devn=1 + mkdir /tmp/factory_data + mount -o ro,noatime -t ubifs ubi1:ubi_factory_data /tmp/factory_data + ;; + esac +} + +boot_hook_add preinit_main preinit_mount_factory_data diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh index 411570715c2..f9d446ff1f7 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh @@ -4,6 +4,79 @@ REQUIRE_IMAGE_METADATA=1 RAMFS_COPY_BIN='fw_printenv fw_setenv head' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' +remove_oem_ubi_volume() { + local oem_volume_name="$1" + local oem_ubivol + local mtdnum + local ubidev + + mtdnum=$(find_mtd_index "$CI_UBIPART") + if [ ! "$mtdnum" ]; then + return + fi + + ubidev=$(nand_find_ubi "$CI_UBIPART") + if [ ! "$ubidev" ]; then + ubiattach --mtdn="$mtdnum" + ubidev=$(nand_find_ubi "$CI_UBIPART") + fi + + if [ "$ubidev" ]; then + oem_ubivol=$(nand_find_volume "$ubidev" "$oem_volume_name") + [ "$oem_ubivol" ] && ubirmvol "/dev/$ubidev" --name="$oem_volume_name" + fi +} + +tplink_get_boot_part() { + local cur_boot_part + local args + + # Try to find rootfs from kernel arguments + read -r args < /proc/cmdline + for arg in $args; do + local ubi_mtd_arg=${arg#ubi.mtd=} + case "$ubi_mtd_arg" in + rootfs|rootfs_1) + echo "$ubi_mtd_arg" + return + ;; + esac + done + + # Fallback to u-boot env (e.g. when running initramfs) + cur_boot_part="$(/usr/sbin/fw_printenv -n tp_boot_idx)" + case $cur_boot_part in + 1) + echo rootfs_1 + ;; + 0|*) + echo rootfs + ;; + esac +} + +tplink_do_upgrade() { + local new_boot_part + + case $(tplink_get_boot_part) in + rootfs) + CI_UBIPART="rootfs_1" + new_boot_part=1 + ;; + rootfs_1) + CI_UBIPART="rootfs" + new_boot_part=0 + ;; + esac + + fw_setenv -s - <<-EOF + tp_boot_idx $new_boot_part + EOF + + remove_oem_ubi_volume ubi_rootfs + nand_do_upgrade "$1" +} + platform_check_image() { return 0; } @@ -55,6 +128,9 @@ platform_do_upgrade() { qihoo,360v6) nand_do_upgrade "$1" ;; + tplink,eap610-outdoor) + tplink_do_upgrade "$1" + ;; yuncore,fap650) [ "$(fw_printenv -n owrt_env_ver 2>/dev/null)" != "7" ] && yuncore_fap650_env_setup local active="$(fw_printenv -n owrt_slotactive 2>/dev/null)" From 9d66b8b312fb6a4087244ee3ee10e1ba1623df81 Mon Sep 17 00:00:00 2001 From: Juan Pedro Paredes Caballero Date: Sat, 7 Dec 2024 14:20:31 +0100 Subject: [PATCH 05/32] mediatek: filogic: Add support for cudy wr3000h The manufacturer Cudy usually releases signed openwrt firmware, to facilitate the migration from the proprietary version to the official versions of openwrt. In contact with the manufacturer tells me that only releases the firmware of the WR3000H if and only if there is an official version. With this proposal I pretend to have an initial operative version so that they do their part, and facilitate to the users the possibility of using openwrt. In the present state, it is only possible to use this firmware by uploading and installing it with UART connection. AX3000 2.5G Dual Band Wi-Fi 6 Mesh Router (WR3000H) Hardware -------- MediaTek MT7981 WiSoC 256MB DDR3 RAM 128MB SPI-NAND (XMC XM25QH128C) MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) 4 LAN MediaTek MT7531 PHY 1 WAN RTL8221B-VB-CG 2.5Gbps PHY (C22) 2 Radios MT7976CN UART: 115200 8N1 3.3V MAC: LAN MAC: label mac WAN MAC: label mac + 1 2.4G MAC: label mac 5G MAC: label mac + 1 with LA bit set Installation ------------ 1. Connect to the serial port as described in the "Hardware" section. 2. Power on the device + press reset pin. Keep pressing reset pin to enter the U-Boot shell (The recovery.bin image load process must fail). 3. Download the OpenWrt initramfs image. Place it on an TFTP server connected to the Cudy LAN ports. Make sure the server is reachable at 192.168.1.88. Rename the image to "cudy3000h.bin" 4. Download and boot the OpenWrt initramfs image. $ tftpboot 0x46000000 cudy3000h.bin; bootm 0x46000000 5. IMPORTANT: Make backup from original firmware. System -> Backup /Flash Firmware -> Save mtdblock contents. All mtdblock one by one, keep unaltered (BL2, u-boot-env, Factory, bdinfo, FIP, and ubi). 6. Transfer the OpenWrt sysupgrade image to the device using scp. Install with sysupgrade. Warning for BL2 and U-BOOT developers ------------------------------------- The nand partition layout from vendor is slightly diferent from "standard". The FIP partition starts at 0x3c0000 be carefull with BL2 to BL31. The UBI partition start at 0x5c0000 be carefull. DO NOT OVERWRITE bdinfo partition it contains hardware MAC definition Layout is start-end (not start size) - 0x000000000000-0x000007800000 : "nmbm0" - 0x000000000000-0x000000100000 : "bl2" - 0x000000100000-0x000000180000 : "u-boot-env" - 0x000000180000-0x000000380000 : "factory" - 0x000000380000-0x0000003c0000 : "bdinfo" - 0x0000003c0000-0x0000005c0000 : "fip" - 0x0000005c0000-0x0000045c0000 : "ubi" ALLWAYS for U-BOOT operations check this setenv mtdids nmbm0=nmbm0 setenv mtdparts nmbm0:1024k(bl2),512k(u-boot-env),2048k(factory),256k(bdinfo),2048k(fip),65536k(ubi) Signed-off-by: Juan Pedro Paredes Caballero Link: https://github.com/openwrt/openwrt/pull/17458 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-cudy-wr3000h-v1.dts | 337 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 8 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 17 + 5 files changed, 367 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts new file mode 100644 index 00000000000..0808eb9557a --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts @@ -0,0 +1,337 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include + +#include "mt7981.dtsi" + +/ { + model = "Cudy WR3000H v1"; + compatible = "cudy,wr3000h-v1", "mediatek,mt7981-spim-snand-rfb"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + phyreset { + gpio-export,name = "phyreset"; + gpio-export,output = <1>; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led@0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + + led_internet { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_wps { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_wlan2g { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_wlan5g { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_lan1 { + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + color = ; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led_lan2 { + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led_lan3 { + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + color = ; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led_lan4 { + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + color = ; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led_wan { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 0>; + label = "lan"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + label = "wan"; + }; + +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; + phy6: ethernet-phy@6 { + compatible = "ethernet-phy-ieee802.3-c22"; // [RTL8221B-VB-CG 2.5Gbps PHY (C22)] + reg = <6>; + phy-mode = "2500base-x"; + }; + +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_de00: macaddr@de00 { + compatible = "mac-base"; + reg = <0xde00 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@3C0000 { + label = "FIP"; + reg = <0x3C0000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x5C0000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index ca4961c6553..a6bb9b0ca8a 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -38,6 +38,14 @@ cudy,re3000-v1) cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; +cudy,wr3000h-v1) + ucidef_set_led_netdev "lan1" "lan1" "white:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "white:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan3" "lan3" "white:lan-3" "lan3" "link tx rx" + ucidef_set_led_netdev "lan4" "lan4" "white:lan-4" "lan4" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" "link tx rx" + ucidef_set_led_netdev "internet" "internet" "white:wan-online" "wan" "link" + ;; glinet,gl-x3000|\ glinet,gl-xe3000) ucidef_set_led_default "power" "POWER" "green:power" "1" 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 3188fe71d5a..4ae2c70658f 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 @@ -79,6 +79,7 @@ case "$board" in cudy,re3000-v1|\ cudy,tr3000-v1|\ cudy,wr3000s-v1|\ + cudy,wr3000h-v1|\ cudy,wr3000-v1) addr=$(mtd_get_mac_binary bdinfo 0xde00) # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict 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 7556be52bda..1d89640a4ef 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -118,6 +118,10 @@ platform_do_upgrade() { CI_KERNPART="linux" nand_do_upgrade "$1" ;; + cudy,wr3000h-v1) + CI_UBIPART="ubi" + nand_do_upgrade "$1" + ;; cudy,re3000-v1|\ cudy,wr3000-v1|\ yuncore,ax835) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 22c9151ff37..afa5224b19a 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -705,6 +705,23 @@ define Device/cudy_wr3000s-v1 endef TARGET_DEVICES += cudy_wr3000s-v1 +define Device/cudy_wr3000h-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := WR3000H + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-wr3000h-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R59 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_wr3000h-v1 + define Device/dlink_aquila-pro-ai-m30-a1 DEVICE_VENDOR := D-Link DEVICE_MODEL := AQUILA PRO AI M30 From e5d1a501cbd0fdda47d9169e9f669c7fb4813f2a Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 7 Jan 2025 14:55:24 +0100 Subject: [PATCH 06/32] realtek: switch RTL8231 driver for HPE 1920-8G Update the base DTS file for the 8 port HPE 1920 devices (JG920A, JG921A, JG922A), causing the new RTL8231 MFD driver to be loaded at start-up. Signed-off-by: Sander Vanheule --- .../realtek/dts/rtl8380_hpe_1920-8g.dtsi | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi b/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi index 262dd83d21c..ddd46c4cf64 100644 --- a/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi +++ b/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi @@ -4,13 +4,6 @@ #include "rtl83xx_hpe_1920.dtsi" / { - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - }; - i2c0: i2c-gpio-0 { compatible = "i2c-gpio"; sda-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; @@ -46,6 +39,24 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + ðernet0 { mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; From 96850585e52dfff2c25d8b20b0b5cd192981ed4d Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 7 Jan 2025 14:59:20 +0100 Subject: [PATCH 07/32] realtek: switch RTL8231 driver for HPE 1920-16/24G Update the base DTS file for the 16 and 24 port HPE 1920 devices (JG923A, JG924A, JG925A, JG926A), causing the new RTL8231 MFD driver to be loaded at start-up. Signed-off-by: Sander Vanheule --- .../linux/realtek/dts/rtl8382_hpe_1920.dtsi | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi b/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi index af168067d4d..20d8693a3be 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi +++ b/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi @@ -4,12 +4,6 @@ #include "rtl83xx_hpe_1920.dtsi" / { - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - }; i2c0: i2c-gpio-0 { compatible = "i2c-gpio"; @@ -84,6 +78,24 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + ðernet0 { mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; From 191ed4e803bbd82e9023d73ed9ff3c1d5ea64892 Mon Sep 17 00:00:00 2001 From: "Anton Yu. Ivanusev" Date: Wed, 8 Jan 2025 01:14:10 +0500 Subject: [PATCH 08/32] ramips: mt76x8: fixs for Keenetic Air (KN-1613) and Extra (KN-1713) A new syntax for LEDs was used, and migration of the LEDs configuration was added. Used lower case hex characters for the addresses. Fixed a USB port power issue. Signed-off-by: Anton Yu. Ivanusev Link: https://github.com/openwrt/openwrt/pull/17521 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_keenetic_kn-1613.dts | 9 ++++-- .../ramips/dts/mt7628an_keenetic_kn-1713.dts | 32 ++++++++++--------- .../base-files/etc/board.d/04_led_migration | 16 ++++++++++ 3 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts index 4b124c92954..af6292980b8 100644 --- a/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts @@ -30,18 +30,21 @@ }; internet { - label = "green:internet"; + function = LED_FUNCTION_WAN; + color = ; gpios = <&gpio 38 GPIO_ACTIVE_LOW>; }; wifi2 { - label = "green:wifi2"; + function = LED_FUNCTION_WLAN_2GHZ; + color = ; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; wifi5 { - label = "green:wifi5"; + function = LED_FUNCTION_WLAN_5GHZ; + color = ; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy1tpt"; }; diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts index 972c88eadd0..84127a88e04 100644 --- a/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts @@ -27,6 +27,7 @@ regulator-max-microvolt = <5000000>; gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; enable-active-high; + regulator-always-on; }; leds { @@ -44,17 +45,18 @@ gpios = <&gpio 38 GPIO_ACTIVE_LOW>; }; - fn { - function = LED_FUNCTION_USB; + wifi2 { + function = LED_FUNCTION_WLAN_2GHZ; color = ; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; }; - wifi { - function = LED_FUNCTION_WLAN; + wifi5 { + function = LED_FUNCTION_WLAN_5GHZ; color = ; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt","phy1tpt"; + linux,default-trigger = "phy1tpt"; }; }; @@ -93,7 +95,7 @@ partition@0 { compatible = "denx,uimage"; label = "firmware"; - reg = <0x0 0x1CC0000>; + reg = <0x0 0x1cc0000>; }; }; }; @@ -160,21 +162,21 @@ reg = <0x50000 0xe60000>; }; - partition@EB0000 { + partition@eb0000 { label = "config_1"; - reg = <0xEB0000 0x40000>; + reg = <0xeb0000 0x40000>; read-only; }; - partition@EF0000 { + partition@ef0000 { label = "storage"; - reg = <0xEF0000 0x100000>; + reg = <0xef0000 0x100000>; read-only; }; - partition@FF0000 { + partition@ff0000 { label = "dump"; - reg = <0xFF0000 0x10000>; + reg = <0xff0000 0x10000>; read-only; }; @@ -198,12 +200,12 @@ firmware2: partition@1050000 { label = "firmware_2"; - reg = <0x1050000 0xE60000>; + reg = <0x1050000 0xe60000>; }; - partition@1EB0000 { + partition@1eb0000 { label = "Config_2"; - reg = <0x1EB0000 0x40000>; + reg = <0x1eb0000 0x40000>; read-only; }; }; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration b/target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration new file mode 100644 index 00000000000..c845fadd734 --- /dev/null +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration @@ -0,0 +1,16 @@ +. /lib/functions.sh +. /lib/functions/migrations.sh + +board=$(board_name) + +case "$board" in +keenetic,kn-1613) + migrate_leds 'green:internet=green:wan' + ;; +esac + +remove_devicename_leds + +migrations_apply system + +exit 0 From b2b4ce15322c75bda0cae6fb2160a74270185831 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 17:04:33 +0100 Subject: [PATCH 09/32] lantiq: xrx200_legacy: add alternative names for TP-Link TD-W9980(B) The TP-Link TD-W9980(B) shares the same hardware with the TP-Link TD-W8980. The only difference is that the TD-W8980 does not support VDSL. This is a software limitation and once the software is changed, both work equally supporting VDSL. This commit adds alternative names for devices so they can be easily found in the firmware selector. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17583 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/image/tp-link_legacy.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/lantiq/image/tp-link_legacy.mk b/target/linux/lantiq/image/tp-link_legacy.mk index d9bcd35d10f..19a81bd8274 100644 --- a/target/linux/lantiq/image/tp-link_legacy.mk +++ b/target/linux/lantiq/image/tp-link_legacy.mk @@ -36,6 +36,12 @@ define Device/tplink_tdw8980 $(Device/lantiqTpLink) DEVICE_MODEL := TD-W8980 DEVICE_VARIANT := v1 + DEVICE_ALT0_VENDOR := TP-LINK + DEVICE_ALT0_MODEL := TD-W9980 + DEVICE_ALT0_VARIANT := v1 + DEVICE_ALT1_VENDOR := TP-LINK + DEVICE_ALT1_MODEL := TD-W9980B + DEVICE_ALT1_VARIANT := v1 TPLINK_FLASHLAYOUT := 8Mltq TPLINK_HWID := 0x89800001 TPLINK_HWREV := 14 From 1b045a7c13aeb141e0c069aaf5fc38989eee11cf Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 17:10:42 +0100 Subject: [PATCH 10/32] lantiq: xrx200: add alternative names for Plusnet Hub One and BT Business Hub 5A The Plusnet Hub One and BT Business Hub 5A have the same hardware as the BT Home Hub 5A. This commit adds alternative names so that both devices can be easily found in the firmware selector. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17583 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/image/vr9.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index 48a372f4768..05999e408de 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -292,6 +292,11 @@ define Device/bt_homehub-v5a DEVICE_VENDOR := British Telecom (BT) DEVICE_MODEL := Home Hub 5 DEVICE_VARIANT := Type A + DEVICE_ALT0_VENDOR := British Telecom (BT) + DEVICE_ALT0_MODEL := Business Hub 5 + DEVICE_ALT0_VARIANT := Type A + DEVICE_ALT1_VENDOR := Plusnet + DEVICE_ALT1_MODEL := Hub One BOARD_NAME := BTHOMEHUBV5A DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader \ kmod-ath10k-ct ath10k-firmware-qca988x-ct wpad-basic-mbedtls kmod-usb-dwc2 From 524e22b4c71366be86493ca3ee7a16ff92d52288 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 16:34:46 +0100 Subject: [PATCH 11/32] lantiq: xway_legacy: refresh config This was done by executing these command: $ make kernel_oldconfig CONFIG_TARGET=subtarget Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17581 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/xrx200_legacy/config-6.6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/lantiq/xrx200_legacy/config-6.6 b/target/linux/lantiq/xrx200_legacy/config-6.6 index c8650c4e87f..166a2cde067 100644 --- a/target/linux/lantiq/xrx200_legacy/config-6.6 +++ b/target/linux/lantiq/xrx200_legacy/config-6.6 @@ -7,7 +7,6 @@ CONFIG_CPU_MIPSR2_IRQ_VI=y CONFIG_CPU_RMAP=y CONFIG_CRC16=y CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_ZSTD=y CONFIG_EXTRA_FIRMWARE="lantiq/xrx200_phy11g_a14.bin lantiq/xrx200_phy11g_a22.bin lantiq/xrx200_phy22f_a14.bin lantiq/xrx200_phy22f_a22.bin" @@ -47,6 +46,7 @@ CONFIG_NET_SWITCHDEV=y CONFIG_NLS=y CONFIG_NR_CPUS=2 CONFIG_PADATA=y +CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PCI=y CONFIG_PCIEPORTBUS=y CONFIG_PCIE_LANTIQ=y From 517b9c1cdcd357fd84c7f27bd2886f235f3ec946 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 16:37:47 +0100 Subject: [PATCH 12/32] lantiq: xrx200_legacy: disable unused phy drivers Subtarget xrx200_legacy supports only a few devices. They all use the integrated Lantiq GSWIP switch and lantiq xway PHYs. The atheros and icplus PHYs can be safely disabled. Switches used by individual devices are listed below. Device Switch PHY Alpha ASL56026 Lantiq GSWIP int. switch Arcadyan VG3503J Lantiq GSWIP int. switch Netgear DM200 Lantiq GSWIP int. switch TP-LINK TD-W8970 Lantiq GSWIP Lantiq PEF7071V TP-Link TD-W8980 Lantiq GSWIP Lantiq PEF7071V Reduces uncompressed kernel size by 16 kB. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17581 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/xrx200_legacy/config-6.6 | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/linux/lantiq/xrx200_legacy/config-6.6 b/target/linux/lantiq/xrx200_legacy/config-6.6 index 166a2cde067..9bb65cff07d 100644 --- a/target/linux/lantiq/xrx200_legacy/config-6.6 +++ b/target/linux/lantiq/xrx200_legacy/config-6.6 @@ -1,4 +1,3 @@ -CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_CONTEXT_TRACKING=y CONFIG_CONTEXT_TRACKING_IDLE=y @@ -16,7 +15,6 @@ CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GRO_CELLS=y CONFIG_HWMON=y CONFIG_HW_RANDOM=y -CONFIG_ICPLUS_PHY=y CONFIG_IFX_VPE_EXT=y CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y @@ -57,7 +55,6 @@ CONFIG_PHY_LANTIQ_VRX200_PCIE=y CONFIG_POWER_RESET_GPIO=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_SUPPLY_HWMON=y -CONFIG_QCOM_NET_PHYLIB=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_REGULATOR=y From 5aa996b06d77d7c0935071de6f2217f13be3f253 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 23 Dec 2024 13:28:25 -0800 Subject: [PATCH 13/32] ath79: pineapple-nano: use regulator for USB GPIO The chipidea USB2 driver used on this platform supports controlling GPIO through regulators. This is the upstream friendly solution. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17356 Signed-off-by: Hauke Mehrtens --- .../dts/ar9331_hak5_wifi-pineapple-nano.dts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts b/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts index a2b6edbd5e7..4a4f455acf0 100644 --- a/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts +++ b/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts @@ -29,12 +29,6 @@ gpio-export,name = "usb-alarm"; gpios = <&gpio 20 GPIO_ACTIVE_LOW>; }; - - usb-power { - gpio-export,name = "usb-power"; - gpio-export,output = <0>; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - }; }; keys { @@ -57,6 +51,14 @@ linux,default-trigger = "phy0tpt"; }; }; + + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; }; ð0 { @@ -123,6 +125,8 @@ &usb { status = "okay"; + + vbus-supply = <®_power_usb>; }; &usb_phy { From 90e86a871319e481322959e301b2603c258092a9 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 23 Dec 2024 13:20:49 -0800 Subject: [PATCH 14/32] ath79: gl-ar150: fix USB GPIO usage Currently, an OpenWrt hack is used to turn the GPIO on in terms of the PHY driver when it should be the USB driver that controls it. The chipidea USB2 driver has support for a vbus-supply property. Use it instead of the local OpenWrt solution that just turns on the GPIO. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17356 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts index fe1d3186cff..8e38c9f5fba 100644 --- a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts +++ b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts @@ -62,16 +62,26 @@ gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; }; + + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb { - dr_mode = "host"; status = "okay"; + + dr_mode = "host"; + vbus-supply = <®_power_usb>; }; &usb_phy { status = "okay"; - gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; }; &spi { From 6c1ad2830e8bc5591db0bfed22873da5a670d08e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 23 Dec 2024 13:35:01 -0800 Subject: [PATCH 15/32] ath79: phy: remove named gpio exports The only real user of this patch was removed and migrated to the upstream friendly regulator. Remove this hack. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17356 Signed-off-by: Hauke Mehrtens --- .../700-phy-add-ath79-usb-phys.patch | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch index b50e4b51a45..1c1b2f2ca1b 100644 --- a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch +++ b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch @@ -51,7 +51,7 @@ Signed-off-by: John Crispin obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o --- /dev/null +++ b/drivers/phy/phy-ar7100-usb.c -@@ -0,0 +1,127 @@ +@@ -0,0 +1,117 @@ +/* + * Copyright (C) 2018 John Crispin + * @@ -144,16 +144,6 @@ Signed-off-by: John Crispin + if (IS_ERR(priv->phy)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + -+ priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); -+ if (gpio_is_valid(priv->gpio)) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ if (ret) -+ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); -+ -+ gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ + phy_set_drvdata(priv->phy, priv); + + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); @@ -181,7 +171,7 @@ Signed-off-by: John Crispin +MODULE_LICENSE("GPL"); --- /dev/null +++ b/drivers/phy/phy-ar7200-usb.c -@@ -0,0 +1,120 @@ +@@ -0,0 +1,111 @@ +/* + * Copyright (C) 2015 Alban Bedel + * @@ -268,15 +258,6 @@ Signed-off-by: John Crispin + if (IS_ERR(priv->phy)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + -+ priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); -+ if (gpio_is_valid(priv->gpio)) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ if (ret) -+ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); -+ gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ + phy_set_drvdata(priv->phy, priv); + + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); From 8fb805aa1f25b69b7849c8b1ce787ed47b16d123 Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Fri, 22 Nov 2024 00:05:39 +0100 Subject: [PATCH 16/32] mvebu: Add support for WD Cloud Mirror Gen2 Hardware -------- Marvell Armada 385 (MV88F6820) 512B RAM 256MB NAND (Hynix H27U2G8F2CTR) 1x 1Gbit 2x USB 3.0 2x SATA-III UART: 115200 8N1 3.3V RTC Weltrend MCU WT6703F connected via UART1 for Power LED / PWM Fan / hw reset / WoL Installation ------------ Connect UART 3.3V adapter to JP2 pins: 1-RX / 2-GND / 5-TX Use USB2.0 FAT32 pendrive with openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin 1. stop boot by pressing 1 2. usb start 3. fatload usb 0:1 0x02000000 openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin;bootm 0x02000000 - 4. do backup mtd1 mtd3 5. use sysupgrade Or tftp 1. stop boot by pressing 1 2. setenv ethact egiga2;setenv serverip 192.168.11.114;setenv ipaddr 192.168.11.113 3. tftpboot 0x02000000 openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin; bootm 0x02000000 - 4. do backup mtd1 mtd3 5. use sysupgrade or Evgeny Kolesnikov method from his failed PR 2040 - Using original firmware's network settings obtain SSH access to the device. - Put *-image-cfs-factory.bin and *-uImage-factory.bin images into device's /tmp directory. - Write kernel (uImage) image 'flash_eraseall /dev/mtd1 && nandwrite --markbad -p /dev/mtd1 /tmp/*-uImage-factory.bin'. - Write rootfs (image-cfs) image 'ubiformat /dev/mtd3 -f /tmp/*-image.cfs-factory.bin -y'. - Reboot the device. Installation (upgrade): Use *-sysupgrade.bin in a usual way. Weltrend MCU control is done via uart1 19200 stty -F /dev/ttyS1 raw speed 19200 stty -F /dev/ttyS1 raw speed 19200 PWM Fan Control off: 00 echo -n -e '\xfa\x02\x00\x00\x00\x00\xfb' > /dev/ttyS1 slow: 5F echo -n -e '\xfa\x02\x00\x5f\x00\x00\xfb' > /dev/ttyS1 max: FF echo -n -e '\xfa\x02\x00\xff\x00\x00\xfb' > /dev/ttyS1 Power LED Control Blue echo -n -e '\xfa\x26\x00\x11\x00\x01\xfb' > /dev/ttyS1 Red echo -n -e '\xfa\x26\x00\x14\x00\x01\xfb' > /dev/ttyS1 Orange echo -n -e '\xfa\x26\x00\x12\x00\x01\xfb' > /dev/ttyS1 more here: https://github.com/c-MM/mcm-daemon/blob/master/mcm.h Signed-off-by: Robert Senderek Link: https://github.com/openwrt/openwrt/pull/17046 Signed-off-by: Hauke Mehrtens --- .../base-files/etc/board.d/02_network | 9 +- .../base-files/lib/upgrade/platform.sh | 3 +- .../armada-385-wd_cloud-mirror-gen2.dts | 368 ++++++++++++++++++ target/linux/mvebu/image/cortexa9.mk | 17 + 4 files changed, 395 insertions(+), 2 deletions(-) create mode 100644 target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index 680af1ce673..8cf1c0e4261 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -13,7 +13,8 @@ mvebu_setup_interfaces() case "$board" in ctera,c200-v2|\ - synology,ds213j) + synology,ds213j|\ + wd,cloud-mirror-gen2) ucidef_set_interface_lan "eth0" "dhcp" ;; cznic,turris-omnia) @@ -94,6 +95,12 @@ mvebu_setup_macs() lan_mac=$label_mac wan_mac=$label_mac ;; + wd,cloud-mirror-gen2) + # mac address is on ubi "config" or ubi "reserve2" in text file. + # ubi "reserve2" /dev/mtd7 is twice small and only contains basic OEM factory info + label_mac=$(macaddr_canonicalize $(strings /dev/mtd7|grep -E '([0-9A-F]{2}[:])')) + lan_mac=$label_mac + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 70678622d34..13d8e77c93c 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -31,7 +31,8 @@ platform_do_upgrade() { CI_ROOT_UBIPART=ubi nand_do_upgrade "$1" ;; - buffalo,ls421de) + buffalo,ls421de|\ + wd,cloud-mirror-gen2) nand_do_upgrade "$1" ;; ctera,c200-v2) diff --git a/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts b/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts new file mode 100644 index 00000000000..50936e72adf --- /dev/null +++ b/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for Western Digital My Cloud Mirror Gen 2 + * (BWVZ/Grand Teton) + * + * Copyright (C) 2020 + * + * Based on the code from: + * + * Copyright (C) 2019 Evgeny Kolesnikov + * Copyright (C) 2016 Martin Mueller + * Copyright (C) 2013 Gregory CLEMENT + * Copyright (C) 2014 Thomas Petazzoni + * + */ + +/dts-v1/; +#include +#include +#include +#include "armada-385.dtsi" + +/ { + model = "WD MyCloud Mirror Gen 2 (BWVZ/Grand Teton)"; + compatible = "wd,cloud-mirror-gen2", "marvell,armada385", "marvell,armada380"; + + aliases { + led-boot = &led_boot; + led-failsafe = &led_boot; + led-upgrade = &led_boot; + }; + + chosen { + stdout-path = "serial0:115200n8"; + append-rootblock = "nullparameter="; /* override the bootloader args */ + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x20000000>; /* 512 MB */ + }; + + soc { + ranges = ; + + internal-regs { + timer@c200 { + status = "okay"; + }; + + i2c0: i2c@11000 { + status = "okay"; + clock-frequency = <100000>; + }; + + i2c1: i2c@11100 { + status = "okay"; + clock-frequency = <100000>; + }; + + serial@12000 { + status = "okay"; + }; + + /* Connected to Welltrend 6703F-OG240WT MCU + * which controls power, fan and other things + */ + serial@12100 { + status = "okay"; + }; + + pinctrl@18000 { + /* use only one pin for UART1, as mpp20 is used by sata0 */ + uart1_pins: uart-pins-1 { + marvell,pins = "mpp19"; + marvell,function = "ua1"; + }; + + xhci0_vbus_pins: xhci0-vbus-pins { + marvell,pins = "mpp26"; + marvell,function = "gpio"; + }; + + xhci1_vbus_pins: xhci1-vbus-pins { + marvell,pins = "mpp27"; + marvell,function = "gpio"; + }; + + sata0_pins: sata-pins-0 { + marvell,pins = "mpp55"; + marvell,function = "sata0"; + }; + + sata1_pins: sata-pins-1 { + marvell,pins = "mpp56"; + marvell,function = "sata1"; + }; + + sata_leds: sata-leds { + marvell,pins = "mpp43", "mpp52", "mpp53", "mpp54"; + marvell,function = "gpio"; + }; + + btn_pins: btn-pins { + marvell,pins = "mpp50"; + marvell,function = "gpio"; + }; + }; + + usb@58000 { + status = "okay"; + }; + + phy: mdio@72004 { + phy0: ethernet-phy@0 { + /* Init ETH LEDs */ + marvell,reg-init = <3 16 0 0x101e>; + reg = <0>; + }; + }; + + sata@a8000 { + status = "okay"; + }; + + nand-controller@d0000 { + status = "okay"; + + nand: nand@0 { + reg = <0>; + label = "pxa3xx_nand-0"; + nand-rb = <0>; + marvell,nand-keep-config; + #marvell,nand-enable-arbiter; //optional + nand-on-flash-bbt; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@00000000 { + label = "U-Boot"; + reg = <0x00000000 0x00500000>; /* 5 MB */ + read-only; + }; + + partition@00500000 { + label = "kernel"; + reg = <0x00500000 0x00500000>; /* 5 MB */ + }; + + partition@00a00000 { + label = "uRamdisk"; + reg = <0x00a00000 0x00500000>; /* 5 MB */ + read-only; + }; + + partition@00f00000 { + label = "ubi"; + reg = <0x00f00000 0x0b900000>; /* 185 MB */ + }; + + partition@c800000 { + label = "rescue fw"; + reg = <0x0c800000 0x00f00000>; /* 15 MB */ + read-only; + }; + + partition@d70000 { + label = "config"; + reg = <0x0d700000 0x01400000>; /* 20 MB */ + read-only; + }; + + partition@eb00000 { + label = "reserve1"; + reg = <0x0eb00000 0x00a00000>; /* 10 MB */ + read-only; + }; + + partition@f500000 { + label = "reserve2"; + reg = <0x0f500000 0x00a00000>; /* 10 MB */ + read-only; + }; + }; + }; + }; + + usb3@f0000 { + usb-phy = <&usb3_0_phy>; + status = "okay"; + }; + + usb3@f8000 { + usb-phy = <&usb3_1_phy>; + status = "okay"; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&sata_leds>; + + led_boot: s1red { + label = "red:hdd1"; + gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + s2red { + label = "red:hdd2"; + gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>; + }; + s1blue { + label = "blue:hdd1"; + gpios = <&gpio1 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "ata1"; + }; + s2blue { + label = "blue:hdd2"; + gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; + linux,default-trigger = "ata2"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + reset { + label = "reset"; + linux,code = ; // Restart=0x198, Power=0x116 + gpios = <&gpio1 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + wakeup-source; + }; + }; + + usb3_0_phy: usb3_0_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_0_vbus>; + }; + + usb3_1_phy: usb3_1_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_1_vbus>; + }; + + reg_usb3_0_vbus: usb3-vbus0 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus0"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci0_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>; + }; + + reg_usb3_1_vbus: usb3-vbus1 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus1"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci1_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>; + }; + + reg_sata0: pwr-sata0 { + compatible = "regulator-fixed"; + regulator-name = "pwr_en_sata0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + enable-active-high; + regulator-boot-on; + gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + + reg_5v_sata0: v5-sata0 { + compatible = "regulator-fixed"; + regulator-name = "v5.0-sata0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_sata0>; + }; + + reg_12v_sata0: v12-sata0 { + compatible = "regulator-fixed"; + regulator-name = "v12.0-sata0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + vin-supply = <®_sata0>; + }; + + reg_sata1: pwr-sata1 { + compatible = "regulator-fixed"; + regulator-name = "pwr_en_sata1"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + enable-active-high; + regulator-boot-on; + gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>; + }; + + reg_5v_sata1: v5-sata1 { + compatible = "regulator-fixed"; + regulator-name = "v5.0-sata1"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_sata1>; + }; + + reg_12v_sata1: v12-sata1 { + compatible = "regulator-fixed"; + regulator-name = "v12.0-sata1"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + vin-supply = <®_sata1>; + }; +}; + +&bm { + status = "okay"; +}; + +&bm_bppi { + status = "okay"; +}; + +ð2 { + status = "okay"; + phy = <&phy0>; + phy-mode = "sgmii"; + buffer-manager = <&bm>; + bm,pool-long = <0>; + bm,pool-short = <1>; +}; + +&ahci0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + sata-port@0 { + reg = <0>; + target-supply = <®_sata0>; + #thermal-sensor-cells = <0>; + }; + + sata-port@1 { + reg = <1>; + target-supply = <®_sata1>; + #thermal-sensor-cells = <1>; + }; +}; diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 4a41f2c1029..d572264866b 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -448,3 +448,20 @@ define Device/synology_ds213j -ppp -kmod-nft-offload -dnsmasq -odhcpd-ipv6only endef TARGET_DEVICES += synology_ds213j + +define Device/wd_cloud-mirror-gen2 + $(Device/NAND-128K) + DEVICE_VENDOR := Western Digital + DEVICE_MODEL := MyCloud Mirror Gen 2 (BWVZ/Grand Teton) + DEVICE_PACKAGES += -uboot-envtools coreutils-stty mkf2fs e2fsprogs \ + partx-utils kmod-hwmon-drivetemp -ppp -kmod-nft-offload -dnsmasq \ + -odhcpd-ipv6only + DEVICE_DTS := armada-385-wd_cloud-mirror-gen2 + KERNEL_SIZE := 5120k + KERNEL := kernel-bin | append-dtb | uImage none + KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none + IMAGES += image-cfs-factory.bin uImage-factory.bin + IMAGE/image-cfs-factory.bin := append-ubi + IMAGE/uImage-factory.bin := append-kernel +endef +TARGET_DEVICES += wd_cloud-mirror-gen2 From 8973c48515b758998c3870ceb94318cca1707896 Mon Sep 17 00:00:00 2001 From: "Anton Yu. Ivanusev" Date: Tue, 7 Jan 2025 20:38:09 +0500 Subject: [PATCH 17/32] ramips: mt76x8: add support for Keenetic Extra (KN-1711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specification: SoC: MediaTek MT7628AN RAM: 128 MB, ESMT M14D1G1664A (DDR2) Flash: 32MB, Winbond 25Q256JVFQ (Dual Boot, SPI) Switch: MediaTek MT7628AN, 5 ports 100 Mbps WiFi: MediaTek MT7603 2T2R/2.4GHz 802.11n and MediaTek MT7613AEN 2T2R/5GHz 802.11ac USB: 1 port USB 2.0 GPIO: 3 buttons (Wi-Fi, Reset, FN), 4 LEDs (Power, Internet, FN, Wi-Fi), USB port power controls Disassembly: At the bottom there are 4 screws hidden by rubber feet. After removing the screws, pry the gray plastic part around (it is secured with latches) and remove it. Serial Interface: The serial interface can be connected to the 4 pin dots to the left of the flash. Pins (from LEDs to LAN ports): 3.3V (do not connect) TX RX GND Settings: 115200, 8N1 Flashing via OEM recovery software: 1. Download the OEM recovery software from the manufacturer's website 2. Download the firmware image (for OpenWRT it is *-squashfs-factory.bin), rename it to KN-1711_recovery.bin 3. Replace the file in the fw folder OEM recovery software with the file from step 2. 4. Run the OEM recovery software and follow the instructions. Flashing via TFTP: 1. Connect your PC and router to port 1-4, configure PC interface using IP 192.168.1.2, mask 255.255.255.252 2. Serve the firmware image (for OpenWRT it is *-squashfs-factory.bin) renamed to KN-1711_recovery.bin via TFTP 3. Power up the router while pressing Reset button on the back 4. Release Restart button when Power LED starts blinking To revert back to OEM firmware: The return to the OEM firmware is carried out by using the methods described above with the help of the appropriate firmware image. When using OEM bootloader, the firmware image size cannot exceed the size of one OEM «Firmware_x» partition or Kernel + rootFS size. Signed-off-by: Anton Yu. Ivanusev Link: https://github.com/openwrt/openwrt/pull/17519 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_keenetic_kn-1711.dts | 243 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 12 + .../mt76x8/base-files/etc/board.d/01_leds | 3 +- .../mt76x8/base-files/etc/board.d/02_network | 1 + 4 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts new file mode 100644 index 00000000000..c0350eb4942 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts @@ -0,0 +1,243 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "keenetic,kn-1711", "mediatek,mt7628an-soc"; + model = "Keenetic KN-1711"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "USB-power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + internet { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + + wifi2 { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi5 { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + + keys { + compatible = "gpio-keys"; + + fn { + label = "fn"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "restart"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1CC0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "i2c", "gpio", "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <104000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-config"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "rf-eeprom"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_400: eeprom@400 { + reg = <0x400 0x4da8>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + }; + + firmware1: partition@50000 { + label = "firmware_1"; + reg = <0x50000 0xe60000>; + }; + + partition@eb0000 { + label = "config_1"; + reg = <0xeb0000 0x40000>; + read-only; + }; + + partition@ef0000 { + label = "storage"; + reg = <0xef0000 0x100000>; + read-only; + }; + + partition@ff0000 { + label = "dump"; + reg = <0xff0000 0x10000>; + read-only; + }; + + partition@1000000 { + label = "u-state"; + reg = <0x1000000 0x30000>; + read-only; + }; + + partition@1030000 { + label = "u-config_res"; + reg = <0x1030000 0x10000>; + read-only; + }; + + partition@1040000 { + label = "rf-eeprom_res"; + reg = <0x1040000 0x10000>; + read-only; + }; + + firmware2: partition@1050000 { + label = "firmware_2"; + reg = <0x1050000 0xe60000>; + }; + + partition@1EB0000 { + label = "Config_2"; + reg = <0x1eb0000 0x40000>; + read-only; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_400>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 76b19515884..d63148cae4a 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -366,6 +366,18 @@ define Device/keenetic_kn-1613 endef TARGET_DEVICES += keenetic_kn-1613 +define Device/keenetic_kn-1711 + BLOCKSIZE := 64k + IMAGE_SIZE := 13434880 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1711 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap kmod-usb2 + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ + check-size | zyimage -d 0x801711 -v "KN-1711" +endef +TARGET_DEVICES += keenetic_kn-1711 + define Device/keenetic_kn-1713 BLOCKSIZE := 64k IMAGE_SIZE := 13434880 diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index e13c5db50e6..b87062ae3c5 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -59,8 +59,9 @@ hiwifi,hc5761a) ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10" ;; keenetic,kn-1613|\ +keenetic,kn-1711|\ keenetic,kn-1713) - ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" + ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x01" ;; mediatek,linkit-smart-7688) ucidef_set_led_wlan "wifi" "wifi" "orange:wifi" "phy0tpt" diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 994ed0009b5..496bb809ef9 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -45,6 +45,7 @@ ramips_setup_interfaces() hilink,hlk-7628n|\ hilink,hlk-7688a|\ hiwifi,hc5861b|\ + keenetic,kn-1711|\ kroks,kndrt31r16|\ skylab,skw92a|\ tplink,archer-c20-v4|\ From 433be50c945a62c8ce9947166e86a8f122b174a8 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 8 Jan 2025 22:57:10 +0800 Subject: [PATCH 18/32] uboot-envtools: update to v2025.01 Update to latest version. There are no patches that need to be refreshed. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17538 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-envtools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 61939be6de9..5b52c3b3959 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot -PKG_VERSION:=2024.07 +PKG_VERSION:=2025.01 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 @@ -17,7 +17,7 @@ PKG_SOURCE_URL:= \ https://ftp.denx.de/pub/u-boot \ https://mirror.cyberbits.eu/u-boot \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_HASH:=cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) From 9a0f0611d2022fb21c400abfcf51c67493b5265a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 8 Jan 2025 22:57:36 +0800 Subject: [PATCH 19/32] mkimage: update to v2025.01 Update to latest version. There are no patches that need to be refreshed. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17539 Signed-off-by: Hauke Mehrtens --- tools/mkimage/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index 0a1712bc678..18d7ea2caad 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mkimage -PKG_VERSION:=2024.07 +PKG_VERSION:=2025.01 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ https://mirror.cyberbits.eu/u-boot \ https://ftp.denx.de/pub/u-boot \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_HASH:=cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) From 0d1568246f6834e4b593b23d43524d4c16a29e82 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Mon, 6 Jan 2025 08:33:36 +0100 Subject: [PATCH 20/32] mediatek: D-Link AQUILA PRO AI M60 A1: Fixed phy6 DTS settings Settings for phy6 can be simplified in the DTS Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17430 Signed-off-by: Hauke Mehrtens --- .../linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts index e805554a134..81634c7c08d 100644 --- a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts +++ b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts @@ -87,9 +87,8 @@ reset-post-delay-us = <1000000>; phy6: phy@6 { - compatible = "maxlinear,gpy211", "ethernet-phy-ieee802.3-c45"; + compatible = "ethernet-phy-ieee802.3-c45"; reg = <6>; - phy-mode = "2500base-x"; }; switch@1f { From d04f41e092294789b5add6816bb3b3bd7570a30d Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 8 Dec 2024 04:08:38 +0100 Subject: [PATCH 21/32] ath79: teltonika-rut230: fix typo in "green:signal-strength4" LED It's missing a hyphen present in every other LED from the set. Set it to "green:signal-strength-4". Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index c2c54b46629..192a7d2a045 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -68,7 +68,7 @@ }; signal-strength-4 { - label = "green:signal-strength4"; + label = "green:signal-strength-4"; gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; }; From 7b9ca01109827368deb68b7d8217643b78b87cb9 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Mon, 6 Jan 2025 17:31:44 +0100 Subject: [PATCH 22/32] ath79: teltonika-rut230: fix failsafe boot without SIM tray Due to "SIM present" input defaulting to "button" type, it is interpreted as such when booting, and causes the system to enter failsafe, if the tray is missing. Similarly to rfkill switch on TP-Link WDR4300 and Archer C7, make it EV_SW instead, to stop it from interfering with the boot process. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index 192a7d2a045..73a6cc52ca5 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -36,6 +36,7 @@ sim-tray { label = "sim-tray"; + linux,input-type = ; linux,code = ; gpios = <&gpio 20 GPIO_ACTIVE_LOW>; debounce-interval = <60>; From f28010a79c653f0ac7183c3cf774ed70f8818935 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:27:18 +0100 Subject: [PATCH 23/32] ath79: teltonika-rut230: add 4G LED Teltonika RUT240 has an extra 4G status LED on GPIO21. Otherwise the hardware is fully compatible with RUT230 line. Attach the LED inside device tree. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index 73a6cc52ca5..aa8a2204700 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -83,6 +83,11 @@ gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; }; + 4g { + label = "green:4g"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + lan { function = LED_FUNCTION_LAN; color = ; @@ -96,8 +101,6 @@ gpios = <&gpio 17 GPIO_ACTIVE_LOW>; /* GPIO 14 - ACTIVE HIGH for hwrev 0 */ }; - - /* 4G LED - GPIO21 ACTIVE_HIGH for RUT240 */ }; reg_usb_vbus: reg_usb_vbus { From 46a6f4968530f1f3b9d7ad0d3b1cac302ef45388 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 4 Jan 2025 02:12:42 +0100 Subject: [PATCH 24/32] ath79: teltonika-rut230: drop reg_usb_vbus USB VBUS regulator was attached to GPIO19, which isn't in fact controlling the modem power itself, but rather modem power key - which has to be asserted high for at least 500ms, to start the modem. Keeping it high allows the modem to reboot upon shutdown - so it is desirable to control this line from userspace, for example - to allow clean modem shutdown down upon powering off the router part. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index aa8a2204700..abac2797753 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -102,15 +102,6 @@ /* GPIO 14 - ACTIVE HIGH for hwrev 0 */ }; }; - - reg_usb_vbus: reg_usb_vbus { - compatible = "regulator-fixed"; - regulator-name = "usb_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; }; ð0 { @@ -197,7 +188,6 @@ &usb { dr_mode = "host"; - vbus-supply = <®_usb_vbus>; status = "okay"; }; From 852911a85dcaf69a8495153b2dabdf5f31efb5a6 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:34:00 +0100 Subject: [PATCH 25/32] ath79: teltonika-rut230: fully support digital output lines Remove GPIO hog for modem power, as well as define userspace GPIO switches for enabling and resetting the modem. While at that, define a switch for the external GPIO available on the power connector. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 9 --------- .../generic/base-files/etc/board.d/03_gpio_switches | 5 +++++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index abac2797753..ee59cecabb3 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -191,15 +191,6 @@ status = "okay"; }; -&gpio { - modem-power { - gpio-hog; - output-low; - gpios = <18 GPIO_ACTIVE_HIGH>; - line-name = "modem-power"; - }; -}; - &usb_phy { status = "okay"; }; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches index d5b41dc0b80..fe71b7b3c40 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches @@ -48,6 +48,11 @@ dlink,dir-835-a1) librerouter,librerouter-v1) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "513" "0" ;; +teltonika,rut230-v1) + ucidef_add_gpio_switch "DOUT" "DOUT" "524" "0" + ucidef_add_gpio_switch "modem_pwr" "Modem power" "531" "1" + ucidef_add_gpio_switch "modem_rst" "Modem reset" "530" "0" + ;; teltonika,rut955) ucidef_add_gpio_switch "sim_sel" "SIM select" "542" "1" ucidef_add_gpio_switch "DOUT1" "DOUT1 (OC)" "543" "0" From f39115632c69ffae50b1c37937d80e934a27d26d Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 8 Dec 2024 04:31:36 +0100 Subject: [PATCH 26/32] ath79: teltonika-rut230: include kmod-usb2 in image Otherwise USB PHY, controller and the built-in modem won't probe. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/generic.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 74ef0d2da08..88915c650c9 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -3063,8 +3063,8 @@ define Device/teltonika_rut230-v1 DEVICE_VENDOR := Teltonika DEVICE_MODEL := RUT230 DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-acm kmod-usb-net-qmi-wwan \ - uqmi -uboot-envtools + DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-acm \ + kmod-usb-net-qmi-wwan uqmi -uboot-envtools IMAGE_SIZE := 15552k TPLINK_HWID := 0x32200002 TPLINK_HWREV := 0x1 From 11ad73f97d35518b3b4def26a62fa78ae1b3dfe1 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:39:13 +0100 Subject: [PATCH 27/32] ath79: teltonika-rut230: include kmod-usb-serial-option in image Newer modems used in RUT240 (Quectel EC25 and MeiG SLM750) use the "option" driver instead of CDC-ACM. Include it in the image too. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 88915c650c9..3f813df2537 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -3064,7 +3064,7 @@ define Device/teltonika_rut230-v1 DEVICE_MODEL := RUT230 DEVICE_VARIANT := v1 DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-acm \ - kmod-usb-net-qmi-wwan uqmi -uboot-envtools + kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi -uboot-envtools IMAGE_SIZE := 15552k TPLINK_HWID := 0x32200002 TPLINK_HWREV := 0x1 From 62af69f9e4611182ca529ab4bf27a105a77df2a7 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:36:52 +0100 Subject: [PATCH 28/32] ath79: teltonika-rut230: add RUT240 model alias Define RUT240 as alternative name, to explicitly show the device is supported using existing image. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/generic.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 3f813df2537..b15b8b0efeb 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -3063,6 +3063,9 @@ define Device/teltonika_rut230-v1 DEVICE_VENDOR := Teltonika DEVICE_MODEL := RUT230 DEVICE_VARIANT := v1 + DEVICE_ALT0_VENDOR := Teltonika + DEVICE_ALT0_MODEL := RUT240 + DEVICE_ALT0_VARIANT := v1 DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-acm \ kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi -uboot-envtools IMAGE_SIZE := 15552k From 5ce1af9539da667f62dc3cb426f9ec36e53fb54e Mon Sep 17 00:00:00 2001 From: Rany Hany Date: Sun, 12 Jan 2025 22:41:48 +0000 Subject: [PATCH 29/32] hostapd: backport upstream patch to fix setting BSS color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch, we get the following error: Mon Dec 23 11:35:44 2024 daemon.err hostapd: nl80211: kernel reports: integer out of range As updating hostapd would be too complex and requires further testing, we backport this simple upstream fix instead. Fixes: https://github.com/openwrt/openwrt/issues/16680 Signed-off-by: Rany Hany Link: https://github.com/openwrt/openwrt/pull/17590 Signed-off-by: Petr Štetiar --- package/network/services/hostapd/Makefile | 2 +- .../hostapd/patches/763-radius-wispr.patch | 2 +- .../803-hostapd-fix-80211be-build.patch | 2 +- ...learing-up-settings-for-color-switch.patch | 28 +++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 44c73586cac..58c18a9088b 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL:=https://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/763-radius-wispr.patch b/package/network/services/hostapd/patches/763-radius-wispr.patch index da81a623e76..f5c4668e13b 100644 --- a/package/network/services/hostapd/patches/763-radius-wispr.patch +++ b/package/network/services/hostapd/patches/763-radius-wispr.patch @@ -36,7 +36,7 @@ sm->eap_if->aaaFail = true; --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -95,6 +95,7 @@ struct sta_info { +@@ -94,6 +94,7 @@ struct sta_info { u8 supported_rates[WLAN_SUPP_RATES_MAX]; int supported_rates_len; u8 qosinfo; /* Valid when WLAN_STA_WMM is set */ diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch index cbd6298d9d3..f197b71bd7b 100644 --- a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch +++ b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch @@ -25,7 +25,7 @@ + --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -408,23 +408,8 @@ int ap_sta_re_add(struct hostapd_data *h +@@ -409,23 +409,8 @@ int ap_sta_re_add(struct hostapd_data *h void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); diff --git a/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch b/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch new file mode 100644 index 00000000000..87d68911c79 --- /dev/null +++ b/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch @@ -0,0 +1,28 @@ +From 161327f91d956771996c96ea1b6e4e1cb8dc074c Mon Sep 17 00:00:00 2001 +From: Stone Zhang +Date: Mon, 14 Oct 2024 18:47:32 +0800 +Subject: [PATCH] hostapd: Fix clearing up settings for color switch + +Settings for color switch (struct cca_settings settings) +is used without zero clearing, which causes the member +settings->ubpr->unsol_bcast_probe_resp_intervalettings +to be a random value. It is againsts the NLA policy of +NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT and causes +BSS color switch failure. + +Fixes: 654d2395dddf ("BSS coloring: Handling of collision events and triggering CCA") +Signed-off-by: Stone Zhang +--- + src/ap/hostapd.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -4813,6 +4813,7 @@ static void hostapd_switch_color_timeout + struct cca_settings settings; + int ret; + ++ os_memset(&settings, 0, sizeof(settings)); + hostapd_cleanup_cca_params(bss); + bss->cca_color = r; + bss->cca_count = 10; From ac1ad1a7ad6bb3a528def4154e91dd398fda8db5 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:12:38 +0100 Subject: [PATCH 30/32] ipq40xx: turn on Teltonika RUTX50 modem by default Turn on the 5G modem of the RUTX50 on by default. This allows to make the modem detectable on a fresh installation OOTB without further intervention. Signed-off-by: David Bauer --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index 56d920a6dde..a2974597950 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -29,7 +29,7 @@ gpio_modem_power { gpio-export,name = "modem_power"; - gpio-export,output = <0>; + gpio-export,output = <1>; gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>; }; From 08c93512fe39ac25f78fb2ab0f32cb2a830c5b70 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:18:31 +0100 Subject: [PATCH 31/32] ipq40xx: use correct wired MAC-addresses for RUTX50 The Teltonika RUTX50 mac-addresses on its wired interfaces are currently random on every boot. Setting the mac-addresses from device-tree using nvmem does not work, as the vendor bootloader mangles the mtd partitions, removing the nvmem-cells property. To remedy the random mac-addresse, set the correct ones in preinit. Signed-off-by: David Bauer --- .../lib/preinit/05_set_iface_mac_ipq40xx.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index 1ede544aacc..092f9da4407 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -43,6 +43,17 @@ preinit_set_mac_address() { ip link set dev sw-eth1 address "$base_mac" ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1) ;; + teltonika,rutx50) + # Vendor Bootloader removes nvmem-cells from partition, + # so this needs to be done here. + base_mac="$(mtd_get_mac_binary 0:CONFIG 0x0)" + ip link set dev eth0 address "$base_mac" + ip link set dev lan1 address "$base_mac" + ip link set dev lan2 address "$base_mac" + ip link set dev lan3 address "$base_mac" + ip link set dev lan4 address "$base_mac" + ip link set dev wan address "$(macaddr_add "$base_mac" 1)" + ;; zyxel,nbg6617) base_mac=$(cat /sys/class/net/eth0/address) ip link set dev eth0 address $(macaddr_add "$base_mac" 2) From 54463f1e2e17d14a24d3504acea8107f45228f27 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:18:51 +0100 Subject: [PATCH 32/32] ipq40xx: enable WiFi LED for Teltonika RUTX50 Enable activity on the WiFi LEDs of the Teltonika RUTX50 like other boards in the ipq40xx target. Signed-off-by: David Bauer --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index a2974597950..ae244bd126a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -103,11 +103,13 @@ led-10 { label = "green:wifi2g"; gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; }; led-11 { label = "green:wifi5g"; gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; }; };