From f5db80a3ab387cc840f5602cc81d3c2028cb7401 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sat, 9 Jul 2022 20:16:00 +0100 Subject: [PATCH 01/11] uclibc++: fix compilation with long file paths Currently, uClic++ 0.2.5 fails to compile when using a long filepath. For example, if the openwrt directory is in the path: /tmp/this_directory_name_is_very_long/more_long_paths/.../openwrt, then uclibc++ will cause a very obtuse error. Although the uclibc++ makefiles do print a "File name too long" error, it's not the final error that's printed, so it's a bit confusing: > /bin/sh: 1: > cannot create src/abi/libsupc/_libsupc++.a.dep: File name too long > > array_type_info.o: No such file or directory Although OpenWRT 22.03 and current master branch have removed uClib++, I thought I'd make a PR for OpenWRT 21.02, since I encountered it and there seems to be quite a few other people experiencing the same issue. It especially happens when using the SDK, (or when using an encrypted fs) since the pre-packaged SDKs have very long filenames. This patch is already in upstream [1], but has not yet been released. [1]: https://git.busybox.net/uClibc++/commit/?id=6687fc9276fa52defaf8592f2001c19b826aec93 Signed-off-by: Alois Klink --- ...-buildsys-shorten-abi-deb-file-names.patch | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch diff --git a/package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch b/package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch new file mode 100644 index 0000000000..8a4677c709 --- /dev/null +++ b/package/libs/uclibc++/patches/006-buildsys-shorten-abi-deb-file-names.patch @@ -0,0 +1,86 @@ +From 6687fc9276fa52defaf8592f2001c19b826aec93 Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer +Date: Thu, 4 Jun 2020 10:21:43 +0200 +Subject: buildsys: shorten abi dep-file names + +certain crypto-layers encode required information in the +filename hence crippling NAME_MAX from 255 down to about 143 +ascii chars. + +Since the dependency files of libgcc_eh and libsupc encode the full +path to the corresponding libraries, the names of the dep files can +get quite large. Shorten them by some (arbitrary, short) hash. + +Signed-off-by: Bernhard Reutner-Fischer +--- + Rules.mak | 2 ++ + src/abi/libgcc_eh/Makefile.in | 4 ++-- + src/abi/libsupc/Makefile.in | 4 ++-- + 3 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/Rules.mak b/Rules.mak +index 1b5ed30..9162c64 100644 +--- a/Rules.mak ++++ b/Rules.mak +@@ -50,6 +50,7 @@ RM = rm -f + TAR = tar + SED = sed + AWK = awk ++MD5SUM = md5sum + + ARFLAGS:= cr + +@@ -249,6 +250,7 @@ endif + + list-archive-members = $(if $(1),$(shell $(AR) t $(1))) + variablify = $(strip $(subst /,_,$(subst :,_,$(subst ;,_,$(subst |,_,$(subst >,_,$(subst <,_,$(1)))))))) ++print-hash = $(strip $(if $(1),$(shell printf "%s" "$(1)" | $(MD5SUM) | $(SED) 's/[^0-9a-zA-Z]//g'))) + + GEN_LIBS:= -lc + ifneq ($(LIBGCC_DIR),$(UCLIBCXX_RUNTIME_LIBDIR)) +diff --git a/src/abi/libgcc_eh/Makefile.in b/src/abi/libgcc_eh/Makefile.in +index 46b0017..1553b34 100644 +--- a/src/abi/libgcc_eh/Makefile.in ++++ b/src/abi/libgcc_eh/Makefile.in +@@ -4,7 +4,7 @@ OBJS = $(call list-archive-members,$(LIBGCC_EH)) + libgcc_eh-$(IMPORT_LIBGCC_EH) := $(OBJS) + + LIBGCC_EH_VAR := $(call variablify,$(LIBGCC_EH)) +-LIBGCC_EH_DEP := $(LIBGCC_EH_OUT).$(LIBGCC_EH_VAR).dep ++LIBGCC_EH_DEP := $(LIBGCC_EH_OUT).$(call print-hash,$(LIBGCC_EH_VAR)).dep + + ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) + -include $(LIBGCC_EH_DEP) +@@ -17,7 +17,7 @@ endif + $(LIBGCC_EH_DEP): $(LIBGCC_EH) + $(Q)$(RM) $(LIBGCC_EH_OUT).*dep $(LIBGCC_EH_OUT)*.o + $(Q)$(if $(LIBGCC_EH),(cd $(LIBGCC_EH_OUT) && $(AR) x $(LIBGCC_EH))) +- $(Q)echo "libgcc_eh-y := \$$(addprefix \$$(LIBGCC_EH_OUT),$(libgcc_eh-y))" > $@ ++ $(Q)printf "# %s\n\n%s\n" "$(LIBGCC_EH)" "libgcc_eh-y := \$$(addprefix \$$(LIBGCC_EH_OUT),$(libgcc_eh-y))" > $@ + + CLEAN_src/abi/libgcc_eh: ; + DISTCLEAN_src/abi/libgcc_eh: +diff --git a/src/abi/libsupc/Makefile.in b/src/abi/libsupc/Makefile.in +index 89e0e8a..9c00df0 100644 +--- a/src/abi/libsupc/Makefile.in ++++ b/src/abi/libsupc/Makefile.in +@@ -5,7 +5,7 @@ OBJS-OMIT = $(filter new_op%.o del_op%.o pure.o new_handler.o eh_alloc.o eh_glob + libsupc-$(IMPORT_LIBSUP) := $(filter-out $(OBJS-OMIT),$(OBJS)) + + LIBSUP_VAR := $(call variablify,$(LIBSUP)) +-LIBSUP_DEP :=$(LIBSUPC_OUT).$(LIBSUP_VAR).dep ++LIBSUP_DEP := $(LIBSUPC_OUT).$(call print-hash,$(LIBSUP_VAR)).dep + + ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) + -include $(LIBSUP_DEP) +@@ -17,7 +17,7 @@ endif + $(LIBSUP_DEP): $(LIBSUP) $(LIBSUPC_OUT)Makefile.in + $(Q)$(RM) $(LIBSUPC_OUT).*dep $(LIBSUPC_OUT)*.o + $(Q)$(if $(LIBSUP),(cd $(LIBSUPC_OUT) && $(AR) x $(LIBSUP) && $(RM) $(OBJS-OMIT))) +- $(Q)echo "libsupc-y := \$$(addprefix \$$(LIBSUPC_OUT),$(libsupc-y))" > $@ ++ $(Q)printf "# %s\n\n%s\n" "$(LIBSUP)" "libsupc-y := \$$(addprefix \$$(LIBSUPC_OUT),$(libsupc-y))" > $@ + + CLEAN_src/abi/libsupc: ; + DISTCLEAN_src/abi/libsupc: +-- +cgit v1.2.3 From 2f82fc6bf04dccd45f41cd9ed9a10478fb2bd31e Mon Sep 17 00:00:00 2001 From: Isaev Ruslan Date: Sat, 29 Jan 2022 02:17:44 +0000 Subject: [PATCH 02/11] tools/libelf: alpine linux os type: linux-musl fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents ./configure "checking build system" test fail on Alpine linux. Signed-off-by: Isaev Ruslan Signed-off-by: Petr Štetiar [commit description] --- tools/libelf/patches/100-linux-musl.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tools/libelf/patches/100-linux-musl.patch diff --git a/tools/libelf/patches/100-linux-musl.patch b/tools/libelf/patches/100-linux-musl.patch new file mode 100644 index 0000000000..538eccd839 --- /dev/null +++ b/tools/libelf/patches/100-linux-musl.patch @@ -0,0 +1,11 @@ +--- a/config.sub 2022-01-29 02:09:42.943549003 +0000 ++++ b/config.sub 2022-01-29 02:04:23.172378567 +0000 +@@ -118,7 +118,7 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ ++ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | linux-musl | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` From caeb618eea9c327d801f0e16eb3ed930f567481d Mon Sep 17 00:00:00 2001 From: Andrea Poletti Date: Fri, 23 Jul 2021 18:15:00 +0200 Subject: [PATCH 03/11] ramips: add support for Sitecom WLR-4100 v1 002 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sitecom WLR-4100 v1 002 (marked as X4 N300) is a wireless router Specification: SoC: MT7620A RAM: 64 MB DDR2 Flash: MX25L6405D SPI NOR 8 MB WIFI: 2.4 GHz integrated Ethernet: 5x 10/100/1000 Mbps QCA8337 USB: 1x 2.0 LEDS: 2x GPIO controlled, 5x switch Buttons: 1x GPIO controlled UART: row of 4 unpopulated holes near USB port, starting count from white triangle on PCB: VCC 3.3V GND TX RX baud: 115200, parity: none, flow control: none Installation Connect to one of LAN (yellow) ethernet ports, Open router configuration interface, Go to Toolbox > Firmware, Browse for OpenWrt factory image with dlf extension and hit Apply, Wait few minutes, after the Power LED will stop blinking, the router is ready for configuration. Known issues Some USB 2.0 devices work at full speed mode 1.1 only MAC addresses factory partition only contains one (binary) MAC address in 0x4. u-boot-env contains four (ascii) MAC addresses, of which two appear to be valid. factory 0x4 **:**:**:**:b9:84 binary u-boot-env ethaddr **:**:**:**:b9:84 ascii u-boot-env wanaddr **:**:**:**:b9:85 ascii u-boot-env wlanaddr 00:AA:BB:CC:DD:12 ascii u-boot-env iNICaddr 00:AA:BB:CC:DD:22 ascii The factory firmware only assigns ethaddr. Thus, we take the binary value which we can use directly in DTS. Additional information OEM firmware shell password is: SitecomSenao useful for creating backup of original firmware. There is also another revision of this device (v1 001), based on RT3352 SoC The nvmem feature (commit 06bb4a5) was introduced in master after the splitting of the 21.02 branch. It need to be reverted in 21.02.. Signed-off-by: Andrea Poletti [remove config DT label, convert to nvmem, remove MAC address setup from u-boot-env, add MAC address info to commit message] Signed-off-by: Adrian Schmutzler (cherry picked from commit de0c380a5f8289839ab970e794a45f0e04a466a3) Signed-off-by: Petr Štetiar --- package/boot/uboot-envtools/files/ramips | 3 +- .../dts/mt7620a_sitecom_wlr-4100-v1-002.dts | 186 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 14 ++ .../mt7620/base-files/etc/board.d/02_network | 3 +- 4 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 target/linux/ramips/dts/mt7620a_sitecom_wlr-4100-v1-002.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 0de062bd83..8d3ae88b48 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -18,7 +18,8 @@ alfa-network,awusfree1|\ alfa-network,quad-e4g|\ alfa-network,r36m-e4g|\ alfa-network,tube-e4g|\ -engenius,esr600h) +engenius,esr600h|\ +sitecom,wlr-4100-v1-002) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" ;; allnet,all0256n-4m|\ diff --git a/target/linux/ramips/dts/mt7620a_sitecom_wlr-4100-v1-002.dts b/target/linux/ramips/dts/mt7620a_sitecom_wlr-4100-v1-002.dts new file mode 100644 index 0000000000..3b260c5b8d --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_sitecom_wlr-4100-v1-002.dts @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "sitecom,wlr-4100-v1-002", "ralink,mt7620a-soc"; + model = "Sitecom WLR-4100 v1 002"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "amber:power"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wifi { + label = "blue:wifi"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + wps { + label = "white:wps"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb-power { + gpio-export,name = "usb-power"; + gpio-export,output = <1>; + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x790000>; + }; + + partition@7e0000 { + label = "backup"; + reg = <0x7e0000 0x10000>; + read-only; + }; + + partition@7f0000 { + label = "storage"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x4>; + + port@5 { + status = "okay"; + + phy-mode = "rgmii"; + mediatek,fixed-link = <1000 1 1 1>; + }; + + mdio-bus { + status = "okay"; + + ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + + qca,ar8327-initvals = < + 0x04 0x06200000 /* PORT0 PAD MODE CTRL */ + 0x08 0x01000000 /* PORT5 PAD MODE CTRL RX delay EN all ports 0, 5, 6 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x00000000 /* PORT6_STATUS */ + >; + }; + }; +}; + +&gsw { + mediatek,ephy-base = /bits/ 8 <8>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&wmac { + status = "okay"; + + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&state_default { + gpio { + groups = "uartf", "i2c", "wled", "spi refclk"; + function = "gpio"; + }; +}; + diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 93fa8ae48d..1fc75974f6 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -963,6 +963,20 @@ define Device/sercomm_na930 endef TARGET_DEVICES += sercomm_na930 +define Device/sitecom_wlr-4100-v1-002 + SOC := mt7620a + BLOCKSIZE := 4k + IMAGE_SIZE := 7744k + IMAGES += factory.dlf + IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size | \ + senao-header -r 0x0222 -p 0x104A -t 2 + DEVICE_VENDOR := Sitecom + DEVICE_MODEL := WLR-4100 + DEVICE_VARIANT := v1 002 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci uboot-envtools +endef +TARGET_DEVICES += sitecom_wlr-4100-v1-002 + define Device/tplink_archer-c20i $(Device/tplink-v2) SOC := mt7620a diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index e867b58aed..07b17a9daf 100755 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -134,7 +134,8 @@ ramips_setup_interfaces() ucidef_add_switch "switch1" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" ;; - engenius,esr600) + engenius,esr600|\ + sitecom,wlr-4100-v1-002) ucidef_add_switch "switch0" \ "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "0@eth0" ucidef_add_switch "switch1" \ From 052ff08aa7ec8d39677fcaccaa74fe2d13ef0384 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Mon, 18 Jan 2021 09:00:42 +0100 Subject: [PATCH 04/11] sunxi: add support for Banana Pi M2 Berry CPU: Allwinner V40 quad-core Cortex A7 @ 1.2GHz Memory: 1GB DDR3 Storage: SDcard, native SATA Network: 10/100/1000M ethernet, Ampak AP6212 wifi + BT USB: 4x USB 2.0 Installation: Use the standard sunxi installation to an SD-card. While the board is very similar to the M2 Ultra board (the V40 is the automotive version of the R40), as both the u-boot and kernel supports them separately, and some pins are different, let's add a separate device spec. Signed-off-by: Zoltan HERPAI (cherry picked from commit 9aa66b8ce730aebff76d353392151708a897a3a0) --- package/boot/uboot-sunxi/Makefile | 7 +++++++ target/linux/sunxi/image/cortexa7.mk | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index 38147339a4..1358da5dfb 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -301,6 +301,12 @@ define U-Boot/Bananapi_M2_Ultra BUILD_DEVICES:=sinovoip_bananapi-m2-ultra endef +define U-Boot/bananapi_m2_berry + BUILD_SUBTARGET:=cortexa7 + NAME:=Bananapi M2 Berry + BUILD_DEVICES:=sinovoip_bananapi-m2-berry +endef + UBOOT_TARGETS := \ a64-olinuxino \ a64-olinuxino-emmc \ @@ -312,6 +318,7 @@ UBOOT_TARGETS := \ A20-OLinuXino_MICRO \ bananapi_m2_plus_h3 \ Bananapi \ + bananapi_m2_berry \ Bananapi_M2_Ultra \ Bananapro \ Cubieboard \ diff --git a/target/linux/sunxi/image/cortexa7.mk b/target/linux/sunxi/image/cortexa7.mk index 6445ed0bd6..f90fae9acf 100644 --- a/target/linux/sunxi/image/cortexa7.mk +++ b/target/linux/sunxi/image/cortexa7.mk @@ -77,6 +77,16 @@ define Device/lemaker_bananapi endef TARGET_DEVICES += lemaker_bananapi +define Device/sinovoip_bananapi-m2-berry + DEVICE_VENDOR := Sinovoip + DEVICE_MODEL := Banana Pi M2 Berry + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-sunxi kmod-brcmfmac \ + brcmfmac-firmware-43430-sdio wpad-basic-wolfssl + SUPPORTED_DEVICES:=lemaker,bananapi-m2-berry + SOC := sun8i-v40 +endef +TARGET_DEVICES += sinovoip_bananapi-m2-berry + define Device/sinovoip_bananapi-m2-ultra DEVICE_VENDOR := Sinovoip DEVICE_MODEL := Banana Pi M2 Ultra From 32101669db23a30a7ed1b84da87136802e94edf9 Mon Sep 17 00:00:00 2001 From: Clemens Hopfer Date: Thu, 22 Jul 2021 17:54:15 +0200 Subject: [PATCH 05/11] ramips: add support for YunCore AX820/HWAP-AX820 There are two versions which are identical apart from the enclosure: YunCore AX820: indoor ceiling mount AP with integrated antennas YunCore HWAP-AX820: outdoor enclosure with external (N) connectors Hardware specs: SoC: MediaTek MT7621DAT Flash: 16 MiB SPI NOR RAM: 128MiB (DDR3, integrated) WiFi: MT7905DAN+MT7975DN 2.4/5GHz 2T2R 802.11ax Ethernet: 10/100/1000 Mbps x2 (WAN/PoE+LAN) LED: Status (green) Button: Reset Power: 802.11af/at PoE; DC 12V,1A Antennas: AX820(indoor): 4dBi internal; HWAP-AX820(outdoor): external Flash instructions: The "OpenWRT support" version of the AX820 comes with a LEDE-based firmware with proprietary MTK drivers and a luci webinterface and ssh accessible under 192.168.1.1 on LAN; user root, no password. The sysupgrade.bin can be flashed using luci or sysupgrade via ssh, you will have to force the upgrade due to a different factory name. Remember: Do *not* preserve factory configuration! MAC addresses as used by OEM firmware: use address source 2g 44:D1:FA:*:0b Factory 0x0004 (label) 5g 46:D1:FA:*:0b LAA of 2g lan 44:D1:FA:*:0c Factory 0xe000 wan 44:D1:FA:*:0d Factory 0xe000 + 1 The wan MAC can also be found in 0xe006 but is not used by OEM dtb. Due to different MAC handling in mt76 the LAA derived from lan is used for 2g to prevent duplicate MACs when creating multiple interfaces. Signed-off-by: Clemens Hopfer (cherry picked from commit 4891b865380e2b7f32acf0893df9c1ca9db8d4ea) [switch to mtd-mac-address instead of nvmem-cells] --- package/boot/uboot-envtools/files/ramips | 3 +- .../linux/ramips/dts/mt7621_yuncore_ax820.dts | 133 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 9 ++ .../mt7621/base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 4 + 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7621_yuncore_ax820.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 8d3ae88b48..3e358ec6ac 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ sitecom,wlr-4100-v1-002) ;; allnet,all0256n-4m|\ allnet,all0256n-8m|\ -allnet,all5002) +allnet,all5002|\ +yuncore,ax820) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; ampedwireless,ally-00x19k|\ diff --git a/target/linux/ramips/dts/mt7621_yuncore_ax820.dts b/target/linux/ramips/dts/mt7621_yuncore_ax820.dts new file mode 100644 index 0000000000..9775ec3572 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_yuncore_ax820.dts @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "yuncore,ax820", "mediatek,mt7621-soc"; + model = "YunCore AX820"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <200>; + always-running; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <80000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "Config"; + reg = <0x30000 0x10000>; + read-only; + }; + + /* range 0x40000 to 0x50000 is empty in vendor + * firmware, so we do not use it either + */ + + factory: partition@50000 { + label = "Factory"; + reg = <0x50000 0x40000>; + read-only; + }; + + partition@90000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x90000 0xf70000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe000>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe000>; + mtd-mac-address-increment = <1>; + }; + + port@1 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 8ee2a020bb..c62087d870 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1567,6 +1567,15 @@ define Device/youku_yk-l2 endef TARGET_DEVICES += youku_yk-l2 +define Device/yuncore_ax820 + $(Device/dsa-migration) + IMAGE_SIZE := 15808k + DEVICE_VENDOR := YunCore + DEVICE_MODEL := AX820 + DEVICE_PACKAGES := kmod-mt7915e +endef +TARGET_DEVICES += yuncore_ax820 + define Device/zbtlink_zbt-we1326 $(Device/dsa-migration) $(Device/uimage-lzma-loader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 4b44669b84..4d081bed8c 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -68,6 +68,7 @@ ramips_setup_interfaces() ubnt,edgerouter-x-sfp) ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4 eth5" "eth0" ;; + yuncore,ax820|\ zyxel,nr7101) ucidef_set_interfaces_lan_wan "lan" "wan" ;; @@ -157,6 +158,9 @@ ramips_setup_macs() wan_mac=$label_mac lan_mac=$(macaddr_add $label_mac 1) ;; + yuncore,ax820) + label_mac=$(mtd_get_mac_binary Factory 0x4) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index bd0f0254c6..68ee537ae5 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -27,4 +27,8 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress ;; + yuncore,ax820) + [ "$PHYNBR" = "1" ] && \ + macaddr_setbit_la "$(mtd_get_mac_binary Factory 0xe000)" > /sys${DEVPATH}/macaddress + ;; esac From d445df84c5a9eb48939322733ec48031c32c2cf2 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 11 Oct 2021 10:47:00 -1000 Subject: [PATCH 06/11] feeds: use git-src-full to allow Git versioning Both $(AUTORELEASE) and $(PKG_SRC_VERSION) (from luci.git) use the Git log to determine releases and package timestamps. Feeds are shallow cloned by default, resulting in an incomplete Git log and therefore different local package versions than offered upstream. This commits sets the default feeds to use `src-git-full` to solve that. Add fixes from "2b1d92f: scripts/feeds: silence git warning by selecting pull style" to `src-git-full` Signed-off-by: Paul Spooren (cherry picked from commit 7fae1e5677e9bb4979c8d4ac99be4de6955b13d0) --- feeds.conf.default | 8 ++++---- scripts/feeds | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/feeds.conf.default b/feeds.conf.default index 98bf97232d..f1827a3661 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,5 +1,5 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-21.02 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-21.02 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-21.02 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-21.02 +src-git-full packages https://git.openwrt.org/feed/packages.git;openwrt-21.02 +src-git-full luci https://git.openwrt.org/project/luci.git;openwrt-21.02 +src-git-full routing https://git.openwrt.org/feed/routing.git;openwrt-21.02 +src-git-full telephony https://git.openwrt.org/feed/telephony.git;openwrt-21.02 #src-link custom /usr/src/openwrt/custom-feed diff --git a/scripts/feeds b/scripts/feeds index eee0a50717..499354391b 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -167,8 +167,8 @@ my %update_method = ( 'init' => "git clone '%s' '%s'", 'init_branch' => "git clone --branch '%s' '%s' '%s'", 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", - 'update' => "git pull --ff", - 'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)", + 'update' => "git pull --ff-only", + 'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)", 'post_update' => "git submodule update --init --recursive", 'controldir' => ".git", 'revision' => "git rev-parse --short HEAD | tr -d '\n'"}, From 69ea8afaea45487975bc00795f31e286d337bc82 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 21 Oct 2021 17:09:28 +0200 Subject: [PATCH 07/11] hostapd: ubus: fix uninitialized pointer This fixes passing a bogus non-null pointer to the ubus handler in case the transition request is rejected. Signed-off-by: David Bauer (cherry picked from commit 9b880f09f394049e0629e3c9d4061f431a6b19a8) Signed-off-by: Nick Hainke --- package/network/services/hostapd/patches/600-ubus_support.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index db4d7f0189..d8fdec3d24 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -441,7 +441,7 @@ { u8 dialog_token, status_code, bss_termination_delay; - const u8 *pos, *end; -+ const u8 *pos, *end, *target_bssid; ++ const u8 *pos, *end, *target_bssid = NULL; int enabled = hapd->conf->bss_transition; struct sta_info *sta; From cd7e6c8a81f1ea02d7cfb486388e644485956b09 Mon Sep 17 00:00:00 2001 From: Julien Cassette Date: Mon, 17 Jan 2022 19:41:32 +0100 Subject: [PATCH 08/11] ipq40xx: add Linksys MR8300 WAN port This makes the WAN interface and port appear in LuCi -> Network -> Switch on Linksys MR8300. This allows to configure a VLAN on WAN. Fixes: FS#4227 Signed-off-by: Julien Cassette (cherry picked from commit 2c1f8a665eb3dce27deb4f9f9b718eb8baf997bd) --- target/linux/ipq40xx/base-files/etc/board.d/02_network | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index c70aa0b95c..87c79db5e1 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -57,12 +57,16 @@ ipq40xx_setup_interfaces() ;; avm,fritzbox-4040|\ linksys,ea6350v3|\ - linksys,ea8300|\ - linksys,mr8300) + linksys,ea8300) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" ;; + linksys,mr8300) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" + ;; avm,fritzbox-7530) ucidef_add_switch "switch0" \ "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" From 1dd4b3f06a97d4c0efddec2b26872ddff1bf2e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sat, 23 Jul 2022 11:18:01 +0200 Subject: [PATCH 09/11] ath79: add support for MikroTik RouterBOARD hAP ac lite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MikroTik RB952Ui-5ac2nD (sold as hAP ac lite) is an indoor 2.4Ghz and 5GHz AP/router with a 2 dBi integrated antenna. See https://mikrotik.com/product/RB952Ui-5ac2nD for more details. Specifications: - SoC: QCA9533 - RAM: 64MB - Storage: 16MB NOR - Wireless: QCA9533 802.11b/g/n 2x2 / QCA9887 802.11a/n/ac 2x2 - Ethernet: AR934X switch, 5x 10/100 ports, 10-28 V passive PoE in port 1, 500 mA PoE out on port 5 - 6 user-controllable LEDs: - 1x user (green) - 5x port status (green) Flashing: TFTP boot initramfs image and then perform sysupgrade. The "Internet" port (port number 1) must be used to upload the TFTP image, then connect to any other port to access the OpenWRT system. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. Signed-off-by: Thibaut VARÈNE (cherry picked from commit 2bd33e8626bd04fd7115ee1a42aaf03aae2fffb8) --- ...9533_mikrotik_routerboard-952ui-5ac2nd.dts | 18 ++++ .../dts/qca9533_mikrotik_routerboard-95x.dtsi | 98 +++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 10 ++ .../mikrotik/base-files/etc/board.d/01_leds | 7 ++ .../base-files/etc/board.d/02_network | 5 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 3 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + 7 files changed, 142 insertions(+) create mode 100644 target/linux/ath79/dts/qca9533_mikrotik_routerboard-952ui-5ac2nd.dts create mode 100644 target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-952ui-5ac2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-952ui-5ac2nd.dts new file mode 100644 index 0000000000..b32d38a697 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-952ui-5ac2nd.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9533_mikrotik_routerboard-95x.dtsi" + +/ { + compatible = "mikrotik,routerboard-952ui-5ac2nd", "qca,qca9533"; + model = "MikroTik RouterBOARD 952Ui-5ac2nD (hAP ac lite)"; +}; + +&pcie0 { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0 0 0 0 0>; + }; +}; + diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi new file mode 100644 index 0000000000..79c9f44d32 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9533_mikrotik_routerboard-16m.dtsi" + +/ { + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-running = &led_user; + led-upgrade = &led_user; + }; + + leds { + compatible = "gpio-leds"; + + led_user: user { + label = "green:user"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + port1 { + label = "green:port1"; + gpios = <&gpio_ext 0 GPIO_ACTIVE_LOW>; + }; + + port2 { + label = "green:port2"; + gpios = <&gpio_ext 1 GPIO_ACTIVE_LOW>; + }; + + port3 { + label = "green:port3"; + gpios = <&gpio_ext 2 GPIO_ACTIVE_LOW>; + }; + + port4 { + label = "green:port4"; + gpios = <&gpio_ext 3 GPIO_ACTIVE_LOW>; + }; + + port5 { + label = "green:port5"; + gpios = <&gpio_ext 4 GPIO_ACTIVE_LOW>; + }; + + }; + + gpio-export { + compatible = "gpio-export"; + + usb_power { + gpio-export,name = "usb-power"; + gpio-export,output = <1>; + gpios = <&gpio_ext 5 GPIO_ACTIVE_LOW>; + }; + + enable_poe_port5 { + gpio-export,name = "enable-poe:port5"; + gpio-export,output = <0>; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pin_spi_cs1>; + + gpio_ext: gpio_ext@1 { + compatible = "fairchild,74hc595"; + reg = <1>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + spi-max-frequency = <25000000>; + }; +}; + + +&pinmux { + pin_spi_cs1: pinmux_spi_cs1 { + pinctrl-single,bits = <0x8 0x0a000000 0xff000000>; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; +}; + +&usb0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index b2c7000419..30bfa0cd8e 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -37,6 +37,16 @@ define Device/mikrotik_routerboard-922uags-5hpacd endef TARGET_DEVICES += mikrotik_routerboard-922uags-5hpacd +define Device/mikrotik_routerboard-952ui-5ac2nd + $(Device/mikrotik_nor) + SOC := qca9533 + DEVICE_MODEL := RouterBOARD 952Ui-5ac2nD (hAP ac lite) + DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9887-ct + IMAGE_SIZE := 16256k + SUPPORTED_DEVICES += rb-952ui-5ac2nd +endef +TARGET_DEVICES += mikrotik_routerboard-952ui-5ac2nd + define Device/mikrotik_routerboard-lhg-2nd $(Device/mikrotik_nor) SOC := qca9533 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index e95c5830e2..f5df9ee1c3 100755 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -7,6 +7,13 @@ board_config_update board=$(board_name) case "$board" in +mikrotik,routerboard-952ui-5ac2nd) + ucidef_set_led_netdev "port1" "port1" "green:port1" "eth1" + ucidef_set_led_switch "port2" "port2" "green:port2" "switch0" "0x10" + ucidef_set_led_switch "port3" "port3" "green:port3" "switch0" "0x08" + ucidef_set_led_switch "port4" "port4" "green:port4" "switch0" "0x04" + ucidef_set_led_switch "port5" "port5" "green:port5" "switch0" "0x02" + ;; mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-mapl-2nd) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index bf8b9bdac2..8b78dd7e63 100755 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -24,6 +24,11 @@ ath79_setup_interfaces() mikrotik,routerboard-wapr-2nd) ucidef_set_interface_lan "eth0" ;; + mikrotik,routerboard-952ui-5ac2nd) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index eca25b69de..58b5c2d3d9 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -33,6 +33,9 @@ case "$FIRMWARE" in mikrotik,routerboard-wap-g-5hact2hnd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" +2) ;; + mikrotik,routerboard-952ui-5ac2nd) + caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 6) + ;; *) caldata_die "board $board is not supported yet" ;; diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 31d4eeedbc..0242f52644 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -12,6 +12,7 @@ case "$FIRMWARE" in "ath10k/cal-pci-0000:00:00.0.bin") case $board in mikrotik,routerboard-921gs-5hpacd-15s|\ + mikrotik,routerboard-952ui-5ac2nd|\ mikrotik,routerboard-wap-g-5hact2hnd) caldata_sysfsload_from_file $wlan_data 0x5000 0x844 ;; From 8b552b1d28b55401c865a926eeedf20af9318f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sat, 23 Jul 2022 11:18:02 +0200 Subject: [PATCH 10/11] ath79: add support for RouterBOARD mAP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MikroTik mAP-2nd (sold as mAP) is an indoor 2.4Ghz AP with 802.3af/at PoE input and passive PoE passthrough. See https://mikrotik.com/product/RBmAP2nD for more details. Specifications: - SoC: QCA9533 - RAM: 64MB - Storage: 16MB NOR - Wireless: QCA9533 802.11b/g/n 2x2 - Ethernet: 2x 10/100 ports, 802.3af/at PoE in port 1, 500 mA passive PoE out on port 2 - 7 user-controllable LEDs Note: the device is a tiny AP and does not distinguish between both ethernet ports roles, so they are both assigned to lan. With the current setup, ETH1 is connected to eth1 and ETH2 is connected to eth0 via the embedded switch port 2. Flashing: TFTP boot initramfs image and then perform sysupgrade. The "ETH1" port must be used to upload the TFTP image. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. Tested-By: Andrew Powers-Holmes Signed-off-by: Thibaut VARÈNE (cherry picked from commit e1223dbee332b89caf71850eb909104529595c31) --- .../qca9533_mikrotik_routerboard-map-2nd.dts | 113 ++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 9 ++ .../mikrotik/base-files/etc/board.d/01_leds | 5 + .../base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 3 + 5 files changed, 134 insertions(+) create mode 100644 target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts new file mode 100644 index 0000000000..25971e6f43 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9533_mikrotik_routerboard-16m.dtsi" + +/ { + compatible = "mikrotik,routerboard-map-2nd", "qca,qca9533"; + model = "MikroTik RouterBOARD mAP-2nD (mAP)"; + + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-running = &led_user; + led-upgrade = &led_user; + }; + + leds { + compatible = "gpio-leds"; + + power { + label = "green:power"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + eth_1 { + label = "green:eth_1"; + gpios = <&gpio_ext 0 GPIO_ACTIVE_LOW>; + }; + + eth_2 { + label = "green:eth_2"; + gpios = <&gpio_ext 1 GPIO_ACTIVE_LOW>; + }; + + poe_out { + label = "red:poe_out"; + gpios = <&gpio_ext 2 GPIO_ACTIVE_LOW>; + }; + + led_user: user { + label = "green:user"; + gpios = <&gpio_ext 3 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "green:wlan"; + gpios = <&gpio_ext 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + ap_cap { + label = "green:ap_cap"; + gpios = <&gpio_ext 6 GPIO_ACTIVE_LOW>; + }; + + }; + + gpio-export { + compatible = "gpio-export"; + + usb_power { + gpio-export,name = "usb-power"; + gpio-export,output = <1>; + gpios = <&gpio_ext 5 GPIO_ACTIVE_LOW>; + }; + + enable_poe_port5 { + gpio-export,name = "enable-poe"; + gpio-export,output = <0>; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pin_spi_cs1>; + + gpio_ext: gpio_ext@1 { + compatible = "fairchild,74hc595"; + reg = <1>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + spi-max-frequency = <25000000>; + }; +}; + + +&pinmux { + pin_spi_cs1: pinmux_spi_cs1 { + pinctrl-single,bits = <0x8 0x0a000000 0xff000000>; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy0>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <1>; + }; +}; + +&usb0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 30bfa0cd8e..08759f98ad 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -55,6 +55,15 @@ define Device/mikrotik_routerboard-lhg-2nd endef TARGET_DEVICES += mikrotik_routerboard-lhg-2nd +define Device/mikrotik_routerboard-map-2nd + $(Device/mikrotik_nor) + SOC := qca9533 + DEVICE_MODEL := RouterBOARD mAP-2nD (mAP) + DEVICE_PACKAGES += kmod-usb2 kmod-ledtrig-gpio + IMAGE_SIZE := 16256k +endef +TARGET_DEVICES += mikrotik_routerboard-map-2nd + define Device/mikrotik_routerboard-mapl-2nd $(Device/mikrotik_nor) SOC := qca9533 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index f5df9ee1c3..9f42a09a2e 100755 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -18,6 +18,11 @@ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-mapl-2nd) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; +mikrotik,routerboard-map-2nd) + ucidef_set_led_netdev "eth_1" "eth_1" "green:eth_1" "eth1" + ucidef_set_led_switch "eth_2" "eth_2" "green:eth_2" "switch0" "0x4" + ucidef_set_led_gpio "poe" "poe" "red:poe_out" "14" "0" + ;; mikrotik,routerboard-wapr-2nd) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100" diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index 8b78dd7e63..e14db83ed1 100755 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -29,6 +29,9 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" ;; + mikrotik,routerboard-map-2nd) + ucidef_set_interface_lan "eth0 eth1" + ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; @@ -47,6 +50,7 @@ ath79_setup_macs() mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-lhg-2nd|\ + mikrotik,routerboard-map-2nd|\ mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-g-5hact2hnd|\ diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 58b5c2d3d9..9d921de839 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -29,6 +29,9 @@ case "$FIRMWARE" in mikrotik,routerboard-wapr-2nd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" +1) ;; + mikrotik,routerboard-map-2nd) + caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 3) + ;; mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-wap-g-5hact2hnd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" +2) From 4cb9d08e71a8d4d4f148f29fcbe8554f0815a056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Wed, 20 Apr 2022 17:57:47 +0200 Subject: [PATCH 11/11] mt76: backport fix encap offload ethernet type check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The driver needs to check if the format is 802.2 vs 802.3 in order to set a tx descriptor flag. skb->protocol can't be used, since it may not be properly initialized for packets coming in from a packet socket. Fix misdetection by checking the ethertype from the skb data instead. Signed-off-by: Thibaut VARÈNE Signed-off-by: Petr Štetiar [commit description] --- ...ix-encap-offload-ethernet-type-check.patch | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 package/kernel/mt76/patches/101-fix-encap-offload-ethernet-type-check.patch diff --git a/package/kernel/mt76/patches/101-fix-encap-offload-ethernet-type-check.patch b/package/kernel/mt76/patches/101-fix-encap-offload-ethernet-type-check.patch new file mode 100644 index 0000000000..d81aa4dfa3 --- /dev/null +++ b/package/kernel/mt76/patches/101-fix-encap-offload-ethernet-type-check.patch @@ -0,0 +1,63 @@ +From: Felix Fietkau +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Thibaut_VAR=C3=88NE?= +Subject: [PATCH] mt76: fix encap offload ethernet type check +Date: Wed, 20 Apr 2022 14:33:08 +0200 +Message-Id: <20220420123308.70104-1-nbd@nbd.name> + +The driver needs to check if the format is 802.2 vs 802.3 in order to set +a tx descriptor flag. skb->protocol can't be used, since it may not be properly +initialized for packets coming in from a packet socket. +Fix misdetection by checking the ethertype from the skb data instead + +Reported-by: Thibaut VARÈNE +Signed-off-by: Felix Fietkau +--- + drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 4 +++- + drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +index 5f4a0e811137..e353e8c44d6c 100644 +--- a/mt7915/mac.c ++++ b/mt7915/mac.c +@@ -1016,6 +1016,7 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi, + + u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; + u8 fc_type, fc_stype; ++ u16 ethertype; + bool wmm = false; + u32 val; + +@@ -1029,7 +1030,8 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi, + val = FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) | + FIELD_PREP(MT_TXD1_TID, tid); + +- if (be16_to_cpu(skb->protocol) >= ETH_P_802_3_MIN) ++ ethertype = get_unaligned_be16(&skb->data[12]); ++ if (ethertype >= ETH_P_802_3_MIN) + val |= MT_TXD1_ETH_802_3; + + txwi[1] |= cpu_to_le32(val); +diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +index 368e54c53ddd..ac11e8b28f13 100644 +--- a/mt7921/mac.c ++++ b/mt7921/mac.c +@@ -814,6 +814,7 @@ mt7921_mac_write_txwi_8023(struct mt7921_dev *dev, __le32 *txwi, + { + u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; + u8 fc_type, fc_stype; ++ u16 ethertype; + bool wmm = false; + u32 val; + +@@ -827,7 +828,8 @@ mt7921_mac_write_txwi_8023(struct mt7921_dev *dev, __le32 *txwi, + val = FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) | + FIELD_PREP(MT_TXD1_TID, tid); + +- if (be16_to_cpu(skb->protocol) >= ETH_P_802_3_MIN) ++ ethertype = get_unaligned_be16(&skb->data[12]); ++ if (ethertype >= ETH_P_802_3_MIN) + val |= MT_TXD1_ETH_802_3; + + txwi[1] |= cpu_to_le32(val);