From 959a0308e5ac3af5a27fc5c401e8e11b5d316c6f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 12 Nov 2021 13:15:35 +0100 Subject: [PATCH 01/35] include/bpf.mk: fix typo in clang version check Signed-off-by: Felix Fietkau --- include/bpf.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/bpf.mk b/include/bpf.mk index 967de7a172..d9f1153cba 100644 --- a/include/bpf.mk +++ b/include/bpf.mk @@ -64,7 +64,7 @@ BPF_CFLAGS := \ -O2 -emit-llvm -Xclang -disable-llvm-passes ifeq ($(DUMP),) - CLANG_VER:=$(shell clang -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3) + CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3) CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 ) ifeq ($(CLANG_VER_VALID),) $(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER)) From 0cbc6b16db8ce03a522b9acb49ea46cc2134697a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 11 Nov 2021 14:24:26 +0000 Subject: [PATCH 02/35] dnsmasq: add ubus acl to allow calls to hotplug.tftp object dnsmasq may call hotplug.dhcp, hotplug.neigh and hotplug.tftp. Only the first two callees were listed in the ACL, so add missing hotplug.tftp. Signed-off-by: Daniel Golle --- package/network/services/dnsmasq/files/dnsmasq_acl.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/network/services/dnsmasq/files/dnsmasq_acl.json b/package/network/services/dnsmasq/files/dnsmasq_acl.json index 47d7c29302..67c6c20483 100644 --- a/package/network/services/dnsmasq/files/dnsmasq_acl.json +++ b/package/network/services/dnsmasq/files/dnsmasq_acl.json @@ -7,6 +7,9 @@ }, "hotplug.neigh": { "methods": [ "call" ] + }, + "hotplug.tftp": { + "methods": [ "call" ] } } } From c3c67fe7b1fbfc9b08e1a2d056b120aa63ef4145 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 12 Nov 2021 11:50:26 +0000 Subject: [PATCH 03/35] mediatek: mt7623: re-write sysupgrade uImage.FIT on MMC Re-reading the partition table doesn't work reliably, it fails if anything on the device is still in use and it's not trivial to prevent every possible case of a block device still being in use somehow. Therefore, instead of relying on the in-kernel partition parser to know where to write the configuration backup, use OpenWrt's format-agnostic fwtool to strip off all metadata from the image and count its blocks while writing. In that way we can know where to write the config backup without needing the kernel to parse the MBR and FIT structures. Signed-off-by: Daniel Golle --- .../mt7623/base-files/lib/upgrade/platform.sh | 27 +++++++++---------- target/linux/mediatek/mt7623/target.mk | 2 +- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh index 29c4bf1e03..0afc15afc9 100755 --- a/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh @@ -1,6 +1,6 @@ REQUIRE_IMAGE_METADATA=1 -RAMFS_COPY_BIN='blockdev' +RAMFS_COPY_BIN='fwtool' # Full system upgrade including preloader for MediaTek SoCs on eMMC or SD mtk_mmc_full_upgrade() { @@ -84,19 +84,14 @@ platform_do_upgrade() { case "$board" in bananapi,bpi-r2) + sync export_bootdevice - export_partdevice rootdev 0 - blockdev --rereadpt /dev/$rootdev || return 1 export_partdevice fitpart 3 [ "$fitpart" ] || return 1 - dd if=/dev/zero of=$fitpart bs=4096 count=1 2>/dev/null - blockdev --rereadpt /dev/$rootdev - get_image "$1" | dd of=$fitpart - blockdev --rereadpt /dev/$rootdev - local datapart=$(find_mmc_part "rootfs_data" $rootdev) - [ "$datapart" ] || return 0 - dd if=/dev/zero of=$datapart bs=4096 count=1 2>/dev/null - echo $datapart > /tmp/sysupgrade.datapart + export UPGRADE_MMC_PARTDEV="/dev/$fitpart" + export UPGRADE_MMC_IMAGE_BLOCKS=$(($(get_image "$1" | fwtool -i /dev/null -T - | dd of=$UPGRADE_MMC_PARTDEV bs=512 2>&1 | grep "records out" | cut -d' ' -f1))) + [ "$UPGRADE_MMC_IMAGE_BLOCKS" ] || return 0 + dd if=/dev/zero of=$UPGRADE_MMC_PARTDEV bs=512 seek=$UPGRADE_MMC_IMAGE_BLOCKS count=8 ;; unielec,u7623-02-emmc-512m) @@ -172,10 +167,12 @@ platform_check_image() { } platform_copy_config_mmc() { - [ -e "$UPGRADE_BACKUP" ] || return - local datapart=$(cat /tmp/sysupgrade.datapart) - [ "$datapart" ] || echo "no rootfs_data partition, cannot keep configuration." >&2 - dd if="$UPGRADE_BACKUP" of=$datapart + if [ ! -e "$UPGRADE_BACKUP" ] || + [ ! -e "$UPGRADE_MMC_PARTDEV" ] || + [ ! "$UPGRADE_MMC_IMAGE_BLOCKS" ]; then + return + fi + dd if="$UPGRADE_BACKUP" of="$UPGRADE_MMC_PARTDEV" bs=512 seek=$UPGRADE_MMC_IMAGE_BLOCKS sync } diff --git a/target/linux/mediatek/mt7623/target.mk b/target/linux/mediatek/mt7623/target.mk index ad05367f86..cc5ff3f27d 100644 --- a/target/linux/mediatek/mt7623/target.mk +++ b/target/linux/mediatek/mt7623/target.mk @@ -9,7 +9,7 @@ CPU_TYPE:=cortex-a7 CPU_SUBTYPE:=neon-vfpv4 KERNELNAME:=Image dtbs zImage FEATURES+=display usbgadget -DEFAULT_PACKAGES+=blockdev uboot-envtools +DEFAULT_PACKAGES+=uboot-envtools define Target/Description Build firmware images for MediaTek mt7623 ARM based boards. From 8fd0268b5f346fba26329c73225c3c425f2658eb Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 12 Nov 2021 14:54:52 +0000 Subject: [PATCH 04/35] mediatek: mt7622: bpi-r64: rewrite MMC uImage.FIT sysupgrade Similar to mt7623, also no longer use 'blockdev' and stop relying on in-kernel partition parsers. Instead, strip off all metadata using 'fwtool' while writing the firmware image and scrape the number of blocks written from 'dd', then use that block offset to stash the configuration backup. Signed-off-by: Daniel Golle --- .../mt7622/base-files/lib/upgrade/platform.sh | 29 +++++++++---------- target/linux/mediatek/mt7622/target.mk | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index 98775c6a13..b9fa055854 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -1,5 +1,5 @@ REQUIRE_IMAGE_METADATA=1 -RAMFS_COPY_BIN='fw_printenv fw_setenv blockdev' +RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' platform_do_upgrade() { @@ -12,17 +12,12 @@ platform_do_upgrade() { export_partdevice rootdev 0 case "$rootdev" in mmc*) - blockdev --rereadpt /dev/$rootdev || return 1 - local fitpart=$(find_mmc_part "production" $rootdev) - [ "$fitpart" ] || return 1 - dd if=/dev/zero of=$fitpart bs=4096 count=1 2>/dev/null - blockdev --rereadpt /dev/$rootdev - get_image "$1" | dd of=$fitpart - blockdev --rereadpt /dev/$rootdev - local datapart=$(find_mmc_part "rootfs_data" $rootdev) - [ "$datapart" ] || return 0 - dd if=/dev/zero of=$datapart bs=4096 count=1 2>/dev/null - echo $datapart > /tmp/sysupgrade.datapart + sync + export UPGRADE_MMC_PARTDEV=$(find_mmc_part "production" $rootdev) + [ "$UPGRADE_MMC_PARTDEV" ] || return 1 + export UPGRADE_MMC_IMAGE_BLOCKS=$(($(get_image "$1" | fwtool -i /dev/null -T - | dd of=$UPGRADE_MMC_PARTDEV bs=512 2>&1 | grep "records out" | cut -d' ' -f1))) + [ "$UPGRADE_MMC_IMAGE_BLOCKS" ] || return 0 + dd if=/dev/zero of=$UPGRADE_MMC_PARTDEV bs=512 seek=$UPGRADE_MMC_IMAGE_BLOCKS count=8 ;; *) CI_KERNPART="fit" @@ -92,10 +87,12 @@ platform_check_image() { } platform_copy_config_mmc() { - [ -e "$UPGRADE_BACKUP" ] || return - local datapart=$(cat /tmp/sysupgrade.datapart) - [ "$datapart" ] || echo "no rootfs_data partition, cannot keep configuration." >&2 - dd if="$UPGRADE_BACKUP" of=$datapart + if [ ! -e "$UPGRADE_BACKUP" ] || + [ ! -e "$UPGRADE_MMC_PARTDEV" ] || + [ ! "$UPGRADE_MMC_IMAGE_BLOCKS" ]; then + return + fi + dd if="$UPGRADE_BACKUP" of="$UPGRADE_MMC_PARTDEV" bs=512 seek=$UPGRADE_MMC_IMAGE_BLOCKS sync } diff --git a/target/linux/mediatek/mt7622/target.mk b/target/linux/mediatek/mt7622/target.mk index 5403bf5f87..92c3f47370 100644 --- a/target/linux/mediatek/mt7622/target.mk +++ b/target/linux/mediatek/mt7622/target.mk @@ -2,7 +2,7 @@ ARCH:=aarch64 SUBTARGET:=mt7622 BOARDNAME:=MT7622 CPU_TYPE:=cortex-a53 -DEFAULT_PACKAGES += kmod-mt7615e kmod-mt7615-firmware wpad-basic-wolfssl blockdev uboot-envtools +DEFAULT_PACKAGES += kmod-mt7615e kmod-mt7615-firmware wpad-basic-wolfssl uboot-envtools KERNELNAME:=Image dtbs define Target/Description From c8340120e703abe6343cf347d1274587d288e0aa Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Fri, 12 Nov 2021 16:50:33 +0000 Subject: [PATCH 05/35] dnsmasq: fix the dynamic dns object names patch We can't use booleans, since we're not including stdbool.h. Use integers instead. Fixes: 0b79e7c01e ("dnsmasq: generate the dns object name dynamically") Signed-off-by: Rui Salvaterra --- .../services/dnsmasq/patches/200-ubus_dns.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch b/package/network/services/dnsmasq/patches/200-ubus_dns.patch index 03fc5b50b3..b8c4e44952 100644 --- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch +++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch @@ -60,17 +60,17 @@ + *dest = blobmsg_get_string(val); +} + -+static bool ubus_dns_doctor(const char *name, int ttl, void *p, int af) ++static int ubus_dns_doctor(const char *name, int ttl, void *p, int af) +{ + struct blob_buf *b; + char *addr; + + if (!name) -+ return false; ++ return 0; + + b = ubus_dns_notify_prepare(); + if (!b) -+ return false; ++ return 0; + + blobmsg_add_string(b, "name", name); + @@ -80,7 +80,7 @@ + + addr = blobmsg_alloc_string_buffer(b, "address", INET6_ADDRSTRLEN); + if (!addr) -+ return false; ++ return 0; + + inet_ntop(af, p, addr, INET6_ADDRSTRLEN); + blobmsg_add_string_buffer(b); @@ -89,14 +89,14 @@ + ubus_dns_notify("dns_result", ubus_dns_doctor_cb, &addr); + + if (!addr) -+ return false; ++ return 0; + + return inet_pton(af, addr, p) == 1; +} +#else -+static bool ubus_dns_doctor(const char *name, int ttl, void *p, int af) ++static int ubus_dns_doctor(const char *name, int ttl, void *p, int af) +{ -+ return false; ++ return 0; +} +#endif + From 50d33fcf7dde872627a3a98ff1b9cfc6e5df30f9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 12 Nov 2021 23:06:26 +0100 Subject: [PATCH 06/35] qosify: update to the latest version 0750f2b4d329 README: dnsmasq integration is complete 8e48d0b0cbba bpf: add initial support for splitting map dscp value into ingress and egress bfc2cafe2a8c map: add support for defining aliases Signed-off-by: Felix Fietkau --- package/network/config/qosify/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/qosify/Makefile b/package/network/config/qosify/Makefile index 7a6ee17688..6e2fdf8fdf 100644 --- a/package/network/config/qosify/Makefile +++ b/package/network/config/qosify/Makefile @@ -11,9 +11,9 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=qosify PKG_SOURCE_URL=$(PROJECT_GIT)/project/qosify.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-11-08.1 -PKG_SOURCE_VERSION:=3a420e272c187885120b964059abdf3e06f10199 -PKG_MIRROR_HASH:=49a6bbb0801b790ce603aa8e3dfa73e681dc3f58fb9cbd524956bffe4c36eb7e +PKG_SOURCE_DATE:=2021-11-12 +PKG_SOURCE_VERSION:=bfc2cafe2a8c66ffab88a7e5c1ad1b0a4d886271 +PKG_MIRROR_HASH:=88990d5816f37ba1e334499e7ee53a364fa0ba1e5751a91ef0a94934cd2a5451 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From bdaacdc2fcd1761ffd784e4280f6135c20be856d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 12 Nov 2021 23:11:37 +0100 Subject: [PATCH 07/35] qosify: add default alias sections Signed-off-by: Felix Fietkau --- package/network/config/qosify/files/qosify.conf | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/package/network/config/qosify/files/qosify.conf b/package/network/config/qosify/files/qosify.conf index dba1d1a46d..ade4c396f6 100644 --- a/package/network/config/qosify/files/qosify.conf +++ b/package/network/config/qosify/files/qosify.conf @@ -2,12 +2,24 @@ config defaults list defaults /etc/qosify/*.conf option dscp_prio CS5 option dscp_icmp CS6 - option dscp_bulk CS0 + option dscp_bulk bulk option dscp_default_udp CS4 option bulk_trigger_timeout 5 option bulk_trigger_pps 100 option prio_max_avg_pkt_len 500 +config alias bulk + option ingress LE + option egress LE + +config alias video + option ingress AF41 + option egress AF41 + +config alias voice + option ingress CS6 + option egress CS6 + config interface wan option name wan option disabled 1 From fa7356dd9d6d88c9aff9dce496dc9eaa0a8d9bda Mon Sep 17 00:00:00 2001 From: Russell Senior Date: Sun, 7 Nov 2021 15:32:18 -0800 Subject: [PATCH 08/35] iproute2: update to 5.15 from https://git.kernel.org/pub/scm/network/iproute2/iproute2.git changes since 5.14.0: ad3a118f rdma: Fix SRQ resource tracking information json 7a235a10 man: devlink-port: fix pfnum for devlink port add 229eaba5 uapi: pickup fix for xfrm ABI breakage a500c5ac lib/bpf: fix map-in-map creation without prepopulation 7c032cac man: devlink-port: remove extra .br 04ee8e6f man: devlink-port: fix style 14802d84 man: devlink-port: fix the devlink port add synopsis 897772a7 cmd: use spaces instead of tabs for usage indentation e7a98a96 mptcp: unbreak JSON endpoint list 2f5825cb lib: bpf_legacy: fix bpffs mount when /sys/fs/bpf exists d756c08a tc/f_flower: fix port range parsing 92e32f77 uapi: updates from 5.15-rc1 e7e0e2ce iptuntap: fix multi-queue flag display deef844b man: ip-link: remove double of a3272b93 configure: restore backward compatibility ceba5930 tree-wide: fix some typos found by Lintian 7a705242 ip: remove leftovers from IPX and DECnet 8ab1834e uapi: update headers from 5.15 merge 6d0d35ba ip/bond: add lacp active support 926ad641 Update kernel headers c730bd0b ip/tunnel: always print all known attributes df8912ed ipioam6: use print_nl instead of print_null 7e7270bb tc/skbmod: Introduce SKBMOD_F_ECN option 86c596ed IOAM man8 2d83c710 New IOAM6 encap type for routes f0b3808a Add, show, link, remove IOAM namespaces and schemas acbdef93 Import ioam6 uapi headers 2d6fa30b Update kernel headers 508ad89c ipneigh: add support to print brief output of neigh cache in tabular format * update patch 170-ip_tiny.patch to accomodate ioam. Signed-off-by: Russell Senior --- package/network/utils/iproute2/Makefile | 4 ++-- package/network/utils/iproute2/patches/170-ip_tiny.patch | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index ca3cb4753a..928f44e797 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 -PKG_VERSION:=5.14.0 +PKG_VERSION:=5.15.0 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=210fa785a52f3763c4287fd5ae63e246f6311bfaa48c424baab6d383bb7591d4 +PKG_HASH:=38e3e4a5f9a7f5575c015027a10df097c149111eeb739993128e5b2b35b291ff PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iproute2/patches/170-ip_tiny.patch b/package/network/utils/iproute2/patches/170-ip_tiny.patch index 2c1ec1dcb3..cd687e7601 100644 --- a/package/network/utils/iproute2/patches/170-ip_tiny.patch +++ b/package/network/utils/iproute2/patches/170-ip_tiny.patch @@ -30,7 +30,7 @@ "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n" " ip [ -force ] -batch filename\n" +#ifndef IPROUTE2_TINY - "where OBJECT := { address | addrlabel | fou | help | ila | l2tp | link |\n" + "where OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp | link |\n" " macsec | maddress | monitor | mptcp | mroute | mrule |\n" " neighbor | neighbour | netconf | netns | nexthop | ntable |\n" " ntbl | route | rule | sr | tap | tcpmetrics |\n" @@ -43,7 +43,7 @@ " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n" " -f[amily] { inet | inet6 | mpls | bridge | link } |\n" -@@ -91,36 +97,50 @@ static const struct cmd { +@@ -91,37 +97,51 @@ static const struct cmd { int (*func)(int argc, char **argv); } cmds[] = { { "address", do_ipaddr }, @@ -90,6 +90,7 @@ +#ifndef IPROUTE2_TINY { "nexthop", do_ipnh }, { "mptcp", do_mptcp }, + { "ioam", do_ioam6 }, +#endif { "help", do_help }, { 0 } From c90e10b62eaccb71d289c3f7a7c67dcbae0b74f8 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 13 Nov 2021 18:24:52 +0100 Subject: [PATCH 09/35] mac80211: Fix deadlock when configuring wifi The nl80211_set_wiphy() function was changed between kernel 5.11 and 5.12 to take the rdev->wiphy lock which should be freed at the end again. The 500-mac80211_configure_antenna_gain.patch added some code which just returned in some cases without unlocking. This resulted in a deadlock with brcmfmac. This patch fixes this by also jumping to the out label in case we want to leave the function. This fixes a hanging system when brcmfmac is in use. I do not know why we do not see this with other driver. The kernel returns very useful debug details when setting these OpenWrt configuration options: CONFIG_KERNEL_DETECT_HUNG_TASK=y CONFIG_KERNEL_PROVE_LOCKING=y Fixes: FS#4122 Fixes: b96c2569ac76 ("mac80211: Update to version 5.12.19-1") Signed-off-by: Hauke Mehrtens --- .../500-mac80211_configure_antenna_gain.patch | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 3f2cc18253..821032fa89 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -137,24 +137,26 @@ }; /* policy for the key attributes */ -@@ -3325,6 +3326,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3324,6 +3325,22 @@ static int nl80211_set_wiphy(struct sk_b + if (result) goto out; } - ++ + if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) { + int idx, dbi = 0; + -+ if (!rdev->ops->set_antenna_gain) -+ return -EOPNOTSUPP; ++ if (!rdev->ops->set_antenna_gain) { ++ result = -EOPNOTSUPP; ++ goto out; ++ } + + idx = NL80211_ATTR_WIPHY_ANTENNA_GAIN; + dbi = nla_get_u32(info->attrs[idx]); + + result = rdev->ops->set_antenna_gain(&rdev->wiphy, dbi); + if (result) -+ return result; ++ goto out; + } -+ + if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) { struct wireless_dev *txp_wdev = wdev; - enum nl80211_tx_power_setting type; From f81dc44fd5360ce58a205ac7ce42aa4611b41483 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Fri, 12 Nov 2021 15:31:37 +0000 Subject: [PATCH 10/35] kernel: bump 5.10 to 5.10.79 Manually rebased: generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch Tested-by: John Audia Tested-by: Daniel Golle Signed-off-by: Rui Salvaterra --- include/kernel-version.mk | 4 ++-- ...-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch | 2 +- ...ehci-add-spurious-flag-to-disable-overcurrent-ch.patch | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 8cf7c9f289..466931583c 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -7,10 +7,10 @@ ifdef CONFIG_TESTING_KERNEL endif LINUX_VERSION-5.4 = .158 -LINUX_VERSION-5.10 = .78 +LINUX_VERSION-5.10 = .79 LINUX_KERNEL_HASH-5.4.158 = 6e018fecdc8fc24553756e582d83b82d65b10a6b03ef36262a24911f839b8d59 -LINUX_KERNEL_HASH-5.10.78 = be806c98e222ea581530727a8e83b0b96fcd678afd12944eb530e58776a6050f +LINUX_KERNEL_HASH-5.10.79 = e49955e16a2ee26d0b3ca1521912daba5ab8f7a6b2c9e5f538bb0ae7b837a8ad remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/target/linux/bcm63xx/patches-5.10/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch b/target/linux/bcm63xx/patches-5.10/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch index 34fac9538c..167fbdf29e 100644 --- a/target/linux/bcm63xx/patches-5.10/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch +++ b/target/linux/bcm63xx/patches-5.10/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch @@ -21,7 +21,7 @@ Signed-off-by: Jonas Gorski --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c -@@ -678,6 +678,10 @@ int ehci_setup(struct usb_hcd *hcd) +@@ -687,6 +687,10 @@ int ehci_setup(struct usb_hcd *hcd) /* cache this readonly data; minimize chip reads */ ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); diff --git a/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch b/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch index 8f2021a0fc..6b75b08717 100644 --- a/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch +++ b/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch @@ -26,7 +26,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c -@@ -651,7 +651,7 @@ static int ehci_run (struct usb_hcd *hcd +@@ -660,7 +660,7 @@ static int ehci_run (struct usb_hcd *hcd "USB %x.%x started, EHCI %x.%02x%s\n", ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), temp >> 8, temp & 0xff, @@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman /* --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c -@@ -327,6 +327,8 @@ static int ehci_platform_probe(struct pl +@@ -333,6 +333,8 @@ static int ehci_platform_probe(struct pl hcd->has_tt = 1; if (pdata->reset_on_resume) priv->reset_on_resume = true; @@ -68,10 +68,10 @@ Signed-off-by: Greg Kroah-Hartman if (ehci->big_endian_mmio) { --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h -@@ -218,6 +218,7 @@ struct ehci_hcd { /* one per controlle - unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ +@@ -219,6 +219,7 @@ struct ehci_hcd { /* one per controlle unsigned need_oc_pp_cycle:1; /* MPC834X port power */ unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ + unsigned is_aspeed:1; + unsigned spurious_oc:1; /* required for usb32 quirk */ From 4d3303b1bddf3c66fc0a05fb5eb45ceac48cd0d5 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 13 Nov 2021 16:29:52 +0000 Subject: [PATCH 11/35] base-files: stage2: improve /proc/*/stat parser Simply reading /proc/*/stat as a space-separated string will not work as the process name may itself contain spaces. Hence we must match on the '(' and ')' characters around the process name and can then handle the remaining string as space-separated values. This fixes shell error messages which have been popping up the console due to spaces in process names being interpreted as field separators. Signed-off-by: Daniel Golle --- package/base-files/files/lib/upgrade/stage2 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index 45fb98d889..74edd61104 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -97,12 +97,15 @@ kill_remaining() { # [ [ ] ] [ -f "$stat" ] || continue local pid name state ppid rest - read pid name state ppid rest < $stat - name="${name#(}"; name="${name%)}" + read pid rest < $stat + name="${rest#\(}" ; rest="${name##*\) }" ; name="${name%\)*}" + set -- $rest ; state="$1" ; ppid="$2" # Skip PID1, our parent, ourself and our children [ $pid -ne 1 -a $pid -ne $proc_ppid -a $pid -ne $$ -a $ppid -ne $$ ] || continue + [ -f "/proc/$pid/cmdline" ] || continue + local cmdline read cmdline < /proc/$pid/cmdline From 7bc18aa2846d5fc4c35bbdf5b3aae486eb485850 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 25 Oct 2021 13:27:26 -1000 Subject: [PATCH 12/35] firewall4: update to latest Git HEAD eb0a3ee fw4.uc: Do not quote port ranges c5a8e3e tests: adapt test to new ICMP print logic Also start using $(AUTORELEASE) Signed-off-by: Paul Spooren --- package/network/config/firewall4/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index ccf5740466..a4f63a91ee 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=firewall4 -PKG_RELEASE:=1 +PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2021-09-01 -PKG_SOURCE_VERSION:=cf835cecc8a449b2d2019f1ef4f085e535d5c1c1 -PKG_MIRROR_HASH:=5798b76846107dde69a2a1ff3467f735b9a91a74106fbd6299d8a26eff70b9c2 +PKG_SOURCE_DATE:=2021-10-25 +PKG_SOURCE_VERSION:=eb0a3ee812d48f1faecbf6258c293e475b4016a0 +PKG_MIRROR_HASH:=46b5bdea13a285dbd1b3432fe8cfd8cb98a2797b86b176d7762e0987ec2f230c PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From b5ab6d0bc577e81a77f39211883f6c0c4155b6ed Mon Sep 17 00:00:00 2001 From: Arne Zachlod Date: Wed, 10 Nov 2021 14:47:55 +0100 Subject: [PATCH 13/35] scripts/env: fix env for git conf init.defaultBranch not set to "master" Since version 2.28, git has a config option init.defaultBranch to set the name of the first branch created with git init. The env script expects this name to be "master". This commit sets the initial branch name to "master" instead of using the git configured one. Signed-off-by: Arne Zachlod --- scripts/env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/env b/scripts/env index df8b486bfe..5987b4160f 100755 --- a/scripts/env +++ b/scripts/env @@ -61,7 +61,7 @@ env_init() { mkdir -p "$ENVDIR" || error "Failed to create the environment directory" cd "$ENVDIR" || error "Failed to switch to the environment directory" [ -d .git ] || { - git init && + git init -b master && touch .config && mkdir files && git add . && From 12d33d388c52565803a746586426bed3d3fcc941 Mon Sep 17 00:00:00 2001 From: Richard Yu Date: Fri, 12 Nov 2021 11:16:21 +0800 Subject: [PATCH 14/35] ipq40xx: add support for P&W R619AC (aka G-DOCK 2.0) P&W R619AC is a IPQ4019 Dual-Band AC1200 router. It is made by P&W (p2w-tech.com) known as P&W R619AC but marketed and sold more popularly as G-DOCK 2.0. Specification: * SOC: Qualcomm Atheros IPQ4019 (717 MHz) * RAM: 512 MiB * Flash: 16 MiB (NOR) + 128 MiB (NAND) * Ethernet: 5 x 10/100/1000 (4 x LAN, 1 x WAN) * Wireless: - 2.4 GHz b/g/n Qualcomm Atheros IPQ4019 - 5 GHz a/n/ac Qualcomm Atheros IPQ4019 * USB: 1 x USB 3.0 * LED: 4 x LAN, 1 x WAN, 2 x WiFi, 1 x Power (All Blue LED) * Input: 1 x reset * 1 x MicroSD card slot * Serial console: 115200bps, pinheader J2 on PCB * Power: DC 12V 2A * 1 x Unpopulated mPCIe Slot (see below how to connect it) * 1 x Unpopulated Sim Card Slot Installation: 1. Access to tty console via UART serial 2. Enter failsafe mode and mount rootfs 3. Edit inittab to enable shell on tty console `sed -i 's/#ttyM/ttyM/' /etc/inittab` 4. Reboot and upload `-nand-factory.bin` to the router (using wget) 5. Use `sysupgrade` command to install Another installation method is to hijack the upgrade server domain of stock firmware, because it's using insecure http. This commit is based on @LGA1150(at GitHub)'s work With some changes: 1. Added `qpic_bam` node in dts. I don't know much about this, but I observed other dtses have this node. 2. Removed `ldo` node under `sd_0_pinmux`, because `ldo` cause SD card not working. This fix is from 3. Removed the 32MB NOR variant. 4. Removed `cd-gpios` in `sdhci` node, because it's reported that it makes wlan2g led light up. 5. Added ethphy led config in dts. 6. Changed nand partition label from `rootfs` to `ubi`. About the 128MiB variant: The stock bootloader sets size of nand to 64MiB. But most of this devices have 128MiB nand. If you want to use all 128MiB, you need to modify the `MIBIB` data of bootloader. More details can be found on github: For instructions on how to flash the MIBIB partition from u-boot console: About the Mini PCIe slot: (from "ygleg") "The REFCLK signals on the Mini PCIe slot is not connected on this board out of the box. If you want to use the Mini PCIe slot on the board, you need to (preferably) solder two 0402 resistors: R436 (REFCLK+) and R444 (REFCLK-)..." This and much more information is provoided in the github comment: Signed-off-by: Richard Yu Signed-off-by: DENG Qingfang [Added comment about MIBIB+128 MiB variant. Added commit message section about pcie slot. Renamed gpio-leds' subnodes and added color, function+enum properties.] Signed-off-by: Christian Lamparter --- package/firmware/ipq-wifi/Makefile | 2 + .../ipq-wifi/board-p2w_r619ac.qca4019 | Bin 0 -> 24308 bytes .../ipq40xx/base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 + .../base-files/lib/upgrade/platform.sh | 2 + .../arm/boot/dts/qcom-ipq4019-r619ac-128m.dts | 18 + .../arm/boot/dts/qcom-ipq4019-r619ac-64m.dts | 12 + .../arm/boot/dts/qcom-ipq4019-r619ac.dtsi | 348 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 26 ++ .../901-arm-boot-add-dts-files.patch | 4 +- 10 files changed, 417 insertions(+), 1 deletion(-) create mode 100644 package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-64m.dts create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index e3b25bb556..da0949b887 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -47,6 +47,7 @@ ALLWIFIBOARDS:= \ mikrotik_sxtsq-5-ac \ mobipromo_cm520-79f \ nec_wg2600hp3 \ + p2w_r619ac \ plasmacloud_pa1200 \ plasmacloud_pa2200 \ qxwlan_e2600ac @@ -132,6 +133,7 @@ $(eval $(call generate-ipq-wifi-package,mikrotik_hap-ac2,Mikrotik hAP ac2)) $(eval $(call generate-ipq-wifi-package,mikrotik_sxtsq-5-ac,MikroTik SXTsq 5 ac)) $(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F)) $(eval $(call generate-ipq-wifi-package,nec_wg2600hp3,NEC Platforms WG2600HP3)) +$(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC)) $(eval $(call generate-ipq-wifi-package,plasmacloud_pa1200,Plasma Cloud PA1200)) $(eval $(call generate-ipq-wifi-package,plasmacloud_pa2200,Plasma Cloud PA2200)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC)) diff --git a/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 b/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 new file mode 100644 index 0000000000000000000000000000000000000000..0ebe28575f16e782b2a3a30c4da82c3e1485118e GIT binary patch literal 24308 zcmeHPTTl~O8a}~rQBmn6AOvV2+!7W71QsGh2_Z58A~39SiLQ%?N&*ZKl#6jn%0Wep z$cQprj39-ITzXxlSe;RsT^-li(v-XVFmJx>+dN2>wYBBTI(tqx4FQ4@gfT$>;qUXG z)8{|`f4**#?ml1gc}j9b@=jHBR7Qj%D>+9A%FD|El#)oa1wab5=xEi}eI-TVMdjLv z{Uus`gtmBV6j>{(*jHJMs?l-b)%z;7`@T4`H9I8FKPN7FOL7Ve`uf9h{3HJrz+!=gk`+<2ix1|Gtn!>l&Ul zuMfBR1J=`-y;`V9;1?(}_sw13G`Y(S&IY|`K{?X)RGDNo<53$TQe&+ni^tDhL8Alp znuM@}{utaLBxVmoKXsgf6{(_kepQx^H9zv(hgiKH3 zRsV2PlTMqaNqRNh)mT@o$w=GsXrSv%Q>FIvw75ru(5lkrr2Y0SlsluMQ1E(S_*7G= zc85m(YOw2cU5Q4WCVO-Xbtj}zDwLa-7{W4t_ zmFJN(bhWB6zBqUnKjY!R;f~ZZ!b;D=j=|j>Th91barfQ7qCK8b8o0wle!sWkbYh99 zz+3(FR^2yQXT(*$`@bEm>DX~DqQ>XoldJmUsRsmU+=Rz{6%FYXA-g=3H*aX$RZYLC z@h-VPT-_ac!cWgFTwW+K+0qC&I>qo!iPnGCBc1mckX(hZM0)WMG zaByIu?V2@?j*dYB?^)RJa6}h$YV@SOT6P zPEbeTQJ55;Ov2P_-JHxxCY#KPF=rj0`9Q+Oxv#mHH|{O=R;S=8uT!uLJVTtJj=^JI z$6$$gqBv1a9R$lQ8H$2_$+zg-)t@yDS!(b{%G4)|b<5iS%R<{$!Zj%~hxr_R1|l6WkM<3bC_ zDZ1Eu=dtCMzV)}QoE>8=EsGXo6(2%o>MI3-`K}Pmx8E|uMZKrQIPwAjSk@YQMqbP; z$!FeSlTW|x(1MT9;nVaG_;lVLEpo*G!53nmmc5^@mz*&mj|ITU!B`$pS|-X%6Q$4v z12Q0E%K--d{#aBGKr{%%Add1VP;Hd01bE&{*YcI7#+i{T0cTwQixyL@Cn>ru9x%Q0wI9C}O z5*+j?m0G!@*6OI$Id%5V{5^%mCB~LZ?N@sG`iE|h++79BJ9xET+Wpf&=tVHLtW}KP3_h56|)f>d< z*x%-|R~9N$v*EqtVLrHz*hkF+%6CdkjjP3KwGza>i^XKPOe|B!F53O|R8(6m4~Ykc zb5bR#SSBY<5{GT$Xgbkr_89c%99=G#TO3>Y_VMrK+e>b+SdeUA+d{Ix-6#0=?#>h{ z@KTcG+XKL6(>Pg{fxny0w}-rgBw82Bw}&ylw~T}AkKx-R-n)`Tz36dKj>yL82C}ry zdtWHu9u4U~@tPI}R;CmCt;e;6Zx8ry@o1>5U z>o#RRy;XKmULRcUwf9-4Hak8vWHSJdx{sBqQp6FyzW4eMx5-b6Dml9z4`^GH>I2I> z_de;aDpbS;`*^xOxL$ThrNRYnTw_<}spuo_c^kIhzg2WG;e>yw`|gLPvOU?#@F0vm z(pz1*T_q5@^P4)dPRCYz7PzYJ4*ub?^rT<8``(fEBm2{~g$Ht-229meX=;ho-Fu|F zvN`2=c)3T;vp=Sv3$OD!=$3c8?U*i0DH3p;`Z_AU$le(d>n*t1p>5oDH0%&J<3@i) zXJSKOC2#M|3;H5uVxW%?uk-8T1KZQXCGPz5&3RwO>IAzv@;d`nS2E8FYdjCE+7pMF zID^0nK;UD4eZ$#Otl-hps8>mAH8P1XI5-IY!C&6+4-5zp1mrr}&986F=EBo-dzVF9 ztDhZ%rrWPwv=~<4XPOuU7KXrl$sUW{Z(-T47_SfW?I{*J`n4H*v?f^WkkD?Y7Wr*} zP{g;lOUvF*@ zMWv%Z$+t%wdq>efN!~rhy?<%%^Iy&RAwE1C^5OH_`+rypKKxQ+I~UKMZvT{AdlZ}D s+fOacEx=;<_6q=waj|a%=Cfuz7suYR-M(kJ@a!1A{ZfBwzJL7x157Z%sQ>@~ literal 0 HcmV?d00001 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 50b460e441..5d123109a2 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -50,6 +50,8 @@ ipq40xx_setup_interfaces() ;; asus,rt-ac58u|\ mikrotik,hap-ac2|\ + p2w,r619ac-64m|\ + p2w,r619ac-128m|\ zyxel,nbg6617) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 505182bb65..35862ce3bc 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -67,6 +67,8 @@ case "$FIRMWARE" in glinet,gl-s1300 |\ linksys,ea6350v3 |\ mobipromo,cm520-79f |\ + p2w,r619ac-64m |\ + p2w,r619ac-128m |\ qcom,ap-dk01.1-c1) caldata_extract "ART" 0x1000 0x2f20 ;; @@ -187,6 +189,8 @@ case "$FIRMWARE" in glinet,gl-s1300 |\ linksys,ea6350v3 |\ mobipromo,cm520-79f |\ + p2w,r619ac-64m |\ + p2w,r619ac-128m |\ qcom,ap-dk01.1-c1) caldata_extract "ART" 0x5000 0x2f20 ;; diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index e391976606..605b1e7881 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -73,6 +73,8 @@ platform_do_upgrade() { luma,wrtq-329acn |\ mobipromo,cm520-79f |\ netgear,wac510 |\ + p2w,r619ac-64m |\ + p2w,r619ac-128m |\ qxwlan,e2600ac-c2) nand_do_upgrade "$1" ;; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts new file mode 100644 index 0000000000..0896374ab2 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019-r619ac.dtsi" + +/ { + model = "P&W R619AC 128M"; + compatible = "p2w,r619ac-128m"; +}; + +&nand_rootfs { + /* + * Watch out: stock MIBIB is set up for a 64MiB chip. + * If a 128MiB flash chip is used, make sure to have + * the right values in MIBIB or the device might not + * boot. + */ + reg = <0x0 0x8000000>; +}; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-64m.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-64m.dts new file mode 100644 index 0000000000..6c8821a90e --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-64m.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019-r619ac.dtsi" + +/ { + model = "P&W R619AC 64M"; + compatible = "p2w,r619ac-64m"; +}; + +&nand_rootfs { + reg = <0x0 0x4000000>; +}; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi new file mode 100644 index 0000000000..ff0486cf09 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi @@ -0,0 +1,348 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + chosen { + bootargs-append = " ubi.mtd=ubi root=/dev/ubiblock0_1"; + }; + + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_sys; + led-upgrade = &led_sys; + label-mac-device = &gmac0; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + mdio@90000 { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb2@60f8800 { + status = "okay"; + }; + + usb3@8af8800 { + status = "okay"; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_sys: led-0 { + label = "blue:sys"; + gpios = <&tlmm 39 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_POWER; + }; + + led-1 { + label = "blue:wlan2g"; + gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <0>; + }; + + led-2 { + label = "blue:wlan5g"; + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <1>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + flash@0 { + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "APPSBL"; + reg = <0xf0000 0x80000>; + read-only; + }; + + partition@170000 { + label = "ART"; + reg = <0x170000 0x10000>; + read-only; + }; + }; + }; +}; + +&nand { + status = "okay"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + nand_rootfs: partition@0 { + label = "ubi"; + /* reg defined in 64M/128M variant dts. */ + }; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&pcie0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + perst-gpio = <&tlmm 4 GPIO_ACTIVE_LOW>; + wake-gpio = <&tlmm 40 GPIO_ACTIVE_HIGH>; + + /* Free slot for use */ + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&sdhci { + pinctrl-0 = <&sd_0_pins>; + pinctrl-names = "default"; + vqmmc-supply = <&vqmmc>; + status = "okay"; +}; + +&tlmm { + pcie_pins: pcie_pinmux { + mux { + pins = "gpio2"; + function = "gpio"; + output-low; + bias-pull-down; + }; + }; + + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + sd_0_pins: sd_0_pinmux { + mux_1 { + pins = "gpio23", "gpio24", "gpio25", "gpio26", "gpio28"; + function = "sdio"; + drive-strength = <10>; + }; + + mux_2 { + pins = "gpio27"; + function = "sdio"; + drive-strength = <16>; + }; + }; + + serial_0_pins: serial0-pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; +}; + +ðphy0 { + qcom,single-led-1000; + qcom,single-led-100; + qcom,single-led-10; +}; + +ðphy1 { + qcom,single-led-1000; + qcom,single-led-100; + qcom,single-led-10; +}; + +ðphy2 { + qcom,single-led-1000; + qcom,single-led-100; + qcom,single-led-10; +}; + +ðphy3 { + qcom,single-led-1000; + qcom,single-led-100; + qcom,single-led-10; +}; + +ðphy4 { + qcom,single-led-1000; + qcom,single-led-100; + qcom,single-led-10; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&vqmmc { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "P&W R619AC"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "P&W R619AC"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index e2ccafd162..6956679e37 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -753,6 +753,32 @@ define Device/openmesh_a62 endef TARGET_DEVICES += openmesh_a62 +define Device/p2w_r619ac + $(call Device/FitzImage) + $(call Device/UbiFit) + DEVICE_VENDOR := P&W + DEVICE_MODEL := R619AC + SOC := qcom-ipq4019 + DEVICE_DTS_CONFIG := config@10 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ipq-wifi-p2w_r619ac +endef + +define Device/p2w_r619ac-64m + $(call Device/p2w_r619ac) + DEVICE_VARIANT := 64M NAND + IMAGES += nand-factory.bin + IMAGE/nand-factory.bin := append-ubi | qsdk-ipq-factory-nand +endef +TARGET_DEVICES += p2w_r619ac-64m + +define Device/p2w_r619ac-128m + $(call Device/p2w_r619ac) + DEVICE_VARIANT := 128M NAND +endef +TARGET_DEVICES += p2w_r619ac-128m + define Device/plasmacloud_pa1200 $(call Device/FitImageLzma) DEVICE_VENDOR := Plasma Cloud diff --git a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch index 471fcd6498..436f5a74f5 100644 --- a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -902,11 +902,65 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -902,11 +902,67 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -58,6 +58,8 @@ Signed-off-by: John Crispin + qcom-ipq4019-map-ac2200.dtb \ + qcom-ipq4019-mr8300.dtb \ + qcom-ipq4019-pa2200.dtb \ ++ qcom-ipq4019-r619ac-64m.dtb \ ++ qcom-ipq4019-r619ac-128m.dtb \ + qcom-ipq4019-rbr50.dtb \ + qcom-ipq4019-rbs50.dtb \ + qcom-ipq4019-rtl30vw.dtb \ From cb18b622067f9b7f25bd1f31e53ccbb8904b1638 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 6 Nov 2021 00:42:43 +0100 Subject: [PATCH 15/35] ipq40xx: reenable Zyxel NBG6617 by default The Zyxel NBG6617 already uses lzma to compress the kernel. A local build with every module enabled (either as =Y or =M) ended produced a 3058 KiB kernel (the kernel partition is 4MiB). It booted just fine, let's reenable the device. Signed-off-by: Christian Lamparter --- target/linux/ipq40xx/image/generic.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 6956679e37..c24eb28523 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -906,7 +906,6 @@ define Device/zyxel_nbg6617 IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k | check-size $$$$(ROOTFS_SIZE) | zyxel-ras-image separate-kernel IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | check-size $$$$(ROOTFS_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata DEVICE_PACKAGES := kmod-usb-ledtrig-usbport - DEFAULT := n endef TARGET_DEVICES += zyxel_nbg6617 From e7d0dce2b3cf49184e0d9d61c184f1073e61791a Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 14 Nov 2021 19:14:55 +0100 Subject: [PATCH 16/35] ipq40xx: fix missing include This patch fixes a blunder of mine. The include needed for LED_COLOR_ID_BLUE property is missing. This caused the builds to fail with: |Error: arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi:91.13-14 syntax error |FATAL ERROR: Unable to parse input tree Fixes: 12d33d388c52 ("ipq40xx: add support for P&W R619AC (aka G-DOCK 2.0)") Signed-off-by: Christian Lamparter --- .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi index ff0486cf09..41294e1931 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi @@ -4,6 +4,7 @@ #include #include #include +#include / { chosen { From 9bd9e04b6fe7e427a5d90ccbb186c2727767a756 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 14 Nov 2021 19:35:52 +0100 Subject: [PATCH 17/35] qosify: add missing alias support in the init script Signed-off-by: Felix Fietkau --- .../network/config/qosify/files/qosify.init | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/package/network/config/qosify/files/qosify.init b/package/network/config/qosify/files/qosify.init index 5928630dc0..040266cc32 100644 --- a/package/network/config/qosify/files/qosify.init +++ b/package/network/config/qosify/files/qosify.init @@ -71,6 +71,20 @@ add_interface() { json_close_object } +add_alias() { + local cfg="$1" + + config_get value "$cfg" value + config_get ingress "$cfg" ingress + config_get egress "$cfg" egress + + json_add_array "$cfg" + json_add_string ingress "${ingress:-$value}" + json_add_string egress "${egress:-$value}" + json_close_array +} + + reload_service() { json_init @@ -82,6 +96,10 @@ reload_service() { config_foreach add_interface interface json_close_object + json_add_object aliases + config_foreach add_alias alias + json_close_object + json_add_object devices config_foreach add_interface device json_close_object From 565b62cca2fc7d27f1f1584c44830a6e5c4f0f61 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Fri, 5 Nov 2021 10:41:26 +0100 Subject: [PATCH 18/35] uboot-lantiq: danube: fix hanging lzma kernel uncompression At least since gcc 7.3.0 (OpenWrt 18.06) lwr/lwl are used in the assembly of LzmaProps_Decode. While the decission made by the compiler looks perfect fine, it triggers some obscure hang on lantiq danube-s v1.5 with MX29LV640EB NOR flash chips. Only if the offset 1 is used, the hang can be observed. Using any other offset works fine: lwl s0,0(a1) - s0 == 0x6d000080 lwl s0,1(a1) - hangs lwl s0,2(a1) - s0 == 0x0080xxxx lwl s0,3(a1) - s0 == 0x80xxxxxx It isn't clear whether it is a limitation of the flash chip, the EBU or something else. Force 8bit reads to prevent gcc optimizing the read with lwr/lwl instructions. Signed-off-by: Mathias Kresin --- .../patches/0030-lzma-force-8bit-reads.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 package/boot/uboot-lantiq/patches/0030-lzma-force-8bit-reads.patch diff --git a/package/boot/uboot-lantiq/patches/0030-lzma-force-8bit-reads.patch b/package/boot/uboot-lantiq/patches/0030-lzma-force-8bit-reads.patch new file mode 100644 index 0000000000..dc7d9ed7ee --- /dev/null +++ b/package/boot/uboot-lantiq/patches/0030-lzma-force-8bit-reads.patch @@ -0,0 +1,48 @@ +From a40a6e16ed76e5e26a0f60226b64c311d4a62c9f Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Sun, 31 Oct 2021 23:04:54 +0100 +Subject: [PATCH] lzma: force 8bit reads + +At least since gcc 7.3.0 (OpenWrt 18.06) lwr/lwl are used in the +assembly of LzmaProps_Decode. While the decission made by the compiler +looks perfect fine, it triggers some obscure hang on lantiq danube-s +v1.5 with MX29LV640EB NOR flash chips. + +Only if the offset 1 is used, the hang can be observed. Using any other +offset works fine: + + lwl s0,0(a1) - s0 == 0x6d000080 + lwl s0,1(a1) - hangs + lwl s0,2(a1) - s0 == 0x0080xxxx + lwl s0,3(a1) - s0 == 0x80xxxxxx + +It isn't clear whether it is a limitation of the flash chip, the EBU or +something else. + +Force 8bit reads to prevent gcc optimizing the read with lwr/lwl +instructions. + +Signed-off-by: Mathias Kresin +--- + lib/lzma/LzmaDec.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/lib/lzma/LzmaDec.c ++++ b/lib/lzma/LzmaDec.c +@@ -7,6 +7,7 @@ + #include "LzmaDec.h" + + #include ++#include + + #define kNumTopBits 24 + #define kTopValue ((UInt32)1 << kNumTopBits) +@@ -929,7 +930,7 @@ SRes LzmaProps_Decode(CLzmaProps *p, con + if (size < LZMA_PROPS_SIZE) + return SZ_ERROR_UNSUPPORTED; + else +- dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); ++ dicSize = readb(&data[1]) | ((UInt32)readb(&data[2]) << 8) | ((UInt32)readb(&data[3]) << 16) | ((UInt32)readb(&data[4]) << 24); + + if (dicSize < LZMA_DIC_MIN) + dicSize = LZMA_DIC_MIN; From 87b8f095af9f7e6ff5edae6778d967f91e779cf2 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Tue, 2 Nov 2021 22:20:28 +0100 Subject: [PATCH 19/35] uboot-lantiq: fix out of bounds cache invalidate With gcc10 the variables are placed more tightly to each other, which uncovers a long existing bug in the lantiq DMA code. It can be observed when using tftpboot with the filename parameter, which gets reset during the tftpboot execution. NetRxPackets[] points to cache line size aligned addresses. In ltq_eth_rx_packet_align() the address NetRxPackets[] points to is increased by LTQ_ETH_IP_ALIGN and the resulting not cache aligned address is used further on. While doing so, the length/size is never updated. The "not cache aligned address" + len/size for a cache aligned address is passed to invalidate_dcache_range(). Hence, invalidate_dcache_range() invalidates the next 32 bit as well, which flashes the BootFile variable as well. variable BootFile is at address: 0x83ffe12c NetRxPackets[] points to 0x83ffdb20 (len is 0x600) data points to: 0x83ffdb22 (len is 0x600) ltq_dma_dcache_inv: 0x83ffdb22 (for len 0x600) invalidate_dcache_range: 0x83ffdb20 to 0x83ffe120 (size: 32) invalidate_dcache_range: 0x83ffdb20 to 0x83ffdb40 (Bootfile: a.bin) ... invalidate_dcache_range: 0x83ffe100 to 0x83ffe120 (Bootfile: a.bin) invalidate_dcache_range: 0x83ffe120 to 0x83ffe140 (Bootfile: ) In ltq_dma_tx_map() and ltq_dma_rx_map() the start address passed to ltq_dma_dcache_wb_inv() is incorrect. By considering the offset, the start address passed to flush_dcache_range() is always aligned to 32, 64 or 128 bytes dependent on configured DMA burst size. Fixes: FS#4113 Signed-off-by: Mathias Kresin --- ...q-fix-out-of-bounds-cache-invalidate.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/boot/uboot-lantiq/patches/0031-dma-lantiq-fix-out-of-bounds-cache-invalidate.patch diff --git a/package/boot/uboot-lantiq/patches/0031-dma-lantiq-fix-out-of-bounds-cache-invalidate.patch b/package/boot/uboot-lantiq/patches/0031-dma-lantiq-fix-out-of-bounds-cache-invalidate.patch new file mode 100644 index 0000000000..b99b07292c --- /dev/null +++ b/package/boot/uboot-lantiq/patches/0031-dma-lantiq-fix-out-of-bounds-cache-invalidate.patch @@ -0,0 +1,62 @@ +From d9527989b2d63749d6c6678fa3a1b658eb26c225 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Tue, 2 Nov 2021 21:24:29 +0100 +Subject: [PATCH] dma: lantiq: fix out of bounds cache invalidate + +With gcc10 the variables are placed more tightly to each other, which +uncovers a long existing bug in the lantiq DMA code. It can be observed +when using tftpboot with the filename parameter, which gets reset during +the tftpboot execution. + +NetRxPackets[] points to cache line size aligned addresses. In +ltq_eth_rx_packet_align() the address NetRxPackets[] points to is +increased by LTQ_ETH_IP_ALIGN and the resulting not cache aligned +address is used further on. While doing so, the length/size is never +updated. + +The "not cache aligned address" + len/size for a cache aligned address +is passed to invalidate_dcache_range(). Hence, invalidate_dcache_range() +invalidates the next 32 bit as well, which flashes the BootFile variable +as well. + + variable BootFile is at address: 0x83ffe12c + NetRxPackets[] points to 0x83ffdb20 (len is 0x600) + data points to: 0x83ffdb22 (len is 0x600) + + ltq_dma_dcache_inv: 0x83ffdb22 (for len 0x600) + invalidate_dcache_range: 0x83ffdb20 to 0x83ffe120 (size: 32) + invalidate_dcache_range: 0x83ffdb20 to 0x83ffdb40 (Bootfile: a.bin) + ... + invalidate_dcache_range: 0x83ffe100 to 0x83ffe120 (Bootfile: a.bin) + invalidate_dcache_range: 0x83ffe120 to 0x83ffe140 (Bootfile: ) + +In ltq_dma_tx_map() and ltq_dma_rx_map() the start address passed to +ltq_dma_dcache_wb_inv() is incorrect. By considering the offset, the +start address passed to flush_dcache_range() is always aligned to 32, 64 +or 128 bytes dependent on configured DMA burst size. + +Signed-off-by: Mathias Kresin +--- + drivers/dma/lantiq_dma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/dma/lantiq_dma.c ++++ b/drivers/dma/lantiq_dma.c +@@ -280,7 +280,7 @@ int ltq_dma_rx_map(struct ltq_dma_device + + offset = dma_addr % ltq_dma_burst_align(dev->rx_burst_len); + +- ltq_dma_dcache_inv(data, len); ++ ltq_dma_dcache_inv(data - offset, len); + + #if 0 + printf("%s: index %d, data %p, dma_addr %08x, offset %u, len %d\n", +@@ -355,7 +355,7 @@ int ltq_dma_tx_map(struct ltq_dma_device + __func__, index, desc, data, dma_addr, offset, len); + #endif + +- ltq_dma_dcache_wb_inv(data, len); ++ ltq_dma_dcache_wb_inv(data - offset, len); + + desc->addr = dma_addr - offset; + desc->ctl = DMA_DESC_OWN | DMA_DESC_SOP | DMA_DESC_EOP | From e6f8cf622318e65a00a5322509707f3f25cef68e Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Tue, 2 Nov 2021 23:35:32 +0100 Subject: [PATCH 20/35] uboot-lantiq: danube: fix SPL boot On danube we only have 0x6800 bytes of usable SRAM. Everything behind can't be written to and a SPL u-boot locks up during boot. Since it's a hard to debug issue and took me more than two years to fix it, I consider it worth to include fix albeit SPL u-boots are not build in OpenWrt. I faced the issue while trying to shrink the u-boot to 64K since some boards only have an u-boot partition of that size from the days ifx-uboot was used. Signed-off-by: Mathias Kresin Reviewed-by: Daniel Schwierzeck --- ...0032-MIPS-lantiq-danube-fix-SPL-boot.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 package/boot/uboot-lantiq/patches/0032-MIPS-lantiq-danube-fix-SPL-boot.patch diff --git a/package/boot/uboot-lantiq/patches/0032-MIPS-lantiq-danube-fix-SPL-boot.patch b/package/boot/uboot-lantiq/patches/0032-MIPS-lantiq-danube-fix-SPL-boot.patch new file mode 100644 index 0000000000..6cb309b8f2 --- /dev/null +++ b/package/boot/uboot-lantiq/patches/0032-MIPS-lantiq-danube-fix-SPL-boot.patch @@ -0,0 +1,34 @@ +From 65f1f160139c2bac83650c9c7c4aee4e5fd74c7c Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Sun, 2 May 2021 02:03:05 +0200 +Subject: [PATCH] MIPS: lantiq: danube: fix SPL boot + +On danube we only have 0x6800 bytes of usable SRAM. Everything behind +can't be written to and a SPL u-boot locks up during boot. + +Signed-off-by: Mathias Kresin +Reviewed-by: Daniel Schwierzeck +--- + arch/mips/include/asm/arch-danube/config.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/include/asm/arch-danube/config.h ++++ b/arch/mips/include/asm/arch-danube/config.h +@@ -61,7 +61,7 @@ + + /* SRAM */ + #define CONFIG_SYS_SRAM_BASE 0xBE1A0000 +-#define CONFIG_SYS_SRAM_SIZE 0x10000 ++#define CONFIG_SYS_SRAM_SIZE 0x6800 + + /* ASC/UART driver and console */ + #define CONFIG_LANTIQ_SERIAL +@@ -117,7 +117,7 @@ + #define CONFIG_CMD_NET + #endif + +-#define CONFIG_SPL_MAX_SIZE (32 * 1024) ++#define CONFIG_SPL_MAX_SIZE (18 * 1024) + #define CONFIG_SPL_BSS_MAX_SIZE (8 * 1024) + #define CONFIG_SPL_STACK_MAX_SIZE (8 * 1024) + #define CONFIG_SPL_MALLOC_MAX_SIZE (32 * 1024) From 9daf57d960d26001645d9c4e178e89257b813717 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Sun, 14 Nov 2021 17:11:14 +0100 Subject: [PATCH 21/35] uboot-lantiq: reduce stack size On lantiq a lot of stuff expects to be loaded to and executed at 0x80002000, including our own second stage bootloader. For all build u-boots, the initial stack pointer is at 0x80008000. After loading data to 0x80002000, every further stack operation corrupts the loaded code. Set the initial stack pointer to 0x80002000, to not overwrite code loaded in memory. A stack of 0x2000 bytes has been proven as enough in all done tests. Signed-off-by: Mathias Kresin --- .../0033-MIPS-lantiq-reduce-stack-size.patch | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 package/boot/uboot-lantiq/patches/0033-MIPS-lantiq-reduce-stack-size.patch diff --git a/package/boot/uboot-lantiq/patches/0033-MIPS-lantiq-reduce-stack-size.patch b/package/boot/uboot-lantiq/patches/0033-MIPS-lantiq-reduce-stack-size.patch new file mode 100644 index 0000000000..4f63ffc423 --- /dev/null +++ b/package/boot/uboot-lantiq/patches/0033-MIPS-lantiq-reduce-stack-size.patch @@ -0,0 +1,56 @@ +From ad739ffebf689abdbcddbe4e1b0bf847d7931a92 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Fri, 20 Jan 2017 13:59:53 +0100 +Subject: [PATCH] MIPS: lantiq: reduce stack size + +On lantiq a lot of stuff expects to be loaded to and executed at +0x80002000, including our own second stage bootloader. + +For all build u-boots, the initial stack pointer is at 0x80008000. After +loading data to 0x80002000, every further stack operation corrupts the +loaded code. + +Set the initial stack pointer to 0x80002000, to not overwrite code +loaded in memory. A stack of 0x2000 bytes has been proven as enough in +all done tests. + +Signed-off-by: Mathias Kresin +--- + arch/mips/include/asm/arch-arx100/config.h | 2 +- + arch/mips/include/asm/arch-danube/config.h | 2 +- + arch/mips/include/asm/arch-vrx200/config.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/mips/include/asm/arch-arx100/config.h ++++ b/arch/mips/include/asm/arch-arx100/config.h +@@ -66,7 +66,7 @@ + #define CONFIG_SYS_MEMTEST_END 0x82000000 + #define CONFIG_SYS_LOAD_ADDR 0x81000000 + #define CONFIG_SYS_LOAD_SIZE (2 * 1024 * 1024) +-#define CONFIG_SYS_INIT_SP_OFFSET (32 * 1024) ++#define CONFIG_SYS_INIT_SP_OFFSET 0x2000 + + /* SRAM */ + #define CONFIG_SYS_SRAM_BASE 0xBE1A0000 +--- a/arch/mips/include/asm/arch-danube/config.h ++++ b/arch/mips/include/asm/arch-danube/config.h +@@ -57,7 +57,7 @@ + #define CONFIG_SYS_MEMTEST_END 0x82000000 + #define CONFIG_SYS_LOAD_ADDR 0x81000000 + #define CONFIG_SYS_LOAD_SIZE (2 * 1024 * 1024) +-#define CONFIG_SYS_INIT_SP_OFFSET 0x4000 ++#define CONFIG_SYS_INIT_SP_OFFSET 0x2000 + + /* SRAM */ + #define CONFIG_SYS_SRAM_BASE 0xBE1A0000 +--- a/arch/mips/include/asm/arch-vrx200/config.h ++++ b/arch/mips/include/asm/arch-vrx200/config.h +@@ -69,7 +69,7 @@ + #define CONFIG_SYS_MEMTEST_END 0x82000000 + #define CONFIG_SYS_LOAD_ADDR 0x81000000 + #define CONFIG_SYS_LOAD_SIZE (2 * 1024 * 1024) +-#define CONFIG_SYS_INIT_SP_OFFSET (32 * 1024) ++#define CONFIG_SYS_INIT_SP_OFFSET 0x2000 + + /* SRAM */ + #define CONFIG_SYS_SRAM_BASE 0xBE220000 From 683e9cf7d05dfb268435d8373e81b8b4f2cb2939 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Sun, 14 Nov 2021 20:09:25 +0100 Subject: [PATCH 22/35] lantiq: fix mac address from nvmem-cells The devicetree property mac-address is expected to be set by the bootloader and has priority over the nvmem supplied one. Drop the mac-address address property from the dtsi files, to let the mac address from nvmem-cells get used. Signed-off-by: Mathias Kresin --- target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi | 1 - target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi | 1 - 2 files changed, 2 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi index 0eec0c614d..819dcfb5a8 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi @@ -385,7 +385,6 @@ 0xe108000 0x200>; interrupt-parent = <&icu0>; interrupts = <73 72>; - mac-address = [ 00 11 22 33 44 55 ]; pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi index 34d8289542..e531fe45e8 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi @@ -299,7 +299,6 @@ reg = <0xe180000 0x40000>; interrupt-parent = <&icu0>; interrupts = <73 78>; - mac-address = [ 00 11 22 33 44 55 ]; }; ppe@e234000 { From f054fcd98a27e6c2030155e1a8f056e76bffb6cc Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sun, 14 Nov 2021 20:59:47 +0200 Subject: [PATCH 23/35] lldpd: bump to 1.0.13 Fixes CVE-2021-43612. Signed-off-by: Stijn Tintel --- package/network/services/lldpd/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 9acc721b99..2d2a8c4a7d 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd -PKG_VERSION:=1.0.12 +PKG_VERSION:=1.0.13 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd -PKG_HASH:=d194c65b5b9c98d194a2842ddc75ba17ebdee7ebd5499f81a98d24031628daf1 +PKG_HASH:=d639827fd8a27720d1bfd94bc52eca24af63ddcc3c9d2da60788778889d84701 PKG_MAINTAINER:=Stijn Tintel PKG_LICENSE:=ISC From d44ab665a6b848422657ce19e3d6c6e76fed0dc2 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sun, 14 Nov 2021 21:12:53 +0200 Subject: [PATCH 24/35] lldpd: consolidate procd command lines There is no need to have multiple lines for this. Signed-off-by: Stijn Tintel --- package/network/services/lldpd/Makefile | 2 +- package/network/services/lldpd/files/lldpd.init | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 2d2a8c4a7d..fcfbc18286 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.13 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 7a5b25e016..74fece7227 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -84,8 +84,7 @@ start_service() { write_lldpd_conf procd_open_instance - procd_set_param command /usr/sbin/lldpd - procd_append_param command -d # don't daemonize, procd will handle that for us + procd_set_param command /usr/sbin/lldpd -d [ $enable_cdp -gt 0 ] && procd_append_param command '-c' [ $enable_fdp -gt 0 ] && procd_append_param command '-f' From 53247d3cb43e1ecc5feef1753ca541e3c8f76110 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sun, 14 Nov 2021 21:18:13 +0200 Subject: [PATCH 25/35] lldpd: add reload trigger This is needed to reload the service when calling reload_config, if the UCI config has changed. Signed-off-by: Stijn Tintel --- package/network/services/lldpd/Makefile | 2 +- package/network/services/lldpd/files/lldpd.init | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index fcfbc18286..8eb7e35716 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.13 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 74fece7227..5b39144921 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -56,6 +56,10 @@ write_lldpd_conf() [ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR } +service_triggers() { + procd_add_reload_trigger "lldpd" +} + start_service() { local enable_cdp From d842da8d1b2c12d70ae9a45d90ed94c10201fcde Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 29 Sep 2021 19:23:05 -1000 Subject: [PATCH 26/35] mxs: switch to Kernel 5.10 Signed-off-by: Paul Spooren --- target/linux/mxs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/mxs/Makefile b/target/linux/mxs/Makefile index 50de5418c1..a5940486df 100644 --- a/target/linux/mxs/Makefile +++ b/target/linux/mxs/Makefile @@ -10,8 +10,8 @@ BOARDNAME:=Freescale i.MX23/i.MX28 FEATURES:=ext4 rtc usb gpio CPU_TYPE:=arm926ej-s -KERNEL_PATCHVER:=5.4 -KERNEL_TESTING_PATCHVER:=5.10 +KERNEL_PATCHVER:=5.10 + KERNELNAME:=zImage dtbs define Target/Description From 59c2a585a19bf4108b7490779e4c25cc6977b9a2 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sun, 14 Nov 2021 19:05:39 +0100 Subject: [PATCH 27/35] mxs: drop kernel 5.4 support Signed-off-by: Zoltan HERPAI --- target/linux/mxs/config-5.4 | 301 ------------------ ...ARM-dts-imx23-introduce-mmc0_sck_cfg.patch | 54 ---- 2 files changed, 355 deletions(-) delete mode 100644 target/linux/mxs/config-5.4 delete mode 100644 target/linux/mxs/patches-5.4/100-ARM-dts-imx23-introduce-mmc0_sck_cfg.patch diff --git a/target/linux/mxs/config-5.4 b/target/linux/mxs/config-5.4 deleted file mode 100644 index 6fa7412cd3..0000000000 --- a/target/linux/mxs/config-5.4 +++ /dev/null @@ -1,301 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_FORTIFY_SOURCE=y -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_ARCH_HAS_KCOV=y -CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y -CONFIG_ARCH_HAS_PHYS_TO_DMA=y -CONFIG_ARCH_HAS_SET_MEMORY=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y -CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MULTIPLATFORM=y -CONFIG_ARCH_MULTI_CPU_AUTO=y -# CONFIG_ARCH_MULTI_V4 is not set -# CONFIG_ARCH_MULTI_V4T is not set -CONFIG_ARCH_MULTI_V4_V5=y -CONFIG_ARCH_MULTI_V5=y -CONFIG_ARCH_MXS=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARM=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_APPENDED_DTB=y -CONFIG_ARM_ATAG_DTB_COMPAT=y -# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set -CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_L1_CACHE_SHIFT=5 -CONFIG_ARM_PATCH_PHYS_VIRT=y -# CONFIG_ARM_SP805_WATCHDOG is not set -CONFIG_ARM_THUMB=y -CONFIG_ATAGS=y -CONFIG_AUTO_ZRELADDR=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_MMIO=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait" -CONFIG_CMDLINE_FROM_BOOTLOADER=y -CONFIG_COMMON_CLK=y -CONFIG_COREDUMP=y -CONFIG_CPU_32v5=y -CONFIG_CPU_ABRT_EV5TJ=y -CONFIG_CPU_ARM926T=y -# CONFIG_CPU_CACHE_ROUND_ROBIN is not set -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_COPY_V4WB=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -# CONFIG_CPU_DCACHE_WRITETHROUGH is not set -# CONFIG_CPU_ICACHE_DISABLE is not set -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_PABRT_LEGACY=y -CONFIG_CPU_PM=y -CONFIG_CPU_THUMB_CAPABLE=y -CONFIG_CPU_TLB_V4WBI=y -CONFIG_CPU_USE_DOMAINS=y -CONFIG_CRC16=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_DEV_MXS_DCP=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_DEBUG_ALIGN_RODATA=y -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -# CONFIG_DEBUG_USER is not set -CONFIG_DMADEVICES=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DTC=y -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -CONFIG_EXT4_FS=y -CONFIG_EXTCON=y -CONFIG_FEC=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FRAME_POINTER=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -# CONFIG_GIANFAR is not set -CONFIG_GLOB=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -CONFIG_GPIO_MXS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y -CONFIG_HAVE_EBPF_JIT=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_RSEQ=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HZ_FIXED=0 -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_ALGOPCA=y -CONFIG_I2C_ALGOPCF=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_MUX=y -CONFIG_I2C_MUX_PINCTRL=y -CONFIG_I2C_MXS=y -CONFIG_IIO=y -CONFIG_IIO_BUFFER=y -CONFIG_IIO_KFIFO_BUF=y -CONFIG_IIO_SYSFS_TRIGGER=y -CONFIG_IIO_TRIGGER=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MXS=y -CONFIG_IRQ_WORK=y -# CONFIG_ISDN is not set -CONFIG_JBD2=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MEMFD_CREATE=y -CONFIG_MFD_CORE=y -CONFIG_MFD_MXS_LRADC=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_MXS=y -CONFIG_MODULES_USE_ELF_REL=y -# CONFIG_MTD_PHYSMAP_OF is not set -CONFIG_MXS_DMA=y -# CONFIG_MXS_LRADC_ADC is not set -CONFIG_MXS_TIMER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_KUSER_HELPERS=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_PTP_CLASSIFY=y -CONFIG_NLS=y -CONFIG_NO_BOOTMEM=y -CONFIG_NVMEM=y -CONFIG_NVMEM_MXS_OCOTP=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PINCTRL=y -CONFIG_PINCTRL_IMX23=y -CONFIG_PINCTRL_IMX28=y -CONFIG_PINCTRL_MXS=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PM=y -CONFIG_PM_CLK=y -# CONFIG_PM_DEBUG is not set -CONFIG_POWER_SUPPLY=y -CONFIG_PPS=y -CONFIG_PTP_1588_CLOCK=y -CONFIG_RATIONAL=y -CONFIG_REFCOUNT_FULL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_REGULATOR_GPIO=y -CONFIG_RESET_CONTROLLER=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_STMP=y -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RTC_MC146818_LIB=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_MXS_AUART=y -CONFIG_SERIAL_MXS_AUART_CONSOLE=y -CONFIG_SMSC_PHY=y -CONFIG_SOC_BUS=y -CONFIG_SOC_IMX23=y -CONFIG_SOC_IMX28=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_MXS=y -CONFIG_SPLIT_PTLOCK_CPUS=999999 -CONFIG_SRCU=y -CONFIG_STMP3XXX_RTC_WATCHDOG=y -CONFIG_STMP_DEVICE=y -CONFIG_SWPHY=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TINY_SRCU=y -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_USB=y -CONFIG_USB_CHIPIDEA=y -CONFIG_USB_CHIPIDEA_HOST=y -CONFIG_USB_CHIPIDEA_OF=y -CONFIG_USB_CHIPIDEA_UDC=y -CONFIG_USB_COMMON=y -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -CONFIG_USB_GADGET=y -CONFIG_USB_MXS_PHY=y -CONFIG_USB_OTG=y -CONFIG_USB_PHY=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_ULPI_BUS=y -CONFIG_USE_OF=y -# CONFIG_VFP is not set -CONFIG_WATCHDOG_CORE=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0 -CONFIG_ZBOOT_ROM_TEXT=0 diff --git a/target/linux/mxs/patches-5.4/100-ARM-dts-imx23-introduce-mmc0_sck_cfg.patch b/target/linux/mxs/patches-5.4/100-ARM-dts-imx23-introduce-mmc0_sck_cfg.patch deleted file mode 100644 index 88e3c725aa..0000000000 --- a/target/linux/mxs/patches-5.4/100-ARM-dts-imx23-introduce-mmc0_sck_cfg.patch +++ /dev/null @@ -1,54 +0,0 @@ -From e4fdac5def509ffb723b49d6a91f9043009119f9 Mon Sep 17 00:00:00 2001 -From: Michael Heimpold -Date: Sun, 8 Mar 2020 23:21:44 +0100 -Subject: [PATCH] ARM: dts: imx23: introduce mmc0_sck_cfg - -The Olimex Olinuxino board has a user led connected to SSP1_DETECT. -But since this pin is listed in mmc0_pins_fixup, it is already claimed -by MMC driver and this results in this error during boot: - -[ 1.390000] imx23-pinctrl 80018000.pinctrl: pin SSP1_DETECT already - requested by 80010000.spi; cannot claim for leds -[ 1.400000] imx23-pinctrl 80018000.pinctrl: pin-65 (leds) status -22 -[ 1.410000] imx23-pinctrl 80018000.pinctrl: could not request pin 65 - (SSP1_DETECT) from group led_gpio2_1.0 on device 80018000.pinctrl -[ 1.420000] leds-gpio leds: Error applying setting, reverse things back -[ 1.430000] leds-gpio: probe of leds failed with error -22 - -This fix it, introduce mmc0_sck_cfg and switch the Olinuxino board to it. - -Signed-off-by: Michael Heimpold -Signed-off-by: Shawn Guo ---- - arch/arm/boot/dts/imx23-olinuxino.dts | 2 +- - arch/arm/boot/dts/imx23.dtsi | 8 ++++++++ - 2 files changed, 9 insertions(+), 1 deletion(-) - ---- a/arch/arm/boot/dts/imx23-olinuxino.dts -+++ b/arch/arm/boot/dts/imx23-olinuxino.dts -@@ -23,7 +23,7 @@ - ssp0: spi@80010000 { - compatible = "fsl,imx23-mmc"; - pinctrl-names = "default"; -- pinctrl-0 = <&mmc0_4bit_pins_a &mmc0_pins_fixup>; -+ pinctrl-0 = <&mmc0_4bit_pins_a &mmc0_sck_cfg>; - bus-width = <4>; - broken-cd; - status = "okay"; ---- a/arch/arm/boot/dts/imx23.dtsi -+++ b/arch/arm/boot/dts/imx23.dtsi -@@ -267,6 +267,14 @@ - fsl,pull-up = ; - }; - -+ mmc0_sck_cfg: mmc0-sck-cfg@0 { -+ reg = <0>; -+ fsl,pinmux-ids = < -+ MX23_PAD_SSP1_SCK__SSP1_SCK -+ >; -+ fsl,pull-up = ; -+ }; -+ - mmc1_4bit_pins_a: mmc1-4bit@0 { - reg = <0>; - fsl,pinmux-ids = < From c9536520bdc2dccd88316fb889f65c0331a080ad Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Sat, 6 Nov 2021 14:05:30 +0000 Subject: [PATCH 28/35] kernel: 5.10: backport explicit MAC06 disable patch Backport of Ansuel Smith's "net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled", to ensure mac06 is disabled even if enabled by the bootloader. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...sure-pad0-mac06-exchange-is-disabled.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 target/linux/generic/backport-5.10/750-v5.16-net-dsa-qca8k-make-sure-pad0-mac06-exchange-is-disabled.patch diff --git a/target/linux/generic/backport-5.10/750-v5.16-net-dsa-qca8k-make-sure-pad0-mac06-exchange-is-disabled.patch b/target/linux/generic/backport-5.10/750-v5.16-net-dsa-qca8k-make-sure-pad0-mac06-exchange-is-disabled.patch new file mode 100644 index 0000000000..4a61703c52 --- /dev/null +++ b/target/linux/generic/backport-5.10/750-v5.16-net-dsa-qca8k-make-sure-pad0-mac06-exchange-is-disabled.patch @@ -0,0 +1,47 @@ +From 5f15d392dcb4aa250a63d6f2c5adfc26c0aedc78 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Tue, 2 Nov 2021 19:30:41 +0100 +Subject: net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled + +Some device set MAC06 exchange in the bootloader. This cause some +problem as we don't support this strange mode and we just set the port6 +as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6 +instead of port0. Add an extra check and explicitly disable MAC06 exchange +to correctly configure the port PAD config. + +Signed-off-by: Ansuel Smith +Fixes: 3fcf734aa482 ("net: dsa: qca8k: add support for cpu port 6") +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 8 ++++++++ + drivers/net/dsa/qca8k.h | 1 + + 2 files changed, 9 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1109,6 +1109,14 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + ++ /* Make sure MAC06 is disabled */ ++ ret = qca8k_reg_clear(priv, QCA8K_REG_PORT0_PAD_CTRL, ++ QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN); ++ if (ret) { ++ dev_err(priv->dev, "failed disabling MAC06 exchange"); ++ return ret; ++ } ++ + /* Enable CPU Port */ + ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0, + QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -34,6 +34,7 @@ + #define QCA8K_MASK_CTRL_DEVICE_ID_MASK GENMASK(15, 8) + #define QCA8K_MASK_CTRL_DEVICE_ID(x) ((x) >> 8) + #define QCA8K_REG_PORT0_PAD_CTRL 0x004 ++#define QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN BIT(31) + #define QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE BIT(19) + #define QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE BIT(18) + #define QCA8K_REG_PORT5_PAD_CTRL 0x008 From 63ce6fcd2093a3503044d51f7a025bf8b0a8260f Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Thu, 4 Nov 2021 14:36:50 +0100 Subject: [PATCH 29/35] kernel: fix mac-address-increment patch Fix mac address increment patch. Permit to overflow to the next byte and correctly calculate the incremented mac. Reported-by: Chen Minqiang Fixes: d284e6ef0f06 ("treewide: convert mtd-mac-address-increment* to generic implementation") Signed-off-by: Ansuel Smith --- ...et-add-mac-address-increment-support.patch | 32 ++++++++++++------- ...83-of_net-add-mac-address-to-of-tree.patch | 6 ++-- ...et-add-mac-address-increment-support.patch | 32 ++++++++++++------- ...83-of_net-add-mac-address-to-of-tree.patch | 6 ++-- 4 files changed, 48 insertions(+), 28 deletions(-) diff --git a/target/linux/generic/pending-5.10/682-of_net-add-mac-address-increment-support.patch b/target/linux/generic/pending-5.10/682-of_net-add-mac-address-increment-support.patch index cd5cad38f7..82e81f37c5 100644 --- a/target/linux/generic/pending-5.10/682-of_net-add-mac-address-increment-support.patch +++ b/target/linux/generic/pending-5.10/682-of_net-add-mac-address-increment-support.patch @@ -1,7 +1,7 @@ -From 639dba857aa554f2a78572adc4cf3c32de9ec2e2 Mon Sep 17 00:00:00 2001 +From 844c273286f328acf0dab5fbd5d864366b4904dc Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Tue, 30 Mar 2021 18:21:14 +0200 -Subject: [PATCH 2/2] of_net: add mac-address-increment support +Subject: [PATCH] of_net: add mac-address-increment support Lots of embedded devices use the mac-address of other interface extracted from nvmem cells and increments it by one or two. Add two @@ -15,12 +15,12 @@ early has to be increased. Signed-off-by: Ansuel Smith --- - drivers/of/of_net.c | 59 ++++++++++++++++++++++++++++++++++----------- - 1 file changed, 45 insertions(+), 14 deletions(-) + drivers/of/of_net.c | 43 +++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 39 insertions(+), 4 deletions(-) --- a/drivers/of/of_net.c +++ b/drivers/of/of_net.c -@@ -115,27 +115,52 @@ static int of_get_mac_addr_nvmem(struct +@@ -115,27 +115,62 @@ static int of_get_mac_addr_nvmem(struct * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists * but is all zeros. * @@ -28,15 +28,17 @@ Signed-off-by: Ansuel Smith + * using: + * - mac-address-increment-byte to decide what byte to increase + * (if not defined is increased the last byte) -+ * - mac-address-increment to decide how much to increase. The value will -+ * not overflow to other bytes if the increment is over 255. -+ * (example 00:01:02:03:04:ff + 1 == 00:01:02:03:04:00) ++ * - mac-address-increment to decide how much to increase. The value WILL ++ * overflow to other bytes if the increment is over 255 or the total ++ * increment will exceed 255 of the current byte. ++ * (example 00:01:02:03:04:ff + 1 == 00:01:02:03:05:00) ++ * (example 00:01:02:03:04:fe + 5 == 00:01:02:03:05:03) + * * Return: 0 on success and errno in case of error. */ int of_get_mac_address(struct device_node *np, u8 *addr) { -+ u32 inc_idx, mac_inc; ++ u32 inc_idx, mac_inc, mac_val; int ret; + /* Check first if the increment byte is present and valid. @@ -70,8 +72,16 @@ Signed-off-by: Ansuel Smith + return ret; + +found: -+ if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) -+ addr[inc_idx] += mac_inc; ++ if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) { ++ /* Convert to a contiguous value */ ++ mac_val = (addr[3] << 16) + (addr[4] << 8) + addr[5]; ++ mac_val += mac_inc << 8 * (5-inc_idx); ++ ++ /* Apply the incremented value handling overflow case */ ++ addr[3] = (mac_val >> 16) & 0xff; ++ addr[4] = (mac_val >> 8) & 0xff; ++ addr[5] = (mac_val >> 0) & 0xff; ++ } - return of_get_mac_addr_nvmem(np, addr); + return ret; diff --git a/target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch b/target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch index 0cb96025cf..03cd763d9d 100644 --- a/target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch +++ b/target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch @@ -28,9 +28,9 @@ /** * Search the device tree for the best MAC address to use. 'mac-address' is * checked first, because that is supposed to contain to "most recent" MAC -@@ -161,6 +182,7 @@ found: - if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) - addr[inc_idx] += mac_inc; +@@ -171,6 +192,7 @@ found: + addr[5] = (mac_val >> 0) & 0xff; + } + of_add_mac_address(np, addr); return ret; diff --git a/target/linux/generic/pending-5.4/682-of_net-add-mac-address-increment-support.patch b/target/linux/generic/pending-5.4/682-of_net-add-mac-address-increment-support.patch index acc7eaf47b..464fc7e1d5 100644 --- a/target/linux/generic/pending-5.4/682-of_net-add-mac-address-increment-support.patch +++ b/target/linux/generic/pending-5.4/682-of_net-add-mac-address-increment-support.patch @@ -1,7 +1,7 @@ -From 639dba857aa554f2a78572adc4cf3c32de9ec2e2 Mon Sep 17 00:00:00 2001 +From 844c273286f328acf0dab5fbd5d864366b4904dc Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Tue, 30 Mar 2021 18:21:14 +0200 -Subject: [PATCH 2/2] of_net: add mac-address-increment support +Subject: [PATCH] of_net: add mac-address-increment support Lots of embedded devices use the mac-address of other interface extracted from nvmem cells and increments it by one or two. Add two @@ -15,12 +15,12 @@ early has to be increased. Signed-off-by: Ansuel Smith --- - drivers/of/of_net.c | 59 ++++++++++++++++++++++++++++++++++----------- - 1 file changed, 45 insertions(+), 14 deletions(-) + drivers/of/of_net.c | 43 +++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 39 insertions(+), 4 deletions(-) --- a/drivers/of/of_net.c +++ b/drivers/of/of_net.c -@@ -109,27 +109,52 @@ static int of_get_mac_addr_nvmem(struct +@@ -109,27 +109,62 @@ static int of_get_mac_addr_nvmem(struct * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists * but is all zeros. * @@ -28,15 +28,17 @@ Signed-off-by: Ansuel Smith + * using: + * - mac-address-increment-byte to decide what byte to increase + * (if not defined is increased the last byte) -+ * - mac-address-increment to decide how much to increase. The value will -+ * not overflow to other bytes if the increment is over 255. -+ * (example 00:01:02:03:04:ff + 1 == 00:01:02:03:04:00) ++ * - mac-address-increment to decide how much to increase. The value WILL ++ * overflow to other bytes if the increment is over 255 or the total ++ * increment will exceed 255 of the current byte. ++ * (example 00:01:02:03:04:ff + 1 == 00:01:02:03:05:00) ++ * (example 00:01:02:03:04:fe + 5 == 00:01:02:03:05:03) + * * Return: 0 on success and errno in case of error. */ int of_get_mac_address(struct device_node *np, u8 *addr) { -+ u32 inc_idx, mac_inc; ++ u32 inc_idx, mac_inc, mac_val; int ret; + /* Check first if the increment byte is present and valid. @@ -70,8 +72,16 @@ Signed-off-by: Ansuel Smith + return ret; + +found: -+ if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) -+ addr[inc_idx] += mac_inc; ++ if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) { ++ /* Convert to a contiguous value */ ++ mac_val = (addr[3] << 16) + (addr[4] << 8) + addr[5]; ++ mac_val += mac_inc << 8 * (5-inc_idx); ++ ++ /* Apply the incremented value handling overflow case */ ++ addr[3] = (mac_val >> 16) & 0xff; ++ addr[4] = (mac_val >> 8) & 0xff; ++ addr[5] = (mac_val >> 0) & 0xff; ++ } - return of_get_mac_addr_nvmem(np, addr); + return ret; diff --git a/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch b/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch index 78514dd9e3..448084b821 100644 --- a/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch +++ b/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch @@ -28,9 +28,9 @@ /** * Search the device tree for the best MAC address to use. 'mac-address' is * checked first, because that is supposed to contain to "most recent" MAC -@@ -155,6 +176,7 @@ found: - if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) - addr[inc_idx] += mac_inc; +@@ -165,6 +186,7 @@ found: + addr[5] = (mac_val >> 0) & 0xff; + } + of_add_mac_address(np, addr); return ret; From 91a5d69ea40196044e7456d72095afb655b0c5aa Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Wed, 3 Nov 2021 15:51:32 -0300 Subject: [PATCH 30/35] build: allow package to be built for all variants This allows a package to be rebuilt for all different VARIANTs. To do so, set VARIANT=*. The wpa-cli package is not getting built after changes made by 19aae94 [build: avoid rebuilds of unset VARIANT packages], because wpa-cli is only built when compiling a variant that includes supplicant support, and the first selected variant may not build it. Signed-off-by: Eneas U de Queiroz --- include/package-bin.mk | 2 +- include/package-ipkg.mk | 2 +- include/subdir.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/package-bin.mk b/include/package-bin.mk index 77e603e420..4ca49218e9 100644 --- a/include/package-bin.mk +++ b/include/package-bin.mk @@ -4,7 +4,7 @@ ifeq ($(DUMP),) define BuildTarget/bin - TARGET_VARIANT=$(if $(ALL_VARIANTS),$(if $(VARIANT),$(VARIANT),$(firstword $(ALL_VARIANTS)))) + TARGET_VARIANT=$(if $(ALL_VARIANTS),$(if $(VARIANT),$(filter-out *,$(VARIANT)),$(firstword $(ALL_VARIANTS)))) ifeq ($(if $(TARGET_VARIANT),$(BUILD_VARIANT)),$(TARGET_VARIANT)) ifdef Package/$(1)/install ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index bd50edb75f..362a0e2a8b 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -105,7 +105,7 @@ ifeq ($(DUMP),) IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) KEEP_$(1):=$(strip $(call Package/$(1)/conffiles)) - TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(VARIANT),$(firstword $(ALL_VARIANTS)))) + TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(filter-out *,$$(VARIANT)),$(firstword $(ALL_VARIANTS)))) ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT))) do_install= ifdef Package/$(1)/install diff --git a/include/subdir.mk b/include/subdir.mk index 155f493538..95009f814e 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -69,7 +69,7 @@ define subdir $(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target))) ) $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd)))) - $(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default))), + $(foreach variant,$(filter-out *,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default)))), $(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant))) $(if $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)),$($(1)/$(bd)/variants))) $(call log_make,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)),$($(1)/$(bd)/variants)) \ From 5720ac8f4c0d17534a2cf8c9800c01fa7e2c785f Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Wed, 3 Nov 2021 15:58:57 -0300 Subject: [PATCH 31/35] hostapd: set VARIANT=* for wpa-cli, hostapd-utils 19aae94 [build: avoid rebuilds of unset VARIANT packages] builds packages defined without a VARIANT only once, using the first VARIANT defined in the Makefile. This caused problems with wpa-cli, as it is only built for variants that include supplicant support, and the first VARIANT defined may not build it. The same happens to hostapd-utils, which is not built for supplicant-only variants. To circumvent this, set VARIANT=* for both packages so that they get built for every defined variant. This should not cause spurious rebuilds, since tey are not a dependency of any other package defined in this Makefile. Signed-off-by: Eneas U de Queiroz --- package/network/services/hostapd/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 4930851780..d921df7f97 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -426,6 +426,7 @@ define Package/hostapd-utils TITLE:=IEEE 802.1x Authenticator (utils) URL:=http://hostap.epitest.fi/ DEPENDS:=@$(subst $(space),||,$(foreach pkg,$(HOSTAPD_PROVIDERS),PACKAGE_$(pkg))) + VARIANT:=* endef define Package/hostapd-utils/description @@ -439,6 +440,7 @@ define Package/wpa-cli SUBMENU:=WirelessAPD DEPENDS:=@$(subst $(space),||,$(foreach pkg,$(SUPPLICANT_PROVIDERS),PACKAGE_$(pkg))) TITLE:=WPA Supplicant command line control utility + VARIANT:=* endef define Package/eapol-test/Default From 38106a484cdff85cd9b52bb2978c8b40f8b2c942 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 6 Nov 2021 20:55:57 +0200 Subject: [PATCH 32/35] kernel: add missing symbol Enabling KERNEL_FTRACE exposes the HIST_TRIGGERS triggers symbol. Add a build option for it to fix build failures with KERNEL_FTRACE enabled. Signed-off-by: Stijn Tintel --- config/Config-kernel.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index e993dc0d8c..8ebe1b7070 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -349,6 +349,19 @@ config KERNEL_PREEMPT_TRACER enabled. This option and the irqs-off timing option can be used together or separately.) +config KERNEL_HIST_TRIGGERS + bool "Histogram triggers" + depends on KERNEL_FTRACE + help + Hist triggers allow one or more arbitrary trace event fields to be + aggregated into hash tables and dumped to stdout by reading a + debugfs/tracefs file. They're useful for gathering quick and dirty + (though precise) summaries of event activity as an initial guide for + further investigation using more advanced tools. + + Inter-event tracing of quantities such as latencies is also + supported using hist triggers under this option. + config KERNEL_DEBUG_KERNEL bool default n From 2f95dd8ff0103374a197b943bb41ca6ff81a3af4 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 15 Nov 2021 01:02:57 +0000 Subject: [PATCH 33/35] ltq-vdsl-fw: update w921v firmware download URL Update Telekom Speedport W921V firmware download URL. Contained TAPI and VDSL firmware blobs are identical. Signed-off-by: Daniel Golle --- package/kernel/lantiq/ltq-vdsl-fw/Makefile | 2 +- package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh | 4 ++-- package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/kernel/lantiq/ltq-vdsl-fw/Makefile b/package/kernel/lantiq/ltq-vdsl-fw/Makefile index 336fc2e5e3..88883ffdee 100644 --- a/package/kernel/lantiq/ltq-vdsl-fw/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-fw/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ltq-vdsl-fw PKG_VERSION:=6.8.6 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MAINTAINER:=Daniel Golle diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh b/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh index 3d3e5aebee..baf230ac75 100755 --- a/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh @@ -1,9 +1,9 @@ #!/bin/sh FW="/tmp/firmware-speedport-w921v-1.46.000.bin" -URL="https://www.telekom.de/hilfe/downloads/firmware-speedport-w921v-1.46.000.bin" +URL="https://www.telekom.de/hilfe/downloads/firmware-speedport-w-921v-1.48.000.bin" FW_TAPI="vr9_tapi_fw.bin" FW_DSL="vr9_dsl_fw_annex_b.bin" -MD5_FW="188734c0773b225f8c130984b279621a" +MD5_FW="afa25146119daced87f67c9b66ef94b3" MD5_TAPI="57f2d07f59e11250ce1219bad99c1eda" MD5_DSL="655442e31deaa42c9c68944869361ec0" diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c b/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c index 8dc392914c..5f47daabed 100644 --- a/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c @@ -26,7 +26,7 @@ #include "LzmaWrapper.h" -#define FW_NAME "/tmp/firmware-speedport-w921v-1.46.000.bin" +#define FW_NAME "/tmp/firmware-speedport-w-921v-1.48.000.bin" #define MAGIC 0x50 #define MAGIC_SZ 0x3FFC00 @@ -78,7 +78,7 @@ int main(int argc, char **argv) if (stat(FW_NAME, &s) != 0) { printf("Failed to find %s\n", FW_NAME); - printf("Ask Google or try https://www.telekom.de/hilfe/downloads/firmware-speedport-w921v-1.45.000.bin\n"); + printf("Ask Google or try https://www.telekom.de/hilfe/downloads/firmware-speedport-w-921v-1.48.000.bin\n"); return -1; } From 0e561a2aea8dddbb446f710f1037ec305c23af9e Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 22 May 2021 20:07:56 +0200 Subject: [PATCH 34/35] lantiq: improve ethernet performance This commit contains a series of fixes for DMA. The burst length patch significantly improves Ethernet performance. Patches were tested on the xRX200 and xRX330. Signed-off-by: Aleksander Jan Bajkowski --- .../arch/mips/boot/dts/lantiq/amazonse.dtsi | 2 + .../files/arch/mips/boot/dts/lantiq/ar9.dtsi | 2 + .../arch/mips/boot/dts/lantiq/danube.dtsi | 2 + .../files/arch/mips/boot/dts/lantiq/vr9.dtsi | 2 + ...ntiq-dma-add-small-delay-after-reset.patch | 32 +++++ ...-dma-reset-correct-number-of-channel.patch | 68 ++++++++++ ...-lantiq-dma-fix-burst-length-for-DEU.patch | 41 ++++++ ...make-a-burst-length-configurable-in-.patch | 84 ++++++++++++ ...-configure-burst-length-for-ethernet.patch | 124 ++++++++++++++++++ ...ntiq-dma-add-small-delay-after-reset.patch | 32 +++++ ...-dma-reset-correct-number-of-channel.patch | 68 ++++++++++ ...-lantiq-dma-fix-burst-length-for-DEU.patch | 41 ++++++ ...make-a-burst-length-configurable-in-.patch | 84 ++++++++++++ ...-configure-burst-length-for-ethernet.patch | 124 ++++++++++++++++++ 14 files changed, 706 insertions(+) create mode 100644 target/linux/lantiq/patches-5.10/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch create mode 100644 target/linux/lantiq/patches-5.10/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch create mode 100644 target/linux/lantiq/patches-5.10/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch create mode 100644 target/linux/lantiq/patches-5.10/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch create mode 100644 target/linux/lantiq/patches-5.10/0710-net-lantiq-configure-burst-length-for-ethernet.patch create mode 100644 target/linux/lantiq/patches-5.4/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch create mode 100644 target/linux/lantiq/patches-5.4/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch create mode 100644 target/linux/lantiq/patches-5.4/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch create mode 100644 target/linux/lantiq/patches-5.4/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch create mode 100644 target/linux/lantiq/patches-5.4/0710-net-lantiq-configure-burst-length-for-ethernet.patch diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse.dtsi index c477473a06..5c608dab63 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/amazonse.dtsi @@ -236,6 +236,8 @@ interrupts = <105 109>; pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; + lantiq,tx-burst-length = <4>; + lantiq,rx-burst-length = <4>; }; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi index 819dcfb5a8..61283f5621 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi @@ -387,6 +387,8 @@ interrupts = <73 72>; pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; + lantiq,tx-burst-length = <8>; + lantiq,rx-burst-length = <8>; }; ppe@e234000 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi index e531fe45e8..a18183a2de 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi @@ -299,6 +299,8 @@ reg = <0xe180000 0x40000>; interrupt-parent = <&icu0>; interrupts = <73 78>; + lantiq,tx-burst-length = <4>; + lantiq,rx-burst-length = <4>; }; ppe@e234000 { diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi index 27858be28f..e379b07b53 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi @@ -488,6 +488,8 @@ interrupt-names = "tx", "rx"; resets = <&reset0 21 16>, <&reset0 8 8>, <&reset0 3 3>; reset-names = "switch", "ppe", "ppe_dsp"; + lantiq,tx-burst-length = <8>; + lantiq,rx-burst-length = <8>; #address-cells = <1>; #size-cells = <0>; diff --git a/target/linux/lantiq/patches-5.10/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch b/target/linux/lantiq/patches-5.10/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch new file mode 100644 index 0000000000..05227c8f89 --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch @@ -0,0 +1,32 @@ +From 497acc03cd3918baabe25d46e30c5c62b998e24d Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Sat, 19 Jun 2021 13:38:12 +0200 +Subject: [PATCH 1/5] MIPS: lantiq: dma: add small delay after reset + +Reading the DMA registers immediately after the reset causes +Data Bus Error. Adding a small delay fixes this problem. + +Signed-off-by: Aleksander Jan Bajkowski +--- + arch/mips/lantiq/xway/dma.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -221,6 +222,8 @@ ltq_dma_init(struct platform_device *pde + clk_enable(clk); + ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL); + ++ usleep_range(1, 10); ++ + /* disable all interrupts */ + ltq_dma_w32(0, LTQ_DMA_IRNEN); + diff --git a/target/linux/lantiq/patches-5.10/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch b/target/linux/lantiq/patches-5.10/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch new file mode 100644 index 0000000000..5d1862d576 --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch @@ -0,0 +1,68 @@ +From d31260c2f6a5cdddb052ab7cb09560eb23ce6597 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 15 Apr 2021 21:28:24 +0200 +Subject: [PATCH 2/5] MIPS: lantiq: dma: reset correct number of channel + +Different SoCs have a different number of channels, e.g .: +* amazon-se has 10 channels, +* danube+ar9 have 20 channels, +* vr9 has 28 channels, +* ar10 has 24 channels. + +We can read the ID register and, depending on the reported +number of channels, reset the appropriate number of channels. + +Signed-off-by: Aleksander Jan Bajkowski +--- + arch/mips/lantiq/xway/dma.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -30,6 +30,7 @@ + #define LTQ_DMA_PCTRL 0x44 + #define LTQ_DMA_IRNEN 0xf4 + ++#define DMA_ID_CHNR GENMASK(26, 20) /* channel number */ + #define DMA_DESCPT BIT(3) /* descriptor complete irq */ + #define DMA_TX BIT(8) /* TX channel direction */ + #define DMA_CHAN_ON BIT(0) /* channel on / off bit */ +@@ -40,7 +41,6 @@ + #define DMA_POLL BIT(31) /* turn on channel polling */ + #define DMA_CLK_DIV4 BIT(6) /* polling clock divider */ + #define DMA_2W_BURST BIT(1) /* 2 word burst length */ +-#define DMA_MAX_CHANNEL 20 /* the soc has 20 channels */ + #define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */ + #define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */ + +@@ -206,7 +206,7 @@ ltq_dma_init(struct platform_device *pde + { + struct clk *clk; + struct resource *res; +- unsigned id; ++ unsigned int id, nchannels; + int i; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +@@ -228,17 +228,18 @@ ltq_dma_init(struct platform_device *pde + ltq_dma_w32(0, LTQ_DMA_IRNEN); + + /* reset/configure each channel */ +- for (i = 0; i < DMA_MAX_CHANNEL; i++) { ++ id = ltq_dma_r32(LTQ_DMA_ID); ++ nchannels = ((id & DMA_ID_CHNR) >> 20); ++ for (i = 0; i < nchannels; i++) { + ltq_dma_w32(i, LTQ_DMA_CS); + ltq_dma_w32(DMA_CHAN_RST, LTQ_DMA_CCTRL); + ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL); + ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL); + } + +- id = ltq_dma_r32(LTQ_DMA_ID); + dev_info(&pdev->dev, + "Init done - hw rev: %X, ports: %d, channels: %d\n", +- id & 0x1f, (id >> 16) & 0xf, id >> 20); ++ id & 0x1f, (id >> 16) & 0xf, nchannels); + + return 0; + } diff --git a/target/linux/lantiq/patches-5.10/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch b/target/linux/lantiq/patches-5.10/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch new file mode 100644 index 0000000000..67423d2e97 --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch @@ -0,0 +1,41 @@ +From 7d9ea9052d6680d2910b8b005c397d95b3a8b012 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Wed, 7 Apr 2021 21:04:39 +0200 +Subject: [PATCH 3/5] MIPS: lantiq: dma: fix burst length for DEU + +The current definition of 2W burst length is invalid. +This patch fixes it. Current downstream DEU driver doesn't +use DMA. An incorrect burst length value doesn't cause any +errors. This patch also adds other burst length values. + +Fixes: dfec1a827d2b ("MIPS: Lantiq: Add DMA support") +Signed-off-by: Aleksander Jan Bajkowski +--- + arch/mips/lantiq/xway/dma.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -40,7 +40,11 @@ + #define DMA_IRQ_ACK 0x7e /* IRQ status register */ + #define DMA_POLL BIT(31) /* turn on channel polling */ + #define DMA_CLK_DIV4 BIT(6) /* polling clock divider */ +-#define DMA_2W_BURST BIT(1) /* 2 word burst length */ ++#define DMA_PCTRL_2W_BURST 0x1 /* 2 word burst length */ ++#define DMA_PCTRL_4W_BURST 0x2 /* 4 word burst length */ ++#define DMA_PCTRL_8W_BURST 0x3 /* 8 word burst length */ ++#define DMA_TX_BURST_SHIFT 4 /* tx burst shift */ ++#define DMA_RX_BURST_SHIFT 2 /* rx burst shift */ + #define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */ + #define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */ + +@@ -191,7 +195,8 @@ ltq_dma_init_port(int p) + break; + + case DMA_PORT_DEU: +- ltq_dma_w32((DMA_2W_BURST << 4) | (DMA_2W_BURST << 2), ++ ltq_dma_w32((DMA_PCTRL_2W_BURST << DMA_TX_BURST_SHIFT) | ++ (DMA_PCTRL_2W_BURST << DMA_RX_BURST_SHIFT), + LTQ_DMA_PCTRL); + break; + diff --git a/target/linux/lantiq/patches-5.10/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch b/target/linux/lantiq/patches-5.10/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch new file mode 100644 index 0000000000..fab2440453 --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch @@ -0,0 +1,84 @@ +From 6615eeb39f7a110a196f20acbfb3a017da4d75d2 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Fri, 14 May 2021 21:25:08 +0200 +Subject: [PATCH 4/5] MIPS: lantiq: dma: make a burst length configurable in + drivers + +Make a burst length configurable in drivers. + +Signed-off-by: Aleksander Jan Bajkowski +--- + .../include/asm/mach-lantiq/xway/xway_dma.h | 2 +- + arch/mips/lantiq/xway/dma.c | 38 ++++++++++++++++--- + 2 files changed, 34 insertions(+), 6 deletions(-) + +--- a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h ++++ b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h +@@ -45,6 +45,6 @@ extern void ltq_dma_close(struct ltq_dma + extern void ltq_dma_alloc_tx(struct ltq_dma_channel *ch); + extern void ltq_dma_alloc_rx(struct ltq_dma_channel *ch); + extern void ltq_dma_free(struct ltq_dma_channel *ch); +-extern void ltq_dma_init_port(int p); ++extern void ltq_dma_init_port(int p, int tx_burst, int rx_burst); + + #endif +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -181,7 +181,7 @@ ltq_dma_free(struct ltq_dma_channel *ch) + EXPORT_SYMBOL_GPL(ltq_dma_free); + + void +-ltq_dma_init_port(int p) ++ltq_dma_init_port(int p, int tx_burst, int rx_burst) + { + ltq_dma_w32(p, LTQ_DMA_PS); + switch (p) { +@@ -190,16 +190,44 @@ ltq_dma_init_port(int p) + * Tell the DMA engine to swap the endianness of data frames and + * drop packets if the channel arbitration fails. + */ +- ltq_dma_w32_mask(0, DMA_ETOP_ENDIANNESS | DMA_PDEN, ++ ltq_dma_w32_mask(0, (DMA_ETOP_ENDIANNESS | DMA_PDEN), + LTQ_DMA_PCTRL); + break; + +- case DMA_PORT_DEU: +- ltq_dma_w32((DMA_PCTRL_2W_BURST << DMA_TX_BURST_SHIFT) | +- (DMA_PCTRL_2W_BURST << DMA_RX_BURST_SHIFT), ++ default: ++ break; ++ } ++ ++ switch (rx_burst) { ++ case 8: ++ ltq_dma_w32_mask(0x0c, (DMA_PCTRL_8W_BURST << DMA_RX_BURST_SHIFT), + LTQ_DMA_PCTRL); + break; ++ case 4: ++ ltq_dma_w32_mask(0x0c, (DMA_PCTRL_4W_BURST << DMA_RX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ case 2: ++ ltq_dma_w32_mask(0x0c, (DMA_PCTRL_2W_BURST << DMA_RX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ default: ++ break; ++ } + ++ switch (tx_burst) { ++ case 8: ++ ltq_dma_w32_mask(0x30, (DMA_PCTRL_8W_BURST << DMA_TX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ case 4: ++ ltq_dma_w32_mask(0x30, (DMA_PCTRL_4W_BURST << DMA_TX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ case 2: ++ ltq_dma_w32_mask(0x30, (DMA_PCTRL_2W_BURST << DMA_TX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; + default: + break; + } diff --git a/target/linux/lantiq/patches-5.10/0710-net-lantiq-configure-burst-length-for-ethernet.patch b/target/linux/lantiq/patches-5.10/0710-net-lantiq-configure-burst-length-for-ethernet.patch new file mode 100644 index 0000000000..0a2996813a --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0710-net-lantiq-configure-burst-length-for-ethernet.patch @@ -0,0 +1,124 @@ +From ec1a17a11aced3cd756e59d91ad6f50b7a2fabfb Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Sun, 16 May 2021 15:52:06 +0200 +Subject: [PATCH 5/5] net: lantiq: configure burst length for ethernet + +Configure the burst length for Ethernet. This improves Ethernet +performance by 58%. According to the vendor BSP, 8W burst length +is supported by ar9 and newer SoCs. + +The NAT benchmark results on xRX200 (Down/Up): +* 2W: 330 Mb/s +* 4W: 432 Mb/s 372 Mb/s +* 8W: 520 Mb/s 389 Mb/s + +Tested on xRX200 and xRX330. + +Signed-off-by: Aleksander Jan Bajkowski +--- + drivers/net/ethernet/lantiq_etop.c | 21 ++++++++++++++++++--- + drivers/net/ethernet/lantiq_xrx200.c | 21 ++++++++++++++++++--- + 2 files changed, 36 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/lantiq_etop.c ++++ b/drivers/net/ethernet/lantiq_etop.c +@@ -148,6 +148,9 @@ struct ltq_etop_priv { + struct ltq_etop_chan txch; + struct ltq_etop_chan rxch; + ++ int tx_burst_len; ++ int rx_burst_len; ++ + int tx_irq; + int rx_irq; + +@@ -399,7 +402,7 @@ ltq_etop_dma_init(struct net_device *dev + int rx = priv->rx_irq - LTQ_DMA_ETOP; + int err; + +- ltq_dma_init_port(DMA_PORT_ETOP); ++ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, priv->rx_burst_len); + + priv->txch.dma.nr = tx; + priv->txch.dma.dev = &priv->pdev->dev; +@@ -676,8 +679,8 @@ ltq_etop_tx(struct sk_buff *skb, struct + return NETDEV_TX_BUSY; + } + +- /* dma needs to start on a 16 byte aligned address */ +- byte_offset = CPHYSADDR(skb->data) % 16; ++ /* dma needs to start on a burst length value aligned address */ ++ byte_offset = CPHYSADDR(skb->data) % (priv->tx_burst_len * 4); + priv->txch.skb[priv->txch.dma.desc] = skb; + + netif_trans_update(dev); +@@ -925,6 +928,18 @@ static int ltq_etop_probe(struct platfor + spin_lock_init(&priv->lock); + SET_NETDEV_DEV(dev, &pdev->dev); + ++ err = device_property_read_u32(&pdev->dev, "lantiq,tx-burst-length", &priv->tx_burst_len); ++ if (err < 0) { ++ dev_err(&pdev->dev, "unable to read tx-burst-length property\n"); ++ return err; ++ } ++ ++ err = device_property_read_u32(&pdev->dev, "lantiq,rx-burst-length", &priv->rx_burst_len); ++ if (err < 0) { ++ dev_err(&pdev->dev, "unable to read rx-burst-length property\n"); ++ return err; ++ } ++ + netif_napi_add(dev, &priv->txch.napi, ltq_etop_poll_tx, 8); + netif_napi_add(dev, &priv->rxch.napi, ltq_etop_poll_rx, 32); + priv->txch.netdev = dev; +--- a/drivers/net/ethernet/lantiq_xrx200.c ++++ b/drivers/net/ethernet/lantiq_xrx200.c +@@ -71,6 +71,9 @@ struct xrx200_priv { + struct net_device *net_dev; + struct device *dev; + ++ int tx_burst_len; ++ int rx_burst_len; ++ + __iomem void *pmac_reg; + }; + +@@ -316,8 +319,8 @@ static netdev_tx_t xrx200_start_xmit(str + if (unlikely(dma_mapping_error(priv->dev, mapping))) + goto err_drop; + +- /* dma needs to start on a 16 byte aligned address */ +- byte_offset = mapping % 16; ++ /* dma needs to start on a burst length value aligned address */ ++ byte_offset = mapping % (priv->tx_burst_len * 4); + + desc->addr = mapping - byte_offset; + /* Make sure the address is written before we give it to HW */ +@@ -369,7 +372,7 @@ static int xrx200_dma_init(struct xrx200 + int ret = 0; + int i; + +- ltq_dma_init_port(DMA_PORT_ETOP); ++ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, priv->rx_burst_len); + + ch_rx->dma.nr = XRX200_DMA_RX; + ch_rx->dma.dev = priv->dev; +@@ -487,6 +490,18 @@ static int xrx200_probe(struct platform_ + if (err) + eth_hw_addr_random(net_dev); + ++ err = device_property_read_u32(dev, "lantiq,tx-burst-length", &priv->tx_burst_len); ++ if (err < 0) { ++ dev_err(dev, "unable to read tx-burst-length property\n"); ++ return err; ++ } ++ ++ err = device_property_read_u32(dev, "lantiq,rx-burst-length", &priv->rx_burst_len); ++ if (err < 0) { ++ dev_err(dev, "unable to read rx-burst-length property\n"); ++ return err; ++ } ++ + /* bring up the dma engine and IP core */ + err = xrx200_dma_init(priv); + if (err) diff --git a/target/linux/lantiq/patches-5.4/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch b/target/linux/lantiq/patches-5.4/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch new file mode 100644 index 0000000000..05227c8f89 --- /dev/null +++ b/target/linux/lantiq/patches-5.4/0110-MIPS-lantiq-dma-add-small-delay-after-reset.patch @@ -0,0 +1,32 @@ +From 497acc03cd3918baabe25d46e30c5c62b998e24d Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Sat, 19 Jun 2021 13:38:12 +0200 +Subject: [PATCH 1/5] MIPS: lantiq: dma: add small delay after reset + +Reading the DMA registers immediately after the reset causes +Data Bus Error. Adding a small delay fixes this problem. + +Signed-off-by: Aleksander Jan Bajkowski +--- + arch/mips/lantiq/xway/dma.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -221,6 +222,8 @@ ltq_dma_init(struct platform_device *pde + clk_enable(clk); + ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL); + ++ usleep_range(1, 10); ++ + /* disable all interrupts */ + ltq_dma_w32(0, LTQ_DMA_IRNEN); + diff --git a/target/linux/lantiq/patches-5.4/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch b/target/linux/lantiq/patches-5.4/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch new file mode 100644 index 0000000000..5d1862d576 --- /dev/null +++ b/target/linux/lantiq/patches-5.4/0111-MIPS-lantiq-dma-reset-correct-number-of-channel.patch @@ -0,0 +1,68 @@ +From d31260c2f6a5cdddb052ab7cb09560eb23ce6597 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 15 Apr 2021 21:28:24 +0200 +Subject: [PATCH 2/5] MIPS: lantiq: dma: reset correct number of channel + +Different SoCs have a different number of channels, e.g .: +* amazon-se has 10 channels, +* danube+ar9 have 20 channels, +* vr9 has 28 channels, +* ar10 has 24 channels. + +We can read the ID register and, depending on the reported +number of channels, reset the appropriate number of channels. + +Signed-off-by: Aleksander Jan Bajkowski +--- + arch/mips/lantiq/xway/dma.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -30,6 +30,7 @@ + #define LTQ_DMA_PCTRL 0x44 + #define LTQ_DMA_IRNEN 0xf4 + ++#define DMA_ID_CHNR GENMASK(26, 20) /* channel number */ + #define DMA_DESCPT BIT(3) /* descriptor complete irq */ + #define DMA_TX BIT(8) /* TX channel direction */ + #define DMA_CHAN_ON BIT(0) /* channel on / off bit */ +@@ -40,7 +41,6 @@ + #define DMA_POLL BIT(31) /* turn on channel polling */ + #define DMA_CLK_DIV4 BIT(6) /* polling clock divider */ + #define DMA_2W_BURST BIT(1) /* 2 word burst length */ +-#define DMA_MAX_CHANNEL 20 /* the soc has 20 channels */ + #define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */ + #define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */ + +@@ -206,7 +206,7 @@ ltq_dma_init(struct platform_device *pde + { + struct clk *clk; + struct resource *res; +- unsigned id; ++ unsigned int id, nchannels; + int i; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +@@ -228,17 +228,18 @@ ltq_dma_init(struct platform_device *pde + ltq_dma_w32(0, LTQ_DMA_IRNEN); + + /* reset/configure each channel */ +- for (i = 0; i < DMA_MAX_CHANNEL; i++) { ++ id = ltq_dma_r32(LTQ_DMA_ID); ++ nchannels = ((id & DMA_ID_CHNR) >> 20); ++ for (i = 0; i < nchannels; i++) { + ltq_dma_w32(i, LTQ_DMA_CS); + ltq_dma_w32(DMA_CHAN_RST, LTQ_DMA_CCTRL); + ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL); + ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL); + } + +- id = ltq_dma_r32(LTQ_DMA_ID); + dev_info(&pdev->dev, + "Init done - hw rev: %X, ports: %d, channels: %d\n", +- id & 0x1f, (id >> 16) & 0xf, id >> 20); ++ id & 0x1f, (id >> 16) & 0xf, nchannels); + + return 0; + } diff --git a/target/linux/lantiq/patches-5.4/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch b/target/linux/lantiq/patches-5.4/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch new file mode 100644 index 0000000000..67423d2e97 --- /dev/null +++ b/target/linux/lantiq/patches-5.4/0112-MIPS-lantiq-dma-fix-burst-length-for-DEU.patch @@ -0,0 +1,41 @@ +From 7d9ea9052d6680d2910b8b005c397d95b3a8b012 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Wed, 7 Apr 2021 21:04:39 +0200 +Subject: [PATCH 3/5] MIPS: lantiq: dma: fix burst length for DEU + +The current definition of 2W burst length is invalid. +This patch fixes it. Current downstream DEU driver doesn't +use DMA. An incorrect burst length value doesn't cause any +errors. This patch also adds other burst length values. + +Fixes: dfec1a827d2b ("MIPS: Lantiq: Add DMA support") +Signed-off-by: Aleksander Jan Bajkowski +--- + arch/mips/lantiq/xway/dma.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -40,7 +40,11 @@ + #define DMA_IRQ_ACK 0x7e /* IRQ status register */ + #define DMA_POLL BIT(31) /* turn on channel polling */ + #define DMA_CLK_DIV4 BIT(6) /* polling clock divider */ +-#define DMA_2W_BURST BIT(1) /* 2 word burst length */ ++#define DMA_PCTRL_2W_BURST 0x1 /* 2 word burst length */ ++#define DMA_PCTRL_4W_BURST 0x2 /* 4 word burst length */ ++#define DMA_PCTRL_8W_BURST 0x3 /* 8 word burst length */ ++#define DMA_TX_BURST_SHIFT 4 /* tx burst shift */ ++#define DMA_RX_BURST_SHIFT 2 /* rx burst shift */ + #define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */ + #define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */ + +@@ -191,7 +195,8 @@ ltq_dma_init_port(int p) + break; + + case DMA_PORT_DEU: +- ltq_dma_w32((DMA_2W_BURST << 4) | (DMA_2W_BURST << 2), ++ ltq_dma_w32((DMA_PCTRL_2W_BURST << DMA_TX_BURST_SHIFT) | ++ (DMA_PCTRL_2W_BURST << DMA_RX_BURST_SHIFT), + LTQ_DMA_PCTRL); + break; + diff --git a/target/linux/lantiq/patches-5.4/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch b/target/linux/lantiq/patches-5.4/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch new file mode 100644 index 0000000000..fab2440453 --- /dev/null +++ b/target/linux/lantiq/patches-5.4/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch @@ -0,0 +1,84 @@ +From 6615eeb39f7a110a196f20acbfb3a017da4d75d2 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Fri, 14 May 2021 21:25:08 +0200 +Subject: [PATCH 4/5] MIPS: lantiq: dma: make a burst length configurable in + drivers + +Make a burst length configurable in drivers. + +Signed-off-by: Aleksander Jan Bajkowski +--- + .../include/asm/mach-lantiq/xway/xway_dma.h | 2 +- + arch/mips/lantiq/xway/dma.c | 38 ++++++++++++++++--- + 2 files changed, 34 insertions(+), 6 deletions(-) + +--- a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h ++++ b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h +@@ -45,6 +45,6 @@ extern void ltq_dma_close(struct ltq_dma + extern void ltq_dma_alloc_tx(struct ltq_dma_channel *ch); + extern void ltq_dma_alloc_rx(struct ltq_dma_channel *ch); + extern void ltq_dma_free(struct ltq_dma_channel *ch); +-extern void ltq_dma_init_port(int p); ++extern void ltq_dma_init_port(int p, int tx_burst, int rx_burst); + + #endif +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -181,7 +181,7 @@ ltq_dma_free(struct ltq_dma_channel *ch) + EXPORT_SYMBOL_GPL(ltq_dma_free); + + void +-ltq_dma_init_port(int p) ++ltq_dma_init_port(int p, int tx_burst, int rx_burst) + { + ltq_dma_w32(p, LTQ_DMA_PS); + switch (p) { +@@ -190,16 +190,44 @@ ltq_dma_init_port(int p) + * Tell the DMA engine to swap the endianness of data frames and + * drop packets if the channel arbitration fails. + */ +- ltq_dma_w32_mask(0, DMA_ETOP_ENDIANNESS | DMA_PDEN, ++ ltq_dma_w32_mask(0, (DMA_ETOP_ENDIANNESS | DMA_PDEN), + LTQ_DMA_PCTRL); + break; + +- case DMA_PORT_DEU: +- ltq_dma_w32((DMA_PCTRL_2W_BURST << DMA_TX_BURST_SHIFT) | +- (DMA_PCTRL_2W_BURST << DMA_RX_BURST_SHIFT), ++ default: ++ break; ++ } ++ ++ switch (rx_burst) { ++ case 8: ++ ltq_dma_w32_mask(0x0c, (DMA_PCTRL_8W_BURST << DMA_RX_BURST_SHIFT), + LTQ_DMA_PCTRL); + break; ++ case 4: ++ ltq_dma_w32_mask(0x0c, (DMA_PCTRL_4W_BURST << DMA_RX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ case 2: ++ ltq_dma_w32_mask(0x0c, (DMA_PCTRL_2W_BURST << DMA_RX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ default: ++ break; ++ } + ++ switch (tx_burst) { ++ case 8: ++ ltq_dma_w32_mask(0x30, (DMA_PCTRL_8W_BURST << DMA_TX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ case 4: ++ ltq_dma_w32_mask(0x30, (DMA_PCTRL_4W_BURST << DMA_TX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; ++ case 2: ++ ltq_dma_w32_mask(0x30, (DMA_PCTRL_2W_BURST << DMA_TX_BURST_SHIFT), ++ LTQ_DMA_PCTRL); ++ break; + default: + break; + } diff --git a/target/linux/lantiq/patches-5.4/0710-net-lantiq-configure-burst-length-for-ethernet.patch b/target/linux/lantiq/patches-5.4/0710-net-lantiq-configure-burst-length-for-ethernet.patch new file mode 100644 index 0000000000..746a09c453 --- /dev/null +++ b/target/linux/lantiq/patches-5.4/0710-net-lantiq-configure-burst-length-for-ethernet.patch @@ -0,0 +1,124 @@ +From ec1a17a11aced3cd756e59d91ad6f50b7a2fabfb Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Sun, 16 May 2021 15:52:06 +0200 +Subject: [PATCH 5/5] net: lantiq: configure burst length for ethernet + +Configure the burst length for Ethernet. This improves Ethernet +performance by 58%. According to the vendor BSP, 8W burst length +is supported by ar9 and newer SoCs. + +The NAT benchmark results on xRX200 (Down/Up): +* 2W: 330 Mb/s +* 4W: 432 Mb/s 372 Mb/s +* 8W: 520 Mb/s 389 Mb/s + +Tested on xRX200 and xRX330. + +Signed-off-by: Aleksander Jan Bajkowski +--- + drivers/net/ethernet/lantiq_etop.c | 21 ++++++++++++++++++--- + drivers/net/ethernet/lantiq_xrx200.c | 21 ++++++++++++++++++--- + 2 files changed, 36 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/lantiq_etop.c ++++ b/drivers/net/ethernet/lantiq_etop.c +@@ -148,6 +148,9 @@ struct ltq_etop_priv { + struct ltq_etop_chan txch; + struct ltq_etop_chan rxch; + ++ int tx_burst_len; ++ int rx_burst_len; ++ + int tx_irq; + int rx_irq; + +@@ -399,7 +402,7 @@ ltq_etop_dma_init(struct net_device *dev + int rx = priv->rx_irq - LTQ_DMA_ETOP; + int err; + +- ltq_dma_init_port(DMA_PORT_ETOP); ++ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, priv->rx_burst_len); + + priv->txch.dma.nr = tx; + priv->txch.dma.dev = &priv->pdev->dev; +@@ -676,8 +679,8 @@ ltq_etop_tx(struct sk_buff *skb, struct + return NETDEV_TX_BUSY; + } + +- /* dma needs to start on a 16 byte aligned address */ +- byte_offset = CPHYSADDR(skb->data) % 16; ++ /* dma needs to start on a burst length value aligned address */ ++ byte_offset = CPHYSADDR(skb->data) % (priv->tx_burst_len * 4); + priv->txch.skb[priv->txch.dma.desc] = skb; + + netif_trans_update(dev); +@@ -930,6 +933,18 @@ static int ltq_etop_probe(struct platfor + spin_lock_init(&priv->lock); + SET_NETDEV_DEV(dev, &pdev->dev); + ++ err = device_property_read_u32(&pdev->dev, "lantiq,tx-burst-length", &priv->tx_burst_len); ++ if (err < 0) { ++ dev_err(&pdev->dev, "unable to read tx-burst-length property\n"); ++ return err; ++ } ++ ++ err = device_property_read_u32(&pdev->dev, "lantiq,rx-burst-length", &priv->rx_burst_len); ++ if (err < 0) { ++ dev_err(&pdev->dev, "unable to read rx-burst-length property\n"); ++ return err; ++ } ++ + netif_napi_add(dev, &priv->txch.napi, ltq_etop_poll_tx, 8); + netif_napi_add(dev, &priv->rxch.napi, ltq_etop_poll_rx, 32); + priv->txch.netdev = dev; +--- a/drivers/net/ethernet/lantiq_xrx200.c ++++ b/drivers/net/ethernet/lantiq_xrx200.c +@@ -71,6 +71,9 @@ struct xrx200_priv { + struct net_device *net_dev; + struct device *dev; + ++ int tx_burst_len; ++ int rx_burst_len; ++ + __iomem void *pmac_reg; + }; + +@@ -315,8 +318,8 @@ static int xrx200_start_xmit(struct sk_b + if (unlikely(dma_mapping_error(priv->dev, mapping))) + goto err_drop; + +- /* dma needs to start on a 16 byte aligned address */ +- byte_offset = mapping % 16; ++ /* dma needs to start on a burst length value aligned address */ ++ byte_offset = mapping % (priv->tx_burst_len * 4); + + desc->addr = mapping - byte_offset; + /* Make sure the address is written before we give it to HW */ +@@ -368,7 +371,7 @@ static int xrx200_dma_init(struct xrx200 + int ret = 0; + int i; + +- ltq_dma_init_port(DMA_PORT_ETOP); ++ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, priv->rx_burst_len); + + ch_rx->dma.nr = XRX200_DMA_RX; + ch_rx->dma.dev = priv->dev; +@@ -486,6 +489,18 @@ static int xrx200_probe(struct platform_ + if (err) + eth_hw_addr_random(net_dev); + ++ err = device_property_read_u32(dev, "lantiq,tx-burst-length", &priv->tx_burst_len); ++ if (err < 0) { ++ dev_err(dev, "unable to read tx-burst-length property\n"); ++ return err; ++ } ++ ++ err = device_property_read_u32(dev, "lantiq,rx-burst-length", &priv->rx_burst_len); ++ if (err < 0) { ++ dev_err(dev, "unable to read rx-burst-length property\n"); ++ return err; ++ } ++ + /* bring up the dma engine and IP core */ + err = xrx200_dma_init(priv); + if (err) From 0c249ab07645489088c9010bb528b637356aa052 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 16 Nov 2021 10:47:43 +0100 Subject: [PATCH 35/35] toolchain/gcc: revert a faulty upstream commit that caused miscompiled code This broke at least the OKLI loader, but possibly other things as well Signed-off-by: Felix Fietkau --- ...leanup-range-of-address-calculations.patch | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 toolchain/gcc/patches/11.2.0/001-Revert-Cleanup-range-of-address-calculations.patch diff --git a/toolchain/gcc/patches/11.2.0/001-Revert-Cleanup-range-of-address-calculations.patch b/toolchain/gcc/patches/11.2.0/001-Revert-Cleanup-range-of-address-calculations.patch new file mode 100644 index 0000000000..a97e061d6b --- /dev/null +++ b/toolchain/gcc/patches/11.2.0/001-Revert-Cleanup-range-of-address-calculations.patch @@ -0,0 +1,160 @@ +From: Felix Fietkau +Date: Tue, 16 Nov 2021 10:39:51 +0100 +Subject: [PATCH] Revert "Cleanup range of address calculations." + +This reverts commit 47923622c663ffad8b14aa93706183290d4f6791. +This commit is causing issues with offset of struct members. + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103255 +--- + delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr78655.c + +--- a/gcc/gimple-range.cc ++++ b/gcc/gimple-range.cc +@@ -431,9 +431,8 @@ gimple_ranger::range_of_range_op (irange + m_cache.register_dependency (lhs, op2); + } + +- if (gimple_code (s) == GIMPLE_ASSIGN +- && gimple_assign_rhs_code (s) == ADDR_EXPR) +- return range_of_address (r, s); ++ if (range_of_non_trivial_assignment (r, s)) ++ return true; + + if (range_of_expr (range1, op1, s)) + { +@@ -447,84 +446,48 @@ gimple_ranger::range_of_range_op (irange + return true; + } + +-// Calculate the range of an assignment containing an ADDR_EXPR. ++// Calculate the range of a non-trivial assignment. That is, is one ++// inolving arithmetic on an SSA name (for example, an ADDR_EXPR). + // Return the range in R. +-// If a range cannot be calculated, set it to VARYING and return true. ++// ++// If a range cannot be calculated, return false. + + bool +-gimple_ranger::range_of_address (irange &r, gimple *stmt) ++gimple_ranger::range_of_non_trivial_assignment (irange &r, gimple *stmt) + { +- gcc_checking_assert (gimple_code (stmt) == GIMPLE_ASSIGN); +- gcc_checking_assert (gimple_assign_rhs_code (stmt) == ADDR_EXPR); ++ if (gimple_code (stmt) != GIMPLE_ASSIGN) ++ return false; + +- bool strict_overflow_p; +- tree expr = gimple_assign_rhs1 (stmt); +- poly_int64 bitsize, bitpos; +- tree offset; +- machine_mode mode; +- int unsignedp, reversep, volatilep; +- tree base = get_inner_reference (TREE_OPERAND (expr, 0), &bitsize, +- &bitpos, &offset, &mode, &unsignedp, +- &reversep, &volatilep); +- +- +- if (base != NULL_TREE +- && TREE_CODE (base) == MEM_REF +- && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) ++ tree base = gimple_range_base_of_assignment (stmt); ++ if (base) + { +- tree ssa = TREE_OPERAND (base, 0); +- gcc_checking_assert (irange::supports_type_p (TREE_TYPE (ssa))); +- range_of_expr (r, ssa, stmt); +- range_cast (r, TREE_TYPE (gimple_assign_rhs1 (stmt))); +- +- poly_offset_int off = 0; +- bool off_cst = false; +- if (offset == NULL_TREE || TREE_CODE (offset) == INTEGER_CST) ++ if (TREE_CODE (base) == MEM_REF) + { +- off = mem_ref_offset (base); +- if (offset) +- off += poly_offset_int::from (wi::to_poly_wide (offset), +- SIGNED); +- off <<= LOG2_BITS_PER_UNIT; +- off += bitpos; +- off_cst = true; ++ if (TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) ++ { ++ int_range_max range1; ++ tree ssa = TREE_OPERAND (base, 0); ++ if (range_of_expr (range1, ssa, stmt)) ++ { ++ tree type = TREE_TYPE (ssa); ++ range_operator *op = range_op_handler (POINTER_PLUS_EXPR, ++ type); ++ int_range<2> offset (TREE_OPERAND (base, 1), ++ TREE_OPERAND (base, 1)); ++ op->fold_range (r, type, range1, offset); ++ return true; ++ } ++ } ++ return false; + } +- /* If &X->a is equal to X, the range of X is the result. */ +- if (off_cst && known_eq (off, 0)) +- return true; +- else if (flag_delete_null_pointer_checks +- && !TYPE_OVERFLOW_WRAPS (TREE_TYPE (expr))) +- { +- /* For -fdelete-null-pointer-checks -fno-wrapv-pointer we don't +- allow going from non-NULL pointer to NULL. */ +- if(!range_includes_zero_p (&r)) +- return true; +- } +- /* If MEM_REF has a "positive" offset, consider it non-NULL +- always, for -fdelete-null-pointer-checks also "negative" +- ones. Punt for unknown offsets (e.g. variable ones). */ +- if (!TYPE_OVERFLOW_WRAPS (TREE_TYPE (expr)) +- && off_cst +- && known_ne (off, 0) +- && (flag_delete_null_pointer_checks || known_gt (off, 0))) ++ if (gimple_assign_rhs_code (stmt) == ADDR_EXPR) + { ++ // Handle "= &a" and return non-zero. + r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt))); + return true; + } +- r = int_range<2> (TREE_TYPE (gimple_assign_rhs1 (stmt))); +- return true; +- } +- +- // Handle "= &a". +- if (tree_single_nonzero_warnv_p (expr, &strict_overflow_p)) +- { +- r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt))); +- return true; + } +- +- // Otherwise return varying. +- r = int_range<2> (TREE_TYPE (gimple_assign_rhs1 (stmt))); +- return true; ++ return false; + } + + // Calculate a range for phi statement S and return it in R. +--- a/gcc/gimple-range.h ++++ b/gcc/gimple-range.h +@@ -62,7 +62,7 @@ protected: + ranger_cache m_cache; + private: + bool range_of_phi (irange &r, gphi *phi); +- bool range_of_address (irange &r, gimple *s); ++ bool range_of_non_trivial_assignment (irange &r, gimple *s); + bool range_of_builtin_call (irange &r, gcall *call); + bool range_with_loop_info (irange &r, tree name); + void range_of_ssa_name_with_loop_info (irange &, tree, class loop *, +--- a/gcc/range-op.cc ++++ b/gcc/range-op.cc +@@ -3447,7 +3447,6 @@ pointer_table::pointer_table () + set (GT_EXPR, op_gt); + set (GE_EXPR, op_ge); + set (SSA_NAME, op_identity); +- set (INTEGER_CST, op_integer_cst); + set (ADDR_EXPR, op_addr); + set (NOP_EXPR, op_convert); + set (CONVERT_EXPR, op_convert);