From 63bef34db99dd58ff935247f9cb8cd8611f43b39 Mon Sep 17 00:00:00 2001 From: Stijn Segers Date: Tue, 26 May 2020 13:28:18 +0200 Subject: [PATCH 01/13] uboot-envtools: ath79: add Netgear WNDR4300SW Add Netgear WNDR4300SW to the list of supported boards. Signed-off-by: Stijn Segers --- package/boot/uboot-envtools/files/ath79 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index aebfeca85d..928a46ca8e 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -56,7 +56,8 @@ netgear,wndr3700-v2) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000" ;; netgear,wndr3700-v4|\ -netgear,wndr4300) +netgear,wndr4300|\ +netgear,wndr4300sw) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" ;; qihoo,c301) From e8a2c21069e969dfbf4505364005dd57934a2abc Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 26 May 2020 16:08:15 +0200 Subject: [PATCH 02/13] rpcd: update to latest Git HEAD 078bb57 uci: reset uci_ptr flags when merging options during section add 3df62bc session: deny access if password login is disabled Signed-off-by: Jo-Philipp Wich --- package/system/rpcd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 3e85f0ce11..20ec3bf17e 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_SOURCE_DATE:=2020-01-05 -PKG_SOURCE_VERSION:=efe51f41d6288fa8503cc4f2efb37a777767d505 +PKG_SOURCE_DATE:=2020-05-26 +PKG_SOURCE_VERSION:=078bb57e0769c987c05244abe1f7d8d53e0e323e PKG_MAINTAINER:=Jo-Philipp Wich -PKG_MIRROR_HASH:=cf4bd4670ce8d49f5fb97f0e74a817324c1a503c90527282e30365d8b9a2e17a +PKG_MIRROR_HASH:=7f626efd95eccc7b8262a7e533341e17fe765d99cfa2fafde978190cb834fced PKG_LICENSE:=ISC PKG_LICENSE_FILES:= From 168e4c91d890da9d27ce562a67fe962bfe0f3a41 Mon Sep 17 00:00:00 2001 From: "J. Scott Heppler" Date: Mon, 25 May 2020 18:24:40 -0700 Subject: [PATCH 03/13] ramips: add support for TRENDnet TEW-810DR Specifications: * MediaTek MT7620A (580 Mhz) * 8 MB of FLASH * 64 MB of RAM * 2.4Ghz and 5.0Ghz radios * 5x 10/100 Mbps Ethernet (1 WAN and 4 LAN) * UART header on PCB (57600 8n1) * Green/Orange Power LEDs illuminating a Power-Button Lens * Green/Orange Internet LEDs GPIO controlled illuminating a Globe/Internet Lens * 3x button - wps, power and reset * U-boot bootloader Installation: The sysupgrade.bin image is reported to be OEM web flashed with an ncc_att_hwid appended. ncc_att_hwid is a 32bit binary in the GPL Source download for either the TEW-810DR or DIR-810L and is located at source/user/wolf/cameo/ncc/hostTools. The invocation is: ncc_att_hwid -f tew-810dr-squashfs-factory.bin -a -m "TEW-810DR" -H "1.0R" -r "WW" -c "1.0" This may need to be altered if your hardware version is "1.1R". The image can also be directly flashed via serial tftp: 1. Load *.sysupgrade.bin to your tftp server directory and rename for convenience. 2. Set a static ip 192.168.10.100. 3. NIC cable to a lan port. 4. Serial connection parameters 57600,8N1 5. Power on the TEW-810 and press 4 for a u-boot command line prompt. 6. Verify IP's with U-Boot command "printenv". 7. Adjust tftp settings if needed per the tftp documentation 8. Boot the tftp image to test the build. 9. If the image loads, reset your server ip to 192.168.1.10 and restart network. 10. Log in to Luci, 192.168.1.1, and flash the *sysupgrade.bin image. Notes: The only valid MAC address is found in 0x28 of the factory partition. Other typical offsets/caldata only contain example data: 00:11:22:00:0f:xx Signed-off-by: J. Scott Heppler [remove "link rx tx" in 01_leds, format and extend commit message, fix DTS led node names] Signed-off-by: Adrian Schmutzler --- .../ramips/dts/mt7620a_trendnet_tew-810dr.dts | 166 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 9 + .../mt7620/base-files/etc/board.d/01_leds | 3 + .../mt7620/base-files/etc/board.d/02_network | 4 +- 4 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts diff --git a/target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts b/target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts new file mode 100644 index 0000000000..24d5fcb51f --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts @@ -0,0 +1,166 @@ +//SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "trendnet,tew-810dr", "ralink,mt7620a-soc"; + model = "TRENDnet TEW-810DR"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_green; + led-running = &led_power_green; + led-upgrade = &led_power_green; + label-mac-device = ðernet; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "tew-810dr:green:power"; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + }; + + wan_orange { + label = "tew-810dr:orange:wan"; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + }; + + wan_green { + label = "tew-810dr:green:wan"; + gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; + }; + + power_orange { + label = "tew-810dr:orange:power"; + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + 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; + }; + + factory5g: partition@50000 { + label = "factory5g"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "Wolf_Config"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = "MyDlink"; + reg = <0x70000 0x80000>; + read-only; + }; + + partition@f0000 { + label = "Jffs2"; + reg = <0xf0000 0x80000>; + read-only; + }; + + partition@170000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x170000 0x690000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uartf", "ephy"; + function = "gpio"; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; +}; + +&gsw { + mediatek,port4 = "ephy"; +}; + +&pcie { + status = "okay"; +}; + +&wmac { + pinctrl-names = "default"; + pinctrl-0 = <&pa_pins>; + + ralink,mtd-eeprom = <&factory 0x0>; + mtd-mac-address = <&factory 0x28>; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0x28>; + mtd-mac-address-increment = <2>; + }; +}; + +&gpio2 { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index e435b1d15f..386809e40f 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -1005,6 +1005,15 @@ define Device/tplink_re210-v1 endef TARGET_DEVICES += tplink_re210-v1 +define Device/trendnet_tew-810dr + SOC := mt7620a + DEVICE_PACKAGES := kmod-mt76x0e + DEVICE_VENDOR := TRENDnet + DEVICE_MODEL := TEW-810DR + IMAGE_SIZE := 6720k +endef +TARGET_DEVICES += trendnet_tew-810dr + define Device/vonets_var11n-300 SOC := mt7620n IMAGE_SIZE := 3776k diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index c1deae59e3..e7b9413a48 100755 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -191,6 +191,9 @@ tplink,archer-mr200) tplink,re200-v1) ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" "eth0" ;; +trendnet,tew-810dr) + ucidef_set_led_netdev "wan" "wan" "$boardname:green:wan" "eth0.2" + ;; youku,yk1) set_wifi_led "$boardname:blue:air" ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x10" 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 d024674c10..2a54fa12e9 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 @@ -26,6 +26,7 @@ ramips_setup_interfaces() ralink,mt7620a-mt7610e-evb|\ ralink,mt7620a-v22sg-evb|\ sanlinking,d240|\ + trendnet,tew-810dr|\ youku,yk1|\ zbtlink,zbt-ape522ii|\ zbtlink,zbt-we826-16m|\ @@ -259,7 +260,8 @@ ramips_setup_macs() alfa-network,ac1200rm|\ dlink,dir-810l|\ phicomm,psg1218a|\ - phicomm,psg1218b) + phicomm,psg1218b|\ + trendnet,tew-810dr) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1) ;; alfa-network,r36m-e4g|\ From 0225018d8b6ebdd2c8ff27abeb5b0ec929cd815c Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 26 May 2020 21:44:54 +0200 Subject: [PATCH 04/13] ramips: create shared DTSI for DIR-810L and TEW-810DR These devices seem to have the same board, so let's have a common file. Signed-off-by: Adrian Schmutzler --- .../linux/ramips/dts/mt7620a_cameo_810.dtsi | 116 ++++++++++++++++++ .../ramips/dts/mt7620a_dlink_dir-810l.dts | 113 +---------------- .../ramips/dts/mt7620a_trendnet_tew-810dr.dts | 112 +---------------- 3 files changed, 118 insertions(+), 223 deletions(-) create mode 100644 target/linux/ramips/dts/mt7620a_cameo_810.dtsi diff --git a/target/linux/ramips/dts/mt7620a_cameo_810.dtsi b/target/linux/ramips/dts/mt7620a_cameo_810.dtsi new file mode 100644 index 0000000000..8ab166d283 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_cameo_810.dtsi @@ -0,0 +1,116 @@ +//SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620a.dtsi" + +#include +#include + +/ { + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + 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; + }; + + factory5g: partition@50000 { + label = "factory5g"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "Wolf_Config"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = "MyDlink"; + reg = <0x70000 0x80000>; + read-only; + }; + + partition@f0000 { + label = "Jffs2"; + reg = <0xf0000 0x80000>; + read-only; + }; + + partition@170000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x170000 0x690000>; + }; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; + + mediatek,portmap = "llllw"; +}; + +&wmac { + pinctrl-names = "default"; + pinctrl-0 = <&pa_pins>; + + ralink,mtd-eeprom = <&factory 0x0>; + mtd-mac-address = <&factory 0x28>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0x28>; + mtd-mac-address-increment = <2>; + }; +}; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts b/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts index 8f6bf971ec..63952d3e64 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts @@ -1,9 +1,6 @@ /dts-v1/; -#include "mt7620a.dtsi" - -#include -#include +#include "mt7620a_cameo_810.dtsi" / { compatible = "dlink,dir-810l", "ralink,mt7620a-soc"; @@ -17,22 +14,6 @@ label-mac-device = ðernet; }; - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - leds { compatible = "gpio-leds"; @@ -53,70 +34,6 @@ }; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <50000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - 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; - }; - - factory5g: partition@50000 { - label = "factory5g"; - reg = <0x50000 0x10000>; - read-only; - }; - - partition@60000 { - label = "Wolf_Config"; - reg = <0x60000 0x10000>; - read-only; - }; - - partition@70000 { - label = "MyDlink"; - reg = <0x70000 0x80000>; - read-only; - }; - - partition@f0000 { - label = "Jffs2"; - reg = <0xf0000 0x80000>; - read-only; - }; - - partition@170000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x170000 0x690000>; - }; - }; - }; -}; - &state_default { gpio { groups = "i2c", "uartf"; @@ -124,37 +41,9 @@ }; }; -ðernet { - mtd-mac-address = <&factory 0x28>; - - mediatek,portmap = "llllw"; -}; - &gsw { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; mediatek,port4 = "ephy"; }; - -&pcie { - status = "okay"; -}; - -&wmac { - pinctrl-names = "default"; - pinctrl-0 = <&pa_pins>; - - ralink,mtd-eeprom = <&factory 0x0>; - mtd-mac-address = <&factory 0x28>; -}; - -&pcie0 { - wifi@0,0 { - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&factory 0x28>; - mtd-mac-address-increment = <2>; - }; -}; diff --git a/target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts b/target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts index 24d5fcb51f..679b429b6d 100644 --- a/target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts +++ b/target/linux/ramips/dts/mt7620a_trendnet_tew-810dr.dts @@ -1,10 +1,7 @@ //SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include "mt7620a.dtsi" - -#include -#include +#include "mt7620a_cameo_810.dtsi" / { compatible = "trendnet,tew-810dr", "ralink,mt7620a-soc"; @@ -18,22 +15,6 @@ label-mac-device = ðernet; }; - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - leds { compatible = "gpio-leds"; @@ -59,70 +40,6 @@ }; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <50000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - 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; - }; - - factory5g: partition@50000 { - label = "factory5g"; - reg = <0x50000 0x10000>; - read-only; - }; - - partition@60000 { - label = "Wolf_Config"; - reg = <0x60000 0x10000>; - read-only; - }; - - partition@70000 { - label = "MyDlink"; - reg = <0x70000 0x80000>; - read-only; - }; - - partition@f0000 { - label = "Jffs2"; - reg = <0xf0000 0x80000>; - read-only; - }; - - partition@170000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x170000 0x690000>; - }; - }; - }; -}; - &state_default { gpio { groups = "i2c", "uartf", "ephy"; @@ -130,37 +47,10 @@ }; }; -ðernet { - mtd-mac-address = <&factory 0x28>; - mediatek,portmap = "llllw"; -}; - &gsw { mediatek,port4 = "ephy"; }; -&pcie { - status = "okay"; -}; - -&wmac { - pinctrl-names = "default"; - pinctrl-0 = <&pa_pins>; - - ralink,mtd-eeprom = <&factory 0x0>; - mtd-mac-address = <&factory 0x28>; -}; - -&pcie0 { - wifi@0,0 { - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - mtd-mac-address = <&factory 0x28>; - mtd-mac-address-increment = <2>; - }; -}; - &gpio2 { status = "okay"; }; From 98342b15434c5d852b891c3be7367257cf9a9cc5 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Tue, 26 May 2020 22:21:46 +0200 Subject: [PATCH 05/13] glibc: update to latest 2.31 commit (BZ #25976, BZ #25824) 3a44844c97 nss_compat: internal_end*ent may clobber errno, hiding ERANGE [BZ #25976] c839175267 aarch64: fix strcpy and strnlen for big-endian [BZ #25824] Signed-off-by: Hans Dedecker --- toolchain/glibc/common.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 768ff19060..db4f0fcc0e 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -11,8 +11,8 @@ PKG_VERSION:=2.31 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=109474122400ca7d60782b131dc867a5c1f2fe55 -PKG_MIRROR_HASH:=5a04a24e69eace9eb892f0b48b869d31d4900ad656099064b6a9d8a342c13d8c +PKG_SOURCE_VERSION:=3a44844c97a8ca1d0798c45b5252e6a49f9cf8e1 +PKG_MIRROR_HASH:=d7206510e494b3c723173d8ec0dd2e41314da59075871c5642324688001b3f6e PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz From 6ce1e299be13800dbc49821b1faad5e934b91f09 Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Tue, 19 May 2020 12:34:53 +0200 Subject: [PATCH 06/13] ath79: fix LEDs for D-Link DIR-842 The device has a total of 8 LEDs, 5 of which are controlled by the switch (LAN 1-4, WAN). Only power, wifi and wps are controlled by the SoC. * led_power is on GPIO 5 (not 15), boot flashing sequence is now visible * remove led 'internet', since it is only connected to the switch * remove ucidef_set_led_switch for WAN from 01_leds, as it has no effect Tested on revisions C1 and C3. Signed-off-by: Sebastian Schaper [adjust commit title] Signed-off-by: Adrian Schmutzler --- .../linux/ath79/dts/qca9563_dlink_dir-842-c1.dts | 15 +++++---------- .../linux/ath79/dts/qca9563_dlink_dir-842-c2.dts | 15 +++++---------- .../linux/ath79/dts/qca9563_dlink_dir-842-c3.dts | 15 +++++---------- .../ath79/generic/base-files/etc/board.d/01_leds | 3 --- 4 files changed, 15 insertions(+), 33 deletions(-) diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts b/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts index 4df4e8a969..444034ed5f 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts +++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts @@ -17,21 +17,16 @@ leds { compatible = "gpio-leds"; + led_power: power { + label = "dir-842-c1:green:power"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + wps { label = "dir-842-c1:green:wps"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; }; - led_power: power { - label = "dir-842-c1:green:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - internet { - label = "dir-842-c1:green:internet"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - wlan { label = "dir-842-c1:green:wlan"; gpios = <&gpio 19 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts b/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts index b86ea29a99..56485a287c 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts +++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts @@ -17,21 +17,16 @@ leds { compatible = "gpio-leds"; + led_power: power { + label = "dir-842-c2:green:power"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + wps { label = "dir-842-c2:green:wps"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; }; - led_power: power { - label = "dir-842-c2:green:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - internet { - label = "dir-842-c2:green:internet"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - wlan { label = "dir-842-c2:green:wlan"; gpios = <&gpio 19 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts b/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts index 205fd8f60e..d1467ab5fe 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts +++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts @@ -17,21 +17,16 @@ leds { compatible = "gpio-leds"; + led_power: power { + label = "dir-842-c3:green:power"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + wps { label = "dir-842-c3:green:wps"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; }; - led_power: power { - label = "dir-842-c3:green:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - internet { - label = "dir-842-c3:green:internet"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - wlan { label = "dir-842-c3:green:wlan"; gpios = <&gpio 19 GPIO_ACTIVE_LOW>; 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 4774d5daf2..90adc3a97f 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -102,9 +102,6 @@ enterasys,ws-ap3705i) devolo,magic-2-wifi) ucidef_set_led_netdev "plcw" "dLAN" "devolo:white:dlan" "eth0.1" "rx" ;; -dlink,dir-842-c1|\ -dlink,dir-842-c2|\ -dlink,dir-842-c3|\ dlink,dir-859-a1) ucidef_set_led_switch "internet" "WAN" "$boardname:green:internet" "switch0" "0x20" ;; From 8643c0b53d74aeb535c6700c115d323cb55ec7fb Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Tue, 19 May 2020 12:38:21 +0200 Subject: [PATCH 07/13] ath79: define switch reset-gpios for D-Link DIR-842 GPIO 11 needs to be pulled high for the external gigabit switch to work, this is currently solved via gpio-hog. Replace with phy0 reset-gpios. Tested on revisions C1 and C3. Reset button is still working for reboot, to enter failsafe, and to enter bootloader http recovery. Signed-off-by: Sebastian Schaper --- target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi index 2482874c99..8071332451 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi +++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi @@ -25,14 +25,6 @@ debounce-interval = <60>; }; }; - - // Pull up on boot - otherwise the reset button won't work - reset-button { - gpio-hog; - output-high; - gpios = <11 GPIO_ACTIVE_LOW>; - line-name = "reset-button"; - }; }; &uart { @@ -116,6 +108,7 @@ phy0: ethernet-phy@0 { reg = <0>; qca,mib-poll-interval = <500>; + reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>; qca,ar8327-initvals = < 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ @@ -140,5 +133,6 @@ &wmac { status = "okay"; + qca,no-eeprom; }; From 64d088d8f9f2fbca75f3240ced5cf40b721dc3f2 Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Tue, 19 May 2020 12:40:17 +0200 Subject: [PATCH 08/13] ath79: increase spi clock for D-Link DIR-842 AHB is 258 MHz for this device (CPU_PLL / 3), but there is no difference between 64 MHz and 50 MHz for spi-max-frequency, thus increase to 50 MHz. Tested on revisions C1 and C3. Signed-off-by: Sebastian Schaper --- target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi index 8071332451..6b2fb1c4a0 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi +++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi @@ -37,12 +37,13 @@ &spi { status = "okay"; + num-cs = <1>; flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <30000000>; + spi-max-frequency = <50000000>; partitions { compatible = "fixed-partitions"; From 10c211031ccd4703230493025a5a3b9d6fcad2f2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 23 May 2020 21:16:44 +0200 Subject: [PATCH 09/13] musl: fix locking synchronization bug Import proposed upstream fix [2] for the critical locking synchronization bug recently found in musl [1]. This affects all programs that are temporarily multithreaded, but then return to single-threaded operation. [1] https://www.openwall.com/lists/musl/2020/05/22/3 [2] https://www.openwall.com/lists/musl/2020/05/22/10 Signed-off-by: Matthias Schiffer --- ...hreads_minus_1-as-relaxed-atomic-for.patch | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 toolchain/musl/patches/500-0002-don-t-use-libc.threads_minus_1-as-relaxed-atomic-for.patch diff --git a/toolchain/musl/patches/500-0002-don-t-use-libc.threads_minus_1-as-relaxed-atomic-for.patch b/toolchain/musl/patches/500-0002-don-t-use-libc.threads_minus_1-as-relaxed-atomic-for.patch new file mode 100644 index 0000000000..4ca51b0be0 --- /dev/null +++ b/toolchain/musl/patches/500-0002-don-t-use-libc.threads_minus_1-as-relaxed-atomic-for.patch @@ -0,0 +1,69 @@ +From e01b5939b38aea5ecbe41670643199825874b26c Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 21 May 2020 23:32:45 -0400 +Subject: [PATCH 2/4] don't use libc.threads_minus_1 as relaxed atomic for + skipping locks + +after all but the last thread exits, the next thread to observe +libc.threads_minus_1==0 and conclude that it can skip locking fails to +synchronize with any changes to memory that were made by the +last-exiting thread. this can produce data races. + +on some archs, at least x86, memory synchronization is unlikely to be +a problem; however, with the inline locks in malloc, skipping the lock +also eliminated the compiler barrier, and caused code that needed to +re-check chunk in-use bits after obtaining the lock to reuse a stale +value, possibly from before the process became single-threaded. this +in turn produced corruption of the heap state. + +some uses of libc.threads_minus_1 remain, especially for allocation of +new TLS in the dynamic linker; otherwise, it could be removed +entirely. it's made non-volatile to reflect that the remaining +accesses are only made under lock on the thread list. + +instead of libc.threads_minus_1, libc.threaded is now used for +skipping locks. the difference is that libc.threaded is permanently +true once an additional thread has been created. this will produce +some performance regression in processes that are mostly +single-threaded but occasionally creating threads. in the future it +may be possible to bring back the full lock-skipping, but more care +needs to be taken to produce a safe design. +--- + src/internal/libc.h | 2 +- + src/malloc/malloc.c | 2 +- + src/thread/__lock.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +--- a/src/internal/libc.h ++++ b/src/internal/libc.h +@@ -21,7 +21,7 @@ struct __libc { + int can_do_threads; + int threaded; + int secure; +- volatile int threads_minus_1; ++ int threads_minus_1; + size_t *auxv; + struct tls_module *tls_head; + size_t tls_size, tls_align, tls_cnt; +--- a/src/malloc/malloc.c ++++ b/src/malloc/malloc.c +@@ -26,7 +26,7 @@ int __malloc_replaced; + + static inline void lock(volatile int *lk) + { +- if (libc.threads_minus_1) ++ if (libc.threaded) + while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1); + } + +--- a/src/thread/__lock.c ++++ b/src/thread/__lock.c +@@ -18,7 +18,7 @@ + + void __lock(volatile int *l) + { +- if (!libc.threads_minus_1) return; ++ if (!libc.threaded) return; + /* fast path: INT_MIN for the lock, +1 for the congestion */ + int current = a_cas(l, 0, INT_MIN + 1); + if (!current) return; From afea16b8f752b3ccd3f66f9ac3890586d44cde69 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 23 May 2020 21:17:15 +0200 Subject: [PATCH 10/13] musl: restore lock skipping for mostly-singlethreaded programs, and related patches The remainder of the patch series proposed by upstream [2] for the locking synchronization issue [1]. [1] https://www.openwall.com/lists/musl/2020/05/22/3 [2] https://www.openwall.com/lists/musl/2020/05/22/10 Signed-off-by: Matthias Schiffer --- ...ist-unlink-in-pthread_exit-after-all.patch | 51 +++++++++++ ...own-size-of-some-libc-struct-members.patch | 25 ++++++ ...pping-for-processes-that-return-to-s.patch | 90 +++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 toolchain/musl/patches/500-0001-reorder-thread-list-unlink-in-pthread_exit-after-all.patch create mode 100644 toolchain/musl/patches/500-0003-cut-down-size-of-some-libc-struct-members.patch create mode 100644 toolchain/musl/patches/500-0004-restore-lock-skipping-for-processes-that-return-to-s.patch diff --git a/toolchain/musl/patches/500-0001-reorder-thread-list-unlink-in-pthread_exit-after-all.patch b/toolchain/musl/patches/500-0001-reorder-thread-list-unlink-in-pthread_exit-after-all.patch new file mode 100644 index 0000000000..d47f2f4108 --- /dev/null +++ b/toolchain/musl/patches/500-0001-reorder-thread-list-unlink-in-pthread_exit-after-all.patch @@ -0,0 +1,51 @@ +From 4d5aa20a94a2d3fae3e69289dc23ecafbd0c16c4 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Fri, 22 May 2020 17:35:14 -0400 +Subject: [PATCH 1/4] reorder thread list unlink in pthread_exit after all + locks + +since the backend for LOCK() skips locking if single-threaded, it's +unsafe to make the process appear single-threaded before the last use +of lock. + +this fixes potential unsynchronized access to a linked list via +__dl_thread_cleanup. +--- + src/thread/pthread_create.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +--- a/src/thread/pthread_create.c ++++ b/src/thread/pthread_create.c +@@ -90,14 +90,7 @@ _Noreturn void __pthread_exit(void *resu + exit(0); + } + +- /* At this point we are committed to thread termination. Unlink +- * the thread from the list. This change will not be visible +- * until the lock is released, which only happens after SYS_exit +- * has been called, via the exit futex address pointing at the lock. */ +- libc.threads_minus_1--; +- self->next->prev = self->prev; +- self->prev->next = self->next; +- self->prev = self->next = self; ++ /* At this point we are committed to thread termination. */ + + /* Process robust list in userspace to handle non-pshared mutexes + * and the detached thread case where the robust list head will +@@ -121,6 +114,16 @@ _Noreturn void __pthread_exit(void *resu + __do_orphaned_stdio_locks(); + __dl_thread_cleanup(); + ++ /* Last, unlink thread from the list. This change will not be visible ++ * until the lock is released, which only happens after SYS_exit ++ * has been called, via the exit futex address pointing at the lock. ++ * This needs to happen after any possible calls to LOCK() that might ++ * skip locking if libc.threads_minus_1 is zero. */ ++ libc.threads_minus_1--; ++ self->next->prev = self->prev; ++ self->prev->next = self->next; ++ self->prev = self->next = self; ++ + /* This atomic potentially competes with a concurrent pthread_detach + * call; the loser is responsible for freeing thread resources. */ + int state = a_cas(&self->detach_state, DT_JOINABLE, DT_EXITING); diff --git a/toolchain/musl/patches/500-0003-cut-down-size-of-some-libc-struct-members.patch b/toolchain/musl/patches/500-0003-cut-down-size-of-some-libc-struct-members.patch new file mode 100644 index 0000000000..6650434397 --- /dev/null +++ b/toolchain/musl/patches/500-0003-cut-down-size-of-some-libc-struct-members.patch @@ -0,0 +1,25 @@ +From f12888e9eb9eed60cc266b899dcafecb4752964a Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Fri, 22 May 2020 17:25:38 -0400 +Subject: [PATCH 3/4] cut down size of some libc struct members + +these are all flags that can be single-byte values. +--- + src/internal/libc.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/src/internal/libc.h ++++ b/src/internal/libc.h +@@ -18,9 +18,9 @@ struct tls_module { + }; + + struct __libc { +- int can_do_threads; +- int threaded; +- int secure; ++ char can_do_threads; ++ char threaded; ++ char secure; + int threads_minus_1; + size_t *auxv; + struct tls_module *tls_head; diff --git a/toolchain/musl/patches/500-0004-restore-lock-skipping-for-processes-that-return-to-s.patch b/toolchain/musl/patches/500-0004-restore-lock-skipping-for-processes-that-return-to-s.patch new file mode 100644 index 0000000000..83a6d0247a --- /dev/null +++ b/toolchain/musl/patches/500-0004-restore-lock-skipping-for-processes-that-return-to-s.patch @@ -0,0 +1,90 @@ +From 8d81ba8c0bc6fe31136cb15c9c82ef4c24965040 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Fri, 22 May 2020 17:45:47 -0400 +Subject: [PATCH 4/4] restore lock-skipping for processes that return to + single-threaded state + +the design used here relies on the barrier provided by the first lock +operation after the process returns to single-threaded state to +synchronize with actions by the last thread that exited. by storing +the intent to change modes in the same object used to detect whether +locking is needed, it's possible to avoid an extra (possibly costly) +memory load after the lock is taken. +--- + src/internal/libc.h | 1 + + src/malloc/malloc.c | 5 ++++- + src/thread/__lock.c | 4 +++- + src/thread/pthread_create.c | 8 ++++---- + 4 files changed, 12 insertions(+), 6 deletions(-) + +--- a/src/internal/libc.h ++++ b/src/internal/libc.h +@@ -21,6 +21,7 @@ struct __libc { + char can_do_threads; + char threaded; + char secure; ++ volatile signed char need_locks; + int threads_minus_1; + size_t *auxv; + struct tls_module *tls_head; +--- a/src/malloc/malloc.c ++++ b/src/malloc/malloc.c +@@ -26,8 +26,11 @@ int __malloc_replaced; + + static inline void lock(volatile int *lk) + { +- if (libc.threaded) ++ int need_locks = libc.need_locks; ++ if (need_locks) { + while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1); ++ if (need_locks < 0) libc.need_locks = 0; ++ } + } + + static inline void unlock(volatile int *lk) +--- a/src/thread/__lock.c ++++ b/src/thread/__lock.c +@@ -18,9 +18,11 @@ + + void __lock(volatile int *l) + { +- if (!libc.threaded) return; ++ int need_locks = libc.need_locks; ++ if (!need_locks) return; + /* fast path: INT_MIN for the lock, +1 for the congestion */ + int current = a_cas(l, 0, INT_MIN + 1); ++ if (need_locks < 0) libc.need_locks = 0; + if (!current) return; + /* A first spin loop, for medium congestion. */ + for (unsigned i = 0; i < 10; ++i) { +--- a/src/thread/pthread_create.c ++++ b/src/thread/pthread_create.c +@@ -118,8 +118,8 @@ _Noreturn void __pthread_exit(void *resu + * until the lock is released, which only happens after SYS_exit + * has been called, via the exit futex address pointing at the lock. + * This needs to happen after any possible calls to LOCK() that might +- * skip locking if libc.threads_minus_1 is zero. */ +- libc.threads_minus_1--; ++ * skip locking if process appears single-threaded. */ ++ if (!--libc.threads_minus_1) libc.need_locks = -1; + self->next->prev = self->prev; + self->prev->next = self->next; + self->prev = self->next = self; +@@ -339,7 +339,7 @@ int __pthread_create(pthread_t *restrict + ~(1UL<<((SIGCANCEL-1)%(8*sizeof(long)))); + + __tl_lock(); +- libc.threads_minus_1++; ++ if (!libc.threads_minus_1++) libc.need_locks = 1; + ret = __clone((c11 ? start_c11 : start), stack, flags, args, &new->tid, TP_ADJ(new), &__thread_list_lock); + + /* All clone failures translate to EAGAIN. If explicit scheduling +@@ -363,7 +363,7 @@ int __pthread_create(pthread_t *restrict + new->next->prev = new; + new->prev->next = new; + } else { +- libc.threads_minus_1--; ++ if (!--libc.threads_minus_1) libc.need_locks = 0; + } + __tl_unlock(); + __restore_sigs(&set); From e8fbb98c6d1b89ea5c8b6df6d0ec96da9978a513 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 27 May 2020 18:30:56 +0200 Subject: [PATCH 11/13] ramips: fix LED DT label for Zyxel Keenetic Start Signed-off-by: Adrian Schmutzler --- .../linux/ramips/dts/rt5350_zyxel_keenetic-start.dts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts b/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts index fe5e5e29b4..20c0dad4bb 100644 --- a/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts +++ b/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts @@ -11,17 +11,17 @@ model = "ZyXEL Keenetic Start"; aliases { - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; label-mac-device = ðernet; }; leds { compatible = "gpio-leds"; - led_status: power { + led_power: power { label = "zyxel:green:power"; gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; From 2b92ee36ae93456b16ca2813612d663dfeb65832 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Thu, 28 May 2020 00:48:39 +0200 Subject: [PATCH 12/13] ath79: replace tab after DT label by space The common separator in this case is a single space. Signed-off-by: Adrian Schmutzler --- target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts | 2 +- target/linux/ath79/dts/ar9331_8dev_carambola2.dts | 2 +- target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts | 2 +- target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts | 2 +- target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi | 2 +- target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi | 2 +- target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi | 2 +- target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts index e85ac8f5f8..56b850c99f 100644 --- a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts +++ b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts @@ -116,7 +116,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x020000>; read-only; diff --git a/target/linux/ath79/dts/ar9331_8dev_carambola2.dts b/target/linux/ath79/dts/ar9331_8dev_carambola2.dts index ef244f0b55..ffb9745e03 100644 --- a/target/linux/ath79/dts/ar9331_8dev_carambola2.dts +++ b/target/linux/ath79/dts/ar9331_8dev_carambola2.dts @@ -81,7 +81,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x040000>; read-only; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts index 97a058edf6..8f4147b7f7 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts @@ -128,7 +128,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x020000>; read-only; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts index 57cefee819..85ab924009 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts @@ -123,7 +123,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x020000>; read-only; diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi b/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi index 9f1bef3d4d..3559481f7d 100644 --- a/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi +++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi @@ -92,7 +92,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x020000>; read-only; diff --git a/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi b/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi index d08b4d65a5..b24ed1fb14 100644 --- a/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi +++ b/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi @@ -74,7 +74,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x020000>; read-only; diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi index bfa29fece3..8a39a10ba5 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi @@ -113,7 +113,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x020000>; read-only; diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi b/target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi index 5050c8cbd5..d98250b070 100644 --- a/target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi +++ b/target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi @@ -30,7 +30,7 @@ #address-cells = <1>; #size-cells = <1>; - uboot: partition@0 { + uboot: partition@0 { label = "u-boot"; reg = <0x000000 0x020000>; read-only; From ad84c095028f6ddef95a92e028760cce23d32f6c Mon Sep 17 00:00:00 2001 From: Pavel Balan Date: Fri, 27 Mar 2020 03:32:55 +0000 Subject: [PATCH 13/13] ath79: add support for COMFAST CF-E130N v2 This patch adds support for the COMFAST CF-E130N v2, an outdoor wireless CPE with a single Ethernet port and a 802.11bgn radio. Specifications: - QCA9531 SoC - 1x 10/100 Mbps Ethernet with PoE-in support - 64 MB of RAM (DDR2) - 16 MB of FLASH - 5 dBi built-in antenna - POWER/LAN/WLAN green LEDs - 4x RSSI LEDs (2x red, 2x green) - UART (115200 8N1) and GPIO (J9) headers on PCB Flashing instructions: The original firmware is based on OpenWrt so a sysupgrade image can be installed via the stock web GUI. The U-boot bootloader also contains a backup TFTP client to upload the firmware from. Upon boot, it checks its ethernet network for the IP 192.168.1.10. Host a TFTP server and provide the image to be flashed as file firmware_auto.bin. MAC address setup: The art partition contains four consecutive MAC addresses: 0x0 aa:bb:cc:xx:xx:c4 0x6 aa:bb:cc:xx:xx:c6 0x1002 aa:bb:cc:xx:xx:c5 0x5006 aa:bb:cc:xx:xx:c7 However, the manufacturer in its infinite wisdom decided that one address is enough and both eth0 and WiFi get the MAC address from 0x0 (yes, that's overwriting the existing and valid address in 0x1002). This is obviously also the address on the device's label. Signed-off-by: Pavel Balan [fix configs partition, fix IMAGE_SIZE, add MAC address comment, rename ATH_SOC to SOC] Signed-off-by: Adrian Schmutzler --- .../ath79/dts/qca9531_comfast_cf-e130n-v2.dts | 150 ++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 8 + .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic.mk | 10 ++ 4 files changed, 169 insertions(+) create mode 100644 target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts new file mode 100644 index 0000000000..a6ef6ad99c --- /dev/null +++ b/target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca953x.dtsi" + +/ { + compatible = "comfast,cf-e130n-v2", "qca,qca9531"; + model = "COMFAST CF-E130N v2"; + + aliases { + serial0 = &uart; + led-boot = &led_rssihigh; + led-failsafe = &led_rssihigh; + led-upgrade = &led_rssihigh; + label-mac-device = ð1; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + + wlan { + label = "cf-e130n-v2:green:wlan"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + lan { + label = "cf-e130n-v2:green:lan"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + unused { + label = "cf-e130n-v2:green:unused"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + rssilow { + label = "cf-e130n-v2:red:rssilow"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + rssimediumlow { + label = "cf-e130n-v2:red:rssimediumlow"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + rssimediumhigh { + label = "cf-e130n-v2:green:rssimediumhigh"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_rssihigh: rssihigh { + label = "cf-e130n-v2:green:rssihigh"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&spi { + status = "okay"; + + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x010000>; + read-only; + }; + + art: partition@10000 { + label = "art"; + reg = <0x010000 0x010000>; + read-only; + }; + + partition@20000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x020000 0x7c0000>; + }; + + partition@7e0000 { + label = "configs"; + reg = <0x7e0000 0x010000>; + read-only; + }; + + partition@7f0000 { + label = "nvram"; + reg = <0x7f0000 0x010000>; + read-only; + }; + }; + }; +}; + +&uart { + status = "okay"; + +}; + +ð0 { + compatible = "syscon", "simple-mfd"; +}; + +ð1 { + status = "okay"; + + phy-handle = <&swphy0>; + + mtd-mac-address = <&art 0x0>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <1>; + }; +}; + +&wmac { + status = "okay"; + + mtd-mac-address = <&art 0x0>; + mtd-cal-data = <&art 0x1000>; +}; 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 90adc3a97f..8e3b5e17af 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -57,6 +57,14 @@ comfast,cf-e120a-v3) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssimediumhigh" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100" ;; +comfast,cf-e130n-v2) + ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0" + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:red:rssimediumlow" "wlan0" "26" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssimediumhigh" "wlan0" "51" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100" + ;; comfast,cf-e313ac) ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x02" ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1" 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 a99d5f6532..6fe76817ff 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -16,6 +16,7 @@ ath79_setup_interfaces() avm,fritz1750e|\ avm,fritz300e|\ comfast,cf-wr752ac-v1|\ + comfast,cf-e130n-v2|\ devolo,dvl1200i|\ devolo,dvl1750c|\ devolo,dvl1750i|\ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 7f06740c98..45dfc6bdad 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -304,6 +304,16 @@ define Device/comfast_cf-e120a-v3 endef TARGET_DEVICES += comfast_cf-e120a-v3 +define Device/comfast_cf-e130n-v2 + SOC := qca9531 + DEVICE_VENDOR := COMFAST + DEVICE_MODEL := CF-E130N + DEVICE_VARIANT := v2 + DEVICE_PACKAGES := rssileds kmod-leds-gpio -swconfig -uboot-envtools + IMAGE_SIZE := 7936k +endef +TARGET_DEVICES += comfast_cf-e130n-v2 + define Device/comfast_cf-e313ac SOC := qca9531 DEVICE_VENDOR := COMFAST