From ee8ef9b10b3b5eb13f83940ef79cf73f0f18584b Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Thu, 12 Nov 2020 18:18:52 +0100 Subject: [PATCH 01/50] iproute2: update to 5.9 Update iproute2 to latest stable 5.9; for the changes see https://lwn.net/Articles/834755/ Refresh patches Signed-off-by: Hans Dedecker Acked-by: Hauke Mehrtens --- package/network/utils/iproute2/Makefile | 4 ++-- .../utils/iproute2/patches/115-add-config-xtlibdir.patch | 2 +- .../utils/iproute2/patches/175-reduce-dynamic-syms.patch | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 90f8b59a02..237f84736b 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.8.0 +PKG_VERSION:=5.9.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=cfcd1f890290f8c8afcc91d9444ad929b9252c16f9ab3f286c50dd3c59dc646e +PKG_HASH:=a25dac94bcdcf2f73316c7f812115ea7a5710580bad892b08a83d00c6b33dacf PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch index 03df7809f7..8702d5fd2d 100644 --- a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch +++ b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch @@ -1,6 +1,6 @@ --- a/tc/Makefile +++ b/tc/Makefile -@@ -127,6 +127,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR +@@ -128,6 +128,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR ifneq ($(IPT_LIB_DIR),) CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\" endif diff --git a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch index e5d5492a35..da961a183b 100644 --- a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch +++ b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch @@ -9,7 +9,7 @@ endif TCLIB := tc_core.o -@@ -143,7 +143,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc +@@ -144,7 +144,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc all: tc $(TCSO) tc: $(TCOBJ) $(LIBNETLINK) libtc.a @@ -18,7 +18,7 @@ libtc.a: $(TCLIB) $(QUIET_AR)$(AR) rcs $@ $^ -@@ -165,6 +165,7 @@ install: all +@@ -166,6 +166,7 @@ install: all clean: rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \ rm -f emp_ematch.tab.* @@ -26,7 +26,7 @@ q_atm.so: q_atm.c $(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm -@@ -204,4 +205,15 @@ static-syms.h: $(wildcard *.c) +@@ -205,4 +206,15 @@ static-syms.h: $(wildcard *.c) sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ done > $@ From cc16f5d73e770136eb0f3cf92ed518292d626bac Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Nov 2020 07:35:11 +0100 Subject: [PATCH 02/50] build: try to find getopt in macOS homebrew's standard location It is not symlinked to /usr/local/bin by default Signed-off-by: Felix Fietkau --- include/prereq-build.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index f67a01299e..8181812599 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -125,7 +125,8 @@ $(eval $(call SetupHostCommand,egrep,Please install GNU 'grep', \ $(eval $(call SetupHostCommand,getopt, \ Please install an extended getopt version that supports --long, \ gnugetopt -o t --long test -- --test | grep '^ *--test *--', \ - getopt -o t --long test -- --test | grep '^ *--test *--')) + getopt -o t --long test -- --test | grep '^ *--test *--', \ + /usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--')) $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ gnustat -c%s $(TOPDIR)/Makefile, \ From 0fd214d89fa970b967c1aaf5613f145c869db2b1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Nov 2020 11:57:23 +0100 Subject: [PATCH 03/50] tools/fakeroot: fix build on macOS with recent Xcode versions Signed-off-by: Felix Fietkau --- tools/fakeroot/patches/100-portability.patch | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/fakeroot/patches/100-portability.patch b/tools/fakeroot/patches/100-portability.patch index 3835a7792b..5713c9e3fe 100644 --- a/tools/fakeroot/patches/100-portability.patch +++ b/tools/fakeroot/patches/100-portability.patch @@ -25,7 +25,7 @@ #ifdef HAVE_SYS_ACL_H #include #endif /* HAVE_SYS_ACL_H */ -@@ -1894,7 +1901,7 @@ ssize_t fremovexattr(int fd, const char +@@ -1894,7 +1901,7 @@ ssize_t fremovexattr(int fd, const char } #endif /* HAVE_FREMOVEXATTR */ @@ -110,3 +110,23 @@ if(argname){ print "static __inline__ " ret " next_" name, argtype " __attribute__((always_inline));" > tmpffile; print "static __inline__ " ret " next_" name, argtype " {" > tmpffile; +--- a/configure.ac ++++ b/configure.ac +@@ -110,6 +110,7 @@ for first in size_t int; do + #include + #endif + #include ++#include + #ifdef HAVE_GRP_H + #include + #endif +--- a/configure ++++ b/configure +@@ -12847,6 +12847,7 @@ for first in size_t int; do + #include + #endif + #include ++#include + #ifdef HAVE_GRP_H + #include + #endif From 31043704558efdeb25e2be9b03f211513047c635 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Nov 2020 12:37:39 +0100 Subject: [PATCH 04/50] build: detect broken make version on macOS Apple ships a broken make version with the Xcode command line tools. Homebrew installs make as gmake by default in order to not collide with Apple's version. Exit with an error if the broken one is used accidentally Signed-off-by: Felix Fietkau --- include/toplevel.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/toplevel.mk b/include/toplevel.mk index c233a4c214..4003b48241 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -29,6 +29,12 @@ export GNU_HOST_NAME:=$(shell $(TOPDIR)/scripts/config.guess) export HOST_OS:=$(shell uname) export HOST_ARCH:=$(shell uname -m) +ifeq ($(HOST_OS),Darwin) + ifneq ($(filter /Applications/Xcode.app/% /Library/Developer/%,$(MAKE)),) + $(error Please use a newer version of GNU make. The version shipped by Apple is not supported) + endif +endif + # prevent perforce from messing with the patch utility unexport P4PORT P4USER P4CONFIG P4CLIENT From a99f88a1866ec082ab635db31a90de618840b165 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Nov 2020 12:47:39 +0100 Subject: [PATCH 05/50] tools/libelf: use autoreconf to fix build failure on macOS with recent Xcode versions Signed-off-by: Felix Fietkau --- tools/libelf/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/libelf/Makefile b/tools/libelf/Makefile index 9fec8308b5..726c4776bf 100644 --- a/tools/libelf/Makefile +++ b/tools/libelf/Makefile @@ -18,8 +18,12 @@ PKG_SOURCE_URL:= \ http://distcache.freebsd.org/ports-distfiles/ HOST_BUILD_PARALLEL:=1 +HOST_FIXUP:=autoreconf + include $(INCLUDE_DIR)/host-build.mk +PKG_REMOVE_FILES := + HOST_CONFIGURE_ARGS += \ --disable-shared \ --enable-elf64 From 6c2ef55e6963d6ae36c4f9c85adaf7fe7aa1f369 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Nov 2020 12:52:58 +0100 Subject: [PATCH 06/50] tools/bc: use autoreconf to fix build failure on macOS with recent Xcode versions Signed-off-by: Felix Fietkau --- tools/Makefile | 2 +- tools/bc/Makefile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 65bec34c1b..4aa268de8f 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -41,7 +41,7 @@ tools-$(CONFIG_USE_SPARSE) += sparse $(curdir)/autoconf/compile := $(curdir)/m4/compile $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkgconf/compile $(curdir)/xz/compile $(curdir)/b43-tools/compile := $(curdir)/bison/compile -$(curdir)/bc/compile := $(curdir)/bison/compile +$(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile $(curdir)/bison/compile := $(curdir)/flex/compile $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile diff --git a/tools/bc/Makefile b/tools/bc/Makefile index 3d505d6032..e5af713cf0 100644 --- a/tools/bc/Makefile +++ b/tools/bc/Makefile @@ -16,6 +16,8 @@ PKG_SOURCE_URL:=http://alpha.gnu.org/gnu/bc \ http://www.nic.funet.fi/pub/gnu/alpha/gnu/bc/ PKG_HASH:=7ee4abbcfac03d8a6e1a8a3440558a3d239d6b858585063e745c760957725ecc +PKG_FIXUP := autoreconf + include $(INCLUDE_DIR)/host-build.mk $(eval $(call HostBuild)) From 5752ccb60f30314b0e77d12d7cbc46fdcaf57f0f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Nov 2020 14:33:23 +0100 Subject: [PATCH 07/50] libjson-c: enable rpath for host builds to fix errors on recent macOS Same approach as on libubox Signed-off-by: Felix Fietkau --- package/libs/libjson-c/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/libs/libjson-c/Makefile b/package/libs/libjson-c/Makefile index c8a514a147..13cf955960 100644 --- a/package/libs/libjson-c/Makefile +++ b/package/libs/libjson-c/Makefile @@ -27,6 +27,11 @@ include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk +CMAKE_HOST_OPTIONS += \ + -DCMAKE_SKIP_RPATH=FALSE \ + -DCMAKE_MACOSX_RPATH=1 \ + -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" + define Package/libjson-c SECTION:=libs CATEGORY:=Libraries From d31da371ac2ac2162c41fb6071ddbebccb44f6b0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Nov 2020 14:34:30 +0100 Subject: [PATCH 08/50] build: support cmake verbose for host builds Signed-off-by: Felix Fietkau --- include/cmake.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/cmake.mk b/include/cmake.mk index 9dd95f5a64..fec6da22ef 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -4,6 +4,7 @@ PKG_INSTALL:=1 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) MAKE_FLAGS+=VERBOSE=1 + HOST_MAKE_FLAGS+=VERBOSE=1 endif CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR)) From c63908afd282ccbe3cbcafae170e32f8f021bdb9 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Thu, 5 Nov 2020 11:37:16 +0000 Subject: [PATCH 09/50] wireguard-tools: drop the dependency on ip-{tiny,full} BusyBox ip already provides the required functionality and is enabled by default in OpenWrt. This patch drops the ip dependency and makes the BusyBox ip required dependencies explicit, allowing for a significant image size reduction. openwrt-ath79-generic-ubnt_nanostation-loco-m-squashfs-sysupgrade.bin size: 4588354 bytes (with ip-tiny) 4457282 bytes (with BusyBox ip) Signed-off-by: Rui Salvaterra --- package/network/utils/wireguard-tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/wireguard-tools/Makefile b/package/network/utils/wireguard-tools/Makefile index a5264a50b4..07258fde98 100644 --- a/package/network/utils/wireguard-tools/Makefile +++ b/package/network/utils/wireguard-tools/Makefile @@ -32,7 +32,7 @@ MAKE_VARS += PLATFORM=linux define Package/wireguard-tools $(call Package/wireguard/Default) TITLE:=WireGuard userspace control program (wg) - DEPENDS:=+ip + DEPENDS:=+@BUSYBOX_CONFIG_IP +@BUSYBOX_CONFIG_FEATURE_IP_LINK endef define Package/wireguard-tools/description From 47e089e30ec3a8d63abb924dbb1d02efe4add9aa Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Fri, 6 Nov 2020 09:54:20 -1000 Subject: [PATCH 10/50] bcm27xx: add bit variant to redundant RaspberryPi Both bcm2709 and bcm2710 firmware can run on the same RaspberryPi models, varying however in 32 and 64 Bit architectures. The model name alone does not include the architecture information, which becomes problematic if looking at a overview that only contains the names. By adding a variant it is possible to tell the architecture. Signed-off-by: Paul Spooren --- target/linux/bcm27xx/image/Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile index f009b997e9..ec0255bc0d 100644 --- a/target/linux/bcm27xx/image/Makefile +++ b/target/linux/bcm27xx/image/Makefile @@ -86,7 +86,14 @@ ifeq ($(SUBTARGET),bcm2708) endif define Device/rpi-2 - DEVICE_MODEL := 2B/3B/3B+/3CM/4B + DEVICE_MODEL := 2B/2B 1.2 + DEVICE_VARIANT := (32bit) + DEVICE_ALT0_VENDOR := Raspberry Pi + DEVICE_ALT0_MODEL := 3B/3B+/3CM + DEVICE_ALT0_VARIANT := (32bit) + DEVICE_ALT1_VENDOR := Raspberry Pi + DEVICE_ALT1_MODEL := 4B + DEVICE_ALT1_VARIANT := (32bit) DEVICE_DTS := \ bcm2709-rpi-2-b bcm2710-rpi-2-b \ bcm2710-rpi-3-b bcm2710-rpi-3-b-plus \ @@ -112,7 +119,11 @@ ifeq ($(SUBTARGET),bcm2709) endif define Device/rpi-3 - DEVICE_MODEL := 2B-1.2/3B/3B+/3CM + DEVICE_MODEL := 3B/3B+/3CM + DEVICE_VARIANT := (64bit) + DEVICE_ALT0_VENDOR := Raspberry Pi + DEVICE_ALT0_MODEL := 2B-1.2 + DEVICE_ALT0_VARIANT := (64bit) KERNEL_IMG := kernel8.img DEVICE_DTS := \ broadcom/bcm2710-rpi-2-b \ @@ -136,6 +147,7 @@ endif define Device/rpi-4 DEVICE_MODEL := 4B + DEVICE_VARIANT := (64bit) KERNEL_IMG := kernel8.img DEVICE_DTS := broadcom/bcm2711-rpi-4-b SUPPORTED_DEVICES := \ From aaf3443e1a35984af6c483b06640c22db29bdbd4 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sat, 14 Nov 2020 13:04:43 +0100 Subject: [PATCH 11/50] dropbear: update to 2.81 Update dropbear to latest stable 2.81; for the changes see https://matt.ucc.asn.au/dropbear/CHANGES Refresh patches Signed-off-by: Hans Dedecker --- package/network/services/dropbear/Makefile | 6 +++--- .../network/services/dropbear/patches/110-change_user.patch | 2 +- .../services/dropbear/patches/160-lto-jobserver.patch | 4 ++-- .../910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch | 4 +--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 1ecca2feb1..8520426382 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dropbear -PKG_VERSION:=2020.80 -PKG_RELEASE:=4 +PKG_VERSION:=2020.81 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://matt.ucc.asn.au/dropbear/releases/ \ https://dropbear.nl/mirror/releases/ -PKG_HASH:=d927941b91f2da150b2033f1a88b6a47999bf0afb1493a73e9216cffdb5d7949 +PKG_HASH:=48235d10b37775dbda59341ac0c4b239b82ad6318c31568b985730c788aac53b PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE diff --git a/package/network/services/dropbear/patches/110-change_user.patch b/package/network/services/dropbear/patches/110-change_user.patch index f66b319100..1dd67948af 100644 --- a/package/network/services/dropbear/patches/110-change_user.patch +++ b/package/network/services/dropbear/patches/110-change_user.patch @@ -1,6 +1,6 @@ --- a/svr-chansession.c +++ b/svr-chansession.c -@@ -950,12 +950,12 @@ static void execchild(const void *user_d +@@ -954,12 +954,12 @@ static void execchild(const void *user_d /* We can only change uid/gid as root ... */ if (getuid() == 0) { diff --git a/package/network/services/dropbear/patches/160-lto-jobserver.patch b/package/network/services/dropbear/patches/160-lto-jobserver.patch index dbba613ac3..1ba7dd6f44 100644 --- a/package/network/services/dropbear/patches/160-lto-jobserver.patch +++ b/package/network/services/dropbear/patches/160-lto-jobserver.patch @@ -1,6 +1,6 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -199,17 +199,17 @@ dropbearkey: $(dropbearkeyobjs) +@@ -198,17 +198,17 @@ dropbearkey: $(dropbearkeyobjs) dropbearconvert: $(dropbearconvertobjs) dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile @@ -22,7 +22,7 @@ # multi-binary compilation. -@@ -220,7 +220,7 @@ ifeq ($(MULTI),1) +@@ -219,7 +219,7 @@ ifeq ($(MULTI),1) endif dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile diff --git a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch index afa0ebb310..b774a38b1a 100644 --- a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch +++ b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch @@ -19,11 +19,9 @@ Signed-off-by: Petr Štetiar signkey.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -diff --git a/signkey.c b/signkey.c -index 92fe6a242cd0..d16ab174d83a 100644 --- a/signkey.c +++ b/signkey.c -@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *key, enum signature_type expect_sigtype, +@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *k sigtype = signature_type_from_name(type_name, type_name_len); m_free(type_name); From 0f7a3288e10fb244a33d80230e7b04b323668821 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sun, 15 Nov 2020 18:44:40 +0100 Subject: [PATCH 12/50] odhcpd: update to latest git HEAD fb55e80 dhcpv6-ia : write statefile atomically Signed-off-by: Hans Dedecker --- package/network/services/odhcpd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index 3f73141c44..9a4cd19bef 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcpd -PKG_RELEASE:=4 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git -PKG_SOURCE_DATE:=2020-11-01 -PKG_SOURCE_VERSION:=735c7836bfcc08f3ecd8cdaf1368665b8a241b94 -PKG_MIRROR_HASH:=887a2c07375dc5127b31edd71c281f48962d8a40e64995401baf648ed4c94b95 +PKG_SOURCE_DATE:=2020-11-15 +PKG_SOURCE_VERSION:=fb55e80394c51d7502bb278f57520dec15a11355 +PKG_MIRROR_HASH:=631d15fd7c93529fa33433380c4811dbacca9665864e5836c6daca0c7165f25a PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 From fe1f11ce320ffca521d758ec6f5d7916fb59aa8a Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Mon, 16 Nov 2020 14:06:12 +0800 Subject: [PATCH 13/50] ramips: mt7621: fix Telco X1 GPIO switches The GPIO base of MT7621 GPIO 0~31 is 480 on kernel 5.4 Fix the GPIO numbering. Signed-off-by: DENG Qingfang --- .../linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches index f809df7f2f..82bbdd24f6 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches @@ -11,7 +11,7 @@ mikrotik,routerboard-760igs) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "497" ;; telco-electronics,x1) - ucidef_add_gpio_switch "modem_reset" "Modem Reset" "16" + ucidef_add_gpio_switch "modem_reset" "Modem Reset" "496" ;; ubnt,edgerouter-x) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "480" From 4e885dd90af50e4ace6f4565a3616e107c4ba2b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Fri, 13 Nov 2020 20:23:00 +0100 Subject: [PATCH 14/50] mvebu: LS421DE: improve the HDD leds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve the HDD LEDs used for disk activity: - Use the trigger activity per ata channel Signed-off-by: Daniel González Cabanelas --- .../files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts index 4589886190..ebcc4692d5 100644 --- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts @@ -153,14 +153,14 @@ label = "ls421de:red:hdd1"; gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; default-state = "off"; - linux,default-trigger = "disk-activity"; + linux,default-trigger = "ata1"; }; hdd2_red { label = "ls421de:red:hdd2"; gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; default-state = "off"; - linux,default-trigger = "disk-activity"; + linux,default-trigger = "ata2"; }; }; From 2658008a2adcd86d9a45ee76bdec504898426254 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 16 Nov 2020 13:26:56 +0100 Subject: [PATCH 15/50] treewide: remove default-state off for LEDs default-state = "off" is default for LEDs, no need to specify it explicitly. https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/common.yaml Signed-off-by: Adrian Schmutzler --- .../001-ARM-dts-imx-Add-GW5907-board-support.patch | 3 +-- .../002-ARM-dts-imx-Add-GW5910-board-support.patch | 4 +--- .../003-ARM-dts-imx-Add-GW5913-board-support.patch | 3 +-- .../004-ARM-dts-imx-Add-GW5912-board-support.patch | 4 +--- .../boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts | 2 -- .../arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts | 2 -- .../linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch | 4 +--- .../patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch | 5 +---- .../files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts | 2 -- 9 files changed, 6 insertions(+), 23 deletions(-) diff --git a/target/linux/imx6/patches-5.4/001-ARM-dts-imx-Add-GW5907-board-support.patch b/target/linux/imx6/patches-5.4/001-ARM-dts-imx-Add-GW5907-board-support.patch index 133c3b9566..e830897704 100644 --- a/target/linux/imx6/patches-5.4/001-ARM-dts-imx-Add-GW5907-board-support.patch +++ b/target/linux/imx6/patches-5.4/001-ARM-dts-imx-Add-GW5907-board-support.patch @@ -80,7 +80,7 @@ Signed-off-by: Shawn Guo +}; --- /dev/null +++ b/arch/arm/boot/dts/imx6qdl-gw5907.dtsi -@@ -0,0 +1,399 @@ +@@ -0,0 +1,398 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019 Gateworks Corporation @@ -117,7 +117,6 @@ Signed-off-by: Shawn Guo + led1: user2 { + label = "user2"; + gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */ -+ default-state = "off"; + }; + }; + diff --git a/target/linux/imx6/patches-5.4/002-ARM-dts-imx-Add-GW5910-board-support.patch b/target/linux/imx6/patches-5.4/002-ARM-dts-imx-Add-GW5910-board-support.patch index 707577edc1..5c52bde70d 100644 --- a/target/linux/imx6/patches-5.4/002-ARM-dts-imx-Add-GW5910-board-support.patch +++ b/target/linux/imx6/patches-5.4/002-ARM-dts-imx-Add-GW5910-board-support.patch @@ -89,7 +89,7 @@ Signed-off-by: Shawn Guo +}; --- /dev/null +++ b/arch/arm/boot/dts/imx6qdl-gw5910.dtsi -@@ -0,0 +1,491 @@ +@@ -0,0 +1,489 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019 Gateworks Corporation @@ -129,13 +129,11 @@ Signed-off-by: Shawn Guo + led1: user2 { + label = "user2"; + gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */ -+ default-state = "off"; + }; + + led2: user3 { + label = "user3"; + gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */ -+ default-state = "off"; + }; + }; + diff --git a/target/linux/imx6/patches-5.4/003-ARM-dts-imx-Add-GW5913-board-support.patch b/target/linux/imx6/patches-5.4/003-ARM-dts-imx-Add-GW5913-board-support.patch index 07a7cbfc88..32f344c588 100644 --- a/target/linux/imx6/patches-5.4/003-ARM-dts-imx-Add-GW5913-board-support.patch +++ b/target/linux/imx6/patches-5.4/003-ARM-dts-imx-Add-GW5913-board-support.patch @@ -84,7 +84,7 @@ Signed-off-by: Shawn Guo +}; --- /dev/null +++ b/arch/arm/boot/dts/imx6qdl-gw5913.dtsi -@@ -0,0 +1,348 @@ +@@ -0,0 +1,347 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019 Gateworks Corporation @@ -121,7 +121,6 @@ Signed-off-by: Shawn Guo + led1: user2 { + label = "user2"; + gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */ -+ default-state = "off"; + }; + }; + diff --git a/target/linux/imx6/patches-5.4/004-ARM-dts-imx-Add-GW5912-board-support.patch b/target/linux/imx6/patches-5.4/004-ARM-dts-imx-Add-GW5912-board-support.patch index cf0ff9dbb2..da733ff357 100644 --- a/target/linux/imx6/patches-5.4/004-ARM-dts-imx-Add-GW5912-board-support.patch +++ b/target/linux/imx6/patches-5.4/004-ARM-dts-imx-Add-GW5912-board-support.patch @@ -87,7 +87,7 @@ Signed-off-by: Shawn Guo +}; --- /dev/null +++ b/arch/arm/boot/dts/imx6qdl-gw5912.dtsi -@@ -0,0 +1,461 @@ +@@ -0,0 +1,459 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019 Gateworks Corporation @@ -125,13 +125,11 @@ Signed-off-by: Shawn Guo + led1: user2 { + label = "user2"; + gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */ -+ default-state = "off"; + }; + + led2: user3 { + label = "user3"; + gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */ -+ default-state = "off"; + }; + }; + diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts index 2235306b2b..0a2814dbff 100644 --- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts @@ -59,13 +59,11 @@ green { label = "bpi-r64:pio:green"; gpios = <&pio 89 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; red { label = "bpi-r64:pio:red"; gpios = <&pio 88 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; }; diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts index 2589a349ad..c007fd717b 100644 --- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts @@ -66,13 +66,11 @@ green { label = "bpi-r64:pio:green"; gpios = <&pio 89 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; red { label = "bpi-r64:pio:red"; gpios = <&pio 88 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; }; diff --git a/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch b/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch index 906b661538..20e51d14ed 100644 --- a/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch +++ b/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch @@ -81,7 +81,7 @@ }; cpus { -@@ -40,23 +39,38 @@ +@@ -40,23 +39,36 @@ gpio-keys { compatible = "gpio-keys"; @@ -108,13 +108,11 @@ + green { + label = "bpi-r64:pio:green"; + gpios = <&pio 89 GPIO_ACTIVE_HIGH>; -+ default-state = "off"; + }; + + red { + label = "bpi-r64:pio:red"; + gpios = <&pio 88 GPIO_ACTIVE_HIGH>; -+ default-state = "off"; }; }; diff --git a/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch b/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch index 7def128daf..3cb1dab69f 100644 --- a/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch +++ b/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch @@ -44,7 +44,7 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS +}; --- /dev/null +++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi -@@ -0,0 +1,343 @@ +@@ -0,0 +1,340 @@ +/* + * Copyright 2018 Kristian Evensen + * @@ -132,13 +132,11 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS + led3 { + label = "u7623-01:green:led3"; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; -+ default-state = "off"; + }; + + led4 { + label = "u7623-01:green:led4"; + gpios = <&pio 15 GPIO_ACTIVE_LOW>; -+ default-state = "off"; + }; + }; +}; @@ -343,7 +341,6 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS + led@0 { + reg = <0>; + label = "led0"; -+ default-state = "off"; + }; + }; + }; diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts index ebcc4692d5..e804665792 100644 --- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts @@ -152,14 +152,12 @@ hdd1_red { label = "ls421de:red:hdd1"; gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; - default-state = "off"; linux,default-trigger = "ata1"; }; hdd2_red { label = "ls421de:red:hdd2"; gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; - default-state = "off"; linux,default-trigger = "ata2"; }; }; From 7661b837681febf1420e65c4b8133402ac0ac650 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 16 Nov 2020 13:35:51 +0100 Subject: [PATCH 16/50] mediatek: fix mixed indent in DTS files mediatek frequently had mixed indent (tabs vs. spaces) in DTS files and DTS file kernel patches (probably due to careless copy/paste). The harmonizes these cases to tabs-only, as usual for DTS(I). Signed-off-by: Adrian Schmutzler --- .../mt7622-bananapi-bpi-r64-rootdisk.dts | 12 +- .../mediatek/mt7622-elecom-wrc-2533gent.dts | 140 +++++++++--------- .../boot/dts/mediatek/mt7622-rfb1-ubi.dts | 62 ++++---- .../patches-5.4/0005-dts-mt7622-add-gsw.patch | 50 +++---- .../patches-5.4/0005-dts-mt7629-add-gsw.patch | 2 +- 5 files changed, 134 insertions(+), 132 deletions(-) diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts index 0a2814dbff..36d908652d 100644 --- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts @@ -256,15 +256,15 @@ }; &pcie0 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie0_pins>; - status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; }; &pcie1 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie1_pins>; - status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie1_pins>; + status = "okay"; }; &pio { diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts index a7b32a9f8b..2ac1c6a671 100644 --- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts @@ -156,19 +156,19 @@ regulator-always-on; }; - rtkgsw: rtkgsw@0 { - compatible = "mediatek,rtk-gsw"; + rtkgsw: rtkgsw@0 { + compatible = "mediatek,rtk-gsw"; mediatek,ethsys = <ðsys>; - mediatek,mdio = <&mdio>; - mediatek,reset-pin = <&pio 54 0>; - status = "okay"; - }; + mediatek,mdio = <&mdio>; + mediatek,reset-pin = <&pio 54 0>; + status = "okay"; + }; }; &pcie0 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie0_pins>; - status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; }; &slot0 { @@ -450,29 +450,31 @@ pinctrl-names = "default"; pinctrl-0 = <ð_pins>; gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "sgmii"; - fixed-link { - speed = <1000>; - full-duplex; - pause; - }; - }; - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - phy-mode = "rgmii"; - fixed-link { - speed = <1000>; - full-duplex; - pause; - }; - }; - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - }; + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "sgmii"; + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "rgmii"; + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; }; &i2c1 { @@ -513,50 +515,50 @@ reg = <0>; partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@0 { - label = "Preloader"; - reg = <0x00000 0x0080000>; - read-only; - }; + partition@0 { + label = "Preloader"; + reg = <0x00000 0x0080000>; + read-only; + }; - partition@80000 { - label = "ATF"; - reg = <0x80000 0x0040000>; - read-only; - }; + partition@80000 { + label = "ATF"; + reg = <0x80000 0x0040000>; + read-only; + }; - partition@c0000 { - label = "uboot"; - reg = <0xc0000 0x0080000>; - read-only; - }; + partition@c0000 { + label = "uboot"; + reg = <0xc0000 0x0080000>; + read-only; + }; - partition@140000 { - label = "uboot-env"; - reg = <0x140000 0x0080000>; - read-only; - }; + partition@140000 { + label = "uboot-env"; + reg = <0x140000 0x0080000>; + read-only; + }; - factory: partition@1c0000 { - label = "factory"; - reg = <0x1c0000 0x0040000>; - read-only; - }; + factory: partition@1c0000 { + label = "factory"; + reg = <0x1c0000 0x0040000>; + read-only; + }; - partition@200000 { - label = "firmware"; - reg = <0x200000 0x2000000>; - }; + partition@200000 { + label = "firmware"; + reg = <0x200000 0x2000000>; + }; - partition@2200000 { - label = "reserved"; - reg = <0x2200000 0x4000000>; - }; - }; + partition@2200000 { + label = "reserved"; + reg = <0x2200000 0x4000000>; + }; + }; }; }; diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts index c007fd717b..8b58c1e12f 100644 --- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts @@ -54,11 +54,11 @@ }; gsw: gsw@0 { - compatible = "mediatek,mt753x"; - mediatek,ethsys = <ðsys>; - #address-cells = <1>; - #size-cells = <0>; - }; + compatible = "mediatek,mt753x"; + mediatek,ethsys = <ðsys>; + #address-cells = <1>; + #size-cells = <0>; + }; leds { compatible = "gpio-leds"; @@ -152,34 +152,34 @@ }; &gsw { - mediatek,mdio = <&mdio>; - mediatek,portmap = "llllw"; - mediatek,mdio_master_pinmux = <0>; - reset-gpios = <&pio 54 0>; - interrupt-parent = <&pio>; - interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; - status = "okay"; + mediatek,mdio = <&mdio>; + mediatek,portmap = "llllw"; + mediatek,mdio_master_pinmux = <0>; + reset-gpios = <&pio 54 0>; + interrupt-parent = <&pio>; + interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; + status = "okay"; - port5: port@5 { - compatible = "mediatek,mt753x-port"; - reg = <5>; - phy-mode = "rgmii"; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; + port5: port@5 { + compatible = "mediatek,mt753x-port"; + reg = <5>; + phy-mode = "rgmii"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; - port6: port@6 { - compatible = "mediatek,mt753x-port"; - reg = <6>; - phy-mode = "sgmii"; - fixed-link { - speed = <2500>; - full-duplex; - }; - }; -}; + port6: port@6 { + compatible = "mediatek,mt753x-port"; + reg = <6>; + phy-mode = "sgmii"; + fixed-link { + speed = <2500>; + full-duplex; + }; + }; +}; &i2c1 { pinctrl-names = "default"; diff --git a/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch b/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch index 20e51d14ed..6b89a39668 100644 --- a/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch +++ b/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch @@ -19,33 +19,33 @@ }; +&gsw { -+ mediatek,mdio = <&mdio>; -+ mediatek,portmap = "wllll"; -+ mediatek,mdio_master_pinmux = <0>; -+ reset-gpios = <&pio 54 0>; -+ interrupt-parent = <&pio>; -+ interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; -+ status = "okay"; ++ mediatek,mdio = <&mdio>; ++ mediatek,portmap = "wllll"; ++ mediatek,mdio_master_pinmux = <0>; ++ reset-gpios = <&pio 54 0>; ++ interrupt-parent = <&pio>; ++ interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; ++ status = "okay"; + -+ port5: port@5 { -+ compatible = "mediatek,mt753x-port"; -+ reg = <5>; -+ phy-mode = "rgmii"; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+ }; ++ port5: port@5 { ++ compatible = "mediatek,mt753x-port"; ++ reg = <5>; ++ phy-mode = "rgmii"; ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; + -+ port6: port@6 { -+ compatible = "mediatek,mt753x-port"; -+ reg = <6>; -+ phy-mode = "sgmii"; -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ }; -+ }; ++ port6: port@6 { ++ compatible = "mediatek,mt753x-port"; ++ reg = <6>; ++ phy-mode = "sgmii"; ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++ }; +}; + &i2c1 { diff --git a/target/linux/mediatek/patches-5.4/0005-dts-mt7629-add-gsw.patch b/target/linux/mediatek/patches-5.4/0005-dts-mt7629-add-gsw.patch index 8c0f488508..773a69f052 100644 --- a/target/linux/mediatek/patches-5.4/0005-dts-mt7629-add-gsw.patch +++ b/target/linux/mediatek/patches-5.4/0005-dts-mt7629-add-gsw.patch @@ -17,7 +17,7 @@ + mediatek,ethsys = <ðsys>; + #address-cells = <1>; + #size-cells = <0>; -+ }; ++ }; + memory@40000000 { device_type = "memory"; From 03d178727aa0f60cd620f58d7df2578969e3c212 Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Fri, 13 Nov 2020 11:54:44 +0800 Subject: [PATCH 17/50] kernel: remove mvsw61xx swconfig driver All targets that used mvsw61xx have switched to upstream mv88e6xxx DSA driver, so it can be removed. Signed-off-by: DENG Qingfang --- package/kernel/linux/modules/netdevices.mk | 14 - target/linux/generic/config-5.4 | 1 - .../generic/files/drivers/net/phy/mvsw61xx.c | 1093 ----------------- .../generic/files/drivers/net/phy/mvsw61xx.h | 309 ----- .../700-swconfig_switch_drivers.patch | 9 +- 5 files changed, 2 insertions(+), 1424 deletions(-) delete mode 100644 target/linux/generic/files/drivers/net/phy/mvsw61xx.c delete mode 100644 target/linux/generic/files/drivers/net/phy/mvsw61xx.h diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 9374620b10..900e5ce63c 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -286,20 +286,6 @@ endef $(eval $(call KernelPackage,switch-bcm53xx-mdio)) -define KernelPackage/switch-mvsw61xx - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell 88E61xx switch support - DEPENDS:=+kmod-swconfig - KCONFIG:=CONFIG_MVSW61XX_PHY - FILES:=$(LINUX_DIR)/drivers/net/phy/mvsw61xx.ko - AUTOLOAD:=$(call AutoLoad,42,mvsw61xx) -endef - -define KernelPackage/switch-mvsw61xx/description - Marvell 88E61xx switch support -endef - -$(eval $(call KernelPackage,switch-mvsw61xx)) define KernelPackage/switch-ip17xx SUBMENU:=$(NETWORK_DEVICES_MENU) diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index 296e875a19..10d14f6be5 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -3279,7 +3279,6 @@ CONFIG_MULTIUSER=y # CONFIG_MV643XX_ETH is not set # CONFIG_MVMDIO is not set # CONFIG_MVNETA_BM is not set -# CONFIG_MVSW61XX_PHY is not set # CONFIG_MVSWITCH_PHY is not set # CONFIG_MV_XOR_V2 is not set # CONFIG_MWAVE is not set diff --git a/target/linux/generic/files/drivers/net/phy/mvsw61xx.c b/target/linux/generic/files/drivers/net/phy/mvsw61xx.c deleted file mode 100644 index 253ebff835..0000000000 --- a/target/linux/generic/files/drivers/net/phy/mvsw61xx.c +++ /dev/null @@ -1,1093 +0,0 @@ -/* - * Marvell 88E61xx switch driver - * - * Copyright (c) 2014 Claudio Leite - * Copyright (c) 2014 Nikita Nazarenko - * - * Based on code (c) 2008 Felix Fietkau - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License v2 as published by the - * Free Software Foundation - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mvsw61xx.h" - -MODULE_DESCRIPTION("Marvell 88E61xx Switch driver"); -MODULE_AUTHOR("Claudio Leite "); -MODULE_AUTHOR("Nikita Nazarenko "); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:mvsw61xx"); - -/* - * Register access is done through direct or indirect addressing, - * depending on how the switch is physically connected. - * - * Direct addressing: all port and global registers directly - * accessible via an address/register pair - * - * Indirect addressing: switch is mapped at a single address, - * port and global registers accessible via a single command/data - * register pair - */ - -static int -mvsw61xx_wait_mask_raw(struct mii_bus *bus, int addr, - int reg, u16 mask, u16 val) -{ - int i = 100; - u16 r; - - do { - r = bus->read(bus, addr, reg); - if ((r & mask) == val) - return 0; - } while (--i > 0); - - return -ETIMEDOUT; -} - -static u16 -r16(struct mii_bus *bus, bool indirect, int base_addr, int addr, int reg) -{ - u16 ind_addr; - - if (!indirect) - return bus->read(bus, addr, reg); - - /* Indirect read: First, make sure switch is free */ - mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, - MV_INDIRECT_INPROGRESS, 0); - - /* Load address and request read */ - ind_addr = MV_INDIRECT_READ | (addr << MV_INDIRECT_ADDR_S) | reg; - bus->write(bus, base_addr, MV_INDIRECT_REG_CMD, - ind_addr); - - /* Wait until it's ready */ - mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, - MV_INDIRECT_INPROGRESS, 0); - - /* Read the requested data */ - return bus->read(bus, base_addr, MV_INDIRECT_REG_DATA); -} - -static void -w16(struct mii_bus *bus, bool indirect, int base_addr, int addr, - int reg, u16 val) -{ - u16 ind_addr; - - if (!indirect) { - bus->write(bus, addr, reg, val); - return; - } - - /* Indirect write: First, make sure switch is free */ - mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, - MV_INDIRECT_INPROGRESS, 0); - - /* Load the data to be written */ - bus->write(bus, base_addr, MV_INDIRECT_REG_DATA, val); - - /* Wait again for switch to be free */ - mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, - MV_INDIRECT_INPROGRESS, 0); - - /* Load address, and issue write command */ - ind_addr = MV_INDIRECT_WRITE | (addr << MV_INDIRECT_ADDR_S) | reg; - bus->write(bus, base_addr, MV_INDIRECT_REG_CMD, - ind_addr); -} - -/* swconfig support */ - -static inline u16 -sr16(struct switch_dev *dev, int addr, int reg) -{ - struct mvsw61xx_state *state = get_state(dev); - - return r16(state->bus, state->is_indirect, state->base_addr, addr, reg); -} - -static inline void -sw16(struct switch_dev *dev, int addr, int reg, u16 val) -{ - struct mvsw61xx_state *state = get_state(dev); - - w16(state->bus, state->is_indirect, state->base_addr, addr, reg, val); -} - -static int -mvsw61xx_wait_mask_s(struct switch_dev *dev, int addr, - int reg, u16 mask, u16 val) -{ - int i = 100; - u16 r; - - do { - r = sr16(dev, addr, reg) & mask; - if (r == val) - return 0; - } while (--i > 0); - - return -ETIMEDOUT; -} - -static int -mvsw61xx_mdio_read(struct switch_dev *dev, int addr, int reg) -{ - sw16(dev, MV_GLOBAL2REG(SMI_OP), - MV_INDIRECT_READ | (addr << MV_INDIRECT_ADDR_S) | reg); - - if (mvsw61xx_wait_mask_s(dev, MV_GLOBAL2REG(SMI_OP), - MV_INDIRECT_INPROGRESS, 0) < 0) - return -ETIMEDOUT; - - return sr16(dev, MV_GLOBAL2REG(SMI_DATA)); -} - -static int -mvsw61xx_mdio_write(struct switch_dev *dev, int addr, int reg, u16 val) -{ - sw16(dev, MV_GLOBAL2REG(SMI_DATA), val); - - sw16(dev, MV_GLOBAL2REG(SMI_OP), - MV_INDIRECT_WRITE | (addr << MV_INDIRECT_ADDR_S) | reg); - - return mvsw61xx_wait_mask_s(dev, MV_GLOBAL2REG(SMI_OP), - MV_INDIRECT_INPROGRESS, 0) < 0; -} - -static int -mvsw61xx_mdio_page_read(struct switch_dev *dev, int port, int page, int reg) -{ - int ret; - - mvsw61xx_mdio_write(dev, port, MII_MV_PAGE, page); - ret = mvsw61xx_mdio_read(dev, port, reg); - mvsw61xx_mdio_write(dev, port, MII_MV_PAGE, 0); - - return ret; -} - -static void -mvsw61xx_mdio_page_write(struct switch_dev *dev, int port, int page, int reg, - u16 val) -{ - mvsw61xx_mdio_write(dev, port, MII_MV_PAGE, page); - mvsw61xx_mdio_write(dev, port, reg, val); - mvsw61xx_mdio_write(dev, port, MII_MV_PAGE, 0); -} - -static int -mvsw61xx_get_port_mask(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - char *buf = state->buf; - int port, len, i; - u16 reg; - - port = val->port_vlan; - reg = sr16(dev, MV_PORTREG(VLANMAP, port)) & MV_PORTS_MASK; - - len = sprintf(buf, "0x%04x: ", reg); - - for (i = 0; i < MV_PORTS; i++) { - if (reg & (1 << i)) - len += sprintf(buf + len, "%d ", i); - else if (i == port) - len += sprintf(buf + len, "(%d) ", i); - } - - val->value.s = buf; - - return 0; -} - -static int -mvsw61xx_get_port_qmode(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - val->value.i = state->ports[val->port_vlan].qmode; - - return 0; -} - -static int -mvsw61xx_set_port_qmode(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - state->ports[val->port_vlan].qmode = val->value.i; - - return 0; -} - -static int -mvsw61xx_get_port_pvid(struct switch_dev *dev, int port, int *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - *val = state->ports[port].pvid; - - return 0; -} - -static int -mvsw61xx_set_port_pvid(struct switch_dev *dev, int port, int val) -{ - struct mvsw61xx_state *state = get_state(dev); - - if (val < 0 || val >= MV_VLANS) - return -EINVAL; - - state->ports[port].pvid = (u16)val; - - return 0; -} - -static int -mvsw61xx_get_port_link(struct switch_dev *dev, int port, - struct switch_port_link *link) -{ - u16 status, speed; - - status = sr16(dev, MV_PORTREG(STATUS, port)); - - link->link = status & MV_PORT_STATUS_LINK; - if (!link->link) - return 0; - - link->duplex = status & MV_PORT_STATUS_FDX; - - speed = (status & MV_PORT_STATUS_SPEED_MASK) >> - MV_PORT_STATUS_SPEED_SHIFT; - - switch (speed) { - case MV_PORT_STATUS_SPEED_10: - link->speed = SWITCH_PORT_SPEED_10; - break; - case MV_PORT_STATUS_SPEED_100: - link->speed = SWITCH_PORT_SPEED_100; - break; - case MV_PORT_STATUS_SPEED_1000: - link->speed = SWITCH_PORT_SPEED_1000; - break; - } - - return 0; -} - -static int mvsw61xx_get_vlan_ports(struct switch_dev *dev, - struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - int i, j, mode, vno; - - vno = val->port_vlan; - - if (vno <= 0 || vno >= dev->vlans) - return -EINVAL; - - for (i = 0, j = 0; i < dev->ports; i++) { - if (state->vlans[vno].mask & (1 << i)) { - val->value.ports[j].id = i; - - mode = (state->vlans[vno].port_mode >> (i * 4)) & 0xf; - if (mode == MV_VTUCTL_EGRESS_TAGGED) - val->value.ports[j].flags = - (1 << SWITCH_PORT_FLAG_TAGGED); - else - val->value.ports[j].flags = 0; - - j++; - } - } - - val->len = j; - - return 0; -} - -static int mvsw61xx_set_vlan_ports(struct switch_dev *dev, - struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - int i, mode, pno, vno; - - vno = val->port_vlan; - - if (vno <= 0 || vno >= dev->vlans) - return -EINVAL; - - state->vlans[vno].mask = 0; - state->vlans[vno].port_mode = 0; - state->vlans[vno].port_sstate = 0; - - if(state->vlans[vno].vid == 0) - state->vlans[vno].vid = vno; - - for (i = 0; i < val->len; i++) { - pno = val->value.ports[i].id; - - state->vlans[vno].mask |= (1 << pno); - if (val->value.ports[i].flags & - (1 << SWITCH_PORT_FLAG_TAGGED)) - mode = MV_VTUCTL_EGRESS_TAGGED; - else - mode = MV_VTUCTL_EGRESS_UNTAGGED; - - state->vlans[vno].port_mode |= mode << (pno * 4); - state->vlans[vno].port_sstate |= - MV_STUCTL_STATE_FORWARDING << (pno * 4 + 2); - } - - /* - * DISCARD is nonzero, so it must be explicitly - * set on ports not in the VLAN. - */ - for (i = 0; i < dev->ports; i++) - if (!(state->vlans[vno].mask & (1 << i))) - state->vlans[vno].port_mode |= - MV_VTUCTL_DISCARD << (i * 4); - - return 0; -} - -static int mvsw61xx_get_vlan_port_based(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - int vno = val->port_vlan; - - if (vno <= 0 || vno >= dev->vlans) - return -EINVAL; - - if (state->vlans[vno].port_based) - val->value.i = 1; - else - val->value.i = 0; - - return 0; -} - -static int mvsw61xx_set_vlan_port_based(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - int vno = val->port_vlan; - - if (vno <= 0 || vno >= dev->vlans) - return -EINVAL; - - if (val->value.i == 1) - state->vlans[vno].port_based = true; - else - state->vlans[vno].port_based = false; - - return 0; -} - -static int mvsw61xx_get_vid(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - int vno = val->port_vlan; - - if (vno <= 0 || vno >= dev->vlans) - return -EINVAL; - - val->value.i = state->vlans[vno].vid; - - return 0; -} - -static int mvsw61xx_set_vid(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - int vno = val->port_vlan; - - if (vno <= 0 || vno >= dev->vlans) - return -EINVAL; - - state->vlans[vno].vid = val->value.i; - - return 0; -} - -static int mvsw61xx_get_enable_vlan(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - val->value.i = state->vlan_enabled; - - return 0; -} - -static int mvsw61xx_set_enable_vlan(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - state->vlan_enabled = val->value.i; - - return 0; -} - -static int mvsw61xx_get_mirror_rx_enable(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - val->value.i = state->mirror_rx; - - return 0; -} - -static int mvsw61xx_set_mirror_rx_enable(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - state->mirror_rx = val->value.i; - - return 0; -} - -static int mvsw61xx_get_mirror_tx_enable(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - val->value.i = state->mirror_tx; - - return 0; -} - -static int mvsw61xx_set_mirror_tx_enable(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - state->mirror_tx = val->value.i; - - return 0; -} - -static int mvsw61xx_get_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - val->value.i = state->monitor_port; - - return 0; -} - -static int mvsw61xx_set_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - state->monitor_port = val->value.i; - - return 0; -} - -static int mvsw61xx_get_mirror_source_port(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - val->value.i = state->source_port; - - return 0; -} - -static int mvsw61xx_set_mirror_source_port(struct switch_dev *dev, - const struct switch_attr *attr, struct switch_val *val) -{ - struct mvsw61xx_state *state = get_state(dev); - - state->source_port = val->value.i; - - return 0; -} - -static int mvsw61xx_vtu_program(struct switch_dev *dev) -{ - struct mvsw61xx_state *state = get_state(dev); - u16 v1, v2, s1, s2; - int i; - - /* Flush */ - mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(VTU_OP), - MV_VTUOP_INPROGRESS, 0); - sw16(dev, MV_GLOBALREG(VTU_OP), - MV_VTUOP_INPROGRESS | MV_VTUOP_PURGE); - - /* Write VLAN table */ - for (i = 1; i < dev->vlans; i++) { - if (state->vlans[i].mask == 0 || - state->vlans[i].vid == 0 || - state->vlans[i].port_based == true) - continue; - - mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(VTU_OP), - MV_VTUOP_INPROGRESS, 0); - - /* Write per-VLAN port state into STU */ - s1 = (u16) (state->vlans[i].port_sstate & 0xffff); - s2 = (u16) ((state->vlans[i].port_sstate >> 16) & 0xffff); - - sw16(dev, MV_GLOBALREG(VTU_VID), MV_VTU_VID_VALID); - sw16(dev, MV_GLOBALREG(VTU_SID), i); - sw16(dev, MV_GLOBALREG(VTU_DATA1), s1); - sw16(dev, MV_GLOBALREG(VTU_DATA2), s2); - sw16(dev, MV_GLOBALREG(VTU_DATA3), 0); - - sw16(dev, MV_GLOBALREG(VTU_OP), - MV_VTUOP_INPROGRESS | MV_VTUOP_STULOAD); - mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(VTU_OP), - MV_VTUOP_INPROGRESS, 0); - - /* Write VLAN information into VTU */ - v1 = (u16) (state->vlans[i].port_mode & 0xffff); - v2 = (u16) ((state->vlans[i].port_mode >> 16) & 0xffff); - - sw16(dev, MV_GLOBALREG(VTU_VID), - MV_VTU_VID_VALID | state->vlans[i].vid); - sw16(dev, MV_GLOBALREG(VTU_SID), i); - sw16(dev, MV_GLOBALREG(VTU_FID), i); - sw16(dev, MV_GLOBALREG(VTU_DATA1), v1); - sw16(dev, MV_GLOBALREG(VTU_DATA2), v2); - sw16(dev, MV_GLOBALREG(VTU_DATA3), 0); - - sw16(dev, MV_GLOBALREG(VTU_OP), - MV_VTUOP_INPROGRESS | MV_VTUOP_LOAD); - mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(VTU_OP), - MV_VTUOP_INPROGRESS, 0); - } - - return 0; -} - -static void mvsw61xx_vlan_port_config(struct switch_dev *dev, int vno) -{ - struct mvsw61xx_state *state = get_state(dev); - int i, mode; - - for (i = 0; i < dev->ports; i++) { - if (!(state->vlans[vno].mask & (1 << i))) - continue; - - mode = (state->vlans[vno].port_mode >> (i * 4)) & 0xf; - - if(mode != MV_VTUCTL_EGRESS_TAGGED) - state->ports[i].pvid = state->vlans[vno].vid; - - if (state->vlans[vno].port_based) { - state->ports[i].mask |= state->vlans[vno].mask; - state->ports[i].fdb = vno; - } - else - state->ports[i].qmode = MV_8021Q_MODE_SECURE; - } -} - -static int mvsw61xx_update_state(struct switch_dev *dev) -{ - struct mvsw61xx_state *state = get_state(dev); - int i; - u16 reg; - - if (!state->registered) - return -EINVAL; - - /* - * Set 802.1q-only mode if vlan_enabled is true. - * - * Without this, even if 802.1q is enabled for - * a port/VLAN, it still depends on the port-based - * VLAN mask being set. - * - * With this setting, port-based VLANs are still - * functional, provided the VID is not in the VTU. - */ - reg = sr16(dev, MV_GLOBAL2REG(SDET_POLARITY)); - - if (state->vlan_enabled) - reg |= MV_8021Q_VLAN_ONLY; - else - reg &= ~MV_8021Q_VLAN_ONLY; - - sw16(dev, MV_GLOBAL2REG(SDET_POLARITY), reg); - - /* - * Set port-based VLAN masks on each port - * based only on VLAN definitions known to - * the driver (i.e. in state). - * - * This means any pre-existing port mapping is - * wiped out once our driver is initialized. - */ - for (i = 0; i < dev->ports; i++) { - state->ports[i].mask = 0; - state->ports[i].qmode = MV_8021Q_MODE_DISABLE; - } - - for (i = 0; i < dev->vlans; i++) - mvsw61xx_vlan_port_config(dev, i); - - for (i = 0; i < dev->ports; i++) { - reg = sr16(dev, MV_PORTREG(VLANID, i)) & ~MV_PVID_MASK; - reg |= state->ports[i].pvid; - sw16(dev, MV_PORTREG(VLANID, i), reg); - - state->ports[i].mask &= ~(1 << i); - - /* set default forwarding DB number and port mask */ - reg = sr16(dev, MV_PORTREG(CONTROL1, i)) & ~MV_FDB_HI_MASK; - reg |= (state->ports[i].fdb >> MV_FDB_HI_SHIFT) & - MV_FDB_HI_MASK; - sw16(dev, MV_PORTREG(CONTROL1, i), reg); - - reg = ((state->ports[i].fdb & 0xf) << MV_FDB_LO_SHIFT) | - state->ports[i].mask; - sw16(dev, MV_PORTREG(VLANMAP, i), reg); - - reg = sr16(dev, MV_PORTREG(CONTROL2, i)) & - ~MV_8021Q_MODE_MASK; - reg |= state->ports[i].qmode << MV_8021Q_MODE_SHIFT; - sw16(dev, MV_PORTREG(CONTROL2, i), reg); - } - - mvsw61xx_vtu_program(dev); - - /* port mirroring */ - /* reset all mirror registers */ - for (i = 0; i < dev->ports; i++) { - reg = sr16(dev, MV_PORTREG(CONTROL2, i)); - reg &= ~(MV_MIRROR_RX_SRC_MASK | MV_MIRROR_TX_SRC_MASK); - sw16(dev, MV_PORTREG(CONTROL2, i), reg); - } - reg = sr16(dev, MV_GLOBALREG(MONITOR_CTRL)); - reg |= MV_MIRROR_RX_DEST_MASK | MV_MIRROR_TX_DEST_MASK; - sw16(dev, MV_GLOBALREG(MONITOR_CTRL), reg); - - /* now enable mirroring if necessary */ - if (state->mirror_rx) { - /* set ingress monitor source */ - reg = sr16(dev, MV_PORTREG(CONTROL2, state->source_port)) & ~MV_MIRROR_RX_SRC_MASK; - reg |= state->mirror_rx << MV_MIRROR_RX_SRC_SHIFT; - sw16(dev, MV_PORTREG(CONTROL2, state->source_port), reg); - /* set ingress monitor destination */ - reg = sr16(dev, MV_GLOBALREG(MONITOR_CTRL)) & ~MV_MIRROR_RX_DEST_MASK; - reg |= state->monitor_port << MV_MIRROR_RX_DEST_SHIFT; - sw16(dev, MV_GLOBALREG(MONITOR_CTRL), reg); - } - - if (state->mirror_tx) { - /* set egress monitor source */ - reg = sr16(dev, MV_PORTREG(CONTROL2, state->source_port)) & ~MV_MIRROR_TX_SRC_MASK; - reg |= state->mirror_tx << MV_MIRROR_TX_SRC_SHIFT; - sw16(dev, MV_PORTREG(CONTROL2, state->source_port), reg); - /* set egress monitor destination */ - reg = sr16(dev, MV_GLOBALREG(MONITOR_CTRL)) & ~MV_MIRROR_TX_DEST_MASK; - reg |= state->monitor_port << MV_MIRROR_TX_DEST_SHIFT; - sw16(dev, MV_GLOBALREG(MONITOR_CTRL), reg); - } - - return 0; -} - -static int mvsw61xx_apply(struct switch_dev *dev) -{ - return mvsw61xx_update_state(dev); -} - -static void mvsw61xx_enable_serdes(struct switch_dev *dev) -{ - int bmcr = mvsw61xx_mdio_page_read(dev, MV_REG_FIBER_SERDES, - MV_PAGE_FIBER_SERDES, MII_BMCR); - if (bmcr < 0) - return; - - if (bmcr & BMCR_PDOWN) - mvsw61xx_mdio_page_write(dev, MV_REG_FIBER_SERDES, - MV_PAGE_FIBER_SERDES, MII_BMCR, - bmcr & ~BMCR_PDOWN); -} - -static int _mvsw61xx_reset(struct switch_dev *dev, bool full) -{ - struct mvsw61xx_state *state = get_state(dev); - int i; - u16 reg; - - /* Disable all ports before reset */ - for (i = 0; i < dev->ports; i++) { - reg = sr16(dev, MV_PORTREG(CONTROL, i)) & - ~MV_PORTCTRL_FORWARDING; - sw16(dev, MV_PORTREG(CONTROL, i), reg); - } - - reg = sr16(dev, MV_GLOBALREG(CONTROL)) | MV_CONTROL_RESET; - - sw16(dev, MV_GLOBALREG(CONTROL), reg); - if (mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(CONTROL), - MV_CONTROL_RESET, 0) < 0) - return -ETIMEDOUT; - - for (i = 0; i < dev->ports; i++) { - state->ports[i].fdb = 0; - state->ports[i].qmode = 0; - state->ports[i].mask = 0; - state->ports[i].pvid = 0; - - /* Force flow control off */ - reg = sr16(dev, MV_PORTREG(PHYCTL, i)) & ~MV_PHYCTL_FC_MASK; - reg |= MV_PHYCTL_FC_DISABLE; - sw16(dev, MV_PORTREG(PHYCTL, i), reg); - - /* Set port association vector */ - sw16(dev, MV_PORTREG(ASSOC, i), (1 << i)); - - /* power up phys */ - if (full && i < 5) { - mvsw61xx_mdio_write(dev, i, MII_MV_SPEC_CTRL, - MV_SPEC_MDI_CROSS_AUTO | - MV_SPEC_ENERGY_DETECT | - MV_SPEC_DOWNSHIFT_COUNTER); - mvsw61xx_mdio_write(dev, i, MII_BMCR, BMCR_RESET | - BMCR_ANENABLE | BMCR_FULLDPLX | - BMCR_SPEED1000); - } - - /* enable SerDes if necessary */ - if (full && i >= 5 && state->model == MV_IDENT_VALUE_6176) { - u16 sts = sr16(dev, MV_PORTREG(STATUS, i)); - u16 mode = sts & MV_PORT_STATUS_CMODE_MASK; - - if (mode == MV_PORT_STATUS_CMODE_100BASE_X || - mode == MV_PORT_STATUS_CMODE_1000BASE_X || - mode == MV_PORT_STATUS_CMODE_SGMII) { - mvsw61xx_enable_serdes(dev); - } - } - } - - for (i = 0; i < dev->vlans; i++) { - state->vlans[i].port_based = false; - state->vlans[i].mask = 0; - state->vlans[i].vid = 0; - state->vlans[i].port_mode = 0; - state->vlans[i].port_sstate = 0; - } - - state->vlan_enabled = 0; - - state->mirror_rx = false; - state->mirror_tx = false; - state->source_port = 0; - state->monitor_port = 0; - - mvsw61xx_update_state(dev); - - /* Re-enable ports */ - for (i = 0; i < dev->ports; i++) { - reg = sr16(dev, MV_PORTREG(CONTROL, i)) | - MV_PORTCTRL_FORWARDING; - sw16(dev, MV_PORTREG(CONTROL, i), reg); - } - - return 0; -} - -static int mvsw61xx_reset(struct switch_dev *dev) -{ - return _mvsw61xx_reset(dev, false); -} - -enum { - MVSW61XX_VLAN_PORT_BASED, - MVSW61XX_VLAN_ID, -}; - -enum { - MVSW61XX_PORT_MASK, - MVSW61XX_PORT_QMODE, -}; - -static const struct switch_attr mvsw61xx_global[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_vlan", - .description = "Enable 802.1q VLAN support", - .get = mvsw61xx_get_enable_vlan, - .set = mvsw61xx_set_enable_vlan, - }, - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_rx", - .description = "Enable mirroring of RX packets", - .set = mvsw61xx_set_mirror_rx_enable, - .get = mvsw61xx_get_mirror_rx_enable, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_tx", - .description = "Enable mirroring of TX packets", - .set = mvsw61xx_set_mirror_tx_enable, - .get = mvsw61xx_get_mirror_tx_enable, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "mirror_monitor_port", - .description = "Mirror monitor port", - .set = mvsw61xx_set_mirror_monitor_port, - .get = mvsw61xx_get_mirror_monitor_port, - .max = MV_PORTS - 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "mirror_source_port", - .description = "Mirror source port", - .set = mvsw61xx_set_mirror_source_port, - .get = mvsw61xx_get_mirror_source_port, - .max = MV_PORTS - 1 - }, -}; - -static const struct switch_attr mvsw61xx_vlan[] = { - [MVSW61XX_VLAN_PORT_BASED] = { - .id = MVSW61XX_VLAN_PORT_BASED, - .type = SWITCH_TYPE_INT, - .name = "port_based", - .description = "Use port-based (non-802.1q) VLAN only", - .get = mvsw61xx_get_vlan_port_based, - .set = mvsw61xx_set_vlan_port_based, - }, - [MVSW61XX_VLAN_ID] = { - .id = MVSW61XX_VLAN_ID, - .type = SWITCH_TYPE_INT, - .name = "vid", - .description = "Get/set VLAN ID", - .get = mvsw61xx_get_vid, - .set = mvsw61xx_set_vid, - }, -}; - -static const struct switch_attr mvsw61xx_port[] = { - [MVSW61XX_PORT_MASK] = { - .id = MVSW61XX_PORT_MASK, - .type = SWITCH_TYPE_STRING, - .description = "Port-based VLAN mask", - .name = "mask", - .get = mvsw61xx_get_port_mask, - .set = NULL, - }, - [MVSW61XX_PORT_QMODE] = { - .id = MVSW61XX_PORT_QMODE, - .type = SWITCH_TYPE_INT, - .description = "802.1q mode: 0=off/1=fallback/2=check/3=secure", - .name = "qmode", - .get = mvsw61xx_get_port_qmode, - .set = mvsw61xx_set_port_qmode, - }, -}; - -static const struct switch_dev_ops mvsw61xx_ops = { - .attr_global = { - .attr = mvsw61xx_global, - .n_attr = ARRAY_SIZE(mvsw61xx_global), - }, - .attr_vlan = { - .attr = mvsw61xx_vlan, - .n_attr = ARRAY_SIZE(mvsw61xx_vlan), - }, - .attr_port = { - .attr = mvsw61xx_port, - .n_attr = ARRAY_SIZE(mvsw61xx_port), - }, - .get_port_link = mvsw61xx_get_port_link, - .get_port_pvid = mvsw61xx_get_port_pvid, - .set_port_pvid = mvsw61xx_set_port_pvid, - .get_vlan_ports = mvsw61xx_get_vlan_ports, - .set_vlan_ports = mvsw61xx_set_vlan_ports, - .apply_config = mvsw61xx_apply, - .reset_switch = mvsw61xx_reset, -}; - -/* end swconfig stuff */ - -static int mvsw61xx_probe(struct platform_device *pdev) -{ - struct mvsw61xx_state *state; - struct device_node *np = pdev->dev.of_node; - struct device_node *mdio; - char *model_str; - u32 val; - int err; - - state = kzalloc(sizeof(*state), GFP_KERNEL); - if (!state) - return -ENOMEM; - - mdio = of_parse_phandle(np, "mii-bus", 0); - if (!mdio) { - dev_err(&pdev->dev, "Couldn't get MII bus handle\n"); - err = -ENODEV; - goto out_err; - } - - state->bus = of_mdio_find_bus(mdio); - if (!state->bus) { - dev_err(&pdev->dev, "Couldn't find MII bus from handle\n"); - err = -ENODEV; - goto out_err; - } - - state->is_indirect = of_property_read_bool(np, "is-indirect"); - - if (state->is_indirect) { - if (of_property_read_u32(np, "reg", &val)) { - dev_err(&pdev->dev, "Switch address not specified\n"); - err = -ENODEV; - goto out_err; - } - - state->base_addr = val; - } else { - state->base_addr = MV_BASE; - } - - state->model = r16(state->bus, state->is_indirect, state->base_addr, - MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; - - switch(state->model) { - case MV_IDENT_VALUE_6171: - model_str = MV_IDENT_STR_6171; - break; - case MV_IDENT_VALUE_6172: - model_str = MV_IDENT_STR_6172; - break; - case MV_IDENT_VALUE_6176: - model_str = MV_IDENT_STR_6176; - break; - case MV_IDENT_VALUE_6352: - model_str = MV_IDENT_STR_6352; - break; - default: - dev_err(&pdev->dev, "No compatible switch found at 0x%02x\n", - state->base_addr); - err = -ENODEV; - goto out_err; - } - - platform_set_drvdata(pdev, state); - dev_info(&pdev->dev, "Found %s at %s:%02x\n", model_str, - state->bus->id, state->base_addr); - - dev_info(&pdev->dev, "Using %sdirect addressing\n", - (state->is_indirect ? "in" : "")); - - if (of_property_read_u32(np, "cpu-port-0", &val)) { - dev_err(&pdev->dev, "CPU port not set\n"); - err = -ENODEV; - goto out_err; - } - - state->cpu_port0 = val; - - if (!of_property_read_u32(np, "cpu-port-1", &val)) - state->cpu_port1 = val; - else - state->cpu_port1 = -1; - - state->dev.vlans = MV_VLANS; - state->dev.cpu_port = state->cpu_port0; - state->dev.ports = MV_PORTS; - state->dev.name = model_str; - state->dev.ops = &mvsw61xx_ops; - state->dev.alias = dev_name(&pdev->dev); - - _mvsw61xx_reset(&state->dev, true); - - err = register_switch(&state->dev, NULL); - if (err < 0) - goto out_err; - - state->registered = true; - - return 0; -out_err: - kfree(state); - return err; -} - -static int -mvsw61xx_remove(struct platform_device *pdev) -{ - struct mvsw61xx_state *state = platform_get_drvdata(pdev); - - if (state->registered) - unregister_switch(&state->dev); - - kfree(state); - - return 0; -} - -static const struct of_device_id mvsw61xx_match[] = { - { .compatible = "marvell,88e6171" }, - { .compatible = "marvell,88e6172" }, - { .compatible = "marvell,88e6176" }, - { .compatible = "marvell,88e6352" }, - { } -}; -MODULE_DEVICE_TABLE(of, mvsw61xx_match); - -static struct platform_driver mvsw61xx_driver = { - .probe = mvsw61xx_probe, - .remove = mvsw61xx_remove, - .driver = { - .name = "mvsw61xx", - .of_match_table = of_match_ptr(mvsw61xx_match), - .owner = THIS_MODULE, - }, -}; - -static int __init mvsw61xx_module_init(void) -{ - return platform_driver_register(&mvsw61xx_driver); -} -late_initcall(mvsw61xx_module_init); - -static void __exit mvsw61xx_module_exit(void) -{ - platform_driver_unregister(&mvsw61xx_driver); -} -module_exit(mvsw61xx_module_exit); diff --git a/target/linux/generic/files/drivers/net/phy/mvsw61xx.h b/target/linux/generic/files/drivers/net/phy/mvsw61xx.h deleted file mode 100644 index 545e2dd660..0000000000 --- a/target/linux/generic/files/drivers/net/phy/mvsw61xx.h +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Marvell 88E61xx switch driver - * - * Copyright (c) 2014 Claudio Leite - * Copyright (c) 2014 Nikita Nazarenko - * - * Based on code (c) 2008 Felix Fietkau - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License v2 as published by the - * Free Software Foundation - */ - -#ifndef __MVSW61XX_H -#define __MVSW61XX_H - -#define MV_PORTS 7 -#define MV_PORTS_MASK ((1 << MV_PORTS) - 1) - -#define MV_BASE 0x10 - -#define MV_SWITCHPORT_BASE 0x10 -#define MV_SWITCHPORT(_n) (MV_SWITCHPORT_BASE + (_n)) -#define MV_SWITCHREGS (MV_BASE + 0xb) - -#define MV_VLANS 64 - -enum { - MV_PORT_STATUS = 0x00, - MV_PORT_PHYCTL = 0x01, - MV_PORT_JAMCTL = 0x02, - MV_PORT_IDENT = 0x03, - MV_PORT_CONTROL = 0x04, - MV_PORT_CONTROL1 = 0x05, - MV_PORT_VLANMAP = 0x06, - MV_PORT_VLANID = 0x07, - MV_PORT_CONTROL2 = 0x08, - MV_PORT_ASSOC = 0x0b, - MV_PORT_RX_DISCARD_LOW = 0x10, - MV_PORT_RX_DISCARD_HIGH = 0x11, - MV_PORT_IN_FILTERED = 0x12, - MV_PORT_OUT_ACCEPTED = 0x13, -}; -#define MV_PORTREG(_type, _port) MV_SWITCHPORT(_port), MV_PORT_##_type - -enum { - MV_PORT_STATUS_FDX = (1 << 10), - MV_PORT_STATUS_LINK = (1 << 11), -}; - -enum { - MV_PORT_STATUS_CMODE_100BASE_X = 0x8, - MV_PORT_STATUS_CMODE_1000BASE_X = 0x9, - MV_PORT_STATUS_CMODE_SGMII = 0xa, -}; - -#define MV_PORT_STATUS_CMODE_MASK 0xf - -enum { - MV_PORT_STATUS_SPEED_10 = 0x00, - MV_PORT_STATUS_SPEED_100 = 0x01, - MV_PORT_STATUS_SPEED_1000 = 0x02, -}; -#define MV_PORT_STATUS_SPEED_SHIFT 8 -#define MV_PORT_STATUS_SPEED_MASK (3 << 8) - -enum { - MV_PORTCTRL_DISABLED = (0 << 0), - MV_PORTCTRL_BLOCKING = (1 << 0), - MV_PORTCTRL_LEARNING = (2 << 0), - MV_PORTCTRL_FORWARDING = (3 << 0), - MV_PORTCTRL_VLANTUN = (1 << 7), - MV_PORTCTRL_EGRESS = (1 << 12), -}; - -#define MV_PHYCTL_FC_MASK (3 << 6) - -enum { - MV_PHYCTL_FC_ENABLE = (3 << 6), - MV_PHYCTL_FC_DISABLE = (1 << 6), -}; - -enum { - MV_8021Q_EGRESS_UNMODIFIED = 0x00, - MV_8021Q_EGRESS_UNTAGGED = 0x01, - MV_8021Q_EGRESS_TAGGED = 0x02, - MV_8021Q_EGRESS_ADDTAG = 0x03, -}; - -#define MV_8021Q_MODE_SHIFT 10 -#define MV_8021Q_MODE_MASK (0x3 << MV_8021Q_MODE_SHIFT) - -enum { - MV_8021Q_MODE_DISABLE = 0x00, - MV_8021Q_MODE_FALLBACK = 0x01, - MV_8021Q_MODE_CHECK = 0x02, - MV_8021Q_MODE_SECURE = 0x03, -}; - -enum { - MV_8021Q_VLAN_ONLY = (1 << 15), -}; - -#define MV_PORTASSOC_MONITOR (1 << 15) - -enum { - MV_SWITCH_ATU_FID0 = 0x01, - MV_SWITCH_ATU_FID1 = 0x02, - MV_SWITCH_ATU_SID = 0x03, - MV_SWITCH_CTRL = 0x04, - MV_SWITCH_ATU_CTRL = 0x0a, - MV_SWITCH_ATU_OP = 0x0b, - MV_SWITCH_ATU_DATA = 0x0c, - MV_SWITCH_ATU_MAC0 = 0x0d, - MV_SWITCH_ATU_MAC1 = 0x0e, - MV_SWITCH_ATU_MAC2 = 0x0f, - MV_SWITCH_GLOBAL = 0x1b, - MV_SWITCH_GLOBAL2 = 0x1c, -}; -#define MV_SWITCHREG(_type) MV_SWITCHREGS, MV_SWITCH_##_type - -enum { - MV_SWITCHCTL_EEIE = (1 << 0), - MV_SWITCHCTL_PHYIE = (1 << 1), - MV_SWITCHCTL_ATUDONE = (1 << 2), - MV_SWITCHCTL_ATUIE = (1 << 3), - MV_SWITCHCTL_CTRMODE = (1 << 8), - MV_SWITCHCTL_RELOAD = (1 << 9), - MV_SWITCHCTL_MSIZE = (1 << 10), - MV_SWITCHCTL_DROP = (1 << 13), -}; - -enum { -#define MV_ATUCTL_AGETIME_MIN 16 -#define MV_ATUCTL_AGETIME_MAX 4080 -#define MV_ATUCTL_AGETIME(_n) ((((_n) / 16) & 0xff) << 4) - MV_ATUCTL_ATU_256 = (0 << 12), - MV_ATUCTL_ATU_512 = (1 << 12), - MV_ATUCTL_ATU_1K = (2 << 12), - MV_ATUCTL_ATUMASK = (3 << 12), - MV_ATUCTL_NO_LEARN = (1 << 14), - MV_ATUCTL_RESET = (1 << 15), -}; - -enum { -#define MV_ATUOP_DBNUM(_n) ((_n) & 0x0f) - MV_ATUOP_NOOP = (0 << 12), - MV_ATUOP_FLUSH_ALL = (1 << 12), - MV_ATUOP_FLUSH_U = (2 << 12), - MV_ATUOP_LOAD_DB = (3 << 12), - MV_ATUOP_GET_NEXT = (4 << 12), - MV_ATUOP_FLUSH_DB = (5 << 12), - MV_ATUOP_FLUSH_DB_UU = (6 << 12), - MV_ATUOP_INPROGRESS = (1 << 15), -}; - -enum { - MV_GLOBAL_STATUS = 0x00, - MV_GLOBAL_ATU_FID = 0x01, - MV_GLOBAL_VTU_FID = 0x02, - MV_GLOBAL_VTU_SID = 0x03, - MV_GLOBAL_CONTROL = 0x04, - MV_GLOBAL_VTU_OP = 0x05, - MV_GLOBAL_VTU_VID = 0x06, - MV_GLOBAL_VTU_DATA1 = 0x07, - MV_GLOBAL_VTU_DATA2 = 0x08, - MV_GLOBAL_VTU_DATA3 = 0x09, - MV_GLOBAL_MONITOR_CTRL = 0x1a, - MV_GLOBAL_CONTROL2 = 0x1c, -}; -#define MV_GLOBALREG(_type) MV_SWITCH_GLOBAL, MV_GLOBAL_##_type - -enum { - MV_GLOBAL2_SMI_OP = 0x18, - MV_GLOBAL2_SMI_DATA = 0x19, - MV_GLOBAL2_SDET_POLARITY = 0x1d, -}; -#define MV_GLOBAL2REG(_type) MV_SWITCH_GLOBAL2, MV_GLOBAL2_##_type - -enum { - MV_VTU_VID_VALID = (1 << 12), -}; - -enum { - MV_VTUOP_PURGE = (1 << 12), - MV_VTUOP_LOAD = (3 << 12), - MV_VTUOP_INPROGRESS = (1 << 15), - MV_VTUOP_STULOAD = (5 << 12), - MV_VTUOP_VTU_GET_NEXT = (4 << 12), - MV_VTUOP_STU_GET_NEXT = (6 << 12), - MV_VTUOP_GET_VIOLATION = (7 << 12), -}; - -enum { - MV_CONTROL_RESET = (1 << 15), - MV_CONTROL_PPU_ENABLE = (1 << 14), -}; - -enum { - MV_VTUCTL_EGRESS_UNMODIFIED = (0 << 0), - MV_VTUCTL_EGRESS_UNTAGGED = (1 << 0), - MV_VTUCTL_EGRESS_TAGGED = (2 << 0), - MV_VTUCTL_DISCARD = (3 << 0), -}; - -enum { - MV_STUCTL_STATE_DISABLED = (0 << 0), - MV_STUCTL_STATE_BLOCKING = (1 << 0), - MV_STUCTL_STATE_LEARNING = (2 << 0), - MV_STUCTL_STATE_FORWARDING = (3 << 0), -}; - -enum { - MV_INDIRECT_REG_CMD = 0, - MV_INDIRECT_REG_DATA = 1, -}; - -enum { - MV_INDIRECT_INPROGRESS = 0x8000, - MV_INDIRECT_WRITE = 0x9400, - MV_INDIRECT_READ = 0x9800, -}; -#define MV_INDIRECT_ADDR_S 5 - -#define MV_IDENT_MASK 0xfff0 - -#define MV_IDENT_VALUE_6171 0x1710 -#define MV_IDENT_STR_6171 "MV88E6171" - -#define MV_IDENT_VALUE_6172 0x1720 -#define MV_IDENT_STR_6172 "MV88E6172" - -#define MV_IDENT_VALUE_6176 0x1760 -#define MV_IDENT_STR_6176 "MV88E6176" - -#define MV_IDENT_VALUE_6352 0x3520 -#define MV_IDENT_STR_6352 "MV88E6352" - -#define MV_PVID_MASK 0x0fff - -#define MV_FDB_HI_MASK 0x00ff -#define MV_FDB_LO_MASK 0xf000 -#define MV_FDB_HI_SHIFT 4 -#define MV_FDB_LO_SHIFT 12 - -#define MV_MIRROR_RX_DEST_MASK 0xf000 -#define MV_MIRROR_TX_DEST_MASK 0x0f00 -#define MV_MIRROR_RX_DEST_SHIFT 12 -#define MV_MIRROR_TX_DEST_SHIFT 8 - -#define MV_MIRROR_RX_SRC_SHIFT 4 -#define MV_MIRROR_RX_SRC_MASK (1 << MV_MIRROR_RX_SRC_SHIFT) -#define MV_MIRROR_TX_SRC_SHIFT 5 -#define MV_MIRROR_TX_SRC_MASK (1 << MV_MIRROR_TX_SRC_SHIFT) - -/* Marvell Specific PHY register */ -#define MII_MV_SPEC_CTRL 16 -enum { - MV_SPEC_MDI_CROSS_AUTO = (0x6 << 4), - MV_SPEC_ENERGY_DETECT = (0x3 << 8), - MV_SPEC_DOWNSHIFT_COUNTER = (0x3 << 12), -}; - -#define MII_MV_PAGE 22 - -#define MV_REG_FIBER_SERDES 0xf -#define MV_PAGE_FIBER_SERDES 0x1 - -struct mvsw61xx_state { - struct switch_dev dev; - struct mii_bus *bus; - int base_addr; - u16 model; - - bool registered; - bool is_indirect; - - int cpu_port0; - int cpu_port1; - - int vlan_enabled; - struct port_state { - u16 fdb; - u16 pvid; - u16 mask; - u8 qmode; - } ports[MV_PORTS]; - - struct vlan_state { - bool port_based; - - u16 mask; - u16 vid; - u32 port_mode; - u32 port_sstate; - } vlans[MV_VLANS]; - - /* mirroring */ - bool mirror_rx; - bool mirror_tx; - int source_port; - int monitor_port; - - char buf[128]; -}; - -#define get_state(_dev) container_of((_dev), struct mvsw61xx_state, dev) - -#endif diff --git a/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch b/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch index ddb642728b..f30ad81e4e 100644 --- a/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch +++ b/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -250,6 +250,89 @@ config LED_TRIGGER_PHY +@@ -250,6 +250,85 @@ config LED_TRIGGER_PHY for any speed known to the PHY. @@ -54,10 +54,6 @@ Signed-off-by: Felix Fietkau + tristate "Driver for Marvell 88E6060 switches" + select ETHERNET_PACKET_MANGLE + -+config MVSW61XX_PHY -+ tristate "Driver for Marvell 88E6171/6172 switches" -+ select SWCONFIG -+ +config PSB6970_PHY + tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch" + select SWCONFIG @@ -104,7 +100,7 @@ Signed-off-by: Felix Fietkau config SFP --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -22,6 +22,21 @@ libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_ +@@ -22,6 +22,20 @@ libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_ obj-$(CONFIG_PHYLINK) += phylink.o obj-$(CONFIG_PHYLIB) += libphy.o @@ -114,7 +110,6 @@ Signed-off-by: Felix Fietkau +obj-$(CONFIG_SWCONFIG_B53) += b53/ +obj-$(CONFIG_IP17XX_PHY) += ip17xx.o +obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o +obj-$(CONFIG_PSB6970_PHY) += psb6970.o +obj-$(CONFIG_RTL8306_PHY) += rtl8306.o +obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o From 4d36569b9cab6422d31bda5501718177f2f9c990 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Tue, 27 Oct 2020 14:02:53 +0300 Subject: [PATCH 18/50] ath79: fix ath10k caldata extraction on some D-Link DIR-842 C3 devices According to forum threads [0][1] and a report on IRC by Doc-Saintly some of those boards have calibration data in a different place. Only one alternative location is known. Without proper board calibration data (board.bin having all 0xff bytes) ath10k firmware still tries to load but crashes on startup with a confusing error message. If you're applying this patch manually on your device do not forget to remove /lib/firmware/ath10k/pre-cal-pci-0000:00:00.0.bin and reboot to force caldata re-extraction. [0] https://forum.openwrt.org/t/support-for-d-link-dir842-rev-c3/41654 [1] https://forum.openwrt.org/t/d-link-dir-842-cant-access-firmware-upload-form/65454 Signed-off-by: Paul Fertser --- .../base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index e968658cac..a72ed0206b 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -169,13 +169,18 @@ case "$FIRMWARE" in ;; dlink,dir-842-c1|\ dlink,dir-842-c2|\ - dlink,dir-842-c3|\ + dlink,dir-842-c3) + caldata_extract "art" 0x5000 0x2f20 + caldata_valid "202f" || caldata_extract "reserved" 0x15000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) + ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ + /lib/firmware/ath10k/QCA9888/hw2.0/board.bin + ;; nec,wg1200cr) caldata_extract "art" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin - ;; netgear,ex6400|\ netgear,ex7300) caldata_extract "caldata" 0x5000 0x2f20 From aafbfc6ac3550556f252d69643cf82bad4e7d1b3 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 16 Nov 2020 19:26:25 +0100 Subject: [PATCH 19/50] ath79: fix missing ";;" in 11-ath10k-caldata This adds a missing ";;" in the switch-case in 11-ath10k-caldata. Fixes: 4d36569b9cab ("ath79: fix ath10k caldata extraction on some D-Link DIR-842 C3 devices") Signed-off-by: Adrian Schmutzler --- .../generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index a72ed0206b..1e205468b7 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -181,6 +181,7 @@ case "$FIRMWARE" in ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin + ;; netgear,ex6400|\ netgear,ex7300) caldata_extract "caldata" 0x5000 0x2f20 From a4d52522c7fbc47a04215b8f04a2e1f7cf7aafea Mon Sep 17 00:00:00 2001 From: Alberto Bursi Date: Tue, 17 Nov 2020 08:58:40 +0100 Subject: [PATCH 20/50] wireguard-tools: fix category/description in menuconfig wireguard-tools is trying to import the menuconfig section from the wireguard package, but since it's not anymore in the same makefile this seems to fail and wireguard-tools ends up in "extra packages" category instead with other odds and ends. Same for the description, it's trying to import it from the wireguard package but it fails so it only shows the line written in this makefile. remove the broken imports and add manually the entries and description they were supposed to load Fixes: ea980fb9c6de ("wireguard: bump to 20191226") Signed-off-by: Alberto Bursi [fix trailing whitespaces, add Fixes] Signed-off-by: Adrian Schmutzler --- package/network/utils/wireguard-tools/Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/package/network/utils/wireguard-tools/Makefile b/package/network/utils/wireguard-tools/Makefile index 07258fde98..3cdbaa785c 100644 --- a/package/network/utils/wireguard-tools/Makefile +++ b/package/network/utils/wireguard-tools/Makefile @@ -30,13 +30,22 @@ MAKE_PATH:=src MAKE_VARS += PLATFORM=linux define Package/wireguard-tools - $(call Package/wireguard/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=VPN + URL:=https://www.wireguard.com + MAINTAINER:=Jason A. Donenfeld TITLE:=WireGuard userspace control program (wg) DEPENDS:=+@BUSYBOX_CONFIG_IP +@BUSYBOX_CONFIG_FEATURE_IP_LINK endef define Package/wireguard-tools/description - $(call Package/wireguard/Default/description) + WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes + state-of-the-art cryptography. It aims to be faster, simpler, leaner, and + more useful than IPSec, while avoiding the massive headache. It intends to + be considerably more performant than OpenVPN. WireGuard is designed as a + general purpose VPN for running on embedded interfaces and super computers + alike, fit for many different circumstances. It uses UDP. This package provides the userspace control program for WireGuard, `wg(8)`, a netifd protocol helper, and a re-resolve watchdog script. From 62a3430f9ba648ec2508e8f539b2e1dc1797668a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 17 Nov 2020 13:09:36 +0000 Subject: [PATCH 21/50] procd: drop legacy seccomp support, switch to OCI parsers d8f36f5 seccomp: specifying architectures is optional d352e6e seccomp: switch to new OCI compliant parser c110405 trace: switch to OCI seccomp JSON output Signed-off-by: Daniel Golle --- package/system/procd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 4e0d864d7c..6c9e0d3de3 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_SOURCE_DATE:=2020-11-06 -PKG_SOURCE_VERSION:=b0de894830a93da5b303a3d89a42baf163d0a58c -PKG_MIRROR_HASH:=ba7f7631fa74d3bede0241f5d96ee4939f15164e79290d1ac7fd15fc8ed628d9 +PKG_SOURCE_DATE:=2020-11-17 +PKG_SOURCE_VERSION:=c110405181056f14956ccd097b8e4ffe97b2f3ec +PKG_MIRROR_HASH:=a3c5cd58d58aebd5976ccadd754ac2f601fed888f48f78d364dfc86e3a34a1e4 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 01b83040d3a9f6f30199c2fe8f0ceb1bc05e76cf Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 17 Nov 2020 13:11:16 +0000 Subject: [PATCH 22/50] umdns: convert seccomp filter rules to OCI format procd-seccomp switched to OCI-compliant seccomp parser instead of our (legacy, OpenWrt-specific) format. Convert ruleset to new format. Signed-off-by: Daniel Golle --- package/network/services/umdns/Makefile | 2 +- .../network/services/umdns/files/umdns.json | 71 +++++++++++-------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile index f02177dca2..d8cd9ae749 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=umdns -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/umdns/files/umdns.json b/package/network/services/umdns/files/umdns.json index c22ba6f5fb..db62f5f36d 100644 --- a/package/network/services/umdns/files/umdns.json +++ b/package/network/services/umdns/files/umdns.json @@ -1,32 +1,43 @@ { - "whitelist": [ - "read", - "write", - "open", - "close", - "time", - "brk", - "ioctl", - "uname", - "bind", - "connect", - "getsockname", - "recvmsg", - "sendmsg", - "sendto", - "setsockopt", - "socket", - "poll", - "fcntl64", - "epoll_create", - "epoll_ctl", - "epoll_wait", - "rt_sigaction", - "sigreturn", - "rt_sigreturn", - "exit_group", - "exit", - "clock_gettime" - ], - "policy": 1 + "defaultAction": "SCMP_ACT_KILL_PROCESS", + "syscalls": [ + { + "names": [ + "read", + "write", + "open", + "close", + "time", + "brk", + "ioctl", + "uname", + "bind", + "connect", + "getsockname", + "recvmsg", + "recvfrom", + "sendmsg", + "sendto", + "setsockopt", + "socket", + "pipe", + "poll", + "fcntl64", + "epoll_create", + "epoll_create1", + "epoll_ctl", + "epoll_wait", + "epoll_pwait", + "rt_sigaction", + "sigreturn", + "rt_sigreturn", + "rt_sigprocmask", + "exit_group", + "exit", + "fcntl", + "clock_gettime" + ], + "action": "SCMP_ACT_ALLOW" + } + ] } From 7463a0b5ee65bae85c2a9e1bfcc86b0727b5b0ee Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 28 Oct 2020 20:42:17 +0100 Subject: [PATCH 23/50] hostapd: fix variable shadowing Fixes commit 838b412cb527 ("hostapd: add interworking support") Signed-off-by: David Bauer --- package/network/services/hostapd/files/hostapd.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index cb7e1d7053..3dbb983170 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -842,10 +842,12 @@ hostapd_set_bss_options() { json_for_each_item append_iw_anqp_elem iw_anqp_elem json_for_each_item append_iw_nai_realm iw_nai_realm + iw_domain_name_conf= json_for_each_item append_iw_domain_name iw_domain_name [ -n "$iw_domain_name_conf" ] && \ append bss_conf "domain_name=$iw_domain_name_conf" "$N" + iw_anqp_3gpp_cell_net_conf= json_for_each_item append_iw_anqp_3gpp_cell_net iw_anqp_3gpp_cell_net [ -n "$iw_anqp_3gpp_cell_net_conf" ] && \ append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N" From cd8052da4998b50219573faa80ac4ddc8a4dcebf Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 11 Oct 2020 17:45:01 +0200 Subject: [PATCH 24/50] hostapd: ubus: add driver information to client list This adds information from mac80211 to hostapd get_client ubus function. This way, TX as well as RX status information as well as the signal can be determined. Signed-off-by: David Bauer --- .../services/hostapd/src/src/ap/ubus.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 5a5dd1a889..cdbb8076d3 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -212,6 +212,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *msg) { struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct hostap_sta_driver_data sta_driver_data; struct sta_info *sta; void *list, *c; char mac_buf[20]; @@ -254,6 +255,29 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0) blobmsg_add_string_buffer(&b); #endif + + /* Driver information */ + if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) { + r = blobmsg_open_table(&b, "bytes"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "packets"); + blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets); + blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "rate"); + /* Rate in kbits */ + blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); + blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); + blobmsg_close_table(&b, r); + blobmsg_add_u32(&b, "signal", sta_driver_data.signal); + } + blobmsg_close_table(&b, c); } blobmsg_close_array(&b, list); From 80b531614beab477c642cfdfef8dc6238c58f007 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 12 Oct 2020 03:10:20 +0200 Subject: [PATCH 25/50] hostapd: ubus: add VHT capabilities to client list This adds parsed VHT capability information to the hostapd get_clients method. Signed-off-by: David Bauer --- .../services/hostapd/src/src/ap/ubus.c | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index cdbb8076d3..f864d586ab 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -206,6 +206,75 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj, return ret; } + +static void +hostapd_parse_vht_map_blobmsg(uint16_t map) +{ + char label[4]; + int16_t val; + int i; + + for (i = 0; i < 8; i++) { + snprintf(label, 4, "%dss", i + 1); + + val = (map & (BIT(1) | BIT(0))) + 7; + blobmsg_add_u16(&b, label, val == 10 ? -1 : val); + map = map >> 2; + } +} + +static void +hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc) +{ + void *supported_mcs; + void *map; + int i; + + static const struct { + const char *name; + uint32_t flag; + } vht_capas[] = { + { "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE }, + { "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE }, + }; + + for (i = 0; i < ARRAY_SIZE(vht_capas); i++) + blobmsg_add_u8(&b, vht_capas[i].name, + !!(vhtc->vht_capabilities_info & vht_capas[i].flag)); + + supported_mcs = blobmsg_open_table(&b, "mcs_map"); + + /* RX map */ + map = blobmsg_open_table(&b, "rx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map)); + blobmsg_close_table(&b, map); + + /* TX map */ + map = blobmsg_open_table(&b, "tx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map)); + blobmsg_close_table(&b, map); + + blobmsg_close_table(&b, supported_mcs); +} + +static void +hostapd_parse_capab_blobmsg(struct sta_info *sta) +{ + void *r, *v; + + v = blobmsg_open_table(&b, "capabilities"); + + if (sta->vht_capabilities) { + r = blobmsg_open_table(&b, "vht"); + hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities); + blobmsg_close_table(&b, r); + } + + /* ToDo: Add HT / HE capability parsing */ + + blobmsg_close_table(&b, v); +} + static int hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -278,6 +347,8 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_add_u32(&b, "signal", sta_driver_data.signal); } + hostapd_parse_capab_blobmsg(sta); + blobmsg_close_table(&b, c); } blobmsg_close_array(&b, list); From 0ce5f15f9c51926bc56aa8f9d8d848f803f9f251 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 2 Nov 2020 00:53:41 +0100 Subject: [PATCH 26/50] hostapd: ubus: add get_status method This adds a new get_status method to a hostapd interface, which provides information about the current interface status. Signed-off-by: David Bauer --- .../services/hostapd/src/src/ap/ubus.c | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index f864d586ab..aae9f91a20 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -372,6 +372,45 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +static int +hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + void *airtime_table, *dfs_table; + struct os_reltime now; + char phy_name[17]; + char mac_buf[20]; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + + snprintf(phy_name, 17, "%s", hapd->iface->phy); + blobmsg_add_string(&b, "phy", phy_name); + + /* Airtime */ + airtime_table = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "time", hapd->iface->last_channel_time); + blobmsg_add_u64(&b, "time_busy", hapd->iface->last_channel_time_busy); + blobmsg_add_u16(&b, "utilization", hapd->iface->channel_utilization); + blobmsg_close_table(&b, airtime_table); + + /* DFS */ + dfs_table = blobmsg_open_table(&b, "dfs"); + blobmsg_add_u32(&b, "cac_seconds", hapd->iface->dfs_cac_ms / 1000); + blobmsg_add_u8(&b, "cac_active", !!(hapd->iface->cac_started)); + os_reltime_age(&hapd->iface->dfs_cac_start, &now); + blobmsg_add_u32(&b, "cac_seconds_left", + hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); + blobmsg_close_table(&b, dfs_table); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + enum { NOTIFY_RESPONSE, __NOTIFY_MAX @@ -1242,6 +1281,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, static const struct ubus_method bss_methods[] = { UBUS_METHOD_NOARG("reload", hostapd_bss_reload), UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), + UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), #ifdef CONFIG_WPS From 03cdeb5f97f82d4be34e3545efa47c0b9aa0fc05 Mon Sep 17 00:00:00 2001 From: Dobroslaw Kijowski Date: Mon, 16 Nov 2020 20:21:46 +0100 Subject: [PATCH 27/50] hostapd: fix per-BSS airtime configuration airtime_mode is always parsed as an empty string since it hasn't been added into hostapd_common_add_device_config function. Fixes: e289f183 ("hostapd: add support for per-BSS airtime configuration") Signed-off-by: Dobroslaw Kijowski --- package/network/services/hostapd/Makefile | 2 +- package/network/services/hostapd/files/hostapd.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 8c884386f2..9a8a74ced9 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=14 +PKG_RELEASE:=15 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 3dbb983170..8a07e4d52b 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -102,6 +102,8 @@ hostapd_common_add_device_config() { config_add_string acs_chan_bias config_add_array hostapd_options + config_add_int airtime_mode + hostapd_add_log_config } From edb93eda161218af49393e2f2c68b87d5538a658 Mon Sep 17 00:00:00 2001 From: Dobroslaw Kijowski Date: Mon, 16 Nov 2020 20:32:38 +0100 Subject: [PATCH 28/50] hostapd: add support for static airtime policy configuration * Add support for passing airtime_sta_weight into hostapd configuration. * Since that commit it is possible to configure station weights. Set higher value for larger airtime share, lower for smaller share. I have tested this functionality by modyfing /etc/config/wireless to: config wifi-device 'radio0' ... option airtime_mode '1' config wifi-iface 'default_radio0' ... list airtime_sta_weight '01:02:03:04:05:06 1024' Now, when the station associates with the access point it has been assigned a higher weight value. root@OpenWrt:~# cat /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/stations/01\:02\:03\:04\:05\:06/airtime RX: 12656 us TX: 10617 us Weight: 1024 Deficit: VO: -2075 us VI: 256 us BE: -206 us BK: 256 us [MAC address has been changed into a dummy one.] Signed-off-by: Dobroslaw Kijowski --- package/network/services/hostapd/Makefile | 2 +- package/network/services/hostapd/files/hostapd.sh | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 9a8a74ced9..e25cd20a2a 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=15 +PKG_RELEASE:=16 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 8a07e4d52b..4d4a75b2dd 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -287,6 +287,7 @@ hostapd_common_add_bss_config() { config_add_array hs20_conn_capab config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp + config_add_array airtime_sta_weight config_add_int airtime_bss_weight airtime_bss_limit } @@ -411,6 +412,10 @@ append_hs20_conn_capab() { [ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N" } +append_airtime_sta_weight() { + [ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N" +} + hostapd_set_bss_options() { local var="$1" local phy="$2" @@ -432,7 +437,7 @@ hostapd_set_bss_options() { acct_server acct_secret acct_port acct_interval \ bss_load_update_period chan_util_avg_period sae_require_mfp \ multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \ - airtime_bss_weight airtime_bss_limit + airtime_bss_weight airtime_bss_limit airtime_sta_weight set_default isolate 0 set_default maxassoc 0 @@ -466,6 +471,7 @@ hostapd_set_bss_options() { [ "$airtime_bss_weight" -gt 0 ] && append bss_conf "airtime_bss_weight=$airtime_bss_weight" "$N" [ "$airtime_bss_limit" -gt 0 ] && append bss_conf "airtime_bss_limit=$airtime_bss_limit" "$N" + json_for_each_item append_airtime_sta_weight airtime_sta_weight append bss_conf "bss_load_update_period=$bss_load_update_period" "$N" append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N" From 21dfdfd78b31a4a330514a5c0126e267be1c7fc3 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 17 Nov 2020 11:47:38 +0100 Subject: [PATCH 29/50] hostapd: set validity interval for BSS TMRA This sets the validity interval for the BSS transition candidate list to the same value as the disassociation timer. Currently the value is always 0, which is the specification states is a reserved value. Also, wpa_supplicant and from the looks of it some Android implementations will outright ignore the candidate list in this case. Signed-off-by: David Bauer --- package/network/services/hostapd/src/src/ap/ubus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index aae9f91a20..8546d2ce69 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -1270,7 +1270,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, if (tb[WNM_DISASSOC_ABRIDGED] && blobmsg_get_bool(tb[WNM_DISASSOC_ABRIDGED])) req_mode |= WNM_BSS_TM_REQ_ABRIDGED; - if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, 0, NULL, + if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, duration, NULL, NULL, nr, nr_len, NULL, 0)) return UBUS_STATUS_UNKNOWN_ERROR; From 3f1109bf2af2cf4977689a33ea481afaaac8dc98 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 16 Nov 2020 17:30:43 +0100 Subject: [PATCH 30/50] base-files: fix backwards compatiblity of rc.common EXTRA_COMMANDS Avoid needlessly breaking old initscripts that set EXTRA_COMMANDS. This will aid in debugging (as it simplifies reverting to an older version of a package) and unbreaks third-party feeds (and packages that maintain their OpenWrt initscripts as part of the software's repo instead of the OpenWrt feed like fastd). Without this, initscripts that set EXTRA_COMMANDS become completely unusable, as all default commands like start/stop cease working. Fixes: 1a69f50dc627 ("base-files: fix rc.common help alignment") Signed-off-by: Matthias Schiffer --- package/base-files/Makefile | 2 +- package/base-files/files/etc/rc.common | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index b546eb7e0b..e13578860f 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=236 +PKG_RELEASE:=237 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index d3d91ef250..f39b69464e 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -62,15 +62,15 @@ depends() { return 0 } -EXTRA_HELP="" -EXTRA_COMMANDS="boot shutdown depends" +ALL_HELP="" +ALL_COMMANDS="boot shutdown depends" extra_command() { local cmd="$1" local help="$2" local extra="$(printf "%-16s%s" "${cmd}" "${help}")" - EXTRA_HELP="${EXTRA_HELP}\t${extra}\n" - EXTRA_COMMANDS="${EXTRA_COMMANDS} ${cmd}" + ALL_HELP="${ALL_HELP}\t${extra}\n" + ALL_COMMANDS="${ALL_COMMANDS} ${cmd}" } help() { @@ -79,7 +79,7 @@ Syntax: $initscript [command] Available commands: EOF - echo -e "$EXTRA_HELP" + echo -e "$ALL_HELP" } # for procd @@ -175,6 +175,7 @@ extra_command "enabled" "Check if service is started on boot" } } -ALL_COMMANDS="${EXTRA_COMMANDS}" +ALL_COMMANDS="${ALL_COMMANDS} ${EXTRA_COMMANDS}" +ALL_HELP="${ALL_HELP}${EXTRA_HELP}" list_contains ALL_COMMANDS "$action" || action=help $action "$@" From 7330348f2dbd9f01786041b726837aa393e3ce34 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sun, 15 Nov 2020 20:43:49 +0100 Subject: [PATCH 31/50] ethtool: update to version 5.9 The ipkg sizes changes as follows for mips 24kc : 5.8 : ethtool_5.8-1_mips_24kc.ipk 34930 5.9 : ethtool_5.9-1_mips_24kc.ipk 35241 Signed-off-by: Hans Dedecker --- package/network/utils/ethtool/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index 6547eee9a5..df8d7ce119 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=5.8 +PKG_VERSION:=5.9 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=2f3b54d08d048f5977b80cb6cb4744994370def7553ee634d39dbbb6ccf87546 +PKG_HASH:=512932010af87bc3e09773c89baea44bca96c1da1151bbcf109fa0e055a88a6f PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From ad0711559d51e30b55c874edd0f4f836eda5f3dc Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 1 Nov 2020 00:17:36 +0100 Subject: [PATCH 32/50] iperf3: Update to version 3.9 No special changes, just get in sync with recent code. See here for the changelog: http://software.es.net/iperf/news.html#iperf-3-9-released The ipkg sizes changes as follows for mips 24kc : 3.7 : iperf3_3.7-1_mips_24kc.ipk 39675 3.9 : iperf3_3.9-1_mips_24kc.ipk 41586 Signed-off-by: Hauke Mehrtens --- package/network/utils/iperf3/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/iperf3/Makefile b/package/network/utils/iperf3/Makefile index ab946c2590..6f90bc9221 100644 --- a/package/network/utils/iperf3/Makefile +++ b/package/network/utils/iperf3/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iperf -PKG_VERSION:=3.7 +PKG_VERSION:=3.9 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf -PKG_HASH:=d846040224317caf2f75c843d309a950a7db23f9b44b94688ccbe557d6d1710c +PKG_HASH:=24b63a26382325f759f11d421779a937b63ca1bc17c44587d2fcfedab60ac038 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause From 557fe9cd3ba3b30a1567ce4be5a65aef61f644bb Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 1 Nov 2020 00:17:51 +0100 Subject: [PATCH 33/50] strace: Update to version 5.9 No special changes, just get in sync with recent code. See here for the changelog: https://github.com/strace/strace/releases/tag/v5.9 The ipkg sizes changes as follows for mips 24kc : 5.8 : strace_5.8-1_mips_24kc.ipk 271195 5.9 : strace_5.9-1_mips_24kc.ipk 278352 Signed-off-by: Hauke Mehrtens --- package/devel/strace/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index 1a0c0f442f..9ea28735a1 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=5.8 +PKG_VERSION:=5.9 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=df4a669f7fff9cc302784085bd4b72fab216a426a3f72c892b28a537b71e7aa9 +PKG_HASH:=39473eb8465546c3e940fb663cb381eba5613160c7302794699d194a4d5d66d9 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=LGPL-2.1-or-later From a8030ea40fdba9edbba240a621c0dc3558a36e07 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 1 Nov 2020 00:17:58 +0100 Subject: [PATCH 34/50] valgrind: Update to version 3.16.1 No special changes, just get in sync with recent code. See here for the changelog: https://valgrind.org/docs/manual/dist.news.html The ipkg sizes changes as follows for mips 24kc : 3.15 : valgrind_3.15.0-2_mips_24kc.ipk 1450680 3.16.1 : valgrind_3.16.1-1_mips_24kc.ipk 1491954 Signed-off-by: Hauke Mehrtens --- package/devel/valgrind/Makefile | 6 +++--- .../devel/valgrind/patches/100-fix_configure_check.patch | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile index ecb4af8b35..829f37569e 100644 --- a/package/devel/valgrind/Makefile +++ b/package/devel/valgrind/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=valgrind -PKG_VERSION:=3.15.0 -PKG_RELEASE:=2 +PKG_VERSION:=3.16.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://sourceware.org/pub/valgrind/ -PKG_HASH:=417c7a9da8f60dd05698b3a7bc6002e4ef996f14c13f0ff96679a16873e78ab1 +PKG_HASH:=c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0+ diff --git a/package/devel/valgrind/patches/100-fix_configure_check.patch b/package/devel/valgrind/patches/100-fix_configure_check.patch index 270181ae37..6e9384ff88 100644 --- a/package/devel/valgrind/patches/100-fix_configure_check.patch +++ b/package/devel/valgrind/patches/100-fix_configure_check.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -341,7 +341,7 @@ case "${host_os}" in +@@ -345,7 +345,7 @@ case "${host_os}" in # Ok, this is linux. Check the kernel version AC_MSG_CHECKING([for the kernel version]) From 79f3f1358bf993a5d7ae14eba9cea2686b40841d Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 25 Oct 2020 14:51:55 +0100 Subject: [PATCH 35/50] ath79: Add support for Ubiquiti NanoBeam AC Gen2 CPU: Atheros AR9342 rev 3 SoC RAM: 64 MB DDR2 Flash: 16 MB NOR SPI WLAN 2.4GHz: Atheros AR9342 v3 (ath9k) WLAN 5.0GHz: QCA988X Ports: 2x GbE Flashing procedure is identical to other ubnt devices. https://openwrt.org/toh/ubiquiti/common Flashing through factory firmware 1. Ensure firmware version v8.7.0 is installed. Up/downgrade to this exact version. 2. Patch fwupdate.real binary using `hexdump -Cv /bin/ubntbox | sed 's/14 40 fe 27/00 00 00 00/g' | \ hexdump -R > /tmp/fwupdate.real` 3. Make the patched fwupdate.real binary executable using `chmod +x /tmp/fwupdate.real` 4. Copy the squashfs factory image to /tmp on the device 5. Flash OpenWrt using `/tmp/fwupdate.real -m ` 6. Wait for the device to reboot (copied from Ubiquiti NanoBeam AC and modified) To keep it consistent, we will add the gen1 variant to the nanobeam ac gen1. Signed-off-by: Nick Hainke --- .../dts/ar9342_ubnt_nanobeam-ac-gen2.dts | 38 +++++++++++++++++++ .../ath79/dts/ar9342_ubnt_nanobeam-ac.dts | 2 +- .../generic/base-files/etc/board.d/01_leds | 1 + .../generic/base-files/etc/board.d/02_network | 2 + .../base-files/etc/board.d/03_gpio_switches | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic-ubnt.mk | 9 +++++ 7 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac-gen2.dts diff --git a/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac-gen2.dts b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac-gen2.dts new file mode 100644 index 0000000000..08f3d2c6d8 --- /dev/null +++ b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac-gen2.dts @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ar9342_ubnt_wa_2port.dtsi" + +/ { + compatible = "ubnt,nanobeam-ac-gen2", "ubnt,wa", "qca,ar9342"; + model = "Ubiquiti NanoBeam AC Gen2 (WA)"; + + aliases { + led-boot = &led_rssi3; + led-failsafe = &led_rssi3; + led-upgrade = &led_rssi3; + }; + + leds { + compatible = "gpio-leds"; + + rssi0 { + label = "blue:rssi0"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + rssi1 { + label = "blue:rssi1"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + rssi2 { + label = "blue:rssi2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + led_rssi3: rssi3 { + label = "blue:rssi3"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts index dc2537a77e..b32a200b11 100644 --- a/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts +++ b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts @@ -4,7 +4,7 @@ / { compatible = "ubnt,nanobeam-ac", "ubnt,wa", "qca,ar9342"; - model = "Ubiquiti NanoBeam AC (WA)"; + model = "Ubiquiti NanoBeam AC Gen1 (WA)"; aliases { led-boot = &led_rssi3; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 227e64678d..08ca2a8398 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -362,6 +362,7 @@ ubnt,rocket-m) ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:link4" "wlan0" "76" "100" ;; ubnt,nanobeam-ac|\ +ubnt,nanobeam-ac-gen2|\ ubnt,nanostation-ac|\ ubnt,powerbeam-5ac-gen2) ucidef_set_rssimon "wlan0" "200000" "1" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index a587cfac96..58518a8273 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -248,6 +248,7 @@ ath79_setup_interfaces() qxwlan,e1700ac-v2-16m|\ qxwlan,e750g-v8-8m|\ qxwlan,e750g-v8-16m|\ + ubnt,nanobeam-ac-gen2|\ ubnt,nanostation-ac|\ yuncore,a782|\ yuncore,xd4200) @@ -582,6 +583,7 @@ ath79_setup_macs() label_mac=$wan_mac ;; ubnt,litebeam-ac-gen2|\ + ubnt,nanobeam-ac-gen2|\ ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2) label_mac=$(mtd_get_mac_binary art 0x5006) diff --git a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches index d390fdfbe2..8ec0af53d4 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches @@ -76,6 +76,7 @@ tplink,wbs510-v2) ubnt,aircube-isp) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "11" ;; +ubnt,nanobeam-ac-gen2|\ ubnt,nanostation-ac) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "3" ;; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 1e205468b7..83ffc8f862 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -33,6 +33,7 @@ case "$FIRMWARE" in ubnt,lap-120|\ ubnt,litebeam-ac-gen2|\ ubnt,nanobeam-ac|\ + ubnt,nanobeam-ac-gen2|\ ubnt,nanostation-ac|\ ubnt,nanostation-ac-loco|\ ubnt,powerbeam-5ac-500|\ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index cd67ea2904..6e12c34d85 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -190,10 +190,19 @@ TARGET_DEVICES += ubnt_litebeam-ac-gen2 define Device/ubnt_nanobeam-ac $(Device/ubnt-wa) DEVICE_MODEL := NanoBeam AC + DEVICE_VARIANT := Gen1 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds endef TARGET_DEVICES += ubnt_nanobeam-ac +define Device/ubnt_nanobeam-ac-gen2 + $(Device/ubnt-wa) + DEVICE_MODEL := NanoBeam AC + DEVICE_VARIANT := Gen2 + DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds +endef +TARGET_DEVICES += ubnt_nanobeam-ac-gen2 + define Device/ubnt_nanobridge-m $(Device/ubnt-xm) SOC := ar7241 From 667f6c7f49c94213ca43a42ad5a9e23abfd81861 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 11 Nov 2020 15:30:36 -0500 Subject: [PATCH 36/50] kernel: bump 5.4 to 5.4.77 Manually rebased patches: bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch generic-backport/744-v5.5-net-sfp-soft-status-and-control-support.patch layerscape/patches-5.4/819-uart-0005-tty-serial-fsl_lpuart-enable-dma-mode-for-imx8qxp.patch mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch Removed: layerscape/patches-5.4/819-uart-0012-tty-serial-lpuart-add-LS1028A-support.patch All modifications made by update_kernel.sh Build system: x86_64 Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711, lantiq/Easybox 904 xDSL, x86_64 Run-tested: ipq806x/R7800, lantiq/Easybox 904 xDSL, x86_64 No dmesg regressions, everything functional Signed-off-by: John Audia Co-developed-by: Adrian Schmutzler Signed-off-by: Adrian Schmutzler --- include/kernel-version.mk | 4 +- ...de-for-using-the-closed-firmware-for.patch | 2 +- ...0134-spi-spi-bcm2835-Re-enable-HW-CS.patch | 2 +- ...i-bcm2835-Disable-forced-software-CS.patch | 14 +--- ...950-0544-drm-vc4-drv-Support-BCM2711.patch | 2 +- ...-sfp-soft-status-and-control-support.patch | 8 +-- ...25p80-mx-disable-software-protection.patch | 2 +- ...or-fix-Spansion-regressions-aliased-.patch | 2 +- ...ort-limiting-4K-sectors-support-base.patch | 6 +- ...or-rework-broken-flash-reset-support.patch | 2 +- .../pending-5.4/754-net-sfp-fix-unbind.patch | 2 +- ...M-dts-imx6qdl-gw5910-add-CC1352-UART.patch | 4 +- ...dl-gw5910-add-support-for-bcm4330-bt.patch | 8 +-- ...ts-imx6qdl-gw5910-fix-wlan-regulator.patch | 4 +- .../700-net-add-qualcomm-mdio.patch | 4 +- .../705-net-add-qualcomm-ar40xx-phy.patch | 4 +- ...-sysfs-entries-for-suppliers-and-con.patch | 6 +- ...rial-lpuart-add-power-domain-support.patch | 4 +- ...al-fsl_lpuart-add-modem-device-reset.patch | 2 +- ...l-fsl_lpuart-add-magic-SysRq-support.patch | 2 +- ...K-18137-fsl_lpuart-Fix-loopback-mode.patch | 2 +- ...l_lpuart-enable-dma-mode-for-imx8qxp.patch | 55 ++++++++------- ...rial-fsl_lpuart-enable-loopback-mode.patch | 2 +- ...rial-fsl_lpuart-check-dma_tx_in_prog.patch | 2 +- ...-fsl_lpuart-do-HW-reset-for-communic.patch | 12 ++-- ...-serial-lpuart-add-runtime-pm-suppor.patch | 22 +++--- ...uart-enable-wakeup-source-for-lpuart.patch | 14 ++-- ...rial-fsl_lpuart-enable-two-stop-bits.patch | 6 +- ...ty-serial-lpuart-add-LS1028A-support.patch | 68 ------------------- ...l-lpuart-support-UPIO_MEM32-for-lpua.patch | 2 +- .../patches-5.4/0003-switch-add-mt7531.patch | 4 +- .../patches-5.4/0005-dts-mt7622-add-gsw.patch | 6 +- .../0308-dts-mt7622-add-snand-support.patch | 4 +- ...dts-add-wmac-support-for-mt7622-rfb1.patch | 4 +- .../0990-gsw-rtl8367s-mt7622-support.patch | 2 +- ...ek-Split-PCIe-node-for-MT2712-MT7622.patch | 2 +- ...s-mt7622-rfb-change-to-ax-mtd-layout.patch | 2 +- ...l-espressobin-Add-ethernet-switch-al.patch | 46 ------------- ...or-support-mtd-name-from-device-tree.patch | 4 +- 39 files changed, 112 insertions(+), 231 deletions(-) delete mode 100644 target/linux/layerscape/patches-5.4/819-uart-0012-tty-serial-lpuart-add-LS1028A-support.patch diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 69dfaa5476..96daf1b105 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,9 +6,9 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-5.4 = .75 +LINUX_VERSION-5.4 = .77 -LINUX_KERNEL_HASH-5.4.75 = d2466fd6eb5433e7bf287b617b11b2640c65a7ea93a57eb7a80d7f537cbc1470 +LINUX_KERNEL_HASH-5.4.77 = a3e03e6970240dddc8174bf9f49b56d774c40125eabe1582d2ebe85b01addbf7 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/bcm27xx/patches-5.4/950-0095-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch b/target/linux/bcm27xx/patches-5.4/950-0095-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch index d09becc815..a9f3256b32 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0095-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0095-drm-vc4-Add-a-mode-for-using-the-closed-firmware-for.patch @@ -70,7 +70,7 @@ Signed-off-by: Eric Anholt --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -345,6 +345,7 @@ static struct platform_driver *const com +@@ -346,6 +346,7 @@ static struct platform_driver *const com &vc4_txp_driver, &vc4_hvs_driver, &vc4_crtc_driver, diff --git a/target/linux/bcm27xx/patches-5.4/950-0134-spi-spi-bcm2835-Re-enable-HW-CS.patch b/target/linux/bcm27xx/patches-5.4/950-0134-spi-spi-bcm2835-Re-enable-HW-CS.patch index d8cac64e81..06928cb19e 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0134-spi-spi-bcm2835-Re-enable-HW-CS.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0134-spi-spi-bcm2835-Re-enable-HW-CS.patch @@ -70,7 +70,7 @@ Signed-off-by: Phil Elwell } static int bcm2835_spi_setup(struct spi_device *spi) -@@ -1289,6 +1337,7 @@ static int bcm2835_spi_probe(struct plat +@@ -1277,6 +1325,7 @@ static int bcm2835_spi_probe(struct plat ctlr->bits_per_word_mask = SPI_BPW_MASK(8); ctlr->num_chipselect = BCM2835_SPI_NUM_CS; ctlr->setup = bcm2835_spi_setup; diff --git a/target/linux/bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch b/target/linux/bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch index 92b2378571..ce44eed0c8 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c -@@ -1279,43 +1279,6 @@ static int bcm2835_spi_setup(struct spi_ +@@ -1279,31 +1279,6 @@ static int bcm2835_spi_setup(struct spi_ return -EINVAL; } @@ -31,18 +31,6 @@ Signed-off-by: Phil Elwell - if (!chip) - return 0; - -- /* -- * Retrieve the corresponding GPIO line used for CS. -- * The inversion semantics will be handled by the GPIO core -- * code, so we pass GPIOS_OUT_LOW for "unasserted" and -- * the correct flag for inversion semantics. The SPI_CS_HIGH -- * on spi->mode cannot be checked for polarity in this case -- * as the flag use_gpio_descriptors enforces SPI_CS_HIGH. -- */ -- if (of_property_read_bool(spi->dev.of_node, "spi-cs-high")) -- lflags = GPIO_ACTIVE_HIGH; -- else -- lflags = GPIO_ACTIVE_LOW; - spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select, - DRV_NAME, - lflags, diff --git a/target/linux/bcm27xx/patches-5.4/950-0544-drm-vc4-drv-Support-BCM2711.patch b/target/linux/bcm27xx/patches-5.4/950-0544-drm-vc4-drv-Support-BCM2711.patch index 00bac3a2b9..9a0f790ff4 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0544-drm-vc4-drv-Support-BCM2711.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0544-drm-vc4-drv-Support-BCM2711.patch @@ -17,7 +17,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -368,6 +368,7 @@ static int vc4_platform_drm_remove(struc +@@ -369,6 +369,7 @@ static int vc4_platform_drm_remove(struc } static const struct of_device_id vc4_of_match[] = { diff --git a/target/linux/generic/backport-5.4/744-v5.5-net-sfp-soft-status-and-control-support.patch b/target/linux/generic/backport-5.4/744-v5.5-net-sfp-soft-status-and-control-support.patch index 6e3c87a7e4..abc9f65f09 100644 --- a/target/linux/generic/backport-5.4/744-v5.5-net-sfp-soft-status-and-control-support.patch +++ b/target/linux/generic/backport-5.4/744-v5.5-net-sfp-soft-status-and-control-support.patch @@ -187,16 +187,16 @@ Signed-off-by: Russell King int err, i; sfp = sfp_alloc(&pdev->dev); -@@ -2183,7 +2253,7 @@ static int sfp_probe(struct platform_dev - +@@ -2184,7 +2254,7 @@ static int sfp_probe(struct platform_dev sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]); - if (!sfp->gpio_irq[i]) { + if (sfp->gpio_irq[i] < 0) { + sfp->gpio_irq[i] = 0; - poll = true; + sfp->need_poll = true; continue; } -@@ -2195,11 +2265,11 @@ static int sfp_probe(struct platform_dev +@@ -2196,11 +2266,11 @@ static int sfp_probe(struct platform_dev dev_name(sfp->dev), sfp); if (err) { sfp->gpio_irq[i] = 0; diff --git a/target/linux/generic/pending-5.4/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/pending-5.4/465-m25p80-mx-disable-software-protection.patch index 24d2d4567d..7c11ad356b 100644 --- a/target/linux/generic/pending-5.4/465-m25p80-mx-disable-software-protection.patch +++ b/target/linux/generic/pending-5.4/465-m25p80-mx-disable-software-protection.patch @@ -8,7 +8,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -4884,6 +4884,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -4883,6 +4883,7 @@ int spi_nor_scan(struct spi_nor *nor, co */ if (JEDEC_MFR(nor->info) == SNOR_MFR_ATMEL || JEDEC_MFR(nor->info) == SNOR_MFR_INTEL || diff --git a/target/linux/generic/pending-5.4/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch b/target/linux/generic/pending-5.4/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch index c5db43b5e6..77b9b72b37 100644 --- a/target/linux/generic/pending-5.4/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch +++ b/target/linux/generic/pending-5.4/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch @@ -25,7 +25,7 @@ Signed-off-by: Matthias Schiffer nor->params.set_4byte = winbond_set_4byte; } -@@ -4886,6 +4887,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -4885,6 +4886,7 @@ int spi_nor_scan(struct spi_nor *nor, co JEDEC_MFR(nor->info) == SNOR_MFR_INTEL || JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX || JEDEC_MFR(nor->info) == SNOR_MFR_SST || diff --git a/target/linux/generic/pending-5.4/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch b/target/linux/generic/pending-5.4/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch index d3e587ff97..7773a8ec05 100644 --- a/target/linux/generic/pending-5.4/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch +++ b/target/linux/generic/pending-5.4/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau depends on OF && (ARM || ARM64 || COMPILE_TEST) --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -4464,6 +4464,7 @@ static void spi_nor_info_init_params(str +@@ -4463,6 +4463,7 @@ static void spi_nor_info_init_params(str struct spi_nor_erase_map *map = ¶ms->erase_map; const struct flash_info *info = nor->info; struct device_node *np = spi_nor_get_flash_node(nor); @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau u8 i, erase_mask; /* Initialize legacy flash parameters and settings. */ -@@ -4527,6 +4528,21 @@ static void spi_nor_info_init_params(str +@@ -4526,6 +4527,21 @@ static void spi_nor_info_init_params(str */ erase_mask = 0; i = 0; @@ -69,7 +69,7 @@ Signed-off-by: Felix Fietkau if (info->flags & SECT_4K_PMC) { erase_mask |= BIT(i); spi_nor_set_erase_type(&map->erase_type[i], 4096u, -@@ -4538,6 +4554,7 @@ static void spi_nor_info_init_params(str +@@ -4537,6 +4553,7 @@ static void spi_nor_info_init_params(str SPINOR_OP_BE_4K); i++; } diff --git a/target/linux/generic/pending-5.4/481-mtd-spi-nor-rework-broken-flash-reset-support.patch b/target/linux/generic/pending-5.4/481-mtd-spi-nor-rework-broken-flash-reset-support.patch index b2f73a5cbd..8add1f7795 100644 --- a/target/linux/generic/pending-5.4/481-mtd-spi-nor-rework-broken-flash-reset-support.patch +++ b/target/linux/generic/pending-5.4/481-mtd-spi-nor-rework-broken-flash-reset-support.patch @@ -148,7 +148,7 @@ Signed-off-by: Chuanhong Guo spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); return ret; } -@@ -4726,9 +4768,13 @@ static int spi_nor_init(struct spi_nor * +@@ -4725,9 +4767,13 @@ static int spi_nor_init(struct spi_nor * * reboots (e.g., crashes). Warn the user (or hopefully, system * designer) that this is bad. */ diff --git a/target/linux/generic/pending-5.4/754-net-sfp-fix-unbind.patch b/target/linux/generic/pending-5.4/754-net-sfp-fix-unbind.patch index d5f3645025..8d98a5d7a1 100644 --- a/target/linux/generic/pending-5.4/754-net-sfp-fix-unbind.patch +++ b/target/linux/generic/pending-5.4/754-net-sfp-fix-unbind.patch @@ -15,7 +15,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -2343,6 +2343,10 @@ static int sfp_remove(struct platform_de +@@ -2344,6 +2344,10 @@ static int sfp_remove(struct platform_de sfp_unregister_socket(sfp->sfp_bus); diff --git a/target/linux/imx6/patches-5.4/006-v5.7-ARM-dts-imx6qdl-gw5910-add-CC1352-UART.patch b/target/linux/imx6/patches-5.4/006-v5.7-ARM-dts-imx6qdl-gw5910-add-CC1352-UART.patch index 5873e92626..72a98a2b15 100644 --- a/target/linux/imx6/patches-5.4/006-v5.7-ARM-dts-imx6qdl-gw5910-add-CC1352-UART.patch +++ b/target/linux/imx6/patches-5.4/006-v5.7-ARM-dts-imx6qdl-gw5910-add-CC1352-UART.patch @@ -13,7 +13,7 @@ Signed-off-by: Shawn Guo --- a/arch/arm/boot/dts/imx6qdl-gw5910.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw5910.dtsi -@@ -220,6 +220,14 @@ +@@ -218,6 +218,14 @@ status = "okay"; }; @@ -28,7 +28,7 @@ Signed-off-by: Shawn Guo /* Sterling-LWB Bluetooth */ &uart4 { pinctrl-names = "default"; -@@ -411,6 +419,23 @@ +@@ -409,6 +417,23 @@ >; }; diff --git a/target/linux/imx6/patches-5.4/009-v5.8-ARM-dts-imx6qdl-gw5910-add-support-for-bcm4330-bt.patch b/target/linux/imx6/patches-5.4/009-v5.8-ARM-dts-imx6qdl-gw5910-add-support-for-bcm4330-bt.patch index 6cbd6fdd03..545a6fddd5 100644 --- a/target/linux/imx6/patches-5.4/009-v5.8-ARM-dts-imx6qdl-gw5910-add-support-for-bcm4330-bt.patch +++ b/target/linux/imx6/patches-5.4/009-v5.8-ARM-dts-imx6qdl-gw5910-add-support-for-bcm4330-bt.patch @@ -18,7 +18,7 @@ Signed-off-by: Shawn Guo --- a/arch/arm/boot/dts/imx6qdl-gw5910.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw5910.dtsi -@@ -83,19 +83,6 @@ +@@ -81,19 +81,6 @@ regulator-max-microvolt = <3300000>; regulator-always-on; }; @@ -38,7 +38,7 @@ Signed-off-by: Shawn Guo }; -@@ -231,9 +218,14 @@ +@@ -229,9 +216,14 @@ /* Sterling-LWB Bluetooth */ &uart4 { pinctrl-names = "default"; @@ -54,7 +54,7 @@ Signed-off-by: Shawn Guo }; /* GPS */ -@@ -288,6 +280,12 @@ +@@ -286,6 +278,12 @@ >; }; @@ -67,7 +67,7 @@ Signed-off-by: Shawn Guo pinctrl_ecspi3: escpi3grp { fsl,pins = < MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK 0x100b1 -@@ -393,12 +391,6 @@ +@@ -391,12 +389,6 @@ >; }; diff --git a/target/linux/imx6/patches-5.4/010-v5.8-ARM-dts-imx6qdl-gw5910-fix-wlan-regulator.patch b/target/linux/imx6/patches-5.4/010-v5.8-ARM-dts-imx6qdl-gw5910-fix-wlan-regulator.patch index c4cce19b93..ce2fa2ee90 100644 --- a/target/linux/imx6/patches-5.4/010-v5.8-ARM-dts-imx6qdl-gw5910-fix-wlan-regulator.patch +++ b/target/linux/imx6/patches-5.4/010-v5.8-ARM-dts-imx6qdl-gw5910-fix-wlan-regulator.patch @@ -14,7 +14,7 @@ Signed-off-by: Shawn Guo --- a/arch/arm/boot/dts/imx6qdl-gw5910.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw5910.dtsi -@@ -81,7 +81,6 @@ +@@ -79,7 +79,6 @@ enable-active-high; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; @@ -22,7 +22,7 @@ Signed-off-by: Shawn Guo }; }; -@@ -251,7 +250,7 @@ +@@ -249,7 +248,7 @@ &usdhc2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; diff --git a/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch b/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch index 8786330d3b..3345d84fb8 100644 --- a/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch +++ b/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -581,6 +581,13 @@ config XILINX_GMII2RGMII +@@ -577,6 +577,13 @@ config XILINX_GMII2RGMII the Reduced Gigabit Media Independent Interface(RGMII) between Ethernet physical media devices and the Gigabit Ethernet controller. @@ -16,7 +16,7 @@ config MICREL_KS8995MA --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -51,6 +51,7 @@ obj-$(CONFIG_MDIO_CAVIUM) += mdio-cavium +@@ -50,6 +50,7 @@ obj-$(CONFIG_MDIO_CAVIUM) += mdio-cavium obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o obj-$(CONFIG_MDIO_HISI_FEMAC) += mdio-hisi-femac.o obj-$(CONFIG_MDIO_I2C) += mdio-i2c.o diff --git a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch index 4cdeab637a..6f080892d5 100644 --- a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch +++ b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -588,6 +588,13 @@ config MDIO_IPQ40XX +@@ -584,6 +584,13 @@ config MDIO_IPQ40XX This driver supports the MDIO interface found in Qualcomm Atheros ipq40xx Soc chip. @@ -16,7 +16,7 @@ config MICREL_KS8995MA --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -70,6 +70,7 @@ ifdef CONFIG_HWMON +@@ -69,6 +69,7 @@ ifdef CONFIG_HWMON aquantia-objs += aquantia_hwmon.o endif obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o diff --git a/target/linux/layerscape/patches-5.4/303-core-0002-drivers-base-add-sysfs-entries-for-suppliers-and-con.patch b/target/linux/layerscape/patches-5.4/303-core-0002-drivers-base-add-sysfs-entries-for-suppliers-and-con.patch index 1e45217307..6307ba839c 100644 --- a/target/linux/layerscape/patches-5.4/303-core-0002-drivers-base-add-sysfs-entries-for-suppliers-and-con.patch +++ b/target/linux/layerscape/patches-5.4/303-core-0002-drivers-base-add-sysfs-entries-for-suppliers-and-con.patch @@ -32,7 +32,7 @@ Signed-off-by: Ioana Ciornei + a specific device. --- a/drivers/base/core.c +++ b/drivers/base/core.c -@@ -1320,6 +1320,34 @@ static ssize_t online_store(struct devic +@@ -1318,6 +1318,34 @@ static ssize_t online_store(struct devic } static DEVICE_ATTR_RW(online); @@ -67,7 +67,7 @@ Signed-off-by: Ioana Ciornei int device_add_groups(struct device *dev, const struct attribute_group **groups) { return sysfs_create_groups(&dev->kobj, groups); -@@ -1491,8 +1519,20 @@ static int device_add_attrs(struct devic +@@ -1489,8 +1517,20 @@ static int device_add_attrs(struct devic goto err_remove_dev_groups; } @@ -88,7 +88,7 @@ Signed-off-by: Ioana Ciornei err_remove_dev_groups: device_remove_groups(dev, dev->groups); err_remove_type_groups: -@@ -1510,6 +1550,8 @@ static void device_remove_attrs(struct d +@@ -1508,6 +1548,8 @@ static void device_remove_attrs(struct d struct class *class = dev->class; const struct device_type *type = dev->type; diff --git a/target/linux/layerscape/patches-5.4/819-uart-0001-tty-serial-lpuart-add-power-domain-support.patch b/target/linux/layerscape/patches-5.4/819-uart-0001-tty-serial-lpuart-add-power-domain-support.patch index aa14f17500..ce93640b55 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0001-tty-serial-lpuart-add-power-domain-support.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0001-tty-serial-lpuart-add-power-domain-support.patch @@ -27,7 +27,7 @@ Signed-off-by: Fugang Duan #include #include #include -@@ -2367,6 +2369,54 @@ static struct uart_driver lpuart_reg = { +@@ -2391,6 +2393,54 @@ static struct uart_driver lpuart_reg = { .cons = LPUART_CONSOLE, }; @@ -82,7 +82,7 @@ Signed-off-by: Fugang Duan static int lpuart_probe(struct platform_device *pdev) { const struct of_device_id *of_id = of_match_device(lpuart_dt_ids, -@@ -2404,6 +2454,10 @@ static int lpuart_probe(struct platform_ +@@ -2428,6 +2478,10 @@ static int lpuart_probe(struct platform_ sport->port.rs485_config = lpuart_config_rs485; diff --git a/target/linux/layerscape/patches-5.4/819-uart-0002-tty-serial-fsl_lpuart-add-modem-device-reset.patch b/target/linux/layerscape/patches-5.4/819-uart-0002-tty-serial-fsl_lpuart-add-modem-device-reset.patch index 9f409a1fab..a287cd7f05 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0002-tty-serial-fsl_lpuart-add-modem-device-reset.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0002-tty-serial-fsl_lpuart-add-modem-device-reset.patch @@ -20,7 +20,7 @@ Signed-off-by: Fugang Duan #include #include #include -@@ -1542,8 +1543,17 @@ static void lpuart32_configure(struct lp +@@ -1555,8 +1556,17 @@ static void lpuart32_configure(struct lp static int lpuart32_startup(struct uart_port *port) { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); diff --git a/target/linux/layerscape/patches-5.4/819-uart-0003-tty-serial-fsl_lpuart-add-magic-SysRq-support.patch b/target/linux/layerscape/patches-5.4/819-uart-0003-tty-serial-fsl_lpuart-add-magic-SysRq-support.patch index bb94b02476..dc2ace7be2 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0003-tty-serial-fsl_lpuart-add-magic-SysRq-support.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0003-tty-serial-fsl_lpuart-add-magic-SysRq-support.patch @@ -12,7 +12,7 @@ Signed-off-by: Fugang Duan --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c -@@ -918,7 +918,12 @@ static void lpuart32_rxint(struct lpuart +@@ -931,7 +931,12 @@ static void lpuart32_rxint(struct lpuart */ sr = lpuart32_read(&sport->port, UARTSTAT); rx = lpuart32_read(&sport->port, UARTDATA); diff --git a/target/linux/layerscape/patches-5.4/819-uart-0004-MLK-18137-fsl_lpuart-Fix-loopback-mode.patch b/target/linux/layerscape/patches-5.4/819-uart-0004-MLK-18137-fsl_lpuart-Fix-loopback-mode.patch index aab529fc76..f3ff330281 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0004-MLK-18137-fsl_lpuart-Fix-loopback-mode.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0004-MLK-18137-fsl_lpuart-Fix-loopback-mode.patch @@ -17,7 +17,7 @@ Signed-off-by: Adriana Reus --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c -@@ -2452,7 +2452,7 @@ static int lpuart_probe(struct platform_ +@@ -2476,7 +2476,7 @@ static int lpuart_probe(struct platform_ return PTR_ERR(sport->port.membase); sport->port.membase += sdata->reg_off; diff --git a/target/linux/layerscape/patches-5.4/819-uart-0005-tty-serial-fsl_lpuart-enable-dma-mode-for-imx8qxp.patch b/target/linux/layerscape/patches-5.4/819-uart-0005-tty-serial-fsl_lpuart-enable-dma-mode-for-imx8qxp.patch index d4034bb9db..6edcc398d0 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0005-tty-serial-fsl_lpuart-enable-dma-mode-for-imx8qxp.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0005-tty-serial-fsl_lpuart-enable-dma-mode-for-imx8qxp.patch @@ -60,7 +60,7 @@ Signed-off-by: Fugang Duan /* Rx DMA timeout in ms, which is used to calculate Rx ring buffer size */ #define DMA_RX_TIMEOUT (10) -@@ -253,6 +260,9 @@ struct lpuart_port { +@@ -254,6 +261,9 @@ struct lpuart_port { unsigned int txfifo_size; unsigned int rxfifo_size; @@ -70,7 +70,7 @@ Signed-off-by: Fugang Duan bool lpuart_dma_tx_use; bool lpuart_dma_rx_use; struct dma_chan *dma_tx_chan; -@@ -278,28 +288,38 @@ struct lpuart_soc_data { +@@ -279,33 +289,45 @@ struct lpuart_soc_data { enum lpuart_type devtype; char iotype; u8 reg_off; @@ -85,13 +85,20 @@ Signed-off-by: Fugang Duan + .rx_dma_cyclic = true, }; - static const struct lpuart_soc_data ls_data = { + static const struct lpuart_soc_data ls1021a_data = { .devtype = LS1021A_LPUART, .iotype = UPIO_MEM32BE, + .rx_watermark = 0, + .rx_dma_cyclic = true, }; + static const struct lpuart_soc_data ls1028a_data = { + .devtype = LS1028A_LPUART, + .iotype = UPIO_MEM32, ++ .rx_watermark = 0, ++ .rx_dma_cyclic = true, + }; + static struct lpuart_soc_data imx7ulp_data = { .devtype = IMX7ULP_LPUART, .iotype = UPIO_MEM32, @@ -109,15 +116,15 @@ Signed-off-by: Fugang Duan }; static const struct of_device_id lpuart_dt_ids[] = { -@@ -313,6 +333,7 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids); +@@ -320,6 +342,7 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids); /* Forward declare this for the dma callbacks*/ static void lpuart_dma_tx_complete(void *arg); +static int lpuart_sched_rx_dma(struct lpuart_port *sport); - static inline bool is_imx8qxp_lpuart(struct lpuart_port *sport) + static inline bool is_layerscape_lpuart(struct lpuart_port *sport) { -@@ -998,19 +1019,15 @@ static irqreturn_t lpuart32_int(int irq, +@@ -1011,19 +1034,15 @@ static irqreturn_t lpuart32_int(int irq, if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use) lpuart32_txint(sport); @@ -141,7 +148,7 @@ Signed-off-by: Fugang Duan if (lpuart_is_32(sport)) { unsigned long sr = lpuart32_read(&sport->port, UARTSTAT); -@@ -1062,8 +1079,21 @@ static void lpuart_copy_rx_to_tty(struct +@@ -1075,8 +1094,21 @@ static void lpuart_copy_rx_to_tty(struct writeb(cr2, sport->port.membase + UARTCR2); } } @@ -164,7 +171,7 @@ Signed-off-by: Fugang Duan spin_lock_irqsave(&sport->port.lock, flags); -@@ -1126,7 +1156,33 @@ static void lpuart_copy_rx_to_tty(struct +@@ -1139,7 +1171,33 @@ static void lpuart_copy_rx_to_tty(struct spin_unlock_irqrestore(&sport->port.lock, flags); tty_flip_buffer_push(port); @@ -199,7 +206,7 @@ Signed-off-by: Fugang Duan } static void lpuart_dma_rx_complete(void *arg) -@@ -1134,6 +1190,8 @@ static void lpuart_dma_rx_complete(void +@@ -1147,6 +1205,8 @@ static void lpuart_dma_rx_complete(void struct lpuart_port *sport = arg; lpuart_copy_rx_to_tty(sport); @@ -208,7 +215,7 @@ Signed-off-by: Fugang Duan } static void lpuart_timer_func(struct timer_list *t) -@@ -1141,13 +1199,78 @@ static void lpuart_timer_func(struct tim +@@ -1154,13 +1214,78 @@ static void lpuart_timer_func(struct tim struct lpuart_port *sport = from_timer(sport, t, lpuart_timer); lpuart_copy_rx_to_tty(sport); @@ -291,7 +298,7 @@ Signed-off-by: Fugang Duan int bits, baud; struct tty_port *port = &sport->port.state->port; struct tty_struct *tty = port->tty; -@@ -1167,6 +1290,18 @@ static inline int lpuart_start_rx_dma(st +@@ -1180,6 +1305,18 @@ static inline int lpuart_start_rx_dma(st sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); if (sport->rx_dma_rng_buf_len < 16) sport->rx_dma_rng_buf_len = 16; @@ -310,7 +317,7 @@ Signed-off-by: Fugang Duan ring->buf = kzalloc(sport->rx_dma_rng_buf_len, GFP_ATOMIC); if (!ring->buf) -@@ -1192,32 +1327,7 @@ static inline int lpuart_start_rx_dma(st +@@ -1205,32 +1342,7 @@ static inline int lpuart_start_rx_dma(st return ret; } @@ -344,7 +351,7 @@ Signed-off-by: Fugang Duan } static void lpuart_dma_rx_free(struct uart_port *port) -@@ -1403,8 +1513,10 @@ static void lpuart_setup_watermark(struc +@@ -1416,8 +1528,10 @@ static void lpuart_setup_watermark(struc writeb(UARTSFIFO_RXUF, sport->port.membase + UARTSFIFO); } @@ -356,7 +363,7 @@ Signed-off-by: Fugang Duan /* Restore cr2 */ writeb(cr2_saved, sport->port.membase + UARTCR2); -@@ -1425,6 +1537,7 @@ static void lpuart32_setup_watermark(str +@@ -1438,6 +1552,7 @@ static void lpuart32_setup_watermark(str { unsigned long val, ctrl; unsigned long ctrl_saved; @@ -364,7 +371,7 @@ Signed-off-by: Fugang Duan ctrl = lpuart32_read(&sport->port, UARTCTRL); ctrl_saved = ctrl; -@@ -1436,12 +1549,26 @@ static void lpuart32_setup_watermark(str +@@ -1449,12 +1564,26 @@ static void lpuart32_setup_watermark(str val = lpuart32_read(&sport->port, UARTFIFO); val |= UARTFIFO_TXFE | UARTFIFO_RXFE; val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH; @@ -392,7 +399,7 @@ Signed-off-by: Fugang Duan /* Restore cr2 */ lpuart32_write(&sport->port, ctrl_saved, UARTCTRL); } -@@ -1453,17 +1580,29 @@ static void lpuart32_setup_watermark_ena +@@ -1466,17 +1595,29 @@ static void lpuart32_setup_watermark_ena lpuart32_setup_watermark(sport); temp = lpuart32_read(&sport->port, UARTCTRL); @@ -423,7 +430,7 @@ Signed-off-by: Fugang Duan static void lpuart_tx_dma_startup(struct lpuart_port *sport) { u32 uartbaud; -@@ -1527,19 +1666,23 @@ static int lpuart_startup(struct uart_po +@@ -1540,19 +1681,23 @@ static int lpuart_startup(struct uart_po return 0; } @@ -454,7 +461,7 @@ Signed-off-by: Fugang Duan if (!sport->lpuart_dma_tx_use) temp |= UARTCTRL_TIE; lpuart32_write(&sport->port, temp, UARTCTRL); -@@ -1572,12 +1715,12 @@ static int lpuart32_startup(struct uart_ +@@ -1596,12 +1741,12 @@ static int lpuart32_startup(struct uart_ spin_lock_irqsave(&sport->port.lock, flags); @@ -469,7 +476,7 @@ Signed-off-by: Fugang Duan lpuart32_configure(sport); spin_unlock_irqrestore(&sport->port.lock, flags); -@@ -1587,7 +1730,7 @@ static int lpuart32_startup(struct uart_ +@@ -1611,7 +1756,7 @@ static int lpuart32_startup(struct uart_ static void lpuart_dma_shutdown(struct lpuart_port *sport) { if (sport->lpuart_dma_rx_use) { @@ -478,7 +485,7 @@ Signed-off-by: Fugang Duan lpuart_dma_rx_free(&sport->port); } -@@ -1628,11 +1771,22 @@ static void lpuart32_shutdown(struct uar +@@ -1652,11 +1797,22 @@ static void lpuart32_shutdown(struct uar spin_lock_irqsave(&port->lock, flags); @@ -503,7 +510,7 @@ Signed-off-by: Fugang Duan spin_unlock_irqrestore(&port->lock, flags); -@@ -1729,10 +1883,10 @@ lpuart_set_termios(struct uart_port *por +@@ -1753,10 +1909,10 @@ lpuart_set_termios(struct uart_port *por * baud rate and restart Rx DMA path. * * Since timer function acqures sport->port.lock, need to stop before @@ -516,7 +523,7 @@ Signed-off-by: Fugang Duan lpuart_dma_rx_free(&sport->port); } -@@ -1944,10 +2098,10 @@ lpuart32_set_termios(struct uart_port *p +@@ -1968,10 +2124,10 @@ lpuart32_set_termios(struct uart_port *p * baud rate and restart Rx DMA path. * * Since timer function acqures sport->port.lock, need to stop before @@ -529,7 +536,7 @@ Signed-off-by: Fugang Duan lpuart_dma_rx_free(&sport->port); } -@@ -2456,6 +2610,10 @@ static int lpuart_probe(struct platform_ +@@ -2480,6 +2636,10 @@ static int lpuart_probe(struct platform_ sport->port.dev = &pdev->dev; sport->port.type = PORT_LPUART; sport->devtype = sdata->devtype; @@ -540,7 +547,7 @@ Signed-off-by: Fugang Duan ret = platform_get_irq(pdev, 0); if (ret < 0) return ret; -@@ -2618,7 +2776,7 @@ static int lpuart_suspend(struct device +@@ -2642,7 +2802,7 @@ static int lpuart_suspend(struct device * Rx DMA path before suspend and start Rx DMA path on resume. */ if (irq_wake) { diff --git a/target/linux/layerscape/patches-5.4/819-uart-0006-tty-serial-fsl_lpuart-enable-loopback-mode.patch b/target/linux/layerscape/patches-5.4/819-uart-0006-tty-serial-fsl_lpuart-enable-loopback-mode.patch index cfcb6e83fc..303aa3b011 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0006-tty-serial-fsl_lpuart-enable-loopback-mode.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0006-tty-serial-fsl_lpuart-enable-loopback-mode.patch @@ -12,7 +12,7 @@ Signed-off-by: Fugang Duan --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c -@@ -1462,6 +1462,14 @@ static void lpuart32_set_mctrl(struct ua +@@ -1477,6 +1477,14 @@ static void lpuart32_set_mctrl(struct ua temp |= UARTMODIR_TXCTSE; lpuart32_write(port, temp, UARTMODIR); diff --git a/target/linux/layerscape/patches-5.4/819-uart-0007-MLK-15094-tty-serial-fsl_lpuart-check-dma_tx_in_prog.patch b/target/linux/layerscape/patches-5.4/819-uart-0007-MLK-15094-tty-serial-fsl_lpuart-check-dma_tx_in_prog.patch index 58f44e86b0..41271f9dfd 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0007-MLK-15094-tty-serial-fsl_lpuart-check-dma_tx_in_prog.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0007-MLK-15094-tty-serial-fsl_lpuart-check-dma_tx_in_prog.patch @@ -16,7 +16,7 @@ Signed-off-by: Vipul Kumar --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c -@@ -490,6 +490,10 @@ static void lpuart_dma_tx_complete(void +@@ -505,6 +505,10 @@ static void lpuart_dma_tx_complete(void unsigned long flags; spin_lock_irqsave(&sport->port.lock, flags); diff --git a/target/linux/layerscape/patches-5.4/819-uart-0008-MLK-21445-serial-fsl_lpuart-do-HW-reset-for-communic.patch b/target/linux/layerscape/patches-5.4/819-uart-0008-MLK-21445-serial-fsl_lpuart-do-HW-reset-for-communic.patch index edb0bd20cf..ab52567a3c 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0008-MLK-21445-serial-fsl_lpuart-do-HW-reset-for-communic.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0008-MLK-21445-serial-fsl_lpuart-do-HW-reset-for-communic.patch @@ -59,9 +59,9 @@ Signed-off-by: Shrikant Bobade #define UARTFIFO_RXIDEN_RDRF 0x3 #define UARTCTRL_IDLECFG 0x7 -@@ -335,6 +345,11 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids); - static void lpuart_dma_tx_complete(void *arg); - static int lpuart_sched_rx_dma(struct lpuart_port *sport); +@@ -350,6 +360,11 @@ static inline bool is_layerscape_lpuart( + sport->devtype == LS1028A_LPUART); + } +static inline bool is_imx7ulp_lpuart(struct lpuart_port *sport) +{ @@ -71,7 +71,7 @@ Signed-off-by: Shrikant Bobade static inline bool is_imx8qxp_lpuart(struct lpuart_port *sport) { return sport->devtype == IMX8QXP_LPUART; -@@ -398,6 +413,33 @@ static unsigned int lpuart_get_baud_clk_ +@@ -413,6 +428,33 @@ static unsigned int lpuart_get_baud_clk_ #define lpuart_enable_clks(x) __lpuart_enable_clks(x, true) #define lpuart_disable_clks(x) __lpuart_enable_clks(x, false) @@ -105,7 +105,7 @@ Signed-off-by: Shrikant Bobade static void lpuart_stop_tx(struct uart_port *port) { unsigned char temp; -@@ -2702,6 +2744,10 @@ static int lpuart_probe(struct platform_ +@@ -2728,6 +2770,10 @@ static int lpuart_probe(struct platform_ if (ret) goto failed_attach_port; @@ -116,7 +116,7 @@ Signed-off-by: Shrikant Bobade uart_get_rs485_mode(&pdev->dev, &sport->port.rs485); if (sport->port.rs485.flags & SER_RS485_RX_DURING_TX) -@@ -2725,6 +2771,8 @@ static int lpuart_probe(struct platform_ +@@ -2751,6 +2797,8 @@ static int lpuart_probe(struct platform_ return 0; diff --git a/target/linux/layerscape/patches-5.4/819-uart-0009-MLK-17133-02-tty-serial-lpuart-add-runtime-pm-suppor.patch b/target/linux/layerscape/patches-5.4/819-uart-0009-MLK-17133-02-tty-serial-lpuart-add-runtime-pm-suppor.patch index 7021a6e3c7..d819f4790a 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0009-MLK-17133-02-tty-serial-lpuart-add-runtime-pm-suppor.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0009-MLK-17133-02-tty-serial-lpuart-add-runtime-pm-suppor.patch @@ -22,7 +22,7 @@ Reviewed-by: Robin Gong #define DRIVER_NAME "fsl-lpuart" #define DEV_NAME "ttyLP" -@@ -844,6 +845,20 @@ static void lpuart32_start_tx(struct uar +@@ -859,6 +860,20 @@ static void lpuart32_start_tx(struct uar } } @@ -43,7 +43,7 @@ Reviewed-by: Robin Gong /* return TIOCSER_TEMT when transmitter is not busy */ static unsigned int lpuart_tx_empty(struct uart_port *port) { -@@ -2257,6 +2272,7 @@ static const struct uart_ops lpuart_pops +@@ -2283,6 +2298,7 @@ static const struct uart_ops lpuart_pops .break_ctl = lpuart_break_ctl, .startup = lpuart_startup, .shutdown = lpuart_shutdown, @@ -51,7 +51,7 @@ Reviewed-by: Robin Gong .set_termios = lpuart_set_termios, .type = lpuart_type, .request_port = lpuart_request_port, -@@ -2281,6 +2297,7 @@ static const struct uart_ops lpuart32_po +@@ -2307,6 +2323,7 @@ static const struct uart_ops lpuart32_po .break_ctl = lpuart32_break_ctl, .startup = lpuart32_startup, .shutdown = lpuart32_shutdown, @@ -59,7 +59,7 @@ Reviewed-by: Robin Gong .set_termios = lpuart32_set_termios, .type = lpuart_type, .request_port = lpuart_request_port, -@@ -2740,6 +2757,11 @@ static int lpuart_probe(struct platform_ +@@ -2766,6 +2783,11 @@ static int lpuart_probe(struct platform_ if (ret) goto failed_irq_request; @@ -71,7 +71,7 @@ Reviewed-by: Robin Gong ret = uart_add_one_port(&lpuart_reg, &sport->port); if (ret) goto failed_attach_port; -@@ -2774,6 +2796,9 @@ static int lpuart_probe(struct platform_ +@@ -2800,6 +2822,9 @@ static int lpuart_probe(struct platform_ failed_reset: uart_remove_one_port(&lpuart_reg, &sport->port); failed_attach_port: @@ -81,7 +81,7 @@ Reviewed-by: Robin Gong failed_irq_request: lpuart_disable_clks(sport); failed_clock_enable: -@@ -2800,15 +2825,41 @@ static int lpuart_remove(struct platform +@@ -2826,15 +2851,41 @@ static int lpuart_remove(struct platform if (sport->dma_rx_chan) dma_release_channel(sport->dma_rx_chan); @@ -123,7 +123,7 @@ Reviewed-by: Robin Gong if (lpuart_is_32(sport)) { /* disable Rx/Tx and interrupts */ -@@ -2822,10 +2873,14 @@ static int lpuart_suspend(struct device +@@ -2848,10 +2899,14 @@ static int lpuart_suspend(struct device writeb(temp, sport->port.membase + UARTCR2); } @@ -138,7 +138,7 @@ Reviewed-by: Robin Gong if (sport->lpuart_dma_rx_use) { /* -@@ -2856,9 +2911,6 @@ static int lpuart_suspend(struct device +@@ -2882,9 +2937,6 @@ static int lpuart_suspend(struct device dmaengine_terminate_all(sport->dma_tx_chan); } @@ -148,7 +148,7 @@ Reviewed-by: Robin Gong return 0; } -@@ -2866,9 +2918,11 @@ static int lpuart_resume(struct device * +@@ -2892,9 +2944,11 @@ static int lpuart_resume(struct device * { struct lpuart_port *sport = dev_get_drvdata(dev); bool irq_wake = irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq)); @@ -162,7 +162,7 @@ Reviewed-by: Robin Gong if (lpuart_is_32(sport)) lpuart32_setup_watermark_enable(sport); -@@ -2889,13 +2943,23 @@ static int lpuart_resume(struct device * +@@ -2915,13 +2969,23 @@ static int lpuart_resume(struct device * if (lpuart_is_32(sport)) lpuart32_configure(sport); @@ -188,7 +188,7 @@ Reviewed-by: Robin Gong static struct platform_driver lpuart_driver = { .probe = lpuart_probe, -@@ -2903,7 +2967,7 @@ static struct platform_driver lpuart_dri +@@ -2929,7 +2993,7 @@ static struct platform_driver lpuart_dri .driver = { .name = "fsl-lpuart", .of_match_table = lpuart_dt_ids, diff --git a/target/linux/layerscape/patches-5.4/819-uart-0010-tty-serial-lpuart-enable-wakeup-source-for-lpuart.patch b/target/linux/layerscape/patches-5.4/819-uart-0010-tty-serial-lpuart-enable-wakeup-source-for-lpuart.patch index 71c75584b8..69dc1b465a 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0010-tty-serial-lpuart-enable-wakeup-source-for-lpuart.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0010-tty-serial-lpuart-enable-wakeup-source-for-lpuart.patch @@ -28,7 +28,7 @@ Signed-off-by: Fugang Duan #include #include #include -@@ -1707,10 +1708,23 @@ static void lpuart_rx_dma_startup(struct +@@ -1722,10 +1723,23 @@ static void lpuart_rx_dma_startup(struct } } @@ -53,7 +53,7 @@ Signed-off-by: Fugang Duan unsigned char temp; /* determine FIFO size and enable FIFO mode */ -@@ -1723,14 +1737,7 @@ static int lpuart_startup(struct uart_po +@@ -1738,14 +1752,7 @@ static int lpuart_startup(struct uart_po sport->rxfifo_size = UARTFIFO_DEPTH((temp >> UARTPFIFO_RXSIZE_OFF) & UARTPFIFO_FIFOSIZE_MASK); @@ -69,7 +69,7 @@ Signed-off-by: Fugang Duan return 0; } -@@ -1757,11 +1764,27 @@ static void lpuart32_configure(struct lp +@@ -1772,11 +1779,27 @@ static void lpuart32_configure(struct lp lpuart32_write(&sport->port, temp, UARTCTRL); } @@ -98,9 +98,9 @@ Signed-off-by: Fugang Duan unsigned long temp; int ret; -@@ -1782,17 +1805,8 @@ static int lpuart32_startup(struct uart_ - sport->rxfifo_size = UARTFIFO_DEPTH((temp >> UARTFIFO_RXSIZE_OFF) & - UARTFIFO_FIFOSIZE_MASK); +@@ -1808,17 +1831,8 @@ static int lpuart32_startup(struct uart_ + sport->port.fifosize = sport->txfifo_size; + } - spin_lock_irqsave(&sport->port.lock, flags); - @@ -117,7 +117,7 @@ Signed-off-by: Fugang Duan return 0; } -@@ -2850,108 +2864,205 @@ static int lpuart_runtime_resume(struct +@@ -2876,108 +2890,205 @@ static int lpuart_runtime_resume(struct return lpuart_enable_clks(sport); }; diff --git a/target/linux/layerscape/patches-5.4/819-uart-0011-serial-fsl_lpuart-enable-two-stop-bits.patch b/target/linux/layerscape/patches-5.4/819-uart-0011-serial-fsl_lpuart-enable-two-stop-bits.patch index 3f92a1491e..2d4c14922a 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0011-serial-fsl_lpuart-enable-two-stop-bits.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0011-serial-fsl_lpuart-enable-two-stop-bits.patch @@ -14,7 +14,7 @@ Signed-off-by: Fugang Duan --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c -@@ -2109,11 +2109,12 @@ lpuart32_set_termios(struct uart_port *p +@@ -2135,11 +2135,12 @@ lpuart32_set_termios(struct uart_port *p { struct lpuart_port *sport = container_of(port, struct lpuart_port, port); unsigned long flags; @@ -28,7 +28,7 @@ Signed-off-by: Fugang Duan modem = lpuart32_read(&sport->port, UARTMODIR); /* * only support CS8 and CS7, and for CS7 must enable PE. -@@ -2150,7 +2151,9 @@ lpuart32_set_termios(struct uart_port *p +@@ -2176,7 +2177,9 @@ lpuart32_set_termios(struct uart_port *p } if (termios->c_cflag & CSTOPB) @@ -39,7 +39,7 @@ Signed-off-by: Fugang Duan /* parity must be enabled when CS7 to match 8-bits format */ if ((termios->c_cflag & CSIZE) == CS7) -@@ -2220,6 +2223,7 @@ lpuart32_set_termios(struct uart_port *p +@@ -2246,6 +2249,7 @@ lpuart32_set_termios(struct uart_port *p lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE), UARTCTRL); diff --git a/target/linux/layerscape/patches-5.4/819-uart-0012-tty-serial-lpuart-add-LS1028A-support.patch b/target/linux/layerscape/patches-5.4/819-uart-0012-tty-serial-lpuart-add-LS1028A-support.patch deleted file mode 100644 index a4cb65cfec..0000000000 --- a/target/linux/layerscape/patches-5.4/819-uart-0012-tty-serial-lpuart-add-LS1028A-support.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 932dac0380bbf7276d4111c35674679bc9ad6384 Mon Sep 17 00:00:00 2001 -From: Vabhav Sharma -Date: Thu, 31 Oct 2019 19:20:47 +0530 -Subject: [PATCH] tty: serial: lpuart: add LS1028A support - -NXP LS1028A lpuart is the same IP as LS1021A, but it is -little endian for register accessing instead of big endian -on LS1021A. - -So add LS1028A matching data to distiguish the chips. - -Signed-off-by: Fugang Duan -Signed-off-by: Vabhav Sharma -Acked-by: Fugang Duan ---- - drivers/tty/serial/fsl_lpuart.c | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - ---- a/drivers/tty/serial/fsl_lpuart.c -+++ b/drivers/tty/serial/fsl_lpuart.c -@@ -3,6 +3,7 @@ - * Freescale lpuart serial port driver - * - * Copyright 2012-2014 Freescale Semiconductor, Inc. -+ * Copyright 2019 NXP - */ - - #if defined(CONFIG_SERIAL_FSL_LPUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -@@ -260,6 +261,7 @@ static DEFINE_IDA(fsl_lpuart_ida); - enum lpuart_type { - VF610_LPUART, - LS1021A_LPUART, -+ LS1028A_LPUART, - IMX7ULP_LPUART, - IMX8QXP_LPUART, - }; -@@ -311,13 +313,20 @@ static const struct lpuart_soc_data vf_d - .rx_dma_cyclic = true, - }; - --static const struct lpuart_soc_data ls_data = { -+static const struct lpuart_soc_data ls1021a_data = { - .devtype = LS1021A_LPUART, - .iotype = UPIO_MEM32BE, - .rx_watermark = 0, - .rx_dma_cyclic = true, - }; - -+static const struct lpuart_soc_data ls1028a_data = { -+ .devtype = LS1028A_LPUART, -+ .iotype = UPIO_MEM32, -+ .rx_watermark = 0, -+ .rx_dma_cyclic = true, -+}; -+ - static struct lpuart_soc_data imx7ulp_data = { - .devtype = IMX7ULP_LPUART, - .iotype = UPIO_MEM32, -@@ -336,7 +345,8 @@ static struct lpuart_soc_data imx8qxp_da - - static const struct of_device_id lpuart_dt_ids[] = { - { .compatible = "fsl,vf610-lpuart", .data = &vf_data, }, -- { .compatible = "fsl,ls1021a-lpuart", .data = &ls_data, }, -+ { .compatible = "fsl,ls1021a-lpuart", .data = &ls1021a_data, }, -+ { .compatible = "fsl,ls1028a-lpuart", .data = &ls1028a_data, }, - { .compatible = "fsl,imx7ulp-lpuart", .data = &imx7ulp_data, }, - { .compatible = "fsl,imx8qxp-lpuart", .data = &imx8qxp_data, }, - { /* sentinel */ } diff --git a/target/linux/layerscape/patches-5.4/819-uart-0013-LF-484-tty-serial-lpuart-support-UPIO_MEM32-for-lpua.patch b/target/linux/layerscape/patches-5.4/819-uart-0013-LF-484-tty-serial-lpuart-support-UPIO_MEM32-for-lpua.patch index 125502ff9d..4223d1e2f2 100644 --- a/target/linux/layerscape/patches-5.4/819-uart-0013-LF-484-tty-serial-lpuart-support-UPIO_MEM32-for-lpua.patch +++ b/target/linux/layerscape/patches-5.4/819-uart-0013-LF-484-tty-serial-lpuart-support-UPIO_MEM32-for-lpua.patch @@ -24,7 +24,7 @@ Signed-off-by: Peng Fan --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c -@@ -2598,7 +2598,9 @@ static int __init lpuart32_early_console +@@ -2614,7 +2614,9 @@ static int __init lpuart32_early_console if (!device->port.membase) return -ENODEV; diff --git a/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch b/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch index 2512ed3142..6fae99c1f4 100644 --- a/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch +++ b/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -333,6 +333,8 @@ config RTL8367B_PHY +@@ -329,6 +329,8 @@ config RTL8367B_PHY endif # RTL8366_SMI @@ -11,7 +11,7 @@ config SFP --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -110,3 +110,5 @@ obj-$(CONFIG_STE10XP) += ste10Xp.o +@@ -109,3 +109,5 @@ obj-$(CONFIG_STE10XP) += ste10Xp.o obj-$(CONFIG_TERANETICS_PHY) += teranetics.o obj-$(CONFIG_VITESSE_PHY) += vitesse.o obj-$(CONFIG_XILINX_GMII2RGMII) += xilinx_gmii2rgmii.o diff --git a/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch b/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch index 6b89a39668..d40cbfb853 100644 --- a/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch +++ b/target/linux/mediatek/patches-5.4/0005-dts-mt7622-add-gsw.patch @@ -122,7 +122,7 @@ }; reg_1p8v: regulator-1p8v { -@@ -101,23 +115,82 @@ +@@ -101,23 +113,82 @@ }; ð { @@ -212,7 +212,7 @@ }; }; }; -@@ -185,15 +258,28 @@ +@@ -185,15 +256,28 @@ &pcie { pinctrl-names = "default"; @@ -242,7 +242,7 @@ /* eMMC is shared pin with parallel NAND */ emmc_pins_default: emmc-pins-default { mux { -@@ -460,11 +546,11 @@ +@@ -460,11 +544,11 @@ }; &sata { diff --git a/target/linux/mediatek/patches-5.4/0308-dts-mt7622-add-snand-support.patch b/target/linux/mediatek/patches-5.4/0308-dts-mt7622-add-snand-support.patch index 378ccb8338..b287780d6c 100644 --- a/target/linux/mediatek/patches-5.4/0308-dts-mt7622-add-snand-support.patch +++ b/target/linux/mediatek/patches-5.4/0308-dts-mt7622-add-snand-support.patch @@ -22,7 +22,7 @@ "mediatek,mt8173-nor"; --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -101,7 +101,7 @@ +@@ -99,7 +99,7 @@ }; &bch { @@ -31,7 +31,7 @@ }; &btif { -@@ -553,6 +553,62 @@ +@@ -551,6 +551,62 @@ status = "disable"; }; diff --git a/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch b/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch index bf16062cb7..92296060c3 100644 --- a/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch +++ b/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch @@ -20,7 +20,7 @@ "syscon"; --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -591,7 +591,7 @@ +@@ -589,7 +589,7 @@ reg = <0x140000 0x0080000>; }; @@ -29,7 +29,7 @@ label = "Factory"; reg = <0x1c0000 0x0040000>; }; -@@ -648,3 +648,8 @@ +@@ -646,3 +646,8 @@ pinctrl-0 = <&watchdog_pins>; status = "okay"; }; diff --git a/target/linux/mediatek/patches-5.4/0990-gsw-rtl8367s-mt7622-support.patch b/target/linux/mediatek/patches-5.4/0990-gsw-rtl8367s-mt7622-support.patch index e4cd77bdc8..a3d49e903e 100644 --- a/target/linux/mediatek/patches-5.4/0990-gsw-rtl8367s-mt7622-support.patch +++ b/target/linux/mediatek/patches-5.4/0990-gsw-rtl8367s-mt7622-support.patch @@ -15,7 +15,7 @@ depends on HAS_IOMEM --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -111,4 +111,5 @@ obj-$(CONFIG_TERANETICS_PHY) += teraneti +@@ -110,4 +110,5 @@ obj-$(CONFIG_TERANETICS_PHY) += teraneti obj-$(CONFIG_VITESSE_PHY) += vitesse.o obj-$(CONFIG_XILINX_GMII2RGMII) += xilinx_gmii2rgmii.o obj-$(CONFIG_MT753X_GSW) += mtk/mt753x/ diff --git a/target/linux/mediatek/patches-5.4/0993-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch b/target/linux/mediatek/patches-5.4/0993-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch index 3283746e30..cea83710b7 100644 --- a/target/linux/mediatek/patches-5.4/0993-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch +++ b/target/linux/mediatek/patches-5.4/0993-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch @@ -389,7 +389,7 @@ Signed-off-by: chuanjia.liu <0 0 0 2 &pcie_intc1 1>, --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -256,18 +256,16 @@ +@@ -254,18 +254,16 @@ }; }; diff --git a/target/linux/mediatek/patches-5.4/1003-dts-mt7622-rfb-change-to-ax-mtd-layout.patch b/target/linux/mediatek/patches-5.4/1003-dts-mt7622-rfb-change-to-ax-mtd-layout.patch index 817948986b..74a294f098 100644 --- a/target/linux/mediatek/patches-5.4/1003-dts-mt7622-rfb-change-to-ax-mtd-layout.patch +++ b/target/linux/mediatek/patches-5.4/1003-dts-mt7622-rfb-change-to-ax-mtd-layout.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -591,17 +591,17 @@ +@@ -589,17 +589,17 @@ factory: partition@1c0000 { label = "Factory"; diff --git a/target/linux/mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch b/target/linux/mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch index 61225387dd..927670d8b3 100644 --- a/target/linux/mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch +++ b/target/linux/mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch @@ -30,7 +30,6 @@ Signed-off-by: Gregory CLEMENT --- .../dts/marvell/armada-3720-espressobin-v7-emmc.dts | 10 ++++++++-- .../boot/dts/marvell/armada-3720-espressobin-v7.dts | 10 ++++++++-- - .../boot/dts/marvell/armada-3720-espressobin.dtsi | 12 ++++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) --- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7-emmc.dts @@ -87,48 +86,3 @@ Signed-off-by: Gregory CLEMENT reg = <3>; label = "wan"; phy-handle = <&switch0phy2>; ---- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts -+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts -@@ -21,6 +21,10 @@ - - aliases { - ethernet0 = ð0; -+ /* for dsa slave device */ -+ ethernet1 = &switch0port1; -+ ethernet2 = &switch0port2; -+ ethernet3 = &switch0port3; - serial0 = &uart0; - serial1 = &uart1; - }; -@@ -147,7 +151,7 @@ - #address-cells = <1>; - #size-cells = <0>; - -- port@0 { -+ switch0port0: port@0 { - reg = <0>; - label = "cpu"; - ethernet = <ð0>; -@@ -158,19 +162,19 @@ - }; - }; - -- port@1 { -+ switch0port1: port@1 { - reg = <1>; - label = "wan"; - phy-handle = <&switch0phy0>; - }; - -- port@2 { -+ switch0port2: port@2 { - reg = <2>; - label = "lan0"; - phy-handle = <&switch0phy1>; - }; - -- port@3 { -+ switch0port3: port@3 { - reg = <3>; - label = "lan1"; - phy-handle = <&switch0phy2>; diff --git a/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch index 4b600d7e8a..f156e968af 100644 --- a/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.4/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -4931,6 +4931,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -4930,6 +4930,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); struct spi_nor_flash_parameter *params = &nor->params; @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -4993,7 +4994,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -4992,7 +4993,12 @@ int spi_nor_scan(struct spi_nor *nor, co /* Init flash parameters based on flash_info struct and SFDP */ spi_nor_init_params(nor); From e0cc68daad31ea255bcbf9bfe71cd5bad913f447 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 18 Nov 2020 20:48:26 +0100 Subject: [PATCH 37/50] ramips: use m25p,fast-read on Xiaomi Mi Router 4A Gb/3G v2 The Xiaomi Mi Router 4A Gigabit model has a race condition on bootup causing the SQUASHFS data errors to appear and create a bootloop scenario. Adding the m25p,fast-read property resolves this issue. Suggested-by: David Bentham Signed-off-by: Adrian Schmutzler --- target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi index 65b299e425..c86bdadf55 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi @@ -50,6 +50,7 @@ compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <80000000>; + m25p,fast-read; partitions { compatible = "fixed-partitions"; From 6fdd4187e0b1b5aacbe0130d8c343c7eb4b2f2e7 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 18 Nov 2020 21:38:59 +0100 Subject: [PATCH 38/50] scripts: checkpatch.pl: suppress warnings about MAINTAINERS The kernel expects changes to MAINTAINERS for all removed or added files, printing warnings like: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #828: deleted file mode 100644 Since this does not apply to "our" files in OpenWrt repo, this warning should be disabled. This can be achieved easiest by setting $reported_maintainer_file to 1. While this is a hack that tricks the script into believing the proper MAINTAINERS changes have been made, it's the easiest solution as it does not require to touch any other code. Signed-off-by: Adrian Schmutzler --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9da28baf35..8ffc093548 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2355,7 +2355,7 @@ sub process { my $commit_log_possible_stack_dump = 0; my $commit_log_long_line = 0; my $commit_log_has_diff = 0; - my $reported_maintainer_file = 0; + my $reported_maintainer_file = 1; my $non_utf8_charset = 0; my $last_blank_line = 0; From 7e7470b517ca956c80c9f81252467633a4624ad5 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 18 Nov 2020 21:45:38 +0100 Subject: [PATCH 39/50] scripts: add const_structs.checkpatch for checkpatch.pl Kernel has separated the structs that are reported to be const in checkpatch.pl into a file of its own, const_structs.checkpatch. This file has been missing after the recent update of checkpatch.pl, leading to the following message: No structs that should be const will be found - file '/data/openwrt/scripts/const_structs.checkpatch': No such file or directory This commit adds the relevant file from v5.10-rc4. Fixes: 086ee09bbcac ("scripts: Update checkpatch.pl to 2020-06-11") Signed-off-by: Adrian Schmutzler --- scripts/const_structs.checkpatch | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 scripts/const_structs.checkpatch diff --git a/scripts/const_structs.checkpatch b/scripts/const_structs.checkpatch new file mode 100644 index 0000000000..1aae4f4fda --- /dev/null +++ b/scripts/const_structs.checkpatch @@ -0,0 +1,68 @@ +acpi_dock_ops +address_space_operations +backlight_ops +block_device_operations +clk_ops +comedi_lrange +component_ops +dentry_operations +dev_pm_ops +dma_map_ops +driver_info +drm_connector_funcs +drm_encoder_funcs +drm_encoder_helper_funcs +ethtool_ops +extent_io_ops +file_lock_operations +file_operations +hv_ops +ide_dma_ops +ide_port_ops +inode_operations +intel_dvo_dev_ops +irq_domain_ops +item_operations +iwl_cfg +iwl_ops +kgdb_arch +kgdb_io +kset_uevent_ops +lock_manager_operations +machine_desc +microcode_ops +mlxsw_reg_info +mtrr_ops +neigh_ops +net_device_ops +nlmsvc_binding +nvkm_device_chip +of_device_id +pci_raw_ops +phy_ops +pinctrl_ops +pinmux_ops +pipe_buf_operations +platform_hibernation_ops +platform_suspend_ops +proto_ops +regmap_access_table +regulator_ops +rpc_pipe_ops +rtc_class_ops +sd_desc +seq_operations +sirfsoc_padmux +snd_ac97_build_ops +snd_soc_component_driver +soc_pcmcia_socket_ops +stacktrace_ops +sysfs_ops +tty_operations +uart_ops +usb_mon_operations +v4l2_ctrl_ops +v4l2_ioctl_ops +vm_operations_struct +wacom_features +wd_ops From d44463b087839ea9b31da2411447e85befbd9ec7 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Mon, 9 Nov 2020 01:23:26 +0100 Subject: [PATCH 40/50] ath79: add label MAC address for ALFA Network N5Q Signed-off-by: Piotr Dymacz --- target/linux/ath79/generic/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 58518a8273..4d0766d262 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -417,6 +417,7 @@ ath79_setup_macs() alfa-network,ap121f|\ alfa-network,ap121fe|\ alfa-network,n2q|\ + alfa-network,n5q|\ alfa-network,r36a|\ engenius,ens202ext-v1) label_mac=$(mtd_get_mac_binary art 0x1002) From 64a6f4a9c1553a968969fb8821f558c875187acc Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 9 Oct 2020 07:30:24 +0200 Subject: [PATCH 41/50] ath79: add support for ALFA Network Pi-WiFi4 ALFA Network Pi-WiFi4 is a Qualcomm QCA9531 v2 based, high-power 802.11n WiFi board in Raspberry Pi 3B shape, equipped with 1x FE and 4x USB 2.0. Specifications: - Qualcomm/Atheros QCA9531 v2 - 650/400/200 MHz (CPU/DDR/AHB) - 128 MB of RAM (DDR2) - 16+ MB of flash (SPI NOR) - 1x 10/100 Mbps Ethernet - 2T2R 2.4 GHz Wi-Fi with Qorvo RFFM8228P FEM - 2x IPEX/U.FL connectors on PCB - 4x USB 2.0 Type-A - Genesys Logic GL850G 4-port USB HUB - USB power is controlled by GPIO - 5x LED (3x on PCB, 2x in RJ45, 4x driven by GPIO) - 1x button (reset) - external h/w watchdog (EM6324QYSP5B, enabled by default) - 1x micro USB Type-B for power and system console (Holtek HT42B534) - UART and GPIO (8-pin, 1.27 mm pitch) header on PCB Flash instruction: You can use sysupgrade image directly in vendor firmware which is based on LEDE/OpenWrt. Alternatively, you can use web recovery mode in U-Boot: 1. Configure PC with static IP 192.168.1.2/24. 2. Connect PC with one of RJ45 ports, press the reset button, power up device, wait for first blink of all LEDs (indicates network setup), then keep button for 3 following blinks and release it. 3. Open 192.168.1.1 address in your browser and upload sysupgrade image. Signed-off-by: Piotr Dymacz --- .../dts/qca9531_alfa-network_pi-wifi4.dts | 87 +++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 4 + .../generic/base-files/etc/board.d/02_network | 2 + target/linux/ath79/image/generic.mk | 9 ++ 4 files changed, 102 insertions(+) create mode 100644 target/linux/ath79/dts/qca9531_alfa-network_pi-wifi4.dts diff --git a/target/linux/ath79/dts/qca9531_alfa-network_pi-wifi4.dts b/target/linux/ath79/dts/qca9531_alfa-network_pi-wifi4.dts new file mode 100644 index 0000000000..42f2c9ffe5 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_alfa-network_pi-wifi4.dts @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9531_alfa-network_r36a.dtsi" + +/ { + model = "ALFA Network Pi-WiFi4"; + compatible = "alfa-network,pi-wifi4", "qca,qca9531"; + + aliases { + led-boot = &led_usb; + led-failsafe = &led_usb; + led-upgrade = &led_usb; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + pinctrl-0 = <&enable_gpio4 &enable_gpio16>; + + lan_data { + label = "orange:lan_data"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + lan_link { + label = "green:lan_link"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + led_usb: usb { + label = "green:usb"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "usbport"; + trigger-sources = <&gl850g_port1>, <&gl850g_port2>, + <&gl850g_port3>, <&gl850g_port4>; + }; + + wlan { + label = "blue:wlan"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; +}; + +ð0 { + mtd-mac-address = <&art 0x1002>; + mtd-mac-address-increment = <(-1)>; +}; + +ð1 { + compatible = "syscon", "simple-mfd"; +}; + +&gpio_export { + usb-power { + gpio-export,name = "usb-power"; + gpio-export,output = <1>; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; +}; + +&hub_port0 { + #address-cells = <1>; + #size-cells = <0>; + + gl850g_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + gl850g_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; + + gl850g_port3: port@3 { + reg = <3>; + #trigger-source-cells = <0>; + }; + + gl850g_port4: port@4 { + reg = <4>; + #trigger-source-cells = <0>; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 08ca2a8398..a345dca4af 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -40,6 +40,10 @@ alfa-network,n5q) ucidef_set_led_rssi "signal3" "SIGNAL3" "green:signal3" "wlan0" "50" "100" ucidef_set_led_rssi "signal4" "SIGNAL4" "green:signal4" "wlan0" "75" "100" ;; +alfa-network,pi-wifi4) + ucidef_set_led_netdev "lan_data" "LAN_DATA" "orange:lan_data" "eth0" "tx rx" + ucidef_set_led_netdev "lan_link" "LAN_LINK" "green:lan_link" "eth0" "link" + ;; alfa-network,r36a) ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" ucidef_set_led_switch "wan" "WAN" "blue:wan" "switch0" "0x10" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 4d0766d262..d03399a054 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -13,6 +13,7 @@ ath79_setup_interfaces() adtran,bsap1840|\ allnet,all-wap02860ac|\ alfa-network,ap121f|\ + alfa-network,pi-wifi4|\ arduino,yun|\ aruba,ap-105|\ avm,fritz1750e|\ @@ -418,6 +419,7 @@ ath79_setup_macs() alfa-network,ap121fe|\ alfa-network,n2q|\ alfa-network,n5q|\ + alfa-network,pi-wifi4|\ alfa-network,r36a|\ engenius,ens202ext-v1) label_mac=$(mtd_get_mac_binary art 0x1002) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index dc91e1b6d9..fc8b136c51 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -257,6 +257,15 @@ define Device/alfa-network_n5q endef TARGET_DEVICES += alfa-network_n5q +define Device/alfa-network_pi-wifi4 + SOC := qca9531 + DEVICE_VENDOR := ALFA Network + DEVICE_MODEL := Pi-WiFi4 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport -swconfig + IMAGE_SIZE := 15872k +endef +TARGET_DEVICES += alfa-network_pi-wifi4 + define Device/alfa-network_r36a SOC := qca9531 DEVICE_VENDOR := ALFA Network From 1bce45fc0f1b75c93847ac56e63a286af23534af Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 9 Oct 2020 07:31:44 +0200 Subject: [PATCH 42/50] uboot-envtools: ath79: add support for ALFA Network Pi-WiFi4 Signed-off-by: Piotr Dymacz --- package/boot/uboot-envtools/files/ath79 | 1 + 1 file changed, 1 insertion(+) diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 2c3697db05..4083a5be20 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -17,6 +17,7 @@ alfa-network,ap121f|\ alfa-network,ap121fe|\ alfa-network,n2q|\ alfa-network,n5q|\ +alfa-network,pi-wifi4|\ alfa-network,r36a|\ allnet,all-wap02860ac|\ arduino,yun|\ From 6d65e3af9b3122e1893d55d1406af286048a1530 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 30 Oct 2020 14:16:08 +0100 Subject: [PATCH 43/50] ath79: calculate Eth MACs from WLAN on ALFA Network R36A New batches of the R36A board series might no longer keep separated Ethernet MAC addresses stored in flash. Use same approach as on the N2Q and calculate Ethernet MACs from WLAN one which is kept in ART. Signed-off-by: Piotr Dymacz --- target/linux/ath79/dts/qca9531_alfa-network_r36a.dts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/qca9531_alfa-network_r36a.dts b/target/linux/ath79/dts/qca9531_alfa-network_r36a.dts index 2588b10d73..ab65369246 100644 --- a/target/linux/ath79/dts/qca9531_alfa-network_r36a.dts +++ b/target/linux/ath79/dts/qca9531_alfa-network_r36a.dts @@ -50,7 +50,8 @@ }; ð0 { - mtd-mac-address = <&art 0x0>; + mtd-mac-address = <&art 0x1002>; + mtd-mac-address-increment = <(-2)>; }; ð1 { @@ -58,7 +59,8 @@ * (GMAC0 -> eth0, GMAC1 -> eth1, same as in old ar71xx target) */ compatible = "qca,qca9530-eth", "syscon", "simple-mfd"; - mtd-mac-address = <&art 0x6>; + mtd-mac-address = <&art 0x1002>; + mtd-mac-address-increment = <(-1)>; }; &gpio_export { From a92d55efcfb2652c7c7261cc1221077b30041f58 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Mon, 16 Nov 2020 01:46:49 +0100 Subject: [PATCH 44/50] ath79: fix reset button support on 8devices Lima This fixes 'linux,code' property name and value for the 'reset' key node in 8devices Lima DTS file. Problem and solution were reported on the forum, see: https://forum.openwrt.org/t/resetbutton-not-working-ath79-8devices-lima/78810 Signed-off-by: Piotr Dymacz --- target/linux/ath79/dts/qca9531_8dev_lima.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/qca9531_8dev_lima.dts b/target/linux/ath79/dts/qca9531_8dev_lima.dts index 266807b837..d13ae66a1c 100644 --- a/target/linux/ath79/dts/qca9531_8dev_lima.dts +++ b/target/linux/ath79/dts/qca9531_8dev_lima.dts @@ -14,7 +14,7 @@ reset { label = "reset"; - linux-code = "KEY_RESTART"; + linux,code = ; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; }; }; From f276395cda79996d395209700a51bb94a0e25abd Mon Sep 17 00:00:00 2001 From: Marc Egerton Date: Fri, 2 Oct 2020 18:30:59 +0100 Subject: [PATCH 45/50] ramips: add support for the Hak5 WiFi Pineapple Mark 7 This patch adds support for the WiFi Pineapple Mark 7, a wireless penetration testing tool. Specifications: * SoC: MediaTek MT7628 (580MHz) * RAM: 256MiB (DDR2) * Storage 1: 32MiB NOR (SPI) * Storage 2: 2GB eMMC * Wireless 1: 802.11b/g/n 2.4GHz (Built In) * Wireless 2: 802.11b/g/n 2.4GHz (MT7601) * Wireless 3: 802.11b/g/n 2.4GHz (MT7601) * USB: 1x USB Type-A 2.0 Host Port * Ethernet: 1x USB Type-C AX88772C Ethernet * UART: 57600 8N1 on PCB * Inputs: 1x Reset Button * Outputs: 1x RGB LED * FCCID: 2AA52MK7 Flash Instructions: Original firmware is based on OpenWRT. Use sysupgrade via SSH to flash. Signed-off-by: Marc Egerton [pepe2k@gmail.com: set only required/used gpio groups to gpio function] Signed-off-by: Piotr Dymacz --- .../dts/mt7628an_hak5_wifi-pineapple-mk7.dts | 124 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 9 ++ .../mt76x8/base-files/etc/board.d/02_network | 1 + 3 files changed, 134 insertions(+) create mode 100644 target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts diff --git a/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts b/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts new file mode 100644 index 0000000000..2ef0422925 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" +#include +#include + +/ { + compatible = "hak5,wifi-pineapple-mk7", "mediatek,mt7628an-soc"; + model = "Hak5 WiFi Pineapple Mark 7"; + + aliases { + led-boot = &led_system_blue; + led-failsafe = &led_system_blue; + led-upgrade = &led_system_blue; + }; + + leds { + compatible = "gpio-leds"; + + system_red { + label = "red:system"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + + system_green { + label = "green:system"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + }; + + led_system_blue: system_blue { + label = "blue:system"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb-power { + gpio-export,name = "usb-power"; + gpio-export,output = <1>; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + }; + + sdhci@10130000 { + compatible = "ralink,mt7620-sdhci"; + reg = <0x10130000 4000>; + + interrupt-parent = <&intc>; + interrupts = <14>; + + status = "okay"; + }; +}; + +&state_default { + gpio { + groups = "gpio", "i2c", "i2s"; + function = "gpio"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; + }; +}; + +ðernet { + status = "okay"; + + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 6327c95bb0..5459288341 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -119,6 +119,15 @@ define Device/glinet_vixmini endef TARGET_DEVICES += glinet_vixmini +define Device/hak5_wifi-pineapple-mk7 + IMAGE_SIZE := 32448k + DEVICE_VENDOR := Hak5 + DEVICE_MODEL := WiFi Pineapple Mark 7 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci + SUPPORTED_DEVICES += wifi-pineapple-mk7 +endef +TARGET_DEVICES += hak5_wifi-pineapple-mk7 + define Device/hilink_hlk-7628n IMAGE_SIZE := 32448k DEVICE_VENDOR := HILINK diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 2cda818b2a..a6272e5a55 100755 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -13,6 +13,7 @@ ramips_setup_interfaces() d-team,pbr-d1|\ glinet,microuter-n300|\ glinet,vixmini|\ + hak5,wifi-pineapple-mk7|\ mediatek,linkit-smart-7688|\ onion,omega2p|\ onion,omega2|\ From 8134c542e2e41d1156efe2a43d81304554a90540 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 19 Nov 2020 15:08:33 +0100 Subject: [PATCH 46/50] base-files: generated named bridge-vlan sections Signed-off-by: John Crispin --- package/base-files/files/bin/config_generate | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index e23f901504..79386d41b5 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -18,14 +18,15 @@ generate_bridge() { bridge_vlan_id=0 generate_bridge_vlan() { - local device=$1 - local ports="$2" + local name=$1_vlan + local device=$2 + local ports="$3" bridge_vlan_id=$((bridge_vlan_id + 1)) uci -q batch <<-EOF - add network bridge-vlan - set network.@bridge-vlan[-1].device='$device' - set network.@bridge-vlan[-1].vlan='$bridge_vlan_id' - set network.@bridge-vlan[-1].ports='$ports' + set network.$name=bridge-vlan + set network.$name.device='$device' + set network.$name.vlan='$bridge_vlan_id' + set network.$name.ports='$ports' EOF } @@ -101,7 +102,7 @@ generate_network() { esac [ -n "$bridge" ] && { - generate_bridge_vlan $bridge "$ifname" + generate_bridge_vlan $1 $bridge "$ifname" ifname=$bridge.$bridge_vlan_id type="" } From 2127accd441b1c979c8f3f56f3ad5264542e185a Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 18 Nov 2020 22:58:58 +0100 Subject: [PATCH 47/50] build: create $(PKG_SYMVERS_DIR) if non-existent Commit 5d76065 moved the creation of the symvers directory to include/kernel-build.mk. This is fine when building from scratch. But when unpacking an SDK the directory doesn't exist and because the kernel won't be built (again) this directory will not be created by the build system, causing build failure if make tries to copy files into it. This moves the creation of the symvers directory back into include/kernel.mk so that the directory is created in any case. Signed-off-by: Sebastian Kemper --- include/kernel-build.mk | 1 - include/kernel.mk | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index a698deec3c..22f7c4c7c7 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -136,7 +136,6 @@ define BuildKernel $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE $(Kernel/CompileModules) - mkdir -p $(PKG_SYMVERS_DIR) touch $$@ $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST) diff --git a/include/kernel.mk b/include/kernel.mk index 1ae9c6be29..1466048b0c 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -149,6 +149,7 @@ define collect_module_symvers grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ done; \ sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \ + mkdir -p $(PKG_SYMVERS_DIR); \ mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers endef From 418362b1cc106b9aca3905150199f60548906fff Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 2 Nov 2020 12:15:05 -1000 Subject: [PATCH 48/50] imagebuilder: add package signature verification The ImageBuilder downloads pre-built packages and adds them to images. This process uses `opkg` which has the capability to verify package list signatures via `usign`, as enabled per default on running OpenWrt devices. Until now this was disabled for ImageBuilders because neither the `opkg` keys nor the `opkg-add` script was present during first packagelist update. To harden the ImageBuilder against *drive-by-download-attacks* both keys and verification script are added to the ImageBuilder allowing `opkg` to verify downloaded package indices. This commit adds `opkg-add` to the ImageBuilder scripts folder. The keys folder is added to ImageBuilder $TOPDIR to have an obvious place for users to store their own keys. The `option check_signature` is appended to the repositories.conf file. All of the above only happens if the Buildbot runs with the SIGNATURE_CHECK option. The keys stored in the ImageBuilder keys/ are the same as included in the openwrt-keyring package. To avoid the chicken-egg problem of downloading and verifying a package, containing signing keys, the keys are added during the ImageBuilder generation. They are same as in shipped images (stored at `/etc/opkg/keys/`). To allow a local package feed in which the user can add additional packages, a local set of `usign` and `ucert` keys is generated, same as building OpenWrt from source. The private key signs the local repository inside the packages/ folder. The local public key is added to the keys/ folder to be considered by `opkg` when updating repositories. This way a local package feed can be modified while requiring `opkg` to check signatures for remote feed, making HTTPS optional. The new option `ADD_LOCAL_KEY` allows to add the local key inside the created images, adding the advantage that sysupgrades can validate the ImageBuilders local key. Signed-off-by: Paul Spooren --- target/imagebuilder/Makefile | 8 ++++++++ target/imagebuilder/files/Makefile | 33 ++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile index 8b2f4e5af6..a96f8618e8 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -61,6 +61,14 @@ else -exec $(CP) -t $(IB_LDIR)/ {} + endif +ifneq ($(CONFIG_SIGNATURE_CHECK),) + echo '' >> $(PKG_BUILD_DIR)/repositories.conf + echo 'option check_signature' >> $(PKG_BUILD_DIR)/repositories.conf + $(INSTALL_DIR) $(PKG_BUILD_DIR)/keys + $(CP) -L $(STAGING_DIR_ROOT)/etc/opkg/keys/ $(PKG_BUILD_DIR)/ + $(CP) -L $(STAGING_DIR_ROOT)/usr/sbin/opkg-key $(PKG_BUILD_DIR)/scripts/ +endif + $(CP) $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/ if [ -d $(TOPDIR)/staging_dir/host/lib/grub ]; then \ $(CP) $(TOPDIR)/staging_dir/host/lib/grub/ $(PKG_BUILD_DIR)/staging_dir/host/lib; \ diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 0ce5f8b39b..65cba92b32 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -46,6 +46,7 @@ Building images: make image BIN_DIR="" # alternative output directory for the images make image EXTRA_IMAGE_NAME="" # Add this to the output image filename (sanitized) make image DISABLED_SERVICES=" [ [ ..]]" # Which services in /etc/init.d/ should be disabled + make image ADD_LOCAL_KEY=1 # store locally generated signing key in built images Print manifest: List "all" packages which get installed into the image. @@ -64,8 +65,10 @@ help: FORCE # override variables from rules.mk PACKAGE_DIR:=$(TOPDIR)/packages LISTS_DIR:=$(subst $(space),/,$(patsubst %,..,$(subst /,$(space),$(TARGET_DIR))))$(DL_DIR) +export OPKG_KEYS:=$(TOPDIR)/keys OPKG:=$(call opkg,$(TARGET_DIR)) \ -f $(TOPDIR)/repositories.conf \ + --verify-program $(SCRIPT_DIR)/opkg-key \ --cache $(DL_DIR) \ --lists-dir $(LISTS_DIR) @@ -133,7 +136,9 @@ package_index: FORCE @echo Building package index... >&2 @mkdir -p $(TMP_DIR) $(TARGET_DIR)/tmp (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \ - gzip -9nc Packages > Packages.gz \ + gzip -9nc Packages > Packages.gz; \ + $(if $(CONFIG_SIGNATURE_CHECK), \ + $(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY)); \ ) >/dev/null 2>/dev/null $(OPKG) update >&2 || true @@ -165,9 +170,14 @@ prepare_rootfs: FORCE @echo Finalizing root filesystem... $(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG) + $(if $(CONFIG_SIGNATURE_CHECK), \ + $(if $(ADD_LOCAL_KEY), \ + OPKG_KEYS=$(TARGET_DIR)/etc/opkg/keys/ \ + $(SCRIPT_DIR)/opkg-key add $(BUILD_KEY).pub \ + ) \ + ) $(call prepare_rootfs,$(TARGET_DIR),$(USER_FILES),$(DISABLED_SERVICES)) - build_image: FORCE @echo @echo Building images... @@ -206,8 +216,26 @@ ifneq ($(PROFILE),) endif endif +_check_keys: FORCE +ifneq ($(CONFIG_SIGNATURE_CHECK),) + @if [ ! -s $(BUILD_KEY) -o ! -s $(BUILD_KEY).pub ]; then \ + echo Generate local signing keys... >&2; \ + $(STAGING_DIR_HOST)/bin/usign -G \ + -s $(BUILD_KEY) -p $(BUILD_KEY).pub -c "Local build key"; \ + $(SCRIPT_DIR)/opkg-key add $(BUILD_KEY).pub; \ + fi + if [ ! -s $(BUILD_KEY).ucert ]; then \ + echo Generate local certificate... >&2; \ + $(STAGING_DIR_HOST)/bin/ucert -I \ + -c $(BUILD_KEY).ucert \ + -p $(BUILD_KEY).pub \ + -s $(BUILD_KEY); \ + fi +endif + image: $(MAKE) -s _check_profile + $(MAKE) -s _check_keys (unset PROFILE FILES PACKAGES MAKEFLAGS; \ $(MAKE) -s _call_image \ $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ @@ -218,6 +246,7 @@ image: manifest: FORCE $(MAKE) -s _check_profile + $(MAKE) -s _check_keys (unset PROFILE FILES PACKAGES MAKEFLAGS; \ $(MAKE) -s _call_manifest \ $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ From d36999389890fb952fc7cc8c0db8e1bbb671af12 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 18 Nov 2020 16:02:23 +0100 Subject: [PATCH 49/50] scripts: download.pl: retry download using filename With this commit, the download script will try downloading source files using the filename instead of the url-filename in case the previous download attempt using the url-filename failed. This is required, as the OpenWrt sources mirrors serve files using the filename files might be renamed to after downloading. If the original mirror for a file where url-filename and filename do not match goes down, the download failed prior to this patch. Further improvement can be done by performing this only for the OpenWrt sources mirrors. Signed-off-by: David Bauer --- scripts/download.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/download.pl b/scripts/download.pl index cdccae133f..351b06a08b 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -93,6 +93,7 @@ $hash_cmd or ($file_hash eq "skip") or die "Cannot find appropriate hash command sub download { my $mirror = shift; + my $download_filename = shift; $mirror =~ s!/$!!; @@ -139,7 +140,7 @@ sub download } }; } else { - my @cmd = download_cmd("$mirror/$url_filename"); + my @cmd = download_cmd("$mirror/$download_filename"); print STDERR "+ ".join(" ",@cmd)."\n"; open(FETCH_FD, '-|', @cmd) or die "Cannot launch curl or wget.\n"; $hash_cmd and do { @@ -265,7 +266,10 @@ while (!-f "$target/$filename") { my $mirror = shift @mirrors; $mirror or die "No more mirrors to try - giving up.\n"; - download($mirror); + download($mirror, $url_filename); + if (!-f "$target/$filename" && $url_filename ne $filename) { + download($mirror, $filename); + } } $SIG{INT} = \&cleanup; From 4d4ef1058c0f10aa2fa4070cd6b9db4d48b94148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 20 Nov 2020 13:13:27 +0100 Subject: [PATCH 50/50] musl: handle wcsnrtombs destination buffer overflow (CVE-2020-28928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wcsnrtombs function in all musl libc versions up through 1.2.1 has been found to have multiple bugs in handling of destination buffer size when limiting the input character count, which can lead to infinite loop with no forward progress (no overflow) or writing past the end of the destination buffera. This function is not used internally in musl and is not widely used, but does appear in some applications. The non-input-limiting form wcsrtombs is not affected. All users of musl 1.2.1 and prior versions should apply the attached patch, which replaces the overly complex and erroneous implementation. The upcoming 1.2.2 release will adopt this new implementation. Signed-off-by: Petr Štetiar --- toolchain/musl/common.mk | 2 +- .../700-wcsnrtombs-cve-2020-28928.diff | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff diff --git a/toolchain/musl/common.mk b/toolchain/musl/common.mk index 8c8eddc855..68098f5c6a 100644 --- a/toolchain/musl/common.mk +++ b/toolchain/musl/common.mk @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/target.mk PKG_NAME:=musl PKG_VERSION:=1.1.24 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://musl.libc.org/releases/ diff --git a/toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff b/toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff new file mode 100644 index 0000000000..8465f9422a --- /dev/null +++ b/toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff @@ -0,0 +1,65 @@ +diff --git a/src/multibyte/wcsnrtombs.c b/src/multibyte/wcsnrtombs.c +index 676932b5..95e25e70 100644 +--- a/src/multibyte/wcsnrtombs.c ++++ b/src/multibyte/wcsnrtombs.c +@@ -1,41 +1,33 @@ + #include ++#include ++#include + + size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict wcs, size_t wn, size_t n, mbstate_t *restrict st) + { +- size_t l, cnt=0, n2; +- char *s, buf[256]; + const wchar_t *ws = *wcs; +- const wchar_t *tmp_ws; +- +- if (!dst) s = buf, n = sizeof buf; +- else s = dst; +- +- while ( ws && n && ( (n2=wn)>=n || n2>32 ) ) { +- if (n2>=n) n2=n; +- tmp_ws = ws; +- l = wcsrtombs(s, &ws, n2, 0); +- if (!(l+1)) { +- cnt = l; +- n = 0; ++ size_t cnt = 0; ++ if (!dst) n=0; ++ while (ws && wn) { ++ char tmp[MB_LEN_MAX]; ++ size_t l = wcrtomb(nn) break; ++ memcpy(dst, tmp, l); ++ } ++ dst += l; + n -= l; + } +- wn = ws ? wn - (ws - tmp_ws) : 0; +- cnt += l; +- } +- if (ws) while (n && wn) { +- l = wcrtomb(s, *ws, 0); +- if ((l+1)<=1) { +- if (!l) ws = 0; +- else cnt = l; ++ if (!*ws) { ++ ws = 0; + break; + } +- ws++; wn--; +- /* safe - this loop runs fewer than sizeof(buf) times */ +- s+=l; n-=l; ++ ws++; ++ wn--; + cnt += l; + } + if (dst) *wcs = ws;