From 2fe497c4a514d09b6e8a9e5953b51d7f4da90b6b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Jan 2024 14:36:42 +0100 Subject: [PATCH 1/5] mac80211: do not emit VHT160 capabilities if channel width is less than 160 MHz Fixes compatibility issues with VHT160 capable clients Signed-off-by: Felix Fietkau (cherry picked from commit 80e4e2285fdf4a7b19c84532deafe2d1e690ed30) --- .../kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index b5378e556e..6ff627b038 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -327,6 +327,11 @@ mac80211_hostapd_setup_base() { [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" + [ "$vht_oper_chwidth" -lt 2 ] && { + vht160=0 + short_gi_160=0 + } + mac80211_add_capabilities vht_capab $vht_cap \ RXLDPC:0x10::$rxldpc \ SHORT-GI-80:0x20::$short_gi_80 \ From 4103958e768d8bb0d8c640f48341838d8bf5724a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Jan 2024 15:15:08 +0100 Subject: [PATCH 2/5] mediatek: fix BPI-R3 wifi mac address Setting/clearing bits on the first byte of the mac address causes collisions when using multiple SSIDs on both PHYs. Change the allocation to alter the last byte instead. Signed-off-by: Felix Fietkau (cherry picked from commit 38bec08e87b69212daf34eac7b26d643a92d9353) --- .../base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 4911d5e85e..6111854e04 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 @@ -27,9 +27,9 @@ case "$board" in [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress ;; bananapi,bpi-r3) - addr=$(macaddr_add $(cat /sys/class/net/eth0/address) 2) - [ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress + addr=$(cat /sys/class/net/eth0/address) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress ;; cetron,ct3003) addr=$(mtd_get_mac_binary "art" 0) From e21411814833a45b39ee94c85ed57b996c892ced Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 5 Jan 2024 17:02:01 +0100 Subject: [PATCH 3/5] ath79: move UniFi AC template into common This allows us to embrace alphabetical sorting for the UK-Ultra. Signed-off-by: David Bauer (cherry picked from commit c9e58f85f6e5d96711291f079413d2f34c36fdc3) --- target/linux/ath79/image/common-ubnt.mk | 7 +++++++ target/linux/ath79/image/generic-ubnt.mk | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/ath79/image/common-ubnt.mk b/target/linux/ath79/image/common-ubnt.mk index 76d6de000b..f44e06e110 100644 --- a/target/linux/ath79/image/common-ubnt.mk +++ b/target/linux/ath79/image/common-ubnt.mk @@ -121,6 +121,13 @@ define Device/ubnt-xw UBNT_VERSION := 6.0.4 endef +define Device/ubnt_unifiac + DEVICE_VENDOR := Ubiquiti + SOC := qca9563 + IMAGE_SIZE := 15488k + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef + define Device/ubnt-unifi-jffs2 $(Device/ubnt) KERNEL_SIZE := 3072k diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index fa4daa3aaa..92b764c389 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -244,13 +244,6 @@ define Device/ubnt_unifi-ap-lr endef TARGET_DEVICES += ubnt_unifi-ap-lr -define Device/ubnt_unifiac - DEVICE_VENDOR := Ubiquiti - SOC := qca9563 - IMAGE_SIZE := 15488k - DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct -endef - define Device/ubnt_unifiac-lite $(Device/ubnt_unifiac) DEVICE_MODEL := UniFi AC Lite From 5ad05681f2de00c8c6d6449df2b958b0838dbc1a Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 5 Jan 2024 17:18:09 +0100 Subject: [PATCH 4/5] ath79: add support for UniFi UK-Ultra Hardware -------- CPU: Qualcomm Atheros QCA9563 RAM: 128M DDR2 FLASH: 16MB SPI-NOR WiFi: Qualcomm Atheros QCA9563 2x2:2 802.11n 2.4GHz Qualcomm Atheros QCA9880 2x2:2 802.11ac 5GHz Antennas -------- The device features internal antennas as well as external antenna connectors. By default, the internal antennas are used. Two GPIOs are exported by name, which can be used to control the antenna-path mux. Writing a logical 0 enables the external antenna connectors. Installation ------------ 1. Download the OpenWrt sysupgrade image to the device. You can use scp for this task. The default username and password are "ubnt" and the device is reachable at 192.168.1.20. $ scp -O openwrt-sysupgrade.bin ubnt@192.168.1.20:/tmp/firmware.bin 2. Connect to the device using SSH. $ ssh ubnt@192.168.1.20 3. Disable the write-protect $ echo "5edfacbf" > /proc/ubnthal/.uf 4. Verify kernel0 and kernel1 match mtd2 and mtd3 $ cat /proc/mtd 5. Write the sysupgrade image to kernel0 and kernel1 $ dd if=/tmp/firmware.bin of=/dev/mtdblock2 $ dd if=/tmp/firmware.bin of=/dev/mtdblock3 6. Write the bootselect flag to boot from kernel0 $ dd if=/dev/zero bs=1 count=1 of=/dev/mtd4 7. Reboot the device $ reboot Signed-off-by: David Bauer (cherry picked from commit bf94e0a38389b2ce5d33be9c97d104d36dd5ebd6) --- .../linux/ath79/dts/qca9563_ubnt_uk-ultra.dts | 35 +++++++++++++++++++ .../linux/ath79/dts/qca9563_ubnt_unifiac.dtsi | 2 +- .../generic/base-files/etc/board.d/01_leds | 7 ++++ .../generic/base-files/etc/board.d/02_network | 1 + .../base-files/etc/board.d/03_gpio_switches | 4 +++ .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic-ubnt.mk | 7 ++++ 7 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts diff --git a/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts b/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts new file mode 100644 index 0000000000..1ba635117e --- /dev/null +++ b/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_ubnt_unifiac-lite.dtsi" + +/ { + compatible = "ubnt,uk-ultra", "qca,qca9563"; + model = "Ubiquiti UniFi Swiss Army Knife Ultra"; +}; + +&leds { + led-rssi0 { + label = "white:rssi0"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + + led-rssi1 { + label = "white:rssi1"; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; + + led-rssi2 { + label = "white:rssi2"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + led-rssi3 { + label = "white:rssi3"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; +}; + +/** + * Antenna selection on GPIO5 and GPIO6 + * High = Internal ; Low = External + */ diff --git a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi index 6704ec983b..14fbee8ab3 100644 --- a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi +++ b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi @@ -13,7 +13,7 @@ led-upgrade = &led_blue; }; - leds { + leds: leds { compatible = "gpio-leds"; led_white: led_white { diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index b5cc4abf65..aaa4ed94d5 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -494,6 +494,13 @@ ubnt,rocket-m) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:link3" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:link4" "wlan0" "76" "100" ;; +ubnt,uk-ultra) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "white:rssi0" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "white:rssi1" "wlan0" "26" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "white:rssi2" "wlan0" "51" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "white:rssi3" "wlan0" "76" "100" + ;; wallys,dr531) ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x2" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 0d7396a04d..ca35bd3223 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -113,6 +113,7 @@ ath79_setup_interfaces() ubnt,powerbridge-m|\ ubnt,rocket-5ac-lite|\ ubnt,rocket-m|\ + ubnt,uk-ultra|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ 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 899a8ba97e..279f518409 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 @@ -92,6 +92,10 @@ ubnt,nanostation-m) ubnt,nanostation-m-xw) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "2" ;; +ubnt,uk-ultra) + ucidef_add_gpio_switch "ant0_internal" "ANT0 Internal" "5" "1" + ucidef_add_gpio_switch "ant1_internal" "ANT1 Internal" "6" "1" + ;; zbtlink,zbt-wd323) ucidef_add_gpio_switch "io0" "IO#0" "0" ucidef_add_gpio_switch "io1" "IO#1" "1" diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index f0a3755de9..cdb1b2bd9d 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -36,6 +36,7 @@ case "$FIRMWARE" in sophos,ap100|\ sophos,ap100c|\ ubnt,bullet-ac|\ + ubnt,uk-ultra|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 92b764c389..68cef7d14b 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -229,6 +229,13 @@ define Device/ubnt_routerstation-pro endef TARGET_DEVICES += ubnt_routerstation-pro +define Device/ubnt_uk-ultra + $(Device/ubnt_unifiac) + DEVICE_MODEL := UniFi Swiss Army Knife Ultra + DEVICE_PACKAGES += rssileds -swconfig +endef +TARGET_DEVICES += ubnt_uk-ultra + define Device/ubnt_unifi-ap $(Device/ubnt-bz) DEVICE_MODEL := UniFi AP From cdc907abedf1ad0d17cc88fd33d35a3ef3f8fc75 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 9 Jan 2024 20:52:56 +0100 Subject: [PATCH 5/5] ath79: read back reset register Read back the reset register in order to flush the cache. This fixes spurious reboot hangs on TP-Link TL-WDR3600 and TL-WDR4300 with Zentel DRAM chips. This issue was fixed in the past, but switching to the reset-driver specific implementation removed the cache barrier which was previously implicitly added by reading back the register in question. Link: https://github.com/freifunk-gluon/gluon/issues/2904 Link: https://github.com/openwrt/openwrt/issues/13043 Link: https://dev.archive.openwrt.org/ticket/17839 Link: f8a7bfe1cb2c ("MIPS: ath79: fix system restart") Signed-off-by: David Bauer (cherry picked from commit 2fe8ecd880396b5ae25fe9583aaa1d71be0b8468) --- ...reset-ath79-read-back-reset-register.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch diff --git a/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch b/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch new file mode 100644 index 0000000000..7aa501514d --- /dev/null +++ b/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch @@ -0,0 +1,33 @@ +From 661edfc3dab943a67c8821353b63cc23057f7ce9 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Tue, 9 Jan 2024 20:48:46 +0100 +Subject: [PATCH] reset: ath79: read back reset register + +Read back the reset register in order to flush the cache. This fixes +spurious reboot hangs on TP-Link TL-WDR3600 and TL-WDR4300 with Zentel +DRAM chips. + +This issue was fixed in the past, but switching to the reset-driver +specific implementation removed the old fix. + +Link: https://github.com/freifunk-gluon/gluon/issues/2904 +Link: https://github.com/openwrt/openwrt/issues/13043 +Link: https://dev.archive.openwrt.org/ticket/17839 +Link: f8a7bfe1cb2c ("MIPS: ath79: fix system restart") + +Signed-off-by: David Bauer +--- + drivers/reset/reset-ath79.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/reset/reset-ath79.c ++++ b/drivers/reset/reset-ath79.c +@@ -37,6 +37,8 @@ static int ath79_reset_update(struct res + else + val &= ~BIT(id); + writel(val, ath79_reset->base); ++ /* Flush cache */ ++ readl(ath79_reset->base); + spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return 0;