From 95c9df79712541627ad5f1cd38a1144decc14474 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sat, 19 Sep 2020 13:16:52 +0200 Subject: [PATCH 1/6] ipq806x: fix support of Edgecore ECW5410 support This fixes several stylistic and functional errors of the recently added Edgecore ECW5410: - fix call in 11-ath10k-caldata - use hex notation in 11-ath10k-caldata - remove redundant definitions from DTS that are already in DTSI - use proper sorting in image/Makefile - use DEVICE_VENDOR/DEVICE_MODEL instead of DEVICE_TITLE - use SOC instead of DEVICE_DTS Fixes: 59f0a0fd839e ("ipq806x: add Edgecore ECW5410 support") Signed-off-by: Adrian Schmutzler --- .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 +- .../arm/boot/dts/qcom-ipq8068-ecw5410.dts | 73 ++----------------- target/linux/ipq806x/image/Makefile | 25 ++++--- 3 files changed, 21 insertions(+), 81 deletions(-) diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index f4572d038c..74ad00c5ce 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -14,7 +14,7 @@ case "$FIRMWARE" in ath10k_patch_mac $(mtd_get_mac_binary ART 0x1e) ;; edgecore,ecw5410) - ath10kcal_extract "0:ART" 4096 12064 + caldata_extract "0:ART" 0x1000 0x2f20 ;; linksys,ea7500-v1 |\ linksys,ea8500) @@ -83,7 +83,7 @@ case "$FIRMWARE" in "ath10k/pre-cal-pci-0002:01:00.0.bin") case $board in edgecore,ecw5410) - ath10kcal_extract "0:ART" 20480 12064 + caldata_extract "0:ART" 0x5000 0x2f20 ;; esac ;; diff --git a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts index 6d216bd85e..9d6afa1c8a 100644 --- a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts +++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8068-ecw5410.dts @@ -8,10 +8,6 @@ compatible = "edgecore,ecw5410", "qcom,ipq8064"; reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - nss@40000000 { reg = <0x40000000 0x1000000>; no-map; @@ -26,11 +22,6 @@ reg = <0x44000000 0x600000>; no-map; }; - - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; }; cpus { @@ -42,21 +33,19 @@ }; aliases { - serial0 = &gsbi4_serial; serial1 = &gsbi1_serial; mdio-gpio0 = &mdio0; ethernet0 = &gmac3; ethernet1 = &gmac2; - led-boot = &power_green; - led-failsafe = &power_red; - led-running = &power_green; - led-upgrade = &power_green; + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; }; chosen { bootargs-append = " console=ttyMSM0,115200n8 root=/dev/ubiblock0_1"; - stdout-path = "serial0:115200n8"; }; keys { @@ -76,7 +65,7 @@ pinctrl-0 = <&led_pins>; pinctrl-names = "default"; - power_green: power_green { + led_power_green: power_green { label = "ecw5410:green:power"; gpios = <&qcom_pinmux 16 GPIO_ACTIVE_HIGH>; }; @@ -96,7 +85,7 @@ gpios = <&qcom_pinmux 26 GPIO_ACTIVE_LOW>; }; - power_red: power_red { + led_power_red: power_red { label = "ecw5410:red:power"; gpios = <&qcom_pinmux 28 GPIO_ACTIVE_LOW>; }; @@ -133,40 +122,6 @@ }; }; - nand_pins: nand_pins { - disable { - pins = "gpio34", "gpio35", "gpio36", "gpio37", - "gpio38"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - - pullups { - pins = "gpio39"; - function = "nand"; - drive-strength = <10>; - bias-pull-up; - }; - - hold { - pins = "gpio40", "gpio41", "gpio42", "gpio43", - "gpio44", "gpio45", "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-bus-hold; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - led_pins: led_pins { mux { pins = "gpio16", "gpio23", "gpio24", "gpio26", @@ -208,22 +163,6 @@ }; }; -&gsbi4 { - qcom,mode = ; - status = "okay"; - - serial@16340000 { - status = "okay"; - }; - - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ -}; - &gsbi5 { qcom,mode = ; status = "okay"; diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index 3b86760a19..ec73630ae5 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -109,6 +109,19 @@ define Device/compex_wpq864 endef TARGET_DEVICES += compex_wpq864 +define Device/edgecore_ecw5410 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Edgecore + DEVICE_MODEL := ECW5410 + SOC := qcom-ipq8068 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@v2.0-ap160 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-edgecore_ecw5410 +endef +TARGET_DEVICES += edgecore_ecw5410 + define Device/linksys_ea7500-v1 $(call Device/LegacyImage) DEVICE_VENDOR := Linksys @@ -126,18 +139,6 @@ define Device/linksys_ea7500-v1 endef TARGET_DEVICES += linksys_ea7500-v1 -define Device/edgecore_ecw5410 - $(call Device/FitImage) - $(call Device/UbiFit) - DEVICE_TITLE := Edgecore ECW5410 - BLOCKSIZE := 128k - PAGESIZE := 2048 - DEVICE_DTS := qcom-ipq8068-ecw5410 - DEVICE_DTS_CONFIG := config@v2.0-ap160 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-edgecore_ecw5410 -endef -TARGET_DEVICES += edgecore_ecw5410 - define Device/linksys_ea8500 $(call Device/LegacyImage) DEVICE_VENDOR := Linksys From 9e7369d37e3c8ea460ea200f629e8cd0dd7ab54e Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 8 Sep 2020 09:26:32 +0100 Subject: [PATCH 2/6] mediatek: mt7623n-preloader: add preloader for Banana Pi R64 We want to be able to make full system images for this system too, just as we now can for the MT7623 platforms. The package directory (mt7623n) is now a bit misnamed as it's overly specific, but the precise set of platforms which we support this way is evolving and we'll fix it up when the dust settles and we know what nomenclature makes most sense. Signed-off-by: David Woodhouse --- package/boot/mt7623n-preloader/Makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/package/boot/mt7623n-preloader/Makefile b/package/boot/mt7623n-preloader/Makefile index 801c6d19b3..0faaf46d3f 100644 --- a/package/boot/mt7623n-preloader/Makefile +++ b/package/boot/mt7623n-preloader/Makefile @@ -30,6 +30,14 @@ define Download/BPI-R2-preloader-2k.img.gz endef $(eval $(call Download,BPI-R2-preloader-2k.img.gz)) +define Download/BPI-R64-preloader-2k.img.gz + FILE:=$(BPI_PRELOADER_PREFIX)-BPI-R64-preloader-2k.img.gz + URL:=$(BPI_PRELOADER_URL) + URL_FILE:=BPI-R64-preloader-2k.img.gz + HASH:=1a4b55da1717190aa4e790ce93850605e9b15aae4c3248bcf8734aac020ab0e4 +endef +$(eval $(call Download,BPI-R64-preloader-2k.img.gz)) + define Package/mt7623n-preloader SECTION:=boot @@ -43,10 +51,23 @@ define Package/mt7623n-preloader/description Preloader image for mt7623n based boards like Banana Pi R2. endef +define Package/mt7622-preloader + SECTION:=boot + CATEGORY:=Boot Loaders + DEPENDS:=@TARGET_mediatek_mt7622 + TITLE:=mt7622-preloader + DEFAULT:=y if TARGET_mediatek +endef + +define Package/mt7622-preloader/description + Preloader image for mt7622 based boards like Banana Pi R64. +endef + define Build/Prepare rm -rf $(PKG_BUILD_DIR) mkdir -p $(PKG_BUILD_DIR) cp $(DL_DIR)/$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-DDR1600-20191024-2k.img.gz $(PKG_BUILD_DIR)/mt7623n_bpir2-preloader.bin.gz + cp $(DL_DIR)/$(BPI_PRELOADER_PREFIX)-BPI-R64-preloader-2k.img.gz $(PKG_BUILD_DIR)/mt7622_bpir64-preloader.bin.gz endef define Build/Compile @@ -59,3 +80,4 @@ define Build/InstallDev endef $(eval $(call BuildPackage,mt7623n-preloader)) +$(eval $(call BuildPackage,mt7622-preloader)) From d10b738c4b50d24a474c865ea7d0dca0fe623245 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 8 Sep 2020 09:26:33 +0100 Subject: [PATCH 3/6] mediatek: fix missing pause on switch port for Banana Pi R2 This causes rx drops when running iperf. Signed-off-by: David Woodhouse --- ...623-add-missing-pause-for-switchport.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch diff --git a/target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch b/target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch new file mode 100644 index 0000000000..35277f0ddd --- /dev/null +++ b/target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch @@ -0,0 +1,27 @@ +From: Frank Wunderlich +Date: Mon, 7 Sep 2020 09:05:17 +0200 + +port6 of mt7530 switch (= cpu port 0) on bananapi-r2 misses pause option +which causes rx drops on running iperf. + +Cc: stable@vger.kernel.org +Fixes: f4ff257cd160 ("arm: dts: mt7623: add support for Bananapi R2 (BPI-R2) board") +Signed-off-by: Frank Wunderlich +--- + arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +index 2b760f90f38c..5375c6699843 100644 +--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts ++++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +@@ -192,6 +192,7 @@ port@6 { + fixed-link { + speed = <1000>; + full-duplex; ++ pause; + }; + }; + }; +-- +2.25.1 From 7190fb2da46bca02c233432db2cad57655208b68 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 8 Sep 2020 09:26:34 +0100 Subject: [PATCH 4/6] mediatek: mt7623: use bash for generating bootable images It turns out that 'echo -e' isn't portable; it doesn't work in the dash builtin echo and Ubuntu users are complaining. I can't even get octal (specified by POSIX) to work consistently because those variants of 'echo' which *do* support -e don't seem to interpret octalwithout it. I could switch to /bin/echo but using -e with that isn't actually portable *either* even though it works today. For now just stick with bash, and use its builtin. We may end up using something else entirely; perhaps perl. Signed-off-by: David Woodhouse --- target/linux/mediatek/image/gen_mtk_mmc_img.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/image/gen_mtk_mmc_img.sh b/target/linux/mediatek/image/gen_mtk_mmc_img.sh index ea8a9c63a1..2dacb9019d 100755 --- a/target/linux/mediatek/image/gen_mtk_mmc_img.sh +++ b/target/linux/mediatek/image/gen_mtk_mmc_img.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright © 2019 Alexey Loukianov # Copyright © 2020 David Woodhouse From cd36c0d2f093ec6b8a2c6e9b7b300a2fd4fc87b3 Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Thu, 17 Sep 2020 15:40:27 +0200 Subject: [PATCH 5/6] mac80211: select the first available channel for 5GHz interfaces Some 5GHz wifi interfaces, especially in Tri-band routers, can't use channel 36. In these cases, the default configuration for 5GHz interfaces, once enabled, doesn't work. This patch selects the first non-disabled channel for 5GHz interfaces. Signed-off-by: Davide Fioravanti --- package/kernel/mac80211/files/lib/wifi/mac80211.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index be9c537926..c0fbfbe5a8 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -82,9 +82,9 @@ detect_mac80211() { iw phy "$dev" info | grep -q 'Capabilities:' && htmode=HT20 - iw phy "$dev" info | grep -q '5180 MHz' && { + iw phy "$dev" info | grep -q '\* 5... MHz \[' && { mode_band="a" - channel="36" + channel=$(iw phy "$dev" info | grep '\* 5... MHz \[' | grep '(disabled)' -v -m 1 | sed 's/[^[]*\[\|\].*//g') iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80" } From 90853439a162d7c5389f6a68028b4390c349c04d Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Fri, 14 Aug 2020 13:21:22 +0100 Subject: [PATCH 6/6] zram-swap: explicitly use mkswap/swapon/swapoff from /sbin The required BusyBox applets are enabled by default, so we can rely on them being present in the system. This way, we make sure there are no conflicts with less featured variants of these same applets which might also be present in the system. Fixes: 0bd7dfa3ed60 ("zram-swap: enable swap discard") Signed-off-by: Rui Salvaterra [wrap commit description] Signed-off-by: David Bauer --- package/system/zram-swap/Makefile | 4 ++-- package/system/zram-swap/files/zram.init | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package/system/zram-swap/Makefile b/package/system/zram-swap/Makefile index 5c132c9062..9a18dd3417 100644 --- a/package/system/zram-swap/Makefile +++ b/package/system/zram-swap/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zram-swap -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -17,7 +17,7 @@ include $(INCLUDE_DIR)/package.mk define Package/zram-swap SECTION:=utils CATEGORY:=Base system - DEPENDS:=+kmod-zram +!(BUSYBOX_CONFIG_MKSWAP&&BUSYBOX_CONFIG_SWAPON&&BUSYBOX_CONFIG_SWAPOFF):swap-utils + DEPENDS:=+kmod-zram +@BUSYBOX_CONFIG_MKSWAP +@BUSYBOX_CONFIG_SWAPON +@BUSYBOX_CONFIG_FEATURE_SWAPON_DISCARD +@BUSYBOX_CONFIG_FEATURE_SWAPON_PRI +@BUSYBOX_CONFIG_SWAPOFF TITLE:=ZRAM swap scripts PKGARCH:=all endef diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init index bfb9285600..a42f019d92 100755 --- a/package/system/zram-swap/files/zram.init +++ b/package/system/zram-swap/files/zram.init @@ -35,18 +35,18 @@ zram_applicable() return 1 } - command -v mkswap >/dev/null || { - logger -s -t zram_applicable -p daemon.err "[ERROR] 'mkswap' not installed" + [ -x /sbin/mkswap ] || { + logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox mkswap' not installed" return 1 } - command -v swapon >/dev/null || { - logger -s -t zram_applicable -p daemon.err "[ERROR] 'swapon' not installed" + [ -x /sbin/swapon ] || { + logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox swapon' not installed" return 1 } - command -v swapoff >/dev/null || { - logger -s -t zram_applicable -p daemon.err "[ERROR] 'swapoff' not installed" + [ -x /sbin/swapoff ] || { + logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox swapoff' not installed" return 1 } } @@ -182,8 +182,8 @@ start() zram_comp_algo "$zram_dev" zram_comp_streams "$zram_dev" echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize" - mkswap "$zram_dev" - swapon -d $zram_priority "$zram_dev" + /sbin/mkswap "$zram_dev" + /sbin/swapon -d $zram_priority "$zram_dev" } stop() @@ -192,7 +192,7 @@ stop() for zram_dev in $( grep zram /proc/swaps |awk '{print $1}' ); do { logger -s -t zram_stop -p daemon.debug "deactivate swap $zram_dev" - swapoff "$zram_dev" && zram_reset "$zram_dev" "claiming memory back" + /sbin/swapoff "$zram_dev" && zram_reset "$zram_dev" "claiming memory back" local dev_index="$( echo $zram_dev | grep -o "[0-9]*$" )" if [ $dev_index -ne 0 ]; then logger -s -t zram_stop -p daemon.debug "removing zram $zram_dev"