From 81923802883c19ae5e86006320ab3d3151f3727d Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 21 May 2023 15:30:04 +0200 Subject: [PATCH 0001/1171] OpenWrt v23.05: set branch defaults Signed-off-by: Christian Marangi --- feeds.conf.default | 12 ++++-------- include/version.mk | 4 ++-- package/base-files/image-config.in | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/feeds.conf.default b/feeds.conf.default index 50ae67cb9dba99..f062f8545ed94b 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,8 +1,4 @@ -src-git-full packages https://git.openwrt.org/feed/packages.git -src-git-full luci https://git.openwrt.org/project/luci.git -src-git-full routing https://git.openwrt.org/feed/routing.git -src-git-full telephony https://git.openwrt.org/feed/telephony.git -#src-git-full video https://github.com/openwrt/video.git -#src-git-full targets https://github.com/openwrt/targets.git -#src-git-full oldpackages http://git.openwrt.org/packages.git -#src-link custom /usr/src/openwrt/custom-feed +src-git-full packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git-full luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git-full routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git-full telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index f39e35cd099a7d..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 2de2130b8490d9..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/snapshots" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: From fdfb848402cb7c43f63be1868d79c30780d1901c Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Sun, 22 May 2022 06:10:56 -0400 Subject: [PATCH 0002/1171] prereq-build: allow host command symlinks to update This makes the prereq stage update the symlinks installed into staging_dir/host/bin by rearrainging the way they are verified. Before, seeing or installing a symlink would result in a successful exit code, and not installing a symlink would result is a failed exit code. However, that is not able to account for the difference between existing good and bad links, or whether the link would be the same if it was reinstalled, because the check can match the program to a different path. Instead, let a success exit code represent identifying an existing symlink as exactly the same as what would be installed if it did not exist, and let a fail exit code represent needing to install the symlink or not having a match to the check criteria. The failing exit code is caught by a new second attempt for all of the check-* targets which will then indicate to the user that there was an update by having a success exit code when the check is run again and the link is the same. When there is nothing to update, the checks will run only once. This relies on the ls command to be POSIX-conformant with long format: "path/to/link -> target/of/link" Also, make sure the symlink is executable, not just a file, and the directory only needs to be created once. Fixes: #12610 Signed-off-by: Michael Pratt (cherry picked from commit f75204036ccc56700df18258602cc65726dd653b) --- include/prereq.mk | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/prereq.mk b/include/prereq.mk index d34539ec3043f7..89660d323d9b82 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -30,6 +30,8 @@ define Require printf "Checking '$(1)'... " if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \ echo 'ok.'; \ + elif $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \ + echo 'updated.'; \ else \ echo 'failed.'; \ echo "$(PKG_NAME): $(strip $(2))" >> $(TMP_DIR)/.prereq-error; \ @@ -107,7 +109,7 @@ endef # 3+: candidates define SetupHostCommand define Require/$(1) - [ -f "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0; \ + mkdir -p "$(STAGING_DIR_HOST)/bin"; \ for cmd in $(call QuoteHostCommand,$(3)) $(call QuoteHostCommand,$(4)) \ $(call QuoteHostCommand,$(5)) $(call QuoteHostCommand,$(6)) \ $(call QuoteHostCommand,$(7)) $(call QuoteHostCommand,$(8)) \ @@ -117,9 +119,13 @@ define SetupHostCommand bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \ command -v "$$$$$$$${cmd%% *}")"; \ if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \ - mkdir -p "$(STAGING_DIR_HOST)/bin"; \ + case "$$$$$$$$(ls -dl -- $(STAGING_DIR_HOST)/bin/$(strip $(1)))" in \ + *" -> $$$$$$$$bin"*) \ + [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ + ;; \ + esac; \ ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \ - exit 0; \ + exit 1; \ fi; \ fi; \ done; \ From 7f0db09513c88e9c68f121d33cf56754e967b349 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 16 May 2023 03:22:09 -0400 Subject: [PATCH 0003/1171] prereq-build: remove python 2 cleanup recipe This reverts commit 3b68fb57c938af3948ae4c2da61501183fbef649. After refactoring build checks to update old symlinks, and after a long time of no python 2 support, this is no longer needed. Signed-off-by: Michael Pratt (cherry picked from commit e2f9fa42044a2660f702a9b51b14cbde24a13702) --- include/prereq-build.mk | 2 -- include/prereq.mk | 12 ------------ 2 files changed, 14 deletions(-) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 14a221088050f5..52988fbda92717 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -175,8 +175,6 @@ $(eval $(call SetupHostCommand,install,Please install GNU 'install', \ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) -$(eval $(call CleanupPython2)) - $(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \ python3.11 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \ diff --git a/include/prereq.mk b/include/prereq.mk index 89660d323d9b82..5646b24efaa61a 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -77,18 +77,6 @@ define RequireCHeader $$(eval $$(call Require,$(1),$(2))) endef -define CleanupPython2 - define Require/python2-cleanup - if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \ - $(STAGING_DIR_HOST)/bin/python -V 2>&1 | \ - grep -q 'Python 2'; then \ - rm $(STAGING_DIR_HOST)/bin/python; \ - fi - endef - - $$(eval $$(call Require,python2-cleanup)) -endef - define QuoteHostCommand '$(subst ','"'"',$(strip $(1)))' endef From 56ffc5a86676b105e806734e722f581f8ccb2a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 23 May 2023 14:17:47 +0200 Subject: [PATCH 0004/1171] prereq: SetupHostCommand: fix wrong check result MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tony has reported, that CI tools job is failing for him in macOS container due to prereq check failure for GNU `install` utility. Michael diagnosed it and from his traces it was clear, that the issue is caused by a wrong return value in the success check case, so lets fix it accordingly. Fixes: f75204036ccc ("prereq-build: allow host command symlinks to update") Reported-by: Tony Ambardar Diagnosed-by: Michael Pratt Signed-off-by: Petr Štetiar (cherry picked from commit 7855378fcd7ed7cb0a223238a99bac0b8e46c380) --- include/prereq.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/prereq.mk b/include/prereq.mk index 5646b24efaa61a..74c3914d060da3 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -113,7 +113,7 @@ define SetupHostCommand ;; \ esac; \ ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \ - exit 1; \ + exit 0; \ fi; \ fi; \ done; \ From 7d226e13e249f72ec8154cf8974ecbf1696ed7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 23 May 2023 14:27:05 +0200 Subject: [PATCH 0005/1171] ci: tools: run the job on changes in include directory as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to prevent regressions like with #12617. Signed-off-by: Petr Štetiar (cherry picked from commit 71ca2a31546d5f14faac03838bf700cf22f85215) --- .github/workflows/tools.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index b9d712c2a69669..76ebdc664b89ae 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -3,11 +3,13 @@ name: Build host tools on: pull_request: paths: + - 'include/**' - 'tools/**' - '.github/workflows/build-tools.yml' - '.github/workflows/tools.yml' push: paths: + - 'include/**' - 'tools/**' - '.github/workflows/build-tools.yml' - '.github/workflows/tools.yml' From 7df43979d102fac7b4f5ca519512c601709aac3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 23 May 2023 16:56:09 +0200 Subject: [PATCH 0006/1171] ci: push-containers: trigger job on release branching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently all 23.05 related CI jobs are failing as the containers are not available, so lets fix it by pushing those containers when the version.mk changes. Signed-off-by: Petr Štetiar (cherry picked from commit 8fc2a0f00f7f62ded3c849e78742c3d87d52ec91) --- .github/workflows/push-containers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index bad39c2fc2c9b3..28b07244ef6c98 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -3,6 +3,7 @@ name: Build and Push prebuilt tools container on: push: paths: + - 'include/version.mk' - 'tools/**' - '.github/workflows/build-tools.yml' - '.github/workflows/push-containers.yml' From 4a6847ce4e4a8034738484a0ff4cb012fa1b295e Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 23 May 2023 14:55:48 +0200 Subject: [PATCH 0007/1171] kernel: qca-ssdk: backport support for building as kernel module Currently, SSDK is rather special in the sense that its not being built as a proper out of tree module at all but rather like a userspace application and that involves a lot of make magic which unfortunately broke with make version 4.4 and newer. Luckily QCA finally added a way to build SSDK as an out of tree module and it uses the kernel buildsystem which makes it compile with make 4.4 as well. So lets backport the support for it and switch to using it. Signed-off-by: Robert Marko (cherry picked from commit 957f1ee85eb243c5c7397b1e3842a3c61a6b852f) --- package/kernel/qca-ssdk/Makefile | 6 +- ...upport-Linux-Style-Makefile-for-SSDK.patch | 286 ++++++++++++++++++ ...pilation-issue-in-Linux-Style-Makefi.patch | 27 ++ ...fix-compilation-issue-in-Miami-yocto.patch | 23 ++ 4 files changed, 340 insertions(+), 2 deletions(-) create mode 100644 package/kernel/qca-ssdk/patches/0012-qca-ssdk-Support-Linux-Style-Makefile-for-SSDK.patch create mode 100644 package/kernel/qca-ssdk/patches/0013-qca-ssdk-fix-compilation-issue-in-Linux-Style-Makefi.patch create mode 100644 package/kernel/qca-ssdk/patches/0014-qca-ssdk-fix-compilation-issue-in-Miami-yocto.patch diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index 62c60fc1becde5..92f7b66490be97 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git PKG_SOURCE_PROTO:=git @@ -37,6 +37,8 @@ else TOOLCHAIN_BIN_PATH=$(TOOLCHAIN_DIR)/bin endif +LNX_CONFIG_OPTS = LNX_MAKEOPTS='$(KERNEL_MAKEOPTS)' MODULE_TYPE=KSLIB modules + MAKE_FLAGS+= \ TARGET_NAME=$(CONFIG_TARGET_NAME) \ TOOL_PATH=$(TOOLCHAIN_BIN_PATH) \ @@ -47,7 +49,7 @@ MAKE_FLAGS+= \ TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \ GCC_VERSION=$(GCC_VERSION) \ EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \ - $(KERNEL_MAKE_FLAGS) + $(LNX_CONFIG_OPTS) ifeq ($(CONFIG_TARGET_BOARD), "ipq807x") MAKE_FLAGS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable diff --git a/package/kernel/qca-ssdk/patches/0012-qca-ssdk-Support-Linux-Style-Makefile-for-SSDK.patch b/package/kernel/qca-ssdk/patches/0012-qca-ssdk-Support-Linux-Style-Makefile-for-SSDK.patch new file mode 100644 index 00000000000000..91b7d570d8a1d4 --- /dev/null +++ b/package/kernel/qca-ssdk/patches/0012-qca-ssdk-Support-Linux-Style-Makefile-for-SSDK.patch @@ -0,0 +1,286 @@ +From edd3d4347cc73a99c7cf59aceeb1e8ad4d4dd303 Mon Sep 17 00:00:00 2001 +From: crao +Date: Tue, 15 Nov 2022 18:50:01 +0800 +Subject: [PATCH] [qca-ssdk]: Support Linux-Style Makefile for SSDK + +Change-Id: I8c4399433b6422ef6192f70bf08b0d3023cc94b6 +Signed-off-by: crao +--- + Makefile | 15 +++++++++++++ + Makefile.modules | 16 ++++++++++++++ + make/defs.mk | 1 + + make/linux_opt.mk | 54 ++++++++++++++++++++++++++++------------------- + make/target.mk | 12 +++++++++++ + src/api/Makefile | 2 +- + 6 files changed, 77 insertions(+), 23 deletions(-) + mode change 100755 => 100644 Makefile + create mode 100644 Makefile.modules + mode change 100755 => 100644 make/defs.mk + mode change 100755 => 100644 make/linux_opt.mk + mode change 100755 => 100644 make/target.mk + mode change 100755 => 100644 src/api/Makefile + +--- a/Makefile ++++ b/Makefile +@@ -12,6 +12,9 @@ include ./make/$(OS)_opt.mk + SUB_DIR=$(patsubst %/, %, $(dir $(wildcard src/*/Makefile))) + SUB_LIB=$(subst src/, , $(SUB_DIR)) + ++#################################################################### ++# SSDK-Style Makefile ++#################################################################### + all: $(BIN_DIR) kslib + mkdir -p ./temp/;cd ./temp;cp ../build/bin/ssdk_ks_km.a ./;ar -x ssdk_ks_km.a; cp ../ko_Makefile ./Makefile; + make -C $(SYS_PATH) M=$(PRJ_PATH)/temp/ CROSS_COMPILE=$(TOOLPREFIX) modules +@@ -20,6 +23,18 @@ all: $(BIN_DIR) kslib + rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a + @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." + ++#################################################################### ++# LNX Modules-Style Makefile ++#################################################################### ++modules: $(BIN_DIR) kslib_c ++ cp Makefile.modules ./Makefile; ++ make -C $(SYS_PATH) M=$(PRJ_PATH)/ $(LNX_MAKEOPTS) modules ++ cp *.ko build/bin; ++ @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." ++ ++kslib_c: ++ $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=KSLIB -C src/$i src_list_loop || exit 1;) ++ + kslib:kslib_o + $(AR) -r $(BIN_DIR)/$(KS_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/KSLIB/*.o) + +--- /dev/null ++++ b/Makefile.modules +@@ -0,0 +1,16 @@ ++#################################################################### ++# Add All Local Flags ++#################################################################### ++ccflags-y += $(LNX_LOCAL_CFLAGS) -Wno-error ++ ++#################################################################### ++# Build Object List ++#################################################################### ++SRC_LIST := $(shell cat $(PRJ_PATH)/src_list.dep) ++OBJ_LIST := $(patsubst %.c,%.o,$(SRC_LIST)) ++ ++#################################################################### ++# Linux Kernel Module ++#################################################################### ++obj-m := qca-ssdk.o ++qca-ssdk-objs := $(OBJ_LIST) +--- a/make/defs.mk ++++ b/make/defs.mk +@@ -7,6 +7,7 @@ ifeq (,$(findstring $(LIB), $(COMPONENTS + endif + + SRC_FILE=$(addprefix $(PRJ_PATH)/$(LOC_DIR)/, $(SRC_LIST)) ++LOC_SRC_FILE=$(addprefix $(LOC_DIR)/, $(SRC_LIST)) + + OBJ_LIST=$(SRC_LIST:.c=.o) + OBJ_FILE=$(addprefix $(DST_DIR)/, $(OBJ_LIST)) +--- a/make/linux_opt.mk ++++ b/make/linux_opt.mk +@@ -295,7 +295,7 @@ ifeq (TRUE, $(DEBUG_ON)) + MODULE_CFLAG += -g + endif + +-MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DOS=\"$(OS)\" -D"KBUILD_STR(s)=\#s" -D"KBUILD_MODNAME=KBUILD_STR(qca-ssdk)" ++MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DOS=\"$(OS)\" -D"KBUILD_STR(s)=\#s" + + MODULE_INC += -I$(PRJ_PATH)/include \ + -I$(PRJ_PATH)/include/common \ +@@ -450,7 +450,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + MODULE_CFLAG += -DKVER34 + MODULE_CFLAG += -DKVER32 + MODULE_CFLAG += -DLNX26_22 +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/source/include \ +@@ -473,7 +473,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + MODULE_CFLAG += -DKVER32 + MODULE_CFLAG += -DLNX26_22 + ifeq ($(ARCH), arm64) +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/source \ +@@ -492,13 +492,13 @@ ifeq (KSLIB, $(MODULE_TYPE)) + -I$(SYS_PATH)/source/include/uapi + + ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),) +- MODULE_INC += -include $(SYS_PATH)/include/linux/kconfig.h ++ SYS_INC += -include $(SYS_PATH)/include/linux/kconfig.h + else +- MODULE_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h ++ SYS_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h + endif + + else ifeq ($(ARCH), arm) +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/7.5.0/include/ \ + -I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \ +@@ -522,13 +522,13 @@ ifeq (KSLIB, $(MODULE_TYPE)) + -I$(TOOL_PATH)/../../lib/arm-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/9.3.0/include/ + + ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),) +- MODULE_INC += -include $(SYS_PATH)/include/linux/kconfig.h ++ SYS_INC += -include $(SYS_PATH)/include/linux/kconfig.h + else +- MODULE_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h ++ SYS_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h + endif + + else +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/source \ +@@ -564,7 +564,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + MODULE_CFLAG += -DLNX26_22 + ifeq ($(ARCH), arm64) + KCONF_FILE = $(SYS_PATH)/source/include/linux/kconfig.h +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/source/include \ +@@ -581,7 +581,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + -I$(SYS_PATH)/source/arch/arm64/include/asm/mach \ + -include $(KCONF_FILE) + else ifeq ($(ARCH), arm) +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ + -I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \ + -I$(SYS_PATH)/include \ +@@ -604,7 +604,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + MODULE_CFLAG += -DKVER34 + MODULE_CFLAG += -DKVER32 + MODULE_CFLAG += -DLNX26_22 +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ + -I$(TOOL_PATH)/../../lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/include/ \ + -I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \ +@@ -627,10 +627,10 @@ ifeq (KSLIB, $(MODULE_TYPE)) + -I$(EXT_PATH) \ + -I$(SYS_PATH)/source/arch/arm/include/asm/mach + ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),) +- MODULE_INC += \ ++ SYS_INC += \ + -include $(SYS_PATH)/include/linux/kconfig.h + else +- MODULE_INC += \ ++ SYS_INC += \ + -include $(SYS_PATH)/source/include/linux/kconfig.h + endif + +@@ -641,7 +641,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + MODULE_CFLAG += -DKVER32 + MODULE_CFLAG += -DLNX26_22 + MODULE_CFLAG += -Werror +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/source/include \ + -I$(SYS_PATH)/source/arch/arm/mach-msm/include \ +@@ -657,7 +657,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + MODULE_CFLAG += -DKVER32 + MODULE_CFLAG += -DLNX26_22 + ifeq (mips, $(CPU)) +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/arch/mips/include \ + -I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \ +@@ -678,7 +678,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB + endif + else +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/arch/arm/include \ + -I$(SYS_PATH)/arch/arm/include/asm \ +@@ -695,7 +695,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + MODULE_CFLAG += -DKVER26 + MODULE_CFLAG += -DLNX26_22 + ifeq (mips, $(CPU)) +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/arch/mips/include \ + -I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \ +@@ -708,7 +708,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB + endif + else +- MODULE_INC += -I$(SYS_PATH) \ ++ SYS_INC += -I$(SYS_PATH) \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/arch/arm/include \ + -I$(SYS_PATH)/arch/arm/include/asm \ +@@ -721,8 +721,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) + + endif + +- MODULE_CFLAG += -D__KERNEL__ -DKERNEL_MODULE $(CPU_CFLAG) +- ++ MODULE_CFLAG += -D__KERNEL__ -DKERNEL_MODULE + + endif + +@@ -748,4 +747,15 @@ ifneq (TRUE, $(KERNEL_MODE)) + endif + endif + +-LOCAL_CFLAGS += $(MODULE_INC) $(MODULE_CFLAG) $(EXTRA_CFLAGS) ++LOCAL_CFLAGS += $(MODULE_INC) $(SYS_INC) $(MODULE_CFLAG) $(EXTRA_CFLAGS) ++ ++#################################################################### ++# cflags for SSDK-Style Makefile ++#################################################################### ++LOCAL_CFLAGS += $(CPU_CFLAG) -D"KBUILD_MODNAME=KBUILD_STR(qca-ssdk)" ++ ++#################################################################### ++# cflags for LNX Modules-Style Makefile ++#################################################################### ++LNX_LOCAL_CFLAGS += $(MODULE_INC) $(MODULE_CFLAG) ${EXTRA_INC} ++export LNX_LOCAL_CFLAGS +--- a/make/target.mk ++++ b/make/target.mk +@@ -3,6 +3,18 @@ include $(PRJ_PATH)/make/$(OS)_opt.mk + + include $(PRJ_PATH)/make/tools.mk + ++#################################################################### ++# LNX Modules-Style Makefile ++#################################################################### ++src_list_loop: src_list ++ $(foreach i, $(SUB_DIR), $(MAKE) -C $(i) src_list_loop || exit 1;) ++ ++src_list: ++ echo -n "$(LOC_SRC_FILE) " >> $(PRJ_PATH)/src_list.dep ++ ++#################################################################### ++# SSDK-Style Makefile ++#################################################################### + obj: $(OBJ_LIST) + $(OBJ_LOOP) + +--- a/src/api/Makefile ++++ b/src/api/Makefile +@@ -1,4 +1,4 @@ +-LOC_DIR=src/sal ++LOC_DIR=src/api + LIB=API + + include $(PRJ_PATH)/make/config.mk diff --git a/package/kernel/qca-ssdk/patches/0013-qca-ssdk-fix-compilation-issue-in-Linux-Style-Makefi.patch b/package/kernel/qca-ssdk/patches/0013-qca-ssdk-fix-compilation-issue-in-Linux-Style-Makefi.patch new file mode 100644 index 00000000000000..792cd9e31b59f9 --- /dev/null +++ b/package/kernel/qca-ssdk/patches/0013-qca-ssdk-fix-compilation-issue-in-Linux-Style-Makefi.patch @@ -0,0 +1,27 @@ +From 3026f89b06049df01d5fe19c5fccc972637aa344 Mon Sep 17 00:00:00 2001 +From: crao +Date: Tue, 7 Mar 2023 17:15:07 +0800 +Subject: [PATCH] [qca-ssdk]: fix compilation issue in Linux-Style Makefile + +Change-Id: If38251fc0a2bf4abc666d30f4812c0d9507310dc +Signed-off-by: crao +--- + Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + mode change 100644 => 100755 Makefile + +--- a/Makefile ++++ b/Makefile +@@ -27,9 +27,9 @@ all: $(BIN_DIR) kslib + # LNX Modules-Style Makefile + #################################################################### + modules: $(BIN_DIR) kslib_c +- cp Makefile.modules ./Makefile; +- make -C $(SYS_PATH) M=$(PRJ_PATH)/ $(LNX_MAKEOPTS) modules +- cp *.ko build/bin; ++ mkdir -p ./temp/;cp * ./temp -a;cd ./temp;cp ../Makefile.modules ./Makefile; ++ make -C $(SYS_PATH) M=$(PRJ_PATH)/temp $(LNX_MAKEOPTS) modules ++ cp temp/*.ko build/bin; + @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." + + kslib_c: diff --git a/package/kernel/qca-ssdk/patches/0014-qca-ssdk-fix-compilation-issue-in-Miami-yocto.patch b/package/kernel/qca-ssdk/patches/0014-qca-ssdk-fix-compilation-issue-in-Miami-yocto.patch new file mode 100644 index 00000000000000..53c0c341316ac0 --- /dev/null +++ b/package/kernel/qca-ssdk/patches/0014-qca-ssdk-fix-compilation-issue-in-Miami-yocto.patch @@ -0,0 +1,23 @@ +From 6e4efd68e6e560a1994bc273fe6f7a72139f3957 Mon Sep 17 00:00:00 2001 +From: crao +Date: Wed, 15 Mar 2023 11:19:39 +0800 +Subject: [PATCH] [qca-ssdk]: fix compilation issue in Miami yocto + +Change-Id: I8526b9e43667d72ae9afa4ef8a13167088d194ba +Signed-off-by: crao +--- + Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/Makefile ++++ b/Makefile +@@ -29,7 +29,9 @@ all: $(BIN_DIR) kslib + modules: $(BIN_DIR) kslib_c + mkdir -p ./temp/;cp * ./temp -a;cd ./temp;cp ../Makefile.modules ./Makefile; + make -C $(SYS_PATH) M=$(PRJ_PATH)/temp $(LNX_MAKEOPTS) modules ++ cp $(PRJ_PATH)/temp/Module.symvers $(PRJ_PATH)/Module.symvers; + cp temp/*.ko build/bin; ++ rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a + @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." + + kslib_c: From 6b9f405324d1767aceb4993933336da12a55bf32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 17 May 2023 11:58:16 +0200 Subject: [PATCH 0008/1171] mac80211: brcm: drop brcmfmac patch waiting for register_wiphy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That was a workaround for OpenWrt generation of config files. This patch was used to postpone returning from probe function until loading firmware and calling register_wiphy(). All of that is not needed anymore thanks to the ieee80211 hotplug.d script introduced in the commit 5f8f8a366136 ("base-files, mac80211, broadcom-wl: wifi detection and configuration"). That takes care of generating /etc/config/wireless entries even if wireless device appears late in the booting process. Signed-off-by: Rafał Miłecki (cherry picked from commit bd262663142e90f64f1c256b3e6b2b979c1022c0) Signed-off-by: Daniel Golle --- package/kernel/mac80211/Makefile | 2 +- ...-register-wiphy-s-during-module_init.patch | 64 ------------------- 2 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 225649d67b293c..248b48c3c15588 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=6.1.24 -PKG_RELEASE:=2 +PKG_RELEASE:=3 # PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/ PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ PKG_HASH:=5d39aca7e34c33cb9b3e366117b2e86841b7bdd37933679d6b1e61be6b150648 diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch deleted file mode 100644 index 9d0f3e20b1de0f..00000000000000 --- a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 8 Jun 2015 16:11:40 +0200 -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is needed by OpenWrt which expects all PHYs to be created after -module loads successfully. - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -459,6 +459,7 @@ struct brcmf_fw { - u32 curpos; - unsigned int board_index; - void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); -+ struct completion *completion; - }; - - #ifdef CONFIG_EFI -@@ -686,6 +687,8 @@ static void brcmf_fw_request_done(const - fwctx->req = NULL; - } - fwctx->done(fwctx->dev, ret, fwctx->req); -+ if (fwctx->completion) -+ complete(fwctx->completion); - kfree(fwctx); - } - -@@ -751,6 +754,8 @@ int brcmf_fw_get_firmwares(struct device - { - struct brcmf_fw_item *first = &req->items[0]; - struct brcmf_fw *fwctx; -+ struct completion completion; -+ unsigned long time_left; - char *alt_path = NULL; - int ret; - -@@ -768,6 +773,9 @@ int brcmf_fw_get_firmwares(struct device - fwctx->dev = dev; - fwctx->req = req; - fwctx->done = fw_cb; -+ -+ init_completion(&completion); -+ fwctx->completion = &completion; - - /* First try alternative board-specific path if any */ - if (fwctx->req->board_types[0]) -@@ -787,6 +795,12 @@ int brcmf_fw_get_firmwares(struct device - if (ret < 0) - brcmf_fw_request_done(NULL, fwctx); - -+ -+ time_left = wait_for_completion_timeout(&completion, -+ msecs_to_jiffies(5000)); -+ if (!time_left && fwctx) -+ fwctx->completion = NULL; -+ - return 0; - } - From e22fba1694376fd1396fe7a7aaedb1273c66f094 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 21 May 2023 18:30:14 +0200 Subject: [PATCH 0009/1171] uml: fix build error due to frame size > 1024 the UML build fails during the kernel build: | arch/um/drivers/net_kern.c: In function 'compute_hash': | arch/um/drivers/net_kern.c:322:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] | 322 | } | | ^ |cc1: all warnings being treated as errors The compute_hash() function is added by our patch: 102-pseudo-random-mac.patch Instead of allocating a 1024 byte buffer on the stack for the SHA1 digest input, let's allocate the data on the heap. We should be able to do that since crypto_alloc_ahash and ahash_request_alloc also need to allocate structures on the heap. Signed-off-by: Christian Lamparter (cherry picked from commit aed2569d3780cab1a1a2d75c9f9e3fe413a9844d) Signed-off-by: Daniel Golle --- .../patches-5.15/102-pseudo-random-mac.patch | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch b/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch index 925b9d77101ff0..045d2d0dbd9ae3 100644 --- a/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch +++ b/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch @@ -49,7 +49,7 @@ Applies to vanilla kernel 3.9.4. #define DRIVER_NAME "uml-netdev" static DEFINE_SPINLOCK(opened_lock); -@@ -274,9 +282,51 @@ static const struct ethtool_ops uml_net_ +@@ -274,9 +282,55 @@ static const struct ethtool_ops uml_net_ .get_ts_info = ethtool_op_get_ts_info, }; @@ -59,24 +59,26 @@ Applies to vanilla kernel 3.9.4. + * * an interface name. */ +static int compute_hash(const char *umid, const char *ifname, char *hash) +{ -+ struct ahash_request *desc; -+ struct crypto_ahash *tfm; ++ struct ahash_request *desc = NULL; ++ struct crypto_ahash *tfm = NULL; + struct scatterlist sg; -+ char vmif[1024]; -+ int ret; ++ char *vmif = NULL; ++ int ret = -ENOMEM; ++ ++ vmif = kmalloc(1024, GFP_KERNEL); ++ if (!vmif) ++ goto out; + + strcpy (vmif, umid); + strcat (vmif, ifname); + + tfm = crypto_alloc_ahash("sha1", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(tfm)) -+ return -ENOMEM; ++ goto out; + + desc = ahash_request_alloc(tfm, GFP_KERNEL); -+ if (!desc) { -+ ret = -ENOMEM; ++ if (!desc) + goto out; -+ } + + crypto_ahash_clear_flags(tfm, ~0); + @@ -88,6 +90,8 @@ Applies to vanilla kernel 3.9.4. + ret = crypto_ahash_digest(desc); +out: + crypto_free_ahash(tfm); ++ ahash_request_free(desc); ++ kfree(vmif); + + return ret; +} @@ -101,7 +105,7 @@ Applies to vanilla kernel 3.9.4. char *end; int i; -@@ -319,9 +369,26 @@ void uml_net_setup_etheraddr(struct net_ +@@ -319,9 +373,26 @@ void uml_net_setup_etheraddr(struct net_ return; random: From 7613efde8eaa17a21d4b24d8691d981673513536 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 21 May 2023 19:05:03 +0200 Subject: [PATCH 0010/1171] uml: exclude some /arch/x86 optimizations The x86_64 UML target wants to include SSSE3 optimized crypto code which lives under /arch/x86/crypto. However, these are not built and this causes an error. | ERROR: module '[...]/arch/x86/crypto/sha512-ssse3.ko' is missing. | make[3]: *** [modules/crypto.mk:990: [...]/kmod-crypto-sha512_5.15.112-1_x86_64.ipk] Error 1 Signed-off-by: Christian Lamparter (cherry picked from commit 959563fb813890e478bf0a51523cd84d54b9af91) Signed-off-by: Daniel Golle --- package/kernel/linux/modules/crypto.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index a3785d26fd04b8..248b4d68f9e14a 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -897,10 +897,12 @@ define KernelPackage/crypto-sha1/mpc85xx AUTOLOAD+=$(call AutoLoad,09,sha1-ppc-spe) endef +ifndef CONFIG_TARGET_uml define KernelPackage/crypto-sha1/x86_64 FILES+=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko AUTOLOAD+=$(call AutoLoad,09,sha1-ssse3) endef +endif ifdef KernelPackage/crypto-sha1/$(ARCH) KernelPackage/crypto-sha1/$(CRYPTO_TARGET)=\ @@ -935,10 +937,12 @@ define KernelPackage/crypto-sha256/mpc85xx AUTOLOAD+=$(call AutoLoad,09,sha256-ppc-spe) endef +ifndef CONFIG_TARGET_uml define KernelPackage/crypto-sha256/x86_64 FILES+=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko AUTOLOAD+=$(call AutoLoad,09,sha256-ssse3) endef +endif ifdef KernelPackage/crypto-sha256/$(ARCH) KernelPackage/crypto-sha256/$(CRYPTO_TARGET)=\ @@ -977,10 +981,12 @@ endef KernelPackage/crypto-sha512/tegra=$(KernelPackage/crypto-sha512/arm) +ifndef CONFIG_TARGET_uml define KernelPackage/crypto-sha512/x86_64 FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko AUTOLOAD+=$(call AutoLoad,09,sha512-ssse3) endef +endif ifdef KernelPackage/crypto-sha512/$(ARCH) KernelPackage/crypto-sha512/$(CRYPTO_TARGET)=\ From 84a4601ca6e3520158fcc6ef6ffd0dd536062296 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Thu, 13 Oct 2022 11:20:10 +0900 Subject: [PATCH 0011/1171] ath79: enable NVMEM u-boot-env driver on generic subtarget This patch enables NVMEM u-boot-env driver (COFNIG_NVMEM_U_BOOT_ENV) on generic subtarget to use from devices, for MAC address and etc. Signed-off-by: INAGAKI Hiroshi (cherry picked from commit e8f7957450e2dcbeb90492c711a973d2cf0ebbfc) Signed-off-by: Daniel Golle --- target/linux/ath79/generic/config-default | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default index dd59a354900eeb..06f264b626a72b 100644 --- a/target/linux/ath79/generic/config-default +++ b/target/linux/ath79/generic/config-default @@ -15,6 +15,8 @@ CONFIG_MARVELL_PHY=y CONFIG_MICREL_PHY=y CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_SPLIT_EVA_FW=y +CONFIG_NVMEM_SYSFS=y +CONFIG_NVMEM_U_BOOT_ENV=y CONFIG_PHY_AR7100_USB=y CONFIG_PHY_AR7200_USB=y CONFIG_REALTEK_PHY=y From f0b2fdb82ed606fd872b2b15214768a3995b51d5 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 20 May 2023 20:35:51 +0800 Subject: [PATCH 0012/1171] ath79: improve support for D-Link DIR-8x9 A1 series 1. Remove unnecessary new lines in the dts. 2. Remove duplicate included file "gpio.h" in the device dts. 3. Add missing button labels "reset" and "wps". 4. Unify the format of the reg properties. 5. Add u-boot environment support. 6. Reduce spi clock frequency since the max value suggested by the chip datasheet is only 25 MHz. 7. Add seama header fixup for DIR-859 A1. Without this header fixup, u-boot checksum for kernel will fail after the first boot. Signed-off-by: Shiji Yang (cherry picked from commit e5d8739aa846db621b6368ba83db17c353a35dea) Signed-off-by: Daniel Golle --- package/boot/uboot-envtools/files/ath79 | 2 ++ .../linux/ath79/dts/qca9563_dlink_dir-859-a1.dts | 1 - .../linux/ath79/dts/qca9563_dlink_dir-869-a1.dts | 2 -- .../linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi | 15 ++++++++------- .../base-files/etc/uci-defaults/09_fix-checksum | 1 + 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 47271453f69f01..38fc663e70917e 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -27,6 +27,8 @@ araknis,an-700-ap-i-ac|\ arduino,yun|\ buffalo,bhr-4grv2|\ devolo,magic-2-wifi|\ +dlink,dir-859-a1|\ +dlink,dir-869-a1|\ engenius,eap1200h|\ engenius,eap1750h|\ engenius,eap300-v2|\ diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts index a828f86cb16e43..93bd8e363e85e7 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts +++ b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include "qca9563_dlink_dir-8x9-a1.dtsi" -#include / { model = "D-Link DIR-859 A1"; diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-869-a1.dts b/target/linux/ath79/dts/qca9563_dlink_dir-869-a1.dts index eab713ea66aafa..5afe683613b42c 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-869-a1.dts +++ b/target/linux/ath79/dts/qca9563_dlink_dir-869-a1.dts @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include "qca9563_dlink_dir-8x9-a1.dtsi" -#include / { model = "D-Link DIR-869 A1"; @@ -28,4 +27,3 @@ }; }; }; - diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi index 556ba604a6b1de..754fcd415d9789 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi +++ b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi @@ -6,17 +6,18 @@ #include / { - keys { compatible = "gpio-keys"; wps { + label = "wps"; linux,code = ; gpios = <&gpio 1 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; reset { + label = "reset"; linux,code = ; gpios = <&gpio 2 GPIO_ACTIVE_LOW>; debounce-interval = <60>; @@ -42,7 +43,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <50000000>; + spi-max-frequency = <25000000>; partitions { compatible = "fixed-partitions"; @@ -51,19 +52,19 @@ partition@0 { label = "bootloader"; - reg = <0x000000 0x40000>; + reg = <0x000000 0x040000>; read-only; }; partition@40000 { + compatible = "u-boot,env"; label = "bdcfg"; - reg = <0x040000 0x10000>; - read-only; + reg = <0x040000 0x010000>; }; partition@50000 { label = "devdata"; - reg = <0x050000 0x10000>; + reg = <0x050000 0x010000>; read-only; compatible = "nvmem-cells"; @@ -81,7 +82,7 @@ partition@60000 { label = "devconf"; - reg = <0x060000 0x10000>; + reg = <0x060000 0x010000>; read-only; }; diff --git a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum index 7f4d6cf428caa0..ad3db95a0c67d9 100644 --- a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum +++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum @@ -22,6 +22,7 @@ dlink,dap-3662-a1) fixwrgg ;; dlink,dir-629-a1|\ +dlink,dir-859-a1|\ dlink,dir-869-a1|\ qihoo,c301) fix_seama_header From 635d5488c91bbf4facf238c6e4baece6f131cbff Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 5 May 2023 01:50:36 +0000 Subject: [PATCH 0013/1171] ath79: add support for D-Link DIR-859 A3 Specifications: SOC: QCA9563 775 MHz + QCA9880 Switch: QCA8337N-AL3C RAM: Winbond W9751G6KB-25 64 MiB Flash: Winbond W25Q128FVSG 16 MiB WLAN: Wi-Fi4 2.4 GHz 3*3 + 5 GHz 3*3 LAN: LAN ports *4 WAN: WAN port *1 Buttons: reset *1 + wps *1 LEDs: ethernet *5, power, wlan, wps MAC Address: use address source1 source2 label 40:9b:xx:xx:xx:3c lan && wlan u-boot,env@ethaddr lan 40:9b:xx:xx:xx:3c devdata@0x3f $label wan 40:9b:xx:xx:xx:3f devdata@0x8f $label + 3 wlan2g 40:9b:xx:xx:xx:3c devdata@0x5b $label wlan5g 40:9b:xx:xx:xx:3e devdata@0x76 $label + 2 Install via Web UI: Apply factory image in the stock firmware's Web UI. Install via Emergency Room Mode: DIR-859 A1 will enter recovery mode when the system fails to boot or press reset button for about 10 seconds. First, set computer IP to 192.168.0.5 and Gateway to 192.168.0.1. Then we can open http://192.168.0.1 in the web browser to upload OpenWrt factory image or stock firmware. Some modern browsers may need to turn on compatibility mode. Signed-off-by: Shiji Yang (cherry picked from commit 0ffbef9317a1dc049ad259c1ec1530355efc0552) Signed-off-by: Daniel Golle --- package/boot/uboot-envtools/files/ath79 | 1 + .../ath79/dts/qca9563_dlink_dir-859-a3.dts | 64 +++++++++++++++++++ .../ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi | 4 +- .../generic/base-files/etc/board.d/01_leds | 3 + .../generic/base-files/etc/board.d/02_network | 5 ++ .../etc/uci-defaults/09_fix-checksum | 1 + target/linux/ath79/image/generic.mk | 14 +++- 7 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 target/linux/ath79/dts/qca9563_dlink_dir-859-a3.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 38fc663e70917e..7c30aa052a6b39 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -28,6 +28,7 @@ arduino,yun|\ buffalo,bhr-4grv2|\ devolo,magic-2-wifi|\ dlink,dir-859-a1|\ +dlink,dir-859-a3|\ dlink,dir-869-a1|\ engenius,eap1200h|\ engenius,eap1750h|\ diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-859-a3.dts b/target/linux/ath79/dts/qca9563_dlink_dir-859-a3.dts new file mode 100644 index 00000000000000..164e0802f9fb6f --- /dev/null +++ b/target/linux/ath79/dts/qca9563_dlink_dir-859-a3.dts @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_dlink_dir-8x9-a1.dtsi" + +#include + +/ { + compatible = "dlink,dir-859-a3", "qca,qca9563"; + model = "D-Link DIR-859 A3"; + + aliases { + label-mac-device = &wmac; + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wan { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + wlan { + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wps { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ath10k { + nvmem-cells = <&calibration_ath10k>, <&macaddr_bdcfg_ethaddr 2>; + nvmem-cell-names = "calibration", "mac-address"; +}; + +&bdcfg { + macaddr_bdcfg_ethaddr: ethaddr { + #nvmem-cell-cells = <1>; + }; +}; + +&wmac { + nvmem-cells = <&calibration_ath9k>, <&macaddr_bdcfg_ethaddr 0>; + nvmem-cell-names = "calibration", "mac-address"; +}; diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi index 754fcd415d9789..3fd9790c4a2382 100644 --- a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi +++ b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi @@ -28,7 +28,7 @@ &pcie { status = "okay"; - wifi@0,0 { + ath10k: wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; @@ -56,7 +56,7 @@ read-only; }; - partition@40000 { + bdcfg: partition@40000 { compatible = "u-boot,env"; label = "bdcfg"; reg = <0x040000 0x010000>; 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 d3508049baa9ab..2ee4ed2544d97d 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -234,6 +234,9 @@ dlink,dap-1365-a1) dlink,dir-859-a1) ucidef_set_led_switch "internet" "WAN" "green:internet" "switch0" "0x20" ;; +dlink,dir-859-a3) + ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x20" + ;; engenius,ens202ext-v1|\ engenius,enstationac-v1) 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 487467cd598d9b..4f535f8a648e6c 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -291,6 +291,7 @@ ath79_setup_interfaces() dlink,dir-842-c2|\ dlink,dir-842-c3|\ dlink,dir-859-a1|\ + dlink,dir-859-a3|\ dlink,dir-869-a1|\ engenius,epg5000|\ engenius,esr1200|\ @@ -661,6 +662,10 @@ ath79_setup_macs() lan_mac=$(mtd_get_mac_text "devdata" 0xc9) wan_mac=$(mtd_get_mac_text "devdata" 0x79) ;; + dlink,dir-859-a3) + lan_mac=$(get_mac_label) + wan_mac=$(macaddr_add "$lan_mac" 3) + ;; qihoo,c301|\ wd,mynet-n600|\ wd,mynet-n750) diff --git a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum index ad3db95a0c67d9..0ea81a8dc3ac53 100644 --- a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum +++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum @@ -23,6 +23,7 @@ dlink,dap-3662-a1) ;; dlink,dir-629-a1|\ dlink,dir-859-a1|\ +dlink,dir-859-a3|\ dlink,dir-869-a1|\ qihoo,c301) fix_seama_header diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index f8969a919c9120..788520120de5ba 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1143,18 +1143,28 @@ define Device/dlink_dir-842-c3 endef TARGET_DEVICES += dlink_dir-842-c3 -define Device/dlink_dir-859-a1 +define Device/dlink_dir-859-ax $(Device/seama) SOC := qca9563 DEVICE_VENDOR := D-Link DEVICE_MODEL := DIR-859 - DEVICE_VARIANT := A1 IMAGE_SIZE := 15872k DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct SEAMA_SIGNATURE := wrgac37_dlink.2013gui_dir859 endef + +define Device/dlink_dir-859-a1 + $(Device/dlink_dir-859-ax) + DEVICE_VARIANT := A1 +endef TARGET_DEVICES += dlink_dir-859-a1 +define Device/dlink_dir-859-a3 + $(Device/dlink_dir-859-ax) + DEVICE_VARIANT := A3 +endef +TARGET_DEVICES += dlink_dir-859-a3 + define Device/dlink_dir-869-a1 $(Device/seama) SOC := qca9563 From bf82648bf74412a364831252d02e708149ef84c7 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 22 May 2023 15:27:48 +0200 Subject: [PATCH 0014/1171] CI: check-kernel-patches: use buildbot user on git diff check Use buildbot user on git diff check instead of using git config safe directory. This should accomplish the same result but should be a better approach following safe practice enforced by git. Fixes: a7747e8670cb ("ci: fix check kernel patches job") Signed-off-by: Christian Marangi (cherry picked from commit 6c80a578a4428c81fd92e0a2abe95dacfa20c008) Signed-off-by: Daniel Golle --- .github/workflows/check-kernel-patches.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index 4ad35e625075e5..274bae367ded56 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -85,10 +85,6 @@ jobs: run: | chown -R buildbot:buildbot openwrt - - name: Opt-out from Git stricter repository ownership checks - run: | - git config --global --add safe.directory '*' - - name: Initialization environment run: | TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1) @@ -138,6 +134,7 @@ jobs: run: make target/linux/refresh V=s - name: Validate Refreshed Kernel Patches + shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | . .github/workflows/scripts/ci_helpers.sh From b79ed14dd16b86f94baff613ef3068ff1d5b65fa Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 22 May 2023 16:47:08 +0200 Subject: [PATCH 0015/1171] CI: rework build workflow to have split target and subtarget directly Instead of referring to a redundant job and ENV variables, rework build workflow to accept and require split target and subtarget and use them directly from inputs. Rework each user and pass a JSON of tuple to matrix include with each target/subtarget combination to test. Special notice this doesn't use the github actions matrix combination feature but reference each specific tuple of target and subtarget to test. Just a cleanup no behaviour change intended. Signed-off-by: Christian Marangi (cherry picked from commit eecc6e48117be26c2eefd9257cceb9d9b1e842f2) Signed-off-by: Daniel Golle --- .github/workflows/build.yml | 32 ++++++++++------------ .github/workflows/check-kernel-patches.yml | 26 ++++++++---------- .github/workflows/coverity.yml | 3 +- .github/workflows/kernel.yml | 12 +++++--- .github/workflows/packages.yml | 7 +++-- .github/workflows/toolchain.yml | 6 ++-- 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8744bc7737a663..52fba8e10639b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,9 @@ on: target: required: true type: string + subtarget: + required: true + type: string testing: type: boolean build_toolchain: @@ -50,7 +53,7 @@ permissions: jobs: setup_build: - name: Setup build ${{ inputs.target }} + name: Setup build ${{ inputs.target }}/${{ inputs.subtarget }} runs-on: ubuntu-latest outputs: owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} @@ -109,7 +112,7 @@ jobs: echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT build: - name: Build ${{ inputs.target }} + name: Build ${{ inputs.target }}/${{ inputs.subtarget }} needs: setup_build runs-on: ubuntu-latest @@ -157,13 +160,6 @@ jobs: run: | chown -R buildbot:buildbot openwrt - - name: Initialization environment - run: | - TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1) - SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2) - echo "TARGET=$TARGET" >> "$GITHUB_ENV" - echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" - - name: Prepare prebuilt tools shell: su buildbot -c "sh -e {0}" working-directory: openwrt @@ -213,7 +209,7 @@ jobs: fi fi - SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" + SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums" if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') @@ -235,16 +231,16 @@ jobs: uses: actions/cache@v3 with: path: openwrt/.ccache - key: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-${{ needs.setup_build.outputs.ccache_hash }} + key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ needs.setup_build.outputs.ccache_hash }} restore-keys: | - ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- + ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}- - name: Download external toolchain/sdk if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | - wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ + wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ | tar --xz -xf - - name: Configure testing kernel @@ -289,7 +285,7 @@ jobs: ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ --overwrite-config \ - --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + --config ${{ inputs.target }}/${{ inputs.subtarget }} - name: Adapt external sdk to external toolchain format if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' @@ -331,7 +327,7 @@ jobs: ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ --overwrite-config \ - --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + --config ${{ inputs.target }}/${{ inputs.subtarget }} - name: Configure internal toolchain if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal' @@ -342,8 +338,8 @@ jobs: echo CONFIG_AUTOREMOVE=y >> .config echo CONFIG_CCACHE=y >> .config - echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config - echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config + echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config + echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config make defconfig @@ -435,5 +431,5 @@ jobs: if: failure() uses: actions/upload-artifact@v3 with: - name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs + name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs path: "openwrt/logs" diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index 274bae367ded56..1ab4a361f5355e 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -6,6 +6,9 @@ on: target: required: true type: string + subtarget: + required: true + type: string testing: type: boolean use_openwrt_container: @@ -85,13 +88,6 @@ jobs: run: | chown -R buildbot:buildbot openwrt - - name: Initialization environment - run: | - TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1) - SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2) - echo "TARGET=$TARGET" >> "$GITHUB_ENV" - echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" - - name: Prepare prebuilt tools shell: su buildbot -c "sh -e {0}" working-directory: openwrt @@ -118,8 +114,8 @@ jobs: echo CONFIG_AUTOREMOVE=y >> .config echo CONFIG_CCACHE=y >> .config - echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config - echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config + echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config + echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config make defconfig @@ -140,13 +136,13 @@ jobs: . .github/workflows/scripts/ci_helpers.sh if git diff --name-only --exit-code; then - success "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} seems ok" + success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok" else - err "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} require refresh. (run 'make target/linux/refresh' and force push this pr)" + err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)" err "You can also check the provided artifacts with the refreshed patch from this CI run." - mkdir ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed + mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed for f in $(git diff --name-only); do - cp --parents $f ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed/ + cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/ done exit 1 fi @@ -155,5 +151,5 @@ jobs: if: failure() uses: actions/upload-artifact@v3 with: - name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed - path: openwrt/${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed + name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed + path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index db628d05eecca4..db59ef8ca68e86 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -17,7 +17,8 @@ jobs: packages: read uses: ./.github/workflows/build.yml with: - target: x86/64 + target: x86 + subtarget: 64 build_full: true include_feeds: true coverity_compiler_template_list: >- diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index a25829a4c0ec99..02aee8b27cc8ad 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -64,8 +64,9 @@ jobs: if echo "$CHANGED_FILES" | grep -v -q target/linux || echo "$CHANGED_FILES" | grep -q target/linux/generic || echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then + TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"'"'"${TARGET}"'"' + JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE" FIRST=0 fi done @@ -77,8 +78,9 @@ jobs: if echo "$CHANGED_FILES" | grep -v -q target/linux || echo "$CHANGED_FILES" | grep -q target/linux/generic || echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then + TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' - JSON_TARGETS="$JSON_TARGETS"'"'"${TARGET}"'"' + JSON_TARGETS="$JSON_TARGETS""$TUPLE" FIRST=0 fi done @@ -104,10 +106,11 @@ jobs: strategy: fail-fast: False matrix: - target: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} + include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} uses: ./.github/workflows/build.yml with: target: ${{ matrix.target }} + subtarget: ${{ matrix.subtarget }} build_kernel: true build_all_kmods: true @@ -120,8 +123,9 @@ jobs: strategy: fail-fast: False matrix: - target: ${{fromJson(needs.determine_targets.outputs.targets)}} + include: ${{fromJson(needs.determine_targets.outputs.targets)}} uses: ./.github/workflows/check-kernel-patches.yml with: target: ${{ matrix.target }} + subtarget: ${{ matrix.subtarget }} diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 340ee0c20446c5..e2f932b1ba3d42 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -37,11 +37,14 @@ jobs: fail-fast: False matrix: include: - - target: malta/be - - target: x86/64 + - target: malta + subtarget: be + - target: x86 + subtarget: 64 uses: ./.github/workflows/build.yml with: target: ${{ matrix.target }} + subtarget: ${{ matrix.subtarget }} build_kernel: true build_all_kmods: true build_all_modules: true diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml index 2a24d82e30ff9a..5755ca25b9db4a 100644 --- a/.github/workflows/toolchain.yml +++ b/.github/workflows/toolchain.yml @@ -40,8 +40,9 @@ jobs: JSON='[' FIRST=1 for TARGET in $TARGETS; do + TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' [[ $FIRST -ne 1 ]] && JSON="$JSON"',' - JSON="$JSON"'"'"${TARGET}"'"' + JSON="$JSON""$TUPLE" FIRST=0 done JSON="$JSON"']' @@ -61,8 +62,9 @@ jobs: strategy: fail-fast: False matrix: - target: ${{fromJson(needs.determine_targets.outputs.target)}} + include: ${{fromJson(needs.determine_targets.outputs.target)}} uses: ./.github/workflows/build.yml with: target: ${{ matrix.target }} + subtarget: ${{ matrix.subtarget }} build_toolchain: true From 22d714868912a7d36d1a29b72bd395994d4146ef Mon Sep 17 00:00:00 2001 From: Pietro Ameruoso Date: Mon, 22 May 2023 09:52:47 +0200 Subject: [PATCH 0016/1171] mediatek: add support for Zyxel EX5601-T0 router Zyxel EX5601-T0 specifics -------------- The operator specific firmware running on the Zyxel branded EX5601-T0 includes U-Boot modifications affecting the OpenWrt installation. Partition Table | dev | size | erasesize | name | | ---- | -------- | --------- | ------------- | | mtd0 | 20000000 | 00040000 | "spi0.1" | | mtd1 | 00100000 | 00040000 | "BL2" | | mtd2 | 00080000 | 00040000 | "u-boot-env" | | mtd3 | 00200000 | 00040000 | "Factory" | | mtd4 | 001c0000 | 00040000 | "FIP" | | mtd5 | 00040000 | 00040000 | "zloader" | | mtd6 | 04000000 | 00040000 | "ubi" | | mtd7 | 04000000 | 00040000 | "ubi2" | | mtd8 | 15a80000 | 00040000 | "zyubi" | The router boots BL2 which than loads FIP (u-boot). U-boot has hardcoded a command to always launch Zloader "mtd read zloader 0x46000000" and than "bootm". Bootargs are deactivated. Zloader is the zyxel booloader which allow to dual-boot ubi or ubi2, by default access to zloader is blocked. Too zloader checks that the firmware contains a particolar file called zyfwinfo. Additional details regarding Zloader can be found here: https://hack-gpon.github.io/zyxel/ https://forum.openwrt.org/t/adding-openwrt-support-for-zyxel-ex5601-t0/155914 Hardware -------- SOC: MediaTek MT7986a CPU: 4 core cortex-a53 (2000MHz) RAM: 1GB DDR4 FLASH: 512MB SPI-NAND (Micron xxx) WIFI: Wifi6 Mediatek MT7976 802.11ax 5 GHz 4x4 + 2.4GHZ 4x4 ETH: MediaTek MT7531 Switch + SoC 3 x builtin 1G phy (lan1, lan2, lan3) 1 x MaxLinear GPY211B 2.5 N-Base-T phy5 (lan4) 1 x MaxLinear GPY211B 2.5Gbit xor SFP/N-Base-T phy6 (wan) USB: 1 x USB 3.2 Enhanced SuperSpeed port UART: 3V3 115200 8N1 (Pinout: GND KEY RX TX VCC) VOIP: 2 FXS ports for analog phones MAC Address Table ----------------- eth0/lan Factory 0x002a eth1/wan Factory 0x0024 wifi 2.4Ghz Factory 0x0004 wifi 5Ghz Factory 0x0004 + 1 Serial console (UART) --------------------- +-------+-------+-------+-------+-------+ | +3.3V | RX | TX | KEY | GND | +---+---+-------+-------+-------+-------+ | +--- Don't connect Installation ------------ Keep in mind that openwrt can only run on the UBI partition, the openwrt firmware is not able to understand the zloader bootargs. The procedure allows restoring the UBI partition with the Zyxel firmware and retains all the OEM functionalities. 1. Unlock Zloader (this will allow to swap manually between partitions UBI and UBI2): - Attach a usb-ttl adapter to your computer and boot the router. - While the router is booting at some point you will read the following: `Please press Enter to activate this console.` - As soon as you read that press enter, type root and than press enter again (just do it, don't care about the logs scrolling). - Most likely the router is still printing the boot log, leave it boot until it stops. - If everything went ok you should have full root access "root@EX5601-T0:/#". - Type the following command and press enter: "fw_setenv EngDebugFlag 0x1". - Reboot the router. - As soon as you read `Hit any key to stop autoboot:` press Enter. - If everything went ok you should have the following prompt: "ZHAL>". - You have successfully unlocked zloader access, this procedure must be done only once. 2. Check the current active partition: - Boot the router and repeat the steps above to gain root access. - Type the following command to check the current active image: "cat /proc/cmdline". - If `rootubi=ubi` it means that the active partition is `mtd6` - If `rootubi=ubi2` it means that the active partition is `mtd7` - As mentioned earlier we need to flash openwrt into ubi/mtd6 and never overwrite ubi2/mtd7 to be able to fully roll-back. - To activate and boot from mtd7 (ubi2) enter into ZHAL> command prompt and type the following commands: atbt 1 # unlock write atsw # swap boot partition atsr # reboot the router - After rebooting check again with "cat /proc/cmdline" that you are correctly booting from mtd7/ubi2 - If yes proceed with the installation guide. If not probably you don't have a firmware into ubi2 or you did something wrong. 3. Flashing: - Download the sysupgrade file for the router from openwrt, than we need to add the zyfwinfo file into the sysupgrade tar. Zloader only checks for the magic (which is a fixed value 'EXYZ') and the crc of the file itself (256bytes). I created a script to create a valid zyfwinfo file but you can use anything that does exactly the same: https://raw.githubusercontent.com/pameruoso/OpenWRT-Zyxel-EX5601-T0/main/gen_zyfwinfo.sh - Add the zyfwinfo file into the sysupgrade tar. - Enter via telnet or ssh into the router with admin credentials - Enter the following commands to disable the firmware and model checks "zycli fwidcheck off" and "zycli modelcheck off" - Open the router web interface and in the update firmware page select the "restore default settings option" - Select the sysupgrade file and click on upload. - The router will flash and reboot itself into openwrt from UBI 4. Restoring and going back to Zyxel firmware. - Use the ZHAL> command line to manually swap the boot parition to UBI2 with the following: atbt 1 # unlock write atsw # swap boot partition atsr # reboot the router - You will boot again the Zyxel firmware you have into UBI2 and you can flash the zyxel firmware to overwrite the UBI partition and openwrt. Working features ---------------- 3 gbit lan ports Wifi Zyxel partitioning for coexistance with Zloader and dual boot. WAN SFP port (only after exporting pins 57 and 10. gpiobase411) leds reset button serial interface usb port lan ethernet 2.5 gbit port (autosense) wan ethernet 2.5 gbit port (autosense) Not working ---------------- voip (missing drivers or proper zyxel platform software) Swapping the wan ethernet/sfp xor port ---------------- The way to swap the wan port between sfp and ethernet is the following: export the pins 57 and 10. Pin 57 is used to probe if an sfp is present. If pin 57 value is 0 it means that an sfp is present into the cage (cat /sys/class/gpio/gpio468/value). If pin 57 value is 1 it means that no sfp is inserted into the cage. In conclusion by default both 57 an 10 pins are by default 1, which means that the active port is the ethernet one. After inserting an SFP pin 57 will become 0 and you have to manually change the value of pin 10 to 0 too. This is totally scriptable of course. Leds description ------------ All the leds are working out of the box but the leds managed by the 2 maxlinear phy (phy 5 lan, phy6 wan). To activate the phy5 led (rj45 ethernet port led on the back of the router) you have to use mdio-tools. To activate the phy6 led (led on the front of the router for 2.5gbit link) you have to use mdio-tools. Example: Set lan5 led to fast blink on 2500/1000, slow blink on 10/100: mdio mdio-bus mmd 5:30 raw 0x0001 0x33FC Set wan 2.5gbit led to constant on when wan is 2.5gbit: mdio mdio-bus mmd 6:30 raw 0x0001 0x0080 Signed-off-by: Pietro Ameruoso (cherry picked from commit 1c05388ab04c934ec240e8362321908f91381a90) Signed-off-by: Daniel Golle --- .../uboot-envtools/files/mediatek_filogic | 4 + .../dts/mt7986a-zyxel-ex5601-t0-stock.dts | 560 ++++++++++++++++++ .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 4 + target/linux/mediatek/image/filogic.mk | 23 + 4 files changed, 591 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index a685b046536beb..50b9cd0e4631c9 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -52,6 +52,10 @@ xiaomi,redmi-router-ax6000-ubootmod) ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1" ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1" ;; +zyxel,ex5601-t0) + local envdev=/dev/mtd$(find_mtd_index "u-boot-env") + ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2" + ;; esac config_load ubootenv diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts new file mode 100644 index 00000000000000..07a3e8d3ee9d04 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts @@ -0,0 +1,560 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +#include "mt7986a.dtsi" +#include +#include + +/ { + model = "Zyxel EX5601-T0"; + compatible = "zyxel,ex5601-t0", "mediatek,mt7986a-rfb-snand"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + gpio-keys { + compatible = "gpio-keys"; + poll-interval = <20>; + + reset-button { + label = "reset"; + gpios = <&pio 21 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wlan-button { + label = "wlan"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps-button { + label = "wps"; + gpios = <&pio 56 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + zyleds { + compatible = "gpio-leds"; + + led_green_wifi24g { + label = "zyled-green-wifi24g"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_wifi5g { + label = "zyled-green-wifi5g"; + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_inet { + label = "zyled-green-inet"; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_red_inet { + label = "zyled-red-inet"; + gpios = <&pio 15 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_pwr { + label = "zyled-green-pwr"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; /* Default blinking */ + led-pattern = <125 125>; /* Fast blink is 4 HZ */ + }; + + led_red_pwr { + label = "zyled-red-pwr"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_fxs { + label = "zyled-green-fxs"; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_fxs { + label = "zyled-amber-fxs"; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_wps24g { + label = "zyled-amber-wps24g"; + gpios = <&pio 18 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_wps5g { + label = "zyled-amber-wps5g"; + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_green_lan { + label = "zyled-green-lan"; + gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_green_sfp { + label = "zyled-green-sfp"; + gpios = <&pio 24 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + }; + +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_factory_002a>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy = <&phy6>; + + nvmem-cells = <&macaddr_factory_0024>; + nvmem-cell-names = "mac-address"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <1500000>; + reset-post-delay-us = <1000000>; + + phy5: phy@5 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + }; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@5 { + reg = <5>; + label = "lan4"; + phy-mode = "2500base-x"; + phy = <&phy5>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&wmac { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; + mediatek,mtd-eeprom = <&factory 0x0>; + nvmem-cells = <&macaddr_factory_0004>; + nvmem-cell-names = "mac-address"; +}; + +&crypto { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <8>; + max-frequency = <200000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + mmc-hs400-1_8v; + hs400-ds-delay = <0x14014>; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; + non-removable; + no-sd; + no-sdio; + status = "disabled"; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pio { + mmc0_pins_default: mmc0-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + mmc0_pins_uhs: mmc0-uhs-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + pcie_pins: pcie-pins { + mux { + function = "pcie"; + groups = "pcie_clk", "pcie_wake", "pcie_pereset"; + }; + }; + + spic_pins_g2: spic-pins-29-to-32 { + mux { + function = "spi"; + groups = "spi1_2"; + }; + }; + + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + uart1_pins: uart1-pins { + mux { + function = "uart"; + groups = "uart1"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart"; + groups = "uart2"; + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf_dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + cs-gpios = <0>, <0>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + spi_nand: spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <10000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x01C0000>; + read-only; + }; + + partition@540000 { + label = "zloader"; + reg = <0x540000 0x0040000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; + }; + + partition@4580000 { + label = "ubi2"; + reg = <0x4580000 0x4000000>; + read-only; + }; + + partition@8580000 { + label = "zyubi"; + reg = <0x8580000 0x15A80000>; + }; + }; + }; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spic_pins_g2>; + status = "okay"; + + proslic_spi: proslic_spi@0 { + compatible = "silabs,proslic_spi"; + reg = <0>; + spi-max-frequency = <10000000>; + spi-cpha = <1>; + spi-cpol = <1>; + channel_count = <1>; + debug_level = <4>; /* 1 = TRC, 2 = DBG, 4 = ERR */ + reset_gpio = <&pio 7 GPIO_ACTIVE_HIGH>; + ig,enable-spi = <1>; /* 1: Enable, 0: Disable */ + }; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_0004: macaddr@0004 { + reg = <0x0004 0x6>; + }; + + macaddr_factory_0024: macaddr@0024 { + reg = <0x0024 0x6>; + }; + + macaddr_factory_002a: macaddr@002a { + reg = <0x002a 0x6>; + }; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 8088b98eb6e054..a56e5bc6893096 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -37,4 +37,8 @@ case "$board" in tplink,tl-xdr6088) [ "$PHYNBR" = "0" ] && get_mac_label > /sys${DEVPATH}/macaddress ;; + zyxel,ex5601-t0) + addr=$(mtd_get_mac_binary "Factory" 0x4) + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; esac diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 7159917ff45bbe..92d1dcfad24991 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -294,3 +294,26 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) endif endef TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod + +define Device/zyxel_ex5601-t0-stock + DEVICE_VENDOR := Zyxel + DEVICE_MODEL := EX5601-T0 (stock layout) + DEVICE_DTS := mt7986a-zyxel-ex5601-t0-stock + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware + SUPPORTED_DEVICES := mediatek,mt7986a-rfb-snand + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 256k + PAGESIZE := 4096 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + KERNEL = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd + DTC_FLAGS += -@ --space 32768 +endef +TARGET_DEVICES += zyxel_ex5601-t0-stock From 60b622002823ffdedfb0cd0a57df0b490eb11868 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 21 May 2023 23:36:01 +0200 Subject: [PATCH 0017/1171] lldpd: update to 1.0.17 Release Notes: https://github.com/lldpd/lldpd/releases/tag/1.0.17 Signed-off-by: Nick Hainke (cherry picked from commit 17fbbafdcbc55d6ab3d357012f336941fa27d43e) Signed-off-by: Daniel Golle --- package/network/services/lldpd/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index c3753534a682ff..289adc55c9407b 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd -PKG_VERSION:=1.0.16 +PKG_VERSION:=1.0.17 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ -PKG_HASH:=7753c6e31e938923185f4e10c4ab328929729e22ee4a9687d08881fb82c092ee +PKG_HASH:=89ae691a4917ac9e0ec3b8b2c1e634cc402d43b804f98850c73bd1c7df380882 PKG_MAINTAINER:=Stijn Tintel PKG_LICENSE:=ISC From f1fbf61fcf2b2ee61548f4096020e2d84ebc76b1 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 21 May 2023 23:25:52 +0200 Subject: [PATCH 0018/1171] libcap: update to 2.69 Release Notes: https://sites.google.com/site/fullycapable/release-notes-for-libcap#h.iuvg7sbjg8pe Fixes: CVE-2023-2602 CVE-2023-2603 Signed-off-by: Nick Hainke (cherry picked from commit 78c45c1e591ce5aeff9fb7eeae049662c4ac4ef2) Signed-off-by: Daniel Golle --- package/libs/libcap/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libcap/Makefile b/package/libs/libcap/Makefile index 6f51b5d5edd991..989209302a489b 100644 --- a/package/libs/libcap/Makefile +++ b/package/libs/libcap/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libcap -PKG_VERSION:=2.68 +PKG_VERSION:=2.69 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2 -PKG_HASH:=90be3b6d41be5f81ae4b03ec76012b0d27c829293684f6c05b65d5f9cce724b2 +PKG_HASH:=f311f8f3dad84699d0566d1d6f7ec943a9298b28f714cae3c931dfd57492d7eb PKG_MAINTAINER:=Paul Wassi PKG_LICENSE:=GPL-2.0-only From ea9a7f1250e84744ae89f14af328908326b0aa6b Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 21 May 2023 23:21:14 +0200 Subject: [PATCH 0019/1171] libxml2: update to 2.11.4 Release Notes: https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.4 Signed-off-by: Nick Hainke (cherry picked from commit c520d682f02890afb38e43b862ca856e2b933507) Signed-off-by: Daniel Golle --- package/libs/libxml2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index 5a7de0d8a1ea90..ed1965c0195418 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.11.3 +PKG_VERSION:=2.11.4 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=f1acae1664bda006cd81bfc238238217043d586d06659d5c0e3d1bcebe040870 +PKG_HASH:=737e1d7f8ab3f139729ca13a2494fd17bf30ddb4b7a427cf336252cab57f57f7 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING From d4b4926320a0a118454ccec065eac95b78215bba Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 21 May 2023 23:54:31 +0200 Subject: [PATCH 0020/1171] busybox: update to 1.36.1 Release Notes: http://lists.busybox.net/pipermail/busybox-cvs/2023-May/041510.html Refresh commands, run after busybox is first built once (nothing changed compared to 1.36.0): cd package/utils/busybox/config/ ../convert_menuconfig.pl ../../../../build_dir/target-mipsel_24kc_musl/busybox-default/busybox-1.36.1 cd .. ./convert_defaults.pl ../../../build_dir/target-mipsel_24kc_musl/busybox-default/busybox-1.36.1/.config > Config-defaults.in Manual edits needed afterward: * Config-defaults.in: OpenWrt config symbol IPV6 logic applied to BUSYBOX_DEFAULT_FEATURE_IPV6 * Config-defaults.in: OpenWrt config TARGET_bcm53xx logic applied to BUSYBOX_DEFAULT_TRUNCATE (commit 547f1ec) * Config-defaults.in: OpenWrt logic applied to BUSYBOX_DEFAULT_LOGIN_SESSION_AS_CHILD (commit dc92917) * Config-defaults.in: correct the default ports that get reset BUSYBOX_DEFAULT_FEATURE_HTTPD_PORT_DEFAULT 80 BUSYBOX_DEFAULT_FEATURE_TELNETD_PORT_DEFAULT 23 * config/editors/Config.in: Add USE_GLIBC dependency to BUSYBOX_CONFIG_FEATURE_VI_REGEX_SEARCH (commit f141090) * config/shell/Config.in: change at "Options common to all shells" the conditional symbol SHELL_ASH --> BUSYBOX_CONFIG_SHELL_ASH (discussion in http://lists.openwrt.org/pipermail/openwrt-devel/2021-January/033140.html Apparently our script does not see the hidden option while prepending config options with "BUSYBOX_CONFIG_" which leads to a missed dependency when the options are later evaluated.) * Edit a few Config.in files by adding quotes to sourced items in config/Config.in, config/networking/Config.in and config/util-linux/Config.in (commit 1da014f) Tested-by: Hannu Nyman Signed-off-by: Nick Hainke (cherry picked from commit 3b76f6eee430a107a0970583c1aa215b35f7e3e4) Signed-off-by: Daniel Golle --- package/utils/busybox/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index d7ad8ca8fa2d76..4bddd5201d8f86 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -5,14 +5,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox -PKG_VERSION:=1.36.0 +PKG_VERSION:=1.36.1 PKG_RELEASE:=1 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_HASH:=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5 +PKG_HASH:=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 From 34b19a852079ab41329461030839695a21fab5fb Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 22 May 2023 22:58:58 +0100 Subject: [PATCH 0021/1171] mediatek: mt7623: build SD card without all filesystems Allow building SD card images without having both initramfs and squashfs present on the card, just like it has already been done for the mt7622 and filogic subtargets. Signed-off-by: Daniel Golle (cherry picked from commit d6fef27f2dd4a852ed7846e4aa5f06dcd8df91b6) --- target/linux/mediatek/image/mt7623.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 26befc1c1e533e..1645ecd5450756 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -104,8 +104,12 @@ define Device/bananapi_bpi-r2 pad-to 2k | append-preloader $$(UBOOT_TARGET) |\ pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\ pad-to 4092k | mt7623-mbr emmc |\ + $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ pad-to 4M | append-image-stage initramfs-recovery.itb |\ + ) \ + $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ pad-to 48M | append-image squashfs-sysupgrade.itb |\ + ) \ gzip ARTIFACTS := u-boot.bin preloader.bin sdcard.img.gz SUPPORTED_DEVICES := bananapi,bpi-r2 @@ -135,8 +139,12 @@ define Device/unielec_u7623-02 # but OpenWrt expects 'SDMM' magic for sysupgrade. ARTIFACT/emmc.img.gz := mt7623-mbr sdmmc |\ pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\ + $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ pad-to 4M | append-image-stage initramfs-recovery.itb |\ + ) \ + $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ pad-to 48M | append-image squashfs-sysupgrade.itb |\ + ) \ gzip | append-metadata ARTIFACT/scatter.txt := scatterfile emmc.img.gz ARTIFACTS := u-boot.bin scatter.txt emmc.img.gz From 5df84814bb8c807a51eba3f470fcbf06bae06886 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Thu, 4 May 2023 19:17:35 -0700 Subject: [PATCH 0022/1171] kernel: enable (ARM|ARM64)_MODULE_PLTS in generic config This allows loading modules with large memory requirements, recently needed while testing on armvirt/32. Past forum discussions [1] and bug reports [2] also raised this and the ipq806x target already set it in response [3]. Given this increases kernel image size by only ~1KB, is generally useful on multi-platform kernels, and enabled by default on upstream arm32 Linux, add it to the generic config. The setting has similar utility on arm64, is a requirement for KASLR, and already enabled on most OpenWrt aarch64 targets, so pull this into the top-level generic config. [1]: https://forum.openwrt.org/t/vmap-allocation-for-size-442368-failed-use-vmalloc-size-to-increase-size/34545/7 [2]: https://github.com/openwrt/openwrt/issues/8282 [3]: f81e148eb6 ("ipq806x: update 4.19 kernel config"). Signed-off-by: Tony Ambardar (cherry picked from commit c2d194a34eb1a62a610f0437287db6c3eca64d5a) Signed-off-by: Daniel Golle --- target/linux/armvirt/64/config-5.15 | 1 - target/linux/bcm27xx/bcm2710/config-5.15 | 1 - target/linux/bcm27xx/bcm2711/config-5.15 | 1 - target/linux/generic/config-5.15 | 4 ++-- target/linux/ipq806x/config-5.15 | 1 - target/linux/layerscape/armv8_64b/config-5.15 | 1 - target/linux/mediatek/filogic/config-5.15 | 1 - target/linux/mediatek/mt7622/config-5.15 | 1 - target/linux/octeontx/config-5.15 | 1 - target/linux/rockchip/armv8/config-5.15 | 1 - 10 files changed, 2 insertions(+), 11 deletions(-) diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armvirt/64/config-5.15 index 19ae3dc0cfa340..eb5405eb1ef961 100644 --- a/target/linux/armvirt/64/config-5.15 +++ b/target/linux/armvirt/64/config-5.15 @@ -23,7 +23,6 @@ CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 diff --git a/target/linux/bcm27xx/bcm2710/config-5.15 b/target/linux/bcm27xx/bcm2710/config-5.15 index 477d70fc66cf3c..193bc7d5ee3071 100644 --- a/target/linux/bcm27xx/bcm2710/config-5.15 +++ b/target/linux/bcm27xx/bcm2710/config-5.15 @@ -27,7 +27,6 @@ CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 diff --git a/target/linux/bcm27xx/bcm2711/config-5.15 b/target/linux/bcm27xx/bcm2711/config-5.15 index 2f8f9dccb1b2af..e18728e49d6622 100644 --- a/target/linux/bcm27xx/bcm2711/config-5.15 +++ b/target/linux/bcm27xx/bcm2711/config-5.15 @@ -27,7 +27,6 @@ CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index f13af8ba268f2f..6ac2993c155976 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -343,7 +343,7 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 # CONFIG_ARM64_ERRATUM_858921 is not set # CONFIG_ARM64_HW_AFDBM is not set # CONFIG_ARM64_LSE_ATOMICS is not set -# CONFIG_ARM64_MODULE_PLTS is not set +CONFIG_ARM64_MODULE_PLTS=y # CONFIG_ARM64_MTE is not set # CONFIG_ARM64_PAN is not set # CONFIG_ARM64_PMEM is not set @@ -408,7 +408,7 @@ CONFIG_ARM_GIC_MAX_NR=1 # CONFIG_ARM_LPAE is not set # CONFIG_ARM_MEDIATEK_CPUFREQ_HW is not set # CONFIG_ARM_MHU is not set -# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_ARM_MODULE_PLTS=y # CONFIG_ARM_PATCH_PHYS_VIRT is not set # CONFIG_ARM_PSCI is not set # CONFIG_ARM_PSCI_CHECKER is not set diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 69e17cfa5044fb..286f327e39da3c 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -39,7 +39,6 @@ CONFIG_ARM_HAS_SG_CHAIN=y # CONFIG_ARM_KRAIT_CACHE_DEVFREQ is not set CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_MODULE_PLTS=y CONFIG_ARM_PATCH_IDIV=y CONFIG_ARM_PATCH_PHYS_VIRT=y # CONFIG_ARM_QCOM_CPUFREQ_HW is not set diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15 index 3fe55e61188e96..df0a3fd849cfba 100644 --- a/target/linux/layerscape/armv8_64b/config-5.15 +++ b/target/linux/layerscape/armv8_64b/config-5.15 @@ -30,7 +30,6 @@ CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 96ff95be13dbb9..9df1494ca095d2 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -20,7 +20,6 @@ CONFIG_ARM64_4K_PAGES=y CONFIG_ARM64_CRYPTO=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PA_BITS=48 CONFIG_ARM64_PA_BITS_48=y diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index 1ce6d852ba1c1a..ac09c8a9c47b4d 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -22,7 +22,6 @@ CONFIG_ARM64_CRYPTO=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PA_BITS=48 CONFIG_ARM64_PA_BITS_48=y diff --git a/target/linux/octeontx/config-5.15 b/target/linux/octeontx/config-5.15 index c2ad7e7ab9d78a..9ca15896432546 100644 --- a/target/linux/octeontx/config-5.15 +++ b/target/linux/octeontx/config-5.15 @@ -26,7 +26,6 @@ CONFIG_ARM64_ERRATUM_827319=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15 index 2359fd8729e895..0ed009004f15a8 100644 --- a/target/linux/rockchip/armv8/config-5.15 +++ b/target/linux/rockchip/armv8/config-5.15 @@ -31,7 +31,6 @@ CONFIG_ARM64_ERRATUM_858921=y CONFIG_ARM64_ERRATUM_1742098=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_MODULE_PLTS=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 From 3ff5e9e8de883b64c2ade3730a1337c554acd67a Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Mon, 1 May 2023 23:20:28 +0800 Subject: [PATCH 0023/1171] mediatek: mt7981: usb enable 3.0 by default There is no reason to limit USB to 2.0 mode by default, delete this limit. Signed-off-by: Chukun Pan (cherry picked from commit b2beb4c68849c804a8b9441f776a6918d433fb1e) Signed-off-by: Daniel Golle --- .../mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index 279bce14e8653c..dbcf4bb28b8420 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -640,7 +640,6 @@ phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>; vusb33-supply = <®_3p3v>; - mediatek,u3p-dis-msk = <0x01>; status = "disabled"; }; From 918c0e5f41c853659cd6ab0b6ede900df9b986ed Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 23 May 2023 02:14:32 +0100 Subject: [PATCH 0024/1171] mediatek: mt7981: setup all clocks needed for eMMC Setup all necessary clocks to get MMC to work on MT7981, similar to how it is done also on MT7986. Signed-off-by: Daniel Golle (cherry picked from commit a9989b30d01e534288928d7ef48df3eb9fe3150b) --- .../files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index dbcf4bb28b8420..95b548143b43b0 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -555,14 +555,15 @@ "mediatek,mt7981-mmc"; reg = <0 0x11230000 0 0x1000>, <0 0x11c20000 0 0x1000>; interrupts = ; - clocks = <&topckgen CLK_TOP_EMMC_208M>, - <&topckgen CLK_TOP_EMMC_400M>, - <&infracfg CLK_INFRA_MSDC_CK>; + clocks = <&infracfg CLK_INFRA_MSDC_CK>, + <&infracfg CLK_INFRA_MSDC_HCK_CK>, + <&infracfg CLK_INFRA_MSDC_66M_CK>, + <&infracfg CLK_INFRA_MSDC_133M_CK>; assigned-clocks = <&topckgen CLK_TOP_EMMC_208M_SEL>, <&topckgen CLK_TOP_EMMC_400M_SEL>; assigned-clock-parents = <&topckgen CLK_TOP_CB_M_D2>, <&topckgen CLK_TOP_CB_NET2_D2>; - clock-names = "source", "hclk", "source_cg"; + clock-names = "source", "hclk", "axi_cg", "ahb_cg"; status = "disabled"; }; From d74c3d889583db6d8c0d78e74fb1cb6b40d2a198 Mon Sep 17 00:00:00 2001 From: Sam Shih Date: Sun, 19 Feb 2023 10:11:50 +0800 Subject: [PATCH 0025/1171] mediatek: add mt7988 clock drivers support This adds clock drivers for the MediaTek MT7988 SoC Signed-off-by: Sam Shih Signed-off-by: Daniel Golle (cherry picked from commit b33c1858767e5109913ac2195ec2b2b8ef0e726a) --- .../drivers/clk/mediatek/clk-mt7988-apmixed.c | 113 ++++ .../drivers/clk/mediatek/clk-mt7988-eth.c | 299 ++++++++++ .../clk/mediatek/clk-mt7988-infracfg.c | 399 +++++++++++++ .../clk/mediatek/clk-mt7988-topckgen.c | 522 ++++++++++++++++++ .../dt-bindings/clock/mediatek,mt7988-clk.h | 276 +++++++++ target/linux/mediatek/filogic/config-5.15 | 1 + target/linux/mediatek/mt7622/config-5.15 | 1 + target/linux/mediatek/mt7623/config-5.15 | 1 + target/linux/mediatek/mt7629/config-5.15 | 1 + ...k-mediatek-Add-pcw-chg-shift-control.patch | 24 + ...lk-mediatek-add-mt7988-clock-support.patch | 31 ++ 11 files changed, 1668 insertions(+) create mode 100644 target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-apmixed.c create mode 100644 target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-eth.c create mode 100644 target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c create mode 100644 target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-topckgen.c create mode 100644 target/linux/mediatek/files-5.15/include/dt-bindings/clock/mediatek,mt7988-clk.h create mode 100644 target/linux/mediatek/patches-5.15/241-clk-mediatek-Add-pcw-chg-shift-control.patch create mode 100644 target/linux/mediatek/patches-5.15/242-clk-mediatek-add-mt7988-clock-support.patch diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-apmixed.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-apmixed.c new file mode 100644 index 00000000000000..587b70767eb21e --- /dev/null +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-apmixed.c @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Sam Shih + * Author: Xiufeng Li + */ + +#include +#include +#include +#include +#include +#include "clk-mtk.h" +#include "clk-gate.h" +#include "clk-mux.h" +#include + +#define MT7988_PLL_FMAX (2500UL * MHZ) +#define MT7988_PCW_CHG_SHIFT 2 + +#define PLL_xtal(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _rst_bar_mask, \ + _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \ + _tuner_en_bit, _pcw_reg, _pcw_shift, _pcw_chg_reg, \ + _div_table) \ + { \ + .id = _id, .name = _name, .reg = _reg, .pwr_reg = _pwr_reg, \ + .en_mask = _en_mask, .flags = _flags, \ + .rst_bar_mask = BIT(_rst_bar_mask), .fmax = MT7988_PLL_FMAX, \ + .pcwbits = _pcwbits, .pd_reg = _pd_reg, \ + .pd_shift = _pd_shift, .tuner_reg = _tuner_reg, \ + .tuner_en_reg = _tuner_en_reg, .tuner_en_bit = _tuner_en_bit, \ + .pcw_reg = _pcw_reg, .pcw_shift = _pcw_shift, \ + .pcw_chg_reg = _pcw_chg_reg, \ + .pcw_chg_shift = MT7988_PCW_CHG_SHIFT, \ + .div_table = _div_table, .parent_name = "clkxtal", \ + } + +#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _rst_bar_mask, \ + _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \ + _tuner_en_bit, _pcw_reg, _pcw_shift, _pcw_chg_reg) \ + PLL_xtal(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _rst_bar_mask, \ + _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \ + _tuner_en_bit, _pcw_reg, _pcw_shift, _pcw_chg_reg, NULL) + +static const struct mtk_pll_data plls[] = { + PLL(CLK_APMIXED_NETSYSPLL, "netsyspll", 0x0104, 0x0110, 0x00000001, 0, + 0, 32, 0x0104, 4, 0, 0, 0, 0x0108, 0, 0x0104), + PLL(CLK_APMIXED_MPLL, "mpll", 0x0114, 0x0120, 0xff000001, HAVE_RST_BAR, + 23, 32, 0x0114, 4, 0, 0, 0, 0x0118, 0, 0x0114), + PLL(CLK_APMIXED_MMPLL, "mmpll", 0x0124, 0x0130, 0xff000001, + HAVE_RST_BAR, 23, 32, 0x0124, 4, 0, 0, 0, 0x0128, 0, 0x0124), + PLL(CLK_APMIXED_APLL2, "apll2", 0x0134, 0x0140, 0x00000001, 0, 0, 32, + 0x0134, 4, 0x0704, 0x0700, 1, 0x0138, 0, 0x0134), + PLL(CLK_APMIXED_NET1PLL, "net1pll", 0x0144, 0x0150, 0xff000001, + HAVE_RST_BAR, 23, 32, 0x0144, 4, 0, 0, 0, 0x0148, 0, 0x0144), + PLL(CLK_APMIXED_NET2PLL, "net2pll", 0x0154, 0x0160, 0xff000001, + (HAVE_RST_BAR | PLL_AO), 23, 32, 0x0154, 4, 0, 0, 0, 0x0158, 0, + 0x0154), + PLL(CLK_APMIXED_WEDMCUPLL, "wedmcupll", 0x0164, 0x0170, 0x00000001, 0, + 0, 32, 0x0164, 4, 0, 0, 0, 0x0168, 0, 0x0164), + PLL(CLK_APMIXED_SGMPLL, "sgmpll", 0x0174, 0x0180, 0x00000001, 0, 0, 32, + 0x0174, 4, 0, 0, 0, 0x0178, 0, 0x0174), + PLL(CLK_APMIXED_ARM_B, "arm_b", 0x0204, 0x0210, 0xff000001, + (HAVE_RST_BAR | PLL_AO), 23, 32, 0x0204, 4, 0, 0, 0, 0x0208, 0, + 0x0204), + PLL(CLK_APMIXED_CCIPLL2_B, "ccipll2_b", 0x0214, 0x0220, 0xff000001, + HAVE_RST_BAR, 23, 32, 0x0214, 4, 0, 0, 0, 0x0218, 0, 0x0214), + PLL(CLK_APMIXED_USXGMIIPLL, "usxgmiipll", 0x0304, 0x0310, 0xff000001, + HAVE_RST_BAR, 23, 32, 0x0304, 4, 0, 0, 0, 0x0308, 0, 0x0304), + PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x0314, 0x0320, 0x00000001, 0, 0, + 32, 0x0314, 4, 0, 0, 0, 0x0318, 0, 0x0314), +}; + +static const struct of_device_id of_match_clk_mt7988_apmixed[] = { + { + .compatible = "mediatek,mt7988-apmixedsys", + }, + {} +}; + +static int clk_mt7988_apmixed_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + + clk_data = mtk_alloc_clk_data(ARRAY_SIZE(plls)); + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_apmixed_data; + } + return r; + +free_apmixed_data: + mtk_free_clk_data(clk_data); + return r; +} + +static struct platform_driver clk_mt7988_apmixed_drv = { + .probe = clk_mt7988_apmixed_probe, + .driver = { + .name = "clk-mt7988-apmixed", + .of_match_table = of_match_clk_mt7988_apmixed, + }, +}; +builtin_platform_driver(clk_mt7988_apmixed_drv); diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-eth.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-eth.c new file mode 100644 index 00000000000000..341d0f73fd3080 --- /dev/null +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-eth.c @@ -0,0 +1,299 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Sam Shih + * Author: Xiufeng Li + */ + +#include +#include +#include +#include +#include +#include "clk-mtk.h" +#include "clk-gate.h" +#include + +static const struct mtk_gate_regs ethdma_cg_regs = { + .set_ofs = 0x30, + .clr_ofs = 0x30, + .sta_ofs = 0x30, +}; + +#define GATE_ETHDMA(_id, _name, _parent, _shift) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = ðdma_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_no_setclr_inv, \ + } + +static const struct mtk_gate ethdma_clks[] = { + GATE_ETHDMA(CLK_ETHDMA_XGP1_EN, "ethdma_xgp1_en", "top_xtal", 0), + GATE_ETHDMA(CLK_ETHDMA_XGP2_EN, "ethdma_xgp2_en", "top_xtal", 1), + GATE_ETHDMA(CLK_ETHDMA_XGP3_EN, "ethdma_xgp3_en", "top_xtal", 2), + GATE_ETHDMA(CLK_ETHDMA_FE_EN, "ethdma_fe_en", "netsys_2x_sel", 6), + GATE_ETHDMA(CLK_ETHDMA_GP2_EN, "ethdma_gp2_en", "top_xtal", 7), + GATE_ETHDMA(CLK_ETHDMA_GP1_EN, "ethdma_gp1_en", "top_xtal", 8), + GATE_ETHDMA(CLK_ETHDMA_GP3_EN, "ethdma_gp3_en", "top_xtal", 10), + GATE_ETHDMA(CLK_ETHDMA_ESW_EN, "ethdma_esw_en", "netsys_gsw_sel", 16), + GATE_ETHDMA(CLK_ETHDMA_CRYPT0_EN, "ethdma_crypt0_en", "eip197_sel", + 29), +}; + +static int clk_mt7988_ethsys_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + void __iomem *base; + + base = of_iomap(node, 0); + if (!base) { + pr_err("%s(): ioremap failed\n", __func__); + return -ENOMEM; + } + + clk_data = mtk_alloc_clk_data(ARRAY_SIZE(ethdma_clks)); + + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_gates(node, ethdma_clks, ARRAY_SIZE(ethdma_clks), + clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_data; + } + return r; + +free_data: + mtk_free_clk_data(clk_data); + return r; +} + +static const struct mtk_gate_regs sgmii0_cg_regs = { + .set_ofs = 0xe4, + .clr_ofs = 0xe4, + .sta_ofs = 0xe4, +}; + +#define GATE_SGMII0(_id, _name, _parent, _shift) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = &sgmii0_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_no_setclr_inv, \ + } + +static const struct mtk_gate sgmii0_clks[] = { + GATE_SGMII0(CLK_SGM0_TX_EN, "sgm0_tx_en", "top_xtal", 2), + GATE_SGMII0(CLK_SGM0_RX_EN, "sgm0_rx_en", "top_xtal", 3), +}; + +static int clk_mt7988_sgmii0_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + void __iomem *base; + + base = of_iomap(node, 0); + if (!base) { + pr_err("%s(): ioremap failed\n", __func__); + return -ENOMEM; + } + + clk_data = mtk_alloc_clk_data(ARRAY_SIZE(sgmii0_clks)); + + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_gates(node, sgmii0_clks, ARRAY_SIZE(sgmii0_clks), + clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_data; + } + return r; + +free_data: + mtk_free_clk_data(clk_data); + return r; +} + +static const struct mtk_gate_regs sgmii1_cg_regs = { + .set_ofs = 0xe4, + .clr_ofs = 0xe4, + .sta_ofs = 0xe4, +}; + +#define GATE_SGMII1(_id, _name, _parent, _shift) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = &sgmii1_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_no_setclr_inv, \ + } + +static const struct mtk_gate sgmii1_clks[] = { + GATE_SGMII1(CLK_SGM1_TX_EN, "sgm1_tx_en", "top_xtal", 2), + GATE_SGMII1(CLK_SGM1_RX_EN, "sgm1_rx_en", "top_xtal", 3), +}; + +static int clk_mt7988_sgmii1_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + void __iomem *base; + + base = of_iomap(node, 0); + if (!base) { + pr_err("%s(): ioremap failed\n", __func__); + return -ENOMEM; + } + + clk_data = mtk_alloc_clk_data(ARRAY_SIZE(sgmii1_clks)); + + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_gates(node, sgmii1_clks, ARRAY_SIZE(sgmii1_clks), + clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_data; + } + return r; + +free_data: + mtk_free_clk_data(clk_data); + return r; +} + +static const struct mtk_gate_regs ethwarp_cg_regs = { + .set_ofs = 0x14, + .clr_ofs = 0x14, + .sta_ofs = 0x14, +}; + +#define GATE_ETHWARP(_id, _name, _parent, _shift) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = ðwarp_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_no_setclr_inv, \ + } + +static const struct mtk_gate ethwarp_clks[] = { + GATE_ETHWARP(CLK_ETHWARP_WOCPU2_EN, "ethwarp_wocpu2_en", + "netsys_mcu_sel", 13), + GATE_ETHWARP(CLK_ETHWARP_WOCPU1_EN, "ethwarp_wocpu1_en", + "netsys_mcu_sel", 14), + GATE_ETHWARP(CLK_ETHWARP_WOCPU0_EN, "ethwarp_wocpu0_en", + "netsys_mcu_sel", 15), +}; + +static int clk_mt7988_ethwarp_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + void __iomem *base; + + base = of_iomap(node, 0); + if (!base) { + pr_err("%s(): ioremap failed\n", __func__); + return -ENOMEM; + } + + clk_data = mtk_alloc_clk_data(ARRAY_SIZE(ethwarp_clks)); + + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_gates(node, ethwarp_clks, ARRAY_SIZE(ethwarp_clks), + clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_data; + } + return r; + +free_data: + mtk_free_clk_data(clk_data); + return r; +} + +static const struct of_device_id of_match_clk_mt7988_ethsys[] = { + { + .compatible = "mediatek,mt7988-ethsys", + }, + {} +}; + +static struct platform_driver clk_mt7988_ethsys_drv = { + .probe = clk_mt7988_ethsys_probe, + .driver = { + .name = "clk-mt7988-ethsys", + .of_match_table = of_match_clk_mt7988_ethsys, + }, +}; +builtin_platform_driver(clk_mt7988_ethsys_drv); + +static const struct of_device_id of_match_clk_mt7988_sgmii0[] = { + { + .compatible = "mediatek,mt7988-sgmiisys_0", + }, + {} +}; + +static struct platform_driver clk_mt7988_sgmii0_drv = { + .probe = clk_mt7988_sgmii0_probe, + .driver = { + .name = "clk-mt7988-sgmiisys_0", + .of_match_table = of_match_clk_mt7988_sgmii0, + }, +}; +builtin_platform_driver(clk_mt7988_sgmii0_drv); + +static const struct of_device_id of_match_clk_mt7988_sgmii1[] = { + { + .compatible = "mediatek,mt7988-sgmiisys_1", + }, + {} +}; + +static struct platform_driver clk_mt7988_sgmii1_drv = { + .probe = clk_mt7988_sgmii1_probe, + .driver = { + .name = "clk-mt7988-sgmiisys_1", + .of_match_table = of_match_clk_mt7988_sgmii1, + }, +}; +builtin_platform_driver(clk_mt7988_sgmii1_drv); + +static const struct of_device_id of_match_clk_mt7988_ethwarp[] = { + { + .compatible = "mediatek,mt7988-ethwarp", + }, + {} +}; + +static struct platform_driver clk_mt7988_ethwarp_drv = { + .probe = clk_mt7988_ethwarp_probe, + .driver = { + .name = "clk-mt7988-ethwarp", + .of_match_table = of_match_clk_mt7988_ethwarp, + }, +}; +builtin_platform_driver(clk_mt7988_ethwarp_drv); \ No newline at end of file diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c new file mode 100644 index 00000000000000..77e25383b6e3c1 --- /dev/null +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c @@ -0,0 +1,399 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Sam Shih + * Author: Xiufeng Li + */ + +#include +#include +#include +#include +#include +#include "clk-mtk.h" +#include "clk-gate.h" +#include "clk-mux.h" +#include + +static DEFINE_SPINLOCK(mt7988_clk_lock); + +static const char *const infra_mux_uart0_parents[] __initconst = { + "csw_infra_f26m_sel", "uart_sel" +}; + +static const char *const infra_mux_uart1_parents[] __initconst = { + "csw_infra_f26m_sel", "uart_sel" +}; + +static const char *const infra_mux_uart2_parents[] __initconst = { + "csw_infra_f26m_sel", "uart_sel" +}; + +static const char *const infra_mux_spi0_parents[] __initconst = { "i2c_sel", + "spi_sel" }; + +static const char *const infra_mux_spi1_parents[] __initconst = { + "i2c_sel", "spim_mst_sel" +}; + +static const char *const infra_pwm_bck_parents[] __initconst = { + "top_rtc_32p7k", "csw_infra_f26m_sel", "sysaxi_sel", "pwm_sel" +}; + +static const char *const infra_pcie_gfmux_tl_ck_o_p0_parents[] __initconst = { + "top_rtc_32p7k", "csw_infra_f26m_sel", "csw_infra_f26m_sel", + "pextp_tl_sel" +}; + +static const char *const infra_pcie_gfmux_tl_ck_o_p1_parents[] __initconst = { + "top_rtc_32p7k", "csw_infra_f26m_sel", "csw_infra_f26m_sel", + "pextp_tl_p1_sel" +}; + +static const char *const infra_pcie_gfmux_tl_ck_o_p2_parents[] __initconst = { + "top_rtc_32p7k", "csw_infra_f26m_sel", "csw_infra_f26m_sel", + "pextp_tl_p2_sel" +}; + +static const char *const infra_pcie_gfmux_tl_ck_o_p3_parents[] __initconst = { + "top_rtc_32p7k", "csw_infra_f26m_sel", "csw_infra_f26m_sel", + "pextp_tl_p3_sel" +}; + +static const struct mtk_mux infra_muxes[] = { + /* MODULE_CLK_SEL_0 */ + MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART0_SEL, "infra_mux_uart0_sel", + infra_mux_uart0_parents, 0x0018, 0x0010, 0x0014, + 0, 1, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART1_SEL, "infra_mux_uart1_sel", + infra_mux_uart1_parents, 0x0018, 0x0010, 0x0014, + 1, 1, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART2_SEL, "infra_mux_uart2_sel", + infra_mux_uart2_parents, 0x0018, 0x0010, 0x0014, + 2, 1, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_SPI0_SEL, "infra_mux_spi0_sel", + infra_mux_spi0_parents, 0x0018, 0x0010, 0x0014, 4, + 1, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_SPI1_SEL, "infra_mux_spi1_sel", + infra_mux_spi1_parents, 0x0018, 0x0010, 0x0014, 5, + 1, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_SPI2_SEL, "infra_mux_spi2_sel", + infra_mux_spi0_parents, 0x0018, 0x0010, 0x0014, 6, + 1, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_SEL, "infra_pwm_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 14, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK1_SEL, "infra_pwm_ck1_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 16, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK2_SEL, "infra_pwm_ck2_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 18, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK3_SEL, "infra_pwm_ck3_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 20, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK4_SEL, "infra_pwm_ck4_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 22, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK5_SEL, "infra_pwm_ck5_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 24, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK6_SEL, "infra_pwm_ck6_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 26, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK7_SEL, "infra_pwm_ck7_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 28, + 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_CK8_SEL, "infra_pwm_ck8_sel", + infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 30, + 2, -1, -1, -1), + /* MODULE_CLK_SEL_1 */ + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PCIE_GFMUX_TL_O_P0_SEL, + "infra_pcie_gfmux_tl_o_p0_sel", + infra_pcie_gfmux_tl_ck_o_p0_parents, 0x0028, + 0x0020, 0x0024, 0, 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PCIE_GFMUX_TL_O_P1_SEL, + "infra_pcie_gfmux_tl_o_p1_sel", + infra_pcie_gfmux_tl_ck_o_p1_parents, 0x0028, + 0x0020, 0x0024, 2, 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PCIE_GFMUX_TL_O_P2_SEL, + "infra_pcie_gfmux_tl_o_p2_sel", + infra_pcie_gfmux_tl_ck_o_p2_parents, 0x0028, + 0x0020, 0x0024, 4, 2, -1, -1, -1), + MUX_GATE_CLR_SET_UPD(CLK_INFRA_PCIE_GFMUX_TL_O_P3_SEL, + "infra_pcie_gfmux_tl_o_p3_sel", + infra_pcie_gfmux_tl_ck_o_p3_parents, 0x0028, + 0x0020, 0x0024, 6, 2, -1, -1, -1), +}; + +static const struct mtk_gate_regs infra0_cg_regs = { + .set_ofs = 0x10, + .clr_ofs = 0x14, + .sta_ofs = 0x18, +}; + +static const struct mtk_gate_regs infra1_cg_regs = { + .set_ofs = 0x40, + .clr_ofs = 0x44, + .sta_ofs = 0x48, +}; + +static const struct mtk_gate_regs infra2_cg_regs = { + .set_ofs = 0x50, + .clr_ofs = 0x54, + .sta_ofs = 0x58, +}; + +static const struct mtk_gate_regs infra3_cg_regs = { + .set_ofs = 0x60, + .clr_ofs = 0x64, + .sta_ofs = 0x68, +}; + +#define GATE_INFRA0_FLAGS(_id, _name, _parent, _shift, _flags) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = &infra0_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, .flags = _flags, \ + } + +#define GATE_INFRA1_FLAGS(_id, _name, _parent, _shift, _flags) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = &infra1_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, .flags = _flags, \ + } + +#define GATE_INFRA2_FLAGS(_id, _name, _parent, _shift, _flags) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = &infra2_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, .flags = _flags, \ + } + +#define GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, _flags) \ + { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = &infra3_cg_regs, .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, .flags = _flags, \ + } + +#define GATE_INFRA0(_id, _name, _parent, _shift) \ + GATE_INFRA0_FLAGS(_id, _name, _parent, _shift, 0) + +#define GATE_INFRA1(_id, _name, _parent, _shift) \ + GATE_INFRA1_FLAGS(_id, _name, _parent, _shift, 0) + +#define GATE_INFRA2(_id, _name, _parent, _shift) \ + GATE_INFRA2_FLAGS(_id, _name, _parent, _shift, 0) + +#define GATE_INFRA3(_id, _name, _parent, _shift) \ + GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, 0) + +static const struct mtk_gate infra_clks[] = { + /* INFRA0 */ + GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P0, + "infra_pcie_peri_ck_26m_ck_p0", "csw_infra_f26m_sel", 7), + GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P1, + "infra_pcie_peri_ck_26m_ck_p1", "csw_infra_f26m_sel", 8), + GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P2, + "infra_pcie_peri_ck_26m_ck_p2", "csw_infra_f26m_sel", 9), + GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P3, + "infra_pcie_peri_ck_26m_ck_p3", "csw_infra_f26m_sel", 10), + /* INFRA1 */ + GATE_INFRA1(CLK_INFRA_66M_GPT_BCK, "infra_hf_66m_gpt_bck", + "sysaxi_sel", 0), + GATE_INFRA1(CLK_INFRA_66M_PWM_HCK, "infra_hf_66m_pwm_hck", + "sysaxi_sel", 1), + GATE_INFRA1(CLK_INFRA_66M_PWM_BCK, "infra_hf_66m_pwm_bck", + "infra_pwm_sel", 2), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK1, "infra_hf_66m_pwm_ck1", + "infra_pwm_ck1_sel", 3), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK2, "infra_hf_66m_pwm_ck2", + "infra_pwm_ck2_sel", 4), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK3, "infra_hf_66m_pwm_ck3", + "infra_pwm_ck3_sel", 5), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK4, "infra_hf_66m_pwm_ck4", + "infra_pwm_ck4_sel", 6), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK5, "infra_hf_66m_pwm_ck5", + "infra_pwm_ck5_sel", 7), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK6, "infra_hf_66m_pwm_ck6", + "infra_pwm_ck6_sel", 8), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK7, "infra_hf_66m_pwm_ck7", + "infra_pwm_ck7_sel", 9), + GATE_INFRA1(CLK_INFRA_66M_PWM_CK8, "infra_hf_66m_pwm_ck8", + "infra_pwm_ck8_sel", 10), + GATE_INFRA1(CLK_INFRA_133M_CQDMA_BCK, "infra_hf_133m_cqdma_bck", + "sysaxi_sel", 12), + GATE_INFRA1(CLK_INFRA_66M_AUD_SLV_BCK, "infra_66m_aud_slv_bck", + "sysaxi_sel", 13), + GATE_INFRA1(CLK_INFRA_AUD_26M, "infra_f_faud_26m", + "csw_infra_f26m_sel", 14), + GATE_INFRA1(CLK_INFRA_AUD_L, "infra_f_faud_l", "aud_l_sel", 15), + GATE_INFRA1(CLK_INFRA_AUD_AUD, "infra_f_aud_aud", "a1sys_sel", 16), + GATE_INFRA1(CLK_INFRA_AUD_EG2, "infra_f_faud_eg2", "a_tuner_sel", 18), + GATE_INFRA1_FLAGS(CLK_INFRA_DRAMC_F26M, "infra_dramc_f26m", + "csw_infra_f26m_sel", 19, CLK_IS_CRITICAL), + // JTAG + GATE_INFRA1_FLAGS(CLK_INFRA_133M_DBG_ACKM, "infra_hf_133m_dbg_ackm", + "sysaxi_sel", 20, CLK_IS_CRITICAL), + GATE_INFRA1(CLK_INFRA_66M_AP_DMA_BCK, "infra_66m_ap_dma_bck", + "sysaxi_sel", 21), + GATE_INFRA1(CLK_INFRA_66M_SEJ_BCK, "infra_hf_66m_sej_bck", + "sysaxi_sel", 29), + GATE_INFRA1(CLK_INFRA_PRE_CK_SEJ_F13M, "infra_pre_ck_sej_f13m", + "csw_infra_f26m_sel", 30), + /* INFRA2 */ + GATE_INFRA2(CLK_INFRA_26M_THERM_SYSTEM, "infra_hf_26m_therm_system", + "csw_infra_f26m_sel", 0), + GATE_INFRA2(CLK_INFRA_I2C_BCK, "infra_i2c_bck", "i2c_sel", 1), + GATE_INFRA2(CLK_INFRA_52M_UART0_CK, "infra_f_52m_uart0", + "infra_mux_uart0_sel", 3), + GATE_INFRA2(CLK_INFRA_52M_UART1_CK, "infra_f_52m_uart1", + "infra_mux_uart1_sel", 4), + GATE_INFRA2(CLK_INFRA_52M_UART2_CK, "infra_f_52m_uart2", + "infra_mux_uart2_sel", 5), + GATE_INFRA2(CLK_INFRA_NFI, "infra_f_fnfi", "nfi1x_sel", 9), + GATE_INFRA2(CLK_INFRA_SPINFI, "infra_f_fspinfi", "spinfi_sel", 10), + GATE_INFRA2_FLAGS(CLK_INFRA_66M_NFI_HCK, "infra_hf_66m_nfi_hck", + "sysaxi_sel", 11, CLK_IS_CRITICAL), + GATE_INFRA2_FLAGS(CLK_INFRA_104M_SPI0, "infra_hf_104m_spi0", + "infra_mux_spi0_sel", 12, CLK_IS_CRITICAL), + GATE_INFRA2(CLK_INFRA_104M_SPI1, "infra_hf_104m_spi1", + "infra_mux_spi1_sel", 13), + GATE_INFRA2(CLK_INFRA_104M_SPI2_BCK, "infra_hf_104m_spi2_bck", + "infra_mux_spi2_sel", 14), + GATE_INFRA2_FLAGS(CLK_INFRA_66M_SPI0_HCK, "infra_hf_66m_spi0_hck", + "sysaxi_sel", 15, CLK_IS_CRITICAL), + GATE_INFRA2(CLK_INFRA_66M_SPI1_HCK, "infra_hf_66m_spi1_hck", + "sysaxi_sel", 16), + GATE_INFRA2(CLK_INFRA_66M_SPI2_HCK, "infra_hf_66m_spi2_hck", + "sysaxi_sel", 17), + GATE_INFRA2(CLK_INFRA_66M_FLASHIF_AXI, "infra_hf_66m_flashif_axi", + "sysaxi_sel", 18), + GATE_INFRA2(CLK_INFRA_RTC, "infra_f_frtc", "top_rtc_32k", 19), + GATE_INFRA2(CLK_INFRA_26M_ADC_BCK, "infra_f_26m_adc_bck", + "csw_infra_f26m_sel", 20), + GATE_INFRA2(CLK_INFRA_RC_ADC, "infra_f_frc_adc", "infra_f_26m_adc_bck", + 21), + GATE_INFRA2(CLK_INFRA_MSDC400, "infra_f_fmsdc400", "emmc_400m_sel", + 22), + GATE_INFRA2(CLK_INFRA_MSDC2_HCK, "infra_f_fmsdc2_hck", "emmc_250m_sel", + 23), + GATE_INFRA2(CLK_INFRA_133M_MSDC_0_HCK, "infra_hf_133m_msdc_0_hck", + "sysaxi_sel", 24), + GATE_INFRA2(CLK_INFRA_66M_MSDC_0_HCK, "infra_66m_msdc_0_hck", + "sysaxi_sel", 25), + GATE_INFRA2(CLK_INFRA_133M_CPUM_BCK, "infra_hf_133m_cpum_bck", + "sysaxi_sel", 26), + GATE_INFRA2(CLK_INFRA_BIST2FPC, "infra_hf_fbist2fpc", "nfi1x_sel", 27), + GATE_INFRA2(CLK_INFRA_I2C_X16W_MCK_CK_P1, + "infra_hf_i2c_x16w_mck_ck_p1", "sysaxi_sel", 29), + GATE_INFRA2(CLK_INFRA_I2C_X16W_PCK_CK_P1, + "infra_hf_i2c_x16w_pck_ck_p1", "sysaxi_sel", 31), + /* INFRA3 */ + GATE_INFRA3(CLK_INFRA_133M_USB_HCK, "infra_133m_usb_hck", "sysaxi_sel", + 0), + GATE_INFRA3(CLK_INFRA_133M_USB_HCK_CK_P1, "infra_133m_usb_hck_ck_p1", + "sysaxi_sel", 1), + GATE_INFRA3(CLK_INFRA_66M_USB_HCK, "infra_66m_usb_hck", "sysaxi_sel", + 2), + GATE_INFRA3(CLK_INFRA_66M_USB_HCK_CK_P1, "infra_66m_usb_hck_ck_p1", + "sysaxi_sel", 3), + GATE_INFRA3(CLK_INFRA_USB_SYS, "infra_usb_sys", "usb_sys_sel", 4), + GATE_INFRA3(CLK_INFRA_USB_SYS_CK_P1, "infra_usb_sys_ck_p1", + "usb_sys_p1_sel", 5), + GATE_INFRA3(CLK_INFRA_USB_REF, "infra_usb_ref", "top_xtal", 6), + GATE_INFRA3(CLK_INFRA_USB_CK_P1, "infra_usb_ck_p1", "top_xtal", 7), + GATE_INFRA3_FLAGS(CLK_INFRA_USB_FRMCNT, "infra_usb_frmcnt", + "usb_frmcnt_sel", 8, CLK_IS_CRITICAL), + GATE_INFRA3_FLAGS(CLK_INFRA_USB_FRMCNT_CK_P1, "infra_usb_frmcnt_ck_p1", + "usb_frmcnt_p1_sel", 9, CLK_IS_CRITICAL), + GATE_INFRA3(CLK_INFRA_USB_PIPE, "infra_usb_pipe", "sspxtp_sel", 10), + GATE_INFRA3(CLK_INFRA_USB_PIPE_CK_P1, "infra_usb_pipe_ck_p1", + "usb_phy_sel", 11), + GATE_INFRA3(CLK_INFRA_USB_UTMI, "infra_usb_utmi", "top_xtal", 12), + GATE_INFRA3(CLK_INFRA_USB_UTMI_CK_P1, "infra_usb_utmi_ck_p1", + "top_xtal", 13), + GATE_INFRA3(CLK_INFRA_USB_XHCI, "infra_usb_xhci", "usb_xhci_sel", 14), + GATE_INFRA3(CLK_INFRA_USB_XHCI_CK_P1, "infra_usb_xhci_ck_p1", + "usb_xhci_p1_sel", 15), + GATE_INFRA3(CLK_INFRA_PCIE_GFMUX_TL_P0, "infra_pcie_gfmux_tl_ck_p0", + "infra_pcie_gfmux_tl_o_p0_sel", 20), + GATE_INFRA3(CLK_INFRA_PCIE_GFMUX_TL_P1, "infra_pcie_gfmux_tl_ck_p1", + "infra_pcie_gfmux_tl_o_p1_sel", 21), + GATE_INFRA3(CLK_INFRA_PCIE_GFMUX_TL_P2, "infra_pcie_gfmux_tl_ck_p2", + "infra_pcie_gfmux_tl_o_p2_sel", 22), + GATE_INFRA3(CLK_INFRA_PCIE_GFMUX_TL_P3, "infra_pcie_gfmux_tl_ck_p3", + "infra_pcie_gfmux_tl_o_p3_sel", 23), + GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P0, "infra_pcie_pipe_ck_p0", + "top_xtal", 24), + GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P1, "infra_pcie_pipe_ck_p1", + "top_xtal", 25), + GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P2, "infra_pcie_pipe_ck_p2", + "top_xtal", 26), + GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P3, "infra_pcie_pipe_ck_p3", + "top_xtal", 27), + GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P0, "infra_133m_pcie_ck_p0", + "sysaxi_sel", 28), + GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P1, "infra_133m_pcie_ck_p1", + "sysaxi_sel", 29), + GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P2, "infra_133m_pcie_ck_p2", + "sysaxi_sel", 30), + GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P3, "infra_133m_pcie_ck_p3", + "sysaxi_sel", 31), +}; + +static int clk_mt7988_infracfg_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + void __iomem *base; + int nr = ARRAY_SIZE(infra_muxes) + ARRAY_SIZE(infra_clks); + + base = of_iomap(node, 0); + if (!base) { + pr_err("%s(): ioremap failed\n", __func__); + return -ENOMEM; + } + + clk_data = mtk_alloc_clk_data(nr); + + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_muxes(infra_muxes, ARRAY_SIZE(infra_muxes), node, + &mt7988_clk_lock, clk_data); + + mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks), + clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_infracfg_data; + } + return r; + +free_infracfg_data: + mtk_free_clk_data(clk_data); + return r; +} + +static const struct of_device_id of_match_clk_mt7988_infracfg[] = { + { + .compatible = "mediatek,mt7988-infracfg", + }, + {} +}; + +static struct platform_driver clk_mt7988_infracfg_drv = { + .probe = clk_mt7988_infracfg_probe, + .driver = { + .name = "clk-mt7988-infracfg", + .of_match_table = of_match_clk_mt7988_infracfg, + }, +}; +builtin_platform_driver(clk_mt7988_infracfg_drv); diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-topckgen.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-topckgen.c new file mode 100644 index 00000000000000..917302b6df682a --- /dev/null +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-topckgen.c @@ -0,0 +1,522 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Sam Shih + * Author: Xiufeng Li + */ + +#include +#include +#include +#include +#include +#include "clk-mtk.h" +#include "clk-gate.h" +#include "clk-mux.h" +#include + +static DEFINE_SPINLOCK(mt7988_clk_lock); + +static const struct mtk_fixed_clk top_fixed_clks[] = { + FIXED_CLK(CLK_TOP_XTAL, "top_xtal", "clkxtal", 40000000), +}; + +static const struct mtk_fixed_factor top_divs[] = { + FACTOR(CLK_TOP_XTAL_D2, "top_xtal_d2", "top_xtal", 1, 2), + FACTOR(CLK_TOP_RTC_32K, "top_rtc_32k", "top_xtal", 1, 1250), + FACTOR(CLK_TOP_RTC_32P7K, "top_rtc_32p7k", "top_xtal", 1, 1220), + FACTOR(CLK_TOP_MPLL_D2, "mpll_d2", "mpll", 1, 2), + FACTOR(CLK_TOP_MPLL_D3_D2, "mpll_d3_d2", "mpll", 1, 2), + FACTOR(CLK_TOP_MPLL_D4, "mpll_d4", "mpll", 1, 4), + FACTOR(CLK_TOP_MPLL_D8, "mpll_d8", "mpll", 1, 8), + FACTOR(CLK_TOP_MPLL_D8_D2, "mpll_d8_d2", "mpll", 1, 16), + FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2), + FACTOR(CLK_TOP_MMPLL_D3_D5, "mmpll_d3_d5", "mmpll", 1, 15), + FACTOR(CLK_TOP_MMPLL_D4, "mmpll_d4", "mmpll", 1, 4), + FACTOR(CLK_TOP_MMPLL_D6_D2, "mmpll_d6_d2", "mmpll", 1, 12), + FACTOR(CLK_TOP_MMPLL_D8, "mmpll_d8", "mmpll", 1, 8), + FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "apll2", 1, 4), + FACTOR(CLK_TOP_NET1PLL_D4, "net1pll_d4", "net1pll", 1, 4), + FACTOR(CLK_TOP_NET1PLL_D5, "net1pll_d5", "net1pll", 1, 5), + FACTOR(CLK_TOP_NET1PLL_D5_D2, "net1pll_d5_d2", "net1pll", 1, 10), + FACTOR(CLK_TOP_NET1PLL_D5_D4, "net1pll_d5_d4", "net1pll", 1, 20), + FACTOR(CLK_TOP_NET1PLL_D8, "net1pll_d8", "net1pll", 1, 8), + FACTOR(CLK_TOP_NET1PLL_D8_D2, "net1pll_d8_d2", "net1pll", 1, 16), + FACTOR(CLK_TOP_NET1PLL_D8_D4, "net1pll_d8_d4", "net1pll", 1, 32), + FACTOR(CLK_TOP_NET1PLL_D8_D8, "net1pll_d8_d8", "net1pll", 1, 64), + FACTOR(CLK_TOP_NET1PLL_D8_D16, "net1pll_d8_d16", "net1pll", 1, 128), + FACTOR(CLK_TOP_NET2PLL_D2, "net2pll_d2", "net2pll", 1, 2), + FACTOR(CLK_TOP_NET2PLL_D4, "net2pll_d4", "net2pll", 1, 4), + FACTOR(CLK_TOP_NET2PLL_D4_D4, "net2pll_d4_d4", "net2pll", 1, 16), + FACTOR(CLK_TOP_NET2PLL_D4_D8, "net2pll_d4_d8", "net2pll", 1, 32), + FACTOR(CLK_TOP_NET2PLL_D6, "net2pll_d6", "net2pll", 1, 6), + FACTOR(CLK_TOP_NET2PLL_D8, "net2pll_d8", "net2pll", 1, 8), +}; + +static const char *const netsys_parents[] = { "top_xtal", "net2pll_d2", + "mmpll_d2" }; + +static const char *const netsys_500m_parents[] = { "top_xtal", "net1pll_d5", + "net1pll_d5_d2" }; + +static const char *const netsys_2x_parents[] = { "top_xtal", "net2pll", + "mmpll" }; + +static const char *const netsys_gsw_parents[] = { "top_xtal", "net1pll_d4", + "net1pll_d5" }; + +static const char *const eth_gmii_parents[] = { "top_xtal", "net1pll_d5_d4" }; + +static const char *const netsys_mcu_parents[] = { "top_xtal", "net2pll", + "mmpll", "net1pll_d4", + "net1pll_d5", "mpll" }; + +static const char *const eip197_parents[] = { "top_xtal", "netsyspll", + "net2pll", "mmpll", + "net1pll_d4", "net1pll_d5" }; + +static const char *const axi_infra_parents[] = { "top_xtal", "net1pll_d8_d2" }; + +static const char *const uart_parents[] = { "top_xtal", "mpll_d8", + "mpll_d8_d2" }; + +static const char *const emmc_250m_parents[] = { "top_xtal", "net1pll_d5_d2", + "mmpll_d4" }; + +static const char *const emmc_400m_parents[] = { "top_xtal", "msdcpll", + "mmpll_d2", "mpll_d2", + "mmpll_d4", "net1pll_d8_d2" }; + +static const char *const spi_parents[] = { "top_xtal", "mpll_d2", + "mmpll_d4", "net1pll_d8_d2", + "net2pll_d6", "net1pll_d5_d4", + "mpll_d4", "net1pll_d8_d4" }; + +static const char *const nfi1x_parents[] = { "top_xtal", "mmpll_d4", + "net1pll_d8_d2", "net2pll_d6", + "mpll_d4", "mmpll_d8", + "net1pll_d8_d4", "mpll_d8" }; + +static const char *const spinfi_parents[] = { "top_xtal_d2", "top_xtal", + "net1pll_d5_d4", "mpll_d4", + "mmpll_d8", "net1pll_d8_d4", + "mmpll_d6_d2", "mpll_d8" }; + +static const char *const pwm_parents[] = { "top_xtal", "net1pll_d8_d2", + "net1pll_d5_d4", "mpll_d4", + "mpll_d8_d2", "top_rtc_32k" }; + +static const char *const i2c_parents[] = { "top_xtal", "net1pll_d5_d4", + "mpll_d4", "net1pll_d8_d4" }; + +static const char *const pcie_mbist_250m_parents[] = { "top_xtal", + "net1pll_d5_d2" }; + +static const char *const pextp_tl_ck_parents[] = { "top_xtal", "net2pll_d6", + "mmpll_d8", "mpll_d8_d2", + "top_rtc_32k" }; + +static const char *const usb_frmcnt_parents[] = { "top_xtal", "mmpll_d3_d5" }; + +static const char *const aud_parents[] = { "top_xtal", "apll2" }; + +static const char *const a1sys_parents[] = { "top_xtal", "apll2_d4" }; + +static const char *const aud_l_parents[] = { "top_xtal", "apll2", + "mpll_d8_d2" }; + +static const char *const sspxtp_parents[] = { "top_xtal_d2", "mpll_d8_d2" }; + +static const char *const usxgmii_sbus_0_parents[] = { "top_xtal", + "net1pll_d8_d4" }; + +static const char *const sgm_0_parents[] = { "top_xtal", "sgmpll" }; + +static const char *const sysapb_parents[] = { "top_xtal", "mpll_d3_d2" }; + +static const char *const eth_refck_50m_parents[] = { "top_xtal", + "net2pll_d4_d4" }; + +static const char *const eth_sys_200m_parents[] = { "top_xtal", "net2pll_d4" }; + +static const char *const eth_xgmii_parents[] = { "top_xtal_d2", + "net1pll_d8_d8", + "net1pll_d8_d16" }; + +static const char *const bus_tops_parents[] = { "top_xtal", "net1pll_d5", + "net2pll_d2" }; + +static const char *const npu_tops_parents[] = { "top_xtal", "net2pll" }; + +static const char *const dramc_md32_parents[] = { "top_xtal", "mpll_d2", + "wedmcupll" }; + +static const char *const da_xtp_glb_p0_parents[] = { "top_xtal", + "net2pll_d8" }; + +static const char *const mcusys_backup_625m_parents[] = { "top_xtal", + "net1pll_d4" }; + +static const char *const macsec_parents[] = { "top_xtal", "sgmpll", + "net1pll_d8" }; + +static const char *const netsys_tops_400m_parents[] = { "top_xtal", + "net2pll_d2" }; + +static const char *const eth_mii_parents[] = { "top_xtal_d2", + "net2pll_d4_d8" }; + +static const struct mtk_mux top_muxes[] = { + /* CLK_CFG_0 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_SEL, "netsys_sel", netsys_parents, + 0x000, 0x004, 0x008, 0, 2, 7, 0x1c0, 0), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_500M_SEL, "netsys_500m_sel", + netsys_500m_parents, 0x000, 0x004, 0x008, 8, 2, + 15, 0x1C0, 1), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_2X_SEL, "netsys_2x_sel", + netsys_2x_parents, 0x000, 0x004, 0x008, 16, 2, 23, + 0x1C0, 2), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_GSW_SEL, "netsys_gsw_sel", + netsys_gsw_parents, 0x000, 0x004, 0x008, 24, 2, + 31, 0x1C0, 3), + /* CLK_CFG_1 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_GMII_SEL, "eth_gmii_sel", + eth_gmii_parents, 0x010, 0x014, 0x018, 0, 1, 7, + 0x1C0, 4), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_MCU_SEL, "netsys_mcu_sel", + netsys_mcu_parents, 0x010, 0x014, 0x018, 8, 3, 15, + 0x1C0, 5), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_PAO_2X_SEL, "netsys_pao_2x_sel", + netsys_mcu_parents, 0x010, 0x014, 0x018, 16, 3, + 23, 0x1C0, 6), + MUX_GATE_CLR_SET_UPD(CLK_TOP_EIP197_SEL, "eip197_sel", eip197_parents, + 0x010, 0x014, 0x018, 24, 3, 31, 0x1c0, 7), + /* CLK_CFG_2 */ + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI_INFRA_SEL, "axi_infra_sel", + axi_infra_parents, 0x020, 0x024, 0x028, 0, + 1, 7, 0x1C0, 8, CLK_IS_CRITICAL), + MUX_GATE_CLR_SET_UPD(CLK_TOP_UART_SEL, "uart_sel", uart_parents, 0x020, + 0x024, 0x028, 8, 2, 15, 0x1c0, 9), + MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_250M_SEL, "emmc_250m_sel", + emmc_250m_parents, 0x020, 0x024, 0x028, 16, 2, 23, + 0x1C0, 10), + MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_400M_SEL, "emmc_400m_sel", + emmc_400m_parents, 0x020, 0x024, 0x028, 24, 3, 31, + 0x1C0, 11), + /* CLK_CFG_3 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x030, + 0x034, 0x038, 0, 3, 7, 0x1c0, 12), + MUX_GATE_CLR_SET_UPD(CLK_TOP_SPIM_MST_SEL, "spim_mst_sel", spi_parents, + 0x030, 0x034, 0x038, 8, 3, 15, 0x1c0, 13), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NFI1X_SEL, "nfi1x_sel", nfi1x_parents, + 0x030, 0x034, 0x038, 16, 3, 23, 0x1c0, 14), + MUX_GATE_CLR_SET_UPD(CLK_TOP_SPINFI_SEL, "spinfi_sel", spinfi_parents, + 0x030, 0x034, 0x038, 24, 3, 31, 0x1c0, 15), + /* CLK_CFG_4 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 0x040, + 0x044, 0x048, 0, 3, 7, 0x1c0, 16), + MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 0x040, + 0x044, 0x048, 8, 2, 15, 0x1c0, 17), + MUX_GATE_CLR_SET_UPD(CLK_TOP_PCIE_MBIST_250M_SEL, + "pcie_mbist_250m_sel", pcie_mbist_250m_parents, + 0x040, 0x044, 0x048, 16, 1, 23, 0x1C0, 18), + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_TL_SEL, "pextp_tl_sel", + pextp_tl_ck_parents, 0x040, 0x044, 0x048, 24, 3, + 31, 0x1C0, 19), + /* CLK_CFG_5 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_TL_P1_SEL, "pextp_tl_p1_sel", + pextp_tl_ck_parents, 0x050, 0x054, 0x058, 0, 3, 7, + 0x1C0, 20), + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_TL_P2_SEL, "pextp_tl_p2_sel", + pextp_tl_ck_parents, 0x050, 0x054, 0x058, 8, 3, + 15, 0x1C0, 21), + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_TL_P3_SEL, "pextp_tl_p3_sel", + pextp_tl_ck_parents, 0x050, 0x054, 0x058, 16, 3, + 23, 0x1C0, 22), + MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_SYS_SEL, "usb_sys_sel", + eth_gmii_parents, 0x050, 0x054, 0x058, 24, 1, 31, + 0x1C0, 23), + /* CLK_CFG_6 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_SYS_P1_SEL, "usb_sys_p1_sel", + eth_gmii_parents, 0x060, 0x064, 0x068, 0, 1, 7, + 0x1C0, 24), + MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_XHCI_SEL, "usb_xhci_sel", + eth_gmii_parents, 0x060, 0x064, 0x068, 8, 1, 15, + 0x1C0, 25), + MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_XHCI_P1_SEL, "usb_xhci_p1_sel", + eth_gmii_parents, 0x060, 0x064, 0x068, 16, 1, 23, + 0x1C0, 26), + MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_FRMCNT_SEL, "usb_frmcnt_sel", + usb_frmcnt_parents, 0x060, 0x064, 0x068, 24, 1, + 31, 0x1C0, 27), + /* CLK_CFG_7 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_FRMCNT_P1_SEL, "usb_frmcnt_p1_sel", + usb_frmcnt_parents, 0x070, 0x074, 0x078, 0, 1, 7, + 0x1C0, 28), + MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_SEL, "aud_sel", aud_parents, 0x070, + 0x074, 0x078, 8, 1, 15, 0x1c0, 29), + MUX_GATE_CLR_SET_UPD(CLK_TOP_A1SYS_SEL, "a1sys_sel", a1sys_parents, + 0x070, 0x074, 0x078, 16, 1, 23, 0x1c0, 30), + MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_L_SEL, "aud_l_sel", aud_l_parents, + 0x070, 0x074, 0x078, 24, 2, 31, 0x1c4, 0), + /* CLK_CFG_8 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_A_TUNER_SEL, "a_tuner_sel", a1sys_parents, + 0x080, 0x084, 0x088, 0, 1, 7, 0x1c4, 1), + MUX_GATE_CLR_SET_UPD(CLK_TOP_SSPXTP_SEL, "sspxtp_sel", sspxtp_parents, + 0x080, 0x084, 0x088, 8, 1, 15, 0x1c4, 2), + MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_PHY_SEL, "usb_phy_sel", + sspxtp_parents, 0x080, 0x084, 0x088, 16, 1, 23, + 0x1c4, 3), + MUX_GATE_CLR_SET_UPD(CLK_TOP_USXGMII_SBUS_0_SEL, "usxgmii_sbus_0_sel", + usxgmii_sbus_0_parents, 0x080, 0x084, 0x088, 24, + 1, 31, 0x1C4, 4), + /* CLK_CFG_9 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_USXGMII_SBUS_1_SEL, "usxgmii_sbus_1_sel", + usxgmii_sbus_0_parents, 0x090, 0x094, 0x098, 0, 1, + 7, 0x1C4, 5), + MUX_GATE_CLR_SET_UPD(CLK_TOP_SGM_0_SEL, "sgm_0_sel", sgm_0_parents, + 0x090, 0x094, 0x098, 8, 1, 15, 0x1c4, 6), + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SGM_SBUS_0_SEL, "sgm_sbus_0_sel", + usxgmii_sbus_0_parents, 0x090, 0x094, 0x098, + 16, 1, 23, 0x1C4, 7, CLK_IS_CRITICAL), + MUX_GATE_CLR_SET_UPD(CLK_TOP_SGM_1_SEL, "sgm_1_sel", sgm_0_parents, + 0x090, 0x094, 0x098, 24, 1, 31, 0x1c4, 8), + /* CLK_CFG_10 */ + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SGM_SBUS_1_SEL, "sgm_sbus_1_sel", + usxgmii_sbus_0_parents, 0x0a0, 0x0a4, 0x0a8, + 0, 1, 7, 0x1C4, 9, CLK_IS_CRITICAL), + MUX_GATE_CLR_SET_UPD(CLK_TOP_XFI_PHY_0_XTAL_SEL, "xfi_phy_0_xtal_sel", + sspxtp_parents, 0x0a0, 0x0a4, 0x0a8, 8, 1, 15, + 0x1C4, 10), + MUX_GATE_CLR_SET_UPD(CLK_TOP_XFI_PHY_1_XTAL_SEL, "xfi_phy_1_xtal_sel", + sspxtp_parents, 0x0a0, 0x0a4, 0x0a8, 16, 1, 23, + 0x1C4, 11), + /* CLK_CFG_11 */ + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SYSAXI_SEL, "sysaxi_sel", + axi_infra_parents, 0x0a0, 0x0a4, 0x0a8, 24, + 1, 31, 0x1C4, 12, CLK_IS_CRITICAL), + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SYSAPB_SEL, "sysapb_sel", + sysapb_parents, 0x0b0, 0x0b4, 0x0b8, 0, 1, + 7, 0x1c4, 13, CLK_IS_CRITICAL), + MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_REFCK_50M_SEL, "eth_refck_50m_sel", + eth_refck_50m_parents, 0x0b0, 0x0b4, 0x0b8, 8, 1, + 15, 0x1C4, 14), + MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_SYS_200M_SEL, "eth_sys_200m_sel", + eth_sys_200m_parents, 0x0b0, 0x0b4, 0x0b8, 16, 1, + 23, 0x1C4, 15), + MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_SYS_SEL, "eth_sys_sel", + pcie_mbist_250m_parents, 0x0b0, 0x0b4, 0x0b8, 24, + 1, 31, 0x1C4, 16), + /* CLK_CFG_12 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_XGMII_SEL, "eth_xgmii_sel", + eth_xgmii_parents, 0x0c0, 0x0c4, 0x0c8, 0, 2, 7, + 0x1C4, 17), + MUX_GATE_CLR_SET_UPD(CLK_TOP_BUS_TOPS_SEL, "bus_tops_sel", + bus_tops_parents, 0x0c0, 0x0c4, 0x0c8, 8, 2, 15, + 0x1C4, 18), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NPU_TOPS_SEL, "npu_tops_sel", + npu_tops_parents, 0x0c0, 0x0c4, 0x0c8, 16, 1, 23, + 0x1C4, 19), + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DRAMC_SEL, "dramc_sel", + sspxtp_parents, 0x0c0, 0x0c4, 0x0c8, 24, 1, + 31, 0x1C4, 20, CLK_IS_CRITICAL), + /* CLK_CFG_13 */ + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DRAMC_MD32_SEL, "dramc_md32_sel", + dramc_md32_parents, 0x0d0, 0x0d4, 0x0d8, 0, + 2, 7, 0x1C4, 21, CLK_IS_CRITICAL), + MUX_GATE_CLR_SET_UPD_FLAGS( + CLK_TOP_INFRA_F26M_SEL, "csw_infra_f26m_sel", sspxtp_parents, + 0x0d0, 0x0d4, 0x0d8, 8, 1, 15, 0x1C4, 22, CLK_IS_CRITICAL), + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_P0_SEL, "pextp_p0_sel", + sspxtp_parents, 0x0d0, 0x0d4, 0x0d8, 16, 1, 23, + 0x1C4, 23), + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_P1_SEL, "pextp_p1_sel", + sspxtp_parents, 0x0d0, 0x0d4, 0x0d8, 24, 1, 31, + 0x1C4, 24), + /* CLK_CFG_14 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_P2_SEL, "pextp_p2_sel", + sspxtp_parents, 0x0e0, 0x0e4, 0x0e8, 0, 1, 7, + 0x1C4, 25), + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_P3_SEL, "pextp_p3_sel", + sspxtp_parents, 0x0e0, 0x0e4, 0x0e8, 8, 1, 15, + 0x1C4, 26), + MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_XTP_GLB_P0_SEL, "da_xtp_glb_p0_sel", + da_xtp_glb_p0_parents, 0x0e0, 0x0e4, 0x0e8, 16, 1, + 23, 0x1C4, 27), + MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_XTP_GLB_P1_SEL, "da_xtp_glb_p1_sel", + da_xtp_glb_p0_parents, 0x0e0, 0x0e4, 0x0e8, 24, 1, + 31, 0x1C4, 28), + /* CLK_CFG_15 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_XTP_GLB_P2_SEL, "da_xtp_glb_p2_sel", + da_xtp_glb_p0_parents, 0x0f0, 0x0f4, 0x0f8, 0, 1, + 7, 0x1C4, 29), + MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_XTP_GLB_P3_SEL, "da_xtp_glb_p3_sel", + da_xtp_glb_p0_parents, 0x0f0, 0x0f4, 0x0f8, 8, 1, + 15, 0x1C4, 30), + MUX_GATE_CLR_SET_UPD(CLK_TOP_CKM_SEL, "ckm_sel", sspxtp_parents, 0x0F0, + 0x0f4, 0x0f8, 16, 1, 23, 0x1c8, 0), + MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_SEL, "da_sel", sspxtp_parents, 0x0f0, + 0x0f4, 0x0f8, 24, 1, 31, 0x1C8, 1), + /* CLK_CFG_16 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_SEL, "pextp_sel", sspxtp_parents, + 0x0100, 0x104, 0x108, 0, 1, 7, 0x1c8, 2), + MUX_GATE_CLR_SET_UPD(CLK_TOP_TOPS_P2_26M_SEL, "tops_p2_26m_sel", + sspxtp_parents, 0x0100, 0x104, 0x108, 8, 1, 15, + 0x1C8, 3), + MUX_GATE_CLR_SET_UPD(CLK_TOP_MCUSYS_BACKUP_625M_SEL, + "mcusys_backup_625m_sel", + mcusys_backup_625m_parents, 0x0100, 0x104, 0x108, + 16, 1, 23, 0x1C8, 4), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_SYNC_250M_SEL, + "netsys_sync_250m_sel", pcie_mbist_250m_parents, + 0x0100, 0x104, 0x108, 24, 1, 31, 0x1c8, 5), + /* CLK_CFG_17 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_MACSEC_SEL, "macsec_sel", macsec_parents, + 0x0110, 0x114, 0x118, 0, 2, 7, 0x1c8, 6), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_TOPS_400M_SEL, + "netsys_tops_400m_sel", netsys_tops_400m_parents, + 0x0110, 0x114, 0x118, 8, 1, 15, 0x1c8, 7), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_PPEFB_250M_SEL, + "netsys_ppefb_250m_sel", pcie_mbist_250m_parents, + 0x0110, 0x114, 0x118, 16, 1, 23, 0x1c8, 8), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_WARP_SEL, "netsys_warp_sel", + netsys_parents, 0x0110, 0x114, 0x118, 24, 2, 31, + 0x1C8, 9), + /* CLK_CFG_18 */ + MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_MII_SEL, "eth_mii_sel", + eth_mii_parents, 0x0120, 0x124, 0x128, 0, 1, 7, + 0x1c8, 10), + MUX_GATE_CLR_SET_UPD(CLK_TOP_NPU_SEL, "ck_npu_sel", netsys_2x_parents, + 0x0120, 0x124, 0x128, 8, 2, 15, 0x1c8, 11), +}; + +static const struct mtk_composite top_aud_divs[] = { + DIV_GATE(CLK_TOP_AUD_I2S_M, "aud_i2s_m", "aud_sel", 0x0420, 0, 0x0420, + 8, 8), +}; + +static int clk_mt7988_topckgen_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + void __iomem *base; + int nr = ARRAY_SIZE(top_fixed_clks) + ARRAY_SIZE(top_divs) + + ARRAY_SIZE(top_muxes) + ARRAY_SIZE(top_aud_divs); + + base = of_iomap(node, 0); + if (!base) { + pr_err("%s(): ioremap failed\n", __func__); + return -ENOMEM; + } + + clk_data = mtk_alloc_clk_data(nr); + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), + clk_data); + + mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); + + mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes), node, + &mt7988_clk_lock, clk_data); + + mtk_clk_register_composites(top_aud_divs, ARRAY_SIZE(top_aud_divs), + base, &mt7988_clk_lock, clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_topckgen_data; + } + return r; + +free_topckgen_data: + mtk_free_clk_data(clk_data); + return r; +} + +static const char *const mcu_bus_div_parents[] = { "top_xtal", "ccipll2_b", + "net1pll_d4" }; + +static const char *const mcu_arm_div_parents[] = { "top_xtal", "arm_b", + "net1pll_d4" }; + +static struct mtk_composite mcu_muxes[] = { + /* bus_pll_divider_cfg */ + MUX_GATE_FLAGS(CLK_MCU_BUS_DIV_SEL, "mcu_bus_div_sel", + mcu_bus_div_parents, 0x7C0, 9, 2, -1, CLK_IS_CRITICAL), + /* mp2_pll_divider_cfg */ + MUX_GATE_FLAGS(CLK_MCU_ARM_DIV_SEL, "mcu_arm_div_sel", + mcu_arm_div_parents, 0x7A8, 9, 2, -1, CLK_IS_CRITICAL), +}; + +static int clk_mt7988_mcusys_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + int r; + void __iomem *base; + int nr = ARRAY_SIZE(mcu_muxes); + + base = of_iomap(node, 0); + if (!base) { + pr_err("%s(): ioremap failed\n", __func__); + return -ENOMEM; + } + + clk_data = mtk_alloc_clk_data(nr); + if (!clk_data) + return -ENOMEM; + + mtk_clk_register_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), base, + &mt7988_clk_lock, clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + + if (r) { + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + goto free_mcusys_data; + } + return r; + +free_mcusys_data: + mtk_free_clk_data(clk_data); + return r; +} + +static const struct of_device_id of_match_clk_mt7988_topckgen[] = { + { + .compatible = "mediatek,mt7988-topckgen", + }, + {} +}; + +static struct platform_driver clk_mt7988_topckgen_drv = { + .probe = clk_mt7988_topckgen_probe, + .driver = { + .name = "clk-mt7988-topckgen", + .of_match_table = of_match_clk_mt7988_topckgen, + }, +}; +builtin_platform_driver(clk_mt7988_topckgen_drv); + +static const struct of_device_id of_match_clk_mt7988_mcusys[] = { + { + .compatible = "mediatek,mt7988-mcusys", + }, + {} +}; + +static struct platform_driver clk_mt7988_mcusys_drv = { + .probe = clk_mt7988_mcusys_probe, + .driver = { + .name = "clk-mt7988-mcusys", + .of_match_table = of_match_clk_mt7988_mcusys, + }, +}; +builtin_platform_driver(clk_mt7988_mcusys_drv); \ No newline at end of file diff --git a/target/linux/mediatek/files-5.15/include/dt-bindings/clock/mediatek,mt7988-clk.h b/target/linux/mediatek/files-5.15/include/dt-bindings/clock/mediatek,mt7988-clk.h new file mode 100644 index 00000000000000..77cfea4a8eaf6a --- /dev/null +++ b/target/linux/mediatek/files-5.15/include/dt-bindings/clock/mediatek,mt7988-clk.h @@ -0,0 +1,276 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Sam Shih + * Author: Xiufeng Li + */ + +#ifndef _DT_BINDINGS_CLK_MT7988_H +#define _DT_BINDINGS_CLK_MT7988_H + +/* APMIXEDSYS */ + +#define CLK_APMIXED_NETSYSPLL 0 +#define CLK_APMIXED_MPLL 1 +#define CLK_APMIXED_MMPLL 2 +#define CLK_APMIXED_APLL2 3 +#define CLK_APMIXED_NET1PLL 4 +#define CLK_APMIXED_NET2PLL 5 +#define CLK_APMIXED_WEDMCUPLL 6 +#define CLK_APMIXED_SGMPLL 7 +#define CLK_APMIXED_ARM_B 8 +#define CLK_APMIXED_CCIPLL2_B 9 +#define CLK_APMIXED_USXGMIIPLL 10 +#define CLK_APMIXED_MSDCPLL 11 + +/* TOPCKGEN */ + +#define CLK_TOP_XTAL 0 +#define CLK_TOP_XTAL_D2 1 +#define CLK_TOP_RTC_32K 2 +#define CLK_TOP_RTC_32P7K 3 +#define CLK_TOP_MPLL_D2 4 +#define CLK_TOP_MPLL_D3_D2 5 +#define CLK_TOP_MPLL_D4 6 +#define CLK_TOP_MPLL_D8 7 +#define CLK_TOP_MPLL_D8_D2 8 +#define CLK_TOP_MMPLL_D2 9 +#define CLK_TOP_MMPLL_D3_D5 10 +#define CLK_TOP_MMPLL_D4 11 +#define CLK_TOP_MMPLL_D6_D2 12 +#define CLK_TOP_MMPLL_D8 13 +#define CLK_TOP_APLL2_D4 14 +#define CLK_TOP_NET1PLL_D4 15 +#define CLK_TOP_NET1PLL_D5 16 +#define CLK_TOP_NET1PLL_D5_D2 17 +#define CLK_TOP_NET1PLL_D5_D4 18 +#define CLK_TOP_NET1PLL_D8 19 +#define CLK_TOP_NET1PLL_D8_D2 20 +#define CLK_TOP_NET1PLL_D8_D4 21 +#define CLK_TOP_NET1PLL_D8_D8 22 +#define CLK_TOP_NET1PLL_D8_D16 23 +#define CLK_TOP_NET2PLL_D2 24 +#define CLK_TOP_NET2PLL_D4 25 +#define CLK_TOP_NET2PLL_D4_D4 26 +#define CLK_TOP_NET2PLL_D4_D8 27 +#define CLK_TOP_NET2PLL_D6 28 +#define CLK_TOP_NET2PLL_D8 29 +#define CLK_TOP_NETSYS_SEL 30 +#define CLK_TOP_NETSYS_500M_SEL 31 +#define CLK_TOP_NETSYS_2X_SEL 32 +#define CLK_TOP_NETSYS_GSW_SEL 33 +#define CLK_TOP_ETH_GMII_SEL 34 +#define CLK_TOP_NETSYS_MCU_SEL 35 +#define CLK_TOP_NETSYS_PAO_2X_SEL 36 +#define CLK_TOP_EIP197_SEL 37 +#define CLK_TOP_AXI_INFRA_SEL 38 +#define CLK_TOP_UART_SEL 39 +#define CLK_TOP_EMMC_250M_SEL 40 +#define CLK_TOP_EMMC_400M_SEL 41 +#define CLK_TOP_SPI_SEL 42 +#define CLK_TOP_SPIM_MST_SEL 43 +#define CLK_TOP_NFI1X_SEL 44 +#define CLK_TOP_SPINFI_SEL 45 +#define CLK_TOP_PWM_SEL 46 +#define CLK_TOP_I2C_SEL 47 +#define CLK_TOP_PCIE_MBIST_250M_SEL 48 +#define CLK_TOP_PEXTP_TL_SEL 49 +#define CLK_TOP_PEXTP_TL_P1_SEL 50 +#define CLK_TOP_PEXTP_TL_P2_SEL 51 +#define CLK_TOP_PEXTP_TL_P3_SEL 52 +#define CLK_TOP_USB_SYS_SEL 53 +#define CLK_TOP_USB_SYS_P1_SEL 54 +#define CLK_TOP_USB_XHCI_SEL 55 +#define CLK_TOP_USB_XHCI_P1_SEL 56 +#define CLK_TOP_USB_FRMCNT_SEL 57 +#define CLK_TOP_USB_FRMCNT_P1_SEL 58 +#define CLK_TOP_AUD_SEL 59 +#define CLK_TOP_A1SYS_SEL 60 +#define CLK_TOP_AUD_L_SEL 61 +#define CLK_TOP_A_TUNER_SEL 62 +#define CLK_TOP_SSPXTP_SEL 63 +#define CLK_TOP_USB_PHY_SEL 64 +#define CLK_TOP_USXGMII_SBUS_0_SEL 65 +#define CLK_TOP_USXGMII_SBUS_1_SEL 66 +#define CLK_TOP_SGM_0_SEL 67 +#define CLK_TOP_SGM_SBUS_0_SEL 68 +#define CLK_TOP_SGM_1_SEL 69 +#define CLK_TOP_SGM_SBUS_1_SEL 70 +#define CLK_TOP_XFI_PHY_0_XTAL_SEL 71 +#define CLK_TOP_XFI_PHY_1_XTAL_SEL 72 +#define CLK_TOP_SYSAXI_SEL 73 +#define CLK_TOP_SYSAPB_SEL 74 +#define CLK_TOP_ETH_REFCK_50M_SEL 75 +#define CLK_TOP_ETH_SYS_200M_SEL 76 +#define CLK_TOP_ETH_SYS_SEL 77 +#define CLK_TOP_ETH_XGMII_SEL 78 +#define CLK_TOP_BUS_TOPS_SEL 79 +#define CLK_TOP_NPU_TOPS_SEL 80 +#define CLK_TOP_DRAMC_SEL 81 +#define CLK_TOP_DRAMC_MD32_SEL 82 +#define CLK_TOP_INFRA_F26M_SEL 83 +#define CLK_TOP_PEXTP_P0_SEL 84 +#define CLK_TOP_PEXTP_P1_SEL 85 +#define CLK_TOP_PEXTP_P2_SEL 86 +#define CLK_TOP_PEXTP_P3_SEL 87 +#define CLK_TOP_DA_XTP_GLB_P0_SEL 88 +#define CLK_TOP_DA_XTP_GLB_P1_SEL 89 +#define CLK_TOP_DA_XTP_GLB_P2_SEL 90 +#define CLK_TOP_DA_XTP_GLB_P3_SEL 91 +#define CLK_TOP_CKM_SEL 92 +#define CLK_TOP_DA_SEL 93 +#define CLK_TOP_PEXTP_SEL 94 +#define CLK_TOP_TOPS_P2_26M_SEL 95 +#define CLK_TOP_MCUSYS_BACKUP_625M_SEL 96 +#define CLK_TOP_NETSYS_SYNC_250M_SEL 97 +#define CLK_TOP_MACSEC_SEL 98 +#define CLK_TOP_NETSYS_TOPS_400M_SEL 99 +#define CLK_TOP_NETSYS_PPEFB_250M_SEL 100 +#define CLK_TOP_NETSYS_WARP_SEL 101 +#define CLK_TOP_ETH_MII_SEL 102 +#define CLK_TOP_NPU_SEL 103 +#define CLK_TOP_AUD_I2S_M 104 + +/* MCUSYS */ + +#define CLK_MCU_BUS_DIV_SEL 0 +#define CLK_MCU_ARM_DIV_SEL 1 + +/* INFRACFG_AO */ + +#define CLK_INFRA_MUX_UART0_SEL 0 +#define CLK_INFRA_MUX_UART1_SEL 1 +#define CLK_INFRA_MUX_UART2_SEL 2 +#define CLK_INFRA_MUX_SPI0_SEL 3 +#define CLK_INFRA_MUX_SPI1_SEL 4 +#define CLK_INFRA_MUX_SPI2_SEL 5 +#define CLK_INFRA_PWM_SEL 6 +#define CLK_INFRA_PWM_CK1_SEL 7 +#define CLK_INFRA_PWM_CK2_SEL 8 +#define CLK_INFRA_PWM_CK3_SEL 9 +#define CLK_INFRA_PWM_CK4_SEL 10 +#define CLK_INFRA_PWM_CK5_SEL 11 +#define CLK_INFRA_PWM_CK6_SEL 12 +#define CLK_INFRA_PWM_CK7_SEL 13 +#define CLK_INFRA_PWM_CK8_SEL 14 +#define CLK_INFRA_PCIE_GFMUX_TL_O_P0_SEL 15 +#define CLK_INFRA_PCIE_GFMUX_TL_O_P1_SEL 16 +#define CLK_INFRA_PCIE_GFMUX_TL_O_P2_SEL 17 +#define CLK_INFRA_PCIE_GFMUX_TL_O_P3_SEL 18 + +/* INFRACFG */ + +#define CLK_INFRA_PCIE_PERI_26M_CK_P0 19 +#define CLK_INFRA_PCIE_PERI_26M_CK_P1 20 +#define CLK_INFRA_PCIE_PERI_26M_CK_P2 21 +#define CLK_INFRA_PCIE_PERI_26M_CK_P3 22 +#define CLK_INFRA_66M_GPT_BCK 23 +#define CLK_INFRA_66M_PWM_HCK 24 +#define CLK_INFRA_66M_PWM_BCK 25 +#define CLK_INFRA_66M_PWM_CK1 26 +#define CLK_INFRA_66M_PWM_CK2 27 +#define CLK_INFRA_66M_PWM_CK3 28 +#define CLK_INFRA_66M_PWM_CK4 29 +#define CLK_INFRA_66M_PWM_CK5 30 +#define CLK_INFRA_66M_PWM_CK6 31 +#define CLK_INFRA_66M_PWM_CK7 32 +#define CLK_INFRA_66M_PWM_CK8 33 +#define CLK_INFRA_133M_CQDMA_BCK 34 +#define CLK_INFRA_66M_AUD_SLV_BCK 35 +#define CLK_INFRA_AUD_26M 36 +#define CLK_INFRA_AUD_L 37 +#define CLK_INFRA_AUD_AUD 38 +#define CLK_INFRA_AUD_EG2 39 +#define CLK_INFRA_DRAMC_F26M 40 +#define CLK_INFRA_133M_DBG_ACKM 41 +#define CLK_INFRA_66M_AP_DMA_BCK 42 +#define CLK_INFRA_66M_SEJ_BCK 43 +#define CLK_INFRA_PRE_CK_SEJ_F13M 44 +#define CLK_INFRA_26M_THERM_SYSTEM 45 +#define CLK_INFRA_I2C_BCK 46 +#define CLK_INFRA_52M_UART0_CK 47 +#define CLK_INFRA_52M_UART1_CK 48 +#define CLK_INFRA_52M_UART2_CK 49 +#define CLK_INFRA_NFI 50 +#define CLK_INFRA_SPINFI 51 +#define CLK_INFRA_66M_NFI_HCK 52 +#define CLK_INFRA_104M_SPI0 53 +#define CLK_INFRA_104M_SPI1 54 +#define CLK_INFRA_104M_SPI2_BCK 55 +#define CLK_INFRA_66M_SPI0_HCK 56 +#define CLK_INFRA_66M_SPI1_HCK 57 +#define CLK_INFRA_66M_SPI2_HCK 58 +#define CLK_INFRA_66M_FLASHIF_AXI 59 +#define CLK_INFRA_RTC 60 +#define CLK_INFRA_26M_ADC_BCK 61 +#define CLK_INFRA_RC_ADC 62 +#define CLK_INFRA_MSDC400 63 +#define CLK_INFRA_MSDC2_HCK 64 +#define CLK_INFRA_133M_MSDC_0_HCK 65 +#define CLK_INFRA_66M_MSDC_0_HCK 66 +#define CLK_INFRA_133M_CPUM_BCK 67 +#define CLK_INFRA_BIST2FPC 68 +#define CLK_INFRA_I2C_X16W_MCK_CK_P1 69 +#define CLK_INFRA_I2C_X16W_PCK_CK_P1 70 +#define CLK_INFRA_133M_USB_HCK 71 +#define CLK_INFRA_133M_USB_HCK_CK_P1 72 +#define CLK_INFRA_66M_USB_HCK 73 +#define CLK_INFRA_66M_USB_HCK_CK_P1 74 +#define CLK_INFRA_USB_SYS 75 +#define CLK_INFRA_USB_SYS_CK_P1 76 +#define CLK_INFRA_USB_REF 77 +#define CLK_INFRA_USB_CK_P1 78 +#define CLK_INFRA_USB_FRMCNT 79 +#define CLK_INFRA_USB_FRMCNT_CK_P1 80 +#define CLK_INFRA_USB_PIPE 81 +#define CLK_INFRA_USB_PIPE_CK_P1 82 +#define CLK_INFRA_USB_UTMI 83 +#define CLK_INFRA_USB_UTMI_CK_P1 84 +#define CLK_INFRA_USB_XHCI 85 +#define CLK_INFRA_USB_XHCI_CK_P1 86 +#define CLK_INFRA_PCIE_GFMUX_TL_P0 87 +#define CLK_INFRA_PCIE_GFMUX_TL_P1 88 +#define CLK_INFRA_PCIE_GFMUX_TL_P2 89 +#define CLK_INFRA_PCIE_GFMUX_TL_P3 90 +#define CLK_INFRA_PCIE_PIPE_P0 91 +#define CLK_INFRA_PCIE_PIPE_P1 92 +#define CLK_INFRA_PCIE_PIPE_P2 93 +#define CLK_INFRA_PCIE_PIPE_P3 94 +#define CLK_INFRA_133M_PCIE_CK_P0 95 +#define CLK_INFRA_133M_PCIE_CK_P1 96 +#define CLK_INFRA_133M_PCIE_CK_P2 97 +#define CLK_INFRA_133M_PCIE_CK_P3 98 + +/* ETHDMA */ + +#define CLK_ETHDMA_XGP1_EN 0 +#define CLK_ETHDMA_XGP2_EN 1 +#define CLK_ETHDMA_XGP3_EN 2 +#define CLK_ETHDMA_FE_EN 3 +#define CLK_ETHDMA_GP2_EN 4 +#define CLK_ETHDMA_GP1_EN 5 +#define CLK_ETHDMA_GP3_EN 6 +#define CLK_ETHDMA_ESW_EN 7 +#define CLK_ETHDMA_CRYPT0_EN 8 +#define CLK_ETHDMA_NR_CLK 9 + +/* SGMIISYS_0 */ + +#define CLK_SGM0_TX_EN 0 +#define CLK_SGM0_RX_EN 1 +#define CLK_SGMII0_NR_CLK 2 + +/* SGMIISYS_1 */ + +#define CLK_SGM1_TX_EN 0 +#define CLK_SGM1_RX_EN 1 +#define CLK_SGMII1_NR_CLK 2 + +/* ETHWARP */ + +#define CLK_ETHWARP_WOCPU2_EN 0 +#define CLK_ETHWARP_WOCPU1_EN 1 +#define CLK_ETHWARP_WOCPU0_EN 2 +#define CLK_ETHWARP_NR_CLK 3 + +#endif /* _DT_BINDINGS_CLK_MT7988_H */ diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 9df1494ca095d2..9f1c6f69395b5b 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -60,6 +60,7 @@ CONFIG_COMMON_CLK_MT7981=y CONFIG_COMMON_CLK_MT7981_ETHSYS=y CONFIG_COMMON_CLK_MT7986=y CONFIG_COMMON_CLK_MT7986_ETHSYS=y +CONFIG_COMMON_CLK_MT7988=y # CONFIG_COMMON_CLK_MT8173 is not set # CONFIG_COMMON_CLK_MT8183 is not set # CONFIG_COMMON_CLK_MT8516 is not set diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index ac09c8a9c47b4d..56e855c559032a 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -71,6 +71,7 @@ CONFIG_COMMON_CLK_MT7622_ETHSYS=y CONFIG_COMMON_CLK_MT7622_HIFSYS=y # CONFIG_COMMON_CLK_MT7981 is not set # CONFIG_COMMON_CLK_MT7986 is not set +# CONFIG_COMMON_CLK_MT7988 is not set # CONFIG_COMMON_CLK_MT8173 is not set # CONFIG_COMMON_CLK_MT8183 is not set # CONFIG_COMMON_CLK_MT8183_AUDIOSYS is not set diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index fb9588ee4f788e..77d20a3bdba3d7 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -71,6 +71,7 @@ CONFIG_COMMON_CLK_MT2701_VDECSYS=y # CONFIG_COMMON_CLK_MT7629 is not set # CONFIG_COMMON_CLK_MT7981 is not set # CONFIG_COMMON_CLK_MT7986 is not set +# CONFIG_COMMON_CLK_MT7988 is not set # CONFIG_COMMON_CLK_MT8135 is not set # CONFIG_COMMON_CLK_MT8173 is not set CONFIG_COMMON_CLK_MT8516=y diff --git a/target/linux/mediatek/mt7629/config-5.15 b/target/linux/mediatek/mt7629/config-5.15 index 709be00c74491d..46b444108bc572 100644 --- a/target/linux/mediatek/mt7629/config-5.15 +++ b/target/linux/mediatek/mt7629/config-5.15 @@ -53,6 +53,7 @@ CONFIG_COMMON_CLK_MT7629_ETHSYS=y CONFIG_COMMON_CLK_MT7629_HIFSYS=y # CONFIG_COMMON_CLK_MT7981 is not set # CONFIG_COMMON_CLK_MT7986 is not set +# CONFIG_COMMON_CLK_MT7988 is not set # CONFIG_COMMON_CLK_MT8135 is not set # CONFIG_COMMON_CLK_MT8173 is not set CONFIG_COMMON_CLK_MT8516=y diff --git a/target/linux/mediatek/patches-5.15/241-clk-mediatek-Add-pcw-chg-shift-control.patch b/target/linux/mediatek/patches-5.15/241-clk-mediatek-Add-pcw-chg-shift-control.patch new file mode 100644 index 00000000000000..23a5b7c911a5da --- /dev/null +++ b/target/linux/mediatek/patches-5.15/241-clk-mediatek-Add-pcw-chg-shift-control.patch @@ -0,0 +1,24 @@ +--- a/drivers/clk/mediatek/clk-mtk.h ++++ b/drivers/clk/mediatek/clk-mtk.h +@@ -233,6 +233,7 @@ struct mtk_pll_data { + u32 pcw_reg; + int pcw_shift; + u32 pcw_chg_reg; ++ int pcw_chg_shift; + const struct mtk_pll_div_table *div_table; + const char *parent_name; + u32 en_reg; +--- a/drivers/clk/mediatek/clk-pll.c ++++ b/drivers/clk/mediatek/clk-pll.c +@@ -137,7 +137,10 @@ static void mtk_pll_set_rate_regs(struct + pll->data->pcw_shift); + val |= pcw << pll->data->pcw_shift; + writel(val, pll->pcw_addr); +- chg = readl(pll->pcw_chg_addr) | PCW_CHG_MASK; ++ if (pll->data->pcw_chg_shift) ++ chg = readl(pll->pcw_chg_addr) | BIT(pll->data->pcw_chg_shift); ++ else ++ chg = readl(pll->pcw_chg_addr) | PCW_CHG_MASK; + writel(chg, pll->pcw_chg_addr); + if (pll->tuner_addr) + writel(val + 1, pll->tuner_addr); diff --git a/target/linux/mediatek/patches-5.15/242-clk-mediatek-add-mt7988-clock-support.patch b/target/linux/mediatek/patches-5.15/242-clk-mediatek-add-mt7988-clock-support.patch new file mode 100644 index 00000000000000..bf9146352a6154 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/242-clk-mediatek-add-mt7988-clock-support.patch @@ -0,0 +1,31 @@ +--- a/drivers/clk/mediatek/Kconfig ++++ b/drivers/clk/mediatek/Kconfig +@@ -378,6 +378,15 @@ config COMMON_CLK_MT7986_ETHSYS + This driver add support for clocks for Ethernet and SGMII + required on MediaTek MT7986 SoC. + ++config COMMON_CLK_MT7988 ++ bool "Clock driver for MediaTek MT7988" ++ depends on ARCH_MEDIATEK || COMPILE_TEST ++ select COMMON_CLK_MEDIATEK ++ default ARCH_MEDIATEK ++ help ++ This driver supports MediaTek MT7988 basic clocks and clocks ++ required for various periperals found on MediaTek. ++ + config COMMON_CLK_MT8135 + bool "Clock driver for MediaTek MT8135" + depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST +--- a/drivers/clk/mediatek/Makefile ++++ b/drivers/clk/mediatek/Makefile +@@ -54,6 +54,10 @@ obj-$(CONFIG_COMMON_CLK_MT7986) += clk-m + obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-topckgen.o + obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-infracfg.o + obj-$(CONFIG_COMMON_CLK_MT7986_ETHSYS) += clk-mt7986-eth.o ++obj-$(CONFIG_COMMON_CLK_MT7988) += clk-mt7988-apmixed.o ++obj-$(CONFIG_COMMON_CLK_MT7988) += clk-mt7988-topckgen.o ++obj-$(CONFIG_COMMON_CLK_MT7988) += clk-mt7988-infracfg.o ++obj-$(CONFIG_COMMON_CLK_MT7988) += clk-mt7988-eth.o + obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o + obj-$(CONFIG_COMMON_CLK_MT8167) += clk-mt8167.o + obj-$(CONFIG_COMMON_CLK_MT8167_AUDSYS) += clk-mt8167-aud.o From d5dc84f44eafc2d9c2d2621c43821d8d43cef9b1 Mon Sep 17 00:00:00 2001 From: Sam Shih Date: Sun, 19 Feb 2023 10:15:10 +0800 Subject: [PATCH 0026/1171] mediatek: add mt7988 pinctrl driver support This adds provisional pinctrl driver support for the MediaTek MT7988 SoC. Signed-off-by: Sam Shih Signed-off-by: Daniel Golle (cherry picked from commit 9e6a7e808f2e9dd02733ccc41827940fb421091d) --- .../drivers/pinctrl/mediatek/pinctrl-mt7988.c | 1281 +++++++++++++++++ target/linux/mediatek/filogic/config-5.15 | 1 + target/linux/mediatek/mt7622/config-5.15 | 1 + ...-mediatek-add-support-for-MT7988-SoC.patch | 26 + 4 files changed, 1309 insertions(+) create mode 100644 target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c create mode 100644 target/linux/mediatek/patches-5.15/240-pinctrl-mediatek-add-support-for-MT7988-SoC.patch diff --git a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c new file mode 100644 index 00000000000000..80a7e19f7a2d0d --- /dev/null +++ b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c @@ -0,0 +1,1281 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * The MT7988 driver based on Linux generic pinctrl binding. + * + * Copyright (C) 2020 MediaTek Inc. + * Author: Sam Shih + */ + +#include "pinctrl-moore.h" + +enum MT7988_PINCTRL_REG_PAGE { + GPIO_BASE, + IOCFG_TR_BASE, + IOCFG_BR_BASE, + IOCFG_RB_BASE, + IOCFG_LB_BASE, + IOCFG_TL_BASE, +}; + +#define MT7988_PIN(_number, _name) MTK_PIN(_number, _name, 0, _number, DRV_GRP4) + +#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ + _x_bits) \ + PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ + _x_bits, 32, 0) + +#define PINS_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ + _x_bits) \ + PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ + _x_bits, 32, 1) + +static const struct mtk_pin_field_calc mt7988_pin_mode_range[] = { + PIN_FIELD(0, 83, 0x300, 0x10, 0, 4), +}; + +static const struct mtk_pin_field_calc mt7988_pin_dir_range[] = { + PIN_FIELD(0, 83, 0x0, 0x10, 0, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_di_range[] = { + PIN_FIELD(0, 83, 0x200, 0x10, 0, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_do_range[] = { + PIN_FIELD(0, 83, 0x100, 0x10, 0, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_ies_range[] = { + PIN_FIELD_BASE(0, 1, 5, 0x30, 0x10, 13, 1), + PIN_FIELD_BASE(2, 3, 5, 0x30, 0x10, 11, 1), + PIN_FIELD_BASE(4, 4, 5, 0x30, 0x10, 0, 1), + PIN_FIELD_BASE(5, 6, 5, 0x30, 0x10, 9, 1), + PIN_FIELD_BASE(7, 7, 4, 0x30, 0x10, 8, 1), + PIN_FIELD_BASE(8, 8, 4, 0x30, 0x10, 6, 1), + PIN_FIELD_BASE(9, 9, 4, 0x30, 0x10, 5, 1), + PIN_FIELD_BASE(10, 10, 4, 0x30, 0x10, 3, 1), + PIN_FIELD_BASE(11, 11, 1, 0x40, 0x10, 0, 1), + PIN_FIELD_BASE(12, 12, 1, 0x40, 0x10, 21, 1), + PIN_FIELD_BASE(13, 14, 1, 0x40, 0x10, 1, 1), + PIN_FIELD_BASE(15, 16, 5, 0x30, 0x10, 7, 1), + PIN_FIELD_BASE(17, 18, 5, 0x30, 0x10, 3, 1), + PIN_FIELD_BASE(19, 19, 4, 0x30, 0x10, 7, 1), + PIN_FIELD_BASE(20, 20, 4, 0x30, 0x10, 4, 1), + PIN_FIELD_BASE(21, 21, 3, 0x50, 0x10, 17, 1), + PIN_FIELD_BASE(22, 22, 3, 0x50, 0x10, 23, 1), + PIN_FIELD_BASE(23, 23, 3, 0x50, 0x10, 20, 1), + PIN_FIELD_BASE(24, 24, 3, 0x50, 0x10, 19, 1), + PIN_FIELD_BASE(25, 26, 3, 0x50, 0x10, 21, 1), + PIN_FIELD_BASE(27, 27, 3, 0x50, 0x10, 18, 1), + PIN_FIELD_BASE(28, 30, 3, 0x50, 0x10, 25, 1), + PIN_FIELD_BASE(31, 31, 3, 0x50, 0x10, 24, 1), + PIN_FIELD_BASE(32, 32, 3, 0x50, 0x10, 28, 1), + PIN_FIELD_BASE(33, 33, 3, 0x60, 0x10, 0, 1), + PIN_FIELD_BASE(34, 34, 3, 0x50, 0x10, 31, 1), + PIN_FIELD_BASE(35, 36, 3, 0x50, 0x10, 29, 1), + PIN_FIELD_BASE(37, 37, 3, 0x60, 0x10, 1, 1), + PIN_FIELD_BASE(38, 38, 3, 0x50, 0x10, 11, 1), + PIN_FIELD_BASE(39, 39, 3, 0x50, 0x10, 10, 1), + PIN_FIELD_BASE(40, 41, 3, 0x50, 0x10, 0, 1), + PIN_FIELD_BASE(42, 42, 3, 0x50, 0x10, 9, 1), + PIN_FIELD_BASE(43, 43, 3, 0x50, 0x10, 8, 1), + PIN_FIELD_BASE(44, 44, 3, 0x50, 0x10, 7, 1), + PIN_FIELD_BASE(45, 45, 3, 0x50, 0x10, 6, 1), + PIN_FIELD_BASE(46, 46, 3, 0x50, 0x10, 5, 1), + PIN_FIELD_BASE(47, 47, 3, 0x50, 0x10, 4, 1), + PIN_FIELD_BASE(48, 48, 3, 0x50, 0x10, 3, 1), + PIN_FIELD_BASE(49, 49, 3, 0x50, 0x10, 2, 1), + PIN_FIELD_BASE(50, 50, 3, 0x50, 0x10, 15, 1), + PIN_FIELD_BASE(51, 53, 3, 0x50, 0x10, 12, 1), + PIN_FIELD_BASE(54, 54, 3, 0x50, 0x10, 16, 1), + PIN_FIELD_BASE(55, 56, 1, 0x40, 0x10, 14, 1), + PIN_FIELD_BASE(57, 57, 1, 0x40, 0x10, 13, 1), + PIN_FIELD_BASE(58, 60, 1, 0x40, 0x10, 4, 1), + PIN_FIELD_BASE(61, 61, 1, 0x40, 0x10, 3, 1), + PIN_FIELD_BASE(62, 62, 1, 0x40, 0x10, 7, 1), + PIN_FIELD_BASE(63, 63, 1, 0x40, 0x10, 20, 1), + PIN_FIELD_BASE(64, 68, 1, 0x40, 0x10, 8, 1), + PIN_FIELD_BASE(69, 70, 5, 0x30, 0x10, 1, 1), + PIN_FIELD_BASE(71, 72, 5, 0x30, 0x10, 5, 1), + PIN_FIELD_BASE(73, 73, 4, 0x30, 0x10, 10, 1), + PIN_FIELD_BASE(74, 74, 4, 0x30, 0x10, 1, 1), + PIN_FIELD_BASE(75, 75, 4, 0x30, 0x10, 11, 1), + PIN_FIELD_BASE(76, 76, 4, 0x30, 0x10, 9, 1), + PIN_FIELD_BASE(77, 77, 4, 0x30, 0x10, 2, 1), + PIN_FIELD_BASE(78, 78, 4, 0x30, 0x10, 0, 1), + PIN_FIELD_BASE(79, 79, 4, 0x30, 0x10, 12, 1), + PIN_FIELD_BASE(80, 81, 1, 0x40, 0x10, 18, 1), + PIN_FIELD_BASE(82, 83, 1, 0x40, 0x10, 16, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_smt_range[] = { + PIN_FIELD_BASE(0, 1, 5, 0xc0, 0x10, 13, 1), + PIN_FIELD_BASE(2, 3, 5, 0xc0, 0x10, 11, 1), + PIN_FIELD_BASE(4, 4, 5, 0xc0, 0x10, 0, 1), + PIN_FIELD_BASE(5, 6, 5, 0xc0, 0x10, 9, 1), + PIN_FIELD_BASE(7, 7, 4, 0xb0, 0x10, 8, 1), + PIN_FIELD_BASE(8, 8, 4, 0xb0, 0x10, 6, 1), + PIN_FIELD_BASE(9, 9, 4, 0xb0, 0x10, 5, 1), + PIN_FIELD_BASE(10, 10, 4, 0xb0, 0x10, 3, 1), + PIN_FIELD_BASE(11, 11, 1, 0xe0, 0x10, 0, 1), + PIN_FIELD_BASE(12, 12, 1, 0xe0, 0x10, 21, 1), + PIN_FIELD_BASE(13, 14, 1, 0xe0, 0x10, 1, 1), + PIN_FIELD_BASE(15, 16, 5, 0xc0, 0x10, 7, 1), + PIN_FIELD_BASE(17, 18, 5, 0xc0, 0x10, 3, 1), + PIN_FIELD_BASE(19, 19, 4, 0xb0, 0x10, 7, 1), + PIN_FIELD_BASE(20, 20, 4, 0xb0, 0x10, 4, 1), + PIN_FIELD_BASE(21, 21, 3, 0x140, 0x10, 17, 1), + PIN_FIELD_BASE(22, 22, 3, 0x140, 0x10, 23, 1), + PIN_FIELD_BASE(23, 23, 3, 0x140, 0x10, 20, 1), + PIN_FIELD_BASE(24, 24, 3, 0x140, 0x10, 19, 1), + PIN_FIELD_BASE(25, 26, 3, 0x140, 0x10, 21, 1), + PIN_FIELD_BASE(27, 27, 3, 0x140, 0x10, 18, 1), + PIN_FIELD_BASE(28, 30, 3, 0x140, 0x10, 25, 1), + PIN_FIELD_BASE(31, 31, 3, 0x140, 0x10, 24, 1), + PIN_FIELD_BASE(32, 32, 3, 0x140, 0x10, 28, 1), + PIN_FIELD_BASE(33, 33, 3, 0x150, 0x10, 0, 1), + PIN_FIELD_BASE(34, 34, 3, 0x140, 0x10, 31, 1), + PIN_FIELD_BASE(35, 36, 3, 0x140, 0x10, 29, 1), + PIN_FIELD_BASE(37, 37, 3, 0x150, 0x10, 1, 1), + PIN_FIELD_BASE(38, 38, 3, 0x140, 0x10, 11, 1), + PIN_FIELD_BASE(39, 39, 3, 0x140, 0x10, 10, 1), + PIN_FIELD_BASE(40, 41, 3, 0x140, 0x10, 0, 1), + PIN_FIELD_BASE(42, 42, 3, 0x140, 0x10, 9, 1), + PIN_FIELD_BASE(43, 43, 3, 0x140, 0x10, 8, 1), + PIN_FIELD_BASE(44, 44, 3, 0x140, 0x10, 7, 1), + PIN_FIELD_BASE(45, 45, 3, 0x140, 0x10, 6, 1), + PIN_FIELD_BASE(46, 46, 3, 0x140, 0x10, 5, 1), + PIN_FIELD_BASE(47, 47, 3, 0x140, 0x10, 4, 1), + PIN_FIELD_BASE(48, 48, 3, 0x140, 0x10, 3, 1), + PIN_FIELD_BASE(49, 49, 3, 0x140, 0x10, 2, 1), + PIN_FIELD_BASE(50, 50, 3, 0x140, 0x10, 15, 1), + PIN_FIELD_BASE(51, 53, 3, 0x140, 0x10, 12, 1), + PIN_FIELD_BASE(54, 54, 3, 0x140, 0x10, 16, 1), + PIN_FIELD_BASE(55, 56, 1, 0xe0, 0x10, 14, 1), + PIN_FIELD_BASE(57, 57, 1, 0xe0, 0x10, 13, 1), + PIN_FIELD_BASE(58, 60, 1, 0xe0, 0x10, 4, 1), + PIN_FIELD_BASE(61, 61, 1, 0xe0, 0x10, 3, 1), + PIN_FIELD_BASE(62, 62, 1, 0xe0, 0x10, 7, 1), + PIN_FIELD_BASE(63, 63, 1, 0xe0, 0x10, 20, 1), + PIN_FIELD_BASE(64, 68, 1, 0xe0, 0x10, 8, 1), + PIN_FIELD_BASE(69, 70, 5, 0xc0, 0x10, 1, 1), + PIN_FIELD_BASE(71, 72, 5, 0xc0, 0x10, 5, 1), + PIN_FIELD_BASE(73, 73, 4, 0xb0, 0x10, 10, 1), + PIN_FIELD_BASE(74, 74, 4, 0xb0, 0x10, 1, 1), + PIN_FIELD_BASE(75, 75, 4, 0xb0, 0x10, 11, 1), + PIN_FIELD_BASE(76, 76, 4, 0xb0, 0x10, 9, 1), + PIN_FIELD_BASE(77, 77, 4, 0xb0, 0x10, 2, 1), + PIN_FIELD_BASE(78, 78, 4, 0xb0, 0x10, 0, 1), + PIN_FIELD_BASE(79, 79, 4, 0xb0, 0x10, 12, 1), + PIN_FIELD_BASE(80, 81, 1, 0xe0, 0x10, 18, 1), + PIN_FIELD_BASE(82, 83, 1, 0xe0, 0x10, 16, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_pu_range[] = { + PIN_FIELD_BASE(7, 7, 4, 0x60, 0x10, 5, 1), + PIN_FIELD_BASE(8, 8, 4, 0x60, 0x10, 4, 1), + PIN_FIELD_BASE(9, 9, 4, 0x60, 0x10, 3, 1), + PIN_FIELD_BASE(10, 10, 4, 0x60, 0x10, 2, 1), + PIN_FIELD_BASE(13, 14, 1, 0x70, 0x10, 0, 1), + PIN_FIELD_BASE(63, 63, 1, 0x70, 0x10, 2, 1), + PIN_FIELD_BASE(75, 75, 4, 0x60, 0x10, 7, 1), + PIN_FIELD_BASE(76, 76, 4, 0x60, 0x10, 6, 1), + PIN_FIELD_BASE(77, 77, 4, 0x60, 0x10, 1, 1), + PIN_FIELD_BASE(78, 78, 4, 0x60, 0x10, 0, 1), + PIN_FIELD_BASE(79, 79, 4, 0x60, 0x10, 8, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_pd_range[] = { + PIN_FIELD_BASE(7, 7, 4, 0x40, 0x10, 5, 1), + PIN_FIELD_BASE(8, 8, 4, 0x40, 0x10, 4, 1), + PIN_FIELD_BASE(9, 9, 4, 0x40, 0x10, 3, 1), + PIN_FIELD_BASE(10, 10, 4, 0x40, 0x10, 2, 1), + PIN_FIELD_BASE(13, 14, 1, 0x50, 0x10, 0, 1), + PIN_FIELD_BASE(15, 16, 5, 0x40, 0x10, 4, 1), + PIN_FIELD_BASE(17, 18, 5, 0x40, 0x10, 0, 1), + PIN_FIELD_BASE(63, 63, 1, 0x50, 0x10, 2, 1), + PIN_FIELD_BASE(71, 72, 5, 0x40, 0x10, 2, 1), + PIN_FIELD_BASE(75, 75, 4, 0x40, 0x10, 7, 1), + PIN_FIELD_BASE(76, 76, 4, 0x40, 0x10, 6, 1), + PIN_FIELD_BASE(77, 77, 4, 0x40, 0x10, 1, 1), + PIN_FIELD_BASE(78, 78, 4, 0x40, 0x10, 0, 1), + PIN_FIELD_BASE(79, 79, 4, 0x40, 0x10, 8, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_drv_range[] = { + PIN_FIELD_BASE(0, 1, 5, 0x00, 0x10, 21, 3), + PIN_FIELD_BASE(2, 3, 5, 0x00, 0x10, 15, 3), + PIN_FIELD_BASE(4, 4, 5, 0x00, 0x10, 0, 3), + PIN_FIELD_BASE(5, 6, 5, 0x00, 0x10, 9, 3), + PIN_FIELD_BASE(7, 7, 4, 0x00, 0x10, 24, 3), + PIN_FIELD_BASE(8, 8, 4, 0x00, 0x10, 28, 3), + PIN_FIELD_BASE(9, 9, 4, 0x00, 0x10, 15, 3), + PIN_FIELD_BASE(10, 10, 4, 0x00, 0x10, 9, 3), + PIN_FIELD_BASE(11, 11, 1, 0x00, 0x10, 0, 3), + PIN_FIELD_BASE(12, 12, 1, 0x20, 0x10, 3, 3), + PIN_FIELD_BASE(13, 14, 1, 0x00, 0x10, 3, 3), + PIN_FIELD_BASE(19, 19, 4, 0x00, 0x10, 21, 3), + PIN_FIELD_BASE(20, 20, 4, 0x00, 0x10, 12, 3), + PIN_FIELD_BASE(21, 21, 3, 0x10, 0x10, 21, 3), + PIN_FIELD_BASE(22, 22, 3, 0x20, 0x10, 9, 3), + PIN_FIELD_BASE(23, 23, 3, 0x20, 0x10, 0, 3), + PIN_FIELD_BASE(24, 24, 3, 0x10, 0x10, 27, 3), + PIN_FIELD_BASE(25, 26, 3, 0x20, 0x10, 3, 3), + PIN_FIELD_BASE(27, 27, 3, 0x10, 0x10, 24, 3), + PIN_FIELD_BASE(28, 30, 3, 0x20, 0x10, 15, 3), + PIN_FIELD_BASE(31, 31, 3, 0x20, 0x10, 12, 3), + PIN_FIELD_BASE(32, 32, 3, 0x20, 0x10, 24, 3), + PIN_FIELD_BASE(33, 33, 3, 0x30, 0x10, 6, 3), + PIN_FIELD_BASE(34, 34, 3, 0x30, 0x10, 3, 3), + PIN_FIELD_BASE(35, 35, 3, 0x20, 0x10, 27, 3), + PIN_FIELD_BASE(36, 36, 3, 0x30, 0x10, 0, 3), + PIN_FIELD_BASE(37, 37, 3, 0x30, 0x10, 9, 3), + PIN_FIELD_BASE(38, 38, 3, 0x10, 0x10, 3, 3), + PIN_FIELD_BASE(39, 39, 3, 0x10, 0x10, 0, 3), + PIN_FIELD_BASE(40, 41, 3, 0x00, 0x10, 0, 3), + PIN_FIELD_BASE(42, 42, 3, 0x00, 0x10, 27, 3), + PIN_FIELD_BASE(43, 43, 3, 0x00, 0x10, 24, 3), + PIN_FIELD_BASE(44, 44, 3, 0x00, 0x10, 21, 3), + PIN_FIELD_BASE(45, 45, 3, 0x00, 0x10, 18, 3), + PIN_FIELD_BASE(46, 46, 3, 0x00, 0x10, 15, 3), + PIN_FIELD_BASE(47, 47, 3, 0x00, 0x10, 12, 3), + PIN_FIELD_BASE(48, 48, 3, 0x00, 0x10, 9, 3), + PIN_FIELD_BASE(49, 49, 3, 0x00, 0x10, 6, 3), + PIN_FIELD_BASE(50, 50, 3, 0x10, 0x10, 15, 3), + PIN_FIELD_BASE(51, 53, 3, 0x10, 0x10, 6, 3), + PIN_FIELD_BASE(54, 54, 3, 0x10, 0x10, 18, 3), + PIN_FIELD_BASE(55, 56, 1, 0x10, 0x10, 12, 3), + PIN_FIELD_BASE(57, 57, 1, 0x10, 0x10, 9, 3), + PIN_FIELD_BASE(58, 60, 1, 0x00, 0x10, 12, 3), + PIN_FIELD_BASE(61, 61, 1, 0x00, 0x10, 9, 3), + PIN_FIELD_BASE(62, 62, 1, 0x00, 0x10, 21, 3), + PIN_FIELD_BASE(63, 63, 1, 0x20, 0x10, 0, 3), + PIN_FIELD_BASE(64, 65, 1, 0x00, 0x10, 24, 3), + PIN_FIELD_BASE(66, 68, 1, 0x10, 0x10, 0, 3), + PIN_FIELD_BASE(69, 70, 5, 0x00, 0x10, 3, 3), + PIN_FIELD_BASE(73, 73, 4, 0x10, 0x10, 0, 3), + PIN_FIELD_BASE(74, 74, 4, 0x00, 0x10, 3, 3), + PIN_FIELD_BASE(75, 75, 4, 0x10, 0x10, 3, 3), + PIN_FIELD_BASE(76, 76, 4, 0x00, 0x10, 27, 3), + PIN_FIELD_BASE(77, 77, 4, 0x00, 0x10, 6, 3), + PIN_FIELD_BASE(78, 78, 4, 0x00, 0x10, 0, 3), + PIN_FIELD_BASE(79, 79, 4, 0x10, 0x10, 6, 3), + PIN_FIELD_BASE(80, 81, 1, 0x10, 0x10, 24, 3), + PIN_FIELD_BASE(82, 83, 1, 0x10, 0x10, 18, 3), +}; + +static const struct mtk_pin_field_calc mt7988_pin_pupd_range[] = { + PIN_FIELD_BASE(0, 1, 5, 0x50, 0x10, 7, 1), + PIN_FIELD_BASE(2, 3, 5, 0x50, 0x10, 5, 1), + PIN_FIELD_BASE(4, 4, 5, 0x50, 0x10, 0, 1), + PIN_FIELD_BASE(5, 6, 5, 0x50, 0x10, 3, 1), + PIN_FIELD_BASE(11, 11, 1, 0x60, 0x10, 0, 1), + PIN_FIELD_BASE(12, 12, 1, 0x60, 0x10, 18, 1), + PIN_FIELD_BASE(19, 19, 4, 0x50, 0x10, 2, 1), + PIN_FIELD_BASE(20, 20, 4, 0x50, 0x10, 1, 1), + PIN_FIELD_BASE(21, 21, 3, 0x70, 0x10, 17, 1), + PIN_FIELD_BASE(22, 22, 3, 0x70, 0x10, 23, 1), + PIN_FIELD_BASE(23, 23, 3, 0x70, 0x10, 20, 1), + PIN_FIELD_BASE(24, 24, 3, 0x70, 0x10, 19, 1), + PIN_FIELD_BASE(25, 26, 3, 0x70, 0x10, 21, 1), + PIN_FIELD_BASE(27, 27, 3, 0x70, 0x10, 18, 1), + PIN_FIELD_BASE(28, 30, 3, 0x70, 0x10, 25, 1), + PIN_FIELD_BASE(31, 31, 3, 0x70, 0x10, 24, 1), + PIN_FIELD_BASE(32, 32, 3, 0x70, 0x10, 28, 1), + PIN_FIELD_BASE(33, 33, 3, 0x80, 0x10, 0, 1), + PIN_FIELD_BASE(34, 34, 3, 0x70, 0x10, 31, 1), + PIN_FIELD_BASE(35, 36, 3, 0x70, 0x10, 29, 1), + PIN_FIELD_BASE(37, 37, 3, 0x80, 0x10, 1, 1), + PIN_FIELD_BASE(38, 38, 3, 0x70, 0x10, 11, 1), + PIN_FIELD_BASE(39, 39, 3, 0x70, 0x10, 10, 1), + PIN_FIELD_BASE(40, 41, 3, 0x70, 0x10, 0, 1), + PIN_FIELD_BASE(42, 42, 3, 0x70, 0x10, 9, 1), + PIN_FIELD_BASE(43, 43, 3, 0x70, 0x10, 8, 1), + PIN_FIELD_BASE(44, 44, 3, 0x70, 0x10, 7, 1), + PIN_FIELD_BASE(45, 45, 3, 0x70, 0x10, 6, 1), + PIN_FIELD_BASE(46, 46, 3, 0x70, 0x10, 5, 1), + PIN_FIELD_BASE(47, 47, 3, 0x70, 0x10, 4, 1), + PIN_FIELD_BASE(48, 48, 3, 0x70, 0x10, 3, 1), + PIN_FIELD_BASE(49, 49, 3, 0x70, 0x10, 2, 1), + PIN_FIELD_BASE(50, 50, 3, 0x70, 0x10, 15, 1), + PIN_FIELD_BASE(51, 53, 3, 0x70, 0x10, 12, 1), + PIN_FIELD_BASE(54, 54, 3, 0x70, 0x10, 16, 1), + PIN_FIELD_BASE(55, 56, 1, 0x60, 0x10, 12, 1), + PIN_FIELD_BASE(57, 57, 1, 0x60, 0x10, 11, 1), + PIN_FIELD_BASE(58, 60, 1, 0x60, 0x10, 2, 1), + PIN_FIELD_BASE(61, 61, 1, 0x60, 0x10, 1, 1), + PIN_FIELD_BASE(62, 62, 1, 0x60, 0x10, 5, 1), + PIN_FIELD_BASE(64, 68, 1, 0x60, 0x10, 6, 1), + PIN_FIELD_BASE(69, 70, 5, 0x50, 0x10, 1, 1), + PIN_FIELD_BASE(73, 73, 4, 0x50, 0x10, 3, 1), + PIN_FIELD_BASE(74, 74, 4, 0x50, 0x10, 0, 1), + PIN_FIELD_BASE(80, 81, 1, 0x60, 0x10, 16, 1), + PIN_FIELD_BASE(82, 83, 1, 0x60, 0x10, 14, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_r0_range[] = { + PIN_FIELD_BASE(0, 1, 5, 0x60, 0x10, 7, 1), + PIN_FIELD_BASE(2, 3, 5, 0x60, 0x10, 5, 1), + PIN_FIELD_BASE(4, 4, 5, 0x60, 0x10, 0, 1), + PIN_FIELD_BASE(5, 6, 5, 0x60, 0x10, 3, 1), + PIN_FIELD_BASE(11, 11, 1, 0x80, 0x10, 0, 1), + PIN_FIELD_BASE(12, 12, 1, 0x80, 0x10, 18, 1), + PIN_FIELD_BASE(19, 19, 4, 0x70, 0x10, 2, 1), + PIN_FIELD_BASE(20, 20, 4, 0x70, 0x10, 1, 1), + PIN_FIELD_BASE(21, 21, 3, 0x90, 0x10, 17, 1), + PIN_FIELD_BASE(22, 22, 3, 0x90, 0x10, 23, 1), + PIN_FIELD_BASE(23, 23, 3, 0x90, 0x10, 20, 1), + PIN_FIELD_BASE(24, 24, 3, 0x90, 0x10, 19, 1), + PIN_FIELD_BASE(25, 26, 3, 0x90, 0x10, 21, 1), + PIN_FIELD_BASE(27, 27, 3, 0x90, 0x10, 18, 1), + PIN_FIELD_BASE(28, 30, 3, 0x90, 0x10, 25, 1), + PIN_FIELD_BASE(31, 31, 3, 0x90, 0x10, 24, 1), + PIN_FIELD_BASE(32, 32, 3, 0x90, 0x10, 28, 1), + PIN_FIELD_BASE(33, 33, 3, 0xa0, 0x10, 0, 1), + PIN_FIELD_BASE(34, 34, 3, 0x90, 0x10, 31, 1), + PIN_FIELD_BASE(35, 36, 3, 0x90, 0x10, 29, 1), + PIN_FIELD_BASE(37, 37, 3, 0xa0, 0x10, 1, 1), + PIN_FIELD_BASE(38, 38, 3, 0x90, 0x10, 11, 1), + PIN_FIELD_BASE(39, 39, 3, 0x90, 0x10, 10, 1), + PIN_FIELD_BASE(40, 41, 3, 0x90, 0x10, 0, 1), + PIN_FIELD_BASE(42, 42, 3, 0x90, 0x10, 9, 1), + PIN_FIELD_BASE(43, 43, 3, 0x90, 0x10, 8, 1), + PIN_FIELD_BASE(44, 44, 3, 0x90, 0x10, 7, 1), + PIN_FIELD_BASE(45, 45, 3, 0x90, 0x10, 6, 1), + PIN_FIELD_BASE(46, 46, 3, 0x90, 0x10, 5, 1), + PIN_FIELD_BASE(47, 47, 3, 0x90, 0x10, 4, 1), + PIN_FIELD_BASE(48, 48, 3, 0x90, 0x10, 3, 1), + PIN_FIELD_BASE(49, 49, 3, 0x90, 0x10, 2, 1), + PIN_FIELD_BASE(50, 50, 3, 0x90, 0x10, 15, 1), + PIN_FIELD_BASE(51, 53, 3, 0x90, 0x10, 12, 1), + PIN_FIELD_BASE(54, 54, 3, 0x90, 0x10, 16, 1), + PIN_FIELD_BASE(55, 56, 1, 0x80, 0x10, 12, 1), + PIN_FIELD_BASE(57, 57, 1, 0x80, 0x10, 11, 1), + PIN_FIELD_BASE(58, 60, 1, 0x80, 0x10, 2, 1), + PIN_FIELD_BASE(61, 61, 1, 0x80, 0x10, 1, 1), + PIN_FIELD_BASE(62, 62, 1, 0x80, 0x10, 5, 1), + PIN_FIELD_BASE(64, 68, 1, 0x80, 0x10, 6, 1), + PIN_FIELD_BASE(69, 70, 5, 0x60, 0x10, 1, 1), + PIN_FIELD_BASE(73, 73, 4, 0x70, 0x10, 3, 1), + PIN_FIELD_BASE(74, 74, 4, 0x70, 0x10, 0, 1), + PIN_FIELD_BASE(80, 81, 1, 0x80, 0x10, 16, 1), + PIN_FIELD_BASE(82, 83, 1, 0x80, 0x10, 14, 1), +}; + +static const struct mtk_pin_field_calc mt7988_pin_r1_range[] = { + PIN_FIELD_BASE(0, 1, 5, 0x70, 0x10, 7, 1), + PIN_FIELD_BASE(2, 3, 5, 0x70, 0x10, 5, 1), + PIN_FIELD_BASE(4, 4, 5, 0x70, 0x10, 0, 1), + PIN_FIELD_BASE(5, 6, 5, 0x70, 0x10, 3, 1), + PIN_FIELD_BASE(11, 11, 1, 0x90, 0x10, 0, 1), + PIN_FIELD_BASE(12, 12, 1, 0x90, 0x10, 18, 1), + PIN_FIELD_BASE(19, 19, 4, 0x80, 0x10, 2, 1), + PIN_FIELD_BASE(20, 20, 4, 0x80, 0x10, 1, 1), + PIN_FIELD_BASE(21, 21, 3, 0xb0, 0x10, 17, 1), + PIN_FIELD_BASE(22, 22, 3, 0xb0, 0x10, 23, 1), + PIN_FIELD_BASE(23, 23, 3, 0xb0, 0x10, 20, 1), + PIN_FIELD_BASE(24, 24, 3, 0xb0, 0x10, 19, 1), + PIN_FIELD_BASE(25, 26, 3, 0xb0, 0x10, 21, 1), + PIN_FIELD_BASE(27, 27, 3, 0xb0, 0x10, 18, 1), + PIN_FIELD_BASE(28, 30, 3, 0xb0, 0x10, 25, 1), + PIN_FIELD_BASE(31, 31, 3, 0xb0, 0x10, 24, 1), + PIN_FIELD_BASE(32, 32, 3, 0xb0, 0x10, 28, 1), + PIN_FIELD_BASE(33, 33, 3, 0xc0, 0x10, 0, 1), + PIN_FIELD_BASE(34, 34, 3, 0xb0, 0x10, 31, 1), + PIN_FIELD_BASE(35, 36, 3, 0xb0, 0x10, 29, 1), + PIN_FIELD_BASE(37, 37, 3, 0xc0, 0x10, 1, 1), + PIN_FIELD_BASE(38, 38, 3, 0xb0, 0x10, 11, 1), + PIN_FIELD_BASE(39, 39, 3, 0xb0, 0x10, 10, 1), + PIN_FIELD_BASE(40, 41, 3, 0xb0, 0x10, 0, 1), + PIN_FIELD_BASE(42, 42, 3, 0xb0, 0x10, 9, 1), + PIN_FIELD_BASE(43, 43, 3, 0xb0, 0x10, 8, 1), + PIN_FIELD_BASE(44, 44, 3, 0xb0, 0x10, 7, 1), + PIN_FIELD_BASE(45, 45, 3, 0xb0, 0x10, 6, 1), + PIN_FIELD_BASE(46, 46, 3, 0xb0, 0x10, 5, 1), + PIN_FIELD_BASE(47, 47, 3, 0xb0, 0x10, 4, 1), + PIN_FIELD_BASE(48, 48, 3, 0xb0, 0x10, 3, 1), + PIN_FIELD_BASE(49, 49, 3, 0xb0, 0x10, 2, 1), + PIN_FIELD_BASE(50, 50, 3, 0xb0, 0x10, 15, 1), + PIN_FIELD_BASE(51, 53, 3, 0xb0, 0x10, 12, 1), + PIN_FIELD_BASE(54, 54, 3, 0xb0, 0x10, 16, 1), + PIN_FIELD_BASE(55, 56, 1, 0x90, 0x10, 12, 1), + PIN_FIELD_BASE(57, 57, 1, 0x90, 0x10, 11, 1), + PIN_FIELD_BASE(58, 60, 1, 0x90, 0x10, 2, 1), + PIN_FIELD_BASE(61, 61, 1, 0x90, 0x10, 1, 1), + PIN_FIELD_BASE(62, 62, 1, 0x90, 0x10, 5, 1), + PIN_FIELD_BASE(64, 68, 1, 0x90, 0x10, 6, 1), + PIN_FIELD_BASE(69, 70, 5, 0x70, 0x10, 1, 1), + PIN_FIELD_BASE(73, 73, 4, 0x80, 0x10, 3, 1), + PIN_FIELD_BASE(74, 74, 4, 0x80, 0x10, 0, 1), + PIN_FIELD_BASE(80, 81, 1, 0x90, 0x10, 16, 1), + PIN_FIELD_BASE(82, 83, 1, 0x90, 0x10, 14, 1), +}; + +static const struct mtk_pin_reg_calc mt7988_reg_cals[] = { + [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7988_pin_mode_range), + [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7988_pin_dir_range), + [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7988_pin_di_range), + [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7988_pin_do_range), + [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7988_pin_smt_range), + [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt7988_pin_ies_range), + [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt7988_pin_pu_range), + [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt7988_pin_pd_range), + [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7988_pin_drv_range), + [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt7988_pin_pupd_range), + [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt7988_pin_r0_range), + [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt7988_pin_r1_range), +}; + +static const struct mtk_pin_desc mt7988_pins[] = { + MT7988_PIN(0, "UART2_RXD"), + MT7988_PIN(1, "UART2_TXD"), + MT7988_PIN(2, "UART2_CTS"), + MT7988_PIN(3, "UART2_RTS"), + MT7988_PIN(4, "GPIO_A"), + MT7988_PIN(5, "SMI_0_MDC"), + MT7988_PIN(6, "SMI_0_MDIO"), + MT7988_PIN(7, "PCIE30_2L_0_WAKE_N"), + MT7988_PIN(8, "PCIE30_2L_0_CLKREQ_N"), + MT7988_PIN(9, "PCIE30_1L_1_WAKE_N"), + MT7988_PIN(10, "PCIE30_1L_1_CLKREQ_N"), + MT7988_PIN(11, "GPIO_P"), + MT7988_PIN(12, "WATCHDOG"), + MT7988_PIN(13, "GPIO_RESET"), + MT7988_PIN(14, "GPIO_WPS"), + MT7988_PIN(15, "PMIC_I2C_SCL"), + MT7988_PIN(16, "PMIC_I2C_SDA"), + MT7988_PIN(17, "I2C_1_SCL"), + MT7988_PIN(18, "I2C_1_SDA"), + MT7988_PIN(19, "PCIE30_2L_0_PRESET_N"), + MT7988_PIN(20, "PCIE30_1L_1_PRESET_N"), + MT7988_PIN(21, "PWMD1"), + MT7988_PIN(22, "SPI0_WP"), + MT7988_PIN(23, "SPI0_HOLD"), + MT7988_PIN(24, "SPI0_CSB"), + MT7988_PIN(25, "SPI0_MISO"), + MT7988_PIN(26, "SPI0_MOSI"), + MT7988_PIN(27, "SPI0_CLK"), + MT7988_PIN(28, "SPI1_CSB"), + MT7988_PIN(29, "SPI1_MISO"), + MT7988_PIN(30, "SPI1_MOSI"), + MT7988_PIN(31, "SPI1_CLK"), + MT7988_PIN(32, "SPI2_CLK"), + MT7988_PIN(33, "SPI2_MOSI"), + MT7988_PIN(34, "SPI2_MISO"), + MT7988_PIN(35, "SPI2_CSB"), + MT7988_PIN(36, "SPI2_HOLD"), + MT7988_PIN(37, "SPI2_WP"), + MT7988_PIN(38, "EMMC_RSTB"), + MT7988_PIN(39, "EMMC_DSL"), + MT7988_PIN(40, "EMMC_CK"), + MT7988_PIN(41, "EMMC_CMD"), + MT7988_PIN(42, "EMMC_DATA_7"), + MT7988_PIN(43, "EMMC_DATA_6"), + MT7988_PIN(44, "EMMC_DATA_5"), + MT7988_PIN(45, "EMMC_DATA_4"), + MT7988_PIN(46, "EMMC_DATA_3"), + MT7988_PIN(47, "EMMC_DATA_2"), + MT7988_PIN(48, "EMMC_DATA_1"), + MT7988_PIN(49, "EMMC_DATA_0"), + MT7988_PIN(50, "PCM_FS_I2S_LRCK"), + MT7988_PIN(51, "PCM_CLK_I2S_BCLK"), + MT7988_PIN(52, "PCM_DRX_I2S_DIN"), + MT7988_PIN(53, "PCM_DTX_I2S_DOUT"), + MT7988_PIN(54, "PCM_MCK_I2S_MCLK"), + MT7988_PIN(55, "UART0_RXD"), + MT7988_PIN(56, "UART0_TXD"), + MT7988_PIN(57, "PWMD0"), + MT7988_PIN(58, "JTAG_JTDI"), + MT7988_PIN(59, "JTAG_JTDO"), + MT7988_PIN(60, "JTAG_JTMS"), + MT7988_PIN(61, "JTAG_JTCLK"), + MT7988_PIN(62, "JTAG_JTRST_N"), + MT7988_PIN(63, "USB_DRV_VBUS_P1"), + MT7988_PIN(64, "LED_A"), + MT7988_PIN(65, "LED_B"), + MT7988_PIN(66, "LED_C"), + MT7988_PIN(67, "LED_D"), + MT7988_PIN(68, "LED_E"), + MT7988_PIN(69, "GPIO_B"), + MT7988_PIN(70, "GPIO_C"), + MT7988_PIN(71, "I2C_2_SCL"), + MT7988_PIN(72, "I2C_2_SDA"), + MT7988_PIN(73, "PCIE30_2L_1_PRESET_N"), + MT7988_PIN(74, "PCIE30_1L_0_PRESET_N"), + MT7988_PIN(75, "PCIE30_2L_1_WAKE_N"), + MT7988_PIN(76, "PCIE30_2L_1_CLKREQ_N"), + MT7988_PIN(77, "PCIE30_1L_0_WAKE_N"), + MT7988_PIN(78, "PCIE30_1L_0_CLKREQ_N"), + MT7988_PIN(79, "USB_DRV_VBUS_P0"), + MT7988_PIN(80, "UART1_RXD"), + MT7988_PIN(81, "UART1_TXD"), + MT7988_PIN(82, "UART1_CTS"), + MT7988_PIN(83, "UART1_RTS"), +}; + +/* jtag */ +static int mt7988_tops_jtag0_0_pins[] = { 0, 1, 2, 3, 4 }; +static int mt7988_tops_jtag0_0_funcs[] = { 2, 2, 2, 2, 2 }; + +static int mt7988_wo0_jtag_pins[] = { 50, 51, 52, 53, 54 }; +static int mt7988_wo0_jtag_funcs[] = { 3, 3, 3, 3, 3 }; + +static int mt7988_wo1_jtag_pins[] = { 50, 51, 52, 53, 54 }; +static int mt7988_wo1_jtag_funcs[] = { 4, 4, 4, 4, 4 }; + +static int mt7988_wo2_jtag_pins[] = { 50, 51, 52, 53, 54 }; +static int mt7988_wo2_jtag_funcs[] = { 5, 5, 5, 5, 5 }; + +static int mt7988_jtag_pins[] = { 58, 59, 60, 61, 62 }; +static int mt7988_jtag_funcs[] = { 1, 1, 1, 1, 1 }; + +static int mt7988_tops_jtag0_1_pins[] = { 58, 59, 60, 61, 62 }; +static int mt7988_tops_jtag0_1_funcs[] = { 4, 4, 4, 4, 4 }; + +/* int_usxgmii */ +static int mt7988_int_usxgmii_pins[] = { 2, 3 }; +static int mt7988_int_usxgmii_funcs[] = { 3, 3 }; + +/* pwm */ +static int mt7988_pwm0_pins[] = { 57 }; +static int mt7988_pwm0_funcs[] = { 1 }; + +static int mt7988_pwm1_pins[] = { 21 }; +static int mt7988_pwm1_funcs[] = { 1 }; + +static int mt7988_pwm2_pins[] = { 80 }; +static int mt7988_pwm2_funcs[] = { 2 }; + +static int mt7988_pwm3_pins[] = { 81 }; +static int mt7988_pwm3_funcs[] = { 2 }; + +static int mt7988_pwm4_pins[] = { 82 }; +static int mt7988_pwm4_funcs[] = { 2 }; + +static int mt7988_pwm5_pins[] = { 83 }; +static int mt7988_pwm5_funcs[] = { 2 }; + +static int mt7988_pwm6_pins[] = { 69 }; +static int mt7988_pwm6_funcs[] = { 3 }; + +static int mt7988_pwm7_pins[] = { 70 }; +static int mt7988_pwm7_funcs[] = { 3 }; + +/* dfd */ +static int mt7988_dfd_pins[] = { 0, 1, 2, 3, 4 }; +static int mt7988_dfd_funcs[] = { 4, 4, 4, 4, 4 }; + +/* i2c */ +static int mt7988_xfi_phy0_i2c0_pins[] = { 0, 1 }; +static int mt7988_xfi_phy0_i2c0_funcs[] = { 5, 5 }; + +static int mt7988_xfi_phy1_i2c0_pins[] = { 0, 1 }; +static int mt7988_xfi_phy1_i2c0_funcs[] = { 6, 6 }; + +static int mt7988_xfi_phy_pll_i2c0_pins[] = { 3, 4 }; +static int mt7988_xfi_phy_pll_i2c0_funcs[] = { 5, 5 }; + +static int mt7988_xfi_phy_pll_i2c1_pins[] = { 3, 4 }; +static int mt7988_xfi_phy_pll_i2c1_funcs[] = { 6, 6 }; + +static int mt7988_i2c0_0_pins[] = { 5, 6 }; +static int mt7988_i2c0_0_funcs[] = { 2, 2 }; + +static int mt7988_i2c1_sfp_pins[] = { 5, 6 }; +static int mt7988_i2c1_sfp_funcs[] = { 4, 4 }; + +static int mt7988_xfi_pextp_phy0_i2c_pins[] = { 5, 6 }; +static int mt7988_xfi_pextp_phy0_i2c_funcs[] = { 5, 5 }; + +static int mt7988_xfi_pextp_phy1_i2c_pins[] = { 5, 6 }; +static int mt7988_xfi_pextp_phy1_i2c_funcs[] = { 6, 6 }; + +static int mt7988_i2c0_1_pins[] = { 15, 16 }; +static int mt7988_i2c0_1_funcs[] = { 1, 1 }; + +static int mt7988_u30_phy_i2c0_pins[] = { 15, 16 }; +static int mt7988_u30_phy_i2c0_funcs[] = { 2, 2 }; + +static int mt7988_u32_phy_i2c0_pins[] = { 15, 16 }; +static int mt7988_u32_phy_i2c0_funcs[] = { 3, 3 }; + +static int mt7988_xfi_phy0_i2c1_pins[] = { 15, 16 }; +static int mt7988_xfi_phy0_i2c1_funcs[] = { 5, 5 }; + +static int mt7988_xfi_phy1_i2c1_pins[] = { 15, 16 }; +static int mt7988_xfi_phy1_i2c1_funcs[] = { 6, 6 }; + +static int mt7988_xfi_phy_pll_i2c2_pins[] = { 15, 16 }; +static int mt7988_xfi_phy_pll_i2c2_funcs[] = { 7, 7 }; + +static int mt7988_i2c1_0_pins[] = { 17, 18 }; +static int mt7988_i2c1_0_funcs[] = { 1, 1 }; + +static int mt7988_u30_phy_i2c1_pins[] = { 17, 18 }; +static int mt7988_u30_phy_i2c1_funcs[] = { 2, 2 }; + +static int mt7988_u32_phy_i2c1_pins[] = { 17, 18 }; +static int mt7988_u32_phy_i2c1_funcs[] = { 3, 3 }; + +static int mt7988_xfi_phy_pll_i2c3_pins[] = { 17, 18 }; +static int mt7988_xfi_phy_pll_i2c3_funcs[] = { 4, 4 }; + +static int mt7988_sgmii0_i2c_pins[] = { 17, 18 }; +static int mt7988_sgmii0_i2c_funcs[] = { 5, 5 }; + +static int mt7988_sgmii1_i2c_pins[] = { 17, 18 }; +static int mt7988_sgmii1_i2c_funcs[] = { 6, 6 }; + +static int mt7988_i2c1_2_pins[] = { 69, 70 }; +static int mt7988_i2c1_2_funcs[] = { 2, 2 }; + +static int mt7988_i2c2_0_pins[] = { 69, 70 }; +static int mt7988_i2c2_0_funcs[] = { 4, 4 }; + +static int mt7988_i2c2_1_pins[] = { 71, 72 }; +static int mt7988_i2c2_1_funcs[] = { 1, 1 }; + +/* eth */ +static int mt7988_mdc_mdio0_pins[] = { 5, 6 }; +static int mt7988_mdc_mdio0_funcs[] = { 1, 1 }; + +static int mt7988_2p5g_ext_mdio_pins[] = { 28, 29 }; +static int mt7988_2p5g_ext_mdio_funcs[] = { 6, 6 }; + +static int mt7988_gbe_ext_mdio_pins[] = { 30, 31 }; +static int mt7988_gbe_ext_mdio_funcs[] = { 6, 6 }; + +static int mt7988_mdc_mdio1_pins[] = { 69, 70 }; +static int mt7988_mdc_mdio1_funcs[] = { 1, 1 }; + +/* pcie */ +static int mt7988_pcie_wake_n0_0_pins[] = { 7 }; +static int mt7988_pcie_wake_n0_0_funcs[] = { 1 }; + +static int mt7988_pcie_clk_req_n0_0_pins[] = { 8 }; +static int mt7988_pcie_clk_req_n0_0_funcs[] = { 1 }; + +static int mt7988_pcie_wake_n3_0_pins[] = { 9 }; +static int mt7988_pcie_wake_n3_0_funcs[] = { 1 }; + +static int mt7988_pcie_clk_req_n3_pins[] = { 10 }; +static int mt7988_pcie_clk_req_n3_funcs[] = { 1 }; + +static int mt7988_pcie_clk_req_n0_1_pins[] = { 10 }; +static int mt7988_pcie_clk_req_n0_1_funcs[] = { 2 }; + +static int mt7988_pcie_p0_phy_i2c_pins[] = { 7, 8 }; +static int mt7988_pcie_p0_phy_i2c_funcs[] = { 3, 3 }; + +static int mt7988_pcie_p1_phy_i2c_pins[] = { 7, 8 }; +static int mt7988_pcie_p1_phy_i2c_funcs[] = { 4, 4 }; + +static int mt7988_pcie_p3_phy_i2c_pins[] = { 9, 10 }; +static int mt7988_pcie_p3_phy_i2c_funcs[] = { 4, 4 }; + +static int mt7988_pcie_p2_phy_i2c_pins[] = { 7, 8 }; +static int mt7988_pcie_p2_phy_i2c_funcs[] = { 5, 5 }; + +static int mt7988_ckm_phy_i2c_pins[] = { 9, 10 }; +static int mt7988_ckm_phy_i2c_funcs[] = { 5, 5 }; + +static int mt7988_pcie_wake_n0_1_pins[] = { 13 }; +static int mt7988_pcie_wake_n0_1_funcs[] = { 2 }; + +static int mt7988_pcie_wake_n3_1_pins[] = { 14 }; +static int mt7988_pcie_wake_n3_1_funcs[] = { 2 }; + +static int mt7988_pcie_2l_0_pereset_pins[] = { 19 }; +static int mt7988_pcie_2l_0_pereset_funcs[] = { 1 }; + +static int mt7988_pcie_1l_1_pereset_pins[] = { 20 }; +static int mt7988_pcie_1l_1_pereset_funcs[] = { 1 }; + +static int mt7988_pcie_clk_req_n2_1_pins[] = { 63 }; +static int mt7988_pcie_clk_req_n2_1_funcs[] = { 2 }; + +static int mt7988_pcie_2l_1_pereset_pins[] = { 73 }; +static int mt7988_pcie_2l_1_pereset_funcs[] = { 1 }; + +static int mt7988_pcie_1l_0_pereset_pins[] = { 74 }; +static int mt7988_pcie_1l_0_pereset_funcs[] = { 1 }; + +static int mt7988_pcie_wake_n1_0_pins[] = { 75 }; +static int mt7988_pcie_wake_n1_0_funcs[] = { 1 }; + +static int mt7988_pcie_clk_req_n1_pins[] = { 76 }; +static int mt7988_pcie_clk_req_n1_funcs[] = { 1 }; + +static int mt7988_pcie_wake_n2_0_pins[] = { 77 }; +static int mt7988_pcie_wake_n2_0_funcs[] = { 1 }; + +static int mt7988_pcie_clk_req_n2_0_pins[] = { 78 }; +static int mt7988_pcie_clk_req_n2_0_funcs[] = { 1 }; + +static int mt7988_pcie_wake_n2_1_pins[] = { 79 }; +static int mt7988_pcie_wake_n2_1_funcs[] = { 2 }; + +/* pmic */ +static int mt7988_pmic_pins[] = { 11 }; +static int mt7988_pmic_funcs[] = { 1 }; + +/* watchdog */ +static int mt7988_watchdog_pins[] = { 12 }; +static int mt7988_watchdog_funcs[] = { 1 }; + +/* spi */ +static int mt7988_spi0_wp_hold_pins[] = { 22, 23 }; +static int mt7988_spi0_wp_hold_funcs[] = { 1, 1 }; + +static int mt7988_spi0_pins[] = { 24, 25, 26, 27 }; +static int mt7988_spi0_funcs[] = { 1, 1, 1, 1 }; + +static int mt7988_spi1_pins[] = { 28, 29, 30, 31 }; +static int mt7988_spi1_funcs[] = { 1, 1, 1, 1 }; + +static int mt7988_spi2_pins[] = { 32, 33, 34, 35 }; +static int mt7988_spi2_funcs[] = { 1, 1, 1, 1 }; + +static int mt7988_spi2_wp_hold_pins[] = { 36, 37 }; +static int mt7988_spi2_wp_hold_funcs[] = { 1, 1 }; + +/* flash */ +static int mt7988_snfi_pins[] = { 22, 23, 24, 25, 26, 27 }; +static int mt7988_snfi_funcs[] = { 2, 2, 2, 2, 2, 2 }; + +static int mt7988_emmc_45_pins[] = { + 21, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37 +}; +static int mt7988_emmc_45_funcs[] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }; + +static int mt7988_sdcard_pins[] = { 32, 33, 34, 35, 36, 37 }; +static int mt7988_sdcard_funcs[] = { 5, 5, 5, 5, 5, 5 }; + +static int mt7988_emmc_51_pins[] = { 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49 }; +static int mt7988_emmc_51_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; + +/* uart */ +static int mt7988_uart2_pins[] = { 0, 1, 2, 3 }; +static int mt7988_uart2_funcs[] = { 1, 1, 1, 1 }; + +static int mt7988_tops_uart0_0_pins[] = { 22, 23 }; +static int mt7988_tops_uart0_0_funcs[] = { 3, 3 }; + +static int mt7988_uart2_0_pins[] = { 28, 29, 30, 31 }; +static int mt7988_uart2_0_funcs[] = { 2, 2, 2, 2 }; + +static int mt7988_uart1_0_pins[] = { 32, 33, 34, 35 }; +static int mt7988_uart1_0_funcs[] = { 2, 2, 2, 2 }; + +static int mt7988_uart2_1_pins[] = { 32, 33, 34, 35 }; +static int mt7988_uart2_1_funcs[] = { 3, 3, 3, 3 }; + +static int mt7988_net_wo0_uart_txd_0_pins[] = { 28 }; +static int mt7988_net_wo0_uart_txd_0_funcs[] = { 3 }; + +static int mt7988_net_wo1_uart_txd_0_pins[] = { 29 }; +static int mt7988_net_wo1_uart_txd_0_funcs[] = { 3 }; + +static int mt7988_net_wo2_uart_txd_0_pins[] = { 30 }; +static int mt7988_net_wo2_uart_txd_0_funcs[] = { 3 }; + +static int mt7988_tops_uart1_0_pins[] = { 28, 29 }; +static int mt7988_tops_uart1_0_funcs[] = { 4, 4 }; + +static int mt7988_tops_uart0_1_pins[] = { 30, 31 }; +static int mt7988_tops_uart0_1_funcs[] = { 4, 4 }; + +static int mt7988_tops_uart1_1_pins[] = { 36, 37 }; +static int mt7988_tops_uart1_1_funcs[] = { 3, 3 }; + +static int mt7988_uart0_pins[] = { 55, 56 }; +static int mt7988_uart0_funcs[] = { 1, 1 }; + +static int mt7988_tops_uart0_2_pins[] = { 55, 56 }; +static int mt7988_tops_uart0_2_funcs[] = { 2, 2 }; + +static int mt7988_uart2_2_pins[] = { 50, 51, 52, 53 }; +static int mt7988_uart2_2_funcs[] = { 2, 2, 2, 2 }; + +static int mt7988_uart1_1_pins[] = { 58, 59, 60, 61 }; +static int mt7988_uart1_1_funcs[] = { 2, 2, 2, 2 }; + +static int mt7988_uart2_3_pins[] = { 58, 59, 60, 61 }; +static int mt7988_uart2_3_funcs[] = { 3, 3, 3, 3 }; + +static int mt7988_uart1_2_pins[] = { 80, 81, 82, 83 }; +static int mt7988_uart1_2_funcs[] = { 1, 1, 1, 1 }; + +static int mt7988_tops_uart1_2_pins[] = { 80, 81 }; +static int mt7988_tops_uart1_2_funcs[] = { + 4, + 4, +}; + +static int mt7988_net_wo0_uart_txd_1_pins[] = { 80 }; +static int mt7988_net_wo0_uart_txd_1_funcs[] = { 3 }; + +static int mt7988_net_wo1_uart_txd_1_pins[] = { 81 }; +static int mt7988_net_wo1_uart_txd_1_funcs[] = { 3 }; + +static int mt7988_net_wo2_uart_txd_1_pins[] = { 82 }; +static int mt7988_net_wo2_uart_txd_1_funcs[] = { 3 }; + +/* udi */ +static int mt7988_udi_pins[] = { 32, 33, 34, 35, 36 }; +static int mt7988_udi_funcs[] = { 4, 4, 4, 4, 4 }; + +/* i2s */ +static int mt7988_i2s_pins[] = { 50, 51, 52, 53, 54 }; +static int mt7988_i2s_funcs[] = { 1, 1, 1, 1, 1 }; + +/* pcm */ +static int mt7988_pcm_pins[] = { 50, 51, 52, 53 }; +static int mt7988_pcm_funcs[] = { 1, 1, 1, 1 }; + +/* led */ +static int mt7988_gbe0_led1_pins[] = { 58 }; +static int mt7988_gbe0_led1_funcs[] = { 6 }; +static int mt7988_gbe1_led1_pins[] = { 59 }; +static int mt7988_gbe1_led1_funcs[] = { 6 }; +static int mt7988_gbe2_led1_pins[] = { 60 }; +static int mt7988_gbe2_led1_funcs[] = { 6 }; +static int mt7988_gbe3_led1_pins[] = { 61 }; +static int mt7988_gbe3_led1_funcs[] = { 6 }; + +static int mt7988_2p5gbe_led1_pins[] = { 62 }; +static int mt7988_2p5gbe_led1_funcs[] = { 6 }; + +static int mt7988_gbe0_led0_pins[] = { 64 }; +static int mt7988_gbe0_led0_funcs[] = { 1 }; +static int mt7988_gbe1_led0_pins[] = { 65 }; +static int mt7988_gbe1_led0_funcs[] = { 1 }; +static int mt7988_gbe2_led0_pins[] = { 66 }; +static int mt7988_gbe2_led0_funcs[] = { 1 }; +static int mt7988_gbe3_led0_pins[] = { 67 }; +static int mt7988_gbe3_led0_funcs[] = { 1 }; + +static int mt7988_2p5gbe_led0_pins[] = { 68 }; +static int mt7988_2p5gbe_led0_funcs[] = { 1 }; + +/* usb */ +static int mt7988_drv_vbus_p1_pins[] = { 63 }; +static int mt7988_drv_vbus_p1_funcs[] = { 1 }; + +static int mt7988_drv_vbus_pins[] = { 79 }; +static int mt7988_drv_vbus_funcs[] = { 1 }; + +static const struct group_desc mt7988_groups[] = { + /* @GPIO(0,1,2,3): uart2 */ + PINCTRL_PIN_GROUP("uart2", mt7988_uart2), + /* @GPIO(0,1,2,3,4): tops_jtag0_0 */ + PINCTRL_PIN_GROUP("tops_jtag0_0", mt7988_tops_jtag0_0), + /* @GPIO(2,3): int_usxgmii */ + PINCTRL_PIN_GROUP("int_usxgmii", mt7988_int_usxgmii), + /* @GPIO(0,1,2,3,4): dfd */ + PINCTRL_PIN_GROUP("dfd", mt7988_dfd), + /* @GPIO(0,1): xfi_phy0_i2c0 */ + PINCTRL_PIN_GROUP("xfi_phy0_i2c0", mt7988_xfi_phy0_i2c0), + /* @GPIO(0,1): xfi_phy1_i2c0 */ + PINCTRL_PIN_GROUP("xfi_phy1_i2c0", mt7988_xfi_phy1_i2c0), + /* @GPIO(3,4): xfi_phy_pll_i2c0 */ + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c0", mt7988_xfi_phy_pll_i2c0), + /* @GPIO(3,4): xfi_phy_pll_i2c1 */ + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c1", mt7988_xfi_phy_pll_i2c1), + /* @GPIO(5,6) i2c0_0 */ + PINCTRL_PIN_GROUP("i2c0_0", mt7988_i2c0_0), + /* @GPIO(5,6) i2c1_sfp */ + PINCTRL_PIN_GROUP("i2c1_sfp", mt7988_i2c1_sfp), + /* @GPIO(5,6) xfi_pextp_phy0_i2c */ + PINCTRL_PIN_GROUP("xfi_pextp_phy0_i2c", mt7988_xfi_pextp_phy0_i2c), + /* @GPIO(5,6) xfi_pextp_phy1_i2c */ + PINCTRL_PIN_GROUP("xfi_pextp_phy1_i2c", mt7988_xfi_pextp_phy1_i2c), + /* @GPIO(5,6) mdc_mdio0 */ + PINCTRL_PIN_GROUP("mdc_mdio0", mt7988_mdc_mdio0), + /* @GPIO(7): pcie_wake_n0_0 */ + PINCTRL_PIN_GROUP("pcie_wake_n0_0", mt7988_pcie_wake_n0_0), + /* @GPIO(8): pcie_clk_req_n0_0 */ + PINCTRL_PIN_GROUP("pcie_clk_req_n0_0", mt7988_pcie_clk_req_n0_0), + /* @GPIO(9): pcie_wake_n3_0 */ + PINCTRL_PIN_GROUP("pcie_wake_n3_0", mt7988_pcie_wake_n3_0), + /* @GPIO(10): pcie_clk_req_n3 */ + PINCTRL_PIN_GROUP("pcie_clk_req_n3", mt7988_pcie_clk_req_n3), + /* @GPIO(10): pcie_clk_req_n0_1 */ + PINCTRL_PIN_GROUP("pcie_clk_req_n0_1", mt7988_pcie_clk_req_n0_1), + /* @GPIO(7,8) pcie_p0_phy_i2c */ + PINCTRL_PIN_GROUP("pcie_p0_phy_i2c", mt7988_pcie_p0_phy_i2c), + /* @GPIO(7,8) pcie_p1_phy_i2c */ + PINCTRL_PIN_GROUP("pcie_p1_phy_i2c", mt7988_pcie_p1_phy_i2c), + /* @GPIO(7,8) pcie_p2_phy_i2c */ + PINCTRL_PIN_GROUP("pcie_p2_phy_i2c", mt7988_pcie_p2_phy_i2c), + /* @GPIO(9,10) pcie_p3_phy_i2c */ + PINCTRL_PIN_GROUP("pcie_p3_phy_i2c", mt7988_pcie_p3_phy_i2c), + /* @GPIO(9,10) ckm_phy_i2c */ + PINCTRL_PIN_GROUP("ckm_phy_i2c", mt7988_ckm_phy_i2c), + /* @GPIO(11): pmic */ + PINCTRL_PIN_GROUP("pcie_pmic", mt7988_pmic), + /* @GPIO(12): watchdog */ + PINCTRL_PIN_GROUP("watchdog", mt7988_watchdog), + /* @GPIO(13): pcie_wake_n0_1 */ + PINCTRL_PIN_GROUP("pcie_wake_n0_1", mt7988_pcie_wake_n0_1), + /* @GPIO(14): pcie_wake_n3_1 */ + PINCTRL_PIN_GROUP("pcie_wake_n3_1", mt7988_pcie_wake_n3_1), + /* @GPIO(15,16) i2c0_1 */ + PINCTRL_PIN_GROUP("i2c0_1", mt7988_i2c0_1), + /* @GPIO(15,16) u30_phy_i2c0 */ + PINCTRL_PIN_GROUP("u30_phy_i2c0", mt7988_u30_phy_i2c0), + /* @GPIO(15,16) u32_phy_i2c0 */ + PINCTRL_PIN_GROUP("u32_phy_i2c0", mt7988_u32_phy_i2c0), + /* @GPIO(15,16) xfi_phy0_i2c1 */ + PINCTRL_PIN_GROUP("xfi_phy0_i2c1", mt7988_xfi_phy0_i2c1), + /* @GPIO(15,16) xfi_phy1_i2c1 */ + PINCTRL_PIN_GROUP("xfi_phy1_i2c1", mt7988_xfi_phy1_i2c1), + /* @GPIO(15,16) xfi_phy_pll_i2c2 */ + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c2", mt7988_xfi_phy_pll_i2c2), + /* @GPIO(17,18) i2c1_0 */ + PINCTRL_PIN_GROUP("i2c1_0", mt7988_i2c1_0), + /* @GPIO(17,18) u30_phy_i2c1 */ + PINCTRL_PIN_GROUP("u30_phy_i2c1", mt7988_u30_phy_i2c1), + /* @GPIO(17,18) u32_phy_i2c1 */ + PINCTRL_PIN_GROUP("u32_phy_i2c1", mt7988_u32_phy_i2c1), + /* @GPIO(17,18) xfi_phy_pll_i2c3 */ + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c3", mt7988_xfi_phy_pll_i2c3), + /* @GPIO(17,18) sgmii0_i2c */ + PINCTRL_PIN_GROUP("sgmii0_i2c", mt7988_sgmii0_i2c), + /* @GPIO(17,18) sgmii1_i2c */ + PINCTRL_PIN_GROUP("sgmii1_i2c", mt7988_sgmii1_i2c), + /* @GPIO(19): pcie_2l_0_pereset */ + PINCTRL_PIN_GROUP("pcie_2l_0_pereset", mt7988_pcie_2l_0_pereset), + /* @GPIO(20): pcie_1l_1_pereset */ + PINCTRL_PIN_GROUP("pcie_1l_1_pereset", mt7988_pcie_1l_1_pereset), + /* @GPIO(21): pwm1 */ + PINCTRL_PIN_GROUP("pwm1", mt7988_pwm1), + /* @GPIO(22,23) spi0_wp_hold */ + PINCTRL_PIN_GROUP("spi0_wp_hold", mt7988_spi0_wp_hold), + /* @GPIO(24,25,26,27) spi0 */ + PINCTRL_PIN_GROUP("spi0", mt7988_spi0), + /* @GPIO(28,29,30,31) spi1 */ + PINCTRL_PIN_GROUP("spi1", mt7988_spi1), + /* @GPIO(32,33,34,35) spi2 */ + PINCTRL_PIN_GROUP("spi2", mt7988_spi2), + /* @GPIO(36,37) spi2_wp_hold */ + PINCTRL_PIN_GROUP("spi2_wp_hold", mt7988_spi2_wp_hold), + /* @GPIO(22,23,24,25,26,27) snfi */ + PINCTRL_PIN_GROUP("snfi", mt7988_snfi), + /* @GPIO(22,23) tops_uart0_0 */ + PINCTRL_PIN_GROUP("tops_uart0_0", mt7988_tops_uart0_0), + /* @GPIO(28,29,30,31) uart2_0 */ + PINCTRL_PIN_GROUP("uart2_0", mt7988_uart2_0), + /* @GPIO(32,33,34,35) uart1_0 */ + PINCTRL_PIN_GROUP("uart1_0", mt7988_uart1_0), + /* @GPIO(32,33,34,35) uart2_1 */ + PINCTRL_PIN_GROUP("uart2_1", mt7988_uart2_1), + /* @GPIO(28) net_wo0_uart_txd_0 */ + PINCTRL_PIN_GROUP("net_wo0_uart_txd_0", mt7988_net_wo0_uart_txd_0), + /* @GPIO(29) net_wo1_uart_txd_0 */ + PINCTRL_PIN_GROUP("net_wo1_uart_txd_0", mt7988_net_wo1_uart_txd_0), + /* @GPIO(30) net_wo2_uart_txd_0 */ + PINCTRL_PIN_GROUP("net_wo2_uart_txd_0", mt7988_net_wo2_uart_txd_0), + /* @GPIO(28,29) tops_uart1_0 */ + PINCTRL_PIN_GROUP("tops_uart0_0", mt7988_tops_uart1_0), + /* @GPIO(30,31) tops_uart0_1 */ + PINCTRL_PIN_GROUP("tops_uart0_1", mt7988_tops_uart0_1), + /* @GPIO(36,37) tops_uart1_1 */ + PINCTRL_PIN_GROUP("tops_uart1_1", mt7988_tops_uart1_1), + /* @GPIO(32,33,34,35,36) udi */ + PINCTRL_PIN_GROUP("udi", mt7988_udi), + /* @GPIO(21,28,29,30,31,32,33,34,35,36,37) emmc_45 */ + PINCTRL_PIN_GROUP("emmc_45", mt7988_emmc_45), + /* @GPIO(32,33,34,35,36,37) sdcard */ + PINCTRL_PIN_GROUP("sdcard", mt7988_sdcard), + /* @GPIO(38,39,40,41,42,43,44,45,46,47,48,49) emmc_51 */ + PINCTRL_PIN_GROUP("emmc_51", mt7988_emmc_51), + /* @GPIO(28,29) 2p5g_ext_mdio */ + PINCTRL_PIN_GROUP("2p5g_ext_mdio", mt7988_2p5g_ext_mdio), + /* @GPIO(30,31) gbe_ext_mdio */ + PINCTRL_PIN_GROUP("gbe_ext_mdio", mt7988_gbe_ext_mdio), + /* @GPIO(50,51,52,53,54) i2s */ + PINCTRL_PIN_GROUP("i2s", mt7988_i2s), + /* @GPIO(50,51,52,53) pcm */ + PINCTRL_PIN_GROUP("pcm", mt7988_pcm), + /* @GPIO(55,56) uart0 */ + PINCTRL_PIN_GROUP("uart0", mt7988_uart0), + /* @GPIO(55,56) tops_uart0_2 */ + PINCTRL_PIN_GROUP("tops_uart0_2", mt7988_tops_uart0_2), + /* @GPIO(50,51,52,53) uart2_2 */ + PINCTRL_PIN_GROUP("uart2_2", mt7988_uart2_2), + /* @GPIO(50,51,52,53,54) wo0_jtag */ + PINCTRL_PIN_GROUP("wo0_jtag", mt7988_wo0_jtag), + /* @GPIO(50,51,52,53,54) wo1-wo1_jtag */ + PINCTRL_PIN_GROUP("wo1_jtag", mt7988_wo1_jtag), + /* @GPIO(50,51,52,53,54) wo2_jtag */ + PINCTRL_PIN_GROUP("wo2_jtag", mt7988_wo2_jtag), + /* @GPIO(57) pwm0 */ + PINCTRL_PIN_GROUP("pwm0", mt7988_pwm0), + /* @GPIO(58,59,60,61,62) jtag */ + PINCTRL_PIN_GROUP("jtag", mt7988_jtag), + /* @GPIO(58,59,60,61,62) tops_jtag0_1 */ + PINCTRL_PIN_GROUP("tops_jtag0_1", mt7988_tops_jtag0_1), + /* @GPIO(58,59,60,61) uart2_3 */ + PINCTRL_PIN_GROUP("uart2_3", mt7988_uart2_3), + /* @GPIO(58,59,60,61) uart1_1 */ + PINCTRL_PIN_GROUP("uart1_1", mt7988_uart1_1), + /* @GPIO(58,59,60,61) gbe_led1 */ + PINCTRL_PIN_GROUP("gbe0_led1", mt7988_gbe0_led1), + PINCTRL_PIN_GROUP("gbe1_led1", mt7988_gbe1_led1), + PINCTRL_PIN_GROUP("gbe2_led1", mt7988_gbe2_led1), + PINCTRL_PIN_GROUP("gbe3_led1", mt7988_gbe3_led1), + /* @GPIO(62) 2p5gbe_led1 */ + PINCTRL_PIN_GROUP("2p5gbe_led1", mt7988_2p5gbe_led1), + /* @GPIO(64,65,66,67) gbe_led0 */ + PINCTRL_PIN_GROUP("gbe0_led0", mt7988_gbe0_led0), + PINCTRL_PIN_GROUP("gbe1_led0", mt7988_gbe1_led0), + PINCTRL_PIN_GROUP("gbe2_led0", mt7988_gbe2_led0), + PINCTRL_PIN_GROUP("gbe3_led0", mt7988_gbe3_led0), + /* @GPIO(68) 2p5gbe_led0 */ + PINCTRL_PIN_GROUP("2p5gbe_led0", mt7988_2p5gbe_led0), + /* @GPIO(63) drv_vbus_p1 */ + PINCTRL_PIN_GROUP("drv_vbus_p1", mt7988_drv_vbus_p1), + /* @GPIO(63) pcie_clk_req_n2_1 */ + PINCTRL_PIN_GROUP("pcie_clk_req_n2_1", mt7988_pcie_clk_req_n2_1), + /* @GPIO(69, 70) mdc_mdio1 */ + PINCTRL_PIN_GROUP("mdc_mdio1", mt7988_mdc_mdio1), + /* @GPIO(69, 70) i2c1_2 */ + PINCTRL_PIN_GROUP("i2c1_2", mt7988_i2c1_2), + /* @GPIO(69) pwm6 */ + PINCTRL_PIN_GROUP("pwm6", mt7988_pwm6), + /* @GPIO(70) pwm7 */ + PINCTRL_PIN_GROUP("pwm7", mt7988_pwm7), + /* @GPIO(69,70) i2c2_0 */ + PINCTRL_PIN_GROUP("i2c2_0", mt7988_i2c2_0), + /* @GPIO(71,72) i2c2_1 */ + PINCTRL_PIN_GROUP("i2c2_1", mt7988_i2c2_1), + /* @GPIO(73) pcie_2l_1_pereset */ + PINCTRL_PIN_GROUP("pcie_2l_1_pereset", mt7988_pcie_2l_1_pereset), + /* @GPIO(74) pcie_1l_0_pereset */ + PINCTRL_PIN_GROUP("pcie_1l_0_pereset", mt7988_pcie_1l_0_pereset), + /* @GPIO(75) pcie_wake_n1_0 */ + PINCTRL_PIN_GROUP("pcie_wake_n1_0", mt7988_pcie_wake_n1_0), + /* @GPIO(76) pcie_clk_req_n1 */ + PINCTRL_PIN_GROUP("pcie_clk_req_n1", mt7988_pcie_clk_req_n1), + /* @GPIO(77) pcie_wake_n2_0 */ + PINCTRL_PIN_GROUP("pcie_wake_n2_0", mt7988_pcie_wake_n2_0), + /* @GPIO(78) pcie_clk_req_n2_0 */ + PINCTRL_PIN_GROUP("pcie_clk_req_n2_0", mt7988_pcie_clk_req_n2_0), + /* @GPIO(79) drv_vbus */ + PINCTRL_PIN_GROUP("drv_vbus", mt7988_drv_vbus), + /* @GPIO(79) pcie_wake_n2_1 */ + PINCTRL_PIN_GROUP("pcie_wake_n2_1", mt7988_pcie_wake_n2_1), + /* @GPIO(80,81,82,83) uart1_2 */ + PINCTRL_PIN_GROUP("uart1_2", mt7988_uart1_2), + /* @GPIO(80) pwm2 */ + PINCTRL_PIN_GROUP("pwm2", mt7988_pwm2), + /* @GPIO(81) pwm3 */ + PINCTRL_PIN_GROUP("pwm3", mt7988_pwm3), + /* @GPIO(82) pwm4 */ + PINCTRL_PIN_GROUP("pwm4", mt7988_pwm4), + /* @GPIO(83) pwm5 */ + PINCTRL_PIN_GROUP("pwm5", mt7988_pwm5), + /* @GPIO(80) net_wo0_uart_txd_0 */ + PINCTRL_PIN_GROUP("net_wo0_uart_txd_0", mt7988_net_wo0_uart_txd_0), + /* @GPIO(81) net_wo1_uart_txd_0 */ + PINCTRL_PIN_GROUP("net_wo1_uart_txd_0", mt7988_net_wo1_uart_txd_0), + /* @GPIO(82) net_wo2_uart_txd_0 */ + PINCTRL_PIN_GROUP("net_wo2_uart_txd_0", mt7988_net_wo2_uart_txd_0), + /* @GPIO(80,81) tops_uart1_2 */ + PINCTRL_PIN_GROUP("tops_uart1_2", mt7988_tops_uart1_2), + /* @GPIO(80) net_wo0_uart_txd_1 */ + PINCTRL_PIN_GROUP("net_wo0_uart_txd_1", mt7988_net_wo0_uart_txd_1), + /* @GPIO(81) net_wo1_uart_txd_1 */ + PINCTRL_PIN_GROUP("net_wo1_uart_txd_1", mt7988_net_wo1_uart_txd_1), + /* @GPIO(82) net_wo2_uart_txd_1 */ + PINCTRL_PIN_GROUP("net_wo2_uart_txd_1", mt7988_net_wo2_uart_txd_1), +}; + +/* Joint those groups owning the same capability in user point of view which + * allows that people tend to use through the device tree. + */ +static const char *mt7988_jtag_groups[] = { + "tops_jtag0_0", "wo0_jtag", "wo1_jtag", + "wo2_jtag", "jtag", "tops_jtag0_1", +}; +static const char *mt7988_int_usxgmii_groups[] = { + "int_usxgmii", +}; +static const char *mt7988_pwm_groups[] = { + "pwm0", "pwm1", "pwm2", "pwm3", "pwm4", "pwm5", "pwm6", "pwm7" +}; +static const char *mt7988_dfd_groups[] = { + "dfd", +}; +static const char *mt7988_i2c_groups[] = { + "xfi_phy0_i2c0", + "xfi_phy1_i2c0", + "xfi_phy_pll_i2c0", + "xfi_phy_pll_i2c1", + "i2c0_0", + "i2c1_sfp", + "xfi_pextp_phy0_i2c", + "xfi_pextp_phy1_i2c", + "i2c0_1", + "u30_phy_i2c0", + "u32_phy_i2c0", + "xfi_phy0_i2c1", + "xfi_phy1_i2c1", + "xfi_phy_pll_i2c2", + "i2c1_0", + "u30_phy_i2c1", + "u32_phy_i2c1", + "xfi_phy_pll_i2c3", + "sgmii0_i2c", + "sgmii1_i2c", + "i2c1_2", + "i2c2_0", + "i2c2_1", +}; +static const char *mt7988_ethernet_groups[] = { + "mdc_mdio0", + "2p5g_ext_mdio", + "gbe_ext_mdio", + "mdc_mdio1", +}; +static const char *mt7988_pcie_groups[] = { + "pcie_wake_n0_0", "pcie_clk_req_n0_0", "pcie_wake_n3_0", + "pcie_clk_req_n3", "pcie_p0_phy_i2c", "pcie_p1_phy_i2c", + "pcie_p3_phy_i2c", "pcie_p2_phy_i2c", "ckm_phy_i2c", + "pcie_wake_n0_1", "pcie_wake_n3_1", "pcie_2l_0_pereset", + "pcie_1l_1_pereset", "pcie_clk_req_n2_1", "pcie_2l_1_pereset", + "pcie_1l_0_pereset", "pcie_wake_n1_0", "pcie_clk_req_n1", + "pcie_wake_n2_0", "pcie_clk_req_n2_0", "pcie_wake_n2_1", + "pcie_clk_req_n0_1" +}; +static const char *mt7988_pmic_groups[] = { + "pmic", +}; +static const char *mt7988_wdt_groups[] = { + "watchdog", +}; +static const char *mt7988_spi_groups[] = { + "spi0", "spi0_wp_hold", "spi1", "spi2", "spi2_wp_hold", +}; +static const char *mt7988_flash_groups[] = { "emmc_45", "sdcard", "snfi", + "emmc_51" }; +static const char *mt7988_uart_groups[] = { + "uart2", + "tops_uart0_0", + "uart2_0", + "uart1_0", + "uart2_1", + "net_wo0_uart_txd_0", + "net_wo1_uart_txd_0", + "net_wo2_uart_txd_0", + "tops_uart1_0", + "ops_uart0_1", + "ops_uart1_1", + "uart0", + "tops_uart0_2", + "uart1_1", + "uart2_3", + "uart1_2", + "tops_uart1_2", + "net_wo0_uart_txd_1", + "net_wo1_uart_txd_1", + "net_wo2_uart_txd_1", +}; +static const char *mt7988_udi_groups[] = { + "udi", +}; +static const char *mt7988_audio_groups[] = { + "i2s", "pcm", +}; +static const char *mt7988_led_groups[] = { + "gbe0_led1", "gbe1_led1", "gbe2_led1", "gbe3_led1", "2p5gbe_led1", + "gbe0_led0", "gbe1_led0", "gbe2_led0", "gbe3_led0", "2p5gbe_led0", + "wf5g_led0", "wf5g_led1", +}; +static const char *mt7988_usb_groups[] = { + "drv_vbus", + "drv_vbus_p1", +}; + +static const struct function_desc mt7988_functions[] = { + { "audio", mt7988_audio_groups, ARRAY_SIZE(mt7988_audio_groups) }, + { "jtag", mt7988_jtag_groups, ARRAY_SIZE(mt7988_jtag_groups) }, + { "int_usxgmii", mt7988_int_usxgmii_groups, + ARRAY_SIZE(mt7988_int_usxgmii_groups) }, + { "pwm", mt7988_pwm_groups, ARRAY_SIZE(mt7988_pwm_groups) }, + { "dfd", mt7988_dfd_groups, ARRAY_SIZE(mt7988_dfd_groups) }, + { "i2c", mt7988_i2c_groups, ARRAY_SIZE(mt7988_i2c_groups) }, + { "eth", mt7988_ethernet_groups, ARRAY_SIZE(mt7988_ethernet_groups) }, + { "pcie", mt7988_pcie_groups, ARRAY_SIZE(mt7988_pcie_groups) }, + { "pmic", mt7988_pmic_groups, ARRAY_SIZE(mt7988_pmic_groups) }, + { "watchdog", mt7988_wdt_groups, ARRAY_SIZE(mt7988_wdt_groups) }, + { "spi", mt7988_spi_groups, ARRAY_SIZE(mt7988_spi_groups) }, + { "flash", mt7988_flash_groups, ARRAY_SIZE(mt7988_flash_groups) }, + { "uart", mt7988_uart_groups, ARRAY_SIZE(mt7988_uart_groups) }, + { "udi", mt7988_udi_groups, ARRAY_SIZE(mt7988_udi_groups) }, + { "usb", mt7988_usb_groups, ARRAY_SIZE(mt7988_usb_groups) }, + { "led", mt7988_led_groups, ARRAY_SIZE(mt7988_led_groups) }, +}; + +static const struct mtk_eint_hw mt7988_eint_hw = { + .port_mask = 7, + .ports = 7, + .ap_num = ARRAY_SIZE(mt7988_pins), + .db_cnt = 16, +}; + +static const char *mt7988_pinctrl_register_base_names[] = { + "gpio_base", "iocfg_tr_base", "iocfg_br_base", + "iocfg_rb_base", "iocfg_lb_base", "iocfg_tl_base", +}; + +static struct mtk_pin_soc mt7988_data = { + .reg_cal = mt7988_reg_cals, + .pins = mt7988_pins, + .npins = ARRAY_SIZE(mt7988_pins), + .grps = mt7988_groups, + .ngrps = ARRAY_SIZE(mt7988_groups), + .funcs = mt7988_functions, + .nfuncs = ARRAY_SIZE(mt7988_functions), + .eint_hw = &mt7988_eint_hw, + .gpio_m = 0, + .ies_present = false, + .base_names = mt7988_pinctrl_register_base_names, + .nbase_names = ARRAY_SIZE(mt7988_pinctrl_register_base_names), + .bias_disable_set = mtk_pinconf_bias_disable_set, + .bias_disable_get = mtk_pinconf_bias_disable_get, + .bias_set = mtk_pinconf_bias_set, + .bias_get = mtk_pinconf_bias_get, + .drive_set = mtk_pinconf_drive_set_rev1, + .drive_get = mtk_pinconf_drive_get_rev1, + .adv_pull_get = mtk_pinconf_adv_pull_get, + .adv_pull_set = mtk_pinconf_adv_pull_set, +}; + +static const struct of_device_id mt7988_pinctrl_of_match[] = { + { + .compatible = "mediatek,mt7988-pinctrl", + }, + {} +}; + +static int mt7988_pinctrl_probe(struct platform_device *pdev) +{ + return mtk_moore_pinctrl_probe(pdev, &mt7988_data); +} + +static struct platform_driver mt7988_pinctrl_driver = { + .driver = { + .name = "mt7988-pinctrl", + .of_match_table = mt7988_pinctrl_of_match, + }, + .probe = mt7988_pinctrl_probe, +}; + +static int __init mt7988_pinctrl_init(void) +{ + return platform_driver_register(&mt7988_pinctrl_driver); +} +arch_initcall(mt7988_pinctrl_init); diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 9f1c6f69395b5b..5170dfdf9803ad 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -311,6 +311,7 @@ CONFIG_PINCTRL=y # CONFIG_PINCTRL_MT7622 is not set CONFIG_PINCTRL_MT7981=y CONFIG_PINCTRL_MT7986=y +CONFIG_PINCTRL_MT7988=y # CONFIG_PINCTRL_MT8173 is not set # CONFIG_PINCTRL_MT8183 is not set CONFIG_PINCTRL_MT8516=y diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index 56e855c559032a..be51e02f4d741a 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -330,6 +330,7 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_MT7622=y # CONFIG_PINCTRL_MT7981 is not set # CONFIG_PINCTRL_MT7986 is not set +# CONFIG_PINCTRL_MT7988 is not set # CONFIG_PINCTRL_MT8173 is not set # CONFIG_PINCTRL_MT8183 is not set CONFIG_PINCTRL_MT8516=y diff --git a/target/linux/mediatek/patches-5.15/240-pinctrl-mediatek-add-support-for-MT7988-SoC.patch b/target/linux/mediatek/patches-5.15/240-pinctrl-mediatek-add-support-for-MT7988-SoC.patch new file mode 100644 index 00000000000000..cbee45bc1f89d2 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/240-pinctrl-mediatek-add-support-for-MT7988-SoC.patch @@ -0,0 +1,26 @@ +--- a/drivers/pinctrl/mediatek/Kconfig ++++ b/drivers/pinctrl/mediatek/Kconfig +@@ -134,6 +134,13 @@ config PINCTRL_MT7986 + default ARM64 && ARCH_MEDIATEK + select PINCTRL_MTK_MOORE + ++config PINCTRL_MT7988 ++ bool "Mediatek MT7988 pin control" ++ depends on OF ++ depends on ARM64 || COMPILE_TEST ++ default ARCH_MEDIATEK ++ select PINCTRL_MTK_MOORE ++ + config PINCTRL_MT8167 + bool "Mediatek MT8167 pin control" + depends on OF +--- a/drivers/pinctrl/mediatek/Makefile ++++ b/drivers/pinctrl/mediatek/Makefile +@@ -19,6 +19,7 @@ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl- + obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o + obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7981.o + obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o ++obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o + obj-$(CONFIG_PINCTRL_MT8167) += pinctrl-mt8167.o + obj-$(CONFIG_PINCTRL_MT8173) += pinctrl-mt8173.o + obj-$(CONFIG_PINCTRL_MT8183) += pinctrl-mt8183.o From 5970f5d02764fa414660f773e8e7556c69577195 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Apr 2023 17:16:12 +0100 Subject: [PATCH 0027/1171] generic: add support for MediaTek NETSYS v3 In order to support Ethernet on the MT7988 SoC add support for NETSYS v3 as well as new paths and USXGMII SerDes to the mtk_eth_soc driver. Signed-off-by: Daniel Golle (cherry picked from commit 6983a215d9d1966f95bc5b1c0045c200948b2079) --- ..._eth_soc-add-MTK_NETSYS_V1-capabilit.patch | 223 +++ ..._eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch | 181 ++ ..._eth_soc-rely-on-num_devs-and-remove.patch | 153 ++ ..._eth_soc-add-MTK_NETSYS_V3-capabilit.patch | 292 +++ ..._eth_soc-convert-caps-in-mtk_soc_dat.patch | 197 ++ ...k_eth_soc-add-support-for-MT7988-SoC.patch | 495 +++++ ..._eth_soc-add-paths-and-SerDes-modes-.patch | 1671 +++++++++++++++++ target/linux/mediatek/filogic/config-5.15 | 1 + target/linux/mediatek/mt7622/config-5.15 | 1 + ..._eth_soc-implement-Clause-45-MDIO-ac.patch | 8 +- ...ethernet-mediatek-support-net-labels.patch | 4 +- 11 files changed, 3220 insertions(+), 6 deletions(-) create mode 100644 target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch create mode 100644 target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch create mode 100644 target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch create mode 100644 target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch create mode 100644 target/linux/generic/pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch create mode 100644 target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch create mode 100644 target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch diff --git a/target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch b/target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch new file mode 100644 index 00000000000000..621a7b0fcf0839 --- /dev/null +++ b/target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch @@ -0,0 +1,223 @@ +From 663fa1b7e0cb2c929008482014a70c6625caad75 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 7 Mar 2023 15:55:13 +0000 +Subject: [PATCH 1/7] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V1 capability + bit + +Introduce MTK_NETSYS_V1 bit in the device capabilities for +MT7621/MT7622/MT7623/MT7628/MT7629 SoCs. +Use !MTK_NETSYS_V1 instead of MTK_NETSYS_V2 in the driver codebase. +This is a preliminary patch to introduce support for MT7988 SoC. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 30 +++++++------- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 45 ++++++++++++--------- + 2 files changed, 41 insertions(+), 34 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -597,7 +597,7 @@ static void mtk_set_queue_speed(struct m + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | + MTK_QTX_SCH_LEAKY_BUCKET_SIZE; +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) + val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; + + if (IS_ENABLED(CONFIG_SOC_MT7621)) { +@@ -974,7 +974,7 @@ static bool mtk_rx_get_desc(struct mtk_e + rxd->rxd1 = READ_ONCE(dma_rxd->rxd1); + rxd->rxd3 = READ_ONCE(dma_rxd->rxd3); + rxd->rxd4 = READ_ONCE(dma_rxd->rxd4); +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { + rxd->rxd5 = READ_ONCE(dma_rxd->rxd5); + rxd->rxd6 = READ_ONCE(dma_rxd->rxd6); + } +@@ -1032,7 +1032,7 @@ static int mtk_init_fq_dma(struct mtk_et + + txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); + txd->txd4 = 0; +- if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { ++ if (!MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V1)) { + txd->txd5 = 0; + txd->txd6 = 0; + txd->txd7 = 0; +@@ -1221,7 +1221,7 @@ static void mtk_tx_set_dma_desc(struct n + struct mtk_mac *mac = netdev_priv(dev); + struct mtk_eth *eth = mac->hw; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) + mtk_tx_set_dma_desc_v2(dev, txd, info); + else + mtk_tx_set_dma_desc_v1(dev, txd, info); +@@ -1902,7 +1902,7 @@ static int mtk_poll_rx(struct napi_struc + break; + + /* find out which mac the packet come from. values start at 1 */ +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) + mac = RX_DMA_GET_SPORT_V2(trxd.rxd5) - 1; + else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && + !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) +@@ -1998,7 +1998,7 @@ static int mtk_poll_rx(struct napi_struc + skb->dev = netdev; + bytes += skb->len; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { + reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5); + hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY; + if (hash != MTK_RXD5_FOE_ENTRY) +@@ -2023,7 +2023,7 @@ static int mtk_poll_rx(struct napi_struc + /* When using VLAN untagging in combination with DSA, the + * hardware treats the MTK special tag as a VLAN and untags it. + */ +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) && ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1) && + (trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) { + unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0); + +@@ -2328,7 +2328,7 @@ static int mtk_tx_alloc(struct mtk_eth * + txd->txd2 = next_ptr; + txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; + txd->txd4 = 0; +- if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { ++ if (!MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V1)) { + txd->txd5 = 0; + txd->txd6 = 0; + txd->txd7 = 0; +@@ -2381,7 +2381,7 @@ static int mtk_tx_alloc(struct mtk_eth * + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | + MTK_QTX_SCH_LEAKY_BUCKET_SIZE; +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) + val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; + mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); + ofs += MTK_QTX_OFFSET; +@@ -2515,7 +2515,7 @@ static int mtk_rx_alloc(struct mtk_eth * + + rxd->rxd3 = 0; + rxd->rxd4 = 0; +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { + rxd->rxd5 = 0; + rxd->rxd6 = 0; + rxd->rxd7 = 0; +@@ -3063,7 +3063,7 @@ static int mtk_start_dma(struct mtk_eth + MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | + MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) + val |= MTK_MUTLI_CNT | MTK_RESV_BUF | + MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | + MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN; +@@ -3475,7 +3475,7 @@ static void mtk_hw_reset(struct mtk_eth + { + u32 val; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { + regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0); + val = RSTCTRL_PPE0_V2; + } else { +@@ -3487,7 +3487,7 @@ static void mtk_hw_reset(struct mtk_eth + + ethsys_reset(eth, RSTCTRL_ETH | RSTCTRL_FE | val); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) + regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, + 0x3ffffff); + } +@@ -3683,7 +3683,7 @@ static int mtk_hw_init(struct mtk_eth *e + else + mtk_hw_reset(eth); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { + /* Set FE to PDMAv2 if necessary */ + val = mtk_r32(eth, MTK_FE_GLO_MISC); + mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); +@@ -3720,7 +3720,7 @@ static int mtk_hw_init(struct mtk_eth *e + */ + val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); + mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL); +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { + val = mtk_r32(eth, MTK_CDMP_IG_CTRL); + mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -816,6 +816,7 @@ enum mkt_eth_capabilities { + MTK_SHARED_INT_BIT, + MTK_TRGMII_MT7621_CLK_BIT, + MTK_QDMA_BIT, ++ MTK_NETSYS_V1_BIT, + MTK_NETSYS_V2_BIT, + MTK_SOC_MT7628_BIT, + MTK_RSTCTRL_PPE1_BIT, +@@ -851,6 +852,7 @@ enum mkt_eth_capabilities { + #define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT) + #define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT) + #define MTK_QDMA BIT(MTK_QDMA_BIT) ++#define MTK_NETSYS_V1 BIT(MTK_NETSYS_V1_BIT) + #define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) + #define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) + #define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) +@@ -913,25 +915,30 @@ enum mkt_eth_capabilities { + + #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x) & ~(MTK_CAP_MASK)) == (_x)) + +-#define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ +- MTK_GMAC2_RGMII | MTK_SHARED_INT | \ +- MTK_TRGMII_MT7621_CLK | MTK_QDMA) +- +-#define MT7622_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_SGMII | MTK_GMAC2_RGMII | \ +- MTK_GMAC2_SGMII | MTK_GDM1_ESW | \ +- MTK_MUX_GDM1_TO_GMAC1_ESW | \ +- MTK_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | MTK_QDMA) +- +-#define MT7623_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | MTK_GMAC2_RGMII | \ +- MTK_QDMA) +- +-#define MT7628_CAPS (MTK_SHARED_INT | MTK_SOC_MT7628) +- +-#define MT7629_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \ +- MTK_GDM1_ESW | MTK_MUX_GDM1_TO_GMAC1_ESW | \ +- MTK_MUX_GMAC2_GMAC0_TO_GEPHY | \ +- MTK_MUX_U3_GMAC2_TO_QPHY | \ +- MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA) ++#define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ ++ MTK_GMAC2_RGMII | MTK_SHARED_INT | \ ++ MTK_TRGMII_MT7621_CLK | MTK_QDMA | \ ++ MTK_NETSYS_V1) ++ ++#define MT7622_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_SGMII | \ ++ MTK_GMAC2_RGMII | MTK_GMAC2_SGMII | \ ++ MTK_GDM1_ESW | MTK_MUX_GDM1_TO_GMAC1_ESW |\ ++ MTK_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | \ ++ MTK_QDMA | MTK_NETSYS_V1) ++ ++#define MT7623_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ ++ MTK_GMAC2_RGMII | MTK_QDMA | \ ++ MTK_NETSYS_V1) ++ ++#define MT7628_CAPS (MTK_SHARED_INT | MTK_SOC_MT7628 | \ ++ MTK_NETSYS_V1) ++ ++#define MT7629_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ ++ MTK_GMAC2_GEPHY | MTK_GDM1_ESW | \ ++ MTK_MUX_GMAC2_GMAC0_TO_GEPHY | MTK_QDMA | \ ++ MTK_MUX_U3_GMAC2_TO_QPHY | MTK_NETSYS_V1 |\ ++ MTK_MUX_GDM1_TO_GMAC1_ESW | \ ++ MTK_MUX_GMAC12_TO_GEPHY_SGMII) + + #define MT7981_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \ + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ diff --git a/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch b/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch new file mode 100644 index 00000000000000..a8debc41bfb3ce --- /dev/null +++ b/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch @@ -0,0 +1,181 @@ +From 5af2b2dc4d6ba0ff7696e79f18e5b2bf862194eb Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 7 Mar 2023 15:55:24 +0000 +Subject: [PATCH 2/7] net: ethernet: mtk_eth_soc: move MAX_DEVS in mtk_soc_data + +This is a preliminary patch to add MT7988 SoC support since it runs 3 +macs instead of 2. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 34 +++++++++++++++++++-- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 11 +++---- + 2 files changed, 36 insertions(+), 9 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -3989,7 +3989,10 @@ static void mtk_sgmii_destroy(struct mtk + { + int i; + +- for (i = 0; i < MTK_MAX_DEVS; i++) ++ if (!eth->sgmii_pcs) ++ return; ++ ++ for (i = 0; i < eth->soc->num_devs; i++) + mtk_pcs_lynxi_destroy(eth->sgmii_pcs[i]); + } + +@@ -4432,7 +4435,12 @@ static int mtk_sgmii_init(struct mtk_eth + u32 flags; + int i; + +- for (i = 0; i < MTK_MAX_DEVS; i++) { ++ eth->sgmii_pcs = devm_kzalloc(eth->dev, ++ sizeof(*eth->sgmii_pcs) * ++ eth->soc->num_devs, ++ GFP_KERNEL); ++ ++ for (i = 0; i < eth->soc->num_devs; i++) { + np = of_parse_phandle(eth->dev->of_node, "mediatek,sgmiisys", i); + if (!np) + break; +@@ -4477,6 +4485,18 @@ static int mtk_probe(struct platform_dev + if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) + eth->ip_align = NET_IP_ALIGN; + ++ eth->netdev = devm_kzalloc(eth->dev, ++ sizeof(*eth->netdev) * eth->soc->num_devs, ++ GFP_KERNEL); ++ if (!eth->netdev) ++ return -ENOMEM; ++ ++ eth->mac = devm_kzalloc(eth->dev, ++ sizeof(*eth->mac) * eth->soc->num_devs, ++ GFP_KERNEL); ++ if (!eth->mac) ++ return -ENOMEM; ++ + spin_lock_init(ð->page_lock); + spin_lock_init(ð->tx_irq_lock); + spin_lock_init(ð->rx_irq_lock); +@@ -4662,7 +4682,7 @@ static int mtk_probe(struct platform_dev + goto err_free_dev; + } + +- for (i = 0; i < MTK_MAX_DEVS; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!eth->netdev[i]) + continue; + +@@ -4739,6 +4759,7 @@ static const struct mtk_soc_data mt2701_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7623_CLKS_BITMAP, + .required_pctl = true, ++ .num_devs = 2, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4757,6 +4778,7 @@ static const struct mtk_soc_data mt7621_ + .required_pctl = false, + .offload_version = 1, + .hash_offset = 2, ++ .num_devs = 2, + .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), +@@ -4778,6 +4800,7 @@ static const struct mtk_soc_data mt7622_ + .offload_version = 2, + .hash_offset = 2, + .has_accounting = true, ++ .num_devs = 2, + .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), +@@ -4797,6 +4820,7 @@ static const struct mtk_soc_data mt7623_ + .required_pctl = true, + .offload_version = 1, + .hash_offset = 2, ++ .num_devs = 2, + .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), +@@ -4816,6 +4840,7 @@ static const struct mtk_soc_data mt7629_ + .required_clks = MT7629_CLKS_BITMAP, + .required_pctl = false, + .has_accounting = true, ++ .num_devs = 2, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4837,6 +4862,7 @@ static const struct mtk_soc_data mt7981_ + .hash_offset = 4, + .foe_entry_size = sizeof(struct mtk_foe_entry), + .has_accounting = true, ++ .num_devs = 2, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma_v2), + .rxd_size = sizeof(struct mtk_rx_dma_v2), +@@ -4856,6 +4882,7 @@ static const struct mtk_soc_data mt7986_ + .required_pctl = false, + .offload_version = 2, + .hash_offset = 4, ++ .num_devs = 2, + .foe_entry_size = sizeof(struct mtk_foe_entry), + .has_accounting = true, + .txrx = { +@@ -4874,6 +4901,7 @@ static const struct mtk_soc_data rt5350_ + .hw_features = MTK_HW_FEATURES_MT7628, + .required_clks = MT7628_CLKS_BITMAP, + .required_pctl = false, ++ .num_devs = 2, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -1018,6 +1018,7 @@ struct mtk_reg_map { + * @required_pctl A bool value to show whether the SoC requires + * the extra setup for those pins used by GMAC. + * @hash_offset Flow table hash offset. ++ * @num_devs SoC number of macs. + * @foe_entry_size Foe table entry size. + * @has_accounting Bool indicating support for accounting of + * offloaded flows. +@@ -1036,6 +1037,7 @@ struct mtk_soc_data { + bool required_pctl; + u8 offload_version; + u8 hash_offset; ++ u8 num_devs; + u16 foe_entry_size; + netdev_features_t hw_features; + bool has_accounting; +@@ -1051,9 +1053,6 @@ struct mtk_soc_data { + + #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) + +-/* currently no SoC has more than 2 macs */ +-#define MTK_MAX_DEVS 2 +- + /* struct mtk_eth - This is the main datasructure for holding the state + * of the driver + * @dev: The device pointer +@@ -1108,14 +1107,14 @@ struct mtk_eth { + spinlock_t tx_irq_lock; + spinlock_t rx_irq_lock; + struct net_device dummy_dev; +- struct net_device *netdev[MTK_MAX_DEVS]; +- struct mtk_mac *mac[MTK_MAX_DEVS]; ++ struct net_device **netdev; ++ struct mtk_mac **mac; + int irq[3]; + u32 msg_enable; + unsigned long sysclk; + struct regmap *ethsys; + struct regmap *infra; +- struct phylink_pcs *sgmii_pcs[MTK_MAX_DEVS]; ++ struct phylink_pcs **sgmii_pcs; + struct regmap *pctl; + bool hwlro; + refcount_t dma_refcnt; diff --git a/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch b/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch new file mode 100644 index 00000000000000..d6b36bf6368933 --- /dev/null +++ b/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch @@ -0,0 +1,153 @@ +From 4e35e80750b33727e606be9e7ce447bde2e0deb7 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 7 Mar 2023 15:55:35 +0000 +Subject: [PATCH 3/7] net: ethernet: mtk_eth_soc: rely on num_devs and remove + MTK_MAC_COUNT + +Get rid of MTK_MAC_COUNT since it is a duplicated of eth->soc->num_devs. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 30 ++++++++++----------- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 - + 2 files changed, 15 insertions(+), 16 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -900,7 +900,7 @@ static void mtk_stats_update(struct mtk_ + { + int i; + +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!eth->mac[i] || !eth->mac[i]->hw_stats) + continue; + if (spin_trylock(ð->mac[i]->hw_stats->stats_lock)) { +@@ -1403,7 +1403,7 @@ static int mtk_queue_stopped(struct mtk_ + { + int i; + +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!eth->netdev[i]) + continue; + if (netif_queue_stopped(eth->netdev[i])) +@@ -1417,7 +1417,7 @@ static void mtk_wake_queue(struct mtk_et + { + int i; + +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!eth->netdev[i]) + continue; + netif_tx_wake_all_queues(eth->netdev[i]); +@@ -1908,7 +1908,7 @@ static int mtk_poll_rx(struct napi_struc + !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) + mac = RX_DMA_GET_SPORT(trxd.rxd4) - 1; + +- if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT || ++ if (unlikely(mac < 0 || mac >= eth->soc->num_devs || + !eth->netdev[mac])) + goto release_desc; + +@@ -2937,7 +2937,7 @@ static void mtk_dma_free(struct mtk_eth + const struct mtk_soc_data *soc = eth->soc; + int i; + +- for (i = 0; i < MTK_MAC_COUNT; i++) ++ for (i = 0; i < soc->num_devs; i++) + if (eth->netdev[i]) + netdev_reset_queue(eth->netdev[i]); + if (eth->scratch_ring) { +@@ -3091,7 +3091,7 @@ static void mtk_gdm_config(struct mtk_et + if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) + return; + +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + u32 val = mtk_r32(eth, MTK_GDMA_FWD_CFG(i)); + + /* default setup the forward port to send frame to PDMA */ +@@ -3704,7 +3704,7 @@ static int mtk_hw_init(struct mtk_eth *e + * up with the more appropriate value when mtk_mac_config call is being + * invoked. + */ +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + struct net_device *dev = eth->netdev[i]; + + mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i)); +@@ -3909,7 +3909,7 @@ static void mtk_pending_work(struct work + mtk_prepare_for_reset(eth); + + /* stop all devices to make sure that dma is properly shut down */ +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!eth->netdev[i] || !netif_running(eth->netdev[i])) + continue; + +@@ -3925,7 +3925,7 @@ static void mtk_pending_work(struct work + mtk_hw_init(eth, true); + + /* restart DMA and enable IRQs */ +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!test_bit(i, &restart)) + continue; + +@@ -3953,7 +3953,7 @@ static int mtk_free_dev(struct mtk_eth * + { + int i; + +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!eth->netdev[i]) + continue; + free_netdev(eth->netdev[i]); +@@ -3972,7 +3972,7 @@ static int mtk_unreg_dev(struct mtk_eth + { + int i; + +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + struct mtk_mac *mac; + if (!eth->netdev[i]) + continue; +@@ -4277,7 +4277,7 @@ static int mtk_add_mac(struct mtk_eth *e + } + + id = be32_to_cpup(_id); +- if (id >= MTK_MAC_COUNT) { ++ if (id >= eth->soc->num_devs) { + dev_err(eth->dev, "%d is not a valid mac id\n", id); + return -EINVAL; + } +@@ -4407,7 +4407,7 @@ void mtk_eth_set_dma_device(struct mtk_e + + rtnl_lock(); + +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + dev = eth->netdev[i]; + + if (!dev || !(dev->flags & IFF_UP)) +@@ -4734,7 +4734,7 @@ static int mtk_remove(struct platform_de + int i; + + /* stop all devices to make sure that dma is properly shut down */ +- for (i = 0; i < MTK_MAC_COUNT; i++) { ++ for (i = 0; i < eth->soc->num_devs; i++) { + if (!eth->netdev[i]) + continue; + mtk_stop(eth->netdev[i]); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -33,7 +33,6 @@ + #define MTK_TX_DMA_BUF_LEN_V2 0xffff + #define MTK_QDMA_RING_SIZE 2048 + #define MTK_DMA_SIZE 512 +-#define MTK_MAC_COUNT 2 + #define MTK_RX_ETH_HLEN (VLAN_ETH_HLEN + ETH_FCS_LEN) + #define MTK_RX_HLEN (NET_SKB_PAD + MTK_RX_ETH_HLEN + NET_IP_ALIGN) + #define MTK_DMA_DUMMY_DESC 0xffffffff diff --git a/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch b/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch new file mode 100644 index 00000000000000..80d729db17ff16 --- /dev/null +++ b/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch @@ -0,0 +1,292 @@ +From ab817f559d505329d8a413c7d29250f6d87d77a0 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 7 Mar 2023 15:55:47 +0000 +Subject: [PATCH 4/7] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V3 capability + bit + +Introduce MTK_NETSYS_V3 bit in the device capabilities. +This is a preliminary patch to introduce support for MT7988 SoC. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 115 ++++++++++++++++---- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 44 +++++++- + 2 files changed, 134 insertions(+), 25 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -880,17 +880,32 @@ void mtk_stats_update_mac(struct mtk_mac + mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x20 + offs); + hw_stats->rx_flow_control_packets += + mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x24 + offs); +- hw_stats->tx_skip += +- mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x28 + offs); +- hw_stats->tx_collisions += +- mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x2c + offs); +- hw_stats->tx_bytes += +- mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x30 + offs); +- stats = mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x34 + offs); +- if (stats) +- hw_stats->tx_bytes += (stats << 32); +- hw_stats->tx_packets += +- mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x38 + offs); ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ hw_stats->tx_skip += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x50 + offs); ++ hw_stats->tx_collisions += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x54 + offs); ++ hw_stats->tx_bytes += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x40 + offs); ++ stats = mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x44 + offs); ++ if (stats) ++ hw_stats->tx_bytes += (stats << 32); ++ hw_stats->tx_packets += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x48 + offs); ++ } else { ++ hw_stats->tx_skip += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x28 + offs); ++ hw_stats->tx_collisions += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x2c + offs); ++ hw_stats->tx_bytes += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x30 + offs); ++ stats = mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x34 + offs); ++ if (stats) ++ hw_stats->tx_bytes += (stats << 32); ++ hw_stats->tx_packets += ++ mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x38 + offs); ++ } + } + + u64_stats_update_end(&hw_stats->syncp); +@@ -1192,7 +1207,10 @@ static void mtk_tx_set_dma_desc_v2(struc + data |= TX_DMA_LS0; + WRITE_ONCE(desc->txd3, data); + +- data = (mac->id + 1) << TX_DMA_FPORT_SHIFT_V2; /* forward port */ ++ if (mac->id == MTK_GMAC3_ID) ++ data = PSE_GDM3_PORT; ++ else ++ data = (mac->id + 1) << TX_DMA_FPORT_SHIFT_V2; /* forward port */ + data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid); + WRITE_ONCE(desc->txd4, data); + +@@ -1203,6 +1221,9 @@ static void mtk_tx_set_dma_desc_v2(struc + /* tx checksum offload */ + if (info->csum) + data |= TX_DMA_CHKSUM_V2; ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && ++ netdev_uses_dsa(dev)) ++ data |= TX_DMA_SPTAG_V3; + } + WRITE_ONCE(desc->txd5, data); + +@@ -1268,8 +1289,13 @@ static int mtk_tx_map(struct sk_buff *sk + mtk_tx_set_dma_desc(dev, itxd, &txd_info); + + itx_buf->flags |= MTK_TX_FLAGS_SINGLE0; +- itx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 : +- MTK_TX_FLAGS_FPORT1; ++ if (mac->id == MTK_GMAC1_ID) ++ itx_buf->flags |= MTK_TX_FLAGS_FPORT0; ++ else if (mac->id == MTK_GMAC2_ID) ++ itx_buf->flags |= MTK_TX_FLAGS_FPORT1; ++ else ++ itx_buf->flags |= MTK_TX_FLAGS_FPORT2; ++ + setup_tx_buf(eth, itx_buf, itxd_pdma, txd_info.addr, txd_info.size, + k++); + +@@ -1317,8 +1343,13 @@ static int mtk_tx_map(struct sk_buff *sk + memset(tx_buf, 0, sizeof(*tx_buf)); + tx_buf->data = (void *)MTK_DMA_DUMMY_DESC; + tx_buf->flags |= MTK_TX_FLAGS_PAGE0; +- tx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 : +- MTK_TX_FLAGS_FPORT1; ++ ++ if (mac->id == MTK_GMAC1_ID) ++ tx_buf->flags |= MTK_TX_FLAGS_FPORT0; ++ else if (mac->id == MTK_GMAC2_ID) ++ tx_buf->flags |= MTK_TX_FLAGS_FPORT1; ++ else ++ tx_buf->flags |= MTK_TX_FLAGS_FPORT2; + + setup_tx_buf(eth, tx_buf, txd_pdma, txd_info.addr, + txd_info.size, k++); +@@ -1902,11 +1933,24 @@ static int mtk_poll_rx(struct napi_struc + break; + + /* find out which mac the packet come from. values start at 1 */ +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) +- mac = RX_DMA_GET_SPORT_V2(trxd.rxd5) - 1; +- else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && +- !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { ++ u32 val = RX_DMA_GET_SPORT_V2(trxd.rxd5); ++ ++ switch (val) { ++ case PSE_GDM1_PORT: ++ case PSE_GDM2_PORT: ++ mac = val - 1; ++ break; ++ case PSE_GDM3_PORT: ++ mac = MTK_GMAC3_ID; ++ break; ++ default: ++ break; ++ } ++ } else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && ++ !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) { + mac = RX_DMA_GET_SPORT(trxd.rxd4) - 1; ++ } + + if (unlikely(mac < 0 || mac >= eth->soc->num_devs || + !eth->netdev[mac])) +@@ -2135,7 +2179,9 @@ static int mtk_poll_tx_qdma(struct mtk_e + tx_buf = mtk_desc_to_tx_buf(ring, desc, + eth->soc->txrx.txd_size); + if (tx_buf->flags & MTK_TX_FLAGS_FPORT1) +- mac = 1; ++ mac = MTK_GMAC2_ID; ++ else if (tx_buf->flags & MTK_TX_FLAGS_FPORT2) ++ mac = MTK_GMAC3_ID; + + if (!tx_buf->data) + break; +@@ -3742,7 +3788,26 @@ static int mtk_hw_init(struct mtk_eth *e + mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); + mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ /* PSE should not drop port1, port8 and port9 packets */ ++ mtk_w32(eth, 0x00000302, PSE_DROP_CFG); ++ ++ /* GDM and CDM Threshold */ ++ mtk_w32(eth, 0x00000707, MTK_CDMW0_THRES); ++ mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES); ++ ++ /* Disable GDM1 RX CRC stripping */ ++ val = mtk_r32(eth, MTK_GDMA_FWD_CFG(0)); ++ val &= ~MTK_GDMA_STRP_CRC; ++ mtk_w32(eth, val, MTK_GDMA_FWD_CFG(0)); ++ ++ /* PSE GDM3 MIB counter has incorrect hw default values, ++ * so the driver ought to read clear the values beforehand ++ * in case ethtool retrieve wrong mib values. ++ */ ++ for (i = 0; i < 0x80; i += 0x4) ++ mtk_r32(eth, reg_map->gdm1_cnt + 0x100 + i); ++ } else if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { + /* PSE should not drop port8 and port9 packets from WDMA Tx */ + mtk_w32(eth, 0x00000300, PSE_DROP_CFG); + +@@ -4314,7 +4379,11 @@ static int mtk_add_mac(struct mtk_eth *e + } + spin_lock_init(&mac->hw_stats->stats_lock); + u64_stats_init(&mac->hw_stats->syncp); +- mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET; ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) ++ mac->hw_stats->reg_offset = id * 0x80; ++ else ++ mac->hw_stats->reg_offset = id * 0x40; + + /* phylink create */ + err = of_get_phy_mode(np, &phy_mode); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -121,6 +121,7 @@ + #define MTK_GDMA_ICS_EN BIT(22) + #define MTK_GDMA_TCS_EN BIT(21) + #define MTK_GDMA_UCS_EN BIT(20) ++#define MTK_GDMA_STRP_CRC BIT(16) + #define MTK_GDMA_TO_PDMA 0x0 + #define MTK_GDMA_DROP_ALL 0x7777 + +@@ -286,8 +287,6 @@ + /* QDMA Interrupt grouping registers */ + #define MTK_RLS_DONE_INT BIT(0) + +-#define MTK_STAT_OFFSET 0x40 +- + /* QDMA TX NUM */ + #define QID_BITS_V2(x) (((x) & 0x3f) << 16) + #define MTK_QDMA_GMAC2_QID 8 +@@ -300,6 +299,8 @@ + #define TX_DMA_CHKSUM_V2 (0x7 << 28) + #define TX_DMA_TSO_V2 BIT(31) + ++#define TX_DMA_SPTAG_V3 BIT(27) ++ + /* QDMA V2 descriptor txd4 */ + #define TX_DMA_FPORT_SHIFT_V2 8 + #define TX_DMA_FPORT_MASK_V2 0xf +@@ -636,6 +637,7 @@ enum mtk_tx_flags { + */ + MTK_TX_FLAGS_FPORT0 = 0x04, + MTK_TX_FLAGS_FPORT1 = 0x08, ++ MTK_TX_FLAGS_FPORT2 = 0x10, + }; + + /* This enum allows us to identify how the clock is defined on the array of the +@@ -721,6 +723,42 @@ enum mtk_dev_state { + MTK_RESETTING + }; + ++/* PSE Port Definition */ ++enum mtk_pse_port { ++ PSE_ADMA_PORT = 0, ++ PSE_GDM1_PORT, ++ PSE_GDM2_PORT, ++ PSE_PPE0_PORT, ++ PSE_PPE1_PORT, ++ PSE_QDMA_TX_PORT, ++ PSE_QDMA_RX_PORT, ++ PSE_DROP_PORT, ++ PSE_WDMA0_PORT, ++ PSE_WDMA1_PORT, ++ PSE_TDMA_PORT, ++ PSE_NONE_PORT, ++ PSE_PPE2_PORT, ++ PSE_WDMA2_PORT, ++ PSE_EIP197_PORT, ++ PSE_GDM3_PORT, ++ PSE_PORT_MAX ++}; ++ ++/* GMAC Identifier */ ++enum mtk_gmac_id { ++ MTK_GMAC1_ID = 0, ++ MTK_GMAC2_ID, ++ MTK_GMAC3_ID, ++ MTK_GMAC_ID_MAX ++}; ++ ++/* GDM Type */ ++enum mtk_gdm_type { ++ MTK_GDM_TYPE = 0, ++ MTK_XGDM_TYPE, ++ MTK_GDM_TYPE_MAX ++}; ++ + enum mtk_tx_buf_type { + MTK_TYPE_SKB, + MTK_TYPE_XDP_TX, +@@ -817,6 +855,7 @@ enum mkt_eth_capabilities { + MTK_QDMA_BIT, + MTK_NETSYS_V1_BIT, + MTK_NETSYS_V2_BIT, ++ MTK_NETSYS_V3_BIT, + MTK_SOC_MT7628_BIT, + MTK_RSTCTRL_PPE1_BIT, + MTK_U3_COPHY_V2_BIT, +@@ -853,6 +892,7 @@ enum mkt_eth_capabilities { + #define MTK_QDMA BIT(MTK_QDMA_BIT) + #define MTK_NETSYS_V1 BIT(MTK_NETSYS_V1_BIT) + #define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) ++#define MTK_NETSYS_V3 BIT(MTK_NETSYS_V3_BIT) + #define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) + #define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) + #define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) diff --git a/target/linux/generic/pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch b/target/linux/generic/pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch new file mode 100644 index 00000000000000..bd26cca305dbd0 --- /dev/null +++ b/target/linux/generic/pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch @@ -0,0 +1,197 @@ +From 45b575fd9e6a455090820248bf1b98b1f2c7b6c8 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 7 Mar 2023 15:56:00 +0000 +Subject: [PATCH 5/7] net: ethernet: mtk_eth_soc: convert caps in mtk_soc_data + struct to u64 + +This is a preliminary patch to introduce support for MT7988 SoC. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/mtk_eth_path.c | 22 +++---- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 62 ++++++++++---------- + 2 files changed, 42 insertions(+), 42 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_path.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c +@@ -15,10 +15,10 @@ + struct mtk_eth_muxc { + const char *name; + int cap_bit; +- int (*set_path)(struct mtk_eth *eth, int path); ++ int (*set_path)(struct mtk_eth *eth, u64 path); + }; + +-static const char *mtk_eth_path_name(int path) ++static const char *mtk_eth_path_name(u64 path) + { + switch (path) { + case MTK_ETH_PATH_GMAC1_RGMII: +@@ -40,7 +40,7 @@ static const char *mtk_eth_path_name(int + } + } + +-static int set_mux_gdm1_to_gmac1_esw(struct mtk_eth *eth, int path) ++static int set_mux_gdm1_to_gmac1_esw(struct mtk_eth *eth, u64 path) + { + bool updated = true; + u32 val, mask, set; +@@ -71,7 +71,7 @@ static int set_mux_gdm1_to_gmac1_esw(str + return 0; + } + +-static int set_mux_gmac2_gmac0_to_gephy(struct mtk_eth *eth, int path) ++static int set_mux_gmac2_gmac0_to_gephy(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0; + bool updated = true; +@@ -94,7 +94,7 @@ static int set_mux_gmac2_gmac0_to_gephy( + return 0; + } + +-static int set_mux_u3_gmac2_to_qphy(struct mtk_eth *eth, int path) ++static int set_mux_u3_gmac2_to_qphy(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0, mask = 0, reg = 0; + bool updated = true; +@@ -125,7 +125,7 @@ static int set_mux_u3_gmac2_to_qphy(stru + return 0; + } + +-static int set_mux_gmac1_gmac2_to_sgmii_rgmii(struct mtk_eth *eth, int path) ++static int set_mux_gmac1_gmac2_to_sgmii_rgmii(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0; + bool updated = true; +@@ -163,7 +163,7 @@ static int set_mux_gmac1_gmac2_to_sgmii_ + return 0; + } + +-static int set_mux_gmac12_to_gephy_sgmii(struct mtk_eth *eth, int path) ++static int set_mux_gmac12_to_gephy_sgmii(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0; + bool updated = true; +@@ -218,7 +218,7 @@ static const struct mtk_eth_muxc mtk_eth + }, + }; + +-static int mtk_eth_mux_setup(struct mtk_eth *eth, int path) ++static int mtk_eth_mux_setup(struct mtk_eth *eth, u64 path) + { + int i, err = 0; + +@@ -249,7 +249,7 @@ out: + + int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id) + { +- int path; ++ u64 path; + + path = (mac_id == 0) ? MTK_ETH_PATH_GMAC1_SGMII : + MTK_ETH_PATH_GMAC2_SGMII; +@@ -260,7 +260,7 @@ int mtk_gmac_sgmii_path_setup(struct mtk + + int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id) + { +- int path = 0; ++ u64 path = 0; + + if (mac_id == 1) + path = MTK_ETH_PATH_GMAC2_GEPHY; +@@ -274,7 +274,7 @@ int mtk_gmac_gephy_path_setup(struct mtk + + int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id) + { +- int path; ++ u64 path; + + path = (mac_id == 0) ? MTK_ETH_PATH_GMAC1_RGMII : + MTK_ETH_PATH_GMAC2_RGMII; +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -878,44 +878,44 @@ enum mkt_eth_capabilities { + }; + + /* Supported hardware group on SoCs */ +-#define MTK_RGMII BIT(MTK_RGMII_BIT) +-#define MTK_TRGMII BIT(MTK_TRGMII_BIT) +-#define MTK_SGMII BIT(MTK_SGMII_BIT) +-#define MTK_ESW BIT(MTK_ESW_BIT) +-#define MTK_GEPHY BIT(MTK_GEPHY_BIT) +-#define MTK_MUX BIT(MTK_MUX_BIT) +-#define MTK_INFRA BIT(MTK_INFRA_BIT) +-#define MTK_SHARED_SGMII BIT(MTK_SHARED_SGMII_BIT) +-#define MTK_HWLRO BIT(MTK_HWLRO_BIT) +-#define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT) +-#define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT) +-#define MTK_QDMA BIT(MTK_QDMA_BIT) +-#define MTK_NETSYS_V1 BIT(MTK_NETSYS_V1_BIT) +-#define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) +-#define MTK_NETSYS_V3 BIT(MTK_NETSYS_V3_BIT) +-#define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) +-#define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) +-#define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) ++#define MTK_RGMII BIT_ULL(MTK_RGMII_BIT) ++#define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT) ++#define MTK_SGMII BIT_ULL(MTK_SGMII_BIT) ++#define MTK_ESW BIT_ULL(MTK_ESW_BIT) ++#define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT) ++#define MTK_MUX BIT_ULL(MTK_MUX_BIT) ++#define MTK_INFRA BIT_ULL(MTK_INFRA_BIT) ++#define MTK_SHARED_SGMII BIT_ULL(MTK_SHARED_SGMII_BIT) ++#define MTK_HWLRO BIT_ULL(MTK_HWLRO_BIT) ++#define MTK_SHARED_INT BIT_ULL(MTK_SHARED_INT_BIT) ++#define MTK_TRGMII_MT7621_CLK BIT_ULL(MTK_TRGMII_MT7621_CLK_BIT) ++#define MTK_QDMA BIT_ULL(MTK_QDMA_BIT) ++#define MTK_NETSYS_V1 BIT_ULL(MTK_NETSYS_V1_BIT) ++#define MTK_NETSYS_V2 BIT_ULL(MTK_NETSYS_V2_BIT) ++#define MTK_NETSYS_V3 BIT_ULL(MTK_NETSYS_V3_BIT) ++#define MTK_SOC_MT7628 BIT_ULL(MTK_SOC_MT7628_BIT) ++#define MTK_RSTCTRL_PPE1 BIT_ULL(MTK_RSTCTRL_PPE1_BIT) ++#define MTK_U3_COPHY_V2 BIT_ULL(MTK_U3_COPHY_V2_BIT) + + #define MTK_ETH_MUX_GDM1_TO_GMAC1_ESW \ +- BIT(MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT) ++ BIT_ULL(MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT) + #define MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY \ +- BIT(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT) ++ BIT_ULL(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT) + #define MTK_ETH_MUX_U3_GMAC2_TO_QPHY \ +- BIT(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT) ++ BIT_ULL(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT) + #define MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII \ +- BIT(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) ++ BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) + #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \ +- BIT(MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT) ++ BIT_ULL(MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT) + + /* Supported path present on SoCs */ +-#define MTK_ETH_PATH_GMAC1_RGMII BIT(MTK_ETH_PATH_GMAC1_RGMII_BIT) +-#define MTK_ETH_PATH_GMAC1_TRGMII BIT(MTK_ETH_PATH_GMAC1_TRGMII_BIT) +-#define MTK_ETH_PATH_GMAC1_SGMII BIT(MTK_ETH_PATH_GMAC1_SGMII_BIT) +-#define MTK_ETH_PATH_GMAC2_RGMII BIT(MTK_ETH_PATH_GMAC2_RGMII_BIT) +-#define MTK_ETH_PATH_GMAC2_SGMII BIT(MTK_ETH_PATH_GMAC2_SGMII_BIT) +-#define MTK_ETH_PATH_GMAC2_GEPHY BIT(MTK_ETH_PATH_GMAC2_GEPHY_BIT) +-#define MTK_ETH_PATH_GDM1_ESW BIT(MTK_ETH_PATH_GDM1_ESW_BIT) ++#define MTK_ETH_PATH_GMAC1_RGMII BIT_ULL(MTK_ETH_PATH_GMAC1_RGMII_BIT) ++#define MTK_ETH_PATH_GMAC1_TRGMII BIT_ULL(MTK_ETH_PATH_GMAC1_TRGMII_BIT) ++#define MTK_ETH_PATH_GMAC1_SGMII BIT_ULL(MTK_ETH_PATH_GMAC1_SGMII_BIT) ++#define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT) ++#define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT) ++#define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT) ++#define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT) + + #define MTK_GMAC1_RGMII (MTK_ETH_PATH_GMAC1_RGMII | MTK_RGMII) + #define MTK_GMAC1_TRGMII (MTK_ETH_PATH_GMAC1_TRGMII | MTK_TRGMII) +@@ -1071,7 +1071,7 @@ struct mtk_reg_map { + struct mtk_soc_data { + const struct mtk_reg_map *reg_map; + u32 ana_rgc3; +- u32 caps; ++ u64 caps; + u32 required_clks; + bool required_pctl; + u8 offload_version; diff --git a/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch b/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch new file mode 100644 index 00000000000000..504d2ea22664d6 --- /dev/null +++ b/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch @@ -0,0 +1,495 @@ +From 661bacf4363ca68939c15e20056b5f72fbd034e7 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Sat, 25 Feb 2023 00:08:24 +0100 +Subject: [PATCH 6/7] net: ethernet: mtk_eth_soc: add support for MT7988 SoC + +Introduce support for ethernet chip available in MT7988 SoC to +mtk_eth_soc driver. +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 153 ++++++++++++++-- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 193 ++++++++++++++------ + 2 files changed, 279 insertions(+), 67 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -152,6 +152,54 @@ static const struct mtk_reg_map mt7986_r + .pse_oq_sta = 0x01a0, + }; + ++static const struct mtk_reg_map mt7988_reg_map = { ++ .tx_irq_mask = 0x461c, ++ .tx_irq_status = 0x4618, ++ .pdma = { ++ .rx_ptr = 0x6900, ++ .rx_cnt_cfg = 0x6904, ++ .pcrx_ptr = 0x6908, ++ .glo_cfg = 0x6a04, ++ .rst_idx = 0x6a08, ++ .delay_irq = 0x6a0c, ++ .irq_status = 0x6a20, ++ .irq_mask = 0x6a28, ++ .adma_rx_dbg0 = 0x6a38, ++ .int_grp = 0x6a50, ++ }, ++ .qdma = { ++ .qtx_cfg = 0x4400, ++ .qtx_sch = 0x4404, ++ .rx_ptr = 0x4500, ++ .rx_cnt_cfg = 0x4504, ++ .qcrx_ptr = 0x4508, ++ .glo_cfg = 0x4604, ++ .rst_idx = 0x4608, ++ .delay_irq = 0x460c, ++ .fc_th = 0x4610, ++ .int_grp = 0x4620, ++ .hred = 0x4644, ++ .ctx_ptr = 0x4700, ++ .dtx_ptr = 0x4704, ++ .crx_ptr = 0x4710, ++ .drx_ptr = 0x4714, ++ .fq_head = 0x4720, ++ .fq_tail = 0x4724, ++ .fq_count = 0x4728, ++ .fq_blen = 0x472c, ++ .tx_sch_rate = 0x4798, ++ }, ++ .gdm1_cnt = 0x1c00, ++ .gdma_to_ppe0 = 0x3333, ++ .ppe_base = 0x2200, ++ .wdma_base = { ++ [0] = 0x4800, ++ [1] = 0x4c00, ++ }, ++ .pse_iq_sta = 0x0180, ++ .pse_oq_sta = 0x01a0, ++}; ++ + /* strings used by ethtool */ + static const struct mtk_ethtool_stats { + char str[ETH_GSTRING_LEN]; +@@ -179,10 +227,54 @@ static const struct mtk_ethtool_stats { + }; + + static const char * const mtk_clks_source_name[] = { +- "ethif", "sgmiitop", "esw", "gp0", "gp1", "gp2", "fe", "trgpll", +- "sgmii_tx250m", "sgmii_rx250m", "sgmii_cdr_ref", "sgmii_cdr_fb", +- "sgmii2_tx250m", "sgmii2_rx250m", "sgmii2_cdr_ref", "sgmii2_cdr_fb", +- "sgmii_ck", "eth2pll", "wocpu0", "wocpu1", "netsys0", "netsys1" ++ "ethif", ++ "sgmiitop", ++ "esw", ++ "gp0", ++ "gp1", ++ "gp2", ++ "gp3", ++ "xgp1", ++ "xgp2", ++ "xgp3", ++ "crypto", ++ "fe", ++ "trgpll", ++ "sgmii_tx250m", ++ "sgmii_rx250m", ++ "sgmii_cdr_ref", ++ "sgmii_cdr_fb", ++ "sgmii2_tx250m", ++ "sgmii2_rx250m", ++ "sgmii2_cdr_ref", ++ "sgmii2_cdr_fb", ++ "sgmii_ck", ++ "eth2pll", ++ "wocpu0", ++ "wocpu1", ++ "netsys0", ++ "netsys1", ++ "ethwarp_wocpu2", ++ "ethwarp_wocpu1", ++ "ethwarp_wocpu0", ++ "top_usxgmii0_sel", ++ "top_usxgmii1_sel", ++ "top_sgm0_sel", ++ "top_sgm1_sel", ++ "top_xfi_phy0_xtal_sel", ++ "top_xfi_phy1_xtal_sel", ++ "top_eth_gmii_sel", ++ "top_eth_refck_50m_sel", ++ "top_eth_sys_200m_sel", ++ "top_eth_sys_sel", ++ "top_eth_xgmii_sel", ++ "top_eth_mii_sel", ++ "top_netsys_sel", ++ "top_netsys_500m_sel", ++ "top_netsys_pao_2x_sel", ++ "top_netsys_sync_250m_sel", ++ "top_netsys_ppefb_250m_sel", ++ "top_netsys_warp_sel", + }; + + void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) +@@ -1207,10 +1299,19 @@ static void mtk_tx_set_dma_desc_v2(struc + data |= TX_DMA_LS0; + WRITE_ONCE(desc->txd3, data); + +- if (mac->id == MTK_GMAC3_ID) +- data = PSE_GDM3_PORT; +- else +- data = (mac->id + 1) << TX_DMA_FPORT_SHIFT_V2; /* forward port */ ++ /* set forward port */ ++ switch (mac->id) { ++ case MTK_GMAC1_ID: ++ data = PSE_GDM1_PORT << TX_DMA_FPORT_SHIFT_V2; ++ break; ++ case MTK_GMAC2_ID: ++ data = PSE_GDM2_PORT << TX_DMA_FPORT_SHIFT_V2; ++ break; ++ case MTK_GMAC3_ID: ++ data = PSE_GDM3_PORT << TX_DMA_FPORT_SHIFT_V2; ++ break; ++ } ++ + data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid); + WRITE_ONCE(desc->txd4, data); + +@@ -4964,6 +5065,25 @@ static const struct mtk_soc_data mt7986_ + }, + }; + ++static const struct mtk_soc_data mt7988_data = { ++ .reg_map = &mt7988_reg_map, ++ .ana_rgc3 = 0x128, ++ .caps = MT7988_CAPS, ++ .hw_features = MTK_HW_FEATURES, ++ .required_clks = MT7988_CLKS_BITMAP, ++ .required_pctl = false, ++ .num_devs = 3, ++ .txrx = { ++ .txd_size = sizeof(struct mtk_tx_dma_v2), ++ .rxd_size = sizeof(struct mtk_rx_dma_v2), ++ .rx_irq_done_mask = MTK_RX_DONE_INT_V2, ++ .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, ++ .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, ++ .dma_len_offset = 8, ++ }, ++}; ++ ++ + static const struct mtk_soc_data rt5350_data = { + .reg_map = &mt7628_reg_map, + .caps = MT7628_CAPS, +@@ -4982,14 +5102,15 @@ static const struct mtk_soc_data rt5350_ + }; + + const struct of_device_id of_mtk_match[] = { +- { .compatible = "mediatek,mt2701-eth", .data = &mt2701_data}, +- { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data}, +- { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, +- { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, +- { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, +- { .compatible = "mediatek,mt7981-eth", .data = &mt7981_data}, +- { .compatible = "mediatek,mt7986-eth", .data = &mt7986_data}, +- { .compatible = "ralink,rt5350-eth", .data = &rt5350_data}, ++ { .compatible = "mediatek,mt2701-eth", .data = &mt2701_data }, ++ { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data }, ++ { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data }, ++ { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data }, ++ { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data }, ++ { .compatible = "mediatek,mt7981-eth", .data = &mt7981_data }, ++ { .compatible = "mediatek,mt7986-eth", .data = &mt7986_data }, ++ { .compatible = "mediatek,mt7988-eth", .data = &mt7988_data }, ++ { .compatible = "ralink,rt5350-eth", .data = &rt5350_data }, + {}, + }; + MODULE_DEVICE_TABLE(of, of_mtk_match); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -116,7 +116,8 @@ + #define MTK_CDMP_EG_CTRL 0x404 + + /* GDM Exgress Control Register */ +-#define MTK_GDMA_FWD_CFG(x) (0x500 + (x * 0x1000)) ++#define MTK_GDMA_FWD_CFG(x) ((x == MTK_GMAC3_ID) ? \ ++ 0x540 : 0x500 + (x * 0x1000)) + #define MTK_GDMA_SPECIAL_TAG BIT(24) + #define MTK_GDMA_ICS_EN BIT(22) + #define MTK_GDMA_TCS_EN BIT(21) +@@ -650,6 +651,11 @@ enum mtk_clks_map { + MTK_CLK_GP0, + MTK_CLK_GP1, + MTK_CLK_GP2, ++ MTK_CLK_GP3, ++ MTK_CLK_XGP1, ++ MTK_CLK_XGP2, ++ MTK_CLK_XGP3, ++ MTK_CLK_CRYPTO, + MTK_CLK_FE, + MTK_CLK_TRGPLL, + MTK_CLK_SGMII_TX_250M, +@@ -666,57 +672,108 @@ enum mtk_clks_map { + MTK_CLK_WOCPU1, + MTK_CLK_NETSYS0, + MTK_CLK_NETSYS1, ++ MTK_CLK_ETHWARP_WOCPU2, ++ MTK_CLK_ETHWARP_WOCPU1, ++ MTK_CLK_ETHWARP_WOCPU0, ++ MTK_CLK_TOP_USXGMII_SBUS_0_SEL, ++ MTK_CLK_TOP_USXGMII_SBUS_1_SEL, ++ MTK_CLK_TOP_SGM_0_SEL, ++ MTK_CLK_TOP_SGM_1_SEL, ++ MTK_CLK_TOP_XFI_PHY_0_XTAL_SEL, ++ MTK_CLK_TOP_XFI_PHY_1_XTAL_SEL, ++ MTK_CLK_TOP_ETH_GMII_SEL, ++ MTK_CLK_TOP_ETH_REFCK_50M_SEL, ++ MTK_CLK_TOP_ETH_SYS_200M_SEL, ++ MTK_CLK_TOP_ETH_SYS_SEL, ++ MTK_CLK_TOP_ETH_XGMII_SEL, ++ MTK_CLK_TOP_ETH_MII_SEL, ++ MTK_CLK_TOP_NETSYS_SEL, ++ MTK_CLK_TOP_NETSYS_500M_SEL, ++ MTK_CLK_TOP_NETSYS_PAO_2X_SEL, ++ MTK_CLK_TOP_NETSYS_SYNC_250M_SEL, ++ MTK_CLK_TOP_NETSYS_PPEFB_250M_SEL, ++ MTK_CLK_TOP_NETSYS_WARP_SEL, + MTK_CLK_MAX + }; + +-#define MT7623_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ +- BIT(MTK_CLK_GP1) | BIT(MTK_CLK_GP2) | \ +- BIT(MTK_CLK_TRGPLL)) +-#define MT7622_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ +- BIT(MTK_CLK_GP0) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_GP2) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII_CK) | \ +- BIT(MTK_CLK_ETH2PLL)) ++#define MT7623_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP1) | BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_TRGPLL)) ++#define MT7622_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP0) | BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII_CK) | \ ++ BIT_ULL(MTK_CLK_ETH2PLL)) + #define MT7621_CLKS_BITMAP (0) + #define MT7628_CLKS_BITMAP (0) +-#define MT7629_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ +- BIT(MTK_CLK_GP0) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_GP2) | BIT(MTK_CLK_FE) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII2_TX_250M) | \ +- BIT(MTK_CLK_SGMII2_RX_250M) | \ +- BIT(MTK_CLK_SGMII2_CDR_REF) | \ +- BIT(MTK_CLK_SGMII2_CDR_FB) | \ +- BIT(MTK_CLK_SGMII_CK) | \ +- BIT(MTK_CLK_ETH2PLL) | BIT(MTK_CLK_SGMIITOP)) +-#define MT7981_CLKS_BITMAP (BIT(MTK_CLK_FE) | BIT(MTK_CLK_GP2) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_WOCPU0) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII2_TX_250M) | \ +- BIT(MTK_CLK_SGMII2_RX_250M) | \ +- BIT(MTK_CLK_SGMII2_CDR_REF) | \ +- BIT(MTK_CLK_SGMII2_CDR_FB) | \ +- BIT(MTK_CLK_SGMII_CK)) +-#define MT7986_CLKS_BITMAP (BIT(MTK_CLK_FE) | BIT(MTK_CLK_GP2) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_WOCPU1) | BIT(MTK_CLK_WOCPU0) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII2_TX_250M) | \ +- BIT(MTK_CLK_SGMII2_RX_250M) | \ +- BIT(MTK_CLK_SGMII2_CDR_REF) | \ +- BIT(MTK_CLK_SGMII2_CDR_FB)) ++#define MT7629_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP0) | BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_GP2) | BIT_ULL(MTK_CLK_FE) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII_CK) | \ ++ BIT_ULL(MTK_CLK_ETH2PLL) | BIT_ULL(MTK_CLK_SGMIITOP)) ++#define MT7981_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_GP2) | BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_WOCPU0) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII_CK)) ++#define MT7986_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_GP2) | BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_WOCPU1) | BIT_ULL(MTK_CLK_WOCPU0) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_FB)) ++#define MT7988_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP1) | BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_GP3) | BIT_ULL(MTK_CLK_XGP1) | \ ++ BIT_ULL(MTK_CLK_XGP2) | BIT_ULL(MTK_CLK_XGP3) | \ ++ BIT_ULL(MTK_CLK_CRYPTO) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_ETHWARP_WOCPU2) | \ ++ BIT_ULL(MTK_CLK_ETHWARP_WOCPU1) | \ ++ BIT_ULL(MTK_CLK_ETHWARP_WOCPU0) | \ ++ BIT_ULL(MTK_CLK_TOP_USXGMII_SBUS_0_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_USXGMII_SBUS_1_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_SGM_0_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_SGM_1_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_XFI_PHY_0_XTAL_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_XFI_PHY_1_XTAL_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_GMII_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_REFCK_50M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_SYS_200M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_SYS_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_XGMII_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_MII_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_500M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_PAO_2X_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_SYNC_250M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_PPEFB_250M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_WARP_SEL)) + + enum mtk_dev_state { + MTK_HW_INIT, +@@ -844,6 +901,7 @@ enum mkt_eth_capabilities { + MTK_RGMII_BIT = 0, + MTK_TRGMII_BIT, + MTK_SGMII_BIT, ++ MTK_USXGMII_BIT, + MTK_ESW_BIT, + MTK_GEPHY_BIT, + MTK_MUX_BIT, +@@ -866,6 +924,8 @@ enum mkt_eth_capabilities { + MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT, + MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT, + MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT, ++ MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT, ++ MTK_ETH_MUX_GMAC123_TO_USXGMII_BIT, + + /* PATH BITS */ + MTK_ETH_PATH_GMAC1_RGMII_BIT, +@@ -874,13 +934,18 @@ enum mkt_eth_capabilities { + MTK_ETH_PATH_GMAC2_RGMII_BIT, + MTK_ETH_PATH_GMAC2_SGMII_BIT, + MTK_ETH_PATH_GMAC2_GEPHY_BIT, ++ MTK_ETH_PATH_GMAC3_SGMII_BIT, + MTK_ETH_PATH_GDM1_ESW_BIT, ++ MTK_ETH_PATH_GMAC1_USXGMII_BIT, ++ MTK_ETH_PATH_GMAC2_USXGMII_BIT, ++ MTK_ETH_PATH_GMAC3_USXGMII_BIT, + }; + + /* Supported hardware group on SoCs */ + #define MTK_RGMII BIT_ULL(MTK_RGMII_BIT) + #define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT) + #define MTK_SGMII BIT_ULL(MTK_SGMII_BIT) ++#define MTK_USXGMII BIT_ULL(MTK_USXGMII_BIT) + #define MTK_ESW BIT_ULL(MTK_ESW_BIT) + #define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT) + #define MTK_MUX BIT_ULL(MTK_MUX_BIT) +@@ -907,6 +972,10 @@ enum mkt_eth_capabilities { + BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) + #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \ + BIT_ULL(MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT) ++#define MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII \ ++ BIT_ULL(MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT) ++#define MTK_ETH_MUX_GMAC123_TO_USXGMII \ ++ BIT_ULL(MTK_ETH_MUX_GMAC123_TO_USXGMII_BIT) + + /* Supported path present on SoCs */ + #define MTK_ETH_PATH_GMAC1_RGMII BIT_ULL(MTK_ETH_PATH_GMAC1_RGMII_BIT) +@@ -915,7 +984,11 @@ enum mkt_eth_capabilities { + #define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT) + #define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT) + #define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT) ++#define MTK_ETH_PATH_GMAC3_SGMII BIT_ULL(MTK_ETH_PATH_GMAC3_SGMII_BIT) + #define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT) ++#define MTK_ETH_PATH_GMAC1_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC1_USXGMII_BIT) ++#define MTK_ETH_PATH_GMAC2_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC2_USXGMII_BIT) ++#define MTK_ETH_PATH_GMAC3_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC3_USXGMII_BIT) + + #define MTK_GMAC1_RGMII (MTK_ETH_PATH_GMAC1_RGMII | MTK_RGMII) + #define MTK_GMAC1_TRGMII (MTK_ETH_PATH_GMAC1_TRGMII | MTK_TRGMII) +@@ -923,7 +996,11 @@ enum mkt_eth_capabilities { + #define MTK_GMAC2_RGMII (MTK_ETH_PATH_GMAC2_RGMII | MTK_RGMII) + #define MTK_GMAC2_SGMII (MTK_ETH_PATH_GMAC2_SGMII | MTK_SGMII) + #define MTK_GMAC2_GEPHY (MTK_ETH_PATH_GMAC2_GEPHY | MTK_GEPHY) ++#define MTK_GMAC3_SGMII (MTK_ETH_PATH_GMAC3_SGMII | MTK_SGMII) + #define MTK_GDM1_ESW (MTK_ETH_PATH_GDM1_ESW | MTK_ESW) ++#define MTK_GMAC1_USXGMII (MTK_ETH_PATH_GMAC1_USXGMII | MTK_USXGMII) ++#define MTK_GMAC2_USXGMII (MTK_ETH_PATH_GMAC2_USXGMII | MTK_USXGMII) ++#define MTK_GMAC3_USXGMII (MTK_ETH_PATH_GMAC3_USXGMII | MTK_USXGMII) + + /* MUXes present on SoCs */ + /* 0: GDM1 -> GMAC1, 1: GDM1 -> ESW */ +@@ -946,6 +1023,12 @@ enum mkt_eth_capabilities { + #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ + (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) + ++#define MTK_MUX_GMAC123_TO_GEPHY_SGMII \ ++ (MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII | MTK_MUX) ++ ++#define MTK_MUX_GMAC123_TO_USXGMII \ ++ (MTK_ETH_MUX_GMAC123_TO_USXGMII | MTK_MUX | MTK_INFRA) ++ + #ifdef CONFIG_SOC_MT7621 + #define MTK_CAP_MASK MTK_NETSYS_V2 + #else +@@ -984,9 +1067,17 @@ enum mkt_eth_capabilities { + MTK_MUX_U3_GMAC2_TO_QPHY | MTK_U3_COPHY_V2 | \ + MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) + +-#define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ +- MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ +- MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) ++#define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ ++ MTK_MUX_GMAC12_TO_GEPHY_SGMII | \ ++ MTK_QDMA | MTK_NETSYS_V2 | \ ++ MTK_RSTCTRL_PPE1) ++ ++#define MT7988_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ ++ MTK_GMAC3_SGMII | MTK_QDMA | \ ++ MTK_MUX_GMAC123_TO_GEPHY_SGMII | \ ++ MTK_NETSYS_V3 | MTK_RSTCTRL_PPE1 | \ ++ MTK_GMAC1_USXGMII | MTK_GMAC2_USXGMII | \ ++ MTK_GMAC3_USXGMII | MTK_MUX_GMAC123_TO_USXGMII) + + struct mtk_tx_dma_desc_info { + dma_addr_t addr; +@@ -1072,7 +1163,7 @@ struct mtk_soc_data { + const struct mtk_reg_map *reg_map; + u32 ana_rgc3; + u64 caps; +- u32 required_clks; ++ u64 required_clks; + bool required_pctl; + u8 offload_version; + u8 hash_offset; diff --git a/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch new file mode 100644 index 00000000000000..68170b6614b8e2 --- /dev/null +++ b/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -0,0 +1,1671 @@ +From 20ac14fedba025b6b336a821ea60660afe2d46cd Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 1 Mar 2023 11:56:04 +0000 +Subject: [PATCH 7/7] net: ethernet: mtk_eth_soc: add paths and SerDes modes + for MT7988 + +MT7988 comes with a built-in 2.5G PHY as well as USXGMII or 10Base-KR +compatible SerDes lanes for external PHYs. +Add support for configuring the MAC and SerDes parts for the new paths. + +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/Makefile | 2 +- + drivers/net/ethernet/mediatek/mtk_eth_path.c | 154 ++++- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 291 +++++++- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 162 ++++- + drivers/net/ethernet/mediatek/mtk_usxgmii.c | 659 +++++++++++++++++++ + 5 files changed, 1236 insertions(+), 32 deletions(-) + create mode 100644 drivers/net/ethernet/mediatek/mtk_usxgmii.c + +--- a/drivers/net/ethernet/mediatek/Makefile ++++ b/drivers/net/ethernet/mediatek/Makefile +@@ -5,6 +5,7 @@ + + obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o + mtk_eth-y := mtk_eth_soc.o mtk_eth_path.o mtk_ppe.o mtk_ppe_debugfs.o mtk_ppe_offload.o ++mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_USXGMII) += mtk_usxgmii.o + mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed.o mtk_wed_mcu.o mtk_wed_wo.o + ifdef CONFIG_DEBUG_FS + mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_debugfs.o +--- a/drivers/net/ethernet/mediatek/mtk_eth_path.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c +@@ -31,10 +31,20 @@ static const char *mtk_eth_path_name(u64 + return "gmac2_rgmii"; + case MTK_ETH_PATH_GMAC2_SGMII: + return "gmac2_sgmii"; ++ case MTK_ETH_PATH_GMAC2_2P5GPHY: ++ return "gmac2_2p5gphy"; + case MTK_ETH_PATH_GMAC2_GEPHY: + return "gmac2_gephy"; ++ case MTK_ETH_PATH_GMAC3_SGMII: ++ return "gmac3_sgmii"; + case MTK_ETH_PATH_GDM1_ESW: + return "gdm1_esw"; ++ case MTK_ETH_PATH_GMAC1_USXGMII: ++ return "gmac1_usxgmii"; ++ case MTK_ETH_PATH_GMAC2_USXGMII: ++ return "gmac2_usxgmii"; ++ case MTK_ETH_PATH_GMAC3_USXGMII: ++ return "gmac3_usxgmii"; + default: + return "unknown path"; + } +@@ -42,8 +52,8 @@ static const char *mtk_eth_path_name(u64 + + static int set_mux_gdm1_to_gmac1_esw(struct mtk_eth *eth, u64 path) + { ++ u32 val, mask, set, reg; + bool updated = true; +- u32 val, mask, set; + + switch (path) { + case MTK_ETH_PATH_GMAC1_SGMII: +@@ -59,10 +69,15 @@ static int set_mux_gdm1_to_gmac1_esw(str + break; + } + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) ++ reg = MTK_MAC_MISC_V3; ++ else ++ reg = MTK_MAC_MISC; ++ + if (updated) { +- val = mtk_r32(eth, MTK_MAC_MISC); ++ val = mtk_r32(eth, reg); + val = (val & mask) | set; +- mtk_w32(eth, val, MTK_MAC_MISC); ++ mtk_w32(eth, val, reg); + } + + dev_dbg(eth->dev, "path %s in %s updated = %d\n", +@@ -125,6 +140,31 @@ static int set_mux_u3_gmac2_to_qphy(stru + return 0; + } + ++static int set_mux_gmac2_to_2p5gphy(struct mtk_eth *eth, u64 path) ++{ ++ unsigned int val = 0; ++ bool updated = true; ++ int mac_id = 0; ++ ++ regmap_read(eth->ethsys, ETHSYS_SYSCFG0, &val); ++ ++ switch (path) { ++ case MTK_ETH_PATH_GMAC2_2P5GPHY: ++ val &= ~(u32)SYSCFG0_SGMII_GMAC2_V2; ++ mac_id = MTK_GMAC2_ID; ++ break; ++ default: ++ updated = false; ++ break; ++ }; ++ ++ if (updated) ++ regmap_update_bits(eth->ethsys, ETHSYS_SYSCFG0, ++ SYSCFG0_SGMII_MASK, val); ++ ++ return 0; ++} ++ + static int set_mux_gmac1_gmac2_to_sgmii_rgmii(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0; +@@ -163,7 +203,61 @@ static int set_mux_gmac1_gmac2_to_sgmii_ + return 0; + } + +-static int set_mux_gmac12_to_gephy_sgmii(struct mtk_eth *eth, u64 path) ++static int set_mux_gmac123_to_usxgmii(struct mtk_eth *eth, u64 path) ++{ ++ unsigned int val = 0; ++ bool updated = true; ++ int mac_id = 0; ++ ++ dev_dbg(eth->dev, "path %s in %s updated = %d\n", ++ mtk_eth_path_name(path), __func__, updated); ++ ++ /* Disable SYSCFG1 SGMII */ ++ regmap_read(eth->ethsys, ETHSYS_SYSCFG0, &val); ++ ++ switch (path) { ++ case MTK_ETH_PATH_GMAC1_USXGMII: ++ val &= ~(u32)SYSCFG0_SGMII_GMAC1_V2; ++ mac_id = MTK_GMAC1_ID; ++ break; ++ case MTK_ETH_PATH_GMAC2_USXGMII: ++ val &= ~(u32)SYSCFG0_SGMII_GMAC2_V2; ++ mac_id = MTK_GMAC2_ID; ++ break; ++ case MTK_ETH_PATH_GMAC3_USXGMII: ++ val &= ~(u32)SYSCFG0_SGMII_GMAC3_V2; ++ mac_id = MTK_GMAC3_ID; ++ break; ++ default: ++ updated = false; ++ }; ++ ++ if (updated) { ++ regmap_update_bits(eth->ethsys, ETHSYS_SYSCFG0, ++ SYSCFG0_SGMII_MASK, val); ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && ++ mac_id == MTK_GMAC2_ID) { ++ regmap_update_bits(eth->infra, ++ TOP_MISC_NETSYS_PCS_MUX, ++ NETSYS_PCS_MUX_MASK, ++ MUX_G2_USXGMII_SEL); ++ } ++ } ++ ++ /* Enable XGDM Path */ ++ val = mtk_r32(eth, MTK_GDMA_EG_CTRL(mac_id)); ++ val |= MTK_GDMA_XGDM_SEL; ++ mtk_w32(eth, val, MTK_GDMA_EG_CTRL(mac_id)); ++ ++ dev_dbg(eth->dev, "path %s in %s updated = %d\n", ++ mtk_eth_path_name(path), __func__, updated); ++ ++ ++ return 0; ++} ++ ++static int set_mux_gmac123_to_gephy_sgmii(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0; + bool updated = true; +@@ -180,6 +274,9 @@ static int set_mux_gmac12_to_gephy_sgmii + case MTK_ETH_PATH_GMAC2_SGMII: + val |= SYSCFG0_SGMII_GMAC2_V2; + break; ++ case MTK_ETH_PATH_GMAC3_SGMII: ++ val |= SYSCFG0_SGMII_GMAC3_V2; ++ break; + default: + updated = false; + } +@@ -208,13 +305,25 @@ static const struct mtk_eth_muxc mtk_eth + .cap_bit = MTK_ETH_MUX_U3_GMAC2_TO_QPHY, + .set_path = set_mux_u3_gmac2_to_qphy, + }, { ++ .name = "mux_gmac2_to_2p5gphy", ++ .cap_bit = MTK_ETH_MUX_GMAC2_TO_2P5GPHY, ++ .set_path = set_mux_gmac2_to_2p5gphy, ++ }, { + .name = "mux_gmac1_gmac2_to_sgmii_rgmii", + .cap_bit = MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII, + .set_path = set_mux_gmac1_gmac2_to_sgmii_rgmii, + }, { + .name = "mux_gmac12_to_gephy_sgmii", + .cap_bit = MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII, +- .set_path = set_mux_gmac12_to_gephy_sgmii, ++ .set_path = set_mux_gmac123_to_gephy_sgmii, ++ }, { ++ .name = "mux_gmac123_to_gephy_sgmii", ++ .cap_bit = MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII, ++ .set_path = set_mux_gmac123_to_gephy_sgmii, ++ }, { ++ .name = "mux_gmac123_to_usxgmii", ++ .cap_bit = MTK_ETH_MUX_GMAC123_TO_USXGMII, ++ .set_path = set_mux_gmac123_to_usxgmii, + }, + }; + +@@ -243,16 +352,46 @@ static int mtk_eth_mux_setup(struct mtk_ + } + } + ++ dev_dbg(eth->dev, "leaving mux_setup %s\n", ++ mtk_eth_path_name(path)); ++ + out: + return err; + } + ++int mtk_gmac_usxgmii_path_setup(struct mtk_eth *eth, int mac_id) ++{ ++ u64 path; ++ ++ path = (mac_id == MTK_GMAC1_ID) ? MTK_ETH_PATH_GMAC1_USXGMII : ++ (mac_id == MTK_GMAC2_ID) ? MTK_ETH_PATH_GMAC2_USXGMII : ++ MTK_ETH_PATH_GMAC3_USXGMII; ++ ++ /* Setup proper MUXes along the path */ ++ return mtk_eth_mux_setup(eth, path); ++} ++ + int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id) + { + u64 path; + +- path = (mac_id == 0) ? MTK_ETH_PATH_GMAC1_SGMII : +- MTK_ETH_PATH_GMAC2_SGMII; ++ path = (mac_id == MTK_GMAC1_ID) ? MTK_ETH_PATH_GMAC1_SGMII : ++ (mac_id == MTK_GMAC2_ID) ? MTK_ETH_PATH_GMAC2_SGMII : ++ MTK_ETH_PATH_GMAC3_SGMII; ++ ++ /* Setup proper MUXes along the path */ ++ return mtk_eth_mux_setup(eth, path); ++} ++ ++int mtk_gmac_2p5gphy_path_setup(struct mtk_eth *eth, int mac_id) ++{ ++ u64 path = 0; ++ ++ if (mac_id == MTK_GMAC2_ID) ++ path = MTK_ETH_PATH_GMAC2_2P5GPHY; ++ ++ if (!path) ++ return -EINVAL; + + /* Setup proper MUXes along the path */ + return mtk_eth_mux_setup(eth, path); +@@ -282,4 +421,3 @@ int mtk_gmac_rgmii_path_setup(struct mtk + /* Setup proper MUXes along the path */ + return mtk_eth_mux_setup(eth, path); + } +- +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -437,6 +437,23 @@ static void mtk_gmac0_rgmii_adjust(struc + mtk_w32(eth, val, TRGMII_TCK_CTRL); + } + ++static void mtk_setup_bridge_switch(struct mtk_eth *eth) ++{ ++ int val; ++ ++ /* Force Port1 XGMAC Link Up */ ++ val = mtk_r32(eth, MTK_XGMAC_STS(MTK_GMAC1_ID)); ++ mtk_w32(eth, val | MTK_XGMAC_FORCE_LINK(MTK_GMAC1_ID), ++ MTK_XGMAC_STS(MTK_GMAC1_ID)); ++ ++ /* Adjust GSW bridge IPG to 11*/ ++ val = mtk_r32(eth, MTK_GSW_CFG); ++ val &= ~(GSWTX_IPG_MASK | GSWRX_IPG_MASK); ++ val |= (GSW_IPG_11 << GSWTX_IPG_SHIFT) | ++ (GSW_IPG_11 << GSWRX_IPG_SHIFT); ++ mtk_w32(eth, val, MTK_GSW_CFG); ++} ++ + static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config, + phy_interface_t interface) + { +@@ -462,7 +479,7 @@ static void mtk_mac_config(struct phylin + struct mtk_mac *mac = container_of(config, struct mtk_mac, + phylink_config); + struct mtk_eth *eth = mac->hw; +- int val, ge_mode, err = 0; ++ int val, ge_mode, force_link, err = 0; + u32 i; + + /* MT76x8 has no hardware settings between for the MAC */ +@@ -506,6 +523,23 @@ static void mtk_mac_config(struct phylin + goto init_err; + } + break; ++ case PHY_INTERFACE_MODE_USXGMII: ++ case PHY_INTERFACE_MODE_10GKR: ++ case PHY_INTERFACE_MODE_5GBASER: ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) { ++ err = mtk_gmac_usxgmii_path_setup(eth, mac->id); ++ if (err) ++ goto init_err; ++ } ++ break; ++ case PHY_INTERFACE_MODE_INTERNAL: ++ if (mac->id == MTK_GMAC2_ID && ++ MTK_HAS_CAPS(eth->soc->caps, MTK_2P5GPHY)) { ++ err = mtk_gmac_2p5gphy_path_setup(eth, mac->id); ++ if (err) ++ goto init_err; ++ } ++ break; + default: + goto err_phy; + } +@@ -584,14 +618,92 @@ static void mtk_mac_config(struct phylin + SYSCFG0_SGMII_MASK, + ~(u32)SYSCFG0_SGMII_MASK); + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ mtk_xfi_pll_enable(eth); ++ mtk_sgmii_reset(eth, mac->id); ++ if (phylink_autoneg_inband(mode)) ++ mtk_sgmii_setup_phya_gen1(eth, mac->id); ++ else ++ mtk_sgmii_setup_phya_gen2(eth, mac->id); ++ } + /* Save the syscfg0 value for mac_finish */ + mac->syscfg0 = val; ++ } else if (state->interface == PHY_INTERFACE_MODE_USXGMII || ++ state->interface == PHY_INTERFACE_MODE_10GKR || ++ state->interface == PHY_INTERFACE_MODE_5GBASER) { ++ ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ err = -EINVAL; ++ goto init_err; ++ } ++ if (phylink_autoneg_inband(mode)) ++ err = mtk_usxgmii_setup_mode_force(eth, mac->id, ++ state); ++ else ++ err = mtk_usxgmii_setup_mode_an(eth, mac->id, ++ SPEED_10000); ++ ++ if (err) ++ goto init_err; + } else if (phylink_autoneg_inband(mode)) { + dev_err(eth->dev, + "In-band mode not supported in non SGMII mode!\n"); + return; + } + ++ /* Setup gmac */ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && ++ (mtk_interface_mode_is_xgmii(state->interface) || ++ mac->interface == PHY_INTERFACE_MODE_INTERNAL)) { ++ mtk_w32(mac->hw, MTK_GDMA_XGDM_SEL, MTK_GDMA_EG_CTRL(mac->id)); ++ mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id)); ++ ++ switch (mac->id) { ++ case MTK_GMAC1_ID: ++ mtk_setup_bridge_switch(eth); ++ break; ++ case MTK_GMAC2_ID: ++ force_link = (mac->interface == ++ PHY_INTERFACE_MODE_INTERNAL) ? ++ MTK_XGMAC_FORCE_LINK(mac->id) : 0; ++ val = mtk_r32(eth, MTK_XGMAC_STS(mac->id)); ++ mtk_w32(eth, val | force_link, ++ MTK_XGMAC_STS(mac->id)); ++ break; ++ case MTK_GMAC3_ID: ++ val = mtk_r32(eth, MTK_XGMAC_STS(mac->id)); ++ mtk_w32(eth, val | MTK_XGMAC_FORCE_LINK(mac->id), ++ MTK_XGMAC_STS(mac->id)); ++ break; ++ } ++ } else { ++ val = mtk_r32(eth, MTK_GDMA_EG_CTRL(mac->id)); ++ mtk_w32(eth, val & ~MTK_GDMA_XGDM_SEL, ++ MTK_GDMA_EG_CTRL(mac->id)); ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ switch (mac->id) { ++ case MTK_GMAC2_ID: ++ case MTK_GMAC3_ID: ++ val = mtk_r32(eth, MTK_XGMAC_STS(mac->id)); ++ mtk_w32(eth, ++ val & ~MTK_XGMAC_FORCE_LINK(mac->id), ++ MTK_XGMAC_STS(mac->id)); ++ break; ++ } ++ } ++ ++/* ++ if (mac->type != mac_type) { ++ if (atomic_read(&reset_pending) == 0) { ++ atomic_inc(&force); ++ schedule_work(ð->pending_work); ++ atomic_inc(&reset_pending); ++ } else ++ atomic_dec(&reset_pending); ++ } ++*/ ++ } + return; + + err_phy: +@@ -632,11 +744,37 @@ static int mtk_mac_finish(struct phylink + return 0; + } + +-static void mtk_mac_pcs_get_state(struct phylink_config *config, ++static void mtk_xgdm_pcs_get_state(struct mtk_mac *mac, ++ struct phylink_link_state *state) ++{ ++ u32 sts = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id)); ++ ++ if (mac->id == MTK_GMAC2_ID) ++ sts = sts >> 16; ++ ++ state->duplex = 1; ++ ++ switch (FIELD_GET(MTK_USXGMII_PCS_MODE, sts)) { ++ case 0: ++ state->speed = SPEED_10000; ++ break; ++ case 1: ++ state->speed = SPEED_5000; ++ break; ++ case 2: ++ state->speed = SPEED_2500; ++ break; ++ case 3: ++ state->speed = SPEED_1000; ++ break; ++ } ++ ++ state->link = FIELD_GET(MTK_USXGMII_PCS_LINK, sts); ++} ++ ++static void mtk_gdm_pcs_get_state(struct mtk_mac *mac, + struct phylink_link_state *state) + { +- struct mtk_mac *mac = container_of(config, struct mtk_mac, +- phylink_config); + u32 pmsr = mtk_r32(mac->hw, MTK_MAC_MSR(mac->id)); + + state->link = (pmsr & MAC_MSR_LINK); +@@ -664,15 +802,35 @@ static void mtk_mac_pcs_get_state(struct + state->pause |= MLO_PAUSE_TX; + } + ++static void mtk_mac_pcs_get_state(struct phylink_config *config, ++ struct phylink_link_state *state) ++{ ++ struct mtk_mac *mac = container_of(config, struct mtk_mac, ++ phylink_config); ++ ++ if (mtk_interface_mode_is_xgmii(state->interface)) ++ mtk_xgdm_pcs_get_state(mac, state); ++ else ++ mtk_gdm_pcs_get_state(mac, state); ++} ++ + static void mtk_mac_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) + { + struct mtk_mac *mac = container_of(config, struct mtk_mac, + phylink_config); +- u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); ++ u32 mcr; + +- mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN); +- mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); ++ if (!mtk_interface_mode_is_xgmii(interface)) { ++ mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); ++ mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN); ++ mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); ++ } else if (mac->id != MTK_GMAC1_ID) { ++ mcr = mtk_r32(mac->hw, MTK_XMAC_MCR(mac->id)); ++ mcr &= 0xfffffff0; ++ mcr |= XMAC_MCR_TRX_DISABLE; ++ mtk_w32(mac->hw, mcr, MTK_XMAC_MCR(mac->id)); ++ } + } + + static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx, +@@ -744,13 +902,11 @@ static void mtk_set_queue_speed(struct m + mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); + } + +-static void mtk_mac_link_up(struct phylink_config *config, +- struct phy_device *phy, +- unsigned int mode, phy_interface_t interface, +- int speed, int duplex, bool tx_pause, bool rx_pause) ++static void mtk_gdm_mac_link_up(struct mtk_mac *mac, ++ struct phy_device *phy, ++ unsigned int mode, phy_interface_t interface, ++ int speed, int duplex, bool tx_pause, bool rx_pause) + { +- struct mtk_mac *mac = container_of(config, struct mtk_mac, +- phylink_config); + u32 mcr; + + mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); +@@ -784,6 +940,47 @@ static void mtk_mac_link_up(struct phyli + mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); + } + ++static void mtk_xgdm_mac_link_up(struct mtk_mac *mac, ++ struct phy_device *phy, ++ unsigned int mode, phy_interface_t interface, ++ int speed, int duplex, bool tx_pause, bool rx_pause) ++{ ++ u32 mcr; ++ ++ if (mac->id == MTK_GMAC1_ID) ++ return; ++ ++ mcr = mtk_r32(mac->hw, MTK_XMAC_MCR(mac->id)); ++ ++ mcr &= ~(XMAC_MCR_FORCE_TX_FC | XMAC_MCR_FORCE_RX_FC); ++ /* Configure pause modes - ++ * phylink will avoid these for half duplex ++ */ ++ if (tx_pause) ++ mcr |= XMAC_MCR_FORCE_TX_FC; ++ if (rx_pause) ++ mcr |= XMAC_MCR_FORCE_RX_FC; ++ ++ mcr &= ~(XMAC_MCR_TRX_DISABLE); ++ mtk_w32(mac->hw, mcr, MTK_XMAC_MCR(mac->id)); ++} ++ ++static void mtk_mac_link_up(struct phylink_config *config, ++ struct phy_device *phy, ++ unsigned int mode, phy_interface_t interface, ++ int speed, int duplex, bool tx_pause, bool rx_pause) ++{ ++ struct mtk_mac *mac = container_of(config, struct mtk_mac, ++ phylink_config); ++ ++ if (mtk_interface_mode_is_xgmii(interface)) ++ mtk_xgdm_mac_link_up(mac, phy, mode, interface, speed, duplex, ++ tx_pause, rx_pause); ++ else ++ mtk_gdm_mac_link_up(mac, phy, mode, interface, speed, duplex, ++ tx_pause, rx_pause); ++} ++ + static const struct phylink_mac_ops mtk_phylink_ops = { + .validate = phylink_generic_validate, + .mac_select_pcs = mtk_mac_select_pcs, +@@ -836,10 +1033,21 @@ static int mtk_mdio_init(struct mtk_eth + } + divider = min_t(unsigned int, DIV_ROUND_UP(MDC_MAX_FREQ, max_clk), 63); + ++ /* Configure MDC Turbo Mode */ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ val = mtk_r32(eth, MTK_MAC_MISC_V3); ++ val |= MISC_MDC_TURBO; ++ mtk_w32(eth, val, MTK_MAC_MISC_V3); ++ } else { ++ val = mtk_r32(eth, MTK_PPSC); ++ val |= PPSC_MDC_TURBO; ++ mtk_w32(eth, val, MTK_PPSC); ++ } ++ + /* Configure MDC Divider */ + val = mtk_r32(eth, MTK_PPSC); + val &= ~PPSC_MDC_CFG; +- val |= FIELD_PREP(PPSC_MDC_CFG, divider) | PPSC_MDC_TURBO; ++ val |= FIELD_PREP(PPSC_MDC_CFG, divider); + mtk_w32(eth, val, MTK_PPSC); + + dev_dbg(eth->dev, "MDC is running on %d Hz\n", MDC_MAX_FREQ / divider); +@@ -4433,8 +4641,8 @@ static int mtk_add_mac(struct mtk_eth *e + const __be32 *_id = of_get_property(np, "reg", NULL); + phy_interface_t phy_mode; + struct phylink *phylink; +- struct mtk_mac *mac; + int id, err; ++ struct mtk_mac *mac; + int txqs = 1; + + if (!_id) { +@@ -4525,6 +4733,32 @@ static int mtk_add_mac(struct mtk_eth *e + mac->phylink_config.supported_interfaces); + } + ++ if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_USXGMII)) { ++ if (id == MTK_GMAC1_ID) { ++ mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | ++ MAC_SYM_PAUSE | ++ MAC_10000FD; ++ phy_interface_zero( ++ mac->phylink_config.supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_INTERNAL, ++ mac->phylink_config.supported_interfaces); ++ } else { ++ mac->phylink_config.mac_capabilities |= MAC_5000FD | MAC_10000FD; ++ __set_bit(PHY_INTERFACE_MODE_5GBASER, ++ mac->phylink_config.supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_10GKR, ++ mac->phylink_config.supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_USXGMII, ++ mac->phylink_config.supported_interfaces); ++ } ++ } ++ ++ if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_2P5GPHY)) { ++ if (id == MTK_GMAC2_ID) ++ __set_bit(PHY_INTERFACE_MODE_INTERNAL, ++ mac->phylink_config.supported_interfaces); ++ } ++ + phylink = phylink_create(&mac->phylink_config, + of_fwnode_handle(mac->of_node), + phy_mode, &mtk_phylink_ops); +@@ -4714,6 +4948,33 @@ static int mtk_probe(struct platform_dev + return err; + } + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) { ++ eth->xgmii = devm_kzalloc(eth->dev, sizeof(*eth->xgmii), GFP_KERNEL); ++ err = mtk_usxgmii_init(eth); ++ if (err) { ++ dev_err(&pdev->dev, "usxgmii init failed\n"); ++ return err; ++ } ++ ++ err = mtk_xfi_pextp_init(eth); ++ if (err) { ++ dev_err(&pdev->dev, "pextp init failed\n"); ++ return err; ++ } ++ ++ err = mtk_xfi_pll_init(eth); ++ if (err) { ++ dev_err(&pdev->dev, "xfi pll init failed\n"); ++ return err; ++ } ++ ++ err = mtk_toprgu_init(eth); ++ if (err) { ++ dev_err(&pdev->dev, "toprgu init failed\n"); ++ return err; ++ } ++ } ++ + if (eth->soc->required_pctl) { + eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, + "mediatek,pctl"); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -126,6 +126,11 @@ + #define MTK_GDMA_TO_PDMA 0x0 + #define MTK_GDMA_DROP_ALL 0x7777 + ++/* GDM Egress Control Register */ ++#define MTK_GDMA_EG_CTRL(x) ((x == MTK_GMAC3_ID) ? \ ++ 0x544 : 0x504 + (x * 0x1000)) ++#define MTK_GDMA_XGDM_SEL BIT(31) ++ + /* Unicast Filter MAC Address Register - Low */ + #define MTK_GDMA_MAC_ADRL(x) (0x508 + (x * 0x1000)) + +@@ -386,7 +391,26 @@ + #define PHY_IAC_TIMEOUT HZ + + #define MTK_MAC_MISC 0x1000c ++#define MTK_MAC_MISC_V3 0x10010 + #define MTK_MUX_TO_ESW BIT(0) ++#define MISC_MDC_TURBO BIT(4) ++ ++/* XMAC status registers */ ++#define MTK_XGMAC_STS(x) ((x == MTK_GMAC3_ID) ? 0x1001C : 0x1000C) ++#define MTK_XGMAC_FORCE_LINK(x) ((x == MTK_GMAC2_ID) ? BIT(31) : BIT(15)) ++#define MTK_USXGMII_PCS_LINK BIT(8) ++#define MTK_XGMAC_RX_FC BIT(5) ++#define MTK_XGMAC_TX_FC BIT(4) ++#define MTK_USXGMII_PCS_MODE GENMASK(3, 1) ++#define MTK_XGMAC_LINK_STS BIT(0) ++ ++/* GSW bridge registers */ ++#define MTK_GSW_CFG (0x10080) ++#define GSWTX_IPG_MASK GENMASK(19, 16) ++#define GSWTX_IPG_SHIFT 16 ++#define GSWRX_IPG_MASK GENMASK(3, 0) ++#define GSWRX_IPG_SHIFT 0 ++#define GSW_IPG_11 11 + + /* Mac control registers */ + #define MTK_MAC_MCR(x) (0x10100 + (x * 0x100)) +@@ -411,6 +435,17 @@ + #define MAC_MCR_FORCE_LINK BIT(0) + #define MAC_MCR_FORCE_LINK_DOWN (MAC_MCR_FORCE_MODE) + ++/* Mac EEE control registers */ ++#define MTK_MAC_EEE(x) (0x10104 + (x * 0x100)) ++#define MAC_EEE_WAKEUP_TIME_1000 GENMASK(31, 24) ++#define MAC_EEE_WAKEUP_TIME_100 GENMASK(23, 16) ++#define MAC_EEE_LPI_TXIDLE_THD GENMASK(15, 8) ++#define MAC_EEE_RESV0 GENMASK(7, 4) ++#define MAC_EEE_CKG_TXILDE BIT(3) ++#define MAC_EEE_CKG_RXLPI BIT(2) ++#define MAC_EEE_TX_DOWN_REQ BIT(1) ++#define MAC_EEE_LPI_MODE BIT(0) ++ + /* Mac status registers */ + #define MTK_MAC_MSR(x) (0x10108 + (x * 0x100)) + #define MAC_MSR_EEE1G BIT(7) +@@ -455,6 +490,12 @@ + #define INTF_MODE_RGMII_1000 (TRGMII_MODE | TRGMII_CENTRAL_ALIGNED) + #define INTF_MODE_RGMII_10_100 0 + ++/* XFI Mac control registers */ ++#define MTK_XMAC_MCR(x) (0x12000 + ((x - 1) * 0x1000)) ++#define XMAC_MCR_TRX_DISABLE 0xf ++#define XMAC_MCR_FORCE_TX_FC BIT(5) ++#define XMAC_MCR_FORCE_RX_FC BIT(4) ++ + /* GPIO port control registers for GMAC 2*/ + #define GPIO_OD33_CTRL8 0x4c0 + #define GPIO_BIAS_CTRL 0xed0 +@@ -480,6 +521,7 @@ + #define SYSCFG0_SGMII_GMAC2 ((3 << 8) & SYSCFG0_SGMII_MASK) + #define SYSCFG0_SGMII_GMAC1_V2 BIT(9) + #define SYSCFG0_SGMII_GMAC2_V2 BIT(8) ++#define SYSCFG0_SGMII_GMAC3_V2 BIT(7) + + + /* ethernet subsystem clock register */ +@@ -506,16 +548,69 @@ + #define ETHSYS_DMA_AG_MAP_QDMA BIT(1) + #define ETHSYS_DMA_AG_MAP_PPE BIT(2) + ++/* USXGMII subsystem config registers */ ++/* Register to control speed */ ++#define RG_PHY_TOP_SPEED_CTRL1 0x80C ++#define RG_USXGMII_RATE_UPDATE_MODE BIT(31) ++#define RG_MAC_CK_GATED BIT(29) ++#define RG_IF_FORCE_EN BIT(28) ++#define RG_RATE_ADAPT_MODE GENMASK(10, 8) ++#define RG_RATE_ADAPT_MODE_X1 0 ++#define RG_RATE_ADAPT_MODE_X2 1 ++#define RG_RATE_ADAPT_MODE_X4 2 ++#define RG_RATE_ADAPT_MODE_X10 3 ++#define RG_RATE_ADAPT_MODE_X100 4 ++#define RG_RATE_ADAPT_MODE_X5 5 ++#define RG_RATE_ADAPT_MODE_X50 6 ++#define RG_XFI_RX_MODE GENMASK(6, 4) ++#define RG_XFI_RX_MODE_10G 0 ++#define RG_XFI_RX_MODE_5G 1 ++#define RG_XFI_TX_MODE GENMASK(2, 0) ++#define RG_XFI_TX_MODE_10G 0 ++#define RG_XFI_TX_MODE_5G 1 ++ ++/* Register to control PCS AN */ ++#define RG_PCS_AN_CTRL0 0x810 ++#define RG_AN_ENABLE BIT(0) ++ ++/* Register to control USXGMII XFI PLL digital */ ++#define XFI_PLL_DIG_GLB8 0x08 ++#define RG_XFI_PLL_EN BIT(31) ++ ++/* Register to control USXGMII XFI PLL analog */ ++#define XFI_PLL_ANA_GLB8 0x108 ++#define RG_XFI_PLL_ANA_SWWA 0x02283248 ++ + /* Infrasys subsystem config registers */ + #define INFRA_MISC2 0x70c + #define CO_QPHY_SEL BIT(0) + #define GEPHY_MAC_SEL BIT(1) + ++/* Toprgu subsystem config registers */ ++#define TOPRGU_SWSYSRST 0x18 ++#define SWSYSRST_UNLOCK_KEY GENMASK(31, 24) ++#define SWSYSRST_XFI_PLL_GRST BIT(16) ++#define SWSYSRST_XFI_PEXPT1_GRST BIT(15) ++#define SWSYSRST_XFI_PEXPT0_GRST BIT(14) ++#define SWSYSRST_SGMII1_GRST BIT(2) ++#define SWSYSRST_SGMII0_GRST BIT(1) ++#define TOPRGU_SWSYSRST_EN 0xFC ++ + /* Top misc registers */ ++#define TOP_MISC_NETSYS_PCS_MUX 0x84 ++#define NETSYS_PCS_MUX_MASK GENMASK(1, 0) ++#define MUX_G2_USXGMII_SEL BIT(1) ++#define MUX_HSGMII1_G1_SEL BIT(0) ++ + #define USB_PHY_SWITCH_REG 0x218 + #define QPHY_SEL_MASK GENMASK(1, 0) + #define SGMII_QPHY_SEL 0x2 + ++/* MDIO control */ ++#define MII_MMD_ACC_CTL_REG 0x0d ++#define MII_MMD_ADDR_DATA_REG 0x0e ++#define MMD_OP_MODE_DATA BIT(14) ++ + /* MT7628/88 specific stuff */ + #define MT7628_PDMA_OFFSET 0x0800 + #define MT7628_SDM_OFFSET 0x0c00 +@@ -809,13 +904,6 @@ enum mtk_gmac_id { + MTK_GMAC_ID_MAX + }; + +-/* GDM Type */ +-enum mtk_gdm_type { +- MTK_GDM_TYPE = 0, +- MTK_XGDM_TYPE, +- MTK_GDM_TYPE_MAX +-}; +- + enum mtk_tx_buf_type { + MTK_TYPE_SKB, + MTK_TYPE_XDP_TX, +@@ -902,6 +990,7 @@ enum mkt_eth_capabilities { + MTK_TRGMII_BIT, + MTK_SGMII_BIT, + MTK_USXGMII_BIT, ++ MTK_2P5GPHY_BIT, + MTK_ESW_BIT, + MTK_GEPHY_BIT, + MTK_MUX_BIT, +@@ -922,6 +1011,7 @@ enum mkt_eth_capabilities { + MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT, + MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT, + MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT, ++ MTK_ETH_MUX_GMAC2_TO_2P5GPHY_BIT, + MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT, + MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT, + MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT, +@@ -933,6 +1023,7 @@ enum mkt_eth_capabilities { + MTK_ETH_PATH_GMAC1_SGMII_BIT, + MTK_ETH_PATH_GMAC2_RGMII_BIT, + MTK_ETH_PATH_GMAC2_SGMII_BIT, ++ MTK_ETH_PATH_GMAC2_2P5GPHY_BIT, + MTK_ETH_PATH_GMAC2_GEPHY_BIT, + MTK_ETH_PATH_GMAC3_SGMII_BIT, + MTK_ETH_PATH_GDM1_ESW_BIT, +@@ -946,6 +1037,7 @@ enum mkt_eth_capabilities { + #define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT) + #define MTK_SGMII BIT_ULL(MTK_SGMII_BIT) + #define MTK_USXGMII BIT_ULL(MTK_USXGMII_BIT) ++#define MTK_2P5GPHY BIT_ULL(MTK_2P5GPHY_BIT) + #define MTK_ESW BIT_ULL(MTK_ESW_BIT) + #define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT) + #define MTK_MUX BIT_ULL(MTK_MUX_BIT) +@@ -968,6 +1060,8 @@ enum mkt_eth_capabilities { + BIT_ULL(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT) + #define MTK_ETH_MUX_U3_GMAC2_TO_QPHY \ + BIT_ULL(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT) ++#define MTK_ETH_MUX_GMAC2_TO_2P5GPHY \ ++ BIT_ULL(MTK_ETH_MUX_GMAC2_TO_2P5GPHY_BIT) + #define MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII \ + BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) + #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \ +@@ -983,6 +1077,7 @@ enum mkt_eth_capabilities { + #define MTK_ETH_PATH_GMAC1_SGMII BIT_ULL(MTK_ETH_PATH_GMAC1_SGMII_BIT) + #define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT) + #define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT) ++#define MTK_ETH_PATH_GMAC2_2P5GPHY BIT_ULL(MTK_ETH_PATH_GMAC2_2P5GPHY_BIT) + #define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT) + #define MTK_ETH_PATH_GMAC3_SGMII BIT_ULL(MTK_ETH_PATH_GMAC3_SGMII_BIT) + #define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT) +@@ -996,6 +1091,7 @@ enum mkt_eth_capabilities { + #define MTK_GMAC2_RGMII (MTK_ETH_PATH_GMAC2_RGMII | MTK_RGMII) + #define MTK_GMAC2_SGMII (MTK_ETH_PATH_GMAC2_SGMII | MTK_SGMII) + #define MTK_GMAC2_GEPHY (MTK_ETH_PATH_GMAC2_GEPHY | MTK_GEPHY) ++#define MTK_GMAC2_2P5GPHY (MTK_ETH_PATH_GMAC2_2P5GPHY | MTK_2P5GPHY) + #define MTK_GMAC3_SGMII (MTK_ETH_PATH_GMAC3_SGMII | MTK_SGMII) + #define MTK_GDM1_ESW (MTK_ETH_PATH_GDM1_ESW | MTK_ESW) + #define MTK_GMAC1_USXGMII (MTK_ETH_PATH_GMAC1_USXGMII | MTK_USXGMII) +@@ -1019,6 +1115,10 @@ enum mkt_eth_capabilities { + (MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | MTK_MUX | \ + MTK_SHARED_SGMII) + ++/* 2: GMAC2 -> XGMII */ ++#define MTK_MUX_GMAC2_TO_2P5GPHY \ ++ (MTK_ETH_MUX_GMAC2_TO_2P5GPHY | MTK_MUX | MTK_INFRA) ++ + /* 0: GMACx -> GEPHY, 1: GMACx -> SGMII where x is 1 or 2 */ + #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ + (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) +@@ -1077,7 +1177,8 @@ enum mkt_eth_capabilities { + MTK_MUX_GMAC123_TO_GEPHY_SGMII | \ + MTK_NETSYS_V3 | MTK_RSTCTRL_PPE1 | \ + MTK_GMAC1_USXGMII | MTK_GMAC2_USXGMII | \ +- MTK_GMAC3_USXGMII | MTK_MUX_GMAC123_TO_USXGMII) ++ MTK_GMAC3_USXGMII | MTK_MUX_GMAC123_TO_USXGMII | \ ++ MTK_GMAC2_2P5GPHY | MTK_MUX_GMAC2_TO_2P5GPHY) + + struct mtk_tx_dma_desc_info { + dma_addr_t addr; +@@ -1183,6 +1284,19 @@ struct mtk_soc_data { + + #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) + ++/* struct mtk_xgmii - This is the structure holding sgmii/usxgmii regmap and ++ * its characteristics ++ * @regmap: The register map pointing at the range used to setup ++ * SGMII/USXGMII modes ++ * @flags: The enum refers to which mode the sgmii wants to run on ++ * @ana_rgc3: The offset refers to register ANA_RGC3 related to regmap ++ */ ++struct mtk_xgmii { ++ struct regmap **regmap_usxgmii; ++ struct regmap **regmap_pextp; ++ struct regmap *regmap_pll; ++}; ++ + /* struct mtk_eth - This is the main datasructure for holding the state + * of the driver + * @dev: The device pointer +@@ -1244,7 +1358,9 @@ struct mtk_eth { + unsigned long sysclk; + struct regmap *ethsys; + struct regmap *infra; ++ struct regmap *toprgu; + struct phylink_pcs **sgmii_pcs; ++ struct mtk_xgmii *xgmii; + struct regmap *pctl; + bool hwlro; + refcount_t dma_refcnt; +@@ -1400,6 +1516,19 @@ static inline u32 mtk_get_ib2_multicast_ + return MTK_FOE_IB2_MULTICAST; + } + ++static inline bool mtk_interface_mode_is_xgmii(phy_interface_t interface) ++{ ++ switch (interface) { ++ case PHY_INTERFACE_MODE_USXGMII: ++ case PHY_INTERFACE_MODE_10GKR: ++ case PHY_INTERFACE_MODE_5GBASER: ++ return true; ++ break; ++ default: ++ return false; ++ } ++} ++ + /* read the hardware status register */ + void mtk_stats_update_mac(struct mtk_mac *mac); + +@@ -1407,8 +1536,10 @@ void mtk_w32(struct mtk_eth *eth, u32 va + u32 mtk_r32(struct mtk_eth *eth, unsigned reg); + + int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id); ++int mtk_gmac_2p5gphy_path_setup(struct mtk_eth *eth, int mac_id); + int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id); + int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id); ++int mtk_gmac_usxgmii_path_setup(struct mtk_eth *eth, int mac_id); + + int mtk_eth_offload_init(struct mtk_eth *eth); + int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type, +@@ -1418,5 +1549,36 @@ int mtk_flow_offload_cmd(struct mtk_eth + void mtk_flow_offload_cleanup(struct mtk_eth *eth, struct list_head *list); + void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev); + ++#ifdef CONFIG_NET_MEDIATEK_SOC_USXGMII ++int mtk_usxgmii_init(struct mtk_eth *eth); ++int mtk_xfi_pextp_init(struct mtk_eth *eth); ++int mtk_xfi_pll_init(struct mtk_eth *eth); ++int mtk_toprgu_init(struct mtk_eth *eth); ++int mtk_xfi_pll_enable(struct mtk_eth *eth); ++int mtk_usxgmii_setup_mode_an(struct mtk_eth *eth, int mac_id, ++ int max_speed); ++int mtk_usxgmii_setup_mode_force(struct mtk_eth *eth, int mac_id, ++ const struct phylink_link_state *state); ++void mtk_usxgmii_setup_phya_an_10000(struct mtk_eth *eth, int mac_id); ++void mtk_usxgmii_reset(struct mtk_eth *eth, int mac_id); ++void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id); ++void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id); ++void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id); ++#else ++static inline int mtk_usxgmii_init(struct mtk_eth *eth) { return 0; }; ++static inline int mtk_xfi_pextp_init(struct mtk_eth *eth) { return 0; }; ++static inline int mtk_xfi_pll_init(struct mtk_eth *eth) { return 0; }; ++static inline int mtk_toprgu_init(struct mtk_eth *eth) { return 0; }; ++static inline int mtk_xfi_pll_enable(struct mtk_eth *eth) { return 0; }; ++static inline int mtk_usxgmii_setup_mode_an(struct mtk_eth *eth, int mac_id, ++ int max_speed) { return 0; }; ++static inline int mtk_usxgmii_setup_mode_force(struct mtk_eth *eth, int mac_id, ++ const struct phylink_link_state *state) { return 0; }; ++static inline void mtk_usxgmii_setup_phya_an_10000(struct mtk_eth *eth, int mac_id) { }; ++static inline void mtk_usxgmii_reset(struct mtk_eth *eth, int mac_id) { }; ++static inline void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) { }; ++static inline void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id) { }; ++static inline void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) { }; ++#endif + + #endif /* MTK_ETH_H */ +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_usxgmii.c +@@ -0,0 +1,646 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Henry Yen ++ */ ++ ++#include ++#include ++#include ++#include "mtk_eth_soc.h" ++ ++int mtk_usxgmii_init(struct mtk_eth *eth) ++{ ++ struct device_node *r = eth->dev->of_node; ++ struct mtk_xgmii *xs = eth->xgmii; ++ struct device *dev = eth->dev; ++ struct device_node *np; ++ int i; ++ ++ xs->regmap_usxgmii = devm_kzalloc(dev, sizeof(*xs->regmap_usxgmii) * ++ eth->soc->num_devs, GFP_KERNEL); ++ if (!xs->regmap_usxgmii) ++ return -ENOMEM; ++ ++ for (i = 0; i < eth->soc->num_devs; i++) { ++ np = of_parse_phandle(r, "mediatek,usxgmiisys", i); ++ if (!np) ++ break; ++ ++ xs->regmap_usxgmii[i] = syscon_node_to_regmap(np); ++ if (IS_ERR(xs->regmap_usxgmii[i])) ++ return PTR_ERR(xs->regmap_usxgmii[i]); ++ } ++ ++ return 0; ++} ++ ++int mtk_xfi_pextp_init(struct mtk_eth *eth) ++{ ++ struct device *dev = eth->dev; ++ struct device_node *r = dev->of_node; ++ struct mtk_xgmii *xs = eth->xgmii; ++ struct device_node *np; ++ int i; ++ ++ xs->regmap_pextp = devm_kzalloc(dev, sizeof(*xs->regmap_pextp) * ++ eth->soc->num_devs, GFP_KERNEL); ++ if (!xs->regmap_pextp) ++ return -ENOMEM; ++ ++ for (i = 0; i < eth->soc->num_devs; i++) { ++ np = of_parse_phandle(r, "mediatek,xfi_pextp", i); ++ if (!np) ++ break; ++ ++ xs->regmap_pextp[i] = syscon_node_to_regmap(np); ++ if (IS_ERR(xs->regmap_pextp[i])) ++ return PTR_ERR(xs->regmap_pextp[i]); ++ } ++ ++ return 0; ++} ++ ++int mtk_xfi_pll_init(struct mtk_eth *eth) ++{ ++ struct device_node *r = eth->dev->of_node; ++ struct mtk_xgmii *xs = eth->xgmii; ++ struct device_node *np; ++ ++ np = of_parse_phandle(r, "mediatek,xfi_pll", 0); ++ if (!np) ++ return -1; ++ ++ xs->regmap_pll = syscon_node_to_regmap(np); ++ if (IS_ERR(xs->regmap_pll)) ++ return PTR_ERR(xs->regmap_pll); ++ ++ return 0; ++} ++ ++int mtk_toprgu_init(struct mtk_eth *eth) ++{ ++ struct device_node *r = eth->dev->of_node; ++ struct device_node *np; ++ ++ np = of_parse_phandle(r, "mediatek,toprgu", 0); ++ if (!np) ++ return -1; ++ ++ eth->toprgu = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->toprgu)) ++ return PTR_ERR(eth->toprgu); ++ ++ return 0; ++} ++ ++int mtk_xfi_pll_enable(struct mtk_eth *eth) ++{ ++ struct mtk_xgmii *xs = eth->xgmii; ++ u32 val = 0; ++ ++ if (!xs->regmap_pll) ++ return -EINVAL; ++ ++ /* Add software workaround for USXGMII PLL TCL issue */ ++ regmap_write(xs->regmap_pll, XFI_PLL_ANA_GLB8, RG_XFI_PLL_ANA_SWWA); ++ ++ regmap_read(xs->regmap_pll, XFI_PLL_DIG_GLB8, &val); ++ val |= RG_XFI_PLL_EN; ++ regmap_write(xs->regmap_pll, XFI_PLL_DIG_GLB8, val); ++ ++ return 0; ++} ++ ++static int mtk_mac2xgmii_id(struct mtk_eth *eth, int mac_id) ++{ ++ int xgmii_id = mac_id; ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ switch (mac_id) { ++ case MTK_GMAC1_ID: ++ case MTK_GMAC2_ID: ++ xgmii_id = 1; ++ break; ++ case MTK_GMAC3_ID: ++ xgmii_id = 0; ++ break; ++ default: ++ xgmii_id = -1; ++ } ++ } ++ ++ return xgmii_id; ++} ++ ++void mtk_usxgmii_setup_phya_an_10000(struct mtk_eth *eth, int mac_id) ++{ ++ struct mtk_xgmii *xs = eth->xgmii; ++ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (id >= eth->soc->num_devs || ++ !xs->regmap_usxgmii[id] || !xs->regmap_pextp[id]) ++ return; ++ ++ regmap_write(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, 0x000FFE6D); ++ regmap_write(xs->regmap_usxgmii[id], 0x818, 0x07B1EC7B); ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, 0x30000000); ++ ndelay(1020); ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, 0x10000000); ++ ndelay(1020); ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, 0x00000000); ++ ++ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00C9071C); ++ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); ++ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); ++ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); ++ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); ++ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014AA); ++ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); ++ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); ++ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); ++ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); ++ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); ++ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); ++ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000AAF); ++ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080D0D); ++ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030909); ++ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); ++ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); ++ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); ++ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); ++ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); ++ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x01423342); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F20); ++ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); ++ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); ++ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); ++ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); ++ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00022220); ++ regmap_write(xs->regmap_pextp[id], 0x5064, 0x0F020A01); ++ regmap_write(xs->regmap_pextp[id], 0x50B4, 0x06100600); ++ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); ++ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); ++ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); ++ regmap_write(xs->regmap_pextp[id], 0x306C, 0x00000F00); ++ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00040000); ++ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000001); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ udelay(150); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ udelay(15); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C101); ++ udelay(100); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F00); ++ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ udelay(400); ++} ++ ++void mtk_usxgmii_setup_phya_force_5000(struct mtk_eth *eth, int mac_id) ++{ ++ unsigned int val; ++ struct mtk_xgmii *xs = eth->xgmii; ++ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (id >= eth->soc->num_devs || ++ !xs->regmap_usxgmii[id] || !xs->regmap_pextp[id]) ++ return; ++ ++ /* Setup USXGMII speed */ ++ val = FIELD_PREP(RG_XFI_RX_MODE, RG_XFI_RX_MODE_5G) | ++ FIELD_PREP(RG_XFI_TX_MODE, RG_XFI_TX_MODE_5G); ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ /* Disable USXGMII AN mode */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, &val); ++ val &= ~RG_AN_ENABLE; ++ regmap_write(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, val); ++ ++ /* Gated USXGMII */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); ++ val |= RG_MAC_CK_GATED; ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ ndelay(1020); ++ ++ /* USXGMII force mode setting */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); ++ val |= RG_USXGMII_RATE_UPDATE_MODE; ++ val |= RG_IF_FORCE_EN; ++ val |= FIELD_PREP(RG_RATE_ADAPT_MODE, RG_RATE_ADAPT_MODE_X1); ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ /* Un-gated USXGMII */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); ++ val &= ~RG_MAC_CK_GATED; ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ ndelay(1020); ++ ++ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00D9071C); ++ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAAA5A5AA); ++ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); ++ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); ++ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); ++ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C018AA); ++ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777812B); ++ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005C9CFF); ++ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9DFAFAFA); ++ regmap_write(xs->regmap_pextp[id], 0x5074, 0x273F3F3F); ++ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA8883868); ++ regmap_write(xs->regmap_pextp[id], 0x507C, 0x14661466); ++ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E001ABF); ++ regmap_write(xs->regmap_pextp[id], 0x5084, 0x080B0D0D); ++ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02050909); ++ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C000000); ++ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04000000); ++ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); ++ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x50808C8C); ++ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18000000); ++ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x00A132A1); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F20); ++ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); ++ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); ++ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); ++ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); ++ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00022220); ++ regmap_write(xs->regmap_pextp[id], 0x5064, 0x0F020A01); ++ regmap_write(xs->regmap_pextp[id], 0x50B4, 0x06100600); ++ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); ++ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); ++ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); ++ regmap_write(xs->regmap_pextp[id], 0x306C, 0x00000F00); ++ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00040000); ++ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000003); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ udelay(150); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ udelay(15); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C101); ++ udelay(100); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F00); ++ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ udelay(400); ++} ++ ++void mtk_usxgmii_setup_phya_force_10000(struct mtk_eth *eth, int mac_id) ++{ ++ struct mtk_xgmii *xs = eth->xgmii; ++ unsigned int val; ++ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (id >= eth->soc->num_devs || ++ !xs->regmap_usxgmii[id] || !xs->regmap_pextp[id]) ++ return; ++ ++ /* Setup USXGMII speed */ ++ val = FIELD_PREP(RG_XFI_RX_MODE, RG_XFI_RX_MODE_10G) | ++ FIELD_PREP(RG_XFI_TX_MODE, RG_XFI_TX_MODE_10G); ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ /* Disable USXGMII AN mode */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, &val); ++ val &= ~RG_AN_ENABLE; ++ regmap_write(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, val); ++ ++ /* Gated USXGMII */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); ++ val |= RG_MAC_CK_GATED; ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ ndelay(1020); ++ ++ /* USXGMII force mode setting */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); ++ val |= RG_USXGMII_RATE_UPDATE_MODE; ++ val |= RG_IF_FORCE_EN; ++ val |= FIELD_PREP(RG_RATE_ADAPT_MODE, RG_RATE_ADAPT_MODE_X1); ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ /* Un-gated USXGMII */ ++ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); ++ val &= ~RG_MAC_CK_GATED; ++ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); ++ ++ ndelay(1020); ++ ++ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00C9071C); ++ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); ++ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); ++ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); ++ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); ++ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014AA); ++ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); ++ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); ++ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); ++ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); ++ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); ++ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); ++ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000AAF); ++ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080D0D); ++ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030909); ++ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); ++ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); ++ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); ++ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); ++ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); ++ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x01423342); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F20); ++ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); ++ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); ++ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); ++ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); ++ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00022220); ++ regmap_write(xs->regmap_pextp[id], 0x5064, 0x0F020A01); ++ regmap_write(xs->regmap_pextp[id], 0x50B4, 0x06100600); ++ regmap_write(xs->regmap_pextp[id], 0x3048, 0x49664100); ++ regmap_write(xs->regmap_pextp[id], 0x3050, 0x00000000); ++ regmap_write(xs->regmap_pextp[id], 0x3054, 0x00000000); ++ regmap_write(xs->regmap_pextp[id], 0x306C, 0x00000F00); ++ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00040000); ++ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000001); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ udelay(150); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ udelay(15); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C101); ++ udelay(100); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F00); ++ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ udelay(400); ++} ++ ++void mtk_usxgmii_reset(struct mtk_eth *eth, int mac_id) ++{ ++ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (id >= eth->soc->num_devs || !eth->toprgu) ++ return; ++ ++ switch (mac_id) { ++ case MTK_GMAC2_ID: ++ regmap_write(eth->toprgu, 0xFC, 0x0000A004); ++ regmap_write(eth->toprgu, 0x18, 0x88F0A004); ++ regmap_write(eth->toprgu, 0xFC, 0x00000000); ++ regmap_write(eth->toprgu, 0x18, 0x88F00000); ++ regmap_write(eth->toprgu, 0x18, 0x00F00000); ++ break; ++ case MTK_GMAC3_ID: ++ regmap_write(eth->toprgu, 0xFC, 0x00005002); ++ regmap_write(eth->toprgu, 0x18, 0x88F05002); ++ regmap_write(eth->toprgu, 0xFC, 0x00000000); ++ regmap_write(eth->toprgu, 0x18, 0x88F00000); ++ regmap_write(eth->toprgu, 0x18, 0x00F00000); ++ break; ++ } ++ ++ mdelay(10); ++} ++ ++int mtk_usxgmii_setup_mode_an(struct mtk_eth *eth, int mac_id, int max_speed) ++{ ++ if (mac_id < 0 || mac_id >= eth->soc->num_devs) ++ return -EINVAL; ++ ++ if ((max_speed != SPEED_10000) && (max_speed != SPEED_5000)) ++ return -EINVAL; ++ ++ mtk_xfi_pll_enable(eth); ++ mtk_usxgmii_reset(eth, mac_id); ++ mtk_usxgmii_setup_phya_an_10000(eth, mac_id); ++ ++ return 0; ++} ++ ++int mtk_usxgmii_setup_mode_force(struct mtk_eth *eth, int mac_id, ++ const struct phylink_link_state *state) ++{ ++ if (mac_id < 0 || mac_id >= eth->soc->num_devs) ++ return -EINVAL; ++ ++ mtk_xfi_pll_enable(eth); ++ mtk_usxgmii_reset(eth, mac_id); ++ if (state->interface == PHY_INTERFACE_MODE_5GBASER) ++ mtk_usxgmii_setup_phya_force_5000(eth, mac_id); ++ else ++ mtk_usxgmii_setup_phya_force_10000(eth, mac_id); ++ ++ return 0; ++} ++ ++void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) ++{ ++ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ struct mtk_xgmii *xs = eth->xgmii; ++ ++ if (id >= eth->soc->num_devs || !xs->regmap_pextp[id]) ++ return; ++ ++ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00D9071C); ++ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); ++ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020207); ++ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E05050F); ++ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00200032); ++ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014BA); ++ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); ++ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); ++ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); ++ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); ++ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); ++ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); ++ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000EAF); ++ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080E0D); ++ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030B09); ++ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); ++ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); ++ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0606); ++ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); ++ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); ++ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x00FA32FA); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F21); ++ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); ++ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); ++ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); ++ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); ++ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00011110); ++ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); ++ regmap_write(xs->regmap_pextp[id], 0x3064, 0x0000C000); ++ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); ++ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); ++ regmap_write(xs->regmap_pextp[id], 0x306C, 0x20200F00); ++ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00050000); ++ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000007); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ udelay(150); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ udelay(15); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C101); ++ udelay(100); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F01); ++ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ udelay(400); ++} ++ ++void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id) ++{ ++ struct mtk_xgmii *xs = eth->xgmii; ++ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (id >= eth->soc->num_devs || !xs->regmap_pextp[id]) ++ return; ++ ++ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00D9071C); ++ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); ++ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); ++ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); ++ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); ++ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014AA); ++ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); ++ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); ++ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); ++ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); ++ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); ++ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); ++ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000AAF); ++ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080D0D); ++ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030909); ++ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); ++ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); ++ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); ++ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); ++ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); ++ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x009C329C); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F21); ++ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); ++ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); ++ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); ++ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); ++ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00011110); ++ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); ++ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); ++ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); ++ regmap_write(xs->regmap_pextp[id], 0x306C, 0x22000F00); ++ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00050000); ++ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000005); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ udelay(150); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ udelay(15); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C111); ++ ndelay(1020); ++ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C101); ++ udelay(100); ++ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); ++ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F01); ++ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ udelay(400); ++} ++ ++void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) ++{ ++ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ u32 val = 0; ++ ++ if (id >= eth->soc->num_devs || !eth->toprgu) ++ return; ++ ++ switch (mac_id) { ++ case MTK_GMAC2_ID: ++ /* Enable software reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); ++ val |= SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_SGMII1_GRST; ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); ++ ++ /* Assert SGMII reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); ++ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88) | ++ SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_SGMII1_GRST; ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); ++ ++ udelay(100); ++ ++ /* De-assert SGMII reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); ++ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88); ++ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_SGMII1_GRST); ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); ++ ++ /* Disable software reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); ++ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_SGMII1_GRST); ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); ++ break; ++ case MTK_GMAC3_ID: ++ /* Enable Software reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); ++ val |= SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_SGMII0_GRST; ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); ++ ++ /* Assert SGMII reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); ++ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88) | ++ SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_SGMII0_GRST; ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); ++ ++ udelay(100); ++ ++ /* De-assert SGMII reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); ++ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88); ++ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_SGMII0_GRST); ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); ++ ++ /* Disable software reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); ++ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_SGMII0_GRST); ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); ++ break; ++ } ++ ++ mdelay(1); ++} +--- a/drivers/net/ethernet/mediatek/Kconfig ++++ b/drivers/net/ethernet/mediatek/Kconfig +@@ -11,6 +11,14 @@ config NET_MEDIATEK_SOC_WED + depends on ARCH_MEDIATEK || COMPILE_TEST + def_bool NET_MEDIATEK_SOC != n + ++config NET_MEDIATEK_SOC_USXGMII ++ bool "Support USXGMII SerDes on MT7988" ++ depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST ++ def_bool NET_MEDIATEK_SOC != n ++ help ++ Include support for 10G USXGMII SerDes unit which can ++ be found on MT7988. ++ + config NET_MEDIATEK_SOC + tristate "MediaTek SoC Gigabit Ethernet support" + depends on NET_DSA || !NET_DSA diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 5170dfdf9803ad..7268b693895b94 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -253,6 +253,7 @@ CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y +CONFIG_NET_MEDIATEK_SOC_USXGMII=y CONFIG_NET_MEDIATEK_SOC_WED=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index be51e02f4d741a..88ca94472cde54 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -275,6 +275,7 @@ CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y +# CONFIG_NET_MEDIATEK_SOC_USXGMII is not set CONFIG_NET_MEDIATEK_SOC_WED=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y diff --git a/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch b/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch index 4187557b781ea7..04ca80c213d767 100644 --- a/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch +++ b/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -231,13 +231,35 @@ static int _mtk_mdio_write(struct mtk_et +@@ -323,13 +323,35 @@ static int _mtk_mdio_write(struct mtk_et if (ret < 0) return ret; @@ -63,7 +63,7 @@ Signed-off-by: David S. Miller ret = mtk_mdio_busy_wait(eth); if (ret < 0) -@@ -254,12 +276,33 @@ static int _mtk_mdio_read(struct mtk_eth +@@ -346,12 +368,33 @@ static int _mtk_mdio_read(struct mtk_eth if (ret < 0) return ret; @@ -103,7 +103,7 @@ Signed-off-by: David S. Miller ret = mtk_mdio_busy_wait(eth); if (ret < 0) -@@ -729,6 +772,7 @@ static int mtk_mdio_init(struct mtk_eth +@@ -1018,6 +1061,7 @@ static int mtk_mdio_init(struct mtk_eth eth->mii_bus->name = "mdio"; eth->mii_bus->read = mtk_mdio_read; eth->mii_bus->write = mtk_mdio_write; @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -376,9 +376,12 @@ +@@ -382,9 +382,12 @@ #define PHY_IAC_ADDR_MASK GENMASK(24, 20) #define PHY_IAC_ADDR(x) FIELD_PREP(PHY_IAC_ADDR_MASK, (x)) #define PHY_IAC_CMD_MASK GENMASK(19, 18) diff --git a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch index 285e24429a4af0..a613803ee6d0c3 100644 --- a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4261,6 +4261,7 @@ static const struct net_device_ops mtk_n +@@ -4638,6 +4638,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -4389,6 +4390,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4796,6 +4797,9 @@ static int mtk_add_mac(struct mtk_eth *e register_netdevice_notifier(&mac->device_notifier); } From f7d0a4797feaee0c03d3f1cd5459702b13337ba2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Apr 2023 14:32:03 +0100 Subject: [PATCH 0028/1171] generic: mt7530: backport support for the MT7988 built-in switch Backport commits adding support for the MT7988 built-in switch to the mt7530 driver. This change results in the Kconfig symbol NET_DSA_MT7530 to be extended by NET_DSA_MT7530_MDIO (everything formally covered by NET_DSA_MT7530) and NET_DSA_MT7530_MMIO (a new driver for the MMIO-connected built-in switch of the MT7988 SoC). Select NET_DSA_MT7530_MDIO for all targets previously selecting NET_DSA_MT7530, with the exception of mediatek/filogic which also selects NET_DSA_MT7530_MMIO. Signed-off-by: Daniel Golle (cherry picked from commit 958fdf36e35c814eb83faf2c39db4ca379c921b5) --- ...ake-some-noise-if-register-read-fail.patch | 32 + ...a-mt7530-refactor-SGMII-PCS-creation.patch | 111 +++ ...mt7530-use-unlocked-regmap-accessors.patch | 74 ++ ...se-regmap-to-access-switch-register-.patch | 224 ++++++ ...ove-SGMII-PCS-creation-to-mt7530_pro.patch | 54 ++ ...t-dsa-mt7530-introduce-mutex-helpers.patch | 273 +++++++ ...ove-p5_intf_modes-function-to-mt7530.patch | 75 ++ ...ntroduce-mt7530_probe_common-helper-.patch | 155 ++++ ...ntroduce-mt7530_remove_common-helper.patch | 55 ++ ...plit-off-common-parts-from-mt7531_se.patch | 143 ++++ ...t7530-introduce-separate-MDIO-driver.patch | 692 ++++++++++++++++++ ...kip-locking-if-MDIO-bus-isn-t-presen.patch | 47 ++ ...ntroduce-driver-for-MT7988-built-in-.patch | 421 +++++++++++ ...-dsa-mt7530-fix-support-for-MT7531BE.patch | 118 +++ ...or-Motorcomm-yt8521-gigabit-ethernet.patch | 2 +- ...d-driver-for-OCOTP-in-Sunplus-SP7021.patch | 2 +- ...001-nvmem-microchip-otpc-add-support.patch | 2 +- ...e-all-MACs-are-powered-down-before-r.patch | 2 +- ...gister-OF-node-for-internal-MDIO-bus.patch | 4 +- target/linux/mediatek/filogic/config-5.15 | 2 + target/linux/mediatek/mt7622/config-5.15 | 2 + target/linux/mediatek/mt7623/config-5.15 | 2 + target/linux/mediatek/mt7629/config-5.15 | 2 + target/linux/ramips/mt7621/config-5.15 | 2 + ...hdog-add-realtek-otto-watchdog-timer.patch | 2 +- ...t-dsa-add-support-for-rtl838x-switch.patch | 4 +- 26 files changed, 2493 insertions(+), 9 deletions(-) create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0001-net-dsa-mt7530-make-some-noise-if-register-read-fail.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0007-net-dsa-mt7530-move-p5_intf_modes-function-to-mt7530.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0012-net-dsa-mt7530-skip-locking-if-MDIO-bus-isn-t-presen.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch create mode 100644 target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch diff --git a/target/linux/generic/backport-5.15/790-v6.4-0001-net-dsa-mt7530-make-some-noise-if-register-read-fail.patch b/target/linux/generic/backport-5.15/790-v6.4-0001-net-dsa-mt7530-make-some-noise-if-register-read-fail.patch new file mode 100644 index 00000000000000..ffbdde5a5772ea --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0001-net-dsa-mt7530-make-some-noise-if-register-read-fail.patch @@ -0,0 +1,32 @@ +From b6f56cddb5f57a0b8da0ce582232a2f1933558c6 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:17:19 +0100 +Subject: [PATCH 04/16] net: dsa: mt7530: make some noise if register read + fails + +Simply returning the negative error value instead of the read value +doesn't seem like a good idea. Return 0 instead and add WARN_ON_ONCE(1) +so this kind of error will not go unnoticed. + +Suggested-by: Andrew Lunn +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -224,9 +224,10 @@ mt7530_mii_read(struct mt7530_priv *priv + /* MT7530 uses 31 as the pseudo port */ + ret = bus->write(bus, 0x1f, 0x1f, page); + if (ret < 0) { ++ WARN_ON_ONCE(1); + dev_err(&bus->dev, + "failed to read mt7530 register\n"); +- return ret; ++ return 0; + } + + lo = bus->read(bus, 0x1f, r); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch b/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch new file mode 100644 index 00000000000000..8963d93d107ac5 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch @@ -0,0 +1,111 @@ +From 9ecc00164dc2300dfcd40afe549a8ee951dfea9f Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:17:30 +0100 +Subject: [PATCH 05/16] net: dsa: mt7530: refactor SGMII PCS creation + +Instead of macro templates use a dedidated function and allocated +regmap_config when creating the regmaps for the pcs-mtk-lynxi +instances. +This is in preparation to switching to use unlocked regmap accessors +and have regmap's locking API handle locking for us. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 74 +++++++++++++++++++++++++++------------- + 1 file changed, 50 insertions(+), 24 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -2926,26 +2926,56 @@ static const struct regmap_bus mt7531_re + .reg_update_bits = mt7530_regmap_update_bits, + }; + +-#define MT7531_PCS_REGMAP_CONFIG(_name, _reg_base) \ +- { \ +- .name = _name, \ +- .reg_bits = 16, \ +- .val_bits = 32, \ +- .reg_stride = 4, \ +- .reg_base = _reg_base, \ +- .max_register = 0x17c, \ ++static int ++mt7531_create_sgmii(struct mt7530_priv *priv) ++{ ++ struct regmap_config *mt7531_pcs_config[2]; ++ struct phylink_pcs *pcs; ++ struct regmap *regmap; ++ int i, ret = 0; ++ ++ for (i = 0; i < 2; i++) { ++ mt7531_pcs_config[i] = devm_kzalloc(priv->dev, ++ sizeof(struct regmap_config), ++ GFP_KERNEL); ++ if (!mt7531_pcs_config[i]) { ++ ret = -ENOMEM; ++ break; ++ } ++ ++ mt7531_pcs_config[i]->name = i ? "port6" : "port5"; ++ mt7531_pcs_config[i]->reg_bits = 16; ++ mt7531_pcs_config[i]->val_bits = 32; ++ mt7531_pcs_config[i]->reg_stride = 4; ++ mt7531_pcs_config[i]->reg_base = MT7531_SGMII_REG_BASE(5 + i); ++ mt7531_pcs_config[i]->max_register = 0x17c; ++ ++ regmap = devm_regmap_init(priv->dev, ++ &mt7531_regmap_bus, priv, ++ mt7531_pcs_config[i]); ++ if (IS_ERR(regmap)) { ++ ret = PTR_ERR(regmap); ++ break; ++ } ++ pcs = mtk_pcs_lynxi_create(priv->dev, regmap, ++ MT7531_PHYA_CTRL_SIGNAL3, 0); ++ if (!pcs) { ++ ret = -ENXIO; ++ break; ++ } ++ priv->ports[5 + i].sgmii_pcs = pcs; + } + +-static const struct regmap_config mt7531_pcs_config[] = { +- MT7531_PCS_REGMAP_CONFIG("port5", MT7531_SGMII_REG_BASE(5)), +- MT7531_PCS_REGMAP_CONFIG("port6", MT7531_SGMII_REG_BASE(6)), +-}; ++ if (ret && i) ++ mtk_pcs_lynxi_destroy(priv->ports[5].sgmii_pcs); ++ ++ return ret; ++} + + static int + mt753x_setup(struct dsa_switch *ds) + { + struct mt7530_priv *priv = ds->priv; +- struct regmap *regmap; + int i, ret; + + /* Initialise the PCS devices */ +@@ -2967,15 +2997,11 @@ mt753x_setup(struct dsa_switch *ds) + if (ret && priv->irq) + mt7530_free_irq_common(priv); + +- if (priv->id == ID_MT7531) +- for (i = 0; i < 2; i++) { +- regmap = devm_regmap_init(ds->dev, +- &mt7531_regmap_bus, priv, +- &mt7531_pcs_config[i]); +- priv->ports[5 + i].sgmii_pcs = +- mtk_pcs_lynxi_create(ds->dev, regmap, +- MT7531_PHYA_CTRL_SIGNAL3, 0); +- } ++ if (priv->id == ID_MT7531) { ++ ret = mt7531_create_sgmii(priv); ++ if (ret && priv->irq) ++ mt7530_free_irq_common(priv); ++ } + + return ret; + } diff --git a/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch b/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch new file mode 100644 index 00000000000000..1b4a9561992f36 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch @@ -0,0 +1,74 @@ +From 1bd099c49f65ed923b9f19b8c4b3cd1ff0024091 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:17:40 +0100 +Subject: [PATCH 06/16] net: dsa: mt7530: use unlocked regmap accessors + +Instead of wrapping the locked register accessor functions, use the +unlocked variants and add locking wrapper functions to let regmap +handle the locking. + +This is a preparation towards being able to always use regmap to +access switch registers instead of open-coded accessor functions. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 23 ++++++++++++++--------- + 1 file changed, 14 insertions(+), 9 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -2899,7 +2899,7 @@ static int mt7530_regmap_read(void *cont + { + struct mt7530_priv *priv = context; + +- *val = mt7530_read(priv, reg); ++ *val = mt7530_mii_read(priv, reg); + return 0; + }; + +@@ -2907,23 +2907,25 @@ static int mt7530_regmap_write(void *con + { + struct mt7530_priv *priv = context; + +- mt7530_write(priv, reg, val); ++ mt7530_mii_write(priv, reg, val); + return 0; + }; + +-static int mt7530_regmap_update_bits(void *context, unsigned int reg, +- unsigned int mask, unsigned int val) ++static void ++mt7530_mdio_regmap_lock(void *mdio_lock) + { +- struct mt7530_priv *priv = context; ++ mutex_lock_nested(mdio_lock, MDIO_MUTEX_NESTED); ++} + +- mt7530_rmw(priv, reg, mask, val); +- return 0; +-}; ++static void ++mt7530_mdio_regmap_unlock(void *mdio_lock) ++{ ++ mutex_unlock(mdio_lock); ++} + + static const struct regmap_bus mt7531_regmap_bus = { + .reg_write = mt7530_regmap_write, + .reg_read = mt7530_regmap_read, +- .reg_update_bits = mt7530_regmap_update_bits, + }; + + static int +@@ -2949,6 +2951,9 @@ mt7531_create_sgmii(struct mt7530_priv * + mt7531_pcs_config[i]->reg_stride = 4; + mt7531_pcs_config[i]->reg_base = MT7531_SGMII_REG_BASE(5 + i); + mt7531_pcs_config[i]->max_register = 0x17c; ++ mt7531_pcs_config[i]->lock = mt7530_mdio_regmap_lock; ++ mt7531_pcs_config[i]->unlock = mt7530_mdio_regmap_unlock; ++ mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; + + regmap = devm_regmap_init(priv->dev, + &mt7531_regmap_bus, priv, diff --git a/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch b/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch new file mode 100644 index 00000000000000..2d8bab9da63e59 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch @@ -0,0 +1,224 @@ +From a08c045580e060a6886bbb656c50ae20b0c780b5 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:17:52 +0100 +Subject: [PATCH 07/16] net: dsa: mt7530: use regmap to access switch register + space + +Use regmap API to access the switch register space. + +Signed-off-by: Daniel Golle +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 99 ++++++++++++++++++++++++---------------- + drivers/net/dsa/mt7530.h | 2 + + 2 files changed, 62 insertions(+), 39 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -183,9 +183,9 @@ core_clear(struct mt7530_priv *priv, u32 + } + + static int +-mt7530_mii_write(struct mt7530_priv *priv, u32 reg, u32 val) ++mt7530_regmap_write(void *context, unsigned int reg, unsigned int val) + { +- struct mii_bus *bus = priv->bus; ++ struct mii_bus *bus = context; + u16 page, r, lo, hi; + int ret; + +@@ -197,24 +197,34 @@ mt7530_mii_write(struct mt7530_priv *pri + /* MT7530 uses 31 as the pseudo port */ + ret = bus->write(bus, 0x1f, 0x1f, page); + if (ret < 0) +- goto err; ++ return ret; + + ret = bus->write(bus, 0x1f, r, lo); + if (ret < 0) +- goto err; ++ return ret; + + ret = bus->write(bus, 0x1f, 0x10, hi); +-err: ++ return ret; ++} ++ ++static int ++mt7530_mii_write(struct mt7530_priv *priv, u32 reg, u32 val) ++{ ++ int ret; ++ ++ ret = regmap_write(priv->regmap, reg, val); ++ + if (ret < 0) +- dev_err(&bus->dev, ++ dev_err(priv->dev, + "failed to write mt7530 register\n"); ++ + return ret; + } + +-static u32 +-mt7530_mii_read(struct mt7530_priv *priv, u32 reg) ++static int ++mt7530_regmap_read(void *context, unsigned int reg, unsigned int *val) + { +- struct mii_bus *bus = priv->bus; ++ struct mii_bus *bus = context; + u16 page, r, lo, hi; + int ret; + +@@ -223,17 +233,32 @@ mt7530_mii_read(struct mt7530_priv *priv + + /* MT7530 uses 31 as the pseudo port */ + ret = bus->write(bus, 0x1f, 0x1f, page); +- if (ret < 0) { ++ if (ret < 0) ++ return ret; ++ ++ lo = bus->read(bus, 0x1f, r); ++ hi = bus->read(bus, 0x1f, 0x10); ++ ++ *val = (hi << 16) | (lo & 0xffff); ++ ++ return 0; ++} ++ ++static u32 ++mt7530_mii_read(struct mt7530_priv *priv, u32 reg) ++{ ++ int ret; ++ u32 val; ++ ++ ret = regmap_read(priv->regmap, reg, &val); ++ if (ret) { + WARN_ON_ONCE(1); +- dev_err(&bus->dev, ++ dev_err(priv->dev, + "failed to read mt7530 register\n"); + return 0; + } + +- lo = bus->read(bus, 0x1f, r); +- hi = bus->read(bus, 0x1f, 0x10); +- +- return (hi << 16) | (lo & 0xffff); ++ return val; + } + + static void +@@ -283,14 +308,10 @@ mt7530_rmw(struct mt7530_priv *priv, u32 + u32 mask, u32 set) + { + struct mii_bus *bus = priv->bus; +- u32 val; + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- val = mt7530_mii_read(priv, reg); +- val &= ~mask; +- val |= set; +- mt7530_mii_write(priv, reg, val); ++ regmap_update_bits(priv->regmap, reg, mask, set); + + mutex_unlock(&bus->mdio_lock); + } +@@ -298,7 +319,7 @@ mt7530_rmw(struct mt7530_priv *priv, u32 + static void + mt7530_set(struct mt7530_priv *priv, u32 reg, u32 val) + { +- mt7530_rmw(priv, reg, 0, val); ++ mt7530_rmw(priv, reg, val, val); + } + + static void +@@ -2895,22 +2916,6 @@ static const struct phylink_pcs_ops mt75 + .pcs_an_restart = mt7530_pcs_an_restart, + }; + +-static int mt7530_regmap_read(void *context, unsigned int reg, unsigned int *val) +-{ +- struct mt7530_priv *priv = context; +- +- *val = mt7530_mii_read(priv, reg); +- return 0; +-}; +- +-static int mt7530_regmap_write(void *context, unsigned int reg, unsigned int val) +-{ +- struct mt7530_priv *priv = context; +- +- mt7530_mii_write(priv, reg, val); +- return 0; +-}; +- + static void + mt7530_mdio_regmap_lock(void *mdio_lock) + { +@@ -2923,7 +2928,7 @@ mt7530_mdio_regmap_unlock(void *mdio_loc + mutex_unlock(mdio_lock); + } + +-static const struct regmap_bus mt7531_regmap_bus = { ++static const struct regmap_bus mt7530_regmap_bus = { + .reg_write = mt7530_regmap_write, + .reg_read = mt7530_regmap_read, + }; +@@ -2956,7 +2961,7 @@ mt7531_create_sgmii(struct mt7530_priv * + mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; + + regmap = devm_regmap_init(priv->dev, +- &mt7531_regmap_bus, priv, ++ &mt7530_regmap_bus, priv->bus, + mt7531_pcs_config[i]); + if (IS_ERR(regmap)) { + ret = PTR_ERR(regmap); +@@ -3121,6 +3126,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match) + static int + mt7530_probe(struct mdio_device *mdiodev) + { ++ static struct regmap_config *regmap_config; + struct mt7530_priv *priv; + struct device_node *dn; + +@@ -3200,6 +3206,21 @@ mt7530_probe(struct mdio_device *mdiodev + mutex_init(&priv->reg_mutex); + dev_set_drvdata(&mdiodev->dev, priv); + ++ regmap_config = devm_kzalloc(&mdiodev->dev, sizeof(*regmap_config), ++ GFP_KERNEL); ++ if (!regmap_config) ++ return -ENOMEM; ++ ++ regmap_config->reg_bits = 16; ++ regmap_config->val_bits = 32; ++ regmap_config->reg_stride = 4; ++ regmap_config->max_register = MT7530_CREV; ++ regmap_config->disable_locking = true; ++ priv->regmap = devm_regmap_init(priv->dev, &mt7530_regmap_bus, ++ priv->bus, regmap_config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); ++ + return dsa_register_switch(priv->ds); + } + +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -747,6 +747,7 @@ struct mt753x_info { + * @dev: The device pointer + * @ds: The pointer to the dsa core structure + * @bus: The bus used for the device and built-in PHY ++ * @regmap: The regmap instance representing all switch registers + * @rstc: The pointer to reset control used by MCM + * @core_pwr: The power supplied into the core + * @io_pwr: The power supplied into the I/O +@@ -767,6 +768,7 @@ struct mt7530_priv { + struct device *dev; + struct dsa_switch *ds; + struct mii_bus *bus; ++ struct regmap *regmap; + struct reset_control *rstc; + struct regulator *core_pwr; + struct regulator *io_pwr; diff --git a/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch b/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch new file mode 100644 index 00000000000000..0bb64c3c5e9924 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch @@ -0,0 +1,54 @@ +From 6de2852297737171ba96b91e89bf302ca1fda869 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:18:04 +0100 +Subject: [PATCH 08/16] net: dsa: mt7530: move SGMII PCS creation to + mt7530_probe function + +Move creating the SGMII PCS from mt753x_setup() to the more appropriate +mt7530_probe() function. +This is done also in preparation of moving all functions related to +MDIO-connected MT753x switches to a separate module. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -3007,12 +3007,6 @@ mt753x_setup(struct dsa_switch *ds) + if (ret && priv->irq) + mt7530_free_irq_common(priv); + +- if (priv->id == ID_MT7531) { +- ret = mt7531_create_sgmii(priv); +- if (ret && priv->irq) +- mt7530_free_irq_common(priv); +- } +- + return ret; + } + +@@ -3129,6 +3123,7 @@ mt7530_probe(struct mdio_device *mdiodev + static struct regmap_config *regmap_config; + struct mt7530_priv *priv; + struct device_node *dn; ++ int ret; + + dn = mdiodev->dev.of_node; + +@@ -3221,6 +3216,12 @@ mt7530_probe(struct mdio_device *mdiodev + if (IS_ERR(priv->regmap)) + return PTR_ERR(priv->regmap); + ++ if (priv->id == ID_MT7531) { ++ ret = mt7531_create_sgmii(priv); ++ if (ret) ++ return ret; ++ } ++ + return dsa_register_switch(priv->ds); + } + diff --git a/target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch b/target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch new file mode 100644 index 00000000000000..c23f96e7a6605a --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch @@ -0,0 +1,273 @@ +From 1557c679f71c82a994eae0baadbaeb62b71e15bf Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:18:16 +0100 +Subject: [PATCH 09/16] net: dsa: mt7530: introduce mutex helpers + +As the MDIO bus lock only needs to be involved if actually operating +on an MDIO-connected switch we will need to skip locking for built-in +switches which are accessed via MMIO. +Create helper functions which simplify that upcoming change. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 73 ++++++++++++++++++++-------------------- + 1 file changed, 36 insertions(+), 37 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -143,31 +143,40 @@ err: + } + + static void +-core_write(struct mt7530_priv *priv, u32 reg, u32 val) ++mt7530_mutex_lock(struct mt7530_priv *priv) + { +- struct mii_bus *bus = priv->bus; ++ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++} + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++static void ++mt7530_mutex_unlock(struct mt7530_priv *priv) ++{ ++ mutex_unlock(&priv->bus->mdio_lock); ++} ++ ++static void ++core_write(struct mt7530_priv *priv, u32 reg, u32 val) ++{ ++ mt7530_mutex_lock(priv); + + core_write_mmd_indirect(priv, reg, MDIO_MMD_VEND2, val); + +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + } + + static void + core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set) + { +- struct mii_bus *bus = priv->bus; + u32 val; + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + val = core_read_mmd_indirect(priv, reg, MDIO_MMD_VEND2); + val &= ~mask; + val |= set; + core_write_mmd_indirect(priv, reg, MDIO_MMD_VEND2, val); + +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + } + + static void +@@ -264,13 +273,11 @@ mt7530_mii_read(struct mt7530_priv *priv + static void + mt7530_write(struct mt7530_priv *priv, u32 reg, u32 val) + { +- struct mii_bus *bus = priv->bus; +- +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + mt7530_mii_write(priv, reg, val); + +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + } + + static u32 +@@ -282,14 +289,13 @@ _mt7530_unlocked_read(struct mt7530_dumm + static u32 + _mt7530_read(struct mt7530_dummy_poll *p) + { +- struct mii_bus *bus = p->priv->bus; + u32 val; + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(p->priv); + + val = mt7530_mii_read(p->priv, p->reg); + +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(p->priv); + + return val; + } +@@ -307,13 +313,11 @@ static void + mt7530_rmw(struct mt7530_priv *priv, u32 reg, + u32 mask, u32 set) + { +- struct mii_bus *bus = priv->bus; +- +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + regmap_update_bits(priv->regmap, reg, mask, set); + +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + } + + static void +@@ -645,14 +649,13 @@ static int + mt7531_ind_c45_phy_read(struct mt7530_priv *priv, int port, int devad, + int regnum) + { +- struct mii_bus *bus = priv->bus; + struct mt7530_dummy_poll p; + u32 reg, val; + int ret; + + INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC); + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + ret = readx_poll_timeout(_mt7530_unlocked_read, &p, val, + !(val & MT7531_PHY_ACS_ST), 20, 100000); +@@ -685,7 +688,7 @@ mt7531_ind_c45_phy_read(struct mt7530_pr + + ret = val & MT7531_MDIO_RW_DATA_MASK; + out: +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + + return ret; + } +@@ -694,14 +697,13 @@ static int + mt7531_ind_c45_phy_write(struct mt7530_priv *priv, int port, int devad, + int regnum, u32 data) + { +- struct mii_bus *bus = priv->bus; + struct mt7530_dummy_poll p; + u32 val, reg; + int ret; + + INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC); + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + ret = readx_poll_timeout(_mt7530_unlocked_read, &p, val, + !(val & MT7531_PHY_ACS_ST), 20, 100000); +@@ -733,7 +735,7 @@ mt7531_ind_c45_phy_write(struct mt7530_p + } + + out: +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + + return ret; + } +@@ -741,14 +743,13 @@ out: + static int + mt7531_ind_c22_phy_read(struct mt7530_priv *priv, int port, int regnum) + { +- struct mii_bus *bus = priv->bus; + struct mt7530_dummy_poll p; + int ret; + u32 val; + + INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC); + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + ret = readx_poll_timeout(_mt7530_unlocked_read, &p, val, + !(val & MT7531_PHY_ACS_ST), 20, 100000); +@@ -771,7 +772,7 @@ mt7531_ind_c22_phy_read(struct mt7530_pr + + ret = val & MT7531_MDIO_RW_DATA_MASK; + out: +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + + return ret; + } +@@ -780,14 +781,13 @@ static int + mt7531_ind_c22_phy_write(struct mt7530_priv *priv, int port, int regnum, + u16 data) + { +- struct mii_bus *bus = priv->bus; + struct mt7530_dummy_poll p; + int ret; + u32 reg; + + INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC); + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + ret = readx_poll_timeout(_mt7530_unlocked_read, &p, reg, + !(reg & MT7531_PHY_ACS_ST), 20, 100000); +@@ -809,7 +809,7 @@ mt7531_ind_c22_phy_write(struct mt7530_p + } + + out: +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + + return ret; + } +@@ -1109,7 +1109,6 @@ static int + mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) + { + struct mt7530_priv *priv = ds->priv; +- struct mii_bus *bus = priv->bus; + int length; + u32 val; + +@@ -1120,7 +1119,7 @@ mt7530_port_change_mtu(struct dsa_switch + if (!dsa_is_cpu_port(ds, port)) + return 0; + +- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + + val = mt7530_mii_read(priv, MT7530_GMACCR); + val &= ~MAX_RX_PKT_LEN_MASK; +@@ -1141,7 +1140,7 @@ mt7530_port_change_mtu(struct dsa_switch + + mt7530_mii_write(priv, MT7530_GMACCR, val); + +- mutex_unlock(&bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + + return 0; + } +@@ -1937,10 +1936,10 @@ mt7530_irq_thread_fn(int irq, void *dev_ + u32 val; + int p; + +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + val = mt7530_mii_read(priv, MT7530_SYS_INT_STS); + mt7530_mii_write(priv, MT7530_SYS_INT_STS, val); +- mutex_unlock(&priv->bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + + for (p = 0; p < MT7530_NUM_PHYS; p++) { + if (BIT(p) & val) { +@@ -1976,7 +1975,7 @@ mt7530_irq_bus_lock(struct irq_data *d) + { + struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); + +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mt7530_mutex_lock(priv); + } + + static void +@@ -1985,7 +1984,7 @@ mt7530_irq_bus_sync_unlock(struct irq_da + struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); + + mt7530_mii_write(priv, MT7530_SYS_INT_EN, priv->irq_enable); +- mutex_unlock(&priv->bus->mdio_lock); ++ mt7530_mutex_unlock(priv); + } + + static struct irq_chip mt7530_irq_chip = { diff --git a/target/linux/generic/backport-5.15/790-v6.4-0007-net-dsa-mt7530-move-p5_intf_modes-function-to-mt7530.patch b/target/linux/generic/backport-5.15/790-v6.4-0007-net-dsa-mt7530-move-p5_intf_modes-function-to-mt7530.patch new file mode 100644 index 00000000000000..bd7ca33f6eddb2 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0007-net-dsa-mt7530-move-p5_intf_modes-function-to-mt7530.patch @@ -0,0 +1,75 @@ +From 25d15dee34a1a40d5fd71636a205e3211f09fd1d Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:18:28 +0100 +Subject: [PATCH 10/16] net: dsa: mt7530: move p5_intf_modes() function to + mt7530.c + +In preparation of splitting mt7530.c into a driver for MDIO-connected +as well as MDIO-accessed built-in switches on one hand and MMIO-accessed +built-in switches move the p5_inft_modes() function from mt7530.h to +mt7530.c. The function is only needed there and will trigger a compiler +warning about a defined but unused function otherwise when including +mt7530.h in the to-be-introduced bus-specific drivers. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 18 ++++++++++++++++++ + drivers/net/dsa/mt7530.h | 18 ------------------ + 2 files changed, 18 insertions(+), 18 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -950,6 +950,24 @@ mt7530_set_ageing_time(struct dsa_switch + return 0; + } + ++static const char *p5_intf_modes(unsigned int p5_interface) ++{ ++ switch (p5_interface) { ++ case P5_DISABLED: ++ return "DISABLED"; ++ case P5_INTF_SEL_PHY_P0: ++ return "PHY P0"; ++ case P5_INTF_SEL_PHY_P4: ++ return "PHY P4"; ++ case P5_INTF_SEL_GMAC5: ++ return "GMAC5"; ++ case P5_INTF_SEL_GMAC5_SGMII: ++ return "GMAC5_SGMII"; ++ default: ++ return "unknown"; ++ } ++} ++ + static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) + { + struct mt7530_priv *priv = ds->priv; +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -682,24 +682,6 @@ enum p5_interface_select { + P5_INTF_SEL_GMAC5_SGMII, + }; + +-static const char *p5_intf_modes(unsigned int p5_interface) +-{ +- switch (p5_interface) { +- case P5_DISABLED: +- return "DISABLED"; +- case P5_INTF_SEL_PHY_P0: +- return "PHY P0"; +- case P5_INTF_SEL_PHY_P4: +- return "PHY P4"; +- case P5_INTF_SEL_GMAC5: +- return "GMAC5"; +- case P5_INTF_SEL_GMAC5_SGMII: +- return "GMAC5_SGMII"; +- default: +- return "unknown"; +- } +-} +- + struct mt7530_priv; + + struct mt753x_pcs { diff --git a/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch b/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch new file mode 100644 index 00000000000000..34a1bd7372d536 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch @@ -0,0 +1,155 @@ +From 37c9c0d8d0b2e24f8c9af72ecd4edd31537284d3 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:18:39 +0100 +Subject: [PATCH 11/16] net: dsa: mt7530: introduce mt7530_probe_common helper + function + +Move commonly used parts from mt7530_probe into new mt7530_probe_common +helper function which will be used by both, mt7530_probe and the +to-be-introduced mt7988_probe. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 98 ++++++++++++++++++++++------------------ + 1 file changed, 54 insertions(+), 44 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -3135,44 +3135,21 @@ static const struct of_device_id mt7530_ + MODULE_DEVICE_TABLE(of, mt7530_of_match); + + static int +-mt7530_probe(struct mdio_device *mdiodev) ++mt7530_probe_common(struct mt7530_priv *priv) + { +- static struct regmap_config *regmap_config; +- struct mt7530_priv *priv; +- struct device_node *dn; +- int ret; ++ struct device *dev = priv->dev; + +- dn = mdiodev->dev.of_node; +- +- priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); +- if (!priv) +- return -ENOMEM; +- +- priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL); ++ priv->ds = devm_kzalloc(dev, sizeof(*priv->ds), GFP_KERNEL); + if (!priv->ds) + return -ENOMEM; + +- priv->ds->dev = &mdiodev->dev; ++ priv->ds->dev = dev; + priv->ds->num_ports = MT7530_NUM_PORTS; + +- /* Use medatek,mcm property to distinguish hardware type that would +- * casues a little bit differences on power-on sequence. +- */ +- priv->mcm = of_property_read_bool(dn, "mediatek,mcm"); +- if (priv->mcm) { +- dev_info(&mdiodev->dev, "MT7530 adapts as multi-chip module\n"); +- +- priv->rstc = devm_reset_control_get(&mdiodev->dev, "mcm"); +- if (IS_ERR(priv->rstc)) { +- dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); +- return PTR_ERR(priv->rstc); +- } +- } +- + /* Get the hardware identifier from the devicetree node. + * We will need it for some of the clock and regulator setup. + */ +- priv->info = of_device_get_match_data(&mdiodev->dev); ++ priv->info = of_device_get_match_data(dev); + if (!priv->info) + return -EINVAL; + +@@ -3186,23 +3163,53 @@ mt7530_probe(struct mdio_device *mdiodev + return -EINVAL; + + priv->id = priv->info->id; ++ priv->dev = dev; ++ priv->ds->priv = priv; ++ priv->ds->ops = &mt7530_switch_ops; ++ mutex_init(&priv->reg_mutex); ++ dev_set_drvdata(dev, priv); + +- if (priv->id == ID_MT7530) { +- priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core"); +- if (IS_ERR(priv->core_pwr)) +- return PTR_ERR(priv->core_pwr); ++ return 0; ++} + +- priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io"); +- if (IS_ERR(priv->io_pwr)) +- return PTR_ERR(priv->io_pwr); +- } ++static int ++mt7530_probe(struct mdio_device *mdiodev) ++{ ++ static struct regmap_config *regmap_config; ++ struct mt7530_priv *priv; ++ struct device_node *dn; ++ int ret; ++ ++ dn = mdiodev->dev.of_node; ++ ++ priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; + +- /* Not MCM that indicates switch works as the remote standalone ++ priv->bus = mdiodev->bus; ++ priv->dev = &mdiodev->dev; ++ ++ ret = mt7530_probe_common(priv); ++ if (ret) ++ return ret; ++ ++ /* Use medatek,mcm property to distinguish hardware type that would ++ * cause a little bit differences on power-on sequence. ++ * Not MCM that indicates switch works as the remote standalone + * integrated circuit so the GPIO pin would be used to complete + * the reset, otherwise memory-mapped register accessing used + * through syscon provides in the case of MCM. + */ +- if (!priv->mcm) { ++ priv->mcm = of_property_read_bool(dn, "mediatek,mcm"); ++ if (priv->mcm) { ++ dev_info(&mdiodev->dev, "MT7530 adapts as multi-chip module\n"); ++ ++ priv->rstc = devm_reset_control_get(&mdiodev->dev, "mcm"); ++ if (IS_ERR(priv->rstc)) { ++ dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); ++ return PTR_ERR(priv->rstc); ++ } ++ } else { + priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(priv->reset)) { +@@ -3211,12 +3218,15 @@ mt7530_probe(struct mdio_device *mdiodev + } + } + +- priv->bus = mdiodev->bus; +- priv->dev = &mdiodev->dev; +- priv->ds->priv = priv; +- priv->ds->ops = &mt7530_switch_ops; +- mutex_init(&priv->reg_mutex); +- dev_set_drvdata(&mdiodev->dev, priv); ++ if (priv->id == ID_MT7530) { ++ priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core"); ++ if (IS_ERR(priv->core_pwr)) ++ return PTR_ERR(priv->core_pwr); ++ ++ priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io"); ++ if (IS_ERR(priv->io_pwr)) ++ return PTR_ERR(priv->io_pwr); ++ } + + regmap_config = devm_kzalloc(&mdiodev->dev, sizeof(*regmap_config), + GFP_KERNEL); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch b/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch new file mode 100644 index 00000000000000..2881365ec77d7b --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch @@ -0,0 +1,55 @@ +From 720d736351761574af02ed093658ab60de60576c Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:18:50 +0100 +Subject: [PATCH 12/16] net: dsa: mt7530: introduce mt7530_remove_common helper + function + +Move commonly used parts from mt7530_remove into new +mt7530_remove_common helper function which will be used by both, +mt7530_remove and the to-be-introduced mt7988_remove. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -3253,6 +3253,17 @@ mt7530_probe(struct mdio_device *mdiodev + } + + static void ++mt7530_remove_common(struct mt7530_priv *priv) ++{ ++ if (priv->irq) ++ mt7530_free_irq(priv); ++ ++ dsa_unregister_switch(priv->ds); ++ ++ mutex_destroy(&priv->reg_mutex); ++} ++ ++static void + mt7530_remove(struct mdio_device *mdiodev) + { + struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); +@@ -3271,16 +3282,11 @@ mt7530_remove(struct mdio_device *mdiode + dev_err(priv->dev, "Failed to disable io pwr: %d\n", + ret); + +- if (priv->irq) +- mt7530_free_irq(priv); +- +- dsa_unregister_switch(priv->ds); ++ mt7530_remove_common(priv); + + for (i = 0; i < 2; ++i) + mtk_pcs_lynxi_destroy(priv->ports[5 + i].sgmii_pcs); + +- mutex_destroy(&priv->reg_mutex); +- + dev_set_drvdata(&mdiodev->dev, NULL); + } + diff --git a/target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch b/target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch new file mode 100644 index 00000000000000..c8e7d93026ddfa --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch @@ -0,0 +1,143 @@ +From 7f54cc9772ced2d76ac11832f0ada43798443ac9 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:19:02 +0100 +Subject: [PATCH 13/16] net: dsa: mt7530: split-off common parts from + mt7531_setup + +MT7988 shares a significant part of the setup function with MT7531. +Split-off those parts into a shared function which is going to be used +also by mt7988_setup. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 99 ++++++++++++++++++++++------------------ + 1 file changed, 55 insertions(+), 44 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -2348,11 +2348,64 @@ mt7530_setup(struct dsa_switch *ds) + } + + static int ++mt7531_setup_common(struct dsa_switch *ds) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ struct dsa_port *cpu_dp; ++ int ret, i; ++ ++ /* BPDU to CPU port */ ++ dsa_switch_for_each_cpu_port(cpu_dp, ds) { ++ mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, ++ BIT(cpu_dp->index)); ++ break; ++ } ++ mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, ++ MT753X_BPDU_CPU_ONLY); ++ ++ /* Enable and reset MIB counters */ ++ mt7530_mib_reset(ds); ++ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) { ++ /* Disable forwarding by default on all ports */ ++ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, ++ PCR_MATRIX_CLR); ++ ++ /* Disable learning by default on all ports */ ++ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); ++ ++ mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); ++ ++ if (dsa_is_cpu_port(ds, i)) { ++ ret = mt753x_cpu_port_enable(ds, i); ++ if (ret) ++ return ret; ++ } else { ++ mt7530_port_disable(ds, i); ++ ++ /* Set default PVID to 0 on all user ports */ ++ mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, ++ G0_PORT_VID_DEF); ++ } ++ ++ /* Enable consistent egress tag */ ++ mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, ++ PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); ++ } ++ ++ /* Flush the FDB table */ ++ ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int + mt7531_setup(struct dsa_switch *ds) + { + struct mt7530_priv *priv = ds->priv; + struct mt7530_dummy_poll p; +- struct dsa_port *cpu_dp; + u32 val, id; + int ret, i; + +@@ -2426,44 +2479,7 @@ mt7531_setup(struct dsa_switch *ds) + mt7531_ind_c45_phy_write(priv, MT753X_CTRL_PHY_ADDR, MDIO_MMD_VEND2, + CORE_PLL_GROUP4, val); + +- /* BPDU to CPU port */ +- dsa_switch_for_each_cpu_port(cpu_dp, ds) { +- mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, +- BIT(cpu_dp->index)); +- break; +- } +- mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, +- MT753X_BPDU_CPU_ONLY); +- +- /* Enable and reset MIB counters */ +- mt7530_mib_reset(ds); +- +- for (i = 0; i < MT7530_NUM_PORTS; i++) { +- /* Disable forwarding by default on all ports */ +- mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, +- PCR_MATRIX_CLR); +- +- /* Disable learning by default on all ports */ +- mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); +- +- mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); +- +- if (dsa_is_cpu_port(ds, i)) { +- ret = mt753x_cpu_port_enable(ds, i); +- if (ret) +- return ret; +- } else { +- mt7530_port_disable(ds, i); +- +- /* Set default PVID to 0 on all user ports */ +- mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, +- G0_PORT_VID_DEF); +- } +- +- /* Enable consistent egress tag */ +- mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, +- PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); +- } ++ mt7531_setup_common(ds); + + /* Setup VLAN ID 0 for VLAN-unaware bridges */ + ret = mt7530_setup_vlan0(priv); +@@ -2473,11 +2489,6 @@ mt7531_setup(struct dsa_switch *ds) + ds->assisted_learning_on_cpu_port = true; + ds->mtu_enforcement_ingress = true; + +- /* Flush the FDB table */ +- ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); +- if (ret < 0) +- return ret; +- + return 0; + } + diff --git a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch new file mode 100644 index 00000000000000..96afa041aad180 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch @@ -0,0 +1,692 @@ +From cb675afcddbbeb2bfa6596e3bc236bc026cd425f Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:19:13 +0100 +Subject: [PATCH 14/16] net: dsa: mt7530: introduce separate MDIO driver + +Split MT7530 switch driver into a common part and a part specific +for MDIO connected switches and multi-chip modules. +Move MDIO-specific functions to newly introduced mt7530-mdio.c while +keeping the common parts in mt7530.c. +Introduce new Kconfig symbol CONFIG_NET_DSA_MT7530_MDIO which is +implied by CONFIG_NET_DSA_MT7530. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + MAINTAINERS | 1 + + drivers/net/dsa/Kconfig | 15 +- + drivers/net/dsa/Makefile | 1 + + drivers/net/dsa/mt7530-mdio.c | 271 ++++++++++++++++++++++++++++++++++ + drivers/net/dsa/mt7530.c | 264 +-------------------------------- + drivers/net/dsa/mt7530.h | 6 + + 6 files changed, 300 insertions(+), 258 deletions(-) + create mode 100644 drivers/net/dsa/mt7530-mdio.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -11901,6 +11901,7 @@ M: Landen Chao + L: netdev@vger.kernel.org + S: Maintained ++F: drivers/net/dsa/mt7530-mdio.c + F: drivers/net/dsa/mt7530.* + F: net/dsa/tag_mtk.c + +--- a/drivers/net/dsa/Kconfig ++++ b/drivers/net/dsa/Kconfig +@@ -37,10 +37,22 @@ config NET_DSA_MT7530 + tristate "MediaTek MT753x and MT7621 Ethernet switch support" + select NET_DSA_TAG_MTK + select MEDIATEK_GE_PHY ++ imply NET_DSA_MT7530_MDIO ++ help ++ This enables support for the MediaTek MT7530 and MT7531 Ethernet ++ switch chips. Multi-chip module MT7530 in MT7621AT, MT7621DAT, ++ MT7621ST and MT7623AI SoCs, and built-in switch in MT7988 SoC are ++ supported as well. ++ ++config NET_DSA_MT7530_MDIO ++ tristate "MediaTek MT7530 MDIO interface driver" ++ depends on NET_DSA_MT7530 + select PCS_MTK_LYNXI + help +- This enables support for the MediaTek MT7530, MT7531, and MT7621 +- Ethernet switch chips. ++ This enables support for the MediaTek MT7530 and MT7531 switch ++ chips which are connected via MDIO, as well as multi-chip ++ module MT7530 which can be found in the MT7621AT, MT7621DAT, ++ MT7621ST and MT7623AI SoCs. + + config NET_DSA_MV88E6060 + tristate "Marvell 88E6060 ethernet switch chip support" +--- a/drivers/net/dsa/Makefile ++++ b/drivers/net/dsa/Makefile +@@ -7,6 +7,7 @@ obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdi + endif + obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o + obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o ++obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o + obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o + obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o + realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o +--- /dev/null ++++ b/drivers/net/dsa/mt7530-mdio.c +@@ -0,0 +1,271 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "mt7530.h" ++ ++static int ++mt7530_regmap_write(void *context, unsigned int reg, unsigned int val) ++{ ++ struct mii_bus *bus = context; ++ u16 page, r, lo, hi; ++ int ret; ++ ++ page = (reg >> 6) & 0x3ff; ++ r = (reg >> 2) & 0xf; ++ lo = val & 0xffff; ++ hi = val >> 16; ++ ++ /* MT7530 uses 31 as the pseudo port */ ++ ret = bus->write(bus, 0x1f, 0x1f, page); ++ if (ret < 0) ++ return ret; ++ ++ ret = bus->write(bus, 0x1f, r, lo); ++ if (ret < 0) ++ return ret; ++ ++ ret = bus->write(bus, 0x1f, 0x10, hi); ++ return ret; ++} ++ ++static int ++mt7530_regmap_read(void *context, unsigned int reg, unsigned int *val) ++{ ++ struct mii_bus *bus = context; ++ u16 page, r, lo, hi; ++ int ret; ++ ++ page = (reg >> 6) & 0x3ff; ++ r = (reg >> 2) & 0xf; ++ ++ /* MT7530 uses 31 as the pseudo port */ ++ ret = bus->write(bus, 0x1f, 0x1f, page); ++ if (ret < 0) ++ return ret; ++ ++ lo = bus->read(bus, 0x1f, r); ++ hi = bus->read(bus, 0x1f, 0x10); ++ ++ *val = (hi << 16) | (lo & 0xffff); ++ ++ return 0; ++} ++ ++static void ++mt7530_mdio_regmap_lock(void *mdio_lock) ++{ ++ mutex_lock_nested(mdio_lock, MDIO_MUTEX_NESTED); ++} ++ ++static void ++mt7530_mdio_regmap_unlock(void *mdio_lock) ++{ ++ mutex_unlock(mdio_lock); ++} ++ ++static const struct regmap_bus mt7530_regmap_bus = { ++ .reg_write = mt7530_regmap_write, ++ .reg_read = mt7530_regmap_read, ++}; ++ ++static int ++mt7531_create_sgmii(struct mt7530_priv *priv) ++{ ++ struct regmap_config *mt7531_pcs_config[2]; ++ struct phylink_pcs *pcs; ++ struct regmap *regmap; ++ int i, ret = 0; ++ ++ for (i = 0; i < 2; i++) { ++ mt7531_pcs_config[i] = devm_kzalloc(priv->dev, ++ sizeof(struct regmap_config), ++ GFP_KERNEL); ++ if (!mt7531_pcs_config[i]) { ++ ret = -ENOMEM; ++ break; ++ } ++ ++ mt7531_pcs_config[i]->name = i ? "port6" : "port5"; ++ mt7531_pcs_config[i]->reg_bits = 16; ++ mt7531_pcs_config[i]->val_bits = 32; ++ mt7531_pcs_config[i]->reg_stride = 4; ++ mt7531_pcs_config[i]->reg_base = MT7531_SGMII_REG_BASE(5 + i); ++ mt7531_pcs_config[i]->max_register = 0x17c; ++ mt7531_pcs_config[i]->lock = mt7530_mdio_regmap_lock; ++ mt7531_pcs_config[i]->unlock = mt7530_mdio_regmap_unlock; ++ mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; ++ ++ regmap = devm_regmap_init(priv->dev, ++ &mt7530_regmap_bus, priv->bus, ++ mt7531_pcs_config[i]); ++ if (IS_ERR(regmap)) { ++ ret = PTR_ERR(regmap); ++ break; ++ } ++ pcs = mtk_pcs_lynxi_create(priv->dev, regmap, ++ MT7531_PHYA_CTRL_SIGNAL3, 0); ++ if (!pcs) { ++ ret = -ENXIO; ++ break; ++ } ++ priv->ports[5 + i].sgmii_pcs = pcs; ++ } ++ ++ if (ret && i) ++ mtk_pcs_lynxi_destroy(priv->ports[5].sgmii_pcs); ++ ++ return ret; ++} ++ ++static const struct of_device_id mt7530_of_match[] = { ++ { .compatible = "mediatek,mt7621", .data = &mt753x_table[ID_MT7621], }, ++ { .compatible = "mediatek,mt7530", .data = &mt753x_table[ID_MT7530], }, ++ { .compatible = "mediatek,mt7531", .data = &mt753x_table[ID_MT7531], }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, mt7530_of_match); ++ ++static int ++mt7530_probe(struct mdio_device *mdiodev) ++{ ++ static struct regmap_config *regmap_config; ++ struct mt7530_priv *priv; ++ struct device_node *dn; ++ int ret; ++ ++ dn = mdiodev->dev.of_node; ++ ++ priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->bus = mdiodev->bus; ++ priv->dev = &mdiodev->dev; ++ ++ ret = mt7530_probe_common(priv); ++ if (ret) ++ return ret; ++ ++ /* Use medatek,mcm property to distinguish hardware type that would ++ * cause a little bit differences on power-on sequence. ++ * Not MCM that indicates switch works as the remote standalone ++ * integrated circuit so the GPIO pin would be used to complete ++ * the reset, otherwise memory-mapped register accessing used ++ * through syscon provides in the case of MCM. ++ */ ++ priv->mcm = of_property_read_bool(dn, "mediatek,mcm"); ++ if (priv->mcm) { ++ dev_info(&mdiodev->dev, "MT7530 adapts as multi-chip module\n"); ++ ++ priv->rstc = devm_reset_control_get(&mdiodev->dev, "mcm"); ++ if (IS_ERR(priv->rstc)) { ++ dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); ++ return PTR_ERR(priv->rstc); ++ } ++ } else { ++ priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset", ++ GPIOD_OUT_LOW); ++ if (IS_ERR(priv->reset)) { ++ dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); ++ return PTR_ERR(priv->reset); ++ } ++ } ++ ++ if (priv->id == ID_MT7530) { ++ priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core"); ++ if (IS_ERR(priv->core_pwr)) ++ return PTR_ERR(priv->core_pwr); ++ ++ priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io"); ++ if (IS_ERR(priv->io_pwr)) ++ return PTR_ERR(priv->io_pwr); ++ } ++ ++ regmap_config = devm_kzalloc(&mdiodev->dev, sizeof(*regmap_config), ++ GFP_KERNEL); ++ if (!regmap_config) ++ return -ENOMEM; ++ ++ regmap_config->reg_bits = 16; ++ regmap_config->val_bits = 32; ++ regmap_config->reg_stride = 4; ++ regmap_config->max_register = MT7530_CREV; ++ regmap_config->disable_locking = true; ++ priv->regmap = devm_regmap_init(priv->dev, &mt7530_regmap_bus, ++ priv->bus, regmap_config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); ++ ++ if (priv->id == ID_MT7531) { ++ ret = mt7531_create_sgmii(priv); ++ if (ret) ++ return ret; ++ } ++ ++ return dsa_register_switch(priv->ds); ++} ++ ++static void ++mt7530_remove(struct mdio_device *mdiodev) ++{ ++ struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); ++ int ret = 0, i; ++ ++ if (!priv) ++ return; ++ ++ ret = regulator_disable(priv->core_pwr); ++ if (ret < 0) ++ dev_err(priv->dev, ++ "Failed to disable core power: %d\n", ret); ++ ++ ret = regulator_disable(priv->io_pwr); ++ if (ret < 0) ++ dev_err(priv->dev, "Failed to disable io pwr: %d\n", ++ ret); ++ ++ mt7530_remove_common(priv); ++ ++ for (i = 0; i < 2; ++i) ++ mtk_pcs_lynxi_destroy(priv->ports[5 + i].sgmii_pcs); ++} ++ ++static void mt7530_shutdown(struct mdio_device *mdiodev) ++{ ++ struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); ++ ++ if (!priv) ++ return; ++ ++ dsa_switch_shutdown(priv->ds); ++ ++ dev_set_drvdata(&mdiodev->dev, NULL); ++} ++ ++static struct mdio_driver mt7530_mdio_driver = { ++ .probe = mt7530_probe, ++ .remove = mt7530_remove, ++ .shutdown = mt7530_shutdown, ++ .mdiodrv.driver = { ++ .name = "mt7530-mdio", ++ .of_match_table = mt7530_of_match, ++ }, ++}; ++ ++mdio_module_driver(mt7530_mdio_driver); ++ ++MODULE_AUTHOR("Sean Wang "); ++MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch (MDIO)"); ++MODULE_LICENSE("GPL"); +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -14,7 +14,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -192,31 +191,6 @@ core_clear(struct mt7530_priv *priv, u32 + } + + static int +-mt7530_regmap_write(void *context, unsigned int reg, unsigned int val) +-{ +- struct mii_bus *bus = context; +- u16 page, r, lo, hi; +- int ret; +- +- page = (reg >> 6) & 0x3ff; +- r = (reg >> 2) & 0xf; +- lo = val & 0xffff; +- hi = val >> 16; +- +- /* MT7530 uses 31 as the pseudo port */ +- ret = bus->write(bus, 0x1f, 0x1f, page); +- if (ret < 0) +- return ret; +- +- ret = bus->write(bus, 0x1f, r, lo); +- if (ret < 0) +- return ret; +- +- ret = bus->write(bus, 0x1f, 0x10, hi); +- return ret; +-} +- +-static int + mt7530_mii_write(struct mt7530_priv *priv, u32 reg, u32 val) + { + int ret; +@@ -230,29 +204,6 @@ mt7530_mii_write(struct mt7530_priv *pri + return ret; + } + +-static int +-mt7530_regmap_read(void *context, unsigned int reg, unsigned int *val) +-{ +- struct mii_bus *bus = context; +- u16 page, r, lo, hi; +- int ret; +- +- page = (reg >> 6) & 0x3ff; +- r = (reg >> 2) & 0xf; +- +- /* MT7530 uses 31 as the pseudo port */ +- ret = bus->write(bus, 0x1f, 0x1f, page); +- if (ret < 0) +- return ret; +- +- lo = bus->read(bus, 0x1f, r); +- hi = bus->read(bus, 0x1f, 0x10); +- +- *val = (hi << 16) | (lo & 0xffff); +- +- return 0; +-} +- + static u32 + mt7530_mii_read(struct mt7530_priv *priv, u32 reg) + { +@@ -2944,72 +2895,6 @@ static const struct phylink_pcs_ops mt75 + .pcs_an_restart = mt7530_pcs_an_restart, + }; + +-static void +-mt7530_mdio_regmap_lock(void *mdio_lock) +-{ +- mutex_lock_nested(mdio_lock, MDIO_MUTEX_NESTED); +-} +- +-static void +-mt7530_mdio_regmap_unlock(void *mdio_lock) +-{ +- mutex_unlock(mdio_lock); +-} +- +-static const struct regmap_bus mt7530_regmap_bus = { +- .reg_write = mt7530_regmap_write, +- .reg_read = mt7530_regmap_read, +-}; +- +-static int +-mt7531_create_sgmii(struct mt7530_priv *priv) +-{ +- struct regmap_config *mt7531_pcs_config[2]; +- struct phylink_pcs *pcs; +- struct regmap *regmap; +- int i, ret = 0; +- +- for (i = 0; i < 2; i++) { +- mt7531_pcs_config[i] = devm_kzalloc(priv->dev, +- sizeof(struct regmap_config), +- GFP_KERNEL); +- if (!mt7531_pcs_config[i]) { +- ret = -ENOMEM; +- break; +- } +- +- mt7531_pcs_config[i]->name = i ? "port6" : "port5"; +- mt7531_pcs_config[i]->reg_bits = 16; +- mt7531_pcs_config[i]->val_bits = 32; +- mt7531_pcs_config[i]->reg_stride = 4; +- mt7531_pcs_config[i]->reg_base = MT7531_SGMII_REG_BASE(5 + i); +- mt7531_pcs_config[i]->max_register = 0x17c; +- mt7531_pcs_config[i]->lock = mt7530_mdio_regmap_lock; +- mt7531_pcs_config[i]->unlock = mt7530_mdio_regmap_unlock; +- mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; +- +- regmap = devm_regmap_init(priv->dev, +- &mt7530_regmap_bus, priv->bus, +- mt7531_pcs_config[i]); +- if (IS_ERR(regmap)) { +- ret = PTR_ERR(regmap); +- break; +- } +- pcs = mtk_pcs_lynxi_create(priv->dev, regmap, +- MT7531_PHYA_CTRL_SIGNAL3, 0); +- if (!pcs) { +- ret = -ENXIO; +- break; +- } +- priv->ports[5 + i].sgmii_pcs = pcs; +- } +- +- if (ret && i) +- mtk_pcs_lynxi_destroy(priv->ports[5].sgmii_pcs); +- +- return ret; +-} +- + static int + mt753x_setup(struct dsa_switch *ds) + { +@@ -3068,7 +2953,7 @@ static int mt753x_set_mac_eee(struct dsa + return 0; + } + +-static const struct dsa_switch_ops mt7530_switch_ops = { ++const struct dsa_switch_ops mt7530_switch_ops = { + .get_tag_protocol = mtk_get_tag_protocol, + .setup = mt753x_setup, + .get_strings = mt7530_get_strings, +@@ -3102,8 +2987,9 @@ static const struct dsa_switch_ops mt753 + .get_mac_eee = mt753x_get_mac_eee, + .set_mac_eee = mt753x_set_mac_eee, + }; ++EXPORT_SYMBOL_GPL(mt7530_switch_ops); + +-static const struct mt753x_info mt753x_table[] = { ++const struct mt753x_info mt753x_table[] = { + [ID_MT7621] = { + .id = ID_MT7621, + .pcs_ops = &mt7530_pcs_ops, +@@ -3136,16 +3022,9 @@ static const struct mt753x_info mt753x_t + .mac_port_config = mt7531_mac_config, + }, + }; ++EXPORT_SYMBOL_GPL(mt753x_table); + +-static const struct of_device_id mt7530_of_match[] = { +- { .compatible = "mediatek,mt7621", .data = &mt753x_table[ID_MT7621], }, +- { .compatible = "mediatek,mt7530", .data = &mt753x_table[ID_MT7530], }, +- { .compatible = "mediatek,mt7531", .data = &mt753x_table[ID_MT7531], }, +- { /* sentinel */ }, +-}; +-MODULE_DEVICE_TABLE(of, mt7530_of_match); +- +-static int ++int + mt7530_probe_common(struct mt7530_priv *priv) + { + struct device *dev = priv->dev; +@@ -3182,88 +3061,9 @@ mt7530_probe_common(struct mt7530_priv * + + return 0; + } ++EXPORT_SYMBOL_GPL(mt7530_probe_common); + +-static int +-mt7530_probe(struct mdio_device *mdiodev) +-{ +- static struct regmap_config *regmap_config; +- struct mt7530_priv *priv; +- struct device_node *dn; +- int ret; +- +- dn = mdiodev->dev.of_node; +- +- priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); +- if (!priv) +- return -ENOMEM; +- +- priv->bus = mdiodev->bus; +- priv->dev = &mdiodev->dev; +- +- ret = mt7530_probe_common(priv); +- if (ret) +- return ret; +- +- /* Use medatek,mcm property to distinguish hardware type that would +- * cause a little bit differences on power-on sequence. +- * Not MCM that indicates switch works as the remote standalone +- * integrated circuit so the GPIO pin would be used to complete +- * the reset, otherwise memory-mapped register accessing used +- * through syscon provides in the case of MCM. +- */ +- priv->mcm = of_property_read_bool(dn, "mediatek,mcm"); +- if (priv->mcm) { +- dev_info(&mdiodev->dev, "MT7530 adapts as multi-chip module\n"); +- +- priv->rstc = devm_reset_control_get(&mdiodev->dev, "mcm"); +- if (IS_ERR(priv->rstc)) { +- dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); +- return PTR_ERR(priv->rstc); +- } +- } else { +- priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset", +- GPIOD_OUT_LOW); +- if (IS_ERR(priv->reset)) { +- dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); +- return PTR_ERR(priv->reset); +- } +- } +- +- if (priv->id == ID_MT7530) { +- priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core"); +- if (IS_ERR(priv->core_pwr)) +- return PTR_ERR(priv->core_pwr); +- +- priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io"); +- if (IS_ERR(priv->io_pwr)) +- return PTR_ERR(priv->io_pwr); +- } +- +- regmap_config = devm_kzalloc(&mdiodev->dev, sizeof(*regmap_config), +- GFP_KERNEL); +- if (!regmap_config) +- return -ENOMEM; +- +- regmap_config->reg_bits = 16; +- regmap_config->val_bits = 32; +- regmap_config->reg_stride = 4; +- regmap_config->max_register = MT7530_CREV; +- regmap_config->disable_locking = true; +- priv->regmap = devm_regmap_init(priv->dev, &mt7530_regmap_bus, +- priv->bus, regmap_config); +- if (IS_ERR(priv->regmap)) +- return PTR_ERR(priv->regmap); +- +- if (priv->id == ID_MT7531) { +- ret = mt7531_create_sgmii(priv); +- if (ret) +- return ret; +- } +- +- return dsa_register_switch(priv->ds); +-} +- +-static void ++void + mt7530_remove_common(struct mt7530_priv *priv) + { + if (priv->irq) +@@ -3274,57 +3074,6 @@ mt7530_remove_common(struct mt7530_priv + mutex_destroy(&priv->reg_mutex); + } + +-static void +-mt7530_remove(struct mdio_device *mdiodev) +-{ +- struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); +- int ret = 0, i; +- +- if (!priv) +- return; +- +- ret = regulator_disable(priv->core_pwr); +- if (ret < 0) +- dev_err(priv->dev, +- "Failed to disable core power: %d\n", ret); +- +- ret = regulator_disable(priv->io_pwr); +- if (ret < 0) +- dev_err(priv->dev, "Failed to disable io pwr: %d\n", +- ret); +- +- mt7530_remove_common(priv); +- +- for (i = 0; i < 2; ++i) +- mtk_pcs_lynxi_destroy(priv->ports[5 + i].sgmii_pcs); +- +- dev_set_drvdata(&mdiodev->dev, NULL); +-} +- +-static void mt7530_shutdown(struct mdio_device *mdiodev) +-{ +- struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); +- +- if (!priv) +- return; +- +- dsa_switch_shutdown(priv->ds); +- +- dev_set_drvdata(&mdiodev->dev, NULL); +-} +- +-static struct mdio_driver mt7530_mdio_driver = { +- .probe = mt7530_probe, +- .remove = mt7530_remove, +- .shutdown = mt7530_shutdown, +- .mdiodrv.driver = { +- .name = "mt7530", +- .of_match_table = mt7530_of_match, +- }, +-}; +- +-mdio_module_driver(mt7530_mdio_driver); +- + MODULE_AUTHOR("Sean Wang "); + MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch"); + MODULE_LICENSE("GPL"); +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -807,4 +807,10 @@ static inline void INIT_MT7530_DUMMY_POL + p->reg = reg; + } + ++int mt7530_probe_common(struct mt7530_priv *priv); ++void mt7530_remove_common(struct mt7530_priv *priv); ++ ++extern const struct dsa_switch_ops mt7530_switch_ops; ++extern const struct mt753x_info mt753x_table[]; ++ + #endif /* __MT7530_H */ diff --git a/target/linux/generic/backport-5.15/790-v6.4-0012-net-dsa-mt7530-skip-locking-if-MDIO-bus-isn-t-presen.patch b/target/linux/generic/backport-5.15/790-v6.4-0012-net-dsa-mt7530-skip-locking-if-MDIO-bus-isn-t-presen.patch new file mode 100644 index 00000000000000..95b7cc6afe5112 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0012-net-dsa-mt7530-skip-locking-if-MDIO-bus-isn-t-presen.patch @@ -0,0 +1,47 @@ +From 54d4147a121cec5004a673a58572da346e4458f8 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:19:28 +0100 +Subject: [PATCH 15/16] net: dsa: mt7530: skip locking if MDIO bus isn't + present + +As MT7530 and MT7531 internally use 32-bit wide registers, each access +to any register of the switch requires several operations on the MDIO +bus. Hence if there is congruent access, e.g. due to PCS or PHY +polling, this can mess up and interfere with another ongoing register +access sequence. + +However, the MDIO bus mutex is only relevant for MDIO-connected +switches. Prepare switches which have there registers directly mapped +into the SoCs register space via MMIO which do not require such +locking. There we can simply use regmap's default locking mechanism. + +Hence guard mutex operations to only be performed in case of MDIO +connected switches. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -144,13 +144,15 @@ err: + static void + mt7530_mutex_lock(struct mt7530_priv *priv) + { +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ if (priv->bus) ++ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); + } + + static void + mt7530_mutex_unlock(struct mt7530_priv *priv) + { +- mutex_unlock(&priv->bus->mdio_lock); ++ if (priv->bus) ++ mutex_unlock(&priv->bus->mdio_lock); + } + + static void diff --git a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch new file mode 100644 index 00000000000000..8210aae27ce0c7 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch @@ -0,0 +1,421 @@ +From 110c18bfed41421edd677935dd33be5e6507ba92 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 3 Apr 2023 02:19:40 +0100 +Subject: [PATCH 16/16] net: dsa: mt7530: introduce driver for MT7988 built-in + switch + +Add driver for the built-in Gigabit Ethernet switch which can be found +in the MediaTek MT7988 SoC. + +The switch shares most of its design with MT7530 and MT7531, but has +it's registers mapped into the SoCs register space rather than being +connected externally or internally via MDIO. + +Introduce a new platform driver to support that. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + MAINTAINERS | 2 + + drivers/net/dsa/Kconfig | 12 +++ + drivers/net/dsa/Makefile | 1 + + drivers/net/dsa/mt7530-mmio.c | 101 +++++++++++++++++++++++++ + drivers/net/dsa/mt7530.c | 137 +++++++++++++++++++++++++++++++++- + drivers/net/dsa/mt7530.h | 12 +-- + 6 files changed, 255 insertions(+), 10 deletions(-) + create mode 100644 drivers/net/dsa/mt7530-mmio.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -11899,9 +11899,11 @@ MEDIATEK SWITCH DRIVER + M: Sean Wang + M: Landen Chao + M: DENG Qingfang ++M: Daniel Golle + L: netdev@vger.kernel.org + S: Maintained + F: drivers/net/dsa/mt7530-mdio.c ++F: drivers/net/dsa/mt7530-mmio.c + F: drivers/net/dsa/mt7530.* + F: net/dsa/tag_mtk.c + +--- a/drivers/net/dsa/Kconfig ++++ b/drivers/net/dsa/Kconfig +@@ -38,6 +38,7 @@ config NET_DSA_MT7530 + select NET_DSA_TAG_MTK + select MEDIATEK_GE_PHY + imply NET_DSA_MT7530_MDIO ++ imply NET_DSA_MT7530_MMIO + help + This enables support for the MediaTek MT7530 and MT7531 Ethernet + switch chips. Multi-chip module MT7530 in MT7621AT, MT7621DAT, +@@ -54,6 +55,17 @@ config NET_DSA_MT7530_MDIO + module MT7530 which can be found in the MT7621AT, MT7621DAT, + MT7621ST and MT7623AI SoCs. + ++config NET_DSA_MT7530_MMIO ++ tristate "MediaTek MT7530 MMIO interface driver" ++ depends on NET_DSA_MT7530 ++ depends on HAS_IOMEM ++ help ++ This enables support for the built-in Ethernet switch found ++ in the MediaTek MT7988 SoC. ++ The switch is a similar design as MT7531, but the switch registers ++ are directly mapped into the SoCs register space rather than being ++ accessible via MDIO. ++ + config NET_DSA_MV88E6060 + tristate "Marvell 88E6060 ethernet switch chip support" + select NET_DSA_TAG_TRAILER +--- a/drivers/net/dsa/Makefile ++++ b/drivers/net/dsa/Makefile +@@ -8,6 +8,7 @@ endif + obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o + obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o + obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o ++obj-$(CONFIG_NET_DSA_MT7530_MMIO) += mt7530-mmio.o + obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o + obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o + realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o +--- /dev/null ++++ b/drivers/net/dsa/mt7530-mmio.c +@@ -0,0 +1,101 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "mt7530.h" ++ ++static const struct of_device_id mt7988_of_match[] = { ++ { .compatible = "mediatek,mt7988-switch", .data = &mt753x_table[ID_MT7988], }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, mt7988_of_match); ++ ++static int ++mt7988_probe(struct platform_device *pdev) ++{ ++ static struct regmap_config *sw_regmap_config; ++ struct mt7530_priv *priv; ++ void __iomem *base_addr; ++ int ret; ++ ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->bus = NULL; ++ priv->dev = &pdev->dev; ++ ++ ret = mt7530_probe_common(priv); ++ if (ret) ++ return ret; ++ ++ priv->rstc = devm_reset_control_get(&pdev->dev, NULL); ++ if (IS_ERR(priv->rstc)) { ++ dev_err(&pdev->dev, "Couldn't get our reset line\n"); ++ return PTR_ERR(priv->rstc); ++ } ++ ++ base_addr = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base_addr)) { ++ dev_err(&pdev->dev, "cannot request I/O memory space\n"); ++ return -ENXIO; ++ } ++ ++ sw_regmap_config = devm_kzalloc(&pdev->dev, sizeof(*sw_regmap_config), GFP_KERNEL); ++ if (!sw_regmap_config) ++ return -ENOMEM; ++ ++ sw_regmap_config->name = "switch"; ++ sw_regmap_config->reg_bits = 16; ++ sw_regmap_config->val_bits = 32; ++ sw_regmap_config->reg_stride = 4; ++ sw_regmap_config->max_register = MT7530_CREV; ++ priv->regmap = devm_regmap_init_mmio(&pdev->dev, base_addr, sw_regmap_config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); ++ ++ return dsa_register_switch(priv->ds); ++} ++ ++static int ++mt7988_remove(struct platform_device *pdev) ++{ ++ struct mt7530_priv *priv = platform_get_drvdata(pdev); ++ ++ if (priv) ++ mt7530_remove_common(priv); ++ ++ return 0; ++} ++ ++static void mt7988_shutdown(struct platform_device *pdev) ++{ ++ struct mt7530_priv *priv = platform_get_drvdata(pdev); ++ ++ if (!priv) ++ return; ++ ++ dsa_switch_shutdown(priv->ds); ++ ++ dev_set_drvdata(&pdev->dev, NULL); ++} ++ ++static struct platform_driver mt7988_platform_driver = { ++ .probe = mt7988_probe, ++ .remove = mt7988_remove, ++ .shutdown = mt7988_shutdown, ++ .driver = { ++ .name = "mt7530-mmio", ++ .of_match_table = mt7988_of_match, ++ }, ++}; ++module_platform_driver(mt7988_platform_driver); ++ ++MODULE_AUTHOR("Daniel Golle "); ++MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch (MMIO)"); ++MODULE_LICENSE("GPL"); +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1984,6 +1984,47 @@ static const struct irq_domain_ops mt753 + }; + + static void ++mt7988_irq_mask(struct irq_data *d) ++{ ++ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); ++ ++ priv->irq_enable &= ~BIT(d->hwirq); ++ mt7530_mii_write(priv, MT7530_SYS_INT_EN, priv->irq_enable); ++} ++ ++static void ++mt7988_irq_unmask(struct irq_data *d) ++{ ++ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); ++ ++ priv->irq_enable |= BIT(d->hwirq); ++ mt7530_mii_write(priv, MT7530_SYS_INT_EN, priv->irq_enable); ++} ++ ++static struct irq_chip mt7988_irq_chip = { ++ .name = KBUILD_MODNAME, ++ .irq_mask = mt7988_irq_mask, ++ .irq_unmask = mt7988_irq_unmask, ++}; ++ ++static int ++mt7988_irq_map(struct irq_domain *domain, unsigned int irq, ++ irq_hw_number_t hwirq) ++{ ++ irq_set_chip_data(irq, domain->host_data); ++ irq_set_chip_and_handler(irq, &mt7988_irq_chip, handle_simple_irq); ++ irq_set_nested_thread(irq, true); ++ irq_set_noprobe(irq); ++ ++ return 0; ++} ++ ++static const struct irq_domain_ops mt7988_irq_domain_ops = { ++ .map = mt7988_irq_map, ++ .xlate = irq_domain_xlate_onecell, ++}; ++ ++static void + mt7530_setup_mdio_irq(struct mt7530_priv *priv) + { + struct dsa_switch *ds = priv->ds; +@@ -2017,8 +2058,15 @@ mt7530_setup_irq(struct mt7530_priv *pri + return priv->irq ? : -EINVAL; + } + +- priv->irq_domain = irq_domain_add_linear(np, MT7530_NUM_PHYS, +- &mt7530_irq_domain_ops, priv); ++ if (priv->id == ID_MT7988) ++ priv->irq_domain = irq_domain_add_linear(np, MT7530_NUM_PHYS, ++ &mt7988_irq_domain_ops, ++ priv); ++ else ++ priv->irq_domain = irq_domain_add_linear(np, MT7530_NUM_PHYS, ++ &mt7530_irq_domain_ops, ++ priv); ++ + if (!priv->irq_domain) { + dev_err(dev, "failed to create IRQ domain\n"); + return -ENOMEM; +@@ -2507,6 +2555,25 @@ static void mt7531_mac_port_get_caps(str + } + } + ++static void mt7988_mac_port_get_caps(struct dsa_switch *ds, int port, ++ struct phylink_config *config) ++{ ++ phy_interface_zero(config->supported_interfaces); ++ ++ switch (port) { ++ case 0 ... 4: /* Internal phy */ ++ __set_bit(PHY_INTERFACE_MODE_INTERNAL, ++ config->supported_interfaces); ++ break; ++ ++ case 6: ++ __set_bit(PHY_INTERFACE_MODE_INTERNAL, ++ config->supported_interfaces); ++ config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | ++ MAC_10000FD; ++ } ++} ++ + static int + mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) + { +@@ -2583,6 +2650,17 @@ static bool mt753x_is_mac_port(u32 port) + } + + static int ++mt7988_mac_config(struct dsa_switch *ds, int port, unsigned int mode, ++ phy_interface_t interface) ++{ ++ if (dsa_is_cpu_port(ds, port) && ++ interface == PHY_INTERFACE_MODE_INTERNAL) ++ return 0; ++ ++ return -EINVAL; ++} ++ ++static int + mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, + phy_interface_t interface) + { +@@ -2652,7 +2730,8 @@ mt753x_phylink_mac_config(struct dsa_swi + + switch (port) { + case 0 ... 4: /* Internal phy */ +- if (state->interface != PHY_INTERFACE_MODE_GMII) ++ if (state->interface != PHY_INTERFACE_MODE_GMII && ++ state->interface != PHY_INTERFACE_MODE_INTERNAL) + goto unsupported; + break; + case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */ +@@ -2730,7 +2809,8 @@ static void mt753x_phylink_mac_link_up(s + /* MT753x MAC works in 1G full duplex mode for all up-clocked + * variants. + */ +- if (interface == PHY_INTERFACE_MODE_TRGMII || ++ if (interface == PHY_INTERFACE_MODE_INTERNAL || ++ interface == PHY_INTERFACE_MODE_TRGMII || + (phy_interface_mode_is_8023z(interface))) { + speed = SPEED_1000; + duplex = DUPLEX_FULL; +@@ -2810,6 +2890,21 @@ mt7531_cpu_port_config(struct dsa_switch + return 0; + } + ++static int ++mt7988_cpu_port_config(struct dsa_switch *ds, int port) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ ++ mt7530_write(priv, MT7530_PMCR_P(port), ++ PMCR_CPU_PORT_SETTING(priv->id)); ++ ++ mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, ++ PHY_INTERFACE_MODE_INTERNAL, NULL, ++ SPEED_10000, DUPLEX_FULL, true, true); ++ ++ return 0; ++} ++ + static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, + struct phylink_config *config) + { +@@ -2955,6 +3050,27 @@ static int mt753x_set_mac_eee(struct dsa + return 0; + } + ++static int mt7988_pad_setup(struct dsa_switch *ds, phy_interface_t interface) ++{ ++ return 0; ++} ++ ++static int mt7988_setup(struct dsa_switch *ds) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ ++ /* Reset the switch */ ++ reset_control_assert(priv->rstc); ++ usleep_range(20, 50); ++ reset_control_deassert(priv->rstc); ++ usleep_range(20, 50); ++ ++ /* Reset the switch PHYs */ ++ mt7530_write(priv, MT7530_SYS_CTRL, SYS_CTRL_PHY_RST); ++ ++ return mt7531_setup_common(ds); ++} ++ + const struct dsa_switch_ops mt7530_switch_ops = { + .get_tag_protocol = mtk_get_tag_protocol, + .setup = mt753x_setup, +@@ -3023,6 +3139,17 @@ const struct mt753x_info mt753x_table[] + .mac_port_get_caps = mt7531_mac_port_get_caps, + .mac_port_config = mt7531_mac_config, + }, ++ [ID_MT7988] = { ++ .id = ID_MT7988, ++ .pcs_ops = &mt7530_pcs_ops, ++ .sw_setup = mt7988_setup, ++ .phy_read = mt7531_ind_phy_read, ++ .phy_write = mt7531_ind_phy_write, ++ .pad_setup = mt7988_pad_setup, ++ .cpu_port_config = mt7988_cpu_port_config, ++ .mac_port_get_caps = mt7988_mac_port_get_caps, ++ .mac_port_config = mt7988_mac_config, ++ }, + }; + EXPORT_SYMBOL_GPL(mt753x_table); + +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -18,6 +18,7 @@ enum mt753x_id { + ID_MT7530 = 0, + ID_MT7621 = 1, + ID_MT7531 = 2, ++ ID_MT7988 = 3, + }; + + #define NUM_TRGMII_CTRL 5 +@@ -54,11 +55,11 @@ enum mt753x_id { + #define MT7531_MIRROR_PORT_SET(x) (((x) & MIRROR_MASK) << 16) + #define MT7531_CPU_PMAP_MASK GENMASK(7, 0) + +-#define MT753X_MIRROR_REG(id) (((id) == ID_MT7531) ? \ ++#define MT753X_MIRROR_REG(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ + MT7531_CFC : MT7530_MFC) +-#define MT753X_MIRROR_EN(id) (((id) == ID_MT7531) ? \ ++#define MT753X_MIRROR_EN(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ + MT7531_MIRROR_EN : MIRROR_EN) +-#define MT753X_MIRROR_MASK(id) (((id) == ID_MT7531) ? \ ++#define MT753X_MIRROR_MASK(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ + MT7531_MIRROR_MASK : MIRROR_MASK) + + /* Registers for BPDU and PAE frame control*/ +@@ -295,9 +296,8 @@ enum mt7530_vlan_port_acc_frm { + MT7531_FORCE_DPX | \ + MT7531_FORCE_RX_FC | \ + MT7531_FORCE_TX_FC) +-#define PMCR_FORCE_MODE_ID(id) (((id) == ID_MT7531) ? \ +- MT7531_FORCE_MODE : \ +- PMCR_FORCE_MODE) ++#define PMCR_FORCE_MODE_ID(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ ++ MT7531_FORCE_MODE : PMCR_FORCE_MODE) + #define PMCR_LINK_SETTINGS_MASK (PMCR_TX_EN | PMCR_FORCE_SPEED_1000 | \ + PMCR_RX_EN | PMCR_FORCE_SPEED_100 | \ + PMCR_TX_FC_EN | PMCR_RX_FC_EN | \ diff --git a/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch b/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch new file mode 100644 index 00000000000000..5259730996d1c5 --- /dev/null +++ b/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch @@ -0,0 +1,118 @@ +From 91daa4f62ce878b6e1ac5908aceb83550332447f Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 16 Apr 2023 13:08:14 +0100 +Subject: [PATCH] net: dsa: mt7530: fix support for MT7531BE +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There are two variants of the MT7531 switch IC which got different +features (and pins) regarding port 5: + * MT7531AE: SGMII/1000Base-X/2500Base-X SerDes PCS + * MT7531BE: RGMII + +Moving the creation of the SerDes PCS from mt753x_setup to mt7530_probe +with commit 6de285229773 ("net: dsa: mt7530: move SGMII PCS creation +to mt7530_probe function") works fine for MT7531AE which got two +instances of mtk-pcs-lynxi, however, MT7531BE requires mt7531_pll_setup +to setup clocks before the single PCS on port 6 (usually used as CPU +port) starts to work and hence the PCS creation failed on MT7531BE. + +Fix this by introducing a pointer to mt7531_create_sgmii function in +struct mt7530_priv and call it again at the end of mt753x_setup like it +was before commit 6de285229773 ("net: dsa: mt7530: move SGMII PCS +creation to mt7530_probe function"). + +Fixes: 6de285229773 ("net: dsa: mt7530: move SGMII PCS creation to mt7530_probe function") +Signed-off-by: Daniel Golle +Acked-by: Arınç ÜNAL +Link: https://lore.kernel.org/r/ZDvlLhhqheobUvOK@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/mt7530-mdio.c | 16 ++++++++-------- + drivers/net/dsa/mt7530.c | 6 ++++++ + drivers/net/dsa/mt7530.h | 4 ++-- + 3 files changed, 16 insertions(+), 10 deletions(-) + +--- a/drivers/net/dsa/mt7530-mdio.c ++++ b/drivers/net/dsa/mt7530-mdio.c +@@ -81,14 +81,17 @@ static const struct regmap_bus mt7530_re + }; + + static int +-mt7531_create_sgmii(struct mt7530_priv *priv) ++mt7531_create_sgmii(struct mt7530_priv *priv, bool dual_sgmii) + { +- struct regmap_config *mt7531_pcs_config[2]; ++ struct regmap_config *mt7531_pcs_config[2] = {}; + struct phylink_pcs *pcs; + struct regmap *regmap; + int i, ret = 0; + +- for (i = 0; i < 2; i++) { ++ /* MT7531AE has two SGMII units for port 5 and port 6 ++ * MT7531BE has only one SGMII unit for port 6 ++ */ ++ for (i = dual_sgmii ? 0 : 1; i < 2; i++) { + mt7531_pcs_config[i] = devm_kzalloc(priv->dev, + sizeof(struct regmap_config), + GFP_KERNEL); +@@ -208,11 +211,8 @@ mt7530_probe(struct mdio_device *mdiodev + if (IS_ERR(priv->regmap)) + return PTR_ERR(priv->regmap); + +- if (priv->id == ID_MT7531) { +- ret = mt7531_create_sgmii(priv); +- if (ret) +- return ret; +- } ++ if (priv->id == ID_MT7531) ++ priv->create_sgmii = mt7531_create_sgmii; + + return dsa_register_switch(priv->ds); + } +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -3017,6 +3017,12 @@ mt753x_setup(struct dsa_switch *ds) + if (ret && priv->irq) + mt7530_free_irq_common(priv); + ++ if (priv->create_sgmii) { ++ ret = priv->create_sgmii(priv, mt7531_dual_sgmii_supported(priv)); ++ if (ret && priv->irq) ++ mt7530_free_irq(priv); ++ } ++ + return ret; + } + +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -741,10 +741,10 @@ struct mt753x_info { + * registers + * @p6_interface Holding the current port 6 interface + * @p5_intf_sel: Holding the current port 5 interface select +- * + * @irq: IRQ number of the switch + * @irq_domain: IRQ domain of the switch irq_chip + * @irq_enable: IRQ enable bits, synced to SYS_INT_EN ++ * @create_sgmii: Pointer to function creating SGMII PCS instance(s) + */ + struct mt7530_priv { + struct device *dev; +@@ -763,7 +763,6 @@ struct mt7530_priv { + unsigned int p5_intf_sel; + u8 mirror_rx; + u8 mirror_tx; +- + struct mt7530_port ports[MT7530_NUM_PORTS]; + struct mt753x_pcs pcs[MT7530_NUM_PORTS]; + /* protect among processes for registers access*/ +@@ -771,6 +770,7 @@ struct mt7530_priv { + int irq; + struct irq_domain *irq_domain; + u32 irq_enable; ++ int (*create_sgmii)(struct mt7530_priv *priv, bool dual_sgmii); + }; + + struct mt7530_hw_vlan_entry { diff --git a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch index 57137c34fc6b54..e2a0e25a7941f7 100644 --- a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch +++ b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch @@ -21,7 +21,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -12697,6 +12697,7 @@ F: include/uapi/linux/meye.h +@@ -12700,6 +12700,7 @@ F: include/uapi/linux/meye.h MOTORCOMM PHY DRIVER M: Peter Geis diff --git a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch index 2a9dc749478772..ae177e0cb036e6 100644 --- a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch +++ b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17962,6 +17962,11 @@ L: netdev@vger.kernel.org +@@ -17965,6 +17965,11 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/dlink/sundance.c diff --git a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch index b1855d1f2f2ad1..ad0460d4f36fdf 100644 --- a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch +++ b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch @@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -12361,6 +12361,14 @@ S: Supported +@@ -12364,6 +12364,14 @@ S: Supported F: Documentation/devicetree/bindings/mtd/atmel-nand.txt F: drivers/mtd/nand/raw/atmel/* diff --git a/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch b/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch index d93ee0685b2f34..bd806a7a6dfa0e 100644 --- a/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch +++ b/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch @@ -15,7 +15,7 @@ Signed-off-by: Alexander Couzens --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2347,6 +2347,10 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2440,6 +2440,10 @@ mt7531_setup(struct dsa_switch *ds) return -ENODEV; } diff --git a/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch b/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch index f9b88db9955e72..8a64a2a985eaf4 100644 --- a/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch +++ b/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch @@ -16,7 +16,7 @@ Signed-off-by: David Bauer --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2081,10 +2081,13 @@ mt7530_setup_mdio(struct mt7530_priv *pr +@@ -2121,10 +2121,13 @@ mt7530_setup_mdio(struct mt7530_priv *pr { struct dsa_switch *ds = priv->ds; struct device *dev = priv->dev; @@ -30,7 +30,7 @@ Signed-off-by: David Bauer bus = devm_mdiobus_alloc(dev); if (!bus) return -ENOMEM; -@@ -2101,7 +2104,9 @@ mt7530_setup_mdio(struct mt7530_priv *pr +@@ -2141,7 +2144,9 @@ mt7530_setup_mdio(struct mt7530_priv *pr if (priv->irq) mt7530_setup_mdio_irq(priv); diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 7268b693895b94..134afb63f9e83b 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -250,6 +250,8 @@ CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y +CONFIG_NET_DSA_MT7530_MDIO=y +CONFIG_NET_DSA_MT7530_MMIO=y CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index 88ca94472cde54..2de14752b4679f 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -272,6 +272,8 @@ CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y +CONFIG_NET_DSA_MT7530_MDIO=y +# CONFIG_NET_DSA_MT7530_MMIO is not set CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index 77d20a3bdba3d7..af0a5c1939fc0a 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -372,6 +372,8 @@ CONFIG_NEON=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y +CONFIG_NET_DSA_MT7530_MDIO=y +# CONFIG_NET_DSA_MT7530_MMIO is not set CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y diff --git a/target/linux/mediatek/mt7629/config-5.15 b/target/linux/mediatek/mt7629/config-5.15 index 46b444108bc572..08089dde2a3211 100644 --- a/target/linux/mediatek/mt7629/config-5.15 +++ b/target/linux/mediatek/mt7629/config-5.15 @@ -197,6 +197,8 @@ CONFIG_NETFILTER=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y +CONFIG_NET_DSA_MT7530_MDIO=y +# CONFIG_NET_DSA_MT7530_MMIO is not set CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y diff --git a/target/linux/ramips/mt7621/config-5.15 b/target/linux/ramips/mt7621/config-5.15 index 1b8a48100dfcde..1b4330c2d16648 100644 --- a/target/linux/ramips/mt7621/config-5.15 +++ b/target/linux/ramips/mt7621/config-5.15 @@ -184,6 +184,8 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y +CONFIG_NET_DSA_MT7530_MDIO=y +# CONFIG_NET_DSA_MT7530_MMIO is not set CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y diff --git a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch index e562dd8396c3df..17ff729f525650 100644 --- a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch +++ b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch @@ -32,7 +32,7 @@ Signed-off-by: Guenter Roeck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -15899,6 +15899,13 @@ S: Maintained +@@ -15902,6 +15902,13 @@ S: Maintained F: include/sound/rt*.h F: sound/soc/codecs/rt* diff --git a/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch b/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch index 8f400012635f9b..8c6a4c36393f5f 100644 --- a/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch +++ b/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch @@ -22,7 +22,7 @@ Submitted-by: John Crispin --- a/drivers/net/dsa/Kconfig +++ b/drivers/net/dsa/Kconfig -@@ -61,6 +61,8 @@ source "drivers/net/dsa/sja1105/Kconfig" +@@ -85,6 +85,8 @@ source "drivers/net/dsa/sja1105/Kconfig" source "drivers/net/dsa/xrs700x/Kconfig" @@ -33,7 +33,7 @@ Submitted-by: John Crispin select NET_DSA_TAG_RTL4_A --- a/drivers/net/dsa/Makefile +++ b/drivers/net/dsa/Makefile -@@ -22,5 +22,6 @@ obj-y += microchip/ +@@ -24,5 +24,6 @@ obj-y += microchip/ obj-y += mv88e6xxx/ obj-y += ocelot/ obj-y += qca/ From 98e6233202b46635a8811d29fd29c79848e58717 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Apr 2023 17:34:55 +0100 Subject: [PATCH 0029/1171] mediatek: update pending SoC Ethernet PHY driver Update driver for MediaTek's built-in Gigabit Ethernet PHYs which can be found in the MT7981 and MT7988 SoCs. Signed-off-by: Daniel Golle (cherry picked from commit 987a0b2b3011a9e5ee3e4120b068fb2f113628a7) --- ...2c-Add-driver-for-Sony-IMX477-sensor.patch | 2 +- ...vicetree-Add-documentation-for-imx37.patch | 2 +- ...a-i2c-Add-IMX519-CMOS-sensor-binding.patch | 2 +- .../drivers/net/phy/mediatek-ge-soc.c | 1263 +++++++++++++++ target/linux/mediatek/filogic/config-5.15 | 2 +- target/linux/mediatek/mt7622/config-5.15 | 2 +- ...er-for-MediaTek-SoC-built-in-GE-PHYs.patch | 1427 +---------------- 7 files changed, 1301 insertions(+), 1399 deletions(-) create mode 100644 target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch index e756fa2fff6605..bb0afb1a2a352e 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch @@ -25,7 +25,7 @@ Signed-off-by: Naushir Patuck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17538,6 +17538,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -17541,6 +17541,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch index 27fd0e57938bad..f9021eea55f1da 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17552,6 +17552,7 @@ M: Raspberry Pi Kernel Maintenance +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17556,6 +17556,14 @@ F: Documentation/devicetree/bindings/med +@@ -17559,6 +17559,14 @@ F: Documentation/devicetree/bindings/med F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c b/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c new file mode 100644 index 00000000000000..e48502ac3fdd16 --- /dev/null +++ b/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c @@ -0,0 +1,1263 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include +#include +#include +#include +#include + +#define MTK_GPHY_ID_MT7981 0x03a29461 +#define MTK_GPHY_ID_MT7988 0x03a29481 + +#define MTK_EXT_PAGE_ACCESS 0x1f +#define MTK_PHY_PAGE_STANDARD 0x0000 +#define MTK_PHY_PAGE_EXTENDED_3 0x0003 + +#define MTK_PHY_LPI_REG_14 0x14 +#define MTK_PHY_LPI_WAKE_TIMER_1000_MASK GENMASK(8, 0) + +#define MTK_PHY_LPI_REG_1c 0x1c +#define MTK_PHY_SMI_DET_ON_THRESH_MASK GENMASK(13, 8) + +#define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30 +#define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 + +#define ANALOG_INTERNAL_OPERATION_MAX_US 20 +#define TXRESERVE_MIN 0 +#define TXRESERVE_MAX 7 + +#define MTK_PHY_ANARG_RG 0x10 +#define MTK_PHY_TCLKOFFSET_MASK GENMASK(12, 8) + +/* Registers on MDIO_MMD_VEND1 */ +#define MTK_PHY_TXVLD_DA_RG 0x12 +#define MTK_PHY_DA_TX_I2MPB_A_GBE_MASK GENMASK(15, 10) +#define MTK_PHY_DA_TX_I2MPB_A_TBT_MASK GENMASK(5, 0) + +#define MTK_PHY_TX_I2MPB_TEST_MODE_A2 0x16 +#define MTK_PHY_DA_TX_I2MPB_A_HBT_MASK GENMASK(15, 10) +#define MTK_PHY_DA_TX_I2MPB_A_TST_MASK GENMASK(5, 0) + +#define MTK_PHY_TX_I2MPB_TEST_MODE_B1 0x17 +#define MTK_PHY_DA_TX_I2MPB_B_GBE_MASK GENMASK(13, 8) +#define MTK_PHY_DA_TX_I2MPB_B_TBT_MASK GENMASK(5, 0) + +#define MTK_PHY_TX_I2MPB_TEST_MODE_B2 0x18 +#define MTK_PHY_DA_TX_I2MPB_B_HBT_MASK GENMASK(13, 8) +#define MTK_PHY_DA_TX_I2MPB_B_TST_MASK GENMASK(5, 0) + +#define MTK_PHY_TX_I2MPB_TEST_MODE_C1 0x19 +#define MTK_PHY_DA_TX_I2MPB_C_GBE_MASK GENMASK(13, 8) +#define MTK_PHY_DA_TX_I2MPB_C_TBT_MASK GENMASK(5, 0) + +#define MTK_PHY_TX_I2MPB_TEST_MODE_C2 0x20 +#define MTK_PHY_DA_TX_I2MPB_C_HBT_MASK GENMASK(13, 8) +#define MTK_PHY_DA_TX_I2MPB_C_TST_MASK GENMASK(5, 0) + +#define MTK_PHY_TX_I2MPB_TEST_MODE_D1 0x21 +#define MTK_PHY_DA_TX_I2MPB_D_GBE_MASK GENMASK(13, 8) +#define MTK_PHY_DA_TX_I2MPB_D_TBT_MASK GENMASK(5, 0) + +#define MTK_PHY_TX_I2MPB_TEST_MODE_D2 0x22 +#define MTK_PHY_DA_TX_I2MPB_D_HBT_MASK GENMASK(13, 8) +#define MTK_PHY_DA_TX_I2MPB_D_TST_MASK GENMASK(5, 0) + +#define MTK_PHY_RXADC_CTRL_RG7 0xc6 +#define MTK_PHY_DA_AD_BUF_BIAS_LP_MASK GENMASK(9, 8) + +#define MTK_PHY_RXADC_CTRL_RG9 0xc8 +#define MTK_PHY_DA_RX_PSBN_TBT_MASK GENMASK(14, 12) +#define MTK_PHY_DA_RX_PSBN_HBT_MASK GENMASK(10, 8) +#define MTK_PHY_DA_RX_PSBN_GBE_MASK GENMASK(6, 4) +#define MTK_PHY_DA_RX_PSBN_LP_MASK GENMASK(2, 0) + +#define MTK_PHY_LDO_OUTPUT_V 0xd7 + +#define MTK_PHY_RG_ANA_CAL_RG0 0xdb +#define MTK_PHY_RG_CAL_CKINV BIT(12) +#define MTK_PHY_RG_ANA_CALEN BIT(8) +#define MTK_PHY_RG_ZCALEN_A BIT(0) + +#define MTK_PHY_RG_ANA_CAL_RG1 0xdc +#define MTK_PHY_RG_ZCALEN_B BIT(12) +#define MTK_PHY_RG_ZCALEN_C BIT(8) +#define MTK_PHY_RG_ZCALEN_D BIT(4) +#define MTK_PHY_RG_TXVOS_CALEN BIT(0) + +#define MTK_PHY_RG_ANA_CAL_RG5 0xe0 +#define MTK_PHY_RG_REXT_TRIM_MASK GENMASK(13, 8) + +#define MTK_PHY_RG_TX_FILTER 0xfe + +#define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG120 0x120 +#define MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK GENMASK(12, 8) +#define MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK GENMASK(4, 0) + +#define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122 0x122 +#define MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK GENMASK(7, 0) + +#define MTK_PHY_RG_TESTMUX_ADC_CTRL 0x144 +#define MTK_PHY_RG_TXEN_DIG_MASK GENMASK(5, 5) + +#define MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B 0x172 +#define MTK_PHY_CR_TX_AMP_OFFSET_A_MASK GENMASK(13, 8) +#define MTK_PHY_CR_TX_AMP_OFFSET_B_MASK GENMASK(6, 0) + +#define MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D 0x173 +#define MTK_PHY_CR_TX_AMP_OFFSET_C_MASK GENMASK(13, 8) +#define MTK_PHY_CR_TX_AMP_OFFSET_D_MASK GENMASK(6, 0) + +#define MTK_PHY_RG_AD_CAL_COMP 0x17a +#define MTK_PHY_AD_CAL_COMP_OUT_SHIFT (8) + +#define MTK_PHY_RG_AD_CAL_CLK 0x17b +#define MTK_PHY_DA_CAL_CLK BIT(0) + +#define MTK_PHY_RG_AD_CALIN 0x17c +#define MTK_PHY_DA_CALIN_FLAG BIT(0) + +#define MTK_PHY_RG_DASN_DAC_IN0_A 0x17d +#define MTK_PHY_DASN_DAC_IN0_A_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DASN_DAC_IN0_B 0x17e +#define MTK_PHY_DASN_DAC_IN0_B_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DASN_DAC_IN0_C 0x17f +#define MTK_PHY_DASN_DAC_IN0_C_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DASN_DAC_IN0_D 0x180 +#define MTK_PHY_DASN_DAC_IN0_D_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DASN_DAC_IN1_A 0x181 +#define MTK_PHY_DASN_DAC_IN1_A_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DASN_DAC_IN1_B 0x182 +#define MTK_PHY_DASN_DAC_IN1_B_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DASN_DAC_IN1_C 0x183 +#define MTK_PHY_DASN_DAC_IN1_C_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DASN_DAC_IN1_D 0x184 +#define MTK_PHY_DASN_DAC_IN1_D_MASK GENMASK(9, 0) + +#define MTK_PHY_RG_DEV1E_REG19b 0x19b +#define MTK_PHY_BYPASS_DSP_LPI_READY BIT(8) + +#define MTK_PHY_RG_LP_IIR2_K1_L 0x22a +#define MTK_PHY_RG_LP_IIR2_K1_U 0x22b +#define MTK_PHY_RG_LP_IIR2_K2_L 0x22c +#define MTK_PHY_RG_LP_IIR2_K2_U 0x22d +#define MTK_PHY_RG_LP_IIR2_K3_L 0x22e +#define MTK_PHY_RG_LP_IIR2_K3_U 0x22f +#define MTK_PHY_RG_LP_IIR2_K4_L 0x230 +#define MTK_PHY_RG_LP_IIR2_K4_U 0x231 +#define MTK_PHY_RG_LP_IIR2_K5_L 0x232 +#define MTK_PHY_RG_LP_IIR2_K5_U 0x233 + +#define MTK_PHY_RG_DEV1E_REG234 0x234 +#define MTK_PHY_TR_OPEN_LOOP_EN_MASK GENMASK(0, 0) +#define MTK_PHY_LPF_X_AVERAGE_MASK GENMASK(7, 4) +#define MTK_PHY_TR_LP_IIR_EEE_EN BIT(12) + +#define MTK_PHY_RG_LPF_CNT_VAL 0x235 + +#define MTK_PHY_RG_DEV1E_REG238 0x238 +#define MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK GENMASK(8, 0) +#define MTK_PHY_LPI_SLV_SEND_TX_EN BIT(12) + +#define MTK_PHY_RG_DEV1E_REG239 0x239 +#define MTK_PHY_LPI_SEND_LOC_TIMER_MASK GENMASK(8, 0) +#define MTK_PHY_LPI_TXPCS_LOC_RCV BIT(12) + +#define MTK_PHY_RG_DEV1E_REG27C 0x27c +#define MTK_PHY_VGASTATE_FFE_THR_ST1_MASK GENMASK(12, 8) +#define MTK_PHY_RG_DEV1E_REG27D 0x27d +#define MTK_PHY_VGASTATE_FFE_THR_ST2_MASK GENMASK(4, 0) + +#define MTK_PHY_RG_DEV1E_REG2C7 0x2c7 +#define MTK_PHY_MAX_GAIN_MASK GENMASK(4, 0) +#define MTK_PHY_MIN_GAIN_MASK GENMASK(12, 8) + +#define MTK_PHY_RG_DEV1E_REG2D1 0x2d1 +#define MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK GENMASK(7, 0) +#define MTK_PHY_LPI_SKIP_SD_SLV_TR BIT(8) +#define MTK_PHY_LPI_TR_READY BIT(9) +#define MTK_PHY_LPI_VCO_EEE_STG0_EN BIT(10) + +#define MTK_PHY_RG_DEV1E_REG323 0x323 +#define MTK_PHY_EEE_WAKE_MAS_INT_DC BIT(0) +#define MTK_PHY_EEE_WAKE_SLV_INT_DC BIT(4) + +#define MTK_PHY_RG_DEV1E_REG324 0x324 +#define MTK_PHY_SMI_DETCNT_MAX_MASK GENMASK(5, 0) +#define MTK_PHY_SMI_DET_MAX_EN BIT(8) + +#define MTK_PHY_RG_DEV1E_REG326 0x326 +#define MTK_PHY_LPI_MODE_SD_ON BIT(0) +#define MTK_PHY_RESET_RANDUPD_CNT BIT(1) +#define MTK_PHY_TREC_UPDATE_ENAB_CLR BIT(2) +#define MTK_PHY_LPI_QUIT_WAIT_DFE_SIG_DET_OFF BIT(4) +#define MTK_PHY_TR_READY_SKIP_AFE_WAKEUP BIT(5) + +#define MTK_PHY_LDO_PUMP_EN_PAIRAB 0x502 +#define MTK_PHY_LDO_PUMP_EN_PAIRCD 0x503 + +#define MTK_PHY_DA_TX_R50_PAIR_A 0x53d +#define MTK_PHY_DA_TX_R50_PAIR_B 0x53e +#define MTK_PHY_DA_TX_R50_PAIR_C 0x53f +#define MTK_PHY_DA_TX_R50_PAIR_D 0x540 + +/* Registers on MDIO_MMD_VEND2 */ +#define MTK_PHY_LED0_ON_CTRL 0x24 +#define MTK_PHY_LED0_ON_MASK GENMASK(6, 0) +#define MTK_PHY_LED0_ON_LINK1000 BIT(0) +#define MTK_PHY_LED0_ON_LINK100 BIT(1) +#define MTK_PHY_LED0_ON_LINK10 BIT(2) +#define MTK_PHY_LED0_ON_LINKDOWN BIT(3) +#define MTK_PHY_LED0_ON_FDX BIT(4) /* Full duplex */ +#define MTK_PHY_LED0_ON_HDX BIT(5) /* Half duplex */ +#define MTK_PHY_LED0_FORCE_ON BIT(6) +#define MTK_PHY_LED0_POLARITY BIT(14) +#define MTK_PHY_LED0_ENABLE BIT(15) + +#define MTK_PHY_LED0_BLINK_CTRL 0x25 +#define MTK_PHY_LED0_1000TX BIT(0) +#define MTK_PHY_LED0_1000RX BIT(1) +#define MTK_PHY_LED0_100TX BIT(2) +#define MTK_PHY_LED0_100RX BIT(3) +#define MTK_PHY_LED0_10TX BIT(4) +#define MTK_PHY_LED0_10RX BIT(5) +#define MTK_PHY_LED0_COLLISION BIT(6) +#define MTK_PHY_LED0_RX_CRC_ERR BIT(7) +#define MTK_PHY_LED0_RX_IDLE_ERR BIT(8) +#define MTK_PHY_LED0_FORCE_BLINK BIT(9) + +#define MTK_PHY_LED1_ON_CTRL 0x26 +#define MTK_PHY_LED1_ON_MASK GENMASK(6, 0) +#define MTK_PHY_LED1_ON_LINK1000 BIT(0) +#define MTK_PHY_LED1_ON_LINK100 BIT(1) +#define MTK_PHY_LED1_ON_LINK10 BIT(2) +#define MTK_PHY_LED1_ON_LINKDOWN BIT(3) +#define MTK_PHY_LED1_ON_FDX BIT(4) /* Full duplex */ +#define MTK_PHY_LED1_ON_HDX BIT(5) /* Half duplex */ +#define MTK_PHY_LED1_FORCE_ON BIT(6) +#define MTK_PHY_LED1_POLARITY BIT(14) +#define MTK_PHY_LED1_ENABLE BIT(15) + +#define MTK_PHY_LED1_BLINK_CTRL 0x27 +#define MTK_PHY_LED1_1000TX BIT(0) +#define MTK_PHY_LED1_1000RX BIT(1) +#define MTK_PHY_LED1_100TX BIT(2) +#define MTK_PHY_LED1_100RX BIT(3) +#define MTK_PHY_LED1_10TX BIT(4) +#define MTK_PHY_LED1_10RX BIT(5) +#define MTK_PHY_LED1_COLLISION BIT(6) +#define MTK_PHY_LED1_RX_CRC_ERR BIT(7) +#define MTK_PHY_LED1_RX_IDLE_ERR BIT(8) +#define MTK_PHY_LED1_FORCE_BLINK BIT(9) + +#define MTK_PHY_RG_BG_RASEL 0x115 +#define MTK_PHY_RG_BG_RASEL_MASK GENMASK(2, 0) + +/* These macro privides efuse parsing for internal phy. */ +#define EFS_DA_TX_I2MPB_A(x) (((x) >> 0) & GENMASK(5, 0)) +#define EFS_DA_TX_I2MPB_B(x) (((x) >> 6) & GENMASK(5, 0)) +#define EFS_DA_TX_I2MPB_C(x) (((x) >> 12) & GENMASK(5, 0)) +#define EFS_DA_TX_I2MPB_D(x) (((x) >> 18) & GENMASK(5, 0)) +#define EFS_DA_TX_AMP_OFFSET_A(x) (((x) >> 24) & GENMASK(5, 0)) + +#define EFS_DA_TX_AMP_OFFSET_B(x) (((x) >> 0) & GENMASK(5, 0)) +#define EFS_DA_TX_AMP_OFFSET_C(x) (((x) >> 6) & GENMASK(5, 0)) +#define EFS_DA_TX_AMP_OFFSET_D(x) (((x) >> 12) & GENMASK(5, 0)) +#define EFS_DA_TX_R50_A(x) (((x) >> 18) & GENMASK(5, 0)) +#define EFS_DA_TX_R50_B(x) (((x) >> 24) & GENMASK(5, 0)) + +#define EFS_DA_TX_R50_C(x) (((x) >> 0) & GENMASK(5, 0)) +#define EFS_DA_TX_R50_D(x) (((x) >> 6) & GENMASK(5, 0)) + +#define EFS_RG_BG_RASEL(x) (((x) >> 4) & GENMASK(2, 0)) +#define EFS_RG_REXT_TRIM(x) (((x) >> 7) & GENMASK(5, 0)) + +enum { + NO_PAIR, + PAIR_A, + PAIR_B, + PAIR_C, + PAIR_D, +}; + +enum { + GPHY_PORT0, + GPHY_PORT1, + GPHY_PORT2, + GPHY_PORT3, +}; + +enum calibration_mode { + EFUSE_K, + SW_K +}; + +enum CAL_ITEM { + REXT, + TX_OFFSET, + TX_AMP, + TX_R50, + TX_VCM +}; + +enum CAL_MODE { + EFUSE_M, + SW_M +}; + +struct mtk_socphy_shared_priv { + u32 boottrap; +}; + +static int mtk_socphy_read_page(struct phy_device *phydev) +{ + return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); +} + +static int mtk_socphy_write_page(struct phy_device *phydev, int page) +{ + return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page); +} + +/* One calibration cycle consists of: + * 1.Set DA_CALIN_FLAG high to start calibration. Keep it high + * until AD_CAL_COMP is ready to output calibration result. + * 2.Wait until DA_CAL_CLK is available. + * 3.Fetch AD_CAL_COMP_OUT. + */ +static int cal_cycle(struct phy_device *phydev, int devad, + u32 regnum, u16 mask, u16 cal_val) +{ + int reg_val; + int ret; + + phy_modify_mmd(phydev, devad, regnum, + mask, cal_val); + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, + MTK_PHY_DA_CALIN_FLAG); + + ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_AD_CAL_CLK, reg_val, + reg_val & MTK_PHY_DA_CAL_CLK, 500, + ANALOG_INTERNAL_OPERATION_MAX_US, false); + if (ret) { + phydev_err(phydev, "Calibration cycle timeout\n"); + return ret; + } + + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, + MTK_PHY_DA_CALIN_FLAG); + ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CAL_COMP) >> + MTK_PHY_AD_CAL_COMP_OUT_SHIFT; + phydev_dbg(phydev, "cal_val: 0x%x, ret: %d\n", cal_val, ret); + + return ret; +} + +static int rext_fill_result(struct phy_device *phydev, u16 *buf) +{ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, + MTK_PHY_RG_REXT_TRIM_MASK, buf[0] << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_BG_RASEL, + MTK_PHY_RG_BG_RASEL_MASK, buf[1]); + + return 0; +} + +static int rext_cal_efuse(struct phy_device *phydev, u32 *buf) +{ + u16 rext_cal_val[2]; + + rext_cal_val[0] = EFS_RG_REXT_TRIM(buf[3]); + rext_cal_val[1] = EFS_RG_BG_RASEL(buf[3]); + rext_fill_result(phydev, rext_cal_val); + + return 0; +} + +static int tx_offset_fill_result(struct phy_device *phydev, u16 *buf) +{ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, + MTK_PHY_CR_TX_AMP_OFFSET_A_MASK, buf[0] << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, + MTK_PHY_CR_TX_AMP_OFFSET_B_MASK, buf[1]); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, + MTK_PHY_CR_TX_AMP_OFFSET_C_MASK, buf[2] << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, + MTK_PHY_CR_TX_AMP_OFFSET_D_MASK, buf[3]); + + return 0; +} + +static int tx_offset_cal_efuse(struct phy_device *phydev, u32 *buf) +{ + u16 tx_offset_cal_val[4]; + + tx_offset_cal_val[0] = EFS_DA_TX_AMP_OFFSET_A(buf[0]); + tx_offset_cal_val[1] = EFS_DA_TX_AMP_OFFSET_B(buf[1]); + tx_offset_cal_val[2] = EFS_DA_TX_AMP_OFFSET_C(buf[1]); + tx_offset_cal_val[3] = EFS_DA_TX_AMP_OFFSET_D(buf[1]); + + tx_offset_fill_result(phydev, tx_offset_cal_val); + + return 0; +} + +static int tx_amp_fill_result(struct phy_device *phydev, u16 *buf) +{ + int i; + int bias[16] = {}; + const int vals_9461[16] = { 7, 1, 4, 7, + 7, 1, 4, 7, + 7, 1, 4, 7, + 7, 1, 4, 7 }; + const int vals_9481[16] = { 10, 6, 6, 10, + 10, 6, 6, 10, + 10, 6, 6, 10, + 10, 6, 6, 10 }; + switch (phydev->drv->phy_id) { + case MTK_GPHY_ID_MT7981: + /* We add some calibration to efuse values + * due to board level influence. + * GBE: +7, TBT: +1, HBT: +4, TST: +7 + */ + memcpy(bias, (const void *)vals_9461, sizeof(bias)); + break; + case MTK_GPHY_ID_MT7988: + memcpy(bias, (const void *)vals_9481, sizeof(bias)); + break; + } + + /* Prevent overflow */ + for (i = 0; i < 12; i++) { + if (buf[i >> 2] + bias[i] > 63) { + buf[i >> 2] = 63; + bias[i] = 0; + } + } + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, + MTK_PHY_DA_TX_I2MPB_A_GBE_MASK, (buf[0] + bias[0]) << 10); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, + MTK_PHY_DA_TX_I2MPB_A_TBT_MASK, buf[0] + bias[1]); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, + MTK_PHY_DA_TX_I2MPB_A_HBT_MASK, (buf[0] + bias[2]) << 10); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, + MTK_PHY_DA_TX_I2MPB_A_TST_MASK, buf[0] + bias[3]); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, + MTK_PHY_DA_TX_I2MPB_B_GBE_MASK, (buf[1] + bias[4]) << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, + MTK_PHY_DA_TX_I2MPB_B_TBT_MASK, buf[1] + bias[5]); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, + MTK_PHY_DA_TX_I2MPB_B_HBT_MASK, (buf[1] + bias[6]) << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, + MTK_PHY_DA_TX_I2MPB_B_TST_MASK, buf[1] + bias[7]); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, + MTK_PHY_DA_TX_I2MPB_C_GBE_MASK, (buf[2] + bias[8]) << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, + MTK_PHY_DA_TX_I2MPB_C_TBT_MASK, buf[2] + bias[9]); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, + MTK_PHY_DA_TX_I2MPB_C_HBT_MASK, (buf[2] + bias[10]) << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, + MTK_PHY_DA_TX_I2MPB_C_TST_MASK, buf[2] + bias[11]); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, + MTK_PHY_DA_TX_I2MPB_D_GBE_MASK, (buf[3] + bias[12]) << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, + MTK_PHY_DA_TX_I2MPB_D_TBT_MASK, buf[3] + bias[13]); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, + MTK_PHY_DA_TX_I2MPB_D_HBT_MASK, (buf[3] + bias[14]) << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, + MTK_PHY_DA_TX_I2MPB_D_TST_MASK, buf[3] + bias[15]); + + return 0; +} + +static int tx_amp_cal_efuse(struct phy_device *phydev, u32 *buf) +{ + u16 tx_amp_cal_val[4]; + + tx_amp_cal_val[0] = EFS_DA_TX_I2MPB_A(buf[0]); + tx_amp_cal_val[1] = EFS_DA_TX_I2MPB_B(buf[0]); + tx_amp_cal_val[2] = EFS_DA_TX_I2MPB_C(buf[0]); + tx_amp_cal_val[3] = EFS_DA_TX_I2MPB_D(buf[0]); + tx_amp_fill_result(phydev, tx_amp_cal_val); + + return 0; +} + +static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val, + u8 txg_calen_x) +{ + int bias = 0; + u16 reg, val; + + if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988) + bias = -2; + + val = clamp_val(bias + tx_r50_cal_val, 0, 63); + + switch (txg_calen_x) { + case PAIR_A: + reg = MTK_PHY_DA_TX_R50_PAIR_A; + break; + case PAIR_B: + reg = MTK_PHY_DA_TX_R50_PAIR_B; + break; + case PAIR_C: + reg = MTK_PHY_DA_TX_R50_PAIR_C; + break; + case PAIR_D: + reg = MTK_PHY_DA_TX_R50_PAIR_D; + break; + default: + return -EINVAL; + } + + phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, val | val << 8); + + return 0; +} + +static int tx_r50_cal_efuse(struct phy_device *phydev, u32 *buf, + u8 txg_calen_x) +{ + u16 tx_r50_cal_val; + + switch (txg_calen_x) { + case PAIR_A: + tx_r50_cal_val = EFS_DA_TX_R50_A(buf[1]); + break; + case PAIR_B: + tx_r50_cal_val = EFS_DA_TX_R50_B(buf[1]); + break; + case PAIR_C: + tx_r50_cal_val = EFS_DA_TX_R50_C(buf[2]); + break; + case PAIR_D: + tx_r50_cal_val = EFS_DA_TX_R50_D(buf[2]); + break; + default: + return -EINVAL; + } + tx_r50_fill_result(phydev, tx_r50_cal_val, txg_calen_x); + + return 0; +} + +static int tx_vcm_cal_sw(struct phy_device *phydev, u8 rg_txreserve_x) +{ + u8 lower_idx, upper_idx, txreserve_val; + u8 lower_ret, upper_ret; + int ret; + + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, + MTK_PHY_RG_ANA_CALEN); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, + MTK_PHY_RG_CAL_CKINV); + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, + MTK_PHY_RG_TXVOS_CALEN); + + switch (rg_txreserve_x) { + case PAIR_A: + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN0_A, + MTK_PHY_DASN_DAC_IN0_A_MASK); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN1_A, + MTK_PHY_DASN_DAC_IN1_A_MASK); + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_ANA_CAL_RG0, + MTK_PHY_RG_ZCALEN_A); + break; + case PAIR_B: + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN0_B, + MTK_PHY_DASN_DAC_IN0_B_MASK); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN1_B, + MTK_PHY_DASN_DAC_IN1_B_MASK); + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_ANA_CAL_RG1, + MTK_PHY_RG_ZCALEN_B); + break; + case PAIR_C: + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN0_C, + MTK_PHY_DASN_DAC_IN0_C_MASK); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN1_C, + MTK_PHY_DASN_DAC_IN1_C_MASK); + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_ANA_CAL_RG1, + MTK_PHY_RG_ZCALEN_C); + break; + case PAIR_D: + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN0_D, + MTK_PHY_DASN_DAC_IN0_D_MASK); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DASN_DAC_IN1_D, + MTK_PHY_DASN_DAC_IN1_D_MASK); + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_ANA_CAL_RG1, + MTK_PHY_RG_ZCALEN_D); + break; + default: + ret = -EINVAL; + goto restore; + } + + lower_idx = TXRESERVE_MIN; + upper_idx = TXRESERVE_MAX; + + phydev_dbg(phydev, "Start TX-VCM SW cal.\n"); + while ((upper_idx - lower_idx) > 1) { + txreserve_val = DIV_ROUND_CLOSEST(lower_idx + upper_idx, 2); + ret = cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, + MTK_PHY_DA_RX_PSBN_TBT_MASK | + MTK_PHY_DA_RX_PSBN_HBT_MASK | + MTK_PHY_DA_RX_PSBN_GBE_MASK | + MTK_PHY_DA_RX_PSBN_LP_MASK, + txreserve_val << 12 | txreserve_val << 8 | + txreserve_val << 4 | txreserve_val); + if (ret == 1) { + upper_idx = txreserve_val; + upper_ret = ret; + } else if (ret == 0) { + lower_idx = txreserve_val; + lower_ret = ret; + } else { + goto restore; + } + } + + if (lower_idx == TXRESERVE_MIN) { + lower_ret = cal_cycle(phydev, MDIO_MMD_VEND1, + MTK_PHY_RXADC_CTRL_RG9, + MTK_PHY_DA_RX_PSBN_TBT_MASK | + MTK_PHY_DA_RX_PSBN_HBT_MASK | + MTK_PHY_DA_RX_PSBN_GBE_MASK | + MTK_PHY_DA_RX_PSBN_LP_MASK, + lower_idx << 12 | lower_idx << 8 | + lower_idx << 4 | lower_idx); + ret = lower_ret; + } else if (upper_idx == TXRESERVE_MAX) { + upper_ret = cal_cycle(phydev, MDIO_MMD_VEND1, + MTK_PHY_RXADC_CTRL_RG9, + MTK_PHY_DA_RX_PSBN_TBT_MASK | + MTK_PHY_DA_RX_PSBN_HBT_MASK | + MTK_PHY_DA_RX_PSBN_GBE_MASK | + MTK_PHY_DA_RX_PSBN_LP_MASK, + upper_idx << 12 | upper_idx << 8 | + upper_idx << 4 | upper_idx); + ret = upper_ret; + } + if (ret < 0) + goto restore; + + /* We calibrate TX-VCM in different logic. Check upper index and then + * lower index. If this calibration is valid, apply lower index's result. + */ + ret = upper_ret - lower_ret; + if (ret == 1) { + ret = 0; + /* Make sure we use upper_idx in our calibration system */ + cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, + MTK_PHY_DA_RX_PSBN_TBT_MASK | + MTK_PHY_DA_RX_PSBN_HBT_MASK | + MTK_PHY_DA_RX_PSBN_GBE_MASK | + MTK_PHY_DA_RX_PSBN_LP_MASK, + upper_idx << 12 | upper_idx << 8 | + upper_idx << 4 | upper_idx); + phydev_dbg(phydev, "TX-VCM SW cal result: 0x%x\n", upper_idx); + } else if (lower_idx == TXRESERVE_MIN && upper_ret == 1 && + lower_ret == 1) { + ret = 0; + cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, + MTK_PHY_DA_RX_PSBN_TBT_MASK | + MTK_PHY_DA_RX_PSBN_HBT_MASK | + MTK_PHY_DA_RX_PSBN_GBE_MASK | + MTK_PHY_DA_RX_PSBN_LP_MASK, + lower_idx << 12 | lower_idx << 8 | + lower_idx << 4 | lower_idx); + phydev_warn(phydev, "TX-VCM SW cal result at low margin 0x%x\n", + lower_idx); + } else if (upper_idx == TXRESERVE_MAX && upper_ret == 0 && + lower_ret == 0) { + ret = 0; + phydev_warn(phydev, "TX-VCM SW cal result at high margin 0x%x\n", + upper_idx); + } else { + ret = -EINVAL; + } + +restore: + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, + MTK_PHY_RG_ANA_CALEN); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, + MTK_PHY_RG_TXVOS_CALEN); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, + MTK_PHY_RG_ZCALEN_A); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, + MTK_PHY_RG_ZCALEN_B | MTK_PHY_RG_ZCALEN_C | + MTK_PHY_RG_ZCALEN_D); + + return ret; +} + +static void mt798x_phy_common_finetune(struct phy_device *phydev) +{ + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); + /* EnabRandUpdTrig = 1 */ + __phy_write(phydev, 0x11, 0x2f00); + __phy_write(phydev, 0x12, 0xe); + __phy_write(phydev, 0x10, 0x8fb0); + + /* NormMseLoThresh = 85 */ + __phy_write(phydev, 0x11, 0x55a0); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x83aa); + + /* TrFreeze = 0 */ + __phy_write(phydev, 0x11, 0x0); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x9686); + + /* SSTrKp1000Slv = 5 */ + __phy_write(phydev, 0x11, 0xbaef); + __phy_write(phydev, 0x12, 0x2e); + __phy_write(phydev, 0x10, 0x968c); + + /* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2, + * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2 + */ + __phy_write(phydev, 0x11, 0xd10a); + __phy_write(phydev, 0x12, 0x34); + __phy_write(phydev, 0x10, 0x8f82); + + /* VcoSlicerThreshBitsHigh */ + __phy_write(phydev, 0x11, 0x5555); + __phy_write(phydev, 0x12, 0x55); + __phy_write(phydev, 0x10, 0x8ec0); + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); + + /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234, + MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK, + BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9)); + + /* rg_tr_lpf_cnt_val = 512 */ + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x200); + + /* IIR2 related */ + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_L, 0x82); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_U, 0x0); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_L, 0x103); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_U, 0x0); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_L, 0x82); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_U, 0x0); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_L, 0xd177); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_U, 0x3); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_L, 0x2c82); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_U, 0xe); + + /* FFE peaking */ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27C, + MTK_PHY_VGASTATE_FFE_THR_ST1_MASK, 0x1b << 8); + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27D, + MTK_PHY_VGASTATE_FFE_THR_ST2_MASK, 0x1e); + + /* Disable LDO pump */ + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRAB, 0x0); + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRCD, 0x0); + /* Adjust LDO output voltage */ + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222); +} + +static void mt7981_phy_finetune(struct phy_device *phydev) +{ + u16 val[8] = { 0x01ce, 0x01c1, + 0x020f, 0x0202, + 0x03d0, 0x03c0, + 0x0013, 0x0005 }; + int i, k; + + /* 100M eye finetune: + * Keep middle level of TX MLT3 shapper as default. + * Only change TX MLT3 overshoot level here. + */ + for (k = 0, i = 1; i < 12; i++) { + if (i % 3 == 0) + continue; + phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]); + } + + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); + /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */ + __phy_write(phydev, 0x11, 0xc71); + __phy_write(phydev, 0x12, 0xc); + __phy_write(phydev, 0x10, 0x8fae); + + /* ResetSyncOffset = 6 */ + __phy_write(phydev, 0x11, 0x600); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x8fc0); + + /* VgaDecRate = 1 */ + __phy_write(phydev, 0x11, 0x4c2a); + __phy_write(phydev, 0x12, 0x3e); + __phy_write(phydev, 0x10, 0x8fa4); + + /* FfeUpdGainForce = 4 */ + __phy_write(phydev, 0x11, 0x240); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x9680); + + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); +} + +static void mt7988_phy_finetune(struct phy_device *phydev) +{ + u16 val[12] = { 0x0187, 0x01cd, 0x01c8, 0x0182, + 0x020d, 0x0206, 0x0384, 0x03d0, + 0x03c6, 0x030a, 0x0011, 0x0005 }; + int i; + + /* Set default MLT3 shaper first */ + for (i = 0; i < 12; i++) + phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[i]); + + /* TCT finetune */ + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5); + + /* Disable TX power saving */ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7, + MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8); + + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); + + /* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */ + __phy_write(phydev, 0x11, 0x671); + __phy_write(phydev, 0x12, 0xc); + __phy_write(phydev, 0x10, 0x8fae); + + /* ResetSyncOffset = 5 */ + __phy_write(phydev, 0x11, 0x500); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x8fc0); + + /* VgaDecRate is 1 at default on mt7988 */ + + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); + + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30); + /* TxClkOffset = 2 */ + __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK, + FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2)); + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); +} + +static void mt798x_phy_eee(struct phy_device *phydev) +{ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG120, + MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK | + MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK, + FIELD_PREP(MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK, 0x0) | + FIELD_PREP(MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK, 0x14)); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122, + MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, + FIELD_PREP(MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, + 0xff)); + + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_TESTMUX_ADC_CTRL, + MTK_PHY_RG_TXEN_DIG_MASK); + + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DEV1E_REG19b, MTK_PHY_BYPASS_DSP_LPI_READY); + + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_DEV1E_REG234, MTK_PHY_TR_LP_IIR_EEE_EN); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG238, + MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK | + MTK_PHY_LPI_SLV_SEND_TX_EN, + FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120)); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239, + MTK_PHY_LPI_SEND_LOC_TIMER_MASK | + MTK_PHY_LPI_TXPCS_LOC_RCV, + FIELD_PREP(MTK_PHY_LPI_SEND_LOC_TIMER_MASK, 0x117)); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7, + MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK, + FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) | + FIELD_PREP(MTK_PHY_MIN_GAIN_MASK, 0x13)); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2D1, + MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK, + FIELD_PREP(MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK, + 0x33) | + MTK_PHY_LPI_SKIP_SD_SLV_TR | MTK_PHY_LPI_TR_READY | + MTK_PHY_LPI_VCO_EEE_STG0_EN); + + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG323, + MTK_PHY_EEE_WAKE_MAS_INT_DC | + MTK_PHY_EEE_WAKE_SLV_INT_DC); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG324, + MTK_PHY_SMI_DETCNT_MAX_MASK, + FIELD_PREP(MTK_PHY_SMI_DETCNT_MAX_MASK, 0x3f) | + MTK_PHY_SMI_DET_MAX_EN); + + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG326, + MTK_PHY_LPI_MODE_SD_ON | MTK_PHY_RESET_RANDUPD_CNT | + MTK_PHY_TREC_UPDATE_ENAB_CLR | + MTK_PHY_LPI_QUIT_WAIT_DFE_SIG_DET_OFF | + MTK_PHY_TR_READY_SKIP_AFE_WAKEUP); + + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); + /* Regsigdet_sel_1000 = 0 */ + __phy_write(phydev, 0x11, 0xb); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x9690); + + /* REG_EEE_st2TrKf1000 = 3 */ + __phy_write(phydev, 0x11, 0x114f); + __phy_write(phydev, 0x12, 0x2); + __phy_write(phydev, 0x10, 0x969a); + + /* RegEEE_slv_wake_tr_timer_tar = 6, RegEEE_slv_remtx_timer_tar = 20 */ + __phy_write(phydev, 0x11, 0x3028); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x969e); + + /* RegEEE_slv_wake_int_timer_tar = 8 */ + __phy_write(phydev, 0x11, 0x5010); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x96a0); + + /* RegEEE_trfreeze_timer2 = 586 */ + __phy_write(phydev, 0x11, 0x24a); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x96a8); + + /* RegEEE100Stg1_tar = 16 */ + __phy_write(phydev, 0x11, 0x3210); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x96b8); + + /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */ + __phy_write(phydev, 0x11, 0x1463); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x96ca); + + /* DfeTailEnableVgaThresh1000 = 27 */ + __phy_write(phydev, 0x11, 0x36); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x8f80); + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); + + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_3); + __phy_modify(phydev, MTK_PHY_LPI_REG_14, MTK_PHY_LPI_WAKE_TIMER_1000_MASK, + FIELD_PREP(MTK_PHY_LPI_WAKE_TIMER_1000_MASK, 0x19c)); + + __phy_modify(phydev, MTK_PHY_LPI_REG_1c, MTK_PHY_SMI_DET_ON_THRESH_MASK, + FIELD_PREP(MTK_PHY_SMI_DET_ON_THRESH_MASK, 0xc)); + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); + + phy_modify_mmd(phydev, MDIO_MMD_VEND1, + MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122, + MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, + FIELD_PREP(MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, 0xff)); +} + +static int cal_sw(struct phy_device *phydev, enum CAL_ITEM cal_item, + u8 start_pair, u8 end_pair) +{ + u8 pair_n; + int ret; + + for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { + /* TX_OFFSET & TX_AMP have no SW calibration. */ + switch (cal_item) { + case TX_VCM: + ret = tx_vcm_cal_sw(phydev, pair_n); + break; + default: + return -EINVAL; + } + if (ret) + return ret; + } + return 0; +} + +static int cal_efuse(struct phy_device *phydev, enum CAL_ITEM cal_item, + u8 start_pair, u8 end_pair, u32 *buf) +{ + u8 pair_n; + int ret; + + for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { + /* TX_VCM has no efuse calibration. */ + switch (cal_item) { + case REXT: + ret = rext_cal_efuse(phydev, buf); + break; + case TX_OFFSET: + ret = tx_offset_cal_efuse(phydev, buf); + break; + case TX_AMP: + ret = tx_amp_cal_efuse(phydev, buf); + break; + case TX_R50: + ret = tx_r50_cal_efuse(phydev, buf, pair_n); + break; + default: + return -EINVAL; + } + if (ret) + return ret; + } + + return 0; +} + +static int start_cal(struct phy_device *phydev, enum CAL_ITEM cal_item, + enum CAL_MODE cal_mode, u8 start_pair, + u8 end_pair, u32 *buf) +{ + int ret; + + switch (cal_mode) { + case EFUSE_M: + ret = cal_efuse(phydev, cal_item, start_pair, + end_pair, buf); + break; + case SW_M: + ret = cal_sw(phydev, cal_item, start_pair, end_pair); + break; + default: + return -EINVAL; + } + + if (ret) { + phydev_err(phydev, "cal %d failed\n", cal_item); + return -EIO; + } + + return 0; +} + +static int mt798x_phy_calibration(struct phy_device *phydev) +{ + int ret = 0; + u32 *buf; + size_t len; + struct nvmem_cell *cell; + + cell = nvmem_cell_get(&phydev->mdio.dev, "phy-cal-data"); + if (IS_ERR(cell)) { + if (PTR_ERR(cell) == -EPROBE_DEFER) + return PTR_ERR(cell); + return 0; + } + + buf = (u32 *)nvmem_cell_read(cell, &len); + if (IS_ERR(buf)) + return PTR_ERR(buf); + nvmem_cell_put(cell); + + if (!buf[0] || !buf[1] || !buf[2] || !buf[3] || len < 4 * sizeof(u32)) { + phydev_err(phydev, "invalid efuse data\n"); + ret = -EINVAL; + goto out; + } + + ret = start_cal(phydev, REXT, EFUSE_M, NO_PAIR, NO_PAIR, buf); + if (ret) + goto out; + ret = start_cal(phydev, TX_OFFSET, EFUSE_M, NO_PAIR, NO_PAIR, buf); + if (ret) + goto out; + ret = start_cal(phydev, TX_AMP, EFUSE_M, NO_PAIR, NO_PAIR, buf); + if (ret) + goto out; + ret = start_cal(phydev, TX_R50, EFUSE_M, PAIR_A, PAIR_D, buf); + if (ret) + goto out; + ret = start_cal(phydev, TX_VCM, SW_M, PAIR_A, PAIR_A, buf); + if (ret) + goto out; + +out: + kfree(buf); + return ret; +} + +static int mt798x_phy_config_init(struct phy_device *phydev) +{ + switch (phydev->drv->phy_id) { + case MTK_GPHY_ID_MT7981: + mt7981_phy_finetune(phydev); + break; + case MTK_GPHY_ID_MT7988: + mt7988_phy_finetune(phydev); + break; + } + + mt798x_phy_common_finetune(phydev); + mt798x_phy_eee(phydev); + + return mt798x_phy_calibration(phydev); +} + +static int mt7988_phy_setup_led(struct phy_device *phydev) +{ + struct mtk_socphy_shared_priv *priv = phydev->shared->priv; + int port = phydev->mdio.addr; + u32 reg = priv->boottrap; + struct pinctrl *pinctrl; + + phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, + MTK_PHY_LED0_ENABLE | MTK_PHY_LED0_POLARITY | + MTK_PHY_LED0_ON_LINK10 | + MTK_PHY_LED0_ON_LINK100 | + MTK_PHY_LED0_ON_LINK1000); + phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_ON_CTRL, + MTK_PHY_LED1_ENABLE | MTK_PHY_LED1_POLARITY | + MTK_PHY_LED1_ON_LINK10 | + MTK_PHY_LED1_ON_LINK100 | + MTK_PHY_LED1_ON_LINK1000); + + if ((port == GPHY_PORT0 && reg & BIT(8)) || + (port == GPHY_PORT1 && reg & BIT(9)) || + (port == GPHY_PORT2 && reg & BIT(10)) || + (port == GPHY_PORT3 && reg & BIT(11))) { + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, + MTK_PHY_LED0_POLARITY); + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_ON_CTRL, + MTK_PHY_LED1_POLARITY); + } + + phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_BLINK_CTRL, + MTK_PHY_LED0_1000TX | MTK_PHY_LED0_1000RX | + MTK_PHY_LED0_100TX | MTK_PHY_LED0_100RX | + MTK_PHY_LED0_10TX | MTK_PHY_LED0_10RX); + phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_BLINK_CTRL, + MTK_PHY_LED1_1000TX | MTK_PHY_LED1_1000RX | + MTK_PHY_LED1_100TX | MTK_PHY_LED1_100RX | + MTK_PHY_LED1_10TX | MTK_PHY_LED1_10RX); + + pinctrl = devm_pinctrl_get_select(&phydev->mdio.dev, "gbe-led"); + if (IS_ERR(pinctrl)) { + dev_err(&phydev->mdio.bus->dev, "Failed to setup LED pins\n"); + return PTR_ERR(pinctrl); + } + + return 0; +} + +static int mt7988_phy_probe_shared(struct phy_device *phydev) +{ + struct mtk_socphy_shared_priv *priv = phydev->shared->priv; + void __iomem *boottrap; + struct device_node *np; + u32 reg; + + np = of_find_compatible_node(NULL, NULL, "mediatek,boottrap"); + if (!np) + return -ENOENT; + + boottrap = of_iomap(np, 0); + if (!boottrap) + return -ENOMEM; + + reg = readl(boottrap); + iounmap(boottrap); + + priv->boottrap = reg; + + return 0; +} + +static int mt7981_phy_probe(struct phy_device *phydev) +{ + return mt798x_phy_calibration(phydev); +} + +static int mt7988_phy_probe(struct phy_device *phydev) +{ + int err; + + err = devm_phy_package_join(&phydev->mdio.dev, phydev, 0, + sizeof(struct mtk_socphy_shared_priv)); + if (err) + return err; + + if (phy_package_probe_once(phydev)) { + err = mt7988_phy_probe_shared(phydev); + if (err) + return err; + } + + mt7988_phy_setup_led(phydev); + + return mt798x_phy_calibration(phydev); +} + +static struct phy_driver mtk_socphy_driver[] = { + { + PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), + .name = "MediaTek MT7981 PHY", + .config_init = mt798x_phy_config_init, + .config_intr = genphy_no_config_intr, + .handle_interrupt = genphy_handle_interrupt_no_ack, + .probe = mt7981_phy_probe, + .suspend = genphy_suspend, + .resume = genphy_resume, + .read_page = mtk_socphy_read_page, + .write_page = mtk_socphy_write_page, + }, + { + PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988), + .name = "MediaTek MT7988 PHY", + .config_init = mt798x_phy_config_init, + .config_intr = genphy_no_config_intr, + .handle_interrupt = genphy_handle_interrupt_no_ack, + .probe = mt7988_phy_probe, + .suspend = genphy_suspend, + .resume = genphy_resume, + .read_page = mtk_socphy_read_page, + .write_page = mtk_socphy_write_page, + }, +}; + +module_phy_driver(mtk_socphy_driver); + +static struct mdio_device_id __maybe_unused mtk_socphy_tbl[] = { + { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981) }, + { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988) }, + { } +}; + +MODULE_DESCRIPTION("MediaTek SoC Gigabit Ethernet PHY driver"); +MODULE_AUTHOR("Daniel Golle "); +MODULE_AUTHOR("SkyLake Huang "); +MODULE_LICENSE("GPL"); + +MODULE_DEVICE_TABLE(mdio, mtk_socphy_tbl); diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 134afb63f9e83b..e6ab85fb5d149b 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -205,7 +205,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MEDIATEK_GE_PHY=y -CONFIG_MEDIATEK_GE_PHY_SOC=y +CONFIG_MEDIATEK_GE_SOC_PHY=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index 2de14752b4679f..d584497ec19df4 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -226,7 +226,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MEDIATEK_GE_PHY=y -# CONFIG_MEDIATEK_GE_PHY_SOC is not set +# CONFIG_MEDIATEK_GE_SOC_PHY is not set CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 diff --git a/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch index 4e462881c2a2a6..b8d1a6061917f2 100644 --- a/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch +++ b/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch @@ -1,23 +1,27 @@ -From a6f143af419bfc3f52d82e88ac033d9833e720af Mon Sep 17 00:00:00 2001 +From 60ed9eb9605656c19ca402b7bd3f47552e901601 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 13 Feb 2023 02:33:14 +0000 Subject: [PATCH] net: phy: add driver for MediaTek SoC built-in GE PHYs Some of MediaTek's Filogic SoCs come with built-in gigabit Ethernet PHYs which require calibration data from the SoC's efuse. -Add support for these PHYs to the mediatek-ge driver if built for -MediaTek's ARM64 SoCs. +Despite the similar design the driver doesn't share any code with the +existing mediatek-ge.c, so add support for these PHYs by introducing a +new driver for only MediaTek's ARM64 SoCs. Signed-off-by: Daniel Golle --- - MAINTAINERS | 8 + - drivers/net/phy/Kconfig | 12 + - drivers/net/phy/mediatek-ge.c | 1351 +++++++++++++++++++++++++++++++++ - 3 files changed, 1371 insertions(+) + MAINTAINERS | 9 + + drivers/net/phy/Kconfig | 12 + + drivers/net/phy/Makefile | 1 + + drivers/net/phy/mediatek-ge-soc.c | 1263 +++++++++++++++++++++++++++++ + drivers/net/phy/mediatek-ge.c | 3 +- + 5 files changed, 1287 insertions(+), 1 deletion(-) + create mode 100644 drivers/net/phy/mediatek-ge-soc.c --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11797,6 +11797,14 @@ S: Maintained +@@ -11797,6 +11797,15 @@ S: Maintained F: drivers/net/pcs/pcs-mtk-lynxi.c F: include/linux/pcs/pcs-mtk-lynxi.h @@ -27,6 +31,7 @@ Signed-off-by: Daniel Golle +M: SkyLake Huang +L: netdev@vger.kernel.org +S: Maintained ++F: drivers/net/phy/mediatek-ge-soc.c +F: drivers/net/phy/mediatek-ge.c + MEDIATEK I2C CONTROLLER DRIVER @@ -38,9 +43,9 @@ Signed-off-by: Daniel Golle help Supports the MediaTek Gigabit Ethernet PHYs. -+config MEDIATEK_GE_PHY_SOC -+ bool "MediaTek SoC Ethernet PHYs" -+ depends on (ARM64 && ARCH_MEDIATEK && MEDIATEK_GE_PHY) || COMPILE_TEST ++config MEDIATEK_GE_SOC_PHY ++ tristate "MediaTek SoC Ethernet PHYs" ++ depends on (ARM64 && ARCH_MEDIATEK) || COMPILE_TEST + select NVMEM_MTK_EFUSE + help + Supports MediaTek SoC built-in Gigabit Ethernet PHYs. @@ -53,1391 +58,25 @@ Signed-off-by: Daniel Golle config MICREL_PHY tristate "Micrel PHYs" help +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -81,6 +81,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o + obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o + obj-$(CONFIG_MAXLINEAR_GPHY) += mxl-gpy.o + obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o ++obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o + obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o + obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o + obj-$(CONFIG_MICREL_PHY) += micrel.o --- a/drivers/net/phy/mediatek-ge.c +++ b/drivers/net/phy/mediatek-ge.c -@@ -2,6 +2,9 @@ - #include - #include - #include -+#include -+#include -+#include - #include - - #define MTK_EXT_PAGE_ACCESS 0x1f -@@ -12,6 +15,275 @@ - #define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30 - #define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 - -+#define ANALOG_INTERNAL_OPERATION_MAX_US (20) -+#define ZCAL_CTRL_MIN (0) -+#define ZCAL_CTRL_MAX (63) -+#define TXRESERVE_MIN (0) -+#define TXRESERVE_MAX (7) -+ -+#define MTK_PHY_ANARG_RG (0x10) -+#define MTK_PHY_TCLKOFFSET_MASK GENMASK(12, 8) -+ -+/* Registers on MDIO_MMD_VEND1 */ -+enum { -+ MTK_PHY_MIDDLE_LEVEL_SHAPPER_0TO1 = 0, -+ MTK_PHY_1st_OVERSHOOT_LEVEL_0TO1, -+ MTK_PHY_2nd_OVERSHOOT_LEVEL_0TO1, -+ MTK_PHY_MIDDLE_LEVEL_SHAPPER_1TO0, -+ MTK_PHY_1st_OVERSHOOT_LEVEL_1TO0, -+ MTK_PHY_2nd_OVERSHOOT_LEVEL_1TO0, -+ MTK_PHY_MIDDLE_LEVEL_SHAPPER_0TON1, /* N means negative */ -+ MTK_PHY_1st_OVERSHOOT_LEVEL_0TON1, -+ MTK_PHY_2nd_OVERSHOOT_LEVEL_0TON1, -+ MTK_PHY_MIDDLE_LEVEL_SHAPPER_N1TO0, -+ MTK_PHY_1st_OVERSHOOT_LEVEL_N1TO0, -+ MTK_PHY_2nd_OVERSHOOT_LEVEL_N1TO0, -+ MTK_PHY_TX_MLT3_END, -+}; -+ -+#define MTK_PHY_TXVLD_DA_RG (0x12) -+#define MTK_PHY_DA_TX_I2MPB_A_GBE_MASK GENMASK(15, 10) -+#define MTK_PHY_DA_TX_I2MPB_A_TBT_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TX_I2MPB_TEST_MODE_A2 (0x16) -+#define MTK_PHY_DA_TX_I2MPB_A_HBT_MASK GENMASK(15, 10) -+#define MTK_PHY_DA_TX_I2MPB_A_TST_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TX_I2MPB_TEST_MODE_B1 (0x17) -+#define MTK_PHY_DA_TX_I2MPB_B_GBE_MASK GENMASK(13, 8) -+#define MTK_PHY_DA_TX_I2MPB_B_TBT_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TX_I2MPB_TEST_MODE_B2 (0x18) -+#define MTK_PHY_DA_TX_I2MPB_B_HBT_MASK GENMASK(13, 8) -+#define MTK_PHY_DA_TX_I2MPB_B_TST_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TX_I2MPB_TEST_MODE_C1 (0x19) -+#define MTK_PHY_DA_TX_I2MPB_C_GBE_MASK GENMASK(13, 8) -+#define MTK_PHY_DA_TX_I2MPB_C_TBT_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TX_I2MPB_TEST_MODE_C2 (0x20) -+#define MTK_PHY_DA_TX_I2MPB_C_HBT_MASK GENMASK(13, 8) -+#define MTK_PHY_DA_TX_I2MPB_C_TST_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TX_I2MPB_TEST_MODE_D1 (0x21) -+#define MTK_PHY_DA_TX_I2MPB_D_GBE_MASK GENMASK(13, 8) -+#define MTK_PHY_DA_TX_I2MPB_D_TBT_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TX_I2MPB_TEST_MODE_D2 (0x22) -+#define MTK_PHY_DA_TX_I2MPB_D_HBT_MASK GENMASK(13, 8) -+#define MTK_PHY_DA_TX_I2MPB_D_TST_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_TANA_CAL_MODE (0xc1) -+#define MTK_PHY_TANA_CAL_MODE_SHIFT (8) -+ -+#define MTK_PHY_RXADC_CTRL_RG7 (0xc6) -+#define MTK_PHY_DA_AD_BUF_BIAS_LP_MASK GENMASK(9, 8) -+ -+#define MTK_PHY_RXADC_CTRL_RG9 (0xc8) -+#define MTK_PHY_DA_RX_PSBN_TBT_MASK GENMASK(14, 12) -+#define MTK_PHY_DA_RX_PSBN_HBT_MASK GENMASK(10, 8) -+#define MTK_PHY_DA_RX_PSBN_GBE_MASK GENMASK(6, 4) -+#define MTK_PHY_DA_RX_PSBN_LP_MASK GENMASK(2, 0) -+ -+#define MTK_PHY_LDO_OUTPUT_V (0xd7) -+ -+#define MTK_PHY_RG_ANA_CAL_RG0 (0xdb) -+#define MTK_PHY_RG_CAL_CKINV BIT(12) -+#define MTK_PHY_RG_ANA_CALEN BIT(8) -+#define MTK_PHY_RG_REXT_CALEN BIT(4) -+#define MTK_PHY_RG_ZCALEN_A BIT(0) -+ -+#define MTK_PHY_RG_ANA_CAL_RG1 (0xdc) -+#define MTK_PHY_RG_ZCALEN_B BIT(12) -+#define MTK_PHY_RG_ZCALEN_C BIT(8) -+#define MTK_PHY_RG_ZCALEN_D BIT(4) -+#define MTK_PHY_RG_TXVOS_CALEN BIT(0) -+ -+#define MTK_PHY_RG_ANA_CAL_RG2 (0xdd) -+#define MTK_PHY_RG_TXG_CALEN_A BIT(12) -+#define MTK_PHY_RG_TXG_CALEN_B BIT(8) -+#define MTK_PHY_RG_TXG_CALEN_C BIT(4) -+#define MTK_PHY_RG_TXG_CALEN_D BIT(0) -+ -+#define MTK_PHY_RG_ANA_CAL_RG5 (0xe0) -+#define MTK_PHY_RG_REXT_TRIM_MASK GENMASK(13, 8) -+#define MTK_PHY_RG_ZCAL_CTRL_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_RG_TX_FILTER (0xfe) -+ -+#define MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B (0x172) -+#define MTK_PHY_CR_TX_AMP_OFFSET_A_MASK GENMASK(13, 8) -+#define MTK_PHY_CR_TX_AMP_OFFSET_B_MASK GENMASK(6, 0) -+ -+#define MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D (0x173) -+#define MTK_PHY_CR_TX_AMP_OFFSET_C_MASK GENMASK(13, 8) -+#define MTK_PHY_CR_TX_AMP_OFFSET_D_MASK GENMASK(6, 0) -+ -+#define MTK_PHY_RG_AD_CAL_COMP (0x17a) -+#define MTK_PHY_AD_CAL_COMP_OUT_SHIFT (8) -+ -+#define MTK_PHY_RG_AD_CAL_CLK (0x17b) -+#define MTK_PHY_DA_CAL_CLK BIT(0) -+ -+#define MTK_PHY_RG_AD_CALIN (0x17c) -+#define MTK_PHY_DA_CALIN_FLAG BIT(0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN0_A (0x17d) -+#define MTK_PHY_DASN_DAC_IN0_A_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN0_B (0x17e) -+#define MTK_PHY_DASN_DAC_IN0_B_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN0_C (0x17f) -+#define MTK_PHY_DASN_DAC_IN0_C_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN0_D (0x180) -+#define MTK_PHY_DASN_DAC_IN0_D_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN1_A (0x181) -+#define MTK_PHY_DASN_DAC_IN1_A_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN1_B (0x182) -+#define MTK_PHY_DASN_DAC_IN1_B_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN1_C (0x183) -+#define MTK_PHY_DASN_DAC_IN1_C_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_DASN_DAC_IN1_D (0x180) -+#define MTK_PHY_DASN_DAC_IN1_D_MASK GENMASK(9, 0) -+ -+#define MTK_PHY_RG_LP_IIR2_K1_L (0x22a) -+#define MTK_PHY_RG_LP_IIR2_K1_U (0x22b) -+#define MTK_PHY_RG_LP_IIR2_K2_L (0x22c) -+#define MTK_PHY_RG_LP_IIR2_K2_U (0x22d) -+#define MTK_PHY_RG_LP_IIR2_K3_L (0x22e) -+#define MTK_PHY_RG_LP_IIR2_K3_U (0x22f) -+#define MTK_PHY_RG_LP_IIR2_K4_L (0x230) -+#define MTK_PHY_RG_LP_IIR2_K4_U (0x231) -+#define MTK_PHY_RG_LP_IIR2_K5_L (0x232) -+#define MTK_PHY_RG_LP_IIR2_K5_U (0x233) -+ -+#define MTK_PHY_RG_DEV1E_REG234 (0x234) -+#define MTK_PHY_TR_OPEN_LOOP_EN_MASK GENMASK(0, 0) -+#define MTK_PHY_LPF_X_AVERAGE_MASK GENMASK(7, 4) -+ -+#define MTK_PHY_RG_LPF_CNT_VAL (0x235) -+ -+#define MTK_PHY_RG_DEV1E_REG27C (0x27c) -+#define MTK_PHY_VGASTATE_FFE_THR_ST1_MASK GENMASK(12, 8) -+#define MTK_PHY_RG_DEV1E_REG27D (0x27d) -+#define MTK_PHY_VGASTATE_FFE_THR_ST2_MASK GENMASK(4, 0) -+ -+#define MTK_PHY_LDO_PUMP_EN_PAIRAB (0x502) -+#define MTK_PHY_LDO_PUMP_EN_PAIRCD (0x503) -+ -+#define MTK_PHY_DA_TX_R50_PAIR_A (0x53d) -+#define MTK_PHY_DA_TX_R50_PAIR_B (0x53e) -+#define MTK_PHY_DA_TX_R50_PAIR_C (0x53f) -+#define MTK_PHY_DA_TX_R50_PAIR_D (0x540) -+ -+/* Registers on MDIO_MMD_VEND2 */ -+#define MTK_PHY_LED0_ON_CTRL (0x24) -+#define MTK_PHY_LED0_ON_MASK GENMASK(6, 0) -+#define MTK_PHY_LED0_ON_LINK1000 BIT(0) -+#define MTK_PHY_LED0_ON_LINK100 BIT(1) -+#define MTK_PHY_LED0_ON_LINK10 BIT(2) -+#define MTK_PHY_LED0_ON_LINKDOWN BIT(3) -+#define MTK_PHY_LED0_ON_FDX BIT(4) /* Full duplex */ -+#define MTK_PHY_LED0_ON_HDX BIT(5) /* Half duplex */ -+#define MTK_PHY_LED0_FORCE_ON BIT(6) -+#define MTK_PHY_LED0_POLARITY BIT(14) -+#define MTK_PHY_LED0_ENABLE BIT(15) -+ -+#define MTK_PHY_LED0_BLINK_CTRL (0x25) -+#define MTK_PHY_LED0_1000TX BIT(0) -+#define MTK_PHY_LED0_1000RX BIT(1) -+#define MTK_PHY_LED0_100TX BIT(2) -+#define MTK_PHY_LED0_100RX BIT(3) -+#define MTK_PHY_LED0_10TX BIT(4) -+#define MTK_PHY_LED0_10RX BIT(5) -+#define MTK_PHY_LED0_COLLISION BIT(6) -+#define MTK_PHY_LED0_RX_CRC_ERR BIT(7) -+#define MTK_PHY_LED0_RX_IDLE_ERR BIT(8) -+#define MTK_PHY_LED0_FORCE_BLINK BIT(9) -+ -+#define MTK_PHY_ANA_TEST_BUS_CTRL_RG (0x100) -+#define MTK_PHY_ANA_TEST_MODE_MASK GENMASK(15, 8) -+ -+#define MTK_PHY_RG_DASN_TXT_DMY2 (0x110) -+#define MTK_PHY_TST_DMY2_MASK GENMASK(5, 0) -+ -+#define MTK_PHY_RG_BG_RASEL (0x115) -+#define MTK_PHY_RG_BG_RASEL_MASK GENMASK(2, 0) -+ -+/* These macro privides efuse parsing for internal phy. */ -+#define EFS_DA_TX_I2MPB_A(x) (((x) >> 0) & GENMASK(5, 0)) -+#define EFS_DA_TX_I2MPB_B(x) (((x) >> 6) & GENMASK(5, 0)) -+#define EFS_DA_TX_I2MPB_C(x) (((x) >> 12) & GENMASK(5, 0)) -+#define EFS_DA_TX_I2MPB_D(x) (((x) >> 18) & GENMASK(5, 0)) -+#define EFS_DA_TX_AMP_OFFSET_A(x) (((x) >> 24) & GENMASK(5, 0)) -+ -+#define EFS_DA_TX_AMP_OFFSET_B(x) (((x) >> 0) & GENMASK(5, 0)) -+#define EFS_DA_TX_AMP_OFFSET_C(x) (((x) >> 6) & GENMASK(5, 0)) -+#define EFS_DA_TX_AMP_OFFSET_D(x) (((x) >> 12) & GENMASK(5, 0)) -+#define EFS_DA_TX_R50_A(x) (((x) >> 18) & GENMASK(5, 0)) -+#define EFS_DA_TX_R50_B(x) (((x) >> 24) & GENMASK(5, 0)) -+ -+#define EFS_DA_TX_R50_C(x) (((x) >> 0) & GENMASK(5, 0)) -+#define EFS_DA_TX_R50_D(x) (((x) >> 6) & GENMASK(5, 0)) -+#define EFS_DA_TX_R50_A_10M(x) (((x) >> 12) & GENMASK(5, 0)) -+#define EFS_DA_TX_R50_B_10M(x) (((x) >> 18) & GENMASK(5, 0)) -+ -+#define EFS_RG_BG_RASEL(x) (((x) >> 4) & GENMASK(2, 0)) -+#define EFS_RG_REXT_TRIM(x) (((x) >> 7) & GENMASK(5, 0)) -+ -+enum { -+ NO_PAIR, -+ PAIR_A, -+ PAIR_B, -+ PAIR_C, -+ PAIR_D, -+}; -+ -+enum { -+ GPHY_PORT0, -+ GPHY_PORT1, -+ GPHY_PORT2, -+ GPHY_PORT3, -+}; -+ -+enum calibration_mode { -+ EFUSE_K, -+ SW_K -+}; -+ -+enum CAL_ITEM { -+ REXT, -+ TX_OFFSET, -+ TX_AMP, -+ TX_R50, -+ TX_VCM -+}; -+ -+enum CAL_MODE { -+ SW_EFUSE_M, -+ EFUSE_M, -+ SW_M -+}; -+ -+const u8 mt798x_zcal_to_r50[64] = { -+ 7, 8, 9, 9, 10, 10, 11, 11, -+ 12, 13, 13, 14, 14, 15, 16, 16, -+ 17, 18, 18, 19, 20, 21, 21, 22, -+ 23, 24, 24, 25, 26, 27, 28, 29, -+ 30, 31, 32, 33, 34, 35, 36, 37, -+ 38, 40, 41, 42, 43, 45, 46, 48, -+ 49, 51, 52, 54, 55, 57, 59, 61, -+ 62, 63, 63, 63, 63, 63, 63, 63 -+}; -+ -+const char pair[4] = {'A', 'B', 'C', 'D'}; -+ - static int mtk_gephy_read_page(struct phy_device *phydev) - { - return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); -@@ -102,6 +374,1059 @@ static int mt7531_phy_config_init(struct - return 0; - } - -+#ifdef CONFIG_MEDIATEK_GE_PHY_SOC -+/* One calibration cycle consists of: -+ * 1.Set DA_CALIN_FLAG high to start calibration. Keep it high -+ * until AD_CAL_COMP is ready to output calibration result. -+ * 2.Wait until DA_CAL_CLK is available. -+ * 3.Fetch AD_CAL_COMP_OUT. -+ */ -+static int cal_cycle(struct phy_device *phydev, int devad, -+ u32 regnum, u16 mask, u16 cal_val) -+{ -+ unsigned long timeout; -+ int reg_val; -+ int ret; -+ -+ phy_modify_mmd(phydev, devad, regnum, -+ mask, cal_val); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, -+ MTK_PHY_DA_CALIN_FLAG); -+ -+ timeout = jiffies + usecs_to_jiffies(ANALOG_INTERNAL_OPERATION_MAX_US); -+ do { -+ reg_val = phy_read_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_AD_CAL_CLK); -+ } while (time_before(jiffies, timeout) && !(reg_val & BIT(0))); -+ -+ if (!(reg_val & BIT(0))) { -+ dev_err(&phydev->mdio.dev, "Calibration cycle timeout\n"); -+ return -ETIMEDOUT; -+ } -+ -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, -+ MTK_PHY_DA_CALIN_FLAG); -+ ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CAL_COMP) >> -+ MTK_PHY_AD_CAL_COMP_OUT_SHIFT; -+ dev_dbg(&phydev->mdio.dev, "cal_val: 0x%x, ret: %d\n", cal_val, ret); -+ -+ return ret; -+} -+ -+static int rext_fill_result(struct phy_device *phydev, u16 *buf) -+{ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_REXT_TRIM_MASK, buf[0] << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_BG_RASEL, -+ MTK_PHY_RG_BG_RASEL_MASK, buf[1]); -+ -+ return 0; -+} -+ -+static int rext_cal_efuse(struct phy_device *phydev, u32 *buf) -+{ -+ u16 rext_cal_val[2]; -+ -+ rext_cal_val[0] = EFS_RG_REXT_TRIM(buf[3]); -+ rext_cal_val[1] = EFS_RG_BG_RASEL(buf[3]); -+ rext_fill_result(phydev, rext_cal_val); -+ -+ return 0; -+} -+ -+static int rext_cal_sw(struct phy_device *phydev) -+{ -+ u8 rg_zcal_ctrl_def; -+ u8 zcal_lower, zcal_upper, rg_zcal_ctrl; -+ u8 lower_ret, upper_ret; -+ u16 rext_cal_val[2]; -+ int ret; -+ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_ANA_TEST_BUS_CTRL_RG, -+ MTK_PHY_ANA_TEST_MODE_MASK, MTK_PHY_TANA_CAL_MODE << 8); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_TXVOS_CALEN); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_CAL_CKINV | MTK_PHY_RG_ANA_CALEN | -+ MTK_PHY_RG_REXT_CALEN); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_DASN_TXT_DMY2, -+ MTK_PHY_TST_DMY2_MASK, 0x1); -+ -+ rg_zcal_ctrl_def = phy_read_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG5) & -+ MTK_PHY_RG_ZCAL_CTRL_MASK; -+ zcal_lower = ZCAL_CTRL_MIN; -+ zcal_upper = ZCAL_CTRL_MAX; -+ -+ dev_dbg(&phydev->mdio.dev, "Start REXT SW cal.\n"); -+ while ((zcal_upper - zcal_lower) > 1) { -+ rg_zcal_ctrl = DIV_ROUND_CLOSEST(zcal_lower + zcal_upper, 2); -+ ret = cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, rg_zcal_ctrl); -+ if (ret == 1) { -+ zcal_upper = rg_zcal_ctrl; -+ upper_ret = ret; -+ } else if (ret == 0) { -+ zcal_lower = rg_zcal_ctrl; -+ lower_ret = ret; -+ } else { -+ goto restore; -+ } -+ } -+ -+ if (zcal_lower == ZCAL_CTRL_MIN) { -+ lower_ret = cal_cycle(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, zcal_lower); -+ ret = lower_ret; -+ } else if (zcal_upper == ZCAL_CTRL_MAX) { -+ upper_ret = cal_cycle(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, zcal_upper); -+ ret = upper_ret; -+ } -+ if (ret < 0) -+ goto restore; -+ -+ ret = upper_ret - lower_ret; -+ if (ret == 1) { -+ rext_cal_val[0] = zcal_upper; -+ rext_cal_val[1] = zcal_upper >> 3; -+ rext_fill_result(phydev, rext_cal_val); -+ dev_info(&phydev->mdio.dev, "REXT SW cal result: 0x%x\n", -+ zcal_upper); -+ ret = 0; -+ } else { -+ ret = -EINVAL; -+ } -+ -+restore: -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, -+ MTK_PHY_ANA_TEST_BUS_CTRL_RG, -+ MTK_PHY_ANA_TEST_MODE_MASK); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_CAL_CKINV | MTK_PHY_RG_ANA_CALEN | -+ MTK_PHY_RG_REXT_CALEN); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_DASN_TXT_DMY2, -+ MTK_PHY_TST_DMY2_MASK); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, rg_zcal_ctrl_def); -+ -+ return ret; -+} -+ -+static int tx_offset_fill_result(struct phy_device *phydev, u16 *buf) -+{ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, -+ MTK_PHY_CR_TX_AMP_OFFSET_A_MASK, buf[0] << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, -+ MTK_PHY_CR_TX_AMP_OFFSET_B_MASK, buf[1]); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, -+ MTK_PHY_CR_TX_AMP_OFFSET_C_MASK, buf[2] << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, -+ MTK_PHY_CR_TX_AMP_OFFSET_D_MASK, buf[3]); -+ -+ return 0; -+} -+ -+static int tx_offset_cal_efuse(struct phy_device *phydev, u32 *buf) -+{ -+ u16 tx_offset_cal_val[4]; -+ -+ tx_offset_cal_val[0] = EFS_DA_TX_AMP_OFFSET_A(buf[0]); -+ tx_offset_cal_val[1] = EFS_DA_TX_AMP_OFFSET_B(buf[1]); -+ tx_offset_cal_val[2] = EFS_DA_TX_AMP_OFFSET_C(buf[1]); -+ tx_offset_cal_val[3] = EFS_DA_TX_AMP_OFFSET_D(buf[1]); -+ -+ tx_offset_fill_result(phydev, tx_offset_cal_val); -+ -+ return 0; -+} -+ -+static int tx_amp_fill_result(struct phy_device *phydev, u16 *buf) -+{ -+ int i; -+ int bias[16] = {0}; -+ const int vals_9461[16] = { 7, 1, 4, 7, -+ 7, 1, 4, 7, -+ 7, 1, 4, 7, -+ 7, 1, 4, 7 }; -+ const int vals_9481[16] = { 10, 6, 6, 10, -+ 10, 6, 6, 10, -+ 10, 6, 6, 10, -+ 10, 6, 6, 10 }; -+ -+ switch (phydev->drv->phy_id) { -+ case 0x03a29461: -+ /* We add some calibration to efuse values -+ * due to board level influence. -+ * GBE: +7, TBT: +1, HBT: +4, TST: +7 -+ */ -+ memcpy(bias, (const void *)vals_9461, sizeof(bias)); -+ for (i = 0; i <= 12; i += 4) { -+ if (likely(buf[i >> 2] + bias[i] >= 32)) { -+ bias[i] -= 13; -+ } else { -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, -+ 0x5c, 0x7 << i, bias[i] << i); -+ bias[i + 1] += 13; -+ bias[i + 2] += 13; -+ bias[i + 3] += 13; -+ } -+ } -+ break; -+ case 0x03a29481: -+ memcpy(bias, (const void *)vals_9481, sizeof(bias)); -+ break; -+ default: -+ break; -+ } -+ -+ /* Prevent overflow */ -+ for (i = 0; i < 12; i++) { -+ if (buf[i >> 2] + bias[i] > 63) { -+ buf[i >> 2] = 63; -+ bias[i] = 0; -+ } else if (buf[i >> 2] + bias[i] < 0) { -+ /* Bias caused by board design may change in the future. -+ * So check negative cases, too. -+ */ -+ buf[i >> 2] = 0; -+ bias[i] = 0; -+ } -+ } -+ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, -+ MTK_PHY_DA_TX_I2MPB_A_GBE_MASK, (buf[0] + bias[0]) << 10); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, -+ MTK_PHY_DA_TX_I2MPB_A_TBT_MASK, buf[0] + bias[1]); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, -+ MTK_PHY_DA_TX_I2MPB_A_HBT_MASK, (buf[0] + bias[2]) << 10); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, -+ MTK_PHY_DA_TX_I2MPB_A_TST_MASK, buf[0] + bias[3]); -+ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, -+ MTK_PHY_DA_TX_I2MPB_B_GBE_MASK, (buf[1] + bias[4]) << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, -+ MTK_PHY_DA_TX_I2MPB_B_TBT_MASK, buf[1] + bias[5]); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, -+ MTK_PHY_DA_TX_I2MPB_B_HBT_MASK, (buf[1] + bias[6]) << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, -+ MTK_PHY_DA_TX_I2MPB_B_TST_MASK, buf[1] + bias[7]); -+ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, -+ MTK_PHY_DA_TX_I2MPB_C_GBE_MASK, (buf[2] + bias[8]) << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, -+ MTK_PHY_DA_TX_I2MPB_C_TBT_MASK, buf[2] + bias[9]); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, -+ MTK_PHY_DA_TX_I2MPB_C_HBT_MASK, (buf[2] + bias[10]) << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, -+ MTK_PHY_DA_TX_I2MPB_C_TST_MASK, buf[2] + bias[11]); -+ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, -+ MTK_PHY_DA_TX_I2MPB_D_GBE_MASK, (buf[3] + bias[12]) << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, -+ MTK_PHY_DA_TX_I2MPB_D_TBT_MASK, buf[3] + bias[13]); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, -+ MTK_PHY_DA_TX_I2MPB_D_HBT_MASK, (buf[3] + bias[14]) << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, -+ MTK_PHY_DA_TX_I2MPB_D_TST_MASK, buf[3] + bias[15]); -+ -+ return 0; -+} -+ -+static int tx_amp_cal_efuse(struct phy_device *phydev, u32 *buf) -+{ -+ u16 tx_amp_cal_val[4]; -+ -+ tx_amp_cal_val[0] = EFS_DA_TX_I2MPB_A(buf[0]); -+ tx_amp_cal_val[1] = EFS_DA_TX_I2MPB_B(buf[0]); -+ tx_amp_cal_val[2] = EFS_DA_TX_I2MPB_C(buf[0]); -+ tx_amp_cal_val[3] = EFS_DA_TX_I2MPB_D(buf[0]); -+ tx_amp_fill_result(phydev, tx_amp_cal_val); -+ -+ return 0; -+} -+ -+static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val, -+ u8 txg_calen_x) -+{ -+ int bias = 0; -+ u16 reg, val; -+ -+ switch (phydev->drv->phy_id) { -+ case 0x03a29481: -+ { -+ bias = -2; -+ break; -+ } -+ /* 0x03a29461 enters default case */ -+ default: -+ break; -+ } -+ -+ val = clamp_val(bias + tx_r50_cal_val, 0, 63); -+ -+ switch (txg_calen_x) { -+ case PAIR_A: -+ reg = MTK_PHY_DA_TX_R50_PAIR_A; -+ break; -+ case PAIR_B: -+ reg = MTK_PHY_DA_TX_R50_PAIR_B; -+ break; -+ case PAIR_C: -+ reg = MTK_PHY_DA_TX_R50_PAIR_C; -+ break; -+ case PAIR_D: -+ reg = MTK_PHY_DA_TX_R50_PAIR_D; -+ break; -+ } -+ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, val | val << 8); -+ -+ return 0; -+} -+ -+static int tx_r50_cal_efuse(struct phy_device *phydev, u32 *buf, -+ u8 txg_calen_x) -+{ -+ u16 tx_r50_cal_val; -+ -+ switch (txg_calen_x) { -+ case PAIR_A: -+ tx_r50_cal_val = EFS_DA_TX_R50_A(buf[1]); -+ break; -+ case PAIR_B: -+ tx_r50_cal_val = EFS_DA_TX_R50_B(buf[1]); -+ break; -+ case PAIR_C: -+ tx_r50_cal_val = EFS_DA_TX_R50_C(buf[2]); -+ break; -+ case PAIR_D: -+ tx_r50_cal_val = EFS_DA_TX_R50_D(buf[2]); -+ break; -+ } -+ tx_r50_fill_result(phydev, tx_r50_cal_val, txg_calen_x); -+ -+ return 0; -+} -+ -+static int tx_r50_cal_sw(struct phy_device *phydev, u8 txg_calen_x) -+{ -+ u8 zcal_lower, zcal_upper, rg_zcal_ctrl; -+ u8 lower_ret, upper_ret; -+ u8 rg_zcal_ctrl_def; -+ u16 tx_r50_cal_val; -+ int ret; -+ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_ANA_TEST_BUS_CTRL_RG, -+ MTK_PHY_ANA_TEST_MODE_MASK, MTK_PHY_TANA_CAL_MODE << 8); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_TXVOS_CALEN); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_CAL_CKINV | MTK_PHY_RG_ANA_CALEN); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG2, -+ BIT(txg_calen_x * 4)); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_DASN_TXT_DMY2, -+ MTK_PHY_TST_DMY2_MASK, 0x1); -+ -+ rg_zcal_ctrl_def = phy_read_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG5) & -+ MTK_PHY_RG_ZCAL_CTRL_MASK; -+ zcal_lower = ZCAL_CTRL_MIN; -+ zcal_upper = ZCAL_CTRL_MAX; -+ -+ dev_dbg(&phydev->mdio.dev, "Start TX-R50 Pair%c SW cal.\n", -+ pair[txg_calen_x]); -+ while ((zcal_upper - zcal_lower) > 1) { -+ rg_zcal_ctrl = DIV_ROUND_CLOSEST(zcal_lower + zcal_upper, 2); -+ ret = cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, rg_zcal_ctrl); -+ if (ret == 1) { -+ zcal_upper = rg_zcal_ctrl; -+ upper_ret = ret; -+ } else if (ret == 0) { -+ zcal_lower = rg_zcal_ctrl; -+ lower_ret = ret; -+ } else { -+ goto restore; -+ } -+ } -+ -+ if (zcal_lower == ZCAL_CTRL_MIN) { -+ lower_ret = cal_cycle(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, zcal_lower); -+ ret = lower_ret; -+ } else if (zcal_upper == ZCAL_CTRL_MAX) { -+ upper_ret = cal_cycle(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, zcal_upper); -+ ret = upper_ret; -+ } -+ if (ret < 0) -+ goto restore; -+ -+ ret = upper_ret - lower_ret; -+ if (ret == 1) { -+ tx_r50_cal_val = mt798x_zcal_to_r50[zcal_upper]; -+ tx_r50_fill_result(phydev, tx_r50_cal_val, txg_calen_x); -+ dev_info(&phydev->mdio.dev, -+ "TX-R50 Pair%c SW cal result: 0x%x\n", -+ pair[txg_calen_x], zcal_lower); -+ ret = 0; -+ } else { -+ ret = -EINVAL; -+ } -+ -+restore: -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_ANA_TEST_BUS_CTRL_RG, -+ MTK_PHY_ANA_TEST_MODE_MASK); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_CAL_CKINV | MTK_PHY_RG_ANA_CALEN); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG2, -+ BIT(txg_calen_x * 4)); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_DASN_TXT_DMY2, -+ MTK_PHY_TST_DMY2_MASK); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, -+ MTK_PHY_RG_ZCAL_CTRL_MASK, rg_zcal_ctrl_def); -+ -+ return ret; -+} -+ -+static int tx_vcm_cal_sw(struct phy_device *phydev, u8 rg_txreserve_x) -+{ -+ u8 lower_idx, upper_idx, txreserve_val; -+ u8 lower_ret, upper_ret; -+ int ret; -+ -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_ANA_CALEN); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_CAL_CKINV); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_TXVOS_CALEN); -+ -+ switch (rg_txreserve_x) { -+ case PAIR_A: -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN0_A, -+ MTK_PHY_DASN_DAC_IN0_A_MASK); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN1_A, -+ MTK_PHY_DASN_DAC_IN1_A_MASK); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_ZCALEN_A); -+ break; -+ case PAIR_B: -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN0_B, -+ MTK_PHY_DASN_DAC_IN0_B_MASK); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN1_B, -+ MTK_PHY_DASN_DAC_IN1_B_MASK); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_ZCALEN_B); -+ break; -+ case PAIR_C: -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN0_C, -+ MTK_PHY_DASN_DAC_IN0_C_MASK); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN1_C, -+ MTK_PHY_DASN_DAC_IN1_C_MASK); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_ZCALEN_C); -+ break; -+ case PAIR_D: -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN0_D, -+ MTK_PHY_DASN_DAC_IN0_D_MASK); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_DASN_DAC_IN1_D, -+ MTK_PHY_DASN_DAC_IN1_D_MASK); -+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_ZCALEN_D); -+ break; -+ default: -+ ret = -EINVAL; -+ goto restore; -+ } -+ -+ lower_idx = TXRESERVE_MIN; -+ upper_idx = TXRESERVE_MAX; -+ -+ dev_dbg(&phydev->mdio.dev, "Start TX-VCM SW cal.\n"); -+ while ((upper_idx - lower_idx) > 1) { -+ txreserve_val = DIV_ROUND_CLOSEST(lower_idx + upper_idx, 2); -+ ret = cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, -+ MTK_PHY_DA_RX_PSBN_TBT_MASK | -+ MTK_PHY_DA_RX_PSBN_HBT_MASK | -+ MTK_PHY_DA_RX_PSBN_GBE_MASK | -+ MTK_PHY_DA_RX_PSBN_LP_MASK, -+ txreserve_val << 12 | txreserve_val << 8 | -+ txreserve_val << 4 | txreserve_val); -+ if (ret == 1) { -+ upper_idx = txreserve_val; -+ upper_ret = ret; -+ } else if (ret == 0) { -+ lower_idx = txreserve_val; -+ lower_ret = ret; -+ } else { -+ goto restore; -+ } -+ } -+ -+ if (lower_idx == TXRESERVE_MIN) { -+ lower_ret = cal_cycle(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RXADC_CTRL_RG9, -+ MTK_PHY_DA_RX_PSBN_TBT_MASK | -+ MTK_PHY_DA_RX_PSBN_HBT_MASK | -+ MTK_PHY_DA_RX_PSBN_GBE_MASK | -+ MTK_PHY_DA_RX_PSBN_LP_MASK, -+ lower_idx << 12 | lower_idx << 8 | -+ lower_idx << 4 | lower_idx); -+ ret = lower_ret; -+ } else if (upper_idx == TXRESERVE_MAX) { -+ upper_ret = cal_cycle(phydev, MDIO_MMD_VEND1, -+ MTK_PHY_RXADC_CTRL_RG9, -+ MTK_PHY_DA_RX_PSBN_TBT_MASK | -+ MTK_PHY_DA_RX_PSBN_HBT_MASK | -+ MTK_PHY_DA_RX_PSBN_GBE_MASK | -+ MTK_PHY_DA_RX_PSBN_LP_MASK, -+ upper_idx << 12 | upper_idx << 8 | -+ upper_idx << 4 | upper_idx); -+ ret = upper_ret; -+ } -+ if (ret < 0) -+ goto restore; -+ -+ /* We calibrate TX-VCM in different logic. Check upper index and then -+ * lower index. If this calibration is valid, apply lower index's result. -+ */ -+ ret = upper_ret - lower_ret; -+ if (ret == 1) { -+ ret = 0; -+ /* Make sure we use upper_idx in our calibration system */ -+ cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, -+ MTK_PHY_DA_RX_PSBN_TBT_MASK | -+ MTK_PHY_DA_RX_PSBN_HBT_MASK | -+ MTK_PHY_DA_RX_PSBN_GBE_MASK | -+ MTK_PHY_DA_RX_PSBN_LP_MASK, -+ upper_idx << 12 | upper_idx << 8 | -+ upper_idx << 4 | upper_idx); -+ dev_info(&phydev->mdio.dev, "TX-VCM SW cal result: 0x%x\n", -+ upper_idx); -+ } else if (lower_idx == TXRESERVE_MIN && upper_ret == 1 && -+ lower_ret == 1) { -+ ret = 0; -+ cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, -+ MTK_PHY_DA_RX_PSBN_TBT_MASK | -+ MTK_PHY_DA_RX_PSBN_HBT_MASK | -+ MTK_PHY_DA_RX_PSBN_GBE_MASK | -+ MTK_PHY_DA_RX_PSBN_LP_MASK, -+ lower_idx << 12 | lower_idx << 8 | -+ lower_idx << 4 | lower_idx); -+ dev_warn(&phydev->mdio.dev, -+ "TX-VCM SW cal result at low margin 0x%x\n", -+ lower_idx); -+ } else if (upper_idx == TXRESERVE_MAX && upper_ret == 0 && -+ lower_ret == 0) { -+ ret = 0; -+ dev_warn(&phydev->mdio.dev, -+ "TX-VCM SW cal result at high margin 0x%x\n", -+ upper_idx); -+ } else { -+ ret = -EINVAL; -+ } -+ -+restore: -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_ANA_CALEN); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_TXVOS_CALEN); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, -+ MTK_PHY_RG_ZCALEN_A); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, -+ MTK_PHY_RG_ZCALEN_B | MTK_PHY_RG_ZCALEN_C | -+ MTK_PHY_RG_ZCALEN_D); -+ -+ return ret; -+} -+ -+static inline void mt7981_phy_finetune(struct phy_device *phydev) -+{ -+ u32 i; -+ -+ /* 100M eye finetune: -+ * Keep middle level of TX MLT3 shapper as default. -+ * Only change TX MLT3 overshoot level here. -+ */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_1st_OVERSHOOT_LEVEL_0TO1, -+ 0x1ce); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_2nd_OVERSHOOT_LEVEL_0TO1, -+ 0x1c1); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_1st_OVERSHOOT_LEVEL_1TO0, -+ 0x20f); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_2nd_OVERSHOOT_LEVEL_1TO0, -+ 0x202); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_1st_OVERSHOOT_LEVEL_0TON1, -+ 0x3d0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_2nd_OVERSHOOT_LEVEL_0TON1, -+ 0x3c0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_1st_OVERSHOOT_LEVEL_N1TO0, -+ 0x13); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_2nd_OVERSHOOT_LEVEL_N1TO0, -+ 0x5); -+ -+ /* TX-AMP finetune: -+ * 100M +4, 1000M +6 to default value. -+ * If efuse values aren't valid, TX-AMP uses the below values. -+ */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, 0x9824); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, -+ 0x9026); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, -+ 0x2624); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, -+ 0x2426); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, -+ 0x2624); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, -+ 0x2426); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, -+ 0x2624); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, -+ 0x2426); -+ -+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); -+ /* EnabRandUpdTrig = 1 */ -+ __phy_write(phydev, 0x11, 0x2f00); -+ __phy_write(phydev, 0x12, 0xe); -+ __phy_write(phydev, 0x10, 0x8fb0); -+ -+ /* SlvDSPreadyTime = 0xc */ -+ __phy_write(phydev, 0x11, 0x671); -+ __phy_write(phydev, 0x12, 0xc); -+ __phy_write(phydev, 0x10, 0x8fae); -+ -+ /* NormMseLoThresh = 85 */ -+ __phy_write(phydev, 0x11, 0x55a0); -+ __phy_write(phydev, 0x12, 0x0); -+ __phy_write(phydev, 0x10, 0x83aa); -+ -+ /* InhibitDisableDfeTail1000 = 1 */ -+ __phy_write(phydev, 0x11, 0x2b); -+ __phy_write(phydev, 0x12, 0x0); -+ __phy_write(phydev, 0x10, 0x8f80); -+ -+ /* SSTr related */ -+ __phy_write(phydev, 0x11, 0xbaef); -+ __phy_write(phydev, 0x12, 0x2e); -+ __phy_write(phydev, 0x10, 0x968c); -+ -+ /* VcoSlicerThreshBitsHigh */ -+ __phy_write(phydev, 0x11, 0x5555); -+ __phy_write(phydev, 0x12, 0x55); -+ __phy_write(phydev, 0x10, 0x8ec0); -+ -+ /* ResetSyncOffset = 6 */ -+ __phy_write(phydev, 0x11, 0x600); -+ __phy_write(phydev, 0x12, 0x0); -+ __phy_write(phydev, 0x10, 0x8fc0); -+ -+ /* VgaDecRate = 1 */ -+ __phy_write(phydev, 0x11, 0x4c2a); -+ __phy_write(phydev, 0x12, 0x3e); -+ __phy_write(phydev, 0x10, 0x8fa4); -+ -+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); -+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234, -+ MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK, -+ BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9)); -+ -+ /* rg_tr_lpf_cnt_val = 512 */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x200); -+ -+ /* IIR2 related */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_L, 0x82); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_U, 0x0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_L, 0x103); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_U, 0x0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_L, 0x82); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_U, 0x0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_L, 0xd177); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_U, 0x3); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_L, 0x2c82); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_U, 0xe); -+ -+ /* FFE peaking */ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27C, -+ MTK_PHY_VGASTATE_FFE_THR_ST1_MASK, 0x1b << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27D, -+ MTK_PHY_VGASTATE_FFE_THR_ST2_MASK, 0x1e); -+ -+ /* TX shape */ -+ /* 10/100/1000 TX shaper is enabled by default */ -+ for (i = 0x202; i < 0x230; i += 2) { -+ if (i == 0x20c || i == 0x218 || i == 0x224) -+ continue; -+ phy_write_mmd(phydev, MDIO_MMD_VEND2, i, 0x2219); -+ phy_write_mmd(phydev, MDIO_MMD_VEND2, i + 1, 0x23); -+ } -+} -+ -+static inline void mt7988_phy_finetune(struct phy_device *phydev) -+{ -+ u16 val[12] = { 0x0187, 0x01cd, 0x01c8, 0x0182, -+ 0x020d, 0x0206, 0x0384, 0x03d0, -+ 0x03c6, 0x030a, 0x0011, 0x0005 }; -+ int i; -+ -+ for (i = 0; i < MTK_PHY_TX_MLT3_END; i++) -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[i]); -+ -+ /* TCT finetune */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5); -+ -+ /* Disable TX power saving */ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7, -+ MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8); -+ -+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); -+ /* EnabRandUpdTrig = 1 */ -+ __phy_write(phydev, 0x11, 0x2f00); -+ __phy_write(phydev, 0x12, 0xe); -+ __phy_write(phydev, 0x10, 0x8fb0); -+ -+ /* SlvDSPreadyTime = 0xc */ -+ __phy_write(phydev, 0x11, 0x671); -+ __phy_write(phydev, 0x12, 0xc); -+ __phy_write(phydev, 0x10, 0x8fae); -+ -+ /* NormMseLoThresh = 85 */ -+ __phy_write(phydev, 0x11, 0x55a0); -+ __phy_write(phydev, 0x12, 0x0); -+ __phy_write(phydev, 0x10, 0x83aa); -+ -+ /* InhibitDisableDfeTail1000 = 1 */ -+ __phy_write(phydev, 0x11, 0x2b); -+ __phy_write(phydev, 0x12, 0x0); -+ __phy_write(phydev, 0x10, 0x8f80); -+ -+ /* SSTr related */ -+ __phy_write(phydev, 0x11, 0xbaef); -+ __phy_write(phydev, 0x12, 0x2e); -+ __phy_write(phydev, 0x10, 0x968c); -+ -+ /* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2, -+ * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2 -+ */ -+ __phy_write(phydev, 0x11, 0xd10a); -+ __phy_write(phydev, 0x12, 0x34); -+ __phy_write(phydev, 0x10, 0x8f82); -+ -+ /* VcoSlicerThreshBitsHigh */ -+ __phy_write(phydev, 0x11, 0x5555); -+ __phy_write(phydev, 0x12, 0x55); -+ __phy_write(phydev, 0x10, 0x8ec0); -+ -+ /* ResetSyncOffset = 5 */ -+ __phy_write(phydev, 0x11, 0x500); -+ __phy_write(phydev, 0x12, 0x0); -+ __phy_write(phydev, 0x10, 0x8fc0); -+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); -+ -+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30); -+ /* TxClkOffset = 2 */ -+ __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK, -+ FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2)); -+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); -+ -+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234, -+ MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK, -+ BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9)); -+ -+ /* rg_tr_lpf_cnt_val = 512 */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x200); -+ -+ /* IIR2 related */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_L, 0x82); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_U, 0x0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_L, 0x103); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_U, 0x0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_L, 0x82); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_U, 0x0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_L, 0xd177); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_U, 0x3); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_L, 0x2c82); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_U, 0xe); -+ -+ /* FFE peaking */ -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27C, -+ MTK_PHY_VGASTATE_FFE_THR_ST1_MASK, 0x1b << 8); -+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27D, -+ MTK_PHY_VGASTATE_FFE_THR_ST2_MASK, 0x1e); -+ -+ /* TX shape */ -+ /* 10/100/1000 TX shaper is enabled by default */ -+ for (i = 0x202; i < 0x230; i += 2) { -+ if (i == 0x20c || i == 0x218 || i == 0x224) -+ continue; -+ phy_write_mmd(phydev, MDIO_MMD_VEND2, i, 0x2219); -+ phy_write_mmd(phydev, MDIO_MMD_VEND2, i + 1, 0x23); -+ } -+ -+ /* Disable LDO pump */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRAB, 0x0); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRCD, 0x0); -+ -+ /* Adjust LDO output voltage */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222); -+} -+ -+static inline int cal_sw(struct phy_device *phydev, enum CAL_ITEM cal_item, -+ u8 start_pair, u8 end_pair) -+{ -+ u8 pair_n; -+ int ret; -+ -+ for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { -+ /* TX_OFFSET & TX_AMP have no SW calibration. */ -+ switch (cal_item) { -+ case REXT: -+ ret = rext_cal_sw(phydev); -+ break; -+ case TX_R50: -+ ret = tx_r50_cal_sw(phydev, pair_n); -+ break; -+ case TX_VCM: -+ ret = tx_vcm_cal_sw(phydev, pair_n); -+ break; -+ default: -+ return -EINVAL; -+ } -+ if (ret) -+ return ret; -+ } -+ return 0; -+} -+ -+static inline int cal_efuse(struct phy_device *phydev, enum CAL_ITEM cal_item, -+ u8 start_pair, u8 end_pair, u32 *buf) -+{ -+ u8 pair_n; -+ int ret; -+ -+ for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { -+ /* TX_VCM has no efuse calibration. */ -+ switch (cal_item) { -+ case REXT: -+ ret = rext_cal_efuse(phydev, buf); -+ break; -+ case TX_OFFSET: -+ ret = tx_offset_cal_efuse(phydev, buf); -+ break; -+ case TX_AMP: -+ ret = tx_amp_cal_efuse(phydev, buf); -+ break; -+ case TX_R50: -+ ret = tx_r50_cal_efuse(phydev, buf, pair_n); -+ break; -+ default: -+ return -EINVAL; -+ } -+ if (ret) -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int start_cal(struct phy_device *phydev, enum CAL_ITEM cal_item, -+ bool efs_valid, enum CAL_MODE cal_mode, u8 start_pair, -+ u8 end_pair, u32 *buf) -+{ -+ char cal_prop[5][20] = { "mediatek,rext", "mediatek,tx_offset", -+ "mediatek,tx_amp", "mediatek,tx_r50", -+ "mediatek,tx_vcm" }; -+ const char *dts_cal_mode; -+ u8 final_cal_mode = 0; -+ bool is_cal = true; -+ int ret, cal_ret; -+ -+ ret = of_property_read_string(phydev->mdio.dev.of_node, -+ cal_prop[cal_item], &dts_cal_mode); -+ -+ switch (cal_mode) { -+ case SW_EFUSE_M: -+ if ((efs_valid && ret) || -+ (efs_valid && !ret && strcmp("efuse", dts_cal_mode) == 0)) { -+ cal_ret = cal_efuse(phydev, cal_item, start_pair, -+ end_pair, buf); -+ final_cal_mode = EFUSE_K; -+ } else if ((!efs_valid && ret) || -+ (!ret && strcmp("sw", dts_cal_mode) == 0)) { -+ cal_ret = cal_sw(phydev, cal_item, start_pair, end_pair); -+ final_cal_mode = SW_K; -+ } else { -+ is_cal = false; -+ } -+ break; -+ case EFUSE_M: -+ if ((efs_valid && ret) || -+ (efs_valid && !ret && strcmp("efuse", dts_cal_mode) == 0)) { -+ cal_ret = cal_efuse(phydev, cal_item, start_pair, -+ end_pair, buf); -+ final_cal_mode = EFUSE_K; -+ } else { -+ is_cal = false; -+ } -+ break; -+ case SW_M: -+ if (ret || (!ret && strcmp("sw", dts_cal_mode) == 0)) { -+ cal_ret = cal_sw(phydev, cal_item, start_pair, end_pair); -+ final_cal_mode = SW_K; -+ } else { -+ is_cal = false; -+ } -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ if (cal_ret) { -+ dev_err(&phydev->mdio.dev, "[%s]cal failed\n", cal_prop[cal_item]); -+ return -EIO; -+ } -+ -+ if (!is_cal) { -+ dev_dbg(&phydev->mdio.dev, "[%s]K mode: %s(not supported)\n", -+ cal_prop[cal_item], dts_cal_mode); -+ return -EIO; -+ } -+ -+ dev_dbg(&phydev->mdio.dev, "[%s]K mode: %s(dts: %s), efs-valid: %s\n", -+ cal_prop[cal_item], -+ final_cal_mode ? "SW" : "EFUSE", -+ ret ? "not set" : dts_cal_mode, -+ efs_valid ? "yes" : "no"); -+ return 0; -+} -+ -+static int mt798x_phy_calibration(struct phy_device *phydev) -+{ -+ int ret = 0; -+ u32 *buf; -+ bool efs_valid = true; -+ size_t len; -+ struct nvmem_cell *cell; -+ -+ if (phydev->interface != PHY_INTERFACE_MODE_GMII) -+ return -EINVAL; -+ -+ cell = nvmem_cell_get(&phydev->mdio.dev, "phy-cal-data"); -+ if (IS_ERR(cell)) { -+ if (PTR_ERR(cell) == -EPROBE_DEFER) -+ return PTR_ERR(cell); -+ return 0; -+ } -+ -+ buf = (u32 *)nvmem_cell_read(cell, &len); -+ if (IS_ERR(buf)) -+ return PTR_ERR(buf); -+ nvmem_cell_put(cell); -+ -+ if (!buf[0] || !buf[1] || !buf[2] || !buf[3]) -+ efs_valid = false; -+ -+ if (len < 4 * sizeof(u32)) { -+ dev_err(&phydev->mdio.dev, "invalid calibration data\n"); -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ ret = start_cal(phydev, REXT, efs_valid, SW_EFUSE_M, -+ NO_PAIR, NO_PAIR, buf); -+ if (ret) -+ goto out; -+ ret = start_cal(phydev, TX_OFFSET, efs_valid, EFUSE_M, -+ NO_PAIR, NO_PAIR, buf); -+ if (ret) -+ goto out; -+ ret = start_cal(phydev, TX_AMP, efs_valid, EFUSE_M, -+ NO_PAIR, NO_PAIR, buf); -+ if (ret) -+ goto out; -+ ret = start_cal(phydev, TX_R50, efs_valid, EFUSE_M, -+ PAIR_A, PAIR_D, buf); -+ if (ret) -+ goto out; -+ ret = start_cal(phydev, TX_VCM, efs_valid, SW_M, -+ PAIR_A, PAIR_A, buf); -+ if (ret) -+ goto out; -+ -+out: -+ kfree(buf); -+ return ret; -+} -+ -+static int mt7981_phy_probe(struct phy_device *phydev) -+{ -+ mt7981_phy_finetune(phydev); -+ -+ return mt798x_phy_calibration(phydev); -+} -+ -+static int mt7988_phy_probe(struct phy_device *phydev) -+{ -+ struct device_node *np; -+ void __iomem *boottrap; -+ u32 reg; -+ int port; -+ -+ /* Setup LED polarity according to boottrap's polarity */ -+ np = of_find_compatible_node(NULL, NULL, "mediatek,boottrap"); -+ if (!np) -+ return -ENOENT; -+ boottrap = of_iomap(np, 0); -+ if (!boottrap) -+ return -ENOMEM; -+ reg = readl(boottrap); -+ port = phydev->mdio.addr; -+ if ((port == GPHY_PORT0 && reg & BIT(8)) || -+ (port == GPHY_PORT1 && reg & BIT(9)) || -+ (port == GPHY_PORT2 && reg & BIT(10)) || -+ (port == GPHY_PORT3 && reg & BIT(11))) { -+ phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, -+ MTK_PHY_LED0_ENABLE | MTK_PHY_LED0_ON_LINK10 | -+ MTK_PHY_LED0_ON_LINK100 | -+ MTK_PHY_LED0_ON_LINK1000); -+ } else { -+ phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, -+ MTK_PHY_LED0_ENABLE | MTK_PHY_LED0_POLARITY | -+ MTK_PHY_LED0_ON_LINK10 | -+ MTK_PHY_LED0_ON_LINK100 | -+ MTK_PHY_LED0_ON_LINK1000); -+ } -+ phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_BLINK_CTRL, -+ MTK_PHY_LED0_1000TX | MTK_PHY_LED0_1000RX | -+ MTK_PHY_LED0_100TX | MTK_PHY_LED0_100RX | -+ MTK_PHY_LED0_10TX | MTK_PHY_LED0_10RX); -+ -+ mt7988_phy_finetune(phydev); -+ -+ return mt798x_phy_calibration(phydev); -+} -+#endif -+ - static struct phy_driver mtk_gephy_driver[] = { - { - PHY_ID_MATCH_EXACT(0x03a29412), -@@ -131,6 +1456,30 @@ static struct phy_driver mtk_gephy_drive - .read_page = mtk_gephy_read_page, - .write_page = mtk_gephy_write_page, - }, -+#ifdef CONFIG_MEDIATEK_GE_PHY_SOC -+ { -+ PHY_ID_MATCH_EXACT(0x03a29461), -+ .name = "MediaTek MT7981 PHY", -+ .probe = mt7981_phy_probe, -+ .config_intr = genphy_no_config_intr, -+ .handle_interrupt = genphy_handle_interrupt_no_ack, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_gephy_read_page, -+ .write_page = mtk_gephy_write_page, -+ }, -+ { -+ PHY_ID_MATCH_EXACT(0x03a29481), -+ .name = "MediaTek MT7988 PHY", -+ .probe = mt7988_phy_probe, -+ .config_intr = genphy_no_config_intr, -+ .handle_interrupt = genphy_handle_interrupt_no_ack, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_gephy_read_page, -+ .write_page = mtk_gephy_write_page, -+ }, -+#endif - }; - +@@ -136,7 +136,8 @@ static struct phy_driver mtk_gephy_drive module_phy_driver(mtk_gephy_driver); -@@ -141,6 +1490,8 @@ static struct mdio_device_id __maybe_unu - }; - MODULE_DESCRIPTION("MediaTek Gigabit Ethernet PHY driver"); -+MODULE_AUTHOR("Daniel Golle "); -+MODULE_AUTHOR("SkyLake Huang "); - MODULE_AUTHOR("DENG, Qingfang "); - MODULE_LICENSE("GPL"); + static struct mdio_device_id __maybe_unused mtk_gephy_tbl[] = { +- { PHY_ID_MATCH_VENDOR(0x03a29400) }, ++ { PHY_ID_MATCH_EXACT(0x03a29441) }, ++ { PHY_ID_MATCH_EXACT(0x03a29412) }, + { } + }; From 84e3d273553ed9ea7213b50ab267aa4d05dd0a09 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Apr 2023 17:41:22 +0100 Subject: [PATCH 0030/1171] mediatek: add driver for built-in 2.5G Ethernet PHY Add driver for the built-in 2.5G Ethernet PHY found in the MT7988 SoC. To function the PHY also needs firmware files which have not yet been published via linux-firmware. Signed-off-by: Daniel Golle (cherry picked from commit ef2a831dabacfda6c36c79b8f963b5fdd9b2d080) --- .../drivers/net/phy/mediatek-2p5ge.c | 262 ++++++++++++++++++ target/linux/mediatek/filogic/config-5.15 | 1 + target/linux/mediatek/mt7622/config-5.15 | 1 + ...phy-add-driver-for-MediaTek-2.5G-PHY.patch | 39 +++ 4 files changed, 303 insertions(+) create mode 100644 target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-2p5ge.c create mode 100644 target/linux/mediatek/patches-5.15/732-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch diff --git a/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-2p5ge.c b/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-2p5ge.c new file mode 100644 index 00000000000000..c12e6b8eb6f8f6 --- /dev/null +++ b/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-2p5ge.c @@ -0,0 +1,262 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include +#include +#include +#include +#include +#include + +#define MEDAITEK_2P5GE_PHY_DMB_FW "mediatek/mediatek-2p5ge-phy-dmb.bin" +#define MEDIATEK_2P5GE_PHY_PMB_FW "mediatek/mediatek-2p5ge-phy-pmb.bin" + +#define MD32_EN_CFG 0x18 +#define MD32_EN BIT(0) + +#define BASE100T_STATUS_EXTEND 0x10 +#define BASE1000T_STATUS_EXTEND 0x11 +#define EXTEND_CTRL_AND_STATUS 0x16 + +#define PHY_AUX_CTRL_STATUS 0x1d +#define PHY_AUX_DPX_MASK GENMASK(5, 5) +#define PHY_AUX_SPEED_MASK GENMASK(4, 2) + +/* Registers on MDIO_MMD_VEND1 */ +#define MTK_PHY_LINK_STATUS_MISC 0xa2 +#define MTK_PHY_FDX_ENABLE BIT(5) + +/* Registers on MDIO_MMD_VEND2 */ +#define MTK_PHY_LED0_ON_CTRL 0x24 +#define MTK_PHY_LED0_ON_LINK1000 BIT(0) +#define MTK_PHY_LED0_ON_LINK100 BIT(1) +#define MTK_PHY_LED0_ON_LINK10 BIT(2) +#define MTK_PHY_LED0_ON_LINK2500 BIT(7) +#define MTK_PHY_LED0_POLARITY BIT(14) + +#define MTK_PHY_LED1_ON_CTRL 0x26 +#define MTK_PHY_LED1_ON_FDX BIT(4) +#define MTK_PHY_LED1_ON_HDX BIT(5) +#define MTK_PHY_LED1_POLARITY BIT(14) + +enum { + PHY_AUX_SPD_10 = 0, + PHY_AUX_SPD_100, + PHY_AUX_SPD_1000, + PHY_AUX_SPD_2500, +}; + +static int mt798x_2p5ge_phy_config_init(struct phy_device *phydev) +{ + int ret; + int i; + const struct firmware *fw; + struct device *dev = &phydev->mdio.dev; + struct device_node *np; + void __iomem *dmb_addr; + void __iomem *pmb_addr; + void __iomem *mcucsr_base; + u16 reg; + struct pinctrl *pinctrl; + + np = of_find_compatible_node(NULL, NULL, "mediatek,2p5gphy-fw"); + if (!np) + return -ENOENT; + + dmb_addr = of_iomap(np, 0); + if (!dmb_addr) + return -ENOMEM; + pmb_addr = of_iomap(np, 1); + if (!pmb_addr) + return -ENOMEM; + mcucsr_base = of_iomap(np, 2); + if (!mcucsr_base) + return -ENOMEM; + + ret = request_firmware(&fw, MEDAITEK_2P5GE_PHY_DMB_FW, dev); + if (ret) { + dev_err(dev, "failed to load firmware: %s, ret: %d\n", + MEDAITEK_2P5GE_PHY_DMB_FW, ret); + return ret; + } + for (i = 0; i < fw->size - 1; i += 4) + writel(*((uint32_t *)(fw->data + i)), dmb_addr + i); + release_firmware(fw); + + ret = request_firmware(&fw, MEDIATEK_2P5GE_PHY_PMB_FW, dev); + if (ret) { + dev_err(dev, "failed to load firmware: %s, ret: %d\n", + MEDIATEK_2P5GE_PHY_PMB_FW, ret); + return ret; + } + for (i = 0; i < fw->size - 1; i += 4) + writel(*((uint32_t *)(fw->data + i)), pmb_addr + i); + release_firmware(fw); + + reg = readw(mcucsr_base + MD32_EN_CFG); + writew(reg | MD32_EN, mcucsr_base + MD32_EN_CFG); + dev_dbg(dev, "Firmware loading/trigger ok.\n"); + + /* Setup LED */ + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, + MTK_PHY_LED0_POLARITY); + + phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, + MTK_PHY_LED0_ON_LINK10 | + MTK_PHY_LED0_ON_LINK100 | + MTK_PHY_LED0_ON_LINK1000 | + MTK_PHY_LED0_ON_LINK2500); + + phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_ON_CTRL, + MTK_PHY_LED1_ON_FDX | MTK_PHY_LED1_ON_HDX); + + pinctrl = devm_pinctrl_get_select(&phydev->mdio.dev, "i2p5gbe-led"); + if (IS_ERR(pinctrl)) { + dev_err(&phydev->mdio.dev, "Fail to set LED pins!\n"); + return PTR_ERR(pinctrl); + } + + return 0; +} + +static int mt798x_2p5ge_phy_config_aneg(struct phy_device *phydev) +{ + bool changed = false; + u32 adv; + int ret; + + if (phydev->autoneg == AUTONEG_DISABLE) { + /* Configure half duplex with genphy_setup_forced, + * because genphy_c45_pma_setup_forced does not support. + */ + return phydev->duplex != DUPLEX_FULL + ? genphy_setup_forced(phydev) + : genphy_c45_pma_setup_forced(phydev); + } + + ret = genphy_c45_an_config_aneg(phydev); + if (ret < 0) + return ret; + if (ret > 0) + changed = true; + + adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); + ret = phy_modify_changed(phydev, MII_CTRL1000, + ADVERTISE_1000FULL | ADVERTISE_1000HALF, + adv); + if (ret < 0) + return ret; + if (ret > 0) + changed = true; + + return genphy_c45_check_and_restart_aneg(phydev, changed); +} + +static int mt798x_2p5ge_phy_get_features(struct phy_device *phydev) +{ + int ret; + + ret = genphy_read_abilities(phydev); + if (ret) + return ret; + + /* We don't support HDX at MAC layer on mt798x. + * So mask phy's HDX capabilities, too. + */ + linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, + phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); + + return 0; +} + +static int mt798x_2p5ge_phy_read_status(struct phy_device *phydev) +{ + int ret; + + ret = genphy_update_link(phydev); + if (ret) + return ret; + + phydev->speed = SPEED_UNKNOWN; + phydev->duplex = DUPLEX_UNKNOWN; + phydev->pause = 0; + phydev->asym_pause = 0; + + if (!phydev->link) + return 0; + + if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { + ret = genphy_c45_read_lpa(phydev); + if (ret < 0) + return ret; + + /* Read the link partner's 1G advertisement */ + ret = phy_read(phydev, MII_STAT1000); + if (ret < 0) + return ret; + mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, ret); + } else if (phydev->autoneg == AUTONEG_DISABLE) { + linkmode_zero(phydev->lp_advertising); + } + + ret = phy_read(phydev, PHY_AUX_CTRL_STATUS); + if (ret < 0) + return ret; + + switch (FIELD_GET(PHY_AUX_SPEED_MASK, ret)) { + case PHY_AUX_SPD_10: + phydev->speed = SPEED_10; + break; + case PHY_AUX_SPD_100: + phydev->speed = SPEED_100; + break; + case PHY_AUX_SPD_1000: + phydev->speed = SPEED_1000; + break; + case PHY_AUX_SPD_2500: + phydev->speed = SPEED_2500; + phydev->duplex = DUPLEX_FULL; /* 2.5G must be FDX */ + break; + } + + ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LINK_STATUS_MISC); + if (ret < 0) + return ret; + + phydev->duplex = (ret & MTK_PHY_FDX_ENABLE) ? DUPLEX_FULL : DUPLEX_HALF; + + return 0; +} + +static struct phy_driver mtk_gephy_driver[] = { + { + PHY_ID_MATCH_EXACT(0x00339c11), + .name = "MediaTek MT798x 2.5GbE PHY", + .config_init = mt798x_2p5ge_phy_config_init, + .config_aneg = mt798x_2p5ge_phy_config_aneg, + .get_features = mt798x_2p5ge_phy_get_features, + .read_status = mt798x_2p5ge_phy_read_status, + }, +}; + +module_phy_driver(mtk_gephy_driver); + +static struct mdio_device_id __maybe_unused mtk_2p5ge_phy_tbl[] = { + { PHY_ID_MATCH_VENDOR(0x00339c00) }, + { } +}; + +MODULE_DESCRIPTION("MediaTek 2.5Gb Ethernet PHY driver"); +MODULE_AUTHOR("SkyLake Huang "); +MODULE_LICENSE("GPL"); + +MODULE_DEVICE_TABLE(mdio, mtk_2p5ge_phy_tbl); +MODULE_FIRMWARE(MEDAITEK_2P5GE_PHY_DMB_FW); +MODULE_FIRMWARE(MEDIATEK_2P5GE_PHY_PMB_FW); diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index e6ab85fb5d149b..224d10d0e17eb6 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -204,6 +204,7 @@ CONFIG_MAXLINEAR_GPHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +CONFIG_MEDIATEK_2P5G_PHY=y CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_GE_SOC_PHY=y CONFIG_MEDIATEK_WATCHDOG=y diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index d584497ec19df4..79df71c9907582 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -225,6 +225,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +# CONFIG_MEDIATEK_2P5G_PHY is not set CONFIG_MEDIATEK_GE_PHY=y # CONFIG_MEDIATEK_GE_SOC_PHY is not set CONFIG_MEDIATEK_WATCHDOG=y diff --git a/target/linux/mediatek/patches-5.15/732-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch b/target/linux/mediatek/patches-5.15/732-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch new file mode 100644 index 00000000000000..a2a3bab6322d26 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/732-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch @@ -0,0 +1,39 @@ +From 128dc09b0af36772062142ce9e85b19c84ac789a Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 28 Feb 2023 17:53:37 +0000 +Subject: [PATCH] net: phy: add driver for MediaTek 2.5G PHY + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/Kconfig | 7 ++ + drivers/net/phy/Makefile | 1 + + drivers/net/phy/mediatek-2p5ge.c | 220 +++++++++++++++++++++++++++++++ + 3 files changed, 226 insertions(+) + create mode 100644 drivers/net/phy/mediatek-2p5ge.c + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -304,6 +304,13 @@ config MEDIATEK_GE_SOC_PHY + present in the SoCs efuse and will dynamically calibrate VCM + (common-mode voltage) during startup. + ++config MEDIATEK_2P5G_PHY ++ tristate "MediaTek 2.5G Ethernet PHY" ++ depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST ++ default NET_MEDIATEK_SOC ++ help ++ Supports the MediaTek 2.5G Ethernet PHY. ++ + config MICREL_PHY + tristate "Micrel PHYs" + help +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -80,6 +80,7 @@ obj-$(CONFIG_MARVELL_10G_PHY) += marvell + obj-$(CONFIG_MARVELL_PHY) += marvell.o + obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o + obj-$(CONFIG_MAXLINEAR_GPHY) += mxl-gpy.o ++obj-$(CONFIG_MEDIATEK_2P5G_PHY) += mediatek-2p5ge.o + obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o + obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o + obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o From fd1791795195cec46b86900ff3e228c080c8bf20 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Apr 2023 17:13:33 +0100 Subject: [PATCH 0031/1171] mediatek: filogic: add driver for Richtek RT5190A regulator The Richtek RT5190A is used on the MT7988 reference board. Backport and enable the driver on the filogic subtarget, so we can support cpufreq on the MT7988 reference board. Signed-off-by: Daniel Golle (cherry picked from commit a3cf3e2c489d5b6f534d1b4d6f7b462f81c9c141) --- target/linux/mediatek/filogic/config-5.15 | 3 +- target/linux/mediatek/mt7622/config-5.15 | 1 + target/linux/mediatek/mt7623/config-5.15 | 1 + ...dd-bindings-for-Richtek-RT5190A-PMIC.patch | 180 ++++++ ...a-Add-support-for-Richtek-RT5190A-PM.patch | 562 ++++++++++++++++++ 5 files changed, 746 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/patches-5.15/830-v5.18-regulator-Add-bindings-for-Richtek-RT5190A-PMIC.patch create mode 100644 target/linux/mediatek/patches-5.15/831-v5.18-regulator-rt5190a-Add-support-for-Richtek-RT5190A-PM.patch diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 224d10d0e17eb6..3e6a1654f20b8c 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -16,7 +16,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANTS_NO_INSTR=y CONFIG_ARM64=y CONFIG_ARM64_4K_PAGES=y -# CONFIG_ARM64_CNP is not set CONFIG_ARM64_CRYPTO=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y @@ -354,10 +353,12 @@ CONFIG_REED_SOLOMON=y CONFIG_REED_SOLOMON_DEC8=y CONFIG_REED_SOLOMON_ENC8=y CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y CONFIG_REGMAP_MMIO=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_MT6380=y +CONFIG_REGULATOR_RT5190A=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index 79df71c9907582..30a5ff948fac83 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -377,6 +377,7 @@ CONFIG_REGMAP_MMIO=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_MT6380=y +# CONFIG_REGULATOR_RT5190A is not set CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index af0a5c1939fc0a..039a904f197000 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -472,6 +472,7 @@ CONFIG_REGULATOR_MT6323=y # CONFIG_REGULATOR_MT6358 is not set # CONFIG_REGULATOR_MT6380 is not set # CONFIG_REGULATOR_MT6397 is not set +# CONFIG_REGULATOR_RT5190A is not set # CONFIG_REGULATOR_QCOM_LABIBB is not set # CONFIG_REGULATOR_QCOM_SPMI is not set # CONFIG_REGULATOR_QCOM_USB_VBUS is not set diff --git a/target/linux/mediatek/patches-5.15/830-v5.18-regulator-Add-bindings-for-Richtek-RT5190A-PMIC.patch b/target/linux/mediatek/patches-5.15/830-v5.18-regulator-Add-bindings-for-Richtek-RT5190A-PMIC.patch new file mode 100644 index 00000000000000..30891d34872b5f --- /dev/null +++ b/target/linux/mediatek/patches-5.15/830-v5.18-regulator-Add-bindings-for-Richtek-RT5190A-PMIC.patch @@ -0,0 +1,180 @@ +From b77e70f6b8f2cc62fba847f3008a430a09ef275d Mon Sep 17 00:00:00 2001 +From: ChiYuan Huang +Date: Wed, 9 Mar 2022 16:01:42 +0800 +Subject: [PATCH 1/2] regulator: Add bindings for Richtek RT5190A PMIC + +Add bindings for Richtek RT5190A PMIC. + +Signed-off-by: ChiYuan Huang +Reviewed-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/1646812903-32496-2-git-send-email-u0084500@gmail.com +Signed-off-by: Mark Brown +--- + .../regulator/richtek,rt5190a-regulator.yaml | 141 ++++++++++++++++++ + .../regulator/richtek,rt5190a-regulator.h | 15 ++ + 2 files changed, 156 insertions(+) + create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml + create mode 100644 include/dt-bindings/regulator/richtek,rt5190a-regulator.h + +--- /dev/null ++++ b/Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml +@@ -0,0 +1,141 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Richtek RT5190A PMIC Regulator ++ ++maintainers: ++ - ChiYuan Huang ++ ++description: | ++ The RT5190A integrates 1 channel buck controller, 3 channels high efficiency ++ synchronous buck converters, 1 LDO, I2C control interface and peripherial ++ logical control. ++ ++ It also supports mute AC OFF depop sound and quick setting storage while ++ input power is removed. ++ ++properties: ++ compatible: ++ enum: ++ - richtek,rt5190a ++ ++ reg: ++ maxItems: 1 ++ ++ interrupts: ++ maxItems: 1 ++ ++ vin2-supply: ++ description: phandle to buck2 input voltage. ++ ++ vin3-supply: ++ description: phandle to buck3 input voltage. ++ ++ vin4-supply: ++ description: phandle to buck4 input voltage. ++ ++ vinldo-supply: ++ description: phandle to ldo input voltage ++ ++ richtek,mute-enable: ++ description: | ++ The mute function uses 'mutein', 'muteout', and 'vdet' pins as the control ++ signal. When enabled, The normal behavior is to bypass the 'mutein' signal ++ 'muteout'. But if the power source removal is detected from 'vdet', ++ whatever the 'mutein' signal is, it will pull down the 'muteout' to force ++ speakers mute. this function is commonly used to prevent the speaker pop ++ noise during AC power turned off in the modern TV system design. ++ type: boolean ++ ++ regulators: ++ type: object ++ ++ patternProperties: ++ "^buck[1-4]$|^ldo$": ++ type: object ++ $ref: regulator.yaml# ++ description: | ++ regulator description for buck1 and buck4. ++ ++ properties: ++ regulator-allowed-modes: ++ description: | ++ buck operating mode, only buck1/4 support mode operating. ++ 0: auto mode ++ 1: force pwm mode ++ items: ++ enum: [0, 1] ++ ++ richtek,latchup-enable: ++ type: boolean ++ description: | ++ If specified, undervolt protection mode changes from the default ++ hiccup to latchup. ++ ++ unevaluatedProperties: false ++ ++ additionalProperties: false ++ ++required: ++ - compatible ++ - reg ++ - regulators ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ #include ++ ++ i2c { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pmic@64 { ++ compatible = "richtek,rt5190a"; ++ reg = <0x64>; ++ interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>; ++ vin2-supply = <&rt5190_buck1>; ++ vin3-supply = <&rt5190_buck1>; ++ vin4-supply = <&rt5190_buck1>; ++ ++ regulators { ++ rt5190_buck1: buck1 { ++ regulator-name = "rt5190a-buck1"; ++ regulator-min-microvolt = <5090000>; ++ regulator-max-microvolt = <5090000>; ++ regulator-allowed-modes = ; ++ regulator-boot-on; ++ }; ++ buck2 { ++ regulator-name = "rt5190a-buck2"; ++ regulator-min-microvolt = <600000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-boot-on; ++ }; ++ buck3 { ++ regulator-name = "rt5190a-buck3"; ++ regulator-min-microvolt = <600000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-boot-on; ++ }; ++ buck4 { ++ regulator-name = "rt5190a-buck4"; ++ regulator-min-microvolt = <850000>; ++ regulator-max-microvolt = <850000>; ++ regulator-allowed-modes = ; ++ regulator-boot-on; ++ }; ++ ldo { ++ regulator-name = "rt5190a-ldo"; ++ regulator-min-microvolt = <1200000>; ++ regulator-max-microvolt = <1200000>; ++ regulator-boot-on; ++ }; ++ }; ++ }; ++ }; +--- /dev/null ++++ b/include/dt-bindings/regulator/richtek,rt5190a-regulator.h +@@ -0,0 +1,15 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++ ++#ifndef __DT_BINDINGS_RICHTEK_RT5190A_REGULATOR_H__ ++#define __DT_BINDINGS_RICHTEK_RT5190A_REGULATOR_H__ ++ ++/* ++ * BUCK/LDO mode constants which may be used in devicetree properties ++ * (eg. regulator-allowed-modes). ++ * See the manufacturer's datasheet for more information on these modes. ++ */ ++ ++#define RT5190A_OPMODE_AUTO 0 ++#define RT5190A_OPMODE_FPWM 1 ++ ++#endif diff --git a/target/linux/mediatek/patches-5.15/831-v5.18-regulator-rt5190a-Add-support-for-Richtek-RT5190A-PM.patch b/target/linux/mediatek/patches-5.15/831-v5.18-regulator-rt5190a-Add-support-for-Richtek-RT5190A-PM.patch new file mode 100644 index 00000000000000..0e0f099e5058df --- /dev/null +++ b/target/linux/mediatek/patches-5.15/831-v5.18-regulator-rt5190a-Add-support-for-Richtek-RT5190A-PM.patch @@ -0,0 +1,562 @@ +From 760423dfad53877b468490758fe7ea968ded9402 Mon Sep 17 00:00:00 2001 +From: ChiYuan Huang +Date: Wed, 9 Mar 2022 16:01:43 +0800 +Subject: [PATCH 2/2] regulator: rt5190a: Add support for Richtek RT5190A PMIC + +Add support for Richtek RT5190A PMIC. + +Signed-off-by: ChiYuan Huang +Link: https://lore.kernel.org/r/1646812903-32496-3-git-send-email-u0084500@gmail.com +Signed-off-by: Mark Brown +--- + drivers/regulator/Kconfig | 10 + + drivers/regulator/Makefile | 1 + + drivers/regulator/rt5190a-regulator.c | 513 ++++++++++++++++++++++++++ + 3 files changed, 524 insertions(+) + create mode 100644 drivers/regulator/rt5190a-regulator.c + +--- a/drivers/regulator/Kconfig ++++ b/drivers/regulator/Kconfig +@@ -1037,6 +1037,16 @@ config REGULATOR_RT5033 + RT5033 PMIC. The device supports multiple regulators like + current source, LDO and Buck. + ++config REGULATOR_RT5190A ++ tristate "Richtek RT5190A PMIC" ++ depends on I2C ++ select REGMAP_I2C ++ help ++ This adds support for voltage regulator in Richtek RT5190A PMIC. ++ It integratas 1 channel buck controller, 3 channels high efficiency ++ buck converters, 1 LDO, mute AC OFF depop function, with the general ++ I2C control interface. ++ + config REGULATOR_RT6160 + tristate "Richtek RT6160 BuckBoost voltage regulator" + depends on I2C +--- a/drivers/regulator/Makefile ++++ b/drivers/regulator/Makefile +@@ -125,6 +125,7 @@ obj-$(CONFIG_REGULATOR_ROHM) += rohm-reg + obj-$(CONFIG_REGULATOR_RT4801) += rt4801-regulator.o + obj-$(CONFIG_REGULATOR_RT4831) += rt4831-regulator.o + obj-$(CONFIG_REGULATOR_RT5033) += rt5033-regulator.o ++obj-$(CONFIG_REGULATOR_RT5190A) += rt5190a-regulator.o + obj-$(CONFIG_REGULATOR_RT6160) += rt6160-regulator.o + obj-$(CONFIG_REGULATOR_RT6245) += rt6245-regulator.o + obj-$(CONFIG_REGULATOR_RTMV20) += rtmv20-regulator.o +--- /dev/null ++++ b/drivers/regulator/rt5190a-regulator.c +@@ -0,0 +1,513 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RT5190A_REG_MANUFACTURE 0x00 ++#define RT5190A_REG_BUCK2VSEL 0x04 ++#define RT5190A_REG_BUCK3VSEL 0x05 ++#define RT5190A_REG_DCDCCNTL 0x06 ++#define RT5190A_REG_ENABLE 0x07 ++#define RT5190A_REG_DISCHARGE 0x09 ++#define RT5190A_REG_PROTMODE 0x0A ++#define RT5190A_REG_MUTECNTL 0x0B ++#define RT5190A_REG_PGSTAT 0x0F ++#define RT5190A_REG_OVINT 0x10 ++#define RT5190A_REG_HOTDIEMASK 0x17 ++ ++#define RT5190A_VSEL_MASK GENMASK(6, 0) ++#define RT5190A_RID_BITMASK(rid) BIT(rid + 1) ++#define RT5190A_BUCK1_DISCHG_MASK GENMASK(1, 0) ++#define RT5190A_BUCK1_DISCHG_ONVAL 0x01 ++#define RT5190A_OVERVOLT_MASK GENMASK(7, 0) ++#define RT5190A_UNDERVOLT_MASK GENMASK(15, 8) ++#define RT5190A_CH234OT_MASK BIT(29) ++#define RT5190A_CHIPOT_MASK BIT(28) ++ ++#define RT5190A_BUCK23_MINUV 600000 ++#define RT5190A_BUCK23_MAXUV 1400000 ++#define RT5190A_BUCK23_STEPUV 10000 ++#define RT5190A_BUCK23_STEPNUM ((1400000 - 600000) / 10000 + 1) ++ ++enum { ++ RT5190A_IDX_BUCK1 = 0, ++ RT5190A_IDX_BUCK2, ++ RT5190A_IDX_BUCK3, ++ RT5190A_IDX_BUCK4, ++ RT5190A_IDX_LDO, ++ RT5190A_MAX_IDX ++}; ++ ++struct rt5190a_priv { ++ struct device *dev; ++ struct regmap *regmap; ++ struct regulator_desc rdesc[RT5190A_MAX_IDX]; ++ struct regulator_dev *rdev[RT5190A_MAX_IDX]; ++}; ++ ++static int rt5190a_get_error_flags(struct regulator_dev *rdev, ++ unsigned int *flags) ++{ ++ struct regmap *regmap = rdev_get_regmap(rdev); ++ int rid = rdev_get_id(rdev); ++ unsigned int pgood_stat; ++ int ret; ++ ++ ret = regmap_read(regmap, RT5190A_REG_PGSTAT, &pgood_stat); ++ if (ret) ++ return ret; ++ ++ if (!(pgood_stat & RT5190A_RID_BITMASK(rid))) ++ *flags = REGULATOR_ERROR_FAIL; ++ else ++ *flags = 0; ++ ++ return 0; ++} ++ ++static int rt5190a_fixed_buck_set_mode(struct regulator_dev *rdev, ++ unsigned int mode) ++{ ++ struct regmap *regmap = rdev_get_regmap(rdev); ++ int rid = rdev_get_id(rdev); ++ unsigned int mask = RT5190A_RID_BITMASK(rid), val; ++ ++ switch (mode) { ++ case REGULATOR_MODE_FAST: ++ val = mask; ++ break; ++ case REGULATOR_MODE_NORMAL: ++ val = 0; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return regmap_update_bits(regmap, RT5190A_REG_DCDCCNTL, mask, val); ++} ++ ++static unsigned int rt5190a_fixed_buck_get_mode(struct regulator_dev *rdev) ++{ ++ struct regmap *regmap = rdev_get_regmap(rdev); ++ int rid = rdev_get_id(rdev); ++ unsigned int val; ++ int ret; ++ ++ ret = regmap_read(regmap, RT5190A_REG_DCDCCNTL, &val); ++ if (ret) { ++ dev_err(&rdev->dev, "Failed to get mode [%d]\n", ret); ++ return ret; ++ } ++ ++ if (val & RT5190A_RID_BITMASK(rid)) ++ return REGULATOR_MODE_FAST; ++ ++ return REGULATOR_MODE_NORMAL; ++} ++ ++static const struct regulator_ops rt5190a_ranged_buck_ops = { ++ .enable = regulator_enable_regmap, ++ .disable = regulator_disable_regmap, ++ .is_enabled = regulator_is_enabled_regmap, ++ .set_voltage_sel = regulator_set_voltage_sel_regmap, ++ .get_voltage_sel = regulator_get_voltage_sel_regmap, ++ .list_voltage = regulator_list_voltage_linear, ++ .set_active_discharge = regulator_set_active_discharge_regmap, ++ .get_error_flags = rt5190a_get_error_flags, ++}; ++ ++static const struct regulator_ops rt5190a_fixed_buck_ops = { ++ .enable = regulator_enable_regmap, ++ .disable = regulator_disable_regmap, ++ .is_enabled = regulator_is_enabled_regmap, ++ .set_active_discharge = regulator_set_active_discharge_regmap, ++ .set_mode = rt5190a_fixed_buck_set_mode, ++ .get_mode = rt5190a_fixed_buck_get_mode, ++ .get_error_flags = rt5190a_get_error_flags, ++}; ++ ++static const struct regulator_ops rt5190a_fixed_ldo_ops = { ++ .enable = regulator_enable_regmap, ++ .disable = regulator_disable_regmap, ++ .is_enabled = regulator_is_enabled_regmap, ++ .set_active_discharge = regulator_set_active_discharge_regmap, ++ .get_error_flags = rt5190a_get_error_flags, ++}; ++ ++static irqreturn_t rt5190a_irq_handler(int irq, void *data) ++{ ++ struct rt5190a_priv *priv = data; ++ __le32 raws; ++ unsigned int events, fields; ++ static const struct { ++ unsigned int bitmask; ++ unsigned int report; ++ } event_tbl[] = { ++ { RT5190A_OVERVOLT_MASK, REGULATOR_ERROR_REGULATION_OUT }, ++ { RT5190A_UNDERVOLT_MASK, REGULATOR_ERROR_UNDER_VOLTAGE } ++ }; ++ int i, j, ret; ++ ++ ret = regmap_raw_read(priv->regmap, RT5190A_REG_OVINT, &raws, ++ sizeof(raws)); ++ if (ret) { ++ dev_err(priv->dev, "Failed to read events\n"); ++ return IRQ_NONE; ++ } ++ ++ events = le32_to_cpu(raws); ++ ++ ret = regmap_raw_write(priv->regmap, RT5190A_REG_OVINT, &raws, ++ sizeof(raws)); ++ if (ret) ++ dev_err(priv->dev, "Failed to write-clear events\n"); ++ ++ /* Handle OV,UV events */ ++ for (i = 0; i < ARRAY_SIZE(event_tbl); i++) { ++ fields = events & event_tbl[i].bitmask; ++ fields >>= ffs(event_tbl[i].bitmask) - 1; ++ ++ for (j = 0; j < RT5190A_MAX_IDX; j++) { ++ if (!(fields & RT5190A_RID_BITMASK(j))) ++ continue; ++ ++ regulator_notifier_call_chain(priv->rdev[j], ++ event_tbl[i].report, ++ NULL); ++ } ++ } ++ ++ /* Handle CH234 OT event */ ++ if (events & RT5190A_CH234OT_MASK) { ++ for (j = RT5190A_IDX_BUCK2; j < RT5190A_IDX_LDO; j++) { ++ regulator_notifier_call_chain(priv->rdev[j], ++ REGULATOR_ERROR_OVER_TEMP, ++ NULL); ++ } ++ } ++ ++ /* Warning if CHIP OT occur */ ++ if (events & RT5190A_CHIPOT_MASK) ++ dev_warn(priv->dev, "CHIP overheat\n"); ++ ++ return IRQ_HANDLED; ++} ++ ++static unsigned int rt5190a_of_map_mode(unsigned int mode) ++{ ++ switch (mode) { ++ case RT5190A_OPMODE_AUTO: ++ return REGULATOR_MODE_NORMAL; ++ case RT5190A_OPMODE_FPWM: ++ return REGULATOR_MODE_FAST; ++ default: ++ return REGULATOR_MODE_INVALID; ++ } ++} ++ ++static int rt5190a_of_parse_cb(struct rt5190a_priv *priv, int rid, ++ struct of_regulator_match *match) ++{ ++ struct regulator_desc *desc = priv->rdesc + rid; ++ struct regulator_init_data *init_data = match->init_data; ++ struct device_node *np = match->of_node; ++ bool latchup_enable; ++ unsigned int mask = RT5190A_RID_BITMASK(rid), val; ++ ++ switch (rid) { ++ case RT5190A_IDX_BUCK1: ++ case RT5190A_IDX_BUCK4: ++ case RT5190A_IDX_LDO: ++ init_data->constraints.apply_uV = 0; ++ ++ if (init_data->constraints.min_uV == ++ init_data->constraints.max_uV) ++ desc->fixed_uV = init_data->constraints.min_uV; ++ else { ++ dev_err(priv->dev, ++ "Variable voltage for fixed regulator\n"); ++ return -EINVAL; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ latchup_enable = of_property_read_bool(np, "richtek,latchup-enable"); ++ ++ /* latchup: 0, default hiccup: 1 */ ++ val = !latchup_enable ? mask : 0; ++ ++ return regmap_update_bits(priv->regmap, RT5190A_REG_PROTMODE, mask, val); ++} ++ ++static void rt5190a_fillin_regulator_desc(struct regulator_desc *desc, int rid) ++{ ++ static const char * const regu_name[] = { "buck1", "buck2", ++ "buck3", "buck4", ++ "ldo" }; ++ static const char * const supply[] = { NULL, "vin2", "vin3", "vin4", ++ "vinldo" }; ++ ++ desc->name = regu_name[rid]; ++ desc->supply_name = supply[rid]; ++ desc->owner = THIS_MODULE; ++ desc->type = REGULATOR_VOLTAGE; ++ desc->id = rid; ++ desc->enable_reg = RT5190A_REG_ENABLE; ++ desc->enable_mask = RT5190A_RID_BITMASK(rid); ++ desc->active_discharge_reg = RT5190A_REG_DISCHARGE; ++ desc->active_discharge_mask = RT5190A_RID_BITMASK(rid); ++ desc->active_discharge_on = RT5190A_RID_BITMASK(rid); ++ ++ switch (rid) { ++ case RT5190A_IDX_BUCK1: ++ desc->active_discharge_mask = RT5190A_BUCK1_DISCHG_MASK; ++ desc->active_discharge_on = RT5190A_BUCK1_DISCHG_ONVAL; ++ desc->n_voltages = 1; ++ desc->ops = &rt5190a_fixed_buck_ops; ++ desc->of_map_mode = rt5190a_of_map_mode; ++ break; ++ case RT5190A_IDX_BUCK2: ++ desc->vsel_reg = RT5190A_REG_BUCK2VSEL; ++ desc->vsel_mask = RT5190A_VSEL_MASK; ++ desc->min_uV = RT5190A_BUCK23_MINUV; ++ desc->uV_step = RT5190A_BUCK23_STEPUV; ++ desc->n_voltages = RT5190A_BUCK23_STEPNUM; ++ desc->ops = &rt5190a_ranged_buck_ops; ++ break; ++ case RT5190A_IDX_BUCK3: ++ desc->vsel_reg = RT5190A_REG_BUCK3VSEL; ++ desc->vsel_mask = RT5190A_VSEL_MASK; ++ desc->min_uV = RT5190A_BUCK23_MINUV; ++ desc->uV_step = RT5190A_BUCK23_STEPUV; ++ desc->n_voltages = RT5190A_BUCK23_STEPNUM; ++ desc->ops = &rt5190a_ranged_buck_ops; ++ break; ++ case RT5190A_IDX_BUCK4: ++ desc->n_voltages = 1; ++ desc->ops = &rt5190a_fixed_buck_ops; ++ desc->of_map_mode = rt5190a_of_map_mode; ++ break; ++ case RT5190A_IDX_LDO: ++ desc->n_voltages = 1; ++ desc->ops = &rt5190a_fixed_ldo_ops; ++ break; ++ } ++} ++ ++static struct of_regulator_match rt5190a_regulator_match[] = { ++ { .name = "buck1", }, ++ { .name = "buck2", }, ++ { .name = "buck3", }, ++ { .name = "buck4", }, ++ { .name = "ldo", } ++}; ++ ++static int rt5190a_parse_regulator_dt_data(struct rt5190a_priv *priv) ++{ ++ struct device_node *regulator_np; ++ struct regulator_desc *reg_desc; ++ struct of_regulator_match *match; ++ int i, ret; ++ ++ for (i = 0; i < RT5190A_MAX_IDX; i++) { ++ reg_desc = priv->rdesc + i; ++ match = rt5190a_regulator_match + i; ++ ++ rt5190a_fillin_regulator_desc(reg_desc, i); ++ ++ match->desc = reg_desc; ++ } ++ ++ regulator_np = of_get_child_by_name(priv->dev->of_node, "regulators"); ++ if (!regulator_np) { ++ dev_err(priv->dev, "Could not find 'regulators' node\n"); ++ return -ENODEV; ++ } ++ ++ ret = of_regulator_match(priv->dev, regulator_np, ++ rt5190a_regulator_match, ++ ARRAY_SIZE(rt5190a_regulator_match)); ++ ++ of_node_put(regulator_np); ++ ++ if (ret < 0) { ++ dev_err(priv->dev, ++ "Error parsing regulator init data: %d\n", ret); ++ return ret; ++ } ++ ++ for (i = 0; i < RT5190A_MAX_IDX; i++) { ++ match = rt5190a_regulator_match + i; ++ ++ ret = rt5190a_of_parse_cb(priv, i, match); ++ if (ret) { ++ dev_err(priv->dev, "Failed in [%d] of_parse_cb\n", i); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static const struct reg_sequence rt5190a_init_patch[] = { ++ { 0x09, 0x3d, }, ++ { 0x0a, 0x3e, }, ++ { 0x0b, 0x01, }, ++ { 0x10, 0xff, }, ++ { 0x11, 0xff, }, ++ { 0x12, 0xff, }, ++ { 0x13, 0xff, }, ++ { 0x14, 0, }, ++ { 0x15, 0, }, ++ { 0x16, 0x3e, }, ++ { 0x17, 0, } ++}; ++ ++static int rt5190a_device_initialize(struct rt5190a_priv *priv) ++{ ++ bool mute_enable; ++ int ret; ++ ++ ret = regmap_register_patch(priv->regmap, rt5190a_init_patch, ++ ARRAY_SIZE(rt5190a_init_patch)); ++ if (ret) { ++ dev_err(priv->dev, "Failed to do register patch\n"); ++ return ret; ++ } ++ ++ mute_enable = device_property_read_bool(priv->dev, ++ "richtek,mute-enable"); ++ ++ if (mute_enable) { ++ ret = regmap_write(priv->regmap, RT5190A_REG_MUTECNTL, 0x00); ++ if (ret) { ++ dev_err(priv->dev, "Failed to enable mute function\n"); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int rt5190a_device_check(struct rt5190a_priv *priv) ++{ ++ u16 devid; ++ int ret; ++ ++ ret = regmap_raw_read(priv->regmap, RT5190A_REG_MANUFACTURE, &devid, ++ sizeof(devid)); ++ if (ret) ++ return ret; ++ ++ if (devid) { ++ dev_err(priv->dev, "Incorrect device id 0x%04x\n", devid); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ ++static const struct regmap_config rt5190a_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, ++ .max_register = RT5190A_REG_HOTDIEMASK, ++}; ++ ++static int rt5190a_probe(struct i2c_client *i2c) ++{ ++ struct rt5190a_priv *priv; ++ struct regulator_config cfg = {}; ++ int i, ret; ++ ++ priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->dev = &i2c->dev; ++ ++ priv->regmap = devm_regmap_init_i2c(i2c, &rt5190a_regmap_config); ++ if (IS_ERR(priv->regmap)) { ++ dev_err(&i2c->dev, "Failed to allocate regmap\n"); ++ return PTR_ERR(priv->regmap); ++ } ++ ++ ret = rt5190a_device_check(priv); ++ if (ret) { ++ dev_err(&i2c->dev, "Failed to check device %d\n", ret); ++ return ret; ++ } ++ ++ ret = rt5190a_device_initialize(priv); ++ if (ret) { ++ dev_err(&i2c->dev, "Failed to initialize the device\n"); ++ return ret; ++ } ++ ++ ret = rt5190a_parse_regulator_dt_data(priv); ++ if (ret) { ++ dev_err(&i2c->dev, "Failed to parse regulator dt\n"); ++ return ret; ++ } ++ ++ cfg.dev = &i2c->dev; ++ cfg.regmap = priv->regmap; ++ ++ for (i = 0; i < RT5190A_MAX_IDX; i++) { ++ struct regulator_desc *desc = priv->rdesc + i; ++ struct of_regulator_match *match = rt5190a_regulator_match + i; ++ ++ cfg.init_data = match->init_data; ++ cfg.of_node = match->of_node; ++ ++ priv->rdev[i] = devm_regulator_register(&i2c->dev, desc, &cfg); ++ if (IS_ERR(priv->rdev[i])) { ++ dev_err(&i2c->dev, "Failed to register regulator %s\n", ++ desc->name); ++ return PTR_ERR(priv->rdev[i]); ++ } ++ } ++ ++ if (i2c->irq) { ++ ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, ++ rt5190a_irq_handler, ++ IRQF_ONESHOT, ++ dev_name(&i2c->dev), priv); ++ if (ret) { ++ dev_err(&i2c->dev, "Failed to register interrupt\n"); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id __maybe_unused rt5190a_device_table[] = { ++ { .compatible = "richtek,rt5190a", }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, rt5190a_device_table); ++ ++static struct i2c_driver rt5190a_driver = { ++ .driver = { ++ .name = "rt5190a", ++ .of_match_table = rt5190a_device_table, ++ }, ++ .probe_new = rt5190a_probe, ++}; ++module_i2c_driver(rt5190a_driver); ++ ++MODULE_AUTHOR("ChiYuan Huang "); ++MODULE_DESCRIPTION("Richtek RT5190A Regulator Driver"); ++MODULE_LICENSE("GPL v2"); From 670dedbbd71056fa60666a6c5f7bd84ebcf6a2a1 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Apr 2023 18:03:00 +0100 Subject: [PATCH 0032/1171] mediatek: backport cpufreq changes to support MT7988 Backport cpufreq changes from upstream so that the MediaTek MT7988 SoC can be supported. Signed-off-by: Daniel Golle (cherry picked from commit e4555d69a1c7c811188d8e257e77ac917d15f492) --- ...-Cleanup-variables-and-error-handlin.patch | 166 ++++++++++++ ...ufreq-mediatek-Remove-unused-headers.patch | 25 ++ ...ediatek-Enable-clocks-and-regulators.patch | 117 ++++++++ ...diatek-Use-device-print-to-show-logs.patch | 161 +++++++++++ ...freq-mediatek-Replace-old_-with-pre_.patch | 201 ++++++++++++++ ...k-Record-previous-target-vproc-value.patch | 64 +++++ ...ediatek-Make-sram-regulator-optional.patch | 30 +++ ...-Fix-NULL-pointer-dereference-in-med.patch | 32 +++ ...-Move-voltage-limits-to-platform-dat.patch | 227 ++++++++++++++++ ...-Refine-mtk_cpufreq_voltage_tracking.patch | 255 ++++++++++++++++++ ...ediatek-Add-opp-notification-support.patch | 184 +++++++++++++ ...-Fix-potential-deadlock-problem-in-m.patch | 43 +++ ...freq-mediatek-Link-CCI-device-to-CPU.patch | 188 +++++++++++++ ...freq-mediatek-Add-support-for-MT8186.patch | 42 +++ ...-Handle-sram-regulator-probe-deferra.patch | 35 +++ ...-fix-error-return-code-in-mtk_cpu_dv.patch | 29 ++ ...mediatek-fix-passing-zero-to-PTR_ERR.patch | 47 ++++ ...-fix-KP-caused-by-handler-usage-afte.patch | 149 ++++++++++ ...-raise-proc-sram-max-voltage-for-MT8.patch | 55 ++++ ...-Raise-proc-and-sram-max-voltage-for.patch | 58 ++++ ...freq-mediatek-Add-support-for-MT7988.patch | 41 +++ ...ek-don-t-request-unsupported-voltage.patch | 29 ++ 22 files changed, 2178 insertions(+) create mode 100644 target/linux/mediatek/patches-5.15/350-01-cpufreq-mediatek-Cleanup-variables-and-error-handlin.patch create mode 100644 target/linux/mediatek/patches-5.15/350-02-cpufreq-mediatek-Remove-unused-headers.patch create mode 100644 target/linux/mediatek/patches-5.15/350-03-cpufreq-mediatek-Enable-clocks-and-regulators.patch create mode 100644 target/linux/mediatek/patches-5.15/350-04-cpufreq-mediatek-Use-device-print-to-show-logs.patch create mode 100644 target/linux/mediatek/patches-5.15/350-05-cpufreq-mediatek-Replace-old_-with-pre_.patch create mode 100644 target/linux/mediatek/patches-5.15/350-06-cpufreq-mediatek-Record-previous-target-vproc-value.patch create mode 100644 target/linux/mediatek/patches-5.15/350-07-cpufreq-mediatek-Make-sram-regulator-optional.patch create mode 100644 target/linux/mediatek/patches-5.15/350-08-cpufreq-mediatek-Fix-NULL-pointer-dereference-in-med.patch create mode 100644 target/linux/mediatek/patches-5.15/350-09-cpufreq-mediatek-Move-voltage-limits-to-platform-dat.patch create mode 100644 target/linux/mediatek/patches-5.15/350-10-cpufreq-mediatek-Refine-mtk_cpufreq_voltage_tracking.patch create mode 100644 target/linux/mediatek/patches-5.15/350-11-cpufreq-mediatek-Add-opp-notification-support.patch create mode 100644 target/linux/mediatek/patches-5.15/350-12-cpufreq-mediatek-Fix-potential-deadlock-problem-in-m.patch create mode 100644 target/linux/mediatek/patches-5.15/350-13-cpufreq-mediatek-Link-CCI-device-to-CPU.patch create mode 100644 target/linux/mediatek/patches-5.15/350-14-cpufreq-mediatek-Add-support-for-MT8186.patch create mode 100644 target/linux/mediatek/patches-5.15/350-15-cpufreq-mediatek-Handle-sram-regulator-probe-deferra.patch create mode 100644 target/linux/mediatek/patches-5.15/350-16-cpufreq-mediatek-fix-error-return-code-in-mtk_cpu_dv.patch create mode 100644 target/linux/mediatek/patches-5.15/350-17-cpufreq-mediatek-fix-passing-zero-to-PTR_ERR.patch create mode 100644 target/linux/mediatek/patches-5.15/350-18-cpufreq-mediatek-fix-KP-caused-by-handler-usage-afte.patch create mode 100644 target/linux/mediatek/patches-5.15/350-19-cpufreq-mediatek-raise-proc-sram-max-voltage-for-MT8.patch create mode 100644 target/linux/mediatek/patches-5.15/350-20-cpufreq-mediatek-Raise-proc-and-sram-max-voltage-for.patch create mode 100644 target/linux/mediatek/patches-5.15/350-21-cpufreq-mediatek-Add-support-for-MT7988.patch create mode 100644 target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch diff --git a/target/linux/mediatek/patches-5.15/350-01-cpufreq-mediatek-Cleanup-variables-and-error-handlin.patch b/target/linux/mediatek/patches-5.15/350-01-cpufreq-mediatek-Cleanup-variables-and-error-handlin.patch new file mode 100644 index 00000000000000..8fad64a5702aa0 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-01-cpufreq-mediatek-Cleanup-variables-and-error-handlin.patch @@ -0,0 +1,166 @@ +From 7a768326fdba542144833b9198a6d0edab52fad2 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 8 Apr 2022 12:58:56 +0800 +Subject: [PATCH 01/21] cpufreq: mediatek: Cleanup variables and error handling + in mtk_cpu_dvfs_info_init() + +- Remove several unnecessary varaibles in mtk_cpu_dvfs_info_init(). +- Unify error message format and use dev_err_probe() if possible. + +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 89 ++++++++++++------------------ + 1 file changed, 34 insertions(+), 55 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -302,96 +302,75 @@ static int mtk_cpufreq_set_target(struct + static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) + { + struct device *cpu_dev; +- struct regulator *proc_reg = ERR_PTR(-ENODEV); +- struct regulator *sram_reg = ERR_PTR(-ENODEV); +- struct clk *cpu_clk = ERR_PTR(-ENODEV); +- struct clk *inter_clk = ERR_PTR(-ENODEV); + struct dev_pm_opp *opp; + unsigned long rate; + int ret; + + cpu_dev = get_cpu_device(cpu); + if (!cpu_dev) { +- pr_err("failed to get cpu%d device\n", cpu); ++ dev_err(cpu_dev, "failed to get cpu%d device\n", cpu); + return -ENODEV; + } ++ info->cpu_dev = cpu_dev; + +- cpu_clk = clk_get(cpu_dev, "cpu"); +- if (IS_ERR(cpu_clk)) { +- if (PTR_ERR(cpu_clk) == -EPROBE_DEFER) +- pr_warn("cpu clk for cpu%d not ready, retry.\n", cpu); +- else +- pr_err("failed to get cpu clk for cpu%d\n", cpu); +- +- ret = PTR_ERR(cpu_clk); +- return ret; +- } +- +- inter_clk = clk_get(cpu_dev, "intermediate"); +- if (IS_ERR(inter_clk)) { +- if (PTR_ERR(inter_clk) == -EPROBE_DEFER) +- pr_warn("intermediate clk for cpu%d not ready, retry.\n", +- cpu); +- else +- pr_err("failed to get intermediate clk for cpu%d\n", +- cpu); ++ info->cpu_clk = clk_get(cpu_dev, "cpu"); ++ if (IS_ERR(info->cpu_clk)) { ++ ret = PTR_ERR(info->cpu_clk); ++ return dev_err_probe(cpu_dev, ret, ++ "cpu%d: failed to get cpu clk\n", cpu); ++ } + +- ret = PTR_ERR(inter_clk); ++ info->inter_clk = clk_get(cpu_dev, "intermediate"); ++ if (IS_ERR(info->inter_clk)) { ++ ret = PTR_ERR(info->inter_clk); ++ dev_err_probe(cpu_dev, ret, ++ "cpu%d: failed to get intermediate clk\n", cpu); + goto out_free_resources; + } + +- proc_reg = regulator_get_optional(cpu_dev, "proc"); +- if (IS_ERR(proc_reg)) { +- if (PTR_ERR(proc_reg) == -EPROBE_DEFER) +- pr_warn("proc regulator for cpu%d not ready, retry.\n", +- cpu); +- else +- pr_err("failed to get proc regulator for cpu%d\n", +- cpu); +- +- ret = PTR_ERR(proc_reg); ++ info->proc_reg = regulator_get_optional(cpu_dev, "proc"); ++ if (IS_ERR(info->proc_reg)) { ++ ret = PTR_ERR(info->proc_reg); ++ dev_err_probe(cpu_dev, ret, ++ "cpu%d: failed to get proc regulator\n", cpu); + goto out_free_resources; + } + + /* Both presence and absence of sram regulator are valid cases. */ +- sram_reg = regulator_get_exclusive(cpu_dev, "sram"); ++ info->sram_reg = regulator_get_exclusive(cpu_dev, "sram"); ++ if (IS_ERR(info->sram_reg)) ++ info->sram_reg = NULL; + + /* Get OPP-sharing information from "operating-points-v2" bindings */ + ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, &info->cpus); + if (ret) { +- pr_err("failed to get OPP-sharing information for cpu%d\n", +- cpu); ++ dev_err(cpu_dev, ++ "cpu%d: failed to get OPP-sharing information\n", cpu); + goto out_free_resources; + } + + ret = dev_pm_opp_of_cpumask_add_table(&info->cpus); + if (ret) { +- pr_warn("no OPP table for cpu%d\n", cpu); ++ dev_warn(cpu_dev, "cpu%d: no OPP table\n", cpu); + goto out_free_resources; + } + + /* Search a safe voltage for intermediate frequency. */ +- rate = clk_get_rate(inter_clk); ++ rate = clk_get_rate(info->inter_clk); + opp = dev_pm_opp_find_freq_ceil(cpu_dev, &rate); + if (IS_ERR(opp)) { +- pr_err("failed to get intermediate opp for cpu%d\n", cpu); ++ dev_err(cpu_dev, "cpu%d: failed to get intermediate opp\n", cpu); + ret = PTR_ERR(opp); + goto out_free_opp_table; + } + info->intermediate_voltage = dev_pm_opp_get_voltage(opp); + dev_pm_opp_put(opp); + +- info->cpu_dev = cpu_dev; +- info->proc_reg = proc_reg; +- info->sram_reg = IS_ERR(sram_reg) ? NULL : sram_reg; +- info->cpu_clk = cpu_clk; +- info->inter_clk = inter_clk; +- + /* + * If SRAM regulator is present, software "voltage tracking" is needed + * for this CPU power domain. + */ +- info->need_voltage_tracking = !IS_ERR(sram_reg); ++ info->need_voltage_tracking = (info->sram_reg != NULL); + + return 0; + +@@ -399,14 +378,14 @@ out_free_opp_table: + dev_pm_opp_of_cpumask_remove_table(&info->cpus); + + out_free_resources: +- if (!IS_ERR(proc_reg)) +- regulator_put(proc_reg); +- if (!IS_ERR(sram_reg)) +- regulator_put(sram_reg); +- if (!IS_ERR(cpu_clk)) +- clk_put(cpu_clk); +- if (!IS_ERR(inter_clk)) +- clk_put(inter_clk); ++ if (!IS_ERR(info->proc_reg)) ++ regulator_put(info->proc_reg); ++ if (!IS_ERR(info->sram_reg)) ++ regulator_put(info->sram_reg); ++ if (!IS_ERR(info->cpu_clk)) ++ clk_put(info->cpu_clk); ++ if (!IS_ERR(info->inter_clk)) ++ clk_put(info->inter_clk); + + return ret; + } diff --git a/target/linux/mediatek/patches-5.15/350-02-cpufreq-mediatek-Remove-unused-headers.patch b/target/linux/mediatek/patches-5.15/350-02-cpufreq-mediatek-Remove-unused-headers.patch new file mode 100644 index 00000000000000..eebeeb09028518 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-02-cpufreq-mediatek-Remove-unused-headers.patch @@ -0,0 +1,25 @@ +From 756104b856d4bc3121420af3ced342f5fc2b2123 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 8 Apr 2022 12:58:57 +0800 +Subject: [PATCH 02/21] cpufreq: mediatek: Remove unused headers + +Remove unused headers. + +Signed-off-by: Jia-Wei Chang +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -13,8 +13,6 @@ + #include + #include + #include +-#include +-#include + + #define MIN_VOLT_SHIFT (100000) + #define MAX_VOLT_SHIFT (200000) diff --git a/target/linux/mediatek/patches-5.15/350-03-cpufreq-mediatek-Enable-clocks-and-regulators.patch b/target/linux/mediatek/patches-5.15/350-03-cpufreq-mediatek-Enable-clocks-and-regulators.patch new file mode 100644 index 00000000000000..c97d5fc3d91d82 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-03-cpufreq-mediatek-Enable-clocks-and-regulators.patch @@ -0,0 +1,117 @@ +From 342d5545e9f40496db9ae0d31c2427dd5f369a43 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 8 Apr 2022 12:58:58 +0800 +Subject: [PATCH 03/21] cpufreq: mediatek: Enable clocks and regulators + +We need to enable regulators so that the max and min requested values will +be recorded. +The intermediate clock is not always enabled by CCF in different projects, +so we should enable it in the cpufreq driver. + +Signed-off-by: Andrew-sh.Cheng +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 50 +++++++++++++++++++++++++++--- + 1 file changed, 45 insertions(+), 5 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -334,10 +334,23 @@ static int mtk_cpu_dvfs_info_init(struct + goto out_free_resources; + } + ++ ret = regulator_enable(info->proc_reg); ++ if (ret) { ++ dev_warn(cpu_dev, "cpu%d: failed to enable vproc\n", cpu); ++ goto out_free_resources; ++ } ++ + /* Both presence and absence of sram regulator are valid cases. */ + info->sram_reg = regulator_get_exclusive(cpu_dev, "sram"); + if (IS_ERR(info->sram_reg)) + info->sram_reg = NULL; ++ else { ++ ret = regulator_enable(info->sram_reg); ++ if (ret) { ++ dev_warn(cpu_dev, "cpu%d: failed to enable vsram\n", cpu); ++ goto out_free_resources; ++ } ++ } + + /* Get OPP-sharing information from "operating-points-v2" bindings */ + ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, &info->cpus); +@@ -353,13 +366,21 @@ static int mtk_cpu_dvfs_info_init(struct + goto out_free_resources; + } + ++ ret = clk_prepare_enable(info->cpu_clk); ++ if (ret) ++ goto out_free_opp_table; ++ ++ ret = clk_prepare_enable(info->inter_clk); ++ if (ret) ++ goto out_disable_mux_clock; ++ + /* Search a safe voltage for intermediate frequency. */ + rate = clk_get_rate(info->inter_clk); + opp = dev_pm_opp_find_freq_ceil(cpu_dev, &rate); + if (IS_ERR(opp)) { + dev_err(cpu_dev, "cpu%d: failed to get intermediate opp\n", cpu); + ret = PTR_ERR(opp); +- goto out_free_opp_table; ++ goto out_disable_inter_clock; + } + info->intermediate_voltage = dev_pm_opp_get_voltage(opp); + dev_pm_opp_put(opp); +@@ -372,10 +393,21 @@ static int mtk_cpu_dvfs_info_init(struct + + return 0; + ++out_disable_inter_clock: ++ clk_disable_unprepare(info->inter_clk); ++ ++out_disable_mux_clock: ++ clk_disable_unprepare(info->cpu_clk); ++ + out_free_opp_table: + dev_pm_opp_of_cpumask_remove_table(&info->cpus); + + out_free_resources: ++ if (regulator_is_enabled(info->proc_reg)) ++ regulator_disable(info->proc_reg); ++ if (info->sram_reg && regulator_is_enabled(info->sram_reg)) ++ regulator_disable(info->sram_reg); ++ + if (!IS_ERR(info->proc_reg)) + regulator_put(info->proc_reg); + if (!IS_ERR(info->sram_reg)) +@@ -390,14 +422,22 @@ out_free_resources: + + static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info) + { +- if (!IS_ERR(info->proc_reg)) ++ if (!IS_ERR(info->proc_reg)) { ++ regulator_disable(info->proc_reg); + regulator_put(info->proc_reg); +- if (!IS_ERR(info->sram_reg)) ++ } ++ if (!IS_ERR(info->sram_reg)) { ++ regulator_disable(info->sram_reg); + regulator_put(info->sram_reg); +- if (!IS_ERR(info->cpu_clk)) ++ } ++ if (!IS_ERR(info->cpu_clk)) { ++ clk_disable_unprepare(info->cpu_clk); + clk_put(info->cpu_clk); +- if (!IS_ERR(info->inter_clk)) ++ } ++ if (!IS_ERR(info->inter_clk)) { ++ clk_disable_unprepare(info->inter_clk); + clk_put(info->inter_clk); ++ } + + dev_pm_opp_of_cpumask_remove_table(&info->cpus); + } diff --git a/target/linux/mediatek/patches-5.15/350-04-cpufreq-mediatek-Use-device-print-to-show-logs.patch b/target/linux/mediatek/patches-5.15/350-04-cpufreq-mediatek-Use-device-print-to-show-logs.patch new file mode 100644 index 00000000000000..18e1da728a877a --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-04-cpufreq-mediatek-Use-device-print-to-show-logs.patch @@ -0,0 +1,161 @@ +From a02e2b359141035d2d6999940bc1b9f83ec88587 Mon Sep 17 00:00:00 2001 +From: Rex-BC Chen +Date: Fri, 22 Apr 2022 15:52:27 +0800 +Subject: [PATCH 04/21] cpufreq: mediatek: Use device print to show logs + +- Replace pr_* with dev_* to show logs. +- Remove usage of __func__. + +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 54 ++++++++++++++++-------------- + 1 file changed, 28 insertions(+), 26 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -67,7 +67,8 @@ static int mtk_cpufreq_voltage_tracking( + + old_vproc = regulator_get_voltage(proc_reg); + if (old_vproc < 0) { +- pr_err("%s: invalid Vproc value: %d\n", __func__, old_vproc); ++ dev_err(info->cpu_dev, ++ "invalid Vproc value: %d\n", old_vproc); + return old_vproc; + } + /* Vsram should not exceed the maximum allowed voltage of SoC. */ +@@ -83,14 +84,14 @@ static int mtk_cpufreq_voltage_tracking( + do { + old_vsram = regulator_get_voltage(sram_reg); + if (old_vsram < 0) { +- pr_err("%s: invalid Vsram value: %d\n", +- __func__, old_vsram); ++ dev_err(info->cpu_dev, ++ "invalid Vsram value: %d\n", old_vsram); + return old_vsram; + } + old_vproc = regulator_get_voltage(proc_reg); + if (old_vproc < 0) { +- pr_err("%s: invalid Vproc value: %d\n", +- __func__, old_vproc); ++ dev_err(info->cpu_dev, ++ "invalid Vproc value: %d\n", old_vproc); + return old_vproc; + } + +@@ -138,14 +139,14 @@ static int mtk_cpufreq_voltage_tracking( + do { + old_vproc = regulator_get_voltage(proc_reg); + if (old_vproc < 0) { +- pr_err("%s: invalid Vproc value: %d\n", +- __func__, old_vproc); ++ dev_err(info->cpu_dev, ++ "invalid Vproc value: %d\n", old_vproc); + return old_vproc; + } + old_vsram = regulator_get_voltage(sram_reg); + if (old_vsram < 0) { +- pr_err("%s: invalid Vsram value: %d\n", +- __func__, old_vsram); ++ dev_err(info->cpu_dev, ++ "invalid Vsram value: %d\n", old_vsram); + return old_vsram; + } + +@@ -216,7 +217,7 @@ static int mtk_cpufreq_set_target(struct + old_freq_hz = clk_get_rate(cpu_clk); + old_vproc = regulator_get_voltage(info->proc_reg); + if (old_vproc < 0) { +- pr_err("%s: invalid Vproc value: %d\n", __func__, old_vproc); ++ dev_err(cpu_dev, "invalid Vproc value: %d\n", old_vproc); + return old_vproc; + } + +@@ -224,8 +225,8 @@ static int mtk_cpufreq_set_target(struct + + opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz); + if (IS_ERR(opp)) { +- pr_err("cpu%d: failed to find OPP for %ld\n", +- policy->cpu, freq_hz); ++ dev_err(cpu_dev, "cpu%d: failed to find OPP for %ld\n", ++ policy->cpu, freq_hz); + return PTR_ERR(opp); + } + vproc = dev_pm_opp_get_voltage(opp); +@@ -239,8 +240,8 @@ static int mtk_cpufreq_set_target(struct + if (old_vproc < target_vproc) { + ret = mtk_cpufreq_set_voltage(info, target_vproc); + if (ret) { +- pr_err("cpu%d: failed to scale up voltage!\n", +- policy->cpu); ++ dev_err(cpu_dev, ++ "cpu%d: failed to scale up voltage!\n", policy->cpu); + mtk_cpufreq_set_voltage(info, old_vproc); + return ret; + } +@@ -249,8 +250,8 @@ static int mtk_cpufreq_set_target(struct + /* Reparent the CPU clock to intermediate clock. */ + ret = clk_set_parent(cpu_clk, info->inter_clk); + if (ret) { +- pr_err("cpu%d: failed to re-parent cpu clock!\n", +- policy->cpu); ++ dev_err(cpu_dev, ++ "cpu%d: failed to re-parent cpu clock!\n", policy->cpu); + mtk_cpufreq_set_voltage(info, old_vproc); + WARN_ON(1); + return ret; +@@ -259,8 +260,8 @@ static int mtk_cpufreq_set_target(struct + /* Set the original PLL to target rate. */ + ret = clk_set_rate(armpll, freq_hz); + if (ret) { +- pr_err("cpu%d: failed to scale cpu clock rate!\n", +- policy->cpu); ++ dev_err(cpu_dev, ++ "cpu%d: failed to scale cpu clock rate!\n", policy->cpu); + clk_set_parent(cpu_clk, armpll); + mtk_cpufreq_set_voltage(info, old_vproc); + return ret; +@@ -269,8 +270,8 @@ static int mtk_cpufreq_set_target(struct + /* Set parent of CPU clock back to the original PLL. */ + ret = clk_set_parent(cpu_clk, armpll); + if (ret) { +- pr_err("cpu%d: failed to re-parent cpu clock!\n", +- policy->cpu); ++ dev_err(cpu_dev, ++ "cpu%d: failed to re-parent cpu clock!\n", policy->cpu); + mtk_cpufreq_set_voltage(info, inter_vproc); + WARN_ON(1); + return ret; +@@ -283,8 +284,8 @@ static int mtk_cpufreq_set_target(struct + if (vproc < inter_vproc || vproc < old_vproc) { + ret = mtk_cpufreq_set_voltage(info, vproc); + if (ret) { +- pr_err("cpu%d: failed to scale down voltage!\n", +- policy->cpu); ++ dev_err(cpu_dev, ++ "cpu%d: failed to scale down voltage!\n", policy->cpu); + clk_set_parent(cpu_clk, info->inter_clk); + clk_set_rate(armpll, old_freq_hz); + clk_set_parent(cpu_clk, armpll); +@@ -450,15 +451,16 @@ static int mtk_cpufreq_init(struct cpufr + + info = mtk_cpu_dvfs_info_lookup(policy->cpu); + if (!info) { +- pr_err("dvfs info for cpu%d is not initialized.\n", +- policy->cpu); ++ dev_err(info->cpu_dev, ++ "dvfs info for cpu%d is not initialized.\n", policy->cpu); + return -EINVAL; + } + + ret = dev_pm_opp_init_cpufreq_table(info->cpu_dev, &freq_table); + if (ret) { +- pr_err("failed to init cpufreq table for cpu%d: %d\n", +- policy->cpu, ret); ++ dev_err(info->cpu_dev, ++ "failed to init cpufreq table for cpu%d: %d\n", ++ policy->cpu, ret); + return ret; + } + diff --git a/target/linux/mediatek/patches-5.15/350-05-cpufreq-mediatek-Replace-old_-with-pre_.patch b/target/linux/mediatek/patches-5.15/350-05-cpufreq-mediatek-Replace-old_-with-pre_.patch new file mode 100644 index 00000000000000..8506f4e47769f9 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-05-cpufreq-mediatek-Replace-old_-with-pre_.patch @@ -0,0 +1,201 @@ +From 35832d9f9c5c1da01420d962dc56e7e61d104829 Mon Sep 17 00:00:00 2001 +From: Rex-BC Chen +Date: Fri, 22 Apr 2022 15:52:28 +0800 +Subject: [PATCH 05/21] cpufreq: mediatek: Replace old_* with pre_* + +To make driver more readable, replace old_* with pre_*. + +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 84 +++++++++++++++--------------- + 1 file changed, 42 insertions(+), 42 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -63,18 +63,18 @@ static int mtk_cpufreq_voltage_tracking( + { + struct regulator *proc_reg = info->proc_reg; + struct regulator *sram_reg = info->sram_reg; +- int old_vproc, old_vsram, new_vsram, vsram, vproc, ret; ++ int pre_vproc, pre_vsram, new_vsram, vsram, vproc, ret; + +- old_vproc = regulator_get_voltage(proc_reg); +- if (old_vproc < 0) { ++ pre_vproc = regulator_get_voltage(proc_reg); ++ if (pre_vproc < 0) { + dev_err(info->cpu_dev, +- "invalid Vproc value: %d\n", old_vproc); +- return old_vproc; ++ "invalid Vproc value: %d\n", pre_vproc); ++ return pre_vproc; + } + /* Vsram should not exceed the maximum allowed voltage of SoC. */ + new_vsram = min(new_vproc + MIN_VOLT_SHIFT, MAX_VOLT_LIMIT); + +- if (old_vproc < new_vproc) { ++ if (pre_vproc < new_vproc) { + /* + * When scaling up voltages, Vsram and Vproc scale up step + * by step. At each step, set Vsram to (Vproc + 200mV) first, +@@ -82,20 +82,20 @@ static int mtk_cpufreq_voltage_tracking( + * Keep doing it until Vsram and Vproc hit target voltages. + */ + do { +- old_vsram = regulator_get_voltage(sram_reg); +- if (old_vsram < 0) { ++ pre_vsram = regulator_get_voltage(sram_reg); ++ if (pre_vsram < 0) { + dev_err(info->cpu_dev, +- "invalid Vsram value: %d\n", old_vsram); +- return old_vsram; ++ "invalid Vsram value: %d\n", pre_vsram); ++ return pre_vsram; + } +- old_vproc = regulator_get_voltage(proc_reg); +- if (old_vproc < 0) { ++ pre_vproc = regulator_get_voltage(proc_reg); ++ if (pre_vproc < 0) { + dev_err(info->cpu_dev, +- "invalid Vproc value: %d\n", old_vproc); +- return old_vproc; ++ "invalid Vproc value: %d\n", pre_vproc); ++ return pre_vproc; + } + +- vsram = min(new_vsram, old_vproc + MAX_VOLT_SHIFT); ++ vsram = min(new_vsram, pre_vproc + MAX_VOLT_SHIFT); + + if (vsram + VOLT_TOL >= MAX_VOLT_LIMIT) { + vsram = MAX_VOLT_LIMIT; +@@ -124,12 +124,12 @@ static int mtk_cpufreq_voltage_tracking( + ret = regulator_set_voltage(proc_reg, vproc, + vproc + VOLT_TOL); + if (ret) { +- regulator_set_voltage(sram_reg, old_vsram, +- old_vsram); ++ regulator_set_voltage(sram_reg, pre_vsram, ++ pre_vsram); + return ret; + } + } while (vproc < new_vproc || vsram < new_vsram); +- } else if (old_vproc > new_vproc) { ++ } else if (pre_vproc > new_vproc) { + /* + * When scaling down voltages, Vsram and Vproc scale down step + * by step. At each step, set Vproc to (Vsram - 200mV) first, +@@ -137,20 +137,20 @@ static int mtk_cpufreq_voltage_tracking( + * Keep doing it until Vsram and Vproc hit target voltages. + */ + do { +- old_vproc = regulator_get_voltage(proc_reg); +- if (old_vproc < 0) { ++ pre_vproc = regulator_get_voltage(proc_reg); ++ if (pre_vproc < 0) { + dev_err(info->cpu_dev, +- "invalid Vproc value: %d\n", old_vproc); +- return old_vproc; ++ "invalid Vproc value: %d\n", pre_vproc); ++ return pre_vproc; + } +- old_vsram = regulator_get_voltage(sram_reg); +- if (old_vsram < 0) { ++ pre_vsram = regulator_get_voltage(sram_reg); ++ if (pre_vsram < 0) { + dev_err(info->cpu_dev, +- "invalid Vsram value: %d\n", old_vsram); +- return old_vsram; ++ "invalid Vsram value: %d\n", pre_vsram); ++ return pre_vsram; + } + +- vproc = max(new_vproc, old_vsram - MAX_VOLT_SHIFT); ++ vproc = max(new_vproc, pre_vsram - MAX_VOLT_SHIFT); + ret = regulator_set_voltage(proc_reg, vproc, + vproc + VOLT_TOL); + if (ret) +@@ -180,8 +180,8 @@ static int mtk_cpufreq_voltage_tracking( + } + + if (ret) { +- regulator_set_voltage(proc_reg, old_vproc, +- old_vproc); ++ regulator_set_voltage(proc_reg, pre_vproc, ++ pre_vproc); + return ret; + } + } while (vproc > new_vproc + VOLT_TOL || +@@ -209,16 +209,16 @@ static int mtk_cpufreq_set_target(struct + struct mtk_cpu_dvfs_info *info = policy->driver_data; + struct device *cpu_dev = info->cpu_dev; + struct dev_pm_opp *opp; +- long freq_hz, old_freq_hz; +- int vproc, old_vproc, inter_vproc, target_vproc, ret; ++ long freq_hz, pre_freq_hz; ++ int vproc, pre_vproc, inter_vproc, target_vproc, ret; + + inter_vproc = info->intermediate_voltage; + +- old_freq_hz = clk_get_rate(cpu_clk); +- old_vproc = regulator_get_voltage(info->proc_reg); +- if (old_vproc < 0) { +- dev_err(cpu_dev, "invalid Vproc value: %d\n", old_vproc); +- return old_vproc; ++ pre_freq_hz = clk_get_rate(cpu_clk); ++ pre_vproc = regulator_get_voltage(info->proc_reg); ++ if (pre_vproc < 0) { ++ dev_err(cpu_dev, "invalid Vproc value: %d\n", pre_vproc); ++ return pre_vproc; + } + + freq_hz = freq_table[index].frequency * 1000; +@@ -237,12 +237,12 @@ static int mtk_cpufreq_set_target(struct + * current voltage, scale up voltage first. + */ + target_vproc = (inter_vproc > vproc) ? inter_vproc : vproc; +- if (old_vproc < target_vproc) { ++ if (pre_vproc < target_vproc) { + ret = mtk_cpufreq_set_voltage(info, target_vproc); + if (ret) { + dev_err(cpu_dev, + "cpu%d: failed to scale up voltage!\n", policy->cpu); +- mtk_cpufreq_set_voltage(info, old_vproc); ++ mtk_cpufreq_set_voltage(info, pre_vproc); + return ret; + } + } +@@ -252,7 +252,7 @@ static int mtk_cpufreq_set_target(struct + if (ret) { + dev_err(cpu_dev, + "cpu%d: failed to re-parent cpu clock!\n", policy->cpu); +- mtk_cpufreq_set_voltage(info, old_vproc); ++ mtk_cpufreq_set_voltage(info, pre_vproc); + WARN_ON(1); + return ret; + } +@@ -263,7 +263,7 @@ static int mtk_cpufreq_set_target(struct + dev_err(cpu_dev, + "cpu%d: failed to scale cpu clock rate!\n", policy->cpu); + clk_set_parent(cpu_clk, armpll); +- mtk_cpufreq_set_voltage(info, old_vproc); ++ mtk_cpufreq_set_voltage(info, pre_vproc); + return ret; + } + +@@ -281,13 +281,13 @@ static int mtk_cpufreq_set_target(struct + * If the new voltage is lower than the intermediate voltage or the + * original voltage, scale down to the new voltage. + */ +- if (vproc < inter_vproc || vproc < old_vproc) { ++ if (vproc < inter_vproc || vproc < pre_vproc) { + ret = mtk_cpufreq_set_voltage(info, vproc); + if (ret) { + dev_err(cpu_dev, + "cpu%d: failed to scale down voltage!\n", policy->cpu); + clk_set_parent(cpu_clk, info->inter_clk); +- clk_set_rate(armpll, old_freq_hz); ++ clk_set_rate(armpll, pre_freq_hz); + clk_set_parent(cpu_clk, armpll); + return ret; + } diff --git a/target/linux/mediatek/patches-5.15/350-06-cpufreq-mediatek-Record-previous-target-vproc-value.patch b/target/linux/mediatek/patches-5.15/350-06-cpufreq-mediatek-Record-previous-target-vproc-value.patch new file mode 100644 index 00000000000000..94e6617d267aad --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-06-cpufreq-mediatek-Record-previous-target-vproc-value.patch @@ -0,0 +1,64 @@ +From 34737eb8d0daa0d4183f10286a2f55d8788066bc Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 22 Apr 2022 15:52:29 +0800 +Subject: [PATCH 06/21] cpufreq: mediatek: Record previous target vproc value + +We found the buck voltage may not be exactly the same with what we set +because CPU may share the same buck with other module. +Therefore, we need to record the previous desired value instead of reading +it from regulators. + +Signed-off-by: Andrew-sh.Cheng +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -40,6 +40,7 @@ struct mtk_cpu_dvfs_info { + struct list_head list_head; + int intermediate_voltage; + bool need_voltage_tracking; ++ int pre_vproc; + }; + + static struct platform_device *cpufreq_pdev; +@@ -193,11 +194,17 @@ static int mtk_cpufreq_voltage_tracking( + + static int mtk_cpufreq_set_voltage(struct mtk_cpu_dvfs_info *info, int vproc) + { ++ int ret; ++ + if (info->need_voltage_tracking) +- return mtk_cpufreq_voltage_tracking(info, vproc); ++ ret = mtk_cpufreq_voltage_tracking(info, vproc); + else +- return regulator_set_voltage(info->proc_reg, vproc, +- vproc + VOLT_TOL); ++ ret = regulator_set_voltage(info->proc_reg, vproc, ++ MAX_VOLT_LIMIT); ++ if (!ret) ++ info->pre_vproc = vproc; ++ ++ return ret; + } + + static int mtk_cpufreq_set_target(struct cpufreq_policy *policy, +@@ -215,7 +222,12 @@ static int mtk_cpufreq_set_target(struct + inter_vproc = info->intermediate_voltage; + + pre_freq_hz = clk_get_rate(cpu_clk); +- pre_vproc = regulator_get_voltage(info->proc_reg); ++ ++ if (unlikely(info->pre_vproc <= 0)) ++ pre_vproc = regulator_get_voltage(info->proc_reg); ++ else ++ pre_vproc = info->pre_vproc; ++ + if (pre_vproc < 0) { + dev_err(cpu_dev, "invalid Vproc value: %d\n", pre_vproc); + return pre_vproc; diff --git a/target/linux/mediatek/patches-5.15/350-07-cpufreq-mediatek-Make-sram-regulator-optional.patch b/target/linux/mediatek/patches-5.15/350-07-cpufreq-mediatek-Make-sram-regulator-optional.patch new file mode 100644 index 00000000000000..4b74873b158fe6 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-07-cpufreq-mediatek-Make-sram-regulator-optional.patch @@ -0,0 +1,30 @@ +From f6114c2bc563a8050e9dc874ad87e1448865f031 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 22 Apr 2022 15:52:33 +0800 +Subject: [PATCH 07/21] cpufreq: mediatek: Make sram regulator optional + +For some MediaTek SoCs, like MT8186, it's possible that the sram regulator +is shared between CPU and CCI. +We hope regulator framework can return error for error handling rather +than a dummy handler from regulator_get api. +Therefore, we choose to use regulator_get_optional. + +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -354,7 +354,7 @@ static int mtk_cpu_dvfs_info_init(struct + } + + /* Both presence and absence of sram regulator are valid cases. */ +- info->sram_reg = regulator_get_exclusive(cpu_dev, "sram"); ++ info->sram_reg = regulator_get_optional(cpu_dev, "sram"); + if (IS_ERR(info->sram_reg)) + info->sram_reg = NULL; + else { diff --git a/target/linux/mediatek/patches-5.15/350-08-cpufreq-mediatek-Fix-NULL-pointer-dereference-in-med.patch b/target/linux/mediatek/patches-5.15/350-08-cpufreq-mediatek-Fix-NULL-pointer-dereference-in-med.patch new file mode 100644 index 00000000000000..f2f572a753faec --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-08-cpufreq-mediatek-Fix-NULL-pointer-dereference-in-med.patch @@ -0,0 +1,32 @@ +From fa7030d8ad4638acfd9e0fac84a20716d031dc95 Mon Sep 17 00:00:00 2001 +From: Wan Jiabing +Date: Tue, 26 Apr 2022 19:17:14 +0800 +Subject: [PATCH 08/21] cpufreq: mediatek: Fix NULL pointer dereference in + mediatek-cpufreq + +Fix following coccicheck error: +drivers/cpufreq/mediatek-cpufreq.c:464:16-23: ERROR: info is NULL but dereferenced. + +Use pr_err instead of dev_err to avoid dereferring a NULL pointer. + +Fixes: f52b16ba9fe4 ("cpufreq: mediatek: Use device print to show logs") +Signed-off-by: Wan Jiabing +Reviewed-by: Matthias Brugger +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -463,8 +463,8 @@ static int mtk_cpufreq_init(struct cpufr + + info = mtk_cpu_dvfs_info_lookup(policy->cpu); + if (!info) { +- dev_err(info->cpu_dev, +- "dvfs info for cpu%d is not initialized.\n", policy->cpu); ++ pr_err("dvfs info for cpu%d is not initialized.\n", ++ policy->cpu); + return -EINVAL; + } + diff --git a/target/linux/mediatek/patches-5.15/350-09-cpufreq-mediatek-Move-voltage-limits-to-platform-dat.patch b/target/linux/mediatek/patches-5.15/350-09-cpufreq-mediatek-Move-voltage-limits-to-platform-dat.patch new file mode 100644 index 00000000000000..23b319648dc937 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-09-cpufreq-mediatek-Move-voltage-limits-to-platform-dat.patch @@ -0,0 +1,227 @@ +From be2354b064e6bafbbad599ae2e10569ba4f7d5a6 Mon Sep 17 00:00:00 2001 +From: Rex-BC Chen +Date: Thu, 5 May 2022 19:52:19 +0800 +Subject: [PATCH 09/21] cpufreq: mediatek: Move voltage limits to platform data + +Voltages and shifts are defined as macros originally. +There are different requirements of these values for each MediaTek SoCs. +Therefore, we add the platform data and move these values into it. + +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 84 +++++++++++++++++++++--------- + 1 file changed, 58 insertions(+), 26 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -10,15 +10,21 @@ + #include + #include + #include ++#include + #include + #include + #include + +-#define MIN_VOLT_SHIFT (100000) +-#define MAX_VOLT_SHIFT (200000) +-#define MAX_VOLT_LIMIT (1150000) + #define VOLT_TOL (10000) + ++struct mtk_cpufreq_platform_data { ++ int min_volt_shift; ++ int max_volt_shift; ++ int proc_max_volt; ++ int sram_min_volt; ++ int sram_max_volt; ++}; ++ + /* + * The struct mtk_cpu_dvfs_info holds necessary information for doing CPU DVFS + * on each CPU power/clock domain of Mediatek SoCs. Each CPU cluster in +@@ -41,6 +47,7 @@ struct mtk_cpu_dvfs_info { + int intermediate_voltage; + bool need_voltage_tracking; + int pre_vproc; ++ const struct mtk_cpufreq_platform_data *soc_data; + }; + + static struct platform_device *cpufreq_pdev; +@@ -62,6 +69,7 @@ static struct mtk_cpu_dvfs_info *mtk_cpu + static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info, + int new_vproc) + { ++ const struct mtk_cpufreq_platform_data *soc_data = info->soc_data; + struct regulator *proc_reg = info->proc_reg; + struct regulator *sram_reg = info->sram_reg; + int pre_vproc, pre_vsram, new_vsram, vsram, vproc, ret; +@@ -73,7 +81,8 @@ static int mtk_cpufreq_voltage_tracking( + return pre_vproc; + } + /* Vsram should not exceed the maximum allowed voltage of SoC. */ +- new_vsram = min(new_vproc + MIN_VOLT_SHIFT, MAX_VOLT_LIMIT); ++ new_vsram = min(new_vproc + soc_data->min_volt_shift, ++ soc_data->sram_max_volt); + + if (pre_vproc < new_vproc) { + /* +@@ -96,10 +105,11 @@ static int mtk_cpufreq_voltage_tracking( + return pre_vproc; + } + +- vsram = min(new_vsram, pre_vproc + MAX_VOLT_SHIFT); ++ vsram = min(new_vsram, ++ pre_vproc + soc_data->min_volt_shift); + +- if (vsram + VOLT_TOL >= MAX_VOLT_LIMIT) { +- vsram = MAX_VOLT_LIMIT; ++ if (vsram + VOLT_TOL >= soc_data->sram_max_volt) { ++ vsram = soc_data->sram_max_volt; + + /* + * If the target Vsram hits the maximum voltage, +@@ -117,7 +127,7 @@ static int mtk_cpufreq_voltage_tracking( + ret = regulator_set_voltage(sram_reg, vsram, + vsram + VOLT_TOL); + +- vproc = vsram - MIN_VOLT_SHIFT; ++ vproc = vsram - soc_data->min_volt_shift; + } + if (ret) + return ret; +@@ -151,7 +161,8 @@ static int mtk_cpufreq_voltage_tracking( + return pre_vsram; + } + +- vproc = max(new_vproc, pre_vsram - MAX_VOLT_SHIFT); ++ vproc = max(new_vproc, ++ pre_vsram - soc_data->max_volt_shift); + ret = regulator_set_voltage(proc_reg, vproc, + vproc + VOLT_TOL); + if (ret) +@@ -160,10 +171,11 @@ static int mtk_cpufreq_voltage_tracking( + if (vproc == new_vproc) + vsram = new_vsram; + else +- vsram = max(new_vsram, vproc + MIN_VOLT_SHIFT); ++ vsram = max(new_vsram, ++ vproc + soc_data->min_volt_shift); + +- if (vsram + VOLT_TOL >= MAX_VOLT_LIMIT) { +- vsram = MAX_VOLT_LIMIT; ++ if (vsram + VOLT_TOL >= soc_data->sram_max_volt) { ++ vsram = soc_data->sram_max_volt; + + /* + * If the target Vsram hits the maximum voltage, +@@ -194,13 +206,14 @@ static int mtk_cpufreq_voltage_tracking( + + static int mtk_cpufreq_set_voltage(struct mtk_cpu_dvfs_info *info, int vproc) + { ++ const struct mtk_cpufreq_platform_data *soc_data = info->soc_data; + int ret; + + if (info->need_voltage_tracking) + ret = mtk_cpufreq_voltage_tracking(info, vproc); + else + ret = regulator_set_voltage(info->proc_reg, vproc, +- MAX_VOLT_LIMIT); ++ soc_data->proc_max_volt); + if (!ret) + info->pre_vproc = vproc; + +@@ -509,9 +522,17 @@ static struct cpufreq_driver mtk_cpufreq + + static int mtk_cpufreq_probe(struct platform_device *pdev) + { ++ const struct mtk_cpufreq_platform_data *data; + struct mtk_cpu_dvfs_info *info, *tmp; + int cpu, ret; + ++ data = dev_get_platdata(&pdev->dev); ++ if (!data) { ++ dev_err(&pdev->dev, ++ "failed to get mtk cpufreq platform data\n"); ++ return -ENODEV; ++ } ++ + for_each_possible_cpu(cpu) { + info = mtk_cpu_dvfs_info_lookup(cpu); + if (info) +@@ -523,6 +544,7 @@ static int mtk_cpufreq_probe(struct plat + goto release_dvfs_info_list; + } + ++ info->soc_data = data; + ret = mtk_cpu_dvfs_info_init(info, cpu); + if (ret) { + dev_err(&pdev->dev, +@@ -558,20 +580,27 @@ static struct platform_driver mtk_cpufre + .probe = mtk_cpufreq_probe, + }; + ++static const struct mtk_cpufreq_platform_data mt2701_platform_data = { ++ .min_volt_shift = 100000, ++ .max_volt_shift = 200000, ++ .proc_max_volt = 1150000, ++ .sram_min_volt = 0, ++ .sram_max_volt = 1150000, ++}; ++ + /* List of machines supported by this driver */ + static const struct of_device_id mtk_cpufreq_machines[] __initconst = { +- { .compatible = "mediatek,mt2701", }, +- { .compatible = "mediatek,mt2712", }, +- { .compatible = "mediatek,mt7622", }, +- { .compatible = "mediatek,mt7623", }, +- { .compatible = "mediatek,mt8167", }, +- { .compatible = "mediatek,mt817x", }, +- { .compatible = "mediatek,mt8173", }, +- { .compatible = "mediatek,mt8176", }, +- { .compatible = "mediatek,mt8183", }, +- { .compatible = "mediatek,mt8365", }, +- { .compatible = "mediatek,mt8516", }, +- ++ { .compatible = "mediatek,mt2701", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt2712", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt7622", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt7623", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8167", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8176", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8183", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8365", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8516", .data = &mt2701_platform_data }, + { } + }; + MODULE_DEVICE_TABLE(of, mtk_cpufreq_machines); +@@ -580,6 +609,7 @@ static int __init mtk_cpufreq_driver_ini + { + struct device_node *np; + const struct of_device_id *match; ++ const struct mtk_cpufreq_platform_data *data; + int err; + + np = of_find_node_by_path("/"); +@@ -592,6 +622,7 @@ static int __init mtk_cpufreq_driver_ini + pr_debug("Machine is not compatible with mtk-cpufreq\n"); + return -ENODEV; + } ++ data = match->data; + + err = platform_driver_register(&mtk_cpufreq_platdrv); + if (err) +@@ -603,7 +634,8 @@ static int __init mtk_cpufreq_driver_ini + * and the device registration codes are put here to handle defer + * probing. + */ +- cpufreq_pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0); ++ cpufreq_pdev = platform_device_register_data(NULL, "mtk-cpufreq", -1, ++ data, sizeof(*data)); + if (IS_ERR(cpufreq_pdev)) { + pr_err("failed to register mtk-cpufreq platform device\n"); + platform_driver_unregister(&mtk_cpufreq_platdrv); diff --git a/target/linux/mediatek/patches-5.15/350-10-cpufreq-mediatek-Refine-mtk_cpufreq_voltage_tracking.patch b/target/linux/mediatek/patches-5.15/350-10-cpufreq-mediatek-Refine-mtk_cpufreq_voltage_tracking.patch new file mode 100644 index 00000000000000..0ba9471ffa7128 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-10-cpufreq-mediatek-Refine-mtk_cpufreq_voltage_tracking.patch @@ -0,0 +1,255 @@ +From 944b041c91f1e1cd762c39c1222f078550149486 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Thu, 5 May 2022 19:52:20 +0800 +Subject: [PATCH 10/21] cpufreq: mediatek: Refine + mtk_cpufreq_voltage_tracking() + +Because the difference of sram and proc should in a range of min_volt_shift +and max_volt_shift. We need to adjust the sram and proc step by step. + +We replace VOLT_TOL (voltage tolerance) with the platform data and update the +logic to determine the voltage boundary and invoking regulator_set_voltage. + +- Use 'sram_min_volt' and 'sram_max_volt' to determine the voltage boundary + of sram regulator. +- Use (sram_min_volt - min_volt_shift) and 'proc_max_volt' to determine the + voltage boundary of vproc regulator. + +Moreover, to prevent infinite loop when tracking voltage, we calculate the +maximum value for each platform data. +We assume min voltage is 0 and tracking target voltage using +min_volt_shift for each iteration. +The retry_max is 3 times of expeted iteration count. + +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 147 ++++++++++------------------- + 1 file changed, 51 insertions(+), 96 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -15,8 +16,6 @@ + #include + #include + +-#define VOLT_TOL (10000) +- + struct mtk_cpufreq_platform_data { + int min_volt_shift; + int max_volt_shift; +@@ -48,6 +47,7 @@ struct mtk_cpu_dvfs_info { + bool need_voltage_tracking; + int pre_vproc; + const struct mtk_cpufreq_platform_data *soc_data; ++ int vtrack_max; + }; + + static struct platform_device *cpufreq_pdev; +@@ -73,6 +73,7 @@ static int mtk_cpufreq_voltage_tracking( + struct regulator *proc_reg = info->proc_reg; + struct regulator *sram_reg = info->sram_reg; + int pre_vproc, pre_vsram, new_vsram, vsram, vproc, ret; ++ int retry = info->vtrack_max; + + pre_vproc = regulator_get_voltage(proc_reg); + if (pre_vproc < 0) { +@@ -80,91 +81,44 @@ static int mtk_cpufreq_voltage_tracking( + "invalid Vproc value: %d\n", pre_vproc); + return pre_vproc; + } +- /* Vsram should not exceed the maximum allowed voltage of SoC. */ +- new_vsram = min(new_vproc + soc_data->min_volt_shift, +- soc_data->sram_max_volt); +- +- if (pre_vproc < new_vproc) { +- /* +- * When scaling up voltages, Vsram and Vproc scale up step +- * by step. At each step, set Vsram to (Vproc + 200mV) first, +- * then set Vproc to (Vsram - 100mV). +- * Keep doing it until Vsram and Vproc hit target voltages. +- */ +- do { +- pre_vsram = regulator_get_voltage(sram_reg); +- if (pre_vsram < 0) { +- dev_err(info->cpu_dev, +- "invalid Vsram value: %d\n", pre_vsram); +- return pre_vsram; +- } +- pre_vproc = regulator_get_voltage(proc_reg); +- if (pre_vproc < 0) { +- dev_err(info->cpu_dev, +- "invalid Vproc value: %d\n", pre_vproc); +- return pre_vproc; +- } + +- vsram = min(new_vsram, +- pre_vproc + soc_data->min_volt_shift); ++ pre_vsram = regulator_get_voltage(sram_reg); ++ if (pre_vsram < 0) { ++ dev_err(info->cpu_dev, "invalid Vsram value: %d\n", pre_vsram); ++ return pre_vsram; ++ } + +- if (vsram + VOLT_TOL >= soc_data->sram_max_volt) { +- vsram = soc_data->sram_max_volt; ++ new_vsram = clamp(new_vproc + soc_data->min_volt_shift, ++ soc_data->sram_min_volt, soc_data->sram_max_volt); ++ ++ do { ++ if (pre_vproc <= new_vproc) { ++ vsram = clamp(pre_vproc + soc_data->max_volt_shift, ++ soc_data->sram_min_volt, new_vsram); ++ ret = regulator_set_voltage(sram_reg, vsram, ++ soc_data->sram_max_volt); + +- /* +- * If the target Vsram hits the maximum voltage, +- * try to set the exact voltage value first. +- */ +- ret = regulator_set_voltage(sram_reg, vsram, +- vsram); +- if (ret) +- ret = regulator_set_voltage(sram_reg, +- vsram - VOLT_TOL, +- vsram); ++ if (ret) ++ return ret; + ++ if (vsram == soc_data->sram_max_volt || ++ new_vsram == soc_data->sram_min_volt) + vproc = new_vproc; +- } else { +- ret = regulator_set_voltage(sram_reg, vsram, +- vsram + VOLT_TOL); +- ++ else + vproc = vsram - soc_data->min_volt_shift; +- } +- if (ret) +- return ret; + + ret = regulator_set_voltage(proc_reg, vproc, +- vproc + VOLT_TOL); ++ soc_data->proc_max_volt); + if (ret) { + regulator_set_voltage(sram_reg, pre_vsram, +- pre_vsram); ++ soc_data->sram_max_volt); + return ret; + } +- } while (vproc < new_vproc || vsram < new_vsram); +- } else if (pre_vproc > new_vproc) { +- /* +- * When scaling down voltages, Vsram and Vproc scale down step +- * by step. At each step, set Vproc to (Vsram - 200mV) first, +- * then set Vproc to (Vproc + 100mV). +- * Keep doing it until Vsram and Vproc hit target voltages. +- */ +- do { +- pre_vproc = regulator_get_voltage(proc_reg); +- if (pre_vproc < 0) { +- dev_err(info->cpu_dev, +- "invalid Vproc value: %d\n", pre_vproc); +- return pre_vproc; +- } +- pre_vsram = regulator_get_voltage(sram_reg); +- if (pre_vsram < 0) { +- dev_err(info->cpu_dev, +- "invalid Vsram value: %d\n", pre_vsram); +- return pre_vsram; +- } +- ++ } else if (pre_vproc > new_vproc) { + vproc = max(new_vproc, + pre_vsram - soc_data->max_volt_shift); + ret = regulator_set_voltage(proc_reg, vproc, +- vproc + VOLT_TOL); ++ soc_data->proc_max_volt); + if (ret) + return ret; + +@@ -174,32 +128,24 @@ static int mtk_cpufreq_voltage_tracking( + vsram = max(new_vsram, + vproc + soc_data->min_volt_shift); + +- if (vsram + VOLT_TOL >= soc_data->sram_max_volt) { +- vsram = soc_data->sram_max_volt; +- +- /* +- * If the target Vsram hits the maximum voltage, +- * try to set the exact voltage value first. +- */ +- ret = regulator_set_voltage(sram_reg, vsram, +- vsram); +- if (ret) +- ret = regulator_set_voltage(sram_reg, +- vsram - VOLT_TOL, +- vsram); +- } else { +- ret = regulator_set_voltage(sram_reg, vsram, +- vsram + VOLT_TOL); +- } +- ++ ret = regulator_set_voltage(sram_reg, vsram, ++ soc_data->sram_max_volt); + if (ret) { + regulator_set_voltage(proc_reg, pre_vproc, +- pre_vproc); ++ soc_data->proc_max_volt); + return ret; + } +- } while (vproc > new_vproc + VOLT_TOL || +- vsram > new_vsram + VOLT_TOL); +- } ++ } ++ ++ pre_vproc = vproc; ++ pre_vsram = vsram; ++ ++ if (--retry < 0) { ++ dev_err(info->cpu_dev, ++ "over loop count, failed to set voltage\n"); ++ return -EINVAL; ++ } ++ } while (vproc != new_vproc || vsram != new_vsram); + + return 0; + } +@@ -261,8 +207,8 @@ static int mtk_cpufreq_set_target(struct + * If the new voltage or the intermediate voltage is higher than the + * current voltage, scale up voltage first. + */ +- target_vproc = (inter_vproc > vproc) ? inter_vproc : vproc; +- if (pre_vproc < target_vproc) { ++ target_vproc = max(inter_vproc, vproc); ++ if (pre_vproc <= target_vproc) { + ret = mtk_cpufreq_set_voltage(info, target_vproc); + if (ret) { + dev_err(cpu_dev, +@@ -417,6 +363,15 @@ static int mtk_cpu_dvfs_info_init(struct + */ + info->need_voltage_tracking = (info->sram_reg != NULL); + ++ /* ++ * We assume min voltage is 0 and tracking target voltage using ++ * min_volt_shift for each iteration. ++ * The vtrack_max is 3 times of expeted iteration count. ++ */ ++ info->vtrack_max = 3 * DIV_ROUND_UP(max(info->soc_data->sram_max_volt, ++ info->soc_data->proc_max_volt), ++ info->soc_data->min_volt_shift); ++ + return 0; + + out_disable_inter_clock: diff --git a/target/linux/mediatek/patches-5.15/350-11-cpufreq-mediatek-Add-opp-notification-support.patch b/target/linux/mediatek/patches-5.15/350-11-cpufreq-mediatek-Add-opp-notification-support.patch new file mode 100644 index 00000000000000..2cb99b907a6e2f --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-11-cpufreq-mediatek-Add-opp-notification-support.patch @@ -0,0 +1,184 @@ +From 01be227eff7e5fc01f7c8de8f6daddd5fb17ddd1 Mon Sep 17 00:00:00 2001 +From: Rex-BC Chen +Date: Thu, 5 May 2022 19:52:21 +0800 +Subject: [PATCH 11/21] cpufreq: mediatek: Add opp notification support + +From this opp notifier, cpufreq should listen to opp notification and do +proper actions when receiving events of disable and voltage adjustment. + +One of the user for this opp notifier is MediaTek SVS. +The MediaTek Smart Voltage Scaling (SVS) is a hardware which calculates +suitable SVS bank voltages to OPP voltage table. + +Signed-off-by: Andrew-sh.Cheng +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +[ Viresh: Renamed opp_freq as current_freq and moved its initialization ] +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 90 +++++++++++++++++++++++++++--- + 1 file changed, 82 insertions(+), 8 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -46,6 +46,11 @@ struct mtk_cpu_dvfs_info { + int intermediate_voltage; + bool need_voltage_tracking; + int pre_vproc; ++ /* Avoid race condition for regulators between notify and policy */ ++ struct mutex reg_lock; ++ struct notifier_block opp_nb; ++ unsigned int opp_cpu; ++ unsigned long current_freq; + const struct mtk_cpufreq_platform_data *soc_data; + int vtrack_max; + }; +@@ -182,6 +187,8 @@ static int mtk_cpufreq_set_target(struct + + pre_freq_hz = clk_get_rate(cpu_clk); + ++ mutex_lock(&info->reg_lock); ++ + if (unlikely(info->pre_vproc <= 0)) + pre_vproc = regulator_get_voltage(info->proc_reg); + else +@@ -214,7 +221,7 @@ static int mtk_cpufreq_set_target(struct + dev_err(cpu_dev, + "cpu%d: failed to scale up voltage!\n", policy->cpu); + mtk_cpufreq_set_voltage(info, pre_vproc); +- return ret; ++ goto out; + } + } + +@@ -224,8 +231,7 @@ static int mtk_cpufreq_set_target(struct + dev_err(cpu_dev, + "cpu%d: failed to re-parent cpu clock!\n", policy->cpu); + mtk_cpufreq_set_voltage(info, pre_vproc); +- WARN_ON(1); +- return ret; ++ goto out; + } + + /* Set the original PLL to target rate. */ +@@ -235,7 +241,7 @@ static int mtk_cpufreq_set_target(struct + "cpu%d: failed to scale cpu clock rate!\n", policy->cpu); + clk_set_parent(cpu_clk, armpll); + mtk_cpufreq_set_voltage(info, pre_vproc); +- return ret; ++ goto out; + } + + /* Set parent of CPU clock back to the original PLL. */ +@@ -244,8 +250,7 @@ static int mtk_cpufreq_set_target(struct + dev_err(cpu_dev, + "cpu%d: failed to re-parent cpu clock!\n", policy->cpu); + mtk_cpufreq_set_voltage(info, inter_vproc); +- WARN_ON(1); +- return ret; ++ goto out; + } + + /* +@@ -260,15 +265,72 @@ static int mtk_cpufreq_set_target(struct + clk_set_parent(cpu_clk, info->inter_clk); + clk_set_rate(armpll, pre_freq_hz); + clk_set_parent(cpu_clk, armpll); +- return ret; ++ goto out; + } + } + +- return 0; ++ info->current_freq = freq_hz; ++ ++out: ++ mutex_unlock(&info->reg_lock); ++ ++ return ret; + } + + #define DYNAMIC_POWER "dynamic-power-coefficient" + ++static int mtk_cpufreq_opp_notifier(struct notifier_block *nb, ++ unsigned long event, void *data) ++{ ++ struct dev_pm_opp *opp = data; ++ struct dev_pm_opp *new_opp; ++ struct mtk_cpu_dvfs_info *info; ++ unsigned long freq, volt; ++ struct cpufreq_policy *policy; ++ int ret = 0; ++ ++ info = container_of(nb, struct mtk_cpu_dvfs_info, opp_nb); ++ ++ if (event == OPP_EVENT_ADJUST_VOLTAGE) { ++ freq = dev_pm_opp_get_freq(opp); ++ ++ mutex_lock(&info->reg_lock); ++ if (info->current_freq == freq) { ++ volt = dev_pm_opp_get_voltage(opp); ++ ret = mtk_cpufreq_set_voltage(info, volt); ++ if (ret) ++ dev_err(info->cpu_dev, ++ "failed to scale voltage: %d\n", ret); ++ } ++ mutex_unlock(&info->reg_lock); ++ } else if (event == OPP_EVENT_DISABLE) { ++ freq = dev_pm_opp_get_freq(opp); ++ ++ /* case of current opp item is disabled */ ++ if (info->current_freq == freq) { ++ freq = 1; ++ new_opp = dev_pm_opp_find_freq_ceil(info->cpu_dev, ++ &freq); ++ if (IS_ERR(new_opp)) { ++ dev_err(info->cpu_dev, ++ "all opp items are disabled\n"); ++ ret = PTR_ERR(new_opp); ++ return notifier_from_errno(ret); ++ } ++ ++ dev_pm_opp_put(new_opp); ++ policy = cpufreq_cpu_get(info->opp_cpu); ++ if (policy) { ++ cpufreq_driver_target(policy, freq / 1000, ++ CPUFREQ_RELATION_L); ++ cpufreq_cpu_put(policy); ++ } ++ } ++ } ++ ++ return notifier_from_errno(ret); ++} ++ + static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) + { + struct device *cpu_dev; +@@ -357,6 +419,17 @@ static int mtk_cpu_dvfs_info_init(struct + info->intermediate_voltage = dev_pm_opp_get_voltage(opp); + dev_pm_opp_put(opp); + ++ mutex_init(&info->reg_lock); ++ info->current_freq = clk_get_rate(info->cpu_clk); ++ ++ info->opp_cpu = cpu; ++ info->opp_nb.notifier_call = mtk_cpufreq_opp_notifier; ++ ret = dev_pm_opp_register_notifier(cpu_dev, &info->opp_nb); ++ if (ret) { ++ dev_err(cpu_dev, "cpu%d: failed to register opp notifier\n", cpu); ++ goto out_disable_inter_clock; ++ } ++ + /* + * If SRAM regulator is present, software "voltage tracking" is needed + * for this CPU power domain. +@@ -421,6 +494,7 @@ static void mtk_cpu_dvfs_info_release(st + } + + dev_pm_opp_of_cpumask_remove_table(&info->cpus); ++ dev_pm_opp_unregister_notifier(info->cpu_dev, &info->opp_nb); + } + + static int mtk_cpufreq_init(struct cpufreq_policy *policy) diff --git a/target/linux/mediatek/patches-5.15/350-12-cpufreq-mediatek-Fix-potential-deadlock-problem-in-m.patch b/target/linux/mediatek/patches-5.15/350-12-cpufreq-mediatek-Fix-potential-deadlock-problem-in-m.patch new file mode 100644 index 00000000000000..76bd795c004afb --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-12-cpufreq-mediatek-Fix-potential-deadlock-problem-in-m.patch @@ -0,0 +1,43 @@ +From 6a1bd7cf4ed7a1948f564aaf16d34b7352c0029b Mon Sep 17 00:00:00 2001 +From: Wan Jiabing +Date: Tue, 10 May 2022 17:05:31 +0800 +Subject: [PATCH 12/21] cpufreq: mediatek: Fix potential deadlock problem in + mtk_cpufreq_set_target + +Fix following coccichek error: +./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on line +./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on line + +mutex_lock is acquired but not released before return. +Use 'goto out' to help releasing the mutex_lock. + +Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification support") +Signed-off-by: Wan Jiabing +Reviewed-by: Rex-BC Chen +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -196,7 +196,8 @@ static int mtk_cpufreq_set_target(struct + + if (pre_vproc < 0) { + dev_err(cpu_dev, "invalid Vproc value: %d\n", pre_vproc); +- return pre_vproc; ++ ret = pre_vproc; ++ goto out; + } + + freq_hz = freq_table[index].frequency * 1000; +@@ -205,7 +206,8 @@ static int mtk_cpufreq_set_target(struct + if (IS_ERR(opp)) { + dev_err(cpu_dev, "cpu%d: failed to find OPP for %ld\n", + policy->cpu, freq_hz); +- return PTR_ERR(opp); ++ ret = PTR_ERR(opp); ++ goto out; + } + vproc = dev_pm_opp_get_voltage(opp); + dev_pm_opp_put(opp); diff --git a/target/linux/mediatek/patches-5.15/350-13-cpufreq-mediatek-Link-CCI-device-to-CPU.patch b/target/linux/mediatek/patches-5.15/350-13-cpufreq-mediatek-Link-CCI-device-to-CPU.patch new file mode 100644 index 00000000000000..eeaa466c326d07 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-13-cpufreq-mediatek-Link-CCI-device-to-CPU.patch @@ -0,0 +1,188 @@ +From 15aaf74fb734a3e69b10d00b97b322711b81e222 Mon Sep 17 00:00:00 2001 +From: Rex-BC Chen +Date: Thu, 5 May 2022 19:52:22 +0800 +Subject: [PATCH 13/21] cpufreq: mediatek: Link CCI device to CPU + +In some MediaTek SoCs, like MT8183, CPU and CCI share the same power +supplies. Cpufreq needs to check if CCI devfreq exists and wait until +CCI devfreq ready before scaling frequency. + +Before CCI devfreq is ready, we record the voltage when booting to +kernel and use the max(cpu target voltage, booting voltage) to +prevent cpufreq adjust to the lower voltage which will cause the CCI +crash because of high frequency and low voltage. + +- Add is_ccifreq_ready() to link CCI device to CPI, and CPU will start + DVFS when CCI is ready. +- Add platform data for MT8183. + +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Kevin Hilman +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 82 +++++++++++++++++++++++++++++- + 1 file changed, 81 insertions(+), 1 deletion(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -22,6 +22,7 @@ struct mtk_cpufreq_platform_data { + int proc_max_volt; + int sram_min_volt; + int sram_max_volt; ++ bool ccifreq_supported; + }; + + /* +@@ -38,6 +39,7 @@ struct mtk_cpufreq_platform_data { + struct mtk_cpu_dvfs_info { + struct cpumask cpus; + struct device *cpu_dev; ++ struct device *cci_dev; + struct regulator *proc_reg; + struct regulator *sram_reg; + struct clk *cpu_clk; +@@ -45,6 +47,7 @@ struct mtk_cpu_dvfs_info { + struct list_head list_head; + int intermediate_voltage; + bool need_voltage_tracking; ++ int vproc_on_boot; + int pre_vproc; + /* Avoid race condition for regulators between notify and policy */ + struct mutex reg_lock; +@@ -53,6 +56,7 @@ struct mtk_cpu_dvfs_info { + unsigned long current_freq; + const struct mtk_cpufreq_platform_data *soc_data; + int vtrack_max; ++ bool ccifreq_bound; + }; + + static struct platform_device *cpufreq_pdev; +@@ -171,6 +175,28 @@ static int mtk_cpufreq_set_voltage(struc + return ret; + } + ++static bool is_ccifreq_ready(struct mtk_cpu_dvfs_info *info) ++{ ++ struct device_link *sup_link; ++ ++ if (info->ccifreq_bound) ++ return true; ++ ++ sup_link = device_link_add(info->cpu_dev, info->cci_dev, ++ DL_FLAG_AUTOREMOVE_CONSUMER); ++ if (!sup_link) { ++ dev_err(info->cpu_dev, "cpu%d: sup_link is NULL\n", info->opp_cpu); ++ return false; ++ } ++ ++ if (sup_link->supplier->links.status != DL_DEV_DRIVER_BOUND) ++ return false; ++ ++ info->ccifreq_bound = true; ++ ++ return true; ++} ++ + static int mtk_cpufreq_set_target(struct cpufreq_policy *policy, + unsigned int index) + { +@@ -213,6 +239,14 @@ static int mtk_cpufreq_set_target(struct + dev_pm_opp_put(opp); + + /* ++ * If MediaTek cci is supported but is not ready, we will use the value ++ * of max(target cpu voltage, booting voltage) to prevent high freqeuncy ++ * low voltage crash. ++ */ ++ if (info->soc_data->ccifreq_supported && !is_ccifreq_ready(info)) ++ vproc = max(vproc, info->vproc_on_boot); ++ ++ /* + * If the new voltage or the intermediate voltage is higher than the + * current voltage, scale up voltage first. + */ +@@ -333,6 +367,23 @@ static int mtk_cpufreq_opp_notifier(stru + return notifier_from_errno(ret); + } + ++static struct device *of_get_cci(struct device *cpu_dev) ++{ ++ struct device_node *np; ++ struct platform_device *pdev; ++ ++ np = of_parse_phandle(cpu_dev->of_node, "mediatek,cci", 0); ++ if (IS_ERR_OR_NULL(np)) ++ return NULL; ++ ++ pdev = of_find_device_by_node(np); ++ of_node_put(np); ++ if (IS_ERR_OR_NULL(pdev)) ++ return NULL; ++ ++ return &pdev->dev; ++} ++ + static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) + { + struct device *cpu_dev; +@@ -347,6 +398,16 @@ static int mtk_cpu_dvfs_info_init(struct + } + info->cpu_dev = cpu_dev; + ++ info->ccifreq_bound = false; ++ if (info->soc_data->ccifreq_supported) { ++ info->cci_dev = of_get_cci(info->cpu_dev); ++ if (IS_ERR_OR_NULL(info->cci_dev)) { ++ ret = PTR_ERR(info->cci_dev); ++ dev_err(cpu_dev, "cpu%d: failed to get cci device\n", cpu); ++ return -ENODEV; ++ } ++ } ++ + info->cpu_clk = clk_get(cpu_dev, "cpu"); + if (IS_ERR(info->cpu_clk)) { + ret = PTR_ERR(info->cpu_clk); +@@ -410,6 +471,15 @@ static int mtk_cpu_dvfs_info_init(struct + if (ret) + goto out_disable_mux_clock; + ++ if (info->soc_data->ccifreq_supported) { ++ info->vproc_on_boot = regulator_get_voltage(info->proc_reg); ++ if (info->vproc_on_boot < 0) { ++ dev_err(info->cpu_dev, ++ "invalid Vproc value: %d\n", info->vproc_on_boot); ++ goto out_disable_inter_clock; ++ } ++ } ++ + /* Search a safe voltage for intermediate frequency. */ + rate = clk_get_rate(info->inter_clk); + opp = dev_pm_opp_find_freq_ceil(cpu_dev, &rate); +@@ -617,6 +687,16 @@ static const struct mtk_cpufreq_platform + .proc_max_volt = 1150000, + .sram_min_volt = 0, + .sram_max_volt = 1150000, ++ .ccifreq_supported = false, ++}; ++ ++static const struct mtk_cpufreq_platform_data mt8183_platform_data = { ++ .min_volt_shift = 100000, ++ .max_volt_shift = 200000, ++ .proc_max_volt = 1150000, ++ .sram_min_volt = 0, ++ .sram_max_volt = 1150000, ++ .ccifreq_supported = true, + }; + + /* List of machines supported by this driver */ +@@ -629,7 +709,7 @@ static const struct of_device_id mtk_cpu + { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8176", .data = &mt2701_platform_data }, +- { .compatible = "mediatek,mt8183", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8183", .data = &mt8183_platform_data }, + { .compatible = "mediatek,mt8365", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8516", .data = &mt2701_platform_data }, + { } diff --git a/target/linux/mediatek/patches-5.15/350-14-cpufreq-mediatek-Add-support-for-MT8186.patch b/target/linux/mediatek/patches-5.15/350-14-cpufreq-mediatek-Add-support-for-MT8186.patch new file mode 100644 index 00000000000000..31000cfbe058fa --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-14-cpufreq-mediatek-Add-support-for-MT8186.patch @@ -0,0 +1,42 @@ +From b6be0baa6615afc65c3963adab674e36af1d4d5f Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Thu, 5 May 2022 19:52:23 +0800 +Subject: [PATCH 14/21] cpufreq: mediatek: Add support for MT8186 + +The platform data of MT8186 is different from previous MediaTek SoCs, +so we add a new compatible and platform data for it. + +Signed-off-by: Jia-Wei Chang +Signed-off-by: Rex-BC Chen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -699,6 +699,15 @@ static const struct mtk_cpufreq_platform + .ccifreq_supported = true, + }; + ++static const struct mtk_cpufreq_platform_data mt8186_platform_data = { ++ .min_volt_shift = 100000, ++ .max_volt_shift = 250000, ++ .proc_max_volt = 1118750, ++ .sram_min_volt = 850000, ++ .sram_max_volt = 1118750, ++ .ccifreq_supported = true, ++}; ++ + /* List of machines supported by this driver */ + static const struct of_device_id mtk_cpufreq_machines[] __initconst = { + { .compatible = "mediatek,mt2701", .data = &mt2701_platform_data }, +@@ -710,6 +719,7 @@ static const struct of_device_id mtk_cpu + { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8176", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8183", .data = &mt8183_platform_data }, ++ { .compatible = "mediatek,mt8186", .data = &mt8186_platform_data }, + { .compatible = "mediatek,mt8365", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8516", .data = &mt2701_platform_data }, + { } diff --git a/target/linux/mediatek/patches-5.15/350-15-cpufreq-mediatek-Handle-sram-regulator-probe-deferra.patch b/target/linux/mediatek/patches-5.15/350-15-cpufreq-mediatek-Handle-sram-regulator-probe-deferra.patch new file mode 100644 index 00000000000000..c0137894c93413 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-15-cpufreq-mediatek-Handle-sram-regulator-probe-deferra.patch @@ -0,0 +1,35 @@ +From 75d19b24aa3203d6c78e4c431c2cc07157ce12fe Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Wed, 13 Jul 2022 13:15:36 +0200 +Subject: [PATCH 15/21] cpufreq: mediatek: Handle sram regulator probe deferral + +If the regulator_get_optional() call for the SRAM regulator returns +a probe deferral, we must bail out and retry probing later: failing +to do this will produce unstabilities on platforms requiring the +handling for this regulator. + +Fixes: ffa7bdf7f344 ("cpufreq: mediatek: Make sram regulator optional") +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -439,9 +439,13 @@ static int mtk_cpu_dvfs_info_init(struct + + /* Both presence and absence of sram regulator are valid cases. */ + info->sram_reg = regulator_get_optional(cpu_dev, "sram"); +- if (IS_ERR(info->sram_reg)) ++ if (IS_ERR(info->sram_reg)) { ++ ret = PTR_ERR(info->sram_reg); ++ if (ret == -EPROBE_DEFER) ++ goto out_free_resources; ++ + info->sram_reg = NULL; +- else { ++ } else { + ret = regulator_enable(info->sram_reg); + if (ret) { + dev_warn(cpu_dev, "cpu%d: failed to enable vsram\n", cpu); diff --git a/target/linux/mediatek/patches-5.15/350-16-cpufreq-mediatek-fix-error-return-code-in-mtk_cpu_dv.patch b/target/linux/mediatek/patches-5.15/350-16-cpufreq-mediatek-fix-error-return-code-in-mtk_cpu_dv.patch new file mode 100644 index 00000000000000..45c4477ff1ab1f --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-16-cpufreq-mediatek-fix-error-return-code-in-mtk_cpu_dv.patch @@ -0,0 +1,29 @@ +From dd1174c21dacacd6c0129c1dabc5decad35c02c2 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Tue, 17 May 2022 21:34:50 +0800 +Subject: [PATCH 16/21] cpufreq: mediatek: fix error return code in + mtk_cpu_dvfs_info_init() + +If regulator_get_voltage() fails, it should return the error code in +mtk_cpu_dvfs_info_init(). + +Fixes: 0daa47325bae ("cpufreq: mediatek: Link CCI device to CPU") +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Rex-BC Chen +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -478,6 +478,7 @@ static int mtk_cpu_dvfs_info_init(struct + if (info->soc_data->ccifreq_supported) { + info->vproc_on_boot = regulator_get_voltage(info->proc_reg); + if (info->vproc_on_boot < 0) { ++ ret = info->vproc_on_boot; + dev_err(info->cpu_dev, + "invalid Vproc value: %d\n", info->vproc_on_boot); + goto out_disable_inter_clock; diff --git a/target/linux/mediatek/patches-5.15/350-17-cpufreq-mediatek-fix-passing-zero-to-PTR_ERR.patch b/target/linux/mediatek/patches-5.15/350-17-cpufreq-mediatek-fix-passing-zero-to-PTR_ERR.patch new file mode 100644 index 00000000000000..557d02b822b3a9 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-17-cpufreq-mediatek-fix-passing-zero-to-PTR_ERR.patch @@ -0,0 +1,47 @@ +From 230a74d459244411db91bfd678f17fcf7aedfcd0 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 24 Mar 2023 18:11:27 +0800 +Subject: [PATCH 17/21] cpufreq: mediatek: fix passing zero to 'PTR_ERR' + +In order to prevent passing zero to 'PTR_ERR' in +mtk_cpu_dvfs_info_init(), we fix the return value of of_get_cci() using +error pointer by explicitly casting error number. + +Signed-off-by: Jia-Wei Chang +Fixes: 0daa47325bae ("cpufreq: mediatek: Link CCI device to CPU") +Reported-by: Dan Carpenter +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -373,13 +373,13 @@ static struct device *of_get_cci(struct + struct platform_device *pdev; + + np = of_parse_phandle(cpu_dev->of_node, "mediatek,cci", 0); +- if (IS_ERR_OR_NULL(np)) +- return NULL; ++ if (!np) ++ return ERR_PTR(-ENODEV); + + pdev = of_find_device_by_node(np); + of_node_put(np); +- if (IS_ERR_OR_NULL(pdev)) +- return NULL; ++ if (!pdev) ++ return ERR_PTR(-ENODEV); + + return &pdev->dev; + } +@@ -401,7 +401,7 @@ static int mtk_cpu_dvfs_info_init(struct + info->ccifreq_bound = false; + if (info->soc_data->ccifreq_supported) { + info->cci_dev = of_get_cci(info->cpu_dev); +- if (IS_ERR_OR_NULL(info->cci_dev)) { ++ if (IS_ERR(info->cci_dev)) { + ret = PTR_ERR(info->cci_dev); + dev_err(cpu_dev, "cpu%d: failed to get cci device\n", cpu); + return -ENODEV; diff --git a/target/linux/mediatek/patches-5.15/350-18-cpufreq-mediatek-fix-KP-caused-by-handler-usage-afte.patch b/target/linux/mediatek/patches-5.15/350-18-cpufreq-mediatek-fix-KP-caused-by-handler-usage-afte.patch new file mode 100644 index 00000000000000..61531d38ad2910 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-18-cpufreq-mediatek-fix-KP-caused-by-handler-usage-afte.patch @@ -0,0 +1,149 @@ +From fced531b7c7e18192e7982637c8e8f20c29aad64 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 24 Mar 2023 18:11:28 +0800 +Subject: [PATCH 18/21] cpufreq: mediatek: fix KP caused by handler usage after + regulator_put/clk_put + +Any kind of failure in mtk_cpu_dvfs_info_init() will lead to calling +regulator_put() or clk_put() and the KP will occur since the regulator/clk +handlers are used after released in mtk_cpu_dvfs_info_release(). + +To prevent the usage after regulator_put()/clk_put(), the regulator/clk +handlers are addressed in a way of "Free the Last Thing Style". + +Signed-off-by: Jia-Wei Chang +Fixes: 4b9ceb757bbb ("cpufreq: mediatek: Enable clocks and regulators") +Suggested-by: AngeloGioacchino Del Regno +Suggested-by: Dan Carpenter +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 62 +++++++++++++++--------------- + 1 file changed, 30 insertions(+), 32 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -420,7 +420,7 @@ static int mtk_cpu_dvfs_info_init(struct + ret = PTR_ERR(info->inter_clk); + dev_err_probe(cpu_dev, ret, + "cpu%d: failed to get intermediate clk\n", cpu); +- goto out_free_resources; ++ goto out_free_mux_clock; + } + + info->proc_reg = regulator_get_optional(cpu_dev, "proc"); +@@ -428,13 +428,13 @@ static int mtk_cpu_dvfs_info_init(struct + ret = PTR_ERR(info->proc_reg); + dev_err_probe(cpu_dev, ret, + "cpu%d: failed to get proc regulator\n", cpu); +- goto out_free_resources; ++ goto out_free_inter_clock; + } + + ret = regulator_enable(info->proc_reg); + if (ret) { + dev_warn(cpu_dev, "cpu%d: failed to enable vproc\n", cpu); +- goto out_free_resources; ++ goto out_free_proc_reg; + } + + /* Both presence and absence of sram regulator are valid cases. */ +@@ -442,14 +442,14 @@ static int mtk_cpu_dvfs_info_init(struct + if (IS_ERR(info->sram_reg)) { + ret = PTR_ERR(info->sram_reg); + if (ret == -EPROBE_DEFER) +- goto out_free_resources; ++ goto out_disable_proc_reg; + + info->sram_reg = NULL; + } else { + ret = regulator_enable(info->sram_reg); + if (ret) { + dev_warn(cpu_dev, "cpu%d: failed to enable vsram\n", cpu); +- goto out_free_resources; ++ goto out_free_sram_reg; + } + } + +@@ -458,13 +458,13 @@ static int mtk_cpu_dvfs_info_init(struct + if (ret) { + dev_err(cpu_dev, + "cpu%d: failed to get OPP-sharing information\n", cpu); +- goto out_free_resources; ++ goto out_disable_sram_reg; + } + + ret = dev_pm_opp_of_cpumask_add_table(&info->cpus); + if (ret) { + dev_warn(cpu_dev, "cpu%d: no OPP table\n", cpu); +- goto out_free_resources; ++ goto out_disable_sram_reg; + } + + ret = clk_prepare_enable(info->cpu_clk); +@@ -533,43 +533,41 @@ out_disable_mux_clock: + out_free_opp_table: + dev_pm_opp_of_cpumask_remove_table(&info->cpus); + +-out_free_resources: +- if (regulator_is_enabled(info->proc_reg)) +- regulator_disable(info->proc_reg); +- if (info->sram_reg && regulator_is_enabled(info->sram_reg)) ++out_disable_sram_reg: ++ if (info->sram_reg) + regulator_disable(info->sram_reg); + +- if (!IS_ERR(info->proc_reg)) +- regulator_put(info->proc_reg); +- if (!IS_ERR(info->sram_reg)) ++out_free_sram_reg: ++ if (info->sram_reg) + regulator_put(info->sram_reg); +- if (!IS_ERR(info->cpu_clk)) +- clk_put(info->cpu_clk); +- if (!IS_ERR(info->inter_clk)) +- clk_put(info->inter_clk); ++ ++out_disable_proc_reg: ++ regulator_disable(info->proc_reg); ++ ++out_free_proc_reg: ++ regulator_put(info->proc_reg); ++ ++out_free_inter_clock: ++ clk_put(info->inter_clk); ++ ++out_free_mux_clock: ++ clk_put(info->cpu_clk); + + return ret; + } + + static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info) + { +- if (!IS_ERR(info->proc_reg)) { +- regulator_disable(info->proc_reg); +- regulator_put(info->proc_reg); +- } +- if (!IS_ERR(info->sram_reg)) { ++ regulator_disable(info->proc_reg); ++ regulator_put(info->proc_reg); ++ if (info->sram_reg) { + regulator_disable(info->sram_reg); + regulator_put(info->sram_reg); + } +- if (!IS_ERR(info->cpu_clk)) { +- clk_disable_unprepare(info->cpu_clk); +- clk_put(info->cpu_clk); +- } +- if (!IS_ERR(info->inter_clk)) { +- clk_disable_unprepare(info->inter_clk); +- clk_put(info->inter_clk); +- } +- ++ clk_disable_unprepare(info->cpu_clk); ++ clk_put(info->cpu_clk); ++ clk_disable_unprepare(info->inter_clk); ++ clk_put(info->inter_clk); + dev_pm_opp_of_cpumask_remove_table(&info->cpus); + dev_pm_opp_unregister_notifier(info->cpu_dev, &info->opp_nb); + } diff --git a/target/linux/mediatek/patches-5.15/350-19-cpufreq-mediatek-raise-proc-sram-max-voltage-for-MT8.patch b/target/linux/mediatek/patches-5.15/350-19-cpufreq-mediatek-raise-proc-sram-max-voltage-for-MT8.patch new file mode 100644 index 00000000000000..2b7d229f1c5d47 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-19-cpufreq-mediatek-raise-proc-sram-max-voltage-for-MT8.patch @@ -0,0 +1,55 @@ +From 24bc42a2d44cb821818717a5c607270921ec5d20 Mon Sep 17 00:00:00 2001 +From: Jia-Wei Chang +Date: Fri, 24 Mar 2023 18:11:29 +0800 +Subject: [PATCH 19/21] cpufreq: mediatek: raise proc/sram max voltage for + MT8516 + +Since the upper boundary of proc/sram voltage of MT8516 is 1300 mV, +which is greater than the value of MT2701 1150 mV, we fix it by adding +the corresponding platform data and specify proc/sram_max_volt to +support MT8516. + +Signed-off-by: Jia-Wei Chang +Fixes: ead858bd128d ("cpufreq: mediatek: Move voltage limits to platform data") +Fixes: 6a17b3876bc8 ("cpufreq: mediatek: Refine mtk_cpufreq_voltage_tracking()") +Reported-by: Nick Hainke +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -711,20 +711,29 @@ static const struct mtk_cpufreq_platform + .ccifreq_supported = true, + }; + ++static const struct mtk_cpufreq_platform_data mt8516_platform_data = { ++ .min_volt_shift = 100000, ++ .max_volt_shift = 200000, ++ .proc_max_volt = 1310000, ++ .sram_min_volt = 0, ++ .sram_max_volt = 1310000, ++ .ccifreq_supported = false, ++}; ++ + /* List of machines supported by this driver */ + static const struct of_device_id mtk_cpufreq_machines[] __initconst = { + { .compatible = "mediatek,mt2701", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt2712", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt7622", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt7623", .data = &mt2701_platform_data }, +- { .compatible = "mediatek,mt8167", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8167", .data = &mt8516_platform_data }, + { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8176", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8183", .data = &mt8183_platform_data }, + { .compatible = "mediatek,mt8186", .data = &mt8186_platform_data }, + { .compatible = "mediatek,mt8365", .data = &mt2701_platform_data }, +- { .compatible = "mediatek,mt8516", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt8516", .data = &mt8516_platform_data }, + { } + }; + MODULE_DEVICE_TABLE(of, mtk_cpufreq_machines); diff --git a/target/linux/mediatek/patches-5.15/350-20-cpufreq-mediatek-Raise-proc-and-sram-max-voltage-for.patch b/target/linux/mediatek/patches-5.15/350-20-cpufreq-mediatek-Raise-proc-and-sram-max-voltage-for.patch new file mode 100644 index 00000000000000..2de8eb6394ca2d --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-20-cpufreq-mediatek-Raise-proc-and-sram-max-voltage-for.patch @@ -0,0 +1,58 @@ +From fe6ef09358dc0cfead9d383a8676fbe7a40fcef7 Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Fri, 24 Mar 2023 18:11:30 +0800 +Subject: [PATCH 20/21] cpufreq: mediatek: Raise proc and sram max voltage for + MT7622/7623 + +During the addition of SRAM voltage tracking for CCI scaling, this +driver got some voltage limits set for the vtrack algorithm: these +were moved to platform data first, then enforced in a later commit +6a17b3876bc8 ("cpufreq: mediatek: Refine mtk_cpufreq_voltage_tracking()") +using these as max values for the regulator_set_voltage() calls. + +In this case, the vsram/vproc constraints for MT7622 and MT7623 +were supposed to be the same as MT2701 (and a number of other SoCs), +but that turned out to be a mistake because the aforementioned two +SoCs' maximum voltage for both VPROC and VPROC_SRAM is 1.36V. + +Fix that by adding new platform data for MT7622/7623 declaring the +right {proc,sram}_max_volt parameter. + +Fixes: ead858bd128d ("cpufreq: mediatek: Move voltage limits to platform data") +Fixes: 6a17b3876bc8 ("cpufreq: mediatek: Refine mtk_cpufreq_voltage_tracking()") +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Jia-Wei Chang +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/mediatek-cpufreq.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -693,6 +693,15 @@ static const struct mtk_cpufreq_platform + .ccifreq_supported = false, + }; + ++static const struct mtk_cpufreq_platform_data mt7622_platform_data = { ++ .min_volt_shift = 100000, ++ .max_volt_shift = 200000, ++ .proc_max_volt = 1360000, ++ .sram_min_volt = 0, ++ .sram_max_volt = 1360000, ++ .ccifreq_supported = false, ++}; ++ + static const struct mtk_cpufreq_platform_data mt8183_platform_data = { + .min_volt_shift = 100000, + .max_volt_shift = 200000, +@@ -724,8 +733,8 @@ static const struct mtk_cpufreq_platform + static const struct of_device_id mtk_cpufreq_machines[] __initconst = { + { .compatible = "mediatek,mt2701", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt2712", .data = &mt2701_platform_data }, +- { .compatible = "mediatek,mt7622", .data = &mt2701_platform_data }, +- { .compatible = "mediatek,mt7623", .data = &mt2701_platform_data }, ++ { .compatible = "mediatek,mt7622", .data = &mt7622_platform_data }, ++ { .compatible = "mediatek,mt7623", .data = &mt7622_platform_data }, + { .compatible = "mediatek,mt8167", .data = &mt8516_platform_data }, + { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data }, diff --git a/target/linux/mediatek/patches-5.15/350-21-cpufreq-mediatek-Add-support-for-MT7988.patch b/target/linux/mediatek/patches-5.15/350-21-cpufreq-mediatek-Add-support-for-MT7988.patch new file mode 100644 index 00000000000000..6acd3d607fbb3b --- /dev/null +++ b/target/linux/mediatek/patches-5.15/350-21-cpufreq-mediatek-Add-support-for-MT7988.patch @@ -0,0 +1,41 @@ +From 4983a1517e7ddbc6f53fc07607e4ebeb51412843 Mon Sep 17 00:00:00 2001 +From: Sam Shih +Date: Tue, 28 Feb 2023 19:59:22 +0800 +Subject: [PATCH 21/21] cpufreq: mediatek: Add support for MT7988 + +This add cpufreq support for mediatek MT7988 SoC. + +The platform data of MT7988 is different from previous MediaTek SoCs, +so we add a new compatible and platform data for it. + +Signed-off-by: Sam Shih +--- + drivers/cpufreq/mediatek-cpufreq.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -702,6 +702,15 @@ static const struct mtk_cpufreq_platform + .ccifreq_supported = false, + }; + ++static const struct mtk_cpufreq_platform_data mt7988_platform_data = { ++ .min_volt_shift = 100000, ++ .max_volt_shift = 200000, ++ .proc_max_volt = 900000, ++ .sram_min_volt = 0, ++ .sram_max_volt = 1150000, ++ .ccifreq_supported = true, ++}; ++ + static const struct mtk_cpufreq_platform_data mt8183_platform_data = { + .min_volt_shift = 100000, + .max_volt_shift = 200000, +@@ -735,6 +744,7 @@ static const struct of_device_id mtk_cpu + { .compatible = "mediatek,mt2712", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt7622", .data = &mt7622_platform_data }, + { .compatible = "mediatek,mt7623", .data = &mt7622_platform_data }, ++ { .compatible = "mediatek,mt7988", .data = &mt7988_platform_data }, + { .compatible = "mediatek,mt8167", .data = &mt8516_platform_data }, + { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data }, diff --git a/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch b/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch new file mode 100644 index 00000000000000..a7a4bd8ea2bba9 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch @@ -0,0 +1,29 @@ +From 20aad28ba5d62f1618408c264384d0b2ad7417db Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 22 May 2023 23:25:48 +0100 +Subject: [PATCH] cpufreq: mediatek: don't request unsupported voltage + +PMICs on MT7622 and MT7623 boards only support up to 1350000uV despite +the SoC's processor and SRAM voltage can be up to 1360000uV. As a +work-around specify max. processor and SRAM voltage as 1350000uV to +avoid requesting an unsupported voltage from the regulator. + +Signed-off-by: Daniel Golle +--- + drivers/cpufreq/mediatek-cpufreq.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -696,9 +696,9 @@ static const struct mtk_cpufreq_platform + static const struct mtk_cpufreq_platform_data mt7622_platform_data = { + .min_volt_shift = 100000, + .max_volt_shift = 200000, +- .proc_max_volt = 1360000, ++ .proc_max_volt = 1350000, + .sram_min_volt = 0, +- .sram_max_volt = 1360000, ++ .sram_max_volt = 1350000, + .ccifreq_supported = false, + }; + From e458cfc214778fe081e20c1719f0da35fcfd9563 Mon Sep 17 00:00:00 2001 From: Sam Shih Date: Sun, 19 Feb 2023 10:18:36 +0800 Subject: [PATCH 0033/1171] mediatek: add basic mt7988 device tree support This add basic device tree support for mediatek MT7988 SoC Signed-off-by: Sam Shih Signed-off-by: Daniel Golle (cherry picked from commit e3a681bab4b2c193704e76b8a6091e57f0fab14e) --- .../mediatek/mt7988a-dsa-10g-spim-nand.dts | 200 ++++ .../dts/mediatek/mt7988a-rfb-spim-nand.dtsi | 70 ++ .../arm64/boot/dts/mediatek/mt7988a-rfb.dtsi | 175 ++++ .../arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 853 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 + target/linux/mediatek/filogic/config-5.15 | 1 + target/linux/mediatek/image/filogic.mk | 18 + 7 files changed, 1320 insertions(+) create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dtsi create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts new file mode 100644 index 00000000000000..98dbf8d6913ff1 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts @@ -0,0 +1,200 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +#include "mt7988a-rfb-spim-nand.dtsi" +#include + +/ { + model = "MediaTek MT7988A DSA 10G SPIM-NAND RFB"; + compatible = "mediatek,mt7988a-dsa-10g-spim-snand", + "mediatek,mt7988a-rfb-snand", + "mediatek,mt7988"; + + chosen { + bootargs = "console=ttyS0,115200n1 loglevel=8 \ + earlycon=uart8250,mmio32,0x11000000 \ + pci=pcie_bus_perf"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +ð { + pinctrl-0 = <&mdio0_pins>; + pinctrl-names = "default"; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "internal"; + + fixed-link { + speed = <10000>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "internal"; + phy-connection-type = "internal"; + phy = <&phy15>; + }; + + gmac2: mac@2 { + compatible = "mediatek,eth-mac"; + reg = <2>; + phy-mode = "10gbase-kr"; + phy-connection-type = "10gbase-kr"; + phy = <&phy8>; + }; + + mdio0: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + /* external Aquantia AQR113C */ + phy0: ethernet-phy@0 { + reg = <0>; + compatible = "ethernet-phy-ieee802.3-c45"; + reset-gpios = <&pio 72 1>; + reset-assert-us = <100000>; + reset-deassert-us = <221000>; + }; + + /* external Aquantia AQR113C */ + phy8: ethernet-phy@8 { + reg = <8>; + compatible = "ethernet-phy-ieee802.3-c45"; + reset-gpios = <&pio 71 1>; + reset-assert-us = <100000>; + reset-deassert-us = <221000>; + }; + + /* external Maxlinear GPY211C */ + phy5: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + }; + + /* external Maxlinear GPY211C */ + phy13: ethernet-phy@13 { + reg = <13>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + }; + + /* internal 2.5G PHY */ + phy15: ethernet-phy@15 { + reg = <15>; + pinctrl-names = "i2p5gbe-led"; + pinctrl-0 = <&i2p5gbe_led0_pins>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "internal"; + }; + }; +}; + +&switch { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan0"; + phy-mode = "internal"; + phy-handle = <&gsw_phy0>; + }; + + port@1 { + reg = <1>; + label = "lan1"; + phy-mode = "internal"; + phy-handle = <&gsw_phy1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-mode = "internal"; + phy-handle = <&gsw_phy2>; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&gsw_phy3>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "internal"; + + fixed-link { + speed = <10000>; + full-duplex; + pause; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + gsw_phy0: ethernet-phy@0 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <0>; + phy-mode = "internal"; + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe0_led0_pins>; + nvmem-cells = <&phy_calibration_p0>; + nvmem-cell-names = "phy-cal-data"; + }; + + gsw_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <1>; + phy-mode = "internal"; + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe1_led0_pins>; + nvmem-cells = <&phy_calibration_p1>; + nvmem-cell-names = "phy-cal-data"; + }; + + gsw_phy2: ethernet-phy@2 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <2>; + phy-mode = "internal"; + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe2_led0_pins>; + nvmem-cells = <&phy_calibration_p2>; + nvmem-cell-names = "phy-cal-data"; + }; + + gsw_phy3: ethernet-phy@3 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <3>; + phy-mode = "internal"; + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe3_led0_pins>; + nvmem-cells = <&phy_calibration_p3>; + nvmem-cell-names = "phy-cal-data"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi new file mode 100644 index 00000000000000..e4c05712509ee4 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +#include "mt7988a-rfb.dtsi" + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: spi_nand@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + }; + +}; + +&spi_nand { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0400000>; + }; + + partition@580000 { + label = "FIP"; + reg = <0x580000 0x0200000>; + }; + + partition@780000 { + label = "ubi"; + reg = <0x780000 0x7080000>; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dtsi new file mode 100644 index 00000000000000..423b3860c6c64e --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dtsi @@ -0,0 +1,175 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +#include "mt7988a.dtsi" +#include + +&cpu0 { + proc-supply = <&rt5190_buck3>; +}; + +&cpu1 { + proc-supply = <&rt5190_buck3>; +}; + +&cpu2 { + proc-supply = <&rt5190_buck3>; +}; + +&cpu3 { + proc-supply = <&rt5190_buck3>; +}; + +&cci { + proc-supply = <&rt5190_buck3>; +}; + +ð { + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; + + rt5190a_64: rt5190a@64 { + compatible = "richtek,rt5190a"; + reg = <0x64>; + /*interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;*/ + vin2-supply = <&rt5190_buck1>; + vin3-supply = <&rt5190_buck1>; + vin4-supply = <&rt5190_buck1>; + + regulators { + rt5190_buck1: buck1 { + regulator-name = "rt5190a-buck1"; + regulator-min-microvolt = <5090000>; + regulator-max-microvolt = <5090000>; + regulator-allowed-modes = + ; + regulator-boot-on; + regulator-always-on; + }; + buck2 { + regulator-name = "vcore"; + regulator-min-microvolt = <600000>; + regulator-max-microvolt = <1400000>; + regulator-boot-on; + regulator-always-on; + }; + rt5190_buck3: buck3 { + regulator-name = "vproc"; + regulator-min-microvolt = <600000>; + regulator-max-microvolt = <1400000>; + regulator-boot-on; + }; + buck4 { + regulator-name = "rt5190a-buck4"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-allowed-modes = + ; + regulator-boot-on; + regulator-always-on; + }; + ldo { + regulator-name = "rt5190a-ldo"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-boot-on; + regulator-always-on; + }; + }; + }; +}; + +&pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; +}; + +&pcie1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie1_pins>; + status = "okay"; +}; + +&pcie2 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_pins>; + status = "disabled"; +}; + +&pcie3 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie3_pins>; + status = "okay"; +}; + +&ssusb0 { + status = "okay"; +}; + +&ssusb1 { + status = "okay"; +}; + +&tphy { + status = "okay"; +}; + +&pio { + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0", + "pcie_wake_n0_0"; + }; + }; + + pcie1_pins: pcie1-pins { + mux { + function = "pcie"; + groups = "pcie_2l_1_pereset", "pcie_clk_req_n1", + "pcie_wake_n1_0"; + }; + }; + + pcie2_pins: pcie2-pins { + mux { + function = "pcie"; + groups = "pcie_1l_0_pereset", "pcie_clk_req_n2_0", + "pcie_wake_n2_0"; + }; + }; + + pcie3_pins: pcie3-pins { + mux { + function = "pcie"; + groups = "pcie_1l_1_pereset", "pcie_clk_req_n3", + "pcie_wake_n3_0"; + }; + }; +}; + +&spi0 { + status = "disabled"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&xphy { + status = "okay"; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi new file mode 100644 index 00000000000000..13ad39500d1b93 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi @@ -0,0 +1,853 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2023 MediaTek Inc. + * Author: Sam.Shih + */ + +#include +#include +#include +#include +#include +#include +#include + +/ { + compatible = "mediatek,mt7988"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + clk40m: oscillator@0 { + compatible = "fixed-clock"; + clock-frequency = <40000000>; + #clock-cells = <0>; + clock-output-names = "clkxtal"; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + enable-method = "psci"; + reg = <0x0>; + clocks = <&mcusys CLK_MCU_ARM_DIV_SEL>, + <&topckgen CLK_TOP_XTAL>; + clock-names = "cpu", "intermediate"; + operating-points-v2 = <&cluster0_opp>; + mediatek,cci = <&cci>; + }; + + cpu1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + enable-method = "psci"; + reg = <0x1>; + clocks = <&mcusys CLK_MCU_ARM_DIV_SEL>, + <&topckgen CLK_TOP_XTAL>; + clock-names = "cpu", "intermediate"; + operating-points-v2 = <&cluster0_opp>; + mediatek,cci = <&cci>; + }; + + cpu2: cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + enable-method = "psci"; + reg = <0x2>; + clocks = <&mcusys CLK_MCU_ARM_DIV_SEL>, + <&topckgen CLK_TOP_XTAL>; + clock-names = "cpu", "intermediate"; + operating-points-v2 = <&cluster0_opp>; + mediatek,cci = <&cci>; + }; + + cpu3: cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + enable-method = "psci"; + reg = <0x3>; + clocks = <&mcusys CLK_MCU_ARM_DIV_SEL>, + <&topckgen CLK_TOP_XTAL>; + clock-names = "cpu", "intermediate"; + operating-points-v2 = <&cluster0_opp>; + mediatek,cci = <&cci>; + }; + + cluster0_opp: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + opp00 { + opp-hz = /bits/ 64 <800000000>; + opp-microvolt = <850000>; + }; + opp01 { + opp-hz = /bits/ 64 <1100000000>; + opp-microvolt = <850000>; + }; + opp02 { + opp-hz = /bits/ 64 <1500000000>; + opp-microvolt = <850000>; + }; + opp03 { + opp-hz = /bits/ 64 <1800000000>; + opp-microvolt = <900000>; + }; + }; + }; + + cci: cci { + compatible = "mediatek,mt7988-cci", + "mediatek,mt8183-cci"; + clocks = <&mcusys CLK_MCU_BUS_DIV_SEL>, + <&topckgen CLK_TOP_XTAL>; + clock-names = "cci", "intermediate"; + operating-points-v2 = <&cci_opp>; + }; + + cci_opp: opp_table_cci { + compatible = "operating-points-v2"; + opp-shared; + opp00 { + opp-hz = /bits/ 64 <480000000>; + opp-microvolt = <850000>; + }; + opp01 { + opp-hz = /bits/ 64 <660000000>; + opp-microvolt = <850000>; + }; + opp02 { + opp-hz = /bits/ 64 <900000000>; + opp-microvolt = <850000>; + }; + opp03 { + opp-hz = /bits/ 64 <1080000000>; + opp-microvolt = <900000>; + }; + }; + + pmu { + compatible = "arm,cortex-a73-pmu"; + interrupt-parent = <&gic>; + interrupt = ; + }; + + psci { + compatible = "arm,psci-0.2"; + method = "smc"; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ + secmon_reserved: secmon@43000000 { + reg = <0 0x43000000 0 0x30000>; + no-map; + }; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupt-parent = <&gic>; + interrupts = , + , + , + ; + }; + + soc { + #address-cells = <2>; + #size-cells = <2>; + compatible = "simple-bus"; + ranges; + + gic: interrupt-controller@c000000 { + compatible = "arm,gic-v3"; + #interrupt-cells = <3>; + interrupt-parent = <&gic>; + interrupt-controller; + reg = <0 0x0c000000 0 0x40000>, /* GICD */ + <0 0x0c080000 0 0x200000>, /* GICR */ + <0 0x0c400000 0 0x2000>, /* GICC */ + <0 0x0c410000 0 0x1000>, /* GICH */ + <0 0x0c420000 0 0x2000>; /* GICV */ + + interrupts = ; + }; + + phyfw: phy-firmware@f000000 { + compatible = "mediatek,2p5gphy-fw"; + reg = <0 0x0f000000 0 0x8000>, + <0 0x0f100000 0 0x20000>, + <0 0x0f0f0000 0 0x200>; + }; + + infracfg: infracfg@10001000 { + compatible = "mediatek,mt7988-infracfg", "syscon"; + reg = <0 0x10001000 0 0x1000>; + #clock-cells = <1>; + }; + + topckgen: topckgen@1001b000 { + compatible = "mediatek,mt7988-topckgen", "syscon"; + reg = <0 0x1001b000 0 0x1000>; + #clock-cells = <1>; + }; + + watchdog: watchdog@1001c000 { + compatible = "mediatek,mt7988-wdt", + "mediatek,mt6589-wdt", + "syscon"; + reg = <0 0x1001c000 0 0x1000>; + interrupts = ; + #reset-cells = <1>; + }; + + apmixedsys: apmixedsys@1001e000 { + compatible = "mediatek,mt7988-apmixedsys"; + reg = <0 0x1001e000 0 0x1000>; + #clock-cells = <1>; + }; + + pio: pinctrl@1001f000 { + compatible = "mediatek,mt7988-pinctrl"; + reg = <0 0x1001f000 0 0x1000>, + <0 0x11c10000 0 0x1000>, + <0 0x11d00000 0 0x1000>, + <0 0x11d20000 0 0x1000>, + <0 0x11e00000 0 0x1000>, + <0 0x11f00000 0 0x1000>, + <0 0x1000b000 0 0x1000>; + reg-names = "gpio_base", "iocfg_tr_base", + "iocfg_br_base", "iocfg_rb_base", + "iocfg_lb_base", "iocfg_tl_base", "eint"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pio 0 0 83>; + interrupt-controller; + interrupts = ; + interrupt-parent = <&gic>; + #interrupt-cells = <2>; + + mdio0_pins: mdio0-pins { + mux { + function = "eth"; + groups = "mdc_mdio0"; + }; + + conf { + groups = "mdc_mdio0"; + drive-strength = ; + }; + }; + + i2c0_pins: i2c0-pins-g0 { + mux { + function = "i2c"; + groups = "i2c0_1"; + }; + }; + + i2c1_pins: i2c1-pins-g0 { + mux { + function = "i2c"; + groups = "i2c1_0"; + }; + }; + + i2c2_pins: i2c2-pins-g0 { + mux { + function = "i2c"; + groups = "i2c2_1"; + }; + }; + + gbe0_led0_pins: gbe0-pins { + mux { + function = "led"; + groups = "gbe0_led0"; + }; + }; + + gbe1_led0_pins: gbe1-pins { + mux { + function = "led"; + groups = "gbe1_led0"; + }; + }; + + gbe2_led0_pins: gbe2-pins { + mux { + function = "led"; + groups = "gbe2_led0"; + }; + }; + + gbe3_led0_pins: gbe3-pins { + mux { + function = "led"; + groups = "gbe3_led0"; + }; + }; + + i2p5gbe_led0_pins: 2p5gbe-pins { + mux { + function = "led"; + groups = "2p5gbe_led0"; + }; + }; + }; + + boottrap: boottrap@1001f6f0 { + compatible = "mediatek,boottrap"; + reg = <0 0x1001f6f0 0 0x4>; + }; + + sgmiisys0: syscon@10060000 { + compatible = "mediatek,mt7988-sgmiisys", + "mediatek,mt7988-sgmiisys_0", + "syscon"; + reg = <0 0x10060000 0 0x1000>; + #clock-cells = <1>; + }; + + sgmiisys1: syscon@10070000 { + compatible = "mediatek,mt7988-sgmiisys", + "mediatek,mt7988-sgmiisys_1", + "syscon"; + reg = <0 0x10070000 0 0x1000>; + #clock-cells = <1>; + }; + + usxgmiisys0: usxgmiisys@10080000 { + compatible = "mediatek,mt7988-usxgmiisys", + "mediatek,mt7988-usxgmiisys_0", + "syscon"; + reg = <0 0x10080000 0 0x1000>; + #clock-cells = <1>; + }; + + usxgmiisys1: usxgmiisys@10081000 { + compatible = "mediatek,mt7988-usxgmiisys", + "mediatek,mt7988-usxgmiisys_1", + "syscon"; + reg = <0 0x10081000 0 0x1000>; + #clock-cells = <1>; + }; + + xfi_pextp0: xfi_pextp@11f20000 { + compatible = "mediatek,mt7988-xfi_pextp", + "mediatek,mt7988-xfi_pextp_0", + "syscon"; + reg = <0 0x11f20000 0 0x10000>; + #clock-cells = <1>; + }; + + xfi_pextp1: xfi_pextp@11f30000 { + compatible = "mediatek,mt7988-xfi_pextp", + "mediatek,mt7988-xfi_pextp_1", + "syscon"; + reg = <0 0x11f30000 0 0x10000>; + #clock-cells = <1>; + }; + + xfi_pll: xfi_pll@11f40000 { + compatible = "mediatek,mt7988-xfi_pll", "syscon"; + reg = <0 0x11f40000 0 0x1000>; + #clock-cells = <1>; + }; + + mcusys: mcusys@100e0000 { + compatible = "mediatek,mt7988-mcusys", "syscon"; + reg = <0 0x100e0000 0 0x1000>; + #clock-cells = <1>; + }; + + uart0: serial@11000000 { + compatible = "mediatek,mt7986-uart", + "mediatek,mt6577-uart"; + reg = <0 0x11000000 0 0x100>; + interrupts = ; + /* + * 8250-mtk driver don't control "baud" clock since commit + * e32a83c70cf9 (kernel v5.7), but both "baud" and "bus" clocks + * still need to be passed to the driver to prevent probe fail + */ + clocks = <&topckgen CLK_TOP_UART_SEL>, + <&infracfg CLK_INFRA_52M_UART0_CK>; + clock-names = "baud", "bus"; + assigned-clocks = <&topckgen CLK_TOP_UART_SEL>, + <&infracfg CLK_INFRA_MUX_UART0_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_XTAL>, + <&topckgen CLK_TOP_UART_SEL>; + status = "disabled"; + }; + + i2c0: i2c@11003000 { + compatible = "mediatek,mt7988-i2c", + "mediatek,mt7981-i2c"; + reg = <0 0x11003000 0 0x1000>, + <0 0x10217080 0 0x80>; + interrupts = ; + clock-div = <1>; + clocks = <&infracfg CLK_INFRA_I2C_BCK>, + <&infracfg CLK_INFRA_66M_AP_DMA_BCK>; + clock-names = "main", "dma"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c1: i2c@11004000 { + compatible = "mediatek,mt7988-i2c", + "mediatek,mt7981-i2c"; + reg = <0 0x11004000 0 0x1000>, + <0 0x10217100 0 0x80>; + interrupts = ; + clock-div = <1>; + clocks = <&infracfg CLK_INFRA_I2C_BCK>, + <&infracfg CLK_INFRA_66M_AP_DMA_BCK>; + clock-names = "main", "dma"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c2: i2c@11005000 { + compatible = "mediatek,mt7988-i2c", + "mediatek,mt7981-i2c"; + reg = <0 0x11005000 0 0x1000>, + <0 0x10217180 0 0x80>; + interrupts = ; + clock-div = <1>; + clocks = <&infracfg CLK_INFRA_I2C_BCK>, + <&infracfg CLK_INFRA_66M_AP_DMA_BCK>; + clock-names = "main", "dma"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + spi0: spi@11007000 { + compatible = "mediatek,ipm-spi-quad", "mediatek,spi-ipm"; + reg = <0 0x11007000 0 0x100>; + interrupts = ; + clocks = <&topckgen CLK_TOP_MPLL_D2>, + <&topckgen CLK_TOP_SPI_SEL>, + <&infracfg CLK_INFRA_104M_SPI0>, + <&infracfg CLK_INFRA_66M_SPI0_HCK>; + clock-names = "parent-clk", "sel-clk", "spi-clk", + "spi-hclk"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + }; + + pcie2: pcie@11280000 { + compatible = "mediatek,mt7988-pcie", + "mediatek,mt7986-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + reg = <0 0x11280000 0 0x2000>; + reg-names = "pcie-mac"; + linux,pci-domain = <3>; + interrupts = ; + bus-range = <0x00 0xff>; + ranges = <0x81000000 0x00 0x20000000 0x00 + 0x20000000 0x00 0x00200000>, + <0x82000000 0x00 0x20200000 0x00 + 0x20200000 0x00 0x07e00000>; + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P2>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P2>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P2>, + <&infracfg CLK_INFRA_133M_PCIE_CK_P2>; + clock-names = "pl_250m", "tl_26m", "peri_26m", + "top_133m"; + status = "disabled"; + + phys = <&xphyu3port0 PHY_TYPE_PCIE>; + phy-names = "pcie-phy"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0x7>; + interrupt-map = <0 0 0 1 &pcie_intc2 0>, + <0 0 0 2 &pcie_intc2 1>, + <0 0 0 3 &pcie_intc2 2>, + <0 0 0 4 &pcie_intc2 3>; + pcie_intc2: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + + pcie3: pcie@11290000 { + compatible = "mediatek,mt7988-pcie", + "mediatek,mt7986-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + reg = <0 0x11290000 0 0x2000>; + reg-names = "pcie-mac"; + linux,pci-domain = <2>; + interrupts = ; + bus-range = <0x00 0xff>; + ranges = <0x81000000 0x00 0x28000000 0x00 + 0x28000000 0x00 0x00200000>, + <0x82000000 0x00 0x28200000 0x00 + 0x28200000 0x00 0x07e00000>; + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P3>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P3>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P3>, + <&infracfg CLK_INFRA_133M_PCIE_CK_P3>; + clock-names = "pl_250m", "tl_26m", "peri_26m", + "top_133m"; + status = "disabled"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0x7>; + interrupt-map = <0 0 0 1 &pcie_intc3 0>, + <0 0 0 2 &pcie_intc3 1>, + <0 0 0 3 &pcie_intc3 2>, + <0 0 0 4 &pcie_intc3 3>; + pcie_intc3: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + + pcie0: pcie@11300000 { + compatible = "mediatek,mt7988-pcie", + "mediatek,mt7986-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + reg = <0 0x11300000 0 0x2000>; + reg-names = "pcie-mac"; + linux,pci-domain = <0>; + interrupts = ; + bus-range = <0x00 0xff>; + ranges = <0x81000000 0x00 0x30000000 0x00 + 0x30000000 0x00 0x00200000>, + <0x82000000 0x00 0x30200000 0x00 + 0x30200000 0x00 0x07e00000>; + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P0>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P0>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P0>, + <&infracfg CLK_INFRA_133M_PCIE_CK_P0>; + clock-names = "pl_250m", "tl_26m", "peri_26m", + "top_133m"; + status = "disabled"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0x7>; + interrupt-map = <0 0 0 1 &pcie_intc0 0>, + <0 0 0 2 &pcie_intc0 1>, + <0 0 0 3 &pcie_intc0 2>, + <0 0 0 4 &pcie_intc0 3>; + pcie_intc0: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + + pcie1: pcie@11310000 { + compatible = "mediatek,mt7988-pcie", + "mediatek,mt7986-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + reg = <0 0x11310000 0 0x2000>; + reg-names = "pcie-mac"; + linux,pci-domain = <1>; + interrupts = ; + bus-range = <0x00 0xff>; + ranges = <0x81000000 0x00 0x38000000 0x00 + 0x38000000 0x00 0x00200000>, + <0x82000000 0x00 0x38200000 0x00 + 0x38200000 0x00 0x07e00000>; + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P1>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P1>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P1>, + <&infracfg CLK_INFRA_133M_PCIE_CK_P1>; + clock-names = "pl_250m", "tl_26m", "peri_26m", + "top_133m"; + status = "disabled"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0x7>; + interrupt-map = <0 0 0 1 &pcie_intc1 0>, + <0 0 0 2 &pcie_intc1 1>, + <0 0 0 3 &pcie_intc1 2>, + <0 0 0 4 &pcie_intc1 3>; + pcie_intc1: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + + ssusb0: usb@11190000 { + compatible = "mediatek,mt7988-xhci", + "mediatek,mtk-xhci"; + reg = <0 0x11190000 0 0x2e00>, + <0 0x11193e00 0 0x0100>; + reg-names = "mac", "ippc"; + interrupts = ; + phys = <&xphyu2port0 PHY_TYPE_USB2>, + <&xphyu3port0 PHY_TYPE_USB3>; + clocks = <&infracfg CLK_INFRA_USB_SYS>, + <&infracfg CLK_INFRA_USB_XHCI>, + <&infracfg CLK_INFRA_USB_REF>, + <&infracfg CLK_INFRA_66M_USB_HCK>, + <&infracfg CLK_INFRA_133M_USB_HCK>; + clock-names = "sys_ck", + "xhci_ck", + "ref_ck", + "mcu_ck", + "dma_ck"; + #address-cells = <2>; + #size-cells = <2>; + mediatek,p0_speed_fixup; + status = "disabled"; + }; + + ssusb1: usb@11200000 { + compatible = "mediatek,mt7988-xhci", + "mediatek,mtk-xhci"; + reg = <0 0x11200000 0 0x2e00>, + <0 0x11203e00 0 0x0100>; + reg-names = "mac", "ippc"; + interrupts = ; + phys = <&tphyu2port0 PHY_TYPE_USB2>, + <&tphyu3port0 PHY_TYPE_USB3>; + clocks = <&infracfg CLK_INFRA_USB_SYS_CK_P1>, + <&infracfg CLK_INFRA_USB_XHCI_CK_P1>, + <&infracfg CLK_INFRA_USB_CK_P1>, + <&infracfg CLK_INFRA_66M_USB_HCK_CK_P1>, + <&infracfg CLK_INFRA_133M_USB_HCK_CK_P1>; + clock-names = "sys_ck", + "xhci_ck", + "ref_ck", + "mcu_ck", + "dma_ck"; + #address-cells = <2>; + #size-cells = <2>; + status = "disabled"; + }; + + tphy: tphy@11c50000 { + compatible = "mediatek,mt7988", + "mediatek,generic-tphy-v2"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + status = "disabled"; + tphyu2port0: usb-phy@11c50000 { + reg = <0 0x11c50000 0 0x700>; + clocks = <&infracfg CLK_INFRA_USB_UTMI_CK_P1>; + clock-names = "ref"; + #phy-cells = <1>; + }; + tphyu3port0: usb-phy@11c50700 { + reg = <0 0x11c50700 0 0x900>; + clocks = <&infracfg CLK_INFRA_USB_PIPE_CK_P1>; + clock-names = "ref"; + #phy-cells = <1>; + mediatek,usb3-pll-ssc-delta; + mediatek,usb3-pll-ssc-delta1; + }; + }; + + topmisc: topmisc@11d10000 { + compatible = "mediatek,mt7988-topmisc", "syscon", + "mediatek,mt7988-power-controller"; + reg = <0 0x11d10000 0 0x10000>; + #clock-cells = <1>; + #power-domain-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + }; + + xphy: xphy@11e10000 { + compatible = "mediatek,mt7988", + "mediatek,xsphy"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + status = "disabled"; + + xphyu2port0: usb-phy@11e10000 { + reg = <0 0x11e10000 0 0x400>; + clocks = <&infracfg CLK_INFRA_USB_UTMI>; + clock-names = "ref"; + #phy-cells = <1>; + }; + + xphyu3port0: usb-phy@11e13000 { + reg = <0 0x11e13400 0 0x500>; + clocks = <&infracfg CLK_INFRA_USB_PIPE>; + clock-names = "ref"; + #phy-cells = <1>; + mediatek,syscon-type = <&topmisc 0x218 0>; + }; + }; + + efuse: efuse@11f50000 { + compatible = "mediatek,efuse"; + reg = <0 0x11f50000 0 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + + lvts_calibration: calib@918 { + reg = <0x918 0x28>; + }; + phy_calibration_p0: calib@940 { + reg = <0x940 0x10>; + }; + phy_calibration_p1: calib@954 { + reg = <0x954 0x10>; + }; + phy_calibration_p2: calib@968 { + reg = <0x968 0x10>; + }; + phy_calibration_p3: calib@97c { + reg = <0x97c 0x10>; + }; + cpufreq_calibration: calib@278 { + reg = <0x278 0x1>; + }; + }; + + ethsys: syscon@15000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "mediatek,mt7988-ethsys", "syscon"; + reg = <0 0x15000000 0 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + switch: switch@15020000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "mediatek,mt7988-switch"; + reg = <0 0x15020000 0 0x8000>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + interrupts = ; + resets = <ðrst 0>; + }; + + ethwarp: syscon@15031000 { + compatible = "mediatek,mt7988-ethwarp", "syscon", "simple-mfd"; + reg = <0 0x15031000 0 0x1000>; + #clock-cells = <1>; + + ethrst: reset-controller { + compatible = "ti,syscon-reset"; + #reset-cells = <1>; + ti,reset-bits = < + 0x8 9 0x8 9 0 0 (ASSERT_SET | DEASSERT_CLEAR | STATUS_NONE) + >; + }; + }; + + eth: ethernet@15100000 { + compatible = "mediatek,mt7988-eth"; + reg = <0 0x15100000 0 0x80000>, + <0 0x15400000 0 0x380000>; + interrupts = , + , + , + ; + clocks = <ðsys CLK_ETHDMA_XGP1_EN>, + <ðsys CLK_ETHDMA_XGP2_EN>, + <ðsys CLK_ETHDMA_XGP3_EN>, + <ðsys CLK_ETHDMA_FE_EN>, + <ðsys CLK_ETHDMA_GP2_EN>, + <ðsys CLK_ETHDMA_GP1_EN>, + <ðsys CLK_ETHDMA_GP3_EN>, + <ðsys CLK_ETHDMA_ESW_EN>, + <ðsys CLK_ETHDMA_CRYPT0_EN>, + <&sgmiisys0 CLK_SGM0_TX_EN>, + <&sgmiisys0 CLK_SGM0_RX_EN>, + <&sgmiisys1 CLK_SGM1_TX_EN>, + <&sgmiisys1 CLK_SGM1_RX_EN>, + <ðwarp CLK_ETHWARP_WOCPU2_EN>, + <ðwarp CLK_ETHWARP_WOCPU1_EN>, + <ðwarp CLK_ETHWARP_WOCPU0_EN>, + <&topckgen CLK_TOP_USXGMII_SBUS_0_SEL>, + <&topckgen CLK_TOP_USXGMII_SBUS_1_SEL>, + <&topckgen CLK_TOP_SGM_0_SEL>, + <&topckgen CLK_TOP_SGM_1_SEL>, + <&topckgen CLK_TOP_XFI_PHY_0_XTAL_SEL>, + <&topckgen CLK_TOP_XFI_PHY_1_XTAL_SEL>, + <&topckgen CLK_TOP_ETH_GMII_SEL>, + <&topckgen CLK_TOP_ETH_REFCK_50M_SEL>, + <&topckgen CLK_TOP_ETH_SYS_200M_SEL>, + <&topckgen CLK_TOP_ETH_SYS_SEL>, + <&topckgen CLK_TOP_ETH_XGMII_SEL>, + <&topckgen CLK_TOP_ETH_MII_SEL>, + <&topckgen CLK_TOP_NETSYS_SEL>, + <&topckgen CLK_TOP_NETSYS_500M_SEL>, + <&topckgen CLK_TOP_NETSYS_PAO_2X_SEL>, + <&topckgen CLK_TOP_NETSYS_SYNC_250M_SEL>, + <&topckgen CLK_TOP_NETSYS_PPEFB_250M_SEL>, + <&topckgen CLK_TOP_NETSYS_WARP_SEL>; + clock-names = "xgp1", "xgp2", "xgp3", "fe", "gp2", "gp1", + "gp3", "esw", "crypto", "sgmii_tx250m", + "sgmii_rx250m", "sgmii2_tx250m", "sgmii2_rx250m", + "ethwarp_wocpu2", "ethwarp_wocpu1", + "ethwarp_wocpu0", "top_usxgmii0_sel", + "top_usxgmii1_sel", "top_sgm0_sel", + "top_sgm1_sel", "top_xfi_phy0_xtal_sel", + "top_xfi_phy1_xtal_sel", "top_eth_gmii_sel", + "top_eth_refck_50m_sel", "top_eth_sys_200m_sel", + "top_eth_sys_sel", "top_eth_xgmii_sel", + "top_eth_mii_sel", "top_netsys_sel", + "top_netsys_500m_sel", "top_netsys_pao_2x_sel", + "top_netsys_sync_250m_sel", + "top_netsys_ppefb_250m_sel", + "top_netsys_warp_sel"; + assigned-clocks = <&topckgen CLK_TOP_NETSYS_2X_SEL>, + <&topckgen CLK_TOP_NETSYS_GSW_SEL>, + <&topckgen CLK_TOP_USXGMII_SBUS_0_SEL>, + <&topckgen CLK_TOP_USXGMII_SBUS_1_SEL>, + <&topckgen CLK_TOP_SGM_0_SEL>, + <&topckgen CLK_TOP_SGM_1_SEL>; + assigned-clock-parents = <&apmixedsys CLK_APMIXED_NET2PLL>, + <&topckgen CLK_TOP_NET1PLL_D4>, + <&topckgen CLK_TOP_NET1PLL_D8_D4>, + <&topckgen CLK_TOP_NET1PLL_D8_D4>, + <&apmixedsys CLK_APMIXED_SGMPLL>, + <&apmixedsys CLK_APMIXED_SGMPLL>; + mediatek,ethsys = <ðsys>; + mediatek,sgmiisys = <&sgmiisys0>, <&sgmiisys1>; + mediatek,usxgmiisys = <&usxgmiisys0>, <&usxgmiisys1>; + mediatek,xfi_pextp = <&xfi_pextp0>, <&xfi_pextp1>; + mediatek,xfi_pll = <&xfi_pll>; + mediatek,infracfg = <&topmisc>; + mediatek,toprgu = <&watchdog>; + #reset-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + }; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 63f898a9cd2511..2fca00921b8caf 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -26,6 +26,9 @@ mediatek_setup_interfaces() mediatek,mt7986b-rfb) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" eth1 ;; + mediatek,mt7988a-dsa-10g-spim-snand) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "eth1 eth2" + ;; tplink,tl-xdr4288|\ tplink,tl-xdr6088) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 3e6a1654f20b8c..4cae8c50ac7427 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -360,6 +360,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_MT6380=y CONFIG_REGULATOR_RT5190A=y CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_TI_SYSCON=y CONFIG_RFS_ACCEL=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y CONFIG_RPS=y diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 92d1dcfad24991..72adb490666414 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -206,6 +206,24 @@ define Device/mediatek_mt7986b-rfb endef TARGET_DEVICES += mediatek_mt7986b-rfb +define Device/mediatek_mt7988a-rfb-nand + DEVICE_VENDOR := MediaTek + DEVICE_MODEL := MT7988a nand rfb + DEVICE_DTS := mt7988a-dsa-10g-spim-nand + DEVICE_DTS_DIR := $(DTS_DIR)/ + KERNEL_LOADADDR := 0x48000000 + SUPPORTED_DEVICES := mediatek,mt7988a-rfb + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += mediatek_mt7988a-rfb-nand + define Device/tplink_tl-xdr-common DEVICE_VENDOR := TP-Link DEVICE_DTS_DIR := ../dts From e996c6eb19ce9fca583d4b146788309e1c10093b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 24 May 2023 09:27:29 +0100 Subject: [PATCH 0034/1171] Revert "kernel: add MODULE_ALLOW_BTF_MISMATCH option" This reverts commit c07038da27cefa5a93e433909b9aca594386ddc1. MODULE_ALLOW_BTF_MISMATCH is not available in Linux 5.15. Signed-off-by: Daniel Golle --- config/Config-kernel.in | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 6c5e6a967a5298..3a2189d63aff00 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -373,16 +373,6 @@ config KERNEL_DEBUG_INFO_BTF Required to run BPF CO-RE applications. -config KERNEL_MODULE_ALLOW_BTF_MISMATCH - bool "Allow loading modules with non-matching BTF type info" - depends on KERNEL_DEBUG_INFO_BTF - help - For modules whose split BTF does not match vmlinux, load without - BTF rather than refusing to load. The default behavior with - module BTF enabled is to reject modules with such mismatches; - this option will still load module BTF where possible but ignore - it when a mismatch is found. - config KERNEL_DEBUG_INFO_REDUCED bool "Reduce debugging information" default y From f54bea12b6d5193509716b4c85bf2d342bbc0123 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sun, 21 May 2023 02:14:37 -0700 Subject: [PATCH 0035/1171] bpftools: update, split off bpftool and libbpf packages My original bpftools package made "variant" builds of bpftool and libbpf as a convenience, since both used the same local kernel sources with the same versioning. This is no longer the case, since the commit below switched to using an out-of-tree build mirror hosting repos for each. Replace bpftools with separate bpftool and libbpf packages, each simplified and correctly versioned. Also fix the broken libbpf ABI introduced in the same commit. Existing build .config files are not impacted. Fixes: 00cbf6f6ab1d ("bpftools: update to standalone bpftools + libbpf, use the latest version") Signed-off-by: Tony Ambardar (cherry picked from commit afe1bf11f2539f75e30ab3206891dbe6f8c43bd5) Signed-off-by: Daniel Golle --- package/libs/libbpf/Makefile | 75 +++++++++++++++++++ package/libs/libbpf/patches/001-cflags.patch | 10 +++ .../utils/{bpftools => bpftool}/Makefile | 64 ++-------------- .../patches/001-cflags.patch | 0 .../patches/002-includes.patch | 0 5 files changed, 92 insertions(+), 57 deletions(-) create mode 100644 package/libs/libbpf/Makefile create mode 100644 package/libs/libbpf/patches/001-cflags.patch rename package/network/utils/{bpftools => bpftool}/Makefile (55%) rename package/network/utils/{bpftools => bpftool}/patches/001-cflags.patch (100%) rename package/network/utils/{bpftools => bpftool}/patches/002-includes.patch (100%) diff --git a/package/libs/libbpf/Makefile b/package/libs/libbpf/Makefile new file mode 100644 index 00000000000000..ee7666f734d891 --- /dev/null +++ b/package/libs/libbpf/Makefile @@ -0,0 +1,75 @@ +# +# Copyright (C) 2020-2023 Tony Ambardar +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libbpf +PKG_VERSION:=1.2.0 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://github.com/libbpf/libbpf +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=fbd60dbff51c870f5e80a17c4f2fd639eb80af90 +PKG_MIRROR_HASH:=80a80dfba71576e017b596fb28068e2a92de629e426f063e4b37314c8d576336 +PKG_ABI_VERSION:=$(firstword $(subst .,$(space),$(PKG_VERSION))) + +PKG_MAINTAINER:=Tony Ambardar + +PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/libbpf + SECTION:=libs + CATEGORY:=Libraries + TITLE:=libbpf - eBPF helper library + LICENSE:=LGPL-2.1 OR BSD-2-Clause + ABI_VERSION:=$(PKG_ABI_VERSION) + URL:=http://www.kernel.org + DEPENDS:=+libelf +endef + +define Package/libbpf/description + libbpf is a library for loading eBPF programs and reading and manipulating eBPF objects from user-space. +endef + +MAKE_VARS = \ + EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" + +MAKE_FLAGS += \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ + LIBSUBDIR=lib + +MAKE_PATH = src + +define Build/InstallDev/libbpf + $(INSTALL_DIR) $(1)/usr/include/bpf + $(CP) $(PKG_INSTALL_DIR)/usr/include/bpf/*.h $(1)/usr/include/bpf/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbpf.{a,so*} \ + $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libbpf.pc \ + $(1)/usr/lib/pkgconfig/ + $(SED) 's,/usr/include,$$$${prefix}/include,g' \ + $(1)/usr/lib/pkgconfig/libbpf.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' \ + $(1)/usr/lib/pkgconfig/libbpf.pc +endef + +Build/InstallDev=$(Build/InstallDev/libbpf) + +define Package/libbpf/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbpf.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libbpf)) diff --git a/package/libs/libbpf/patches/001-cflags.patch b/package/libs/libbpf/patches/001-cflags.patch new file mode 100644 index 00000000000000..d6ffc3f907f8ec --- /dev/null +++ b/package/libs/libbpf/patches/001-cflags.patch @@ -0,0 +1,10 @@ +--- a/src/Makefile ++++ b/src/Makefile +@@ -34,6 +34,7 @@ ALL_CFLAGS := $(INCLUDES) + + SHARED_CFLAGS += -fPIC -fvisibility=hidden -DSHARED + ++CFLAGS = $(EXTRA_CFLAGS) + CFLAGS ?= -g -O2 -Werror -Wall -std=gnu89 + ALL_CFLAGS += $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(EXTRA_CFLAGS) + ALL_LDFLAGS += $(LDFLAGS) $(EXTRA_LDFLAGS) diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftool/Makefile similarity index 55% rename from package/network/utils/bpftools/Makefile rename to package/network/utils/bpftool/Makefile index 047d2a0967e7af..cbbba2dba5964d 100644 --- a/package/network/utils/bpftools/Makefile +++ b/package/network/utils/bpftool/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2020 Tony Ambardar +# Copyright (C) 2020-2023 Tony Ambardar # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,14 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bpftools +PKG_VERSION:=7.2.0 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/libbpf/bpftool PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=7.1.0 -PKG_SOURCE_VERSION:=b01941c8f7890489f09713348a7d89567538504b -PKG_MIRROR_HASH:=641fb337342e25ae784a3efe72c71d8c88600a326300d8d5834e26be21547015 -PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) +PKG_SOURCE_VERSION:=19ff0564980a7429e730f6987a0b0bf418b3c676 +PKG_MIRROR_HASH:=f9b9871f64986dd2e5dab7060bb919398256ba93964da49c62efaf0e6bc9bbc4 PKG_MAINTAINER:=Tony Ambardar @@ -63,27 +62,8 @@ define Package/bpftool-full/description eBPF programs and jited code. endef -define Package/libbpf - SECTION:=libs - CATEGORY:=Libraries - TITLE:=libbpf - eBPF helper library - VARIANT:=lib - LICENSE:=LGPL-2.1 OR BSD-2-Clause - ABI_VERSION:=$(PKG_ABI_VERSION) - URL:=http://www.kernel.org - DEPENDS:=+libelf -endef - -define Package/libbpf/description - libbpf is a library for loading eBPF programs and reading and manipulating eBPF objects from user-space. -endef - - -# LTO not compatible with DSO using PIC -ifneq ($(BUILD_VARIANT),lib) - TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto - TARGET_LDFLAGS += -Wl,--gc-sections -flto -endif +TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto ifeq ($(BUILD_VARIANT),full) full:=1 @@ -99,7 +79,6 @@ MAKE_FLAGS += \ OUTPUT="$(PKG_BUILD_DIR)/" \ prefix="/usr" \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ - LIBSUBDIR=lib \ check_feat=0 \ feature-clang-bpf-co-re=0 \ feature-libbfd=$(full) \ @@ -108,30 +87,7 @@ MAKE_FLAGS += \ feature-disassembler-four-args=1 \ feature-disassembler-init-styled=1 -ifeq ($(BUILD_VARIANT),lib) - MAKE_PATH = libbpf/src -else - MAKE_PATH = src -endif - -define Build/InstallDev/libbpf - $(INSTALL_DIR) $(1)/usr/include/bpf - $(CP) $(PKG_INSTALL_DIR)/usr/include/bpf/*.h $(1)/usr/include/bpf/ - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbpf.{a,so*} \ - $(1)/usr/lib/ - $(INSTALL_DIR) $(1)/usr/lib/pkgconfig - $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libbpf.pc \ - $(1)/usr/lib/pkgconfig/ - $(SED) 's,/usr/include,$$$${prefix}/include,g' \ - $(1)/usr/lib/pkgconfig/libbpf.pc - $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' \ - $(1)/usr/lib/pkgconfig/libbpf.pc -endef - -ifeq ($(BUILD_VARIANT),lib) - Build/InstallDev=$(Build/InstallDev/libbpf) -endif +MAKE_PATH = src define Package/bpftool-$(BUILD_VARIANT)/install $(INSTALL_DIR) $(1)/usr/libexec @@ -139,11 +95,5 @@ define Package/bpftool-$(BUILD_VARIANT)/install $(1)/usr/libexec/bpftool-$(BUILD_VARIANT) endef -define Package/libbpf/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbpf.so.* $(1)/usr/lib/ -endef - -$(eval $(call BuildPackage,libbpf)) $(eval $(call BuildPackage,bpftool-full)) $(eval $(call BuildPackage,bpftool-minimal)) diff --git a/package/network/utils/bpftools/patches/001-cflags.patch b/package/network/utils/bpftool/patches/001-cflags.patch similarity index 100% rename from package/network/utils/bpftools/patches/001-cflags.patch rename to package/network/utils/bpftool/patches/001-cflags.patch diff --git a/package/network/utils/bpftools/patches/002-includes.patch b/package/network/utils/bpftool/patches/002-includes.patch similarity index 100% rename from package/network/utils/bpftools/patches/002-includes.patch rename to package/network/utils/bpftool/patches/002-includes.patch From 8f2dcd0c3d29ec0e4983d9a96b26a30c226da7a1 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 22 May 2023 23:42:13 +0200 Subject: [PATCH 0036/1171] generic: filter out CONFIG_PAHOLE_HAS_SPLIT_BTF CONFIG_PAHOLE_HAS_SPLIT_BTF should be runtime detected as it depends on pahole being available on the host, so filter it out of configs. Signed-off-by: Robert Marko (cherry picked from commit 3591353f5143fc46e31f921484177a9d6f1089a2) Signed-off-by: Daniel Golle --- target/linux/generic/config-filter | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-filter b/target/linux/generic/config-filter index 201b68dddf2800..e7aa90f8b548f4 100644 --- a/target/linux/generic/config-filter +++ b/target/linux/generic/config-filter @@ -10,6 +10,7 @@ CONFIG_CLANG_VERSION=.* # CONFIG_LD_.* is not set CONFIG_LLD_VERSION=.* CONFIG_PAHOLE_VERSION=.* +CONFIG_PAHOLE_HAS_SPLIT_BTF=.* CONFIG_PLUGIN_HOSTCC=".*" # CONFIG_SET_FS is not set # CONFIG_TASKS_.* is not set From 7666503f68c736970c89779ad3dc77e3573e5b11 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 25 May 2023 18:24:00 +0200 Subject: [PATCH 0037/1171] CI: use split target and subtarget in label workflow With eecc6e48117b ("CI: rework build workflow to have split target and subtarget directly") target and subtarget are split in 2 different variables. Label workflow were not aligned to this change and are currently broken. Fix them and correctly pass split target and subtarget. Fixes: eecc6e48117b ("CI: rework build workflow to have split target and subtarget directly") Signed-off-by: Christian Marangi (cherry picked from commit bf8187d5dc4d4bbb23770955744bca1787f32ac0) --- .github/workflows/label-kernel.yml | 5 ++++- .github/workflows/label-target.yml | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index 1156e0ad985cc3..6c79014edb6f53 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -20,7 +20,8 @@ jobs: env: CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1\/\2"/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1"/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget="\2"/p' | tee --append $GITHUB_OUTPUT build_kernel: name: Build Kernel with external toolchain @@ -31,6 +32,7 @@ jobs: uses: ./.github/workflows/build.yml with: target: ${{ needs.set_target.outputs.target }} + subtarget: ${{ needs.set_target.outputs.subtarget }} build_kernel: true build_all_kmods: true @@ -43,3 +45,4 @@ jobs: uses: ./.github/workflows/check-kernel-patches.yml with: target: ${{ needs.set_target.outputs.target }} + subtarget: ${{ needs.set_target.outputs.subtarget }} diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml index e1890240764226..4c3df28f51bb37 100644 --- a/.github/workflows/label-target.yml +++ b/.github/workflows/label-target.yml @@ -20,7 +20,8 @@ jobs: env: CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1\/\2"/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1"/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget="\2"/p' | tee --append $GITHUB_OUTPUT build_target: name: Build target @@ -31,6 +32,7 @@ jobs: uses: ./.github/workflows/build.yml with: target: ${{ needs.set_target.outputs.target }} + subtarget: ${{ needs.set_target.outputs.subtarget }} build_full: true build_all_kmods: true build_all_boards: true From 962334bc82bf358d56d52dd4d87be8d07db94543 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 25 May 2023 23:09:59 +0200 Subject: [PATCH 0038/1171] CI: correctly output subtarget in label workflow Commit bf8187d5dc4d ("CI: use split target and subtarget in label workflow") didn't correctly output subtarget resulting in calling with an empty subtarget. Fix this and correctly output generated subtarget. Fixes: bf8187d5dc4d ("CI: use split target and subtarget in label workflow") Signed-off-by: Christian Marangi (cherry picked from commit 8aa5a860101cc3f8d35ca968746320495c4b469e) --- .github/workflows/label-kernel.yml | 1 + .github/workflows/label-target.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index 6c79014edb6f53..243d285e28996c 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest outputs: target: ${{ steps.set_target.outputs.target }} + subtarget: ${{ steps.set_target.outputs.subtarget }} steps: - name: Set target diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml index 4c3df28f51bb37..3a624598b1e217 100644 --- a/.github/workflows/label-target.yml +++ b/.github/workflows/label-target.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest outputs: target: ${{ steps.set_target.outputs.target }} + subtarget: ${{ steps.set_target.outputs.subtarget }} steps: - name: Set target From ec6bbc52557e559a469761d182d690af20bf6189 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 25 May 2023 02:44:21 +0200 Subject: [PATCH 0039/1171] CI: build: fix parse toolchain step failing for git strict rules Commit 1cb8cdb ("ci: use new buildbot worker images with Debian 11") introduced new Git version with strict rules for owner of the git directory. To handle this and not cause major change, just move the parsing before the change of ownership of the openwrt directory permitting the correct run of git fetch command with the same user that did the repository checkout. Fixes: 1cb8cdb ("ci: use new buildbot worker images with Debian 11") Signed-off-by: Christian Marangi (cherry picked from commit 0063e71d66766818fba286efe2a0ed8746c265e5) --- .github/workflows/build.yml | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52fba8e10639b5..816ef6ab3cafbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -156,28 +156,6 @@ jobs: repository: openwrt/telephony path: openwrt/feeds/telephony - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Prepare prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - mkdir -p staging_dir build_dir - ln -s /prebuilt_tools/staging_dir/host staging_dir/host - ln -s /prebuilt_tools/build_dir/host build_dir/host - - ./scripts/ext-tools.sh --refresh - - - name: Update & Install feeds - if: inputs.include_feeds == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - ./scripts/feeds update -a - ./scripts/feeds install -a - - name: Parse toolchain file if: inputs.build_toolchain == false id: parse-toolchain @@ -227,6 +205,28 @@ jobs: echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" + - name: Fix permission + run: | + chown -R buildbot:buildbot openwrt + + - name: Prepare prebuilt tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + mkdir -p staging_dir build_dir + ln -s /prebuilt_tools/staging_dir/host staging_dir/host + ln -s /prebuilt_tools/build_dir/host build_dir/host + + ./scripts/ext-tools.sh --refresh + + - name: Update & Install feeds + if: inputs.include_feeds == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + ./scripts/feeds update -a + ./scripts/feeds install -a + - name: Cache ccache uses: actions/cache@v3 with: From 4174768d9f764faccae376723dbac132b2c11fe9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 27 May 2023 19:53:15 +0200 Subject: [PATCH 0040/1171] CI: don't add "" in target and subtarget for label workflow Don't add "" in target and subtarget for label workflow from label detection as it does cause problem in build workflow on container target/subtarget matching. Fixes: bf8187d5dc4d ("CI: use split target and subtarget in label workflow") Signed-off-by: Christian Marangi (cherry picked from commit 1fa84354a963eb71eca9e67a1fc7f99a53016a5c) --- .github/workflows/label-kernel.yml | 4 ++-- .github/workflows/label-target.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index 243d285e28996c..e5ca945a645852 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -21,8 +21,8 @@ jobs: env: CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1"/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget="\2"/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT build_kernel: name: Build Kernel with external toolchain diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml index 3a624598b1e217..157e8caaad7085 100644 --- a/.github/workflows/label-target.yml +++ b/.github/workflows/label-target.yml @@ -21,8 +21,8 @@ jobs: env: CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1"/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget="\2"/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT build_target: name: Build target From 3a1cb63336ec5a6e4d8d7cea142925751e1321d5 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 28 May 2023 03:44:01 +0200 Subject: [PATCH 0041/1171] CI: use toolchain container for label workflow Use toolchain container for label workflow to skip downloading external toolchain from openwrt servers. Fixes: 0fe5776f4a79 ("CI: build: Add support to use container included external toolchain") Signed-off-by: Christian Marangi (cherry picked from commit 66fd0aa6efac3690fdc46c94a4657faacf3070dd) --- .github/workflows/label-kernel.yml | 1 + .github/workflows/label-target.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index e5ca945a645852..67faaddfcdfce4 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -32,6 +32,7 @@ jobs: packages: read uses: ./.github/workflows/build.yml with: + container_name: toolchain target: ${{ needs.set_target.outputs.target }} subtarget: ${{ needs.set_target.outputs.subtarget }} build_kernel: true diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml index 157e8caaad7085..78aea28b106b80 100644 --- a/.github/workflows/label-target.yml +++ b/.github/workflows/label-target.yml @@ -32,6 +32,7 @@ jobs: packages: read uses: ./.github/workflows/build.yml with: + container_name: toolchain target: ${{ needs.set_target.outputs.target }} subtarget: ${{ needs.set_target.outputs.subtarget }} build_full: true From afe2722f6de70d6bbe91f2fd9adbe5f39ce550d2 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 24 May 2023 15:10:44 -0400 Subject: [PATCH 0042/1171] kernel: bump 5.15 to 5.15.113 All patches automatically rebased. Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia (cherry picked from commit c815ecdebd77c3484f2cd0ef21e4c69d274ef33a) --- include/kernel-5.15 | 4 ++-- ...-Better-coalescing-parameter-defaults.patch | 2 +- ...net-bcmgenet-Reset-RBUF-on-first-open.patch | 2 +- ...ound-for-bogus-SET_DEQ_PENDING-endpoi.patch | 2 +- ...i-quirks-add-link-TRB-quirk-for-VL805.patch | 4 ++-- ...om_on_ring-for-cases-where-there-is-a.patch | 2 +- ...ut-TRBS_PER_SEGMENT-define-in-runtime.patch | 4 ++-- ...-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch | 2 +- ...quirk-for-Superspeed-bulk-OUT-transfe.patch | 8 ++++---- ...rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch | 6 +++--- .../721-net-add-packet-mangeling.patch | 2 +- .../pending-5.15/630-packet_socket_type.patch | 10 +++++----- ...ET-skip-GRO-for-foreign-MAC-addresses.patch | 10 +++++----- ...tional-threading-for-backlog-processi.patch | 18 +++++++++--------- .../302-clocksource-add-otto-driver.patch | 2 +- .../103-pcengines_apu6_platform.patch | 4 ++-- 16 files changed, 41 insertions(+), 41 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index ddb9b7a875d204..733a8edf782325 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .112 -LINUX_KERNEL_HASH-5.15.112 = b0e8ebdba38e0c369f64ec4dc2a69ec59ffe87a64b82f940dbdf8e752b6ad651 +LINUX_VERSION-5.15 = .113 +LINUX_KERNEL_HASH-5.15.113 = 4a4e98d21149d781867a6d44855f708b02f03cfe233d8026a0af9c9841b3b9ca diff --git a/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch b/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch index 243605680b387b..69e99c5f99b84a 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /* Disable rate control for now */ bcmgenet_tdma_ring_writel(priv, index, flow_period_val, TDMA_FLOW_PERIOD); -@@ -4083,9 +4083,12 @@ static int bcmgenet_probe(struct platfor +@@ -4084,9 +4084,12 @@ static int bcmgenet_probe(struct platfor netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); /* Set default coalescing parameters */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch b/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch index cd50ba1802ab09..254376ee052a69 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell /* Reinitialize TDMA and RDMA and SW housekeeping */ ret = bcmgenet_init_dma(priv); -@@ -4212,7 +4220,7 @@ static int bcmgenet_resume(struct device +@@ -4213,7 +4221,7 @@ static int bcmgenet_resume(struct device bcmgenet_hfb_create_rxnfc_filter(priv, rule); /* Disable RX/TX DMA and flush TX queues */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0468-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch b/target/linux/bcm27xx/patches-5.15/950-0468-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch index f9e24ab3ea32b5..974094cebf2d34 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0468-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0468-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -677,9 +677,9 @@ deq_found: +@@ -697,9 +697,9 @@ deq_found: } if ((ep->ep_state & SET_DEQ_PENDING)) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 3ef184fd786808..cf9e3f512eaf7d 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -296,6 +296,7 @@ static void xhci_pci_quirks(struct devic +@@ -297,6 +297,7 @@ static void xhci_pci_quirks(struct devic if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; @@ -32,7 +32,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -667,6 +667,15 @@ static int xhci_move_dequeue_past_td(str +@@ -687,6 +687,15 @@ static int xhci_move_dequeue_past_td(str } while (!cycle_found || !td_last_trb_found); deq_found: diff --git a/target/linux/bcm27xx/patches-5.15/950-0601-xhci-correct-room_on_ring-for-cases-where-there-is-a.patch b/target/linux/bcm27xx/patches-5.15/950-0601-xhci-correct-room_on_ring-for-cases-where-there-is-a.patch index 26e4f7ae78e3c3..49db546b3dc250 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0601-xhci-correct-room_on_ring-for-cases-where-there-is-a.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0601-xhci-correct-room_on_ring-for-cases-where-there-is-a.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -289,6 +289,12 @@ static inline int room_on_ring(struct xh +@@ -309,6 +309,12 @@ static inline int room_on_ring(struct xh return 0; if (ring->type != TYPE_COMMAND && ring->type != TYPE_EVENT) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch index a26619d1cca774..4cb33c75297889 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch @@ -205,7 +205,7 @@ Signed-off-by: Jonathan Bell xhci_err(xhci, "Tried to move enqueue past ring segment\n"); return; } -@@ -3162,7 +3165,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd +@@ -3189,7 +3192,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd * that clears the EHB. */ while (xhci_handle_event(xhci) > 0) { @@ -214,7 +214,7 @@ Signed-off-by: Jonathan Bell continue; xhci_update_erst_dequeue(xhci, event_ring_deq); event_ring_deq = xhci->event_ring->dequeue; -@@ -3304,7 +3307,8 @@ static int prepare_ring(struct xhci_hcd +@@ -3331,7 +3334,8 @@ static int prepare_ring(struct xhci_hcd } } diff --git a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch index b27f505e32966c..2b0030bd91d751 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch @@ -53,7 +53,7 @@ Signed-off-by: Jonathan Bell cycle_state, type, max_packet, flags); --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -297,6 +297,7 @@ static void xhci_pci_quirks(struct devic +@@ -298,6 +298,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; diff --git a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch index ef95a78b3e44eb..5771cfb3d410c3 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -298,6 +298,7 @@ static void xhci_pci_quirks(struct devic +@@ -299,6 +299,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; xhci->quirks |= XHCI_VLI_TRB_CACHE_BUG; @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3617,14 +3617,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3644,14 +3644,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -54,7 +54,7 @@ Signed-off-by: Jonathan Bell full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ if (urb->num_sgs && !(urb->transfer_flags & URB_DMA_MAP_SINGLE)) { -@@ -3661,6 +3662,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3688,6 +3689,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * start_cycle = ring->cycle_state; send_addr = addr; @@ -72,7 +72,7 @@ Signed-off-by: Jonathan Bell /* Queue the TRBs, even if they are zero-length */ for (enqd_len = 0; first_trb || enqd_len < full_len; enqd_len += trb_buff_len) { -@@ -3673,6 +3685,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3700,6 +3712,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; diff --git a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch index 49638b3a057186..526fa29bcc63a2 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch @@ -13,7 +13,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3617,7 +3617,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3644,7 +3644,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell u32 field, length_field, remainder, maxpacket; u64 addr, send_addr; -@@ -3663,14 +3663,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3690,14 +3690,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * send_addr = addr; if (xhci->quirks & XHCI_VLI_SS_BULK_OUT_BUG && @@ -40,7 +40,7 @@ Signed-off-by: Jonathan Bell } /* Queue the TRBs, even if they are zero-length */ -@@ -3685,7 +3680,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3712,7 +3707,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index dbdb141c6dc449..2593f7c0fcbcf6 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3590,6 +3590,11 @@ static int xmit_one(struct sk_buff *skb, +@@ -3592,6 +3592,11 @@ static int xmit_one(struct sk_buff *skb, if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); diff --git a/target/linux/generic/pending-5.15/630-packet_socket_type.patch b/target/linux/generic/pending-5.15/630-packet_socket_type.patch index 2d2c7b6cc55343..b95ceebac76a69 100644 --- a/target/linux/generic/pending-5.15/630-packet_socket_type.patch +++ b/target/linux/generic/pending-5.15/630-packet_socket_type.patch @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau goto out; if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -2093,12 +2095,12 @@ static int packet_rcv(struct sk_buff *sk +@@ -2091,12 +2093,12 @@ static int packet_rcv(struct sk_buff *sk unsigned int snaplen, res; bool is_drop_n_account = false; @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -2224,12 +2226,12 @@ static int tpacket_rcv(struct sk_buff *s +@@ -2222,12 +2224,12 @@ static int tpacket_rcv(struct sk_buff *s BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3342,6 +3344,7 @@ static int packet_create(struct net *net +@@ -3340,6 +3342,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3979,6 +3982,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3977,6 +3980,16 @@ packet_setsockopt(struct socket *sock, i WRITE_ONCE(po->xmit, val ? packet_direct_xmit : dev_queue_xmit); return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4035,6 +4048,13 @@ static int packet_getsockopt(struct sock +@@ -4033,6 +4046,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 091e65f31e02ed..e56fd325123a41 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau __u8 inner_protocol_type:1; --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6065,6 +6065,9 @@ static enum gro_result dev_gro_receive(s +@@ -6067,6 +6067,9 @@ static enum gro_result dev_gro_receive(s int same_flow; int grow; @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -8079,6 +8082,48 @@ static void __netdev_adjacent_dev_unlink +@@ -8081,6 +8084,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info, -@@ -8130,6 +8175,7 @@ static int __netdev_upper_dev_link(struc +@@ -8132,6 +8177,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -8226,6 +8272,7 @@ static void __netdev_upper_dev_unlink(st +@@ -8228,6 +8274,7 @@ static void __netdev_upper_dev_unlink(st __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); -@@ -9045,6 +9092,7 @@ int dev_set_mac_address(struct net_devic +@@ -9047,6 +9094,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch index fc83416b2a916d..67e9d6419bcb42 100644 --- a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch +++ b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #endif --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4574,7 +4574,7 @@ static int rps_ipi_queued(struct softnet +@@ -4576,7 +4576,7 @@ static int rps_ipi_queued(struct softnet #ifdef CONFIG_RPS struct softnet_data *mysd = this_cpu_ptr(&softnet_data); @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5755,6 +5755,8 @@ static DEFINE_PER_CPU(struct work_struct +@@ -5757,6 +5757,8 @@ static DEFINE_PER_CPU(struct work_struct /* Network device is going away, flush any packets still pending */ static void flush_backlog(struct work_struct *work) { @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau struct sk_buff *skb, *tmp; struct softnet_data *sd; -@@ -5770,9 +5772,18 @@ static void flush_backlog(struct work_st +@@ -5772,9 +5774,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->process_queue); -@@ -5780,7 +5791,18 @@ static void flush_backlog(struct work_st +@@ -5782,7 +5793,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau } static bool flush_required(int cpu) -@@ -6463,6 +6485,7 @@ static int process_backlog(struct napi_s +@@ -6465,6 +6487,7 @@ static int process_backlog(struct napi_s local_irq_disable(); rps_lock(sd); @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6472,7 +6495,8 @@ static int process_backlog(struct napi_s +@@ -6474,7 +6497,8 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6889,6 +6913,57 @@ int dev_set_threaded(struct net_device * +@@ -6891,6 +6915,57 @@ int dev_set_threaded(struct net_device * } EXPORT_SYMBOL(dev_set_threaded); @@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -11367,6 +11442,9 @@ static int dev_cpu_dead(unsigned int old +@@ -11369,6 +11444,9 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; oldsd->rps_ipi_list = NULL; -@@ -11706,6 +11784,7 @@ static int __init net_dev_init(void) +@@ -11708,6 +11786,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif diff --git a/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch b/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch index 8f2f4c0c4aa227..63a5050ebb5fa9 100644 --- a/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch +++ b/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch @@ -83,7 +83,7 @@ Signed-off-by: Sander Vanheule obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h -@@ -177,6 +177,7 @@ enum cpuhp_state { +@@ -176,6 +176,7 @@ enum cpuhp_state { CPUHP_AP_MARCO_TIMER_STARTING, CPUHP_AP_MIPS_GIC_TIMER_STARTING, CPUHP_AP_ARC_TIMER_STARTING, diff --git a/target/linux/x86/patches-5.15/103-pcengines_apu6_platform.patch b/target/linux/x86/patches-5.15/103-pcengines_apu6_platform.patch index 03cb33acbf7349..9ec0a33c3110aa 100644 --- a/target/linux/x86/patches-5.15/103-pcengines_apu6_platform.patch +++ b/target/linux/x86/patches-5.15/103-pcengines_apu6_platform.patch @@ -63,7 +63,7 @@ Sighed-off-by: Philip Prindeville --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig -@@ -701,7 +701,7 @@ config XO1_RFKILL +@@ -661,7 +661,7 @@ config XO1_RFKILL laptop. config PCENGINES_APU2 @@ -72,7 +72,7 @@ Sighed-off-by: Philip Prindeville depends on INPUT && INPUT_KEYBOARD && GPIOLIB depends on LEDS_CLASS select GPIO_AMD_FCH -@@ -709,7 +709,7 @@ config PCENGINES_APU2 +@@ -669,7 +669,7 @@ config PCENGINES_APU2 select LEDS_GPIO help This driver provides support for the front button and LEDs on From 912974cc15031acb3ccf8e1bf12c5809ce01464e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 26 May 2023 10:26:49 +0100 Subject: [PATCH 0043/1171] mediatek: fix, clean and unify SD card image generation Make sure sub-images on the SD card are size-checked, allow generating SD card without squashfs and/or initramfs. Signed-off-by: Daniel Golle (cherry picked from commit 43d27b02522c100b0c625d4b22f4bb6ad83c166f) --- target/linux/mediatek/image/filogic.mk | 5 +++-- target/linux/mediatek/image/mt7622.mk | 7 ++++--- target/linux/mediatek/image/mt7623.mk | 10 ++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 72adb490666414..fac72a1b371fd7 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -119,8 +119,9 @@ define Device/bananapi_bpi-r3 pad-to 52M | bl31-uboot bananapi_bpi-r3-emmc |\ pad-to 56M | mt7986-gpt emmc |\ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ - pad-to 64M | append-image squashfs-sysupgrade.itb | check-size | gzip \ - ) + pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ + ) \ + gzip IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | \ diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 12e819ed5454a3..92824ff24a6f77 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -88,9 +88,10 @@ define Device/bananapi_bpi-r64 pad-to 40960k | bl31-uboot bananapi_bpi-r64-emmc |\ pad-to 43008k | bl2 snand-2ddr |\ pad-to 43520k | bl31-uboot bananapi_bpi-r64-snand |\ - $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ - pad-to 46080k | append-image squashfs-sysupgrade.itb | check-size | gzip \ - ) + $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS), \ + pad-to 46080k | append-image squashfs-sysupgrade.itb | check-size |\ + ) \ + gzip IMAGE_SIZE := $$(shell expr 45 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 1645ecd5450756..5828c4d763d937 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -96,6 +96,7 @@ define Device/bananapi_bpi-r2 KERNEL := kernel-bin | gzip KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd + IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata ARTIFACT/preloader.bin := mt7623-mbr emmc |\ pad-to 2k | append-preloader $$(UBOOT_TARGET) @@ -105,10 +106,10 @@ define Device/bananapi_bpi-r2 pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\ pad-to 4092k | mt7623-mbr emmc |\ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ - pad-to 4M | append-image-stage initramfs-recovery.itb |\ + pad-to 4M | append-image-stage initramfs-recovery.itb | check-size 48m |\ ) \ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ - pad-to 48M | append-image squashfs-sysupgrade.itb |\ + pad-to 48M | append-image squashfs-sysupgrade.itb | check-size |\ ) \ gzip ARTIFACTS := u-boot.bin preloader.bin sdcard.img.gz @@ -129,6 +130,7 @@ define Device/unielec_u7623-02 UBOOT_TARGET := mt7623a_unielec_u7623 UBOOT_IMAGE := u-boot-mtk.bin UBOOT_PATH := $(STAGING_DIR_IMAGE)/$$(UBOOT_TARGET)-$$(UBOOT_IMAGE) + IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m IMAGES := sysupgrade.itb KERNEL := kernel-bin | gzip KERNEL_INITRAMFS_SUFFIX := -recovery.itb @@ -140,10 +142,10 @@ define Device/unielec_u7623-02 ARTIFACT/emmc.img.gz := mt7623-mbr sdmmc |\ pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ - pad-to 4M | append-image-stage initramfs-recovery.itb |\ + pad-to 4M | append-image-stage initramfs-recovery.itb | check-size 48m |\ ) \ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ - pad-to 48M | append-image squashfs-sysupgrade.itb |\ + pad-to 48M | append-image squashfs-sysupgrade.itb | check-size |\ ) \ gzip | append-metadata ARTIFACT/scatter.txt := scatterfile emmc.img.gz From dc2841045dec20209472938d50fdb27dc6682910 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Tue, 23 May 2023 16:47:42 +0200 Subject: [PATCH 0044/1171] ramips: mark patches accepted upstream Add kernel tags to the patches that got accepted upstream. Signed-off-by: Nick Hainke (cherry picked from commit 2388b119de9279d7adaa525c7ba502fcae1fe187) Signed-off-by: Daniel Golle --- ...16-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch} | 0 ...101-v5.17-PCI-mt7621-Rename-mt7621_pci_-to-mt7621_pcie_.patch} | 0 ...h => 102-v5.17-PCI-mt7621-Declare-mt7621_pci_ops-static.patch} | 0 ...17-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch} | 0 ...17-PCI-mt7621-Drop-of_match_ptr-to-avoid-unused-variabl.patch} | 0 ...=> 105-v5.17-PCI-mt7621-Remove-unused-function-pcie_rmw.patch} | 0 ...17-PCI-Let-pcibios_root_bridge_prepare-access-bridge-wi.patch} | 0 ...tch => 107-v6.2-PCI-mt7621-Add-sentinel-to-quirks-table.patch} | 0 ...h => 108-v6.3-PCI-mt7621-Delay-phy-ports-initialization.patch} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/ramips/patches-5.15/{100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch => 100-v5.16-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch} (100%) rename target/linux/ramips/patches-5.15/{101-PCI-mt7621-Rename-mt7621_pci_-to-mt7621_pcie_.patch => 101-v5.17-PCI-mt7621-Rename-mt7621_pci_-to-mt7621_pcie_.patch} (100%) rename target/linux/ramips/patches-5.15/{102-PCI-mt7621-Declare-mt7621_pci_ops-static.patch => 102-v5.17-PCI-mt7621-Declare-mt7621_pci_ops-static.patch} (100%) rename target/linux/ramips/patches-5.15/{103-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch => 103-v5.17-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch} (100%) rename target/linux/ramips/patches-5.15/{104-PCI-mt7621-Drop-of_match_ptr-to-avoid-unused-variabl.patch => 104-v5.17-PCI-mt7621-Drop-of_match_ptr-to-avoid-unused-variabl.patch} (100%) rename target/linux/ramips/patches-5.15/{105-PCI-mt7621-Remove-unused-function-pcie_rmw.patch => 105-v5.17-PCI-mt7621-Remove-unused-function-pcie_rmw.patch} (100%) rename target/linux/ramips/patches-5.15/{106-PCI-Let-pcibios_root_bridge_prepare-access-bridge-wi.patch => 106-v5.17-PCI-Let-pcibios_root_bridge_prepare-access-bridge-wi.patch} (100%) rename target/linux/ramips/patches-5.15/{107-PCI-mt7621-Add-sentinel-to-quirks-table.patch => 107-v6.2-PCI-mt7621-Add-sentinel-to-quirks-table.patch} (100%) rename target/linux/ramips/patches-5.15/{108-PCI-mt7621-Delay-phy-ports-initialization.patch => 108-v6.3-PCI-mt7621-Delay-phy-ports-initialization.patch} (100%) diff --git a/target/linux/ramips/patches-5.15/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch b/target/linux/ramips/patches-5.15/100-v5.16-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch similarity index 100% rename from target/linux/ramips/patches-5.15/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch rename to target/linux/ramips/patches-5.15/100-v5.16-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch diff --git a/target/linux/ramips/patches-5.15/101-PCI-mt7621-Rename-mt7621_pci_-to-mt7621_pcie_.patch b/target/linux/ramips/patches-5.15/101-v5.17-PCI-mt7621-Rename-mt7621_pci_-to-mt7621_pcie_.patch similarity index 100% rename from target/linux/ramips/patches-5.15/101-PCI-mt7621-Rename-mt7621_pci_-to-mt7621_pcie_.patch rename to target/linux/ramips/patches-5.15/101-v5.17-PCI-mt7621-Rename-mt7621_pci_-to-mt7621_pcie_.patch diff --git a/target/linux/ramips/patches-5.15/102-PCI-mt7621-Declare-mt7621_pci_ops-static.patch b/target/linux/ramips/patches-5.15/102-v5.17-PCI-mt7621-Declare-mt7621_pci_ops-static.patch similarity index 100% rename from target/linux/ramips/patches-5.15/102-PCI-mt7621-Declare-mt7621_pci_ops-static.patch rename to target/linux/ramips/patches-5.15/102-v5.17-PCI-mt7621-Declare-mt7621_pci_ops-static.patch diff --git a/target/linux/ramips/patches-5.15/103-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch b/target/linux/ramips/patches-5.15/103-v5.17-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch similarity index 100% rename from target/linux/ramips/patches-5.15/103-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch rename to target/linux/ramips/patches-5.15/103-v5.17-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch diff --git a/target/linux/ramips/patches-5.15/104-PCI-mt7621-Drop-of_match_ptr-to-avoid-unused-variabl.patch b/target/linux/ramips/patches-5.15/104-v5.17-PCI-mt7621-Drop-of_match_ptr-to-avoid-unused-variabl.patch similarity index 100% rename from target/linux/ramips/patches-5.15/104-PCI-mt7621-Drop-of_match_ptr-to-avoid-unused-variabl.patch rename to target/linux/ramips/patches-5.15/104-v5.17-PCI-mt7621-Drop-of_match_ptr-to-avoid-unused-variabl.patch diff --git a/target/linux/ramips/patches-5.15/105-PCI-mt7621-Remove-unused-function-pcie_rmw.patch b/target/linux/ramips/patches-5.15/105-v5.17-PCI-mt7621-Remove-unused-function-pcie_rmw.patch similarity index 100% rename from target/linux/ramips/patches-5.15/105-PCI-mt7621-Remove-unused-function-pcie_rmw.patch rename to target/linux/ramips/patches-5.15/105-v5.17-PCI-mt7621-Remove-unused-function-pcie_rmw.patch diff --git a/target/linux/ramips/patches-5.15/106-PCI-Let-pcibios_root_bridge_prepare-access-bridge-wi.patch b/target/linux/ramips/patches-5.15/106-v5.17-PCI-Let-pcibios_root_bridge_prepare-access-bridge-wi.patch similarity index 100% rename from target/linux/ramips/patches-5.15/106-PCI-Let-pcibios_root_bridge_prepare-access-bridge-wi.patch rename to target/linux/ramips/patches-5.15/106-v5.17-PCI-Let-pcibios_root_bridge_prepare-access-bridge-wi.patch diff --git a/target/linux/ramips/patches-5.15/107-PCI-mt7621-Add-sentinel-to-quirks-table.patch b/target/linux/ramips/patches-5.15/107-v6.2-PCI-mt7621-Add-sentinel-to-quirks-table.patch similarity index 100% rename from target/linux/ramips/patches-5.15/107-PCI-mt7621-Add-sentinel-to-quirks-table.patch rename to target/linux/ramips/patches-5.15/107-v6.2-PCI-mt7621-Add-sentinel-to-quirks-table.patch diff --git a/target/linux/ramips/patches-5.15/108-PCI-mt7621-Delay-phy-ports-initialization.patch b/target/linux/ramips/patches-5.15/108-v6.3-PCI-mt7621-Delay-phy-ports-initialization.patch similarity index 100% rename from target/linux/ramips/patches-5.15/108-PCI-mt7621-Delay-phy-ports-initialization.patch rename to target/linux/ramips/patches-5.15/108-v6.3-PCI-mt7621-Delay-phy-ports-initialization.patch From 7f0e1373f40c45e3b8c3ec4517070e8b9dec2a64 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 26 May 2023 13:49:02 +0100 Subject: [PATCH 0045/1171] mediatek: cleanly backport and add fix for I2C driver Pick accepted patches from upstream Linux tree instead of having to maintain our slightly different downstream patches. Import pending patch fixing I2C on MT7981 by making sure all clocks are enabled before accessing I2C registers. Signed-off-by: Daniel Golle (cherry picked from commit 213b7282760506ffab9151a20347d65ea70ed916) --- .../arch/arm64/boot/dts/mediatek/mt7981.dtsi | 6 +- ...-mediatek-add-support-for-MT7981-SoC.patch | 74 --- ...et-the-handshake-signal-between-i2c-.patch | 74 +++ ...p-i2c-dma-register-when-a-timeout-oc.patch | 102 +++ ...d-i2c-compatible-for-Mediatek-MT8186.patch | 45 ++ ...modify-bus-speed-calculation-formula.patch | 132 ++++ ...mediatek-remove-redundant-null-check.patch | 41 ++ ...18-i2c-mt65xx-Simplify-with-clk-bulk.patch | 234 +++++++ ...d-i2c-compatible-for-Mediatek-MT8168.patch | 46 ++ ...imize-master_xfer-and-avoid-circular.patch | 101 +++ ...-an-error-handling-path-in-mtk_i2c_p.patch | 48 ++ ...diatek-add-i2c-compatible-for-MT8188.patch | 82 +++ ...move-drivers-from-strlcpy-to-strscpy.patch | 579 ++++++++++++++++++ ...6.2-i2c-mediatek-add-mt7986-support.patch} | 24 +- ...evm_platform_get_and_ioremap_resourc.patch | 42 ++ ...t65xx-drop-of_match_ptr-for-ID-table.patch | 33 + ...-mediatek-add-support-for-MT7981-SoC.patch | 47 ++ ...ing-i2c-mt65xx-add-additional-clocks.patch | 55 ++ 18 files changed, 1684 insertions(+), 81 deletions(-) delete mode 100644 target/linux/mediatek/patches-5.15/810-i2c-mediatek-add-support-for-MT7981-SoC.patch create mode 100644 target/linux/mediatek/patches-5.15/840-v5.16-i2c-mediatek-Reset-the-handshake-signal-between-i2c-.patch create mode 100644 target/linux/mediatek/patches-5.15/841-v5.16-i2c-mediatek-Dump-i2c-dma-register-when-a-timeout-oc.patch create mode 100644 target/linux/mediatek/patches-5.15/842-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8186.patch create mode 100644 target/linux/mediatek/patches-5.15/843-v5.18-i2c-mediatek-modify-bus-speed-calculation-formula.patch create mode 100644 target/linux/mediatek/patches-5.15/844-v5.18-i2c-mediatek-remove-redundant-null-check.patch create mode 100644 target/linux/mediatek/patches-5.15/845-v5.18-i2c-mt65xx-Simplify-with-clk-bulk.patch create mode 100644 target/linux/mediatek/patches-5.15/846-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8168.patch create mode 100644 target/linux/mediatek/patches-5.15/847-v5.19-i2c-mediatek-Optimize-master_xfer-and-avoid-circular.patch create mode 100644 target/linux/mediatek/patches-5.15/848-v5.19-i2c-mediatek-Fix-an-error-handling-path-in-mtk_i2c_p.patch create mode 100644 target/linux/mediatek/patches-5.15/849-v6.0-i2c-mediatek-add-i2c-compatible-for-MT8188.patch create mode 100644 target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch rename target/linux/mediatek/patches-5.15/{803-i2c-busses-add-mt7986-support.patch => 851-v6.2-i2c-mediatek-add-mt7986-support.patch} (54%) create mode 100644 target/linux/mediatek/patches-5.15/852-v6.3-i2c-mt65xx-Use-devm_platform_get_and_ioremap_resourc.patch create mode 100644 target/linux/mediatek/patches-5.15/853-v6.3-i2c-mt65xx-drop-of_match_ptr-for-ID-table.patch create mode 100644 target/linux/mediatek/patches-5.15/854-v6.4-i2c-mediatek-add-support-for-MT7981-SoC.patch create mode 100644 target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index 95b548143b43b0..07a8c06979e58f 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -317,8 +317,10 @@ interrupts = ; clock-div = <1>; clocks = <&infracfg CLK_INFRA_I2C0_CK>, - <&infracfg CLK_INFRA_AP_DMA_CK>; - clock-names = "main", "dma"; + <&infracfg CLK_INFRA_AP_DMA_CK>, + <&infracfg CLK_INFRA_I2C_MCK_CK>, + <&infracfg CLK_INFRA_I2C_PCK_CK>; + clock-names = "main", "dma", "mck", "pck"; #address-cells = <1>; #size-cells = <0>; status = "disabled"; diff --git a/target/linux/mediatek/patches-5.15/810-i2c-mediatek-add-support-for-MT7981-SoC.patch b/target/linux/mediatek/patches-5.15/810-i2c-mediatek-add-support-for-MT7981-SoC.patch deleted file mode 100644 index f9ad79c4430a08..00000000000000 --- a/target/linux/mediatek/patches-5.15/810-i2c-mediatek-add-support-for-MT7981-SoC.patch +++ /dev/null @@ -1,74 +0,0 @@ -From bd4f7dae6a1f2fd65bb2112783c92ffe0839bc77 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Tue, 28 Feb 2023 23:53:56 +0000 -Subject: [PATCH] i2c: mediatek: add support for MT7981 SoC - -Signed-off-by: Daniel Golle ---- - drivers/i2c/busses/i2c-mt65xx.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/drivers/i2c/busses/i2c-mt65xx.c -+++ b/drivers/i2c/busses/i2c-mt65xx.c -@@ -202,6 +202,34 @@ static const u16 mt_i2c_regs_v2[] = { - [OFFSET_DCM_EN] = 0xf88, - }; - -+static const u16 mt_i2c_regs_v3[] = { -+ [OFFSET_DATA_PORT] = 0x0, -+ [OFFSET_INTR_MASK] = 0x8, -+ [OFFSET_INTR_STAT] = 0xc, -+ [OFFSET_CONTROL] = 0x10, -+ [OFFSET_TRANSFER_LEN] = 0x14, -+ [OFFSET_TRANSAC_LEN] = 0x18, -+ [OFFSET_DELAY_LEN] = 0x1c, -+ [OFFSET_TIMING] = 0x20, -+ [OFFSET_START] = 0x24, -+ [OFFSET_EXT_CONF] = 0x28, -+ [OFFSET_LTIMING] = 0x2c, -+ [OFFSET_HS] = 0x30, -+ [OFFSET_IO_CONFIG] = 0x34, -+ [OFFSET_FIFO_ADDR_CLR] = 0x38, -+ [OFFSET_SDA_TIMING] = 0x3c, -+ [OFFSET_TRANSFER_LEN_AUX] = 0x44, -+ [OFFSET_CLOCK_DIV] = 0x48, -+ [OFFSET_SOFTRESET] = 0x50, -+ [OFFSET_SCL_MIS_COMP_POINT] = 0x90, -+ [OFFSET_SLAVE_ADDR] = 0x94, -+ [OFFSET_DEBUGSTAT] = 0xe4, -+ [OFFSET_DEBUGCTRL] = 0xe8, -+ [OFFSET_FIFO_STAT] = 0xf4, -+ [OFFSET_FIFO_THRESH] = 0xf8, -+ [OFFSET_DCM_EN] = 0xf88, -+}; -+ - struct mtk_i2c_compatible { - const struct i2c_adapter_quirks *quirks; - const u16 *regs; -@@ -365,6 +393,18 @@ static const struct mtk_i2c_compatible m - .max_dma_support = 32, - }; - -+static const struct mtk_i2c_compatible mt7981_compat = { -+ .regs = mt_i2c_regs_v3, -+ .pmic_i2c = 0, -+ .dcm = 0, -+ .auto_restart = 1, -+ .aux_len_reg = 1, -+ .timing_adjust = 1, -+ .dma_sync = 1, -+ .ltiming_adjust = 1, -+ .max_dma_support = 33 -+}; -+ - static const struct mtk_i2c_compatible mt7986_compat = { - .quirks = &mt7622_i2c_quirks, - .regs = mt_i2c_regs_v1, -@@ -424,6 +464,7 @@ static const struct of_device_id mtk_i2c - { .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat }, - { .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat }, - { .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat }, -+ { .compatible = "mediatek,mt7981-i2c", .data = &mt7981_compat }, - { .compatible = "mediatek,mt7986-i2c", .data = &mt7986_compat }, - { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, - { .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat }, diff --git a/target/linux/mediatek/patches-5.15/840-v5.16-i2c-mediatek-Reset-the-handshake-signal-between-i2c-.patch b/target/linux/mediatek/patches-5.15/840-v5.16-i2c-mediatek-Reset-the-handshake-signal-between-i2c-.patch new file mode 100644 index 00000000000000..8b0119640984c9 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/840-v5.16-i2c-mediatek-Reset-the-handshake-signal-between-i2c-.patch @@ -0,0 +1,74 @@ +From 95e4dfbf33dc0a0843ba20db811f7ea271235e1e Mon Sep 17 00:00:00 2001 +From: Kewei Xu +Date: Sun, 10 Oct 2021 15:05:12 +0800 +Subject: [PATCH 01/16] i2c: mediatek: Reset the handshake signal between i2c + and dma + +Due to changes in the hardware design of the handshaking signal +between i2c and dma, it is necessary to reset the handshaking +signal before each transfer to ensure that the multi-msgs can +be transferred correctly. + +Signed-off-by: Kewei Xu +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -49,6 +50,8 @@ + #define I2C_RD_TRANAC_VALUE 0x0001 + #define I2C_SCL_MIS_COMP_VALUE 0x0000 + #define I2C_CHN_CLR_FLAG 0x0000 ++#define I2C_RELIABILITY 0x0010 ++#define I2C_DMAACK_ENABLE 0x0008 + + #define I2C_DMA_CON_TX 0x0000 + #define I2C_DMA_CON_RX 0x0001 +@@ -851,6 +854,7 @@ static int mtk_i2c_do_transfer(struct mt + u16 restart_flag = 0; + u16 dma_sync = 0; + u32 reg_4g_mode; ++ u32 reg_dma_reset; + u8 *dma_rd_buf = NULL; + u8 *dma_wr_buf = NULL; + dma_addr_t rpaddr = 0; +@@ -864,6 +868,28 @@ static int mtk_i2c_do_transfer(struct mt + + reinit_completion(&i2c->msg_complete); + ++ if (i2c->dev_comp->apdma_sync && ++ i2c->op != I2C_MASTER_WRRD && num > 1) { ++ mtk_i2c_writew(i2c, 0x00, OFFSET_DEBUGCTRL); ++ writel(I2C_DMA_HANDSHAKE_RST | I2C_DMA_WARM_RST, ++ i2c->pdmabase + OFFSET_RST); ++ ++ ret = readw_poll_timeout(i2c->pdmabase + OFFSET_RST, ++ reg_dma_reset, ++ !(reg_dma_reset & I2C_DMA_WARM_RST), ++ 0, 100); ++ if (ret) { ++ dev_err(i2c->dev, "DMA warm reset timeout\n"); ++ return -ETIMEDOUT; ++ } ++ ++ writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST); ++ mtk_i2c_writew(i2c, I2C_HANDSHAKE_RST, OFFSET_SOFTRESET); ++ mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_SOFTRESET); ++ mtk_i2c_writew(i2c, I2C_RELIABILITY | I2C_DMAACK_ENABLE, ++ OFFSET_DEBUGCTRL); ++ } ++ + control_reg = mtk_i2c_readw(i2c, OFFSET_CONTROL) & + ~(I2C_CONTROL_DIR_CHANGE | I2C_CONTROL_RS); + if ((i2c->speed_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) || (left_num >= 1)) diff --git a/target/linux/mediatek/patches-5.15/841-v5.16-i2c-mediatek-Dump-i2c-dma-register-when-a-timeout-oc.patch b/target/linux/mediatek/patches-5.15/841-v5.16-i2c-mediatek-Dump-i2c-dma-register-when-a-timeout-oc.patch new file mode 100644 index 00000000000000..a2d2521c772f87 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/841-v5.16-i2c-mediatek-Dump-i2c-dma-register-when-a-timeout-oc.patch @@ -0,0 +1,102 @@ +From 5b8e29e566e086ef9b5b9ea0d054370a295e1d05 Mon Sep 17 00:00:00 2001 +From: Kewei Xu +Date: Sun, 10 Oct 2021 15:05:13 +0800 +Subject: [PATCH 02/16] i2c: mediatek: Dump i2c/dma register when a timeout + occurs + +When a timeout error occurs in i2c transter, it is usually related +to the i2c/dma IP hardware configuration. Therefore, the purpose of +this patch is to dump the key register values of i2c/dma when a +timeout occurs in i2c for debugging. + +Signed-off-by: Kewei Xu +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 54 +++++++++++++++++++++++++++++++++ + 1 file changed, 54 insertions(+) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -130,6 +130,7 @@ enum I2C_REGS_OFFSET { + OFFSET_HS, + OFFSET_SOFTRESET, + OFFSET_DCM_EN, ++ OFFSET_MULTI_DMA, + OFFSET_PATH_DIR, + OFFSET_DEBUGSTAT, + OFFSET_DEBUGCTRL, +@@ -197,6 +198,7 @@ static const u16 mt_i2c_regs_v2[] = { + [OFFSET_TRANSFER_LEN_AUX] = 0x44, + [OFFSET_CLOCK_DIV] = 0x48, + [OFFSET_SOFTRESET] = 0x50, ++ [OFFSET_MULTI_DMA] = 0x8c, + [OFFSET_SCL_MIS_COMP_POINT] = 0x90, + [OFFSET_DEBUGSTAT] = 0xe4, + [OFFSET_DEBUGCTRL] = 0xe8, +@@ -845,6 +847,57 @@ static int mtk_i2c_set_speed(struct mtk_ + return 0; + } + ++static void i2c_dump_register(struct mtk_i2c *i2c) ++{ ++ dev_dbg(i2c->dev, "SLAVE_ADDR: 0x%x, INTR_MASK: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_SLAVE_ADDR), ++ mtk_i2c_readw(i2c, OFFSET_INTR_MASK)); ++ dev_dbg(i2c->dev, "INTR_STAT: 0x%x, CONTROL: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_INTR_STAT), ++ mtk_i2c_readw(i2c, OFFSET_CONTROL)); ++ dev_dbg(i2c->dev, "TRANSFER_LEN: 0x%x, TRANSAC_LEN: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_TRANSFER_LEN), ++ mtk_i2c_readw(i2c, OFFSET_TRANSAC_LEN)); ++ dev_dbg(i2c->dev, "DELAY_LEN: 0x%x, HTIMING: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_DELAY_LEN), ++ mtk_i2c_readw(i2c, OFFSET_TIMING)); ++ dev_dbg(i2c->dev, "START: 0x%x, EXT_CONF: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_START), ++ mtk_i2c_readw(i2c, OFFSET_EXT_CONF)); ++ dev_dbg(i2c->dev, "HS: 0x%x, IO_CONFIG: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_HS), ++ mtk_i2c_readw(i2c, OFFSET_IO_CONFIG)); ++ dev_dbg(i2c->dev, "DCM_EN: 0x%x, TRANSFER_LEN_AUX: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_DCM_EN), ++ mtk_i2c_readw(i2c, OFFSET_TRANSFER_LEN_AUX)); ++ dev_dbg(i2c->dev, "CLOCK_DIV: 0x%x, FIFO_STAT: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_CLOCK_DIV), ++ mtk_i2c_readw(i2c, OFFSET_FIFO_STAT)); ++ dev_dbg(i2c->dev, "DEBUGCTRL : 0x%x, DEBUGSTAT: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_DEBUGCTRL), ++ mtk_i2c_readw(i2c, OFFSET_DEBUGSTAT)); ++ if (i2c->dev_comp->regs == mt_i2c_regs_v2) { ++ dev_dbg(i2c->dev, "LTIMING: 0x%x, MULTI_DMA: 0x%x\n", ++ mtk_i2c_readw(i2c, OFFSET_LTIMING), ++ mtk_i2c_readw(i2c, OFFSET_MULTI_DMA)); ++ } ++ dev_dbg(i2c->dev, "\nDMA_INT_FLAG: 0x%x, DMA_INT_EN: 0x%x\n", ++ readl(i2c->pdmabase + OFFSET_INT_FLAG), ++ readl(i2c->pdmabase + OFFSET_INT_EN)); ++ dev_dbg(i2c->dev, "DMA_EN: 0x%x, DMA_CON: 0x%x\n", ++ readl(i2c->pdmabase + OFFSET_EN), ++ readl(i2c->pdmabase + OFFSET_CON)); ++ dev_dbg(i2c->dev, "DMA_TX_MEM_ADDR: 0x%x, DMA_RX_MEM_ADDR: 0x%x\n", ++ readl(i2c->pdmabase + OFFSET_TX_MEM_ADDR), ++ readl(i2c->pdmabase + OFFSET_RX_MEM_ADDR)); ++ dev_dbg(i2c->dev, "DMA_TX_LEN: 0x%x, DMA_RX_LEN: 0x%x\n", ++ readl(i2c->pdmabase + OFFSET_TX_LEN), ++ readl(i2c->pdmabase + OFFSET_RX_LEN)); ++ dev_dbg(i2c->dev, "DMA_TX_4G_MODE: 0x%x, DMA_RX_4G_MODE: 0x%x", ++ readl(i2c->pdmabase + OFFSET_TX_4G_MODE), ++ readl(i2c->pdmabase + OFFSET_RX_4G_MODE)); ++} ++ + static int mtk_i2c_do_transfer(struct mtk_i2c *i2c, struct i2c_msg *msgs, + int num, int left_num) + { +@@ -1075,6 +1128,7 @@ static int mtk_i2c_do_transfer(struct mt + + if (ret == 0) { + dev_dbg(i2c->dev, "addr: %x, transfer timeout\n", msgs->addr); ++ i2c_dump_register(i2c); + mtk_i2c_init_hw(i2c); + return -ETIMEDOUT; + } diff --git a/target/linux/mediatek/patches-5.15/842-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8186.patch b/target/linux/mediatek/patches-5.15/842-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8186.patch new file mode 100644 index 00000000000000..184fe94ff80bde --- /dev/null +++ b/target/linux/mediatek/patches-5.15/842-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8186.patch @@ -0,0 +1,45 @@ +From 83630e3c6147bf7bb18a18f3d5a99462464f450b Mon Sep 17 00:00:00 2001 +From: Kewei Xu +Date: Tue, 25 Jan 2022 19:04:13 +0800 +Subject: [PATCH 03/16] i2c: mediatek: Add i2c compatible for Mediatek MT8186 + +Add i2c compatible for MT8186. Compare to MT8192 i2c controller, +MT8186 doesn't need handshake signal witch apdma. + +Signed-off-by: Kewei Xu +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -397,6 +397,19 @@ static const struct mtk_i2c_compatible m + .max_dma_support = 33, + }; + ++static const struct mtk_i2c_compatible mt8186_compat = { ++ .regs = mt_i2c_regs_v2, ++ .pmic_i2c = 0, ++ .dcm = 0, ++ .auto_restart = 1, ++ .aux_len_reg = 1, ++ .timing_adjust = 1, ++ .dma_sync = 0, ++ .ltiming_adjust = 1, ++ .apdma_sync = 0, ++ .max_dma_support = 36, ++}; ++ + static const struct mtk_i2c_compatible mt8192_compat = { + .quirks = &mt8183_i2c_quirks, + .regs = mt_i2c_regs_v2, +@@ -418,6 +431,7 @@ static const struct of_device_id mtk_i2c + { .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat }, + { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, + { .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat }, ++ { .compatible = "mediatek,mt8186-i2c", .data = &mt8186_compat }, + { .compatible = "mediatek,mt8192-i2c", .data = &mt8192_compat }, + {} + }; diff --git a/target/linux/mediatek/patches-5.15/843-v5.18-i2c-mediatek-modify-bus-speed-calculation-formula.patch b/target/linux/mediatek/patches-5.15/843-v5.18-i2c-mediatek-modify-bus-speed-calculation-formula.patch new file mode 100644 index 00000000000000..0ace4a6701c5d5 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/843-v5.18-i2c-mediatek-modify-bus-speed-calculation-formula.patch @@ -0,0 +1,132 @@ +From f606aab3f1a49d723d66e14e545f6ca45005bda6 Mon Sep 17 00:00:00 2001 +From: Kewei Xu +Date: Thu, 17 Feb 2022 20:22:43 +0800 +Subject: [PATCH 04/16] i2c: mediatek: modify bus speed calculation formula + +When clock-div is 0 or greater than 1, the bus speed +calculated by the old speed calculation formula will be +larger than the target speed. So we update the formula. + +Signed-off-by: Kewei Xu +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 51 ++++++++++++++++++++++++++------- + 1 file changed, 41 insertions(+), 10 deletions(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -67,11 +67,12 @@ + + #define MAX_SAMPLE_CNT_DIV 8 + #define MAX_STEP_CNT_DIV 64 +-#define MAX_CLOCK_DIV 256 ++#define MAX_CLOCK_DIV_8BITS 256 ++#define MAX_CLOCK_DIV_5BITS 32 + #define MAX_HS_STEP_CNT_DIV 8 +-#define I2C_STANDARD_MODE_BUFFER (1000 / 2) +-#define I2C_FAST_MODE_BUFFER (300 / 2) +-#define I2C_FAST_MODE_PLUS_BUFFER (20 / 2) ++#define I2C_STANDARD_MODE_BUFFER (1000 / 3) ++#define I2C_FAST_MODE_BUFFER (300 / 3) ++#define I2C_FAST_MODE_PLUS_BUFFER (20 / 3) + + #define I2C_CONTROL_RS (0x1 << 1) + #define I2C_CONTROL_DMA_EN (0x1 << 2) +@@ -604,6 +605,31 @@ static int mtk_i2c_max_step_cnt(unsigned + return MAX_STEP_CNT_DIV; + } + ++static int mtk_i2c_get_clk_div_restri(struct mtk_i2c *i2c, ++ unsigned int sample_cnt) ++{ ++ int clk_div_restri = 0; ++ ++ if (i2c->dev_comp->ltiming_adjust == 0) ++ return 0; ++ ++ if (sample_cnt == 1) { ++ if (i2c->ac_timing.inter_clk_div == 0) ++ clk_div_restri = 0; ++ else ++ clk_div_restri = 1; ++ } else { ++ if (i2c->ac_timing.inter_clk_div == 0) ++ clk_div_restri = -1; ++ else if (i2c->ac_timing.inter_clk_div == 1) ++ clk_div_restri = 0; ++ else ++ clk_div_restri = 1; ++ } ++ ++ return clk_div_restri; ++} ++ + /* + * Check and Calculate i2c ac-timing + * +@@ -732,6 +758,7 @@ static int mtk_i2c_calculate_speed(struc + unsigned int best_mul; + unsigned int cnt_mul; + int ret = -EINVAL; ++ int clk_div_restri = 0; + + if (target_speed > I2C_MAX_HIGH_SPEED_MODE_FREQ) + target_speed = I2C_MAX_HIGH_SPEED_MODE_FREQ; +@@ -749,7 +776,8 @@ static int mtk_i2c_calculate_speed(struc + * optimizing for sample_cnt * step_cnt being minimal + */ + for (sample_cnt = 1; sample_cnt <= MAX_SAMPLE_CNT_DIV; sample_cnt++) { +- step_cnt = DIV_ROUND_UP(opt_div, sample_cnt); ++ clk_div_restri = mtk_i2c_get_clk_div_restri(i2c, sample_cnt); ++ step_cnt = DIV_ROUND_UP(opt_div + clk_div_restri, sample_cnt); + cnt_mul = step_cnt * sample_cnt; + if (step_cnt > max_step_cnt) + continue; +@@ -763,7 +791,7 @@ static int mtk_i2c_calculate_speed(struc + best_mul = cnt_mul; + base_sample_cnt = sample_cnt; + base_step_cnt = step_cnt; +- if (best_mul == opt_div) ++ if (best_mul == (opt_div + clk_div_restri)) + break; + } + } +@@ -774,7 +802,8 @@ static int mtk_i2c_calculate_speed(struc + sample_cnt = base_sample_cnt; + step_cnt = base_step_cnt; + +- if ((clk_src / (2 * sample_cnt * step_cnt)) > target_speed) { ++ if ((clk_src / (2 * (sample_cnt * step_cnt - clk_div_restri))) > ++ target_speed) { + /* In this case, hardware can't support such + * low i2c_bus_freq + */ +@@ -803,13 +832,16 @@ static int mtk_i2c_set_speed(struct mtk_ + target_speed = i2c->speed_hz; + parent_clk /= i2c->clk_src_div; + +- if (i2c->dev_comp->timing_adjust) +- max_clk_div = MAX_CLOCK_DIV; ++ if (i2c->dev_comp->timing_adjust && i2c->dev_comp->ltiming_adjust) ++ max_clk_div = MAX_CLOCK_DIV_5BITS; ++ else if (i2c->dev_comp->timing_adjust) ++ max_clk_div = MAX_CLOCK_DIV_8BITS; + else + max_clk_div = 1; + + for (clk_div = 1; clk_div <= max_clk_div; clk_div++) { + clk_src = parent_clk / clk_div; ++ i2c->ac_timing.inter_clk_div = clk_div - 1; + + if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) { + /* Set master code speed register */ +@@ -856,7 +888,6 @@ static int mtk_i2c_set_speed(struct mtk_ + break; + } + +- i2c->ac_timing.inter_clk_div = clk_div - 1; + + return 0; + } diff --git a/target/linux/mediatek/patches-5.15/844-v5.18-i2c-mediatek-remove-redundant-null-check.patch b/target/linux/mediatek/patches-5.15/844-v5.18-i2c-mediatek-remove-redundant-null-check.patch new file mode 100644 index 00000000000000..8f3c965a8d4e32 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/844-v5.18-i2c-mediatek-remove-redundant-null-check.patch @@ -0,0 +1,41 @@ +From eb4a2ae019815946f574cd9f8209e12bdcd8fd34 Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Wed, 30 Sep 2020 08:42:33 +0000 +Subject: [PATCH 05/16] i2c: mediatek: remove redundant null check + +Because clk_disable_unprepare already checked NULL clock parameter, +so the additional checks are unnecessary, just remove it + +Signed-off-by: Xu Wang +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -476,8 +476,7 @@ static int mtk_i2c_clock_enable(struct m + return 0; + + err_arb: +- if (i2c->have_pmic) +- clk_disable_unprepare(i2c->clk_pmic); ++ clk_disable_unprepare(i2c->clk_pmic); + err_pmic: + clk_disable_unprepare(i2c->clk_main); + err_main: +@@ -488,11 +487,9 @@ err_main: + + static void mtk_i2c_clock_disable(struct mtk_i2c *i2c) + { +- if (i2c->clk_arb) +- clk_disable_unprepare(i2c->clk_arb); ++ clk_disable_unprepare(i2c->clk_arb); + +- if (i2c->have_pmic) +- clk_disable_unprepare(i2c->clk_pmic); ++ clk_disable_unprepare(i2c->clk_pmic); + + clk_disable_unprepare(i2c->clk_main); + clk_disable_unprepare(i2c->clk_dma); diff --git a/target/linux/mediatek/patches-5.15/845-v5.18-i2c-mt65xx-Simplify-with-clk-bulk.patch b/target/linux/mediatek/patches-5.15/845-v5.18-i2c-mt65xx-Simplify-with-clk-bulk.patch new file mode 100644 index 00000000000000..71d083f31a9565 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/845-v5.18-i2c-mt65xx-Simplify-with-clk-bulk.patch @@ -0,0 +1,234 @@ +From cc6faa5e0772296d815fd298c231277d47308a6a Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Thu, 3 Mar 2022 10:15:47 +0100 +Subject: [PATCH 06/16] i2c: mt65xx: Simplify with clk-bulk + +Since depending on the SoC or specific bus functionality some clocks +may be optional, we cannot get the benefit of using devm_clk_bulk_get() +but, by migrating to clk-bulk, we are able to remove the custom functions +mtk_i2c_clock_enable() and mtk_i2c_clock_disable(), increasing common +APIs usage, hence (lightly) decreasing kernel footprint. + +Signed-off-by: AngeloGioacchino Del Regno +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 124 +++++++++++++------------------- + 1 file changed, 51 insertions(+), 73 deletions(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -86,6 +86,27 @@ + + #define I2C_DRV_NAME "i2c-mt65xx" + ++/** ++ * enum i2c_mt65xx_clks - Clocks enumeration for MT65XX I2C ++ * ++ * @I2C_MT65XX_CLK_MAIN: main clock for i2c bus ++ * @I2C_MT65XX_CLK_DMA: DMA clock for i2c via DMA ++ * @I2C_MT65XX_CLK_PMIC: PMIC clock for i2c from PMIC ++ * @I2C_MT65XX_CLK_ARB: Arbitrator clock for i2c ++ * @I2C_MT65XX_CLK_MAX: Number of supported clocks ++ */ ++enum i2c_mt65xx_clks { ++ I2C_MT65XX_CLK_MAIN = 0, ++ I2C_MT65XX_CLK_DMA, ++ I2C_MT65XX_CLK_PMIC, ++ I2C_MT65XX_CLK_ARB, ++ I2C_MT65XX_CLK_MAX ++}; ++ ++static const char * const i2c_mt65xx_clk_ids[I2C_MT65XX_CLK_MAX] = { ++ "main", "dma", "pmic", "arb" ++}; ++ + enum DMA_REGS_OFFSET { + OFFSET_INT_FLAG = 0x0, + OFFSET_INT_EN = 0x04, +@@ -244,10 +265,7 @@ struct mtk_i2c { + /* set in i2c probe */ + void __iomem *base; /* i2c base addr */ + void __iomem *pdmabase; /* dma base address*/ +- struct clk *clk_main; /* main clock for i2c bus */ +- struct clk *clk_dma; /* DMA clock for i2c via DMA */ +- struct clk *clk_pmic; /* PMIC clock for i2c from PMIC */ +- struct clk *clk_arb; /* Arbitrator clock for i2c */ ++ struct clk_bulk_data clocks[I2C_MT65XX_CLK_MAX]; /* clocks for i2c */ + bool have_pmic; /* can use i2c pins from PMIC */ + bool use_push_pull; /* IO config push-pull mode */ + +@@ -449,52 +467,6 @@ static void mtk_i2c_writew(struct mtk_i2 + writew(val, i2c->base + i2c->dev_comp->regs[reg]); + } + +-static int mtk_i2c_clock_enable(struct mtk_i2c *i2c) +-{ +- int ret; +- +- ret = clk_prepare_enable(i2c->clk_dma); +- if (ret) +- return ret; +- +- ret = clk_prepare_enable(i2c->clk_main); +- if (ret) +- goto err_main; +- +- if (i2c->have_pmic) { +- ret = clk_prepare_enable(i2c->clk_pmic); +- if (ret) +- goto err_pmic; +- } +- +- if (i2c->clk_arb) { +- ret = clk_prepare_enable(i2c->clk_arb); +- if (ret) +- goto err_arb; +- } +- +- return 0; +- +-err_arb: +- clk_disable_unprepare(i2c->clk_pmic); +-err_pmic: +- clk_disable_unprepare(i2c->clk_main); +-err_main: +- clk_disable_unprepare(i2c->clk_dma); +- +- return ret; +-} +- +-static void mtk_i2c_clock_disable(struct mtk_i2c *i2c) +-{ +- clk_disable_unprepare(i2c->clk_arb); +- +- clk_disable_unprepare(i2c->clk_pmic); +- +- clk_disable_unprepare(i2c->clk_main); +- clk_disable_unprepare(i2c->clk_dma); +-} +- + static void mtk_i2c_init_hw(struct mtk_i2c *i2c) + { + u16 control_reg; +@@ -1191,7 +1163,7 @@ static int mtk_i2c_transfer(struct i2c_a + int left_num = num; + struct mtk_i2c *i2c = i2c_get_adapdata(adap); + +- ret = mtk_i2c_clock_enable(i2c); ++ ret = clk_bulk_prepare_enable(I2C_MT65XX_CLK_MAX, i2c->clocks); + if (ret) + return ret; + +@@ -1245,7 +1217,7 @@ static int mtk_i2c_transfer(struct i2c_a + ret = num; + + err_exit: +- mtk_i2c_clock_disable(i2c); ++ clk_bulk_disable_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); + return ret; + } + +@@ -1323,9 +1295,8 @@ static int mtk_i2c_probe(struct platform + { + int ret = 0; + struct mtk_i2c *i2c; +- struct clk *clk; + struct resource *res; +- int irq; ++ int i, irq, speed_clk; + + i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + if (!i2c) +@@ -1371,35 +1342,42 @@ static int mtk_i2c_probe(struct platform + if (i2c->have_pmic && !i2c->dev_comp->pmic_i2c) + return -EINVAL; + +- i2c->clk_main = devm_clk_get(&pdev->dev, "main"); +- if (IS_ERR(i2c->clk_main)) { ++ /* Fill in clk-bulk IDs */ ++ for (i = 0; i < I2C_MT65XX_CLK_MAX; i++) ++ i2c->clocks[i].id = i2c_mt65xx_clk_ids[i]; ++ ++ /* Get clocks one by one, some may be optional */ ++ i2c->clocks[I2C_MT65XX_CLK_MAIN].clk = devm_clk_get(&pdev->dev, "main"); ++ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_MAIN].clk)) { + dev_err(&pdev->dev, "cannot get main clock\n"); +- return PTR_ERR(i2c->clk_main); ++ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_MAIN].clk); + } + +- i2c->clk_dma = devm_clk_get(&pdev->dev, "dma"); +- if (IS_ERR(i2c->clk_dma)) { ++ i2c->clocks[I2C_MT65XX_CLK_DMA].clk = devm_clk_get(&pdev->dev, "dma"); ++ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_DMA].clk)) { + dev_err(&pdev->dev, "cannot get dma clock\n"); +- return PTR_ERR(i2c->clk_dma); ++ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_DMA].clk); + } + +- i2c->clk_arb = devm_clk_get(&pdev->dev, "arb"); +- if (IS_ERR(i2c->clk_arb)) +- i2c->clk_arb = NULL; ++ i2c->clocks[I2C_MT65XX_CLK_ARB].clk = devm_clk_get_optional(&pdev->dev, "arb"); ++ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk)) ++ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk); + +- clk = i2c->clk_main; + if (i2c->have_pmic) { +- i2c->clk_pmic = devm_clk_get(&pdev->dev, "pmic"); +- if (IS_ERR(i2c->clk_pmic)) { ++ i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get(&pdev->dev, "pmic"); ++ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) { + dev_err(&pdev->dev, "cannot get pmic clock\n"); +- return PTR_ERR(i2c->clk_pmic); ++ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk); + } +- clk = i2c->clk_pmic; ++ speed_clk = I2C_MT65XX_CLK_PMIC; ++ } else { ++ i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = NULL; ++ speed_clk = I2C_MT65XX_CLK_MAIN; + } + + strlcpy(i2c->adap.name, I2C_DRV_NAME, sizeof(i2c->adap.name)); + +- ret = mtk_i2c_set_speed(i2c, clk_get_rate(clk)); ++ ret = mtk_i2c_set_speed(i2c, clk_get_rate(i2c->clocks[speed_clk].clk)); + if (ret) { + dev_err(&pdev->dev, "Failed to set the speed.\n"); + return -EINVAL; +@@ -1414,13 +1392,13 @@ static int mtk_i2c_probe(struct platform + } + } + +- ret = mtk_i2c_clock_enable(i2c); ++ ret = clk_bulk_prepare_enable(I2C_MT65XX_CLK_MAX, i2c->clocks); + if (ret) { + dev_err(&pdev->dev, "clock enable failed!\n"); + return ret; + } + mtk_i2c_init_hw(i2c); +- mtk_i2c_clock_disable(i2c); ++ clk_bulk_disable_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); + + ret = devm_request_irq(&pdev->dev, irq, mtk_i2c_irq, + IRQF_NO_SUSPEND | IRQF_TRIGGER_NONE, +@@ -1465,7 +1443,7 @@ static int mtk_i2c_resume_noirq(struct d + int ret; + struct mtk_i2c *i2c = dev_get_drvdata(dev); + +- ret = mtk_i2c_clock_enable(i2c); ++ ret = clk_bulk_prepare_enable(I2C_MT65XX_CLK_MAX, i2c->clocks); + if (ret) { + dev_err(dev, "clock enable failed!\n"); + return ret; +@@ -1473,7 +1451,7 @@ static int mtk_i2c_resume_noirq(struct d + + mtk_i2c_init_hw(i2c); + +- mtk_i2c_clock_disable(i2c); ++ clk_bulk_disable_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); + + i2c_mark_adapter_resumed(&i2c->adap); + diff --git a/target/linux/mediatek/patches-5.15/846-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8168.patch b/target/linux/mediatek/patches-5.15/846-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8168.patch new file mode 100644 index 00000000000000..fe5be94fca446e --- /dev/null +++ b/target/linux/mediatek/patches-5.15/846-v5.18-i2c-mediatek-Add-i2c-compatible-for-Mediatek-MT8168.patch @@ -0,0 +1,46 @@ +From de054c03f90b3ea22bc346fbf78ac716df192b2d Mon Sep 17 00:00:00 2001 +From: Kewei Xu +Date: Mon, 7 Mar 2022 11:36:49 +0800 +Subject: [PATCH 07/16] i2c: mediatek: Add i2c compatible for Mediatek MT8168 + +Add i2c compatible for MT8168. Compare to MT2712 i2c controller, +MT8168 need to synchronize signal with dma. + +Signed-off-by: Kewei Xu +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -389,6 +389,19 @@ static const struct mtk_i2c_compatible m + .max_dma_support = 32, + }; + ++static const struct mtk_i2c_compatible mt8168_compat = { ++ .regs = mt_i2c_regs_v1, ++ .pmic_i2c = 0, ++ .dcm = 1, ++ .auto_restart = 1, ++ .aux_len_reg = 1, ++ .timing_adjust = 1, ++ .dma_sync = 1, ++ .ltiming_adjust = 0, ++ .apdma_sync = 0, ++ .max_dma_support = 33, ++}; ++ + static const struct mtk_i2c_compatible mt8173_compat = { + .regs = mt_i2c_regs_v1, + .pmic_i2c = 0, +@@ -448,6 +461,7 @@ static const struct of_device_id mtk_i2c + { .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat }, + { .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat }, + { .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat }, ++ { .compatible = "mediatek,mt8168-i2c", .data = &mt8168_compat }, + { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, + { .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat }, + { .compatible = "mediatek,mt8186-i2c", .data = &mt8186_compat }, diff --git a/target/linux/mediatek/patches-5.15/847-v5.19-i2c-mediatek-Optimize-master_xfer-and-avoid-circular.patch b/target/linux/mediatek/patches-5.15/847-v5.19-i2c-mediatek-Optimize-master_xfer-and-avoid-circular.patch new file mode 100644 index 00000000000000..5c4ce40765c058 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/847-v5.19-i2c-mediatek-Optimize-master_xfer-and-avoid-circular.patch @@ -0,0 +1,101 @@ +From 2831f9a53ec3a16012d2d23590e3ebad6084b763 Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Mon, 11 Apr 2022 15:21:07 +0200 +Subject: [PATCH 08/16] i2c: mediatek: Optimize master_xfer() and avoid + circular locking +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Especially (but not only) during probe, it may happen that multiple +devices are communicating via i2c (or multiple i2c busses) and +sometimes while others are probing asynchronously. +For example, a Cr50 TPM may be filling entropy (or userspace may be +reading random data) while the rt5682 (i2c) codec driver reads/sets +some registers, like while getting/setting a clock's rate, which +happens both during probe and during system operation. + +In this driver, the mtk_i2c_transfer() function (which is the i2c +.master_xfer() callback) was granularly managing the clocks by +performing a clk_bulk_prepare_enable() to start them and its inverse. +This is not only creating possible circular locking dependencies in +the some cases (like former explanation), but it's also suboptimal, +as clk_core prepare/unprepare operations are using mutex locking, +which creates a bit of unwanted overhead (for example, i2c trackpads +will call master_xfer() every few milliseconds!). + +With this commit, we avoid both the circular locking and additional +overhead by changing how we handle the clocks in this driver: +- Prepare the clocks during probe (and PM resume) +- Enable/disable clocks in mtk_i2c_transfer() +- Unprepare the clocks only for driver removal (and PM suspend) + +For the sake of providing a full explanation: during probe, the +clocks are not only prepared but also enabled, as this is needed +for some hardware initialization but, after that, we are disabling +but not unpreparing them, leaving an expected state for the +aforementioned clock handling strategy. + +Signed-off-by: AngeloGioacchino Del Regno +Tested-by: Nícolas F. R. A. Prado +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -1177,7 +1177,7 @@ static int mtk_i2c_transfer(struct i2c_a + int left_num = num; + struct mtk_i2c *i2c = i2c_get_adapdata(adap); + +- ret = clk_bulk_prepare_enable(I2C_MT65XX_CLK_MAX, i2c->clocks); ++ ret = clk_bulk_enable(I2C_MT65XX_CLK_MAX, i2c->clocks); + if (ret) + return ret; + +@@ -1231,7 +1231,7 @@ static int mtk_i2c_transfer(struct i2c_a + ret = num; + + err_exit: +- clk_bulk_disable_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); ++ clk_bulk_disable(I2C_MT65XX_CLK_MAX, i2c->clocks); + return ret; + } + +@@ -1412,7 +1412,7 @@ static int mtk_i2c_probe(struct platform + return ret; + } + mtk_i2c_init_hw(i2c); +- clk_bulk_disable_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); ++ clk_bulk_disable(I2C_MT65XX_CLK_MAX, i2c->clocks); + + ret = devm_request_irq(&pdev->dev, irq, mtk_i2c_irq, + IRQF_NO_SUSPEND | IRQF_TRIGGER_NONE, +@@ -1439,6 +1439,8 @@ static int mtk_i2c_remove(struct platfor + + i2c_del_adapter(&i2c->adap); + ++ clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); ++ + return 0; + } + +@@ -1448,6 +1450,7 @@ static int mtk_i2c_suspend_noirq(struct + struct mtk_i2c *i2c = dev_get_drvdata(dev); + + i2c_mark_adapter_suspended(&i2c->adap); ++ clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); + + return 0; + } +@@ -1465,7 +1468,7 @@ static int mtk_i2c_resume_noirq(struct d + + mtk_i2c_init_hw(i2c); + +- clk_bulk_disable_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); ++ clk_bulk_disable(I2C_MT65XX_CLK_MAX, i2c->clocks); + + i2c_mark_adapter_resumed(&i2c->adap); + diff --git a/target/linux/mediatek/patches-5.15/848-v5.19-i2c-mediatek-Fix-an-error-handling-path-in-mtk_i2c_p.patch b/target/linux/mediatek/patches-5.15/848-v5.19-i2c-mediatek-Fix-an-error-handling-path-in-mtk_i2c_p.patch new file mode 100644 index 00000000000000..354f12e2146495 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/848-v5.19-i2c-mediatek-Fix-an-error-handling-path-in-mtk_i2c_p.patch @@ -0,0 +1,48 @@ +From 6f3a5814c7aaea4176e0ac8b1ec6dc0a65aa2808 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sun, 22 May 2022 14:22:07 +0200 +Subject: [PATCH 09/16] i2c: mediatek: Fix an error handling path in + mtk_i2c_probe() + +The clsk are prepared, enabled, then disabled. So if an error occurs after +the disable step, they are still prepared. + +Add an error handling path to unprepare the clks in such a case, as already +done in the .remove function. + +Fixes: 8b4fc246c3ff ("i2c: mediatek: Optimize master_xfer() and avoid circular locking") +Signed-off-by: Christophe JAILLET +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -1420,17 +1420,22 @@ static int mtk_i2c_probe(struct platform + if (ret < 0) { + dev_err(&pdev->dev, + "Request I2C IRQ %d fail\n", irq); +- return ret; ++ goto err_bulk_unprepare; + } + + i2c_set_adapdata(&i2c->adap, i2c); + ret = i2c_add_adapter(&i2c->adap); + if (ret) +- return ret; ++ goto err_bulk_unprepare; + + platform_set_drvdata(pdev, i2c); + + return 0; ++ ++err_bulk_unprepare: ++ clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); ++ ++ return ret; + } + + static int mtk_i2c_remove(struct platform_device *pdev) diff --git a/target/linux/mediatek/patches-5.15/849-v6.0-i2c-mediatek-add-i2c-compatible-for-MT8188.patch b/target/linux/mediatek/patches-5.15/849-v6.0-i2c-mediatek-add-i2c-compatible-for-MT8188.patch new file mode 100644 index 00000000000000..744aa96ed0c49b --- /dev/null +++ b/target/linux/mediatek/patches-5.15/849-v6.0-i2c-mediatek-add-i2c-compatible-for-MT8188.patch @@ -0,0 +1,82 @@ +From 94c7f8af2c0a399c8aa66f2522b60c5784b5be6c Mon Sep 17 00:00:00 2001 +From: Kewei Xu +Date: Sat, 6 Aug 2022 18:02:49 +0800 +Subject: [PATCH 10/16] i2c: mediatek: add i2c compatible for MT8188 + +Add i2c compatible for MT8188 and added mt_i2c_regs_v3[], since +MT8188 i2c OFFSET_SLAVE_ADDR register changed from 0x04 to 0x94. + +Signed-off-by: Kewei Xu +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Qii Wang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 43 +++++++++++++++++++++++++++++++++ + 1 file changed, 43 insertions(+) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -229,6 +229,35 @@ static const u16 mt_i2c_regs_v2[] = { + [OFFSET_DCM_EN] = 0xf88, + }; + ++static const u16 mt_i2c_regs_v3[] = { ++ [OFFSET_DATA_PORT] = 0x0, ++ [OFFSET_INTR_MASK] = 0x8, ++ [OFFSET_INTR_STAT] = 0xc, ++ [OFFSET_CONTROL] = 0x10, ++ [OFFSET_TRANSFER_LEN] = 0x14, ++ [OFFSET_TRANSAC_LEN] = 0x18, ++ [OFFSET_DELAY_LEN] = 0x1c, ++ [OFFSET_TIMING] = 0x20, ++ [OFFSET_START] = 0x24, ++ [OFFSET_EXT_CONF] = 0x28, ++ [OFFSET_LTIMING] = 0x2c, ++ [OFFSET_HS] = 0x30, ++ [OFFSET_IO_CONFIG] = 0x34, ++ [OFFSET_FIFO_ADDR_CLR] = 0x38, ++ [OFFSET_SDA_TIMING] = 0x3c, ++ [OFFSET_TRANSFER_LEN_AUX] = 0x44, ++ [OFFSET_CLOCK_DIV] = 0x48, ++ [OFFSET_SOFTRESET] = 0x50, ++ [OFFSET_MULTI_DMA] = 0x8c, ++ [OFFSET_SCL_MIS_COMP_POINT] = 0x90, ++ [OFFSET_SLAVE_ADDR] = 0x94, ++ [OFFSET_DEBUGSTAT] = 0xe4, ++ [OFFSET_DEBUGCTRL] = 0xe8, ++ [OFFSET_FIFO_STAT] = 0xf4, ++ [OFFSET_FIFO_THRESH] = 0xf8, ++ [OFFSET_DCM_EN] = 0xf88, ++}; ++ + struct mtk_i2c_compatible { + const struct i2c_adapter_quirks *quirks; + const u16 *regs; +@@ -442,6 +471,19 @@ static const struct mtk_i2c_compatible m + .max_dma_support = 36, + }; + ++static const struct mtk_i2c_compatible mt8188_compat = { ++ .regs = mt_i2c_regs_v3, ++ .pmic_i2c = 0, ++ .dcm = 0, ++ .auto_restart = 1, ++ .aux_len_reg = 1, ++ .timing_adjust = 1, ++ .dma_sync = 0, ++ .ltiming_adjust = 1, ++ .apdma_sync = 1, ++ .max_dma_support = 36, ++}; ++ + static const struct mtk_i2c_compatible mt8192_compat = { + .quirks = &mt8183_i2c_quirks, + .regs = mt_i2c_regs_v2, +@@ -465,6 +507,7 @@ static const struct of_device_id mtk_i2c + { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, + { .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat }, + { .compatible = "mediatek,mt8186-i2c", .data = &mt8186_compat }, ++ { .compatible = "mediatek,mt8188-i2c", .data = &mt8188_compat }, + { .compatible = "mediatek,mt8192-i2c", .data = &mt8192_compat }, + {} + }; diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch new file mode 100644 index 00000000000000..506689965d36c6 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -0,0 +1,579 @@ +From 2f4ca256a98cc19787b7c861109dd1150a21b0bf Mon Sep 17 00:00:00 2001 +From: Wolfram Sang +Date: Thu, 11 Aug 2022 09:10:30 +0200 +Subject: [PATCH 11/16] i2c: move drivers from strlcpy to strscpy + +Follow the advice of the below link and prefer 'strscpy'. Conversion is +easy because no driver used the return value and has been done with a +simple sed invocation. + +Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ +Signed-off-by: Wolfram Sang +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-altera.c | 2 +- + drivers/i2c/busses/i2c-aspeed.c | 2 +- + drivers/i2c/busses/i2c-au1550.c | 2 +- + drivers/i2c/busses/i2c-axxia.c | 2 +- + drivers/i2c/busses/i2c-bcm-kona.c | 2 +- + drivers/i2c/busses/i2c-cbus-gpio.c | 2 +- + drivers/i2c/busses/i2c-cht-wc.c | 2 +- + drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +- + drivers/i2c/busses/i2c-davinci.c | 2 +- + drivers/i2c/busses/i2c-digicolor.c | 2 +- + drivers/i2c/busses/i2c-eg20t.c | 2 +- + drivers/i2c/busses/i2c-emev2.c | 2 +- + drivers/i2c/busses/i2c-exynos5.c | 2 +- + drivers/i2c/busses/i2c-gpio.c | 2 +- + drivers/i2c/busses/i2c-highlander.c | 2 +- + drivers/i2c/busses/i2c-hix5hd2.c | 2 +- + drivers/i2c/busses/i2c-i801.c | 4 ++-- + drivers/i2c/busses/i2c-ibm_iic.c | 2 +- + drivers/i2c/busses/i2c-icy.c | 2 +- + drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- + drivers/i2c/busses/i2c-lpc2k.c | 2 +- + drivers/i2c/busses/i2c-meson.c | 2 +- + drivers/i2c/busses/i2c-mt65xx.c | 2 +- + drivers/i2c/busses/i2c-mt7621.c | 2 +- + drivers/i2c/busses/i2c-mv64xxx.c | 2 +- + drivers/i2c/busses/i2c-mxs.c | 2 +- + drivers/i2c/busses/i2c-nvidia-gpu.c | 2 +- + drivers/i2c/busses/i2c-omap.c | 2 +- + drivers/i2c/busses/i2c-opal.c | 4 ++-- + drivers/i2c/busses/i2c-parport.c | 2 +- + drivers/i2c/busses/i2c-pxa.c | 2 +- + drivers/i2c/busses/i2c-qcom-geni.c | 2 +- + drivers/i2c/busses/i2c-qup.c | 2 +- + drivers/i2c/busses/i2c-rcar.c | 2 +- + drivers/i2c/busses/i2c-riic.c | 2 +- + drivers/i2c/busses/i2c-rk3x.c | 2 +- + drivers/i2c/busses/i2c-s3c2410.c | 2 +- + drivers/i2c/busses/i2c-sh_mobile.c | 2 +- + drivers/i2c/busses/i2c-simtec.c | 2 +- + drivers/i2c/busses/i2c-taos-evm.c | 2 +- + drivers/i2c/busses/i2c-tegra-bpmp.c | 2 +- + drivers/i2c/busses/i2c-tegra.c | 2 +- + drivers/i2c/busses/i2c-uniphier-f.c | 2 +- + drivers/i2c/busses/i2c-uniphier.c | 2 +- + drivers/i2c/busses/i2c-versatile.c | 2 +- + drivers/i2c/busses/i2c-wmt.c | 2 +- + 46 files changed, 48 insertions(+), 48 deletions(-) + +--- a/drivers/i2c/busses/i2c-altera.c ++++ b/drivers/i2c/busses/i2c-altera.c +@@ -447,7 +447,7 @@ static int altr_i2c_probe(struct platfor + mutex_unlock(&idev->isr_mutex); + + i2c_set_adapdata(&idev->adapter, idev); +- strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name)); ++ strscpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name)); + idev->adapter.owner = THIS_MODULE; + idev->adapter.algo = &altr_i2c_algo; + idev->adapter.dev.parent = &pdev->dev; +--- a/drivers/i2c/busses/i2c-aspeed.c ++++ b/drivers/i2c/busses/i2c-aspeed.c +@@ -1024,7 +1024,7 @@ static int aspeed_i2c_probe_bus(struct p + bus->adap.algo = &aspeed_i2c_algo; + bus->adap.dev.parent = &pdev->dev; + bus->adap.dev.of_node = pdev->dev.of_node; +- strlcpy(bus->adap.name, pdev->name, sizeof(bus->adap.name)); ++ strscpy(bus->adap.name, pdev->name, sizeof(bus->adap.name)); + i2c_set_adapdata(&bus->adap, bus); + + bus->dev = &pdev->dev; +--- a/drivers/i2c/busses/i2c-au1550.c ++++ b/drivers/i2c/busses/i2c-au1550.c +@@ -321,7 +321,7 @@ i2c_au1550_probe(struct platform_device + priv->adap.algo = &au1550_algo; + priv->adap.algo_data = priv; + priv->adap.dev.parent = &pdev->dev; +- strlcpy(priv->adap.name, "Au1xxx PSC I2C", sizeof(priv->adap.name)); ++ strscpy(priv->adap.name, "Au1xxx PSC I2C", sizeof(priv->adap.name)); + + /* Now, set up the PSC for SMBus PIO mode. */ + i2c_au1550_setup(priv); +--- a/drivers/i2c/busses/i2c-axxia.c ++++ b/drivers/i2c/busses/i2c-axxia.c +@@ -783,7 +783,7 @@ static int axxia_i2c_probe(struct platfo + } + + i2c_set_adapdata(&idev->adapter, idev); +- strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name)); ++ strscpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name)); + idev->adapter.owner = THIS_MODULE; + idev->adapter.algo = &axxia_i2c_algo; + idev->adapter.bus_recovery_info = &axxia_i2c_recovery_info; +--- a/drivers/i2c/busses/i2c-bcm-kona.c ++++ b/drivers/i2c/busses/i2c-bcm-kona.c +@@ -849,7 +849,7 @@ static int bcm_kona_i2c_probe(struct pla + adap = &dev->adapter; + i2c_set_adapdata(adap, dev); + adap->owner = THIS_MODULE; +- strlcpy(adap->name, "Broadcom I2C adapter", sizeof(adap->name)); ++ strscpy(adap->name, "Broadcom I2C adapter", sizeof(adap->name)); + adap->algo = &bcm_algo; + adap->dev.parent = &pdev->dev; + adap->dev.of_node = pdev->dev.of_node; +--- a/drivers/i2c/busses/i2c-cbus-gpio.c ++++ b/drivers/i2c/busses/i2c-cbus-gpio.c +@@ -245,7 +245,7 @@ static int cbus_i2c_probe(struct platfor + adapter->nr = pdev->id; + adapter->timeout = HZ; + adapter->algo = &cbus_i2c_algo; +- strlcpy(adapter->name, "CBUS I2C adapter", sizeof(adapter->name)); ++ strscpy(adapter->name, "CBUS I2C adapter", sizeof(adapter->name)); + + spin_lock_init(&chost->lock); + chost->dev = &pdev->dev; +--- a/drivers/i2c/busses/i2c-cht-wc.c ++++ b/drivers/i2c/busses/i2c-cht-wc.c +@@ -334,7 +334,7 @@ static int cht_wc_i2c_adap_i2c_probe(str + adap->adapter.class = I2C_CLASS_HWMON; + adap->adapter.algo = &cht_wc_i2c_adap_algo; + adap->adapter.lock_ops = &cht_wc_i2c_adap_lock_ops; +- strlcpy(adap->adapter.name, "PMIC I2C Adapter", ++ strscpy(adap->adapter.name, "PMIC I2C Adapter", + sizeof(adap->adapter.name)); + adap->adapter.dev.parent = &pdev->dev; + +--- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c ++++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c +@@ -267,7 +267,7 @@ static int ec_i2c_probe(struct platform_ + bus->dev = dev; + + bus->adap.owner = THIS_MODULE; +- strlcpy(bus->adap.name, "cros-ec-i2c-tunnel", sizeof(bus->adap.name)); ++ strscpy(bus->adap.name, "cros-ec-i2c-tunnel", sizeof(bus->adap.name)); + bus->adap.algo = &ec_i2c_algorithm; + bus->adap.algo_data = bus; + bus->adap.dev.parent = &pdev->dev; +--- a/drivers/i2c/busses/i2c-davinci.c ++++ b/drivers/i2c/busses/i2c-davinci.c +@@ -847,7 +847,7 @@ static int davinci_i2c_probe(struct plat + i2c_set_adapdata(adap, dev); + adap->owner = THIS_MODULE; + adap->class = I2C_CLASS_DEPRECATED; +- strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name)); ++ strscpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name)); + adap->algo = &i2c_davinci_algo; + adap->dev.parent = &pdev->dev; + adap->timeout = DAVINCI_I2C_TIMEOUT; +--- a/drivers/i2c/busses/i2c-digicolor.c ++++ b/drivers/i2c/busses/i2c-digicolor.c +@@ -322,7 +322,7 @@ static int dc_i2c_probe(struct platform_ + if (ret < 0) + return ret; + +- strlcpy(i2c->adap.name, "Conexant Digicolor I2C adapter", ++ strscpy(i2c->adap.name, "Conexant Digicolor I2C adapter", + sizeof(i2c->adap.name)); + i2c->adap.owner = THIS_MODULE; + i2c->adap.algo = &dc_i2c_algorithm; +--- a/drivers/i2c/busses/i2c-eg20t.c ++++ b/drivers/i2c/busses/i2c-eg20t.c +@@ -773,7 +773,7 @@ static int pch_i2c_probe(struct pci_dev + + pch_adap->owner = THIS_MODULE; + pch_adap->class = I2C_CLASS_HWMON; +- strlcpy(pch_adap->name, KBUILD_MODNAME, sizeof(pch_adap->name)); ++ strscpy(pch_adap->name, KBUILD_MODNAME, sizeof(pch_adap->name)); + pch_adap->algo = &pch_algorithm; + pch_adap->algo_data = &adap_info->pch_data[i]; + +--- a/drivers/i2c/busses/i2c-emev2.c ++++ b/drivers/i2c/busses/i2c-emev2.c +@@ -371,7 +371,7 @@ static int em_i2c_probe(struct platform_ + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + +- strlcpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name)); ++ strscpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name)); + + priv->sclk = devm_clk_get(&pdev->dev, "sclk"); + if (IS_ERR(priv->sclk)) +--- a/drivers/i2c/busses/i2c-exynos5.c ++++ b/drivers/i2c/busses/i2c-exynos5.c +@@ -751,7 +751,7 @@ static int exynos5_i2c_probe(struct plat + if (of_property_read_u32(np, "clock-frequency", &i2c->op_clock)) + i2c->op_clock = I2C_MAX_STANDARD_MODE_FREQ; + +- strlcpy(i2c->adap.name, "exynos5-i2c", sizeof(i2c->adap.name)); ++ strscpy(i2c->adap.name, "exynos5-i2c", sizeof(i2c->adap.name)); + i2c->adap.owner = THIS_MODULE; + i2c->adap.algo = &exynos5_i2c_algorithm; + i2c->adap.retries = 3; +--- a/drivers/i2c/busses/i2c-gpio.c ++++ b/drivers/i2c/busses/i2c-gpio.c +@@ -436,7 +436,7 @@ static int i2c_gpio_probe(struct platfor + + adap->owner = THIS_MODULE; + if (np) +- strlcpy(adap->name, dev_name(dev), sizeof(adap->name)); ++ strscpy(adap->name, dev_name(dev), sizeof(adap->name)); + else + snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); + +--- a/drivers/i2c/busses/i2c-highlander.c ++++ b/drivers/i2c/busses/i2c-highlander.c +@@ -402,7 +402,7 @@ static int highlander_i2c_probe(struct p + i2c_set_adapdata(adap, dev); + adap->owner = THIS_MODULE; + adap->class = I2C_CLASS_HWMON; +- strlcpy(adap->name, "HL FPGA I2C adapter", sizeof(adap->name)); ++ strscpy(adap->name, "HL FPGA I2C adapter", sizeof(adap->name)); + adap->algo = &highlander_i2c_algo; + adap->dev.parent = &pdev->dev; + adap->nr = pdev->id; +--- a/drivers/i2c/busses/i2c-hix5hd2.c ++++ b/drivers/i2c/busses/i2c-hix5hd2.c +@@ -423,7 +423,7 @@ static int hix5hd2_i2c_probe(struct plat + } + clk_prepare_enable(priv->clk); + +- strlcpy(priv->adap.name, "hix5hd2-i2c", sizeof(priv->adap.name)); ++ strscpy(priv->adap.name, "hix5hd2-i2c", sizeof(priv->adap.name)); + priv->dev = &pdev->dev; + priv->adap.owner = THIS_MODULE; + priv->adap.algo = &hix5hd2_i2c_algorithm; +--- a/drivers/i2c/busses/i2c-i801.c ++++ b/drivers/i2c/busses/i2c-i801.c +@@ -1111,7 +1111,7 @@ static void dmi_check_onboard_device(u8 + + memset(&info, 0, sizeof(struct i2c_board_info)); + info.addr = dmi_devices[i].i2c_addr; +- strlcpy(info.type, dmi_devices[i].i2c_type, I2C_NAME_SIZE); ++ strscpy(info.type, dmi_devices[i].i2c_type, I2C_NAME_SIZE); + i2c_new_client_device(adap, &info); + break; + } +@@ -1267,7 +1267,7 @@ static void register_dell_lis3lv02d_i2c_ + + memset(&info, 0, sizeof(struct i2c_board_info)); + info.addr = dell_lis3lv02d_devices[i].i2c_addr; +- strlcpy(info.type, "lis3lv02d", I2C_NAME_SIZE); ++ strscpy(info.type, "lis3lv02d", I2C_NAME_SIZE); + i2c_new_client_device(&priv->adapter, &info); + } + +--- a/drivers/i2c/busses/i2c-ibm_iic.c ++++ b/drivers/i2c/busses/i2c-ibm_iic.c +@@ -738,7 +738,7 @@ static int iic_probe(struct platform_dev + adap = &dev->adap; + adap->dev.parent = &ofdev->dev; + adap->dev.of_node = of_node_get(np); +- strlcpy(adap->name, "IBM IIC", sizeof(adap->name)); ++ strscpy(adap->name, "IBM IIC", sizeof(adap->name)); + i2c_set_adapdata(adap, dev); + adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + adap->algo = &iic_algo; +--- a/drivers/i2c/busses/i2c-icy.c ++++ b/drivers/i2c/busses/i2c-icy.c +@@ -141,7 +141,7 @@ static int icy_probe(struct zorro_dev *z + i2c->adapter.owner = THIS_MODULE; + /* i2c->adapter.algo assigned by i2c_pcf_add_bus() */ + i2c->adapter.algo_data = algo_data; +- strlcpy(i2c->adapter.name, "ICY I2C Zorro adapter", ++ strscpy(i2c->adapter.name, "ICY I2C Zorro adapter", + sizeof(i2c->adapter.name)); + + if (!devm_request_mem_region(&z->dev, +--- a/drivers/i2c/busses/i2c-imx-lpi2c.c ++++ b/drivers/i2c/busses/i2c-imx-lpi2c.c +@@ -564,7 +564,7 @@ static int lpi2c_imx_probe(struct platfo + lpi2c_imx->adapter.algo = &lpi2c_imx_algo; + lpi2c_imx->adapter.dev.parent = &pdev->dev; + lpi2c_imx->adapter.dev.of_node = pdev->dev.of_node; +- strlcpy(lpi2c_imx->adapter.name, pdev->name, ++ strscpy(lpi2c_imx->adapter.name, pdev->name, + sizeof(lpi2c_imx->adapter.name)); + + lpi2c_imx->clk = devm_clk_get(&pdev->dev, NULL); +--- a/drivers/i2c/busses/i2c-lpc2k.c ++++ b/drivers/i2c/busses/i2c-lpc2k.c +@@ -417,7 +417,7 @@ static int i2c_lpc2k_probe(struct platfo + + i2c_set_adapdata(&i2c->adap, i2c); + i2c->adap.owner = THIS_MODULE; +- strlcpy(i2c->adap.name, "LPC2K I2C adapter", sizeof(i2c->adap.name)); ++ strscpy(i2c->adap.name, "LPC2K I2C adapter", sizeof(i2c->adap.name)); + i2c->adap.algo = &i2c_lpc2k_algorithm; + i2c->adap.dev.parent = &pdev->dev; + i2c->adap.dev.of_node = pdev->dev.of_node; +--- a/drivers/i2c/busses/i2c-meson.c ++++ b/drivers/i2c/busses/i2c-meson.c +@@ -451,7 +451,7 @@ static int meson_i2c_probe(struct platfo + return ret; + } + +- strlcpy(i2c->adap.name, "Meson I2C adapter", ++ strscpy(i2c->adap.name, "Meson I2C adapter", + sizeof(i2c->adap.name)); + i2c->adap.owner = THIS_MODULE; + i2c->adap.algo = &meson_i2c_algorithm; +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -1432,7 +1432,7 @@ static int mtk_i2c_probe(struct platform + speed_clk = I2C_MT65XX_CLK_MAIN; + } + +- strlcpy(i2c->adap.name, I2C_DRV_NAME, sizeof(i2c->adap.name)); ++ strscpy(i2c->adap.name, I2C_DRV_NAME, sizeof(i2c->adap.name)); + + ret = mtk_i2c_set_speed(i2c, clk_get_rate(i2c->clocks[speed_clk].clk)); + if (ret) { +--- a/drivers/i2c/busses/i2c-mt7621.c ++++ b/drivers/i2c/busses/i2c-mt7621.c +@@ -315,7 +315,7 @@ static int mtk_i2c_probe(struct platform + adap->dev.parent = &pdev->dev; + i2c_set_adapdata(adap, i2c); + adap->dev.of_node = pdev->dev.of_node; +- strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); ++ strscpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); + + platform_set_drvdata(pdev, i2c); + +--- a/drivers/i2c/busses/i2c-mv64xxx.c ++++ b/drivers/i2c/busses/i2c-mv64xxx.c +@@ -989,7 +989,7 @@ mv64xxx_i2c_probe(struct platform_device + if (IS_ERR(drv_data->reg_base)) + return PTR_ERR(drv_data->reg_base); + +- strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", ++ strscpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", + sizeof(drv_data->adapter.name)); + + init_waitqueue_head(&drv_data->waitq); +--- a/drivers/i2c/busses/i2c-mxs.c ++++ b/drivers/i2c/busses/i2c-mxs.c +@@ -838,7 +838,7 @@ static int mxs_i2c_probe(struct platform + return err; + + adap = &i2c->adapter; +- strlcpy(adap->name, "MXS I2C adapter", sizeof(adap->name)); ++ strscpy(adap->name, "MXS I2C adapter", sizeof(adap->name)); + adap->owner = THIS_MODULE; + adap->algo = &mxs_i2c_algo; + adap->quirks = &mxs_i2c_quirks; +--- a/drivers/i2c/busses/i2c-nvidia-gpu.c ++++ b/drivers/i2c/busses/i2c-nvidia-gpu.c +@@ -319,7 +319,7 @@ static int gpu_i2c_probe(struct pci_dev + + i2c_set_adapdata(&i2cd->adapter, i2cd); + i2cd->adapter.owner = THIS_MODULE; +- strlcpy(i2cd->adapter.name, "NVIDIA GPU I2C adapter", ++ strscpy(i2cd->adapter.name, "NVIDIA GPU I2C adapter", + sizeof(i2cd->adapter.name)); + i2cd->adapter.algo = &gpu_i2c_algorithm; + i2cd->adapter.quirks = &gpu_i2c_quirks; +--- a/drivers/i2c/busses/i2c-omap.c ++++ b/drivers/i2c/busses/i2c-omap.c +@@ -1488,7 +1488,7 @@ omap_i2c_probe(struct platform_device *p + i2c_set_adapdata(adap, omap); + adap->owner = THIS_MODULE; + adap->class = I2C_CLASS_DEPRECATED; +- strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name)); ++ strscpy(adap->name, "OMAP I2C adapter", sizeof(adap->name)); + adap->algo = &omap_i2c_algo; + adap->quirks = &omap_i2c_quirks; + adap->dev.parent = &pdev->dev; +--- a/drivers/i2c/busses/i2c-opal.c ++++ b/drivers/i2c/busses/i2c-opal.c +@@ -220,9 +220,9 @@ static int i2c_opal_probe(struct platfor + adapter->dev.of_node = of_node_get(pdev->dev.of_node); + pname = of_get_property(pdev->dev.of_node, "ibm,port-name", NULL); + if (pname) +- strlcpy(adapter->name, pname, sizeof(adapter->name)); ++ strscpy(adapter->name, pname, sizeof(adapter->name)); + else +- strlcpy(adapter->name, "opal", sizeof(adapter->name)); ++ strscpy(adapter->name, "opal", sizeof(adapter->name)); + + platform_set_drvdata(pdev, adapter); + rc = i2c_add_adapter(adapter); +--- a/drivers/i2c/busses/i2c-parport.c ++++ b/drivers/i2c/busses/i2c-parport.c +@@ -308,7 +308,7 @@ static void i2c_parport_attach(struct pa + /* Fill the rest of the structure */ + adapter->adapter.owner = THIS_MODULE; + adapter->adapter.class = I2C_CLASS_HWMON; +- strlcpy(adapter->adapter.name, "Parallel port adapter", ++ strscpy(adapter->adapter.name, "Parallel port adapter", + sizeof(adapter->adapter.name)); + adapter->algo_data = parport_algo_data; + /* Slow down if we can't sense SCL */ +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -1403,7 +1403,7 @@ static int i2c_pxa_probe(struct platform + spin_lock_init(&i2c->lock); + init_waitqueue_head(&i2c->wait); + +- strlcpy(i2c->adap.name, "pxa_i2c-i2c", sizeof(i2c->adap.name)); ++ strscpy(i2c->adap.name, "pxa_i2c-i2c", sizeof(i2c->adap.name)); + + i2c->clk = devm_clk_get(&dev->dev, NULL); + if (IS_ERR(i2c->clk)) { +--- a/drivers/i2c/busses/i2c-qcom-geni.c ++++ b/drivers/i2c/busses/i2c-qcom-geni.c +@@ -577,7 +577,7 @@ static int geni_i2c_probe(struct platfor + i2c_set_adapdata(&gi2c->adap, gi2c); + gi2c->adap.dev.parent = dev; + gi2c->adap.dev.of_node = dev->of_node; +- strlcpy(gi2c->adap.name, "Geni-I2C", sizeof(gi2c->adap.name)); ++ strscpy(gi2c->adap.name, "Geni-I2C", sizeof(gi2c->adap.name)); + + ret = geni_icc_get(&gi2c->se, "qup-memory"); + if (ret) +--- a/drivers/i2c/busses/i2c-qup.c ++++ b/drivers/i2c/busses/i2c-qup.c +@@ -1878,7 +1878,7 @@ nodma: + qup->adap.dev.of_node = pdev->dev.of_node; + qup->is_last = true; + +- strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); ++ strscpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); + + pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC); + pm_runtime_use_autosuspend(qup->dev); +--- a/drivers/i2c/busses/i2c-rcar.c ++++ b/drivers/i2c/busses/i2c-rcar.c +@@ -1059,7 +1059,7 @@ static int rcar_i2c_probe(struct platfor + adap->bus_recovery_info = &rcar_i2c_bri; + adap->quirks = &rcar_i2c_quirks; + i2c_set_adapdata(adap, priv); +- strlcpy(adap->name, pdev->name, sizeof(adap->name)); ++ strscpy(adap->name, pdev->name, sizeof(adap->name)); + + /* Init DMA */ + sg_init_table(&priv->sg, 1); +--- a/drivers/i2c/busses/i2c-riic.c ++++ b/drivers/i2c/busses/i2c-riic.c +@@ -447,7 +447,7 @@ static int riic_i2c_probe(struct platfor + + adap = &riic->adapter; + i2c_set_adapdata(adap, riic); +- strlcpy(adap->name, "Renesas RIIC adapter", sizeof(adap->name)); ++ strscpy(adap->name, "Renesas RIIC adapter", sizeof(adap->name)); + adap->owner = THIS_MODULE; + adap->algo = &riic_algo; + adap->dev.parent = &pdev->dev; +--- a/drivers/i2c/busses/i2c-rk3x.c ++++ b/drivers/i2c/busses/i2c-rk3x.c +@@ -1240,7 +1240,7 @@ static int rk3x_i2c_probe(struct platfor + /* use common interface to get I2C timing properties */ + i2c_parse_fw_timings(&pdev->dev, &i2c->t, true); + +- strlcpy(i2c->adap.name, "rk3x-i2c", sizeof(i2c->adap.name)); ++ strscpy(i2c->adap.name, "rk3x-i2c", sizeof(i2c->adap.name)); + i2c->adap.owner = THIS_MODULE; + i2c->adap.algo = &rk3x_i2c_algorithm; + i2c->adap.retries = 3; +--- a/drivers/i2c/busses/i2c-s3c2410.c ++++ b/drivers/i2c/busses/i2c-s3c2410.c +@@ -1076,7 +1076,7 @@ static int s3c24xx_i2c_probe(struct plat + else + s3c24xx_i2c_parse_dt(pdev->dev.of_node, i2c); + +- strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name)); ++ strscpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name)); + i2c->adap.owner = THIS_MODULE; + i2c->adap.algo = &s3c24xx_i2c_algorithm; + i2c->adap.retries = 2; +--- a/drivers/i2c/busses/i2c-sh_mobile.c ++++ b/drivers/i2c/busses/i2c-sh_mobile.c +@@ -930,7 +930,7 @@ static int sh_mobile_i2c_probe(struct pl + adap->nr = dev->id; + adap->dev.of_node = dev->dev.of_node; + +- strlcpy(adap->name, dev->name, sizeof(adap->name)); ++ strscpy(adap->name, dev->name, sizeof(adap->name)); + + spin_lock_init(&pd->lock); + init_waitqueue_head(&pd->wait); +--- a/drivers/i2c/busses/i2c-simtec.c ++++ b/drivers/i2c/busses/i2c-simtec.c +@@ -99,7 +99,7 @@ static int simtec_i2c_probe(struct platf + pd->adap.algo_data = &pd->bit; + pd->adap.dev.parent = &dev->dev; + +- strlcpy(pd->adap.name, "Simtec I2C", sizeof(pd->adap.name)); ++ strscpy(pd->adap.name, "Simtec I2C", sizeof(pd->adap.name)); + + pd->bit.data = pd; + pd->bit.setsda = simtec_i2c_setsda; +--- a/drivers/i2c/busses/i2c-taos-evm.c ++++ b/drivers/i2c/busses/i2c-taos-evm.c +@@ -239,7 +239,7 @@ static int taos_connect(struct serio *se + dev_err(&serio->dev, "TAOS EVM identification failed\n"); + goto exit_close; + } +- strlcpy(adapter->name, name, sizeof(adapter->name)); ++ strscpy(adapter->name, name, sizeof(adapter->name)); + + /* Turn echo off for better performance */ + taos->state = TAOS_STATE_EOFF; +--- a/drivers/i2c/busses/i2c-tegra-bpmp.c ++++ b/drivers/i2c/busses/i2c-tegra-bpmp.c +@@ -305,7 +305,7 @@ static int tegra_bpmp_i2c_probe(struct p + + i2c_set_adapdata(&i2c->adapter, i2c); + i2c->adapter.owner = THIS_MODULE; +- strlcpy(i2c->adapter.name, "Tegra BPMP I2C adapter", ++ strscpy(i2c->adapter.name, "Tegra BPMP I2C adapter", + sizeof(i2c->adapter.name)); + i2c->adapter.algo = &tegra_bpmp_i2c_algo; + i2c->adapter.dev.parent = &pdev->dev; +--- a/drivers/i2c/busses/i2c-tegra.c ++++ b/drivers/i2c/busses/i2c-tegra.c +@@ -1799,7 +1799,7 @@ static int tegra_i2c_probe(struct platfo + if (i2c_dev->hw->supports_bus_clear) + i2c_dev->adapter.bus_recovery_info = &tegra_i2c_recovery_info; + +- strlcpy(i2c_dev->adapter.name, dev_name(i2c_dev->dev), ++ strscpy(i2c_dev->adapter.name, dev_name(i2c_dev->dev), + sizeof(i2c_dev->adapter.name)); + + err = i2c_add_numbered_adapter(&i2c_dev->adapter); +--- a/drivers/i2c/busses/i2c-uniphier-f.c ++++ b/drivers/i2c/busses/i2c-uniphier-f.c +@@ -564,7 +564,7 @@ static int uniphier_fi2c_probe(struct pl + priv->adap.algo = &uniphier_fi2c_algo; + priv->adap.dev.parent = dev; + priv->adap.dev.of_node = dev->of_node; +- strlcpy(priv->adap.name, "UniPhier FI2C", sizeof(priv->adap.name)); ++ strscpy(priv->adap.name, "UniPhier FI2C", sizeof(priv->adap.name)); + priv->adap.bus_recovery_info = &uniphier_fi2c_bus_recovery_info; + i2c_set_adapdata(&priv->adap, priv); + platform_set_drvdata(pdev, priv); +--- a/drivers/i2c/busses/i2c-uniphier.c ++++ b/drivers/i2c/busses/i2c-uniphier.c +@@ -358,7 +358,7 @@ static int uniphier_i2c_probe(struct pla + priv->adap.algo = &uniphier_i2c_algo; + priv->adap.dev.parent = dev; + priv->adap.dev.of_node = dev->of_node; +- strlcpy(priv->adap.name, "UniPhier I2C", sizeof(priv->adap.name)); ++ strscpy(priv->adap.name, "UniPhier I2C", sizeof(priv->adap.name)); + priv->adap.bus_recovery_info = &uniphier_i2c_bus_recovery_info; + i2c_set_adapdata(&priv->adap, priv); + platform_set_drvdata(pdev, priv); +--- a/drivers/i2c/busses/i2c-versatile.c ++++ b/drivers/i2c/busses/i2c-versatile.c +@@ -79,7 +79,7 @@ static int i2c_versatile_probe(struct pl + writel(SCL | SDA, i2c->base + I2C_CONTROLS); + + i2c->adap.owner = THIS_MODULE; +- strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name)); ++ strscpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name)); + i2c->adap.algo_data = &i2c->algo; + i2c->adap.dev.parent = &dev->dev; + i2c->adap.dev.of_node = dev->dev.of_node; +--- a/drivers/i2c/busses/i2c-wmt.c ++++ b/drivers/i2c/busses/i2c-wmt.c +@@ -413,7 +413,7 @@ static int wmt_i2c_probe(struct platform + + adap = &i2c_dev->adapter; + i2c_set_adapdata(adap, i2c_dev); +- strlcpy(adap->name, "WMT I2C adapter", sizeof(adap->name)); ++ strscpy(adap->name, "WMT I2C adapter", sizeof(adap->name)); + adap->owner = THIS_MODULE; + adap->algo = &wmt_i2c_algo; + adap->dev.parent = &pdev->dev; diff --git a/target/linux/mediatek/patches-5.15/803-i2c-busses-add-mt7986-support.patch b/target/linux/mediatek/patches-5.15/851-v6.2-i2c-mediatek-add-mt7986-support.patch similarity index 54% rename from target/linux/mediatek/patches-5.15/803-i2c-busses-add-mt7986-support.patch rename to target/linux/mediatek/patches-5.15/851-v6.2-i2c-mediatek-add-mt7986-support.patch index 1860a6da0174e0..4c398c59f93551 100644 --- a/target/linux/mediatek/patches-5.15/803-i2c-busses-add-mt7986-support.patch +++ b/target/linux/mediatek/patches-5.15/851-v6.2-i2c-mediatek-add-mt7986-support.patch @@ -1,7 +1,21 @@ +From 11f9a0f4e51887ad7b4a2898a368fcd0c2984e89 Mon Sep 17 00:00:00 2001 +From: Frank Wunderlich +Date: Sun, 9 Oct 2022 12:16:31 +0200 +Subject: [PATCH 12/16] i2c: mediatek: add mt7986 support + +Add i2c support for MT7986 SoC. + +Signed-off-by: Frank Wunderlich +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c -@@ -365,6 +365,19 @@ static const struct mtk_i2c_compatible m - .max_dma_support = 32, +@@ -431,6 +431,19 @@ static const struct mtk_i2c_compatible m + .max_dma_support = 33, }; +static const struct mtk_i2c_compatible mt7986_compat = { @@ -11,20 +25,20 @@ + .dcm = 1, + .auto_restart = 1, + .aux_len_reg = 1, -+ .max_dma_support = 32, + .timing_adjust = 0, + .dma_sync = 1, + .ltiming_adjust = 0, ++ .max_dma_support = 32, +}; + static const struct mtk_i2c_compatible mt8173_compat = { .regs = mt_i2c_regs_v1, .pmic_i2c = 0, -@@ -411,6 +424,7 @@ static const struct of_device_id mtk_i2c +@@ -503,6 +516,7 @@ static const struct of_device_id mtk_i2c { .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat }, { .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat }, { .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat }, + { .compatible = "mediatek,mt7986-i2c", .data = &mt7986_compat }, + { .compatible = "mediatek,mt8168-i2c", .data = &mt8168_compat }, { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, { .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat }, - { .compatible = "mediatek,mt8192-i2c", .data = &mt8192_compat }, diff --git a/target/linux/mediatek/patches-5.15/852-v6.3-i2c-mt65xx-Use-devm_platform_get_and_ioremap_resourc.patch b/target/linux/mediatek/patches-5.15/852-v6.3-i2c-mt65xx-Use-devm_platform_get_and_ioremap_resourc.patch new file mode 100644 index 00000000000000..18c66cdac52910 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/852-v6.3-i2c-mt65xx-Use-devm_platform_get_and_ioremap_resourc.patch @@ -0,0 +1,42 @@ +From 98204ccafd45a8a6109ff2d60e2c179b95d92578 Mon Sep 17 00:00:00 2001 +From: ye xingchen +Date: Thu, 19 Jan 2023 17:19:58 +0800 +Subject: [PATCH 13/16] i2c: mt65xx: Use + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +Signed-off-by: ye xingchen +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -1366,20 +1366,17 @@ static int mtk_i2c_probe(struct platform + { + int ret = 0; + struct mtk_i2c *i2c; +- struct resource *res; + int i, irq, speed_clk; + + i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + if (!i2c) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- i2c->base = devm_ioremap_resource(&pdev->dev, res); ++ i2c->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (IS_ERR(i2c->base)) + return PTR_ERR(i2c->base); + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 1); +- i2c->pdmabase = devm_ioremap_resource(&pdev->dev, res); ++ i2c->pdmabase = devm_platform_get_and_ioremap_resource(pdev, 1, NULL); + if (IS_ERR(i2c->pdmabase)) + return PTR_ERR(i2c->pdmabase); + diff --git a/target/linux/mediatek/patches-5.15/853-v6.3-i2c-mt65xx-drop-of_match_ptr-for-ID-table.patch b/target/linux/mediatek/patches-5.15/853-v6.3-i2c-mt65xx-drop-of_match_ptr-for-ID-table.patch new file mode 100644 index 00000000000000..d000d535226f42 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/853-v6.3-i2c-mt65xx-drop-of_match_ptr-for-ID-table.patch @@ -0,0 +1,33 @@ +From 8106fa2e0ae6082833fe1df97829c46c0183eaea Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Sat, 11 Mar 2023 12:16:54 +0100 +Subject: [PATCH 14/16] i2c: mt65xx: drop of_match_ptr for ID table +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The driver can match only via the DT table so the table should be always +used and the of_match_ptr does not have any sense (this also allows ACPI +matching via PRP0001, even though it might not be relevant here). + + drivers/i2c/busses/i2c-mt65xx.c:514:34: error: ‘mtk_i2c_of_match’ defined but not used [-Werror=unused-const-variable=] + +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Guenter Roeck +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -1546,7 +1546,7 @@ static struct platform_driver mtk_i2c_dr + .driver = { + .name = I2C_DRV_NAME, + .pm = &mtk_i2c_pm, +- .of_match_table = of_match_ptr(mtk_i2c_of_match), ++ .of_match_table = mtk_i2c_of_match, + }, + }; + diff --git a/target/linux/mediatek/patches-5.15/854-v6.4-i2c-mediatek-add-support-for-MT7981-SoC.patch b/target/linux/mediatek/patches-5.15/854-v6.4-i2c-mediatek-add-support-for-MT7981-SoC.patch new file mode 100644 index 00000000000000..e0973741e29d68 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/854-v6.4-i2c-mediatek-add-support-for-MT7981-SoC.patch @@ -0,0 +1,47 @@ +From f69f3d662ba3bf999c36d9ac1e684540c4487bc3 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 10 Apr 2023 17:19:38 +0100 +Subject: [PATCH 15/16] i2c: mediatek: add support for MT7981 SoC + +Add support for the I2C units found in the MediaTek MT7981 and MT7988 +SoCs. Just like other recent MediaTek I2C units that also uses v3 +register offsets (which differ from v2 only by OFFSET_SLAVE_ADDR being +0x94 instead of 0x4). + +Signed-off-by: Daniel Golle +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Alexandre Mergnat +Signed-off-by: Wolfram Sang +--- + drivers/i2c/busses/i2c-mt65xx.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -431,6 +431,18 @@ static const struct mtk_i2c_compatible m + .max_dma_support = 33, + }; + ++static const struct mtk_i2c_compatible mt7981_compat = { ++ .regs = mt_i2c_regs_v3, ++ .pmic_i2c = 0, ++ .dcm = 0, ++ .auto_restart = 1, ++ .aux_len_reg = 1, ++ .timing_adjust = 1, ++ .dma_sync = 1, ++ .ltiming_adjust = 1, ++ .max_dma_support = 33 ++}; ++ + static const struct mtk_i2c_compatible mt7986_compat = { + .quirks = &mt7622_i2c_quirks, + .regs = mt_i2c_regs_v1, +@@ -516,6 +528,7 @@ static const struct of_device_id mtk_i2c + { .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat }, + { .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat }, + { .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat }, ++ { .compatible = "mediatek,mt7981-i2c", .data = &mt7981_compat }, + { .compatible = "mediatek,mt7986-i2c", .data = &mt7986_compat }, + { .compatible = "mediatek,mt8168-i2c", .data = &mt8168_compat }, + { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, diff --git a/target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch b/target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch new file mode 100644 index 00000000000000..1ed8d1a96a3363 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch @@ -0,0 +1,55 @@ +From 94bf61df9201195d6d8ce82e299fb231b31fbaae Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 26 May 2023 10:29:45 +0100 +Subject: [PATCH] i2c: mt65xx: add additional clocks + +On MT7981 additional clocks are required when accessing I2C registers. +Add MCK and PCK optional clocks to i2c-mt65xx driver so we don't have +to always have them enabled, but really only if I2C is used. + +Signed-off-by: Daniel Golle +--- + drivers/i2c/busses/i2c-mt65xx.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -93,6 +93,8 @@ + * @I2C_MT65XX_CLK_DMA: DMA clock for i2c via DMA + * @I2C_MT65XX_CLK_PMIC: PMIC clock for i2c from PMIC + * @I2C_MT65XX_CLK_ARB: Arbitrator clock for i2c ++ * @I2C_MT65XX_CLK_MCK: MCK clock for i2c ++ * @I2C_MT65XX_CLK_PCK: PCK clock for i2c + * @I2C_MT65XX_CLK_MAX: Number of supported clocks + */ + enum i2c_mt65xx_clks { +@@ -100,11 +102,13 @@ enum i2c_mt65xx_clks { + I2C_MT65XX_CLK_DMA, + I2C_MT65XX_CLK_PMIC, + I2C_MT65XX_CLK_ARB, ++ I2C_MT65XX_CLK_MCK, ++ I2C_MT65XX_CLK_PCK, + I2C_MT65XX_CLK_MAX + }; + + static const char * const i2c_mt65xx_clk_ids[I2C_MT65XX_CLK_MAX] = { +- "main", "dma", "pmic", "arb" ++ "main", "dma", "pmic", "arb", "mck", "pck" + }; + + enum DMA_REGS_OFFSET { +@@ -1444,6 +1448,14 @@ static int mtk_i2c_probe(struct platform + if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk)) + return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk); + ++ i2c->clocks[I2C_MT65XX_CLK_MCK].clk = devm_clk_get_optional(&pdev->dev, "mck"); ++ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk)) ++ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk); ++ ++ i2c->clocks[I2C_MT65XX_CLK_PCK].clk = devm_clk_get_optional(&pdev->dev, "pck"); ++ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk)) ++ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk); ++ + if (i2c->have_pmic) { + i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get(&pdev->dev, "pmic"); + if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) { From 5d0d04e2384ebd54d14e1f5d80ad74602f8fc17f Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 19 Mar 2023 19:00:51 +0100 Subject: [PATCH 0046/1171] mediatek: mt7981: add reserved memory to support pstore Add reserved memory for pstore/ramoops to device tree used by Linux as well as U-Boot. Signed-off-by: Alexander Couzens Signed-off-by: Daniel Golle (cherry picked from commit 3eb354f999a3687f9ae547899b0f5ec2b10185ab) Signed-off-by: Daniel Golle --- .../patches/052-mt7981-enable-pstore.patch | 38 +++++++++++++++++++ .../arch/arm64/boot/dts/mediatek/mt7981.dtsi | 7 ++++ 2 files changed, 45 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/052-mt7981-enable-pstore.patch diff --git a/package/boot/uboot-mediatek/patches/052-mt7981-enable-pstore.patch b/package/boot/uboot-mediatek/patches/052-mt7981-enable-pstore.patch new file mode 100644 index 00000000000000..9bfea8f7379b69 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/052-mt7981-enable-pstore.patch @@ -0,0 +1,38 @@ +--- a/arch/arm/dts/mt7981.dtsi ++++ b/arch/arm/dts/mt7981.dtsi +@@ -32,6 +32,35 @@ + }; + }; + ++ psci { ++ compatible = "arm,psci-0.2"; ++ method = "smc"; ++ }; ++ ++ reserved-memory { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ /* 64 KiB reserved for ramoops/pstore */ ++ ramoops@42ff0000 { ++ compatible = "ramoops"; ++ reg = <0 0x42ff0000 0 0x10000>; ++ record-size = <0x1000>; ++ }; ++ ++ /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ ++ secmon_reserved: secmon@43000000 { ++ reg = <0 0x43000000 0 0x30000>; ++ no-map; ++ }; ++ ++ wmcpu_emi: wmcpu-reserved@4fc00000 { ++ no-map; ++ reg = <0 0x4fc00000 0 0x00100000>; ++ }; ++ }; ++ + gpt_clk: gpt_dummy20m { + compatible = "fixed-clock"; + clock-frequency = <13000000>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index 07a8c06979e58f..17038a24847278 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -164,6 +164,13 @@ #size-cells = <2>; ranges; + /* 64 KiB reserved for ramoops/pstore */ + ramoops@42ff0000 { + compatible = "ramoops"; + reg = <0 0x42ff0000 0 0x10000>; + record-size = <0x1000>; + }; + /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ secmon_reserved: secmon@43000000 { reg = <0 0x43000000 0 0x30000>; From c55bcf777226dd43620d351c54008b43824b4303 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Tue, 25 Apr 2023 23:06:20 +0800 Subject: [PATCH 0047/1171] mediatek: filogic: add uboot build for mt7981 Rename previous uboot build to mt7986-*. Signed-off-by: Chukun Pan (cherry picked from commit c620409d58a29d49ceccf838e90e030610c06611) Signed-off-by: Daniel Golle --- target/linux/mediatek/image/filogic.mk | 40 +++++++++++++++----------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index fac72a1b371fd7..da0d81c3461ae6 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -6,11 +6,19 @@ define Image/Prepare echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark endef -define Build/bl2 +define Build/mt7981-bl2 + cat $(STAGING_DIR_IMAGE)/mt7981-$1-bl2.img >> $@ +endef + +define Build/mt7981-bl31-uboot + cat $(STAGING_DIR_IMAGE)/mt7981_$1-u-boot.fip >> $@ +endef + +define Build/mt7986-bl2 cat $(STAGING_DIR_IMAGE)/mt7986-$1-bl2.img >> $@ endef -define Build/bl31-uboot +define Build/mt7986-bl31-uboot cat $(STAGING_DIR_IMAGE)/mt7986_$1-u-boot.fip >> $@ endef @@ -99,24 +107,24 @@ define Device/bananapi_bpi-r3 nor-preloader.bin nor-bl31-uboot.fip \ sdcard.img.gz \ snand-preloader.bin snand-bl31-uboot.fip - ARTIFACT/emmc-preloader.bin := bl2 emmc-ddr4 - ARTIFACT/emmc-bl31-uboot.fip := bl31-uboot bananapi_bpi-r3-emmc - ARTIFACT/nor-preloader.bin := bl2 nor-ddr4 - ARTIFACT/nor-bl31-uboot.fip := bl31-uboot bananapi_bpi-r3-nor - ARTIFACT/snand-preloader.bin := bl2 spim-nand-ddr4 - ARTIFACT/snand-bl31-uboot.fip := bl31-uboot bananapi_bpi-r3-snand + ARTIFACT/emmc-preloader.bin := mt7986-bl2 emmc-ddr4 + ARTIFACT/emmc-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-emmc + ARTIFACT/nor-preloader.bin := mt7986-bl2 nor-ddr4 + ARTIFACT/nor-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-nor + ARTIFACT/snand-preloader.bin := mt7986-bl2 spim-nand-ddr4 + ARTIFACT/snand-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-snand ARTIFACT/sdcard.img.gz := mt7986-gpt sdmmc |\ - pad-to 17k | bl2 sdmmc-ddr4 |\ - pad-to 6656k | bl31-uboot bananapi_bpi-r3-sdmmc |\ + pad-to 17k | mt7986-bl2 sdmmc-ddr4 |\ + pad-to 6656k | mt7986-bl31-uboot bananapi_bpi-r3-sdmmc |\ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\ ) \ - pad-to 44M | bl2 spim-nand-ddr4 |\ - pad-to 45M | bl31-uboot bananapi_bpi-r3-snand |\ - pad-to 49M | bl2 nor-ddr4 |\ - pad-to 50M | bl31-uboot bananapi_bpi-r3-nor |\ - pad-to 51M | bl2 emmc-ddr4 |\ - pad-to 52M | bl31-uboot bananapi_bpi-r3-emmc |\ + pad-to 44M | mt7986-bl2 spim-nand-ddr4 |\ + pad-to 45M | mt7986-bl31-uboot bananapi_bpi-r3-snand |\ + pad-to 49M | mt7986-bl2 nor-ddr4 |\ + pad-to 50M | mt7986-bl31-uboot bananapi_bpi-r3-nor |\ + pad-to 51M | mt7986-bl2 emmc-ddr4 |\ + pad-to 52M | mt7986-bl31-uboot bananapi_bpi-r3-emmc |\ pad-to 56M | mt7986-gpt emmc |\ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ From f588da89a3341c4c876255944daac087d8050c24 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Wed, 26 Apr 2023 23:28:31 +0800 Subject: [PATCH 0048/1171] arm-trusted-firmware-mediatek: add build for MT7981 DDR3 Add new build option BOARD_QFN/BOARD_BGA. This option is only useful for MT7981 device. MT7981A/B: BOARD_BGA, MT7981C: BOARD_QFN. Signed-off-by: Chukun Pan (cherry picked from commit 602cb4f3259cb676fcf6fa6c459d598df643653b) Signed-off-by: Daniel Golle --- .../arm-trusted-firmware-mediatek/Makefile | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 2f879f9a57dc1e..2098d0835f83b3 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -30,6 +30,7 @@ define Trusted-Firmware-A/Default DDR3_FLYBY:= DDR_TYPE:= NAND_TYPE:= + BOARD_QFN:= endef define Trusted-Firmware-A/mt7622-nor-1ddr @@ -92,6 +93,46 @@ define Trusted-Firmware-A/mt7622-sdmmc-2ddr DDR3_FLYBY:=1 endef +define Trusted-Firmware-A/mt7981-nor-ddr3 + NAME:=MediaTek MT7981 (SPI-NOR, DDR3) + BOOT_DEVICE:=nor + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7981-emmc-ddr3 + NAME:=MediaTek MT7981 (eMMC, DDR3) + BOOT_DEVICE:=emmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7981-sdmmc-ddr3 + NAME:=MediaTek MT7981 (SD card, DDR3) + BOOT_DEVICE:=sdmmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7986-snand-ddr3 + NAME:=MediaTek MT7981 (SPI-NAND via SNFI, DDR3) + BOOT_DEVICE:=snand + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7981-spim-nand-ddr3 + NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR3) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr3 +endef + define Trusted-Firmware-A/mt7986-nor-ddr4 NAME:=MediaTek MT7986 (SPI-NOR, DDR4) BOOT_DEVICE:=nor @@ -182,6 +223,11 @@ TFA_TARGETS:= \ mt7622-emmc-2ddr \ mt7622-sdmmc-1ddr \ mt7622-sdmmc-2ddr \ + mt7981-emmc-ddr3 \ + mt7981-nor-ddr3 \ + mt7981-sdmmc-ddr3 \ + mt7986-snand-ddr3 \ + mt7981-spim-nand-ddr3 \ mt7986-emmc-ddr3 \ mt7986-nor-ddr3 \ mt7986-sdmmc-ddr3 \ @@ -197,6 +243,7 @@ TFA_MAKE_FLAGS += \ BOOT_DEVICE=$(BOOT_DEVICE) \ USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \ $(if $(findstring ddr4,$(DDR_TYPE)),DRAM_USE_DDR4=1) \ + $(if $(BOARD_QFN),BOARD_QFN=1,BOARD_BGA=1) \ $(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \ HAVE_DRAM_OBJ_FILE=yes \ $(if $(DDR3_FLYBY),DDR3_FLYBY=1) \ From 99c94c669618c37ab4e6c888e46f59fb7197f86a Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Fri, 28 Apr 2023 23:36:17 +0800 Subject: [PATCH 0049/1171] uboot-mediatek: add Qihoo 360T7 support The vendor uboot will verify firmware at boot. So add a custom uboot build for this device. Signed-off-by: Chukun Pan (cherry picked from commit c51eb177308835f811ae43b17dde0ea962ed1df1) Signed-off-by: Daniel Golle --- .../uboot-envtools/files/mediatek_filogic | 1 + package/boot/uboot-mediatek/Makefile | 13 + ...7981-generic-reset-button-ignore-env.patch | 43 ++ .../patches/433-add-qihoo_360t7.patch | 420 ++++++++++++++++++ 4 files changed, 477 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch create mode 100644 package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 50b9cd0e4631c9..b638a65a4e8a64 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -41,6 +41,7 @@ xiaomi,redmi-router-ax6000-stock) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000" ;; +qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 12c305617b30cc..8ea05b9159e627 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -176,6 +176,18 @@ define U-Boot/mt7629_rfb UBOOT_CONFIG:=mt7629_rfb endef +define U-Boot/mt7981_qihoo_360t7 + NAME:=Qihoo 360T7 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=qihoo_360t7 + UBOOT_CONFIG:=mt7981_qihoo-360t7 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + define U-Boot/mt7986_rfb NAME:=MT7986 Reference Board BUILD_SUBTARGET:=filogic @@ -301,6 +313,7 @@ UBOOT_TARGETS := \ mt7628_rfb \ ravpower_rp-wd009 \ mt7629_rfb \ + mt7981_qihoo_360t7 \ mt7986_bananapi_bpi-r3-emmc \ mt7986_bananapi_bpi-r3-sdmmc \ mt7986_bananapi_bpi-r3-snand \ diff --git a/package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch new file mode 100644 index 00000000000000..fc443349829c05 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch @@ -0,0 +1,43 @@ +--- a/board/mediatek/mt7981/mt7981_rfb.c ++++ b/board/mediatek/mt7981/mt7981_rfb.c +@@ -6,9 +6,16 @@ + + #include + #include ++#include ++#include + #include + #include + #include ++#include ++ ++#ifndef CONFIG_RESET_BUTTON_LABEL ++#define CONFIG_RESET_BUTTON_LABEL "reset" ++#endif + + #include + #include +@@ -24,7 +31,22 @@ int board_init(void) + + int board_late_init(void) + { +- gd->env_valid = 1; //to load environment variable from persistent store ++ struct udevice *dev; ++ ++ gd->env_valid = ENV_VALID; ++ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) { ++ puts("reset button found\n"); ++#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY ++ if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) { ++ button_get_state(dev); ++ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY); ++ } ++#endif ++ if (button_get_state(dev) == BUTTON_ON) { ++ puts("button pushed, resetting environment\n"); ++ gd->env_valid = ENV_INVALID; ++ } ++ } + env_relocate(); + return 0; + } diff --git a/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch b/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch new file mode 100644 index 00000000000000..2be7e18c6ec94d --- /dev/null +++ b/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch @@ -0,0 +1,420 @@ +--- /dev/null ++++ b/configs/mt7981_qihoo-360t7_defconfig +@@ -0,0 +1,175 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981_qihoo-360t7" ++CONFIG_DEFAULT_ENV_FILE="qihoo-360t7_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_qihoo-360t7.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_AHCI=y ++CONFIG_AHCI_PCI=y ++CONFIG_SCSI_AHCI=y ++CONFIG_SCSI=y ++CONFIG_CMD_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_HEXDUMP=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/arch/arm/dts/mt7981_qihoo-360t7.dts +@@ -0,0 +1,180 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "Qihoo 360T7"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ factory { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wps { ++ label = "wps"; ++ linux,code = ; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status_red { ++ label = "red:status"; ++ gpios = <&gpio 3 GPIO_ACTIVE_LOW>; ++ }; ++ ++ status_green { ++ label = "green:status"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "disabled"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "sgmii"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++ ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_1"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++ ++ pwm_pins: pwm0-pins-func-1 { ++ mux { ++ function = "pwm"; ++ groups = "pwm0_1", "pwm1_0"; ++ }; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "orig-env"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@160000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x6c00000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/qihoo-360t7_env +@@ -0,0 +1,56 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-qihoo_360t7-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-qihoo_360t7-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-qihoo_360t7-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-qihoo_360t7-squashfs-sysupgrade.itb ++bootled_pwr=green:status ++bootled_rec=red:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++part_default=production ++part_recovery=recovery ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" From e018afcfc6ae26d3d41d1a6092962657fe9ec96a Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Sat, 29 Apr 2023 23:08:26 +0800 Subject: [PATCH 0050/1171] mediatek: filogic: add Qihoo 360T7 support Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: ESMT F50L1G41LB 128MB RAM: MT5CC128M16JR-EK 256MB Ethernet: 4x 10/100/1000 Mbps Switch: MediaTek MT7531AE WiFi: MediaTek MT7976C Button: Reset, WPS Power: DC 12V 1A Flash instructions: 1. Attach UART, boot the stock firmware until the message about failsafe mode appears. 2. Enter failsafe mode by pressing "f" and "Enter" 3. Type "mount_root", then run "fw_setenv bootmenu_delay 3" 4. Back up all mtd partitions before flashing. 5. Reboot, U-Boot now presents a menu. 6. Connect to your PC via the Gigabit port of the router, set a static ip on the ethernet interface of your PC. (ip 192.168.1.254, gateway 192.168.1.1) 7. Select "Upgrade ATF BL2", then use this file: openwrt-mediatek-filogic-qihoo_360t7-preloader.bin 8. Select "Upgrade ATF FIP", then use this file: openwrt-mediatek-filogic-qihoo_360t7-bl31-uboot.fip 9. Download the initramfs image, and type "reset", waiting for tftp recovery to complete. a. After openwrt boots up, perform sysupgrade. Note: 1. Since NMBM is disabled, we must back up all partitions. 2. Flash instructions is based on commit 28df7f7. Signed-off-by: Chukun Pan (cherry picked from commit dc2d4d73939c3d86a8e9d968c5c3462f92771bc6) Signed-off-by: Daniel Golle --- .../mediatek/dts/mt7981b-qihoo-360t7.dts | 229 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 8 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 24 ++ 5 files changed, 267 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts diff --git a/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts b/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts new file mode 100644 index 00000000000000..87076d255cfdac --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts @@ -0,0 +1,229 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Qihoo 360T7"; + compatible = "qihoo,360t7", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: red { + label = "red:status"; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + }; + + led_status_green: green { + label = "green:status"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bl2"; + reg = <0x0000000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x0180000 0x0200000>; + read-only; + }; + + partition@380000 { + label = "fip"; + reg = <0x0380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x0580000 0x6c00000>; + }; + + partition@7180000 { + label = "config"; + reg = <0x7180000 0x0100000>; + read-only; + }; + + partition@7280000 { + label = "factory"; + reg = <0x7280000 0x0080000>; + read-only; + }; + + partition@7300000 { + label = "log"; + reg = <0x7300000 0x0700000>; + read-only; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan3"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan1"; + }; + + port@3 { + reg = <3>; + label = "wan"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 2fca00921b8caf..a327a46108acd9 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -29,6 +29,9 @@ mediatek_setup_interfaces() mediatek,mt7988a-dsa-10g-spim-snand) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "eth1 eth2" ;; + qihoo,360t7) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan + ;; tplink,tl-xdr4288|\ tplink,tl-xdr6088) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 @@ -63,6 +66,11 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + qihoo,360t7) + lan_mac=$(mtd_get_mac_ascii factory lanMac) + wan_mac=$(macaddr_add "$lan_mac" 1) + label_mac=$wan_mac + ;; xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) wan_mac=$(mtd_get_mac_ascii Bdata ethaddr_wan) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index a56e5bc6893096..a3db00f5e8ffd0 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -32,6 +32,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress ;; + qihoo,360t7) + addr=$(mtd_get_mac_ascii factory lanMac) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress + ;; tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 9a7a5aaffb0d5e..5b624bc5517146 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -70,6 +70,7 @@ platform_do_upgrade() { cudy,wr3000-v1) default_do_upgrade "$1" ;; + qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index da0d81c3461ae6..d1a0a44138632a 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -233,6 +233,30 @@ define Device/mediatek_mt7988a-rfb-nand endef TARGET_DEVICES += mediatek_mt7988a-rfb-nand +define Device/qihoo_360t7 + DEVICE_VENDOR := Qihoo + DEVICE_MODEL := 360T7 + DEVICE_DTS := mt7981b-qihoo-360t7 + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot qihoo_360t7 +endef +TARGET_DEVICES += qihoo_360t7 + define Device/tplink_tl-xdr-common DEVICE_VENDOR := TP-Link DEVICE_DTS_DIR := ../dts From cd36c6f52b154e05789e8a2c462a4a0d3fb61cda Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 27 May 2023 21:49:55 +0100 Subject: [PATCH 0051/1171] mediatek: follow-up with renamed Build/bl2 and Build/bl31-uboot Use renamed build step names for all boards which were not handled by commit c620409d58 ("mediatek: filogic: add uboot build for mt7981") and now breaking the build. Fixes: c620409d58 ("mediatek: filogic: add uboot build for mt7981") Signed-off-by: Daniel Golle (cherry picked from commit 037ce27244b52fe4c0e2bd15f4a16973c64df93f) --- target/linux/mediatek/image/filogic.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index d1a0a44138632a..582c1f70b8f2ae 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -274,13 +274,13 @@ define Device/tplink_tl-xdr-common fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := bl2 spim-nand-ddr3 + ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr3 endef define Device/tplink_tl-xdr4288 DEVICE_MODEL := TL-XDR4288 DEVICE_DTS := mt7986a-tplink-tl-xdr4288 - ARTIFACT/bl31-uboot.fip := bl31-uboot tplink_tl-xdr4288 + ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr4288 $(call Device/tplink_tl-xdr-common) endef TARGET_DEVICES += tplink_tl-xdr4288 @@ -288,7 +288,7 @@ TARGET_DEVICES += tplink_tl-xdr4288 define Device/tplink_tl-xdr6086 DEVICE_MODEL := TL-XDR6086 DEVICE_DTS := mt7986a-tplink-tl-xdr6086 - ARTIFACT/bl31-uboot.fip := bl31-uboot tplink_tl-xdr6086 + ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr6086 $(call Device/tplink_tl-xdr-common) endef TARGET_DEVICES += tplink_tl-xdr6086 @@ -296,7 +296,7 @@ TARGET_DEVICES += tplink_tl-xdr6086 define Device/tplink_tl-xdr6088 DEVICE_MODEL := TL-XDR6088 DEVICE_DTS := mt7986a-tplink-tl-xdr6088 - ARTIFACT/bl31-uboot.fip := bl31-uboot tplink_tl-xdr6088 + ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr6088 $(call Device/tplink_tl-xdr-common) endef TARGET_DEVICES += tplink_tl-xdr6088 @@ -337,8 +337,8 @@ define Device/xiaomi_redmi-router-ax6000-ubootmod IMAGE/sysupgrade.itb := append-kernel | \ fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := bl2 spim-nand-ddr4 - ARTIFACT/bl31-uboot.fip := bl31-uboot xiaomi_redmi-router-ax6000 + ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr4 + ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot xiaomi_redmi-router-ax6000 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) ARTIFACTS += initramfs-factory.ubi ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel From 94884f390406b4c67688e8e2206469b5150b3bc6 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 27 May 2023 21:03:40 +0100 Subject: [PATCH 0052/1171] mediatek: sync MT7988 USXGMII with SDK driver The USXGMII driver in SDK was heavily refactored, some bugs have been fixed and it has switched to use phylink_pcs. Follow up with changes in SDK driver and sync our on-top-of-mainline driver with the SDK driver. Signed-off-by: Daniel Golle (cherry picked from commit ba58245e83714de5f47b4b0fc0369930c3661cab) --- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 1382 ++++++++++------- ..._eth_soc-implement-Clause-45-MDIO-ac.patch | 2 +- ...ethernet-mediatek-support-net-labels.patch | 4 +- 3 files changed, 792 insertions(+), 596 deletions(-) diff --git a/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index 68170b6614b8e2..0185bed089774d 100644 --- a/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -1,23 +1,40 @@ -From 20ac14fedba025b6b336a821ea60660afe2d46cd Mon Sep 17 00:00:00 2001 +From 3d833ad2cfc1ab503d9aae2967b7f10811bb3c9c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 1 Mar 2023 11:56:04 +0000 -Subject: [PATCH 7/7] net: ethernet: mtk_eth_soc: add paths and SerDes modes +Subject: [PATCH 7/7] net: ethernet: mtk_eth_soc: add paths and SerDes modes for MT7988 -MT7988 comes with a built-in 2.5G PHY as well as USXGMII or 10Base-KR -compatible SerDes lanes for external PHYs. +MT7988 comes with a built-in 2.5G PHY as well as +USXGMII/10GBase-KR/5GBase-KR compatible SerDes lanes for external PHYs. Add support for configuring the MAC and SerDes parts for the new paths. Signed-off-by: Daniel Golle --- - drivers/net/ethernet/mediatek/Makefile | 2 +- - drivers/net/ethernet/mediatek/mtk_eth_path.c | 154 ++++- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 291 +++++++- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 162 ++++- - drivers/net/ethernet/mediatek/mtk_usxgmii.c | 659 +++++++++++++++++++ - 5 files changed, 1236 insertions(+), 32 deletions(-) + drivers/net/ethernet/mediatek/Kconfig | 7 + + drivers/net/ethernet/mediatek/Makefile | 1 + + drivers/net/ethernet/mediatek/mtk_eth_path.c | 154 +++- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 270 +++++- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 194 ++++- + drivers/net/ethernet/mediatek/mtk_usxgmii.c | 835 +++++++++++++++++++ + 6 files changed, 1428 insertions(+), 33 deletions(-) create mode 100644 drivers/net/ethernet/mediatek/mtk_usxgmii.c +--- a/drivers/net/ethernet/mediatek/Kconfig ++++ b/drivers/net/ethernet/mediatek/Kconfig +@@ -24,6 +24,13 @@ config NET_MEDIATEK_SOC + This driver supports the gigabit ethernet MACs in the + MediaTek SoC family. + ++config NET_MEDIATEK_SOC_USXGMII ++ bool "Support USXGMII SerDes on MT7988" ++ depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST ++ def_bool NET_MEDIATEK_SOC != n ++ help ++ Include support for 10G SerDes which can be found on MT7988. ++ + config NET_MEDIATEK_STAR_EMAC + tristate "MediaTek STAR Ethernet MAC support" + select PHYLIB --- a/drivers/net/ethernet/mediatek/Makefile +++ b/drivers/net/ethernet/mediatek/Makefile @@ -5,6 +5,7 @@ @@ -291,7 +308,20 @@ Signed-off-by: Daniel Golle static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config, phy_interface_t interface) { -@@ -462,7 +479,7 @@ static void mtk_mac_config(struct phylin +@@ -451,6 +468,12 @@ static struct phylink_pcs *mtk_mac_selec + 0 : mac->id; + + return eth->sgmii_pcs[sid]; ++ } else if ((interface == PHY_INTERFACE_MODE_USXGMII || ++ interface == PHY_INTERFACE_MODE_10GKR || ++ interface == PHY_INTERFACE_MODE_5GBASER) && ++ MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && ++ mac->id != MTK_GMAC1_ID) { ++ return mtk_usxgmii_select_pcs(eth, mac->id); + } + + return NULL; +@@ -462,7 +485,7 @@ static void mtk_mac_config(struct phylin struct mtk_mac *mac = container_of(config, struct mtk_mac, phylink_config); struct mtk_eth *eth = mac->hw; @@ -300,7 +330,7 @@ Signed-off-by: Daniel Golle u32 i; /* MT76x8 has no hardware settings between for the MAC */ -@@ -506,6 +523,23 @@ static void mtk_mac_config(struct phylin +@@ -506,6 +529,23 @@ static void mtk_mac_config(struct phylin goto init_err; } break; @@ -324,7 +354,7 @@ Signed-off-by: Daniel Golle default: goto err_phy; } -@@ -584,14 +618,92 @@ static void mtk_mac_config(struct phylin +@@ -584,14 +624,78 @@ static void mtk_mac_config(struct phylin SYSCFG0_SGMII_MASK, ~(u32)SYSCFG0_SGMII_MASK); @@ -338,26 +368,14 @@ Signed-off-by: Daniel Golle + } /* Save the syscfg0 value for mac_finish */ mac->syscfg0 = val; -+ } else if (state->interface == PHY_INTERFACE_MODE_USXGMII || -+ state->interface == PHY_INTERFACE_MODE_10GKR || -+ state->interface == PHY_INTERFACE_MODE_5GBASER) { -+ -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { -+ err = -EINVAL; -+ goto init_err; -+ } -+ if (phylink_autoneg_inband(mode)) -+ err = mtk_usxgmii_setup_mode_force(eth, mac->id, -+ state); -+ else -+ err = mtk_usxgmii_setup_mode_an(eth, mac->id, -+ SPEED_10000); -+ -+ if (err) -+ goto init_err; - } else if (phylink_autoneg_inband(mode)) { +- } else if (phylink_autoneg_inband(mode)) { ++ } else if (state->interface != PHY_INTERFACE_MODE_USXGMII && ++ state->interface != PHY_INTERFACE_MODE_10GKR && ++ state->interface != PHY_INTERFACE_MODE_5GBASER && ++ phylink_autoneg_inband(mode)) { dev_err(eth->dev, - "In-band mode not supported in non SGMII mode!\n"); +- "In-band mode not supported in non SGMII mode!\n"); ++ "In-band mode not supported in non-SerDes modes!\n"); return; } @@ -417,7 +435,7 @@ Signed-off-by: Daniel Golle return; err_phy: -@@ -632,11 +744,37 @@ static int mtk_mac_finish(struct phylink +@@ -632,11 +736,40 @@ static int mtk_mac_finish(struct phylink return 0; } @@ -430,7 +448,12 @@ Signed-off-by: Daniel Golle + if (mac->id == MTK_GMAC2_ID) + sts = sts >> 16; + -+ state->duplex = 1; ++ state->link = FIELD_GET(MTK_USXGMII_PCS_LINK, sts); ++ if (!state->link) ++ return; ++ ++ state->duplex = DUPLEX_FULL; ++ state->interface = mac->interface; + + switch (FIELD_GET(MTK_USXGMII_PCS_MODE, sts)) { + case 0: @@ -446,8 +469,6 @@ Signed-off-by: Daniel Golle + state->speed = SPEED_1000; + break; + } -+ -+ state->link = FIELD_GET(MTK_USXGMII_PCS_LINK, sts); +} + +static void mtk_gdm_pcs_get_state(struct mtk_mac *mac, @@ -458,7 +479,7 @@ Signed-off-by: Daniel Golle u32 pmsr = mtk_r32(mac->hw, MTK_MAC_MSR(mac->id)); state->link = (pmsr & MAC_MSR_LINK); -@@ -664,15 +802,35 @@ static void mtk_mac_pcs_get_state(struct +@@ -664,15 +797,35 @@ static void mtk_mac_pcs_get_state(struct state->pause |= MLO_PAUSE_TX; } @@ -497,7 +518,7 @@ Signed-off-by: Daniel Golle } static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx, -@@ -744,13 +902,11 @@ static void mtk_set_queue_speed(struct m +@@ -744,13 +897,11 @@ static void mtk_set_queue_speed(struct m mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); } @@ -515,7 +536,7 @@ Signed-off-by: Daniel Golle u32 mcr; mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); -@@ -784,6 +940,47 @@ static void mtk_mac_link_up(struct phyli +@@ -784,6 +935,47 @@ static void mtk_mac_link_up(struct phyli mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); } @@ -563,7 +584,7 @@ Signed-off-by: Daniel Golle static const struct phylink_mac_ops mtk_phylink_ops = { .validate = phylink_generic_validate, .mac_select_pcs = mtk_mac_select_pcs, -@@ -836,10 +1033,21 @@ static int mtk_mdio_init(struct mtk_eth +@@ -836,10 +1028,21 @@ static int mtk_mdio_init(struct mtk_eth } divider = min_t(unsigned int, DIV_ROUND_UP(MDC_MAX_FREQ, max_clk), 63); @@ -586,7 +607,7 @@ Signed-off-by: Daniel Golle mtk_w32(eth, val, MTK_PPSC); dev_dbg(eth->dev, "MDC is running on %d Hz\n", MDC_MAX_FREQ / divider); -@@ -4433,8 +4641,8 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4433,8 +4636,8 @@ static int mtk_add_mac(struct mtk_eth *e const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; @@ -596,7 +617,7 @@ Signed-off-by: Daniel Golle int txqs = 1; if (!_id) { -@@ -4525,6 +4733,32 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4525,6 +4728,32 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.supported_interfaces); } @@ -629,40 +650,20 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4714,6 +4948,33 @@ static int mtk_probe(struct platform_dev - return err; - } +@@ -4712,6 +4941,13 @@ static int mtk_probe(struct platform_dev + if (err) + return err; ++ } ++ + if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) { -+ eth->xgmii = devm_kzalloc(eth->dev, sizeof(*eth->xgmii), GFP_KERNEL); + err = mtk_usxgmii_init(eth); -+ if (err) { -+ dev_err(&pdev->dev, "usxgmii init failed\n"); -+ return err; -+ } + -+ err = mtk_xfi_pextp_init(eth); -+ if (err) { -+ dev_err(&pdev->dev, "pextp init failed\n"); -+ return err; -+ } -+ -+ err = mtk_xfi_pll_init(eth); -+ if (err) { -+ dev_err(&pdev->dev, "xfi pll init failed\n"); -+ return err; -+ } -+ -+ err = mtk_toprgu_init(eth); -+ if (err) { -+ dev_err(&pdev->dev, "toprgu init failed\n"); ++ if (err) + return err; -+ } -+ } -+ + } + if (eth->soc->required_pctl) { - eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, - "mediatek,pctl"); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -126,6 +126,11 @@ @@ -743,34 +744,54 @@ Signed-off-by: Daniel Golle /* ethernet subsystem clock register */ -@@ -506,16 +548,69 @@ +@@ -506,16 +548,91 @@ #define ETHSYS_DMA_AG_MAP_QDMA BIT(1) #define ETHSYS_DMA_AG_MAP_PPE BIT(2) +/* USXGMII subsystem config registers */ +/* Register to control speed */ +#define RG_PHY_TOP_SPEED_CTRL1 0x80C -+#define RG_USXGMII_RATE_UPDATE_MODE BIT(31) -+#define RG_MAC_CK_GATED BIT(29) -+#define RG_IF_FORCE_EN BIT(28) -+#define RG_RATE_ADAPT_MODE GENMASK(10, 8) -+#define RG_RATE_ADAPT_MODE_X1 0 -+#define RG_RATE_ADAPT_MODE_X2 1 -+#define RG_RATE_ADAPT_MODE_X4 2 -+#define RG_RATE_ADAPT_MODE_X10 3 -+#define RG_RATE_ADAPT_MODE_X100 4 -+#define RG_RATE_ADAPT_MODE_X5 5 -+#define RG_RATE_ADAPT_MODE_X50 6 -+#define RG_XFI_RX_MODE GENMASK(6, 4) -+#define RG_XFI_RX_MODE_10G 0 -+#define RG_XFI_RX_MODE_5G 1 -+#define RG_XFI_TX_MODE GENMASK(2, 0) -+#define RG_XFI_TX_MODE_10G 0 -+#define RG_XFI_TX_MODE_5G 1 ++#define USXGMII_RATE_UPDATE_MODE BIT(31) ++#define USXGMII_MAC_CK_GATED BIT(29) ++#define USXGMII_IF_FORCE_EN BIT(28) ++#define USXGMII_RATE_ADAPT_MODE GENMASK(10, 8) ++#define USXGMII_RATE_ADAPT_MODE_X1 0 ++#define USXGMII_RATE_ADAPT_MODE_X2 1 ++#define USXGMII_RATE_ADAPT_MODE_X4 2 ++#define USXGMII_RATE_ADAPT_MODE_X10 3 ++#define USXGMII_RATE_ADAPT_MODE_X100 4 ++#define USXGMII_RATE_ADAPT_MODE_X5 5 ++#define USXGMII_RATE_ADAPT_MODE_X50 6 ++#define USXGMII_XFI_RX_MODE GENMASK(6, 4) ++#define USXGMII_XFI_RX_MODE_10G 0 ++#define USXGMII_XFI_RX_MODE_5G 1 ++#define USXGMII_XFI_TX_MODE GENMASK(2, 0) ++#define USXGMII_XFI_TX_MODE_10G 0 ++#define USXGMII_XFI_TX_MODE_5G 1 + +/* Register to control PCS AN */ +#define RG_PCS_AN_CTRL0 0x810 -+#define RG_AN_ENABLE BIT(0) ++#define USXGMII_AN_RESTART BIT(31) ++#define USXGMII_AN_SYNC_CNT GENMASK(30, 11) ++#define USXGMII_AN_ENABLE BIT(0) ++ ++#define RG_PCS_AN_CTRL2 0x818 ++#define USXGMII_LINK_TIMER_IDLE_DETECT GENMASK(29, 20) ++#define USXGMII_LINK_TIMER_COMP_ACK_DETECT GENMASK(19, 10) ++#define USXGMII_LINK_TIMER_AN_RESTART GENMASK(9, 0) ++ ++/* Register to read PCS AN status */ ++#define RG_PCS_AN_STS0 0x81c ++#define USXGMII_LPA_SPEED_MASK GENMASK(11, 9) ++#define USXGMII_LPA_SPEED_10 0 ++#define USXGMII_LPA_SPEED_100 1 ++#define USXGMII_LPA_SPEED_1000 2 ++#define USXGMII_LPA_SPEED_10000 3 ++#define USXGMII_LPA_SPEED_2500 4 ++#define USXGMII_LPA_SPEED_5000 5 ++#define USXGMII_LPA_DUPLEX BIT(12) ++#define USXGMII_LPA_LINK BIT(15) ++#define USXGMII_LPA_LATCH BIT(31) + +/* Register to control USXGMII XFI PLL digital */ +#define XFI_PLL_DIG_GLB8 0x08 @@ -791,6 +812,8 @@ Signed-off-by: Daniel Golle +#define SWSYSRST_XFI_PLL_GRST BIT(16) +#define SWSYSRST_XFI_PEXPT1_GRST BIT(15) +#define SWSYSRST_XFI_PEXPT0_GRST BIT(14) ++#define SWSYSRST_XFI1_GRST BIT(13) ++#define SWSYSRST_XFI0_GRST BIT(12) +#define SWSYSRST_SGMII1_GRST BIT(2) +#define SWSYSRST_SGMII0_GRST BIT(1) +#define TOPRGU_SWSYSRST_EN 0xFC @@ -813,7 +836,7 @@ Signed-off-by: Daniel Golle /* MT7628/88 specific stuff */ #define MT7628_PDMA_OFFSET 0x0800 #define MT7628_SDM_OFFSET 0x0c00 -@@ -809,13 +904,6 @@ enum mtk_gmac_id { +@@ -809,13 +926,6 @@ enum mtk_gmac_id { MTK_GMAC_ID_MAX }; @@ -827,7 +850,7 @@ Signed-off-by: Daniel Golle enum mtk_tx_buf_type { MTK_TYPE_SKB, MTK_TYPE_XDP_TX, -@@ -902,6 +990,7 @@ enum mkt_eth_capabilities { +@@ -902,6 +1012,7 @@ enum mkt_eth_capabilities { MTK_TRGMII_BIT, MTK_SGMII_BIT, MTK_USXGMII_BIT, @@ -835,7 +858,7 @@ Signed-off-by: Daniel Golle MTK_ESW_BIT, MTK_GEPHY_BIT, MTK_MUX_BIT, -@@ -922,6 +1011,7 @@ enum mkt_eth_capabilities { +@@ -922,6 +1033,7 @@ enum mkt_eth_capabilities { MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT, MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT, MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT, @@ -843,7 +866,7 @@ Signed-off-by: Daniel Golle MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT, MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT, MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT, -@@ -933,6 +1023,7 @@ enum mkt_eth_capabilities { +@@ -933,6 +1045,7 @@ enum mkt_eth_capabilities { MTK_ETH_PATH_GMAC1_SGMII_BIT, MTK_ETH_PATH_GMAC2_RGMII_BIT, MTK_ETH_PATH_GMAC2_SGMII_BIT, @@ -851,7 +874,7 @@ Signed-off-by: Daniel Golle MTK_ETH_PATH_GMAC2_GEPHY_BIT, MTK_ETH_PATH_GMAC3_SGMII_BIT, MTK_ETH_PATH_GDM1_ESW_BIT, -@@ -946,6 +1037,7 @@ enum mkt_eth_capabilities { +@@ -946,6 +1059,7 @@ enum mkt_eth_capabilities { #define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT) #define MTK_SGMII BIT_ULL(MTK_SGMII_BIT) #define MTK_USXGMII BIT_ULL(MTK_USXGMII_BIT) @@ -859,7 +882,7 @@ Signed-off-by: Daniel Golle #define MTK_ESW BIT_ULL(MTK_ESW_BIT) #define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT) #define MTK_MUX BIT_ULL(MTK_MUX_BIT) -@@ -968,6 +1060,8 @@ enum mkt_eth_capabilities { +@@ -968,6 +1082,8 @@ enum mkt_eth_capabilities { BIT_ULL(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT) #define MTK_ETH_MUX_U3_GMAC2_TO_QPHY \ BIT_ULL(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT) @@ -868,7 +891,7 @@ Signed-off-by: Daniel Golle #define MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII \ BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \ -@@ -983,6 +1077,7 @@ enum mkt_eth_capabilities { +@@ -983,6 +1099,7 @@ enum mkt_eth_capabilities { #define MTK_ETH_PATH_GMAC1_SGMII BIT_ULL(MTK_ETH_PATH_GMAC1_SGMII_BIT) #define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT) #define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT) @@ -876,7 +899,7 @@ Signed-off-by: Daniel Golle #define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT) #define MTK_ETH_PATH_GMAC3_SGMII BIT_ULL(MTK_ETH_PATH_GMAC3_SGMII_BIT) #define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT) -@@ -996,6 +1091,7 @@ enum mkt_eth_capabilities { +@@ -996,6 +1113,7 @@ enum mkt_eth_capabilities { #define MTK_GMAC2_RGMII (MTK_ETH_PATH_GMAC2_RGMII | MTK_RGMII) #define MTK_GMAC2_SGMII (MTK_ETH_PATH_GMAC2_SGMII | MTK_SGMII) #define MTK_GMAC2_GEPHY (MTK_ETH_PATH_GMAC2_GEPHY | MTK_GEPHY) @@ -884,7 +907,7 @@ Signed-off-by: Daniel Golle #define MTK_GMAC3_SGMII (MTK_ETH_PATH_GMAC3_SGMII | MTK_SGMII) #define MTK_GDM1_ESW (MTK_ETH_PATH_GDM1_ESW | MTK_ESW) #define MTK_GMAC1_USXGMII (MTK_ETH_PATH_GMAC1_USXGMII | MTK_USXGMII) -@@ -1019,6 +1115,10 @@ enum mkt_eth_capabilities { +@@ -1019,6 +1137,10 @@ enum mkt_eth_capabilities { (MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | MTK_MUX | \ MTK_SHARED_SGMII) @@ -895,7 +918,7 @@ Signed-off-by: Daniel Golle /* 0: GMACx -> GEPHY, 1: GMACx -> SGMII where x is 1 or 2 */ #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) -@@ -1077,7 +1177,8 @@ enum mkt_eth_capabilities { +@@ -1077,7 +1199,8 @@ enum mkt_eth_capabilities { MTK_MUX_GMAC123_TO_GEPHY_SGMII | \ MTK_NETSYS_V3 | MTK_RSTCTRL_PPE1 | \ MTK_GMAC1_USXGMII | MTK_GMAC2_USXGMII | \ @@ -905,37 +928,54 @@ Signed-off-by: Daniel Golle struct mtk_tx_dma_desc_info { dma_addr_t addr; -@@ -1183,6 +1284,19 @@ struct mtk_soc_data { +@@ -1183,6 +1306,22 @@ struct mtk_soc_data { #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) -+/* struct mtk_xgmii - This is the structure holding sgmii/usxgmii regmap and -+ * its characteristics -+ * @regmap: The register map pointing at the range used to setup -+ * SGMII/USXGMII modes -+ * @flags: The enum refers to which mode the sgmii wants to run on -+ * @ana_rgc3: The offset refers to register ANA_RGC3 related to regmap ++/* struct mtk_usxgmii_pcs - This structure holds each usxgmii regmap and ++ * associated data ++ * @regmap: The register map pointing at the range used to setup ++ * USXGMII modes ++ * @interface: Currently selected interface mode ++ * @id: The element is used to record the index of PCS ++ * @pcs: Phylink PCS structure + */ -+struct mtk_xgmii { -+ struct regmap **regmap_usxgmii; -+ struct regmap **regmap_pextp; -+ struct regmap *regmap_pll; ++struct mtk_usxgmii_pcs { ++ struct mtk_eth *eth; ++ struct regmap *regmap; ++ phy_interface_t interface; ++ u8 id; ++ struct phylink_pcs pcs; +}; + /* struct mtk_eth - This is the main datasructure for holding the state * of the driver * @dev: The device pointer -@@ -1244,7 +1358,9 @@ struct mtk_eth { +@@ -1203,6 +1342,11 @@ struct mtk_soc_data { + * @infra: The register map pointing at the range used to setup + * SGMII and GePHY path + * @sgmii_pcs: Pointers to mtk-pcs-lynxi phylink_pcs instances ++ * @usxgmii_pll: The register map pointing at the range used to control ++ * the USXGMII SerDes PLL ++ * @regmap_pextp: The register map pointing at the range used to setup ++ * PHYA ++ * @usxgmii_pcs: Pointer to array of pointers to struct for USXGMII PCS + * @pctl: The register map pointing at the range used to setup + * GMAC port drive/slew values + * @dma_refcnt: track how many netdevs are using the DMA engine +@@ -1244,7 +1388,11 @@ struct mtk_eth { unsigned long sysclk; struct regmap *ethsys; struct regmap *infra; + struct regmap *toprgu; struct phylink_pcs **sgmii_pcs; -+ struct mtk_xgmii *xgmii; ++ struct regmap *usxgmii_pll; ++ struct regmap **regmap_pextp; ++ struct mtk_usxgmii_pcs **usxgmii_pcs; struct regmap *pctl; bool hwlro; refcount_t dma_refcnt; -@@ -1400,6 +1516,19 @@ static inline u32 mtk_get_ib2_multicast_ +@@ -1400,6 +1548,19 @@ static inline u32 mtk_get_ib2_multicast_ return MTK_FOE_IB2_MULTICAST; } @@ -955,7 +995,7 @@ Signed-off-by: Daniel Golle /* read the hardware status register */ void mtk_stats_update_mac(struct mtk_mac *mac); -@@ -1407,8 +1536,10 @@ void mtk_w32(struct mtk_eth *eth, u32 va +@@ -1407,8 +1568,10 @@ void mtk_w32(struct mtk_eth *eth, u32 va u32 mtk_r32(struct mtk_eth *eth, unsigned reg); int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id); @@ -966,50 +1006,35 @@ Signed-off-by: Daniel Golle int mtk_eth_offload_init(struct mtk_eth *eth); int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type, -@@ -1418,5 +1549,36 @@ int mtk_flow_offload_cmd(struct mtk_eth +@@ -1418,5 +1581,20 @@ int mtk_flow_offload_cmd(struct mtk_eth void mtk_flow_offload_cleanup(struct mtk_eth *eth, struct list_head *list); void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev); +#ifdef CONFIG_NET_MEDIATEK_SOC_USXGMII ++struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int id); +int mtk_usxgmii_init(struct mtk_eth *eth); -+int mtk_xfi_pextp_init(struct mtk_eth *eth); -+int mtk_xfi_pll_init(struct mtk_eth *eth); -+int mtk_toprgu_init(struct mtk_eth *eth); +int mtk_xfi_pll_enable(struct mtk_eth *eth); -+int mtk_usxgmii_setup_mode_an(struct mtk_eth *eth, int mac_id, -+ int max_speed); -+int mtk_usxgmii_setup_mode_force(struct mtk_eth *eth, int mac_id, -+ const struct phylink_link_state *state); -+void mtk_usxgmii_setup_phya_an_10000(struct mtk_eth *eth, int mac_id); -+void mtk_usxgmii_reset(struct mtk_eth *eth, int mac_id); +void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id); +void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id); +void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id); +#else -+static inline int mtk_usxgmii_init(struct mtk_eth *eth) { return 0; }; -+static inline int mtk_xfi_pextp_init(struct mtk_eth *eth) { return 0; }; -+static inline int mtk_xfi_pll_init(struct mtk_eth *eth) { return 0; }; -+static inline int mtk_toprgu_init(struct mtk_eth *eth) { return 0; }; -+static inline int mtk_xfi_pll_enable(struct mtk_eth *eth) { return 0; }; -+static inline int mtk_usxgmii_setup_mode_an(struct mtk_eth *eth, int mac_id, -+ int max_speed) { return 0; }; -+static inline int mtk_usxgmii_setup_mode_force(struct mtk_eth *eth, int mac_id, -+ const struct phylink_link_state *state) { return 0; }; -+static inline void mtk_usxgmii_setup_phya_an_10000(struct mtk_eth *eth, int mac_id) { }; -+static inline void mtk_usxgmii_reset(struct mtk_eth *eth, int mac_id) { }; -+static inline void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) { }; -+static inline void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id) { }; -+static inline void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) { }; -+#endif ++static inline struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int id) { return NULL; } ++static inline int mtk_usxgmii_init(struct mtk_eth *eth) { return 0; } ++static inline int mtk_xfi_pll_enable(struct mtk_eth *eth) { return 0; } ++static inline void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) { } ++static inline void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id) { } ++static inline void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) { } ++#endif /* NET_MEDIATEK_SOC_USXGMII */ #endif /* MTK_ETH_H */ --- /dev/null +++ b/drivers/net/ethernet/mediatek/mtk_usxgmii.c -@@ -0,0 +1,646 @@ +@@ -0,0 +1,835 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Copyright (c) 2022 MediaTek Inc. + * Author: Henry Yen ++ * Daniel Golle + */ + +#include @@ -1017,43 +1042,20 @@ Signed-off-by: Daniel Golle +#include +#include "mtk_eth_soc.h" + -+int mtk_usxgmii_init(struct mtk_eth *eth) ++static struct mtk_usxgmii_pcs *pcs_to_mtk_usxgmii_pcs(struct phylink_pcs *pcs) +{ -+ struct device_node *r = eth->dev->of_node; -+ struct mtk_xgmii *xs = eth->xgmii; -+ struct device *dev = eth->dev; -+ struct device_node *np; -+ int i; -+ -+ xs->regmap_usxgmii = devm_kzalloc(dev, sizeof(*xs->regmap_usxgmii) * -+ eth->soc->num_devs, GFP_KERNEL); -+ if (!xs->regmap_usxgmii) -+ return -ENOMEM; -+ -+ for (i = 0; i < eth->soc->num_devs; i++) { -+ np = of_parse_phandle(r, "mediatek,usxgmiisys", i); -+ if (!np) -+ break; -+ -+ xs->regmap_usxgmii[i] = syscon_node_to_regmap(np); -+ if (IS_ERR(xs->regmap_usxgmii[i])) -+ return PTR_ERR(xs->regmap_usxgmii[i]); -+ } -+ -+ return 0; ++ return container_of(pcs, struct mtk_usxgmii_pcs, pcs); +} + -+int mtk_xfi_pextp_init(struct mtk_eth *eth) ++static int mtk_xfi_pextp_init(struct mtk_eth *eth) +{ + struct device *dev = eth->dev; + struct device_node *r = dev->of_node; -+ struct mtk_xgmii *xs = eth->xgmii; + struct device_node *np; + int i; + -+ xs->regmap_pextp = devm_kzalloc(dev, sizeof(*xs->regmap_pextp) * -+ eth->soc->num_devs, GFP_KERNEL); -+ if (!xs->regmap_pextp) ++ eth->regmap_pextp = devm_kcalloc(dev, eth->soc->num_devs, sizeof(eth->regmap_pextp), GFP_KERNEL); ++ if (!eth->regmap_pextp) + return -ENOMEM; + + for (i = 0; i < eth->soc->num_devs; i++) { @@ -1061,32 +1063,31 @@ Signed-off-by: Daniel Golle + if (!np) + break; + -+ xs->regmap_pextp[i] = syscon_node_to_regmap(np); -+ if (IS_ERR(xs->regmap_pextp[i])) -+ return PTR_ERR(xs->regmap_pextp[i]); ++ eth->regmap_pextp[i] = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->regmap_pextp[i])) ++ return PTR_ERR(eth->regmap_pextp[i]); + } + + return 0; +} + -+int mtk_xfi_pll_init(struct mtk_eth *eth) ++static int mtk_xfi_pll_init(struct mtk_eth *eth) +{ + struct device_node *r = eth->dev->of_node; -+ struct mtk_xgmii *xs = eth->xgmii; + struct device_node *np; + + np = of_parse_phandle(r, "mediatek,xfi_pll", 0); + if (!np) + return -1; + -+ xs->regmap_pll = syscon_node_to_regmap(np); -+ if (IS_ERR(xs->regmap_pll)) -+ return PTR_ERR(xs->regmap_pll); ++ eth->usxgmii_pll = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->usxgmii_pll)) ++ return PTR_ERR(eth->usxgmii_pll); + + return 0; +} + -+int mtk_toprgu_init(struct mtk_eth *eth) ++static int mtk_toprgu_init(struct mtk_eth *eth) +{ + struct device_node *r = eth->dev->of_node; + struct device_node *np; @@ -1104,18 +1105,17 @@ Signed-off-by: Daniel Golle + +int mtk_xfi_pll_enable(struct mtk_eth *eth) +{ -+ struct mtk_xgmii *xs = eth->xgmii; + u32 val = 0; + -+ if (!xs->regmap_pll) ++ if (!eth->usxgmii_pll) + return -EINVAL; + + /* Add software workaround for USXGMII PLL TCL issue */ -+ regmap_write(xs->regmap_pll, XFI_PLL_ANA_GLB8, RG_XFI_PLL_ANA_SWWA); ++ regmap_write(eth->usxgmii_pll, XFI_PLL_ANA_GLB8, RG_XFI_PLL_ANA_SWWA); + -+ regmap_read(xs->regmap_pll, XFI_PLL_DIG_GLB8, &val); ++ regmap_read(eth->usxgmii_pll, XFI_PLL_DIG_GLB8, &val); + val |= RG_XFI_PLL_EN; -+ regmap_write(xs->regmap_pll, XFI_PLL_DIG_GLB8, val); ++ regmap_write(eth->usxgmii_pll, XFI_PLL_DIG_GLB8, val); + + return 0; +} @@ -1141,531 +1141,727 @@ Signed-off-by: Daniel Golle + return xgmii_id; +} + -+void mtk_usxgmii_setup_phya_an_10000(struct mtk_eth *eth, int mac_id) ++static int mtk_xgmii2mac_id(struct mtk_eth *eth, int xgmii_id) +{ -+ struct mtk_xgmii *xs = eth->xgmii; -+ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ int mac_id = xgmii_id; ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ switch (xgmii_id) { ++ case 0: ++ mac_id = 2; ++ break; ++ case 1: ++ mac_id = 1; ++ break; ++ default: ++ mac_id = -1; ++ } ++ } ++ ++ return mac_id; ++} ++ + -+ if (id >= eth->soc->num_devs || -+ !xs->regmap_usxgmii[id] || !xs->regmap_pextp[id]) ++static void mtk_usxgmii_setup_phya_usxgmii(struct mtk_usxgmii_pcs *mpcs) ++{ ++ struct regmap *pextp; ++ ++ if (!mpcs->eth) + return; + -+ regmap_write(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, 0x000FFE6D); -+ regmap_write(xs->regmap_usxgmii[id], 0x818, 0x07B1EC7B); -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, 0x30000000); -+ ndelay(1020); -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, 0x10000000); -+ ndelay(1020); -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, 0x00000000); -+ -+ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00C9071C); -+ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); -+ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); -+ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); -+ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); -+ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014AA); -+ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); -+ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); -+ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); -+ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); -+ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); -+ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); -+ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000AAF); -+ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080D0D); -+ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030909); -+ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); -+ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); -+ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); -+ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); -+ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); -+ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x01423342); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F20); -+ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ pextp = mpcs->eth->regmap_pextp[mpcs->id]; ++ if (!pextp) ++ return; ++ ++ /* Setup operation mode */ ++ regmap_write(pextp, 0x9024, 0x00C9071C); ++ regmap_write(pextp, 0x2020, 0xAA8585AA); ++ regmap_write(pextp, 0x2030, 0x0C020707); ++ regmap_write(pextp, 0x2034, 0x0E050F0F); ++ regmap_write(pextp, 0x2040, 0x00140032); ++ regmap_write(pextp, 0x50F0, 0x00C014AA); ++ regmap_write(pextp, 0x50E0, 0x3777C12B); ++ regmap_write(pextp, 0x506C, 0x005F9CFF); ++ regmap_write(pextp, 0x5070, 0x9D9DFAFA); ++ regmap_write(pextp, 0x5074, 0x27273F3F); ++ regmap_write(pextp, 0x5078, 0xA7883C68); ++ regmap_write(pextp, 0x507C, 0x11661166); ++ regmap_write(pextp, 0x5080, 0x0E000AAF); ++ regmap_write(pextp, 0x5084, 0x08080D0D); ++ regmap_write(pextp, 0x5088, 0x02030909); ++ regmap_write(pextp, 0x50E4, 0x0C0C0000); ++ regmap_write(pextp, 0x50E8, 0x04040000); ++ regmap_write(pextp, 0x50EC, 0x0F0F0C06); ++ regmap_write(pextp, 0x50A8, 0x506E8C8C); ++ regmap_write(pextp, 0x6004, 0x18190000); ++ regmap_write(pextp, 0x00F8, 0x01423342); ++ /* Force SGDT_OUT off and select PCS */ ++ regmap_write(pextp, 0x00F4, 0x80201F20); ++ /* Force GLB_CKDET_OUT */ ++ regmap_write(pextp, 0x0030, 0x00050C00); ++ /* Force AEQ on */ ++ regmap_write(pextp, 0x0070, 0x02002800); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); -+ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); -+ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); -+ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); -+ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00022220); -+ regmap_write(xs->regmap_pextp[id], 0x5064, 0x0F020A01); -+ regmap_write(xs->regmap_pextp[id], 0x50B4, 0x06100600); -+ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); -+ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); -+ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); -+ regmap_write(xs->regmap_pextp[id], 0x306C, 0x00000F00); -+ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00040000); -+ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000001); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ /* Setup DA default value */ ++ regmap_write(pextp, 0x30B0, 0x00000020); ++ regmap_write(pextp, 0x3028, 0x00008A01); ++ regmap_write(pextp, 0x302C, 0x0000A884); ++ regmap_write(pextp, 0x3024, 0x00083002); ++ regmap_write(pextp, 0x3010, 0x00022220); ++ regmap_write(pextp, 0x5064, 0x0F020A01); ++ regmap_write(pextp, 0x50B4, 0x06100600); ++ regmap_write(pextp, 0x3048, 0x40704000); ++ regmap_write(pextp, 0x3050, 0xA8000000); ++ regmap_write(pextp, 0x3054, 0x000000AA); ++ regmap_write(pextp, 0x306C, 0x00000F00); ++ regmap_write(pextp, 0xA060, 0x00040000); ++ regmap_write(pextp, 0x90D0, 0x00000001); ++ /* Release reset */ ++ regmap_write(pextp, 0x0070, 0x0200E800); + udelay(150); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ /* Switch to P0 */ ++ regmap_write(pextp, 0x0070, 0x0200C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ regmap_write(pextp, 0x0070, 0x0200C101); + udelay(15); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C111); ++ /* Switch to Gen3 */ ++ regmap_write(pextp, 0x0070, 0x0202C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C101); ++ regmap_write(pextp, 0x0070, 0x0202C101); + udelay(100); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F00); -+ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ regmap_write(pextp, 0x30B0, 0x00000030); ++ regmap_write(pextp, 0x00F4, 0x80201F00); ++ regmap_write(pextp, 0x3040, 0x30000000); + udelay(400); +} + -+void mtk_usxgmii_setup_phya_force_5000(struct mtk_eth *eth, int mac_id) ++static void mtk_usxgmii_setup_phya_5gbaser(struct mtk_usxgmii_pcs *mpcs) +{ -+ unsigned int val; -+ struct mtk_xgmii *xs = eth->xgmii; -+ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ struct regmap *pextp; + -+ if (id >= eth->soc->num_devs || -+ !xs->regmap_usxgmii[id] || !xs->regmap_pextp[id]) ++ if (!mpcs->eth) + return; + -+ /* Setup USXGMII speed */ -+ val = FIELD_PREP(RG_XFI_RX_MODE, RG_XFI_RX_MODE_5G) | -+ FIELD_PREP(RG_XFI_TX_MODE, RG_XFI_TX_MODE_5G); -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ /* Disable USXGMII AN mode */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, &val); -+ val &= ~RG_AN_ENABLE; -+ regmap_write(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, val); -+ -+ /* Gated USXGMII */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); -+ val |= RG_MAC_CK_GATED; -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ ndelay(1020); -+ -+ /* USXGMII force mode setting */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); -+ val |= RG_USXGMII_RATE_UPDATE_MODE; -+ val |= RG_IF_FORCE_EN; -+ val |= FIELD_PREP(RG_RATE_ADAPT_MODE, RG_RATE_ADAPT_MODE_X1); -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ /* Un-gated USXGMII */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); -+ val &= ~RG_MAC_CK_GATED; -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ ndelay(1020); ++ pextp = mpcs->eth->regmap_pextp[mpcs->id]; ++ if (!pextp) ++ return; + -+ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00D9071C); -+ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAAA5A5AA); -+ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); -+ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); -+ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); -+ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C018AA); -+ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777812B); -+ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005C9CFF); -+ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9DFAFAFA); -+ regmap_write(xs->regmap_pextp[id], 0x5074, 0x273F3F3F); -+ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA8883868); -+ regmap_write(xs->regmap_pextp[id], 0x507C, 0x14661466); -+ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E001ABF); -+ regmap_write(xs->regmap_pextp[id], 0x5084, 0x080B0D0D); -+ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02050909); -+ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C000000); -+ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04000000); -+ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); -+ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x50808C8C); -+ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18000000); -+ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x00A132A1); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F20); -+ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ /* Setup operation mode */ ++ regmap_write(pextp, 0x9024, 0x00D9071C); ++ regmap_write(pextp, 0x2020, 0xAAA5A5AA); ++ regmap_write(pextp, 0x2030, 0x0C020707); ++ regmap_write(pextp, 0x2034, 0x0E050F0F); ++ regmap_write(pextp, 0x2040, 0x00140032); ++ regmap_write(pextp, 0x50F0, 0x00C018AA); ++ regmap_write(pextp, 0x50E0, 0x3777812B); ++ regmap_write(pextp, 0x506C, 0x005C9CFF); ++ regmap_write(pextp, 0x5070, 0x9DFAFAFA); ++ regmap_write(pextp, 0x5074, 0x273F3F3F); ++ regmap_write(pextp, 0x5078, 0xA8883868); ++ regmap_write(pextp, 0x507C, 0x14661466); ++ regmap_write(pextp, 0x5080, 0x0E001ABF); ++ regmap_write(pextp, 0x5084, 0x080B0D0D); ++ regmap_write(pextp, 0x5088, 0x02050909); ++ regmap_write(pextp, 0x50E4, 0x0C000000); ++ regmap_write(pextp, 0x50E8, 0x04000000); ++ regmap_write(pextp, 0x50EC, 0x0F0F0C06); ++ regmap_write(pextp, 0x50A8, 0x50808C8C); ++ regmap_write(pextp, 0x6004, 0x18000000); ++ regmap_write(pextp, 0x00F8, 0x00A132A1); ++ /* Force SGDT_OUT off and select PCS */ ++ regmap_write(pextp, 0x00F4, 0x80201F20); ++ /* Force GLB_CKDET_OUT */ ++ regmap_write(pextp, 0x0030, 0x00050C00); ++ /* Force AEQ on */ ++ regmap_write(pextp, 0x0070, 0x02002800); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); -+ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); -+ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); -+ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); -+ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00022220); -+ regmap_write(xs->regmap_pextp[id], 0x5064, 0x0F020A01); -+ regmap_write(xs->regmap_pextp[id], 0x50B4, 0x06100600); -+ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); -+ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); -+ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); -+ regmap_write(xs->regmap_pextp[id], 0x306C, 0x00000F00); -+ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00040000); -+ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000003); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ /* Setup DA default value */ ++ regmap_write(pextp, 0x30B0, 0x00000020); ++ regmap_write(pextp, 0x3028, 0x00008A01); ++ regmap_write(pextp, 0x302C, 0x0000A884); ++ regmap_write(pextp, 0x3024, 0x00083002); ++ regmap_write(pextp, 0x3010, 0x00022220); ++ regmap_write(pextp, 0x5064, 0x0F020A01); ++ regmap_write(pextp, 0x50B4, 0x06100600); ++ regmap_write(pextp, 0x3048, 0x40704000); ++ regmap_write(pextp, 0x3050, 0xA8000000); ++ regmap_write(pextp, 0x3054, 0x000000AA); ++ regmap_write(pextp, 0x306C, 0x00000F00); ++ regmap_write(pextp, 0xA060, 0x00040000); ++ regmap_write(pextp, 0x90D0, 0x00000003); ++ /* Release reset */ ++ regmap_write(pextp, 0x0070, 0x0200E800); + udelay(150); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ /* Switch to P0 */ ++ regmap_write(pextp, 0x0070, 0x0200C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ regmap_write(pextp, 0x0070, 0x0200C101); + udelay(15); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C111); ++ /* Switch to Gen3 */ ++ regmap_write(pextp, 0x0070, 0x0202C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C101); ++ regmap_write(pextp, 0x0070, 0x0202C101); + udelay(100); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F00); -+ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ regmap_write(pextp, 0x30B0, 0x00000030); ++ regmap_write(pextp, 0x00F4, 0x80201F00); ++ regmap_write(pextp, 0x3040, 0x30000000); + udelay(400); +} + -+void mtk_usxgmii_setup_phya_force_10000(struct mtk_eth *eth, int mac_id) ++static void mtk_usxgmii_setup_phya_10gbaser(struct mtk_usxgmii_pcs *mpcs) +{ -+ struct mtk_xgmii *xs = eth->xgmii; -+ unsigned int val; -+ u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ struct regmap *pextp; + -+ if (id >= eth->soc->num_devs || -+ !xs->regmap_usxgmii[id] || !xs->regmap_pextp[id]) ++ if (!mpcs->eth) + return; + -+ /* Setup USXGMII speed */ -+ val = FIELD_PREP(RG_XFI_RX_MODE, RG_XFI_RX_MODE_10G) | -+ FIELD_PREP(RG_XFI_TX_MODE, RG_XFI_TX_MODE_10G); -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ /* Disable USXGMII AN mode */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, &val); -+ val &= ~RG_AN_ENABLE; -+ regmap_write(xs->regmap_usxgmii[id], RG_PCS_AN_CTRL0, val); -+ -+ /* Gated USXGMII */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); -+ val |= RG_MAC_CK_GATED; -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ ndelay(1020); -+ -+ /* USXGMII force mode setting */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); -+ val |= RG_USXGMII_RATE_UPDATE_MODE; -+ val |= RG_IF_FORCE_EN; -+ val |= FIELD_PREP(RG_RATE_ADAPT_MODE, RG_RATE_ADAPT_MODE_X1); -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ /* Un-gated USXGMII */ -+ regmap_read(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, &val); -+ val &= ~RG_MAC_CK_GATED; -+ regmap_write(xs->regmap_usxgmii[id], RG_PHY_TOP_SPEED_CTRL1, val); -+ -+ ndelay(1020); ++ pextp = mpcs->eth->regmap_pextp[mpcs->id]; ++ if (!pextp) ++ return; + -+ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00C9071C); -+ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); -+ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); -+ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); -+ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); -+ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014AA); -+ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); -+ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); -+ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); -+ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); -+ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); -+ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); -+ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000AAF); -+ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080D0D); -+ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030909); -+ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); -+ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); -+ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); -+ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); -+ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); -+ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x01423342); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F20); -+ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ /* Setup operation mode */ ++ regmap_write(pextp, 0x9024, 0x00C9071C); ++ regmap_write(pextp, 0x2020, 0xAA8585AA); ++ regmap_write(pextp, 0x2030, 0x0C020707); ++ regmap_write(pextp, 0x2034, 0x0E050F0F); ++ regmap_write(pextp, 0x2040, 0x00140032); ++ regmap_write(pextp, 0x50F0, 0x00C014AA); ++ regmap_write(pextp, 0x50E0, 0x3777C12B); ++ regmap_write(pextp, 0x506C, 0x005F9CFF); ++ regmap_write(pextp, 0x5070, 0x9D9DFAFA); ++ regmap_write(pextp, 0x5074, 0x27273F3F); ++ regmap_write(pextp, 0x5078, 0xA7883C68); ++ regmap_write(pextp, 0x507C, 0x11661166); ++ regmap_write(pextp, 0x5080, 0x0E000AAF); ++ regmap_write(pextp, 0x5084, 0x08080D0D); ++ regmap_write(pextp, 0x5088, 0x02030909); ++ regmap_write(pextp, 0x50E4, 0x0C0C0000); ++ regmap_write(pextp, 0x50E8, 0x04040000); ++ regmap_write(pextp, 0x50EC, 0x0F0F0C06); ++ regmap_write(pextp, 0x50A8, 0x506E8C8C); ++ regmap_write(pextp, 0x6004, 0x18190000); ++ regmap_write(pextp, 0x00F8, 0x01423342); ++ /* Force SGDT_OUT off and select PCS */ ++ regmap_write(pextp, 0x00F4, 0x80201F20); ++ /* Force GLB_CKDET_OUT */ ++ regmap_write(pextp, 0x0030, 0x00050C00); ++ /* Force AEQ on */ ++ regmap_write(pextp, 0x0070, 0x02002800); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); -+ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); -+ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); -+ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); -+ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00022220); -+ regmap_write(xs->regmap_pextp[id], 0x5064, 0x0F020A01); -+ regmap_write(xs->regmap_pextp[id], 0x50B4, 0x06100600); -+ regmap_write(xs->regmap_pextp[id], 0x3048, 0x49664100); -+ regmap_write(xs->regmap_pextp[id], 0x3050, 0x00000000); -+ regmap_write(xs->regmap_pextp[id], 0x3054, 0x00000000); -+ regmap_write(xs->regmap_pextp[id], 0x306C, 0x00000F00); -+ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00040000); -+ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000001); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ /* Setup DA default value */ ++ regmap_write(pextp, 0x30B0, 0x00000020); ++ regmap_write(pextp, 0x3028, 0x00008A01); ++ regmap_write(pextp, 0x302C, 0x0000A884); ++ regmap_write(pextp, 0x3024, 0x00083002); ++ regmap_write(pextp, 0x3010, 0x00022220); ++ regmap_write(pextp, 0x5064, 0x0F020A01); ++ regmap_write(pextp, 0x50B4, 0x06100600); ++ regmap_write(pextp, 0x3048, 0x47684100); ++ regmap_write(pextp, 0x3050, 0x00000000); ++ regmap_write(pextp, 0x3054, 0x00000000); ++ regmap_write(pextp, 0x306C, 0x00000F00); ++ if (mpcs->id == 0) ++ regmap_write(pextp, 0xA008, 0x0007B400); ++ ++ regmap_write(pextp, 0xA060, 0x00040000); ++ regmap_write(pextp, 0x90D0, 0x00000001); ++ /* Release reset */ ++ regmap_write(pextp, 0x0070, 0x0200E800); + udelay(150); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ /* Switch to P0 */ ++ regmap_write(pextp, 0x0070, 0x0200C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ regmap_write(pextp, 0x0070, 0x0200C101); + udelay(15); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C111); ++ /* Switch to Gen3 */ ++ regmap_write(pextp, 0x0070, 0x0202C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0202C101); ++ regmap_write(pextp, 0x0070, 0x0202C101); + udelay(100); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F00); -+ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ regmap_write(pextp, 0x30B0, 0x00000030); ++ regmap_write(pextp, 0x00F4, 0x80201F00); ++ regmap_write(pextp, 0x3040, 0x30000000); + udelay(400); +} + -+void mtk_usxgmii_reset(struct mtk_eth *eth, int mac_id) ++void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) +{ + u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ struct regmap *pextp; + -+ if (id >= eth->soc->num_devs || !eth->toprgu) ++ if (id >= eth->soc->num_devs) + return; + -+ switch (mac_id) { -+ case MTK_GMAC2_ID: -+ regmap_write(eth->toprgu, 0xFC, 0x0000A004); -+ regmap_write(eth->toprgu, 0x18, 0x88F0A004); -+ regmap_write(eth->toprgu, 0xFC, 0x00000000); -+ regmap_write(eth->toprgu, 0x18, 0x88F00000); -+ regmap_write(eth->toprgu, 0x18, 0x00F00000); -+ break; -+ case MTK_GMAC3_ID: -+ regmap_write(eth->toprgu, 0xFC, 0x00005002); -+ regmap_write(eth->toprgu, 0x18, 0x88F05002); -+ regmap_write(eth->toprgu, 0xFC, 0x00000000); -+ regmap_write(eth->toprgu, 0x18, 0x88F00000); -+ regmap_write(eth->toprgu, 0x18, 0x00F00000); -+ break; -+ } -+ -+ mdelay(10); -+} -+ -+int mtk_usxgmii_setup_mode_an(struct mtk_eth *eth, int mac_id, int max_speed) -+{ -+ if (mac_id < 0 || mac_id >= eth->soc->num_devs) -+ return -EINVAL; -+ -+ if ((max_speed != SPEED_10000) && (max_speed != SPEED_5000)) -+ return -EINVAL; -+ -+ mtk_xfi_pll_enable(eth); -+ mtk_usxgmii_reset(eth, mac_id); -+ mtk_usxgmii_setup_phya_an_10000(eth, mac_id); -+ -+ return 0; -+} -+ -+int mtk_usxgmii_setup_mode_force(struct mtk_eth *eth, int mac_id, -+ const struct phylink_link_state *state) -+{ -+ if (mac_id < 0 || mac_id >= eth->soc->num_devs) -+ return -EINVAL; -+ -+ mtk_xfi_pll_enable(eth); -+ mtk_usxgmii_reset(eth, mac_id); -+ if (state->interface == PHY_INTERFACE_MODE_5GBASER) -+ mtk_usxgmii_setup_phya_force_5000(eth, mac_id); -+ else -+ mtk_usxgmii_setup_phya_force_10000(eth, mac_id); -+ -+ return 0; -+} -+ -+void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) -+{ -+ u32 id = mtk_mac2xgmii_id(eth, mac_id); -+ struct mtk_xgmii *xs = eth->xgmii; -+ -+ if (id >= eth->soc->num_devs || !xs->regmap_pextp[id]) ++ pextp = eth->regmap_pextp[id]; ++ if (!pextp) + return; + -+ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00D9071C); -+ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); -+ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020207); -+ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E05050F); -+ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00200032); -+ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014BA); -+ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); -+ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); -+ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); -+ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); -+ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); -+ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); -+ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000EAF); -+ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080E0D); -+ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030B09); -+ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); -+ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); -+ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0606); -+ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); -+ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); -+ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x00FA32FA); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F21); -+ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ /* Setup operation mode */ ++ regmap_write(pextp, 0x9024, 0x00D9071C); ++ regmap_write(pextp, 0x2020, 0xAA8585AA); ++ regmap_write(pextp, 0x2030, 0x0C020207); ++ regmap_write(pextp, 0x2034, 0x0E05050F); ++ regmap_write(pextp, 0x2040, 0x00200032); ++ regmap_write(pextp, 0x50F0, 0x00C014BA); ++ regmap_write(pextp, 0x50E0, 0x3777C12B); ++ regmap_write(pextp, 0x506C, 0x005F9CFF); ++ regmap_write(pextp, 0x5070, 0x9D9DFAFA); ++ regmap_write(pextp, 0x5074, 0x27273F3F); ++ regmap_write(pextp, 0x5078, 0xA7883C68); ++ regmap_write(pextp, 0x507C, 0x11661166); ++ regmap_write(pextp, 0x5080, 0x0E000EAF); ++ regmap_write(pextp, 0x5084, 0x08080E0D); ++ regmap_write(pextp, 0x5088, 0x02030B09); ++ regmap_write(pextp, 0x50E4, 0x0C0C0000); ++ regmap_write(pextp, 0x50E8, 0x04040000); ++ regmap_write(pextp, 0x50EC, 0x0F0F0606); ++ regmap_write(pextp, 0x50A8, 0x506E8C8C); ++ regmap_write(pextp, 0x6004, 0x18190000); ++ regmap_write(pextp, 0x00F8, 0x00FA32FA); ++ /* Force SGDT_OUT off and select PCS */ ++ regmap_write(pextp, 0x00F4, 0x80201F21); ++ /* Force GLB_CKDET_OUT */ ++ regmap_write(pextp, 0x0030, 0x00050C00); ++ /* Force AEQ on */ ++ regmap_write(pextp, 0x0070, 0x02002800); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); -+ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); -+ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); -+ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); -+ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00011110); -+ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); -+ regmap_write(xs->regmap_pextp[id], 0x3064, 0x0000C000); -+ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); -+ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); -+ regmap_write(xs->regmap_pextp[id], 0x306C, 0x20200F00); -+ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00050000); -+ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000007); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ /* Setup DA default value */ ++ regmap_write(pextp, 0x30B0, 0x00000020); ++ regmap_write(pextp, 0x3028, 0x00008A01); ++ regmap_write(pextp, 0x302C, 0x0000A884); ++ regmap_write(pextp, 0x3024, 0x00083002); ++ regmap_write(pextp, 0x3010, 0x00011110); ++ regmap_write(pextp, 0x3048, 0x40704000); ++ regmap_write(pextp, 0x3064, 0x0000C000); ++ regmap_write(pextp, 0x3050, 0xA8000000); ++ regmap_write(pextp, 0x3054, 0x000000AA); ++ regmap_write(pextp, 0x306C, 0x20200F00); ++ regmap_write(pextp, 0xA060, 0x00050000); ++ regmap_write(pextp, 0x90D0, 0x00000007); ++ /* Release reset */ ++ regmap_write(pextp, 0x0070, 0x0200E800); + udelay(150); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ /* Switch to P0 */ ++ regmap_write(pextp, 0x0070, 0x0200C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ regmap_write(pextp, 0x0070, 0x0200C101); + udelay(15); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C111); ++ /* Switch to Gen2 */ ++ regmap_write(pextp, 0x0070, 0x0201C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C101); ++ regmap_write(pextp, 0x0070, 0x0201C101); + udelay(100); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F01); -+ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ regmap_write(pextp, 0x30B0, 0x00000030); ++ regmap_write(pextp, 0x00F4, 0x80201F01); ++ regmap_write(pextp, 0x3040, 0x30000000); + udelay(400); +} + +void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id) +{ -+ struct mtk_xgmii *xs = eth->xgmii; + u32 id = mtk_mac2xgmii_id(eth, mac_id); ++ struct regmap *pextp; ++ ++ if (id >= eth->soc->num_devs) ++ return; + -+ if (id >= eth->soc->num_devs || !xs->regmap_pextp[id]) ++ pextp = eth->regmap_pextp[id]; ++ if (!pextp) + return; + -+ regmap_write(xs->regmap_pextp[id], 0x9024, 0x00D9071C); -+ regmap_write(xs->regmap_pextp[id], 0x2020, 0xAA8585AA); -+ regmap_write(xs->regmap_pextp[id], 0x2030, 0x0C020707); -+ regmap_write(xs->regmap_pextp[id], 0x2034, 0x0E050F0F); -+ regmap_write(xs->regmap_pextp[id], 0x2040, 0x00140032); -+ regmap_write(xs->regmap_pextp[id], 0x50F0, 0x00C014AA); -+ regmap_write(xs->regmap_pextp[id], 0x50E0, 0x3777C12B); -+ regmap_write(xs->regmap_pextp[id], 0x506C, 0x005F9CFF); -+ regmap_write(xs->regmap_pextp[id], 0x5070, 0x9D9DFAFA); -+ regmap_write(xs->regmap_pextp[id], 0x5074, 0x27273F3F); -+ regmap_write(xs->regmap_pextp[id], 0x5078, 0xA7883C68); -+ regmap_write(xs->regmap_pextp[id], 0x507C, 0x11661166); -+ regmap_write(xs->regmap_pextp[id], 0x5080, 0x0E000AAF); -+ regmap_write(xs->regmap_pextp[id], 0x5084, 0x08080D0D); -+ regmap_write(xs->regmap_pextp[id], 0x5088, 0x02030909); -+ regmap_write(xs->regmap_pextp[id], 0x50E4, 0x0C0C0000); -+ regmap_write(xs->regmap_pextp[id], 0x50E8, 0x04040000); -+ regmap_write(xs->regmap_pextp[id], 0x50EC, 0x0F0F0C06); -+ regmap_write(xs->regmap_pextp[id], 0x50A8, 0x506E8C8C); -+ regmap_write(xs->regmap_pextp[id], 0x6004, 0x18190000); -+ regmap_write(xs->regmap_pextp[id], 0x00F8, 0x009C329C); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F21); -+ regmap_write(xs->regmap_pextp[id], 0x0030, 0x00050C00); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x02002800); ++ /* Setup operation mode */ ++ regmap_write(pextp, 0x9024, 0x00D9071C); ++ regmap_write(pextp, 0x2020, 0xAA8585AA); ++ regmap_write(pextp, 0x2030, 0x0C020707); ++ regmap_write(pextp, 0x2034, 0x0E050F0F); ++ regmap_write(pextp, 0x2040, 0x00140032); ++ regmap_write(pextp, 0x50F0, 0x00C014AA); ++ regmap_write(pextp, 0x50E0, 0x3777C12B); ++ regmap_write(pextp, 0x506C, 0x005F9CFF); ++ regmap_write(pextp, 0x5070, 0x9D9DFAFA); ++ regmap_write(pextp, 0x5074, 0x27273F3F); ++ regmap_write(pextp, 0x5078, 0xA7883C68); ++ regmap_write(pextp, 0x507C, 0x11661166); ++ regmap_write(pextp, 0x5080, 0x0E000AAF); ++ regmap_write(pextp, 0x5084, 0x08080D0D); ++ regmap_write(pextp, 0x5088, 0x02030909); ++ regmap_write(pextp, 0x50E4, 0x0C0C0000); ++ regmap_write(pextp, 0x50E8, 0x04040000); ++ regmap_write(pextp, 0x50EC, 0x0F0F0C06); ++ regmap_write(pextp, 0x50A8, 0x506E8C8C); ++ regmap_write(pextp, 0x6004, 0x18190000); ++ regmap_write(pextp, 0x00F8, 0x009C329C); ++ /* Force SGDT_OUT off and select PCS */ ++ regmap_write(pextp, 0x00F4, 0x80201F21); ++ /* Force GLB_CKDET_OUT */ ++ regmap_write(pextp, 0x0030, 0x00050C00); ++ /* Force AEQ on */ ++ regmap_write(pextp, 0x0070, 0x02002800); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000020); -+ regmap_write(xs->regmap_pextp[id], 0x3028, 0x00008A01); -+ regmap_write(xs->regmap_pextp[id], 0x302C, 0x0000A884); -+ regmap_write(xs->regmap_pextp[id], 0x3024, 0x00083002); -+ regmap_write(xs->regmap_pextp[id], 0x3010, 0x00011110); -+ regmap_write(xs->regmap_pextp[id], 0x3048, 0x40704000); -+ regmap_write(xs->regmap_pextp[id], 0x3050, 0xA8000000); -+ regmap_write(xs->regmap_pextp[id], 0x3054, 0x000000AA); -+ regmap_write(xs->regmap_pextp[id], 0x306C, 0x22000F00); -+ regmap_write(xs->regmap_pextp[id], 0xA060, 0x00050000); -+ regmap_write(xs->regmap_pextp[id], 0x90D0, 0x00000005); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200E800); ++ /* Setup DA default value */ ++ regmap_write(pextp, 0x30B0, 0x00000020); ++ regmap_write(pextp, 0x3028, 0x00008A01); ++ regmap_write(pextp, 0x302C, 0x0000A884); ++ regmap_write(pextp, 0x3024, 0x00083002); ++ regmap_write(pextp, 0x3010, 0x00011110); ++ regmap_write(pextp, 0x3048, 0x40704000); ++ regmap_write(pextp, 0x3050, 0xA8000000); ++ regmap_write(pextp, 0x3054, 0x000000AA); ++ regmap_write(pextp, 0x306C, 0x22000F00); ++ regmap_write(pextp, 0xA060, 0x00050000); ++ regmap_write(pextp, 0x90D0, 0x00000005); ++ /* Release reset */ ++ regmap_write(pextp, 0x0070, 0x0200E800); + udelay(150); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C111); ++ /* Switch to P0 */ ++ regmap_write(pextp, 0x0070, 0x0200C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0200C101); ++ regmap_write(pextp, 0x0070, 0x0200C101); + udelay(15); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C111); ++ /* Switch to Gen2 */ ++ regmap_write(pextp, 0x0070, 0x0201C111); + ndelay(1020); -+ regmap_write(xs->regmap_pextp[id], 0x0070, 0x0201C101); ++ regmap_write(pextp, 0x0070, 0x0201C101); + udelay(100); -+ regmap_write(xs->regmap_pextp[id], 0x30B0, 0x00000030); -+ regmap_write(xs->regmap_pextp[id], 0x00F4, 0x80201F01); -+ regmap_write(xs->regmap_pextp[id], 0x3040, 0x30000000); ++ regmap_write(pextp, 0x30B0, 0x00000030); ++ regmap_write(pextp, 0x00F4, 0x80201F01); ++ regmap_write(pextp, 0x3040, 0x30000000); + udelay(400); +} + -+void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) ++static void mtk_usxgmii_reset(struct mtk_eth *eth, int id) +{ -+ u32 id = mtk_mac2xgmii_id(eth, mac_id); + u32 val = 0; + + if (id >= eth->soc->num_devs || !eth->toprgu) + return; + -+ switch (mac_id) { -+ case MTK_GMAC2_ID: ++ switch (id) { ++ case 0: + /* Enable software reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val |= SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_SGMII1_GRST; ++ val |= SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_XFI0_GRST; + regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); + -+ /* Assert SGMII reset */ ++ /* Assert USXGMII reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); + val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88) | -+ SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_SGMII1_GRST; ++ SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_XFI0_GRST; + regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); + + udelay(100); + -+ /* De-assert SGMII reset */ ++ /* De-assert USXGMII reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); + val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88); -+ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_SGMII1_GRST); ++ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_XFI0_GRST); + regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); + + /* Disable software reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_SGMII1_GRST); ++ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | ++ SWSYSRST_XFI0_GRST); + regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); + break; -+ case MTK_GMAC3_ID: -+ /* Enable Software reset */ ++ case 1: ++ /* Enable software reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val |= SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_SGMII0_GRST; ++ val |= SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_XFI1_GRST; + regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); + -+ /* Assert SGMII reset */ ++ /* Assert USXGMII reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); + val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88) | -+ SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_SGMII0_GRST; ++ SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_XFI1_GRST; + regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); + + udelay(100); + -+ /* De-assert SGMII reset */ ++ /* De-assert USXGMII reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); + val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88); -+ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_SGMII0_GRST); ++ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_XFI1_GRST); + regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); + + /* Disable software reset */ + regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_SGMII0_GRST); ++ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | ++ SWSYSRST_XFI1_GRST); + regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); + break; + } + -+ mdelay(1); ++ mdelay(10); ++} ++ ++void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) ++{ ++ u32 xgmii_id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ mtk_usxgmii_reset(eth, xgmii_id); ++} ++ ++ ++static int mtk_usxgmii_pcs_config(struct phylink_pcs *pcs, unsigned int mode, ++ phy_interface_t interface, ++ const unsigned long *advertising, ++ bool permit_pause_to_mac) ++{ ++ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); ++ struct mtk_eth *eth = mpcs->eth; ++ unsigned int an_ctrl = 0, link_timer = 0, xfi_mode = 0, adapt_mode = 0; ++ bool mode_changed = false; ++ ++ if (interface == PHY_INTERFACE_MODE_USXGMII) { ++ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0x1FF) | ++ USXGMII_AN_ENABLE; ++ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x7B); ++ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_10G) | ++ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_10G); ++ } else if (interface == PHY_INTERFACE_MODE_10GKR) { ++ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0x1FF); ++ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x7B); ++ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_10G) | ++ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_10G); ++ adapt_mode = USXGMII_RATE_UPDATE_MODE; ++ } else if (interface == PHY_INTERFACE_MODE_5GBASER) { ++ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0xFF); ++ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x3D) | ++ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x3D) | ++ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x3D); ++ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_5G) | ++ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_5G); ++ adapt_mode = USXGMII_RATE_UPDATE_MODE; ++ } else ++ return -EINVAL; ++ ++ adapt_mode |= FIELD_PREP(USXGMII_RATE_ADAPT_MODE, USXGMII_RATE_ADAPT_MODE_X1); ++ ++ if (mpcs->interface != interface) { ++ mpcs->interface = interface; ++ mode_changed = true; ++ } ++ ++ mtk_xfi_pll_enable(eth); ++ mtk_usxgmii_reset(eth, mpcs->id); ++ ++ /* Setup USXGMII AN ctrl */ ++ regmap_update_bits(mpcs->regmap, RG_PCS_AN_CTRL0, ++ USXGMII_AN_SYNC_CNT | USXGMII_AN_ENABLE, ++ an_ctrl); ++ ++ regmap_update_bits(mpcs->regmap, RG_PCS_AN_CTRL2, ++ USXGMII_LINK_TIMER_IDLE_DETECT | ++ USXGMII_LINK_TIMER_COMP_ACK_DETECT | ++ USXGMII_LINK_TIMER_AN_RESTART, ++ link_timer); ++ ++ /* Gated MAC CK */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_MAC_CK_GATED, USXGMII_MAC_CK_GATED); ++ ++ /* Enable interface force mode */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_IF_FORCE_EN, USXGMII_IF_FORCE_EN); ++ ++ /* Setup USXGMII adapt mode */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_RATE_UPDATE_MODE | USXGMII_RATE_ADAPT_MODE, ++ adapt_mode); ++ ++ /* Setup USXGMII speed */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_XFI_RX_MODE | USXGMII_XFI_TX_MODE, ++ xfi_mode); ++ ++ udelay(1); ++ ++ /* Un-gated MAC CK */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_MAC_CK_GATED, 0); ++ ++ udelay(1); ++ ++ /* Disable interface force mode for the AN mode */ ++ if (an_ctrl & USXGMII_AN_ENABLE) ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_IF_FORCE_EN, 0); ++ ++ /* Setup USXGMIISYS with the determined property */ ++ if (interface == PHY_INTERFACE_MODE_USXGMII) ++ mtk_usxgmii_setup_phya_usxgmii(mpcs); ++ else if (interface == PHY_INTERFACE_MODE_10GKR) ++ mtk_usxgmii_setup_phya_10gbaser(mpcs); ++ else if (interface == PHY_INTERFACE_MODE_5GBASER) ++ mtk_usxgmii_setup_phya_5gbaser(mpcs); ++ ++ return mode_changed; ++} ++ ++static void mtk_usxgmii_pcs_get_state(struct phylink_pcs *pcs, ++ struct phylink_link_state *state) ++{ ++ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); ++ struct mtk_eth *eth = mpcs->eth; ++ struct mtk_mac *mac = eth->mac[mtk_xgmii2mac_id(eth, mpcs->id)]; ++ u32 val = 0; ++ ++ regmap_read(mpcs->regmap, RG_PCS_AN_CTRL0, &val); ++ if (FIELD_GET(USXGMII_AN_ENABLE, val)) { ++ /* Refresh LPA by inverting LPA_LATCH */ ++ regmap_read(mpcs->regmap, RG_PCS_AN_STS0, &val); ++ regmap_update_bits(mpcs->regmap, RG_PCS_AN_STS0, ++ USXGMII_LPA_LATCH, ++ !(val & USXGMII_LPA_LATCH)); ++ ++ regmap_read(mpcs->regmap, RG_PCS_AN_STS0, &val); ++ ++ state->interface = mpcs->interface; ++ state->link = FIELD_GET(USXGMII_LPA_LINK, val); ++ state->duplex = FIELD_GET(USXGMII_LPA_DUPLEX, val); ++ ++ switch (FIELD_GET(USXGMII_LPA_SPEED_MASK, val)) { ++ case USXGMII_LPA_SPEED_10: ++ state->speed = SPEED_10; ++ break; ++ case USXGMII_LPA_SPEED_100: ++ state->speed = SPEED_100; ++ break; ++ case USXGMII_LPA_SPEED_1000: ++ state->speed = SPEED_1000; ++ break; ++ case USXGMII_LPA_SPEED_2500: ++ state->speed = SPEED_2500; ++ break; ++ case USXGMII_LPA_SPEED_5000: ++ state->speed = SPEED_5000; ++ break; ++ case USXGMII_LPA_SPEED_10000: ++ state->speed = SPEED_10000; ++ break; ++ } ++ } else { ++ val = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id)); ++ ++ if (mac->id == MTK_GMAC2_ID) ++ val = val >> 16; ++ ++ switch (FIELD_GET(MTK_USXGMII_PCS_MODE, val)) { ++ case 0: ++ state->speed = SPEED_10000; ++ break; ++ case 1: ++ state->speed = SPEED_5000; ++ break; ++ case 2: ++ state->speed = SPEED_2500; ++ break; ++ case 3: ++ state->speed = SPEED_1000; ++ break; ++ } ++ ++ state->interface = mpcs->interface; ++ state->link = FIELD_GET(MTK_USXGMII_PCS_LINK, val); ++ state->duplex = DUPLEX_FULL; ++ } ++ ++ if (state->link == 0) ++ mtk_usxgmii_pcs_config(pcs, MLO_AN_INBAND, ++ state->interface, NULL, false); +} ---- a/drivers/net/ethernet/mediatek/Kconfig -+++ b/drivers/net/ethernet/mediatek/Kconfig -@@ -11,6 +11,14 @@ config NET_MEDIATEK_SOC_WED - depends on ARCH_MEDIATEK || COMPILE_TEST - def_bool NET_MEDIATEK_SOC != n - -+config NET_MEDIATEK_SOC_USXGMII -+ bool "Support USXGMII SerDes on MT7988" -+ depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST -+ def_bool NET_MEDIATEK_SOC != n -+ help -+ Include support for 10G USXGMII SerDes unit which can -+ be found on MT7988. + - config NET_MEDIATEK_SOC - tristate "MediaTek SoC Gigabit Ethernet support" - depends on NET_DSA || !NET_DSA ++static void mtk_usxgmii_pcs_restart_an(struct phylink_pcs *pcs) ++{ ++ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); ++ unsigned int val = 0; ++ ++ if (!mpcs->regmap) ++ return; ++ ++ regmap_read(mpcs->regmap, RG_PCS_AN_CTRL0, &val); ++ val |= USXGMII_AN_RESTART; ++ regmap_write(mpcs->regmap, RG_PCS_AN_CTRL0, val); ++} ++ ++static void mtk_usxgmii_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, ++ phy_interface_t interface, ++ int speed, int duplex) ++{ ++ /* Reconfiguring USXGMII to ensure the quality of the RX signal ++ * after the line side link up. ++ */ ++ mtk_usxgmii_pcs_config(pcs, mode, ++ interface, NULL, false); ++} ++ ++static const struct phylink_pcs_ops mtk_usxgmii_pcs_ops = { ++ .pcs_config = mtk_usxgmii_pcs_config, ++ .pcs_get_state = mtk_usxgmii_pcs_get_state, ++ .pcs_an_restart = mtk_usxgmii_pcs_restart_an, ++ .pcs_link_up = mtk_usxgmii_pcs_link_up, ++}; ++ ++int mtk_usxgmii_init(struct mtk_eth *eth) ++{ ++ struct device_node *r = eth->dev->of_node; ++ struct device *dev = eth->dev; ++ struct device_node *np; ++ int i, ret; ++ ++ eth->usxgmii_pcs = devm_kcalloc(dev, eth->soc->num_devs, sizeof(eth->usxgmii_pcs), GFP_KERNEL); ++ if (!eth->usxgmii_pcs) ++ return -ENOMEM; ++ ++ for (i = 0; i < eth->soc->num_devs; i++) { ++ np = of_parse_phandle(r, "mediatek,usxgmiisys", i); ++ if (!np) ++ break; ++ ++ eth->usxgmii_pcs[i] = devm_kzalloc(dev, sizeof(*eth->usxgmii_pcs), GFP_KERNEL); ++ if (!eth->usxgmii_pcs[i]) ++ return -ENOMEM; ++ ++ eth->usxgmii_pcs[i]->id = i; ++ eth->usxgmii_pcs[i]->eth = eth; ++ eth->usxgmii_pcs[i]->regmap = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->usxgmii_pcs[i]->regmap)) ++ return PTR_ERR(eth->usxgmii_pcs[i]->regmap); ++ ++ eth->usxgmii_pcs[i]->pcs.ops = &mtk_usxgmii_pcs_ops; ++ eth->usxgmii_pcs[i]->pcs.poll = true; ++ eth->usxgmii_pcs[i]->interface = PHY_INTERFACE_MODE_NA; ++ ++ of_node_put(np); ++ } ++ ++ ret = mtk_xfi_pextp_init(eth); ++ if (ret) ++ return ret; ++ ++ ret = mtk_xfi_pll_init(eth); ++ if (ret) ++ return ret; ++ ++ return mtk_toprgu_init(eth); ++} ++ ++struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int mac_id) ++{ ++ u32 xgmii_id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (!eth->usxgmii_pcs[xgmii_id]->regmap) ++ return NULL; ++ ++ return ð->usxgmii_pcs[xgmii_id]->pcs; ++} diff --git a/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch b/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch index 04ca80c213d767..84718d300b5df7 100644 --- a/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch +++ b/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch @@ -103,7 +103,7 @@ Signed-off-by: David S. Miller ret = mtk_mdio_busy_wait(eth); if (ret < 0) -@@ -1018,6 +1061,7 @@ static int mtk_mdio_init(struct mtk_eth +@@ -1013,6 +1056,7 @@ static int mtk_mdio_init(struct mtk_eth eth->mii_bus->name = "mdio"; eth->mii_bus->read = mtk_mdio_read; eth->mii_bus->write = mtk_mdio_write; diff --git a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch index a613803ee6d0c3..e57e6fa83b25ce 100644 --- a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4638,6 +4638,7 @@ static const struct net_device_ops mtk_n +@@ -4633,6 +4633,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -4796,6 +4797,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4791,6 +4792,9 @@ static int mtk_add_mac(struct mtk_eth *e register_netdevice_notifier(&mac->device_notifier); } From 6fc6ea4d3ab3ec2dee0843c3b357c11037d6ca27 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Tue, 18 Apr 2023 11:37:04 +0200 Subject: [PATCH 0053/1171] package: layerscape: change loadaddr address At this moment loadaddr in most layerscape boards are configured to 0x81000000. 5.15 kernel on some boards is bigger than 5.10 and it cause error: Loading kernel from FIT Image at 81000000 ... Using 'config-1' configuration Trying 'kernel-1' kernel subimage Description: ARM64 OpenWrt Linux-5.15.112 Created: 2023-05-21 17:39:35 UTC Type: Kernel Image Compression: gzip compressed Data Start: 0x810000ec Data Size: 7513944 Bytes = 7.2 MiB Architecture: AArch64 OS: Linux Load Address: 0x80000000 Entry Point: 0x80000000 Hash algo: crc32 Hash value: 6fd69550 Hash algo: sha1 Hash value: ee34c753ffb615e199a428762824ad4a0aaef90a Verifying Hash Integrity ... crc32+ sha1+ OK Loading fdt from FIT Image at 81000000 ... Using 'config-1' configuration Trying 'fdt-1' fdt subimage Description: ARM64 OpenWrt fsl_ls1088a-rdb-sdboot device tree blob Created: 2023-05-21 17:39:35 UTC Type: Flat Device Tree Compression: uncompressed Data Start: 0x8172a98c Data Size: 19794 Bytes = 19.3 KiB Architecture: AArch64 Hash algo: crc32 Hash value: 59792ba3 Hash algo: sha1 Hash value: 135585a49f86cd85acea559b78b0098ae99d5e12 Verifying Hash Integrity ... crc32+ sha1+ OK Booting using the fdt blob at 0x8172a98c Uncompressing Kernel Image ERROR: new format image overwritten - must RESET the board to recover resetting ... This patch changes loadaddr to 0x88000000 (like LS1012A-FRDM board) to avoid overlapping for bigger images (like initramfs) too. Tested-by: Alexandra Alth [LS1088ARDB] Signed-off-by: Pawel Dembicki (cherry picked from commit 0822040671e6177020892e0ddbdfafd4bb3690e0) --- .../uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_ls1012a-rdb-uEnv.txt | 2 +- .../boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt | 2 +- .../boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_ls1021a-twr-uEnv.txt | 2 +- .../boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-uEnv.txt | 2 +- .../uboot-layerscape/files/fsl_ls1046a-frwy-sdboot-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-uEnv.txt | 2 +- .../boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-uEnv.txt | 2 +- .../boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_ls2088a-rdb-uEnv.txt | 2 +- .../boot/uboot-layerscape/files/fsl_lx2160a-rdb-sdboot-uEnv.txt | 2 +- package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-uEnv.txt | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt index 592158955e8002..18efdc1bc34e50 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0x8fffffff initrd_high=0xffffffffffffffff sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr diff --git a/package/boot/uboot-layerscape/files/fsl_ls1012a-rdb-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1012a-rdb-uEnv.txt index 8d57d51ece75c5..0898354e7744b5 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1012a-rdb-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1012a-rdb-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr bootargs=root=/dev/mtdblock8 rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=1550000.spi:1m(bl2),4m(fip),1m(u-boot-env),4m(reserved-1),3m(pfe),2m(reserved-2),1m(dtb),16m(kernel),32m(rootfs),49m@0xf00000(firmware) diff --git a/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt index ae0d6a6f96bdf3..f8ec2c10fe869f 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0x8fffffff initrd_high=0xffffffff sd_boot=ext4load mmc 0:1 ${loadaddr} fitImage;bootm ${loadaddr} diff --git a/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt index 55620d67257c83..d7f67e78ec870c 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0x8fffffff initrd_high=0xffffffff sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr diff --git a/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-uEnv.txt index 6d4647b1fd6e1c..26fb3e9207b288 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 nor_boot=cp.b 60f00000 $fdtaddr 100000;cp.b 61000000 $loadaddr 1000000;bootm $loadaddr - $fdtaddr bootargs=root=/dev/mtdblock6 rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=60000000.nor:1m(rcw),2m(u-boot),1m(u-boot-env),11m(reserved-1),1m(dtb),16m(kernel),32m(rootfs),49m@0xf00000(firmware) cma=64M@0x0-0xb0000000 diff --git a/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt index 3c39c2263de06d..591210eea73728 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0x8fffffff initrd_high=0xffffffffffffffff hwconfig=fsl_ddr:bank_intlv=auto diff --git a/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-uEnv.txt index acb61ca00a32db..c601cab92f8b5d 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 hwconfig=fsl_ddr:bank_intlv=auto nor_boot=cp.b 60f00000 $fdtaddr 100000;cp.b 61000000 $loadaddr 1000000;bootm $loadaddr - $fdtaddr diff --git a/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-sdboot-uEnv.txt index 303157cb800405..e69332efacbda1 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 hwconfig=fsl_ddr:bank_intlv=auto sd_boot=ext4load mmc 0:1 ${loadaddr} fitImage;bootm ${loadaddr} diff --git a/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-uEnv.txt index 5461bba9b66716..ad5cc77841dccf 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1046a-frwy-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 hwconfig=fsl_ddr:bank_intlv=auto qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr diff --git a/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt index 3c39c2263de06d..591210eea73728 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0x8fffffff initrd_high=0xffffffffffffffff hwconfig=fsl_ddr:bank_intlv=auto diff --git a/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-uEnv.txt index e52e48802bc23c..dab8faaf1322ca 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 hwconfig=fsl_ddr:bank_intlv=auto qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr diff --git a/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt index f616cb1398657f..5b235378448a42 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0xa0000000 initrd_high=0xffffffffffffffff hwconfig=fsl_ddr:bank_intlv=auto diff --git a/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-uEnv.txt index 210c18721df2f2..a15717bcb80c81 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0xa0000000 initrd_high=0xffffffffffffffff hwconfig=fsl_ddr:bank_intlv=auto diff --git a/package/boot/uboot-layerscape/files/fsl_ls2088a-rdb-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls2088a-rdb-uEnv.txt index 946029d1f16cd2..646aed4427826a 100644 --- a/package/boot/uboot-layerscape/files/fsl_ls2088a-rdb-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_ls2088a-rdb-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 fdt_high=0xa0000000 initrd_high=0xffffffffffffffff hwconfig=fsl_ddr:bank_intlv=auto diff --git a/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-sdboot-uEnv.txt index d1373199150ae6..2d8043d7b1b28d 100644 --- a/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-sdboot-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-sdboot-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 hwconfig=fsl_ddr:bank_intlv=auto mc_init=mmc read 80000000 5000 1800;mmc read 80300000 7000 800;fsl_mc start mc 80000000 80300000;mmc read 80400000 6800 800;fsl_mc apply dpl 80400000 diff --git a/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-uEnv.txt index 41fde35c88c166..16f905afc685a5 100644 --- a/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-uEnv.txt +++ b/package/boot/uboot-layerscape/files/fsl_lx2160a-rdb-uEnv.txt @@ -1,5 +1,5 @@ fdtaddr=0x8f000000 -loadaddr=0x81000000 +loadaddr=0x88000000 bootm_size=0x10000000 hwconfig=fsl_ddr:bank_intlv=auto mc_init=sf probe 0:0;sf read 80000000 a00000 300000;sf read 80300000 e00000 100000;fsl_mc start mc 80000000 80300000;sf read 80400000 d00000 100000;fsl_mc apply dpl 80400000 From 3d05d54679b9503baab31635507d3374239d6bfe Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Fri, 28 Apr 2023 09:24:24 +0200 Subject: [PATCH 0054/1171] layerscape: kernel: enable MC userspace support Management Complex (MC) userspace support is required for userspace helpers working with DPAA2 objects exported by the Management Complex BUS. Without it, there is the error: ``` root@OpenWrt:/# ls-addni dpmac.1 error: Did not find a device file Restool wrapper scripts only support the latest major MC version that currently is MC10.x. Use with caution. error: Did not find a device file ``` This patch fixes it. Suggested-by: Alexandra Alth Signed-off-by: Pawel Dembicki (cherry picked from commit d04d6a82da70f6b691409972ffd4503f339105b7) --- target/linux/layerscape/armv8_64b/config-5.15 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15 index df0a3fd849cfba..b4510b7d34ccc5 100644 --- a/target/linux/layerscape/armv8_64b/config-5.15 +++ b/target/linux/layerscape/armv8_64b/config-5.15 @@ -291,7 +291,7 @@ CONFIG_FSL_GUTS=y CONFIG_FSL_IFC=y CONFIG_FSL_MC_BUS=y CONFIG_FSL_MC_DPIO=y -# CONFIG_FSL_MC_UAPI_SUPPORT is not set +CONFIG_FSL_MC_UAPI_SUPPORT=y # CONFIG_FSL_PPFE is not set # CONFIG_FSL_PPFE_UTIL_DISABLED is not set # CONFIG_FSL_QMAN_TEST is not set From 570618b84482ff2757bcde1c7d7ccbda92b343c8 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Sun, 28 May 2023 04:48:26 +0000 Subject: [PATCH 0055/1171] base-files: x86 fix 01_leds Syntax error Cezary Jackiewicz reported: | Syntax error in line /etc/board.d/01_leds#L22 - missing "\" Fixes: c191c2d46f00 ("x86: base-files add support for Sophos 135r3/135r3w") Reported-by: Cezary Jackiewicz Signed-off-by: Stan Grishin (buffed up commit message) Signed-off-by: Christian Lamparter (cherry picked from commit 4b8b2f4f978d6df586dd7ce4dcc3e1286b93bd48) --- target/linux/x86/base-files/etc/board.d/01_leds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/base-files/etc/board.d/01_leds b/target/linux/x86/base-files/etc/board.d/01_leds index e41c78e62b2493..efc5460df3ce86 100644 --- a/target/linux/x86/base-files/etc/board.d/01_leds +++ b/target/linux/x86/base-files/etc/board.d/01_leds @@ -19,7 +19,7 @@ pc-engines-apu1|pc-engines-apu2|pc-engines-apu3|pc-engines-apu4|pc-engines-apu5| sophos-sg-105wr1|sophos-sg-125wr1|sophos-sg-135wr1|sophos-xg-105wr1|sophos-xg-125wr1|sophos-xg-135wr1) ucidef_set_led_netdev "wlan" "WiFi" "ath9k-phy0" "phy0tpt" ;; -sophos-sg-105wr2|sophos-sg-125wr2|sophos-sg-135wr2|sophos-xg-105wr2|sophos-xg-125wr2|sophos-xg-135wr2| +sophos-sg-105wr2|sophos-sg-125wr2|sophos-sg-135wr2|sophos-xg-105wr2|sophos-xg-125wr2|sophos-xg-135wr2|\ sophos-sg-105wr3|sophos-sg-125wr3|sophos-sg-135wr3|sophos-xg-105wr3|sophos-xg-125wr3|sophos-xg-135wr3) ucidef_set_led_netdev "wlan" "WiFi" "ath10k-phy0" "phy0tpt" ;; From e8231a43e08caebe6d3cb354f7ae7ea325fa32f1 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 21 May 2023 22:51:16 +0800 Subject: [PATCH 0056/1171] ramips: correct page read return value of the mt7621 nand driver read_page() need to return maximum number of bitflips instead of the accumulated number. Change takes from upstream mt7621 u-boot [1]. * @read_page: function to read a page according to the ECC generator * requirements; returns maximum number of bitflips * corrected in any single ECC step, -EIO hw error [1] https://lore.kernel.org/all/cover.1653015383.git.weijie.gao@mediatek.com/ Signed-off-by: Shiji Yang (cherry picked from commit 2fbb91d73ffecc7d033e5bb0b550d664ef9e0f91) --- .../files/drivers/mtd/nand/raw/mt7621_nand.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c index f3a81ee4e24101..89cc7e2624af08 100644 --- a/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c +++ b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c @@ -1006,7 +1006,7 @@ static int mt7621_nfc_read_page_hwecc(struct nand_chip *nand, uint8_t *buf, { struct mt7621_nfc *nfc = nand_get_controller_data(nand); struct mtd_info *mtd = nand_to_mtd(nand); - int bitflips = 0; + int bitflips = 0, ret = 0; int rc, i; nand_read_page_op(nand, page, 0, NULL, 0); @@ -1031,7 +1031,7 @@ static int mt7621_nfc_read_page_hwecc(struct nand_chip *nand, uint8_t *buf, mt7621_nfc_read_sector_fdm(nfc, i); if (rc < 0) { - bitflips = -EIO; + ret = -EIO; continue; } @@ -1043,10 +1043,11 @@ static int mt7621_nfc_read_page_hwecc(struct nand_chip *nand, uint8_t *buf, dev_dbg(nfc->dev, "Uncorrectable ECC error at page %d.%d\n", page, i); - bitflips = -EBADMSG; + bitflips = nand->ecc.strength + 1; mtd->ecc_stats.failed++; - } else if (bitflips >= 0) { - bitflips += rc; + } else { + if (rc > bitflips) + bitflips = rc; mtd->ecc_stats.corrected += rc; } } @@ -1055,6 +1056,9 @@ static int mt7621_nfc_read_page_hwecc(struct nand_chip *nand, uint8_t *buf, nfi_write16(nfc, NFI_CON, 0); + if (ret < 0) + return ret; + return bitflips; } From e2e7dd44506ee7e604a8b7c1a83837f1c025417f Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 25 May 2023 03:29:58 -0400 Subject: [PATCH 0057/1171] x86: disable CONFIG_X86_PLATFORM_DRIVERS_HP New config option defaulted to N for this bump. Signed-off-by: John Audia (cherry picked from commit 3664c57e34454ce50ac7ab6de9e3983a86cde052) --- target/linux/x86/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15 index ee7ab9d6deeb93..aebe4f08c4a389 100644 --- a/target/linux/x86/config-5.15 +++ b/target/linux/x86/config-5.15 @@ -415,6 +415,7 @@ CONFIG_X86_MSR=y CONFIG_X86_PAT=y CONFIG_X86_PLATFORM_DEVICES=y # CONFIG_X86_PLATFORM_DRIVERS_DELL is not set +# CONFIG_X86_PLATFORM_DRIVERS_HP is not set # CONFIG_X86_POWERNOW_K6 is not set # CONFIG_X86_POWERNOW_K7 is not set # CONFIG_X86_REBOOTFIXUPS is not set From 478a3e609fec5034ab5acef54deb2f7907eebfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Sat, 27 May 2023 10:31:58 +0200 Subject: [PATCH 0058/1171] Revert "feeds: use git-src-full to allow Git versioning" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This partially reverts commit 7fae1e5677e9bb4979c8d4ac99be4de6955b13d0 as it should be no longer necessary to do a full clone since commit 48ed07bc0b94 ("treewide: replace AUTORELEASE with real PKG_RELEASE"). Suggested-by: Thibaut VARÈNE Signed-off-by: Petr Štetiar (cherry picked from commit 11bb5337b8d8b5018e48f0df415efb99e2f49d0d) [adjusted to 23.05] Signed-off-by: Thibaut VARÈNE --- feeds.conf.default | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/feeds.conf.default b/feeds.conf.default index f062f8545ed94b..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git-full packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git-full luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git-full routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git-full telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 From 9c45c58c7c57f91c7e525f1580a67d52cde27372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kwiatek?= Date: Thu, 18 May 2023 21:40:24 +0200 Subject: [PATCH 0059/1171] netfilter: add kmod-nft-dup-inet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add kmod-nft-dup-inet package to allow packet duplication in ip/ip6/inet nftables family Signed-off-by: Michał Kwiatek (cherry picked from commit a7e9445975f832db887e6044d7e84220d2a68cf1) --- package/kernel/linux/modules/netfilter.mk | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 99a48a37d479bc..e6dc400b30aad8 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1,6 +1,6 @@ # -# Copyright (C) 2006-2010 OpenWrt.org +# Copyright (C) 2006-2023 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -1147,6 +1147,26 @@ endef $(eval $(call KernelPackage,nft-bridge)) +define KernelPackage/nft-dup-inet + SUBMENU:=$(NF_MENU) + TITLE:=Netfilter nf_tables dup in ip/ip6/inet familly support + DEPENDS:=+kmod-nft-core +kmod-nf-conntrack +IPV6:kmod-nf-conntrack6 + KCONFIG:= \ + CONFIG_NF_DUP_IPV4 \ + CONFIG_NF_DUP_IPV6 \ + CONFIG_NFT_DUP_IPV4 \ + CONFIG_NFT_DUP_IPV6 + FILES:= \ + $(LINUX_DIR)/net/ipv4/netfilter/nf_dup_ipv4.ko \ + $(LINUX_DIR)/net/ipv6/netfilter/nf_dup_ipv6.ko \ + $(LINUX_DIR)/net/ipv4/netfilter/nft_dup_ipv4.ko \ + $(LINUX_DIR)/net/ipv6/netfilter/nft_dup_ipv6.ko + AUTOLOAD:=$(call AutoProbe,nf_dup_ipv4 nf_dup_ipv6 nft_dup_ipv4 nft_dup_ipv6) +endef + +$(eval $(call KernelPackage,nft-dup-inet)) + + define KernelPackage/nft-nat SUBMENU:=$(NF_MENU) TITLE:=Netfilter nf_tables NAT support From 20295c071a6285066b847a9ad2bc1b7d1f6e5e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 26 May 2023 13:08:06 +0200 Subject: [PATCH 0060/1171] pcre2: fix host compilation of libselinux by enabling PIC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libselinux-3.5 fails to compile in Fedora 38 container due to the following: cc -O2 -I/openwrt/staging_dir/host/include -I/openwrt/staging_dir/hostpkg/include -I/openwrt/staging_dir/target-x86_64_musl/host/include -I../include -D_GNU_SOURCE -DNO_ANDROID_BACKEND -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -I/openwrt/staging_dir/hostpkg/include -L/openwrt/staging_dir/host/lib -L/openwrt/staging_dir/hostpkg/lib -L/openwrt/staging_dir/target-x86_64_musl/host/lib -Wl,-rpath=/openwrt/staging_dir/hostpkg/lib -shared -o libselinux.so.1 avc.lo avc_internal.lo avc_sidtab.lo booleans.lo callbacks.lo canonicalize_context.lo checkAccess.lo check_context.lo checkreqprot.lo compute_av.lo compute_create.lo compute_member.lo compute_relabel.lo compute_user.lo context.lo deny_unknown.lo disable.lo enabled.lo fgetfilecon.lo freecon.lo freeconary.lo fsetfilecon.lo get_context_list.lo get_default_type.lo get_initial_context.lo getenforce.lo getfilecon.lo getpeercon.lo init.lo is_customizable_type.lo label.lo label_db.lo label_file.lo label_media.lo label_support.lo label_x.lo lgetfilecon.lo load_policy.lo lsetfilecon.lo mapping.lo matchmediacon.lo matchpathcon.lo policyvers.lo procattr.lo query_user_context.lo regex.lo reject_unknown.lo selinux_check_securetty_context.lo selinux_config.lo selinux_internal.lo selinux_restorecon.lo sestatus.lo setenforce.lo setexecfilecon.lo setfilecon.lo setrans_client.lo seusers.lo sha1.lo stringrep.lo validatetrans.lo -L/openwrt/staging_dir/hostpkg/lib -lpcre2-8 -lfts -ldl -Wl,-soname,libselinux.so.1,--version-script=libselinux.map,-z,defs,-z,relro /usr/bin/ld: /openwrt/staging_dir/hostpkg/lib/libpcre2-8.a(pcre2_compile.c.o): relocation R_X86_64_32S against symbol `_pcre2_ucd_stage1_8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: failed to set dynamic section sizes: bad value So lets fix it by enabling build of host static library with the position independent code option enabled. Signed-off-by: Petr Štetiar (cherry picked from commit 12494f5b8a7bb48cbf7b2fba7d17a53981173120) --- package/libs/pcre2/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/libs/pcre2/Makefile b/package/libs/pcre2/Makefile index d178e3cd04f30e..fa4282cee8ca80 100644 --- a/package/libs/pcre2/Makefile +++ b/package/libs/pcre2/Makefile @@ -66,7 +66,8 @@ CMAKE_HOST_OPTIONS += \ -DPCRE2_SUPPORT_JIT=OFF \ -DPCRE2_SHOW_REPORT=OFF \ -DPCRE2_BUILD_PCRE2GREP=OFF \ - -DPCRE2_BUILD_TESTS=OFF + -DPCRE2_BUILD_TESTS=OFF \ + -DPCRE2_STATIC_PIC=ON CMAKE_OPTIONS += \ -DBUILD_SHARED_LIBS=ON \ From 14cbf041ea46ab936f5ac4e9c05d67e3259e3bd9 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 26 May 2023 12:09:47 +0800 Subject: [PATCH 0061/1171] ca-certificates: Update to version 20230311 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the ca-certificates and ca-bundle package from version 20211016 to version 20230311. Use TAR_OPTIONS instead of hacking Build/Prepare, refresh patches. Debian change-log entry [1]: |[...] |[ Đoàn Trần Công Danh ] |* ca-certificates: compat with non-GNU mktemp (closes: #1000847) | |[ Ilya Lipnitskiy ] |* certdata2pem.py: use UTC time when checking cert validity | |[ Julien Cristau ] |* Update Mozilla certificate authority bundle to version 2.60 | The following certificate authorities were added (+): | + "Autoridad de Certificacion Firmaprofesional CIF A62634068" | + "Certainly Root E1" | + "Certainly Root R1" | + "D-TRUST BR Root CA 1 2020" | + "D-TRUST EV Root CA 1 2020" | + "DigiCert TLS ECC P384 Root G5" | + "DigiCert TLS RSA4096 Root G5" | + "E-Tugra Global Root CA ECC v3" | + "E-Tugra Global Root CA RSA v3" | + "HARICA TLS ECC Root CA 2021" | + "HARICA TLS RSA Root CA 2021" | + "HiPKI Root CA - G1" | + "ISRG Root X2" | + "Security Communication ECC RootCA1" | + "Security Communication RootCA3" | + "Telia Root CA v2" | + "TunTrust Root CA" | + "vTrus ECC Root CA" | + "vTrus Root CA" | The following certificate authorities were removed (-): | - "Cybertrust Global Root" (expired) | - "EC-ACC" | - "GlobalSign Root CA - R2" (expired) | - "Hellenic Academic and Research Institutions RootCA 2011" | - "Network Solutions Certificate Authority" | - "Staat der Nederlanden EV Root CA" (expired) |* Drop trailing space from debconf template causing misformatting | (closes: #980821) | |[ Wataru Ashihara ] |* Make certdata2pem.py compatible with cryptography >= 35 (closes: #1008244) |[...] [1]: https://metadata.ftp-master.debian.org/changelogs/main/c/ca-certificates/ca-certificates_20230311_changelog Signed-off-by: Tianling Shen (cherry picked from commit 7c83b6ac8656f9a3b005554d25857e8ed5faf3f6) --- package/system/ca-certificates/Makefile | 14 +++++--------- ...ates-fix-python3-cryptography-woes-in-cer.patch | 8 ++++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile index 9fac32e7e3e80c..ec588cc65b6c6b 100644 --- a/package/system/ca-certificates/Makefile +++ b/package/system/ca-certificates/Makefile @@ -7,17 +7,20 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ca-certificates -PKG_VERSION:=20211016 +PKG_VERSION:=20230311 PKG_RELEASE:=1 PKG_MAINTAINER:= PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/main/c/ca-certificates -PKG_HASH:=2ae9b6dc5f40c25d6d7fe55e07b54f12a8967d1955d3b7b2f42ee46266eeef88 +PKG_HASH:=83de934afa186e279d1ed08ea0d73f5cf43a6fbfb5f00874b6db3711c64576f3 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) + define Package/ca-certificates SECTION:=base CATEGORY:=Base system @@ -34,13 +37,6 @@ define Package/ca-bundle PROVIDES:=ca-certs endef -define Build/Prepare - $(DECOMPRESS_CMD) $(HOST_TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) - $(Build/Patch) -endef - -MAKE_PATH := work - define Build/Install mkdir -p \ $(PKG_INSTALL_DIR)/usr/sbin \ diff --git a/package/system/ca-certificates/patches/0001-ca-certificates-fix-python3-cryptography-woes-in-cer.patch b/package/system/ca-certificates/patches/0001-ca-certificates-fix-python3-cryptography-woes-in-cer.patch index add01f42c0fb29..09092617f18ffd 100644 --- a/package/system/ca-certificates/patches/0001-ca-certificates-fix-python3-cryptography-woes-in-cer.patch +++ b/package/system/ca-certificates/patches/0001-ca-certificates-fix-python3-cryptography-woes-in-cer.patch @@ -18,8 +18,8 @@ Reported-by: Chen Minqiang Reported-by: Shane Synan Signed-off-by: Christian Lamparter --- ---- a/work/mozilla/certdata2pem.py -+++ b/work/mozilla/certdata2pem.py +--- a/mozilla/certdata2pem.py ++++ b/mozilla/certdata2pem.py @@ -21,16 +21,12 @@ # USA. @@ -42,8 +42,8 @@ Signed-off-by: Christian Lamparter if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]: continue - -- cert = x509.load_der_x509_certificate(obj['CKA_VALUE']) -- if cert.not_valid_after < datetime.datetime.now(): +- cert = x509.load_der_x509_certificate(bytes(obj['CKA_VALUE'])) +- if cert.not_valid_after < datetime.datetime.utcnow(): - print('!'*74) - print('Trusted but expired certificate found: %s' % obj['CKA_LABEL']) - print('!'*74) From 65b5b72cb7da983e7ec85a48c2916c97ce3b8277 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sat, 27 May 2023 13:13:25 +0800 Subject: [PATCH 0062/1171] selinux-policy: update to 1.2.5 30d503a uci jsonfilter: pipe and leak e13cb64 rpcd leds 144781f jsonfilter, luci, ubus 1210762 rpcd and all agents get fd's leaked ab9227c rpcd 2f99e0e luci rpcd b43aaf3 rpcd (enable/disable services) luci peeraddr f20f03e rpcd 7bc74f6 rpcd reads all subj state and luci-bwc leaks 9634b17 adds inotify perms to anon_inode 3d3c17c adds bare anon_inode (linux 5.15) 7104b20 dnsmasq and luci 0de2c66 luci,rpcd, ucode, wpad 14f5cf9 luci and ucode e3ce84c rpcd, ucode and cgiio loose ends 96a2401 misc updates 9fe0490 initscript: remove redundant rules 71bd77e allow all init scripts to log to logd f697331 sandbox: make ttydev handling more robust a471877 simplify pty tty console access f738984 sandbox: also remove TIOSCTI from all ttydevs Signed-off-by: Linhui Liu (cherry picked from commit 4c5a9da8699a7982b8f03b28561f955d9d1313f1) --- package/libs/libselinux/Makefile | 2 +- package/system/selinux-policy/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libselinux/Makefile b/package/libs/libselinux/Makefile index db2221d7e31e03..816e09f30ce877 100644 --- a/package/libs/libselinux/Makefile +++ b/package/libs/libselinux/Makefile @@ -103,7 +103,7 @@ endef $(foreach a,$(LIBSELINUX_UTILS),$(eval $(call GenUtilPkg,libselinux-$(a),$(a)))) # Needed to link libselinux utilities, which link against -# libselinux.so, which indirectly depends on libpcre.so, installed in +# libselinux.so, which indirectly depends on libpcre2.so, installed in # $(STAGING_DIR_HOSTPKG). HOST_LDFLAGS += -Wl,-rpath="$(STAGING_DIR_HOSTPKG)/lib" diff --git a/package/system/selinux-policy/Makefile b/package/system/selinux-policy/Makefile index bcf6b4a3c24676..8e36b267bb4fb3 100644 --- a/package/system/selinux-policy/Makefile +++ b/package/system/selinux-policy/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=selinux-policy PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://git.defensec.nl/selinux-policy.git -PKG_VERSION:=1.2.3 -PKG_MIRROR_HASH:=ff1ddca168a6631aeac34352657f424bc4acf5d50b8aa7ff8dfa8c9663ba8538 +PKG_VERSION:=1.2.5 +PKG_MIRROR_HASH:=81ac6e31d2f1febddbe594f3578a9c40444fc0e349075ab6abd3d3ee014a988e PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_BUILD_DEPENDS:=secilc/host policycoreutils/host From c734a399cc57b1b8371290c08b43fd21b5007df8 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 20 May 2023 13:56:00 +0200 Subject: [PATCH 0063/1171] airoha: spi-en7523: Fix compile warning The set_spi_clock_speed() function is not used, this causes a compile warning which results in a build error with -WError. Signed-off-by: Hauke Mehrtens (cherry picked from commit 2d5f3b3c4ce4c6221299f2362b3029783048f649) --- ...spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/airoha/patches-5.15/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch b/target/linux/airoha/patches-5.15/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch index 8df11630c754f3..6c21666ed11c51 100644 --- a/target/linux/airoha/patches-5.15/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch +++ b/target/linux/airoha/patches-5.15/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch @@ -25,7 +25,7 @@ obj-$(CONFIG_SPI_FSL_CPM) += spi-fsl-cpm.o --- /dev/null +++ b/drivers/spi/spi-en7523.c -@@ -0,0 +1,311 @@ +@@ -0,0 +1,313 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include @@ -166,6 +166,7 @@ + } +} + ++#if 0 +static void set_spi_clock_speed(int freq_mhz) +{ + u32 tmp, val; @@ -178,6 +179,7 @@ + tmp |= (val << 8) | 1; + writel(tmp, ENSPI_CLOCK_DIVIDER); +} ++#endif + +static void init_hw(void) +{ From f2a13cf10e12769fabe387daf2102691c4c810c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=20=E9=B9=8F?= Date: Wed, 22 Feb 2023 20:46:28 +0800 Subject: [PATCH 0064/1171] ipq40xx: add e2600ac c1 to dsa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert E2600ac c1 to DSA and enable it. Signed-off-by: 张 鹏 [ rename port to more generic name ] Signed-off-by: Christian Marangi (cherry picked from commit 7f2ecab0f4623e9b437b1a6656275695ac063fe4) --- .../ipq40xx/base-files/etc/board.d/02_network | 3 ++ .../arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts | 32 +++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 3 +- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 28648c0db99e53..0d9be90ddb0d0f 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -97,6 +97,9 @@ ipq40xx_setup_interfaces() plasmacloud,pa2200) ucidef_set_interfaces_lan_wan "ethernet1" "ethernet2" ;; + qxwlan,e2600ac-c1) + ucidef_set_interfaces_lan_wan "sw-eth1" "sw-eth2" + ;; zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts index f9205c28fa4f9d..70e05c7eef3ab9 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts @@ -79,6 +79,14 @@ precal_art_5000: precal@5000 { reg = <0x5000 0x2f20>; }; + + macaddr_gmac0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_gmac1: macaddr@6 { + reg = <0x6 0x6>; + }; }; partition@180000 { compatible = "denx,fit"; @@ -102,3 +110,27 @@ nvmem-cells = <&precal_art_5000>; qcom,ath10k-calibration-variant = "Qxwlan-E2600AC-C1"; }; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + label = "sw-eth1"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_gmac0>; +}; + +&swport5 { + status = "okay"; + + label = "sw-eth2"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_gmac1>; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 59bdd04296294e..6cde091b2b51df 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1033,8 +1033,7 @@ define Device/qxwlan_e2600ac-c1 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata DEFAULT := n endef -# Missing DSA Setup -#TARGET_DEVICES += qxwlan_e2600ac-c1 +TARGET_DEVICES += qxwlan_e2600ac-c1 define Device/qxwlan_e2600ac-c2 $(call Device/FitImage) From dd979547725b37c28f84974a292a44593cef457d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=20=E9=B9=8F?= Date: Wed, 22 Feb 2023 20:55:44 +0800 Subject: [PATCH 0065/1171] ipq40xx: add e2600ac c2 to dsa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert E2600ac c2 to DSA and enable it. Signed-off-by: 张 鹏 [ rename port to more generic name ] Signed-off-by: Christian Marangi (cherry picked from commit 0dca52cf595cedcabec5d384ddc83f1954cca46d) --- .../ipq40xx/base-files/etc/board.d/02_network | 3 ++ .../arm/boot/dts/qcom-ipq4019-e2600ac-c2.dts | 40 +++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 3 +- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 0d9be90ddb0d0f..d6b19c981eab99 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -100,6 +100,9 @@ ipq40xx_setup_interfaces() qxwlan,e2600ac-c1) ucidef_set_interfaces_lan_wan "sw-eth1" "sw-eth2" ;; + qxwlan,e2600ac-c2) + ucidef_set_interfaces_lan_wan "sw-eth1 sw-eth2" "sw-eth3" + ;; zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c2.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c2.dts index 1f88322a4f1e8c..2ad794e8ecb3a2 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c2.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c2.dts @@ -79,6 +79,14 @@ precal_art_5000: precal@5000 { reg = <0x5000 0x2f20>; }; + + macaddr_gmac0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_gmac1: macaddr@6 { + reg = <0x6 0x6>; + }; }; }; }; @@ -137,3 +145,35 @@ nvmem-cells = <&precal_art_5000>; qcom,ath10k-calibration-variant = "Qxwlan-E2600AC-C2"; }; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport2 { + status = "okay"; + label = "sw-eth1"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_gmac0>; +}; + +&swport4 { + status = "okay"; + label = "sw-eth2"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_gmac0>; +}; + +&swport5 { + status = "okay"; + + label = "sw-eth3"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_gmac1>; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 6cde091b2b51df..59dfb0062839a0 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1046,8 +1046,7 @@ define Device/qxwlan_e2600ac-c2 BLOCKSIZE := 128k PAGESIZE := 2048 endef -# Missing DSA Setup -#TARGET_DEVICES += qxwlan_e2600ac-c2 +TARGET_DEVICES += qxwlan_e2600ac-c2 define Device/sony_ncp-hg100-cellular $(call Device/FitImage) From d4d94a1ff37fec554af1d08569e189ea1eede6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=20=E9=B9=8F?= Date: Fri, 24 Feb 2023 08:58:28 +0800 Subject: [PATCH 0066/1171] ipq40xx: e2600ac-c1 remove KERNEL_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, e2600ac-c1 cannot be built as the kernel is larger than the defined KERNEL_SIZE, however, there is no bootloader limit for the kernel size so remove KERNEL_SIZE completely. Signed-off-by: 张 鹏 [ improve commit title, fix merge conflict ] Signed-off-by: Christian Marangi (cherry picked from commit b764268acb7ed410d1d81e783f1b0ce407efda82) --- target/linux/ipq40xx/image/generic.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 59dfb0062839a0..7c7a4acc5ca002 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1028,10 +1028,8 @@ define Device/qxwlan_e2600ac-c1 DEVICE_VARIANT := C1 BOARD_NAME := e2600ac-c1 SOC := qcom-ipq4019 - KERNEL_SIZE := 4096k IMAGE_SIZE := 31232k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata - DEFAULT := n endef TARGET_DEVICES += qxwlan_e2600ac-c1 From f949dd5c906fc36d74d86d39fb9c4d514eea57d6 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 30 May 2023 20:21:43 +0200 Subject: [PATCH 0067/1171] kernel: Set CONFIG_FRAME_WARN depending on target This set the CONFIG_FRAME_WARN option depending on some target settings. It will use the default from the upstream kernel and not the hard coded value of 1024 now. Signed-off-by: Hauke Mehrtens (cherry picked from commit 16a20512d852f6ecebf8c57cd7fa2572a06a9d0b) --- config/Config-kernel.in | 11 +++++++++++ target/linux/generic/config-5.15 | 1 - target/linux/layerscape/armv8_64b/config-5.15 | 1 - target/linux/octeon/config-5.15 | 1 - target/linux/rockchip/armv8/config-5.15 | 1 - target/linux/sunxi/config-5.15 | 1 - 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 3a2189d63aff00..32524f5aedf1bf 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -387,6 +387,17 @@ config KERNEL_DEBUG_INFO_REDUCED DEBUG_INFO build and compile times are reduced too. Only works with newer gcc versions. +config KERNEL_FRAME_WARN + int + range 0 8192 + default 1280 if KERNEL_KASAN && !ARCH_64BIT + default 1024 if !ARCH_64BIT + default 2048 if ARCH_64BIT + help + Tell the compiler to warn at build time for stack frames larger than this. + Setting this too low will cause a lot of warnings. + Setting it to 0 disables the warning. + # KERNEL_DEBUG_LL symbols must have the default value set as otherwise # KConfig wont evaluate them unless KERNEL_EARLY_PRINTK is selected # which means that buildroot wont override the DEBUG_LL symbols in target diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 6ac2993c155976..4635a423ffc6b4 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -2077,7 +2077,6 @@ CONFIG_FORTIFY_SOURCE=y # CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set # CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set # CONFIG_FRAME_POINTER is not set -CONFIG_FRAME_WARN=1024 # CONFIG_FREEZER is not set # CONFIG_FRONTSWAP is not set # CONFIG_FSCACHE is not set diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15 index b4510b7d34ccc5..69edc7a3f0703a 100644 --- a/target/linux/layerscape/armv8_64b/config-5.15 +++ b/target/linux/layerscape/armv8_64b/config-5.15 @@ -269,7 +269,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set CONFIG_FRAME_POINTER=y -CONFIG_FRAME_WARN=2048 CONFIG_FREEZER=y # CONFIG_FSL_BMAN_TEST is not set CONFIG_FSL_DPAA=y diff --git a/target/linux/octeon/config-5.15 b/target/linux/octeon/config-5.15 index 450b84be44c437..5882c7dd757325 100644 --- a/target/linux/octeon/config-5.15 +++ b/target/linux/octeon/config-5.15 @@ -70,7 +70,6 @@ CONFIG_EXT4_FS=y CONFIG_F2FS_FS=y CONFIG_FAT_FS=y CONFIG_FIXED_PHY=y -CONFIG_FRAME_WARN=2048 CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FWNODE_MDIO=y diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15 index 0ed009004f15a8..08ce65d8eafb68 100644 --- a/target/linux/rockchip/armv8/config-5.15 +++ b/target/linux/rockchip/armv8/config-5.15 @@ -201,7 +201,6 @@ CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y # CONFIG_FORTIFY_SOURCE is not set CONFIG_FRAME_POINTER=y -CONFIG_FRAME_WARN=2048 CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y diff --git a/target/linux/sunxi/config-5.15 b/target/linux/sunxi/config-5.15 index 9771ee8b4cf9c6..c33bb7ab6fd829 100644 --- a/target/linux/sunxi/config-5.15 +++ b/target/linux/sunxi/config-5.15 @@ -161,7 +161,6 @@ CONFIG_FONT_SUPPORT=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y -CONFIG_FRAME_WARN=2048 CONFIG_FREEZER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y From e2701e0f33980f7fd46d7b09daf29737e15bb071 Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 30 May 2023 12:17:13 -0400 Subject: [PATCH 0068/1171] kernel: bump 5.15 to 5.15.114 All patches automatically rebased. Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia (cherry picked from commit 223004b4d6e5d17c0ae99e15d0f4c591676b4f44) --- include/kernel-5.15 | 4 ++-- ...usb-add-plumbing-for-updating-interrupt-endpoint-int.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 733a8edf782325..4c18bc35c2258c 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .113 -LINUX_KERNEL_HASH-5.15.113 = 4a4e98d21149d781867a6d44855f708b02f03cfe233d8026a0af9c9841b3b9ca +LINUX_VERSION-5.15 = .114 +LINUX_KERNEL_HASH-5.15.114 = e981ea5d219f77735bf5a3f7e84a8af578df8ac3e1c4ff1b0649e2b0795277d2 diff --git a/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch b/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch index 857221d8b5304a..68c2c6d7281dd8 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch @@ -70,7 +70,7 @@ Signed-off-by: Jonathan Bell * @dev: the device whose endpoint is being disabled --- a/include/linux/usb.h +++ b/include/linux/usb.h -@@ -1845,6 +1845,8 @@ extern int usb_clear_halt(struct usb_dev +@@ -1850,6 +1850,8 @@ extern int usb_clear_halt(struct usb_dev extern int usb_reset_configuration(struct usb_device *dev); extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr); From f29f876bfa3b8a3636d924eb8e9724dbe5248891 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 7 Jun 2023 01:06:48 +0200 Subject: [PATCH 0069/1171] OpenWrt v23.05.0-rc1: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..26a45fdeeed7bc 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^002cea57c04dc8cc606b49d2f3d6902cfbac75d8 +src-git luci https://git.openwrt.org/project/luci.git^39e312a9b2ab44d19703df7a23287445da488784 +src-git routing https://git.openwrt.org/feed/routing.git^593a514ab53c4590bd0efc37ab82ae90460434bb +src-git telephony https://git.openwrt.org/feed/telephony.git^129c8e0a9d68a39ad2dd550cf79dc8fc678f4a38 diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..d3c9ce418ec87b 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc1) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23069-e2701e0f33) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc1) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..704540b4c46736 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.0-rc1" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..a58709eea48003 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23069-e2701e0f33 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..a9d9edc143f5e9 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1685785320 From 5db2d6d009019d9c8b30ff2321785812d1fb19b2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 7 Jun 2023 01:06:59 +0200 Subject: [PATCH 0070/1171] OpenWrt v23.05.0-rc1: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index 26a45fdeeed7bc..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^002cea57c04dc8cc606b49d2f3d6902cfbac75d8 -src-git luci https://git.openwrt.org/project/luci.git^39e312a9b2ab44d19703df7a23287445da488784 -src-git routing https://git.openwrt.org/feed/routing.git^593a514ab53c4590bd0efc37ab82ae90460434bb -src-git telephony https://git.openwrt.org/feed/telephony.git^129c8e0a9d68a39ad2dd550cf79dc8fc678f4a38 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index d3c9ce418ec87b..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc1) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23069-e2701e0f33) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc1) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 704540b4c46736..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.0-rc1" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index a58709eea48003..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23069-e2701e0f33 diff --git a/version.date b/version.date deleted file mode 100644 index a9d9edc143f5e9..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1685785320 From b059aaf039e8127bef74b180593bf940b6397f3b Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 31 May 2023 21:58:34 +0800 Subject: [PATCH 0071/1171] build: export GIT_CEILING_DIRECTORIES for package builds A package may run git as part of its build process, and if the package source code is not from a git checkout, then git may traverse up the directory tree to find buildroot's repository directory (.git). For instance, Poetry Core, a Python build backend, will read the contents of .gitignore for paths to exclude when creating a Python package. If it finds buildroot's .gitignore file, then Poetry Core will exclude all of the package's files[1]. This exports GIT_CEILING_DIRECTORIES for both package and host builds so that git will not traverse beyond $(BUILD_DIR)/$(BUILD_DIR_HOST). [1]: https://github.com/python-poetry/poetry/issues/5547 Signed-off-by: Jeffery To (cherry picked from commit f597f34f3afa7bba8a2606490617688f1cea5a44) --- include/host-build.mk | 1 + include/package.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/include/host-build.mk b/include/host-build.mk index b7fb0a737f14a4..7485f91e422ed1 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -131,6 +131,7 @@ define Host/Exports/Default $(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX) $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig $(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig + $(1) : export GIT_CEILING_DIRECTORIES=$$(BUILD_DIR_HOST) $(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE)) $(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG)) endef diff --git a/include/package.mk b/include/package.mk index f03cb15f05d5ac..c391d320aa2c50 100644 --- a/include/package.mk +++ b/include/package.mk @@ -194,6 +194,7 @@ define Build/Exports/Default $(1) : export CONFIG_SITE:=$$(CONFIG_SITE) $(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH) $(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH) + $(1) : export GIT_CEILING_DIRECTORIES:=$$(BUILD_DIR) endef Build/Exports=$(Build/Exports/Default) From 38f8f56c7a2989c4896b2a3fb560dda7ccfd216a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Mon, 5 Jun 2023 12:57:51 +0800 Subject: [PATCH 0072/1171] sdk: Expose CCACHE_DIR option As the CCACHE option is already exposed, it would be helpful to also make the ccache directory easily customizable. Signed-off-by: Jeffery To (cherry picked from commit 897691fdce27868aa4c0c68de8b67e8af6f209e1) --- target/sdk/files/Config.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in index a14c17fe955ba3..0cf68faa6e1296 100644 --- a/target/sdk/files/Config.in +++ b/target/sdk/files/Config.in @@ -119,6 +119,13 @@ menu "Advanced configuration options (for developers)" help Compiler cache; see https://ccache.samba.org/ + config CCACHE_DIR + string "Set ccache directory" if CCACHE + default "" + help + Store ccache in this directory. + If not set, uses './.ccache' + config BUILD_LOG bool "Enable log files during build process" help From b42ee4df5d45fc69a24be997fe9bc5933cc1896d Mon Sep 17 00:00:00 2001 From: Daniel Danzberger Date: Fri, 2 Jun 2023 19:36:28 +0200 Subject: [PATCH 0073/1171] ramips: fix lzma-loader for ASIARF boards This fixes a well known "LZMA ERROR 1" error, reported previously on numerous of similar devices. Signed-off-by: Daniel Danzberger (cherry picked from commit 29a5cb7a8b105ca6534bba63edcec48ae935c078) --- target/linux/ramips/image/mt7621.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2697f84bf7684d..6f50623acbba93 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -237,6 +237,7 @@ TARGET_DEVICES += arcadyan_we420223-99 define Device/asiarf_ap7621-001 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) IMAGE_SIZE := 16000k DEVICE_VENDOR := AsiaRF DEVICE_MODEL := AP7621-001 @@ -247,6 +248,7 @@ TARGET_DEVICES += asiarf_ap7621-001 define Device/asiarf_ap7621-nv1 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) IMAGE_SIZE := 16000k DEVICE_VENDOR := AsiaRF DEVICE_MODEL := AP7621-NV1 From 42976b1c97e11bf0006311b15d8626fa685f0550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 29 Mar 2023 10:57:17 +0200 Subject: [PATCH 0074/1171] netifd: update to version 2023-05-31 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contains following changes: * bridge: bridge_dump_info: add dumping of bridge attributes * bridge: make it more clear why the config was applied * cmake: fix build by reordering the cflags definitions * treewide: fix multiple compiler warnings Signed-off-by: Petr Štetiar (cherry picked from commit d2ecaaca3404a05ba65bb6756bc5fbd05389ed2f) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 8dcff7987d2ca6..8d179beb30c557 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-04-17 -PKG_SOURCE_VERSION:=7de5440a520f9c6687358c7ef88ac4aad0ff98a5 -PKG_MIRROR_HASH:=aaf6aef1c991c67b6ef43b4c7f102ba94319bf522f620e93293d031b8333bd8f +PKG_SOURCE_DATE:=2023-05-31 +PKG_SOURCE_VERSION:=38cbdc1c8cbbe2e30d62227d74565bd3fa21a36b +PKG_MIRROR_HASH:=c275ef1f550726b045b3dd7bcee1d660bba9d56c4d53bf32f1eeb6f68bc4116c PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 3bdefae5f82c1edfe4e98498ffe2a3fa41994786 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 3 Jun 2023 14:37:37 +0200 Subject: [PATCH 0075/1171] netifd: Fix PKG_MIRROR_HASH Fix the PKG_MIRROR_HASH value for netifd. Fixes: d2ecaaca3404 ("netifd: update to version 2023-05-31") Signed-off-by: Hauke Mehrtens (cherry picked from commit 21f713d5abf86fc5639b41d7f4e7535a5538d63a) --- package/network/config/netifd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 8d179beb30c557..cac3ddc6cb7ef6 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -7,7 +7,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git PKG_SOURCE_DATE:=2023-05-31 PKG_SOURCE_VERSION:=38cbdc1c8cbbe2e30d62227d74565bd3fa21a36b -PKG_MIRROR_HASH:=c275ef1f550726b045b3dd7bcee1d660bba9d56c4d53bf32f1eeb6f68bc4116c +PKG_MIRROR_HASH:=5fbf325516a1bf1cc945019c061af280f5217267b20ae46fcfc71739616b3389 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From bb0306969134a5390b537465700175ed114c3427 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 4 Jun 2023 18:37:21 +0200 Subject: [PATCH 0076/1171] netifd: update to the latest version ec9dba721245 system-linux: fix memory leak in system_bridge_vlan_check Signed-off-by: Felix Fietkau (cherry picked from commit 20ce21866e482c132df7085061f28dfdafc8a48a) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index cac3ddc6cb7ef6..31fd0838a49309 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-05-31 -PKG_SOURCE_VERSION:=38cbdc1c8cbbe2e30d62227d74565bd3fa21a36b -PKG_MIRROR_HASH:=5fbf325516a1bf1cc945019c061af280f5217267b20ae46fcfc71739616b3389 +PKG_SOURCE_DATE:=2023-06-04 +PKG_SOURCE_VERSION:=ec9dba72124597b7224bbfe75960386dc320f4bd +PKG_MIRROR_HASH:=baee39a3882a2b03fc83a3a6a8963c340fa8d884c7a8c9e80e7d2dddc50e24bd PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 0c885c1542382e737856864508448342fc61bb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Sun, 2 Apr 2023 10:40:47 +0200 Subject: [PATCH 0077/1171] ramips: tplink,mr600v2: fix image generation for sysupgrade image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MR600v2 does not find its rootfs if it is neither directly after the kernel or aligned to an erase block boundary (64k). This aligns the rootfs to 0x10000 allowing the device to boot again. Based on investigation by forum user relghuar. Signed-off-by: Andreas Böhler (cherry picked from commit 46b51e9e992884c81f4838440cd2967e67db3a79) --- target/linux/ramips/image/mt7621.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 6f50623acbba93..340d4ba4a1b321 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2160,6 +2160,9 @@ define Device/tplink_mr600-v2-eu TPLINK_FLASHLAYOUT := 16Mltq DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ kmod-usb-net-qmi-wwan uqmi kmod-usb3 -uboot-envtools + IMAGE/factory.bin := tplink-v2-image -e -a 0x10000 + IMAGE/sysupgrade.bin := tplink-v2-image -s -e -a 0x10000 | check-size | \ + append-metadata KERNEL := $(KERNEL_DTB) | uImage lzma KERNEL_INITRAMFS := $$(KERNEL) | tplink-v2-header TPLINK_BOARD_ID := MR600-V2-EU From 1e4f9db13836de5eea0cb2e6c90c04331a4cabbe Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Thu, 27 Apr 2023 16:34:49 +0200 Subject: [PATCH 0078/1171] ubnt-ledbar: depend on mediatek and ramips subtargets It's only used on devices in mt7621 and mt7622 subtargets, so no reason to compile it for others. Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit e81298463ed45cd03d45837c12f4c0a4b85f6cd4) --- package/kernel/ubnt-ledbar/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/ubnt-ledbar/Makefile b/package/kernel/ubnt-ledbar/Makefile index 90eccf1c21b3ef..69236ffbb330d4 100644 --- a/package/kernel/ubnt-ledbar/Makefile +++ b/package/kernel/ubnt-ledbar/Makefile @@ -20,7 +20,7 @@ define KernelPackage/leds-ubnt-ledbar FILES:= \ $(PKG_BUILD_DIR)/leds-ubnt-ledbar.ko AUTOLOAD:=$(call AutoProbe,leds-ubnt-ledbar,1) - DEPENDS:=+kmod-i2c-core + DEPENDS:=@TARGET_mediatek_mt7622||TARGET_ramips_mt7621 +kmod-i2c-core endef define KernelPackage/leds-ubnt-ledbar/description From ea11b6ea03dff0abca0e4c65265928d86105f6c9 Mon Sep 17 00:00:00 2001 From: Yanase Yuki Date: Wed, 31 May 2023 16:28:31 +0900 Subject: [PATCH 0079/1171] ipq806x: use new package name for NEC WG2600HP3 commit 0c45ad41e15e2255 changes ipq806x usb kmod name from usb-phy-qcom-dwc3 to phy-qcom-ipq806x-usb, so use new name. Signed-off-by: Yanase Yuki (cherry picked from commit 93147443502e61d0a824406bef13b0b9fe250f71) --- target/linux/ipq806x/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk index b83999dd00ed6c..aac0a2c8fadfde 100644 --- a/target/linux/ipq806x/image/generic.mk +++ b/target/linux/ipq806x/image/generic.mk @@ -245,7 +245,7 @@ define Device/nec_wg2600hp3 pad-rootfs | append-metadata DEVICE_PACKAGES := -kmod-ata-ahci -kmod-ata-ahci-platform \ -kmod-usb-ohci -kmod-usb2 -kmod-usb-ledtrig-usbport \ - -kmod-usb-phy-qcom-dwc3 -kmod-usb3 -kmod-usb-dwc3-qcom \ + -kmod-phy-qcom-ipq806x-usb -kmod-usb3 -kmod-usb-dwc3-qcom \ ath10k-firmware-qca9984-ct endef TARGET_DEVICES += nec_wg2600hp3 From 0c15f45fa71feb4eb32f7961446df286cdfc319b Mon Sep 17 00:00:00 2001 From: Yanase Yuki Date: Wed, 31 May 2023 16:41:59 +0900 Subject: [PATCH 0080/1171] ipq40xx: convert Buffalo WTR-M2133HP to DSA This commit convert WTR-M2133HP to DSA setup. Signed-off-by: Yanase Yuki (cherry picked from commit edb3a4162c0763ecc9d5e7660700a68a25bf28e3) --- .../ipq40xx/base-files/etc/board.d/02_network | 1 + .../arm/boot/dts/qcom-ipq4019-wtr-m2133hp.dts | 29 +++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 3 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index d6b19c981eab99..b131d0d6182fe4 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -82,6 +82,7 @@ ipq40xx_setup_interfaces() ucidef_set_interface_lan "sw-eth1 sw-eth2" ;; aruba,ap-303h|\ + buffalo,wtr-m2133hp|\ ezviz,cs-w3-wd1200g-eup|\ netgear,rbr50|\ netgear,rbs50|\ diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wtr-m2133hp.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wtr-m2133hp.dts index f1d58ccba916d2..3260de23bd4089 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wtr-m2133hp.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wtr-m2133hp.dts @@ -417,6 +417,35 @@ qcom,ath10k-calibration-variant = "Buffalo-WTR-M2133HP"; }; +&switch { + status = "okay"; +}; + +&swport2 { + status = "okay"; + label = "lan3"; +}; + +&swport3 { + status = "okay"; + label = "lan2"; +}; + +&swport4 { + status = "okay"; + label = "lan1"; +}; + +&swport5 { + status = "okay"; +}; + +&gmac { + status = "okay"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_orgdata_20>; +}; + &mdio { status = "okay"; pinctrl-0 = <&mdio_pins>; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 7c7a4acc5ca002..59d4f082ff8b48 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -305,8 +305,7 @@ define Device/buffalo_wtr-m2133hp BLOCKSIZE := 128k PAGESIZE := 2048 endef -# Missing DSA Setup -#TARGET_DEVICES += buffalo_wtr-m2133hp +TARGET_DEVICES += buffalo_wtr-m2133hp define Device/cellc_rtl30vw KERNEL_SUFFIX := -zImage.itb From 47437563aafcd7158584cbfc991f754f27aebeba Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Tue, 30 May 2023 00:54:16 +0200 Subject: [PATCH 0081/1171] apm821xx: mx60: drop nand-is-boot-medium it was reported that this flag caused the mx60 not to boot anymore. Fixes: f095822699cc ("apm821xx: convert legacy nand partition layou") Signed-off-by: Christian Lamparter --- target/linux/apm821xx/dts/meraki-mx60.dts | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/linux/apm821xx/dts/meraki-mx60.dts b/target/linux/apm821xx/dts/meraki-mx60.dts index 33f9a3d9f78719..0e343ed7825e2b 100644 --- a/target/linux/apm821xx/dts/meraki-mx60.dts +++ b/target/linux/apm821xx/dts/meraki-mx60.dts @@ -47,8 +47,6 @@ status = "okay"; nand { - nand-is-boot-medium; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; From 76cabb95da1994b84a373346c46e52ec836edfc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Wed, 12 Apr 2023 13:01:25 +0200 Subject: [PATCH 0082/1171] kernel: Backport mvneta crash fix to 5.15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport Russell King's series [1] net: mvneta: reduce size of TSO header allocation to pending-5.15 to fix random crashes on Turris Omnia. This also backports two patches that are dependencies to this series: net: mvneta: Delete unused variable net: mvneta: fix potential double-frees in mvneta_txq_sw_deinit() [1] https://lore.kernel.org/netdev/ZCsbJ4nG+So%2Fn9qY@shell.armlinux.org.uk/ Signed-off-by: Marek Behún Signed-off-by: Christian Lamparter (squashed) (cherry picked from commit 7b31c2e9ed4da7bfeecbd393c17c249eca870717) --- ...16-net-mvneta-Delete-unused-variable.patch | 62 ++++++ ...otential-double-frees-in-mvneta_txq_.patch | 37 ++++ ...transmit-path-dma-unmapping-on-error.patch | 111 +++++++++++ ...rk-mapped-and-tso-buffers-separately.patch | 42 ++++ ...uf-type-to-determine-whether-to-dma-.patch | 59 ++++++ ...tso_build_hdr-into-mvneta_tso_put_hd.patch | 65 +++++++ ...cate-TSO-header-DMA-memory-in-chunks.patch | 179 ++++++++++++++++++ .../700-mvneta-tx-queue-workaround.patch | 4 +- ...ethernet-marvell-mvnetaMQPrioOffload.patch | 4 +- ...xt-ethernet-marvell-mvnetaMQPrioFlag.patch | 2 +- ...t-ethernet-marvell-mvnetaMQPrioQueue.patch | 8 +- ...hernet-marvell-mvnetaMQPrioTCOffload.patch | 6 +- 12 files changed, 567 insertions(+), 12 deletions(-) create mode 100644 target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch create mode 100644 target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch create mode 100644 target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch create mode 100644 target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch create mode 100644 target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch create mode 100644 target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch create mode 100644 target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch diff --git a/target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch b/target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch new file mode 100644 index 00000000000000..421563ef08cf9d --- /dev/null +++ b/target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch @@ -0,0 +1,62 @@ +From 43ed6fff01333868a1d0e19876f67c22d9939952 Mon Sep 17 00:00:00 2001 +From: Yuval Shaia +Date: Wed, 13 Oct 2021 09:49:21 +0300 +Subject: [PATCH] net: mvneta: Delete unused variable + +The variable pp is not in use - delete it. + +Signed-off-by: Yuval Shaia +Link: https://lore.kernel.org/r/20211013064921.26346-1-yshaia@marvell.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/marvell/mvneta.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -1914,7 +1914,7 @@ static int mvneta_rx_refill(struct mvnet + } + + /* Handle tx checksum */ +-static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) ++static u32 mvneta_skb_tx_csum(struct sk_buff *skb) + { + if (skb->ip_summed == CHECKSUM_PARTIAL) { + int ip_hdr_len = 0; +@@ -2595,8 +2595,7 @@ err_drop_frame: + } + + static inline void +-mvneta_tso_put_hdr(struct sk_buff *skb, +- struct mvneta_port *pp, struct mvneta_tx_queue *txq) ++mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq) + { + int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; +@@ -2604,7 +2603,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb, + + tx_desc = mvneta_txq_next_desc_get(txq); + tx_desc->data_size = hdr_len; +- tx_desc->command = mvneta_skb_tx_csum(pp, skb); ++ tx_desc->command = mvneta_skb_tx_csum(skb); + tx_desc->command |= MVNETA_TXD_F_DESC; + tx_desc->buf_phys_addr = txq->tso_hdrs_phys + + txq->txq_put_index * TSO_HEADER_SIZE; +@@ -2681,7 +2680,7 @@ static int mvneta_tx_tso(struct sk_buff + hdr = txq->tso_hdrs + txq->txq_put_index * TSO_HEADER_SIZE; + tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0); + +- mvneta_tso_put_hdr(skb, pp, txq); ++ mvneta_tso_put_hdr(skb, txq); + + while (data_left > 0) { + int size; +@@ -2799,7 +2798,7 @@ static netdev_tx_t mvneta_tx(struct sk_b + /* Get a descriptor for the first part of the packet */ + tx_desc = mvneta_txq_next_desc_get(txq); + +- tx_cmd = mvneta_skb_tx_csum(pp, skb); ++ tx_cmd = mvneta_skb_tx_csum(skb); + + tx_desc->data_size = skb_headlen(skb); + diff --git a/target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch b/target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch new file mode 100644 index 00000000000000..a16e68ee4fd9c5 --- /dev/null +++ b/target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch @@ -0,0 +1,37 @@ +From 0cf39c6543469aae4a30cba354243125514ed568 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Wed, 29 Mar 2023 13:11:17 +0100 +Subject: [PATCH] net: mvneta: fix potential double-frees in + mvneta_txq_sw_deinit() + +Reported on the Turris forum, mvneta provokes kernel warnings in the +architecture DMA mapping code when mvneta_setup_txqs() fails to +allocate memory. This happens because when mvneta_cleanup_txqs() is +called in the mvneta_stop() path, we leave pointers in the structure +that have been freed. + +Then on mvneta_open(), we call mvneta_setup_txqs(), which starts +allocating memory. On memory allocation failure, mvneta_cleanup_txqs() +will walk all the queues freeing any non-NULL pointers - which includes +pointers that were previously freed in mvneta_stop(). + +Fix this by setting these pointers to NULL to prevent double-freeing +of the same memory. + +Link: https://forum.turris.cz/t/random-kernel-exceptions-on-hbl-tos-7-0/18865/8 +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -3481,6 +3481,8 @@ static void mvneta_txq_sw_deinit(struct + + netdev_tx_reset_queue(nq); + ++ txq->buf = NULL; ++ txq->tso_hdrs = NULL; + txq->descs = NULL; + txq->last_desc = 0; + txq->next_desc_to_proc = 0; diff --git a/target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch b/target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch new file mode 100644 index 00000000000000..287728ba1df5f7 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch @@ -0,0 +1,111 @@ +From d6d80269cf5c79f9dfe7d69f8b41a72015c89748 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:20 +0100 +Subject: [PATCH 1/5] net: mvneta: fix transmit path dma-unmapping on error + +The transmit code assumes that the transmit descriptors that are used +begin with the first descriptor in the ring, but this may not be the +case. Fix this by providing a new function that dma-unmaps a range of +numbered descriptor entries, and use that to do the unmapping. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 53 +++++++++++++++++---------- + 1 file changed, 33 insertions(+), 20 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -2647,14 +2647,40 @@ mvneta_tso_put_data(struct net_device *d + return 0; + } + ++static void mvneta_release_descs(struct mvneta_port *pp, ++ struct mvneta_tx_queue *txq, ++ int first, int num) ++{ ++ int desc_idx, i; ++ ++ desc_idx = first + num; ++ if (desc_idx >= txq->size) ++ desc_idx -= txq->size; ++ ++ for (i = num; i >= 0; i--) { ++ struct mvneta_tx_desc *tx_desc = txq->descs + desc_idx; ++ ++ if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) ++ dma_unmap_single(pp->dev->dev.parent, ++ tx_desc->buf_phys_addr, ++ tx_desc->data_size, ++ DMA_TO_DEVICE); ++ ++ mvneta_txq_desc_put(txq); ++ ++ if (desc_idx == 0) ++ desc_idx = txq->size; ++ desc_idx -= 1; ++ } ++} ++ + static int mvneta_tx_tso(struct sk_buff *skb, struct net_device *dev, + struct mvneta_tx_queue *txq) + { + int hdr_len, total_len, data_left; +- int desc_count = 0; ++ int first_desc, desc_count = 0; + struct mvneta_port *pp = netdev_priv(dev); + struct tso_t tso; +- int i; + + /* Count needed descriptors */ + if ((txq->count + tso_count_descs(skb)) >= txq->size) +@@ -2665,6 +2691,8 @@ static int mvneta_tx_tso(struct sk_buff + return 0; + } + ++ first_desc = txq->txq_put_index; ++ + /* Initialize the TSO handler, and prepare the first payload */ + hdr_len = tso_start(skb, &tso); + +@@ -2705,15 +2733,7 @@ err_release: + /* Release all used data descriptors; header descriptors must not + * be DMA-unmapped. + */ +- for (i = desc_count - 1; i >= 0; i--) { +- struct mvneta_tx_desc *tx_desc = txq->descs + i; +- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) +- dma_unmap_single(pp->dev->dev.parent, +- tx_desc->buf_phys_addr, +- tx_desc->data_size, +- DMA_TO_DEVICE); +- mvneta_txq_desc_put(txq); +- } ++ mvneta_release_descs(pp, txq, first_desc, desc_count - 1); + return 0; + } + +@@ -2723,6 +2743,7 @@ static int mvneta_tx_frag_process(struct + { + struct mvneta_tx_desc *tx_desc; + int i, nr_frags = skb_shinfo(skb)->nr_frags; ++ int first_desc = txq->txq_put_index; + + for (i = 0; i < nr_frags; i++) { + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; +@@ -2761,15 +2782,7 @@ error: + /* Release all descriptors that were used to map fragments of + * this packet, as well as the corresponding DMA mappings + */ +- for (i = i - 1; i >= 0; i--) { +- tx_desc = txq->descs + i; +- dma_unmap_single(pp->dev->dev.parent, +- tx_desc->buf_phys_addr, +- tx_desc->data_size, +- DMA_TO_DEVICE); +- mvneta_txq_desc_put(txq); +- } +- ++ mvneta_release_descs(pp, txq, first_desc, i - 1); + return -ENOMEM; + } + diff --git a/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch b/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch new file mode 100644 index 00000000000000..4db3ffe4e149d4 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch @@ -0,0 +1,42 @@ +From e3c77d0a1b635d114c147fd2078afb57ed558b81 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:25 +0100 +Subject: [PATCH 2/5] net: mvneta: mark mapped and tso buffers separately + +Mark dma-mapped skbs and TSO buffers separately, so we can use +buf->type to identify their differences. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -607,6 +607,7 @@ struct mvneta_rx_desc { + #endif + + enum mvneta_tx_buf_type { ++ MVNETA_TYPE_TSO, + MVNETA_TYPE_SKB, + MVNETA_TYPE_XDP_TX, + MVNETA_TYPE_XDP_NDO, +@@ -1852,7 +1853,8 @@ static void mvneta_txq_bufs_free(struct + dma_unmap_single(pp->dev->dev.parent, + tx_desc->buf_phys_addr, + tx_desc->data_size, DMA_TO_DEVICE); +- if (buf->type == MVNETA_TYPE_SKB && buf->skb) { ++ if ((buf->type == MVNETA_TYPE_TSO || ++ buf->type == MVNETA_TYPE_SKB) && buf->skb) { + bytes_compl += buf->skb->len; + pkts_compl++; + dev_kfree_skb_any(buf->skb); +@@ -2607,7 +2609,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb, + tx_desc->command |= MVNETA_TXD_F_DESC; + tx_desc->buf_phys_addr = txq->tso_hdrs_phys + + txq->txq_put_index * TSO_HEADER_SIZE; +- buf->type = MVNETA_TYPE_SKB; ++ buf->type = MVNETA_TYPE_TSO; + buf->skb = NULL; + + mvneta_txq_inc_put(txq); diff --git a/target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch b/target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch new file mode 100644 index 00000000000000..37511ff1dd75e4 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch @@ -0,0 +1,59 @@ +From fe2abc1abc0dfc6c13fe8f189216f00dbbb33044 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:30 +0100 +Subject: [PATCH 3/5] net: mvneta: use buf->type to determine whether to + dma-unmap + +Now that we use a different buffer type for TSO headers, we can use +buf->type to determine whether the original buffer was DMA-mapped or +not. The rules are: + + MVNETA_TYPE_XDP_TX - from a DMA pool, no unmap is required + MVNETA_TYPE_XDP_NDO - dma_map_single()'d + MVNETA_TYPE_SKB - normal skbuff, dma_map_single()'d + MVNETA_TYPE_TSO - from the TSO buffer area + +This means we only need to call dma_unmap_single() on the XDP_NDO and +SKB types of buffer, and we no longer need the private IS_TSO_HEADER() +which relies on the TSO region being contiguously allocated. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -334,10 +334,6 @@ + MVNETA_SKB_HEADROOM)) + #define MVNETA_MAX_RX_BUF_SIZE (PAGE_SIZE - MVNETA_SKB_PAD) + +-#define IS_TSO_HEADER(txq, addr) \ +- ((addr >= txq->tso_hdrs_phys) && \ +- (addr < txq->tso_hdrs_phys + txq->size * TSO_HEADER_SIZE)) +- + #define MVNETA_RX_GET_BM_POOL_ID(rxd) \ + (((rxd)->status & MVNETA_RXD_BM_POOL_MASK) >> MVNETA_RXD_BM_POOL_SHIFT) + +@@ -1848,8 +1844,8 @@ static void mvneta_txq_bufs_free(struct + + mvneta_txq_inc_get(txq); + +- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr) && +- buf->type != MVNETA_TYPE_XDP_TX) ++ if (buf->type == MVNETA_TYPE_XDP_NDO || ++ buf->type == MVNETA_TYPE_SKB) + dma_unmap_single(pp->dev->dev.parent, + tx_desc->buf_phys_addr, + tx_desc->data_size, DMA_TO_DEVICE); +@@ -2661,8 +2657,9 @@ static void mvneta_release_descs(struct + + for (i = num; i >= 0; i--) { + struct mvneta_tx_desc *tx_desc = txq->descs + desc_idx; ++ struct mvneta_tx_buf *buf = &txq->buf[desc_idx]; + +- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) ++ if (buf->type == MVNETA_TYPE_SKB) + dma_unmap_single(pp->dev->dev.parent, + tx_desc->buf_phys_addr, + tx_desc->data_size, diff --git a/target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch b/target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch new file mode 100644 index 00000000000000..444b60f15166d0 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch @@ -0,0 +1,65 @@ +From 210ca75d4949f1ace8ea53a75148806cc28224a0 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:35 +0100 +Subject: [PATCH 4/5] net: mvneta: move tso_build_hdr() into + mvneta_tso_put_hdr() + +Move tso_build_hdr() into mvneta_tso_put_hdr() so that all the TSO +header building code is in one place. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -2592,19 +2592,24 @@ err_drop_frame: + return rx_done; + } + +-static inline void +-mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq) ++static void mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq, ++ struct tso_t *tso, int size, bool is_last) + { +- int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); ++ int tso_offset, hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; + struct mvneta_tx_desc *tx_desc; ++ char *hdr; ++ ++ tso_offset = txq->txq_put_index * TSO_HEADER_SIZE; ++ ++ hdr = txq->tso_hdrs + tso_offset; ++ tso_build_hdr(skb, hdr, tso, size, is_last); + + tx_desc = mvneta_txq_next_desc_get(txq); + tx_desc->data_size = hdr_len; + tx_desc->command = mvneta_skb_tx_csum(skb); + tx_desc->command |= MVNETA_TXD_F_DESC; +- tx_desc->buf_phys_addr = txq->tso_hdrs_phys + +- txq->txq_put_index * TSO_HEADER_SIZE; ++ tx_desc->buf_phys_addr = txq->tso_hdrs_phys + tso_offset; + buf->type = MVNETA_TYPE_TSO; + buf->skb = NULL; + +@@ -2697,17 +2702,12 @@ static int mvneta_tx_tso(struct sk_buff + + total_len = skb->len - hdr_len; + while (total_len > 0) { +- char *hdr; +- + data_left = min_t(int, skb_shinfo(skb)->gso_size, total_len); + total_len -= data_left; + desc_count++; + + /* prepare packet headers: MAC + IP + TCP */ +- hdr = txq->tso_hdrs + txq->txq_put_index * TSO_HEADER_SIZE; +- tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0); +- +- mvneta_tso_put_hdr(skb, txq); ++ mvneta_tso_put_hdr(skb, txq, &tso, data_left, total_len == 0); + + while (data_left > 0) { + int size; diff --git a/target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch b/target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch new file mode 100644 index 00000000000000..395a0bf5d2b8d4 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch @@ -0,0 +1,179 @@ +From 58d50fb089da553023df5a05f5ae86feaacc7f24 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:40 +0100 +Subject: [PATCH 5/5] net: mvneta: allocate TSO header DMA memory in chunks + +Now that we no longer need to check whether the DMA address is within +the TSO header DMA memory range for the queue, we can allocate the TSO +header DMA memory in chunks rather than one contiguous order-6 chunk, +which can stress the kernel's memory subsystems to allocate. + +Instead, use order-1 (8k) allocations, which will result in 32 order-1 +pages containing 32 TSO headers. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 88 +++++++++++++++++++++------ + 1 file changed, 70 insertions(+), 18 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -314,6 +314,15 @@ + + #define MVNETA_MAX_SKB_DESCS (MVNETA_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS) + ++/* The size of a TSO header page */ ++#define MVNETA_TSO_PAGE_SIZE (2 * PAGE_SIZE) ++ ++/* Number of TSO headers per page. This should be a power of 2 */ ++#define MVNETA_TSO_PER_PAGE (MVNETA_TSO_PAGE_SIZE / TSO_HEADER_SIZE) ++ ++/* Maximum number of TSO header pages */ ++#define MVNETA_MAX_TSO_PAGES (MVNETA_MAX_TXD / MVNETA_TSO_PER_PAGE) ++ + /* descriptor aligned size */ + #define MVNETA_DESC_ALIGNED_SIZE 32 + +@@ -656,10 +665,10 @@ struct mvneta_tx_queue { + int next_desc_to_proc; + + /* DMA buffers for TSO headers */ +- char *tso_hdrs; ++ char *tso_hdrs[MVNETA_MAX_TSO_PAGES]; + + /* DMA address of TSO headers */ +- dma_addr_t tso_hdrs_phys; ++ dma_addr_t tso_hdrs_phys[MVNETA_MAX_TSO_PAGES]; + + /* Affinity mask for CPUs*/ + cpumask_t affinity_mask; +@@ -2592,24 +2601,71 @@ err_drop_frame: + return rx_done; + } + ++static void mvneta_free_tso_hdrs(struct mvneta_port *pp, ++ struct mvneta_tx_queue *txq) ++{ ++ struct device *dev = pp->dev->dev.parent; ++ int i; ++ ++ for (i = 0; i < MVNETA_MAX_TSO_PAGES; i++) { ++ if (txq->tso_hdrs[i]) { ++ dma_free_coherent(dev, MVNETA_TSO_PAGE_SIZE, ++ txq->tso_hdrs[i], ++ txq->tso_hdrs_phys[i]); ++ txq->tso_hdrs[i] = NULL; ++ } ++ } ++} ++ ++static int mvneta_alloc_tso_hdrs(struct mvneta_port *pp, ++ struct mvneta_tx_queue *txq) ++{ ++ struct device *dev = pp->dev->dev.parent; ++ int i, num; ++ ++ num = DIV_ROUND_UP(txq->size, MVNETA_TSO_PER_PAGE); ++ for (i = 0; i < num; i++) { ++ txq->tso_hdrs[i] = dma_alloc_coherent(dev, MVNETA_TSO_PAGE_SIZE, ++ &txq->tso_hdrs_phys[i], ++ GFP_KERNEL); ++ if (!txq->tso_hdrs[i]) { ++ mvneta_free_tso_hdrs(pp, txq); ++ return -ENOMEM; ++ } ++ } ++ ++ return 0; ++} ++ ++static char *mvneta_get_tso_hdr(struct mvneta_tx_queue *txq, dma_addr_t *dma) ++{ ++ int index, offset; ++ ++ index = txq->txq_put_index / MVNETA_TSO_PER_PAGE; ++ offset = (txq->txq_put_index % MVNETA_TSO_PER_PAGE) * TSO_HEADER_SIZE; ++ ++ *dma = txq->tso_hdrs_phys[index] + offset; ++ ++ return txq->tso_hdrs[index] + offset; ++} ++ + static void mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq, + struct tso_t *tso, int size, bool is_last) + { +- int tso_offset, hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); ++ int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; + struct mvneta_tx_desc *tx_desc; ++ dma_addr_t hdr_phys; + char *hdr; + +- tso_offset = txq->txq_put_index * TSO_HEADER_SIZE; +- +- hdr = txq->tso_hdrs + tso_offset; ++ hdr = mvneta_get_tso_hdr(txq, &hdr_phys); + tso_build_hdr(skb, hdr, tso, size, is_last); + + tx_desc = mvneta_txq_next_desc_get(txq); + tx_desc->data_size = hdr_len; + tx_desc->command = mvneta_skb_tx_csum(skb); + tx_desc->command |= MVNETA_TXD_F_DESC; +- tx_desc->buf_phys_addr = txq->tso_hdrs_phys + tso_offset; ++ tx_desc->buf_phys_addr = hdr_phys; + buf->type = MVNETA_TYPE_TSO; + buf->skb = NULL; + +@@ -3401,7 +3457,7 @@ static void mvneta_rxq_deinit(struct mvn + static int mvneta_txq_sw_init(struct mvneta_port *pp, + struct mvneta_tx_queue *txq) + { +- int cpu; ++ int cpu, err; + + txq->size = pp->tx_ring_size; + +@@ -3426,11 +3482,9 @@ static int mvneta_txq_sw_init(struct mvn + return -ENOMEM; + + /* Allocate DMA buffers for TSO MAC/IP/TCP headers */ +- txq->tso_hdrs = dma_alloc_coherent(pp->dev->dev.parent, +- txq->size * TSO_HEADER_SIZE, +- &txq->tso_hdrs_phys, GFP_KERNEL); +- if (!txq->tso_hdrs) +- return -ENOMEM; ++ err = mvneta_alloc_tso_hdrs(pp, txq); ++ if (err) ++ return err; + + /* Setup XPS mapping */ + if (pp->neta_armada3700) +@@ -3482,10 +3536,7 @@ static void mvneta_txq_sw_deinit(struct + + kfree(txq->buf); + +- if (txq->tso_hdrs) +- dma_free_coherent(pp->dev->dev.parent, +- txq->size * TSO_HEADER_SIZE, +- txq->tso_hdrs, txq->tso_hdrs_phys); ++ mvneta_free_tso_hdrs(pp, txq); + if (txq->descs) + dma_free_coherent(pp->dev->dev.parent, + txq->size * MVNETA_DESC_ALIGNED_SIZE, +@@ -3494,7 +3545,6 @@ static void mvneta_txq_sw_deinit(struct + netdev_tx_reset_queue(nq); + + txq->buf = NULL; +- txq->tso_hdrs = NULL; + txq->descs = NULL; + txq->last_desc = 0; + txq->next_desc_to_proc = 0; +@@ -5543,6 +5593,8 @@ static int __init mvneta_driver_init(voi + { + int ret; + ++ BUILD_BUG_ON_NOT_POWER_OF_2(MVNETA_TSO_PER_PAGE); ++ + ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "net/mvneta:online", + mvneta_cpu_online, + mvneta_cpu_down_prepare); diff --git a/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch b/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch index 826f95d1c2ceef..32e8ef4b7d8727 100644 --- a/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch +++ b/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -4943,6 +4943,16 @@ static int mvneta_setup_tc(struct net_de +@@ -5006,6 +5006,16 @@ static int mvneta_setup_tc(struct net_de } } @@ -26,7 +26,7 @@ Signed-off-by: Felix Fietkau static const struct net_device_ops mvneta_netdev_ops = { .ndo_open = mvneta_open, .ndo_stop = mvneta_stop, -@@ -4953,6 +4963,9 @@ static const struct net_device_ops mvnet +@@ -5016,6 +5026,9 @@ static const struct net_device_ops mvnet .ndo_fix_features = mvneta_fix_features, .ndo_get_stats64 = mvneta_get_stats64, .ndo_eth_ioctl = mvneta_ioctl, diff --git a/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch b/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch index c3a6d9f4d06b45..019b9528c360e5 100644 --- a/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch +++ b/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include /* Registers */ -@@ -4903,14 +4904,14 @@ static void mvneta_setup_rx_prio_map(str +@@ -4966,14 +4967,14 @@ static void mvneta_setup_rx_prio_map(str } static int mvneta_setup_mqprio(struct net_device *dev, @@ -44,7 +44,7 @@ Signed-off-by: David S. Miller if (num_tc > rxq_number) return -EINVAL; -@@ -4921,13 +4922,15 @@ static int mvneta_setup_mqprio(struct ne +@@ -4984,13 +4985,15 @@ static int mvneta_setup_mqprio(struct ne return 0; } diff --git a/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch b/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch index 8ef585be9a1224..c878a288439216 100644 --- a/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch +++ b/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -4910,7 +4910,9 @@ static int mvneta_setup_mqprio(struct ne +@@ -4973,7 +4973,9 @@ static int mvneta_setup_mqprio(struct ne u8 num_tc; int i; diff --git a/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch b/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch index 196b986541e976..546a8486ef0588 100644 --- a/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch +++ b/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch @@ -22,7 +22,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -493,7 +493,6 @@ struct mvneta_port { +@@ -498,7 +498,6 @@ struct mvneta_port { u8 mcast_count[256]; u16 tx_ring_size; u16 rx_ring_size; @@ -30,7 +30,7 @@ Signed-off-by: David S. Miller phy_interface_t phy_interface; struct device_node *dn; -@@ -4892,13 +4891,12 @@ static void mvneta_clear_rx_prio_map(str +@@ -4955,13 +4954,12 @@ static void mvneta_clear_rx_prio_map(str mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, 0); } @@ -48,7 +48,7 @@ Signed-off-by: David S. Miller mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, val); } -@@ -4907,8 +4905,8 @@ static int mvneta_setup_mqprio(struct ne +@@ -4970,8 +4968,8 @@ static int mvneta_setup_mqprio(struct ne struct tc_mqprio_qopt_offload *mqprio) { struct mvneta_port *pp = netdev_priv(dev); @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller if (mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS) return 0; -@@ -4918,21 +4916,28 @@ static int mvneta_setup_mqprio(struct ne +@@ -4981,21 +4979,28 @@ static int mvneta_setup_mqprio(struct ne if (num_tc > rxq_number) return -EINVAL; diff --git a/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch b/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch index d640da4d4490e4..1d4a055a71938e 100644 --- a/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch +++ b/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch @@ -62,7 +62,7 @@ Signed-off-by: David S. Miller #define MVNETA_LPI_CTRL_0 0x2cc0 #define MVNETA_LPI_CTRL_1 0x2cc4 #define MVNETA_LPI_REQUEST_ENABLE BIT(0) -@@ -4901,11 +4928,74 @@ static void mvneta_map_vlan_prio_to_rxq( +@@ -4964,11 +4991,74 @@ static void mvneta_map_vlan_prio_to_rxq( mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, val); } @@ -138,7 +138,7 @@ Signed-off-by: David S. Miller u8 num_tc; if (mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS) -@@ -4919,6 +5009,7 @@ static int mvneta_setup_mqprio(struct ne +@@ -4982,6 +5072,7 @@ static int mvneta_setup_mqprio(struct ne mvneta_clear_rx_prio_map(pp); if (!num_tc) { @@ -146,7 +146,7 @@ Signed-off-by: David S. Miller netdev_reset_tc(dev); return 0; } -@@ -4939,6 +5030,33 @@ static int mvneta_setup_mqprio(struct ne +@@ -5002,6 +5093,33 @@ static int mvneta_setup_mqprio(struct ne } } From ef1effdefcac0b9a84cdbe47bc44fe5dfa5c96c6 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Wed, 17 May 2023 17:12:18 -0600 Subject: [PATCH 0083/1171] x86/64: Enable IOMMU_V2 support for later CPUs Support newer IOMMU_V2 on AMD platforms, useful for DPDK and KVM. Signed-off-by: Philip Prindeville (cherry picked from commit 1eb02ce3254ef6f115640df8ac470574d6903588) --- target/linux/x86/64/config-5.15 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index a20891ea55f4fc..d972668e543fbc 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -42,7 +42,7 @@ CONFIG_AGP_INTEL=y # CONFIG_AGP_SIS is not set # CONFIG_AGP_VIA is not set CONFIG_AMD_IOMMU=y -# CONFIG_AMD_IOMMU_V2 is not set +CONFIG_AMD_IOMMU_V2=y # CONFIG_AMD_PMC is not set # CONFIG_AMD_PTDMA is not set # CONFIG_AMD_SFH_HID is not set From b99b89da52df3cdc052d24bce8b863f747a43bab Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Mon, 29 May 2023 18:17:38 +0100 Subject: [PATCH 0084/1171] netfilter: fix typo in kmod-nft-dup-inet Fix typo of 'family' in a7e9445975 Signed-off-by: Kevin Darbyshire-Bryant (cherry picked from commit 191742eb8ddc4353eedf71a327fb17a11c5a3a99) --- package/kernel/linux/modules/netfilter.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index e6dc400b30aad8..5bd1bfbbc724c9 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1149,7 +1149,7 @@ $(eval $(call KernelPackage,nft-bridge)) define KernelPackage/nft-dup-inet SUBMENU:=$(NF_MENU) - TITLE:=Netfilter nf_tables dup in ip/ip6/inet familly support + TITLE:=Netfilter nf_tables dup in ip/ip6/inet family support DEPENDS:=+kmod-nft-core +kmod-nf-conntrack +IPV6:kmod-nf-conntrack6 KCONFIG:= \ CONFIG_NF_DUP_IPV4 \ From a48d0bdb77eb93f7fba6e055dace125c72755b6a Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 1 Jun 2023 15:22:26 +0800 Subject: [PATCH 0085/1171] openssl: fix uci config for built-in engines Built-in engine configs are added in libopenssl-conf/install stage already, postinst/add_engine_config is just duplicating them, and due to the lack of `config` header it results a broken uci config: > uci: Parse error (invalid command) at line 3, byte 0 ``` config engine 'devcrypto' option enabled '1' engine 'devcrypto' option enabled '1' option builtin '1' ``` Add `builtin` option in libopenssl-conf/install stage and remove duplicate engine configuration in postinst/add_engine_config to fix this issue. Fixes: 0b70d55a64c39d ("openssl: make UCI config aware of built-in engines") Signed-off-by: Tianling Shen (cherry picked from commit a0d71934253f599f4ac651b1b3a429901049e802) --- package/libs/openssl/Makefile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index bd1cfed447b93a..66ababab3c731f 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_VERSION:=3.0.8 -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_BUILD_FLAGS:=no-mips16 gc-sections PKG_BUILD_PARALLEL:=1 @@ -141,7 +141,6 @@ endef ifneq ($(CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK)$(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),) define Package/libopenssl-conf/postinst #!/bin/sh -OPENSSL_UCI="$${IPKG_INSTROOT}/etc/config/openssl" add_engine_config() { if [ -z "$${IPKG_INSTROOT}" ] && uci -q get "openssl.$$1" >/dev/null; then @@ -149,12 +148,6 @@ add_engine_config() { uci set "openssl.$$1.builtin=1" && uci commit openssl return fi - { - echo "engine '$$1'" - echo " option enabled '1'" - echo " option builtin '1'" - echo - } >>"$${OPENSSL_UCI}" } $(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),add_engine_config devcrypto) @@ -424,10 +417,10 @@ define Package/libopenssl-conf/install touch $(1)/etc/config/openssl $(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO), $(CP) ./files/devcrypto.cnf $(1)/etc/ssl/modules.cnf.d/ - echo -e "config engine 'devcrypto'\n\toption enabled '1'" >> $(1)/etc/config/openssl) + echo -e "config engine 'devcrypto'\n\toption enabled '1'\n\toption builtin '1'" >> $(1)/etc/config/openssl) $(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK), $(CP) ./files/padlock.cnf $(1)/etc/ssl/modules.cnf.d/ - echo -e "\nconfig engine 'padlock'\n\toption enabled '1'" >> $(1)/etc/config/openssl) + echo -e "\nconfig engine 'padlock'\n\toption enabled '1'\n\toption builtin '1'" >> $(1)/etc/config/openssl) endef define Package/openssl-util/install From 91221d9e741abaad6c1342b24139ae72c24e28f4 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 3 Jun 2023 08:37:54 +0000 Subject: [PATCH 0086/1171] ramips: enable LED button for TP-Link EC330-G5u v1 The device already has LED push button (KEY_LIGHTS_TOGGLE) and exported GPIO control "led-light". This commit adds button handler script for switching on/off all device LEDs. Signed-off-by: Mikhail Zhilkin Signed-off-by: Christian Lamparter (cherry picked from commit d955b41275eaf93b7600f8eb7d706f40302f26c2) --- .../base-files/etc/rc.button/lights_toggle | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 target/linux/ramips/mt7621/base-files/etc/rc.button/lights_toggle diff --git a/target/linux/ramips/mt7621/base-files/etc/rc.button/lights_toggle b/target/linux/ramips/mt7621/base-files/etc/rc.button/lights_toggle new file mode 100755 index 00000000000000..c008b633a4e077 --- /dev/null +++ b/target/linux/ramips/mt7621/base-files/etc/rc.button/lights_toggle @@ -0,0 +1,16 @@ +#!/bin/sh + +[[ "${ACTION}" = "released" ]] || exit 0 + +. /lib/functions.sh + +case "$(board_name)" in +tplink,ec330-g5u-v1) + led_light="/sys/class/gpio/led-light/value" + echo "$((!$(cat $led_light)))" > "$led_light" +;; + *) +;; +esac + +return 0 From 2804fff57f01134bb992f1d1798e4d5af77d7112 Mon Sep 17 00:00:00 2001 From: Jitao Lu Date: Sun, 4 Jun 2023 13:54:01 +0800 Subject: [PATCH 0087/1171] oxnas: Enable CONFIG_CRYPTO_LZ4 Previously, CONFIG_LZ4_DECOMPRESS=y was selected by CONFIG_RD_LZ4 only. When building kernel for initramfs, CONFIG_RD_LZ4 will be unset by Kernel/SetInitramfs if the chosen compression method is not lz4, then CONFIG_LZ4_DECOMPRESS will become a *module* in the newly generated kernel config. However, the newly added module won't be built after 38c150612cc9be488527e342db92d5c74093213f, so packaging kmod-lib-lz4 fails due to missing lz4_decompress.ko. CONFIG_CRYPTO_LZ4=y makes CONFIG_LZ4_DECOMPRESS=y being selected w/o CONFIG_RD_LZ4, so that the modules of the default kernel and initramfs kernel are consistent. Fixes: #12766 Fixes: 38c150612cc ("build: revert 54070a1 (all kernels are >= 5.10)") Signed-off-by: Jitao Lu (cherry picked from commit cc87f6629b8a120420075cd984a4e6ece6c669df) --- target/linux/oxnas/config-5.15 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/oxnas/config-5.15 b/target/linux/oxnas/config-5.15 index cdb762a2a0dde6..9540a76774f5df 100644 --- a/target/linux/oxnas/config-5.15 +++ b/target/linux/oxnas/config-5.15 @@ -77,6 +77,7 @@ CONFIG_CRC16=y CONFIG_CRC32_SLICEBY8=y CONFIG_CROSS_MEMORY_ATTACH=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LZ4=y CONFIG_CRYPTO_RNG2=y CONFIG_DEBUG_ALIGN_RODATA=y CONFIG_DEBUG_BUGVERBOSE=y @@ -165,6 +166,7 @@ CONFIG_LEDS_TRIGGER_ONESHOT=y CONFIG_LIBFDT=y CONFIG_LOCALVERSION_AUTO=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LZ4_COMPRESS=y CONFIG_LZ4_DECOMPRESS=y CONFIG_LZO_DECOMPRESS=y # CONFIG_MACH_OX810SE is not set @@ -242,6 +244,7 @@ CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SERIO=y CONFIG_SERIO_LIBPS2=y CONFIG_SERIO_SERPORT=y +CONFIG_SGL_ALLOC=y CONFIG_SLUB_DEBUG=y CONFIG_SOCK_DIAG=y CONFIG_SPARSE_IRQ=y From 417b76b1f1ab00141f6554ba76cb59ec3b8b9d76 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 8 Jun 2023 03:23:53 +0200 Subject: [PATCH 0088/1171] generic: drop useless binfmt patch fixing compilation warning The compilation warning was triggered by wrongly set FRAME_WARN to 1024 even for 64bit. This was recently fix by correctly setting the FRAME_WARN to 2048 for 64bit systems. The compilation warning would still be triggered on 32bit system but the actual code is never reached as ARCH_USE_GNU_PROPERTY is only set on arm64 arch. Drop the patch as kmalloc cause perf regression as suggested by upstream maintainers. Fixes: fa79baf4a6e2 ("generic: copy backport, hack, pending patch and config from 5.15 to 6.1") Fixes: 5913ea1ba2fa ("generic: 5.15: add pending patch fixing binfmt compilation warning") Signed-off-by: Christian Marangi (cherry picked from commit 62338f41625074640a4de9e26e5e67b010fe0ebe) --- ...ically-allocate-note.data-in-parse_e.patch | 94 ------------------- 1 file changed, 94 deletions(-) delete mode 100644 target/linux/generic/pending-5.15/130-binfmt_elf-dynamically-allocate-note.data-in-parse_e.patch diff --git a/target/linux/generic/pending-5.15/130-binfmt_elf-dynamically-allocate-note.data-in-parse_e.patch b/target/linux/generic/pending-5.15/130-binfmt_elf-dynamically-allocate-note.data-in-parse_e.patch deleted file mode 100644 index f04007e982d025..00000000000000 --- a/target/linux/generic/pending-5.15/130-binfmt_elf-dynamically-allocate-note.data-in-parse_e.patch +++ /dev/null @@ -1,94 +0,0 @@ -From ca71e00839fcdd26f122fb6d9e97903c9fe198f7 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Sat, 6 May 2023 08:08:35 +0200 -Subject: [PATCH] binfmt_elf: dynamically allocate note.data in - parse_elf_properties - -Dynamically allocate note.data in parse_elf_properties to fix -compilation warning on some arch. - -On some arch note.data exceet the stack limit for a single function and -this cause the following compilation warning: -fs/binfmt_elf.c: In function 'parse_elf_properties.isra': -fs/binfmt_elf.c:821:1: error: the frame size of 1040 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] - 821 | } - | ^ -cc1: all warnings being treated as errors - -Fix this by dynamically allocating the array. - -Fixes: 00e19ceec80b ("ELF: Add ELF program property parsing support") -Signed-off-by: Christian Marangi -Cc: stable@vger.kernel.org # v5.8+ ---- - fs/binfmt_elf.c | 32 +++++++++++++++++++++++--------- - 1 file changed, 23 insertions(+), 9 deletions(-) - ---- a/fs/binfmt_elf.c -+++ b/fs/binfmt_elf.c -@@ -768,7 +768,7 @@ static int parse_elf_properties(struct f - { - union { - struct elf_note nhdr; -- char data[NOTE_DATA_SZ]; -+ char *data; - } note; - loff_t pos; - ssize_t n; -@@ -788,26 +788,38 @@ static int parse_elf_properties(struct f - if (phdr->p_filesz > sizeof(note)) - return -ENOEXEC; - -+ note.data = kcalloc(NOTE_DATA_SZ, sizeof(*note.data), GFP_KERNEL); -+ if (!note.data) -+ return -ENOMEM; -+ - pos = phdr->p_offset; - n = kernel_read(f, ¬e, phdr->p_filesz, &pos); - - BUILD_BUG_ON(sizeof(note) < sizeof(note.nhdr) + NOTE_NAME_SZ); -- if (n < 0 || n < sizeof(note.nhdr) + NOTE_NAME_SZ) -- return -EIO; -+ if (n < 0 || n < sizeof(note.nhdr) + NOTE_NAME_SZ) { -+ ret = -EIO; -+ goto exit; -+ } - - if (note.nhdr.n_type != NT_GNU_PROPERTY_TYPE_0 || - note.nhdr.n_namesz != NOTE_NAME_SZ || - strncmp(note.data + sizeof(note.nhdr), -- GNU_PROPERTY_TYPE_0_NAME, n - sizeof(note.nhdr))) -- return -ENOEXEC; -+ GNU_PROPERTY_TYPE_0_NAME, n - sizeof(note.nhdr))) { -+ ret = -ENOEXEC; -+ goto exit; -+ } - - off = round_up(sizeof(note.nhdr) + NOTE_NAME_SZ, - ELF_GNU_PROPERTY_ALIGN); -- if (off > n) -- return -ENOEXEC; -- -- if (note.nhdr.n_descsz > n - off) -- return -ENOEXEC; -+ if (off > n) { -+ ret = -ENOEXEC; -+ goto exit; -+ } -+ -+ if (note.nhdr.n_descsz > n - off) { -+ ret = -ENOEXEC; -+ goto exit; -+ } - datasz = off + note.nhdr.n_descsz; - - have_prev_type = false; -@@ -817,6 +829,8 @@ static int parse_elf_properties(struct f - have_prev_type = true; - } while (!ret); - -+exit: -+ kfree(note.data); - return ret == -ENOENT ? 0 : ret; - } - From ecfcc47f0ce5333eda3149ea2e3f1d2c25bd9455 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 30 May 2023 12:59:07 +0800 Subject: [PATCH 0089/1171] uboot-rockchip: add Orange Pi R1 Plus support Add support for the Xunlong Orange Pi R1 Plus. Manually generated of-platdata files to avoid swig dependency. Signed-off-by: Tianling Shen (cherry picked from commit 043f8a4f5ecf00e8a62b5a5d48baba48e620ea6a) --- package/boot/uboot-rockchip/Makefile | 8 + ...28-Add-support-for-Orange-Pi-R1-Plus.patch | 564 ++++++++++++++++++ .../orangepi-r1-plus-rk3328/dt-decl.h | 24 + .../orangepi-r1-plus-rk3328/dt-plat.c | 170 ++++++ .../orangepi-r1-plus-rk3328/dt-structs-gen.h | 55 ++ 5 files changed, 821 insertions(+) create mode 100644 package/boot/uboot-rockchip/patches/103-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus.patch create mode 100644 package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-decl.h create mode 100644 package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-plat.c create mode 100644 package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-structs-gen.h diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index bdd1f5d5d88674..126af6ac54c9ee 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -45,6 +45,13 @@ define U-Boot/nanopi-r2s-rk3328 friendlyarm_nanopi-r2s endef +define U-Boot/orangepi-r1-plus-rk3328 + $(U-Boot/rk3328/Default) + NAME:=Orange Pi R1 Plus + BUILD_DEVICES:= \ + xunlong_orangepi-r1-plus +endef + define U-Boot/roc-cc-rk3328 $(U-Boot/rk3328/Default) NAME:=ROC-RK3328-CC @@ -87,6 +94,7 @@ UBOOT_TARGETS := \ rockpro64-rk3399 \ nanopi-r2c-rk3328 \ nanopi-r2s-rk3328 \ + orangepi-r1-plus-rk3328 \ roc-cc-rk3328 UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes diff --git a/package/boot/uboot-rockchip/patches/103-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus.patch b/package/boot/uboot-rockchip/patches/103-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus.patch new file mode 100644 index 00000000000000..ff17559c2fe6b0 --- /dev/null +++ b/package/boot/uboot-rockchip/patches/103-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus.patch @@ -0,0 +1,564 @@ +From ff312af37d5f263f181468639aab83f645d331f1 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Sat, 20 May 2023 18:50:38 +0800 +Subject: [PATCH] rockchip: rk3328: Add support for Orange Pi R1 Plus + +Orange Pi R1 Plus is a Rockchip RK3328 based SBC by Xunlong. + +This device is similar to the NanoPi R2S, and has a 16MB +SPI NOR (mx25l12805d). The reset button is changed to +directly reset the power supply, another detail is that +both network ports have independent MAC addresses. + +The device tree and description are taken from kernel v6.3-rc1. + +Reviewed-by: Kever Yang +Signed-off-by: Tianling Shen +--- + arch/arm/dts/Makefile | 1 + + .../dts/rk3328-orangepi-r1-plus-u-boot.dtsi | 46 +++ + arch/arm/dts/rk3328-orangepi-r1-plus.dts | 373 ++++++++++++++++++ + board/rockchip/evb_rk3328/MAINTAINERS | 6 + + configs/orangepi-r1-plus-rk3328_defconfig | 114 ++++++ + 5 files changed, 540 insertions(+) + create mode 100644 arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi + create mode 100644 arch/arm/dts/rk3328-orangepi-r1-plus.dts + create mode 100644 configs/orangepi-r1-plus-rk3328_defconfig + +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -110,6 +110,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3328) += \ + rk3328-evb.dtb \ + rk3328-nanopi-r2c.dtb \ + rk3328-nanopi-r2s.dtb \ ++ rk3328-orangepi-r1-plus.dtb \ + rk3328-roc-cc.dtb \ + rk3328-rock64.dtb \ + rk3328-rock-pi-e.dtb +--- /dev/null ++++ b/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi +@@ -0,0 +1,46 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd ++ * (C) Copyright 2020 David Bauer ++ */ ++ ++#include "rk3328-u-boot.dtsi" ++#include "rk3328-sdram-ddr4-666.dtsi" ++/ { ++ chosen { ++ u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc; ++ }; ++}; ++ ++&gpio0 { ++ u-boot,dm-spl; ++}; ++ ++&pinctrl { ++ u-boot,dm-spl; ++}; ++ ++&sdmmc0m1_gpio { ++ u-boot,dm-spl; ++}; ++ ++&pcfg_pull_up_4ma { ++ u-boot,dm-spl; ++}; ++ ++/* Need this and all the pinctrl/gpio stuff above to set pinmux */ ++&vcc_sd { ++ u-boot,dm-spl; ++}; ++ ++&gmac2io { ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++}; ++ ++&spi0 { ++ spi_flash: spiflash@0 { ++ u-boot,dm-pre-reloc; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/dts/rk3328-orangepi-r1-plus.dts +@@ -0,0 +1,359 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Based on rk3328-nanopi-r2s.dts, which is: ++ * Copyright (c) 2020 David Bauer ++ */ ++ ++/dts-v1/; ++ ++#include ++#include ++#include "rk3328.dtsi" ++ ++/ { ++ model = "Xunlong Orange Pi R1 Plus"; ++ compatible = "xunlong,orangepi-r1-plus", "rockchip,rk3328"; ++ ++ aliases { ++ mmc0 = &sdmmc; ++ }; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ gmac_clk: gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "gmac_clkin"; ++ #clock-cells = <0>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; ++ pinctrl-names = "default"; ++ ++ led-0 { ++ function = LED_FUNCTION_LAN; ++ color = ; ++ gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led-1 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ led-2 { ++ function = LED_FUNCTION_WAN; ++ color = ; ++ gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ vcc_sd: sdmmc-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&sdmmc0m1_gpio>; ++ pinctrl-names = "default"; ++ regulator-name = "vcc_sd"; ++ regulator-boot-on; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vcc_sys: vcc-sys-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vdd_5v_lan: vdd-5v-lan-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; ++ pinctrl-0 = <&lan_vdd_pin>; ++ pinctrl-names = "default"; ++ regulator-name = "vdd_5v_lan"; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&display_subsystem { ++ status = "disabled"; ++}; ++ ++&gmac2io { ++ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; ++ assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; ++ clock_in_out = "input"; ++ phy-handle = <&rtl8211e>; ++ phy-mode = "rgmii"; ++ phy-supply = <&vcc_io>; ++ pinctrl-0 = <&rgmiim1_pins>; ++ pinctrl-names = "default"; ++ snps,aal; ++ rx_delay = <0x18>; ++ tx_delay = <0x24>; ++ status = "okay"; ++ ++ mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rtl8211e: ethernet-phy@1 { ++ reg = <1>; ++ pinctrl-0 = <ð_phy_reset_pin>; ++ pinctrl-names = "default"; ++ reset-assert-us = <10000>; ++ reset-deassert-us = <50000>; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: pmic@18 { ++ compatible = "rockchip,rk805"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk805-clkout2"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ pinctrl-0 = <&pmic_int_l>; ++ pinctrl-names = "default"; ++ rockchip,system-power-controller; ++ wakeup-source; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_sys>; ++ ++ regulators { ++ vdd_log: DCDC_REG1 { ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: DCDC_REG2 { ++ regulator-name = "vdd_arm"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: DCDC_REG4 { ++ regulator-name = "vcc_io"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: LDO_REG1 { ++ regulator-name = "vcc_18"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc18_emmc: LDO_REG2 { ++ regulator-name = "vcc18_emmc"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vdd_10: LDO_REG3 { ++ regulator-name = "vdd_10"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <1000000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&io_domains { ++ pmuio-supply = <&vcc_io>; ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_io>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_io>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ gmac2io { ++ eth_phy_reset_pin: eth-phy-reset-pin { ++ rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ leds { ++ lan_led_pin: lan-led-pin { ++ rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ sys_led_pin: sys-led-pin { ++ rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ wan_led_pin: wan-led-pin { ++ rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ lan { ++ lan_vdd_pin: lan-vdd-pin { ++ rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; ++ pinctrl-names = "default"; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ status = "okay"; ++ ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <50000000>; ++ }; ++}; ++ ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; ++ rockchip,hw-tshut-polarity = <0>; ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; +--- a/board/rockchip/evb_rk3328/MAINTAINERS ++++ b/board/rockchip/evb_rk3328/MAINTAINERS +@@ -18,6 +18,12 @@ F: configs/nanopi-r2s-rk3328_defcon + F: arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi + F: arch/arm/dts/rk3328-nanopi-r2s.dts + ++ORANGEPI-R1-PLUS-RK3328 ++M: Tianling Shen ++S: Maintained ++F: configs/orangepi-r1-plus-rk3328_defconfig ++F: arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi ++ + ROC-RK3328-CC + M: Loic Devulder + M: Chen-Yu Tsai +--- /dev/null ++++ b/configs/orangepi-r1-plus-rk3328_defconfig +@@ -0,0 +1,98 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_ROCKCHIP=y ++CONFIG_SYS_TEXT_BASE=0x00200000 ++CONFIG_SPL_GPIO_SUPPORT=y ++CONFIG_ENV_OFFSET=0x3F8000 ++CONFIG_ROCKCHIP_RK3328=y ++CONFIG_TPL_ROCKCHIP_COMMON_BOARD=y ++CONFIG_TPL_LIBCOMMON_SUPPORT=y ++CONFIG_TPL_LIBGENERIC_SUPPORT=y ++CONFIG_SPL_DRIVERS_MISC_SUPPORT=y ++CONFIG_SPL_STACK_R_ADDR=0x600000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEBUG_UART_BASE=0xFF130000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_SYSINFO=y ++CONFIG_DEBUG_UART=y ++CONFIG_TPL_SYS_MALLOC_F_LEN=0x800 ++# CONFIG_ANDROID_BOOT_IMAGE is not set ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y ++CONFIG_SPL_LOAD_FIT=y ++CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-orangepi-r1-plus.dtb" ++CONFIG_MISC_INIT_R=y ++# CONFIG_DISPLAY_CPUINFO is not set ++CONFIG_DISPLAY_BOARDINFO_LATE=y ++# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set ++CONFIG_TPL_SYS_MALLOC_SIMPLE=y ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_I2C_SUPPORT=y ++CONFIG_SPL_POWER_SUPPORT=y ++CONFIG_SPL_ATF=y ++CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_USB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TIME=y ++CONFIG_SPL_OF_CONTROL=y ++CONFIG_TPL_OF_CONTROL=y ++CONFIG_DEFAULT_DEVICE_TREE="rk3328-orangepi-r1-plus" ++CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" ++CONFIG_TPL_OF_PLATDATA=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_TPL_DM=y ++CONFIG_REGMAP=y ++CONFIG_SPL_REGMAP=y ++CONFIG_TPL_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_SPL_SYSCON=y ++CONFIG_TPL_SYSCON=y ++CONFIG_CLK=y ++CONFIG_SPL_CLK=y ++CONFIG_FASTBOOT_BUF_ADDR=0x800800 ++CONFIG_FASTBOOT_CMD_OEM_FORMAT=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_SF_DEFAULT_SPEED=20000000 ++CONFIG_DM_ETH=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_GMAC_ROCKCHIP=y ++CONFIG_PINCTRL=y ++CONFIG_SPL_PINCTRL=y ++CONFIG_DM_PMIC=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_SPL_DM_REGULATOR=y ++CONFIG_REGULATOR_PWM=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_SPL_DM_REGULATOR_FIXED=y ++CONFIG_REGULATOR_RK8XX=y ++CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM=y ++CONFIG_SPL_RAM=y ++CONFIG_TPL_RAM=y ++CONFIG_DM_RESET=y ++CONFIG_BAUDRATE=1500000 ++CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_SYSRESET=y ++# CONFIG_TPL_SYSRESET is not set ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y ++CONFIG_USB_OHCI_HCD=y ++CONFIG_USB_OHCI_GENERIC=y ++CONFIG_USB_DWC2=y ++CONFIG_USB_DWC3=y ++# CONFIG_USB_DWC3_GADGET is not set ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_SPL_TINY_MEMSET=y ++CONFIG_TPL_TINY_MEMSET=y ++CONFIG_ERRNO_STR=y diff --git a/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-decl.h b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-decl.h new file mode 100644 index 00000000000000..75795aa6cc7af2 --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-decl.h @@ -0,0 +1,24 @@ +/* + * DO NOT MODIFY + * + * Declares externs for all device/uclass instances. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +#include +#include + +/* driver declarations - these allow DM_DRIVER_GET() to be used */ +extern U_BOOT_DRIVER(rockchip_rk3328_cru); +extern U_BOOT_DRIVER(rockchip_rk3328_dmc); +extern U_BOOT_DRIVER(rockchip_rk3288_dw_mshc); +extern U_BOOT_DRIVER(ns16550_serial); +extern U_BOOT_DRIVER(rockchip_rk3328_spi); +extern U_BOOT_DRIVER(rockchip_rk3328_grf); + +/* uclass driver declarations - needed for DM_UCLASS_DRIVER_REF() */ +extern UCLASS_DRIVER(clk); +extern UCLASS_DRIVER(mmc); +extern UCLASS_DRIVER(ram); +extern UCLASS_DRIVER(serial); +extern UCLASS_DRIVER(syscon); diff --git a/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-plat.c b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-plat.c new file mode 100644 index 00000000000000..90656fc306d85a --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-plat.c @@ -0,0 +1,170 @@ +/* + * DO NOT MODIFY + * + * Declares the U_BOOT_DRIVER() records and platform data. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +/* Allow use of U_BOOT_DRVINFO() in this file */ +#define DT_PLAT_C + +#include +#include +#include + +/* + * driver_info declarations, ordered by 'struct driver_info' linker_list idx: + * + * idx driver_info driver + * --- -------------------- -------------------- + * 0: clock_controller_at_ff440000 rockchip_rk3328_cru + * 1: dmc rockchip_rk3328_dmc + * 2: mmc_at_ff500000 rockchip_rk3288_dw_mshc + * 3: serial_at_ff130000 ns16550_serial + * 4: spi_at_ff190000 rockchip_rk3328_spi + * 5: syscon_at_ff100000 rockchip_rk3328_grf + * --- -------------------- -------------------- + */ + +/* + * Node /clock-controller@ff440000 index 0 + * driver rockchip_rk3328_cru parent None + */ +static struct dtd_rockchip_rk3328_cru dtv_clock_controller_at_ff440000 = { + .reg = {0xff440000, 0x1000}, + .rockchip_grf = 0x38, +}; +U_BOOT_DRVINFO(clock_controller_at_ff440000) = { + .name = "rockchip_rk3328_cru", + .plat = &dtv_clock_controller_at_ff440000, + .plat_size = sizeof(dtv_clock_controller_at_ff440000), + .parent_idx = -1, +}; + +/* + * Node /dmc index 1 + * driver rockchip_rk3328_dmc parent None + */ +static struct dtd_rockchip_rk3328_dmc dtv_dmc = { + .reg = {0xff400000, 0x1000, 0xff780000, 0x3000, 0xff100000, 0x1000, 0xff440000, 0x1000, + 0xff720000, 0x1000, 0xff798000, 0x1000}, + .rockchip_sdram_params = {0x1, 0xa, 0x2, 0x1, 0x0, 0x0, 0x11, 0x0, + 0x11, 0x0, 0x0, 0x94291288, 0x0, 0x27, 0x462, 0x15, + 0x242, 0xff, 0x14d, 0x0, 0x1, 0x0, 0x0, 0x0, + 0x43049010, 0x64, 0x28003b, 0xd0, 0x20053, 0xd4, 0x220000, 0xd8, + 0x100, 0xdc, 0x40000, 0xe0, 0x0, 0xe4, 0x110000, 0xe8, + 0x420, 0xec, 0x400, 0xf4, 0xf011f, 0x100, 0x9060b06, 0x104, + 0x20209, 0x108, 0x505040a, 0x10c, 0x40400c, 0x110, 0x5030206, 0x114, + 0x3030202, 0x120, 0x3030b03, 0x124, 0x20208, 0x180, 0x1000040, 0x184, + 0x0, 0x190, 0x7030003, 0x198, 0x5001100, 0x1a0, 0xc0400003, 0x240, + 0x6000604, 0x244, 0x201, 0x250, 0xf00, 0x490, 0x1, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0x4, 0xc, 0x28, 0xa, 0x2c, + 0x0, 0x30, 0x9, 0xffffffff, 0xffffffff, 0x77, 0x88, 0x79, + 0x79, 0x87, 0x97, 0x87, 0x78, 0x77, 0x78, 0x87, + 0x88, 0x87, 0x87, 0x77, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x69, 0x9, 0x77, + 0x78, 0x77, 0x78, 0x77, 0x78, 0x77, 0x78, 0x77, + 0x79, 0x9, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x69, 0x9, 0x77, 0x78, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x79, 0x9, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x69, 0x9, 0x77, 0x78, 0x77, 0x78, 0x77, + 0x78, 0x77, 0x78, 0x77, 0x79, 0x9, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x69, + 0x9, 0x77, 0x78, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x79, 0x9}, +}; +U_BOOT_DRVINFO(dmc) = { + .name = "rockchip_rk3328_dmc", + .plat = &dtv_dmc, + .plat_size = sizeof(dtv_dmc), + .parent_idx = -1, +}; + +/* + * Node /mmc@ff500000 index 2 + * driver rockchip_rk3288_dw_mshc parent None + */ +static struct dtd_rockchip_rk3288_dw_mshc dtv_mmc_at_ff500000 = { + .bus_width = 0x4, + .cap_sd_highspeed = true, + .clocks = { + {0, {317}}, + {0, {33}}, + {0, {74}}, + {0, {78}},}, + .disable_wp = true, + .fifo_depth = 0x100, + .interrupts = {0x0, 0xc, 0x4}, + .max_frequency = 0x8f0d180, + .pinctrl_0 = {0x45, 0x46, 0x47, 0x48}, + .pinctrl_names = "default", + .reg = {0xff500000, 0x4000}, + .u_boot_spl_fifo_mode = true, + .vmmc_supply = 0x49, +}; +U_BOOT_DRVINFO(mmc_at_ff500000) = { + .name = "rockchip_rk3288_dw_mshc", + .plat = &dtv_mmc_at_ff500000, + .plat_size = sizeof(dtv_mmc_at_ff500000), + .parent_idx = -1, +}; + +/* + * Node /serial@ff130000 index 3 + * driver ns16550_serial parent None + */ +static struct dtd_ns16550_serial dtv_serial_at_ff130000 = { + .clock_frequency = 0x16e3600, + .clocks = { + {0, {40}}, + {0, {212}},}, + .dma_names = {"tx", "rx"}, + .dmas = {0x10, 0x6, 0x10, 0x7}, + .interrupts = {0x0, 0x39, 0x4}, + .pinctrl_0 = 0x24, + .pinctrl_names = "default", + .reg = {0xff130000, 0x100}, + .reg_io_width = 0x4, + .reg_shift = 0x2, +}; +U_BOOT_DRVINFO(serial_at_ff130000) = { + .name = "ns16550_serial", + .plat = &dtv_serial_at_ff130000, + .plat_size = sizeof(dtv_serial_at_ff130000), + .parent_idx = -1, +}; + +/* Node /spi@ff190000 index 4 */ +static struct dtd_rockchip_rk3328_spi dtv_spi_at_ff190000 = { + .clocks = { + {0, {32}}, + {0, {209}},}, + .dma_names = {"tx", "rx"}, + .dmas = {0x10, 0x8, 0x10, 0x9}, + .interrupts = {0x0, 0x31, 0x4}, + .pinctrl_0 = {0x2c, 0x2d, 0x2e, 0x2f}, + .pinctrl_names = "default", + .reg = {0xff190000, 0x1000}, +}; +U_BOOT_DRVINFO(spi_at_ff190000) = { + .name = "rockchip_rk3328_spi", + .plat = &dtv_spi_at_ff190000, + .plat_size = sizeof(dtv_spi_at_ff190000), + .parent_idx = -1, +}; + +/* + * Node /syscon@ff100000 index 5 + * driver rockchip_rk3328_grf parent None + */ +static struct dtd_rockchip_rk3328_grf dtv_syscon_at_ff100000 = { + .reg = {0xff100000, 0x1000}, +}; +U_BOOT_DRVINFO(syscon_at_ff100000) = { + .name = "rockchip_rk3328_grf", + .plat = &dtv_syscon_at_ff100000, + .plat_size = sizeof(dtv_syscon_at_ff100000), + .parent_idx = -1, +}; + diff --git a/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-structs-gen.h b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-structs-gen.h new file mode 100644 index 00000000000000..d09583153103cf --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-rk3328/dt-structs-gen.h @@ -0,0 +1,55 @@ +/* + * DO NOT MODIFY + * + * Defines the structs used to hold devicetree data. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +#include +#include +struct dtd_ns16550_serial { + fdt32_t clock_frequency; + struct phandle_1_arg clocks[2]; + const char * dma_names[2]; + fdt32_t dmas[4]; + fdt32_t interrupts[3]; + fdt32_t pinctrl_0; + const char * pinctrl_names; + fdt64_t reg[2]; + fdt32_t reg_io_width; + fdt32_t reg_shift; +}; +struct dtd_rockchip_rk3288_dw_mshc { + fdt32_t bus_width; + bool cap_sd_highspeed; + struct phandle_1_arg clocks[4]; + bool disable_wp; + fdt32_t fifo_depth; + fdt32_t interrupts[3]; + fdt32_t max_frequency; + fdt32_t pinctrl_0[4]; + const char * pinctrl_names; + fdt64_t reg[2]; + bool u_boot_spl_fifo_mode; + fdt32_t vmmc_supply; +}; +struct dtd_rockchip_rk3328_cru { + fdt64_t reg[2]; + fdt32_t rockchip_grf; +}; +struct dtd_rockchip_rk3328_dmc { + fdt64_t reg[12]; + fdt32_t rockchip_sdram_params[196]; +}; +struct dtd_rockchip_rk3328_grf { + fdt64_t reg[2]; +}; +struct dtd_rockchip_rk3328_spi { + struct phandle_1_arg clocks[2]; + const char * dma_names[2]; + fdt32_t dmas[4]; + fdt32_t interrupts[3]; + fdt32_t pinctrl_0[4]; + const char * pinctrl_names; + fdt64_t reg[2]; +}; From c11115b5cff2b67ee73da50d864e6443e7124812 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 30 May 2023 12:59:07 +0800 Subject: [PATCH 0090/1171] rockchip: add Orange Pi R1 Plus support Orange Pi R1 Plus is a Rockchip RK3328 based SBC by Xunlong. This device is similar to the NanoPi R2S, and has a 16MB SPI NOR (mx25l12805d). The reset button is changed to directly reset the power supply, another detail is that both network ports have independent MAC addresses. Note: booting from SPI is currently unsupported, you have to install the image on a SD card. Signed-off-by: Tianling Shen (cherry picked from commit ab641efe698f4412319fcbcfe6ffde64c929cd97) [Removed patches for kernel 6.1] Signed-off-by: Tianling Shen --- .../armv8/base-files/etc/board.d/01_leds | 3 +- .../armv8/base-files/etc/board.d/02_network | 6 +- .../etc/hotplug.d/net/40-net-smp-affinity | 3 +- target/linux/rockchip/image/armv8.mk | 9 + ...ockchip-rk3328-Add-Orange-Pi-R1-Plus.patch | 407 ++++++++++++++++++ ...ip-Update-LED-properties-for-Orange-.patch | 56 +++ ...ip-add-LED-configuration-to-Orange-P.patch | 24 ++ 7 files changed, 505 insertions(+), 3 deletions(-) create mode 100644 target/linux/rockchip/patches-5.15/007-v6.3-arm64-dts-rockchip-rk3328-Add-Orange-Pi-R1-Plus.patch create mode 100644 target/linux/rockchip/patches-5.15/107-arm64-dts-rockchip-Update-LED-properties-for-Orange-.patch create mode 100644 target/linux/rockchip/patches-5.15/108-arm64-dts-rockchip-add-LED-configuration-to-Orange-P.patch diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds index 2c9206b03ed85e..f0da262a094e36 100644 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds @@ -10,7 +10,8 @@ board_config_update case $board in friendlyarm,nanopi-r2c|\ friendlyarm,nanopi-r2s|\ -friendlyarm,nanopi-r4s) +friendlyarm,nanopi-r4s|\ +xunlong,orangepi-r1-plus) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth1" ;; diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network index 16ba01b7e313c8..f7e0da67b27144 100644 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network @@ -8,7 +8,8 @@ rockchip_setup_interfaces() case "$board" in friendlyarm,nanopi-r2s|\ - friendlyarm,nanopi-r4s) + friendlyarm,nanopi-r4s|\ + xunlong,orangepi-r1-plus) ucidef_set_interfaces_lan_wan 'eth1' 'eth0' ;; *) @@ -55,6 +56,9 @@ rockchip_setup_macs() wan_mac=$(nanopi_r4s_get_mac wan) lan_mac=$(nanopi_r4s_get_mac lan) ;; + xunlong,orangepi-r1-plus) + wan_mac=$(macaddr_add "$(cat /sys/class/net/eth1/address)" -1) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity index 3d1d99128ecfdc..660a7e286671bc 100644 --- a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity +++ b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity @@ -30,7 +30,8 @@ set_interface_core() { case "$(board_name)" in friendlyarm,nanopi-r2c|\ -friendlyarm,nanopi-r2s) +friendlyarm,nanopi-r2s|\ +xunlong,orangepi-r1-plus) set_interface_core 2 "eth0" set_interface_core 4 "eth1" "xhci-hcd:usb3" ;; diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index 601ddcbdd6b9aa..9a32a07b21aff0 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -60,3 +60,12 @@ define Device/radxa_rock-pi-4a IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata endef TARGET_DEVICES += radxa_rock-pi-4a + +define Device/xunlong_orangepi-r1-plus + DEVICE_VENDOR := Xunlong + DEVICE_MODEL := Orange Pi R1 Plus + SOC := rk3328 + IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata + DEVICE_PACKAGES := kmod-usb-net-rtl8152 +endef +TARGET_DEVICES += xunlong_orangepi-r1-plus diff --git a/target/linux/rockchip/patches-5.15/007-v6.3-arm64-dts-rockchip-rk3328-Add-Orange-Pi-R1-Plus.patch b/target/linux/rockchip/patches-5.15/007-v6.3-arm64-dts-rockchip-rk3328-Add-Orange-Pi-R1-Plus.patch new file mode 100644 index 00000000000000..053a4d0d8e27fa --- /dev/null +++ b/target/linux/rockchip/patches-5.15/007-v6.3-arm64-dts-rockchip-rk3328-Add-Orange-Pi-R1-Plus.patch @@ -0,0 +1,407 @@ +From 51712e1d014aaaa4c6e1e7e84932d58b5c0f59ed Mon Sep 17 00:00:00 2001 +From: Chukun Pan +Date: Sat, 3 Dec 2022 15:41:49 +0800 +Subject: [PATCH] arm64: dts: rockchip: rk3328: Add Orange Pi R1 Plus + +Orange Pi R1 Plus is a Rockchip RK3328 based SBC by Xunlong. + +This device is similar to the NanoPi R2S, and has a 16MB +SPI NOR (mx25l12805d). The reset button is changed to +directly reset the power supply, another detail is that +both network ports have independent MAC addresses. + +Signed-off-by: Chukun Pan +Link: https://lore.kernel.org/r/20221203074149.11543-3-amadeus@jmu.edu.cn +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + .../dts/rockchip/rk3328-orangepi-r1-plus.dts | 373 ++++++++++++++++++ + 2 files changed, 374 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts + +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -11,6 +11,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1 + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2c.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock-pi-e.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-roc-cc.dtb +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +@@ -0,0 +1,373 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Based on rk3328-nanopi-r2s.dts, which is: ++ * Copyright (c) 2020 David Bauer ++ */ ++ ++/dts-v1/; ++ ++#include ++#include ++#include "rk3328.dtsi" ++ ++/ { ++ model = "Xunlong Orange Pi R1 Plus"; ++ compatible = "xunlong,orangepi-r1-plus", "rockchip,rk3328"; ++ ++ aliases { ++ ethernet1 = &rtl8153; ++ mmc0 = &sdmmc; ++ }; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ gmac_clk: gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "gmac_clkin"; ++ #clock-cells = <0>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; ++ pinctrl-names = "default"; ++ ++ led-0 { ++ function = LED_FUNCTION_LAN; ++ color = ; ++ gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led-1 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ led-2 { ++ function = LED_FUNCTION_WAN; ++ color = ; ++ gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ vcc_sd: sdmmc-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&sdmmc0m1_pin>; ++ pinctrl-names = "default"; ++ regulator-name = "vcc_sd"; ++ regulator-boot-on; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vcc_sys: vcc-sys-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vdd_5v_lan: vdd-5v-lan-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; ++ pinctrl-0 = <&lan_vdd_pin>; ++ pinctrl-names = "default"; ++ regulator-name = "vdd_5v_lan"; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&display_subsystem { ++ status = "disabled"; ++}; ++ ++&gmac2io { ++ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; ++ assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; ++ clock_in_out = "input"; ++ phy-handle = <&rtl8211e>; ++ phy-mode = "rgmii"; ++ phy-supply = <&vcc_io>; ++ pinctrl-0 = <&rgmiim1_pins>; ++ pinctrl-names = "default"; ++ snps,aal; ++ rx_delay = <0x18>; ++ tx_delay = <0x24>; ++ status = "okay"; ++ ++ mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rtl8211e: ethernet-phy@1 { ++ reg = <1>; ++ pinctrl-0 = <ð_phy_reset_pin>; ++ pinctrl-names = "default"; ++ reset-assert-us = <10000>; ++ reset-deassert-us = <50000>; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: pmic@18 { ++ compatible = "rockchip,rk805"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk805-clkout2"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ pinctrl-0 = <&pmic_int_l>; ++ pinctrl-names = "default"; ++ rockchip,system-power-controller; ++ wakeup-source; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_sys>; ++ ++ regulators { ++ vdd_log: DCDC_REG1 { ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: DCDC_REG2 { ++ regulator-name = "vdd_arm"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: DCDC_REG4 { ++ regulator-name = "vcc_io"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: LDO_REG1 { ++ regulator-name = "vcc_18"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc18_emmc: LDO_REG2 { ++ regulator-name = "vcc18_emmc"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vdd_10: LDO_REG3 { ++ regulator-name = "vdd_10"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <1000000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&io_domains { ++ pmuio-supply = <&vcc_io>; ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_io>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_io>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ gmac2io { ++ eth_phy_reset_pin: eth-phy-reset-pin { ++ rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ leds { ++ lan_led_pin: lan-led-pin { ++ rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ sys_led_pin: sys-led-pin { ++ rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ wan_led_pin: wan-led-pin { ++ rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ lan { ++ lan_vdd_pin: lan-vdd-pin { ++ rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; ++ pinctrl-names = "default"; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ status = "okay"; ++ ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <50000000>; ++ }; ++}; ++ ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; ++ rockchip,hw-tshut-polarity = <0>; ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ dr_mode = "host"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ /* Second port is for USB 3.0 */ ++ rtl8153: device@2 { ++ compatible = "usbbda,8153"; ++ reg = <2>; ++ }; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; diff --git a/target/linux/rockchip/patches-5.15/107-arm64-dts-rockchip-Update-LED-properties-for-Orange-.patch b/target/linux/rockchip/patches-5.15/107-arm64-dts-rockchip-Update-LED-properties-for-Orange-.patch new file mode 100644 index 00000000000000..b1e26d4e3e27d7 --- /dev/null +++ b/target/linux/rockchip/patches-5.15/107-arm64-dts-rockchip-Update-LED-properties-for-Orange-.patch @@ -0,0 +1,56 @@ +From d2166e3b3680bd2b206aebf1e1ce4c0d346f3c50 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Fri, 19 May 2023 12:10:52 +0800 +Subject: [PATCH] arm64: dts: rockchip: Update LED properties for Orange Pi R1 + Plus + +Add OpenWrt's LED aliases for showing system status. +Also replace function/color with legacy label as OpenWrt relys on it +to update LED settings. + +Signed-off-by: Tianling Shen +--- + .../dts/rockchip/rk3328-orangepi-r1-plus.dts | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +@@ -17,6 +17,11 @@ + aliases { + ethernet1 = &rtl8153; + mmc0 = &sdmmc; ++ ++ led-boot = &status_led; ++ led-failsafe = &status_led; ++ led-running = &status_led; ++ led-upgrade = &status_led; + }; + + chosen { +@@ -36,22 +41,18 @@ + pinctrl-names = "default"; + + led-0 { +- function = LED_FUNCTION_LAN; +- color = ; + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; ++ label = "green:lan"; + }; + +- led-1 { +- function = LED_FUNCTION_STATUS; +- color = ; ++ status_led: led-1 { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "heartbeat"; ++ label = "red:status"; + }; + + led-2 { +- function = LED_FUNCTION_WAN; +- color = ; + gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; ++ label = "green:wan"; + }; + }; + diff --git a/target/linux/rockchip/patches-5.15/108-arm64-dts-rockchip-add-LED-configuration-to-Orange-P.patch b/target/linux/rockchip/patches-5.15/108-arm64-dts-rockchip-add-LED-configuration-to-Orange-P.patch new file mode 100644 index 00000000000000..37b59925fc16dc --- /dev/null +++ b/target/linux/rockchip/patches-5.15/108-arm64-dts-rockchip-add-LED-configuration-to-Orange-P.patch @@ -0,0 +1,24 @@ +From b46a530d12ada422b9d5b2b97059e0d3ed950b40 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Fri, 19 May 2023 12:38:04 +0800 +Subject: [PATCH] arm64: dts: rockchip: add LED configuration to Orange Pi R1 + Plus + +Add the correct value for the RTL8153 LED configuration register to +match the blink behavior of the other port on the device. + +Signed-off-by: Tianling Shen +--- + arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +@@ -362,6 +362,7 @@ + rtl8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; ++ realtek,led-data = <0x87>; + }; + }; + From 3b8564f9aa3361589f0f87c3e9a635fd4a56d5ac Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 30 May 2023 12:59:07 +0800 Subject: [PATCH 0091/1171] uboot-rockchip: add Orange Pi R1 Plus LTS support Add support for the Xunlong Orange Pi R1 Plus LTS. Manually generated of-platdata files to avoid swig dependency. Tested-by: Volkan Yetik Signed-off-by: Tianling Shen (cherry picked from commit 37fed89166e6e21c20ef92b36106f7184a0476c6) --- package/boot/uboot-rockchip/Makefile | 8 + ...Add-support-for-Orange-Pi-R1-Plus-LT.patch | 242 ++++++++++++++++++ .../orangepi-r1-plus-lts-rk3328/dt-decl.h | 24 ++ .../orangepi-r1-plus-lts-rk3328/dt-plat.c | 170 ++++++++++++ .../dt-structs-gen.h | 55 ++++ 5 files changed, 499 insertions(+) create mode 100644 package/boot/uboot-rockchip/patches/104-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus-LT.patch create mode 100644 package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-decl.h create mode 100644 package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-plat.c create mode 100644 package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-structs-gen.h diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index 126af6ac54c9ee..59b8be84cfb61b 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -52,6 +52,13 @@ define U-Boot/orangepi-r1-plus-rk3328 xunlong_orangepi-r1-plus endef +define U-Boot/orangepi-r1-plus-lts-rk3328 + $(U-Boot/rk3328/Default) + NAME:=Orange Pi R1 Plus LTS + BUILD_DEVICES:= \ + xunlong_orangepi-r1-plus-lts +endef + define U-Boot/roc-cc-rk3328 $(U-Boot/rk3328/Default) NAME:=ROC-RK3328-CC @@ -95,6 +102,7 @@ UBOOT_TARGETS := \ nanopi-r2c-rk3328 \ nanopi-r2s-rk3328 \ orangepi-r1-plus-rk3328 \ + orangepi-r1-plus-lts-rk3328 \ roc-cc-rk3328 UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes diff --git a/package/boot/uboot-rockchip/patches/104-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus-LT.patch b/package/boot/uboot-rockchip/patches/104-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus-LT.patch new file mode 100644 index 00000000000000..05d569e7203bd0 --- /dev/null +++ b/package/boot/uboot-rockchip/patches/104-rockchip-rk3328-Add-support-for-Orange-Pi-R1-Plus-LT.patch @@ -0,0 +1,242 @@ +From 7a9326a96098bc63d2b60538f657c3a533415276 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Sat, 20 May 2023 18:52:14 +0800 +Subject: [PATCH] rockchip: rk3328: Add support for Orange Pi R1 Plus LTS + +The OrangePi R1 Plus LTS is a minor variant of OrangePi R1 Plus with +the on-board NIC chip changed from rtl8211e to yt8531c, and RAM type +changed from DDR4 to LPDDR3. + +The device tree is taken from kernel v6.4-rc1. + +Signed-off-by: Tianling Shen + +--- + arch/arm/dts/Makefile | 1 + + .../rk3328-orangepi-r1-plus-lts-u-boot.dtsi | 46 +++++++ + arch/arm/dts/rk3328-orangepi-r1-plus-lts.dts | 40 ++++++ + board/rockchip/evb_rk3328/MAINTAINERS | 6 + + configs/orangepi-r1-plus-lts-rk3328_defconfig | 114 ++++++++++++++++++ + 5 files changed, 207 insertions(+) + create mode 100644 arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi + create mode 100644 arch/arm/dts/rk3328-orangepi-r1-plus-lts.dts + create mode 100644 configs/orangepi-r1-plus-lts-rk3328_defconfig + +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -111,6 +111,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3328) += \ + rk3328-nanopi-r2c.dtb \ + rk3328-nanopi-r2s.dtb \ + rk3328-orangepi-r1-plus.dtb \ ++ rk3328-orangepi-r1-plus-lts.dtb \ + rk3328-roc-cc.dtb \ + rk3328-rock64.dtb \ + rk3328-rock-pi-e.dtb +--- /dev/null ++++ b/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi +@@ -0,0 +1,46 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd ++ * (C) Copyright 2020 David Bauer ++ */ ++ ++#include "rk3328-u-boot.dtsi" ++#include "rk3328-sdram-lpddr3-666.dtsi" ++/ { ++ chosen { ++ u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc; ++ }; ++}; ++ ++&gpio0 { ++ u-boot,dm-spl; ++}; ++ ++&pinctrl { ++ u-boot,dm-spl; ++}; ++ ++&sdmmc0m1_gpio { ++ u-boot,dm-spl; ++}; ++ ++&pcfg_pull_up_4ma { ++ u-boot,dm-spl; ++}; ++ ++/* Need this and all the pinctrl/gpio stuff above to set pinmux */ ++&vcc_sd { ++ u-boot,dm-spl; ++}; ++ ++&gmac2io { ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++}; ++ ++&spi0 { ++ spi_flash: spiflash@0 { ++ u-boot,dm-pre-reloc; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/dts/rk3328-orangepi-r1-plus-lts.dts +@@ -0,0 +1,40 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Copyright (c) 2016 Xunlong Software. Co., Ltd. ++ * (http://www.orangepi.org) ++ * ++ * Copyright (c) 2021-2023 Tianling Shen ++ */ ++ ++/dts-v1/; ++#include "rk3328-orangepi-r1-plus.dts" ++ ++/ { ++ model = "Xunlong Orange Pi R1 Plus LTS"; ++ compatible = "xunlong,orangepi-r1-plus-lts", "rockchip,rk3328"; ++}; ++ ++&gmac2io { ++ phy-handle = <&yt8531c>; ++ tx_delay = <0x19>; ++ rx_delay = <0x05>; ++ ++ mdio { ++ /delete-node/ ethernet-phy@1; ++ ++ yt8531c: ethernet-phy@0 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <0>; ++ ++ motorcomm,clk-out-frequency-hz = <125000000>; ++ motorcomm,keep-pll-enabled; ++ motorcomm,auto-sleep-disabled; ++ ++ pinctrl-0 = <ð_phy_reset_pin>; ++ pinctrl-names = "default"; ++ reset-assert-us = <15000>; ++ reset-deassert-us = <50000>; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; +--- a/board/rockchip/evb_rk3328/MAINTAINERS ++++ b/board/rockchip/evb_rk3328/MAINTAINERS +@@ -24,6 +24,12 @@ S: Maintained + F: configs/orangepi-r1-plus-rk3328_defconfig + F: arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi + ++ORANGEPI-R1-PLUS-LTS-RK3328 ++M: Tianling Shen ++S: Maintained ++F: configs/orangepi-r1-plus-lts-rk3328_defconfig ++F: arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi ++ + ROC-RK3328-CC + M: Loic Devulder + M: Chen-Yu Tsai +--- /dev/null ++++ b/configs/orangepi-r1-plus-lts-rk3328_defconfig +@@ -0,0 +1,98 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_ROCKCHIP=y ++CONFIG_SYS_TEXT_BASE=0x00200000 ++CONFIG_SPL_GPIO_SUPPORT=y ++CONFIG_ENV_OFFSET=0x3F8000 ++CONFIG_ROCKCHIP_RK3328=y ++CONFIG_TPL_ROCKCHIP_COMMON_BOARD=y ++CONFIG_TPL_LIBCOMMON_SUPPORT=y ++CONFIG_TPL_LIBGENERIC_SUPPORT=y ++CONFIG_SPL_DRIVERS_MISC_SUPPORT=y ++CONFIG_SPL_STACK_R_ADDR=0x600000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEBUG_UART_BASE=0xFF130000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_SYSINFO=y ++CONFIG_DEBUG_UART=y ++CONFIG_TPL_SYS_MALLOC_F_LEN=0x800 ++# CONFIG_ANDROID_BOOT_IMAGE is not set ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y ++CONFIG_SPL_LOAD_FIT=y ++CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-orangepi-r1-plus-lts.dtb" ++CONFIG_MISC_INIT_R=y ++# CONFIG_DISPLAY_CPUINFO is not set ++CONFIG_DISPLAY_BOARDINFO_LATE=y ++# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set ++CONFIG_TPL_SYS_MALLOC_SIMPLE=y ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_I2C_SUPPORT=y ++CONFIG_SPL_POWER_SUPPORT=y ++CONFIG_SPL_ATF=y ++CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_USB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TIME=y ++CONFIG_SPL_OF_CONTROL=y ++CONFIG_TPL_OF_CONTROL=y ++CONFIG_DEFAULT_DEVICE_TREE="rk3328-orangepi-r1-plus-lts" ++CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" ++CONFIG_TPL_OF_PLATDATA=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_TPL_DM=y ++CONFIG_REGMAP=y ++CONFIG_SPL_REGMAP=y ++CONFIG_TPL_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_SPL_SYSCON=y ++CONFIG_TPL_SYSCON=y ++CONFIG_CLK=y ++CONFIG_SPL_CLK=y ++CONFIG_FASTBOOT_BUF_ADDR=0x800800 ++CONFIG_FASTBOOT_CMD_OEM_FORMAT=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_SF_DEFAULT_SPEED=20000000 ++CONFIG_DM_ETH=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_GMAC_ROCKCHIP=y ++CONFIG_PINCTRL=y ++CONFIG_SPL_PINCTRL=y ++CONFIG_DM_PMIC=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_SPL_DM_REGULATOR=y ++CONFIG_REGULATOR_PWM=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_SPL_DM_REGULATOR_FIXED=y ++CONFIG_REGULATOR_RK8XX=y ++CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM=y ++CONFIG_SPL_RAM=y ++CONFIG_TPL_RAM=y ++CONFIG_DM_RESET=y ++CONFIG_BAUDRATE=1500000 ++CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_SYSRESET=y ++# CONFIG_TPL_SYSRESET is not set ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y ++CONFIG_USB_OHCI_HCD=y ++CONFIG_USB_OHCI_GENERIC=y ++CONFIG_USB_DWC2=y ++CONFIG_USB_DWC3=y ++# CONFIG_USB_DWC3_GADGET is not set ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_SPL_TINY_MEMSET=y ++CONFIG_TPL_TINY_MEMSET=y ++CONFIG_ERRNO_STR=y diff --git a/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-decl.h b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-decl.h new file mode 100644 index 00000000000000..75795aa6cc7af2 --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-decl.h @@ -0,0 +1,24 @@ +/* + * DO NOT MODIFY + * + * Declares externs for all device/uclass instances. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +#include +#include + +/* driver declarations - these allow DM_DRIVER_GET() to be used */ +extern U_BOOT_DRIVER(rockchip_rk3328_cru); +extern U_BOOT_DRIVER(rockchip_rk3328_dmc); +extern U_BOOT_DRIVER(rockchip_rk3288_dw_mshc); +extern U_BOOT_DRIVER(ns16550_serial); +extern U_BOOT_DRIVER(rockchip_rk3328_spi); +extern U_BOOT_DRIVER(rockchip_rk3328_grf); + +/* uclass driver declarations - needed for DM_UCLASS_DRIVER_REF() */ +extern UCLASS_DRIVER(clk); +extern UCLASS_DRIVER(mmc); +extern UCLASS_DRIVER(ram); +extern UCLASS_DRIVER(serial); +extern UCLASS_DRIVER(syscon); diff --git a/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-plat.c b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-plat.c new file mode 100644 index 00000000000000..12081b19e021a0 --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-plat.c @@ -0,0 +1,170 @@ +/* + * DO NOT MODIFY + * + * Declares the U_BOOT_DRIVER() records and platform data. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +/* Allow use of U_BOOT_DRVINFO() in this file */ +#define DT_PLAT_C + +#include +#include +#include + +/* + * driver_info declarations, ordered by 'struct driver_info' linker_list idx: + * + * idx driver_info driver + * --- -------------------- -------------------- + * 0: clock_controller_at_ff440000 rockchip_rk3328_cru + * 1: dmc rockchip_rk3328_dmc + * 2: mmc_at_ff500000 rockchip_rk3288_dw_mshc + * 3: serial_at_ff130000 ns16550_serial + * 4: spi_at_ff190000 rockchip_rk3328_spi + * 5: syscon_at_ff100000 rockchip_rk3328_grf + * --- -------------------- -------------------- + */ + +/* + * Node /clock-controller@ff440000 index 0 + * driver rockchip_rk3328_cru parent None + */ +static struct dtd_rockchip_rk3328_cru dtv_clock_controller_at_ff440000 = { + .reg = {0xff440000, 0x1000}, + .rockchip_grf = 0x38, +}; +U_BOOT_DRVINFO(clock_controller_at_ff440000) = { + .name = "rockchip_rk3328_cru", + .plat = &dtv_clock_controller_at_ff440000, + .plat_size = sizeof(dtv_clock_controller_at_ff440000), + .parent_idx = -1, +}; + +/* + * Node /dmc index 1 + * driver rockchip_rk3328_dmc parent None + */ +static struct dtd_rockchip_rk3328_dmc dtv_dmc = { + .reg = {0xff400000, 0x1000, 0xff780000, 0x3000, 0xff100000, 0x1000, 0xff440000, 0x1000, + 0xff720000, 0x1000, 0xff798000, 0x1000}, + .rockchip_sdram_params = {0x1, 0xc, 0x3, 0x1, 0x0, 0x0, 0x10, 0x10, + 0x10, 0x10, 0x0, 0x8c48a18a, 0x0, 0x21, 0x482, 0x15, + 0x21a, 0xff, 0x14d, 0x6, 0x1, 0x0, 0x0, 0x0, + 0x43041008, 0x64, 0x140023, 0xd0, 0x220002, 0xd4, 0x10000, 0xd8, + 0x703, 0xdc, 0x830004, 0xe0, 0x10000, 0xe4, 0x70003, 0xf4, + 0xf011f, 0x100, 0x6090b07, 0x104, 0x2020b, 0x108, 0x2030506, 0x10c, + 0x505000, 0x110, 0x3020204, 0x114, 0x1010303, 0x118, 0x2020003, 0x120, + 0x303, 0x138, 0x25, 0x180, 0x3c000f, 0x184, 0x900000, 0x190, + 0x7020000, 0x198, 0x5001100, 0x1a0, 0xc0400003, 0x240, 0x900090c, 0x244, + 0x101, 0x250, 0xf00, 0x490, 0x1, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0x4, 0xb, 0x28, 0x6, 0x2c, + 0x0, 0x30, 0x3, 0xffffffff, 0xffffffff, 0x77, 0x88, 0x79, + 0x79, 0x87, 0x97, 0x87, 0x78, 0x77, 0x78, 0x87, + 0x88, 0x87, 0x87, 0x77, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x69, 0x9, 0x77, + 0x78, 0x77, 0x78, 0x77, 0x78, 0x77, 0x78, 0x77, + 0x79, 0x9, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x69, 0x9, 0x77, 0x78, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x79, 0x9, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x78, 0x69, 0x9, 0x77, 0x78, 0x77, 0x78, 0x77, + 0x78, 0x77, 0x78, 0x77, 0x79, 0x9, 0x78, 0x78, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x69, + 0x9, 0x77, 0x78, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x79, 0x9}, +}; +U_BOOT_DRVINFO(dmc) = { + .name = "rockchip_rk3328_dmc", + .plat = &dtv_dmc, + .plat_size = sizeof(dtv_dmc), + .parent_idx = -1, +}; + +/* + * Node /mmc@ff500000 index 2 + * driver rockchip_rk3288_dw_mshc parent None + */ +static struct dtd_rockchip_rk3288_dw_mshc dtv_mmc_at_ff500000 = { + .bus_width = 0x4, + .cap_sd_highspeed = true, + .clocks = { + {0, {317}}, + {0, {33}}, + {0, {74}}, + {0, {78}},}, + .disable_wp = true, + .fifo_depth = 0x100, + .interrupts = {0x0, 0xc, 0x4}, + .max_frequency = 0x8f0d180, + .pinctrl_0 = {0x45, 0x46, 0x47, 0x48}, + .pinctrl_names = "default", + .reg = {0xff500000, 0x4000}, + .u_boot_spl_fifo_mode = true, + .vmmc_supply = 0x49, +}; +U_BOOT_DRVINFO(mmc_at_ff500000) = { + .name = "rockchip_rk3288_dw_mshc", + .plat = &dtv_mmc_at_ff500000, + .plat_size = sizeof(dtv_mmc_at_ff500000), + .parent_idx = -1, +}; + +/* + * Node /serial@ff130000 index 3 + * driver ns16550_serial parent None + */ +static struct dtd_ns16550_serial dtv_serial_at_ff130000 = { + .clock_frequency = 0x16e3600, + .clocks = { + {0, {40}}, + {0, {212}},}, + .dma_names = {"tx", "rx"}, + .dmas = {0x10, 0x6, 0x10, 0x7}, + .interrupts = {0x0, 0x39, 0x4}, + .pinctrl_0 = 0x24, + .pinctrl_names = "default", + .reg = {0xff130000, 0x100}, + .reg_io_width = 0x4, + .reg_shift = 0x2, +}; +U_BOOT_DRVINFO(serial_at_ff130000) = { + .name = "ns16550_serial", + .plat = &dtv_serial_at_ff130000, + .plat_size = sizeof(dtv_serial_at_ff130000), + .parent_idx = -1, +}; + +/* Node /spi@ff190000 index 4 */ +static struct dtd_rockchip_rk3328_spi dtv_spi_at_ff190000 = { + .clocks = { + {0, {32}}, + {0, {209}},}, + .dma_names = {"tx", "rx"}, + .dmas = {0x10, 0x8, 0x10, 0x9}, + .interrupts = {0x0, 0x31, 0x4}, + .pinctrl_0 = {0x2c, 0x2d, 0x2e, 0x2f}, + .pinctrl_names = "default", + .reg = {0xff190000, 0x1000}, +}; +U_BOOT_DRVINFO(spi_at_ff190000) = { + .name = "rockchip_rk3328_spi", + .plat = &dtv_spi_at_ff190000, + .plat_size = sizeof(dtv_spi_at_ff190000), + .parent_idx = -1, +}; + +/* + * Node /syscon@ff100000 index 5 + * driver rockchip_rk3328_grf parent None + */ +static struct dtd_rockchip_rk3328_grf dtv_syscon_at_ff100000 = { + .reg = {0xff100000, 0x1000}, +}; +U_BOOT_DRVINFO(syscon_at_ff100000) = { + .name = "rockchip_rk3328_grf", + .plat = &dtv_syscon_at_ff100000, + .plat_size = sizeof(dtv_syscon_at_ff100000), + .parent_idx = -1, +}; + diff --git a/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-structs-gen.h b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-structs-gen.h new file mode 100644 index 00000000000000..d09583153103cf --- /dev/null +++ b/package/boot/uboot-rockchip/src/of-platdata/orangepi-r1-plus-lts-rk3328/dt-structs-gen.h @@ -0,0 +1,55 @@ +/* + * DO NOT MODIFY + * + * Defines the structs used to hold devicetree data. + * This was generated by dtoc from a .dtb (device tree binary) file. + */ + +#include +#include +struct dtd_ns16550_serial { + fdt32_t clock_frequency; + struct phandle_1_arg clocks[2]; + const char * dma_names[2]; + fdt32_t dmas[4]; + fdt32_t interrupts[3]; + fdt32_t pinctrl_0; + const char * pinctrl_names; + fdt64_t reg[2]; + fdt32_t reg_io_width; + fdt32_t reg_shift; +}; +struct dtd_rockchip_rk3288_dw_mshc { + fdt32_t bus_width; + bool cap_sd_highspeed; + struct phandle_1_arg clocks[4]; + bool disable_wp; + fdt32_t fifo_depth; + fdt32_t interrupts[3]; + fdt32_t max_frequency; + fdt32_t pinctrl_0[4]; + const char * pinctrl_names; + fdt64_t reg[2]; + bool u_boot_spl_fifo_mode; + fdt32_t vmmc_supply; +}; +struct dtd_rockchip_rk3328_cru { + fdt64_t reg[2]; + fdt32_t rockchip_grf; +}; +struct dtd_rockchip_rk3328_dmc { + fdt64_t reg[12]; + fdt32_t rockchip_sdram_params[196]; +}; +struct dtd_rockchip_rk3328_grf { + fdt64_t reg[2]; +}; +struct dtd_rockchip_rk3328_spi { + struct phandle_1_arg clocks[2]; + const char * dma_names[2]; + fdt32_t dmas[4]; + fdt32_t interrupts[3]; + fdt32_t pinctrl_0[4]; + const char * pinctrl_names; + fdt64_t reg[2]; +}; From 3f3586a06d27cb6eeab1102e3858b47a1c902ad8 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 30 May 2023 12:59:07 +0800 Subject: [PATCH 0092/1171] rockchip: add Orange Pi R1 Plus LTS support The OrangePi R1 Plus LTS is a minor variant of OrangePi R1 Plus with the on-board NIC chip changed from rtl8211e to yt8531c, and otherwise identical to OrangePi R1 Plus. Tested-by: Volkan Yetik Signed-off-by: Tianling Shen (cherry picked from commit 32d5921b8b5508a99680ecf1626667517c2cbdb8) [Removed patches for kernel 6.1] Signed-off-by: Tianling Shen --- .../armv8/base-files/etc/board.d/01_leds | 3 +- .../armv8/base-files/etc/board.d/02_network | 6 +- .../etc/hotplug.d/net/40-net-smp-affinity | 3 +- target/linux/rockchip/image/armv8.mk | 9 +++ ...hip-Add-Xunlong-OrangePi-R1-Plus-LTS.patch | 71 +++++++++++++++++++ 5 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 target/linux/rockchip/patches-5.15/008-v6.4-arm64-dts-rockchip-Add-Xunlong-OrangePi-R1-Plus-LTS.patch diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds index f0da262a094e36..d82e47cf538f54 100644 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds @@ -11,7 +11,8 @@ case $board in friendlyarm,nanopi-r2c|\ friendlyarm,nanopi-r2s|\ friendlyarm,nanopi-r4s|\ -xunlong,orangepi-r1-plus) +xunlong,orangepi-r1-plus|\ +xunlong,orangepi-r1-plus-lts) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth1" ;; diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network index f7e0da67b27144..c10e0cbcc9d185 100644 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network @@ -9,7 +9,8 @@ rockchip_setup_interfaces() case "$board" in friendlyarm,nanopi-r2s|\ friendlyarm,nanopi-r4s|\ - xunlong,orangepi-r1-plus) + xunlong,orangepi-r1-plus|\ + xunlong,orangepi-r1-plus-lts) ucidef_set_interfaces_lan_wan 'eth1' 'eth0' ;; *) @@ -56,7 +57,8 @@ rockchip_setup_macs() wan_mac=$(nanopi_r4s_get_mac wan) lan_mac=$(nanopi_r4s_get_mac lan) ;; - xunlong,orangepi-r1-plus) + xunlong,orangepi-r1-plus|\ + xunlong,orangepi-r1-plus-lts) wan_mac=$(macaddr_add "$(cat /sys/class/net/eth1/address)" -1) ;; esac diff --git a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity index 660a7e286671bc..bb119b9185ebab 100644 --- a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity +++ b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity @@ -31,7 +31,8 @@ set_interface_core() { case "$(board_name)" in friendlyarm,nanopi-r2c|\ friendlyarm,nanopi-r2s|\ -xunlong,orangepi-r1-plus) +xunlong,orangepi-r1-plus|\ +xunlong,orangepi-r1-plus-lts) set_interface_core 2 "eth0" set_interface_core 4 "eth1" "xhci-hcd:usb3" ;; diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index 9a32a07b21aff0..063dc6fd644795 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -69,3 +69,12 @@ define Device/xunlong_orangepi-r1-plus DEVICE_PACKAGES := kmod-usb-net-rtl8152 endef TARGET_DEVICES += xunlong_orangepi-r1-plus + +define Device/xunlong_orangepi-r1-plus-lts + DEVICE_VENDOR := Xunlong + DEVICE_MODEL := Orange Pi R1 Plus LTS + SOC := rk3328 + IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata + DEVICE_PACKAGES := kmod-usb-net-rtl8152 +endef +TARGET_DEVICES += xunlong_orangepi-r1-plus-lts diff --git a/target/linux/rockchip/patches-5.15/008-v6.4-arm64-dts-rockchip-Add-Xunlong-OrangePi-R1-Plus-LTS.patch b/target/linux/rockchip/patches-5.15/008-v6.4-arm64-dts-rockchip-Add-Xunlong-OrangePi-R1-Plus-LTS.patch new file mode 100644 index 00000000000000..cedf28dc799f05 --- /dev/null +++ b/target/linux/rockchip/patches-5.15/008-v6.4-arm64-dts-rockchip-Add-Xunlong-OrangePi-R1-Plus-LTS.patch @@ -0,0 +1,71 @@ +From 387b3bbac5ea6a0a105d685237f033ffe0f184f1 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Sat, 25 Mar 2023 15:40:22 +0800 +Subject: [PATCH] arm64: dts: rockchip: Add Xunlong OrangePi R1 Plus LTS + +The OrangePi R1 Plus LTS is a minor variant of OrangePi R1 Plus with +the on-board NIC chip changed from rtl8211e to yt8531c, and otherwise +identical to OrangePi R1 Plus. + +Signed-off-by: Tianling Shen +Link: https://lore.kernel.org/r/20230325074022.9818-5-cnsztl@gmail.com +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + .../rockchip/rk3328-orangepi-r1-plus-lts.dts | 40 +++++++++++++++++++ + 2 files changed, 41 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus-lts.dts + +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -12,6 +12,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-ev + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2c.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus-lts.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock-pi-e.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-roc-cc.dtb +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus-lts.dts +@@ -0,0 +1,40 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Copyright (c) 2016 Xunlong Software. Co., Ltd. ++ * (http://www.orangepi.org) ++ * ++ * Copyright (c) 2021-2023 Tianling Shen ++ */ ++ ++/dts-v1/; ++#include "rk3328-orangepi-r1-plus.dts" ++ ++/ { ++ model = "Xunlong Orange Pi R1 Plus LTS"; ++ compatible = "xunlong,orangepi-r1-plus-lts", "rockchip,rk3328"; ++}; ++ ++&gmac2io { ++ phy-handle = <&yt8531c>; ++ tx_delay = <0x19>; ++ rx_delay = <0x05>; ++ ++ mdio { ++ /delete-node/ ethernet-phy@1; ++ ++ yt8531c: ethernet-phy@0 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <0>; ++ ++ motorcomm,clk-out-frequency-hz = <125000000>; ++ motorcomm,keep-pll-enabled; ++ motorcomm,auto-sleep-disabled; ++ ++ pinctrl-0 = <ð_phy_reset_pin>; ++ pinctrl-names = "default"; ++ reset-assert-us = <15000>; ++ reset-deassert-us = <50000>; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; From 081dfcfb0fa9a928321af885b118b480635dfdd5 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Fri, 26 May 2023 01:41:18 -0700 Subject: [PATCH 0093/1171] base-files: enable BPF JIT kallsyms by default Set net.core.bpf_jit_kallsyms=1 in /etc/sysctl.d/10-default.conf. For privileged users, this exports addresses of JIT-compiled programs to appear in /proc/kallsyms when present, allowing their use for debugging and in traces. Signed-off-by: Tony Ambardar (cherry picked from commit b3aaede2a7b14f2be850db8ae0c826e2782a60e8) --- package/base-files/files/etc/sysctl.d/10-default.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/package/base-files/files/etc/sysctl.d/10-default.conf b/package/base-files/files/etc/sysctl.d/10-default.conf index bc8c57969514e6..ee7df2bfa61b85 100644 --- a/package/base-files/files/etc/sysctl.d/10-default.conf +++ b/package/base-files/files/etc/sysctl.d/10-default.conf @@ -9,6 +9,7 @@ fs.protected_hardlinks=1 fs.protected_symlinks=1 net.core.bpf_jit_enable=1 +net.core.bpf_jit_kallsyms=1 net.ipv4.conf.default.arp_ignore=1 net.ipv4.conf.all.arp_ignore=1 From 11677aa44cc0ab423c520201ce067be2bdef730f Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Mon, 28 Nov 2022 20:43:19 -0800 Subject: [PATCH 0094/1171] kernel: backport libcap workaround for BPF selftests Recent libcap versions (>= 2.60) cause problems with BPF kselftests, so backport an upstream patch that replaces libcap and drops the dependency. Signed-off-by: Tony Ambardar (cherry picked from commit 04981c716acab6b7a81f672f217e5c47ee42a0b6) --- ...d-helpers-to-directly-use-the-capget.patch | 123 ++++++++++++ ...move-libcap-usage-from-test_verifier.patch | 188 ++++++++++++++++++ ...-Remove-libcap-usage-from-test_progs.patch | 122 ++++++++++++ 3 files changed, 433 insertions(+) create mode 100644 target/linux/generic/backport-5.15/060-v5.18-01-bpf-selftests-Add-helpers-to-directly-use-the-capget.patch create mode 100644 target/linux/generic/backport-5.15/060-v5.18-02-bpf-selftests-Remove-libcap-usage-from-test_verifier.patch create mode 100644 target/linux/generic/backport-5.15/060-v5.18-03-bpf-selftests-Remove-libcap-usage-from-test_progs.patch diff --git a/target/linux/generic/backport-5.15/060-v5.18-01-bpf-selftests-Add-helpers-to-directly-use-the-capget.patch b/target/linux/generic/backport-5.15/060-v5.18-01-bpf-selftests-Add-helpers-to-directly-use-the-capget.patch new file mode 100644 index 00000000000000..4d544a30f59774 --- /dev/null +++ b/target/linux/generic/backport-5.15/060-v5.18-01-bpf-selftests-Add-helpers-to-directly-use-the-capget.patch @@ -0,0 +1,123 @@ +From 5287acc6f097c0c18e54401b611a877a3083b68c Mon Sep 17 00:00:00 2001 +From: Martin KaFai Lau +Date: Wed, 16 Mar 2022 10:38:23 -0700 +Subject: [PATCH 1/3] bpf: selftests: Add helpers to directly use the capget + and capset syscall + +After upgrading to the newer libcap (>= 2.60), +the libcap commit aca076443591 ("Make cap_t operations thread safe.") +added a "__u8 mutex;" to the "struct _cap_struct". It caused a few byte +shift that breaks the assumption made in the "struct libcap" definition +in test_verifier.c. + +The bpf selftest usage only needs to enable and disable the effective +caps of the running task. It is easier to directly syscall the +capget and capset instead. It can also remove the libcap +library dependency. + +The cap_helpers.{c,h} is added. One __u64 is used for all CAP_* +bits instead of two __u32. + +Signed-off-by: Martin KaFai Lau +Signed-off-by: Alexei Starovoitov +Acked-by: John Fastabend +Link: https://lore.kernel.org/bpf/20220316173823.2036955-1-kafai@fb.com +--- + tools/testing/selftests/bpf/cap_helpers.c | 67 +++++++++++++++++++++++ + tools/testing/selftests/bpf/cap_helpers.h | 19 +++++++ + 2 files changed, 86 insertions(+) + create mode 100644 tools/testing/selftests/bpf/cap_helpers.c + create mode 100644 tools/testing/selftests/bpf/cap_helpers.h + +--- /dev/null ++++ b/tools/testing/selftests/bpf/cap_helpers.c +@@ -0,0 +1,67 @@ ++// SPDX-License-Identifier: GPL-2.0 ++#include "cap_helpers.h" ++ ++/* Avoid including from the libcap-devel package, ++ * so directly declare them here and use them from glibc. ++ */ ++int capget(cap_user_header_t header, cap_user_data_t data); ++int capset(cap_user_header_t header, const cap_user_data_t data); ++ ++int cap_enable_effective(__u64 caps, __u64 *old_caps) ++{ ++ struct __user_cap_data_struct data[_LINUX_CAPABILITY_U32S_3]; ++ struct __user_cap_header_struct hdr = { ++ .version = _LINUX_CAPABILITY_VERSION_3, ++ }; ++ __u32 cap0 = caps; ++ __u32 cap1 = caps >> 32; ++ int err; ++ ++ err = capget(&hdr, data); ++ if (err) ++ return err; ++ ++ if (old_caps) ++ *old_caps = (__u64)(data[1].effective) << 32 | data[0].effective; ++ ++ if ((data[0].effective & cap0) == cap0 && ++ (data[1].effective & cap1) == cap1) ++ return 0; ++ ++ data[0].effective |= cap0; ++ data[1].effective |= cap1; ++ err = capset(&hdr, data); ++ if (err) ++ return err; ++ ++ return 0; ++} ++ ++int cap_disable_effective(__u64 caps, __u64 *old_caps) ++{ ++ struct __user_cap_data_struct data[_LINUX_CAPABILITY_U32S_3]; ++ struct __user_cap_header_struct hdr = { ++ .version = _LINUX_CAPABILITY_VERSION_3, ++ }; ++ __u32 cap0 = caps; ++ __u32 cap1 = caps >> 32; ++ int err; ++ ++ err = capget(&hdr, data); ++ if (err) ++ return err; ++ ++ if (old_caps) ++ *old_caps = (__u64)(data[1].effective) << 32 | data[0].effective; ++ ++ if (!(data[0].effective & cap0) && !(data[1].effective & cap1)) ++ return 0; ++ ++ data[0].effective &= ~cap0; ++ data[1].effective &= ~cap1; ++ err = capset(&hdr, data); ++ if (err) ++ return err; ++ ++ return 0; ++} +--- /dev/null ++++ b/tools/testing/selftests/bpf/cap_helpers.h +@@ -0,0 +1,19 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __CAP_HELPERS_H ++#define __CAP_HELPERS_H ++ ++#include ++#include ++ ++#ifndef CAP_PERFMON ++#define CAP_PERFMON 38 ++#endif ++ ++#ifndef CAP_BPF ++#define CAP_BPF 39 ++#endif ++ ++int cap_enable_effective(__u64 caps, __u64 *old_caps); ++int cap_disable_effective(__u64 caps, __u64 *old_caps); ++ ++#endif diff --git a/target/linux/generic/backport-5.15/060-v5.18-02-bpf-selftests-Remove-libcap-usage-from-test_verifier.patch b/target/linux/generic/backport-5.15/060-v5.18-02-bpf-selftests-Remove-libcap-usage-from-test_verifier.patch new file mode 100644 index 00000000000000..cc60b54340156e --- /dev/null +++ b/target/linux/generic/backport-5.15/060-v5.18-02-bpf-selftests-Remove-libcap-usage-from-test_verifier.patch @@ -0,0 +1,188 @@ +From 847a6b7ee906be874f0cae279c8de902a7d3f092 Mon Sep 17 00:00:00 2001 +From: Martin KaFai Lau +Date: Wed, 16 Mar 2022 10:38:29 -0700 +Subject: [PATCH 2/3] bpf: selftests: Remove libcap usage from test_verifier + +This patch removes the libcap usage from test_verifier. +The cap_*_effective() helpers added in the earlier patch are +used instead. + +Signed-off-by: Martin KaFai Lau +Signed-off-by: Alexei Starovoitov +Acked-by: John Fastabend +Link: https://lore.kernel.org/bpf/20220316173829.2038682-1-kafai@fb.com +--- + tools/testing/selftests/bpf/Makefile | 31 +++++--- + tools/testing/selftests/bpf/test_verifier.c | 88 ++++++--------------- + 2 files changed, 46 insertions(+), 73 deletions(-) + +--- a/tools/testing/selftests/bpf/Makefile ++++ b/tools/testing/selftests/bpf/Makefile +@@ -189,16 +189,27 @@ TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPF + + $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ) + +-$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c +-$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c +-$(OUTPUT)/test_sock: cgroup_helpers.c +-$(OUTPUT)/test_sock_addr: cgroup_helpers.c +-$(OUTPUT)/test_sockmap: cgroup_helpers.c +-$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c +-$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c +-$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c +-$(OUTPUT)/test_sock_fields: cgroup_helpers.c +-$(OUTPUT)/test_sysctl: cgroup_helpers.c ++CGROUP_HELPERS := $(OUTPUT)/cgroup_helpers.o ++TESTING_HELPERS := $(OUTPUT)/testing_helpers.o ++TRACE_HELPERS := $(OUTPUT)/trace_helpers.o ++CAP_HELPERS := $(OUTPUT)/cap_helpers.o ++ ++$(OUTPUT)/test_dev_cgroup: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_skb_cgroup_id_user: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_sock: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_sock_addr: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_sockmap: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_tcpnotify_user: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(TRACE_HELPERS) ++$(OUTPUT)/get_cgroup_id_user: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_cgroup_storage: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_sock_fields: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_sysctl: $(CGROUP_HELPERS) $(TESTING_HELPERS) ++$(OUTPUT)/test_tag: $(TESTING_HELPERS) ++$(OUTPUT)/test_lirc_mode2_user: $(TESTING_HELPERS) ++$(OUTPUT)/xdping: $(TESTING_HELPERS) ++$(OUTPUT)/flow_dissector_load: $(TESTING_HELPERS) ++$(OUTPUT)/test_maps: $(TESTING_HELPERS) ++$(OUTPUT)/test_verifier: $(TESTING_HELPERS) $(CAP_HELPERS) + + BPFTOOL ?= $(DEFAULT_BPFTOOL) + $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \ +--- a/tools/testing/selftests/bpf/test_verifier.c ++++ b/tools/testing/selftests/bpf/test_verifier.c +@@ -22,8 +22,6 @@ + #include + #include + +-#include +- + #include + #include + #include +@@ -43,6 +41,7 @@ + # endif + #endif + #include "bpf_rlimit.h" ++#include "cap_helpers.h" + #include "bpf_rand.h" + #include "bpf_util.h" + #include "test_btf.h" +@@ -59,6 +58,10 @@ + #define F_NEEDS_EFFICIENT_UNALIGNED_ACCESS (1 << 0) + #define F_LOAD_WITH_STRICT_ALIGNMENT (1 << 1) + ++/* need CAP_BPF, CAP_NET_ADMIN, CAP_PERFMON to load progs */ ++#define ADMIN_CAPS (1ULL << CAP_NET_ADMIN | \ ++ 1ULL << CAP_PERFMON | \ ++ 1ULL << CAP_BPF) + #define UNPRIV_SYSCTL "kernel/unprivileged_bpf_disabled" + static bool unpriv_disabled = false; + static int skips; +@@ -940,47 +943,19 @@ struct libcap { + + static int set_admin(bool admin) + { +- cap_t caps; +- /* need CAP_BPF, CAP_NET_ADMIN, CAP_PERFMON to load progs */ +- const cap_value_t cap_net_admin = CAP_NET_ADMIN; +- const cap_value_t cap_sys_admin = CAP_SYS_ADMIN; +- struct libcap *cap; +- int ret = -1; +- +- caps = cap_get_proc(); +- if (!caps) { +- perror("cap_get_proc"); +- return -1; +- } +- cap = (struct libcap *)caps; +- if (cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_sys_admin, CAP_CLEAR)) { +- perror("cap_set_flag clear admin"); +- goto out; +- } +- if (cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_net_admin, +- admin ? CAP_SET : CAP_CLEAR)) { +- perror("cap_set_flag set_or_clear net"); +- goto out; +- } +- /* libcap is likely old and simply ignores CAP_BPF and CAP_PERFMON, +- * so update effective bits manually +- */ ++ int err; ++ + if (admin) { +- cap->data[1].effective |= 1 << (38 /* CAP_PERFMON */ - 32); +- cap->data[1].effective |= 1 << (39 /* CAP_BPF */ - 32); ++ err = cap_enable_effective(ADMIN_CAPS, NULL); ++ if (err) ++ perror("cap_enable_effective(ADMIN_CAPS)"); + } else { +- cap->data[1].effective &= ~(1 << (38 - 32)); +- cap->data[1].effective &= ~(1 << (39 - 32)); ++ err = cap_disable_effective(ADMIN_CAPS, NULL); ++ if (err) ++ perror("cap_disable_effective(ADMIN_CAPS)"); + } +- if (cap_set_proc(caps)) { +- perror("cap_set_proc"); +- goto out; +- } +- ret = 0; +-out: +- if (cap_free(caps)) +- perror("cap_free"); +- return ret; ++ ++ return err; + } + + static int do_prog_test_run(int fd_prog, bool unpriv, uint32_t expected_val, +@@ -1246,31 +1221,18 @@ fail_log: + + static bool is_admin(void) + { +- cap_flag_value_t net_priv = CAP_CLEAR; +- bool perfmon_priv = false; +- bool bpf_priv = false; +- struct libcap *cap; +- cap_t caps; +- +-#ifdef CAP_IS_SUPPORTED +- if (!CAP_IS_SUPPORTED(CAP_SETFCAP)) { +- perror("cap_get_flag"); +- return false; +- } +-#endif +- caps = cap_get_proc(); +- if (!caps) { +- perror("cap_get_proc"); ++ __u64 caps; ++ ++ /* The test checks for finer cap as CAP_NET_ADMIN, ++ * CAP_PERFMON, and CAP_BPF instead of CAP_SYS_ADMIN. ++ * Thus, disable CAP_SYS_ADMIN at the beginning. ++ */ ++ if (cap_disable_effective(1ULL << CAP_SYS_ADMIN, &caps)) { ++ perror("cap_disable_effective(CAP_SYS_ADMIN)"); + return false; + } +- cap = (struct libcap *)caps; +- bpf_priv = cap->data[1].effective & (1 << (39/* CAP_BPF */ - 32)); +- perfmon_priv = cap->data[1].effective & (1 << (38/* CAP_PERFMON */ - 32)); +- if (cap_get_flag(caps, CAP_NET_ADMIN, CAP_EFFECTIVE, &net_priv)) +- perror("cap_get_flag NET"); +- if (cap_free(caps)) +- perror("cap_free"); +- return bpf_priv && perfmon_priv && net_priv == CAP_SET; ++ ++ return (caps & ADMIN_CAPS) == ADMIN_CAPS; + } + + static void get_unpriv_disabled() diff --git a/target/linux/generic/backport-5.15/060-v5.18-03-bpf-selftests-Remove-libcap-usage-from-test_progs.patch b/target/linux/generic/backport-5.15/060-v5.18-03-bpf-selftests-Remove-libcap-usage-from-test_progs.patch new file mode 100644 index 00000000000000..9badba7f8eaa36 --- /dev/null +++ b/target/linux/generic/backport-5.15/060-v5.18-03-bpf-selftests-Remove-libcap-usage-from-test_progs.patch @@ -0,0 +1,122 @@ +From 1ac00fea13c576e2b13dabf9a72ad3034e3bb804 Mon Sep 17 00:00:00 2001 +From: Martin KaFai Lau +Date: Wed, 16 Mar 2022 10:38:35 -0700 +Subject: [PATCH 3/3] bpf: selftests: Remove libcap usage from test_progs + +This patch removes the libcap usage from test_progs. +bind_perm.c is the only user. cap_*_effective() helpers added in the +earlier patch are directly used instead. + +No other selftest binary is using libcap, so '-lcap' is also removed +from the Makefile. + +Signed-off-by: Martin KaFai Lau +Signed-off-by: Alexei Starovoitov +Reviewed-by: Stanislav Fomichev +Acked-by: John Fastabend +Link: https://lore.kernel.org/bpf/20220316173835.2039334-1-kafai@fb.com +--- + tools/testing/selftests/bpf/Makefile | 5 ++- + .../selftests/bpf/prog_tests/bind_perm.c | 44 ++++--------------- + 2 files changed, 11 insertions(+), 38 deletions(-) + +--- a/tools/testing/selftests/bpf/Makefile ++++ b/tools/testing/selftests/bpf/Makefile +@@ -26,7 +26,7 @@ CFLAGS += -g -O0 -rdynamic -Wall $(GENFL + -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) \ + -Dbpf_prog_load=bpf_prog_test_load \ + -Dbpf_load_program=bpf_test_load_program +-LDLIBS += -lcap -lelf -lz -lrt -lpthread ++LDLIBS += -lelf -lz -lrt -lpthread + + # Silence some warnings when compiled with clang + ifneq ($(LLVM),) +@@ -471,7 +471,8 @@ TRUNNER_TESTS_DIR := prog_tests + TRUNNER_BPF_PROGS_DIR := progs + TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \ + network_helpers.c testing_helpers.c \ +- btf_helpers.c flow_dissector_load.h ++ btf_helpers.c flow_dissector_load.h \ ++ cap_helpers.c + TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \ + ima_setup.sh \ + $(wildcard progs/btf_dump_test_case_*.c) +--- a/tools/testing/selftests/bpf/prog_tests/bind_perm.c ++++ b/tools/testing/selftests/bpf/prog_tests/bind_perm.c +@@ -4,9 +4,9 @@ + #include + #include + #include +-#include + + #include "test_progs.h" ++#include "cap_helpers.h" + #include "bind_perm.skel.h" + + static int duration; +@@ -49,41 +49,11 @@ close_socket: + close(fd); + } + +-bool cap_net_bind_service(cap_flag_value_t flag) +-{ +- const cap_value_t cap_net_bind_service = CAP_NET_BIND_SERVICE; +- cap_flag_value_t original_value; +- bool was_effective = false; +- cap_t caps; +- +- caps = cap_get_proc(); +- if (CHECK(!caps, "cap_get_proc", "errno %d", errno)) +- goto free_caps; +- +- if (CHECK(cap_get_flag(caps, CAP_NET_BIND_SERVICE, CAP_EFFECTIVE, +- &original_value), +- "cap_get_flag", "errno %d", errno)) +- goto free_caps; +- +- was_effective = (original_value == CAP_SET); +- +- if (CHECK(cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_net_bind_service, +- flag), +- "cap_set_flag", "errno %d", errno)) +- goto free_caps; +- +- if (CHECK(cap_set_proc(caps), "cap_set_proc", "errno %d", errno)) +- goto free_caps; +- +-free_caps: +- CHECK(cap_free(caps), "cap_free", "errno %d", errno); +- return was_effective; +-} +- + void test_bind_perm(void) + { +- bool cap_was_effective; ++ const __u64 net_bind_svc_cap = 1ULL << CAP_NET_BIND_SERVICE; + struct bind_perm *skel; ++ __u64 old_caps = 0; + int cgroup_fd; + + if (create_netns()) +@@ -105,7 +75,8 @@ void test_bind_perm(void) + if (!ASSERT_OK_PTR(skel, "bind_v6_prog")) + goto close_skeleton; + +- cap_was_effective = cap_net_bind_service(CAP_CLEAR); ++ ASSERT_OK(cap_disable_effective(net_bind_svc_cap, &old_caps), ++ "cap_disable_effective"); + + try_bind(AF_INET, 110, EACCES); + try_bind(AF_INET6, 110, EACCES); +@@ -113,8 +84,9 @@ void test_bind_perm(void) + try_bind(AF_INET, 111, 0); + try_bind(AF_INET6, 111, 0); + +- if (cap_was_effective) +- cap_net_bind_service(CAP_SET); ++ if (old_caps & net_bind_svc_cap) ++ ASSERT_OK(cap_enable_effective(net_bind_svc_cap, NULL), ++ "cap_enable_effective"); + + close_skeleton: + bind_perm__destroy(skel); From 436e477430d224e533b96cb25cdc5923c62c0390 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Mon, 17 May 2021 11:57:40 -0700 Subject: [PATCH 0095/1171] kselftests-bpf: add kernel BPF tests Build and package kernel self-tests used for BPF testing, program and JIT development. This package, together with the existing 'kmod-bpf-test', was extensively used for past upstream Linux JIT submissions [1]. Currently this includes only 'test_verifier'; building 'test_progs' will fail due to known endian limitations with bpftool skeletons. [1]:https://lore.kernel.org/bpf/cover.1633392335.git.Tony.Ambardar@gmail.com Signed-off-by: Tony Ambardar (cherry picked from commit 3886ea9b87c416c080078603fedea95bcc144442) --- package/devel/kselftests-bpf/Makefile | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 package/devel/kselftests-bpf/Makefile diff --git a/package/devel/kselftests-bpf/Makefile b/package/devel/kselftests-bpf/Makefile new file mode 100644 index 00000000000000..ae845486bd45d7 --- /dev/null +++ b/package/devel/kselftests-bpf/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2021 Tony Ambardar +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=kselftests-bpf +PKG_VERSION:=$(LINUX_VERSION) +PKG_RELEASE:=1 +PKG_MAINTAINER:=Tony Ambardar + +PKG_BUILD_FLAGS:=gc-sections lto +PKG_BUILD_PARALLEL:=1 +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/kselftests-bpf + SECTION:=devel + CATEGORY:=Development + DEPENDS:= +libelf +zlib +libpthread +librt @!IN_SDK \ + @KERNEL_DEBUG_FS @KERNEL_DEBUG_INFO_BTF @KERNEL_BPF_EVENTS + TITLE:=Linux Kernel Selftests (BPF) + URL:=http://www.kernel.org +endef + +define Package/kselftests-bpf/description + kselftests-bpf is the Linux kernel BPF test suite +endef + +TEST_TARGET = test_verifier + +MAKE_PATH:=tools/testing/selftests/bpf + +MAKE_VARS = \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SAN_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + LDLIBS="$(TARGET_LDFLAGS)" \ + TOOLCHAIN_INCLUDE="$(TOOLCHAIN_DIR)/include" \ + VMLINUX_BTF="$(LINUX_DIR)/vmlinux" + +MAKE_FLAGS = \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ + O=$(PKG_BUILD_DIR) + +define Build/Compile + +$(MAKE_VARS) \ + $(MAKE) $(PKG_JOBS) -C $(LINUX_DIR)/$(MAKE_PATH) \ + $(MAKE_FLAGS) $(TEST_TARGET) ; +endef + +define Package/kselftests-bpf/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(TEST_TARGET) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,kselftests-bpf)) From c78ba8a69562fed73a409000a3d541ea7fa2a821 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 31 May 2023 22:51:12 +0200 Subject: [PATCH 0096/1171] valgrind: update to 3.21.0 Release Notes: https://valgrind.org/docs/manual/dist.news.html This improves support for the memory allocator used in musl libc 1.2.2 and later which is currently used by OpenWrt. Signed-off-by: Hauke Mehrtens (cherry picked from commit d85013460d47b538389b08506fda49e96a1968b5) --- package/devel/valgrind/Makefile | 4 +-- .../010-mips-Fix-new-syscall-numbers.patch | 30 +++++++++++++------ .../patches/100-fix_configure_check.patch | 2 +- .../patches/130-fix_arm_arch_detection.patch | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile index 372a720d017d5d..f696b28c3c79e9 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.20.0 +PKG_VERSION:=3.21.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/pub/valgrind/ -PKG_HASH:=8536c031dbe078d342f121fa881a9ecd205cb5a78e639005ad570011bdb9f3c6 +PKG_HASH:=10ce1618bb3e33fad16eb79552b0a3e1211762448a0d7fce11c8a6243b9ac971 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0+ diff --git a/package/devel/valgrind/patches/010-mips-Fix-new-syscall-numbers.patch b/package/devel/valgrind/patches/010-mips-Fix-new-syscall-numbers.patch index e84273c973225a..5967b0cadac210 100644 --- a/package/devel/valgrind/patches/010-mips-Fix-new-syscall-numbers.patch +++ b/package/devel/valgrind/patches/010-mips-Fix-new-syscall-numbers.patch @@ -1,11 +1,11 @@ -From 86ab9452bd10f08dbfa22d94e1155838f6f9f2e0 Mon Sep 17 00:00:00 2001 +From 82e935c564699456a766044faa39367b47cce793 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 31 Oct 2021 23:11:11 +0100 Subject: [PATCH] mips: Fix new syscall numbers The MIPS32 and MIPS64 O32 ABI are adding 4000 to all syscall numbers. The MIPS64 N64 ABI adds 5000 to each syscall and the MIPS64 N32 ABI adds -6000 to each syscall number. We can not sue the shared file for MIPS and +6000 to each syscall number. We can not use the shared file for MIPS and have to define this for each sycall separately. Without this change valgrind is not able to detect new syscalls like @@ -13,10 +13,10 @@ clock_gettime64 correctly. Signed-off-by: Hauke Mehrtens --- - include/pub_tool_vkiscnums_asm.h | 3 --- - include/vki/vki-scnums-mips32-linux.h | 36 +++++++++++++++++++++++++++ - include/vki/vki-scnums-mips64-linux.h | 32 ++++++++++++++++++++++++ - 3 files changed, 68 insertions(+), 3 deletions(-) + include/pub_tool_vkiscnums_asm.h | 3 -- + include/vki/vki-scnums-mips32-linux.h | 40 +++++++++++++++++++++++++++ + include/vki/vki-scnums-mips64-linux.h | 40 +++++++++++++++++++++++++++ + 3 files changed, 80 insertions(+), 3 deletions(-) --- a/include/pub_tool_vkiscnums_asm.h +++ b/include/pub_tool_vkiscnums_asm.h @@ -38,7 +38,7 @@ Signed-off-by: Hauke Mehrtens #elif defined(VGP_x86_freebsd) || defined(VGP_amd64_freebsd) --- a/include/vki/vki-scnums-mips32-linux.h +++ b/include/vki/vki-scnums-mips32-linux.h -@@ -401,6 +401,42 @@ +@@ -401,6 +401,46 @@ #define __NR_pkey_free (__NR_Linux + 365) #define __NR_statx (__NR_Linux + 366) @@ -73,17 +73,21 @@ Signed-off-by: Hauke Mehrtens +#define __NR_fsmount (__NR_Linux + 432) +#define __NR_fspick (__NR_Linux + 433) + ++#define __NR_pidfd_open (__NR_Linux + 434) +#define __NR_clone3 (__NR_Linux + 435) +#define __NR_close_range (__NR_Linux + 436) ++#define __NR_openat2 (__NR_Linux + 437) + +#define __NR_faccessat2 (__NR_Linux + 439) ++ ++#define __NR_epoll_pwait2 (__NR_Linux + 441) + /* * Offset of the last Linux o32 flavoured syscall */ --- a/include/vki/vki-scnums-mips64-linux.h +++ b/include/vki/vki-scnums-mips64-linux.h -@@ -363,6 +363,22 @@ +@@ -363,6 +363,26 @@ #define __NR_pkey_free (__NR_Linux + 325) #define __NR_statx (__NR_Linux + 326) @@ -98,15 +102,19 @@ Signed-off-by: Hauke Mehrtens +#define __NR_fsmount (__NR_Linux + 432) +#define __NR_fspick (__NR_Linux + 433) + ++#define __NR_pidfd_open (__NR_Linux + 434) +#define __NR_clone3 (__NR_Linux + 435) +#define __NR_close_range (__NR_Linux + 436) ++#define __NR_openat2 (__NR_Linux + 437) + +#define __NR_faccessat2 (__NR_Linux + 439) ++ ++#define __NR_epoll_pwait2 (__NR_Linux + 441) + #elif defined(VGABI_N32) /* -@@ -702,6 +718,22 @@ +@@ -702,6 +722,26 @@ #define __NR_pkey_free (__NR_Linux + 329) #define __NR_statx (__NR_Linux + 330) @@ -121,10 +129,14 @@ Signed-off-by: Hauke Mehrtens +#define __NR_fsmount (__NR_Linux + 432) +#define __NR_fspick (__NR_Linux + 433) + ++#define __NR_pidfd_open (__NR_Linux + 434) +#define __NR_clone3 (__NR_Linux + 435) +#define __NR_close_range (__NR_Linux + 436) ++#define __NR_openat2 (__NR_Linux + 437) + +#define __NR_faccessat2 (__NR_Linux + 439) ++ ++#define __NR_epoll_pwait2 (__NR_Linux + 441) + #else #error unknown mips64 abi diff --git a/package/devel/valgrind/patches/100-fix_configure_check.patch b/package/devel/valgrind/patches/100-fix_configure_check.patch index 38269bb14cd263..5fa51977e7b754 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 -@@ -368,7 +368,7 @@ case "${host_os}" in +@@ -364,7 +364,7 @@ case "${host_os}" in # Ok, this is linux. Check the kernel version AC_MSG_CHECKING([for the kernel version]) diff --git a/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch b/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch index 957e5c930fb6c4..9a7b591e70794b 100644 --- a/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch +++ b/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch @@ -6,7 +6,7 @@ Last-Update: 2013-11-30 --- a/configure.ac +++ b/configure.ac -@@ -275,7 +275,7 @@ case "${host_cpu}" in +@@ -271,7 +271,7 @@ case "${host_cpu}" in ARCH_MAX="s390x" ;; From e1d59497e9d0104388a58ceda770afcc087a6c37 Mon Sep 17 00:00:00 2001 From: Ivan Pavlov Date: Sun, 4 Jun 2023 22:34:39 +0300 Subject: [PATCH 0097/1171] openssl: update to 3.0.9 CVE-2023-2650 fix Remove upstreamed patches Major changes between OpenSSL 3.0.8 and OpenSSL 3.0.9 [30 May 2023] * Mitigate for very slow OBJ_obj2txt() performance with gigantic OBJECT IDENTIFIER sub-identities. (CVE-2023-2650) * Fixed buffer overread in AES-XTS decryption on ARM 64 bit platforms (CVE-2023-1255) * Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466) * Fixed handling of invalid certificate policies in leaf certificates (CVE-2023-0465) * Limited the number of nodes created in a policy tree (CVE-2023-0464) Signed-off-by: Ivan Pavlov (cherry picked from commit 6348850f10545aac70db94d3a9555a4f2eb84281) --- package/libs/openssl/Makefile | 6 +- .../120-strip-cflags-from-binary.patch | 2 +- ...esource-use-verifying-policy-constra.patch | 207 ------------------ ...AG_INVALID_POLICY-is-checked-even-in.patch | 44 ---- ...oid-buffer-overrread-in-AES-XTS-decr.patch | 39 ---- 5 files changed, 4 insertions(+), 294 deletions(-) delete mode 100644 package/libs/openssl/patches/200-x509-excessive-resource-use-verifying-policy-constra.patch delete mode 100644 package/libs/openssl/patches/210-Ensure-that-EXFLAG_INVALID_POLICY-is-checked-even-in.patch delete mode 100644 package/libs/openssl/patches/220-aesv8-armx.pl-Avoid-buffer-overrread-in-AES-XTS-decr.patch diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 66ababab3c731f..a34a7849733c1d 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl -PKG_VERSION:=3.0.8 -PKG_RELEASE:=10 +PKG_VERSION:=3.0.9 +PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections PKG_BUILD_PARALLEL:=1 @@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e +PKG_HASH:=eb1ab04781474360f77c318ab89d8c5a03abc38e63d65a603cabbf1b00a1dc90 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch index e9f4fc131aaf4a..c4f2540395b415 100644 --- a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch +++ b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch @@ -10,7 +10,7 @@ Signed-off-by: Eneas U de Queiroz --- a/crypto/build.info +++ b/crypto/build.info -@@ -113,7 +113,7 @@ DEFINE[../libcrypto]=$UPLINKDEF +@@ -111,7 +111,7 @@ DEFINE[../libcrypto]=$UPLINKDEF DEPEND[info.o]=buildinf.h DEPEND[cversion.o]=buildinf.h diff --git a/package/libs/openssl/patches/200-x509-excessive-resource-use-verifying-policy-constra.patch b/package/libs/openssl/patches/200-x509-excessive-resource-use-verifying-policy-constra.patch deleted file mode 100644 index 927634c0a745cf..00000000000000 --- a/package/libs/openssl/patches/200-x509-excessive-resource-use-verifying-policy-constra.patch +++ /dev/null @@ -1,207 +0,0 @@ -From 959c59c7a0164117e7f8366466a32bb1f8d77ff1 Mon Sep 17 00:00:00 2001 -From: Pauli -Date: Wed, 8 Mar 2023 15:28:20 +1100 -Subject: [PATCH] x509: excessive resource use verifying policy constraints - -A security vulnerability has been identified in all supported versions -of OpenSSL related to the verification of X.509 certificate chains -that include policy constraints. Attackers may be able to exploit this -vulnerability by creating a malicious certificate chain that triggers -exponential use of computational resources, leading to a denial-of-service -(DoS) attack on affected systems. - -Fixes CVE-2023-0464 - -Reviewed-by: Tomas Mraz -Reviewed-by: Shane Lontis -(Merged from https://github.com/openssl/openssl/pull/20568) - ---- a/crypto/x509/pcy_local.h -+++ b/crypto/x509/pcy_local.h -@@ -111,6 +111,11 @@ struct X509_POLICY_LEVEL_st { - }; - - struct X509_POLICY_TREE_st { -+ /* The number of nodes in the tree */ -+ size_t node_count; -+ /* The maximum number of nodes in the tree */ -+ size_t node_maximum; -+ - /* This is the tree 'level' data */ - X509_POLICY_LEVEL *levels; - int nlevel; -@@ -157,7 +162,8 @@ X509_POLICY_NODE *ossl_policy_tree_find_ - X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level, - X509_POLICY_DATA *data, - X509_POLICY_NODE *parent, -- X509_POLICY_TREE *tree); -+ X509_POLICY_TREE *tree, -+ int extra_data); - void ossl_policy_node_free(X509_POLICY_NODE *node); - int ossl_policy_node_match(const X509_POLICY_LEVEL *lvl, - const X509_POLICY_NODE *node, const ASN1_OBJECT *oid); ---- a/crypto/x509/pcy_node.c -+++ b/crypto/x509/pcy_node.c -@@ -59,10 +59,15 @@ X509_POLICY_NODE *ossl_policy_level_find - X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level, - X509_POLICY_DATA *data, - X509_POLICY_NODE *parent, -- X509_POLICY_TREE *tree) -+ X509_POLICY_TREE *tree, -+ int extra_data) - { - X509_POLICY_NODE *node; - -+ /* Verify that the tree isn't too large. This mitigates CVE-2023-0464 */ -+ if (tree->node_maximum > 0 && tree->node_count >= tree->node_maximum) -+ return NULL; -+ - node = OPENSSL_zalloc(sizeof(*node)); - if (node == NULL) { - ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE); -@@ -70,7 +75,7 @@ X509_POLICY_NODE *ossl_policy_level_add_ - } - node->data = data; - node->parent = parent; -- if (level) { -+ if (level != NULL) { - if (OBJ_obj2nid(data->valid_policy) == NID_any_policy) { - if (level->anyPolicy) - goto node_error; -@@ -90,7 +95,7 @@ X509_POLICY_NODE *ossl_policy_level_add_ - } - } - -- if (tree) { -+ if (extra_data) { - if (tree->extra_data == NULL) - tree->extra_data = sk_X509_POLICY_DATA_new_null(); - if (tree->extra_data == NULL){ -@@ -103,6 +108,7 @@ X509_POLICY_NODE *ossl_policy_level_add_ - } - } - -+ tree->node_count++; - if (parent) - parent->nchild++; - ---- a/crypto/x509/pcy_tree.c -+++ b/crypto/x509/pcy_tree.c -@@ -14,6 +14,17 @@ - - #include "pcy_local.h" - -+/* -+ * If the maximum number of nodes in the policy tree isn't defined, set it to -+ * a generous default of 1000 nodes. -+ * -+ * Defining this to be zero means unlimited policy tree growth which opens the -+ * door on CVE-2023-0464. -+ */ -+#ifndef OPENSSL_POLICY_TREE_NODES_MAX -+# define OPENSSL_POLICY_TREE_NODES_MAX 1000 -+#endif -+ - static void expected_print(BIO *channel, - X509_POLICY_LEVEL *lev, X509_POLICY_NODE *node, - int indent) -@@ -163,6 +174,9 @@ static int tree_init(X509_POLICY_TREE ** - return X509_PCY_TREE_INTERNAL; - } - -+ /* Limit the growth of the tree to mitigate CVE-2023-0464 */ -+ tree->node_maximum = OPENSSL_POLICY_TREE_NODES_MAX; -+ - /* - * http://tools.ietf.org/html/rfc5280#section-6.1.2, figure 3. - * -@@ -180,7 +194,7 @@ static int tree_init(X509_POLICY_TREE ** - if ((data = ossl_policy_data_new(NULL, - OBJ_nid2obj(NID_any_policy), 0)) == NULL) - goto bad_tree; -- if (ossl_policy_level_add_node(level, data, NULL, tree) == NULL) { -+ if (ossl_policy_level_add_node(level, data, NULL, tree, 1) == NULL) { - ossl_policy_data_free(data); - goto bad_tree; - } -@@ -239,7 +253,8 @@ static int tree_init(X509_POLICY_TREE ** - * Return value: 1 on success, 0 otherwise - */ - static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr, -- X509_POLICY_DATA *data) -+ X509_POLICY_DATA *data, -+ X509_POLICY_TREE *tree) - { - X509_POLICY_LEVEL *last = curr - 1; - int i, matched = 0; -@@ -249,13 +264,13 @@ static int tree_link_matching_nodes(X509 - X509_POLICY_NODE *node = sk_X509_POLICY_NODE_value(last->nodes, i); - - if (ossl_policy_node_match(last, node, data->valid_policy)) { -- if (ossl_policy_level_add_node(curr, data, node, NULL) == NULL) -+ if (ossl_policy_level_add_node(curr, data, node, tree, 0) == NULL) - return 0; - matched = 1; - } - } - if (!matched && last->anyPolicy) { -- if (ossl_policy_level_add_node(curr, data, last->anyPolicy, NULL) == NULL) -+ if (ossl_policy_level_add_node(curr, data, last->anyPolicy, tree, 0) == NULL) - return 0; - } - return 1; -@@ -268,7 +283,8 @@ static int tree_link_matching_nodes(X509 - * Return value: 1 on success, 0 otherwise. - */ - static int tree_link_nodes(X509_POLICY_LEVEL *curr, -- const X509_POLICY_CACHE *cache) -+ const X509_POLICY_CACHE *cache, -+ X509_POLICY_TREE *tree) - { - int i; - -@@ -276,7 +292,7 @@ static int tree_link_nodes(X509_POLICY_L - X509_POLICY_DATA *data = sk_X509_POLICY_DATA_value(cache->data, i); - - /* Look for matching nodes in previous level */ -- if (!tree_link_matching_nodes(curr, data)) -+ if (!tree_link_matching_nodes(curr, data, tree)) - return 0; - } - return 1; -@@ -307,7 +323,7 @@ static int tree_add_unmatched(X509_POLIC - /* Curr may not have anyPolicy */ - data->qualifier_set = cache->anyPolicy->qualifier_set; - data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; -- if (ossl_policy_level_add_node(curr, data, node, tree) == NULL) { -+ if (ossl_policy_level_add_node(curr, data, node, tree, 1) == NULL) { - ossl_policy_data_free(data); - return 0; - } -@@ -370,7 +386,7 @@ static int tree_link_any(X509_POLICY_LEV - /* Finally add link to anyPolicy */ - if (last->anyPolicy && - ossl_policy_level_add_node(curr, cache->anyPolicy, -- last->anyPolicy, NULL) == NULL) -+ last->anyPolicy, tree, 0) == NULL) - return 0; - return 1; - } -@@ -553,7 +569,7 @@ static int tree_calculate_user_set(X509_ - extra->flags = POLICY_DATA_FLAG_SHARED_QUALIFIERS - | POLICY_DATA_FLAG_EXTRA_NODE; - node = ossl_policy_level_add_node(NULL, extra, anyPolicy->parent, -- tree); -+ tree, 1); - } - if (!tree->user_policies) { - tree->user_policies = sk_X509_POLICY_NODE_new_null(); -@@ -580,7 +596,7 @@ static int tree_evaluate(X509_POLICY_TRE - - for (i = 1; i < tree->nlevel; i++, curr++) { - cache = ossl_policy_cache_set(curr->cert); -- if (!tree_link_nodes(curr, cache)) -+ if (!tree_link_nodes(curr, cache, tree)) - return X509_PCY_TREE_INTERNAL; - - if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY) diff --git a/package/libs/openssl/patches/210-Ensure-that-EXFLAG_INVALID_POLICY-is-checked-even-in.patch b/package/libs/openssl/patches/210-Ensure-that-EXFLAG_INVALID_POLICY-is-checked-even-in.patch deleted file mode 100644 index 01819c15a8b646..00000000000000 --- a/package/libs/openssl/patches/210-Ensure-that-EXFLAG_INVALID_POLICY-is-checked-even-in.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 1dd43e0709fece299b15208f36cc7c76209ba0bb Mon Sep 17 00:00:00 2001 -From: Matt Caswell -Date: Tue, 7 Mar 2023 16:52:55 +0000 -Subject: [PATCH] Ensure that EXFLAG_INVALID_POLICY is checked even in leaf - certs - -Even though we check the leaf cert to confirm it is valid, we -later ignored the invalid flag and did not notice that the leaf -cert was bad. - -Fixes: CVE-2023-0465 - -Reviewed-by: Hugo Landau -Reviewed-by: Tomas Mraz -(Merged from https://github.com/openssl/openssl/pull/20587) - ---- a/crypto/x509/x509_vfy.c -+++ b/crypto/x509/x509_vfy.c -@@ -1654,15 +1654,23 @@ static int check_policy(X509_STORE_CTX * - goto memerr; - /* Invalid or inconsistent extensions */ - if (ret == X509_PCY_TREE_INVALID) { -- int i; -+ int i, cbcalled = 0; - - /* Locate certificates with bad extensions and notify callback. */ -- for (i = 1; i < sk_X509_num(ctx->chain); i++) { -+ for (i = 0; i < sk_X509_num(ctx->chain); i++) { - X509 *x = sk_X509_value(ctx->chain, i); - -+ if ((x->ex_flags & EXFLAG_INVALID_POLICY) != 0) -+ cbcalled = 1; - CB_FAIL_IF((x->ex_flags & EXFLAG_INVALID_POLICY) != 0, - ctx, x, i, X509_V_ERR_INVALID_POLICY_EXTENSION); - } -+ if (!cbcalled) { -+ /* Should not be able to get here */ -+ ERR_raise(ERR_LIB_X509, ERR_R_INTERNAL_ERROR); -+ return 0; -+ } -+ /* The callback ignored the error so we return success */ - return 1; - } - if (ret == X509_PCY_TREE_FAILURE) { diff --git a/package/libs/openssl/patches/220-aesv8-armx.pl-Avoid-buffer-overrread-in-AES-XTS-decr.patch b/package/libs/openssl/patches/220-aesv8-armx.pl-Avoid-buffer-overrread-in-AES-XTS-decr.patch deleted file mode 100644 index d6a45aec21ee4c..00000000000000 --- a/package/libs/openssl/patches/220-aesv8-armx.pl-Avoid-buffer-overrread-in-AES-XTS-decr.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 02ac9c9420275868472f33b01def01218742b8bb Mon Sep 17 00:00:00 2001 -From: Tomas Mraz -Date: Mon, 17 Apr 2023 16:51:20 +0200 -Subject: [PATCH] aesv8-armx.pl: Avoid buffer overrread in AES-XTS decryption - -Original author: Nevine Ebeid (Amazon) -Fixes: CVE-2023-1255 - -The buffer overread happens on decrypts of 4 mod 5 sizes. -Unless the memory just after the buffer is unmapped this is harmless. - -Reviewed-by: Paul Dale -Reviewed-by: Tom Cosgrove -(Merged from https://github.com/openssl/openssl/pull/20759) - -(cherry picked from commit 72dfe46550ee1f1bbfacd49f071419365bc23304) - -diff --git a/crypto/aes/asm/aesv8-armx.pl b/crypto/aes/asm/aesv8-armx.pl -index 6a7bf05d1b..bd583e2c89 100755 ---- a/crypto/aes/asm/aesv8-armx.pl -+++ b/crypto/aes/asm/aesv8-armx.pl -@@ -3353,7 +3353,7 @@ $code.=<<___ if ($flavour =~ /64/); - .align 4 - .Lxts_dec_tail4x: - add $inp,$inp,#16 -- vld1.32 {$dat0},[$inp],#16 -+ tst $tailcnt,#0xf - veor $tmp1,$dat1,$tmp0 - vst1.8 {$tmp1},[$out],#16 - veor $tmp2,$dat2,$tmp2 -@@ -3362,6 +3362,8 @@ $code.=<<___ if ($flavour =~ /64/); - veor $tmp4,$dat4,$tmp4 - vst1.8 {$tmp3-$tmp4},[$out],#32 - -+ b.eq .Lxts_dec_abort -+ vld1.32 {$dat0},[$inp],#16 - b .Lxts_done - .align 4 - .Lxts_outer_dec_tail: From c4c14e9ce80d7a9981fb1fd3997addfb5104edde Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 26 May 2023 13:31:26 +0100 Subject: [PATCH 0098/1171] mediatek: use cpufreq fix suggested by MediaTek Use suggested fix for mediatek-cpufreq, patch will also be sent upstream. Signed-off-by: Daniel Golle (cherry picked from commit 7e93f520d6b12bc04391f987b63c633d3b113e26) --- ...-correct-voltages-for-MT7622-and-MT7.patch | 53 +++++++++++++++++++ ...ek-don-t-request-unsupported-voltage.patch | 29 ---------- 2 files changed, 53 insertions(+), 29 deletions(-) create mode 100644 target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-correct-voltages-for-MT7622-and-MT7.patch delete mode 100644 target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch diff --git a/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-correct-voltages-for-MT7622-and-MT7.patch b/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-correct-voltages-for-MT7622-and-MT7.patch new file mode 100644 index 00000000000000..6ab05b897c3e39 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-correct-voltages-for-MT7622-and-MT7.patch @@ -0,0 +1,53 @@ +From e7697814c142c99f470c3458d49e41b25a575f23 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 26 May 2023 10:31:40 +0100 +Subject: [PATCH] cpufreq: mediatek: correct voltages for MT7622 and MT7623 + +The MT6380 regulator typically used together with MT7622 does not +support the current maximum processor and SRAM voltage in the cpufreq +driver (1360000uV). +For MT7622 limit processor and SRAM supply voltages to 1350000uV to +avoid having the tracking algorithm request unsupported voltages from +the regulator. + +On MT7623 there is no separate SRAM supply and the maximum voltage used +is 1300000uV. Create dedicated platform data for MT7623 to cover that +case as well. + +Fixes: 0883426fd07e3 ("cpufreq: mediatek: Raise proc and sram max voltage for MT7622/7623") +Suggested-by: Jia-wei Chang +Signed-off-by: Daniel Golle +--- + drivers/cpufreq/mediatek-cpufreq.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- a/drivers/cpufreq/mediatek-cpufreq.c ++++ b/drivers/cpufreq/mediatek-cpufreq.c +@@ -696,9 +696,16 @@ static const struct mtk_cpufreq_platform + static const struct mtk_cpufreq_platform_data mt7622_platform_data = { + .min_volt_shift = 100000, + .max_volt_shift = 200000, +- .proc_max_volt = 1360000, ++ .proc_max_volt = 1350000, + .sram_min_volt = 0, +- .sram_max_volt = 1360000, ++ .sram_max_volt = 1350000, ++ .ccifreq_supported = false, ++}; ++ ++static const struct mtk_cpufreq_platform_data mt7623_platform_data = { ++ .min_volt_shift = 100000, ++ .max_volt_shift = 200000, ++ .proc_max_volt = 1300000, + .ccifreq_supported = false, + }; + +@@ -743,7 +750,7 @@ static const struct of_device_id mtk_cpu + { .compatible = "mediatek,mt2701", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt2712", .data = &mt2701_platform_data }, + { .compatible = "mediatek,mt7622", .data = &mt7622_platform_data }, +- { .compatible = "mediatek,mt7623", .data = &mt7622_platform_data }, ++ { .compatible = "mediatek,mt7623", .data = &mt7623_platform_data }, + { .compatible = "mediatek,mt7988", .data = &mt7988_platform_data }, + { .compatible = "mediatek,mt8167", .data = &mt8516_platform_data }, + { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data }, diff --git a/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch b/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch deleted file mode 100644 index a7a4bd8ea2bba9..00000000000000 --- a/target/linux/mediatek/patches-5.15/351-cpufreq-mediatek-don-t-request-unsupported-voltage.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 20aad28ba5d62f1618408c264384d0b2ad7417db Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Mon, 22 May 2023 23:25:48 +0100 -Subject: [PATCH] cpufreq: mediatek: don't request unsupported voltage - -PMICs on MT7622 and MT7623 boards only support up to 1350000uV despite -the SoC's processor and SRAM voltage can be up to 1360000uV. As a -work-around specify max. processor and SRAM voltage as 1350000uV to -avoid requesting an unsupported voltage from the regulator. - -Signed-off-by: Daniel Golle ---- - drivers/cpufreq/mediatek-cpufreq.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/cpufreq/mediatek-cpufreq.c -+++ b/drivers/cpufreq/mediatek-cpufreq.c -@@ -696,9 +696,9 @@ static const struct mtk_cpufreq_platform - static const struct mtk_cpufreq_platform_data mt7622_platform_data = { - .min_volt_shift = 100000, - .max_volt_shift = 200000, -- .proc_max_volt = 1360000, -+ .proc_max_volt = 1350000, - .sram_min_volt = 0, -- .sram_max_volt = 1360000, -+ .sram_max_volt = 1350000, - .ccifreq_supported = false, - }; - From 4494791fc7ce0e55234e07a90d31902d39a17066 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 1 Jun 2023 10:32:19 +0100 Subject: [PATCH 0099/1171] mediatek: use existing I2C clock names PCK and MCK should really be P=PMIC and M=MEM, which means that they should effectively be CLK_PMIC and CLK_ARB. Suggested-by: AngeloGioacchino Del Regno Signed-off-by: Daniel Golle (cherry picked from commit 0580747adab2094862c18b5e762c908dd3b43236) --- .../arch/arm64/boot/dts/mediatek/mt7981.dtsi | 2 +- ...ing-i2c-mt65xx-add-additional-clocks.patch | 55 ------------------- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index 17038a24847278..304566810a0b3e 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -327,7 +327,7 @@ <&infracfg CLK_INFRA_AP_DMA_CK>, <&infracfg CLK_INFRA_I2C_MCK_CK>, <&infracfg CLK_INFRA_I2C_PCK_CK>; - clock-names = "main", "dma", "mck", "pck"; + clock-names = "main", "dma", "arb", "pmic"; #address-cells = <1>; #size-cells = <0>; status = "disabled"; diff --git a/target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch b/target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch deleted file mode 100644 index 1ed8d1a96a3363..00000000000000 --- a/target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 94bf61df9201195d6d8ce82e299fb231b31fbaae Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Fri, 26 May 2023 10:29:45 +0100 -Subject: [PATCH] i2c: mt65xx: add additional clocks - -On MT7981 additional clocks are required when accessing I2C registers. -Add MCK and PCK optional clocks to i2c-mt65xx driver so we don't have -to always have them enabled, but really only if I2C is used. - -Signed-off-by: Daniel Golle ---- - drivers/i2c/busses/i2c-mt65xx.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - ---- a/drivers/i2c/busses/i2c-mt65xx.c -+++ b/drivers/i2c/busses/i2c-mt65xx.c -@@ -93,6 +93,8 @@ - * @I2C_MT65XX_CLK_DMA: DMA clock for i2c via DMA - * @I2C_MT65XX_CLK_PMIC: PMIC clock for i2c from PMIC - * @I2C_MT65XX_CLK_ARB: Arbitrator clock for i2c -+ * @I2C_MT65XX_CLK_MCK: MCK clock for i2c -+ * @I2C_MT65XX_CLK_PCK: PCK clock for i2c - * @I2C_MT65XX_CLK_MAX: Number of supported clocks - */ - enum i2c_mt65xx_clks { -@@ -100,11 +102,13 @@ enum i2c_mt65xx_clks { - I2C_MT65XX_CLK_DMA, - I2C_MT65XX_CLK_PMIC, - I2C_MT65XX_CLK_ARB, -+ I2C_MT65XX_CLK_MCK, -+ I2C_MT65XX_CLK_PCK, - I2C_MT65XX_CLK_MAX - }; - - static const char * const i2c_mt65xx_clk_ids[I2C_MT65XX_CLK_MAX] = { -- "main", "dma", "pmic", "arb" -+ "main", "dma", "pmic", "arb", "mck", "pck" - }; - - enum DMA_REGS_OFFSET { -@@ -1444,6 +1448,14 @@ static int mtk_i2c_probe(struct platform - if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk)) - return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk); - -+ i2c->clocks[I2C_MT65XX_CLK_MCK].clk = devm_clk_get_optional(&pdev->dev, "mck"); -+ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk)) -+ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk); -+ -+ i2c->clocks[I2C_MT65XX_CLK_PCK].clk = devm_clk_get_optional(&pdev->dev, "pck"); -+ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk)) -+ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk); -+ - if (i2c->have_pmic) { - i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get(&pdev->dev, "pmic"); - if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) { From d46e13d8648a3969789d6e0bd28eddfd05f121ee Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 4 Jun 2023 16:05:29 +0100 Subject: [PATCH 0100/1171] mediatek: convert mt7986a-zyxel-ex5601-t0-stock.dts to UNIX The device tree file was in DOS format (CR-LF). Convert it to UNIX style. Signed-off-by: Daniel Golle (cherry picked from commit d28534545edfa29e9529f9c9cd5960889a9d4018) --- .../dts/mt7986a-zyxel-ex5601-t0-stock.dts | 1120 ++++++++--------- 1 file changed, 560 insertions(+), 560 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts index 07a3e8d3ee9d04..32b581c3c2a34f 100644 --- a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts @@ -1,560 +1,560 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Copyright (C) 2021 MediaTek Inc. - * Author: Sam.Shih - */ - -/dts-v1/; -#include "mt7986a.dtsi" -#include -#include - -/ { - model = "Zyxel EX5601-T0"; - compatible = "zyxel,ex5601-t0", "mediatek,mt7986a-rfb-snand"; - - aliases { - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory { - reg = <0 0x40000000 0 0x40000000>; - }; - - reg_1p8v: regulator-1p8v { - compatible = "regulator-fixed"; - regulator-name = "fixed-1.8V"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-boot-on; - regulator-always-on; - }; - - reg_3p3v: regulator-3p3v { - compatible = "regulator-fixed"; - regulator-name = "fixed-3.3V"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - - reg_5v: regulator-5v { - compatible = "regulator-fixed"; - regulator-name = "fixed-5V"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - regulator-boot-on; - regulator-always-on; - }; - - gpio-keys { - compatible = "gpio-keys"; - poll-interval = <20>; - - reset-button { - label = "reset"; - gpios = <&pio 21 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wlan-button { - label = "wlan"; - gpios = <&pio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps-button { - label = "wps"; - gpios = <&pio 56 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - zyleds { - compatible = "gpio-leds"; - - led_green_wifi24g { - label = "zyled-green-wifi24g"; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_wifi5g { - label = "zyled-green-wifi5g"; - gpios = <&pio 2 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_inet { - label = "zyled-green-inet"; - gpios = <&pio 14 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_red_inet { - label = "zyled-red-inet"; - gpios = <&pio 15 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_pwr { - label = "zyled-green-pwr"; - gpios = <&pio 13 GPIO_ACTIVE_LOW>; - linux,default-trigger = "timer"; /* Default blinking */ - led-pattern = <125 125>; /* Fast blink is 4 HZ */ - }; - - led_red_pwr { - label = "zyled-red-pwr"; - gpios = <&pio 12 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_fxs { - label = "zyled-green-fxs"; - gpios = <&pio 16 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_amber_fxs { - label = "zyled-amber-fxs"; - gpios = <&pio 17 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_amber_wps24g { - label = "zyled-amber-wps24g"; - gpios = <&pio 18 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_amber_wps5g { - label = "zyled-amber-wps5g"; - gpios = <&pio 19 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_green_lan { - label = "zyled-green-lan"; - gpios = <&pio 20 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_green_sfp { - label = "zyled-green-sfp"; - gpios = <&pio 24 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - }; - -}; - -ð { - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "2500base-x"; - - nvmem-cells = <&macaddr_factory_002a>; - nvmem-cell-names = "mac-address"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - phy-mode = "2500base-x"; - phy = <&phy6>; - - nvmem-cells = <&macaddr_factory_0024>; - nvmem-cell-names = "mac-address"; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; - reset-delay-us = <1500000>; - reset-post-delay-us = <1000000>; - - phy5: phy@5 { - compatible = "ethernet-phy-ieee802.3-c45"; - reg = <5>; - }; - - phy6: phy@6 { - compatible = "ethernet-phy-ieee802.3-c45"; - reg = <6>; - }; - - switch@0 { - compatible = "mediatek,mt7531"; - reg = <31>; - reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@1 { - reg = <1>; - label = "lan1"; - }; - - port@2 { - reg = <2>; - label = "lan2"; - }; - - port@3 { - reg = <3>; - label = "lan3"; - }; - - port@5 { - reg = <5>; - label = "lan4"; - phy-mode = "2500base-x"; - phy = <&phy5>; - }; - - port@6 { - reg = <6>; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - }; - }; - }; -}; - -&wmac { - status = "okay"; - pinctrl-names = "default", "dbdc"; - pinctrl-0 = <&wf_2g_5g_pins>; - pinctrl-1 = <&wf_dbdc_pins>; - mediatek,mtd-eeprom = <&factory 0x0>; - nvmem-cells = <&macaddr_factory_0004>; - nvmem-cell-names = "mac-address"; -}; - -&crypto { - status = "okay"; -}; - -&mmc0 { - pinctrl-names = "default", "state_uhs"; - pinctrl-0 = <&mmc0_pins_default>; - pinctrl-1 = <&mmc0_pins_uhs>; - bus-width = <8>; - max-frequency = <200000000>; - cap-mmc-highspeed; - mmc-hs200-1_8v; - mmc-hs400-1_8v; - hs400-ds-delay = <0x14014>; - vmmc-supply = <®_3p3v>; - vqmmc-supply = <®_1p8v>; - non-removable; - no-sd; - no-sdio; - status = "disabled"; -}; - -&pcie { - pinctrl-names = "default"; - pinctrl-0 = <&pcie_pins>; - status = "okay"; -}; - -&pcie_phy { - status = "okay"; -}; - -&pio { - mmc0_pins_default: mmc0-pins { - mux { - function = "emmc"; - groups = "emmc_51"; - }; - conf-cmd-dat { - pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", - "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", - "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; - input-enable; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - conf-clk { - pins = "EMMC_CK"; - drive-strength = <6>; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-ds { - pins = "EMMC_DSL"; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-rst { - pins = "EMMC_RSTB"; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - }; - - mmc0_pins_uhs: mmc0-uhs-pins { - mux { - function = "emmc"; - groups = "emmc_51"; - }; - conf-cmd-dat { - pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", - "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", - "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; - input-enable; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - conf-clk { - pins = "EMMC_CK"; - drive-strength = <6>; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-ds { - pins = "EMMC_DSL"; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-rst { - pins = "EMMC_RSTB"; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - }; - - pcie_pins: pcie-pins { - mux { - function = "pcie"; - groups = "pcie_clk", "pcie_wake", "pcie_pereset"; - }; - }; - - spic_pins_g2: spic-pins-29-to-32 { - mux { - function = "spi"; - groups = "spi1_2"; - }; - }; - - spi_flash_pins: spi-flash-pins-33-to-38 { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - conf-pu { - pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; - drive-strength = <8>; - mediatek,pull-up-adv = <0>; /* bias-disable */ - }; - conf-pd { - pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; - drive-strength = <8>; - mediatek,pull-down-adv = <0>; /* bias-disable */ - }; - }; - - uart1_pins: uart1-pins { - mux { - function = "uart"; - groups = "uart1"; - }; - }; - - uart2_pins: uart2-pins { - mux { - function = "uart"; - groups = "uart2"; - }; - }; - - wf_2g_5g_pins: wf_2g_5g-pins { - mux { - function = "wifi"; - groups = "wf_2g", "wf_5g"; - }; - conf { - pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", - "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", - "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", - "WF1_TOP_CLK", "WF1_TOP_DATA"; - drive-strength = <4>; - }; - }; - - wf_dbdc_pins: wf_dbdc-pins { - mux { - function = "wifi"; - groups = "wf_dbdc"; - }; - conf { - pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", - "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", - "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", - "WF1_TOP_CLK", "WF1_TOP_DATA"; - drive-strength = <4>; - }; - }; -}; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi_flash_pins>; - cs-gpios = <0>, <0>; - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - - spi_nand: spi_nand@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "spi-nand"; - reg = <1>; - spi-max-frequency = <10000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "BL2"; - reg = <0x00000 0x0100000>; - read-only; - }; - - partition@100000 { - label = "u-boot-env"; - reg = <0x0100000 0x0080000>; - }; - - factory: partition@180000 { - label = "Factory"; - reg = <0x180000 0x0200000>; - read-only; - }; - - partition@380000 { - label = "FIP"; - reg = <0x380000 0x01C0000>; - read-only; - }; - - partition@540000 { - label = "zloader"; - reg = <0x540000 0x0040000>; - read-only; - }; - - partition@580000 { - label = "ubi"; - reg = <0x580000 0x4000000>; - }; - - partition@4580000 { - label = "ubi2"; - reg = <0x4580000 0x4000000>; - read-only; - }; - - partition@8580000 { - label = "zyubi"; - reg = <0x8580000 0x15A80000>; - }; - }; - }; -}; - -&spi1 { - pinctrl-names = "default"; - pinctrl-0 = <&spic_pins_g2>; - status = "okay"; - - proslic_spi: proslic_spi@0 { - compatible = "silabs,proslic_spi"; - reg = <0>; - spi-max-frequency = <10000000>; - spi-cpha = <1>; - spi-cpol = <1>; - channel_count = <1>; - debug_level = <4>; /* 1 = TRC, 2 = DBG, 4 = ERR */ - reset_gpio = <&pio 7 GPIO_ACTIVE_HIGH>; - ig,enable-spi = <1>; /* 1: Enable, 0: Disable */ - }; -}; - -&ssusb { - vusb33-supply = <®_3p3v>; - vbus-supply = <®_5v>; - status = "okay"; -}; - -&uart0 { - status = "okay"; -}; - -&uart1 { - pinctrl-names = "default"; - pinctrl-0 = <&uart1_pins>; - status = "okay"; -}; - -&uart2 { - pinctrl-names = "default"; - pinctrl-0 = <&uart2_pins>; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_0004: macaddr@0004 { - reg = <0x0004 0x6>; - }; - - macaddr_factory_0024: macaddr@0024 { - reg = <0x0024 0x6>; - }; - - macaddr_factory_002a: macaddr@002a { - reg = <0x002a 0x6>; - }; -}; +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +#include "mt7986a.dtsi" +#include +#include + +/ { + model = "Zyxel EX5601-T0"; + compatible = "zyxel,ex5601-t0", "mediatek,mt7986a-rfb-snand"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + gpio-keys { + compatible = "gpio-keys"; + poll-interval = <20>; + + reset-button { + label = "reset"; + gpios = <&pio 21 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wlan-button { + label = "wlan"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps-button { + label = "wps"; + gpios = <&pio 56 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + zyleds { + compatible = "gpio-leds"; + + led_green_wifi24g { + label = "zyled-green-wifi24g"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_wifi5g { + label = "zyled-green-wifi5g"; + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_inet { + label = "zyled-green-inet"; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_red_inet { + label = "zyled-red-inet"; + gpios = <&pio 15 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_pwr { + label = "zyled-green-pwr"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; /* Default blinking */ + led-pattern = <125 125>; /* Fast blink is 4 HZ */ + }; + + led_red_pwr { + label = "zyled-red-pwr"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_fxs { + label = "zyled-green-fxs"; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_fxs { + label = "zyled-amber-fxs"; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_wps24g { + label = "zyled-amber-wps24g"; + gpios = <&pio 18 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_wps5g { + label = "zyled-amber-wps5g"; + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_green_lan { + label = "zyled-green-lan"; + gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_green_sfp { + label = "zyled-green-sfp"; + gpios = <&pio 24 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + }; + +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_factory_002a>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy = <&phy6>; + + nvmem-cells = <&macaddr_factory_0024>; + nvmem-cell-names = "mac-address"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <1500000>; + reset-post-delay-us = <1000000>; + + phy5: phy@5 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + }; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@5 { + reg = <5>; + label = "lan4"; + phy-mode = "2500base-x"; + phy = <&phy5>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&wmac { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; + mediatek,mtd-eeprom = <&factory 0x0>; + nvmem-cells = <&macaddr_factory_0004>; + nvmem-cell-names = "mac-address"; +}; + +&crypto { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <8>; + max-frequency = <200000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + mmc-hs400-1_8v; + hs400-ds-delay = <0x14014>; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; + non-removable; + no-sd; + no-sdio; + status = "disabled"; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pio { + mmc0_pins_default: mmc0-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + mmc0_pins_uhs: mmc0-uhs-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + pcie_pins: pcie-pins { + mux { + function = "pcie"; + groups = "pcie_clk", "pcie_wake", "pcie_pereset"; + }; + }; + + spic_pins_g2: spic-pins-29-to-32 { + mux { + function = "spi"; + groups = "spi1_2"; + }; + }; + + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + uart1_pins: uart1-pins { + mux { + function = "uart"; + groups = "uart1"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart"; + groups = "uart2"; + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf_dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + cs-gpios = <0>, <0>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + spi_nand: spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <10000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x01C0000>; + read-only; + }; + + partition@540000 { + label = "zloader"; + reg = <0x540000 0x0040000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; + }; + + partition@4580000 { + label = "ubi2"; + reg = <0x4580000 0x4000000>; + read-only; + }; + + partition@8580000 { + label = "zyubi"; + reg = <0x8580000 0x15A80000>; + }; + }; + }; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spic_pins_g2>; + status = "okay"; + + proslic_spi: proslic_spi@0 { + compatible = "silabs,proslic_spi"; + reg = <0>; + spi-max-frequency = <10000000>; + spi-cpha = <1>; + spi-cpol = <1>; + channel_count = <1>; + debug_level = <4>; /* 1 = TRC, 2 = DBG, 4 = ERR */ + reset_gpio = <&pio 7 GPIO_ACTIVE_HIGH>; + ig,enable-spi = <1>; /* 1: Enable, 0: Disable */ + }; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_0004: macaddr@0004 { + reg = <0x0004 0x6>; + }; + + macaddr_factory_0024: macaddr@0024 { + reg = <0x0024 0x6>; + }; + + macaddr_factory_002a: macaddr@002a { + reg = <0x002a 0x6>; + }; +}; From d05d886d22ed1f395d7d4ee47b2e2075b58fa9b9 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 4 Jun 2023 15:57:25 +0100 Subject: [PATCH 0101/1171] image: improve uImage.FIT device tree overlay support Instead of generating full config nodes incl. kernel, generate minimal config nodes for device tree overlays to be applied to the main config. In this way, multiple device tree overlays can be applied more easily. While at it change filenames to upstream style, ie. use dtso and dtbo suffix for device tree overlays. Signed-off-by: Daniel Golle (cherry picked from commit 6b01d40bfedb42323a1324e1b5624f192a4c91de) --- include/image-commands.mk | 2 +- include/image.mk | 19 ++++++++++++++++++- scripts/mkits.sh | 9 +++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index ea602662a5b3c2..1d694850195457 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -307,7 +307,7 @@ define Build/fit $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ $(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \ $(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \ - $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \ + $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ -A $(LINUX_KARCH) -v $(LINUX_VERSION) PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ diff --git a/include/image.mk b/include/image.mk index 0eae216ded20f3..0cf110df9319c3 100644 --- a/include/image.mk +++ b/include/image.mk @@ -554,16 +554,33 @@ define Device/Build/dtb image_prepare: $(KDIR)/image-$(1).dtb endif +endef + +define Device/Build/dtbo + ifndef BUILD_DTS_$(1) + BUILD_DTS_$(1) := 1 + $(KDIR)/image-$(1).dtbo: FORCE + $(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dtso,$$@) + + image_prepare: $(KDIR)/image-$(1).dtbo + endif + endef endif define Device/Build/kernel - $$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \ + $$(eval $$(foreach dts,$$(DEVICE_DTS), \ $$(call Device/Build/dtb,$$(notdir $$(dts)), \ $$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \ $$(dts) \ ) \ )) + $$(eval $$(foreach dtso,$$(DEVICE_DTS_OVERLAY), \ + $$(call Device/Build/dtbo,$$(notdir $$(dtso)), \ + $$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \ + $$(dtso) \ + ) \ + )) $(KDIR)/$$(KERNEL_NAME):: image_prepare $$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE)) diff --git a/scripts/mkits.sh b/scripts/mkits.sh index bf75d69f09cc09..b1c6f988674711 100755 --- a/scripts/mkits.sh +++ b/scripts/mkits.sh @@ -191,13 +191,10 @@ OVCONFIGS="" " OVCONFIGS="$OVCONFIGS - config-$ovname { - description = \"OpenWrt ${DEVICE} with $ovname\"; - kernel = \"kernel${REFERENCE_CHAR}1\"; - fdt = \"fdt${REFERENCE_CHAR}$FDTNUM\", \"$ovnode\"; - ${LOADABLES:+loadables = ${LOADABLES};} + $ovname { + description = \"OpenWrt ${DEVICE} overlay $ovname\"; + fdt = \"$ovnode\"; ${COMPATIBLE_PROP} - ${INITRD_PROP} }; " done From dc778190bc9ce68dc57ec54e730b797c63666d56 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 4 Jun 2023 18:21:29 +0100 Subject: [PATCH 0102/1171] generic: use only first element in bootconf for uImage.FIT Now that it is possible to load several device tree overlays by appending their config names to bootconf the uImage.FIT partition parser need to discard everything after the first '#' character in bootconf when looking up the config node to be used. Signed-off-by: Daniel Golle (cherry picked from commit 07bca1adaa0de71d0aefcf83bff2e1d90616cd3d) --- .../generic/files/block/partitions/fit.c | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/target/linux/generic/files/block/partitions/fit.c b/target/linux/generic/files/block/partitions/fit.c index 13c03743f3dd38..91b25e0581e7e0 100644 --- a/target/linux/generic/files/block/partitions/fit.c +++ b/target/linux/generic/files/block/partitions/fit.c @@ -84,13 +84,13 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector, const u32 *image_offset_be, *image_len_be, *image_pos_be; int ret = 1, node, images, config; const char *image_name, *image_type, *image_description, *config_default, - *config_description, *config_loadables; + *config_description, *config_loadables, *bootconf_c; int image_name_len, image_type_len, image_description_len, config_default_len, - config_description_len, config_loadables_len; + config_description_len, config_loadables_len, bootconf_len; sector_t start_sect, nr_sects; size_t label_min; struct device_node *np = NULL; - const char *bootconf; + char *bootconf = NULL, *bootconf_term; const char *loadable; const char *select_rootfs = NULL; bool found; @@ -143,10 +143,17 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector, return -ENOMEM; np = of_find_node_by_path("/chosen"); - if (np) - bootconf = of_get_property(np, "u-boot,bootconf", NULL); - else - bootconf = NULL; + if (np) { + bootconf_c = of_get_property(np, "u-boot,bootconf", &bootconf_len); + if (bootconf_c && bootconf_len) + bootconf = kmemdup_nul(bootconf_c, bootconf_len, GFP_KERNEL); + } + + if (bootconf) { + bootconf_term = strchr(bootconf, '#'); + if (bootconf_term) + *bootconf_term = '\0'; + } config = fdt_path_offset(fit, FIT_CONFS_PATH); if (config < 0) { @@ -285,6 +292,7 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector, strlcat(state->pp_buf, tmp, PAGE_SIZE); } ret_out: + kfree(bootconf); kfree(fit); return ret; } From 5f3c5848e3a8e70f3e47e4e1b17cbc8338f9e562 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 4 Jun 2023 18:55:17 +0100 Subject: [PATCH 0103/1171] uboot-mediatek: adapt BPi-R3 and BPi-R64 to new device tree overlay Update bootloader environment for BPi-R3 and BPi-R64 to adapt to new device tree overlay mechanism now that support for multiple device tree overlays has been added. Signed-off-by: Daniel Golle (cherry picked from commit ec50d2d366fecb6f4bac2ae9d5cfa4aba9cf7bbc) --- .../404-add-bananapi_bpi-r64_defconfigs.patch | 18 ++++---- .../patches/430-add-bpi-r3.patch | 42 ++++++++++++++----- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch b/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch index 135eb90e2b9e48..f3d9499e171db0 100644 --- a/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch +++ b/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch @@ -173,9 +173,9 @@ +loadaddr=0x48000000 +bootargs=root=/dev/mmcblk1p65 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi -+bootconf=config-mt7622-bananapi-bpi-r64-pcie1 -+bootconf_pcie=config-mt7622-bananapi-bpi-r64-pcie1 -+bootconf_sata=config-mt7622-bananapi-bpi-r64-sata ++bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1 ++bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1 ++bootconf_sata=config-1#mt7622-bananapi-bpi-r64-sata +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb +bootfile_emmcbl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-preloader.bin @@ -412,9 +412,9 @@ +loadaddr=0x48000000 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi +bootargs=root=/dev/mmcblk0p65 -+bootconf=config-mt7622-bananapi-bpi-r64-pcie1 -+bootconf_pcie=config-mt7622-bananapi-bpi-r64-pcie1 -+bootconf_sata=config-mt7622-bananapi-bpi-r64-sata ++bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1 ++bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1 ++bootconf_sata=config-1#mt7622-bananapi-bpi-r64-sata +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb +bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb @@ -619,9 +619,9 @@ +loadaddr=0x48000000 +bootargs=root=/dev/ubiblock0_2p1 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi -+bootconf=config-mt7622-bananapi-bpi-r64-pcie1 -+bootconf_pcie=config-mt7622-bananapi-bpi-r64-pcie1 -+bootconf_sata=config-mt7622-bananapi-bpi-r64-sata ++bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1 ++bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1 ++bootconf_sata=config-1#mt7622-bananapi-bpi-r64-sata +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb +bootfile_fip=openwrt-mediatek-mt7622-bananapi_bpi-r64-snand-bl31-uboot.fip diff --git a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch index 880b1b4d3225f6..bcd29b974e52e9 100644 --- a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch +++ b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch @@ -1118,7 +1118,7 @@ + --- /dev/null +++ b/bananapi_bpi-r3_sdmmc_env -@@ -0,0 +1,75 @@ +@@ -0,0 +1,80 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x46000000 @@ -1126,6 +1126,11 @@ +bootargs=root=/dev/mmcblk0p65 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi +bootconf=config-mt7986a-bananapi-bpi-r3 ++bootconf_base=config-mt7986a-bananapi-bpi-r3 ++bootconf_nor=mt7986a-bananapi-bpi-r3-nor ++bootconf_nand=mt7986a-bananapi-bpi-r3-nand ++bootconf_sd=mt7986a-bananapi-bpi-r3-sd ++bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc +bootdelay=0 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb +bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb @@ -1146,7 +1151,7 @@ +bootmenu_7=Install bootloader, recovery and production to NAND.=if nand info ; then run ubi_init ; else echo "NAND not detected" ; fi ; run bootmenu_confirm_return +bootmenu_8=Reboot.=reset +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset -+boot_update_conf=if nand info ; then setenv bootconf config-mt7986a-bananapi-bpi-r3-snand ; else if sf probe ; then setenv bootconf config-mt7986a-bananapi-bpi-r3-nor ; else setenv bootconf config-mt7986a-bananapi-bpi-r3 ; fi ; fi ++boot_update_conf=if nand info ; then setenv bootconf $bootconf_base#$bootconf_sd#$bootconf_nand ; else if sf probe ; then setenv bootconf $bootconf_base#$bootconf_sd#$bootconf_nor ; else setenv bootconf $bootconf_base#$bootconf_sd ; fi ; fi +boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever +boot_production=led $bootled_pwr on ; run boot_update_conf ; run sdmmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off @@ -1196,14 +1201,19 @@ +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- /dev/null +++ b/bananapi_bpi-r3_nor_env -@@ -0,0 +1,55 @@ +@@ -0,0 +1,60 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 +bootargs=root=/dev/mtdblock0p1 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi -+bootconf=config-mt7986a-bananapi-bpi-r3-emmc-nor ++bootconf=config-mt7986a-bananapi-bpi-r3 ++bootconf_base=config-mt7986a-bananapi-bpi-r3 ++bootconf_nor=mt7986a-bananapi-bpi-r3-nor ++bootconf_nand=mt7986a-bananapi-bpi-r3-nand ++bootconf_sd=mt7986a-bananapi-bpi-r3-sd ++bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc +bootdelay=0 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb +bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-nor-preloader.bin @@ -1238,7 +1248,7 @@ +boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip +boot_tftp_write_preloader=tftpboot $loadaddr $bootfile_bl2 && run boot_write_preloader -+boot_update_conf=if mmc partconf 0 ; then setenv bootconf config-mt7986a-bananapi-bpi-r3-emmc-nor ; else setenv bootconf config-mt7986a-bananapi-bpi-r3-nor ; fi ++boot_update_conf=if mmc partconf 0 ; then setenv bootconf $bootconf_base#$bootconf_nor#$bootconf_emmc ; else setenv bootconf $bootconf_base#$bootconf_nor#$bootconf_sd ; fi +boot_nor=run boot_production ; run boot_recovery +boot_write_fip=mtd erase fip && mtd write fip $loadaddr +boot_write_preloader=mtd erase bl2 && mtd write bl2 $loadaddr @@ -1254,13 +1264,18 @@ +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- /dev/null +++ b/bananapi_bpi-r3_snand_env -@@ -0,0 +1,69 @@ +@@ -0,0 +1,74 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 +bootargs=root=/dev/ubiblock0_2p1 -+bootconf=config-mt7986a-bananapi-bpi-r3-snand ++bootconf=config-mt7986a-bananapi-bpi-r3 ++bootconf_base=config-mt7986a-bananapi-bpi-r3 ++bootconf_nor=mt7986a-bananapi-bpi-r3-nor ++bootconf_nand=mt7986a-bananapi-bpi-r3-nand ++bootconf_sd=mt7986a-bananapi-bpi-r3-sd ++bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi +bootdelay=0 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb @@ -1296,7 +1311,7 @@ +boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 -+boot_update_conf=if mmc partconf 0 ; then setenv bootconf config-mt7986a-bananapi-bpi-r3-emmc-snand ; else setenv bootconf config-mt7986a-bananapi-bpi-r3-snand ; fi ++boot_update_conf=if mmc partconf 0 ; then setenv bootconf $bootconf_base#$bootconf_nand#$bootconf_emmc ; else setenv bootconf $bootconf_base#$bootconf_nand#$bootconf_sd ; fi +part_default=production +part_recovery=recovery +reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 @@ -1326,14 +1341,19 @@ +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- /dev/null +++ b/bananapi_bpi-r3_emmc_env -@@ -0,0 +1,56 @@ +@@ -0,0 +1,61 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 +bootargs=root=/dev/mmcblk0p65 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi -+bootconf=config-mt7986a-bananapi-bpi-r3-emmc ++bootconf=config-mt7986a-bananapi-bpi-r3 ++bootconf_base=config-mt7986a-bananapi-bpi-r3 ++bootconf_nor=mt7986a-bananapi-bpi-r3-nor ++bootconf_nand=mt7986a-bananapi-bpi-r3-nand ++bootconf_sd=mt7986a-bananapi-bpi-r3-sd ++bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc +bootdelay=0 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb +bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-emmc-preloader.bin @@ -1367,7 +1387,7 @@ +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2 +boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf -+boot_update_conf=if nand info ; then setenv bootconf config-mt7986a-bananapi-bpi-r3-emmc-snand ; else setenv bootconf config-mt7986a-bananapi-bpi-r3-emmc-nor ; fi ++boot_update_conf=if nand info ; then setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nand ; else setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nor ; fi +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size +mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 +part_default=production From bca04036ffc9fd6f891eafb7996510dce9af0fbc Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 4 Jun 2023 19:55:11 +0100 Subject: [PATCH 0104/1171] mediatek: use updated device tree overlay mechanism for BPi-R64 Use new device tree overlay mechanism for the BananaPi BPi-R64 board. Signed-off-by: Daniel Golle (cherry picked from commit 34bb33094a5e49c727b76b20394d252f3e2ba70d) --- target/linux/mediatek/image/mt7622.mk | 2 ++ .../base-files/etc/board.d/05_compat-version | 15 +++++++++++++++ ...dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/mt7622/base-files/etc/board.d/05_compat-version diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 92824ff24a6f77..c02390100b4b27 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -96,6 +96,8 @@ define Device/bananapi_bpi-r64 KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update endef TARGET_DEVICES += bananapi_bpi-r64 diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/05_compat-version b/target/linux/mediatek/mt7622/base-files/etc/board.d/05_compat-version new file mode 100644 index 00000000000000..c8fb2c08f69915 --- /dev/null +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/05_compat-version @@ -0,0 +1,15 @@ + +. /lib/functions.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + bananapi,bpi-r64) + ucidef_set_compat_version "1.1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/mediatek/patches-5.15/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch b/target/linux/mediatek/patches-5.15/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch index b15d04f8bb0945..f779c1e0473ab2 100644 --- a/target/linux/mediatek/patches-5.15/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch +++ b/target/linux/mediatek/patches-5.15/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch @@ -10,7 +10,7 @@ gpios = <90 GPIO_ACTIVE_HIGH>; output-high; --- /dev/null -+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-sata.dts ++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-sata.dtso @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ + @@ -44,7 +44,7 @@ + }; +}; --- /dev/null -+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-pcie1.dts ++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-pcie1.dtso @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ + From a65ec9fea7c9bf0ed2c247e37448f4189b01adf2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 4 Jun 2023 15:56:15 +0100 Subject: [PATCH 0105/1171] mediatek: sync MT7986 device trees with upstream Sync device tree files for MT7986 boards with what landed in upstream Linux tree to easy maintainance and also allow for a smooth update to Linux 6.1. Signed-off-by: Daniel Golle (cherry picked from commit 7a0ec001ff79b12beefb8f3773820bfedebbb340) --- .../mediatek/dts/mt7986a-asus-tuf-ax4200.dts | 14 +- .../dts/mt7986a-bananapi-bpi-r3-emmc-nor.dts | 80 --- .../mt7986a-bananapi-bpi-r3-emmc-snand.dts | 71 --- .../mediatek/dts/mt7986a-bananapi-bpi-r3.dts | 585 ------------------ .../dts/mt7986a-tplink-tl-xdr-common.dtsi | 14 +- .../dts/mt7986a-tplink-tl-xdr4288.dts | 2 +- .../dts/mt7986a-tplink-tl-xdr6086.dts | 2 +- .../dts/mt7986a-tplink-tl-xdr6088.dts | 2 +- .../mt7986a-xiaomi-redmi-router-ax6000.dtsi | 18 +- .../dts/mt7986a-zyxel-ex5601-t0-stock.dts | 10 +- .../arch/arm64/boot/dts/mediatek/mt7981.dtsi | 2 +- .../mt7986a-bananapi-bpi-r3-emmc.dtso | 29 + .../mt7986a-bananapi-bpi-r3-nand.dtso} | 8 +- .../mt7986a-bananapi-bpi-r3-nor.dtso} | 7 +- .../mediatek/mt7986a-bananapi-bpi-r3-sd.dtso | 23 + .../dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 499 +++++++++++++++ .../dts/mediatek/mt7986a-rfb-spim-nand.dts | 2 +- .../dts/mediatek/mt7986a-rfb-spim-nor.dts | 2 +- .../arm64/boot/dts/mediatek/mt7986a-rfb.dtsi | 2 +- .../arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 303 +++------ .../arm64/boot/dts/mediatek/mt7986b-rfb.dts | 2 +- .../arch/arm64/boot/dts/mediatek/mt7986b.dtsi | 3 + .../drivers/clk/mediatek/clk-mt7986-eth.c | 2 +- .../include/dt-bindings/reset/mt7986-resets.h | 59 +- .../base-files/etc/board.d/05_compat-version | 15 + target/linux/mediatek/image/filogic.mk | 6 +- .../194-dts-mt7968a-add-ramoops.patch | 17 + ...i-r3-leds-port-names-and-wifi-eeprom.patch | 196 ++++++ ...986-move-cpuboot-in-a-dedicated-node.patch | 9 +- ...-mt7986-move-ilm-in-a-dedicated-node.patch | 6 +- ...-mt7986-move-dlm-in-a-dedicated-node.patch | 6 +- 31 files changed, 994 insertions(+), 1002 deletions(-) delete mode 100644 target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-nor.dts delete mode 100644 target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-snand.dts delete mode 100644 target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-emmc.dtso rename target/linux/mediatek/{dts/mt7986a-bananapi-bpi-r3-snand.dts => files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso} (82%) rename target/linux/mediatek/{dts/mt7986a-bananapi-bpi-r3-nor.dts => files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso} (86%) create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sd.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts create mode 100644 target/linux/mediatek/filogic/base-files/etc/board.d/05_compat-version create mode 100644 target/linux/mediatek/patches-5.15/194-dts-mt7968a-add-ramoops.patch create mode 100644 target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts index bed7871d6ec92c..239be9645f38ff 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts @@ -89,6 +89,10 @@ }; }; +&crypto { + status = "okay"; +}; + ð { status = "okay"; @@ -330,13 +334,21 @@ }; }; -&wmac { +&watchdog { + status = "okay"; +}; + +&wifi { status = "okay"; pinctrl-names = "default", "dbdc"; pinctrl-0 = <&wf_2g_5g_pins>; pinctrl-1 = <&wf_dbdc_pins>; }; +&trng { + status = "okay"; +}; + &uart0 { status = "okay"; }; diff --git a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-nor.dts b/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-nor.dts deleted file mode 100644 index 1c82782b1f4d8d..00000000000000 --- a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-nor.dts +++ /dev/null @@ -1,80 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ - -/dts-v1/; -/plugin/; - -/ { - compatible = "bananapi,bpi-r3", "mediatek,mt7986a"; - - fragment@0 { - target-path = "/soc/mmc@11230000"; - __overlay__ { - pinctrl-names = "default", "state_uhs"; - pinctrl-0 = <&mmc0_pins_default>; - pinctrl-1 = <&mmc0_pins_uhs>; - bus-width = <8>; - max-frequency = <200000000>; - /delete-property/ cap-sd-highspeed; - cap-mmc-highspeed; - mmc-hs200-1_8v; - mmc-hs400-1_8v; - hs400-ds-delay = <0x14014>; - vmmc-supply = <®_3p3v>; - vqmmc-supply = <®_1p8v>; - non-removable; - no-sd; - no-sdio; - status = "okay"; - }; - }; - - fragment@1 { - target-path = "/soc/spi@1100a000"; - __overlay__ { - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "bl2"; - reg = <0x0 0x40000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x40000 0x40000>; - }; - - partition@80000 { - label = "reserved2"; - reg = <0x80000 0x80000>; - }; - - partition@100000 { - label = "fip"; - reg = <0x100000 0x80000>; - read-only; - }; - - partition@180000 { - label = "recovery"; - reg = <0x180000 0xa80000>; - }; - - partition@c00000 { - label = "fit"; - reg = <0xc00000 0x1400000>; - compatible = "denx,fit"; - }; - }; - }; - }; - }; -}; diff --git a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-snand.dts b/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-snand.dts deleted file mode 100644 index 2ca865d6e6f871..00000000000000 --- a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-emmc-snand.dts +++ /dev/null @@ -1,71 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ - -/dts-v1/; -/plugin/; - -/ { - compatible = "bananapi,bpi-r3", "mediatek,mt7986a"; - - fragment@0 { - target-path = "/soc/mmc@11230000"; - __overlay__ { - pinctrl-names = "default", "state_uhs"; - pinctrl-0 = <&mmc0_pins_default>; - pinctrl-1 = <&mmc0_pins_uhs>; - bus-width = <8>; - max-frequency = <200000000>; - /delete-property/ cap-sd-highspeed; - cap-mmc-highspeed; - mmc-hs200-1_8v; - mmc-hs400-1_8v; - hs400-ds-delay = <0x14014>; - vmmc-supply = <®_3p3v>; - vqmmc-supply = <®_1p8v>; - non-removable; - no-sd; - no-sdio; - status = "okay"; - }; - }; - - fragment@1 { - target-path = "/soc/spi@1100a000"; - __overlay__ { - flash@0 { - compatible = "spi-nand"; - reg = <0>; - spi-max-frequency = <10000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "bl2"; - reg = <0x0 0x80000>; - read-only; - }; - - partition@80000 { - label = "reserved"; - reg = <0x80000 0x300000>; - }; - - partition@380000 { - label = "fip"; - reg = <0x380000 0x200000>; - read-only; - }; - - partition@580000 { - label = "ubi"; - reg = <0x580000 0x7a80000>; - }; - }; - }; - }; - }; -}; diff --git a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts b/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts deleted file mode 100644 index bcd682fee0f153..00000000000000 --- a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts +++ /dev/null @@ -1,585 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Copyright (C) 2021 MediaTek Inc. - * Author: Sam.Shih - */ - -/dts-v1/; -#include -#include - -#include "mt7986a.dtsi" - -/ { - model = "Bananapi BPI-R3"; - compatible = "bananapi,bpi-r3", "mediatek,mt7986a"; - - aliases { - serial0 = &uart0; - ethernet0 = &gmac0; - ethernet1 = &gmac1; - led-boot = &led_status_green; - led-failsafe = &led_status_green; - led-running = &led_status_green; - led-upgrade = &led_status_blue; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory@40000000 { - device_type = "memory"; - reg = <0 0x40000000 0 0x40000000>; - }; - - reg_1p8v: regulator-1p8v { - compatible = "regulator-fixed"; - regulator-name = "fixed-1.8V"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-boot-on; - regulator-always-on; - }; - - reg_3p3v: regulator-3p3v { - compatible = "regulator-fixed"; - regulator-name = "fixed-3.3V"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - - reg_5v: regulator-5v { - compatible = "regulator-fixed"; - regulator-name = "fixed-5V"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - regulator-boot-on; - regulator-always-on; - }; - - keys { - compatible = "gpio-keys"; - -/* - * RST button is also PCIe-CLKREQ signal, use WPS button as reset - * instead as RST button doesn't make sense and cannot be used. - * - * intended buttons: - factory { - label = "reset"; - linux,code = ; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; - }; - - wps { - label = "wps"; - linux,code = ; - gpios = <&pio 10 GPIO_ACTIVE_LOW>; - }; - * actual setup: - */ - wps { - label = "wps"; - linux,code = ; - gpios = <&pio 10 GPIO_ACTIVE_LOW>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_status_green: green { - label = "green:status"; - gpios = <&pio 69 GPIO_ACTIVE_HIGH>; - default-state = "on"; - }; - - led_status_blue: blue { - label = "blue:status"; - gpios = <&pio 86 GPIO_ACTIVE_HIGH>; - }; - }; - - /* SFP1 cage (WAN) */ - i2c_sfp1: i2c-gpio-0 { - compatible = "i2c-gpio"; - sda-gpios = <&pio 16 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - scl-gpios = <&pio 17 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - i2c-gpio,delay-us = <2>; - #address-cells = <1>; - #size-cells = <0>; - }; - - sfp1: sfp1 { - compatible = "sff,sfp"; - i2c-bus = <&i2c_sfp1>; - los-gpios = <&pio 46 GPIO_ACTIVE_HIGH>; - mod-def0-gpios = <&pio 49 GPIO_ACTIVE_LOW>; - tx-disable-gpios = <&pio 20 GPIO_ACTIVE_HIGH>; - tx-fault-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; - maximum-power-milliwatt = <3000>; - }; - - /* SFP2 cage (LAN) */ - i2c_sfp2: i2c-gpio-1 { - compatible = "i2c-gpio"; - sda-gpios = <&pio 18 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - scl-gpios = <&pio 19 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - i2c-gpio,delay-us = <2>; - #address-cells = <1>; - #size-cells = <0>; - }; - - sfp2: sfp2 { - compatible = "sff,sfp"; - i2c-bus = <&i2c_sfp2>; - los-gpios = <&pio 31 GPIO_ACTIVE_HIGH>; - mod-def0-gpios = <&pio 47 GPIO_ACTIVE_LOW>; - tx-disable-gpios = <&pio 15 GPIO_ACTIVE_HIGH>; - tx-fault-gpios = <&pio 48 GPIO_ACTIVE_HIGH>; - maximum-power-milliwatt = <3000>; - }; -}; - -ð { - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - phy-mode = "2500base-x"; - sfp = <&sfp1>; - managed = "in-band-status"; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - }; -}; - -&mdio { - switch: switch@0 { - compatible = "mediatek,mt7531"; - reg = <31>; - reset-gpios = <&pio 5 GPIO_ACTIVE_LOW>; - interrupt-controller; - #interrupt-cells = <1>; - interrupt-parent = <&pio>; - interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; - }; -}; - -&switch { - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - label = "wan"; - }; - - port@1 { - reg = <1>; - label = "lan1"; - }; - - port@2 { - reg = <2>; - label = "lan2"; - }; - - port@3 { - reg = <3>; - label = "lan3"; - }; - - port@4 { - reg = <4>; - label = "lan4"; - }; - - port5: port@5 { - reg = <5>; - label = "sfp2"; - phy-mode = "2500base-x"; - sfp = <&sfp2>; - managed = "in-band-status"; - }; - - port@6 { - reg = <6>; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - }; -}; - -&crypto { - status = "okay"; -}; - -&mmc0 { - //sdcard - pinctrl-names = "default", "state_uhs"; - pinctrl-0 = <&mmc0_pins_default>; - pinctrl-1 = <&mmc0_pins_uhs>; - bus-width = <4>; - max-frequency = <52000000>; - cap-sd-highspeed; - vmmc-supply = <®_3p3v>; - vqmmc-supply = <®_1p8v>; - status = "okay"; -}; - -&pcie { - pinctrl-names = "default"; - pinctrl-0 = <&pcie_pins>; - status = "okay"; -}; - -&pcie_phy { - status = "okay"; -}; - -&wmac { - status = "okay"; - pinctrl-names = "default", "dbdc"; - pinctrl-0 = <&wf_2g_5g_pins>, <&wf_led_pins>; - pinctrl-1 = <&wf_dbdc_pins>, <&wf_led_pins>; -}; - -&pio { - /* don't mess around with GPIO 419, 450, 451, 498, 510 in sysfs system will freeze. */ - mmc0_pins_default: mmc0-pins { - mux { - function = "emmc"; - groups = "emmc_51"; - }; - conf-cmd-dat { - pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", - "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", - "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; - input-enable; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - conf-clk { - pins = "EMMC_CK"; - drive-strength = <6>; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-ds { - pins = "EMMC_DSL"; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-rst { - pins = "EMMC_RSTB"; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - }; - - mmc0_pins_uhs: mmc0-uhs-pins { - mux { - function = "emmc"; - groups = "emmc_51"; - }; - conf-cmd-dat { - pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", - "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", - "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; - input-enable; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - conf-clk { - pins = "EMMC_CK"; - drive-strength = <6>; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-ds { - pins = "EMMC_DSL"; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-rst { - pins = "EMMC_RSTB"; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - }; - - pcie_pins: pcie-pins { - mux { - function = "pcie"; - groups = "pcie_clk", "pcie_pereset"; //"pcie_wake" is unused - }; - }; - - spi_flash_pins: spi-flash-pins { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - }; - - uart1_pins: uart1-pins { - mux { - function = "uart"; - groups = "uart1"; - }; - }; - - i2c0_pins: i2c0-pins { - mux { - function = "i2c"; - groups = "i2c"; - }; - }; - - pwm_pins: pwm-pins { - mux { - function = "pwm"; - groups = "pwm0", "pwm1_0"; - }; - }; - - wf_led_pins: wf-led-pins { - mux { - function = "led"; - groups = "wifi_led"; - }; - }; - - wf_2g_5g_pins: wf-2g-5g-pins { - mux { - function = "wifi"; - groups = "wf_2g", "wf_5g"; - }; - conf { - pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", - "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", - "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", - "WF1_TOP_CLK", "WF1_TOP_DATA"; - drive-strength = <4>; - }; - }; - - wf_dbdc_pins: wf-dbdc-pins { - mux { - function = "wifi"; - groups = "wf_dbdc"; - }; - conf { - pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", - "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", - "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", - "WF1_TOP_CLK", "WF1_TOP_DATA"; - drive-strength = <4>; - }; - }; -}; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi_flash_pins>; - - status = "okay"; -}; - -&ssusb { - vusb33-supply = <®_3p3v>; - vbus-supply = <®_5v>; - status = "okay"; -}; - -&uart0 { - status = "okay"; -}; - -&uart1 { - pinctrl-names = "default"; - pinctrl-0 = <&uart1_pins>; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&i2c0 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins>; - status = "okay"; -}; - -&pwm { - pinctrl-names = "default"; - pinctrl-0 = <&pwm_pins>; - status = "okay"; -}; - -&fan { - pwms = <&pwm 0 10000 0>; - cooling-levels = <255 96 52 0>; - status = "okay"; -}; - -&wmac { - mediatek,eeprom-data = <0x86790900 0xc4326 0x60000000 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x1000000 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x800 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x24649090 0x280000 0x5100000 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x21e00 0x21e0002 0x1e00021e 0x22800 0x2280002 0x28000228 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x8080 0x8080fdf7 - 0x903150d 0x80808080 0x80808080 0x5050d0d 0x1313c6c6 0xc3c3c200 0xc200c2 0x8182 - 0x8585c2c2 0x82828282 0x858500c2 0xc2000081 0x82858587 0x87c2c200 0x81818285 0x858787c2 - 0xc2000081 0x82858587 0x87c2c200 0x818285 0x858787c2 0xc2000081 0x82858587 0x87c4c4c2 - 0xc100c300 0xc3c3c100 0x818383c3 0xc3c3c100 0x81838300 0xc2c2c2c0 0x81828484 0xc3 - 0xc3c3c100 0x81838386 0x86c3c3c3 0xc1008183 0x838686c2 0xc2c2c081 0x82848486 0x86c3c3c3 - 0xc1008183 0x838686c3 0xc3c3c100 0x81838386 0x86c3c3c3 0xc1008183 0x83868622 0x28002228 - 0x222800 0x22280000 0xdddddddd 0xdddddddd 0xddbbbbbb 0xccccccdd 0xdddddddd 0xdddddddd - 0xeeeeeecc 0xccccdddd 0xdddddddd 0x4a5662 0x4a 0x56620000 0x4a5662 0x4a - 0x56620000 0x88888888 0x33333326 0x26262626 0x26262600 0x33333326 0x26262626 0x26262600 - 0x33333326 0x26262626 0x26262600 0x33333326 0x26262626 0x26262600 0x00 0xf0f0cc00 - 0x00 0xaaaa 0xaabbbbbb 0xcccccccc 0xccccbbbb 0xbbbbbbbb 0xbbbbbbaa 0xaaaabbbb - 0xbbaaaaaa 0x999999aa 0xaaaabbbb 0xbbcccccc 0x00 0xaaaa 0xaa000000 0xbbbbbbbb - 0xbbbbaaaa 0xaa999999 0xaaaaaaaa 0xaaaaaaaa 0xaaaaaaaa 0xaaaaaaaa 0xaaaabbbb 0xbbbbbbbb - 0x00 0x00 0x00 0x99999999 0x9999aaaa 0xaaaaaaaa 0x999999aa 0xaaaaaaaa - 0xaaaaaaaa 0xaaaaaaaa 0xaaaabbbb 0xbbbbbbbb 0x00 0xeeee 0xeeffffff 0xcccccccc - 0xccccdddd 0xddbbbbbb 0xccccccbb 0xbbbbbbbb 0xbbbbbbbb 0xbbbbbbbb 0xbbbbcccc 0xccdddddd - 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 - 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 - 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e - 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 - 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 - 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e 0x516200 0x686e0051 0x6200686e - 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x01 0x6000100 0x1050002 0xff0300 - 0xf900fe03 0x00 0x00 0x9b 0x6e370000 0x00 0xfc0009 0xa00fe00 - 0x60700fe 0x70800 0x5000b0a 0x00 0x00 0xe2 0x96460000 0x00 - 0x400f7 0xf8000300 0xfcfe0003 0xfbfc00 0xee00e3f2 0x00 0x00 0x11 - 0xbb550000 0x00 0x600f6 0xfc000300 0xfbfe0004 0xfafe00 0xf600ecf2 0x00 - 0x00 0x1f 0xbf580000 0x00 0x600f5 0xf6000400 0xf8f90004 0xf7f800 - 0xf700f0f4 0x00 0x00 0x24 0xbe570000 0x00 0x800f8 0xfe000600 - 0xf8fd0007 0xf9fe00 0xf500f0f4 0x00 0x00 0x2d 0xd6610000 0x00 - 0x400f7 0xfc000500 0xf7fc0005 0xf7fc00 0xf900f5f8 0x00 0x00 0x26 - 0xd96e0000 0x00 0x400f7 0xf9000600 0xf5f70005 0xf5f800 0xf900f4f7 0x00 - 0x00 0x1b 0xce690000 0x00 0x300f8 0xf8000600 0xf6f60004 0xf6f700 - 0xf900f4f7 0x00 0x00 0x18 0xd8720000 0x00 0x00 0x2404002 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0xc1c2c1c2 0x41c341c3 0x3fc13fc1 0x40c13fc2 0x3fc240c1 0x41c040c0 0x3fc23fc2 0x40c13fc2 - 0x3fc140c0 0x41c040c0 0x3fc33fc3 0x40c23fc2 0x3fc240c1 0x41c040c0 0x3fc23fc2 0x40c23fc2 - 0x3fc140c1 0x41c040c0 0x00 0x00 0x41c741c7 0xc1c7c1c7 0x00 0x00 - 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 - 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 - 0xa0ce00 0x00 0xb6840000 0x00 0x00 0x00 0x18181818 0x18181818 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x4b5763 0x4b 0x57630000 0x4b5763 0x4b 0x57630000 0x88888888 0x8474759 - 0x69780849 0x49596d7a 0x849495a 0x6d790848 0x48596c78 0x8484858 0x6a780848 0x48586a78 - 0x8484858 0x6c78084a 0x4a5b6d79 0x8474759 0x697a0848 0x48596b79 0x8484859 0x6c7a0848 - 0x48586c79 0x8484857 0x68770848 0x48576877 0x8484857 0x6a77084a 0x4a5a6a77 0x8464659 - 0x69790848 0x48586b79 0x8484858 0x6c7a0848 0x48596c79 0x8484857 0x68770848 0x48576877 - 0x8494958 0x6d7a084b 0x4b5c6c77 0x847475a 0x6a7b0849 0x495a6e7c 0x849495a 0x6e7c0849 - 0x495b6e7c 0x8494959 0x6a7a0849 0x49596a7a 0x84a4a5a 0x6f7d084b 0x4b5c6e7b 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x85848484 - 0xc3c4c4c5 0xc4c3c33f 0xc3c3c2c2 0xc2c2c03f 0xc3c3c3c4 0xc4c4c33f 0xc2c2c2c2 0xc1c3c1c1 - 0xc0c08282 0x83848686 0x88880000 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x1111 0x00 - 0x8080f703 0x10808080 0x80050d13 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0xa4 0xce000000 0xb684 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00>; -}; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi index 739e500a12170b..94edfd121e42cf 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi @@ -83,6 +83,10 @@ }; }; +&crypto { + status = "okay"; +}; + ð { status = "okay"; @@ -231,6 +235,10 @@ status = "okay"; }; +&trng { + status = "okay"; +}; + &uart0 { status = "okay"; }; @@ -239,7 +247,11 @@ status = "okay"; }; -&wmac { +&watchdog { + status = "okay"; +}; + +&wifi { mediatek,mtd-eeprom = <&factory 0x0>; nvmem-cells = <&macaddr_config_1c>; nvmem-cell-names = "mac-address"; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr4288.dts b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr4288.dts index b7f7d2d3712f8e..591d16195e233a 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr4288.dts +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr4288.dts @@ -73,7 +73,7 @@ }; }; -&wmac { +&wifi { pinctrl-names = "dbdc"; pinctrl-0 = <&wf_dbdc_pins>; }; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6086.dts b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6086.dts index ffe57e55026da0..68a159a8e7c173 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6086.dts +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6086.dts @@ -58,7 +58,7 @@ }; }; -&wmac { +&wifi { pinctrl-names = "default"; pinctrl-0 = <&wf_2g_5g_pins>; }; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6088.dts b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6088.dts index 213f89918fe8de..751909a6aa2f22 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6088.dts +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr6088.dts @@ -73,7 +73,7 @@ }; }; -&wmac { +&wifi { pinctrl-names = "default"; pinctrl-0 = <&wf_2g_5g_pins>; }; diff --git a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi index 101b81f8a9a8f9..13f37cd7630b8d 100644 --- a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi +++ b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi @@ -42,6 +42,10 @@ }; }; +&crypto { + status = "okay"; +}; + ð { status = "okay"; @@ -246,7 +250,19 @@ }; }; -&wmac { +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&wf_2g_5g_pins>; diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts index 32b581c3c2a34f..bc9f6688b39361 100644 --- a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts @@ -246,7 +246,11 @@ }; }; -&wmac { +&watchdog { + status = "okay"; +}; + +&wifi { status = "okay"; pinctrl-names = "default", "dbdc"; pinctrl-0 = <&wf_2g_5g_pins>; @@ -521,6 +525,10 @@ status = "okay"; }; +&trng { + status = "okay"; +}; + &uart0 { status = "okay"; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index 304566810a0b3e..3629a6f6dda70c 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -755,7 +755,7 @@ wifi: wifi@18000000 { compatible = "mediatek,mt7981-wmac"; - resets = <&watchdog MT7986_TOPRGU_CONSYS_RST>; + resets = <&watchdog MT7986_TOPRGU_CONSYS_SW_RST>; reset-names = "consys"; pinctrl-0 = <&wifi_dbdc_pins>; pinctrl-names = "dbdc"; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-emmc.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-emmc.dtso new file mode 100644 index 00000000000000..779dc6782bb198 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-emmc.dtso @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-r3", "mediatek,mt7986a"; + + fragment@0 { + target-path = "/soc/mmc@11230000"; + __overlay__ { + bus-width = <8>; + max-frequency = <200000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + mmc-hs400-1_8v; + hs400-ds-delay = <0x14014>; + non-removable; + no-sd; + no-sdio; + status = "okay"; + }; + }; +}; + diff --git a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-snand.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso similarity index 82% rename from target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-snand.dts rename to target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso index e29ea2adb03df4..15ee8c568f3c3f 100644 --- a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-snand.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso @@ -1,4 +1,8 @@ /* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/* + * Authors: Daniel Golle + * Frank Wunderlich + */ /dts-v1/; /plugin/; @@ -9,7 +13,9 @@ fragment@0 { target-path = "/soc/spi@1100a000"; __overlay__ { - nand-flash@0 { + #address-cells = <1>; + #size-cells = <0>; + spi_nand: spi_nand@0 { compatible = "spi-nand"; reg = <0>; spi-max-frequency = <10000000>; diff --git a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-nor.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso similarity index 86% rename from target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-nor.dts rename to target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso index f597b869abc80d..e48881be4ed60c 100644 --- a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-nor.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso @@ -1,4 +1,8 @@ /* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/* + * Authors: Daniel Golle + * Frank Wunderlich + */ /dts-v1/; /plugin/; @@ -9,6 +13,8 @@ fragment@0 { target-path = "/soc/spi@1100a000"; __overlay__ { + #address-cells = <1>; + #size-cells = <0>; flash@0 { compatible = "jedec,spi-nor"; reg = <0>; @@ -49,7 +55,6 @@ partition@c00000 { label = "fit"; reg = <0xc00000 0x1400000>; - compatible = "denx,fit"; }; }; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sd.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sd.dtso new file mode 100644 index 00000000000000..f623bce075ce6e --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sd.dtso @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-r3", "mediatek,mt7986a"; + + fragment@0 { + target-path = "/soc/mmc@11230000"; + __overlay__ { + bus-width = <4>; + max-frequency = <52000000>; + cap-sd-highspeed; + status = "okay"; + }; + }; +}; + diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts new file mode 100644 index 00000000000000..af4a4309bda4b9 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts @@ -0,0 +1,499 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Authors: Sam.Shih + * Frank Wunderlich + * Daniel Golle + */ + +/dts-v1/; +#include +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "Bananapi BPI-R3"; + chassis-type = "embedded"; + compatible = "bananapi,bpi-r3", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + ethernet0 = &gmac0; + ethernet1 = &gmac1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + dcin: regulator-12vd { + compatible = "regulator-fixed"; + regulator-name = "12vd"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-boot-on; + regulator-always-on; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + /* cooling level (0, 1, 2) - pwm inverted */ + cooling-levels = <255 96 0>; + pwms = <&pwm 0 10000 0>; + status = "okay"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset-key { + label = "reset"; + linux,code = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + wps-key { + label = "wps"; + linux,code = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; + + /* i2c of the left SFP cage (wan) */ + i2c_sfp1: i2c-gpio-0 { + compatible = "i2c-gpio"; + sda-gpios = <&pio 16 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&pio 17 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + /* i2c of the right SFP cage (lan) */ + i2c_sfp2: i2c-gpio-1 { + compatible = "i2c-gpio"; + sda-gpios = <&pio 18 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&pio 19 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + leds { + compatible = "gpio-leds"; + + green_led: led-0 { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&pio 69 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + blue_led: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 86 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "1.8vd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + vin-supply = <&dcin>; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "3.3vd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + vin-supply = <&dcin>; + }; + + /* left SFP cage (wan) */ + sfp1: sfp-1 { + compatible = "sff,sfp"; + i2c-bus = <&i2c_sfp1>; + los-gpios = <&pio 46 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&pio 49 GPIO_ACTIVE_LOW>; + tx-disable-gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + tx-fault-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; + }; + + /* right SFP cage (lan) */ + sfp2: sfp-2 { + compatible = "sff,sfp"; + i2c-bus = <&i2c_sfp2>; + los-gpios = <&pio 31 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&pio 47 GPIO_ACTIVE_LOW>; + tx-disable-gpios = <&pio 15 GPIO_ACTIVE_HIGH>; + tx-fault-gpios = <&pio 48 GPIO_ACTIVE_HIGH>; + }; +}; + +&cpu_thermal { + cooling-maps { + cpu-active-high { + /* active: set fan to cooling level 2 */ + cooling-device = <&fan 2 2>; + trip = <&cpu_trip_active_high>; + }; + + cpu-active-low { + /* active: set fan to cooling level 1 */ + cooling-device = <&fan 1 1>; + trip = <&cpu_trip_active_low>; + }; + + cpu-passive { + /* passive: set fan to cooling level 0 */ + cooling-device = <&fan 0 0>; + trip = <&cpu_trip_passive>; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + sfp = <&sfp1>; + managed = "in-band-status"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + switch: switch@31 { + compatible = "mediatek,mt7531"; + reg = <31>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + }; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + status = "okay"; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pio { + i2c_pins: i2c-pins { + mux { + function = "i2c"; + groups = "i2c"; + }; + }; + + mmc0_pins_default: mmc0-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + bias-pull-up = ; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + bias-pull-down = ; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + bias-pull-down = ; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + bias-pull-up = ; /* pull-up 10K */ + }; + }; + + mmc0_pins_uhs: mmc0-uhs-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + bias-pull-up = ; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + bias-pull-down = ; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + bias-pull-down = ; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + bias-pull-up = ; /* pull-up 10K */ + }; + }; + + pcie_pins: pcie-pins { + mux { + function = "pcie"; + groups = "pcie_clk", "pcie_pereset"; + }; + }; + + pwm_pins: pwm-pins { + mux { + function = "pwm"; + groups = "pwm0", "pwm1_0"; + }; + }; + + spi_flash_pins: spi-flash-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + + spic_pins: spic-pins { + mux { + function = "spi"; + groups = "spi1_0"; + }; + }; + + uart1_pins: uart1-pins { + mux { + function = "uart"; + groups = "uart1_rx_tx"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart"; + groups = "uart2_0_rx_tx"; + }; + }; + + wf_2g_5g_pins: wf-2g-5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_led_pins: wf-led-pins { + mux { + function = "led"; + groups = "wifi_led"; + }; + }; +}; + +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm_pins>; + status = "okay"; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spic_pins>; + status = "okay"; +}; + +&ssusb { + status = "okay"; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan0"; + }; + + port@2 { + reg = <2>; + label = "lan1"; + }; + + port@3 { + reg = <3>; + label = "lan2"; + }; + + port@4 { + reg = <4>; + label = "lan3"; + }; + + port5: port@5 { + reg = <5>; + label = "lan4"; + phy-mode = "2500base-x"; + sfp = <&sfp2>; + managed = "in-band-status"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>, <&wf_led_pins>; + pinctrl-1 = <&wf_dbdc_pins>, <&wf_led_pins>; + + led { + led-active-low; + }; +}; + diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts index 938dd181b97221..83a37150cf07ed 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts @@ -47,6 +47,6 @@ }; }; -&wmac { +&wifi { mediatek,mtd-eeprom = <&factory 0>; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts index 6342981304d7f6..868365a99429a7 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts @@ -46,6 +46,6 @@ }; }; -&wmac { +&wifi { mediatek,mtd-eeprom = <&factory 0>; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi index b63692c16121fa..1ab56e37f741cd 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi @@ -78,7 +78,7 @@ }; }; -&wmac { +&wifi { status = "okay"; pinctrl-names = "default", "dbdc"; pinctrl-0 = <&wf_2g_5g_pins>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi index 86090f8ebed9ae..68539ea788dfcc 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi @@ -4,19 +4,19 @@ * Author: Sam.Shih */ -#include #include #include -#include +#include #include -#include +#include / { + compatible = "mediatek,mt7986a"; interrupt-parent = <&gic>; #address-cells = <2>; #size-cells = <2>; - clk40m: oscillator@0 { + clk40m: oscillator-40m { compatible = "fixed-clock"; clock-frequency = <40000000>; #clock-cells = <0>; @@ -60,22 +60,14 @@ }; psci { - compatible = "arm,psci-0.2"; - method = "smc"; + compatible = "arm,psci-0.2"; + method = "smc"; }; reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges; - - /* 64 KiB reserved for ramoops/pstore */ - ramoops@42ff0000 { - compatible = "ramoops"; - reg = <0 0x42ff0000 0 0x10000>; - record-size = <0x1000>; - }; - /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ secmon_reserved: secmon@43000000 { reg = <0 0x43000000 0 0x30000>; @@ -126,6 +118,7 @@ reg = <0 0x15194000 0 0x1000>; no-map; }; + }; timer { @@ -162,6 +155,12 @@ #clock-cells = <1>; }; + wed_pcie: wed-pcie@10003000 { + compatible = "mediatek,mt7986-wed-pcie", + "syscon"; + reg = <0 0x10003000 0 0x10>; + }; + topckgen: topckgen@1001b000 { compatible = "mediatek,mt7986-topckgen", "syscon"; reg = <0 0x1001B000 0 0x1000>; @@ -169,11 +168,17 @@ }; watchdog: watchdog@1001c000 { - compatible = "mediatek,mt7986-wdt", - "mediatek,mt6589-wdt"; + compatible = "mediatek,mt7986-wdt"; reg = <0 0x1001c000 0 0x1000>; interrupts = ; #reset-cells = <1>; + status = "disabled"; + }; + + apmixedsys: apmixedsys@1001e000 { + compatible = "mediatek,mt7986-apmixedsys"; + reg = <0 0x1001E000 0 0x1000>; + #clock-cells = <1>; }; pio: pinctrl@1001f000 { @@ -197,12 +202,6 @@ #interrupt-cells = <2>; }; - apmixedsys: apmixedsys@1001e000 { - compatible = "mediatek,mt7986-apmixedsys"; - reg = <0 0x1001E000 0 0x1000>; - #clock-cells = <1>; - }; - sgmiisys0: syscon@10060000 { compatible = "mediatek,mt7986-sgmiisys_0", "syscon"; @@ -217,12 +216,13 @@ #clock-cells = <1>; }; - trng: trng@1020f000 { - compatible = "mediatek,mt7986-rng"; + trng: rng@1020f000 { + compatible = "mediatek,mt7986-rng", + "mediatek,mt7623-rng"; reg = <0 0x1020f000 0 0x100>; clocks = <&infracfg CLK_INFRA_TRNG_CK>; clock-names = "rng"; - status = "okay"; + status = "disabled"; }; crypto: crypto@10320000 { @@ -237,7 +237,7 @@ clock-names = "infra_eip97_ck"; assigned-clocks = <&topckgen CLK_TOP_EIP_B_SEL>; assigned-clock-parents = <&apmixedsys CLK_APMIXED_NET2PLL>; - status = "okay"; + status = "disabled"; }; pwm: pwm@10048000 { @@ -246,7 +246,7 @@ #clock-cells = <1>; #pwm-cells = <2>; interrupts = ; - clocks = <&infracfg CLK_INFRA_PWM_HCK>, + clocks = <&topckgen CLK_TOP_PWM_SEL>, <&infracfg CLK_INFRA_PWM_STA>, <&infracfg CLK_INFRA_PWM1_CK>, <&infracfg CLK_INFRA_PWM2_CK>; @@ -311,6 +311,8 @@ spi0: spi@1100a000 { compatible = "mediatek,mt7986-spi-ipm", "mediatek,spi-ipm"; + #address-cells = <1>; + #size-cells = <0>; reg = <0 0x1100a000 0 0x100>; interrupts = ; clocks = <&topckgen CLK_TOP_MPLL_D2>, @@ -323,6 +325,8 @@ spi1: spi@1100b000 { compatible = "mediatek,mt7986-spi-ipm", "mediatek,spi-ipm"; + #address-cells = <1>; + #size-cells = <0>; reg = <0 0x1100b000 0 0x100>; interrupts = ; clocks = <&topckgen CLK_TOP_MPLL_D2>, @@ -334,12 +338,12 @@ }; auxadc: adc@1100d000 { - compatible = "mediatek,mt7986-auxadc", - "mediatek,mt7622-auxadc"; + compatible = "mediatek,mt7986-auxadc"; reg = <0 0x1100d000 0 0x1000>; clocks = <&infracfg CLK_INFRA_ADC_26M_CK>; clock-names = "main"; #io-channel-cells = <1>; + status = "disabled"; }; ssusb: usb@11200000 { @@ -350,15 +354,15 @@ reg-names = "mac", "ippc"; interrupts = ; clocks = <&infracfg CLK_INFRA_IUSB_SYS_CK>, - <&topckgen CLK_TOP_U2U3_XHCI_SEL>, <&infracfg CLK_INFRA_IUSB_CK>, <&infracfg CLK_INFRA_IUSB_133_CK>, - <&infracfg CLK_INFRA_IUSB_66M_CK>; + <&infracfg CLK_INFRA_IUSB_66M_CK>, + <&topckgen CLK_TOP_U2U3_XHCI_SEL>; clock-names = "sys_ck", - "xhci_ck", "ref_ck", "mcu_ck", - "dma_ck"; + "dma_ck", + "xhci_ck"; phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>, <&u2port1 PHY_TYPE_USB2>; @@ -370,15 +374,13 @@ reg = <0 0x11230000 0 0x1000>, <0 0x11c20000 0 0x1000>; interrupts = ; - clocks = <&infracfg CLK_INFRA_MSDC_CK>, + clocks = <&topckgen CLK_TOP_EMMC_416M_SEL>, <&infracfg CLK_INFRA_MSDC_HCK_CK>, - <&infracfg CLK_INFRA_MSDC_66M_CK>, - <&infracfg CLK_INFRA_MSDC_133M_CK>; - clock-names = "source", "hclk", "axi_cg", "ahb_cg"; - assigned-clocks = <&topckgen CLK_TOP_EMMC_416M_SEL>, - <&topckgen CLK_TOP_EMMC_250M_SEL>; - assigned-clock-parents = <&apmixedsys CLK_APMIXED_MPLL>, - <&topckgen CLK_TOP_NET1PLL_D5_D2>; + <&infracfg CLK_INFRA_MSDC_CK>, + <&infracfg CLK_INFRA_MSDC_133M_CK>, + <&infracfg CLK_INFRA_MSDC_66M_CK>; + clock-names = "source", "hclk", "source_cg", "bus_clk", + "sys_cg"; status = "disabled"; }; @@ -388,8 +390,9 @@ reg = <0 0x1100c800 0 0x800>; interrupts = ; clocks = <&infracfg CLK_INFRA_THERM_CK>, - <&infracfg CLK_INFRA_ADC_26M_CK>; - clock-names = "therm", "auxadc"; + <&infracfg CLK_INFRA_ADC_26M_CK>, + <&infracfg CLK_INFRA_ADC_FRC_CK>; + clock-names = "therm", "auxadc", "adc_32k"; mediatek,auxadc = <&auxadc>; mediatek,apmixedsys = <&apmixedsys>; nvmem-cells = <&thermal_calibration>; @@ -408,11 +411,11 @@ bus-range = <0x00 0xff>; ranges = <0x82000000 0x00 0x20000000 0x00 0x20000000 0x00 0x10000000>; - clocks = <&infracfg CLK_INFRA_PCIE_SEL>, + clocks = <&infracfg CLK_INFRA_IPCIE_PIPE_CK>, <&infracfg CLK_INFRA_IPCIE_CK>, - <&infracfg CLK_INFRA_IPCIE_PIPE_CK>, <&infracfg CLK_INFRA_IPCIER_CK>, <&infracfg CLK_INFRA_IPCIEB_CK>; + clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m"; status = "disabled"; phys = <&pcie_port PHY_TYPE_PCIE>; @@ -433,7 +436,7 @@ pcie_phy: t-phy@11c00000 { compatible = "mediatek,mt7986-tphy", - "mediatek,generic-tphy-v4"; + "mediatek,generic-tphy-v2"; #address-cells = <2>; #size-cells = <2>; ranges; @@ -444,30 +447,11 @@ clocks = <&clk40m>; clock-names = "ref"; #phy-cells = <1>; - auto_load_valid; - auto_load_valid_ln1; - nvmem-cells = <&pcie_intr_ln0>, - <&pcie_rx_imp_ln0>, - <&pcie_tx_imp_ln0>, - <&pcie_auto_load_valid_ln0>, - <&pcie_intr_ln1>, - <&pcie_rx_imp_ln1>, - <&pcie_tx_imp_ln1>, - <&pcie_auto_load_valid_ln1>; - nvmem-cell-names = "intr", - "rx_imp", - "tx_imp", - "auto_load_valid", - "intr_ln1", - "rx_imp_ln1", - "tx_imp_ln1", - "auto_load_valid_ln1"; }; }; efuse: efuse@11d00000 { - compatible = "mediatek,mt7986-efuse", - "mediatek,efuse"; + compatible = "mediatek,mt7986-efuse", "mediatek,efuse"; reg = <0 0x11d00000 0 0x1000>; #address-cells = <1>; #size-cells = <1>; @@ -475,149 +459,50 @@ thermal_calibration: calib@274 { reg = <0x274 0xc>; }; - - comb_auto_load_valid: usb3-alv-imp@8da { - reg = <0x8da 1>; - bits = <0 1>; - }; - - comb_rx_imp_p0: usb3-rx-imp@8d8 { - reg = <0x8d8 1>; - bits = <0 5>; - }; - - comb_tx_imp_p0: usb3-tx-imp@8d8 { - reg = <0x8d8 2>; - bits = <5 5>; - }; - - comb_intr_p0: usb3-intr@8d9 { - reg = <0x8d9 1>; - bits = <2 6>; - }; - - u2_auto_load_valid_p0: usb2-alv-p0@8e0 { - reg = <0x8e0 1>; - bits = <0 1>; - }; - - u2_intr_p0: usb2-intr-p0@8e0 { - reg = <0x8e0 1>; - bits = <1 5>; - }; - - u2_auto_load_valid_p1: usb2-alv-p1@8e0 { - reg = <0x8e0 2>; - bits = <6 1>; - }; - - u2_intr_p1: usb2-intr-p1@8e0 { - reg = <0x8e0 2>; - bits = <7 5>; - }; - - pcie_rx_imp_ln0: pcie-rx-imp@8d0 { - reg = <0x8d0 1>; - bits = <0 5>; - }; - - pcie_tx_imp_ln0: pcie-tx-imp@8d0 { - reg = <0x8d0 2>; - bits = <5 5>; - }; - - pcie_intr_ln0: pcie-intr@8d1 { - reg = <0x8d1 1>; - bits = <2 6>; - }; - - pcie_auto_load_valid_ln0: pcie-ln0-alv@8d4 { - reg = <0x8d4 1>; - bits = <0 1>; - }; - - pcie_rx_imp_ln1: pcie-rx-imp@8d2 { - reg = <0x8d2 1>; - bits = <0 5>; - }; - - pcie_tx_imp_ln1: pcie-tx-imp@8d2 { - reg = <0x8d2 2>; - bits = <5 5>; - }; - - pcie_intr_ln1: pcie-intr@8d3 { - reg = <0x8d3 1>; - bits = <2 6>; - }; - - pcie_auto_load_valid_ln1: pcie-ln1-alv@8d4 { - reg = <0x8d4 1>; - bits = <1 1>; - }; }; usb_phy: t-phy@11e10000 { compatible = "mediatek,mt7986-tphy", "mediatek,generic-tphy-v2"; - #address-cells = <2>; - #size-cells = <2>; - ranges; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0 0x11e10000 0x1700>; status = "disabled"; - u2port0: usb-phy@11e10000 { - reg = <0 0x11e10000 0 0x700>; + u2port0: usb-phy@0 { + reg = <0x0 0x700>; clocks = <&topckgen CLK_TOP_DA_U2_REFSEL>, <&topckgen CLK_TOP_DA_U2_CK_1P_SEL>; clock-names = "ref", "da_ref"; #phy-cells = <1>; - auto_load_valid; - nvmem-cells = <&u2_intr_p0>, <&u2_auto_load_valid_p0>; - nvmem-cell-names = "intr", "auto_load_valid"; }; - u3port0: usb-phy@11e10700 { - reg = <0 0x11e10700 0 0x900>; + u3port0: usb-phy@700 { + reg = <0x700 0x900>; clocks = <&topckgen CLK_TOP_USB3_PHY_SEL>; clock-names = "ref"; #phy-cells = <1>; - auto_load_valid; - nvmem-cells = <&comb_intr_p0>, - <&comb_rx_imp_p0>, - <&comb_tx_imp_p0>, - <&comb_auto_load_valid>; - nvmem-cell-names = "intr", "rx_imp", "tx_imp", "auto_load_valid"; }; - u2port1: usb-phy@11e11000 { - reg = <0 0x11e11000 0 0x700>; + u2port1: usb-phy@1000 { + reg = <0x1000 0x700>; clocks = <&topckgen CLK_TOP_DA_U2_REFSEL>, <&topckgen CLK_TOP_DA_U2_CK_1P_SEL>; clock-names = "ref", "da_ref"; #phy-cells = <1>; - auto_load_valid; - nvmem-cells = <&u2_intr_p1>, <&u2_auto_load_valid_p1>; - nvmem-cell-names = "intr", "auto_load_valid"; }; }; ethsys: syscon@15000000 { #address-cells = <1>; #size-cells = <1>; - compatible = "mediatek,mt7986-ethsys_ck", + compatible = "mediatek,mt7986-ethsys", "syscon"; reg = <0 0x15000000 0 0x1000>; #clock-cells = <1>; #reset-cells = <1>; }; - wed_pcie: wed-pcie@10003000 { - compatible = "mediatek,mt7986-wed-pcie", - "syscon"; - reg = <0 0x10003000 0 0x10>; - }; - - wed0: wed@15010000 { compatible = "mediatek,mt7986-wed", "syscon"; @@ -700,95 +585,49 @@ status = "disabled"; }; - consys: consys@10000000 { - compatible = "mediatek,mt7986-consys"; - reg = <0 0x10000000 0 0x8600000>; - memory-region = <&wmcpu_emi>; - }; - - wmac: wmac@18000000 { - compatible = "mediatek,mt7986-wmac", "mediatek,wbsys"; - resets = <&watchdog MT7986_TOPRGU_CONSYS_RST>; + wifi: wifi@18000000 { + compatible = "mediatek,mt7986-wmac"; + resets = <&watchdog MT7986_TOPRGU_CONSYS_SW_RST>; reset-names = "consys"; + clocks = <&topckgen CLK_TOP_CONN_MCUSYS_SEL>, + <&topckgen CLK_TOP_AP2CNN_HOST_SEL>; + clock-names = "mcu", "ap2conn"; reg = <0 0x18000000 0 0x1000000>, <0 0x10003000 0 0x1000>, <0 0x11d10000 0 0x1000>; interrupts = , , , - ; - clocks = <&topckgen CLK_TOP_CONN_MCUSYS_SEL>, - <&topckgen CLK_TOP_AP2CNN_HOST_SEL>; - clock-names = "mcu", "ap2conn"; + ; memory-region = <&wmcpu_emi>; - status = "disabled"; }; }; - fan: pwm-fan { - compatible = "pwm-fan"; - /* cooling level (0, 1, 2, 3) : (0% duty, 33% duty, 66% duty, 100% duty) */ - cooling-levels = <0 86 172 255>; - #cooling-cells = <2>; - status = "disabled"; - }; - thermal-zones { cpu_thermal: cpu-thermal { polling-delay-passive = <1000>; polling-delay = <1000>; thermal-sensors = <&thermal 0>; - trips { - cpu_trip_crit: crit { - temperature = <125000>; - hysteresis = <2000>; - type = "critical"; - }; - - cpu_trip_hot: hot { - temperature = <120000>; - hysteresis = <2000>; - type = "hot"; - }; + trips { cpu_trip_active_high: active-high { temperature = <115000>; hysteresis = <2000>; type = "active"; }; - cpu_trip_active_med: active-med { + cpu_trip_active_low: active-low { temperature = <85000>; hysteresis = <2000>; type = "active"; }; - cpu_trip_active_low: active-low { - temperature = <60000>; + cpu_trip_passive: passive { + temperature = <40000>; hysteresis = <2000>; type = "passive"; }; }; - - cooling-maps { - cpu-active-high { - /* active: set fan to cooling level 3 */ - cooling-device = <&fan 3 3>; - trip = <&cpu_trip_active_high>; - }; - - cpu-active-med { - /* active: set fan to cooling level 2 */ - cooling-device = <&fan 2 2>; - trip = <&cpu_trip_active_med>; - }; - - cpu-active-low { - /* passive: set fan to cooling level 1 */ - cooling-device = <&fan 1 1>; - trip = <&cpu_trip_active_low>; - }; - }; }; }; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts index 85465223cf4f46..83d51916717fb9 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts @@ -56,7 +56,7 @@ status = "okay"; }; -&wmac { +&wifi { status = "okay"; pinctrl-names = "default", "dbdc"; pinctrl-0 = <&wf_2g_5g_pins>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b.dtsi index 23923b9f8944b5..db5189664c29ba 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b.dtsi @@ -5,6 +5,9 @@ */ #include "mt7986a.dtsi" +/ { + compatible = "mediatek,mt7986b"; +}; &pio { compatible = "mediatek,mt7986b-pinctrl"; diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-eth.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-eth.c index 495d023ccad7c6..ed2e7b20098770 100644 --- a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-eth.c +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-eth.c @@ -129,4 +129,4 @@ static void __init mtk_ethsys_init(struct device_node *node) pr_err("%s(): could not register clock provider: %d\n", __func__, r); } -CLK_OF_DECLARE(mtk_ethsys, "mediatek,mt7986-ethsys_ck", mtk_ethsys_init); +CLK_OF_DECLARE(mtk_ethsys, "mediatek,mt7986-ethsys", mtk_ethsys_init); diff --git a/target/linux/mediatek/files-5.15/include/dt-bindings/reset/mt7986-resets.h b/target/linux/mediatek/files-5.15/include/dt-bindings/reset/mt7986-resets.h index 1bdfe34a7a3492..af3d16c81192f7 100644 --- a/target/linux/mediatek/files-5.15/include/dt-bindings/reset/mt7986-resets.h +++ b/target/linux/mediatek/files-5.15/include/dt-bindings/reset/mt7986-resets.h @@ -1,10 +1,55 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (c) 2021 MediaTek Inc. */ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* + * Copyright (c) 2022 MediaTek Inc. + * Author: Sam Shih + */ -#ifndef _DT_BINDINGS_RESET_MT7986 -#define _DT_BINDINGS_RESET_MT7986 +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT7986 +#define _DT_BINDINGS_RESET_CONTROLLER_MT7986 -#define MT7986_TOPRGU_CONSYS_RST 23 -#define MT7986_TOPRGU_SW_RST_NUM 32 +/* INFRACFG resets */ +#define MT7986_INFRACFG_PEXTP_MAC_SW_RST 6 +#define MT7986_INFRACFG_SSUSB_SW_RST 7 +#define MT7986_INFRACFG_EIP97_SW_RST 8 +#define MT7986_INFRACFG_AUDIO_SW_RST 13 +#define MT7986_INFRACFG_CQ_DMA_SW_RST 14 -#endif /* _DT_BINDINGS_RESET_MT7986 */ +#define MT7986_INFRACFG_TRNG_SW_RST 17 +#define MT7986_INFRACFG_AP_DMA_SW_RST 32 +#define MT7986_INFRACFG_I2C_SW_RST 33 +#define MT7986_INFRACFG_NFI_SW_RST 34 +#define MT7986_INFRACFG_SPI0_SW_RST 35 +#define MT7986_INFRACFG_SPI1_SW_RST 36 +#define MT7986_INFRACFG_UART0_SW_RST 37 +#define MT7986_INFRACFG_UART1_SW_RST 38 +#define MT7986_INFRACFG_UART2_SW_RST 39 +#define MT7986_INFRACFG_AUXADC_SW_RST 43 + +#define MT7986_INFRACFG_APXGPT_SW_RST 66 +#define MT7986_INFRACFG_PWM_SW_RST 68 + +#define MT7986_INFRACFG_SW_RST_NUM 69 + +/* TOPRGU resets */ +#define MT7986_TOPRGU_APMIXEDSYS_SW_RST 0 +#define MT7986_TOPRGU_SGMII0_SW_RST 1 +#define MT7986_TOPRGU_SGMII1_SW_RST 2 +#define MT7986_TOPRGU_INFRA_SW_RST 3 +#define MT7986_TOPRGU_U2PHY_SW_RST 5 +#define MT7986_TOPRGU_PCIE_SW_RST 6 +#define MT7986_TOPRGU_SSUSB_SW_RST 7 +#define MT7986_TOPRGU_ETHDMA_SW_RST 20 +#define MT7986_TOPRGU_CONSYS_SW_RST 23 + +#define MT7986_TOPRGU_SW_RST_NUM 24 + +/* ETHSYS Subsystem resets */ +#define MT7986_ETHSYS_FE_SW_RST 6 +#define MT7986_ETHSYS_PMTR_SW_RST 8 +#define MT7986_ETHSYS_GMAC_SW_RST 23 +#define MT7986_ETHSYS_PPE0_SW_RST 30 +#define MT7986_ETHSYS_PPE1_SW_RST 31 + +#define MT7986_ETHSYS_SW_RST_NUM 32 + +#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT7986 */ diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/05_compat-version b/target/linux/mediatek/filogic/base-files/etc/board.d/05_compat-version new file mode 100644 index 00000000000000..e0e1a8ecc73e3d --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/05_compat-version @@ -0,0 +1,15 @@ + +. /lib/functions.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + bananapi,bpi-r3) + ucidef_set_compat_version "1.1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 582c1f70b8f2ae..31c576983bb81b 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -96,8 +96,8 @@ define Device/bananapi_bpi-r3 DEVICE_MODEL := BPi-R3 DEVICE_DTS := mt7986a-bananapi-bpi-r3 DEVICE_DTS_CONFIG := config-mt7986a-bananapi-bpi-r3 - DEVICE_DTS_OVERLAY:= mt7986a-bananapi-bpi-r3-nor mt7986a-bananapi-bpi-r3-emmc-nor mt7986a-bananapi-bpi-r3-emmc-snand mt7986a-bananapi-bpi-r3-snand - DEVICE_DTS_DIR := ../dts + DEVICE_DTS_OVERLAY:= mt7986a-bananapi-bpi-r3-emmc mt7986a-bananapi-bpi-r3-nand mt7986a-bananapi-bpi-r3-nor mt7986a-bananapi-bpi-r3-sd + DEVICE_DTS_DIR := $(DTS_DIR)/ DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-i2c-gpio kmod-mt7986-firmware kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs mt7986-wo-firmware IMAGES := sysupgrade.itb KERNEL_LOADADDR := 0x44000000 @@ -136,6 +136,8 @@ define Device/bananapi_bpi-r3 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata DTC_FLAGS += -@ --space 32768 + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update endef TARGET_DEVICES += bananapi_bpi-r3 diff --git a/target/linux/mediatek/patches-5.15/194-dts-mt7968a-add-ramoops.patch b/target/linux/mediatek/patches-5.15/194-dts-mt7968a-add-ramoops.patch new file mode 100644 index 00000000000000..161c1e75168cff --- /dev/null +++ b/target/linux/mediatek/patches-5.15/194-dts-mt7968a-add-ramoops.patch @@ -0,0 +1,17 @@ +--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi +@@ -68,6 +68,14 @@ + #address-cells = <2>; + #size-cells = <2>; + ranges; ++ ++ /* 64 KiB reserved for ramoops/pstore */ ++ ramoops@42ff0000 { ++ compatible = "ramoops"; ++ reg = <0 0x42ff0000 0 0x10000>; ++ record-size = <0x1000>; ++ }; ++ + /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ + secmon_reserved: secmon@43000000 { + reg = <0 0x43000000 0 0x30000>; diff --git a/target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch b/target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch new file mode 100644 index 00000000000000..7126da788beaba --- /dev/null +++ b/target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch @@ -0,0 +1,196 @@ +--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts ++++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +@@ -23,6 +23,10 @@ + serial0 = &uart0; + ethernet0 = &gmac0; + ethernet1 = &gmac1; ++ led-boot = &green_led; ++ led-failsafe = &green_led; ++ led-running = &green_led; ++ led-upgrade = &blue_led; + }; + + chosen { +@@ -417,27 +421,27 @@ + + port@1 { + reg = <1>; +- label = "lan0"; ++ label = "lan1"; + }; + + port@2 { + reg = <2>; +- label = "lan1"; ++ label = "lan2"; + }; + + port@3 { + reg = <3>; +- label = "lan2"; ++ label = "lan3"; + }; + + port@4 { + reg = <4>; +- label = "lan3"; ++ label = "lan4"; + }; + + port5: port@5 { + reg = <5>; +- label = "lan4"; ++ label = "sfp2"; + phy-mode = "2500base-x"; + sfp = <&sfp2>; + managed = "in-band-status"; +@@ -488,9 +492,137 @@ + + &wifi { + status = "okay"; +- pinctrl-names = "default", "dbdc"; ++ pinctrl-names = "default"; + pinctrl-0 = <&wf_2g_5g_pins>, <&wf_led_pins>; +- pinctrl-1 = <&wf_dbdc_pins>, <&wf_led_pins>; ++ ++ mediatek,eeprom-data = <0x86790900 0x000c4326 0x60000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x01000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000800 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x24649090 0x00280000 0x05100000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00021e00 0x021e0002 0x1e00021e 0x00022800 0x02280002 0x28000228 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00008080 0x8080fdf7 ++ 0x0903150d 0x80808080 0x80808080 0x05050d0d 0x1313c6c6 0xc3c3c200 0x00c200c2 0x00008182 ++ 0x8585c2c2 0x82828282 0x858500c2 0xc2000081 0x82858587 0x87c2c200 0x81818285 0x858787c2 ++ 0xc2000081 0x82858587 0x87c2c200 0x00818285 0x858787c2 0xc2000081 0x82858587 0x87c4c4c2 ++ 0xc100c300 0xc3c3c100 0x818383c3 0xc3c3c100 0x81838300 0xc2c2c2c0 0x81828484 0x000000c3 ++ 0xc3c3c100 0x81838386 0x86c3c3c3 0xc1008183 0x838686c2 0xc2c2c081 0x82848486 0x86c3c3c3 ++ 0xc1008183 0x838686c3 0xc3c3c100 0x81838386 0x86c3c3c3 0xc1008183 0x83868622 0x28002228 ++ 0x00222800 0x22280000 0xdddddddd 0xdddddddd 0xddbbbbbb 0xccccccdd 0xdddddddd 0xdddddddd ++ 0xeeeeeecc 0xccccdddd 0xdddddddd 0x004a5662 0x0000004a 0x56620000 0x004a5662 0x0000004a ++ 0x56620000 0x88888888 0x33333326 0x26262626 0x26262600 0x33333326 0x26262626 0x26262600 ++ 0x33333326 0x26262626 0x26262600 0x33333326 0x26262626 0x26262600 0x00000000 0xf0f0cc00 ++ 0x00000000 0x0000aaaa 0xaabbbbbb 0xcccccccc 0xccccbbbb 0xbbbbbbbb 0xbbbbbbaa 0xaaaabbbb ++ 0xbbaaaaaa 0x999999aa 0xaaaabbbb 0xbbcccccc 0x00000000 0x0000aaaa 0xaa000000 0xbbbbbbbb ++ 0xbbbbaaaa 0xaa999999 0xaaaaaaaa 0xaaaaaaaa 0xaaaaaaaa 0xaaaaaaaa 0xaaaabbbb 0xbbbbbbbb ++ 0x00000000 0x00000000 0x00000000 0x99999999 0x9999aaaa 0xaaaaaaaa 0x999999aa 0xaaaaaaaa ++ 0xaaaaaaaa 0xaaaaaaaa 0xaaaabbbb 0xbbbbbbbb 0x00000000 0x0000eeee 0xeeffffff 0xcccccccc ++ 0xccccdddd 0xddbbbbbb 0xccccccbb 0xbbbbbbbb 0xbbbbbbbb 0xbbbbbbbb 0xbbbbcccc 0xccdddddd ++ 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 ++ 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 ++ 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e ++ 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 ++ 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 ++ 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e 0x00516200 0x686e0051 0x6200686e ++ 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 0x88888888 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000001 0x06000100 0x01050002 0x00ff0300 ++ 0xf900fe03 0x00000000 0x00000000 0x0000009b 0x6e370000 0x00000000 0x00fc0009 0x0a00fe00 ++ 0x060700fe 0x00070800 0x05000b0a 0x00000000 0x00000000 0x000000e2 0x96460000 0x00000000 ++ 0x000400f7 0xf8000300 0xfcfe0003 0x00fbfc00 0xee00e3f2 0x00000000 0x00000000 0x00000011 ++ 0xbb550000 0x00000000 0x000600f6 0xfc000300 0xfbfe0004 0x00fafe00 0xf600ecf2 0x00000000 ++ 0x00000000 0x0000001f 0xbf580000 0x00000000 0x000600f5 0xf6000400 0xf8f90004 0x00f7f800 ++ 0xf700f0f4 0x00000000 0x00000000 0x00000024 0xbe570000 0x00000000 0x000800f8 0xfe000600 ++ 0xf8fd0007 0x00f9fe00 0xf500f0f4 0x00000000 0x00000000 0x0000002d 0xd6610000 0x00000000 ++ 0x000400f7 0xfc000500 0xf7fc0005 0x00f7fc00 0xf900f5f8 0x00000000 0x00000000 0x00000026 ++ 0xd96e0000 0x00000000 0x000400f7 0xf9000600 0xf5f70005 0x00f5f800 0xf900f4f7 0x00000000 ++ 0x00000000 0x0000001b 0xce690000 0x00000000 0x000300f8 0xf8000600 0xf6f60004 0x00f6f700 ++ 0xf900f4f7 0x00000000 0x00000000 0x00000018 0xd8720000 0x00000000 0x00000000 0x02404002 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0xc1c2c1c2 0x41c341c3 0x3fc13fc1 0x40c13fc2 0x3fc240c1 0x41c040c0 0x3fc23fc2 0x40c13fc2 ++ 0x3fc140c0 0x41c040c0 0x3fc33fc3 0x40c23fc2 0x3fc240c1 0x41c040c0 0x3fc23fc2 0x40c23fc2 ++ 0x3fc140c1 0x41c040c0 0x00000000 0x00000000 0x41c741c7 0xc1c7c1c7 0x00000000 0x00000000 ++ 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 ++ 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 0x3fc03fc0 ++ 0x00a0ce00 0x00000000 0xb6840000 0x00000000 0x00000000 0x00000000 0x18181818 0x18181818 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x004b5763 0x0000004b 0x57630000 0x004b5763 0x0000004b 0x57630000 0x88888888 0x08474759 ++ 0x69780849 0x49596d7a 0x0849495a 0x6d790848 0x48596c78 0x08484858 0x6a780848 0x48586a78 ++ 0x08484858 0x6c78084a 0x4a5b6d79 0x08474759 0x697a0848 0x48596b79 0x08484859 0x6c7a0848 ++ 0x48586c79 0x08484857 0x68770848 0x48576877 0x08484857 0x6a77084a 0x4a5a6a77 0x08464659 ++ 0x69790848 0x48586b79 0x08484858 0x6c7a0848 0x48596c79 0x08484857 0x68770848 0x48576877 ++ 0x08494958 0x6d7a084b 0x4b5c6c77 0x0847475a 0x6a7b0849 0x495a6e7c 0x0849495a 0x6e7c0849 ++ 0x495b6e7c 0x08494959 0x6a7a0849 0x49596a7a 0x084a4a5a 0x6f7d084b 0x4b5c6e7b 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x85848484 ++ 0xc3c4c4c5 0xc4c3c33f 0xc3c3c2c2 0xc2c2c03f 0xc3c3c3c4 0xc4c4c33f 0xc2c2c2c2 0xc1c3c1c1 ++ 0xc0c08282 0x83848686 0x88880000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00001111 0x00000000 ++ 0x8080f703 0x10808080 0x80050d13 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x000000a4 0xce000000 0x0000b684 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ++ 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000>; + + led { + led-active-low; +--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso ++++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso +@@ -55,6 +55,7 @@ + partition@c00000 { + label = "fit"; + reg = <0xc00000 0x1400000>; ++ compatible = "denx,fit"; + }; + }; + }; diff --git a/target/linux/mediatek/patches-5.15/941-arm64-dts-mt7986-move-cpuboot-in-a-dedicated-node.patch b/target/linux/mediatek/patches-5.15/941-arm64-dts-mt7986-move-cpuboot-in-a-dedicated-node.patch index 2d2871772d442f..0a58ae953b4fe5 100644 --- a/target/linux/mediatek/patches-5.15/941-arm64-dts-mt7986-move-cpuboot-in-a-dedicated-node.patch +++ b/target/linux/mediatek/patches-5.15/941-arm64-dts-mt7986-move-cpuboot-in-a-dedicated-node.patch @@ -11,7 +11,7 @@ Signed-off-by: Lorenzo Bianconi --- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi -@@ -121,11 +121,6 @@ +@@ -121,12 +121,6 @@ reg = <0 0x151f8000 0 0x2000>; no-map; }; @@ -20,10 +20,11 @@ Signed-off-by: Lorenzo Bianconi - reg = <0 0x15194000 0 0x1000>; - no-map; - }; +- }; timer { -@@ -625,10 +620,11 @@ +@@ -518,10 +512,11 @@ interrupt-parent = <&gic>; interrupts = ; memory-region = <&wo_emi0>, <&wo_ilm0>, <&wo_dlm0>, @@ -37,7 +38,7 @@ Signed-off-by: Lorenzo Bianconi }; wed1: wed@15011000 { -@@ -638,10 +634,11 @@ +@@ -531,10 +526,11 @@ interrupt-parent = <&gic>; interrupts = ; memory-region = <&wo_emi1>, <&wo_ilm1>, <&wo_dlm1>, @@ -51,7 +52,7 @@ Signed-off-by: Lorenzo Bianconi }; wo_ccif0: syscon@151a5000 { -@@ -658,6 +655,11 @@ +@@ -551,6 +547,11 @@ interrupts = ; }; diff --git a/target/linux/mediatek/patches-5.15/945-arm64-dts-mt7986-move-ilm-in-a-dedicated-node.patch b/target/linux/mediatek/patches-5.15/945-arm64-dts-mt7986-move-ilm-in-a-dedicated-node.patch index b640ed4b229c50..36fe9278372a95 100644 --- a/target/linux/mediatek/patches-5.15/945-arm64-dts-mt7986-move-ilm-in-a-dedicated-node.patch +++ b/target/linux/mediatek/patches-5.15/945-arm64-dts-mt7986-move-ilm-in-a-dedicated-node.patch @@ -34,7 +34,7 @@ Signed-off-by: Lorenzo Bianconi wo_data: wo-data@4fd80000 { reg = <0 0x4fd80000 0 0x240000>; no-map; -@@ -619,11 +609,10 @@ +@@ -511,11 +501,10 @@ reg = <0 0x15010000 0 0x1000>; interrupt-parent = <&gic>; interrupts = ; @@ -49,7 +49,7 @@ Signed-off-by: Lorenzo Bianconi mediatek,wo-cpuboot = <&wo_cpuboot>; }; -@@ -633,11 +622,10 @@ +@@ -525,11 +514,10 @@ reg = <0 0x15011000 0 0x1000>; interrupt-parent = <&gic>; interrupts = ; @@ -64,7 +64,7 @@ Signed-off-by: Lorenzo Bianconi mediatek,wo-cpuboot = <&wo_cpuboot>; }; -@@ -655,6 +643,16 @@ +@@ -547,6 +535,16 @@ interrupts = ; }; diff --git a/target/linux/mediatek/patches-5.15/946-arm64-dts-mt7986-move-dlm-in-a-dedicated-node.patch b/target/linux/mediatek/patches-5.15/946-arm64-dts-mt7986-move-dlm-in-a-dedicated-node.patch index 0523ae009d935a..55f17286c600eb 100644 --- a/target/linux/mediatek/patches-5.15/946-arm64-dts-mt7986-move-dlm-in-a-dedicated-node.patch +++ b/target/linux/mediatek/patches-5.15/946-arm64-dts-mt7986-move-dlm-in-a-dedicated-node.patch @@ -34,7 +34,7 @@ Signed-off-by: Lorenzo Bianconi }; timer { -@@ -609,10 +599,11 @@ +@@ -501,10 +491,11 @@ reg = <0 0x15010000 0 0x1000>; interrupt-parent = <&gic>; interrupts = ; @@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Bianconi mediatek,wo-cpuboot = <&wo_cpuboot>; }; -@@ -622,10 +613,11 @@ +@@ -514,10 +505,11 @@ reg = <0 0x15011000 0 0x1000>; interrupt-parent = <&gic>; interrupts = ; @@ -62,7 +62,7 @@ Signed-off-by: Lorenzo Bianconi mediatek,wo-cpuboot = <&wo_cpuboot>; }; -@@ -653,6 +645,16 @@ +@@ -545,6 +537,16 @@ reg = <0 0x151f0000 0 0x8000>; }; From 49bd38f01ac6927cda2dc894417994d1256673a7 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 6 Jun 2023 01:14:27 +0100 Subject: [PATCH 0106/1171] mediatek: set new compat version if booted on R64 and R3 If the board comes up with OpenWrt that means that the bootloader is recent enough and knows about the new device tree overlays. Using /etc/board.d/ is not enough in this case because it doesn't overwrite existing configuration which may exist (and is fine to exist) if the user updated with 'sysupgrade -F *.itb' and has kept configuration. They would still need to manually set compat_version even though the fact that the bootloader env has been updated can be implied by the fact that the system has started. Hence we can always set compat_version=1.1 for those two boards using uci-defaults. Signed-off-by: Daniel Golle (cherry picked from commit 25e27c4af3f1de872aadbaada434437cba3b0a75) --- .../base-files/etc/uci-defaults/05_fix-compat-version | 10 ++++++++++ .../base-files/etc/uci-defaults/05_fix-compat-version | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 target/linux/mediatek/filogic/base-files/etc/uci-defaults/05_fix-compat-version create mode 100644 target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version diff --git a/target/linux/mediatek/filogic/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/05_fix-compat-version new file mode 100644 index 00000000000000..4486f2f090c55a --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/05_fix-compat-version @@ -0,0 +1,10 @@ +. /lib/functions.sh + +case "$(board_name)" in + bananapi,bpi-r3) + uci set system.@system[0].compat_version="1.1" + uci commit system + ;; +esac + +exit 0 diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version new file mode 100644 index 00000000000000..c77e1cb8bd1927 --- /dev/null +++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version @@ -0,0 +1,10 @@ +. /lib/functions.sh + +case "$(board_name)" in + bananapi,bpi-r64) + uci set system.@system[0].compat_version="1.1" + uci commit system + ;; +esac + +exit 0 From 4bb75f6f40014b960d55be01213fc7837a696a6e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 6 Jun 2023 13:01:15 +0100 Subject: [PATCH 0107/1171] image: introduce DEVICE_DTC_FLAGS and DEVICE_DTCO_FLAGS Handle compiling device tree overlay blobs separate to allow for overlays being compiled with different parameters, mostly to safe space. Allow defining DEVICE_DTC_FLAGS and DEVICE_DTCO_FLAGS as per-device parameters to be passed to dtc. Previously some boards directly used DTC_FLAGS in their build recipe which then also affected other boards. Signed-off-by: Daniel Golle (cherry picked from commit 56f409c4e4df8b365b39a0bf9d2919814cc556a4) --- include/image.mk | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/include/image.mk b/include/image.mk index 0cf110df9319c3..fae4d32a8bb99d 100644 --- a/include/image.mk +++ b/include/image.mk @@ -146,7 +146,7 @@ endif # Disable noisy checks by default as in upstream -DTC_FLAGS += \ +DTC_WARN_FLAGS := \ -Wno-unit_address_vs_reg \ -Wno-simple_bus_reg \ -Wno-unit_address_format \ @@ -159,6 +159,9 @@ DTC_FLAGS += \ -Wno-graph_port \ -Wno-unique_unit_address +DTC_FLAGS += $(DTC_WARN_FLAGS) +DTCO_FLAGS += $(DTC_WARN_FLAGS) + define Image/pad-to dd if=$(1) of=$(1).new bs=$(2) conv=sync mv $(1).new $(1) @@ -174,7 +177,7 @@ endef # $(2) target dtb file # $(3) extra CPP flags # $(4) extra DTC flags -define Image/BuildDTB +define Image/BuildDTB/sub $(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \ $(DTS_CPPFLAGS) \ -I$(DTS_DIR) \ @@ -183,12 +186,20 @@ define Image/BuildDTB -undef -D__DTS__ $(3) \ -o $(2).tmp $(1) $(LINUX_DIR)/scripts/dtc/dtc -O dtb \ - -i$(dir $(1)) $(DTC_FLAGS) $(4) \ + -i$(dir $(1)) $(4) \ $(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \ -o $(2) $(2).tmp $(RM) $(2).tmp endef +define Image/BuildDTB + $(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTC_FLAGS) $(DEVICE_DTC_FLAGS) $(4)) +endef + +define Image/BuildDTBO + $(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTCO_FLAGS) $(DEVICE_DTCO_FLAGS) $(4)) +endef + define Image/mkfs/jffs2/sub-raw $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \ $(2) \ @@ -400,6 +411,8 @@ define Device/Init DEVICE_DTS_LOADADDR := DEVICE_DTS_OVERLAY := DEVICE_FDT_NUM := + DEVICE_DTC_FLAGS := + DEVICE_DTCO_FLAGS := SOC := BOARD_NAME := @@ -422,9 +435,9 @@ endef DEFAULT_DEVICE_VARS := \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ - VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ - DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \ - DEVICE_DTS_LOADADDR \ + VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTC_FLAGS \ + DEVICE_DTCO_FLAGS DEVICE_DTS DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER \ + DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \ DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ UBOOT_PATH IMAGE_SIZE \ @@ -557,10 +570,10 @@ define Device/Build/dtb endef define Device/Build/dtbo - ifndef BUILD_DTS_$(1) - BUILD_DTS_$(1) := 1 + ifndef BUILD_DTSO_$(1) + BUILD_DTSO_$(1) := 1 $(KDIR)/image-$(1).dtbo: FORCE - $(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dtso,$$@) + $(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@) image_prepare: $(KDIR)/image-$(1).dtbo endif From 703a5519cbf38855f9d496479c5d385032f97839 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 6 Jun 2023 13:04:08 +0100 Subject: [PATCH 0108/1171] mediatek: use DEVICE_DTC_FLAGS for BPi-R64 Make sure there is an extra 4kb of padding to apply device tree overlays on the BPi-R64. Signed-off-by: Daniel Golle (cherry picked from commit 7b536c4ec9f1a56a92dc5d96b7579cb514341dbf) --- target/linux/mediatek/image/mt7622.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index c02390100b4b27..040ef957db9a8d 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -70,6 +70,7 @@ define Device/bananapi_bpi-r64 DEVICE_DTS := mt7622-bananapi-bpi-r64 DEVICE_DTS_OVERLAY := mt7622-bananapi-bpi-r64-pcie1 mt7622-bananapi-bpi-r64-sata DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 e2fsprogs mkf2fs f2fsck + DEVICE_DTC_FLAGS := --pad 4096 ARTIFACTS := emmc-preloader.bin emmc-bl31-uboot.fip sdcard.img.gz snand-preloader.bin snand-bl31-uboot.fip IMAGES := sysupgrade.itb KERNEL_INITRAMFS_SUFFIX := -recovery.itb From e827f8f702da7b8095000d589978b494b15f02d1 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 6 Jun 2023 13:05:50 +0100 Subject: [PATCH 0109/1171] mediatek: use DEVICE_DTC_FLAGS and drop DTC_FLAGS where not needed The MT7986 RFB was intended to use device tree overlays and for that reason modified DTC_FLAGS. zyxel_ex5601-t0-stock later on probably copied it from there. Both boards do not actually use device tree overlays, so remove setting DTC_FLAGS from both. The BPi-R3 does use device tree overlays, use DEVICE_DTC_FLAGS to give it an extra 4kb of padding for overlays to be applied. Signed-off-by: Daniel Golle (cherry picked from commit 98e6ea32a400b10b425e0efdf5a8109a0dfd48fe) --- target/linux/mediatek/image/filogic.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 31c576983bb81b..6323a05de2a625 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -135,7 +135,7 @@ define Device/bananapi_bpi-r3 KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata - DTC_FLAGS += -@ --space 32768 + DEVICE_DTC_FLAGS := --pad 4096 DEVICE_COMPAT_VERSION := 1.1 DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update endef @@ -195,7 +195,6 @@ define Device/mediatek_mt7986a-rfb-nand fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_INITRAMFS = kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd - DTC_FLAGS += -@ --space 32768 endef TARGET_DEVICES += mediatek_mt7986a-rfb-nand @@ -367,6 +366,5 @@ define Device/zyxel_ex5601-t0-stock fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_INITRAMFS = kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd - DTC_FLAGS += -@ --space 32768 endef TARGET_DEVICES += zyxel_ex5601-t0-stock From 8a77ffc9719ffcdc0f014e230ff8c7eb84d74dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 9 Jun 2023 19:48:42 +0200 Subject: [PATCH 0110/1171] bmips: bump LZMA Loader address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows booting bigger ramdisk images via TFTP at the cost of breaking 32M RAM compatibility, but those devices have been unable to boot ramdisks on this target for some time anyway due to not having enough RAM. Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bmips/image/Makefile b/target/linux/bmips/image/Makefile index f86e46e0b95526..b5e3098fe75aa5 100644 --- a/target/linux/bmips/image/Makefile +++ b/target/linux/bmips/image/Makefile @@ -5,7 +5,7 @@ include $(INCLUDE_DIR)/image.mk KERNEL_LOADADDR := 0x80010000 # RAM start + 64K LOADER_ENTRY := 0x80a00000 # RAM start + 10M, for relocate -LZMA_TEXT_START := 0x81800000 # RAM start + 24M +LZMA_TEXT_START := 0x82000000 # RAM start + 32M DEVICE_VARS += CFE_BOARD_ID CFE_EXTRAS DEVICE_VARS += CFE_PART_FLAGS CFE_PART_ID From 725319ad3857e0d6b2f5f900e9ab2f779ad53410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Fri, 9 Jun 2023 00:09:33 +0200 Subject: [PATCH 0111/1171] bmips: add support for Observa VH4032N MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Observa VH4032N is an xDSL wifi router with a vertical white casing and two internal antennas connected via UFL. Hardware: - SoC: Broadcom BCM6368 - CPU: dual core BMIPS4350 V3.1 @400MHz - RAM: 128 MB DDR - Flash: 32 MB parallel NOR - Ethernet LAN: 4x 100Mbit - Wifi 2.4/5 GHz: onboard Broadcom BCM43222 802.11abgn - USB: 3x 2.0 - Buttons: 2x, 1 reset - LEDs: 8x, blue and red - UART: 1x Installation via OEM web UI: 1. Use the admin credentials to login via web UI 2. Go to Managament->Update firmware and select the OpenWrt CFE firmware 3. Press "Update Firmware" button and wait some minutes until it finish Signed-off-by: Daniel González Cabanelas --- .../bcm6368/base-files/etc/board.d/01_leds | 17 ++ .../bcm6368/base-files/etc/board.d/02_network | 3 +- .../base-files/etc/uci-defaults/09_fix_crc | 3 +- .../bmips/dts/bcm6368-observa-vh4032n.dts | 233 ++++++++++++++++++ target/linux/bmips/image/bcm6368.mk | 15 ++ 5 files changed, 269 insertions(+), 2 deletions(-) create mode 100644 target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds create mode 100644 target/linux/bmips/dts/bcm6368-observa-vh4032n.dts diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds new file mode 100644 index 00000000000000..ab797568b7fd08 --- /dev/null +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/leds.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in +observa,vh4032n) + ucidef_set_led_usbport "usb1" "USB1" "blue:hspa" "usb1-port1" "usb2-port1" + ucidef_set_led_usbport "usb2" "USB2" "red:hspa" "1-2-port1" "1-2-port2" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network index 14d6e56dd1cf1f..1064b80fba169a 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network @@ -5,7 +5,8 @@ board_config_update case "$(board_name)" in -comtrend,vr-3025u) +comtrend,vr-3025u |\ +observa,vh4032n) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; diff --git a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc index c66e4169fddaf7..d4ff723d142194 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc @@ -3,7 +3,8 @@ . /lib/functions.sh case "$(board_name)" in -comtrend,vr-3025u) +comtrend,vr-3025u |\ +observa,vh4032n) mtd fixtrx firmware ;; esac diff --git a/target/linux/bmips/dts/bcm6368-observa-vh4032n.dts b/target/linux/bmips/dts/bcm6368-observa-vh4032n.dts new file mode 100644 index 00000000000000..4a4cca0982c4d1 --- /dev/null +++ b/target/linux/bmips/dts/bcm6368-observa-vh4032n.dts @@ -0,0 +1,233 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368.dtsi" + +/ { + model = "Observa VH4032N"; + compatible = "observa,vh4032n", "brcm,bcm6368"; + + aliases { + led-boot = &led_power_blue; + led-failsafe = &led_power_red; + led-running = &led_power_blue; + led-upgrade = &led_power_blue; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led@2 { + label = "blue:dsl"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + led@5 { + label = "red:dsl"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + led@11 { + label = "blue:hspa"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + led@12 { + label = "red:hspa"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + led_power_blue: led@22 { + label = "blue:power"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_power_red: led@24 { + label = "red:power"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + }; + + led@25 { + label = "blue:voice"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + }; + + led@26 { + label = "red:voice"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + }; + }; + + bcm43222-sprom { + compatible = "brcm,ssb-sprom"; + + pci-bus = <0>; + pci-dev = <1>; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm43222-sprom.bin"; + brcm,sprom-fixups = <2 0x04d2>, <4 0x4350>, + <65 0x1300>, <68 0x0402>, + <70 0x0090>, <71 0x4c19>, + <72 0x2345>, <87 0x0315>, + <88 0x0315>, <96 0x2048>, + <97 0xfed7>, <98 0x15a6>, + <99 0xfaee>, <100 0x3e3a>, + <101 0x3a36>, <102 0xff7f>, + <103 0x11b9>, <104 0xfc53>, + <105 0xffe6>, <106 0xfdd2>, + <107 0xfe49>, <108 0xff6a>, + <109 0x136e>, <110 0xfbed>, + <111 0x0000>, <112 0x2048>, + <113 0xfee2>, <114 0x15e5>, + <115 0xfaed>, <116 0x3e3a>, + <117 0x3a36>, <118 0xffc8>, + <119 0x12b8>, <120 0xfca1>, + <121 0xff9b>, <122 0x122a>, + <123 0xfcc8>, <124 0xff95>, + <125 0x146b>, <126 0xfbba>, + <127 0x0000>, <161 0x0000>, + <162 0x0000>, <169 0x0000>, + <170 0x0000>, <171 0x0000>, + <172 0x0000>, <173 0x0000>, + <174 0x0000>, <175 0x0000>, + <176 0x0000>, <219 0x1108>; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&gpio { + usb_hub_reset { + gpio-hog; + gpios = <27 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "usb-hub-reset-gpio"; + }; +}; + +&ohci { + status = "okay"; +}; + +&pci { + status = "okay"; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "CFE"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + compatible = "brcm,bcm963xx-imagetag"; + label = "firmware"; + reg = <0x0020000 0x1fc0000>; + }; + + partition@1fe0000 { + label = "nvram"; + reg = <0x1fe0000 0x020000>; + }; + }; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ephy0_led &pinctrl_ephy1_led + &pinctrl_ephy2_led &pinctrl_ephy3_led>; +}; + +&switch0 { + ports { + port@0 { + reg = <0>; + label = "lan4"; + + phy-handle = <&phy1>; + phy-mode = "mii"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + + phy-handle = <&phy2>; + phy-mode = "mii"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + + phy-handle = <&phy3>; + phy-mode = "mii"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + + phy-handle = <&phy4>; + phy-mode = "mii"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index 268b68dd7c305b..e3aa40d404c08d 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -13,3 +13,18 @@ define Device/comtrend_vr-3025u kmod-leds-gpio endef TARGET_DEVICES += comtrend_vr-3025u + +define Device/observa_vh4032n + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := Observa + DEVICE_MODEL := VH4032N + IMAGES += sysupgrade.bin + CFE_BOARD_ID := 96368VVW + CHIP_ID := 6368 + BLOCKSIZE := 0x20000 + FLASH_MB := 32 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-43222-sprom \ + kmod-leds-gpio +endef +TARGET_DEVICES += observa_vh4032n From f25afae0b51c47a185ae30d4414ce229f27feb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Sat, 10 Jun 2023 11:54:59 +0200 Subject: [PATCH 0112/1171] bmips: add support for Netgear DGND3700 v1, DGND3800B MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Netgear DGND3700 v1 and DGND3800B are the same device but with different factory firmwares. It's an xDSL wifi router with a slim black shiny casing and 4 PCB internal antennas connected via UFL to a miniPCI detachable card. Hardware: - SoC: Broadcom BCM6368 - CPU: dual core BMIPS4350 V3.1 @400Mhz - RAM: 128 MB DDR - NOR Flash: 32 MB parallel (CFE and OS) - NAND flash: 128 MB (empty) - Ethernet LAN: 5x 1Gbit - Wifi 2.4 GHz: Broadcom BCM43222 802.11bgn - Wifi 5 GHz: Broadcom BCM43222 802.11abgn - USB: 2x 2.0 - Buttons: 3x, 1 reset - LEDs: 11x - UART: yes Installation via OEM web UI: 1. Open the Netgear administration web interface, by default: http://192.168.0.1 user: admin password: password 2. Look for "upgrade firmware" and proceed 3. Wait some minutes until it finishes Signed-off-by: Daniel González Cabanelas --- .../bcm6368/base-files/etc/board.d/01_leds | 9 + .../bcm6368/base-files/etc/board.d/02_network | 5 + .../bmips/dts/bcm6368-netgear-dgnd3700-v1.dts | 8 + .../bmips/dts/bcm6368-netgear-dgnd3700.dtsi | 266 ++++++++++++++++++ .../bmips/dts/bcm6368-netgear-dgnd3800b.dts | 8 + target/linux/bmips/image/Makefile | 9 + target/linux/bmips/image/bcm6368.mk | 29 ++ 7 files changed, 334 insertions(+) create mode 100644 target/linux/bmips/dts/bcm6368-netgear-dgnd3700-v1.dts create mode 100644 target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi create mode 100644 target/linux/bmips/dts/bcm6368-netgear-dgnd3800b.dts diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds index ab797568b7fd08..e68a4e947b1820 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds @@ -6,6 +6,15 @@ board_config_update case "$(board_name)" in +netgear,dgnd3700-v1 |\ +netgear,dgnd3800b) + ucidef_set_led_netdev "lan" "LAN" "green:lan" "switch.1" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" + ucidef_set_led_netdev "wlan0" "WIFI2G" "green:wifi2g" "phy0-ap0" + ucidef_set_led_netdev "wlan1" "WIFI5G" "blue:wifi5g" "phy1-ap0" + ucidef_set_led_usbport "usb1" "USB1" "green:usb1" "usb1-port1" "usb2-port1" + ucidef_set_led_usbport "usb2" "USB2" "green:usb2" "usb1-port2" "usb2-port2" + ;; observa,vh4032n) ucidef_set_led_usbport "usb1" "USB1" "blue:hspa" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb2" "USB2" "red:hspa" "1-2-port1" "1-2-port2" diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network index 1064b80fba169a..f99005acd722d9 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network @@ -10,6 +10,11 @@ observa,vh4032n) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; +netgear,dgnd3700-v1 |\ +netgear,dgnd3800b) + ucidef_set_bridge_device switch + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" + ;; esac board_config_flush diff --git a/target/linux/bmips/dts/bcm6368-netgear-dgnd3700-v1.dts b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700-v1.dts new file mode 100644 index 00000000000000..4ec6c480834b80 --- /dev/null +++ b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700-v1.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368-netgear-dgnd3700.dtsi" + +/ { + model = "Netgear DGND3700 v1"; + compatible = "netgear,dgnd3700-v1", "brcm,bcm6368"; +}; diff --git a/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi new file mode 100644 index 00000000000000..2299611d55020f --- /dev/null +++ b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi @@ -0,0 +1,266 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368.dtsi" + +/ { + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led@2 { + label = "green:dsl"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + led@4 { + label = "red:wan"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led@5 { + label = "green:wan"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + led@11 { + label = "green:wps"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + /* usb front */ + led@13 { + label = "green:usb2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + /* usb back */ + led@14 { + label = "green:usb1"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_power_red: led@22 { + label = "red:power"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + panic-indicator; + }; + + led@23 { + label = "green:lan"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + + led_power_green: led@24 { + label = "green:power"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led@26 { + label = "green:wifi2g"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + }; + + led@27 { + label = "blue:wifi5g"; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&lsspi { + status = "okay"; + + switch@1 { + compatible = "brcm,bcm53115"; + reg = <1>; + spi-max-frequency = <781000>; + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + wan@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan4"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan2"; + }; + + port@4 { + reg = <4>; + label = "lan1"; + }; + + port@8 { + reg = <8>; + + phy-mode = "rgmii"; + ethernet = <&switch0port5>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <15>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "storage"; + reg = <0 0>; /* autodetected size */ + }; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&pci { + status = "okay"; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "CFE"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + compatible = "brcm,bcm963xx-imagetag"; + label = "firmware"; + reg = <0x0020000 0x1e20000>; + }; + + partition@1e40000 { + label = "board_data"; + reg = <0x1e40000 0x1a0000>; + read-only; + }; + + partition@1fe0000 { + label = "nvram"; + reg = <0x1fe0000 0x020000>; + }; + }; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + switch0port5: port@5 { + reg = <5>; + label = "extsw"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/dts/bcm6368-netgear-dgnd3800b.dts b/target/linux/bmips/dts/bcm6368-netgear-dgnd3800b.dts new file mode 100644 index 00000000000000..350d3619c05256 --- /dev/null +++ b/target/linux/bmips/dts/bcm6368-netgear-dgnd3800b.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368-netgear-dgnd3700.dtsi" + +/ { + model = "Netgear DGND3800B"; + compatible = "netgear,dgnd3800b", "brcm,bcm6368"; +}; diff --git a/target/linux/bmips/image/Makefile b/target/linux/bmips/image/Makefile index b5e3098fe75aa5..58685dec7472dc 100644 --- a/target/linux/bmips/image/Makefile +++ b/target/linux/bmips/image/Makefile @@ -313,6 +313,15 @@ define Device/bcm63xx-nand DEVICE_PACKAGES += nand-utils endef +define Device/bcm63xx_netgear + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := NETGEAR + IMAGES := factory.chk sysupgrade.bin + IMAGE/factory.chk := cfe-bin | netgear-chk + NETGEAR_BOARD_ID := + NETGEAR_REGION := +endef + define Device/sercomm-nand $(Device/bcm63xx-nand) IMAGES := factory.img sysupgrade.bin diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index e3aa40d404c08d..41bce9e938c8dc 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -14,6 +14,35 @@ define Device/comtrend_vr-3025u endef TARGET_DEVICES += comtrend_vr-3025u +define Device/netgear_dgnd3700-v1 + $(Device/bcm63xx_netgear) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := DGND3700 + DEVICE_VARIANT := v1 + CFE_BOARD_ID := 96368MVWG + CHIP_ID := 6368 + BLOCKSIZE := 0x20000 + NETGEAR_BOARD_ID := U12L144T01_NETGEAR_NEWLED + NETGEAR_REGION := 1 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) +endef +TARGET_DEVICES += netgear_dgnd3700-v1 + +define Device/netgear_dgnd3800b + $(Device/bcm63xx_netgear) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := DGND3800B + CFE_BOARD_ID := 96368MVWG + CHIP_ID := 6368 + BLOCKSIZE := 0x20000 + NETGEAR_BOARD_ID := U12L144T11_NETGEAR_NEWLED + NETGEAR_REGION := 1 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) +endef +TARGET_DEVICES += netgear_dgnd3800b + define Device/observa_vh4032n $(Device/bcm63xx-cfe) DEVICE_VENDOR := Observa From 04ddeb85e784f76992584017acb85b08efe1f9b7 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Thu, 8 Jun 2023 18:12:05 +0200 Subject: [PATCH 0113/1171] apm821xx: switch over from DTB_SIZE to DEVICE_DTC_FLAGS DEVICE_DTC_FLAGS is more flexible and can be used in place of APM821xx own DTB_SIZE. Signed-off-by: Christian Lamparter (cherry picked from commit a5fc132aa3e43c8cc3a3beac3479b003e1a8f16a) --- target/linux/apm821xx/image/Makefile | 18 ++++++----------- target/linux/apm821xx/image/nand.mk | 29 ++++++++++------------------ target/linux/apm821xx/image/sata.mk | 6 +++--- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index f4701e9f26320c..03799bcc1061d4 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -3,14 +3,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -DEVICE_VARS += DTB_SIZE - define Build/boot-img $(RM) -rf $@.bootdir mkdir -p $@.bootdir/boot $(CP) $@.scr $@.bootdir/boot/boot.scr - $(CP) $(IMAGE_KERNEL).dtb $@.bootdir/boot/$(DEVICE_DTB) + $(CP) $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@.bootdir/boot/$(DEVICE_DTB) $(CP) $(IMAGE_KERNEL) $@.bootdir/boot/uImage genext2fs --block-size $(BLOCKSIZE:%k=%Ki) \ @@ -28,12 +26,8 @@ define Build/boot-script $@.scr endef -define Build/dtb - $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb,,--space $(DTB_SIZE)) -endef - define Build/export-dtb - cp $(IMAGE_KERNEL).dtb $@ + cp $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@ endef define Build/MuImage-initramfs @@ -58,15 +52,15 @@ define Build/MuImage-initramfs # part of the legacy multi image. Since we need to put the # device tree stuff into part 3. - -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T multi \ - -C $(1) -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) \ - -n '$(BOARD_NAME) initramfs' -d $@:$@.fakerd:$@.dtb $@.new + -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T multi -C $(1) \ + -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) -n '$(BOARD_NAME) initramfs' \ + -d $@:$@.fakerd:$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@.new mv $@.new $@ rm -rf $@.fakerd endef define Build/prepend-dtb - cat "$@.dtb.uimage" "$@" > "$@.new" + cat "$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb" "$@" > "$@.new" mv "$@.new" "$@" endef diff --git a/target/linux/apm821xx/image/nand.mk b/target/linux/apm821xx/image/nand.mk index 2848b87719ed92..bbc429c45db062 100644 --- a/target/linux/apm821xx/image/nand.mk +++ b/target/linux/apm821xx/image/nand.mk @@ -6,15 +6,6 @@ define Build/create-uImage-dtb -d "$@.dtb" "$@.dtb.uimage" endef -define Build/MerakiAdd-dtb - $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb) - ( \ - dd if=$@.dtb bs=$(DTB_SIZE) conv=sync; \ - cat $@ ; \ - ) > $@.new - @mv $@.new $@ -endef - define Build/meraki-header -$(STAGING_DIR_HOST)/bin/mkmerakifw \ -B $(BOARD_NAME) -s \ @@ -30,10 +21,10 @@ define Device/meraki_mr24 DEVICE_PACKAGES := kmod-spi-gpio -swconfig BOARD_NAME := mr24 IMAGES := sysupgrade.bin - DTB_SIZE := 64512 + DEVICE_DTC_FLAGS := --space 64512 IMAGE_SIZE := 8191k - KERNEL := kernel-bin | lzma | uImage lzma | MerakiAdd-dtb | meraki-header - KERNEL_INITRAMFS := kernel-bin | lzma | dtb | MuImage-initramfs lzma + KERNEL := kernel-bin | lzma | uImage lzma | prepend-dtb | meraki-header + KERNEL_INITRAMFS := kernel-bin | lzma | MuImage-initramfs lzma IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata UBINIZE_OPTS := -E 5 SUPPORTED_DEVICES += mr24 @@ -49,9 +40,9 @@ define Device/meraki_mx60 kmod-usb-storage block-mount BLOCKSIZE := 128k IMAGES := sysupgrade.bin - DTB_SIZE := 20480 + DEVICE_DTC_FLAGS := --space 20480 IMAGE_SIZE := 1021m - KERNEL := kernel-bin | libdeflate-gzip | dtb | MuImage-initramfs gzip + KERNEL := kernel-bin | libdeflate-gzip | MuImage-initramfs gzip IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata UBINIZE_OPTS := -E 5 DEVICE_COMPAT_VERSION := 2.0 @@ -66,11 +57,11 @@ define Device/netgear_wndap6x0 SUBPAGESIZE := 256 PAGESIZE := 512 BLOCKSIZE := 16k - DTB_SIZE := 32768 + DEVICE_DTC_FLAGS := --space 32768 IMAGE_SIZE := 27392k IMAGES := sysupgrade.bin factory.img KERNEL_SIZE := 6080k - KERNEL := dtb | kernel-bin | libdeflate-gzip | MuImage-initramfs gzip + KERNEL := kernel-bin | libdeflate-gzip | MuImage-initramfs gzip IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi UBINIZE_OPTS := -E 5 @@ -105,7 +96,7 @@ define Device/netgear_wndr4700 PAGESIZE := 2048 SUBPAGESIZE := 512 BLOCKSIZE := 128k - DTB_SIZE := 131008 + DEVICE_DTC_FLAGS := --space 131008 IMAGE_SIZE := 24960k IMAGES := factory.img sysupgrade.bin ARTIFACTS := device-tree.dtb @@ -113,8 +104,8 @@ define Device/netgear_wndr4700 # append a fake/empty rootfs to fool netgear's uboot # CHECK_DNI_FIRMWARE_ROOTFS_INTEGRITY in do_chk_dniimg() KERNEL := kernel-bin | lzma -d16 | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | \ - append-uImage-fakehdr filesystem | dtb | create-uImage-dtb | prepend-dtb - KERNEL_INITRAMFS := kernel-bin | libdeflate-gzip | dtb | MuImage-initramfs gzip + append-uImage-fakehdr filesystem | create-uImage-dtb | prepend-dtb + KERNEL_INITRAMFS := kernel-bin | libdeflate-gzip | MuImage-initramfs gzip IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ netgear-dni | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata diff --git a/target/linux/apm821xx/image/sata.mk b/target/linux/apm821xx/image/sata.mk index 8a9bd579881437..c7d7257691e7ab 100644 --- a/target/linux/apm821xx/image/sata.mk +++ b/target/linux/apm821xx/image/sata.mk @@ -11,9 +11,9 @@ define Device/wd_mybooklive DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-basic-mbedtls SUPPORTED_DEVICES += mbl wd,mybooklive-duo BLOCKSIZE := 1k - DTB_SIZE := 16384 - KERNEL := kernel-bin | dtb | libdeflate-gzip | uImage gzip - KERNEL_INITRAMFS := kernel-bin | libdeflate-gzip | dtb | MuImage-initramfs gzip + DEVICE_DTC_FLAGS := --pad 4096 + KERNEL := kernel-bin | libdeflate-gzip | uImage gzip + KERNEL_INITRAMFS := kernel-bin | libdeflate-gzip | MuImage-initramfs gzip IMAGES := factory.img.gz sysupgrade.img.gz ARTIFACTS := apollo3g.dtb DEVICE_DTB := apollo3g.dtb From 7d4868461264eefcb21a6e2d3ff6d02871d9ad5b Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Thu, 25 May 2023 22:20:15 +0200 Subject: [PATCH 0114/1171] kernel: use struct group to wipe psb6970 volatile priv data Instead of reference vlan and do strange subtraction, use the handy struct_group() to create a virtual struct of the same size of the members. This permits to have a more secure memset and fix compilation warning in 6.1 where additional checks are done. Fix compilation warning: | inlined from 'psb6970_reset_switch' at drivers/net/phy/psb6970.c:275:2: | ./include/linux/fortify-string.h:314:25: error: call to '__write_overflow_field' | declared with attribute warning: detected write beyond size of field | (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] | 314 | __write_overflow_field(p_size_field, size); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |cc1: all warnings being treated as errors Signed-off-by: Aleksander Jan Bajkowski (cherry picked from commit d69becd3071d560cd1c9ea655cbba26adce91f61) --- .../generic/files/drivers/net/phy/psb6970.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/psb6970.c b/target/linux/generic/files/drivers/net/phy/psb6970.c index af64704b16429e..2587b999138474 100644 --- a/target/linux/generic/files/drivers/net/phy/psb6970.c +++ b/target/linux/generic/files/drivers/net/phy/psb6970.c @@ -60,11 +60,13 @@ struct psb6970_priv { struct mutex reg_mutex; /* all fields below are cleared on reset */ - bool vlan; - u16 vlan_id[PSB6970_MAX_VLANS]; - u8 vlan_table[PSB6970_MAX_VLANS]; - u8 vlan_tagged; - u16 pvid[PSB6970_NUM_PORTS]; + struct_group(psb6970_priv_volatile, + bool vlan; + u16 vlan_id[PSB6970_MAX_VLANS]; + u8 vlan_table[PSB6970_MAX_VLANS]; + u8 vlan_tagged; + u16 pvid[PSB6970_NUM_PORTS]; + ); }; #define to_psb6970(_dev) container_of(_dev, struct psb6970_priv, dev) @@ -272,8 +274,8 @@ static int psb6970_reset_switch(struct switch_dev *dev) mutex_lock(&priv->reg_mutex); - memset(&priv->vlan, 0, sizeof(struct psb6970_priv) - - offsetof(struct psb6970_priv, vlan)); + memset(&priv->psb6970_priv_volatile, 0, + sizeof(priv->psb6970_priv_volatile)); for (i = 0; i < PSB6970_MAX_VLANS; i++) priv->vlan_id[i] = i; From bc7362fbcefaf644d2abb131a4fdd25a51f0b421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Fri, 9 Jun 2023 11:55:21 +0300 Subject: [PATCH 0115/1171] ramips: fix first boot network configuration for TOZED ZLT S12 PRO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The network configuration at first boot for TOZED ZLT S12 PRO lacks setting up the LAN and WAN network interfaces. Address this. The WAN port is advertised as WAN/LAN on the device and is put on LAN on stock firmware so put it on LAN here as well. Fixes: ce1f9fa625 ("ramips: add support for TOZED ZLT S12 PRO") Reported-by: Andre Cruz Signed-off-by: Arınç ÜNAL (cherry picked from commit b61253f92abb4c0d21ec7358a74438eae8d7e6b4) --- target/linux/ramips/mt7621/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 176d15b730520c..cd746e84eeae88 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -109,6 +109,7 @@ ramips_setup_interfaces() ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan sfp" ;; tozed,zlt-s12-pro) + ucidef_set_interface_lan "lan1 lan2 lan3 wan" ucidef_set_interface "wwan" device "/dev/ttyUSB0" protocol "ncm" uci add_list firewall.@zone[1].network='wwan' ;; From df34f71be4aeb849461997f6de70124cfe778604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Schr=C3=B6der?= Date: Fri, 9 Jun 2023 12:03:31 +0200 Subject: [PATCH 0116/1171] ramips: fix button definitions for Zyxel WSM20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Setting the events of the WPS and LED buttons to the best matching values based from the documentation: Signed-off-by: Thomas Schröder (cherry picked from commit b0120f7c8bb35088f298f00eb4a630f62fb4183f) --- target/linux/ramips/dts/mt7621_zyxel_wsm20.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_zyxel_wsm20.dts b/target/linux/ramips/dts/mt7621_zyxel_wsm20.dts index 315e2e1d79709c..299d982dc11795 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_wsm20.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_wsm20.dts @@ -66,7 +66,7 @@ led { label = "led"; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - linux,code = ; + linux,code = ; }; reset { @@ -78,7 +78,7 @@ wps { label = "wps"; gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - linux,code = ; + linux,code = ; }; }; }; From 13579e64417545dca6bc878927d9f48f3dfe4af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Sat, 10 Jun 2023 21:05:33 +0200 Subject: [PATCH 0117/1171] bmips: add support for Netgear EVG2000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Netgear EVG2000 is a wifi gigabit router, 2.4 GHz single band with two internal antennas integrated in the main PCB. Hardware: - SoC: Broadcom BCM6369 - CPU: dual core BMIPS4350 V3.1 @400Mhz - RAM: 64 MB DDR - Flash: 16 MB parallel NOR - LAN switch: Broadcom BCM53115, 5x 1Gbit - Wifi 2.4 GHz: Broadcom BCM4322 802.11bgn - USB: 2x 2.0 - Buttons: 2x, 1 reset - LEDs: 10x - FXS: 2x - UART: yes Installation via CFE web UI: 1. Power off the router and make a temporal TX-RX shortcircuit on the serial pins. 2. Power on the router and wait 3 or more seconds 3. Remove the TX-RX shortcircuit 4. Browse to http://192.168.1.1 or http://192.168.0.1 and upload the firmware 5. Wait a few minutes for it to finish Signed-off-by: Daniel González Cabanelas --- .../bcm6368/base-files/etc/board.d/01_leds | 5 + .../bcm6368/base-files/etc/board.d/02_network | 3 +- .../base-files/etc/uci-defaults/09_fix_crc | 1 + .../bmips/dts/bcm6369-netgear-evg2000.dts | 237 ++++++++++++++++++ target/linux/bmips/image/bcm6368.mk | 15 ++ 5 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 target/linux/bmips/dts/bcm6369-netgear-evg2000.dts diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds index e68a4e947b1820..fb7cca17e5b6b7 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds @@ -15,6 +15,11 @@ netgear,dgnd3800b) ucidef_set_led_usbport "usb1" "USB1" "green:usb1" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb2" "USB2" "green:usb2" "usb1-port2" "usb2-port2" ;; +netgear,evg2000) + ucidef_set_led_netdev "lan" "LAN" "green:lan" "switch.1" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" + ucidef_set_led_usbdev "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" "usb1-port2" "usb2-port2" + ;; observa,vh4032n) ucidef_set_led_usbport "usb1" "USB1" "blue:hspa" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb2" "USB2" "red:hspa" "1-2-port1" "1-2-port2" diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network index f99005acd722d9..76145024c130ba 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network @@ -11,7 +11,8 @@ observa,vh4032n) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; netgear,dgnd3700-v1 |\ -netgear,dgnd3800b) +netgear,dgnd3800b |\ +netgear,evg2000) ucidef_set_bridge_device switch ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; diff --git a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc index d4ff723d142194..363e492594e040 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc @@ -4,6 +4,7 @@ case "$(board_name)" in comtrend,vr-3025u |\ +netgear,evg2000 |\ observa,vh4032n) mtd fixtrx firmware ;; diff --git a/target/linux/bmips/dts/bcm6369-netgear-evg2000.dts b/target/linux/bmips/dts/bcm6369-netgear-evg2000.dts new file mode 100644 index 00000000000000..9f03c9e4dc526b --- /dev/null +++ b/target/linux/bmips/dts/bcm6369-netgear-evg2000.dts @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368.dtsi" + +/ { + model = "Netgear EVG2000"; + compatible = "netgear,evg2000", "brcm,bcm6369", "brcm,bcm6368"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led@2 { + label = "green:voip2"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + led@4 { + label = "red:internet"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led@5 { + label = "green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + led@14 { + label = "green:voip1"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led@15 { + label = "green:usb"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_power_green: led@22 { + label = "green:power"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_power_red: led@23 { + label = "red:power"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + + led@24 { + label = "green:lan"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + }; + + led@27 { + label = "green:wan"; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + }; + + bcm4322-sprom { + compatible = "brcm,ssb-sprom"; + + pci-bus = <0>; + pci-dev = <1>; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm4322-sprom.bin"; + brcm,sprom-fixups = <219 0xec08>; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&mdio_ext { + switch@1e { + compatible = "brcm,bcm53115"; + reg = <30>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@4 { + reg = <4>; + label = "lan4"; + }; + + port@8 { + reg = <8>; + + phy-mode = "rgmii"; + ethernet = <&switch0port5>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + switch0port5: port@5 { + reg = <5>; + label = "extsw"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "CFE"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x020000 0xf40000>; + compatible = "brcm,bcm963xx-imagetag"; + }; + + partition@f60000 { + label = "board_data"; + reg = <0xf60000 0x080000>; + read-only; + }; + + partition@fe0000 { + label = "nvram"; + reg = <0xfe0000 0x020000>; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&pci { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index 41bce9e938c8dc..82d7608fba26fa 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -43,6 +43,21 @@ define Device/netgear_dgnd3800b endef TARGET_DEVICES += netgear_dgnd3800b +define Device/netgear_evg2000 + $(Device/bcm63xx_netgear) + DEVICE_MODEL := EVG2000 + CFE_BOARD_ID := 96369PVG + CHIP_ID := 6368 + SOC := bcm6369 + BLOCKSIZE := 0x20000 + NETGEAR_BOARD_ID := U12H154T90_NETGEAR + NETGEAR_REGION := 1 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-4322-sprom \ + kmod-leds-gpio +endef +TARGET_DEVICES += netgear_evg2000 + define Device/observa_vh4032n $(Device/bcm63xx-cfe) DEVICE_VENDOR := Observa From 0ea4866d65d0af1a61e1210c6aed42d0c6a69d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 11 Jun 2023 10:14:25 +0200 Subject: [PATCH 0118/1171] bmips: dts: improve and align device tree files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align all the device tree files and follow the same criteria before more devices are ported from bcm63xx and this goes out of control. Signed-off-by: Álvaro Fernández Rojas --- .../bmips/dts/bcm63167-sercomm-h500-s.dtsi | 11 ++++------- .../bmips/dts/bcm63168-comtrend-vr-3032u.dts | 10 +++------- .../bmips/dts/bcm63168-sercomm-shg2500.dts | 10 +++------- .../bmips/dts/bcm6318-comtrend-ar-5315u.dts | 19 ++++++++----------- .../bmips/dts/bcm6328-comtrend-ar-5387un.dts | 8 +++----- .../bmips/dts/bcm6358-huawei-hg556a-b.dts | 9 +++------ .../bmips/dts/bcm6362-huawei-hg253s-v2.dts | 10 +++------- .../bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 17 ++++++----------- .../bmips/dts/bcm6368-comtrend-vr-3025u.dts | 8 +++----- .../bmips/dts/bcm6368-netgear-dgnd3700.dtsi | 5 ++--- .../bmips/dts/bcm6368-observa-vh4032n.dts | 2 +- .../bmips/dts/bcm6369-netgear-evg2000.dts | 2 +- 12 files changed, 40 insertions(+), 71 deletions(-) diff --git a/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi index 8e0024a20f52da..95f330d6c53520 100644 --- a/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi @@ -8,10 +8,6 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; - - led-internet = &led_internet_green; - led-usb = &led_mobile_green; - led-wireless = &led_wireless_green; }; keys { @@ -56,7 +52,7 @@ label = "red:mobile"; }; - led_mobile_green: led@1 { + led@1 { reg = <1>; label = "green:mobile"; }; @@ -64,9 +60,10 @@ led_power_red: led@8 { reg = <8>; label = "red:power"; + panic-indicator; }; - led_wireless_green: led@9 { + led@9 { reg = <9>; label = "green:wifi"; }; @@ -86,7 +83,7 @@ label = "red:internet"; }; - led_internet_green: led@15 { + led@15 { reg = <15>; label = "green:internet"; }; diff --git a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts index 8c4611ee881ed5..5196f90afa8fa6 100644 --- a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts +++ b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts @@ -11,10 +11,6 @@ led-failsafe = &led_power_green; led-running = &led_power_green; led-upgrade = &led_power_green; - - led-dsl = &led_dsl_green; - led-internet = &led_internet_green; - led-usb = &led_usb_green; }; keys { @@ -78,13 +74,13 @@ label = "red:internet"; }; - led_dsl_green: led@3 { + led@3 { reg = <3>; active-low; label = "green:dsl"; }; - led_usb_green: led@4 { + led@4 { reg = <4>; active-low; label = "green:usb"; @@ -96,7 +92,7 @@ label = "green:wps"; }; - led_internet_green: led@8 { + led@8 { reg = <8>; active-low; label = "green:internet"; diff --git a/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts b/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts index bb769b09e1cb14..7b0ebf2aefc35d 100644 --- a/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts +++ b/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts @@ -11,10 +11,6 @@ led-failsafe = &led_power_red; led-running = &led_power_red; led-upgrade = &led_power_red; - - led-internet = &led_internet_green; - led-usb = &led_modem_green; - led-wireless = &led_wireless_green; }; i2c { @@ -82,7 +78,7 @@ label = "red:modem"; }; - led_modem_green: led@2 { + led@2 { reg = <2>; label = "green:modem"; }; @@ -107,7 +103,7 @@ label = "green:phone"; }; - led_wireless_green: led@7 { + led@7 { reg = <7>; label = "green:wifi"; }; @@ -117,7 +113,7 @@ label = "red:power"; }; - led_internet_green: led@9 { + led@9 { reg = <9>; label = "green:internet"; }; diff --git a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts index 8ac37be495cd02..45ed6e2a3b7123 100644 --- a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts +++ b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts @@ -11,10 +11,6 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; - - led-dsl = &led_dsl_green; - led-internet = &led_internet_green; - led-usb = &led_usb_green; }; keys { @@ -130,41 +126,41 @@ label = "green:power"; }; - led_usb_green: led@2 { + led@2 { reg = <2>; active-low; label = "green:usb"; }; led@4 { + /* EPHY0 Act */ reg = <4>; brcm,hardware-controlled; brcm,link-signal-sources = <4>; - /* EPHY0 Act */ }; led@5 { + /* EPHY1 Act */ reg = <5>; brcm,hardware-controlled; brcm,link-signal-sources = <5>; - /* EPHY1 Act */ }; led@6 { + /* EPHY2 Act */ reg = <6>; brcm,hardware-controlled; brcm,link-signal-sources = <6>; - /* EPHY2 Act */ }; led@7 { + /* EPHY3 Act */ reg = <7>; brcm,hardware-controlled; brcm,link-signal-sources = <7>; - /* EPHY3 Act */ }; - led_internet_green: led@8 { + led@8 { reg = <8>; active-low; label = "green:internet"; @@ -176,7 +172,7 @@ label = "red:internet"; }; - led_dsl_green: led@10 { + led@10 { reg = <10>; active-low; label = "green:dsl"; @@ -186,6 +182,7 @@ reg = <11>; active-low; label = "red:power"; + panic-indicator; }; }; diff --git a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts index 72802366a0855b..a0d1c117f74755 100644 --- a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts +++ b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts @@ -11,9 +11,6 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; - - led-dsl = &led_dsl_green; - led-internet = &led_internet_green; }; keys { @@ -129,9 +126,10 @@ led_power_red: led@4 { reg = <4>; label = "red:power"; + panic-indicator; }; - led_internet_green: led@7 { + led@7 { reg = <7>; label = "green:internet"; }; @@ -141,7 +139,7 @@ label = "green:power"; }; - led_dsl_green: led@11 { + led@11 { reg = <11>; active-low; label = "green:dsl"; diff --git a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts index 716c6227f8a068..d5f162846d24b5 100644 --- a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts +++ b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts @@ -3,17 +3,14 @@ #include "bcm6358.dtsi" / { - compatible = "huawei,hg556a-b", "brcm,bcm6358"; model = "Huawei EchoLife HG556a (version B)"; + compatible = "huawei,hg556a-b", "brcm,bcm6358"; aliases { led-boot = &led_power_red; led-failsafe = &led_power_red; led-running = &led_power_red; led-upgrade = &led_power_red; - - led-dsl = &led_dsl_red; - led-usb = &led_hspa_red; }; keys { @@ -57,12 +54,12 @@ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; }; - led_hspa_red: led@1 { + led@1 { label = "red:hspa"; gpios = <&gpio 1 GPIO_ACTIVE_LOW>; }; - led_dsl_red: led@2 { + led@2 { label = "red:dsl"; gpios = <&gpio 2 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts index 2a9a6c559a786a..f562bcd9b2b24a 100644 --- a/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts +++ b/target/linux/bmips/dts/bcm6362-huawei-hg253s-v2.dts @@ -10,10 +10,6 @@ led-boot = &led_phone_green; led-failsafe = &led_phone_green; led-upgrade = &led_phone_green; - - led-internet = &led_internet_green; - led-usb = &led_usb_green; - led-wireless = &led_wireless_green; }; keys { @@ -50,7 +46,7 @@ gpios = <&gpio 28 GPIO_ACTIVE_LOW>; }; - led_usb_green: led@30 { + led@30 { label = "green:usb"; gpios = <&gpio 30 GPIO_ACTIVE_LOW>; }; @@ -74,13 +70,13 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_leds>; - led_internet_green: led@3 { + led@3 { reg = <3>; active-low; label = "green:internet"; }; - led_wireless_green: led@5 { + led@5 { reg = <5>; active-low; label = "green:wifi"; diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index ddcde2b6889df7..46bb3e8bf651f9 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -11,12 +11,6 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; - - led-dsl = &led_dsl_green; - led-ethernet = &led_ethernet_green; - led-internet = &led_internet_green; - led-usb = &led_usb1_green; - led-usb2 = &led_usb2_green; }; keys { @@ -48,7 +42,7 @@ leds { compatible = "gpio-leds"; - led_dsl_green: led@28 { + led@28 { label = "green:dsl"; gpios = <&gpio 28 GPIO_ACTIVE_LOW>; }; @@ -56,6 +50,7 @@ led_power_red: led@34 { label = "red:power"; gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + panic-indicator; }; }; }; @@ -82,7 +77,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led>; - led_internet_green: led@1 { + led@1 { reg = <1>; active-low; label = "green:internet"; @@ -99,13 +94,13 @@ label = "green:wps"; }; - led_usb1_green: led@10 { + led@10 { reg = <10>; active-low; label = "green:usb1"; }; - led_usb2_green: led@11 { + led@11 { reg = <11>; active-low; label = "green:usb2"; @@ -117,7 +112,7 @@ label = "amber:internet"; }; - led_ethernet_green: led@13 { + led@13 { reg = <13>; active-low; label = "green:ethernet"; diff --git a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts index 60029fe7f84bb4..e67db8b6bde631 100644 --- a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts +++ b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts @@ -11,9 +11,6 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; - - led-dsl = &led_dsl_green; - led-internet = &led_internet_green; }; keys { @@ -31,12 +28,12 @@ leds { compatible = "gpio-leds"; - led_dsl_green: led@2 { + led@2 { label = "green:dsl"; gpios = <&gpio 2 GPIO_ACTIVE_LOW>; }; - led_internet_green: led@5 { + led@5 { label = "green:internet"; gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; }; @@ -49,6 +46,7 @@ led_power_red: led@24 { label = "red:power"; gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + panic-indicator; }; led@31 { diff --git a/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi index 2299611d55020f..74494556310601 100644 --- a/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi +++ b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi @@ -59,14 +59,14 @@ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; }; - /* usb front */ led@13 { + /* Front USB port */ label = "green:usb2"; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; - /* usb back */ led@14 { + /* Back USB port */ label = "green:usb1"; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; }; @@ -85,7 +85,6 @@ led_power_green: led@24 { label = "green:power"; gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - default-state = "on"; }; led@26 { diff --git a/target/linux/bmips/dts/bcm6368-observa-vh4032n.dts b/target/linux/bmips/dts/bcm6368-observa-vh4032n.dts index 4a4cca0982c4d1..14fbd856f8ffc2 100644 --- a/target/linux/bmips/dts/bcm6368-observa-vh4032n.dts +++ b/target/linux/bmips/dts/bcm6368-observa-vh4032n.dts @@ -58,12 +58,12 @@ led_power_blue: led@22 { label = "blue:power"; gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; - default-state = "on"; }; led_power_red: led@24 { label = "red:power"; gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + panic-indicator; }; led@25 { diff --git a/target/linux/bmips/dts/bcm6369-netgear-evg2000.dts b/target/linux/bmips/dts/bcm6369-netgear-evg2000.dts index 9f03c9e4dc526b..460c88f755c2cb 100644 --- a/target/linux/bmips/dts/bcm6369-netgear-evg2000.dts +++ b/target/linux/bmips/dts/bcm6369-netgear-evg2000.dts @@ -63,12 +63,12 @@ led_power_green: led@22 { label = "green:power"; gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - default-state = "on"; }; led_power_red: led@23 { label = "red:power"; gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + panic-indicator; }; led@24 { From b6c9312f4be7e4c8b4d3a61c11a8aec8547c4f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 11 Jun 2023 10:17:50 +0200 Subject: [PATCH 0119/1171] bmips: image: rename Device/bcm63xx_netgear MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every other Device definition in the target is using hyphens instead of underscores. Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/image/Makefile | 2 +- target/linux/bmips/image/bcm6368.mk | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/bmips/image/Makefile b/target/linux/bmips/image/Makefile index 58685dec7472dc..5ce026c5842234 100644 --- a/target/linux/bmips/image/Makefile +++ b/target/linux/bmips/image/Makefile @@ -313,7 +313,7 @@ define Device/bcm63xx-nand DEVICE_PACKAGES += nand-utils endef -define Device/bcm63xx_netgear +define Device/bcm63xx-netgear $(Device/bcm63xx-cfe) DEVICE_VENDOR := NETGEAR IMAGES := factory.chk sysupgrade.bin diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index 82d7608fba26fa..923701fd8036ed 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -15,7 +15,7 @@ endef TARGET_DEVICES += comtrend_vr-3025u define Device/netgear_dgnd3700-v1 - $(Device/bcm63xx_netgear) + $(Device/bcm63xx-netgear) DEVICE_VENDOR := NETGEAR DEVICE_MODEL := DGND3700 DEVICE_VARIANT := v1 @@ -30,7 +30,7 @@ endef TARGET_DEVICES += netgear_dgnd3700-v1 define Device/netgear_dgnd3800b - $(Device/bcm63xx_netgear) + $(Device/bcm63xx-netgear) DEVICE_VENDOR := NETGEAR DEVICE_MODEL := DGND3800B CFE_BOARD_ID := 96368MVWG @@ -44,7 +44,7 @@ endef TARGET_DEVICES += netgear_dgnd3800b define Device/netgear_evg2000 - $(Device/bcm63xx_netgear) + $(Device/bcm63xx-netgear) DEVICE_MODEL := EVG2000 CFE_BOARD_ID := 96369PVG CHIP_ID := 6368 From bb1f3ebd560aaeb34ecf9361bafad1019e270d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 11 Jun 2023 10:25:03 +0200 Subject: [PATCH 0120/1171] bmips: dgnd3700v1/dgnd3800b: add missing kmod-leds-gpio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit ed79519b8d89 missed adding kmod-leds-gpio to these devices. Fixes: ed79519b8d89 ("bmips: add support for Netgear DGND3700 v1, DGND3800B") Signed-off-by: Álvaro Fernández Rojas --- target/linux/bmips/image/bcm6368.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index 923701fd8036ed..e7d907fddb7c4d 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -25,7 +25,8 @@ define Device/netgear_dgnd3700-v1 NETGEAR_BOARD_ID := U12L144T01_NETGEAR_NEWLED NETGEAR_REGION := 1 DEVICE_PACKAGES += $(USB2_PACKAGES) \ - $(B43_PACKAGES) + $(B43_PACKAGES) \ + kmod-leds-gpio endef TARGET_DEVICES += netgear_dgnd3700-v1 @@ -39,7 +40,8 @@ define Device/netgear_dgnd3800b NETGEAR_BOARD_ID := U12L144T11_NETGEAR_NEWLED NETGEAR_REGION := 1 DEVICE_PACKAGES += $(USB2_PACKAGES) \ - $(B43_PACKAGES) + $(B43_PACKAGES) \ + kmod-leds-gpio endef TARGET_DEVICES += netgear_dgnd3800b From 0880d5d194d9e509b1f8a6163d6cdc89a9bcba61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 11 Jun 2023 10:53:10 +0200 Subject: [PATCH 0121/1171] bmips: add support for Comtrend VR-3025un MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Comtrend VR-3025un is a wifi gigabit router, 2.4 GHz single band with two external antennas. Hardware: - SoC: Broadcom BCM6368 - CPU: dual core BMIPS4350 @ 400Mhz - RAM: 64 MB DDR - Flash: 8 MB parallel NOR - Ethernet LAN: 4x 100Mbit - Wifi 2.4 GHz: miniPCI Broadcom BCM43222 802.11bgn - USB: 1x 2.0 - Buttons: 1x (reset) - LEDs: yes - UART: yes Installation via CFE web UI: 1. Power off the router. 2. Press reset button near the antenna. 3. Keep it pressed while powering up during ~20+ seconds. 4. Browse to http://192.168.1.1 and upload the firmware. 5. Wait a few minutes for it to finish. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 3baa45fbd8) --- .../bcm6368/base-files/etc/board.d/02_network | 4 + .../base-files/etc/uci-defaults/09_fix_crc | 1 + .../bmips/dts/bcm6368-comtrend-vr-3025un.dts | 182 ++++++++++++++++++ target/linux/bmips/image/bcm6368.mk | 13 ++ 4 files changed, 200 insertions(+) create mode 100644 target/linux/bmips/dts/bcm6368-comtrend-vr-3025un.dts diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network index 76145024c130ba..1b47e5a76f367f 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network @@ -10,6 +10,10 @@ observa,vh4032n) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; +comtrend,vr-3025un) + ucidef_set_bridge_device switch + ucidef_set_interface_lan "lan1 lan2 lan3 iptv" + ;; netgear,dgnd3700-v1 |\ netgear,dgnd3800b |\ netgear,evg2000) diff --git a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc index 363e492594e040..729931794799fe 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc @@ -4,6 +4,7 @@ case "$(board_name)" in comtrend,vr-3025u |\ +comtrend,vr-3025un |\ netgear,evg2000 |\ observa,vh4032n) mtd fixtrx firmware diff --git a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025un.dts b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025un.dts new file mode 100644 index 00000000000000..3256783e0e88db --- /dev/null +++ b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025un.dts @@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368.dtsi" + +/ { + model = "Comtrend VR-3025un"; + compatible = "comtrend,vr-3025un", "brcm,bcm6368"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led@2 { + label = "green:dsl"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + led@5 { + label = "green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + + led_power_green: led@22 { + label = "green:power"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + }; + + led_power_red: led@24 { + label = "red:power"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + led@31 { + label = "red:internet"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + bcm43222-sprom { + compatible = "brcm,ssb-sprom"; + + pci-bus = <0>; + pci-dev = <1>; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm43222-sprom.bin"; + brcm,sprom-fixups = <97 0xfeb3>, + <98 0x1618>, + <99 0xfab0>, + <113 0xfed1>, + <114 0x1609>, + <115 0xfad9>; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&ohci { + status = "okay"; +}; + +&pci { + status = "okay"; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "CFE"; + reg = <0x000000 0x010000>; + read-only; + }; + + partition@20000 { + compatible = "brcm,bcm963xx-imagetag"; + label = "firmware"; + reg = <0x010000 0x7e0000>; + }; + + partition@1fe0000 { + label = "nvram"; + reg = <0x7f0000 0x010000>; + }; + }; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ephy0_led &pinctrl_ephy1_led + &pinctrl_ephy2_led &pinctrl_ephy3_led>; +}; + +&switch0 { + ports { + port@0 { + reg = <0>; + label = "lan1"; + + phy-handle = <&phy1>; + phy-mode = "mii"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + + phy-handle = <&phy2>; + phy-mode = "mii"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + + phy-handle = <&phy3>; + phy-mode = "mii"; + }; + + port@3 { + reg = <3>; + label = "iptv"; + + phy-handle = <&phy4>; + phy-mode = "mii"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index e7d907fddb7c4d..67f8bbb09f0b9e 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -14,6 +14,19 @@ define Device/comtrend_vr-3025u endef TARGET_DEVICES += comtrend_vr-3025u +define Device/comtrend_vr-3025un + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := Comtrend + DEVICE_MODEL := VR-3025un + CHIP_ID := 6368 + CFE_BOARD_ID := 96368M-1341N + FLASH_MB := 8 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-43222-sprom \ + kmod-leds-gpio +endef +TARGET_DEVICES += comtrend_vr-3025un + define Device/netgear_dgnd3700-v1 $(Device/bcm63xx-netgear) DEVICE_VENDOR := NETGEAR From 8b20b8fe2ab2b67463c9a725627ac6951da6750c Mon Sep 17 00:00:00 2001 From: Volodymyr Puiul Date: Sat, 10 Jun 2023 18:23:17 +0400 Subject: [PATCH 0122/1171] ramips: mt7621-dts: move wan port to gmac1 YunCore FAP-640 move wan port to gmac1 to achieve 2Gbps CPU bandwidth between wan and lan on YunCore FAP-640 Signed-off-by: Volodymyr Puiul (cherry picked from commit 47c2d50c0312412582fff7950b843d619400da9f) --- .../ramips/dts/mt7621_yuncore_fap640.dts | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_yuncore_fap640.dts b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts index a0c32a02116042..d525dde385b4d9 100644 --- a/target/linux/ramips/dts/mt7621_yuncore_fap640.dts +++ b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts @@ -148,10 +148,26 @@ }; &gmac0 { + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + nvmem-cells = <&macaddr_factory_0004>; nvmem-cell-names = "mac-address"; }; +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + + &switch0 { gpio-controller; #gpio-cells = <2>; @@ -176,13 +192,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_0004>; - nvmem-cell-names = "mac-address"; - }; }; }; @@ -201,5 +210,9 @@ macaddr_factory_0004: macaddr@0004 { reg = <0x0004 0x6>; }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; }; From cfdcf4b4d91006ae2202f9846df3a8d23fe098a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 11 Jun 2023 12:30:57 +0200 Subject: [PATCH 0123/1171] bmips: add support for Comtrend WAP-5813n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Comtrend WAP-5813n is a wifi gigabit router, 2.4 GHz single band with two external antennas. Hardware: - SoC: Broadcom BCM6369 - CPU: dual core BMIPS4350 @ 400Mhz - RAM: 64 MB DDR - Flash: 8 MB parallel NOR - LAN switch: Broadcom BCM53115, 5x 1Gbit - Wifi 2.4 GHz: miniPCI Broadcom BCM4322 802.11bgn - USB: 1x 2.0 (optional) - Buttons: 3x (reset) - LEDs: yes - UART: yes Installation via CFE web UI: 1. Power off the router. 2. Press reset button near the power switch. 3. Keep it pressed while powering up during ~20+ seconds. 4. Browse to http://192.168.1.1 and upload the firmware. 5. Wait a few minutes for it to finish. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit c3b1ef2dfd) --- .../bcm6368/base-files/etc/board.d/01_leds | 3 + .../bcm6368/base-files/etc/board.d/02_network | 1 + .../base-files/etc/uci-defaults/09_fix_crc | 1 + .../bmips/dts/bcm6369-comtrend-wap-5813n.dts | 230 ++++++++++++++++++ target/linux/bmips/image/bcm6368.mk | 14 ++ 5 files changed, 249 insertions(+) create mode 100644 target/linux/bmips/dts/bcm6369-comtrend-wap-5813n.dts diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds index fb7cca17e5b6b7..c7e61fe72f35a6 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds @@ -6,6 +6,9 @@ board_config_update case "$(board_name)" in +comtrend,wap-5813n) + ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" + ;; netgear,dgnd3700-v1 |\ netgear,dgnd3800b) ucidef_set_led_netdev "lan" "LAN" "green:lan" "switch.1" diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network index 1b47e5a76f367f..58fba05fec3a3e 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ comtrend,vr-3025un) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 iptv" ;; +comtrend,wap-5813n |\ netgear,dgnd3700-v1 |\ netgear,dgnd3800b |\ netgear,evg2000) diff --git a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc index 729931794799fe..63d10c9a8e8082 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc @@ -5,6 +5,7 @@ case "$(board_name)" in comtrend,vr-3025u |\ comtrend,vr-3025un |\ +comtrend,wap-5813n |\ netgear,evg2000 |\ observa,vh4032n) mtd fixtrx firmware diff --git a/target/linux/bmips/dts/bcm6369-comtrend-wap-5813n.dts b/target/linux/bmips/dts/bcm6369-comtrend-wap-5813n.dts new file mode 100644 index 00000000000000..517a894cf506a4 --- /dev/null +++ b/target/linux/bmips/dts/bcm6369-comtrend-wap-5813n.dts @@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368.dtsi" + +/ { + model = "Comtrend WAP-5813n"; + compatible = "comtrend,wap-5813n", "brcm,bcm6369", "brcm,bcm6368"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + wlan { + label = "wlan"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led@5 { + label = "green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + + led@14 { + label = "green:usb"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_power_green: led@22 { + label = "green:power"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + }; + + led@23 { + label = "green:wps"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + + led_power_red: led@24 { + label = "red:power"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + led@31 { + label = "red:internet"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + bcm4322-sprom { + compatible = "brcm,ssb-sprom"; + + pci-bus = <0>; + pci-dev = <1>; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm4322-sprom.bin"; + brcm,sprom-fixups = <97 0xfeed>, + <98 0x15d1>, + <99 0xfb0d>, + <113 0xfef7>, + <114 0x15f7>, + <115 0xfb1a>; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&lsspi { + status = "okay"; + + switch@0 { + compatible = "brcm,bcm53115"; + reg = <0>; + spi-max-frequency = <781000>; + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan4"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@5 { + reg = <5>; + + phy-mode = "rgmii"; + ethernet = <&switch0port4>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "CFE"; + reg = <0x000000 0x010000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x010000 0x7e0000>; + compatible = "brcm,bcm963xx-imagetag"; + }; + + partition@fe0000 { + label = "nvram"; + reg = <0x7f0000 0x010000>; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&pci { + status = "okay"; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + switch0port4: port@4 { + reg = <4>; + label = "extsw"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index 67f8bbb09f0b9e..83cd096959ba30 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -27,6 +27,20 @@ define Device/comtrend_vr-3025un endef TARGET_DEVICES += comtrend_vr-3025un +define Device/comtrend_wap-5813n + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := Comtrend + DEVICE_MODEL := WAP-5813n + CHIP_ID := 6368 + SOC := bcm6369 + CFE_BOARD_ID := 96369R-1231N + FLASH_MB := 8 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-4322-sprom \ + kmod-leds-gpio +endef +TARGET_DEVICES += comtrend_wap-5813n + define Device/netgear_dgnd3700-v1 $(Device/bcm63xx-netgear) DEVICE_VENDOR := NETGEAR From 16d06a15d833176bbee2c369a103d88d51049ec5 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 11 Jun 2023 15:12:05 +0200 Subject: [PATCH 0124/1171] layerscape: 5.15: update source.codeaurora.org ppfe driver reference source.codeaurora.org project has been shut down and the nxp repositories has been moved to github. Update the link reference to the new location. Signed-off-by: Christian Marangi (cherry picked from commit 52d86ac6eb82b17769ce130eab5f4ba4efed06d2) --- .../patches-5.15/701-staging-add-fsl_ppfe-driver.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch index 9e6022608384ff..6130bf0030ff3f 100644 --- a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch +++ b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch @@ -7,7 +7,7 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is squash of all commits with ppfe driver taken from NXP 5.15 tree: -https://source.codeaurora.org/external/qoriq/qoriq-components/linux/log/drivers/staging/fsl_ppfe?h=lf-5.15.y +https://github.com/nxp-qoriq/linux/commits/lf-5.15.y/drivers/staging/fsl_ppfe List of original commits: From 774ca0c0e97f78e663dc12bc71171a36e4a2a939 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 11 Jun 2023 15:20:01 +0200 Subject: [PATCH 0125/1171] ls-dpl: update source.codeaurora.org repository link source.codeaurora.org project has been shut down and the nxp repositories has been moved to github. Update the repository link to the new location. Signed-off-by: Christian Marangi (cherry picked from commit 52fd8d8ba3ed4d34ed1dbc9d14fc7754960a576d) --- package/firmware/layerscape/ls-dpl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/firmware/layerscape/ls-dpl/Makefile b/package/firmware/layerscape/ls-dpl/Makefile index e3c84e98288497..6c53b4541700fa 100644 --- a/package/firmware/layerscape/ls-dpl/Makefile +++ b/package/firmware/layerscape/ls-dpl/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=21.08 PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/mc-utils +PKG_SOURCE_URL:=https://github.com/nxp-qoriq/mc-utils PKG_SOURCE_VERSION:=LSDK-21.08 PKG_MIRROR_HASH:=372498ff4b5c8a1ac64ead5856d03ee021332f57771989ed6fe066745372b242 From f3ec4a2790a4f1bdde2f745d0cb319260c8cee49 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 11 Jun 2023 15:22:49 +0200 Subject: [PATCH 0126/1171] restool: update source.codeaurora.org repository link source.codeaurora.org project has been shut down and the nxp repositories has been moved to github. Update the repository link to the new location. Signed-off-by: Christian Marangi (cherry picked from commit 0a1ee5323549bfce30b4d42be2dcc461f694881c) --- package/network/utils/layerscape/restool/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/layerscape/restool/Makefile b/package/network/utils/layerscape/restool/Makefile index 5f938a854b04ef..5919f42ff2afa2 100644 --- a/package/network/utils/layerscape/restool/Makefile +++ b/package/network/utils/layerscape/restool/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=21.08 PKG_RELEASE:=4 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/restool +PKG_SOURCE_URL:=https://github.com/nxp-qoriq/restool PKG_SOURCE_VERSION:=LSDK-21.08 PKG_MIRROR_HASH:=0396644927b8f3da20183227562f695c8063d3d4c6bb606e8f31dda450e962e4 From 8f1251a95150b0e30d8a07521c8d4b5e1f6a7a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 11 Jun 2023 18:44:36 +0200 Subject: [PATCH 0127/1171] bmips: add support for Comtrend AR-5381u MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Comtrend AR-5381u is a wifi fast ethernet router, 2.4 GHz single band with two internal antennas. Hardware: - SoC: Broadcom BCM6328 - CPU: single core BMIPS4350 @ 320Mhz - RAM: 64 MB DDR - Flash: 16 MB SPI NOR - Ethernet LAN: 4x 100Mbit - Wifi 2.4 GHz: miniPCI Broadcom BCM43225 802.11bgn - USB: 1x 2.0 - Buttons: 1x (reset) - LEDs: yes - UART: yes Installation via CFE web UI: 1. Power off the router. 2. Press reset button near the power switch. 3. Keep it pressed while powering up during ~20+ seconds. 4. Browse to http://192.168.1.1 and upload the firmware. 5. Wait a few minutes for it to finish. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit bcdf861519) --- .../bcm6328/base-files/etc/board.d/02_network | 1 + .../base-files/etc/uci-defaults/09_fix_crc | 1 + .../bmips/dts/bcm6328-comtrend-ar-5381u.dts | 190 ++++++++++++++++++ target/linux/bmips/image/bcm6328.mk | 13 ++ 4 files changed, 205 insertions(+) create mode 100644 target/linux/bmips/dts/bcm6328-comtrend-ar-5381u.dts diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network index 792926fcf27a90..c9c704067e9ebb 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network @@ -5,6 +5,7 @@ board_config_update case "$(board_name)" in +comtrend,ar-5381u |\ comtrend,ar-5387un) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" diff --git a/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc index 3909947be6de41..21f18b4b819502 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc @@ -3,6 +3,7 @@ . /lib/functions.sh case "$(board_name)" in +comtrend,ar-5381u |\ comtrend,ar-5387un) mtd fixtrx firmware ;; diff --git a/target/linux/bmips/dts/bcm6328-comtrend-ar-5381u.dts b/target/linux/bmips/dts/bcm6328-comtrend-ar-5381u.dts new file mode 100644 index 00000000000000..7499e7090ff49e --- /dev/null +++ b/target/linux/bmips/dts/bcm6328-comtrend-ar-5381u.dts @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6328.dtsi" + +/ { + model = "Comtrend AR-5381u"; + compatible = "comtrend,ar-5381u", "brcm,bcm6328"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_alarm_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + bcm43225-sprom { + compatible = "brcm,bcma-sprom"; + + pci-bus = <1>; + pci-dev = <0>; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm43225-sprom.bin"; + brcm,sprom-fixups = <97 0xfee5>, + <98 0x157c>, + <99 0xfae7>, + <113 0xfefa>, + <114 0x15d6>, + <115 0xfaf8>; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&hsspi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <16666667>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + reg = <0>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + reg = <0x000000 0x010000>; + label = "cfe"; + read-only; + }; + + partition@10000 { + compatible = "brcm,bcm963xx-imagetag"; + reg = <0x010000 0xfe0000>; + label = "firmware"; + }; + + partition@ff0000 { + reg = <0xff0000 0x010000>; + label = "nvram"; + }; + }; + }; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + led_alarm_red: led@2 { + reg = <2>; + active-low; + label = "red:alarm"; + panic-indicator; + }; + + led@3 { + reg = <3>; + active-low; + label = "green:internet"; + }; + + led_power_green: led@4 { + reg = <4>; + active-low; + label = "green:power"; + }; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio2", "gpio3", "gpio4"; + }; +}; + +&switch0 { + ports { + port@0 { + reg = <0>; + label = "lan1"; + + phy-handle = <&phy1>; + phy-mode = "mii"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + + phy-handle = <&phy2>; + phy-mode = "mii"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + + phy-handle = <&phy3>; + phy-mode = "mii"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + + phy-handle = <&phy4>; + phy-mode = "mii"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6328.mk b/target/linux/bmips/image/bcm6328.mk index b3cef51a71be57..dfa134df94673a 100644 --- a/target/linux/bmips/image/bcm6328.mk +++ b/target/linux/bmips/image/bcm6328.mk @@ -1,5 +1,18 @@ # SPDX-License-Identifier: GPL-2.0-or-later +define Device/comtrend_ar-5381u + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := Comtrend + DEVICE_MODEL := AR-5381u + CHIP_ID := 6328 + CFE_BOARD_ID := 96328A-1241N + FLASH_MB := 16 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-43225-sprom \ + kmod-leds-bcm6328 +endef +TARGET_DEVICES += comtrend_ar-5381u + define Device/comtrend_ar-5387un $(Device/bcm63xx-cfe) DEVICE_VENDOR := Comtrend From ee7a223433da78347ebec55900e25aa54eda8833 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 31 May 2023 15:19:31 +0200 Subject: [PATCH 0128/1171] kernel: fix wrong detection of Linux-Testing-Version in makefile DUMP When the split was done, the case for testing kernel version wasn't handled and only the to-be-compiled kernel version details files was included. This cause the kernel Linux-Testing-Version output from makefile target DUMP to report only the kernel version without the minor version (example 6.1 instead of 6.1.29). This value is expected with the full kernel version and this cause the dump-target-info.pl script to not correctly identify if a target have a testing kernel for the kernels calls. Fix this regression by correctly including the kernel details files if the target declare support for a testing kernel version. Fixes: 0765466a42f4 ("kernel: split kernel version to dedicated files") Signed-off-by: Christian Marangi (cherry picked from commit 595608eb3f05cba31da59e0d5d82504ab6731c0b) --- include/kernel-version.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 1edb01df278571..958ed9be0c0b80 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -13,6 +13,15 @@ endif include $(KERNEL_DETAILS_FILE) +ifdef KERNEL_TESTING_PATCHVER + KERNEL_TESTING_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_TESTING_PATCHVER) + ifeq ($(wildcard $(KERNEL_TESTING_DETAILS_FILE)),) + $(error Missing kernel version/hash file for $(KERNEL_TESTING_PATCHVER). Please create $(KERNEL_TESTING_DETAILS_FILE)) + endif + + include $(KERNEL_TESTING_DETAILS_FILE) +endif + remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) From b1114c1a7a2b3ea2602d30d116cd6d72483659a2 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 20 Mar 2023 04:16:04 +0000 Subject: [PATCH 0129/1171] kernel: add mdio-bus-mux support The MDIO bus multiplexing framework is used by some drivers such as dwmac-sun8i. As this is a per-driver requirement, set it to be hidden in the menu. Signed-off-by: Mathew McBride (cherry picked from commit 2dbeb607251b75b506dcc8f1294cd9ed0bac9694) --- package/kernel/linux/modules/netsupport.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index b73928980928f3..580ebb2d1b6cf4 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -1359,6 +1359,21 @@ endef $(eval $(call KernelPackage,mdio)) +define KernelPackage/mdio-bus-mux + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=MDIO bus multiplexers + KCONFIG:=CONFIG_MDIO_BUS_MUX + HIDDEN:=1 + FILES:=$(LINUX_DIR)/drivers/net/mdio/mdio-mux.ko + AUTOLOAD:=$(call AutoLoad,32,mdio-mux) +endef + +define KernelPackage/mdio/description + Kernel framework for MDIO bus multiplexers. +endef + +$(eval $(call KernelPackage,mdio-bus-mux)) + define KernelPackage/macsec SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IEEE 802.1AE MAC-level encryption (MAC) From fc87a8f2ec51f9d2c839b8ed537b339e2fcc7eb9 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 2 Jun 2023 12:27:19 +0200 Subject: [PATCH 0130/1171] generic: b53: rename exported symbols to avoid upstream conflict Upstream DSA driver is exporting symbols with the same name as our downstream swconfig driver, so lets rename the downstream symbols to make them unique and avoid the conflict on 6.1 kernel. Without this change, building 6.1 with kmod-switch-bcm53xx would conflict with the B53 DSA driver and CI would fail. Signed-off-by: Robert Marko (cherry picked from commit effccdd444a956afc5493ef8f1c79a7e7ffa8490) --- .../files/drivers/net/phy/b53/b53_common.c | 16 ++++++++-------- .../generic/files/drivers/net/phy/b53/b53_mdio.c | 6 +++--- .../generic/files/drivers/net/phy/b53/b53_mmap.c | 4 ++-- .../generic/files/drivers/net/phy/b53/b53_priv.h | 8 ++++---- .../generic/files/drivers/net/phy/b53/b53_spi.c | 4 ++-- .../generic/files/drivers/net/phy/b53/b53_srab.c | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c index 215a369e63eede..d5f9bfc2f0438b 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c @@ -1611,8 +1611,8 @@ static int b53_switch_init(struct b53_device *dev) return b53_switch_reset(dev); } -struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops, - void *priv) +struct b53_device *b53_swconfig_switch_alloc(struct device *base, struct b53_io_ops *ops, + void *priv) { struct b53_device *dev; @@ -1627,9 +1627,9 @@ struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops, return dev; } -EXPORT_SYMBOL(b53_switch_alloc); +EXPORT_SYMBOL(b53_swconfig_switch_alloc); -int b53_switch_detect(struct b53_device *dev) +int b53_swconfig_switch_detect(struct b53_device *dev) { u32 id32; u16 tmp; @@ -1694,9 +1694,9 @@ int b53_switch_detect(struct b53_device *dev) return b53_read8(dev, B53_MGMT_PAGE, B53_REV_ID, &dev->core_rev); } -EXPORT_SYMBOL(b53_switch_detect); +EXPORT_SYMBOL(b53_swconfig_switch_detect); -int b53_switch_register(struct b53_device *dev) +int b53_swconfig_switch_register(struct b53_device *dev) { int ret; @@ -1706,7 +1706,7 @@ int b53_switch_register(struct b53_device *dev) dev->sw_dev.alias = dev->pdata->alias; } - if (!dev->chip_id && b53_switch_detect(dev)) + if (!dev->chip_id && b53_swconfig_switch_detect(dev)) return -EINVAL; ret = b53_switch_init(dev); @@ -1717,7 +1717,7 @@ int b53_switch_register(struct b53_device *dev) return register_switch(&dev->sw_dev, NULL); } -EXPORT_SYMBOL(b53_switch_register); +EXPORT_SYMBOL(b53_swconfig_switch_register); MODULE_AUTHOR("Jonas Gorski "); MODULE_DESCRIPTION("B53 switch library"); diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c index 6ec23a49a36450..c85df1f3055801 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c @@ -280,7 +280,7 @@ static int b53_phy_probe(struct phy_device *phydev) if (phydev->mdio.addr != B53_PSEUDO_PHY && phydev->mdio.addr != 0) return -ENODEV; - dev = b53_switch_alloc(&phydev->mdio.dev, &b53_mdio_ops, phydev->mdio.bus); + dev = b53_swconfig_switch_alloc(&phydev->mdio.dev, &b53_mdio_ops, phydev->mdio.bus); if (!dev) return -ENOMEM; @@ -290,7 +290,7 @@ static int b53_phy_probe(struct phy_device *phydev) dev->pdata = NULL; mutex_init(&dev->reg_mutex); - ret = b53_switch_detect(dev); + ret = b53_swconfig_switch_detect(dev); if (ret) return ret; @@ -302,7 +302,7 @@ static int b53_phy_probe(struct phy_device *phydev) linkmode_copy(phydev->advertising, phydev->supported); - ret = b53_switch_register(dev); + ret = b53_swconfig_switch_register(dev); if (ret) { dev_err(dev->dev, "failed to register switch: %i\n", ret); return ret; diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c index ab1895e9b5ad47..0a21ff1de55ed4 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c @@ -205,7 +205,7 @@ static int b53_mmap_probe(struct platform_device *pdev) if (!pdata) return -EINVAL; - dev = b53_switch_alloc(&pdev->dev, &b53_mmap_ops, pdata->regs); + dev = b53_swconfig_switch_alloc(&pdev->dev, &b53_mmap_ops, pdata->regs); if (!dev) return -ENOMEM; @@ -214,7 +214,7 @@ static int b53_mmap_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); - return b53_switch_register(dev); + return b53_swconfig_switch_register(dev); } static int b53_mmap_remove(struct platform_device *pdev) diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h index 37c17aeb256dde..e455c755bf22e3 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h @@ -183,12 +183,12 @@ static inline struct b53_device *sw_to_b53(struct switch_dev *sw) return container_of(sw, struct b53_device, sw_dev); } -struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops, - void *priv); +struct b53_device *b53_swconfig_switch_alloc(struct device *base, struct b53_io_ops *ops, + void *priv); -int b53_switch_detect(struct b53_device *dev); +int b53_swconfig_switch_detect(struct b53_device *dev); -int b53_switch_register(struct b53_device *dev); +int b53_swconfig_switch_register(struct b53_device *dev); static inline void b53_switch_remove(struct b53_device *dev) { diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c b/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c index efc8f7ee89f2b3..400454df18c119 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c @@ -288,14 +288,14 @@ static int b53_spi_probe(struct spi_device *spi) struct b53_device *dev; int ret; - dev = b53_switch_alloc(&spi->dev, &b53_spi_ops, spi); + dev = b53_swconfig_switch_alloc(&spi->dev, &b53_spi_ops, spi); if (!dev) return -ENOMEM; if (spi->dev.platform_data) dev->pdata = spi->dev.platform_data; - ret = b53_switch_register(dev); + ret = b53_swconfig_switch_register(dev); if (ret) return ret; diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c b/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c index 012daa3a51fef8..ead5209cf0b84b 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c @@ -342,7 +342,7 @@ static int b53_srab_probe(struct platform_device *pdev) if (!pdata) return -EINVAL; - dev = b53_switch_alloc(&pdev->dev, &b53_srab_ops, pdata->regs); + dev = b53_swconfig_switch_alloc(&pdev->dev, &b53_srab_ops, pdata->regs); if (!dev) return -ENOMEM; @@ -351,7 +351,7 @@ static int b53_srab_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); - return b53_switch_register(dev); + return b53_swconfig_switch_register(dev); } static int b53_srab_remove(struct platform_device *pdev) From 61c1b9a0f60d1668204ba2be68dd40f47ccad715 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 25 May 2023 13:38:47 +0200 Subject: [PATCH 0131/1171] realtek: Add missing headers We are missing a bunch of headers, which trigger errors on 6.1, probably due to changed header-in-header dependencies. Best add them now. Signed-off-by: Olliver Schinagl (cherry picked from commit 9fb1dbb1df35911b407fa0faaa2443fbc0f0ddde) --- .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c | 2 ++ target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c | 1 + target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c | 1 + 7 files changed, 8 insertions(+) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c index 4b928f248be696..0434312afcef46 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index 5b5608b9b4a181..5744c70ea3f0fd 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include #include diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c index 0f9c3c33a4c4fd..adff404fddd430 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include #include diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c index fe5572a4476ebb..ff80a9074edf1e 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include "rtl83xx.h" diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c index e65f95e9f15ac1..c4f200bc0e02e9 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include #include "rtl83xx.h" diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c index 5e1b00add59346..3221109c1804ca 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include "rtl83xx.h" diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c index 2c2175922c283e..3f7c31e04d38ea 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c @@ -2,6 +2,7 @@ #include #include +#include #include #include #include From e7aae81d03f21dda8a371163fe347ea949381e34 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Wed, 24 May 2023 12:58:37 +0200 Subject: [PATCH 0132/1171] realtek: eth: Do not write directly to dev->addr One is never to write to dev->addr directly. In 6.1 it will be a const and with the newly enabled WERROR, we get a failing grade. Lets fix this ahead of time. Signed-off-by: Olliver Schinagl (cherry picked from commit d881f65da1e6f3bc4237b39cf2373bef51c3828c) --- .../drivers/net/ethernet/rtl838x_eth.c | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c index e9ebc7c73c85ce..9dcb7a3b78ed7c 100644 --- a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c @@ -1557,7 +1557,7 @@ static int rtl838x_set_mac_address(struct net_device *dev, void *p) if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + dev_addr_set(dev, addr->sa_data); rtl838x_set_mac_hw(dev, mac); pr_info("Using MAC %08x%08x\n", sw_r32(priv->r->mac), sw_r32(priv->r->mac + 4)); @@ -2352,6 +2352,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) struct resource *res, *mem; phy_interface_t phy_mode; struct phylink *phylink; + u8 mac_addr[ETH_ALEN]; int err = 0, rxrings, rxringlen; struct ring_b *ring; @@ -2478,17 +2479,18 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) * 1) from device tree data * 2) from internal registers set by bootloader */ - of_get_mac_address(pdev->dev.of_node, dev->dev_addr); - if (is_valid_ether_addr(dev->dev_addr)) { - rtl838x_set_mac_hw(dev, (u8 *)dev->dev_addr); + of_get_mac_address(pdev->dev.of_node, mac_addr); + if (is_valid_ether_addr(mac_addr)) { + rtl838x_set_mac_hw(dev, mac_addr); } else { - dev->dev_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff; - dev->dev_addr[1] = sw_r32(priv->r->mac) & 0xff; - dev->dev_addr[2] = (sw_r32(priv->r->mac + 4) >> 24) & 0xff; - dev->dev_addr[3] = (sw_r32(priv->r->mac + 4) >> 16) & 0xff; - dev->dev_addr[4] = (sw_r32(priv->r->mac + 4) >> 8) & 0xff; - dev->dev_addr[5] = sw_r32(priv->r->mac + 4) & 0xff; - } + mac_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff; + mac_addr[1] = sw_r32(priv->r->mac) & 0xff; + mac_addr[2] = (sw_r32(priv->r->mac + 4) >> 24) & 0xff; + mac_addr[3] = (sw_r32(priv->r->mac + 4) >> 16) & 0xff; + mac_addr[4] = (sw_r32(priv->r->mac + 4) >> 8) & 0xff; + mac_addr[5] = sw_r32(priv->r->mac + 4) & 0xff; + } + dev_addr_set(dev, mac_addr); /* if the address is invalid, use a random value */ if (!is_valid_ether_addr(dev->dev_addr)) { struct sockaddr sa = { AF_UNSPEC }; From 802e99a7fed6278b0b34d433c808b1685c63e92c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 2 Jun 2023 14:08:31 +0200 Subject: [PATCH 0133/1171] mac80211: backport EMA beacon support Backport EMA beacon support from kernel 6.4. It is required for MBSSID/EMA suport in ath11k that will follow. Tested-by: Francisco G Luna Signed-off-by: Robert Marko (cherry picked from commit 84b5735b4c59c8fcb3db647430a4ffd574fb10a3) --- ...0211-generate-EMA-beacons-in-AP-mode.patch | 372 ++++++++++++++++++ .../500-mac80211_configure_antenna_gain.patch | 4 +- 2 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch diff --git a/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch new file mode 100644 index 00000000000000..088f468e37216e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch @@ -0,0 +1,372 @@ +From bd54f3c29077f23dad92ef82a78061b40be30c65 Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Mon, 5 Dec 2022 16:50:37 -0800 +Subject: [PATCH] wifi: mac80211: generate EMA beacons in AP mode + +Add APIs to generate an array of beacons for an EMA AP (enhanced +multiple BSSID advertisements), each including a single MBSSID element. +EMA profile periodicity equals the count of elements. + +- ieee80211_beacon_get_template_ema_list() - Generate and return all +EMA beacon templates. Drivers must call ieee80211_beacon_free_ema_list() +to free the memory. No change in the prototype for the existing API, +ieee80211_beacon_get_template(), which should be used for non-EMA AP. + +- ieee80211_beacon_get_template_ema_index() - Generate a beacon which +includes the multiple BSSID element at the given index. Drivers can use +this function in a loop until NULL is returned which indicates end of +available MBSSID elements. + +- ieee80211_beacon_free_ema_list() - free the memory allocated for the +list of EMA beacon templates. + +Modify existing functions ieee80211_beacon_get_ap(), +ieee80211_get_mbssid_beacon_len() and ieee80211_beacon_add_mbssid() +to accept a new parameter for EMA index. + +Signed-off-by: Aloka Dixit +Co-developed-by: John Crispin +Signed-off-by: John Crispin +Link: https://lore.kernel.org/r/20221206005040.3177-2-quic_alokad@quicinc.com +Signed-off-by: Johannes Berg +--- + include/net/mac80211.h | 68 +++++++++++++++++++ + net/mac80211/cfg.c | 11 +-- + net/mac80211/ieee80211_i.h | 10 ++- + net/mac80211/tx.c | 134 ++++++++++++++++++++++++++++++++++--- + 4 files changed, 205 insertions(+), 18 deletions(-) + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -5252,6 +5252,74 @@ ieee80211_beacon_get_template(struct iee + unsigned int link_id); + + /** ++ * ieee80211_beacon_get_template_ema_index - EMA beacon template generation ++ * @hw: pointer obtained from ieee80211_alloc_hw(). ++ * @vif: &struct ieee80211_vif pointer from the add_interface callback. ++ * @offs: &struct ieee80211_mutable_offsets pointer to struct that will ++ * receive the offsets that may be updated by the driver. ++ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP). ++ * @ema_index: index of the beacon in the EMA set. ++ * ++ * This function follows the same rules as ieee80211_beacon_get_template() ++ * but returns a beacon template which includes multiple BSSID element at the ++ * requested index. ++ * ++ * Return: The beacon template. %NULL indicates the end of EMA templates. ++ */ ++struct sk_buff * ++ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_mutable_offsets *offs, ++ unsigned int link_id, u8 ema_index); ++ ++/** ++ * struct ieee80211_ema_beacons - List of EMA beacons ++ * @cnt: count of EMA beacons. ++ * ++ * @bcn: array of EMA beacons. ++ * @bcn.skb: the skb containing this specific beacon ++ * @bcn.offs: &struct ieee80211_mutable_offsets pointer to struct that will ++ * receive the offsets that may be updated by the driver. ++ */ ++struct ieee80211_ema_beacons { ++ u8 cnt; ++ struct { ++ struct sk_buff *skb; ++ struct ieee80211_mutable_offsets offs; ++ } bcn[]; ++}; ++ ++/** ++ * ieee80211_beacon_get_template_ema_list - EMA beacon template generation ++ * @hw: pointer obtained from ieee80211_alloc_hw(). ++ * @vif: &struct ieee80211_vif pointer from the add_interface callback. ++ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP) ++ * ++ * This function follows the same rules as ieee80211_beacon_get_template() ++ * but allocates and returns a pointer to list of all beacon templates required ++ * to cover all profiles in the multiple BSSID set. Each template includes only ++ * one multiple BSSID element. ++ * ++ * Driver must call ieee80211_beacon_free_ema_list() to free the memory. ++ * ++ * Return: EMA beacon templates of type struct ieee80211_ema_beacons *. ++ * %NULL on error. ++ */ ++struct ieee80211_ema_beacons * ++ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ unsigned int link_id); ++ ++/** ++ * ieee80211_beacon_free_ema_list - free an EMA beacon template list ++ * @ema_beacons: list of EMA beacons of type &struct ieee80211_ema_beacons pointers. ++ * ++ * This function will free a list previously acquired by calling ++ * ieee80211_beacon_get_template_ema_list() ++ */ ++void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons); ++ ++/** + * ieee80211_beacon_get_tim - beacon generation function + * @hw: pointer obtained from ieee80211_alloc_hw(). + * @vif: &struct ieee80211_vif pointer from the add_interface callback. +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1122,11 +1122,11 @@ static int ieee80211_assign_beacon(struc + if (params->mbssid_ies) { + mbssid = params->mbssid_ies; + size += struct_size(new->mbssid_ies, elem, mbssid->cnt); +- size += ieee80211_get_mbssid_beacon_len(mbssid); ++ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt); + } else if (old && old->mbssid_ies) { + mbssid = old->mbssid_ies; + size += struct_size(new->mbssid_ies, elem, mbssid->cnt); +- size += ieee80211_get_mbssid_beacon_len(mbssid); ++ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt); + } + + new = kzalloc(size, GFP_KERNEL); +@@ -3384,8 +3384,11 @@ cfg80211_beacon_dup(struct cfg80211_beac + + len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len + + beacon->proberesp_ies_len + beacon->assocresp_ies_len + +- beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len + +- ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); ++ beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len; ++ ++ if (beacon->mbssid_ies) ++ len += ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies, ++ beacon->mbssid_ies->cnt); + + new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL); + if (!new_beacon) +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1182,13 +1182,17 @@ ieee80211_vif_get_shift(struct ieee80211 + } + + static inline int +-ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems) ++ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems, u8 i) + { +- int i, len = 0; ++ int len = 0; + +- if (!elems) ++ if (!elems || !elems->cnt || i > elems->cnt) + return 0; + ++ if (i < elems->cnt) ++ return elems->elem[i].len; ++ ++ /* i == elems->cnt, calculate total length of all MBSSID elements */ + for (i = 0; i < elems->cnt; i++) + len += elems->elem[i].len; + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -5205,13 +5205,20 @@ ieee80211_beacon_get_finish(struct ieee8 + } + + static void +-ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon) ++ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon, ++ u8 i) + { +- int i; ++ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt || ++ i > beacon->mbssid_ies->cnt) ++ return; + +- if (!beacon->mbssid_ies) ++ if (i < beacon->mbssid_ies->cnt) { ++ skb_put_data(skb, beacon->mbssid_ies->elem[i].data, ++ beacon->mbssid_ies->elem[i].len); + return; ++ } + ++ /* i == beacon->mbssid_ies->cnt, include all MBSSID elements */ + for (i = 0; i < beacon->mbssid_ies->cnt; i++) + skb_put_data(skb, beacon->mbssid_ies->elem[i].data, + beacon->mbssid_ies->elem[i].len); +@@ -5224,7 +5231,8 @@ ieee80211_beacon_get_ap(struct ieee80211 + struct ieee80211_mutable_offsets *offs, + bool is_template, + struct beacon_data *beacon, +- struct ieee80211_chanctx_conf *chanctx_conf) ++ struct ieee80211_chanctx_conf *chanctx_conf, ++ u8 ema_index) + { + struct ieee80211_local *local = hw_to_local(hw); + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); +@@ -5243,7 +5251,9 @@ ieee80211_beacon_get_ap(struct ieee80211 + /* headroom, head length, + * tail length, maximum TIM length and multiple BSSID length + */ +- mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); ++ mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies, ++ ema_index); ++ + skb = dev_alloc_skb(local->tx_headroom + beacon->head_len + + beacon->tail_len + 256 + + local->hw.extra_beacon_tailroom + mbssid_len); +@@ -5261,7 +5271,7 @@ ieee80211_beacon_get_ap(struct ieee80211 + offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; + + if (mbssid_len) { +- ieee80211_beacon_add_mbssid(skb, beacon); ++ ieee80211_beacon_add_mbssid(skb, beacon, ema_index); + offs->mbssid_off = skb->len - mbssid_len; + } + +@@ -5280,12 +5290,51 @@ ieee80211_beacon_get_ap(struct ieee80211 + return skb; + } + ++static struct ieee80211_ema_beacons * ++ieee80211_beacon_get_ap_ema_list(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_link_data *link, ++ struct ieee80211_mutable_offsets *offs, ++ bool is_template, struct beacon_data *beacon, ++ struct ieee80211_chanctx_conf *chanctx_conf) ++{ ++ struct ieee80211_ema_beacons *ema = NULL; ++ ++ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt) ++ return NULL; ++ ++ ema = kzalloc(struct_size(ema, bcn, beacon->mbssid_ies->cnt), ++ GFP_ATOMIC); ++ if (!ema) ++ return NULL; ++ ++ for (ema->cnt = 0; ema->cnt < beacon->mbssid_ies->cnt; ema->cnt++) { ++ ema->bcn[ema->cnt].skb = ++ ieee80211_beacon_get_ap(hw, vif, link, ++ &ema->bcn[ema->cnt].offs, ++ is_template, beacon, ++ chanctx_conf, ema->cnt); ++ if (!ema->bcn[ema->cnt].skb) ++ break; ++ } ++ ++ if (ema->cnt == beacon->mbssid_ies->cnt) ++ return ema; ++ ++ ieee80211_beacon_free_ema_list(ema); ++ return NULL; ++} ++ ++#define IEEE80211_INCLUDE_ALL_MBSSID_ELEMS -1 ++ + static struct sk_buff * + __ieee80211_beacon_get(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_mutable_offsets *offs, + bool is_template, +- unsigned int link_id) ++ unsigned int link_id, ++ int ema_index, ++ struct ieee80211_ema_beacons **ema_beacons) + { + struct ieee80211_local *local = hw_to_local(hw); + struct beacon_data *beacon = NULL; +@@ -5314,8 +5363,29 @@ __ieee80211_beacon_get(struct ieee80211_ + if (!beacon) + goto out; + +- skb = ieee80211_beacon_get_ap(hw, vif, link, offs, is_template, +- beacon, chanctx_conf); ++ if (ema_beacons) { ++ *ema_beacons = ++ ieee80211_beacon_get_ap_ema_list(hw, vif, link, ++ offs, ++ is_template, ++ beacon, ++ chanctx_conf); ++ } else { ++ if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) { ++ if (ema_index >= beacon->mbssid_ies->cnt) ++ goto out; /* End of MBSSID elements */ ++ ++ if (ema_index <= IEEE80211_INCLUDE_ALL_MBSSID_ELEMS) ++ ema_index = beacon->mbssid_ies->cnt; ++ } else { ++ ema_index = 0; ++ } ++ ++ skb = ieee80211_beacon_get_ap(hw, vif, link, offs, ++ is_template, beacon, ++ chanctx_conf, ++ ema_index); ++ } + } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { + struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; + struct ieee80211_hdr *hdr; +@@ -5403,10 +5473,50 @@ ieee80211_beacon_get_template(struct iee + struct ieee80211_mutable_offsets *offs, + unsigned int link_id) + { +- return __ieee80211_beacon_get(hw, vif, offs, true, link_id); ++ return __ieee80211_beacon_get(hw, vif, offs, true, link_id, ++ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS, NULL); + } + EXPORT_SYMBOL(ieee80211_beacon_get_template); + ++struct sk_buff * ++ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_mutable_offsets *offs, ++ unsigned int link_id, u8 ema_index) ++{ ++ return __ieee80211_beacon_get(hw, vif, offs, true, link_id, ema_index, ++ NULL); ++} ++EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_index); ++ ++void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons) ++{ ++ u8 i; ++ ++ if (!ema_beacons) ++ return; ++ ++ for (i = 0; i < ema_beacons->cnt; i++) ++ kfree_skb(ema_beacons->bcn[i].skb); ++ ++ kfree(ema_beacons); ++} ++EXPORT_SYMBOL(ieee80211_beacon_free_ema_list); ++ ++struct ieee80211_ema_beacons * ++ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ unsigned int link_id) ++{ ++ struct ieee80211_ema_beacons *ema_beacons = NULL; ++ ++ WARN_ON(__ieee80211_beacon_get(hw, vif, NULL, false, link_id, 0, ++ &ema_beacons)); ++ ++ return ema_beacons; ++} ++EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_list); ++ + struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + u16 *tim_offset, u16 *tim_length, +@@ -5414,7 +5524,9 @@ struct sk_buff *ieee80211_beacon_get_tim + { + struct ieee80211_mutable_offsets offs = {}; + struct sk_buff *bcn = __ieee80211_beacon_get(hw, vif, &offs, false, +- link_id); ++ link_id, ++ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS, ++ NULL); + struct sk_buff *copy; + int shift; + diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index b1e84e2ef2876a..4a3984fb424510 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -77,7 +77,7 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) { struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4953,6 +4966,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4956,6 +4969,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -87,7 +87,7 @@ CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1538,6 +1538,7 @@ struct ieee80211_local { +@@ -1542,6 +1542,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ From 7baa1573ebb4dd1fd217137bc30948e0d0c803b7 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 2 Jun 2023 14:12:01 +0200 Subject: [PATCH 0134/1171] mac80211: ath11k: sync with ath-next Synchronize the ath11k backports with the current ath-next tree. This introduces support for MBSSID and EMA, adds factory test mode and some new HTT stats. Tested-by: Francisco G Luna Signed-off-by: Robert Marko (cherry picked from commit acde5271a68835f51185aae1b11343439a9d4cab) --- ...ound-false-positive-stringop-overrea.patch | 84 ++ ...k-driver-settings-for-MBSSID-and-EMA.patch | 133 +++ ...ID-configuration-during-vdev-create-.patch | 215 +++++ ...ame-MBSSID-fields-in-wmi_vdev_up_cmd.patch | 52 ++ ...ID-parameter-configuration-in-AP-mod.patch | 138 +++ ...efactor-vif-parameter-configurations.patch | 86 ++ ...76-wifi-ath11k-MBSSID-beacon-support.patch | 190 ++++ .../0077-wifi-ath11k-EMA-beacon-support.patch | 156 ++++ ...cate-the-func-ath11k_mac_bitrate_mas.patch | 75 ++ ...-HT-fixed-rate-in-WMI-peer-fixed-par.patch | 141 +++ ...support-default-regdb-while-searchin.patch | 127 +++ ...ve-unused-function-ath11k_tm_event_w.patch | 128 +++ ...ifi-ath11k-factory-test-mode-support.patch | 850 ++++++++++++++++++ ...w-ath11k-to-boot-without-caldata-in-.patch | 47 + ...11k-Add-HTT-stats-for-PHY-reset-case.patch | 261 ++++++ ...ble-coldboot-calibration-for-IPQ8074.patch | 2 +- ...upport-setting-FW-memory-mode-via-DT.patch | 10 +- ...tersection-support-for-regulatory-ru.patch | 4 +- 18 files changed, 2691 insertions(+), 8 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch diff --git a/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch b/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch new file mode 100644 index 00000000000000..aa4df16a90fe6b --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch @@ -0,0 +1,84 @@ +From 695df2f417d25202bdac9cde3c82d2acb6492b4d Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 5 May 2023 16:11:25 +0300 +Subject: [PATCH] wifi: ath: work around false-positive stringop-overread + warning + +In a rare arm64 randconfig build, I got multiple warnings for ath11k +and ath12k: + +In function 'ath11k_peer_assoc_h_ht', + inlined from 'ath11k_peer_assoc_prepare' at drivers/net/wireless/ath/ath11k/mac.c:2665:2: +drivers/net/wireless/ath/ath11k/mac.c:1709:13: error: 'ath11k_peer_assoc_h_ht_masked' reading 10 bytes from a region of size 0 [-Werror=stringop-overread] + 1709 | if (ath11k_peer_assoc_h_ht_masked(ht_mcs_mask)) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This happens whenever gcc-13 fails to inline one of the functions +that take a fixed-length array argument but gets passed a pointer. + +Change these functions to all take a regular pointer argument +instead. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230417205447.1800912-1-arnd@kernel.org +--- + drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -433,7 +433,7 @@ u8 ath11k_mac_bitrate_to_idx(const struc + } + + static u32 +-ath11k_mac_max_ht_nss(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) ++ath11k_mac_max_ht_nss(const u8 *ht_mcs_mask) + { + int nss; + +@@ -445,7 +445,7 @@ ath11k_mac_max_ht_nss(const u8 ht_mcs_ma + } + + static u32 +-ath11k_mac_max_vht_nss(const u16 vht_mcs_mask[NL80211_VHT_NSS_MAX]) ++ath11k_mac_max_vht_nss(const u16 *vht_mcs_mask) + { + int nss; + +@@ -457,7 +457,7 @@ ath11k_mac_max_vht_nss(const u16 vht_mcs + } + + static u32 +-ath11k_mac_max_he_nss(const u16 he_mcs_mask[NL80211_HE_NSS_MAX]) ++ath11k_mac_max_he_nss(const u16 *he_mcs_mask) + { + int nss; + +@@ -1658,7 +1658,7 @@ static void ath11k_peer_assoc_h_rates(st + } + + static bool +-ath11k_peer_assoc_h_ht_masked(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) ++ath11k_peer_assoc_h_ht_masked(const u8 *ht_mcs_mask) + { + int nss; + +@@ -1670,7 +1670,7 @@ ath11k_peer_assoc_h_ht_masked(const u8 h + } + + static bool +-ath11k_peer_assoc_h_vht_masked(const u16 vht_mcs_mask[]) ++ath11k_peer_assoc_h_vht_masked(const u16 *vht_mcs_mask) + { + int nss; + +@@ -2065,7 +2065,7 @@ static u16 ath11k_peer_assoc_h_he_limit( + } + + static bool +-ath11k_peer_assoc_h_he_masked(const u16 he_mcs_mask[NL80211_HE_NSS_MAX]) ++ath11k_peer_assoc_h_he_masked(const u16 *he_mcs_mask) + { + int nss; + diff --git a/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch b/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch new file mode 100644 index 00000000000000..bede4819ca4072 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch @@ -0,0 +1,133 @@ +From a08dbb04d7365a04d52882143cf196005bfc88c3 Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Fri, 5 May 2023 16:11:27 +0300 +Subject: [PATCH 71/77] wifi: ath11k: driver settings for MBSSID and EMA + +Advertise the driver support for multiple BSSID (MBSSID) and +enhanced multi-BSSID advertisements (EMA) by setting extended +capabilities. + +Configure mbssid_max_interfaces and ema_max_profile_periodicity +fields in structure wiphy which are used to advertise maximum number +of interfaces and profile periodicity supported by the driver. + +Add new WMI fields to configure maximum vdev count supported for +MBSSID and profile periodicity in case of EMA. +Setting WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET flag +indicates that the firmware should track and update the DTIM counts +for each non-transmitted profile. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Co-developed-by: John Crispin +Signed-off-by: John Crispin +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230405221648.17950-2-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/hw.c | 3 +++ + drivers/net/wireless/ath/ath11k/hw.h | 1 + + drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++ + drivers/net/wireless/ath/ath11k/wmi.c | 3 +++ + drivers/net/wireless/ath/ath11k/wmi.h | 6 ++++++ + 5 files changed, 20 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/hw.c ++++ b/drivers/net/wireless/ath/ath11k/hw.c +@@ -202,6 +202,9 @@ static void ath11k_init_wmi_config_ipq80 + config->twt_ap_sta_count = 1000; + config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64; + config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI; ++ config->ema_max_vap_cnt = ab->num_radios; ++ config->ema_max_profile_period = TARGET_EMA_MAX_PROFILE_PERIOD; ++ config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt; + } + + static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw, +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -64,6 +64,7 @@ + #define TARGET_NUM_WDS_ENTRIES 32 + #define TARGET_DMA_BURST_SIZE 1 + #define TARGET_RX_BATCHMODE 1 ++#define TARGET_EMA_MAX_PROFILE_PERIOD 8 + + #define ATH11K_HW_MAX_QUEUES 4 + #define ATH11K_QUEUE_LEN 4096 +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -9001,19 +9001,23 @@ static int ath11k_mac_setup_iface_combin + + static const u8 ath11k_if_types_ext_capa[] = { + [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, ++ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, + [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, + }; + + static const u8 ath11k_if_types_ext_capa_sta[] = { + [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, ++ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, + [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, + [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT, + }; + + static const u8 ath11k_if_types_ext_capa_ap[] = { + [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, ++ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, + [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, + [9] = WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT, ++ [10] = WLAN_EXT_CAPA11_EMA_SUPPORT, + }; + + static const struct wiphy_iftype_ext_capab ath11k_iftypes_ext_capa[] = { +@@ -9251,6 +9255,9 @@ static int __ath11k_mac_register(struct + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); + ++ ar->hw->wiphy->mbssid_max_interfaces = TARGET_NUM_VDEVS(ab); ++ ar->hw->wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD; ++ + ath11k_reg_init(ar); + + if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -3987,6 +3987,9 @@ ath11k_wmi_copy_resource_config(struct w + ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); + wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported << + WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); ++ wmi_cfg->flags2 = WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET; ++ wmi_cfg->ema_max_vap_cnt = tg_cfg->ema_max_vap_cnt; ++ wmi_cfg->ema_max_profile_period = tg_cfg->ema_max_profile_period; + } + + static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi, +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -2317,6 +2317,7 @@ struct wmi_init_cmd { + } __packed; + + #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) ++#define WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET BIT(9) + #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18) + + #define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4 +@@ -2389,6 +2390,9 @@ struct wmi_resource_config { + u32 msdu_flow_override_config1; + u32 flags2; + u32 host_service_flags; ++ u32 max_rnr_neighbours; ++ u32 ema_max_vap_cnt; ++ u32 ema_max_profile_period; + } __packed; + + struct wmi_service_ready_event { +@@ -5646,6 +5650,8 @@ struct target_resource_config { + u32 twt_ap_pdev_count; + u32 twt_ap_sta_count; + u8 is_reg_cc_ext_event_supported; ++ u32 ema_max_vap_cnt; ++ u32 ema_max_profile_period; + }; + + enum wmi_debug_log_param { diff --git a/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch b/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch new file mode 100644 index 00000000000000..4ba0717319cad8 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch @@ -0,0 +1,215 @@ +From 5a81610acf66c4ad6e1a1fbd09f3f555fca863b1 Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Fri, 5 May 2023 16:11:27 +0300 +Subject: [PATCH 72/77] wifi: ath11k: MBSSID configuration during vdev + create/start + +Configure multiple BSSID flags and index of the transmitting interface +in vdev create/start commands depending on the service bit +WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Co-developed-by: John Crispin +Signed-off-by: John Crispin +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230405221648.17950-3-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++++++++++++++++-- + drivers/net/wireless/ath/ath11k/wmi.c | 5 ++ + drivers/net/wireless/ath/ath11k/wmi.h | 19 ++++++++ + 3 files changed, 90 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -6181,17 +6181,62 @@ static void ath11k_mac_op_stop(struct ie + atomic_set(&ar->num_pending_mgmt_tx, 0); + } + +-static void +-ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif, +- struct vdev_create_params *params) ++static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif, ++ u32 *flags, u32 *tx_vdev_id) ++{ ++ struct ath11k *ar = arvif->ar; ++ struct ath11k_vif *tx_arvif; ++ struct ieee80211_vif *tx_vif; ++ ++ *tx_vdev_id = 0; ++ tx_vif = arvif->vif->mbssid_tx_vif; ++ if (!tx_vif) { ++ *flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP; ++ return 0; ++ } ++ ++ tx_arvif = (void *)tx_vif->drv_priv; ++ ++ if (arvif->vif->bss_conf.nontransmitted) { ++ if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy) ++ return -EINVAL; ++ ++ *flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP; ++ *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id; ++ } else if (tx_arvif == arvif) { ++ *flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP; ++ } else { ++ return -EINVAL; ++ } ++ ++ if (arvif->vif->bss_conf.ema_ap) ++ *flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE; ++ ++ return 0; ++} ++ ++static int ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif, ++ struct vdev_create_params *params) + { + struct ath11k *ar = arvif->ar; + struct ath11k_pdev *pdev = ar->pdev; ++ int ret; + + params->if_id = arvif->vdev_id; + params->type = arvif->vdev_type; + params->subtype = arvif->vdev_subtype; + params->pdev_id = pdev->pdev_id; ++ params->mbssid_flags = 0; ++ params->mbssid_tx_vdev_id = 0; ++ ++ if (!test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT, ++ ar->ab->wmi_ab.svc_map)) { ++ ret = ath11k_mac_setup_vdev_params_mbssid(arvif, ++ ¶ms->mbssid_flags, ++ ¶ms->mbssid_tx_vdev_id); ++ if (ret) ++ return ret; ++ } + + if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { + params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; +@@ -6206,6 +6251,7 @@ ath11k_mac_setup_vdev_create_params(stru + params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; + params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; + } ++ return 0; + } + + static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw, +@@ -6500,7 +6546,12 @@ static int ath11k_mac_op_add_interface(s + for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) + vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1); + +- ath11k_mac_setup_vdev_create_params(arvif, &vdev_param); ++ ret = ath11k_mac_setup_vdev_create_params(arvif, &vdev_param); ++ if (ret) { ++ ath11k_warn(ab, "failed to create vdev parameters %d: %d\n", ++ arvif->vdev_id, ret); ++ goto err; ++ } + + ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param); + if (ret) { +@@ -6905,6 +6956,17 @@ ath11k_mac_vdev_start_restart(struct ath + arg.pref_tx_streams = ar->num_tx_chains; + arg.pref_rx_streams = ar->num_rx_chains; + ++ arg.mbssid_flags = 0; ++ arg.mbssid_tx_vdev_id = 0; ++ if (test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT, ++ ar->ab->wmi_ab.svc_map)) { ++ ret = ath11k_mac_setup_vdev_params_mbssid(arvif, ++ &arg.mbssid_flags, ++ &arg.mbssid_tx_vdev_id); ++ if (ret) ++ return ret; ++ } ++ + if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { + arg.ssid = arvif->u.ap.ssid; + arg.ssid_len = arvif->u.ap.ssid_len; +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -724,6 +724,9 @@ int ath11k_wmi_vdev_create(struct ath11k + cmd->vdev_subtype = param->subtype; + cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX; + cmd->pdev_id = param->pdev_id; ++ cmd->mbssid_flags = param->mbssid_flags; ++ cmd->mbssid_tx_vdev_id = param->mbssid_tx_vdev_id; ++ + ether_addr_copy(cmd->vdev_macaddr.addr, macaddr); + + ptr = skb->data + sizeof(*cmd); +@@ -941,6 +944,8 @@ int ath11k_wmi_vdev_start(struct ath11k + cmd->cac_duration_ms = arg->cac_duration_ms; + cmd->regdomain = arg->regdomain; + cmd->he_ops = arg->he_ops; ++ cmd->mbssid_flags = arg->mbssid_flags; ++ cmd->mbssid_tx_vdev_id = arg->mbssid_tx_vdev_id; + + if (!restart) { + if (arg->ssid) { +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -137,6 +137,14 @@ enum { + WMI_AUTORATE_3200NS_GI = BIT(11), + }; + ++enum { ++ WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP = 0x00000001, ++ WMI_HOST_VDEV_FLAGS_TRANSMIT_AP = 0x00000002, ++ WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP = 0x00000004, ++ WMI_HOST_VDEV_FLAGS_EMA_MODE = 0x00000008, ++ WMI_HOST_VDEV_FLAGS_SCAN_MODE_VAP = 0x00000010, ++}; ++ + /* + * wmi command groups. + */ +@@ -2096,6 +2104,7 @@ enum wmi_tlv_service { + WMI_TLV_SERVICE_EXT2_MSG = 220, + WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246, + WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249, ++ WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253, + WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263, + + /* The second 128 bits */ +@@ -2583,6 +2592,8 @@ struct vdev_create_params { + u8 rx; + } chains[NUM_NL80211_BANDS]; + u32 pdev_id; ++ u32 mbssid_flags; ++ u32 mbssid_tx_vdev_id; + }; + + struct wmi_vdev_create_cmd { +@@ -2593,6 +2604,8 @@ struct wmi_vdev_create_cmd { + struct wmi_mac_addr vdev_macaddr; + u32 num_cfg_txrx_streams; + u32 pdev_id; ++ u32 mbssid_flags; ++ u32 mbssid_tx_vdev_id; + } __packed; + + struct wmi_vdev_txrx_streams { +@@ -2656,6 +2669,9 @@ struct wmi_vdev_start_request_cmd { + u32 he_ops; + u32 cac_duration_ms; + u32 regdomain; ++ u32 min_data_rate; ++ u32 mbssid_flags; ++ u32 mbssid_tx_vdev_id; + } __packed; + + #define MGMT_TX_DL_FRM_LEN 64 +@@ -2825,6 +2841,9 @@ struct wmi_vdev_start_req_arg { + u32 pref_rx_streams; + u32 pref_tx_streams; + u32 num_noa_descriptors; ++ u32 min_data_rate; ++ u32 mbssid_flags; ++ u32 mbssid_tx_vdev_id; + }; + + struct peer_create_params { diff --git a/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch b/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch new file mode 100644 index 00000000000000..023a1dbb9fc03e --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch @@ -0,0 +1,52 @@ +From cf604e72bc6e6db68c7fcaa8779b03ec14b8d2fa Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Fri, 5 May 2023 16:11:27 +0300 +Subject: [PATCH 73/77] wifi: ath11k: rename MBSSID fields in wmi_vdev_up_cmd + +Rename trans_bssid to tx_vdev_bssid to make it similar to vdev_bssid. + +Rename profile_num to nontx_profile_cnt, and profile_idx to +nontx_profile_idx which makes it clear that these store configurations +related to MBSSID non-transmitting profiles. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230405221648.17950-4-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/wmi.c | 6 +++--- + drivers/net/wireless/ath/ath11k/wmi.h | 6 +++--- + 2 files changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -1029,10 +1029,10 @@ int ath11k_wmi_vdev_up(struct ath11k *ar + bss_conf = &arvif->vif->bss_conf; + + if (bss_conf->nontransmitted) { +- ether_addr_copy(cmd->trans_bssid.addr, ++ ether_addr_copy(cmd->tx_vdev_bssid.addr, + bss_conf->transmitter_bssid); +- cmd->profile_idx = bss_conf->bssid_index; +- cmd->profile_num = bss_conf->bssid_indicator; ++ cmd->nontx_profile_idx = bss_conf->bssid_index; ++ cmd->nontx_profile_cnt = bss_conf->bssid_indicator; + } + } + +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -2625,9 +2625,9 @@ struct wmi_vdev_up_cmd { + u32 vdev_id; + u32 vdev_assoc_id; + struct wmi_mac_addr vdev_bssid; +- struct wmi_mac_addr trans_bssid; +- u32 profile_idx; +- u32 profile_num; ++ struct wmi_mac_addr tx_vdev_bssid; ++ u32 nontx_profile_idx; ++ u32 nontx_profile_cnt; + } __packed; + + struct wmi_vdev_stop_cmd { diff --git a/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch b/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch new file mode 100644 index 00000000000000..d93e27dd42bb95 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch @@ -0,0 +1,138 @@ +From c82dc33f252fd8883be66f2d0230af0fd734c683 Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Fri, 5 May 2023 16:11:27 +0300 +Subject: [PATCH 74/77] wifi: ath11k: MBSSID parameter configuration in AP mode + +Include MBSSID parameters in WMI vdev up operation. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Co-developed-by: John Crispin +Signed-off-by: John Crispin +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230405221648.17950-5-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 29 +++++++++++++++++++++------ + drivers/net/wireless/ath/ath11k/wmi.c | 8 +++++++- + drivers/net/wireless/ath/ath11k/wmi.h | 3 ++- + 3 files changed, 32 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -964,7 +964,7 @@ static int ath11k_mac_monitor_vdev_start + return ret; + } + +- ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); ++ ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr, NULL, 0, 0); + if (ret) { + ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", + vdev_id, ret); +@@ -1423,6 +1423,7 @@ static void ath11k_control_beaconing(str + struct ieee80211_bss_conf *info) + { + struct ath11k *ar = arvif->ar; ++ struct ath11k_vif *tx_arvif = NULL; + int ret = 0; + + lockdep_assert_held(&arvif->ar->conf_mutex); +@@ -1451,8 +1452,14 @@ static void ath11k_control_beaconing(str + + ether_addr_copy(arvif->bssid, info->bssid); + ++ if (arvif->vif->mbssid_tx_vif) ++ tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv; ++ + ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, +- arvif->bssid); ++ arvif->bssid, ++ tx_arvif ? tx_arvif->bssid : NULL, ++ info->bssid_index, ++ 1 << info->bssid_indicator); + if (ret) { + ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n", + arvif->vdev_id, ret); +@@ -2879,7 +2886,8 @@ static void ath11k_bss_assoc(struct ieee + arvif->aid = vif->cfg.aid; + ether_addr_copy(arvif->bssid, bss_conf->bssid); + +- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); ++ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid, ++ NULL, 0, 0); + if (ret) { + ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n", + arvif->vdev_id, ret); +@@ -7133,7 +7141,8 @@ ath11k_mac_update_vif_chan(struct ath11k + int n_vifs) + { + struct ath11k_base *ab = ar->ab; +- struct ath11k_vif *arvif; ++ struct ath11k_vif *arvif, *tx_arvif = NULL; ++ struct ieee80211_vif *mbssid_tx_vif; + int ret; + int i; + bool monitor_vif = false; +@@ -7187,8 +7196,15 @@ ath11k_mac_update_vif_chan(struct ath11k + ath11k_warn(ab, "failed to update bcn tmpl during csa: %d\n", + ret); + ++ mbssid_tx_vif = arvif->vif->mbssid_tx_vif; ++ if (mbssid_tx_vif) ++ tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv; ++ + ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, +- arvif->bssid); ++ arvif->bssid, ++ tx_arvif ? tx_arvif->bssid : NULL, ++ arvif->vif->bss_conf.bssid_index, ++ 1 << arvif->vif->bss_conf.bssid_indicator); + if (ret) { + ath11k_warn(ab, "failed to bring vdev up %d: %d\n", + arvif->vdev_id, ret); +@@ -7306,7 +7322,8 @@ static int ath11k_start_vdev_delay(struc + } + + if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { +- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr); ++ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr, ++ NULL, 0, 0); + if (ret) { + ath11k_warn(ab, "failed put monitor up: %d\n", ret); + return ret; +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -1001,7 +1001,8 @@ int ath11k_wmi_vdev_start(struct ath11k + return ret; + } + +-int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid) ++int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid, ++ u8 *tx_bssid, u32 nontx_profile_idx, u32 nontx_profile_cnt) + { + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct wmi_vdev_up_cmd *cmd; +@@ -1025,6 +1026,11 @@ int ath11k_wmi_vdev_up(struct ath11k *ar + + ether_addr_copy(cmd->vdev_bssid.addr, bssid); + ++ cmd->nontx_profile_idx = nontx_profile_idx; ++ cmd->nontx_profile_cnt = nontx_profile_cnt; ++ if (tx_bssid) ++ ether_addr_copy(cmd->tx_vdev_bssid.addr, tx_bssid); ++ + if (arvif && arvif->vif->type == NL80211_IFTYPE_STATION) { + bss_conf = &arvif->vif->bss_conf; + +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -6301,7 +6301,8 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a + struct sk_buff *bcn); + int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id); + int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, +- const u8 *bssid); ++ const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx, ++ u32 nontx_profile_cnt); + int ath11k_wmi_vdev_stop(struct ath11k *ar, u8 vdev_id); + int ath11k_wmi_vdev_start(struct ath11k *ar, struct wmi_vdev_start_req_arg *arg, + bool restart); diff --git a/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch b/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch new file mode 100644 index 00000000000000..8509e55978d75d --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch @@ -0,0 +1,86 @@ +From cb9bea773c85e372931cd7a177db4165adf29d95 Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Fri, 5 May 2023 16:11:28 +0300 +Subject: [PATCH 75/77] wifi: ath11k: refactor vif parameter configurations + +Security parameters for each non-transmitting profile can be +different when MBSSID is enabled and this information is included +in the MBSSID element in the Beacon frame. Current implementation +to set rsnie_present and wpaie_present does not parse this element +hence it applies only to the transmitting interface. + +Move the code to a separate function to make additions for +non-transmitting interfaces cleaner. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230405221648.17950-6-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 41 ++++++++++++++++----------- + 1 file changed, 24 insertions(+), 17 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -1351,28 +1351,14 @@ err_mon_del: + return ret; + } + +-static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) ++static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif, ++ struct sk_buff *bcn) + { +- struct ath11k *ar = arvif->ar; +- struct ath11k_base *ab = ar->ab; +- struct ieee80211_hw *hw = ar->hw; +- struct ieee80211_vif *vif = arvif->vif; +- struct ieee80211_mutable_offsets offs = {}; +- struct sk_buff *bcn; + struct ieee80211_mgmt *mgmt; + u8 *ies; +- int ret; +- +- if (arvif->vdev_type != WMI_VDEV_TYPE_AP) +- return 0; +- +- bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); +- if (!bcn) { +- ath11k_warn(ab, "failed to get beacon template from mac80211\n"); +- return -EPERM; +- } + + ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); ++ mgmt = (struct ieee80211_mgmt *)bcn->data; + ies += sizeof(mgmt->u.beacon); + + if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) +@@ -1386,7 +1372,28 @@ static int ath11k_mac_setup_bcn_tmpl(str + arvif->wpaie_present = true; + else + arvif->wpaie_present = false; ++} ++ ++static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) ++{ ++ struct ath11k *ar = arvif->ar; ++ struct ath11k_base *ab = ar->ab; ++ struct ieee80211_hw *hw = ar->hw; ++ struct ieee80211_vif *vif = arvif->vif; ++ struct ieee80211_mutable_offsets offs = {}; ++ struct sk_buff *bcn; ++ int ret; ++ ++ if (arvif->vdev_type != WMI_VDEV_TYPE_AP) ++ return 0; ++ ++ bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); ++ if (!bcn) { ++ ath11k_warn(ab, "failed to get beacon template from mac80211\n"); ++ return -EPERM; ++ } + ++ ath11k_mac_set_vif_params(arvif, bcn); + ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); + + kfree_skb(bcn); diff --git a/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch b/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch new file mode 100644 index 00000000000000..d23ea8deeadc57 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch @@ -0,0 +1,190 @@ +From 335a92765d308dfe22826f5562cd4b4389b45e71 Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Fri, 5 May 2023 16:11:28 +0300 +Subject: [PATCH 76/77] wifi: ath11k: MBSSID beacon support + +- Split ath11k_mac_setup_bcn_tmpl() to move the beacon retrieval and + WMI command to a new function, ath11k_mac_setup_bcn_tmpl_legacy(). + In the original function add checks to use the transmitting interface + when MBSSID is enabled. +- Set rsnie_present and wpaie_present fields for the non-transmitting + interfaces when MBSSID is enabled. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Co-developed-by: John Crispin +Signed-off-by: John Crispin +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230405221648.17950-7-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 116 ++++++++++++++++++++++++-- + drivers/net/wireless/ath/ath11k/wmi.c | 1 + + 2 files changed, 112 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -1351,6 +1351,84 @@ err_mon_del: + return ret; + } + ++static void ath11k_mac_setup_nontx_vif_rsnie(struct ath11k_vif *arvif, ++ bool tx_arvif_rsnie_present, ++ const u8 *profile, u8 profile_len) ++{ ++ if (cfg80211_find_ie(WLAN_EID_RSN, profile, profile_len)) { ++ arvif->rsnie_present = true; ++ } else if (tx_arvif_rsnie_present) { ++ int i; ++ u8 nie_len; ++ const u8 *nie = cfg80211_find_ext_ie(WLAN_EID_EXT_NON_INHERITANCE, ++ profile, profile_len); ++ if (!nie) ++ return; ++ ++ nie_len = nie[1]; ++ nie += 2; ++ for (i = 0; i < nie_len; i++) { ++ if (nie[i] == WLAN_EID_RSN) { ++ arvif->rsnie_present = false; ++ break; ++ } ++ } ++ } ++} ++ ++static bool ath11k_mac_set_nontx_vif_params(struct ath11k_vif *tx_arvif, ++ struct ath11k_vif *arvif, ++ struct sk_buff *bcn) ++{ ++ struct ieee80211_mgmt *mgmt; ++ const u8 *ies, *profile, *next_profile; ++ int ies_len; ++ ++ ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); ++ mgmt = (struct ieee80211_mgmt *)bcn->data; ++ ies += sizeof(mgmt->u.beacon); ++ ies_len = skb_tail_pointer(bcn) - ies; ++ ++ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ies, ies_len); ++ arvif->rsnie_present = tx_arvif->rsnie_present; ++ ++ while (ies) { ++ u8 mbssid_len; ++ ++ ies_len -= (2 + ies[1]); ++ mbssid_len = ies[1] - 1; ++ profile = &ies[3]; ++ ++ while (mbssid_len) { ++ u8 profile_len; ++ ++ profile_len = profile[1]; ++ next_profile = profile + (2 + profile_len); ++ mbssid_len -= (2 + profile_len); ++ ++ profile += 2; ++ profile_len -= (2 + profile[1]); ++ profile += (2 + profile[1]); /* nontx capabilities */ ++ profile_len -= (2 + profile[1]); ++ profile += (2 + profile[1]); /* SSID */ ++ if (profile[2] == arvif->vif->bss_conf.bssid_index) { ++ profile_len -= 5; ++ profile = profile + 5; ++ ath11k_mac_setup_nontx_vif_rsnie(arvif, ++ tx_arvif->rsnie_present, ++ profile, ++ profile_len); ++ return true; ++ } ++ profile = next_profile; ++ } ++ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, profile, ++ ies_len); ++ } ++ ++ return false; ++} ++ + static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif, + struct sk_buff *bcn) + { +@@ -1374,18 +1452,26 @@ static void ath11k_mac_set_vif_params(st + arvif->wpaie_present = false; + } + +-static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) ++static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif) + { + struct ath11k *ar = arvif->ar; + struct ath11k_base *ab = ar->ab; ++ struct ath11k_vif *tx_arvif = arvif; + struct ieee80211_hw *hw = ar->hw; + struct ieee80211_vif *vif = arvif->vif; + struct ieee80211_mutable_offsets offs = {}; + struct sk_buff *bcn; + int ret; + +- if (arvif->vdev_type != WMI_VDEV_TYPE_AP) +- return 0; ++ if (arvif->vif->mbssid_tx_vif) { ++ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; ++ if (tx_arvif != arvif) { ++ ar = tx_arvif->ar; ++ ab = ar->ab; ++ hw = ar->hw; ++ vif = tx_arvif->vif; ++ } ++ } + + bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); + if (!bcn) { +@@ -1393,9 +1479,12 @@ static int ath11k_mac_setup_bcn_tmpl(str + return -EPERM; + } + +- ath11k_mac_set_vif_params(arvif, bcn); +- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); ++ if (tx_arvif == arvif) ++ ath11k_mac_set_vif_params(tx_arvif, bcn); ++ else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn)) ++ return -EINVAL; + ++ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); + kfree_skb(bcn); + + if (ret) +@@ -1405,6 +1494,23 @@ static int ath11k_mac_setup_bcn_tmpl(str + return ret; + } + ++static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) ++{ ++ struct ieee80211_vif *vif = arvif->vif; ++ ++ if (arvif->vdev_type != WMI_VDEV_TYPE_AP) ++ return 0; ++ ++ /* Target does not expect beacon templates for the already up ++ * non-transmitting interfaces, and results in a crash if sent. ++ */ ++ if (vif->mbssid_tx_vif && ++ arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) ++ return 0; ++ ++ return ath11k_mac_setup_bcn_tmpl_mbssid(arvif); ++} ++ + void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif) + { + struct ieee80211_vif *vif = arvif->vif; +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -1737,6 +1737,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a + } + + cmd->buf_len = bcn->len; ++ cmd->mbssid_ie_offset = offs->mbssid_off; + + ptr = skb->data + sizeof(*cmd); + diff --git a/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch b/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch new file mode 100644 index 00000000000000..51353fa3e480f1 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch @@ -0,0 +1,156 @@ +From 87bd401138161008fdb82fbca6e213af117bfeb9 Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Fri, 5 May 2023 16:11:28 +0300 +Subject: [PATCH 77/77] wifi: ath11k: EMA beacon support + +Add new function ath11k_mac_setup_bcn_tmpl_ema() which invokes the new +API provided by MAC80211 to retrieve EMA beacons. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Co-developed-by: John Crispin +Signed-off-by: John Crispin +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230405221648.17950-8-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 59 ++++++++++++++++++++++++++- + drivers/net/wireless/ath/ath11k/wmi.c | 3 +- + drivers/net/wireless/ath/ath11k/wmi.h | 11 ++++- + 3 files changed, 70 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -1452,6 +1452,60 @@ static void ath11k_mac_set_vif_params(st + arvif->wpaie_present = false; + } + ++static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif) ++{ ++ struct ath11k_vif *tx_arvif; ++ struct ieee80211_ema_beacons *beacons; ++ int ret = 0; ++ bool nontx_vif_params_set = false; ++ u32 params = 0; ++ u8 i = 0; ++ ++ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; ++ ++ beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw, ++ tx_arvif->vif, 0); ++ if (!beacons || !beacons->cnt) { ++ ath11k_warn(arvif->ar->ab, ++ "failed to get ema beacon templates from mac80211\n"); ++ return -EPERM; ++ } ++ ++ if (tx_arvif == arvif) ++ ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb); ++ else ++ arvif->wpaie_present = tx_arvif->wpaie_present; ++ ++ for (i = 0; i < beacons->cnt; i++) { ++ if (tx_arvif != arvif && !nontx_vif_params_set) ++ nontx_vif_params_set = ++ ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, ++ beacons->bcn[i].skb); ++ ++ params = beacons->cnt; ++ params |= (i << WMI_EMA_TMPL_IDX_SHIFT); ++ params |= ((!i ? 1 : 0) << WMI_EMA_FIRST_TMPL_SHIFT); ++ params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT); ++ ++ ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id, ++ &beacons->bcn[i].offs, ++ beacons->bcn[i].skb, params); ++ if (ret) { ++ ath11k_warn(tx_arvif->ar->ab, ++ "failed to set ema beacon template id %i error %d\n", ++ i, ret); ++ break; ++ } ++ } ++ ++ ieee80211_beacon_free_ema_list(beacons); ++ ++ if (tx_arvif != arvif && !nontx_vif_params_set) ++ return -EINVAL; /* Profile not found in the beacons */ ++ ++ return ret; ++} ++ + static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif) + { + struct ath11k *ar = arvif->ar; +@@ -1484,7 +1538,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbs + else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn)) + return -EINVAL; + +- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); ++ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0); + kfree_skb(bcn); + + if (ret) +@@ -1508,6 +1562,9 @@ static int ath11k_mac_setup_bcn_tmpl(str + arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) + return 0; + ++ if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif) ++ return ath11k_mac_setup_bcn_tmpl_ema(arvif); ++ + return ath11k_mac_setup_bcn_tmpl_mbssid(arvif); + } + +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -1699,7 +1699,7 @@ int ath11k_wmi_send_bcn_offload_control_ + + int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, + struct ieee80211_mutable_offsets *offs, +- struct sk_buff *bcn) ++ struct sk_buff *bcn, u32 ema_params) + { + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct wmi_bcn_tmpl_cmd *cmd; +@@ -1738,6 +1738,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a + + cmd->buf_len = bcn->len; + cmd->mbssid_ie_offset = offs->mbssid_off; ++ cmd->ema_params = ema_params; + + ptr = skb->data + sizeof(*cmd); + +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -3566,6 +3566,10 @@ struct wmi_get_pdev_temperature_cmd { + + #define WMI_BEACON_TX_BUFFER_SIZE 512 + ++#define WMI_EMA_TMPL_IDX_SHIFT 8 ++#define WMI_EMA_FIRST_TMPL_SHIFT 16 ++#define WMI_EMA_LAST_TMPL_SHIFT 24 ++ + struct wmi_bcn_tmpl_cmd { + u32 tlv_header; + u32 vdev_id; +@@ -3576,6 +3580,11 @@ struct wmi_bcn_tmpl_cmd { + u32 csa_event_bitmap; + u32 mbssid_ie_offset; + u32 esp_ie_offset; ++ u32 csc_switch_count_offset; ++ u32 csc_event_bitmap; ++ u32 mu_edca_ie_offset; ++ u32 feature_enable_bitmap; ++ u32 ema_params; + } __packed; + + struct wmi_key_seq_counter { +@@ -6298,7 +6307,7 @@ int ath11k_wmi_mgmt_send(struct ath11k * + struct sk_buff *frame); + int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, + struct ieee80211_mutable_offsets *offs, +- struct sk_buff *bcn); ++ struct sk_buff *bcn, u32 ema_param); + int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id); + int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, + const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx, diff --git a/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch b/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch new file mode 100644 index 00000000000000..610bf725149221 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch @@ -0,0 +1,75 @@ +From 570eec3d40505c30babbe3b8f85a38496c975ab2 Mon Sep 17 00:00:00 2001 +From: Maharaja Kennadyrajan +Date: Tue, 9 May 2023 20:07:23 +0300 +Subject: [PATCH] wifi: ath11k: Relocate the func + ath11k_mac_bitrate_mask_num_ht_rates() and change hweight16 to hweight8 + +Relocate the function ath11k_mac_bitrate_mask_num_ht_rates() definition +to call this function from other functions which helps to avoid the +compilation error (function not defined). + +ht_mcs[] is 1 byte array and it is enough to use hweight8() instead +of hweight16(). Hence, fixed the same. + +Tested on: Compile tested only. + +Signed-off-by: Maharaja Kennadyrajan +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230504092033.3542456-2-quic_mkenna@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 30 +++++++++++++-------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -4338,6 +4338,20 @@ exit: + } + + static int ++ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar, ++ enum nl80211_band band, ++ const struct cfg80211_bitrate_mask *mask) ++{ ++ int num_rates = 0; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) ++ num_rates += hweight8(mask->control[band].ht_mcs[i]); ++ ++ return num_rates; ++} ++ ++static int + ath11k_mac_bitrate_mask_num_vht_rates(struct ath11k *ar, + enum nl80211_band band, + const struct cfg80211_bitrate_mask *mask) +@@ -7791,20 +7805,6 @@ static void ath11k_mac_op_flush(struct i + ath11k_mac_flush_tx_complete(ar); + } + +-static int +-ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar, +- enum nl80211_band band, +- const struct cfg80211_bitrate_mask *mask) +-{ +- int num_rates = 0; +- int i; +- +- for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) +- num_rates += hweight16(mask->control[band].ht_mcs[i]); +- +- return num_rates; +-} +- + static bool + ath11k_mac_has_single_legacy_rate(struct ath11k *ar, + enum nl80211_band band, diff --git a/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch b/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch new file mode 100644 index 00000000000000..6282f4462e6b45 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch @@ -0,0 +1,141 @@ +From df8e3729ffc0aa645839693f74ee7b6d999cdf64 Mon Sep 17 00:00:00 2001 +From: Maharaja Kennadyrajan +Date: Tue, 9 May 2023 20:07:24 +0300 +Subject: [PATCH] wifi: ath11k: Send HT fixed rate in WMI peer fixed param + +Due to the firmware behavior with HT fixed rate setting, +HT fixed rate MCS with NSS > 1 are treated as NSS = 1 +HT rates in the firmware and enables the HT fixed rate of +NSS = 1. + +This leads to HT fixed rate is always configured for NSS = 1 +even though the user sets NSS = 2 or > 1 HT fixed MCS in the +set bitrate command. + +Currently HT fixed MCS is sent via WMI peer assoc command. +Fix this issue, by sending the HT fixed rate MCS in WMI peer +fixed param instead of sending in peer assoc command. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Maharaja Kennadyrajan +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230504092033.3542456-3-quic_mkenna@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 63 ++++++++++++++++++++++++++- + 1 file changed, 61 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -4480,6 +4480,54 @@ ath11k_mac_set_peer_he_fixed_rate(struct + return ret; + } + ++static int ++ath11k_mac_set_peer_ht_fixed_rate(struct ath11k_vif *arvif, ++ struct ieee80211_sta *sta, ++ const struct cfg80211_bitrate_mask *mask, ++ enum nl80211_band band) ++{ ++ struct ath11k *ar = arvif->ar; ++ u8 ht_rate, nss = 0; ++ u32 rate_code; ++ int ret, i; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { ++ if (hweight8(mask->control[band].ht_mcs[i]) == 1) { ++ nss = i + 1; ++ ht_rate = ffs(mask->control[band].ht_mcs[i]) - 1; ++ } ++ } ++ ++ if (!nss) { ++ ath11k_warn(ar->ab, "No single HT Fixed rate found to set for %pM", ++ sta->addr); ++ return -EINVAL; ++ } ++ ++ /* Avoid updating invalid nss as fixed rate*/ ++ if (nss > sta->deflink.rx_nss) ++ return -EINVAL; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, ++ "Setting Fixed HT Rate for peer %pM. Device will not switch to any other selected rates", ++ sta->addr); ++ ++ rate_code = ATH11K_HW_RATE_CODE(ht_rate, nss - 1, ++ WMI_RATE_PREAMBLE_HT); ++ ret = ath11k_wmi_set_peer_param(ar, sta->addr, ++ arvif->vdev_id, ++ WMI_PEER_PARAM_FIXED_RATE, ++ rate_code); ++ if (ret) ++ ath11k_warn(ar->ab, ++ "failed to update STA %pM HT Fixed Rate %d: %d\n", ++ sta->addr, rate_code, ret); ++ ++ return ret; ++} ++ + static int ath11k_station_assoc(struct ath11k *ar, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, +@@ -4491,7 +4539,7 @@ static int ath11k_station_assoc(struct a + struct cfg80211_chan_def def; + enum nl80211_band band; + struct cfg80211_bitrate_mask *mask; +- u8 num_vht_rates, num_he_rates; ++ u8 num_ht_rates, num_vht_rates, num_he_rates; + + lockdep_assert_held(&ar->conf_mutex); + +@@ -4519,6 +4567,7 @@ static int ath11k_station_assoc(struct a + + num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask); + num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, mask); ++ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, mask); + + /* If single VHT/HE rate is configured (by set_bitrate_mask()), + * peer_assoc will disable VHT/HE. This is now enabled by a peer specific +@@ -4535,6 +4584,11 @@ static int ath11k_station_assoc(struct a + band); + if (ret) + return ret; ++ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { ++ ret = ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask, ++ band); ++ if (ret) ++ return ret; + } + + /* Re-assoc is run only to update supported rates for given station. It +@@ -4608,7 +4662,7 @@ static void ath11k_sta_rc_update_wk(stru + const u16 *vht_mcs_mask; + const u16 *he_mcs_mask; + u32 changed, bw, nss, smps, bw_prev; +- int err, num_vht_rates, num_he_rates; ++ int err, num_ht_rates, num_vht_rates, num_he_rates; + const struct cfg80211_bitrate_mask *mask; + struct peer_assoc_params peer_arg; + enum wmi_phy_mode peer_phymode; +@@ -4724,6 +4778,8 @@ static void ath11k_sta_rc_update_wk(stru + + if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { + mask = &arvif->bitrate_mask; ++ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, ++ mask); + num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, + mask); + num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, +@@ -4746,6 +4802,9 @@ static void ath11k_sta_rc_update_wk(stru + } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) { + ath11k_mac_set_peer_he_fixed_rate(arvif, sta, mask, + band); ++ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { ++ ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask, ++ band); + } else { + /* If the peer is non-VHT/HE or no fixed VHT/HE rate + * is provided in the new bitrate mask we set the diff --git a/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch b/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch new file mode 100644 index 00000000000000..5ff40aac7a12d0 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch @@ -0,0 +1,127 @@ +From 88ca89202f8e8afb5225eb5244d79cd67c15d744 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Fri, 26 May 2023 12:41:06 +0300 +Subject: [PATCH] wifi: ath11k: add support default regdb while searching + board-2.bin for WCN6855 + +Sometimes board-2.bin does not have the regdb data which matched the +parameters such as vendor, device, subsystem-vendor, subsystem-device +and etc. Add default regdb data with 'bus=%s' into board-2.bin for +WCN6855, then ath11k use 'bus=pci' to search regdb data in board-2.bin +for WCN6855. + +kernel: [ 122.515808] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262' +kernel: [ 122.517240] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564 +kernel: [ 122.517280] ath11k_pci 0000:03:00.0: failed to fetch regdb data for bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262 from ath11k/WCN6855/hw2.0/board-2.bin +kernel: [ 122.517464] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci' +kernel: [ 122.518901] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564 +kernel: [ 122.518915] ath11k_pci 0000:03:00.0: board name +kernel: [ 122.518917] ath11k_pci 0000:03:00.0: 00000000: 62 75 73 3d 70 63 69 bus=pci +kernel: [ 122.518918] ath11k_pci 0000:03:00.0: boot found match regdb data for name 'bus=pci' +kernel: [ 122.518920] ath11k_pci 0000:03:00.0: boot found regdb data for 'bus=pci' +kernel: [ 122.518921] ath11k_pci 0000:03:00.0: fetched regdb + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230517133959.8224-1-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 53 +++++++++++++++++++------- + 1 file changed, 40 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -961,7 +961,8 @@ int ath11k_core_check_dt(struct ath11k_b + } + + static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name, +- size_t name_len, bool with_variant) ++ size_t name_len, bool with_variant, ++ bool bus_type_mode) + { + /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */ + char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 }; +@@ -972,15 +973,20 @@ static int __ath11k_core_create_board_na + + switch (ab->id.bdf_search) { + case ATH11K_BDF_SEARCH_BUS_AND_BOARD: +- scnprintf(name, name_len, +- "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", +- ath11k_bus_str(ab->hif.bus), +- ab->id.vendor, ab->id.device, +- ab->id.subsystem_vendor, +- ab->id.subsystem_device, +- ab->qmi.target.chip_id, +- ab->qmi.target.board_id, +- variant); ++ if (bus_type_mode) ++ scnprintf(name, name_len, ++ "bus=%s", ++ ath11k_bus_str(ab->hif.bus)); ++ else ++ scnprintf(name, name_len, ++ "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", ++ ath11k_bus_str(ab->hif.bus), ++ ab->id.vendor, ab->id.device, ++ ab->id.subsystem_vendor, ++ ab->id.subsystem_device, ++ ab->qmi.target.chip_id, ++ ab->qmi.target.board_id, ++ variant); + break; + default: + scnprintf(name, name_len, +@@ -999,13 +1005,19 @@ static int __ath11k_core_create_board_na + static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, true); ++ return __ath11k_core_create_board_name(ab, name, name_len, true, false); + } + + static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, false); ++ return __ath11k_core_create_board_name(ab, name, name_len, false, false); ++} ++ ++static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name, ++ size_t name_len) ++{ ++ return __ath11k_core_create_board_name(ab, name, name_len, false, true); + } + + const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, +@@ -1309,7 +1321,7 @@ success: + + int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd) + { +- char boardname[BOARD_NAME_SIZE]; ++ char boardname[BOARD_NAME_SIZE], default_boardname[BOARD_NAME_SIZE]; + int ret; + + ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); +@@ -1323,6 +1335,21 @@ int ath11k_core_fetch_regdb(struct ath11 + ATH11K_BD_IE_REGDB, + ATH11K_BD_IE_REGDB_NAME, + ATH11K_BD_IE_REGDB_DATA); ++ if (!ret) ++ goto exit; ++ ++ ret = ath11k_core_create_bus_type_board_name(ab, default_boardname, ++ BOARD_NAME_SIZE); ++ if (ret) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "failed to create default board name for regdb: %d", ret); ++ goto exit; ++ } ++ ++ ret = ath11k_core_fetch_board_data_api_n(ab, bd, default_boardname, ++ ATH11K_BD_IE_REGDB, ++ ATH11K_BD_IE_REGDB_NAME, ++ ATH11K_BD_IE_REGDB_DATA); + if (!ret) + goto exit; + diff --git a/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch b/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch new file mode 100644 index 00000000000000..b5dc83f007e3ab --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch @@ -0,0 +1,128 @@ +From 86f85575a3f6a20cef1c8bb98e78585fe3a53ccc Mon Sep 17 00:00:00 2001 +From: Govindaraj Saminathan +Date: Fri, 26 May 2023 12:41:06 +0300 +Subject: [PATCH 82/84] wifi: ath11k: remove unused function + ath11k_tm_event_wmi() + +The function ath11k_tm_event_wmi() is only defined and it is not used +anywhere. Hence remove the unused. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Govindaraj Saminathan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230517135934.16408-2-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/testmode.c | 64 +--------------------- + drivers/net/wireless/ath/ath11k/testmode.h | 8 +-- + 2 files changed, 2 insertions(+), 70 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/testmode.c ++++ b/drivers/net/wireless/ath/ath11k/testmode.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include "testmode.h" +@@ -20,69 +21,6 @@ static const struct nla_policy ath11k_tm + [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 }, + }; + +-/* Returns true if callee consumes the skb and the skb should be discarded. +- * Returns false if skb is not used. Does not sleep. +- */ +-bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb) +-{ +- struct sk_buff *nl_skb; +- bool consumed; +- int ret; +- +- ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, +- "testmode event wmi cmd_id %d skb %pK skb->len %d\n", +- cmd_id, skb, skb->len); +- +- ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len); +- +- spin_lock_bh(&ar->data_lock); +- +- consumed = true; +- +- nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, +- 2 * sizeof(u32) + skb->len, +- GFP_ATOMIC); +- if (!nl_skb) { +- ath11k_warn(ar->ab, +- "failed to allocate skb for testmode wmi event\n"); +- goto out; +- } +- +- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI); +- if (ret) { +- ath11k_warn(ar->ab, +- "failed to put testmode wmi event cmd attribute: %d\n", +- ret); +- kfree_skb(nl_skb); +- goto out; +- } +- +- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id); +- if (ret) { +- ath11k_warn(ar->ab, +- "failed to put testmode wmi even cmd_id: %d\n", +- ret); +- kfree_skb(nl_skb); +- goto out; +- } +- +- ret = nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data); +- if (ret) { +- ath11k_warn(ar->ab, +- "failed to copy skb to testmode wmi event: %d\n", +- ret); +- kfree_skb(nl_skb); +- goto out; +- } +- +- cfg80211_testmode_event(nl_skb, GFP_ATOMIC); +- +-out: +- spin_unlock_bh(&ar->data_lock); +- +- return consumed; +-} +- + static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[]) + { + struct sk_buff *skb; +--- a/drivers/net/wireless/ath/ath11k/testmode.h ++++ b/drivers/net/wireless/ath/ath11k/testmode.h +@@ -1,24 +1,18 @@ + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include "core.h" + + #ifdef CPTCFG_NL80211_TESTMODE + +-bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb); + int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + void *data, int len); + + #else + +-static inline bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, +- struct sk_buff *skb) +-{ +- return false; +-} +- + static inline int ath11k_tm_cmd(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + void *data, int len) diff --git a/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch b/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch new file mode 100644 index 00000000000000..f1b262724f94eb --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch @@ -0,0 +1,850 @@ +From b43310e44edc823a7f02af1e1e2b4e8a9abc7d91 Mon Sep 17 00:00:00 2001 +From: Govindaraj Saminathan +Date: Fri, 26 May 2023 12:41:07 +0300 +Subject: [PATCH 83/84] wifi: ath11k: factory test mode support + +Add support to process factory test mode commands (FTM) for calibration. +By default firmware start with NORMAL mode and to process the FTM commands +firmware needs to be restarted in FTM mode using module parameter ftm_mode. +The pre-request is all the radios should be down before starting the test. + +When start command ATH11K_TM_CMD_TESTMODE_START is received, ar->state +is set to Test Mode. If the FTM command or event length is greater +than 256 bytes, it will be broken down into multiple segments and +encoded with TLV header if it is segmented commands, else it is sent +to firmware as it is. + +On receiving UTF event from firmware, if it is segmented event, the driver +will wait until it receives all the segments and notify the complete +data to user application. In case the segmented sequence are missed or +lost from the firmware, driver will skip the already received partial data. + +In case of unsegmented UTF event from firmware, driver notifies the +data to the user application as it comes. Applications handles +the data further. + +Command to boot in ftm mode: + +insmod ath11k ftm_mode=1 + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Govindaraj Saminathan +Co-developed-by: Sowmiya Sree Elavalagan +Signed-off-by: Sowmiya Sree Elavalagan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230517135934.16408-4-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/ahb.c | 3 +- + drivers/net/wireless/ath/ath11k/core.c | 21 +- + drivers/net/wireless/ath/ath11k/core.h | 16 +- + drivers/net/wireless/ath/ath11k/debug.h | 1 + + drivers/net/wireless/ath/ath11k/mac.c | 11 +- + drivers/net/wireless/ath/ath11k/pci.c | 3 +- + drivers/net/wireless/ath/ath11k/testmode.c | 350 ++++++++++++++++++- + drivers/net/wireless/ath/ath11k/testmode.h | 6 + + drivers/net/wireless/ath/ath11k/testmode_i.h | 18 +- + drivers/net/wireless/ath/ath11k/wmi.c | 11 +- + drivers/net/wireless/ath/ath11k/wmi.h | 22 ++ + drivers/net/wireless/ath/ath11k/wow.c | 3 +- + 12 files changed, 444 insertions(+), 21 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -1155,6 +1155,7 @@ static int ath11k_ahb_probe(struct platf + ab->hif.ops = hif_ops; + ab->pdev = pdev; + ab->hw_rev = hw_rev; ++ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; + platform_set_drvdata(pdev, ab); + + ret = ath11k_pcic_register_pci_ops(ab, pci_ops); +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -32,6 +32,10 @@ module_param_named(frame_mode, ath11k_fr + MODULE_PARM_DESC(frame_mode, + "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)"); + ++bool ath11k_ftm_mode; ++module_param_named(ftm_mode, ath11k_ftm_mode, bool, 0444); ++MODULE_PARM_DESC(ftm_mode, "Boots up in factory test mode"); ++ + static const struct ath11k_hw_params ath11k_hw_params[] = { + { + .hw_rev = ATH11K_HW_IPQ8074, +@@ -1381,6 +1385,11 @@ static int ath11k_core_soc_create(struct + { + int ret; + ++ if (ath11k_ftm_mode) { ++ ab->fw_mode = ATH11K_FIRMWARE_MODE_FTM; ++ ath11k_info(ab, "Booting in factory test mode\n"); ++ } ++ + ret = ath11k_qmi_init_service(ab); + if (ret) { + ath11k_err(ab, "failed to initialize qmi :%d\n", ret); +@@ -1607,7 +1616,7 @@ int ath11k_core_qmi_firmware_ready(struc + { + int ret; + +- ret = ath11k_core_start_firmware(ab, ATH11K_FIRMWARE_MODE_NORMAL); ++ ret = ath11k_core_start_firmware(ab, ab->fw_mode); + if (ret) { + ath11k_err(ab, "failed to start firmware: %d\n", ret); + return ret; +@@ -1772,7 +1781,8 @@ void ath11k_core_pre_reconfigure_recover + for (i = 0; i < ab->num_radios; i++) { + pdev = &ab->pdevs[i]; + ar = pdev->ar; +- if (!ar || ar->state == ATH11K_STATE_OFF) ++ if (!ar || ar->state == ATH11K_STATE_OFF || ++ ar->state == ATH11K_STATE_FTM) + continue; + + ieee80211_stop_queues(ar->hw); +@@ -1841,7 +1851,12 @@ static void ath11k_core_post_reconfigure + ath11k_warn(ab, + "device is wedged, will not restart radio %d\n", i); + break; ++ case ATH11K_STATE_FTM: ++ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, ++ "fw mode reset done radio %d\n", i); ++ break; + } ++ + mutex_unlock(&ar->conf_mutex); + } + complete(&ab->driver_recovery); +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #ifndef ATH11K_CORE_H +@@ -52,6 +52,7 @@ + #define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_" + + extern unsigned int ath11k_frame_mode; ++extern bool ath11k_ftm_mode; + + #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ) + +@@ -277,6 +278,7 @@ enum ath11k_dev_flags { + ATH11K_FLAG_FIXED_MEM_RGN, + ATH11K_FLAG_DEVICE_INIT_DONE, + ATH11K_FLAG_MULTI_MSI_VECTORS, ++ ATH11K_FLAG_FTM_SEGMENTED, + }; + + enum ath11k_monitor_flags { +@@ -530,6 +532,7 @@ enum ath11k_state { + ATH11K_STATE_RESTARTING, + ATH11K_STATE_RESTARTED, + ATH11K_STATE_WEDGED, ++ ATH11K_STATE_FTM, + /* Add other states as required */ + }; + +@@ -709,6 +712,8 @@ struct ath11k { + u32 last_ppdu_id; + u32 cached_ppdu_id; + int monitor_vdev_id; ++ struct completion fw_mode_reset; ++ u8 ftm_msgref; + #ifdef CPTCFG_ATH11K_DEBUGFS + struct ath11k_debug debug; + #endif +@@ -838,6 +843,7 @@ struct ath11k_msi_config { + /* Master structure to hold the hw data which may be used in core module */ + struct ath11k_base { + enum ath11k_hw_rev hw_rev; ++ enum ath11k_firmware_mode fw_mode; + struct platform_device *pdev; + struct device *dev; + struct ath11k_qmi qmi; +@@ -978,6 +984,14 @@ struct ath11k_base { + const struct ath11k_pci_ops *ops; + } pci; + ++#ifdef CPTCFG_NL80211_TESTMODE ++ struct { ++ u32 data_pos; ++ u32 expected_seq; ++ u8 *eventdata; ++ } testmode; ++#endif ++ + /* must be last */ + u8 drv_priv[] __aligned(sizeof(void *)); + }; +--- a/drivers/net/wireless/ath/ath11k/debug.h ++++ b/drivers/net/wireless/ath/ath11k/debug.h +@@ -1,6 +1,7 @@ + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #ifndef _ATH11K_DEBUG_H_ +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -643,7 +643,10 @@ struct ath11k *ath11k_mac_get_ar_by_pdev + return NULL; + + for (i = 0; i < ab->num_radios; i++) { +- pdev = rcu_dereference(ab->pdevs_active[i]); ++ if (ab->fw_mode == ATH11K_FIRMWARE_MODE_FTM) ++ pdev = &ab->pdevs[i]; ++ else ++ pdev = rcu_dereference(ab->pdevs_active[i]); + + if (pdev && pdev->pdev_id == pdev_id) + return (pdev->ar ? pdev->ar : NULL); +@@ -6271,6 +6274,11 @@ static int ath11k_mac_op_start(struct ie + struct ath11k_pdev *pdev = ar->pdev; + int ret; + ++ if (ath11k_ftm_mode) { ++ ath11k_warn(ab, "mac operations not supported in factory test mode\n"); ++ return -EOPNOTSUPP; ++ } ++ + ath11k_mac_drain_tx(ar); + mutex_lock(&ar->conf_mutex); + +@@ -6285,6 +6293,7 @@ static int ath11k_mac_op_start(struct ie + case ATH11K_STATE_RESTARTED: + case ATH11K_STATE_WEDGED: + case ATH11K_STATE_ON: ++ case ATH11K_STATE_FTM: + WARN_ON(1); + ret = -EINVAL; + goto err; +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. +- * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -745,6 +745,7 @@ static int ath11k_pci_probe(struct pci_d + ab_pci->ab = ab; + ab_pci->pdev = pdev; + ab->hif.ops = &ath11k_pci_hif_ops; ++ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; + pci_set_drvdata(pdev, ab); + spin_lock_init(&ab_pci->window_lock); + +--- a/drivers/net/wireless/ath/ath11k/testmode.c ++++ b/drivers/net/wireless/ath/ath11k/testmode.c +@@ -12,6 +12,9 @@ + #include "core.h" + #include "testmode_i.h" + ++#define ATH11K_FTM_SEGHDR_CURRENT_SEQ GENMASK(3, 0) ++#define ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS GENMASK(7, 4) ++ + static const struct nla_policy ath11k_tm_policy[ATH11K_TM_ATTR_MAX + 1] = { + [ATH11K_TM_ATTR_CMD] = { .type = NLA_U32 }, + [ATH11K_TM_ATTR_DATA] = { .type = NLA_BINARY, +@@ -21,13 +24,217 @@ static const struct nla_policy ath11k_tm + [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 }, + }; + ++static struct ath11k *ath11k_tm_get_ar(struct ath11k_base *ab) ++{ ++ struct ath11k_pdev *pdev; ++ struct ath11k *ar = NULL; ++ int i; ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ++ if (ar && ar->state == ATH11K_STATE_FTM) ++ break; ++ } ++ ++ return ar; ++} ++ ++/* This function handles unsegmented events. Data in various events are aggregated ++ * in application layer, this event is unsegmented from host perspective. ++ */ ++static void ath11k_tm_wmi_event_unsegmented(struct ath11k_base *ab, u32 cmd_id, ++ struct sk_buff *skb) ++{ ++ struct sk_buff *nl_skb; ++ struct ath11k *ar; ++ ++ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, ++ "event wmi cmd_id %d skb length %d\n", ++ cmd_id, skb->len); ++ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len); ++ ++ ar = ath11k_tm_get_ar(ab); ++ if (!ar) { ++ ath11k_warn(ab, "testmode event not handled due to invalid pdev\n"); ++ return; ++ } ++ ++ spin_lock_bh(&ar->data_lock); ++ ++ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, ++ 2 * nla_total_size(sizeof(u32)) + ++ nla_total_size(skb->len), ++ GFP_ATOMIC); ++ if (!nl_skb) { ++ ath11k_warn(ab, ++ "failed to allocate skb for unsegmented testmode wmi event\n"); ++ goto out; ++ } ++ ++ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI) || ++ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) || ++ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data)) { ++ ath11k_warn(ab, "failed to populate testmode unsegmented event\n"); ++ kfree_skb(nl_skb); ++ goto out; ++ } ++ ++ cfg80211_testmode_event(nl_skb, GFP_ATOMIC); ++ spin_unlock_bh(&ar->data_lock); ++ return; ++ ++out: ++ spin_unlock_bh(&ar->data_lock); ++ ath11k_warn(ab, "Failed to send testmode event to higher layers\n"); ++} ++ ++/* This function handles segmented events. Data of various events received ++ * from firmware is aggregated and sent to application layer ++ */ ++static int ath11k_tm_process_event(struct ath11k_base *ab, u32 cmd_id, ++ const struct wmi_ftm_event_msg *ftm_msg, ++ u16 length) ++{ ++ struct sk_buff *nl_skb; ++ int ret = 0; ++ struct ath11k *ar; ++ u8 const *buf_pos; ++ u16 datalen; ++ u8 total_segments, current_seq; ++ u32 data_pos; ++ u32 pdev_id; ++ ++ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, ++ "event wmi cmd_id %d ftm event msg %pK datalen %d\n", ++ cmd_id, ftm_msg, length); ++ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", ftm_msg, length); ++ pdev_id = DP_HW2SW_MACID(ftm_msg->seg_hdr.pdev_id); ++ ++ if (pdev_id >= ab->num_radios) { ++ ath11k_warn(ab, "testmode event not handled due to invalid pdev id: %d\n", ++ pdev_id); ++ return -EINVAL; ++ } ++ ++ ar = ab->pdevs[pdev_id].ar; ++ if (!ar) { ++ ath11k_warn(ab, "testmode event not handled due to absence of pdev\n"); ++ return -ENODEV; ++ } ++ ++ current_seq = FIELD_GET(ATH11K_FTM_SEGHDR_CURRENT_SEQ, ++ ftm_msg->seg_hdr.segmentinfo); ++ total_segments = FIELD_GET(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS, ++ ftm_msg->seg_hdr.segmentinfo); ++ datalen = length - (sizeof(struct wmi_ftm_seg_hdr)); ++ buf_pos = ftm_msg->data; ++ ++ spin_lock_bh(&ar->data_lock); ++ ++ if (current_seq == 0) { ++ ab->testmode.expected_seq = 0; ++ ab->testmode.data_pos = 0; ++ } ++ ++ data_pos = ab->testmode.data_pos; ++ ++ if ((data_pos + datalen) > ATH11K_FTM_EVENT_MAX_BUF_LENGTH) { ++ ath11k_warn(ab, "Invalid ftm event length at %d: %d\n", ++ data_pos, datalen); ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ memcpy(&ab->testmode.eventdata[data_pos], buf_pos, datalen); ++ data_pos += datalen; ++ ++ if (++ab->testmode.expected_seq != total_segments) { ++ ab->testmode.data_pos = data_pos; ++ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, ++ "partial data received current_seq %d total_seg %d\n", ++ current_seq, total_segments); ++ goto out; ++ } ++ ++ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, ++ "total data length pos %d len %d\n", ++ data_pos, ftm_msg->seg_hdr.len); ++ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, ++ 2 * nla_total_size(sizeof(u32)) + ++ nla_total_size(data_pos), ++ GFP_ATOMIC); ++ if (!nl_skb) { ++ ath11k_warn(ab, ++ "failed to allocate skb for segmented testmode wmi event\n"); ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ++ ATH11K_TM_CMD_WMI_FTM) || ++ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) || ++ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, data_pos, ++ &ab->testmode.eventdata[0])) { ++ ath11k_warn(ab, "failed to populate segmented testmode event"); ++ kfree_skb(nl_skb); ++ ret = -ENOBUFS; ++ goto out; ++ } ++ ++ cfg80211_testmode_event(nl_skb, GFP_ATOMIC); ++ ++out: ++ spin_unlock_bh(&ar->data_lock); ++ return ret; ++} ++ ++static void ath11k_tm_wmi_event_segmented(struct ath11k_base *ab, u32 cmd_id, ++ struct sk_buff *skb) ++{ ++ const void **tb; ++ const struct wmi_ftm_event_msg *ev; ++ u16 length; ++ int ret; ++ ++ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); ++ if (IS_ERR(tb)) { ++ ret = PTR_ERR(tb); ++ ath11k_warn(ab, "failed to parse ftm event tlv: %d\n", ret); ++ return; ++ } ++ ++ ev = tb[WMI_TAG_ARRAY_BYTE]; ++ if (!ev) { ++ ath11k_warn(ab, "failed to fetch ftm msg\n"); ++ kfree(tb); ++ return; ++ } ++ ++ length = skb->len - TLV_HDR_SIZE; ++ ret = ath11k_tm_process_event(ab, cmd_id, ev, length); ++ if (ret) ++ ath11k_warn(ab, "Failed to process ftm event\n"); ++ ++ kfree(tb); ++} ++ ++void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb) ++{ ++ if (test_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags)) ++ ath11k_tm_wmi_event_segmented(ab, cmd_id, skb); ++ else ++ ath11k_tm_wmi_event_unsegmented(ab, cmd_id, skb); ++} ++ + static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[]) + { + struct sk_buff *skb; + int ret; + + ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, +- "testmode cmd get version_major %d version_minor %d\n", ++ "cmd get version_major %d version_minor %d\n", + ATH11K_TESTMODE_VERSION_MAJOR, + ATH11K_TESTMODE_VERSION_MINOR); + +@@ -53,6 +260,43 @@ static int ath11k_tm_cmd_get_version(str + return cfg80211_testmode_reply(skb); + } + ++static int ath11k_tm_cmd_testmode_start(struct ath11k *ar, struct nlattr *tb[]) ++{ ++ int ret; ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ if (ar->state == ATH11K_STATE_FTM) { ++ ret = -EALREADY; ++ goto err; ++ } ++ ++ /* start utf only when the driver is not in use */ ++ if (ar->state != ATH11K_STATE_OFF) { ++ ret = -EBUSY; ++ goto err; ++ } ++ ++ ar->ab->testmode.eventdata = kzalloc(ATH11K_FTM_EVENT_MAX_BUF_LENGTH, ++ GFP_KERNEL); ++ if (!ar->ab->testmode.eventdata) { ++ ret = -ENOMEM; ++ goto err; ++ } ++ ++ ar->state = ATH11K_STATE_FTM; ++ ar->ftm_msgref = 0; ++ ++ mutex_unlock(&ar->conf_mutex); ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, "cmd start\n"); ++ return 0; ++ ++err: ++ mutex_unlock(&ar->conf_mutex); ++ return ret; ++} ++ + static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[]) + { + struct ath11k_pdev_wmi *wmi = ar->wmi; +@@ -63,11 +307,6 @@ static int ath11k_tm_cmd_wmi(struct ath1 + + mutex_lock(&ar->conf_mutex); + +- if (ar->state != ATH11K_STATE_ON) { +- ret = -ENETDOWN; +- goto out; +- } +- + if (!tb[ATH11K_TM_ATTR_DATA]) { + ret = -EINVAL; + goto out; +@@ -80,11 +319,17 @@ static int ath11k_tm_cmd_wmi(struct ath1 + + buf = nla_data(tb[ATH11K_TM_ATTR_DATA]); + buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]); ++ if (!buf_len) { ++ ath11k_warn(ar->ab, "No data present in testmode wmi command\n"); ++ ret = -EINVAL; ++ goto out; ++ } ++ + cmd_id = nla_get_u32(tb[ATH11K_TM_ATTR_WMI_CMDID]); + + ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, +- "testmode cmd wmi cmd_id %d buf %pK buf_len %d\n", +- cmd_id, buf, buf_len); ++ "cmd wmi cmd_id %d buf length %d\n", ++ cmd_id, buf_len); + + ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len); + +@@ -111,6 +356,91 @@ out: + return ret; + } + ++static int ath11k_tm_cmd_wmi_ftm(struct ath11k *ar, struct nlattr *tb[]) ++{ ++ struct ath11k_pdev_wmi *wmi = ar->wmi; ++ struct ath11k_base *ab = ar->ab; ++ struct sk_buff *skb; ++ u32 cmd_id, buf_len, hdr_info; ++ int ret; ++ void *buf; ++ u8 segnumber = 0, seginfo; ++ u16 chunk_len, total_bytes, num_segments; ++ u8 *bufpos; ++ struct wmi_ftm_cmd *ftm_cmd; ++ ++ set_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags); ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ if (ar->state != ATH11K_STATE_FTM) { ++ ret = -ENETDOWN; ++ goto out; ++ } ++ ++ if (!tb[ATH11K_TM_ATTR_DATA]) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ buf = nla_data(tb[ATH11K_TM_ATTR_DATA]); ++ buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]); ++ cmd_id = WMI_PDEV_UTF_CMDID; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, ++ "cmd wmi ftm cmd_id %d buffer length %d\n", ++ cmd_id, buf_len); ++ ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len); ++ ++ bufpos = buf; ++ total_bytes = buf_len; ++ num_segments = total_bytes / MAX_WMI_UTF_LEN; ++ ++ if (buf_len - (num_segments * MAX_WMI_UTF_LEN)) ++ num_segments++; ++ ++ while (buf_len) { ++ chunk_len = min_t(u16, buf_len, MAX_WMI_UTF_LEN); ++ ++ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, (chunk_len + ++ sizeof(struct wmi_ftm_cmd))); ++ if (!skb) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ ftm_cmd = (struct wmi_ftm_cmd *)skb->data; ++ hdr_info = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | ++ FIELD_PREP(WMI_TLV_LEN, (chunk_len + ++ sizeof(struct wmi_ftm_seg_hdr))); ++ ftm_cmd->tlv_header = hdr_info; ++ ftm_cmd->seg_hdr.len = total_bytes; ++ ftm_cmd->seg_hdr.msgref = ar->ftm_msgref; ++ seginfo = FIELD_PREP(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS, num_segments) | ++ FIELD_PREP(ATH11K_FTM_SEGHDR_CURRENT_SEQ, segnumber); ++ ftm_cmd->seg_hdr.segmentinfo = seginfo; ++ segnumber++; ++ ++ memcpy(&ftm_cmd->data, bufpos, chunk_len); ++ ++ ret = ath11k_wmi_cmd_send(wmi, skb, cmd_id); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to send wmi ftm command: %d\n", ret); ++ goto out; ++ } ++ ++ buf_len -= chunk_len; ++ bufpos += chunk_len; ++ } ++ ++ ar->ftm_msgref++; ++ ret = 0; ++ ++out: ++ mutex_unlock(&ar->conf_mutex); ++ return ret; ++} ++ + int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + void *data, int len) + { +@@ -131,6 +461,10 @@ int ath11k_tm_cmd(struct ieee80211_hw *h + return ath11k_tm_cmd_get_version(ar, tb); + case ATH11K_TM_CMD_WMI: + return ath11k_tm_cmd_wmi(ar, tb); ++ case ATH11K_TM_CMD_TESTMODE_START: ++ return ath11k_tm_cmd_testmode_start(ar, tb); ++ case ATH11K_TM_CMD_WMI_FTM: ++ return ath11k_tm_cmd_wmi_ftm(ar, tb); + default: + return -EOPNOTSUPP; + } +--- a/drivers/net/wireless/ath/ath11k/testmode.h ++++ b/drivers/net/wireless/ath/ath11k/testmode.h +@@ -8,11 +8,17 @@ + + #ifdef CPTCFG_NL80211_TESTMODE + ++void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb); + int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + void *data, int len); + + #else + ++static inline void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, ++ struct sk_buff *skb) ++{ ++} ++ + static inline int ath11k_tm_cmd(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + void *data, int len) +--- a/drivers/net/wireless/ath/ath11k/testmode_i.h ++++ b/drivers/net/wireless/ath/ath11k/testmode_i.h +@@ -1,6 +1,7 @@ + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + /* "API" level of the ath11k testmode interface. Bump it after every +@@ -11,9 +12,10 @@ + /* Bump this after every _compatible_ interface change, for example + * addition of a new command or an attribute. + */ +-#define ATH11K_TESTMODE_VERSION_MINOR 0 ++#define ATH11K_TESTMODE_VERSION_MINOR 1 + + #define ATH11K_TM_DATA_MAX_LEN 5000 ++#define ATH11K_FTM_EVENT_MAX_BUF_LENGTH 2048 + + enum ath11k_tm_attr { + __ATH11K_TM_ATTR_INVALID = 0, +@@ -47,4 +49,18 @@ enum ath11k_tm_cmd { + * ATH11K_TM_ATTR_DATA. + */ + ATH11K_TM_CMD_WMI = 1, ++ ++ /* Boots the UTF firmware, the netdev interface must be down at the ++ * time. ++ */ ++ ATH11K_TM_CMD_TESTMODE_START = 2, ++ ++ /* The command used to transmit a FTM WMI command to the firmware ++ * and the event to receive WMI events from the firmware. The data ++ * received only contain the payload, need to add the tlv header ++ * and send the cmd to firmware with command id WMI_PDEV_UTF_CMDID. ++ * The data payload size could be large and the driver needs to ++ * send segmented data to firmware. ++ */ ++ ATH11K_TM_CMD_WMI_FTM = 3, + }; +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +- * Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + #include + #include +@@ -19,6 +19,7 @@ + #include "mac.h" + #include "hw.h" + #include "peer.h" ++#include "testmode.h" + + struct wmi_tlv_policy { + size_t min_len; +@@ -237,9 +238,8 @@ static int ath11k_wmi_tlv_parse(struct a + (void *)tb); + } + +-static const void ** +-ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, +- size_t len, gfp_t gfp) ++const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, ++ size_t len, gfp_t gfp) + { + const void **tb; + int ret; +@@ -8628,6 +8628,9 @@ static void ath11k_wmi_tlv_op_rx(struct + case WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID: + ath11k_wmi_pdev_csa_switch_count_status_event(ab, skb); + break; ++ case WMI_PDEV_UTF_EVENTID: ++ ath11k_tm_wmi_event(ab, id, skb); ++ break; + case WMI_PDEV_TEMPERATURE_EVENTID: + ath11k_wmi_pdev_temperature_event(ab, skb); + break; +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -1,6 +1,7 @@ + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #ifndef ATH11K_WMI_H +@@ -68,6 +69,7 @@ struct wmi_tlv { + + #define WMI_APPEND_TO_EXISTING_CHAN_LIST_FLAG 1 + ++#define MAX_WMI_UTF_LEN 252 + #define WMI_BA_MODE_BUFFER_SIZE_256 3 + /* + * HW mode config type replicated from FW header +@@ -3564,6 +3566,24 @@ struct wmi_get_pdev_temperature_cmd { + u32 pdev_id; + } __packed; + ++struct wmi_ftm_seg_hdr { ++ u32 len; ++ u32 msgref; ++ u32 segmentinfo; ++ u32 pdev_id; ++} __packed; ++ ++struct wmi_ftm_cmd { ++ u32 tlv_header; ++ struct wmi_ftm_seg_hdr seg_hdr; ++ u8 data[]; ++} __packed; ++ ++struct wmi_ftm_event_msg { ++ struct wmi_ftm_seg_hdr seg_hdr; ++ u8 data[]; ++} __packed; ++ + #define WMI_BEACON_TX_BUFFER_SIZE 512 + + #define WMI_EMA_TMPL_IDX_SHIFT 8 +@@ -6300,6 +6320,8 @@ enum wmi_sta_keepalive_method { + #define WMI_STA_KEEPALIVE_INTERVAL_DEFAULT 30 + #define WMI_STA_KEEPALIVE_INTERVAL_DISABLE 0 + ++const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, ++ size_t len, gfp_t gfp); + int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb, + u32 cmd_id); + struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len); +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2020 The Linux Foundation. All rights reserved. +- * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -838,6 +838,7 @@ exit: + case ATH11K_STATE_RESTARTING: + case ATH11K_STATE_RESTARTED: + case ATH11K_STATE_WEDGED: ++ case ATH11K_STATE_FTM: + ath11k_warn(ar->ab, "encountered unexpected device state %d on resume, cannot recover\n", + ar->state); + ret = -EIO; diff --git a/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch b/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch new file mode 100644 index 00000000000000..5a1fa882948e5a --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch @@ -0,0 +1,47 @@ +From 8aeba427296bff6a6051686f1d139c89a0b00e4c Mon Sep 17 00:00:00 2001 +From: Sowmiya Sree Elavalagan +Date: Fri, 26 May 2023 12:41:07 +0300 +Subject: [PATCH 84/84] wifi: ath11k: Allow ath11k to boot without caldata in + ftm mode + +Currently, if ath11k is unable to load the calibration data file it will +always exit. However the calibration data may not be present in factory +test mode, so update the logic to allow the driver to execute in FTM mode +even if downloading the calibration data fails. + +Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Sowmiya Sree Elavalagan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230517135934.16408-5-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/qmi.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -2460,6 +2460,14 @@ static int ath11k_qmi_load_bdf_qmi(struc + + fw_entry = ath11k_core_firmware_request(ab, ATH11K_DEFAULT_CAL_FILE); + if (IS_ERR(fw_entry)) { ++ /* Caldata may not be present during first time calibration in ++ * factory hence allow to boot without loading caldata in ftm mode ++ */ ++ if (ath11k_ftm_mode) { ++ ath11k_info(ab, ++ "Booting without cal data file in factory test mode\n"); ++ return 0; ++ } + ret = PTR_ERR(fw_entry); + ath11k_warn(ab, + "qmi failed to load CAL data file:%s\n", diff --git a/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch b/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch new file mode 100644 index 00000000000000..946f5f7b5786bb --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch @@ -0,0 +1,261 @@ +From 2d4f9093e2d8531ad0a2bb98fe5b36dc8addf2a2 Mon Sep 17 00:00:00 2001 +From: Nidhi Jain +Date: Fri, 26 May 2023 12:41:07 +0300 +Subject: [PATCH] wifi: ath11k: Add HTT stats for PHY reset case + +New HTT stats are added with stats type 37 to +provide PHY reset stats and PHY reset counter stats. + +PHY reset stats are used to display the current +PHY-related operation information such as band, CCA +threshold, current operating channel etc., + +PHY reset counter stats are used to display the +PHY reset counter values like calibration counts, +temperature based recalibration counts etc., + +Usage: +echo 37 > /sys/kernel/debug/ieee80211/phyX/ath11k/htt_stats_type +cat /sys/kernel/debug/ieee80211/phyx/ath11k/htt_stats + +Output: + +HTT_PHY_RESET_STATS_TLV: +pdev_id = 0 +chan_mhz = 5180 +chan_band_center_freq1 = 5210 +chan_band_center_freq2 = 0 +chan_phy_mode = 18 +chan_flags = 0x8 +chan_num = 36 +reset_cause = 0x50000 +prev_reset_cause = 0x50000 +phy_warm_reset_src = 0x0 +rx_gain_tbl_mode = 0 +xbar_val = 0xfac688 +force_calibration = 0 +phyrf_mode = 0 +phy_homechan = 0 +phy_tx_ch_mask = 0x3 +phy_rx_ch_mask = 0x3 +phybb_ini_mask = 0x5 +phyrf_ini_mask = 0x0 +phy_dfs_en_mask = 0x0 +phy_sscan_en_mask = 0x0 +phy_synth_sel_mask = 0x0 +phy_adfs_freq = 0 +cck_fir_settings = 0x0 +phy_dyn_pri_chan = 6 +cca_thresh = 0x26232020 +dyn_cca_status = 0 +rxdesense_thresh_hw = 0xcfe0afe +rxdesense_thresh_sw = 0xcfe0afe + +HTT_PHY_RESET_COUNTERS_TLV: +pdev_id = 0 +cf_active_low_fail_cnt = 0 +cf_active_low_pass_cnt = 0 +phy_off_through_vreg_cnt = 0 +force_calibration_cnt = 0 +rf_mode_switch_phy_off_cnt = 0 + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Nidhi Jain +Signed-off-by: Maharaja Kennadyrajan +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230517141242.2754293-1-quic_mkenna@quicinc.com +--- + .../wireless/ath/ath11k/debugfs_htt_stats.c | 114 ++++++++++++++++++ + .../wireless/ath/ath11k/debugfs_htt_stats.h | 43 +++++++ + 2 files changed, 157 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c +@@ -4011,6 +4011,114 @@ void htt_print_phy_stats_tlv(const void + stats_req->buf_len = len; + } + ++static inline void ++htt_print_phy_reset_counters_tlv(const void *tag_buf, ++ u16 tag_len, ++ struct debug_htt_stats_req *stats_req) ++{ ++ const struct htt_phy_reset_counters_tlv *htt_stats_buf = tag_buf; ++ u8 *buf = stats_req->buf; ++ u32 len = stats_req->buf_len; ++ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; ++ ++ if (tag_len < sizeof(*htt_stats_buf)) ++ return; ++ ++ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_COUNTERS_TLV:\n"); ++ ++ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n", ++ htt_stats_buf->pdev_id); ++ len += scnprintf(buf + len, buf_len - len, "cf_active_low_fail_cnt = %u\n", ++ htt_stats_buf->cf_active_low_fail_cnt); ++ len += scnprintf(buf + len, buf_len - len, "cf_active_low_pass_cnt = %u\n", ++ htt_stats_buf->cf_active_low_pass_cnt); ++ len += scnprintf(buf + len, buf_len - len, "phy_off_through_vreg_cnt = %u\n", ++ htt_stats_buf->phy_off_through_vreg_cnt); ++ len += scnprintf(buf + len, buf_len - len, "force_calibration_cnt = %u\n", ++ htt_stats_buf->force_calibration_cnt); ++ len += scnprintf(buf + len, buf_len - len, "rf_mode_switch_phy_off_cnt = %u\n", ++ htt_stats_buf->rf_mode_switch_phy_off_cnt); ++ ++ stats_req->buf_len = len; ++} ++ ++static inline void ++htt_print_phy_reset_stats_tlv(const void *tag_buf, ++ u16 tag_len, ++ struct debug_htt_stats_req *stats_req) ++{ ++ const struct htt_phy_reset_stats_tlv *htt_stats_buf = tag_buf; ++ u8 *buf = stats_req->buf; ++ u32 len = stats_req->buf_len; ++ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; ++ ++ if (tag_len < sizeof(*htt_stats_buf)) ++ return; ++ ++ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_STATS_TLV:\n"); ++ ++ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n", ++ htt_stats_buf->pdev_id); ++ len += scnprintf(buf + len, buf_len - len, "chan_mhz = %u\n", ++ htt_stats_buf->chan_mhz); ++ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq1 = %u\n", ++ htt_stats_buf->chan_band_center_freq1); ++ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq2 = %u\n", ++ htt_stats_buf->chan_band_center_freq2); ++ len += scnprintf(buf + len, buf_len - len, "chan_phy_mode = %u\n", ++ htt_stats_buf->chan_phy_mode); ++ len += scnprintf(buf + len, buf_len - len, "chan_flags = 0x%0x\n", ++ htt_stats_buf->chan_flags); ++ len += scnprintf(buf + len, buf_len - len, "chan_num = %u\n", ++ htt_stats_buf->chan_num); ++ len += scnprintf(buf + len, buf_len - len, "reset_cause = 0x%0x\n", ++ htt_stats_buf->reset_cause); ++ len += scnprintf(buf + len, buf_len - len, "prev_reset_cause = 0x%0x\n", ++ htt_stats_buf->prev_reset_cause); ++ len += scnprintf(buf + len, buf_len - len, "phy_warm_reset_src = 0x%0x\n", ++ htt_stats_buf->phy_warm_reset_src); ++ len += scnprintf(buf + len, buf_len - len, "rx_gain_tbl_mode = %d\n", ++ htt_stats_buf->rx_gain_tbl_mode); ++ len += scnprintf(buf + len, buf_len - len, "xbar_val = 0x%0x\n", ++ htt_stats_buf->xbar_val); ++ len += scnprintf(buf + len, buf_len - len, "force_calibration = %u\n", ++ htt_stats_buf->force_calibration); ++ len += scnprintf(buf + len, buf_len - len, "phyrf_mode = %u\n", ++ htt_stats_buf->phyrf_mode); ++ len += scnprintf(buf + len, buf_len - len, "phy_homechan = %u\n", ++ htt_stats_buf->phy_homechan); ++ len += scnprintf(buf + len, buf_len - len, "phy_tx_ch_mask = 0x%0x\n", ++ htt_stats_buf->phy_tx_ch_mask); ++ len += scnprintf(buf + len, buf_len - len, "phy_rx_ch_mask = 0x%0x\n", ++ htt_stats_buf->phy_rx_ch_mask); ++ len += scnprintf(buf + len, buf_len - len, "phybb_ini_mask = 0x%0x\n", ++ htt_stats_buf->phybb_ini_mask); ++ len += scnprintf(buf + len, buf_len - len, "phyrf_ini_mask = 0x%0x\n", ++ htt_stats_buf->phyrf_ini_mask); ++ len += scnprintf(buf + len, buf_len - len, "phy_dfs_en_mask = 0x%0x\n", ++ htt_stats_buf->phy_dfs_en_mask); ++ len += scnprintf(buf + len, buf_len - len, "phy_sscan_en_mask = 0x%0x\n", ++ htt_stats_buf->phy_sscan_en_mask); ++ len += scnprintf(buf + len, buf_len - len, "phy_synth_sel_mask = 0x%0x\n", ++ htt_stats_buf->phy_synth_sel_mask); ++ len += scnprintf(buf + len, buf_len - len, "phy_adfs_freq = %u\n", ++ htt_stats_buf->phy_adfs_freq); ++ len += scnprintf(buf + len, buf_len - len, "cck_fir_settings = 0x%0x\n", ++ htt_stats_buf->cck_fir_settings); ++ len += scnprintf(buf + len, buf_len - len, "phy_dyn_pri_chan = %u\n", ++ htt_stats_buf->phy_dyn_pri_chan); ++ len += scnprintf(buf + len, buf_len - len, "cca_thresh = 0x%0x\n", ++ htt_stats_buf->cca_thresh); ++ len += scnprintf(buf + len, buf_len - len, "dyn_cca_status = %u\n", ++ htt_stats_buf->dyn_cca_status); ++ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_hw = 0x%x\n", ++ htt_stats_buf->rxdesense_thresh_hw); ++ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_sw = 0x%x\n", ++ htt_stats_buf->rxdesense_thresh_sw); ++ ++ stats_req->buf_len = len; ++} ++ + static inline + void htt_print_peer_ctrl_path_txrx_stats_tlv(const void *tag_buf, + struct debug_htt_stats_req *stats_req) +@@ -4425,6 +4533,12 @@ static int ath11k_dbg_htt_ext_stats_pars + case HTT_STATS_PHY_STATS_TAG: + htt_print_phy_stats_tlv(tag_buf, stats_req); + break; ++ case HTT_STATS_PHY_RESET_COUNTERS_TAG: ++ htt_print_phy_reset_counters_tlv(tag_buf, len, stats_req); ++ break; ++ case HTT_STATS_PHY_RESET_STATS_TAG: ++ htt_print_phy_reset_stats_tlv(tag_buf, len, stats_req); ++ break; + case HTT_STATS_PEER_CTRL_PATH_TXRX_STATS_TAG: + htt_print_peer_ctrl_path_txrx_stats_tlv(tag_buf, stats_req); + break; +--- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h ++++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h +@@ -111,6 +111,8 @@ enum htt_tlv_tag_t { + HTT_STATS_TXBF_OFDMA_STEER_STATS_TAG = 116, + HTT_STATS_PHY_COUNTERS_TAG = 121, + HTT_STATS_PHY_STATS_TAG = 122, ++ HTT_STATS_PHY_RESET_COUNTERS_TAG = 123, ++ HTT_STATS_PHY_RESET_STATS_TAG = 124, + + HTT_STATS_MAX_TAG, + }; +@@ -1964,6 +1966,47 @@ struct htt_phy_stats_tlv { + u32 fw_run_time; + }; + ++struct htt_phy_reset_counters_tlv { ++ u32 pdev_id; ++ u32 cf_active_low_fail_cnt; ++ u32 cf_active_low_pass_cnt; ++ u32 phy_off_through_vreg_cnt; ++ u32 force_calibration_cnt; ++ u32 rf_mode_switch_phy_off_cnt; ++}; ++ ++struct htt_phy_reset_stats_tlv { ++ u32 pdev_id; ++ u32 chan_mhz; ++ u32 chan_band_center_freq1; ++ u32 chan_band_center_freq2; ++ u32 chan_phy_mode; ++ u32 chan_flags; ++ u32 chan_num; ++ u32 reset_cause; ++ u32 prev_reset_cause; ++ u32 phy_warm_reset_src; ++ u32 rx_gain_tbl_mode; ++ u32 xbar_val; ++ u32 force_calibration; ++ u32 phyrf_mode; ++ u32 phy_homechan; ++ u32 phy_tx_ch_mask; ++ u32 phy_rx_ch_mask; ++ u32 phybb_ini_mask; ++ u32 phyrf_ini_mask; ++ u32 phy_dfs_en_mask; ++ u32 phy_sscan_en_mask; ++ u32 phy_synth_sel_mask; ++ u32 phy_adfs_freq; ++ u32 cck_fir_settings; ++ u32 phy_dyn_pri_chan; ++ u32 cca_thresh; ++ u32 dyn_cca_status; ++ u32 rxdesense_thresh_hw; ++ u32 rxdesense_thresh_sw; ++}; ++ + struct htt_peer_ctrl_path_txrx_stats_tlv { + /* peer mac address */ + u8 peer_mac_addr[ETH_ALEN]; diff --git a/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch b/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch index 01f2bb4848ed3f..5454fa75e4c62d 100644 --- a/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch +++ b/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch @@ -13,7 +13,7 @@ Signed-off-by: Robert Marko --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -82,7 +82,7 @@ static const struct ath11k_hw_params ath +@@ -86,7 +86,7 @@ static const struct ath11k_hw_params ath .supports_shadow_regs = false, .idle_ps = false, .supports_sta_ps = false, diff --git a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch index a93871eca54b02..22c2493ca9d1e0 100644 --- a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch +++ b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch @@ -22,16 +22,16 @@ Signed-off-by: Robert Marko --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -32,7 +32,7 @@ module_param_named(frame_mode, ath11k_fr - MODULE_PARM_DESC(frame_mode, - "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)"); +@@ -36,7 +36,7 @@ bool ath11k_ftm_mode; + module_param_named(ftm_mode, ath11k_ftm_mode, bool, 0444); + MODULE_PARM_DESC(ftm_mode, "Boots up in factory test mode"); -static const struct ath11k_hw_params ath11k_hw_params[] = { +static struct ath11k_hw_params ath11k_hw_params[] = { { .hw_rev = ATH11K_HW_IPQ8074, .name = "ipq8074 hw2.0", -@@ -1911,7 +1911,8 @@ static void ath11k_core_reset(struct wor +@@ -1953,7 +1953,8 @@ static void ath11k_core_reset(struct wor static int ath11k_init_hw_params(struct ath11k_base *ab) { const struct ath11k_hw_params *hw_params = NULL; @@ -41,7 +41,7 @@ Signed-off-by: Robert Marko for (i = 0; i < ARRAY_SIZE(ath11k_hw_params); i++) { hw_params = &ath11k_hw_params[i]; -@@ -1927,7 +1928,30 @@ static int ath11k_init_hw_params(struct +@@ -1969,7 +1970,30 @@ static int ath11k_init_hw_params(struct ab->hw_params = *hw_params; diff --git a/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch b/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch index 40dc9d56f79dd6..b0ceb00ba034e0 100644 --- a/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch +++ b/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch @@ -271,7 +271,7 @@ Signed-off-by: Aditya Kumar Singh #endif --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6980,24 +6980,12 @@ static void ath11k_wmi_htc_tx_complete(s +@@ -6996,24 +6996,12 @@ static void ath11k_wmi_htc_tx_complete(s wake_up(&wmi->tx_ce_desc_wq); } @@ -296,7 +296,7 @@ Signed-off-by: Aditya Kumar Singh int ret = 0, pdev_idx, i, j; struct ath11k *ar; -@@ -7059,17 +7047,7 @@ static int ath11k_reg_chan_list_event(st +@@ -7075,17 +7063,7 @@ static int ath11k_reg_chan_list_event(st (char *)reg_info->alpha2, 2)) goto mem_free; From bc6bf2a0d0232f66d42f50188895c3c6908d0ca9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 4 Jun 2023 16:54:19 +0200 Subject: [PATCH 0135/1171] unetd: update to the latest version 412d03012f13 network: prevent adding endpoint routes for addresses on the network faaf9cee6ef4 utils: fix ipv4 checksum issue 0e1c2fad3540 pex-msg: fix memory leak on fread fail in pex_msg_update_request_init 51be0ed659d0 host: fix crash parsing gateway when no endpoint is specified ca17601dc24e wg-linux: add support for splitting netlink messages for allowed ips 7d3986b7a5a2 wg-linux: increase default messages size Signed-off-by: Felix Fietkau (cherry picked from commit 7b1e8983365746876034534ef22004d423c390e0) --- package/network/services/unetd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/unetd/Makefile b/package/network/services/unetd/Makefile index d2cd4a618357fd..7d8ed9a144caa9 100644 --- a/package/network/services/unetd/Makefile +++ b/package/network/services/unetd/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=unetd PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/unetd.git -PKG_SOURCE_DATE:=2022-09-16.1 -PKG_SOURCE_VERSION:=6c888f897862b152e2cfae735faafc9cdcb07336 -PKG_MIRROR_HASH:=35df8c822c671495146c3d5d1c193c1d1a44721c274aee2035943eb5e8c04768 +PKG_SOURCE_DATE:=2023-05-31 +PKG_SOURCE_VERSION:=7d3986b7a5a20b9af0dacd053b2657210385e7bb +PKG_MIRROR_HASH:=07f0a4cbae3e80c6309bb8aa27fcef19fbc56093a9c7e426e0d527227af09429 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From c6531042da2afc6b9601c05a4dc8bacde4780bc2 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 24 May 2023 10:21:23 +0200 Subject: [PATCH 0136/1171] libubox: update to the latest version b09b316aeaf6 blobmsg: add blobmsg_parse_attr function eac92a4d5d82 blobmsg: add blobmsg_parse_array_attr ef5e8e38bd38 usock: fix poll return code check 6fc29d1c4292 jshn.sh: Add pretty-printing to json_dump 5893cf78da40 blobmsg: Don't do at run-time what can be done at compile-time 362951a2d96e uloop: fix uloop_run_timeout 75a3b870cace uloop: add support for integrating with a different event loop Signed-off-by: Felix Fietkau (cherry picked from commit b6e0a24c492537e5bbfa015e2a3638ccc53c164b) --- package/libs/libubox/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index e19a97cbbab02e..c62278adc50ab2 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git -PKG_MIRROR_HASH:=400bef38b8c0f382e4e595a50bb52dfbdb8da820eb80f3447b9bd7be3f5499a5 -PKG_SOURCE_DATE:=2022-09-27 -PKG_SOURCE_VERSION:=ea56013409d5823001b47a9bba6f74055a6d76a5 +PKG_MIRROR_HASH:=f22de22a784a0135cc2869fe81ff30e52136dca36863ee713503b4be5be01869 +PKG_SOURCE_DATE:=2023-05-23 +PKG_SOURCE_VERSION:=75a3b870cace1171faf57bd55e5a9a2f1564f757 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 03455e79d7a4a0da5399618851168dfadebf416e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 29 May 2023 19:27:15 +0200 Subject: [PATCH 0137/1171] qca-nss-dp: fix oops in nss_dp_probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently kernel crashes when of_phy_connect has issues: Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000308 ... pc : phy_attached_print+0x28/0x1b0 lr : phy_attached_info+0x14/0x20 ... Call trace: phy_attached_print+0x28/0x1b0 phy_attached_info+0x14/0x20 nss_dp_adjust_link+0x544/0x6c4 [qca_nss_dp] of_phy_connect returns either pointer or NULL, so can't be checked with IS_ERR macro. Signed-off-by: Petr Štetiar (cherry picked from commit 38c7cf0e69aeefdec44d513307732e4daf7d9794) --- ...ss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch index ba9b8ef26222b3..276c87adfc52af 100644 --- a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch +++ b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch @@ -155,11 +155,12 @@ Signed-off-by: Alexandru Gagniuc - dp_priv->phydev = phy_connect(netdev, phy_id, - &nss_dp_adjust_link, - dp_priv->phy_mii_type); +- if (IS_ERR(dp_priv->phydev)) { +- netdev_dbg(netdev, "failed to connect to phy device\n"); + dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node, + &nss_dp_adjust_link, 0, + dp_priv->phy_mii_type); - if (IS_ERR(dp_priv->phydev)) { -- netdev_dbg(netdev, "failed to connect to phy device\n"); ++ if (!(dp_priv->phydev)) { + dev_err(&pdev->dev, "Could not attach to PHY\n"); goto phy_setup_fail; } From 145d485d51330c40deccce8e249a1da4b1c283ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 30 May 2023 16:36:05 +0200 Subject: [PATCH 0138/1171] ipq807x: image: factor out common eMMC bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For better maintainability and reusability. Signed-off-by: Petr Štetiar (cherry picked from commit a9be186466fdb4987c158916781d99329d1c3712) --- target/linux/ipq807x/image/generic.mk | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index 609c6690d17092..f4a872ce09ab41 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -10,6 +10,13 @@ define Device/FitImageLzma KERNEL_NAME := Image endef +define Device/EmmcImage + IMAGES += factory.bin sysupgrade.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k + IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata + DEVICE_PACKAGES := e2fsprogs kmod-fs-ext4 losetup +endef + define Device/UbiFit KERNEL_IN_UBI := 1 IMAGES := factory.ubi sysupgrade.bin @@ -90,16 +97,14 @@ TARGET_DEVICES += netgear_wax218 define Device/qnap_301w $(call Device/FitImage) + $(call Device/EmmcImage) DEVICE_VENDOR := QNAP DEVICE_MODEL := 301w DEVICE_DTS_CONFIG := config@hk01 KERNEL_SIZE := 16384k BLOCKSIZE := 512k SOC := ipq8072 - IMAGES += factory.bin sysupgrade.bin - IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k - IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata - DEVICE_PACKAGES := ipq-wifi-qnap_301w e2fsprogs kmod-fs-ext4 losetup + DEVICE_PACKAGES += ipq-wifi-qnap_301w endef TARGET_DEVICES += qnap_301w @@ -150,16 +155,14 @@ TARGET_DEVICES += xiaomi_ax9000 define Device/zyxel_nbg7815 $(call Device/FitImage) + $(call Device/EmmcImage) DEVICE_VENDOR := ZYXEL DEVICE_MODEL := NBG7815 DEVICE_DTS_CONFIG := config@nbg7815 BLOCKSIZE := 128k PAGESIZE := 2048 SOC := ipq8074 - IMAGES += factory.bin sysupgrade.bin - IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k - IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata - DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci e2fsprogs kmod-fs-ext4 losetup \ - kmod-hwmon-tmp103 kmod-bluetooth + DEVICE_PACKAGES += ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci kmod-hwmon-tmp103 \ + kmod-bluetooth endef TARGET_DEVICES += zyxel_nbg7815 From 948dc515dc5afca45a233471535e7c463866c9a9 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 25 May 2023 02:31:17 -0400 Subject: [PATCH 0139/1171] treewide: add ORIG_PATH variable Add a variable that stores the original value of $PATH in the host system's shell, before Make alters it. This can be useful for when it is necessary to ignore symlinks and programs made by the build system. Define this new variable before all instances of 'export PATH:=' or similar. Signed-off-by: Michael Pratt (cherry picked from commit d87a8aa148ddf93b199a759deb088fff73787025) --- Makefile | 2 ++ include/scan.mk | 1 + include/toplevel.mk | 1 + rules.mk | 1 + target/imagebuilder/files/Makefile | 1 + target/sdk/files/Makefile | 2 ++ target/toolchain/files/wrapper.sh | 1 + 7 files changed, 9 insertions(+) diff --git a/Makefile b/Makefile index cff0e1d8d48299..c325034bb9da4f 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir world: DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1) + +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH) ifneq ($(OPENWRT_BUILD),1) diff --git a/include/scan.mk b/include/scan.mk index 12ef5d1dc77fe9..33a5832ff5f237 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -11,6 +11,7 @@ TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE) OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE) +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(STAGING_DIR_HOST)/bin:$(PATH) define feedname diff --git a/include/toplevel.mk b/include/toplevel.mk index 2fda7ed223924b..328214be1bc59f 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -50,6 +50,7 @@ space:= $(empty) $(empty) path:=$(subst :,$(space),$(PATH)) path:=$(filter-out .%,$(path)) path:=$(subst $(space),:,$(path)) +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(path) export STAGING_DIR_HOST:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host),$(TOPDIR)/staging_dir/host) diff --git a/rules.mk b/rules.mk index dcac49667bbfd3..58c53705a28161 100644 --- a/rules.mk +++ b/rules.mk @@ -227,6 +227,7 @@ else endif endif +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(TARGET_PATH) export STAGING_DIR STAGING_DIR_HOST STAGING_DIR_HOSTPKG export SH_FUNC:=. $(INCLUDE_DIR)/shell.sh; diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 5aeedb74dadab4..5020373792450b 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -13,6 +13,7 @@ export TOPDIR LC_ALL LANG export OPENWRT_VERBOSE=s all: help +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) ifneq ($(OPENWRT_BUILD),1) diff --git a/target/sdk/files/Makefile b/target/sdk/files/Makefile index dca8bbe20e78f7..89c6a109eee020 100644 --- a/target/sdk/files/Makefile +++ b/target/sdk/files/Makefile @@ -15,6 +15,8 @@ export TOPDIR LC_ALL LANG SDK world: DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1) + +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) ifneq ($(OPENWRT_BUILD),1) diff --git a/target/toolchain/files/wrapper.sh b/target/toolchain/files/wrapper.sh index 4b3f8f911ab67e..09a9cac928abd9 100755 --- a/target/toolchain/files/wrapper.sh +++ b/target/toolchain/files/wrapper.sh @@ -43,6 +43,7 @@ TOOLCHAIN_BIN_DIR="$REALNAME_DIR/" # Set the PATH so that our run-time location is first # (get_feature is run from the path, so this has to be set) +export ORIG_PATH=${ORIG_PATH:-$PATH} export PATH="$TOOLCHAIN_BIN_DIR":$PATH export GCC_HONOUR_COPTS From c7bd7a9c5143f25dc6137439794fdf075c6cc424 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 25 May 2023 02:31:52 -0400 Subject: [PATCH 0140/1171] prereq-build: fix inconsistent value of $PATH In the recipe SetupHostCommand for checking and creating symlinks, $PATH was only overridden for one of several commands. This causes the symlinks to be included in the paths to pick a program from when the check was repeated, because staging_dir/host/bin was included in $PATH, but only *sometimes*. When the check ran again, the command succeded with a $PATH including the symlink, (eval "$$$$$$$$cmd") while the path to the program was evaluated with a $PATH NOT including the symlink, (bin=...) causing the symlink to be relinked incorrectly, instead of passing as exactly the same. Coincidentally, this was only a problem if the symlink targeted the alternative program with a different name. By overriding the value of $PATH at the invocation of Make, it will apply to the entire environment of the checks. Signed-off-by: Michael Pratt (cherry picked from commit 665fe2f818300f0b84c8c458fc49ae58ff8853aa) --- include/prereq.mk | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/prereq.mk b/include/prereq.mk index 74c3914d060da3..45c84e984c6f29 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -28,9 +28,9 @@ define Require prereq-$(1): $(if $(PREREQ_PREV),prereq-$(PREREQ_PREV)) FORCE printf "Checking '$(1)'... " - if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \ + if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) PATH="$(ORIG_PATH)" >/dev/null 2>/dev/null; then \ echo 'ok.'; \ - elif $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \ + elif $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) PATH="$(ORIG_PATH)" >/dev/null 2>/dev/null; then \ echo 'updated.'; \ else \ echo 'failed.'; \ @@ -104,8 +104,7 @@ define SetupHostCommand $(call QuoteHostCommand,$(9)) $(call QuoteHostCommand,$(10)) \ $(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \ if [ -n "$$$$$$$$cmd" ]; then \ - bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \ - command -v "$$$$$$$${cmd%% *}")"; \ + bin="$$$$$$$$(command -v "$$$$$$$${cmd%% *}")"; \ if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \ case "$$$$$$$$(ls -dl -- $(STAGING_DIR_HOST)/bin/$(strip $(1)))" in \ *" -> $$$$$$$$bin"*) \ From 43b92ff6ce203dee5049c3ad4f28c95a69dd0694 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Sat, 27 May 2023 17:11:47 -0400 Subject: [PATCH 0141/1171] prereq-build: do not replace binaries with symlinks Some programs, like bash and patch, are checked by prereq stage and have a symlink installed, but then is later built from source. Now that the prereq-build checks are not successful just by finding the file alone, it is possible for a new symlink to overwrite the installed binary. If a normal file is found in staging_dir/host/bin, let the check look for the associated stampfile, and if found, skip creation of a symlink and exit successfully. Suggested-by: Kevin Darbyshire-Bryant Signed-off-by: Michael Pratt (cherry picked from commit 729909c07fae4201591e51895833112cb88485e1) --- include/prereq.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/prereq.mk b/include/prereq.mk index 45c84e984c6f29..ada11a87019920 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -110,6 +110,10 @@ define SetupHostCommand *" -> $$$$$$$$bin"*) \ [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ ;; \ + "-"*) \ + find "$(STAGING_DIR_HOST)/stamp" | grep $(strip $(1)) && \ + [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ + ;; \ esac; \ ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \ exit 0; \ From e972e4f2a9ecbb65b826f53b890e4705c6034f43 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 29 May 2023 05:38:33 -0400 Subject: [PATCH 0142/1171] prereq-build: replace relative symlinks only if broken Some programs installed to staging_dir/host/bin also install some symlinks to itself for an alternative name. Some of those new symlinks are overwriting symlinks that were installed by prereq stage. If prereq stage were to somehow be run again, it should not be overwriting symlinks that point to programs that are already built. To filter that out, catch all symlinks after first catching all symlinks that have an absolute target after all other cases in the case statement, make sure it is not broken, and if so exit successfully. Suggested-by: Kevin Darbyshire-Bryant Signed-off-by: Michael Pratt (cherry picked from commit b890e2fbf9211648ad4a74f3e8b47bbf04a3cc7a) --- include/prereq.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/prereq.mk b/include/prereq.mk index ada11a87019920..88ed1f406afdb2 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -114,6 +114,11 @@ define SetupHostCommand find "$(STAGING_DIR_HOST)/stamp" | grep $(strip $(1)) && \ [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ ;; \ + *" -> /"*) \ + ;; \ + *" -> "*) \ + [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ + ;; \ esac; \ ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \ exit 0; \ From ea22a1f4da2ee98cd8354acc61840199814dfb6d Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 30 May 2023 07:20:19 -0400 Subject: [PATCH 0143/1171] host-build: add support for a stampfile per installed binary Some individual build items install a group of programs instead of a program matching the name of the build item. Add support for installing stampfiles for each of the programs installed by that build item, which will allow more control and awareness of what is installed by the rest of the build system, if, for example, prereq symlink checks are looking for the same program which is built already. Signed-off-by: Michael Pratt (cherry picked from commit 84f7a45e9e83339d84bcc15f06259b1064cb961a) --- include/host-build.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/host-build.mk b/include/host-build.mk index 7485f91e422ed1..dba6b819da6349 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -26,6 +26,7 @@ HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built HOST_BUILD_PREFIX?=$(if $(IS_PACKAGE_BUILD),$(STAGING_DIR_HOSTPKG),$(STAGING_DIR_HOST)) HOST_STAMP_INSTALLED:=$(HOST_BUILD_PREFIX)/stamp/.$(PKG_NAME)_installed +HOST_STAMP_PROGRAMS:=$(foreach program,$(PKG_PROGRAMS),$(subst $(PKG_NAME),$(program),$(HOST_STAMP_INSTALLED)) ) override MAKEFLAGS= @@ -172,7 +173,7 @@ ifndef DUMP $(foreach hook,$(Hooks/HostInstall/Post),$(call $(hook))$(sep)) mkdir -p $$(shell dirname $$@) touch $(HOST_STAMP_BUILT) - touch $$@ + touch $$@ $(HOST_STAMP_PROGRAMS) $(call DefaultTargets,$(patsubst %,host-%,$(DEFAULT_SUBDIR_TARGETS))) ifndef STAMP_BUILT @@ -187,7 +188,7 @@ ifndef DUMP $(_host_target)host-prepare: $(HOST_STAMP_PREPARED) $(_host_target)host-configure: $(HOST_STAMP_CONFIGURED) - $(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED) + $(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_PROGRAMS) host-install: host-compile host-clean-build: FORCE @@ -196,7 +197,7 @@ ifndef DUMP host-clean: host-clean-build $(call Host/Clean) - rm -rf $(HOST_STAMP_INSTALLED) + rm -rf $(HOST_STAMP_INSTALLED) $(HOST_STAMP_PROGRAMS) ifneq ($(CONFIG_AUTOREMOVE),) host-compile: From f30712956185dcade6415916924513617b846ae0 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 30 May 2023 05:43:00 -0400 Subject: [PATCH 0144/1171] tools/findutils: define list of installed programs Define the variable PKG_PROGRAMS for the list of programs installed by findutils, which will create a stampfile for each through a new feature in host-build.mk. Signed-off-by: Michael Pratt (cherry picked from commit 04053e3f2050b6ea2cdb83c0956034e5fd368d10) --- tools/findutils/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/findutils/Makefile b/tools/findutils/Makefile index ac1d5312c9da7a..fd0cde2145edea 100644 --- a/tools/findutils/Makefile +++ b/tools/findutils/Makefile @@ -14,6 +14,8 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) PKG_HASH:=a2bfb8c09d436770edc59f50fa483e785b161a3b7b9d547573cb08065fd462fe +PKG_PROGRAMS:=find locate updatedb xargs + HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk From 0928545f3b9f899b97b58bc86e1bd955ce08cde9 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 30 May 2023 05:22:54 -0400 Subject: [PATCH 0145/1171] tools/coreutils: rename list of installed programs Rename the list of programs installed by coreutils to PKG_PROGRAMS, which will create a stampfile for each through a new feature in host-build.mk. Also, cleanup a bit to save lines regarding the usage of this list. Signed-off-by: Michael Pratt (cherry picked from commit 14a85d929b4a0a728dc4390ad34dcf8d69ac3475) --- tools/coreutils/Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile index 233ab1585d75af..86302862060239 100644 --- a/tools/coreutils/Makefile +++ b/tools/coreutils/Makefile @@ -16,20 +16,18 @@ PKG_HASH:=adbcfcfe899235b71e8768dcf07cd532520b7f54f9a8064843f8d199a904bbaa HOST_BUILD_PARALLEL := 1 -BUILD_PROGRAMS = date readlink touch ln chown ginstall +PKG_PROGRAMS:=date readlink touch ln chown ginstall include $(INCLUDE_DIR)/host-build.mk export GNULIB_SRCDIR:=$(HOST_GNULIB_SRCDIR) -BUILD_BINS = $(patsubst %,src/%,$(BUILD_PROGRAMS)) - HOST_CONFIGURE_ARGS += \ - --enable-install-program=$(subst $(space),$(comma),$(strip $(BUILD_PROGRAMS))) + --enable-install-program=$(subst $(space),$(comma),$(strip $(PKG_PROGRAMS))) HOST_MAKE_FLAGS += \ $(AM_TOOL_PATHS_FAKE) \ - PROGRAMS="$(BUILD_BINS)" \ + PROGRAMS="$(patsubst %,src/%,$(PKG_PROGRAMS))" \ LIBRARIES= MANS= SUBDIRS=. define Host/Bootstrap @@ -58,7 +56,7 @@ endef define Host/Install $(INSTALL_DIR) $(1)/bin - $(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/%,$(BUILD_BINS)) $(1)/bin/ + $(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/src/%,$(PKG_PROGRAMS)) $(1)/bin/ ln -sf ginstall $(1)/bin/install endef From f8d26ece2550ebd66ae8934661ea737606ad862d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 30 May 2023 16:31:39 +0200 Subject: [PATCH 0146/1171] ipq807x: image: cleanup unused variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BLOCKSIZE and PAGESIZE seems to be unused on qnap_301w and zyxel_nbg7815 device which use eMMC storage. Signed-off-by: Petr Štetiar (cherry picked from commit fdea7cb61776192ddb808a639af0a585d5b01b5b) --- target/linux/ipq807x/image/generic.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index f4a872ce09ab41..d57099e5b4e904 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -102,7 +102,6 @@ define Device/qnap_301w DEVICE_MODEL := 301w DEVICE_DTS_CONFIG := config@hk01 KERNEL_SIZE := 16384k - BLOCKSIZE := 512k SOC := ipq8072 DEVICE_PACKAGES += ipq-wifi-qnap_301w endef @@ -159,8 +158,6 @@ define Device/zyxel_nbg7815 DEVICE_VENDOR := ZYXEL DEVICE_MODEL := NBG7815 DEVICE_DTS_CONFIG := config@nbg7815 - BLOCKSIZE := 128k - PAGESIZE := 2048 SOC := ipq8074 DEVICE_PACKAGES += ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci kmod-hwmon-tmp103 \ kmod-bluetooth From 793b9cddd219837ddf018b72c228e8232097bebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Nyk=C3=A4nen?= Date: Thu, 25 May 2023 09:43:46 +0300 Subject: [PATCH 0147/1171] ipq-wifi: bump to latest git HEAD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0f73d32 ipq8074: update RegDB in new submitted BDF a4cd21f ipq8074: add Compex WPQ873 BDF c888dd0 qca-wireless: ipq40xx: Add BDFs for Eero Cento 6388ba9 ipq8074: update regdb for Netgear SXK80 BDF 77775d2 ipq8074: add Netgear SXK80 Signed-off-by: Antti Nykänen (cherry picked from commit 86e7614e0deb5e97083103600b045833c6517c6b) --- package/firmware/ipq-wifi/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index b3bec858ef8967..afdb49b2e99b89 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2023-04-12 -PKG_SOURCE_VERSION:=b22487d729362feaff7d06354353d005a3a9d6b7 -PKG_MIRROR_HASH:=94eea9db636b2cbf6782ec17d8b8fe36770c61ff283702ec418df1a1b09f54ef +PKG_SOURCE_DATE:=2023-05-22 +PKG_SOURCE_VERSION:=0f73d32e641c4f17e64597da0e6c40ed3cbebe69 +PKG_MIRROR_HASH:=70bd8ecda004528ec74de078d00df792f92322c58c4ec4b0630d1da097a8bc89 PKG_FLAGS:=nonshared @@ -29,6 +29,7 @@ endef ALLWIFIBOARDS:= \ buffalo_wxr-5950ax12 \ + compex_wpq873 \ dynalink_dl-wrx36 \ edgecore_eap102 \ edimax_cax1800 \ @@ -113,6 +114,7 @@ endef # Add $(eval $(call generate-ipq-wifi-package,,)) $(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12)) +$(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873)) $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) From 7e6403a966939427693ca915b1d04f48520f4984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 5 Jun 2023 12:06:41 +0200 Subject: [PATCH 0148/1171] ipq-wifi: update to version 2023-06-03 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contains following updates: * ipq8074: update RegDB in new submitted BDF * Revert "ipq8074: update RegDB in new submitted BDF" * qcn9074: update RegDB in new submitted BDF * ipq8074: update RegDB in new submitted BDF * qca-wireless: ipq40xx: add BDFs for ZTE MF287+ * Add BDFs for prpl Foundation Haze board Signed-off-by: Petr Štetiar (cherry picked from commit c2bb9f055b252f167d58540bddb9e5e9586fa986) --- package/firmware/ipq-wifi/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index afdb49b2e99b89..0c6941050b0a43 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2023-05-22 -PKG_SOURCE_VERSION:=0f73d32e641c4f17e64597da0e6c40ed3cbebe69 -PKG_MIRROR_HASH:=70bd8ecda004528ec74de078d00df792f92322c58c4ec4b0630d1da097a8bc89 +PKG_SOURCE_DATE:=2023-06-03 +PKG_SOURCE_VERSION:=cd9c30ca47b8e5388b770c523a7f6b8b969e2f92 +PKG_MIRROR_HASH:=45e623fcc512b514ade0f22e217275536aa8de4afba7dfdb11696482b8fa71a2 PKG_FLAGS:=nonshared @@ -34,6 +34,7 @@ ALLWIFIBOARDS:= \ edgecore_eap102 \ edimax_cax1800 \ netgear_wax218 \ + prpl_haze \ qnap_301w \ redmi_ax6 \ wallys_dr40x9 \ @@ -120,6 +121,7 @@ $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218)) $(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w)) +$(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) From 41af35cf6b5eadaf0e380c867be3ee0427202775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 5 Jun 2023 12:13:04 +0200 Subject: [PATCH 0149/1171] ipq807x: add initial support for prpl Foundation Haze board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Haze is prpl Foundation's reference board (WNC LVRP). Board info: - IPQ8072A SoC - 2 GiB RAM - 4 GiB eMMC - 8MiB SPI NOR (MX25U6435F) - 3x 1GigE ports (QCA8075) - 1x 10GigE port (AQR113C) - 1x SFP cage - WiFi 6GHz 160MHz (QCN9074) - WiFi 5GHz 80+80MHz (QCN5054) - WiFi 2.4G (QCN5024) - ARM Standard 20-pin 2.54mm/0.1" JTAG (1V8 !!!) - Bluetooth v5.0 + EDR with integrated Class 1 PA (CYW20704) - 1x M.2 B-key socket with PCIe 3.0 - 1x USB 3.0 port - UART marked J6 is 4-pin 2.54mm/0.1" connector 3V3(arrow),RX,TX,GND (115200 8N1) - Reset and WPS buttons Flashing instructions: 1. From U-Boot boot OpenWrt using initramfs image: IPQ807x# tftpboot openwrt-ipq807x-generic-prpl_haze-initramfs-uImage.itb && bootm 2. In OpenWrt running from initramfs execute sysupgrade: root@OpenWrt:/# sysupgrade -n /tmp/openwrt-ipq807x-generic-prpl_haze-squashfs-sysupgrade.bin Work in progress/known issues: * SFP feature not implemented/tested * M.2 feature not implemented/tested * Bluetooth feature not implemented/tested * 6GHz wireless should be working, but not tested * MAC address assigments for LAN interfaces Signed-off-by: Petr Štetiar (cherry picked from commit 2e910039dd7170fd28641e7686c376dba6f0d8a5) --- package/boot/uboot-envtools/files/ipq807x | 5 + .../ipq807x/base-files/etc/board.d/02_network | 3 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 9 +- .../base-files/lib/upgrade/platform.sh | 1 + .../arch/arm64/boot/dts/qcom/ipq8072-haze.dts | 308 ++++++++++++++++++ target/linux/ipq807x/image/generic.mk | 11 + 6 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x index ca331f10322fb6..2064bfc6f2a404 100644 --- a/package/boot/uboot-envtools/files/ipq807x +++ b/package/boot/uboot-envtools/files/ipq807x @@ -35,6 +35,11 @@ xiaomi,ax9000) [ -n "$idx2" ] && \ ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000" ;; +prpl,haze) + mmcpart="$(find_mmc_part 0:APPSBLENV)" + [ -n "$mmcpart" ] && \ + ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100" + ;; qnap,301w) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network index 1da5c3ae1e203c..21364337fbbf42 100644 --- a/target/linux/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/ipq807x/base-files/etc/board.d/02_network @@ -25,6 +25,9 @@ ipq807x_setup_interfaces() netgear,wax218) ucidef_set_interface_lan "lan" "dhcp" ;; + prpl,haze) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ;; qnap,301w) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g-2" "10g-1" ;; diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index b3564fe9c6d128..13cb07477ef6d7 100644 --- a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -21,10 +21,17 @@ case "$FIRMWARE" in zyxel,nbg7815) caldata_extract "0:art" 0x1000 0x20000 ;; + prpl,haze) + caldata_extract_mmc "0:ART" 0x1000 0x20000 + ;; esac ;; -"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin") +"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin"|\ +"ath11k/QCN9074/hw1.0/cal-pci-0001:01:00.0.bin") case "$board" in + prpl,haze) + caldata_extract_mmc "0:ART" 0x26800 0x20000 + ;; xiaomi,ax9000) caldata_extract "0:art" 0x26800 0x20000 ;; diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh index 11717d6324dfb0..346cc390f3124e 100644 --- a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh @@ -70,6 +70,7 @@ platform_do_upgrade() { netgear,wax218) nand_do_upgrade "$1" ;; + prpl,haze|\ qnap,301w) kernelname="0:HLOS" rootfsname="rootfs" diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts new file mode 100644 index 00000000000000..8a5200b4ebf50e --- /dev/null +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts @@ -0,0 +1,308 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq8074.dtsi" +#include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include +#include + +/ { + model = "prpl Foundation Haze"; + compatible = "prpl,haze", "qcom,ipq8074"; + + aliases { + serial0 = &blsp1_uart5; + /* Aliases are required by U-Boot to patch MAC addresses */ + ethernet0 = &dp6_syn; + ethernet1 = &dp4; + ethernet2 = &dp3; + ethernet3 = &dp2; + label-mac-device = &dp6_syn; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + wps-button { + label = "wps"; + gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset-button { + label = "reset"; + gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&tlmm { + mdio_pins: mdio-state { + mdc-pins { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio-pins { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + button_pins: button-state { + wps-pins { + pins = "gpio42"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + + rst-pins { + pins = "gpio44"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&ssphy_1 { + status = "okay"; +}; + +&qusb_phy_1 { + status = "okay"; +}; + +&usb_0 { + status = "okay"; +}; + +&usb_1 { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&blsp1_spi1 { /* BLSP1 QUP1 */ + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + cs-gpios = <0>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <50000000>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>; + + qca8075_1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; + + qca8075_2: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_3: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_4: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + aqr113c: ethernet-phy@5 { + compatible ="ethernet-phy-ieee802.3-c45"; + reg = <8>; + reset-gpios = <&tlmm 43 GPIO_ACTIVE_LOW>; + }; +}; + +&sdhc_1 { + status = "okay"; + + vqmmc-supply = <&l11>; +}; + +&switch { + status = "okay"; + + switch_cpu_bmp = <0x1>; /* cpu port bitmap */ + switch_lan_bmp = <0x1e>; /* lan port bitmap */ + switch_wan_bmp = <0x60>; /* wan port bitmap */ + switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ + switch_mac_mode1 = <0xe>; /* mac mode for uniphy instance1*/ + switch_mac_mode2 = <0xd>; /* mac mode for uniphy instance2*/ + bm_tick_mode = <0>; /* bm tick mode */ + tm_tick_mode = <0>; /* tm tick mode */ + + qcom,port_phyinfo { + port@0 { + port_id = <1>; + phy_address = <0>; + }; + port@1 { + port_id = <2>; + phy_address = <1>; + }; + port@2 { + port_id = <3>; + phy_address = <2>; + }; + port@3 { + port_id = <4>; + phy_address = <3>; + }; + port@4 { + port_id = <6>; + phy_address = <8>; + compatible = "ethernet-phy-ieee802.3-c45"; + ethernet-phy-ieee802.3-c45; + }; + }; +}; + +&edma { + status = "okay"; +}; + +/* Dummy LAN port */ +&dp1 { + status = "disabled"; + phy-handle = <&qca8075_1>; + label = "lan4"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan3"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan1"; +}; + +&dp6_syn { + status = "okay"; + qcom,mactype = <1>; + phy-handle = <&aqr113c>; + label = "wan"; +}; + +&pcie_qmp0 { + status = "okay"; +}; + +&pcie0 { + status = "okay"; + + perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00020000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + }; +}; + +&pcie_qmp1 { + status = "okay"; +}; + +&pcie1 { + status = "okay"; + + perst-gpio = <&tlmm 61 GPIO_ACTIVE_LOW>; + + bridge@1,0 { + reg = <0x00010000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi@1,0 { + status = "okay"; + + /* ath11k has no DT compatible for PCI cards */ + compatible = "pci17cb,1104"; + reg = <0x00010000 0 0 0 0>; + + qcom,ath11k-calibration-variant = "prpl-Haze"; + }; + }; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "prpl-Haze"; +}; diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index d57099e5b4e904..6eca67d11c681e 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -95,6 +95,17 @@ define Device/netgear_wax218 endef TARGET_DEVICES += netgear_wax218 +define Device/prpl_haze + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := prpl Foundation + DEVICE_MODEL := Haze + DEVICE_DTS_CONFIG := config@hk09 + SOC := ipq8072 + DEVICE_PACKAGES += ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci +endef +TARGET_DEVICES += prpl_haze + define Device/qnap_301w $(call Device/FitImage) $(call Device/EmmcImage) From 1e7fa539ae6e94bfdb5d9e503f0c103e15b408a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 5 Jun 2023 14:10:44 +0200 Subject: [PATCH 0150/1171] ipq807x: image: fix eMMC flashing/recovery from within initramfs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having initramfs image built with same config as on buildbots: CONFIG_TARGET_MULTI_PROFILE=y CONFIG_TARGET_ALL_PROFILES=y CONFIG_TARGET_PER_DEVICE_ROOTFS=y Its currently impossible to flash/recover the device using that image as losetup is missing: root@OpenWrt:/# sysupgrade -v /tmp/openwrt-ipq807x-generic-prpl_haze-squashfs-sysupgrade.bin ... /lib/upgrade/do_stage2: line 38: losetup: not found Failed to detach all loop devices. Skip this try. So lets fix it by including the needed utils for sysupgrade in DEFAULT_PACKAGES set. Signed-off-by: Petr Štetiar (cherry picked from commit 07fe8bc62a866e78e131c3f63a08554a94e931f8) --- target/linux/ipq807x/Makefile | 3 ++- target/linux/ipq807x/image/generic.mk | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq807x/Makefile b/target/linux/ipq807x/Makefile index fdabf575d362c8..f423acd76c70d8 100644 --- a/target/linux/ipq807x/Makefile +++ b/target/linux/ipq807x/Makefile @@ -16,6 +16,7 @@ DEFAULT_PACKAGES += \ kmod-leds-gpio kmod-gpio-button-hotplug \ kmod-phy-aquantia kmod-qca-nss-dp \ ath11k-firmware-ipq8074 kmod-ath11k-ahb \ - wpad-basic-mbedtls uboot-envtools + wpad-basic-mbedtls uboot-envtools \ + e2fsprogs kmod-fs-ext4 losetup $(eval $(call BuildTarget)) diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index 6eca67d11c681e..124cdfc3b2a54e 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -14,7 +14,6 @@ define Device/EmmcImage IMAGES += factory.bin sysupgrade.bin IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata - DEVICE_PACKAGES := e2fsprogs kmod-fs-ext4 losetup endef define Device/UbiFit From 7c223a881f93cb5e8e68fe8b92693b48d4609002 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 19 Jan 2022 02:25:23 +0000 Subject: [PATCH 0151/1171] armvirt: add EFI support EFI booting is used on newer machines compatible with the Arm SystemReady specifications. This commit restructures armvirt into a more 'generic' target similar to x86. See https://github.com/openwrt/openwrt/pull/4956 for a history of this port. Signed-off-by: Mathew McBride (23.05 version of e0f06ddc23b2503a1791ae7e97b02e2647e8a70d) --- target/linux/armvirt/32/config-5.15 | 2 + target/linux/armvirt/32/target.mk | 2 +- target/linux/armvirt/64/target.mk | 4 +- target/linux/armvirt/Makefile | 5 +- .../armvirt/base-files/etc/board.d/01_led | 19 ++ .../armvirt/base-files/etc/board.d/02_network | 18 ++ .../base-files/etc/board.d/03_gpio_switches | 23 +++ .../base-files/lib/preinit/01_sysinfo_acpi | 52 ++++++ .../base-files/lib/upgrade/platform.sh | 164 ++++++++++++++++++ target/linux/armvirt/image/Makefile | 109 ++++++++++-- target/linux/armvirt/image/grub-efi.cfg | 14 ++ 11 files changed, 393 insertions(+), 19 deletions(-) create mode 100644 target/linux/armvirt/base-files/etc/board.d/01_led create mode 100644 target/linux/armvirt/base-files/etc/board.d/02_network create mode 100644 target/linux/armvirt/base-files/etc/board.d/03_gpio_switches create mode 100644 target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi create mode 100644 target/linux/armvirt/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/armvirt/image/grub-efi.cfg diff --git a/target/linux/armvirt/32/config-5.15 b/target/linux/armvirt/32/config-5.15 index 91a0c61ddd4965..f3247545e00bcd 100644 --- a/target/linux/armvirt/32/config-5.15 +++ b/target/linux/armvirt/32/config-5.15 @@ -4,6 +4,7 @@ CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y CONFIG_ARCH_MULTIPLATFORM=y CONFIG_ARCH_MULTI_V6_V7=y CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_MMAP_RND_BITS=8 CONFIG_ARCH_NR_GPIO=0 CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y @@ -14,6 +15,7 @@ CONFIG_ARM_CPU_SUSPEND=y CONFIG_ARM_CRYPTO=y CONFIG_ARM_HAS_SG_CHAIN=y CONFIG_ARM_HEAVY_MB=y +# CONFIG_ARM_HIGHBANK_CPUIDLE is not set CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_ARM_L1_CACHE_SHIFT_6=y CONFIG_ARM_LPAE=y diff --git a/target/linux/armvirt/32/target.mk b/target/linux/armvirt/32/target.mk index 8d42a14b7cf57c..df220402411cfd 100644 --- a/target/linux/armvirt/32/target.mk +++ b/target/linux/armvirt/32/target.mk @@ -1,6 +1,6 @@ ARCH:=arm SUBTARGET:=32 -BOARDNAME:=QEMU ARM Virtual Machine (cortex-a15) +BOARDNAME:=32-bit ARM QEMU Virtual Machine CPU_TYPE:=cortex-a15 CPU_SUBTYPE:=neon-vfpv4 KERNELNAME:=zImage diff --git a/target/linux/armvirt/64/target.mk b/target/linux/armvirt/64/target.mk index 58adcc7d602389..ac5a60d848b858 100644 --- a/target/linux/armvirt/64/target.mk +++ b/target/linux/armvirt/64/target.mk @@ -1,8 +1,6 @@ ARCH:=aarch64 SUBTARGET:=64 -BOARDNAME:=QEMU ARMv8 Virtual Machine (cortex-a53) -CPU_TYPE:=cortex-a53 -KERNELNAME:=Image +BOARDNAME:=64-bit ARM machines define Target/Description Build multi-platform images for the ARMv8 instruction set architecture diff --git a/target/linux/armvirt/Makefile b/target/linux/armvirt/Makefile index 73913f4a5b7b68..34e032fe9ed8e4 100644 --- a/target/linux/armvirt/Makefile +++ b/target/linux/armvirt/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk BOARD:=armvirt BOARDNAME:=QEMU ARM Virtual Machine -FEATURES:=fpu pci rtc usb +FEATURES:=fpu pci pcie rtc usb boot-part rootfs-part FEATURES+=cpiogz ext4 ramdisk squashfs targz KERNEL_PATCHVER:=5.15 @@ -14,5 +14,8 @@ KERNEL_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += mkf2fs e2fsprogs +# blkid used for resolving PARTUUID +# in sysupgrade +DEFAULT_PACKAGES += blkid $(eval $(call BuildTarget)) diff --git a/target/linux/armvirt/base-files/etc/board.d/01_led b/target/linux/armvirt/base-files/etc/board.d/01_led new file mode 100644 index 00000000000000..0250a9672f5e5c --- /dev/null +++ b/target/linux/armvirt/base-files/etc/board.d/01_led @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +traverse,ten64) + ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx" + ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/armvirt/base-files/etc/board.d/02_network b/target/linux/armvirt/base-files/etc/board.d/02_network new file mode 100644 index 00000000000000..f58de1c27d3986 --- /dev/null +++ b/target/linux/armvirt/base-files/etc/board.d/02_network @@ -0,0 +1,18 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/system.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + traverse,ten64) + ucidef_set_interface_lan "eth0 eth1 eth2 eth3" + ucidef_set_interface_wan "eth6" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/armvirt/base-files/etc/board.d/03_gpio_switches b/target/linux/armvirt/base-files/etc/board.d/03_gpio_switches new file mode 100644 index 00000000000000..cf07bc0f54fbc0 --- /dev/null +++ b/target/linux/armvirt/base-files/etc/board.d/03_gpio_switches @@ -0,0 +1,23 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +traverse,ten64) + ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376" + ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377" + ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "378" + ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "379" + ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "369" + ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "373" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi b/target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi new file mode 100644 index 00000000000000..1069d74cf3e3cb --- /dev/null +++ b/target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +sanitize_name_arm64() { + sed -e ' + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; + s/[^a-z0-9_-]\+/-/g; + s/^-//; + s/-$//; + ' "$@" +} + +do_sysinfo_arm64() { + local vendor product file + + for file in sys_vendor board_vendor; do + vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" + case "$vendor" in + empty | \ + System\ manufacturer | \ + To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) + continue + ;; + esac + [ -n "$vendor" ] && break + done + + for file in product_name board_name; do + product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" + case "$vendor:$product" in + ?*:empty | \ + ?*:System\ Product\ Name | \ + ?*:To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) + continue + ;; + ?*:?*) + break + ;; + esac + done + + [ -d "/sys/firmware/devicetree/base" ] && return + + [ -n "$vendor" -a -n "$product" ] || return + + mkdir -p /tmp/sysinfo + + echo "$vendor $product" > /tmp/sysinfo/model + + sanitize_name_arm64 /tmp/sysinfo/model > /tmp/sysinfo/board_name +} + +boot_hook_add preinit_main do_sysinfo_arm64 diff --git a/target/linux/armvirt/base-files/lib/upgrade/platform.sh b/target/linux/armvirt/base-files/lib/upgrade/platform.sh new file mode 100644 index 00000000000000..8263b9c7e3aa4d --- /dev/null +++ b/target/linux/armvirt/base-files/lib/upgrade/platform.sh @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +RAMFS_COPY_BIN="/usr/sbin/blkid" + +platform_check_image() { + local board=$(board_name) + local diskdev partdev diff + [ "$#" -gt 1 ] && return 1 + + v "Board is ${board}" + + export_bootdevice && export_partdevice diskdev 0 || { + v "platform_check_image: Unable to determine upgrade device" + return 1 + } + + get_partitions "/dev/$diskdev" bootdisk + + v "Extract boot sector from the image" + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + + rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image + + if [ -n "$diff" ]; then + v "Partition layout has changed. Full image will be written." + ask_bool 0 "Abort" && exit 1 + return 0 + fi +} + +platform_copy_config() { + local partdev parttype=ext4 + + if export_partdevice partdev 2; then + mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt + cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" + umount /mnt + else + v "ERROR: Unable to find partition to copy config data to" + fi + + sleep 5 +} + +# To avoid writing over any firmware +# files (e.g ubootefi.var or firmware/X/ aka EBBR) +# Copy efi/openwrt and efi/boot from the new image +# to the existing ESP +platform_do_upgrade_efi_system_partition() { + local image_file=$1 + local target_partdev=$2 + local image_efisp_start=$3 + local image_efisp_size=$4 + + v "Updating ESP on ${target_partdev}" + NEW_ESP_DIR="/mnt/new_esp_loop" + CUR_ESP_DIR="/mnt/cur_esp" + mkdir "${NEW_ESP_DIR}" + mkdir "${CUR_ESP_DIR}" + + get_image_dd "$image_file" of="/tmp/new_efi_sys_part.img" \ + skip="$image_efisp_start" count="$image_efisp_size" + + mount -t vfat -o loop -o ro /tmp/new_efi_sys_part.img "${NEW_ESP_DIR}" + if [ ! -d "${NEW_ESP_DIR}/efi/boot" ]; then + v "ERROR: Image does not contain EFI boot files (/efi/boot)" + return 1 + fi + + mount -t vfat "/dev/$partdev" "${CUR_ESP_DIR}" + + for d in $(find "${NEW_ESP_DIR}/efi/" -mindepth 1 -maxdepth 1 -type d); do + v "Copying ${d}" + newdir_bname=$(basename "${d}") + rm -rf "${CUR_ESP_DIR}/efi/${newdir_bname}" + cp -r "${d}" "${CUR_ESP_DIR}/efi" + done + + umount "${NEW_ESP_DIR}" + umount "${CUR_ESP_DIR}" +} + +platform_do_upgrade() { + local board=$(board_name) + local diskdev partdev diff + + export_bootdevice && export_partdevice diskdev 0 || { + v "platform_do_upgrade: Unable to determine upgrade device" + return 1 + } + + sync + + if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then + get_partitions "/dev/$diskdev" bootdisk + + v "Extract boot sector from the image" + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + else + diff=1 + fi + + # Only change the partition table if sysupgrade -p is set, + # otherwise doing so could interfere with embedded "single storage" + # (e.g SoC boot from SD card) setups, as well as other user + # created storage (like uvol) + if [ -n "$diff" ] && [ "${UPGRADE_OPT_SAVE_PARTITIONS}" = "0" ]; then + # Need to remove partitions before dd, otherwise the partitions + # that are added after will have minor numbers offset + partx -d - "/dev/$diskdev" + + get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync + + # Separate removal and addtion is necessary; otherwise, partition 1 + # will be missing if it overlaps with the old partition 2 + partx -a - "/dev/$diskdev" + + return 0 + fi + + #iterate over each partition from the image and write it to the boot disk + while read part start size; do + if export_partdevice partdev $part; then + v "Writing image to /dev/$partdev..." + if [ "$part" = "1" ]; then + platform_do_upgrade_efi_system_partition \ + $1 $partdev $start $size || return 1 + else + v "Normal partition, doing DD" + get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" \ + count="$size" conv=fsync + fi + else + v "Unable to find partition $part device, skipped." + fi + done < /tmp/partmap.image + + local parttype=ext4 + + if (blkid > /dev/null) && export_partdevice partdev 1; then + part_magic_fat "/dev/$partdev" && parttype=vfat + mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt + if export_partdevice partdev 2; then + THIS_PART_BLKID=$(blkid -o value -s PARTUUID "/dev/${partdev}") + v "Setting rootfs PARTUUID=${THIS_PART_BLKID}" + sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1${THIS_PART_BLKID}/ig" \ + /mnt/efi/openwrt/grub.cfg + fi + umount /mnt + fi + # Provide time for the storage medium to flush before system reset + # (despite the sync/umount it appears NVMe etc. do it in the background) + sleep 5 +} diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index 5f9ef21d658beb..bd75f85996d72b 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -5,28 +5,109 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -define Image/BuildKernel - $(foreach k,$(filter zImage Image,$(KERNELNAME)), \ - cp $(KDIR)/$(KERNELNAME) $(BIN_DIR)/$(IMG_PREFIX)-$(k) \ +GRUB2_VARIANT = +GRUB_TERMINALS = +GRUB_SERIAL_CONFIG = +GRUB_TERMINAL_CONFIG = +GRUB_CONSOLE_CMDLINE = earlycon + +ifneq ($(CONFIG_GRUB_CONSOLE),) + GRUB_TERMINALS += console +endif + +GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL)) + +ifneq ($(GRUB_SERIAL),) + GRUB_SERIAL_CONFIG := serial --unit=0 --speed=$(CONFIG_GRUB_BAUDRATE) --word=8 --parity=no --stop=1 --rtscts=$(if $(CONFIG_GRUB_FLOWCONTROL),on,off) + GRUB_TERMINALS += serial +endif + +ifneq ($(GRUB_TERMINALS),) + GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS) +endif + +ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) +ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(IMG_PART_SIGNATURE)-02) +GPT_ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) +GPT_ROOTPART:=$(if $(GPT_ROOTPART),$(GPT_ROOTPART),PARTUUID=$(shell echo $(IMG_PART_DISKGUID) | sed 's/00$$/02/')) + +GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT)) +GRUB_TITLE:=$(call qstrip,$(CONFIG_GRUB_TITLE)) + +BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS)) + +define Build/combined + $(INSTALL_DIR) $@.boot/ + $(CP) $(KDIR)/$(KERNEL_NAME) $@.boot/efi/openwrt/ + -$(CP) $(STAGING_DIR_ROOT)/boot/. $@.boot/boot/ + $(if $(filter $(1),efi), + $(INSTALL_DIR) $@.boot/efi/boot + $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/openwrt/ + $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/boot/ ) + FAT_TYPE="32" PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \ + $(if $(filter $(1),efi),GUID="$(IMG_PART_DISKGUID)") $(SCRIPT_DIR)/gen_image_generic.sh \ + $@ \ + $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \ + 256 endef -define Image/Build/Initramfs - $(foreach k,$(filter zImage Image,$(KERNELNAME)), \ - cp $(KDIR)/$(k)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(k)-initramfs \ - ) +define Build/grub-config + rm -fR $@.boot + $(INSTALL_DIR) $@.boot/efi/openwrt/ + sed \ + -e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \ + -e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \ + -e 's#@ROOTPART@#root=$(ROOTPART) rootwait#g' \ + -e 's#@GPT_ROOTPART@#root=$(GPT_ROOTPART) rootwait#g' \ + -e 's#@CMDLINE@#$(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE)#g' \ + -e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \ + -e 's#@TITLE@#$(GRUB_TITLE)#g' \ + -e 's#@KERNEL_NAME@#$(KERNEL_NAME)#g' \ + ./grub-$(1).cfg > $@.boot/efi/openwrt/grub.cfg endef -define Image/Build/gzip - gzip -f9n $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img +define Build/grub-install + rm -fR $@.grub2 + $(INSTALL_DIR) $@.grub2 endef -$(eval $(call Image/gzip-ext4-padded-squashfs)) +DEVICE_VARS += GRUB2_VARIANT +define Device/efi-default + IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE) + IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip + IMAGE/combined.img := grub-config efi | combined efi | grub-install efi | append-metadata + IMAGE/combined.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata + IMAGE/combined.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk + ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y) + IMAGES-y := rootfs.img.gz + IMAGES-y += combined.img.gz + else + IMAGES-y := rootfs.img + IMAGES-y += combined.img + endif + ifeq ($(CONFIG_VMDK_IMAGES),y) + IMAGES-y += combined.vmdk + endif + KERNEL := kernel-bin + KERNEL_INSTALL := 1 + IMAGES := $$(IMAGES-y) + ARTIFACTS := $$(ARTIFACTS-y) + SUPPORTED_DEVICES := + ifeq ($(CONFIG_arm),y) + KERNEL_NAME = zImage + endif +endef -define Image/Build - $(call Image/Build/$(1)) - $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img - $(call Image/Build/gzip/$(1)) +define Device/generic + $(call Device/efi-default) + DEVICE_TITLE := Generic EFI Boot + GRUB2_VARIANT := generic + FILESYSTEMS := ext4 squashfs + DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ + kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils endef +TARGET_DEVICES += generic $(eval $(call BuildImage)) diff --git a/target/linux/armvirt/image/grub-efi.cfg b/target/linux/armvirt/image/grub-efi.cfg new file mode 100644 index 00000000000000..fd329e41e0ff2d --- /dev/null +++ b/target/linux/armvirt/image/grub-efi.cfg @@ -0,0 +1,14 @@ +@SERIAL_CONFIG@ +@TERMINAL_CONFIG@ + +set default="0" +set timeout="@TIMEOUT@" + +menuentry "@TITLE@" { + search --set=root --label kernel + linux /efi/openwrt/@KERNEL_NAME@ @GPT_ROOTPART@ @CMDLINE@ noinitrd +} +menuentry "@TITLE@ (failsafe)" { + search --set=root --label kernel + linux /efi/openwrt/@KERNEL_NAME@ failsafe=true @GPT_ROOTPART@ @CMDLINE@ noinitrd +} From 3f72d24a04f28c3e7bdf625dc4a9d6771ff0a2dd Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 28 Sep 2022 15:47:30 +1000 Subject: [PATCH 0152/1171] armvirt: disable LD dead code elimination on ARM32 This interferes with the generation of the EFI stub section for ARM32. As this target is not size constrained, disable the dead code data elimination hack. Signed-off-by: Mathew McBride (23.05 version of eb0e61285d4da910317e082de559337a305fa1dc) --- .../221-armvirt-disable-gc_sections.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 target/linux/armvirt/patches-5.15/221-armvirt-disable-gc_sections.patch diff --git a/target/linux/armvirt/patches-5.15/221-armvirt-disable-gc_sections.patch b/target/linux/armvirt/patches-5.15/221-armvirt-disable-gc_sections.patch new file mode 100644 index 00000000000000..ac90a6698d253a --- /dev/null +++ b/target/linux/armvirt/patches-5.15/221-armvirt-disable-gc_sections.patch @@ -0,0 +1,23 @@ +From b77c0ecdc7915e5c5c515da1aa6cfaf6f4eb8351 Mon Sep 17 00:00:00 2001 +From: Mathew McBride +Date: Wed, 28 Sep 2022 16:39:31 +1000 +Subject: [PATCH] arm: disable code size reduction measures + (gc-sections,-f*-sections) + +This interferes with the EFI boot stub on armv7l. + +Signed-off-by: Mathew McBride +--- + arch/arm/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -117,7 +117,6 @@ config ARM + select HAVE_UID16 + select HAVE_VIRT_CPU_ACCOUNTING_GEN + select IRQ_FORCED_THREADING +- select HAVE_LD_DEAD_CODE_DATA_ELIMINATION + select MODULES_USE_ELF_REL + select NEED_DMA_MAP_STATE + select OF_EARLY_FLATTREE if OF From 649d3a75e2d29a999aabb80d9a4d63cc4cfb7c56 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 19 Jan 2022 03:24:45 +0000 Subject: [PATCH 0153/1171] armvirt: update README with new image names The introduction of EFI support has changed how armvirt images are generated. The kernel and filesystem binaries can still be used as before with QEMU directly. Signed-off-by: Mathew McBride (cherry picked from commit 97c5d317f59e071c9f691add5748a74a75665038) --- target/linux/armvirt/README | 48 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/target/linux/armvirt/README b/target/linux/armvirt/README index b870fe19f7c052..b4409f8f1135f6 100644 --- a/target/linux/armvirt/README +++ b/target/linux/armvirt/README @@ -1,21 +1,23 @@ -This is intended to be used with OpenWrt project to provide image for use with -QEMU ARM virt machine. +This target generates images that can be used on ARM machines with EFI +support (e.g EDKII/TianoCore or U-Boot with bootefi). + +The kernel and filesystem images can also be used directly by QEMU: Run with qemu-system-arm # boot with initramfs embedded in - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-zImage-initramfs + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-initramfs-kernel.bin # boot with accel=kvm qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel - openwrt-armvirt-32-zImage-initramfs + openwrt-armvirt-32-generic-initramfs-kernel.bin # boot with a separate rootfs - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-zImage \ - -drive file=openwrt-armvirt-32-root.ext4,format=raw,if=virtio -append 'root=/dev/vda rootwait' + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \ + -drive file=openwrt-armvirt-32-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait' # boot with local dir as rootfs - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-zImage \ + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \ -fsdev local,id=rootdev,path=root-armvirt/,security_model=none \ -device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \ -append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p' @@ -37,4 +39,34 @@ Run with kvmtool The multi-platform ARMv8 target can be used with QEMU: qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \ - -kernel openwrt-armvirt-64-Image-initramfs \ + -kernel openwrt-armvirt-64-generic-initramfs-kernel.bin \ + +With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use these +images in EFI mode: + +32-bit: +gunzip -c bin/targets/armvirt/32/openwrt-armvirt-32-generic-ext4-combined.img.gz > openwrt-arm-32.img +qemu-system-arm -nographic \ + -cpu cortex-a15 -machine virt \ + -bios QEMU_EFI_32.fd \ + -smp 1 -m 1024 \ + -device virtio-rng-pci \ + -drive file=openwrt-arm-32.img,format=raw,index=0,media=disk \ + -netdev user,id=testlan -net nic,netdev=testlan \ + -netdev user,id=testwan -net nic,netdev=testwan + +64-bit: +gunzip -c bin/targets/armvirt/64/openwrt-armvirt-64-generic-ext4-combined.img.gz > openwrt-arm-64.img +qemu-system-aarch64 -nographic \ + -cpu cortex-a53 -machine virt \ + -bios QEMU_EFI_64.fd \ + -smp 1 -m 1024 \ + -device virtio-rng-pci \ + -drive file=openwrt-arm-64.img,format=raw,index=0,media=disk \ + -netdev user,id=testlan -net nic,netdev=testlan \ + -netdev user,id=testwan -net nic,netdev=testwan + +One can find EFI/BIOS binaries from: +- Compile mainline U-Boot for the QEMU ARM virtual machine (qemu_arm_defconfig/qemu_arm64_defconfig) +- From distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian) +- Community builds, like retrage/edk2-nightly: https://retrage.github.io/edk2-nightly/ From f48985861a26f175682e49ce87e6d5b674a22d1a Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 24 Feb 2021 04:53:40 +0000 Subject: [PATCH 0154/1171] grub2: enable EFI for armvirt This adds a separate package for EFI on Arm SystemReady compatible machines. 32-bit Arm UEFI is supported as well. It is very similar to x86-64 EFI setup, without the need for BIOS backward compatibility and slightly different default modules. Signed-off-by: Mathew McBride (cherry picked from commit 8f29b1573ddf3b7ed7c53bee1a7d55e574806205) --- config/Config-images.in | 9 ++--- package/boot/grub2/Makefile | 40 +++++++++++++++++---- package/boot/grub2/files/grub-early-gpt.cfg | 2 ++ 3 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 package/boot/grub2/files/grub-early-gpt.cfg diff --git a/config/Config-images.in b/config/Config-images.in index 8c4616f37caeb8..cbf1e9f26d6307 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -204,11 +204,12 @@ menu "Target Images" config GRUB_EFI_IMAGES bool "Build GRUB EFI images (Linux x86 or x86_64 host only)" - depends on TARGET_x86 + depends on TARGET_x86 || TARGET_armvirt depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS - select PACKAGE_grub2 - select PACKAGE_grub2-efi - select PACKAGE_grub2-bios-setup + select PACKAGE_grub2 if TARGET_x86 + select PACKAGE_grub2-efi if TARGET_x86 + select PACKAGE_grub2-bios-setup if TARGET_x86 + select PACKAGE_grub2-efi-arm if TARGET_armvirt select PACKAGE_kmod-fs-vfat default y diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index 0613f46f995eb5..50bf96360d645f 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -33,14 +33,15 @@ include $(INCLUDE_DIR)/package.mk define Package/grub2/Default CATEGORY:=Boot Loaders SECTION:=boot - TITLE:=GRand Unified Bootloader ($(1)) + TITLE:=GRand Unified Bootloader ($(2)) URL:=http://www.gnu.org/software/grub/ - DEPENDS:=@TARGET_x86 - VARIANT:=$(1) + DEPENDS:=@TARGET_$(1) + VARIANT:=$(2) endef -Package/grub2=$(call Package/grub2/Default,pc) -Package/grub2-efi=$(call Package/grub2/Default,efi) +Package/grub2=$(call Package/grub2/Default,x86,pc) +Package/grub2-efi=$(call Package/grub2/Default,x86,efi) +Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi) define Package/grub2-editenv CATEGORY:=Utilities @@ -107,6 +108,10 @@ ifneq ($(BUILD_VARIANT),none) MAKE_PATH := grub-core endif +ifeq ($(CONFIG_arm),y) + TARGET_CFLAGS := $(filter-out -mfloat-abi=hard,$(TARGET_CFLAGS)) +endif + define Host/Configure $(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in $(Host/Configure/Default) @@ -162,9 +167,31 @@ define Package/grub2-efi/install -O $(CONFIG_ARCH)-efi \ -c ./files/grub-early.cfg \ -o $(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \ - at_keyboard boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga + boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga endef +define Package/grub2-efi-arm/install + $(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2 + cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg + $(STAGING_DIR_HOST)/bin/grub-mkimage \ + -d $(PKG_BUILD_DIR)/grub-core \ + -p /boot/grub \ + -O arm$(if $(CONFIG_aarch64),64,)-efi \ + -c $(PKG_BUILD_DIR)/grub-early.cfg \ + -o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi \ + boot chain configfile fat linux ls part_gpt part_msdos reboot search \ + search_fs_uuid search_label serial efi_gop lsefi minicmd ext2 + $(STAGING_DIR_HOST)/bin/grub-mkimage \ + -d $(PKG_BUILD_DIR)/grub-core \ + -p /boot/grub \ + -O arm$(if $(CONFIG_aarch64),64,)-efi \ + -c ./files/grub-early.cfg \ + -o $(STAGING_DIR_IMAGE)/grub2/iso-bootaa$(if $(CONFIG_aarch64),aa64,arm).efi \ + boot chain configfile fat iso9660 linux ls lsefi minicmd part_msdos part_gpt \ + reboot serial test efi_gop +endef + + define Package/grub2-editenv/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/ @@ -178,5 +205,6 @@ endef $(eval $(call HostBuild)) $(eval $(call BuildPackage,grub2)) $(eval $(call BuildPackage,grub2-efi)) +$(eval $(call BuildPackage,grub2-efi-arm)) $(eval $(call BuildPackage,grub2-editenv)) $(eval $(call BuildPackage,grub2-bios-setup)) diff --git a/package/boot/grub2/files/grub-early-gpt.cfg b/package/boot/grub2/files/grub-early-gpt.cfg new file mode 100644 index 00000000000000..c295d1f7d775ec --- /dev/null +++ b/package/boot/grub2/files/grub-early-gpt.cfg @@ -0,0 +1,2 @@ +search --set=root --label kernel +configfile ($root)/efi/openwrt/grub.cfg From ddb8845bd6be37e6126a4a56c071dd9fc3b3695a Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Thu, 20 Apr 2023 06:36:50 +0000 Subject: [PATCH 0155/1171] scripts: gen_image_generic: allow the partition types to be set The use case for this is to set the kernel partition as the EFI system partition. Versions of U-Boot with the EFI boot manager (eficonfig and efidebug commands) will store their boot order data on the ESP. Signed-off-by: Mathew McBride (cherry picked from commit 701d774f54aef2f9fe3c584700773dcb260dd03c) --- scripts/gen_image_generic.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/gen_image_generic.sh b/scripts/gen_image_generic.sh index 5c88dcea80c79e..11e40f38868f8e 100755 --- a/scripts/gen_image_generic.sh +++ b/scripts/gen_image_generic.sh @@ -9,8 +9,10 @@ fi OUTPUT="$1" KERNELSIZE="$2" KERNELDIR="$3" +KERNELPARTTYPE=${KERNELPARTTYPE:-83} ROOTFSSIZE="$4" ROOTFSIMAGE="$5" +ROOTFSPARTTYPE=${ROOTFSPARTTYPE:-83} ALIGN="$6" rm -f "$OUTPUT" @@ -19,7 +21,7 @@ head=16 sect=63 # create partition table -set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -p "${KERNELSIZE}m${PARTOFFSET:+@$PARTOFFSET}" -p "${ROOTFSSIZE}m" ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID}) +set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -t "${KERNELPARTTYPE}" -p "${KERNELSIZE}m${PARTOFFSET:+@$PARTOFFSET}" -t "${ROOTFSPARTTYPE}" -p "${ROOTFSSIZE}m" ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID}) KERNELOFFSET="$(($1 / 512))" KERNELSIZE="$2" From 84f566b00c1745797e3d3ab66311306a5c27b50f Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Thu, 20 Apr 2023 06:38:22 +0000 Subject: [PATCH 0156/1171] armvirt: set kernel partition as the EFI system partition U-Boot with EFI boot manager functionality will store EFI boot order data on the ESP in the ubootefi.var file. Signed-off-by: Mathew McBride (cherry picked from commit 9a76b99c1bd781248c18d69abe570f35932db8a3) --- target/linux/armvirt/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index bd75f85996d72b..50c993b5225d6f 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -45,7 +45,7 @@ define Build/combined $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/openwrt/ $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/boot/ ) - FAT_TYPE="32" PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \ + KERNELPARTTYPE=ef FAT_TYPE="32" PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \ $(if $(filter $(1),efi),GUID="$(IMG_PART_DISKGUID)") $(SCRIPT_DIR)/gen_image_generic.sh \ $@ \ $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \ From b0e724e49c110d1f36e475186ad945da70829817 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 24 Jan 2022 23:16:56 +0000 Subject: [PATCH 0157/1171] armvirt: remove model name override Now that armvirt has been expanded to boot on more generic ARM machines, remove the board and model name override. Signed-off-by: Mathew McBride (cherry picked from commit 3d99314569a059a1d5e015086e534b3e04ff2097) --- .../linux/armvirt/base-files/etc/board.d/00_model | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 target/linux/armvirt/base-files/etc/board.d/00_model diff --git a/target/linux/armvirt/base-files/etc/board.d/00_model b/target/linux/armvirt/base-files/etc/board.d/00_model deleted file mode 100644 index bfaa45f59cca6d..00000000000000 --- a/target/linux/armvirt/base-files/etc/board.d/00_model +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2015 OpenWrt.org -# Copyright (C) 2016 Yousong Zhou - -. /lib/functions/uci-defaults.sh - -board_config_update - -ucidef_set_board_id "armvirt" -ucidef_set_model_name "QEMU ARM Virtual Machine" - -board_config_flush - -exit 0 From 04d2f8f11fc4c1809c297b5b90fddbad98ce905d Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 1 Jun 2021 01:48:25 +0000 Subject: [PATCH 0158/1171] build: use 128MiB as the boot/kernel partition size on armvirt target The nominal partition type for EFI boot partitions is FAT32, which has a minimum size of 32MiB on a 512-byte-sector block device. To ensure that the boot partition is created as FAT32 set a size well above this minimum. A useful discussion about EFI partition sizes can be found here: https://superuser.com/questions/1310927/what-is-the-absolute-minimum-size-a-uefi-system-partition-can-be I have found 128MiB works pretty consistently across both tools (mkfs.fat) and firmwares (EDKII) Signed-off-by: Mathew McBride (cherry picked from commit 71e56b2ff1e8aeb3205784c0b5f8ca6ba0fbbf63) --- config/Config-images.in | 1 + 1 file changed, 1 insertion(+) diff --git a/config/Config-images.in b/config/Config-images.in index cbf1e9f26d6307..396f1dd3e3d1e7 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -292,6 +292,7 @@ menu "Target Images" depends on USES_BOOT_PART default 8 if TARGET_apm821xx_sata default 64 if TARGET_bcm27xx + default 128 if TARGET_armvirt default 16 config TARGET_ROOTFS_PARTSIZE From 0bedcbb9ffd10158760dc3b57e6650ffaa562f26 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 12 Jan 2022 05:53:55 +0000 Subject: [PATCH 0159/1171] build: enable vmdk/vmware images for arm64 target This is useful for VMware's ARM64 products, e.g Fusion for M1/ARM Macs. Signed-off-by: Mathew McBride (cherry picked from commit f899e0e024825861e129b0e8fbfb31c1d614273a) --- config/Config-images.in | 2 +- target/linux/armvirt/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/Config-images.in b/config/Config-images.in index 396f1dd3e3d1e7..d92c31ec5fcefa 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -267,7 +267,7 @@ menu "Target Images" config VMDK_IMAGES bool "Build VMware image files (VMDK)" - depends on TARGET_x86 + depends on TARGET_x86 || TARGET_armvirt depends on GRUB_IMAGES || GRUB_EFI_IMAGES select PACKAGE_kmod-e1000 diff --git a/target/linux/armvirt/Makefile b/target/linux/armvirt/Makefile index 34e032fe9ed8e4..04ff914b96e33a 100644 --- a/target/linux/armvirt/Makefile +++ b/target/linux/armvirt/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk BOARD:=armvirt BOARDNAME:=QEMU ARM Virtual Machine FEATURES:=fpu pci pcie rtc usb boot-part rootfs-part -FEATURES+=cpiogz ext4 ramdisk squashfs targz +FEATURES+=cpiogz ext4 ramdisk squashfs targz vmdk KERNEL_PATCHVER:=5.15 From 23ca9a1677635548281bc25acb43a904427a105d Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Thu, 9 Jun 2022 04:51:59 +0000 Subject: [PATCH 0160/1171] armvirt: add ACPI support ACPI support is required for Arm 'SystemReady' server and workstation systems (and as an option on embedded platforms). These config changes allow OpenWrt to boot in a QEMU virtual machine with a UEFI/EDKII 'BIOS', but with no other hardware enabled yet. Signed-off-by: Mathew McBride (23.05/5.15 version of cb3bbbf00cfb465de3333e4b84e8da9138985595) --- target/linux/armvirt/64/config-5.15 | 4 +- target/linux/armvirt/config-5.15 | 137 ++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 1 deletion(-) diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armvirt/64/config-5.15 index eb5405eb1ef961..66be848f8a8432 100644 --- a/target/linux/armvirt/64/config-5.15 +++ b/target/linux/armvirt/64/config-5.15 @@ -102,6 +102,7 @@ CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y CONFIG_HDMI=y +# CONFIG_HISI_PMU is not set CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y CONFIG_HW_RANDOM_VIRTIO=y @@ -142,6 +143,8 @@ CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +# CONFIG_SPI_HISI_KUNPENG is not set +# CONFIG_SPI_HISI_SFC_V3XX is not set CONFIG_SYNC_FILE=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_THREAD_INFO_IN_TASK=y @@ -150,5 +153,4 @@ CONFIG_VEXPRESS_CONFIG=y CONFIG_VIDEOMODE_HELPERS=y CONFIG_VIRTIO_DMA_SHARED_BUFFER=y CONFIG_VMAP_STACK=y -CONFIG_WATCHDOG_CORE=y CONFIG_ZONE_DMA32=y diff --git a/target/linux/armvirt/config-5.15 b/target/linux/armvirt/config-5.15 index 36f7d9f01e3094..4828e98dbf81fa 100644 --- a/target/linux/armvirt/config-5.15 +++ b/target/linux/armvirt/config-5.15 @@ -1,54 +1,142 @@ +CONFIG_64BIT=y CONFIG_9P_FS=y # CONFIG_9P_FS_POSIX_ACL is not set # CONFIG_9P_FS_SECURITY is not set +CONFIG_ACPI=y +CONFIG_ACPI_AC=y +CONFIG_ACPI_APEI=y +CONFIG_ACPI_APEI_EINJ=y +# CONFIG_ACPI_APEI_ERST_DEBUG is not set +CONFIG_ACPI_APEI_GHES=y +CONFIG_ACPI_APEI_MEMORY_FAILURE=y +CONFIG_ACPI_APEI_PCIEAER=y +CONFIG_ACPI_BATTERY=y +# CONFIG_ACPI_BGRT is not set +CONFIG_ACPI_CCA_REQUIRED=y +CONFIG_ACPI_CONTAINER=y +CONFIG_ACPI_CPPC_CPUFREQ=y +# CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_DEBUGGER is not set +# CONFIG_ACPI_DOCK is not set +# CONFIG_ACPI_EC_DEBUGFS is not set +CONFIG_ACPI_FAN=y +CONFIG_ACPI_GENERIC_GSI=y +CONFIG_ACPI_GTDT=y +CONFIG_ACPI_HOTPLUG_CPU=y +CONFIG_ACPI_I2C_OPREGION=y +CONFIG_ACPI_IORT=y +CONFIG_ACPI_MCFG=y +# CONFIG_ACPI_PCI_SLOT is not set +CONFIG_ACPI_PPTT=y +CONFIG_ACPI_PROCESSOR=y +CONFIG_ACPI_PROCESSOR_IDLE=y +CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y +CONFIG_ACPI_SPCR_TABLE=y +CONFIG_ACPI_THERMAL=y +# CONFIG_ACPI_TINY_POWER_BUTTON is not set CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_PROC_KCORE_TEXT=y CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_STACKWALK=y CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_ARM64=y +CONFIG_ARM64_4K_PAGES=y +# CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set +CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y +CONFIG_ARM64_PAGE_SHIFT=12 +CONFIG_ARM64_PA_BITS=48 +CONFIG_ARM64_PA_BITS_48=y +CONFIG_ARM64_TAGGED_ADDR_ABI=y +CONFIG_ARM64_VA_BITS=39 +CONFIG_ARM64_VA_BITS_39=y CONFIG_ARM_AMBA=y CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +# CONFIG_ARM_DMC620_PMU is not set CONFIG_ARM_GIC=y CONFIG_ARM_GIC_V2M=y CONFIG_ARM_GIC_V3=y CONFIG_ARM_GIC_V3_ITS=y CONFIG_ARM_GIC_V3_ITS_PCI=y CONFIG_ARM_PSCI_FW=y +# CONFIG_ARM_SMMU_V3_PMU is not set +CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y CONFIG_BALLOON_COMPACTION=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_MQ_VIRTIO=y +CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_PM=y CONFIG_CPU_RMAP=y CONFIG_CRC16=y CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_RNG2=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DMADEVICES=y +CONFIG_DMA_ACPI=y +CONFIG_DMA_DIRECT_REMAP=y CONFIG_DMA_ENGINE=y CONFIG_DMA_OF=y CONFIG_DMA_REMAP=y +CONFIG_DMI=y +CONFIG_DMIID=y +CONFIG_DMI_SYSFS=y CONFIG_DTC=y CONFIG_EDAC_SUPPORT=y +CONFIG_EFI=y +CONFIG_EFIVAR_FS=y +CONFIG_EFI_ARMSTUB_DTB_LOADER=y +# CONFIG_EFI_BOOTLOADER_CONTROL is not set +# CONFIG_EFI_CAPSULE_LOADER is not set +# CONFIG_EFI_CUSTOM_SSDT_OVERLAYS is not set +# CONFIG_EFI_DISABLE_PCI_DMA is not set +CONFIG_EFI_EARLYCON=y +CONFIG_EFI_ESRT=y +CONFIG_EFI_GENERIC_STUB=y +# CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER is not set +CONFIG_EFI_PARAMS_FROM_FDT=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_STUB=y +# CONFIG_EFI_TEST is not set CONFIG_EXT4_FS=y CONFIG_F2FS_FS=y CONFIG_FAILOVER=y +CONFIG_FB_EFI=y CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FONT_8x16=y +CONFIG_FONT_AUTOSELECT=y +CONFIG_FONT_SUPPORT=y +CONFIG_FRAME_POINTER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_GENERIC_CSUM=y CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y @@ -65,7 +153,9 @@ CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_ACPI=y CONFIG_GPIO_CDEV=y +# CONFIG_GPIO_HISI is not set CONFIG_GPIO_PL061=y CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDIRQS_SW_RESEND=y @@ -73,13 +163,21 @@ CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HOTPLUG_CPU=y +CONFIG_HOTPLUG_PCI_ACPI=y CONFIG_HVC_DRIVER=y +CONFIG_HZ_PERIODIC=y +# CONFIG_I2C_AMD_MP2 is not set +CONFIG_I2C_HID_ACPI=y +# CONFIG_I2C_HISI is not set +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y +# CONFIG_ISCSI_IBFT is not set CONFIG_JBD2=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y @@ -87,14 +185,19 @@ CONFIG_LOCK_SPIN_ON_OWNER=y CONFIG_MEMFD_CREATE=y CONFIG_MEMORY_BALLOON=y CONFIG_MIGRATION=y +# CONFIG_MLXBF_GIGE is not set +CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MODULES_USE_ELF_RELA=y CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NET_9P=y # CONFIG_NET_9P_DEBUG is not set CONFIG_NET_9P_VIRTIO=y CONFIG_NET_FAILOVER=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NLS=y +CONFIG_NR_CPUS=256 CONFIG_NVMEM=y CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -107,40 +210,71 @@ CONFIG_PADATA=y CONFIG_PAGE_REPORTING=y CONFIG_PARTITION_PERCPU=y CONFIG_PCI=y +# CONFIG_PCIE_HISI_ERR is not set CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS_GENERIC=y CONFIG_PCI_ECAM=y CONFIG_PCI_HOST_COMMON=y CONFIG_PCI_HOST_GENERIC=y +CONFIG_PCI_LABEL=y CONFIG_PCI_MSI=y CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y +# CONFIG_PMIC_OPREGION is not set +CONFIG_PNP=y +CONFIG_PNPACPI=y +CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_POWER_RESET=y +CONFIG_POWER_SUPPLY=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y CONFIG_RATIONAL=y +# CONFIG_RESET_ATTACK_MITIGATION is not set CONFIG_RFS_ACCEL=y +CONFIG_RODATA_FULL_DEFAULT_ENABLED=y CONFIG_RPS=y CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_EFI=y CONFIG_RTC_DRV_PL031=y CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_SCSI=y CONFIG_SCSI_COMMON=y CONFIG_SCSI_VIRTIO=y CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_PNP=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SPARSEMEM=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSE_IRQ=y CONFIG_SRCU=y +# CONFIG_SURFACE_PLATFORMS is not set CONFIG_SWIOTLB=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYSFB=y +# CONFIG_SYSFB_SIMPLEFB is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_OF=y +CONFIG_THREAD_INFO_IN_TASK=y CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_ACPI=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y +CONFIG_UCS2_STRING=y +CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_USB_SUPPORT=y CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y @@ -152,4 +286,7 @@ CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_PCI_LEGACY=y CONFIG_VIRTIO_PCI_LIB=y +CONFIG_VMAP_STACK=y +CONFIG_WATCHDOG_CORE=y CONFIG_XPS=y +CONFIG_ZONE_DMA32=y From 182fb97d8f88cc62a31a3a4e873d1417cb1e4d8e Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 15 Jul 2022 02:47:52 +0000 Subject: [PATCH 0161/1171] armvirt: add 5.15 patches for NXP DPAA2 platform This fixes an issue with NXP's DPAA2 platforms (LS1088/2088/LX2160) * A deadlock issue when attempting to detach the SFP management from a PHY interface (e.g when trying to reboot). These issues were fixed in kernel 6.2[1], but it's version does not cleanly apply onto 5.15. Signed-off-by: Mathew McBride [1] - see patch series "Fix rtnl_mutex deadlock with DPAA2 and SFP modules", https://patchwork.kernel.org/project/netdevbpf/cover/20221129141221.872653-1-vladimir.oltean@nxp.com/ --- .../701-dpaa2-eth-do-not-hold-rtnl_lock.patch | 74 +++++++++++++++++++ ...2-mac-add-support-for-more-10G-modes.patch | 34 +++++++++ 2 files changed, 108 insertions(+) create mode 100644 target/linux/armvirt/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch create mode 100644 target/linux/armvirt/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch diff --git a/target/linux/armvirt/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch b/target/linux/armvirt/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch new file mode 100644 index 00000000000000..447266fa1438dc --- /dev/null +++ b/target/linux/armvirt/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch @@ -0,0 +1,74 @@ +From d5af37ae22f0364be9ded773d737dd6e5b207b10 Mon Sep 17 00:00:00 2001 +From: Ioana Ciornei +Date: Thu, 21 Nov 2019 21:15:25 +0200 +Subject: [PATCH 3/4] dpaa2-eth: do not hold rtnl_lock on phylink_create() or + _destroy() + +The rtnl_lock should not be held when calling phylink_create() or +phylink_destroy() since it leads to the deadlock listed below: + +[ 18.656576] rtnl_lock+0x18/0x20 +[ 18.659798] sfp_bus_add_upstream+0x28/0x90 +[ 18.663974] phylink_create+0x2cc/0x828 +[ 18.667803] dpaa2_mac_connect+0x14c/0x2a8 +[ 18.671890] dpaa2_eth_connect_mac+0x94/0xd8 + +Fix this by moving the _lock() and _unlock() calls just outside of +phylink_of_phy_connect() and phylink_disconnect_phy(). + +Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink") +Reported-by: Russell King +Signed-off-by: Ioana Ciornei +Signed-off-by: Russell King +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ---- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 4 ++++ + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -4217,12 +4217,10 @@ static irqreturn_t dpni_irq0_handler_thr + dpaa2_eth_set_mac_addr(netdev_priv(net_dev)); + dpaa2_eth_update_tx_fqids(priv); + +- rtnl_lock(); + if (dpaa2_eth_has_mac(priv)) + dpaa2_eth_disconnect_mac(priv); + else + dpaa2_eth_connect_mac(priv); +- rtnl_unlock(); + } + + return IRQ_HANDLED; +@@ -4516,9 +4514,7 @@ static int dpaa2_eth_remove(struct fsl_m + #endif + + unregister_netdev(net_dev); +- rtnl_lock(); + dpaa2_eth_disconnect_mac(priv); +- rtnl_unlock(); + + dpaa2_eth_dl_port_del(priv); + dpaa2_eth_dl_traps_unregister(priv); +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -351,7 +351,9 @@ int dpaa2_mac_connect(struct dpaa2_mac * + if (mac->pcs) + phylink_set_pcs(mac->phylink, &mac->pcs->pcs); + ++ rtnl_lock(); + err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); ++ rtnl_unlock(); + if (err) { + netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); + goto err_phylink_destroy; +@@ -372,7 +374,9 @@ void dpaa2_mac_disconnect(struct dpaa2_m + if (!mac->phylink) + return; + ++ rtnl_lock(); + phylink_disconnect_phy(mac->phylink); ++ rtnl_unlock(); + phylink_destroy(mac->phylink); + dpaa2_pcs_destroy(mac); + } diff --git a/target/linux/armvirt/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch b/target/linux/armvirt/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch new file mode 100644 index 00000000000000..0bd96f1f4f71dd --- /dev/null +++ b/target/linux/armvirt/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch @@ -0,0 +1,34 @@ +From c314138bd045e050432158ab021160de3ba51c5e Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Thu, 30 Jan 2020 22:42:38 +0000 +Subject: [PATCH 2/4] net: dpaa2-mac: add support for more 10G modes + +Phylink documentation says: + * Note that the PHY may be able to transform from one connection + * technology to another, so, eg, don't clear 1000BaseX just + * because the MAC is unable to BaseX mode. This is more about + * clearing unsupported speeds and duplex settings. The port modes + * should not be cleared; phylink_set_port_modes() will help with this. + +So add the missing 10G modes. + +Signed-off-by: Russell King +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -140,6 +140,12 @@ static void dpaa2_mac_validate(struct ph + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_USXGMII: + phylink_set(mask, 10000baseT_Full); ++ phylink_set(mask, 10000baseKR_Full); ++ phylink_set(mask, 10000baseCR_Full); ++ phylink_set(mask, 10000baseSR_Full); ++ phylink_set(mask, 10000baseLR_Full); ++ phylink_set(mask, 10000baseLRM_Full); ++ phylink_set(mask, 10000baseER_Full); + if (state->interface == PHY_INTERFACE_MODE_10GBASER) + break; + phylink_set(mask, 5000baseT_Full); From f1a02ba135c388b3ff2400463c10f4f82584106b Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 10 Jun 2022 05:57:03 +0000 Subject: [PATCH 0162/1171] armvirt: add options and driver modules for NXP Layerscape DPAA2 platform Tested with a Traverse Technologies Ten64 (LS1088A) board. Signed-off-by: Mathew McBride (23.05/5.15 version of commit 54bb95f879aaa62c4253d30390e77bc8180f4ed7) --- target/linux/armvirt/64/config-5.15 | 50 ++++++++++++++- target/linux/armvirt/config-5.15 | 13 +++- target/linux/armvirt/image/Makefile | 3 +- target/linux/armvirt/modules.mk | 96 +++++++++++++++++++++++++++++ 4 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 target/linux/armvirt/modules.mk diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armvirt/64/config-5.15 index 66be848f8a8432..fc9128a0644dee 100644 --- a/target/linux/armvirt/64/config-5.15 +++ b/target/linux/armvirt/64/config-5.15 @@ -1,4 +1,5 @@ CONFIG_64BIT=y +CONFIG_ARCH_LAYERSCAPE=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y CONFIG_ARCH_MMAP_RND_BITS=18 CONFIG_ARCH_MMAP_RND_BITS_MAX=24 @@ -31,21 +32,33 @@ CONFIG_ARM64_PTR_AUTH=y CONFIG_ARM64_PTR_AUTH_KERNEL=y CONFIG_ARM64_SVE=y CONFIG_ARM64_TAGGED_ADDR_ABI=y -CONFIG_ARM64_VA_BITS=39 -CONFIG_ARM64_VA_BITS_39=y +CONFIG_ARM64_VA_BITS=48 +CONFIG_ARM64_VA_BITS_48=y CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y +# CONFIG_ARM_DMC620_PMU is not set CONFIG_ARM_SBSA_WATCHDOG=y +CONFIG_ARM_SMC_WATCHDOG=y +CONFIG_ARM_SMMU=y +# CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT is not set +# CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS is not set +CONFIG_ARM_SMMU_V3=y +# CONFIG_ARM_SMMU_V3_PMU is not set +# CONFIG_ARM_SMMU_V3_SVA is not set CONFIG_ATOMIC64_SELFTEST=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BLK_PM=y CONFIG_CAVIUM_TX2_ERRATUM_219=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_CLK_LS1028A_PLLDIG=y +CONFIG_CLK_QORIQ=y CONFIG_CLK_SP810=y CONFIG_CLK_VEXPRESS_OSC=y +# CONFIG_COMMON_CLK_FSL_FLEXSPI is not set +# CONFIG_COMMON_CLK_FSL_SAI is not set # CONFIG_COMPAT_32BIT_TIME is not set CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_MENU=y @@ -62,6 +75,7 @@ CONFIG_CRYPTO_BLAKE2S=y CONFIG_CRYPTO_CHACHA20=y CONFIG_CRYPTO_CHACHA20_NEON=y CONFIG_CRYPTO_CRYPTD=y +# CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM is not set CONFIG_CRYPTO_GHASH_ARM64_CE=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y @@ -94,13 +108,20 @@ CONFIG_FB_CFB_IMAGEBLIT=y CONFIG_FB_CMDLINE=y CONFIG_FB_MODE_HELPERS=y CONFIG_FRAME_POINTER=y +# CONFIG_FSL_DPAA is not set +# CONFIG_FSL_DPAA2_QDMA is not set CONFIG_FSL_ERRATUM_A008585=y +# CONFIG_FSL_FMAN is not set +# CONFIG_FSL_IMX8_DDR_PMU is not set +# CONFIG_FSL_PQ_MDIO is not set CONFIG_FUJITSU_ERRATUM_010001=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_CSUM=y CONFIG_GENERIC_FIND_FIRST_BIT=y +# CONFIG_GIANFAR is not set CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_GPIO_MPC8XXX=y CONFIG_HDMI=y # CONFIG_HISI_PMU is not set CONFIG_HW_RANDOM=y @@ -109,7 +130,16 @@ CONFIG_HW_RANDOM_VIRTIO=y CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_IMX=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +# CONFIG_IMX2_WDT is not set +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set +CONFIG_IOMMU_DEFAULT_DMA_STRICT=y +CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set +# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set +CONFIG_IOMMU_SUPPORT=y CONFIG_KCMP=y CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_PLATFORM is not set @@ -118,6 +148,12 @@ CONFIG_MFD_SYSCON=y CONFIG_MFD_VEXPRESS_SYSREG=y CONFIG_MMC=y CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_RICOH_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_OF_ESDHC=y +CONFIG_MMC_SDHCI_PCI=y +CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MODULES_USE_ELF_RELA=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NO_HZ=y @@ -125,6 +161,9 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=64 CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y +# CONFIG_NVMEM_LAYERSCAPE_SFP is not set +CONFIG_PCIE_LAYERSCAPE=y +CONFIG_PCI_LAYERSCAPE=y CONFIG_PM=y CONFIG_PM_CLK=y CONFIG_PM_GENERIC_DOMAINS=y @@ -132,25 +171,32 @@ CONFIG_PM_GENERIC_DOMAINS_OF=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_VEXPRESS=y CONFIG_POWER_SUPPLY=y +CONFIG_QORIQ_THERMAL=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y +# CONFIG_RTC_DRV_FSL_FTM_ALARM is not set CONFIG_RTC_I2C_AND_SPI=y CONFIG_SMC91X=y CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +# CONFIG_SPI_FSL_QUADSPI is not set # CONFIG_SPI_HISI_KUNPENG is not set # CONFIG_SPI_HISI_SFC_V3XX is not set CONFIG_SYNC_FILE=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_THREAD_INFO_IN_TASK=y CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB_DWC3=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PLATFORM=y CONFIG_VEXPRESS_CONFIG=y CONFIG_VIDEOMODE_HELPERS=y CONFIG_VIRTIO_DMA_SHARED_BUFFER=y +# CONFIG_VIRTIO_IOMMU is not set CONFIG_VMAP_STACK=y CONFIG_ZONE_DMA32=y diff --git a/target/linux/armvirt/config-5.15 b/target/linux/armvirt/config-5.15 index 4828e98dbf81fa..d609207bbed279 100644 --- a/target/linux/armvirt/config-5.15 +++ b/target/linux/armvirt/config-5.15 @@ -60,17 +60,17 @@ CONFIG_ARM64_VA_BITS_39=y CONFIG_ARM_AMBA=y CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -# CONFIG_ARM_DMC620_PMU is not set CONFIG_ARM_GIC=y CONFIG_ARM_GIC_V2M=y CONFIG_ARM_GIC_V3=y CONFIG_ARM_GIC_V3_ITS=y CONFIG_ARM_GIC_V3_ITS_PCI=y CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_SMMU_V3_PMU is not set CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y CONFIG_BALLOON_COMPACTION=y CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_NVME=y +CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_MQ_VIRTIO=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y @@ -169,6 +169,7 @@ CONFIG_HZ_PERIODIC=y # CONFIG_I2C_AMD_MP2 is not set CONFIG_I2C_HID_ACPI=y # CONFIG_I2C_HISI is not set +# CONFIG_I2C_SLAVE_TESTUNIT is not set CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 # CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set CONFIG_INITRAMFS_SOURCE="" @@ -199,6 +200,8 @@ CONFIG_NET_FLOW_LIMIT=y CONFIG_NLS=y CONFIG_NR_CPUS=256 CONFIG_NVMEM=y +CONFIG_NVME_CORE=y +# CONFIG_NVME_MULTIPATH is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -247,6 +250,7 @@ CONFIG_SERIAL_8250_PNP=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SOCK_RX_QUEUE_MAPPING=y @@ -273,9 +277,14 @@ CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y +# CONFIG_UACCE is not set CONFIG_UCS2_STRING=y CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB=y +CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index 50c993b5225d6f..e88544c96375a6 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -106,7 +106,8 @@ define Device/generic GRUB2_VARIANT := generic FILESYSTEMS := ext4 squashfs DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ - kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils + kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ + kmod-fsl-dpaa2-net endef TARGET_DEVICES += generic diff --git a/target/linux/armvirt/modules.mk b/target/linux/armvirt/modules.mk new file mode 100644 index 00000000000000..3ac3f6a27d6512 --- /dev/null +++ b/target/linux/armvirt/modules.mk @@ -0,0 +1,96 @@ +define KernelPackage/acpi-mdio + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=ACPI MDIO support + DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-mdio-devres + KCONFIG:=CONFIG_ACPI_MDIO + FILES:=$(LINUX_DIR)/drivers/net/mdio/acpi_mdio.ko + AUTOLOAD:=$(call AutoLoad,11,acpi_mdio) +endef + +define KernelPackage/acpi-mdio/description + Kernel driver for ACPI MDIO support +endef + +$(eval $(call KernelPackage,acpi-mdio)) + +define KernelPackage/fsl-pcs-lynx + SUBMENU=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-phylink + TITLE:=NXP (Freescale) Lynx PCS + HIDDEN:=1 + KCONFIG:=CONFIG_PCS_LYNX + FILES=$(LINUX_DIR)/drivers/net/pcs/pcs-lynx.ko + AUTOLOAD=$(call AutoLoad,30,pcs-lynx) +endef + +$(eval $(call KernelPackage,fsl-pcs-lynx)) + +define KernelPackage/fsl-xgmac-mdio + SUBMENU=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio + TITLE:=NXP (Freescale) MDIO bus + KCONFIG:=CONFIG_FSL_XGMAC_MDIO + FILES=$(LINUX_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko + AUTOLOAD=$(call AutoLoad,30,xgmac_mdio) +endef + +$(eval $(call KernelPackage,fsl-xgmac-mdio)) + +define KernelPackage/fsl-mc-dpio + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP DPAA2 DPIO (Data Path IO) driver + HIDDEN:=1 + KCONFIG:=CONFIG_FSL_MC_BUS=y \ + CONFIG_FSL_MC_DPIO + FILES:=$(LINUX_DIR)/drivers/soc/fsl/dpio/fsl-mc-dpio.ko + AUTOLOAD=$(call AutoLoad,30,fsl-mc-dpio) +endef + +$(eval $(call KernelPackage,fsl-mc-dpio)) + +define KernelPackage/fsl-dpaa2-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=NXP DPAA2 Ethernet + DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-phylink \ + +kmod-fsl-pcs-lynx +kmod-fsl-mc-dpio + KCONFIG:= \ + CONFIG_FSL_MC_UAPI_SUPPORT=y \ + CONFIG_FSL_DPAA2_ETH + FILES:= \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.ko + AUTOLOAD=$(call AutoLoad,35,fsl-dpaa2-eth) +endef + +$(eval $(call KernelPackage,fsl-dpaa2-net)) + +define KernelPackage/fsl-dpaa2-console + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP DPAA2 Debug console + DEPENDS:=@(TARGET_armvirt_64) + KCONFIG:=CONFIG_DPAA2_CONSOLE + FILES=$(LINUX_DIR)/drivers/soc/fsl/dpaa2-console.ko + AUTOLOAD=$(call AutoLoad,40,dpaa2-console) +endef + +define KernelPackage/fsl-dpaa2-console/description + Kernel modules for the NXP DPAA2 debug consoles + (Management Complex and AIOP). +endef + +$(eval $(call KernelPackage,fsl-dpaa2-console)) + +define KernelPackage/wdt-sp805 + SUBMENU:=$(OTHER_MENU) + TITLE:=ARM SP805 Watchdog + KCONFIG:=CONFIG_ARM_SP805_WATCHDOG + FILES=$(LINUX_DIR)/drivers/watchdog/sp805_wdt.ko + AUTOLOAD=$(call AutoLoad,50,sp805_wdt) +endef + +define KernelPackage/wdt-sp805/description + Support for the ARM SP805 wathchdog module. + This is present in the NXP Layerscape family, + HiSilicon HI3660 among others. +endef + +$(eval $(call KernelPackage,wdt-sp805)) From 2bec445c1d40f1d9a3d92708a99588cb83fcf272 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 15 Jul 2022 02:38:02 +0000 Subject: [PATCH 0163/1171] armvirt: 64: add support for other SystemReady-compatible vendors These changes are to support other vendors that have SystemReady/EFI support, including: * Marvell Armada ** (This is speculative as I don't have a machine of my own to test) * Amazon Graviton (tested bare-metal and virtualized instances) * VMware (Fusion for ARM Mac preview) * NXP/Freescale (Layerscape series not already selected) * HiSilicon * Allwinner/sunxi * Rockchip (untested, options taken from arm64 defconfig) To give an idea of the hardware certified for SystemReady, see https://www.arm.com/architecture/system-architectures/systemready-certification-program/ir and https://www.arm.com/architecture/system-architectures/systemready-certification-program/es Other vendors that _should_ work include Marvell Octeon 10 and Ampere. I understand these systems should work "out of the box" in ACPI mode but may require other drivers (e.g PCIe NICs and storage controllers). Signed-off-by: Mathew McBride (23.05/5.15 version of c3151b6f04579a937b7cb166bbeff0d0ee539946) --- target/linux/armvirt/64/config-5.15 | 220 +++++++++++++++++++++++++++- target/linux/armvirt/config-5.15 | 2 + target/linux/armvirt/image/Makefile | 5 +- target/linux/armvirt/modules.mk | 84 +++++++++++ 4 files changed, 308 insertions(+), 3 deletions(-) diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armvirt/64/config-5.15 index fc9128a0644dee..bcae79c8fb0bea 100644 --- a/target/linux/armvirt/64/config-5.15 +++ b/target/linux/armvirt/64/config-5.15 @@ -1,14 +1,23 @@ CONFIG_64BIT=y +CONFIG_ARCH_HISI=y +CONFIG_ARCH_INTEL_SOCFPGA=y CONFIG_ARCH_LAYERSCAPE=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y CONFIG_ARCH_MMAP_RND_BITS=18 CONFIG_ARCH_MMAP_RND_BITS_MAX=24 CONFIG_ARCH_MMAP_RND_BITS_MIN=18 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_MVEBU=y CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_ARCH_ROCKCHIP=y CONFIG_ARCH_STACKWALK=y +CONFIG_ARCH_SUNXI=y +CONFIG_ARCH_SYNQUACER=y +CONFIG_ARCH_THUNDER=y +CONFIG_ARCH_THUNDER2=y CONFIG_ARCH_VEXPRESS=y CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_ARCH_ZYNQMP=y CONFIG_ARM64=y CONFIG_ARM64_4K_PAGES=y CONFIG_ARM64_CNP=y @@ -37,8 +46,12 @@ CONFIG_ARM64_VA_BITS_48=y CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y +# CONFIG_ARMADA_37XX_RWTM_MBOX is not set +CONFIG_ARMADA_37XX_WATCHDOG=y +CONFIG_ARMADA_THERMAL=y CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y # CONFIG_ARM_DMC620_PMU is not set +# CONFIG_ARM_MHU_V2 is not set CONFIG_ARM_SBSA_WATCHDOG=y CONFIG_ARM_SMC_WATCHDOG=y CONFIG_ARM_SMMU=y @@ -49,16 +62,43 @@ CONFIG_ARM_SMMU_V3=y # CONFIG_ARM_SMMU_V3_SVA is not set CONFIG_ATOMIC64_SELFTEST=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +# CONFIG_AXI_DMAC is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BLK_PM=y CONFIG_CAVIUM_TX2_ERRATUM_219=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_CLK_INTEL_SOCFPGA=y +CONFIG_CLK_INTEL_SOCFPGA64=y CONFIG_CLK_LS1028A_PLLDIG=y +CONFIG_CLK_PX30=y CONFIG_CLK_QORIQ=y +CONFIG_CLK_RK3308=y +CONFIG_CLK_RK3328=y +CONFIG_CLK_RK3368=y +CONFIG_CLK_RK3399=y +CONFIG_CLK_RK3568=y CONFIG_CLK_SP810=y +CONFIG_CLK_SUNXI=y +CONFIG_CLK_SUNXI_CLOCKS=y +# CONFIG_CLK_SUNXI_PRCM_SUN6I is not set +# CONFIG_CLK_SUNXI_PRCM_SUN8I is not set +# CONFIG_CLK_SUNXI_PRCM_SUN9I is not set CONFIG_CLK_VEXPRESS_OSC=y # CONFIG_COMMON_CLK_FSL_FLEXSPI is not set # CONFIG_COMMON_CLK_FSL_SAI is not set +CONFIG_COMMON_CLK_HI3516CV300=y +CONFIG_COMMON_CLK_HI3519=y +CONFIG_COMMON_CLK_HI3559A=y +CONFIG_COMMON_CLK_HI3660=y +CONFIG_COMMON_CLK_HI3670=y +CONFIG_COMMON_CLK_HI3798CV200=y +CONFIG_COMMON_CLK_HI6220=y +CONFIG_COMMON_CLK_HI655X=y +CONFIG_COMMON_CLK_ROCKCHIP=y +CONFIG_COMMON_CLK_SCPI=y +CONFIG_COMMON_CLK_ZYNQMP=y +CONFIG_COMMON_RESET_HI3660=y +CONFIG_COMMON_RESET_HI6220=y # CONFIG_COMPAT_32BIT_TIME is not set CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_MENU=y @@ -75,7 +115,14 @@ CONFIG_CRYPTO_BLAKE2S=y CONFIG_CRYPTO_CHACHA20=y CONFIG_CRYPTO_CHACHA20_NEON=y CONFIG_CRYPTO_CRYPTD=y +# CONFIG_CRYPTO_DEV_ALLWINNER is not set # CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM is not set +# CONFIG_CRYPTO_DEV_HISI_HPRE is not set +# CONFIG_CRYPTO_DEV_HISI_SEC2 is not set +# CONFIG_CRYPTO_DEV_HISI_TRNG is not set +# CONFIG_CRYPTO_DEV_OCTEONTX2_CPT is not set +# CONFIG_CRYPTO_DEV_ROCKCHIP is not set +# CONFIG_CRYPTO_DEV_ZYNQMP_AES is not set CONFIG_CRYPTO_GHASH_ARM64_CE=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y @@ -87,6 +134,7 @@ CONFIG_CRYPTO_SHA512_ARM64=y CONFIG_CRYPTO_SIMD=y CONFIG_DMA_DIRECT_REMAP=y CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DMA_SUN6I=y CONFIG_DRM=y CONFIG_DRM_BOCHS=y CONFIG_DRM_BRIDGE=y @@ -100,6 +148,10 @@ CONFIG_DRM_TTM=y CONFIG_DRM_TTM_HELPER=y CONFIG_DRM_VIRTIO_GPU=y CONFIG_DRM_VRAM_HELPER=y +# CONFIG_DWMAC_SUN8I is not set +# CONFIG_DWMAC_SUNXI is not set +CONFIG_DW_WATCHDOG=y +CONFIG_ENA_ETHERNET=y CONFIG_FB=y CONFIG_FB_ARMCLCD=y CONFIG_FB_CFB_COPYAREA=y @@ -107,11 +159,11 @@ CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y CONFIG_FB_CMDLINE=y CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_XILINX is not set CONFIG_FRAME_POINTER=y # CONFIG_FSL_DPAA is not set # CONFIG_FSL_DPAA2_QDMA is not set CONFIG_FSL_ERRATUM_A008585=y -# CONFIG_FSL_FMAN is not set # CONFIG_FSL_IMX8_DDR_PMU is not set # CONFIG_FSL_PQ_MDIO is not set CONFIG_FUJITSU_ERRATUM_010001=y @@ -122,17 +174,34 @@ CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y CONFIG_GPIO_MPC8XXX=y +CONFIG_GPIO_ROCKCHIP=y +CONFIG_GPIO_THUNDERX=y +CONFIG_GPIO_XLP=y +CONFIG_GPIO_ZYNQ=y CONFIG_HDMI=y -# CONFIG_HISI_PMU is not set +CONFIG_HI3660_MBOX=y +CONFIG_HI6220_MBOX=y +CONFIG_HISILICON_LPC=y +CONFIG_HISI_PMU=y +CONFIG_HISI_THERMAL=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y +# CONFIG_HW_RANDOM_HISI is not set CONFIG_HW_RANDOM_VIRTIO=y CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_ALTERA=y CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_HIX5HD2 is not set CONFIG_I2C_IMX=y +CONFIG_I2C_SYNQUACER=y +CONFIG_I2C_THUNDERX=y +# CONFIG_I2C_XLP9XX is not set CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 # CONFIG_IMX2_WDT is not set +# CONFIG_INPUT_HISI_POWERKEY is not set +# CONFIG_INTEL_STRATIX10_RSU is not set +# CONFIG_INTEL_STRATIX10_SERVICE is not set # CONFIG_IOMMU_DEBUGFS is not set # CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set CONFIG_IOMMU_DEFAULT_DMA_STRICT=y @@ -140,35 +209,121 @@ CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y # CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set # CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set CONFIG_IOMMU_SUPPORT=y +# CONFIG_K3_DMA is not set CONFIG_KCMP=y +# CONFIG_KEYBOARD_SUN4I_LRADC is not set CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_PLATFORM is not set +# CONFIG_MAILBOX_TEST is not set +CONFIG_MDIO_SUN4I=y +# CONFIG_MFD_ALTERA_A10SR is not set +CONFIG_MFD_ALTERA_SYSMGR=y +# CONFIG_MFD_AXP20X_RSB is not set CONFIG_MFD_CORE=y +CONFIG_MFD_HI655X_PMIC=y +# CONFIG_MFD_KHADAS_MCU is not set +CONFIG_MFD_SUN4I_GPADC=y +# CONFIG_MFD_SUN6I_PRCM is not set CONFIG_MFD_SYSCON=y CONFIG_MFD_VEXPRESS_SYSREG=y CONFIG_MMC=y CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_CAVIUM_THUNDERX=y +CONFIG_MMC_DW=y +# CONFIG_MMC_DW_BLUEFIELD is not set +# CONFIG_MMC_DW_EXYNOS is not set +# CONFIG_MMC_DW_HI3798CV200 is not set +# CONFIG_MMC_DW_K3 is not set +# CONFIG_MMC_DW_PCI is not set +CONFIG_MMC_DW_PLTFM=y +CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_RICOH_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ACPI=y CONFIG_MMC_SDHCI_OF_ESDHC=y CONFIG_MMC_SDHCI_PCI=y CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SUNXI=y CONFIG_MODULES_USE_ELF_RELA=y +# CONFIG_MV_XOR is not set CONFIG_NEED_SG_DMA_LENGTH=y +# CONFIG_NET_VENDOR_ALLWINNER is not set CONFIG_NO_HZ=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=64 CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y # CONFIG_NVMEM_LAYERSCAPE_SFP is not set +CONFIG_NVMEM_ROCKCHIP_EFUSE=y +# CONFIG_NVMEM_ROCKCHIP_OTP is not set +# CONFIG_NVMEM_SUNXI_SID is not set +# CONFIG_NVMEM_ZYNQMP is not set +CONFIG_PCC=y +CONFIG_PCIE_HISI_STB=y CONFIG_PCIE_LAYERSCAPE=y +CONFIG_PCIE_MOBIVEIL_PLAT=y +CONFIG_PCIE_ROCKCHIP=y +# CONFIG_PCIE_ROCKCHIP_DW_HOST is not set +CONFIG_PCIE_ROCKCHIP_HOST=y +CONFIG_PCIE_XILINX_CPM=y +CONFIG_PCIE_XILINX_NWL=y +CONFIG_PCI_AARDVARK=y CONFIG_PCI_LAYERSCAPE=y +CONFIG_PHY_HI3660_USB=y +CONFIG_PHY_HI3670_USB=y +CONFIG_PHY_HI6220_USB=y +CONFIG_PHY_HISI_INNO_USB2=y +# CONFIG_PHY_HISTB_COMBPHY is not set +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y +CONFIG_PHY_MVEBU_A38X_COMPHY=y +CONFIG_PHY_MVEBU_CP110_COMPHY=y +# CONFIG_PHY_ROCKCHIP_DP is not set +# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set +CONFIG_PHY_ROCKCHIP_EMMC=y +# CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY is not set +# CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY is not set +# CONFIG_PHY_ROCKCHIP_INNO_HDMI is not set +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_PCIE=y +CONFIG_PHY_ROCKCHIP_TYPEC=y +# CONFIG_PHY_ROCKCHIP_USB is not set +CONFIG_PHY_SUN4I_USB=y +CONFIG_PHY_SUN50I_USB3=y +# CONFIG_PHY_SUN6I_MIPI_DPHY is not set +CONFIG_PHY_SUN9I_USB=y +# CONFIG_PHY_XILINX_ZYNQMP is not set +CONFIG_PINCTRL_ROCKCHIP=y +CONFIG_PINCTRL_SUN4I_A10=y +CONFIG_PINCTRL_SUN50I_A100=y +CONFIG_PINCTRL_SUN50I_A100_R=y +CONFIG_PINCTRL_SUN50I_A64=y +CONFIG_PINCTRL_SUN50I_A64_R=y +CONFIG_PINCTRL_SUN50I_H5=y +CONFIG_PINCTRL_SUN50I_H6=y +CONFIG_PINCTRL_SUN50I_H616=y +CONFIG_PINCTRL_SUN50I_H616_R=y +CONFIG_PINCTRL_SUN50I_H6_R=y +CONFIG_PINCTRL_SUN5I=y +# CONFIG_PINCTRL_SUN6I_A31 is not set +# CONFIG_PINCTRL_SUN6I_A31_R is not set +# CONFIG_PINCTRL_SUN8I_A23 is not set +# CONFIG_PINCTRL_SUN8I_A23_R is not set +# CONFIG_PINCTRL_SUN8I_A33 is not set +# CONFIG_PINCTRL_SUN8I_A83T is not set +# CONFIG_PINCTRL_SUN8I_A83T_R is not set +# CONFIG_PINCTRL_SUN8I_H3 is not set +# CONFIG_PINCTRL_SUN8I_H3_R is not set +# CONFIG_PINCTRL_SUN8I_V3S is not set +# CONFIG_PINCTRL_SUN9I_A80 is not set +# CONFIG_PINCTRL_SUN9I_A80_R is not set +CONFIG_PINCTRL_ZYNQMP=y CONFIG_PM=y CONFIG_PM_CLK=y CONFIG_PM_GENERIC_DOMAINS=y CONFIG_PM_GENERIC_DOMAINS_OF=y CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_HISI=y CONFIG_POWER_RESET_VEXPRESS=y CONFIG_POWER_SUPPLY=y CONFIG_QORIQ_THERMAL=y @@ -176,27 +331,88 @@ CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR_AXP20X=y +CONFIG_REGULATOR_HI655X=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_ROCKCHIP_IOMMU=y +# CONFIG_ROCKCHIP_MBOX is not set +CONFIG_ROCKCHIP_PM_DOMAINS=y +# CONFIG_ROCKCHIP_SARADC is not set +# CONFIG_ROCKCHIP_THERMAL is not set CONFIG_RODATA_FULL_DEFAULT_ENABLED=y # CONFIG_RTC_DRV_FSL_FTM_ALARM is not set +CONFIG_RTC_DRV_MV=y CONFIG_RTC_I2C_AND_SPI=y +# CONFIG_SERIAL_8250_EXAR is not set +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_MVEBU_CONSOLE=y +CONFIG_SERIAL_MVEBU_UART=y +CONFIG_SERIAL_SAMSUNG=y +CONFIG_SERIAL_SAMSUNG_CONSOLE=y CONFIG_SMC91X=y +# CONFIG_SND_SUN4I_I2S is not set +# CONFIG_SND_SUN50I_CODEC_ANALOG is not set +# CONFIG_SND_SUN50I_DMIC is not set +# CONFIG_SND_SUN8I_CODEC is not set +# CONFIG_SND_SUN8I_CODEC_ANALOG is not set +# CONFIG_SNI_NETSEC is not set CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPI_ARMADA_3700=y # CONFIG_SPI_FSL_QUADSPI is not set # CONFIG_SPI_HISI_KUNPENG is not set +# CONFIG_SPI_HISI_SFC is not set # CONFIG_SPI_HISI_SFC_V3XX is not set +# CONFIG_SPI_ROCKCHIP_SFC is not set +# CONFIG_SPI_SUN4I is not set +# CONFIG_SPI_SUN6I is not set +# CONFIG_SPI_SYNQUACER is not set +CONFIG_SPI_THUNDERX=y +# CONFIG_SPI_XLP is not set +CONFIG_STUB_CLK_HI3660=y +CONFIG_STUB_CLK_HI6220=y +CONFIG_SUN50I_A100_CCU=y +CONFIG_SUN50I_A100_R_CCU=y +CONFIG_SUN50I_A64_CCU=y +CONFIG_SUN50I_H616_CCU=y +CONFIG_SUN50I_H6_CCU=y +CONFIG_SUN50I_H6_R_CCU=y +CONFIG_SUN50I_IOMMU=y +CONFIG_SUN6I_MSGBOX=y +# CONFIG_SUN8I_A83T_CCU is not set +CONFIG_SUN8I_DE2_CCU=y +# CONFIG_SUN8I_H3_CCU is not set +CONFIG_SUN8I_R_CCU=y +CONFIG_SUN8I_THERMAL=y +CONFIG_SUNXI_CCU=y +CONFIG_SUNXI_RSB=y +CONFIG_SUNXI_WATCHDOG=y CONFIG_SYNC_FILE=y CONFIG_SYSCTL_EXCEPTION_TRACE=y +# CONFIG_TCG_TIS_SYNQUACER is not set CONFIG_THREAD_INFO_IN_TASK=y +# CONFIG_TURRIS_MOX_RWTM is not set CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_XILINX=y CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_HISTB=y +CONFIG_USB_XHCI_MVEBU=y CONFIG_USB_XHCI_PLATFORM=y CONFIG_VEXPRESS_CONFIG=y CONFIG_VIDEOMODE_HELPERS=y +# CONFIG_VIDEO_SUN4I_CSI is not set +# CONFIG_VIDEO_SUN6I_CSI is not set CONFIG_VIRTIO_DMA_SHARED_BUFFER=y # CONFIG_VIRTIO_IOMMU is not set CONFIG_VMAP_STACK=y +CONFIG_WDAT_WDT=y +# CONFIG_XILINX_AMS is not set +# CONFIG_XILINX_INTC is not set CONFIG_ZONE_DMA32=y +CONFIG_ZYNQMP_FIRMWARE=y +# CONFIG_ZYNQMP_FIRMWARE_DEBUG is not set +CONFIG_ZYNQMP_PM_DOMAINS=y +CONFIG_ZYNQMP_POWER=y diff --git a/target/linux/armvirt/config-5.15 b/target/linux/armvirt/config-5.15 index d609207bbed279..a45126ead22889 100644 --- a/target/linux/armvirt/config-5.15 +++ b/target/linux/armvirt/config-5.15 @@ -190,6 +190,7 @@ CONFIG_MIGRATION=y CONFIG_MMC_SDHCI_ACPI=y CONFIG_MODULES_USE_ELF_RELA=y CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_MVMDIO=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NET_9P=y @@ -297,5 +298,6 @@ CONFIG_VIRTIO_PCI_LEGACY=y CONFIG_VIRTIO_PCI_LIB=y CONFIG_VMAP_STACK=y CONFIG_WATCHDOG_CORE=y +CONFIG_WDAT_WDT=y CONFIG_XPS=y CONFIG_ZONE_DMA32=y diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index e88544c96375a6..5a2004345c236b 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -107,7 +107,10 @@ define Device/generic FILESYSTEMS := ext4 squashfs DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ - kmod-fsl-dpaa2-net + kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ + kmod-fsl-enetc-net \ + kmod-phy-aquantia kmod-phy-broadcom kmod-phy-marvell \ + kmod-phy-marvell-10g kmod-atlantic endef TARGET_DEVICES += generic diff --git a/target/linux/armvirt/modules.mk b/target/linux/armvirt/modules.mk index 3ac3f6a27d6512..f1dc28083ac8eb 100644 --- a/target/linux/armvirt/modules.mk +++ b/target/linux/armvirt/modules.mk @@ -48,6 +48,44 @@ endef $(eval $(call KernelPackage,fsl-mc-dpio)) +define KernelPackage/fsl-enetc-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=:NXP ENETC (LS1028A) Ethernet + DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-fsl-pcs-lynx + KCONFIG:= \ + CONFIG_FSL_ENETC \ + CONFIG_FSL_ENETC_VF \ + CONFIG_FSL_ENETC_QOS + FILES:= \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-mdio.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-ierb.ko + AUTOLOAD=$(call AutoLoad,35,fsl-enetc) +endef + +$(eval $(call KernelPackage,fsl-enetc-net)) + +define KernelPackage/fsl-dpaa1-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=NXP DPAA1 (LS1043/LS1046) Ethernet + DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32 + KCONFIG:= \ + CONFIG_FSL_DPAA=y \ + CONFIG_FSL_DPAA_ETH \ + CONFIG_FSL_FMAN \ + CONFIG_FSL_DPAA_CHECKING=n \ + CONFIG_FSL_BMAN_TEST=n \ + CONFIG_FSL_QMAN_TEST=n + MODULES:= \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa/fsl_dpa.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_fman.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_mac.ko + AUTOLOAD=$(call AutoLoad,35,fsl-dpa) +endef + +$(eval $(call KernelPackage,fsl-dpaa1-net)) + define KernelPackage/fsl-dpaa2-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=NXP DPAA2 Ethernet @@ -79,6 +117,51 @@ endef $(eval $(call KernelPackage,fsl-dpaa2-console)) +define KernelPackage/marvell-mdio + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Armada platform MDIO driver + DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio + KCONFIG:=CONFIG_MVMDIO + FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvmdio.ko + AUTOLOAD=$(call AutoLoad,30,marvell-mdio) +endef + +$(eval $(call KernelPackage,marvell-mdio)) + +define KernelPackage/phy-marvell-10g + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Alaska 10G PHY driver + DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy + KCONFIG:=CONFIG_MARVELL_10G_PHY + FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko + AUTOLOAD=$(call AutoLoad,35,marvell10g) +endef + +$(eval $(call KernelPackage,phy-marvell-10g)) + +define KernelPackage/mvneta + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Armada 370/38x/XP/37xx network driver + DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink + KCONFIG:=CONFIG_MVNETA + FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvneta.ko + AUTOLOAD=$(call AutoLoad,40,mvneta) +endef + +$(eval $(call KernelPackage,mvneta)) + +define KernelPackage/mvpp2 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Armada 375/7K/8K network driver + DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink + KCONFIG:=CONFIG_MVPP2 \ + CONFIG_MVPP2_PTP=n + FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko + AUTOLOAD=$(call AutoLoad,40,mvpp2) +endef + +$(eval $(call KernelPackage,mvpp2)) + define KernelPackage/wdt-sp805 SUBMENU:=$(OTHER_MENU) TITLE:=ARM SP805 Watchdog @@ -94,3 +177,4 @@ define KernelPackage/wdt-sp805/description endef $(eval $(call KernelPackage,wdt-sp805)) + From 3eb25435af354b84eaac35de9bae851857ff27ce Mon Sep 17 00:00:00 2001 From: Anton Antonov Date: Thu, 22 Dec 2022 12:00:12 +0000 Subject: [PATCH 0164/1171] armvirt: 64: Add NXP i.MX 8M Mini/Nano/Quad/Plus EVK support Also includes Advantech RSB-3720 (iMX8 Plus) support. Signed-off-by: Anton Antonov Signed-off-by: Mathew McBride [Re-sort into kernel config, move network into modules] (23.05/5.15 version of commit 3efb3b801bb1393897ff58b9af3753157f28f441) --- target/linux/armvirt/64/config-5.15 | 82 ++++++++++++++++++++- target/linux/armvirt/base-files/etc/inittab | 3 + target/linux/armvirt/image/Makefile | 2 +- target/linux/armvirt/modules.mk | 71 ++++++++++++++++++ 4 files changed, 155 insertions(+), 3 deletions(-) diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armvirt/64/config-5.15 index bcae79c8fb0bea..e77d17d07f10a3 100644 --- a/target/linux/armvirt/64/config-5.15 +++ b/target/linux/armvirt/64/config-5.15 @@ -8,6 +8,7 @@ CONFIG_ARCH_MMAP_RND_BITS_MAX=24 CONFIG_ARCH_MMAP_RND_BITS_MIN=18 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 CONFIG_ARCH_MVEBU=y +CONFIG_ARCH_MXC=y CONFIG_ARCH_PROC_KCORE_TEXT=y CONFIG_ARCH_ROCKCHIP=y CONFIG_ARCH_STACKWALK=y @@ -60,6 +61,7 @@ CONFIG_ARM_SMMU=y CONFIG_ARM_SMMU_V3=y # CONFIG_ARM_SMMU_V3_PMU is not set # CONFIG_ARM_SMMU_V3_SVA is not set +CONFIG_AT803X_PHY=y CONFIG_ATOMIC64_SELFTEST=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y # CONFIG_AXI_DMAC is not set @@ -67,6 +69,10 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BLK_PM=y CONFIG_CAVIUM_TX2_ERRATUM_219=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_CLK_IMX8MM=y +CONFIG_CLK_IMX8MN=y +CONFIG_CLK_IMX8MP=y +CONFIG_CLK_IMX8MQ=y CONFIG_CLK_INTEL_SOCFPGA=y CONFIG_CLK_INTEL_SOCFPGA64=y CONFIG_CLK_LS1028A_PLLDIG=y @@ -139,6 +145,7 @@ CONFIG_DRM=y CONFIG_DRM_BOCHS=y CONFIG_DRM_BRIDGE=y CONFIG_DRM_GEM_SHMEM_HELPER=y +# CONFIG_DRM_IMX_DCSS is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_PANEL=y CONFIG_DRM_PANEL_BRIDGE=y @@ -159,6 +166,7 @@ CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y CONFIG_FB_CMDLINE=y CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_MX3 is not set # CONFIG_FB_XILINX is not set CONFIG_FRAME_POINTER=y # CONFIG_FSL_DPAA is not set @@ -174,6 +182,7 @@ CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y CONFIG_GPIO_MPC8XXX=y +CONFIG_GPIO_MXC=y CONFIG_GPIO_ROCKCHIP=y CONFIG_GPIO_THUNDERX=y CONFIG_GPIO_XLP=y @@ -194,14 +203,29 @@ CONFIG_I2C_ALTERA=y CONFIG_I2C_BOARDINFO=y # CONFIG_I2C_HIX5HD2 is not set CONFIG_I2C_IMX=y +CONFIG_I2C_IMX_LPI2C=y CONFIG_I2C_SYNQUACER=y CONFIG_I2C_THUNDERX=y # CONFIG_I2C_XLP9XX is not set CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -# CONFIG_IMX2_WDT is not set +CONFIG_IMX2_WDT=y +CONFIG_IMX7ULP_WDT=y +# CONFIG_IMX8MM_THERMAL is not set +# CONFIG_IMX_DMA is not set +# CONFIG_IMX_DSP is not set +CONFIG_IMX_IRQSTEER=y +CONFIG_IMX_MBOX=y +# CONFIG_IMX_SCU is not set +CONFIG_IMX_SDMA=y +# CONFIG_IMX_WEIM is not set # CONFIG_INPUT_HISI_POWERKEY is not set # CONFIG_INTEL_STRATIX10_RSU is not set # CONFIG_INTEL_STRATIX10_SERVICE is not set +CONFIG_INTERCONNECT=y +CONFIG_INTERCONNECT_IMX=y +CONFIG_INTERCONNECT_IMX8MM=y +CONFIG_INTERCONNECT_IMX8MN=y +CONFIG_INTERCONNECT_IMX8MQ=y # CONFIG_IOMMU_DEBUGFS is not set # CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set CONFIG_IOMMU_DEFAULT_DMA_STRICT=y @@ -228,6 +252,7 @@ CONFIG_MFD_SYSCON=y CONFIG_MFD_VEXPRESS_SYSREG=y CONFIG_MMC=y CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_BLOCK=y CONFIG_MMC_CAVIUM_THUNDERX=y CONFIG_MMC_DW=y # CONFIG_MMC_DW_BLUEFIELD is not set @@ -237,15 +262,20 @@ CONFIG_MMC_DW=y # CONFIG_MMC_DW_PCI is not set CONFIG_MMC_DW_PLTFM=y CONFIG_MMC_DW_ROCKCHIP=y +# CONFIG_MMC_MXC is not set CONFIG_MMC_RICOH_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_CADENCE=y +CONFIG_MMC_SDHCI_ESDHC_IMX=y CONFIG_MMC_SDHCI_OF_ESDHC=y CONFIG_MMC_SDHCI_PCI=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MMC_SUNXI=y CONFIG_MODULES_USE_ELF_RELA=y # CONFIG_MV_XOR is not set +# CONFIG_MX3_IPU is not set +CONFIG_MXS_DMA=y CONFIG_NEED_SG_DMA_LENGTH=y # CONFIG_NET_VENDOR_ALLWINNER is not set CONFIG_NO_HZ=y @@ -253,9 +283,13 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=64 CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y +# CONFIG_NVMEM_IMX_IIM is not set +CONFIG_NVMEM_IMX_OCOTP=y +CONFIG_NVMEM_IMX_OCOTP_SCU=y # CONFIG_NVMEM_LAYERSCAPE_SFP is not set CONFIG_NVMEM_ROCKCHIP_EFUSE=y # CONFIG_NVMEM_ROCKCHIP_OTP is not set +# CONFIG_NVMEM_SNVS_LPGPR is not set # CONFIG_NVMEM_SUNXI_SID is not set # CONFIG_NVMEM_ZYNQMP is not set CONFIG_PCC=y @@ -268,7 +302,9 @@ CONFIG_PCIE_ROCKCHIP_HOST=y CONFIG_PCIE_XILINX_CPM=y CONFIG_PCIE_XILINX_NWL=y CONFIG_PCI_AARDVARK=y +CONFIG_PCI_IMX6=y CONFIG_PCI_LAYERSCAPE=y +CONFIG_PHY_FSL_IMX8MQ_USB=y CONFIG_PHY_HI3660_USB=y CONFIG_PHY_HI3670_USB=y CONFIG_PHY_HI6220_USB=y @@ -293,6 +329,11 @@ CONFIG_PHY_SUN50I_USB3=y # CONFIG_PHY_SUN6I_MIPI_DPHY is not set CONFIG_PHY_SUN9I_USB=y # CONFIG_PHY_XILINX_ZYNQMP is not set +CONFIG_PINCTRL_IMX8MM=y +CONFIG_PINCTRL_IMX8MN=y +CONFIG_PINCTRL_IMX8MP=y +CONFIG_PINCTRL_IMX8MQ=y +CONFIG_PINCTRL_IMX8ULP=y CONFIG_PINCTRL_ROCKCHIP=y CONFIG_PINCTRL_SUN4I_A10=y CONFIG_PINCTRL_SUN50I_A100=y @@ -331,8 +372,13 @@ CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR_AXP20X=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_ANATOP=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_HI655X=y +CONFIG_REGULATOR_PFUZE100=y +# CONFIG_REGULATOR_VEXPRESS is not set +CONFIG_RESET_IMX7=y CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_ROCKCHIP_IOMMU=y # CONFIG_ROCKCHIP_MBOX is not set @@ -341,10 +387,16 @@ CONFIG_ROCKCHIP_PM_DOMAINS=y # CONFIG_ROCKCHIP_THERMAL is not set CONFIG_RODATA_FULL_DEFAULT_ENABLED=y # CONFIG_RTC_DRV_FSL_FTM_ALARM is not set +# CONFIG_RTC_DRV_IMXDI is not set CONFIG_RTC_DRV_MV=y +# CONFIG_RTC_DRV_MXC is not set +# CONFIG_RTC_DRV_MXC_V2 is not set CONFIG_RTC_I2C_AND_SPI=y # CONFIG_SERIAL_8250_EXAR is not set CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_IMX=y +CONFIG_SERIAL_IMX_CONSOLE=y +CONFIG_SERIAL_IMX_EARLYCON=y CONFIG_SERIAL_MVEBU_CONSOLE=y CONFIG_SERIAL_MVEBU_UART=y CONFIG_SERIAL_SAMSUNG=y @@ -356,15 +408,18 @@ CONFIG_SMC91X=y # CONFIG_SND_SUN8I_CODEC is not set # CONFIG_SND_SUN8I_CODEC_ANALOG is not set # CONFIG_SNI_NETSEC is not set +CONFIG_SOC_IMX8M=y CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPI_ARMADA_3700=y +# CONFIG_SPI_FSL_LPSPI is not set # CONFIG_SPI_FSL_QUADSPI is not set # CONFIG_SPI_HISI_KUNPENG is not set # CONFIG_SPI_HISI_SFC is not set # CONFIG_SPI_HISI_SFC_V3XX is not set +# CONFIG_SPI_IMX is not set # CONFIG_SPI_ROCKCHIP_SFC is not set # CONFIG_SPI_SUN4I is not set # CONFIG_SPI_SUN6I is not set @@ -394,9 +449,32 @@ CONFIG_SYSCTL_EXCEPTION_TRACE=y # CONFIG_TCG_TIS_SYNQUACER is not set CONFIG_THREAD_INFO_IN_TASK=y # CONFIG_TURRIS_MOX_RWTM is not set +CONFIG_TYPEC=y +# CONFIG_TYPEC_DP_ALTMODE is not set +# CONFIG_TYPEC_FUSB302 is not set +# CONFIG_TYPEC_HD3SS3220 is not set +# CONFIG_TYPEC_MUX_PI3USB30532 is not set +# CONFIG_TYPEC_RT1711H is not set +# CONFIG_TYPEC_STUSB160X is not set +CONFIG_TYPEC_TCPCI=y +# CONFIG_TYPEC_TCPCI_MAXIM is not set +CONFIG_TYPEC_TCPM=y +# CONFIG_TYPEC_TPS6598X is not set CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_CHIPIDEA_IMX=y +CONFIG_USB_CHIPIDEA_MSM=y +CONFIG_USB_CHIPIDEA_UDC=y CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_DUAL_ROLE=y +CONFIG_USB_DWC3_HAPS=y +CONFIG_USB_DWC3_IMX8MP=y +CONFIG_USB_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3_XILINX=y +CONFIG_USB_EHCI_FSL=y +# CONFIG_USB_EHCI_HCD_ORION is not set +CONFIG_USB_MXS_PHY=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_HISTB=y CONFIG_USB_XHCI_MVEBU=y diff --git a/target/linux/armvirt/base-files/etc/inittab b/target/linux/armvirt/base-files/etc/inittab index 837d7f32a41f0f..83b1888c5c33be 100644 --- a/target/linux/armvirt/base-files/etc/inittab +++ b/target/linux/armvirt/base-files/etc/inittab @@ -3,3 +3,6 @@ ttyAMA0::askfirst:/usr/libexec/login.sh ttyS0::askfirst:/usr/libexec/login.sh hvc0::askfirst:/usr/libexec/login.sh +ttymxc0::askfirst:/usr/libexec/login.sh +ttymxc1::askfirst:/usr/libexec/login.sh +ttymxc2::askfirst:/usr/libexec/login.sh diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index 5a2004345c236b..693ae38c08db82 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -108,7 +108,7 @@ define Device/generic DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ - kmod-fsl-enetc-net \ + kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec \ kmod-phy-aquantia kmod-phy-broadcom kmod-phy-marvell \ kmod-phy-marvell-10g kmod-atlantic endef diff --git a/target/linux/armvirt/modules.mk b/target/linux/armvirt/modules.mk index f1dc28083ac8eb..1750fe73d74afb 100644 --- a/target/linux/armvirt/modules.mk +++ b/target/linux/armvirt/modules.mk @@ -25,6 +25,29 @@ endef $(eval $(call KernelPackage,fsl-pcs-lynx)) +define KernelPackage/pcs-xpcs + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Synopsis DesignWare PCS driver + DEPENDS:=@(TARGET_armvirt_64) + KCONFIG:=CONFIG_PCS_XPCS + FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko + AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs) +endef + +$(eval $(call KernelPackage,pcs-xpcs)) + +define KernelPackage/fsl-fec + SUBMENU:=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio \ + +kmod-ptp +kmod-net-selftests + TITLE:=NXP (Freescale) FEC Ethernet controller (i.MX) + KCONFIG:=CONFIG_FEC + FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/fec.ko + AUTOLOAD:=$(call AutoLoad,35,fec) +endef + +$(eval $(call KernelPackage,fsl-fec)) + define KernelPackage/fsl-xgmac-mdio SUBMENU=$(NETWORK_DEVICES_MENU) DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio @@ -162,6 +185,54 @@ endef $(eval $(call KernelPackage,mvpp2)) +define KernelPackage/imx2-wdt + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP (Freescale) i.MX2+ and Layerscape watchdog driver + KCONFIG:=CONFIG_IMX2_WDT + FILES=$(LINUX_DIR)/drivers/watchdog/imx2_wdt.ko + AUTOLOAD=$(call AutoLoad,60,imx2_wdt) +endef + +$(eval $(call KernelPackage,imx2-wdt)) + +define KernelPackage/imx7-ulp-wdt + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP (Freescale) i.MX7ULP and later watchdog + KCONFIG:=CONFIG_IMX7ULP_WDT + FILES=$(LINUX_DIR)/drivers/watchdog/imx7ulp_wdt.ko + AUTOLOAD=$(call AutoLoad,60,imx7ulp_wdt) +endef + +$(eval $(call KernelPackage,imx7-ulp-wdt)) + +define KernelPackage/stmmac-core + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others) + DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-pcs-xpcs +kmod-ptp + KCONFIG:=CONFIG_STMMAC_ETH \ + CONFIG_STMMAC_SELFTESTS=n \ + CONFIG_STMMAC_PLATFORM \ + CONFIG_CONFIG_DWMAC_DWC_QOS_ETH=n \ + CONFIG_DWMAC_GENERIC + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac.ko \ + $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac-platform.ko \ + $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.ko + AUTOLOAD=$(call AutoLoad,40,stmmac stmmac-platform dwmac-generic) +endef + +$(eval $(call KernelPackage,stmmac-core)) + +define KernelPackage/dwmac-imx + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=NXP i.MX8 Ethernet controller + DEPENDS:=+kmod-stmmac-core + KCONFIG:=CONFIG_DWMAC_IMX8 + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.ko + AUTOLOAD=$(call AutoLoad,45,dwmac-imx) +endef + +$(eval $(call KernelPackage,dwmac-imx)) + define KernelPackage/wdt-sp805 SUBMENU:=$(OTHER_MENU) TITLE:=ARM SP805 Watchdog From a80eeec96d0826ecf516bc0d350ddb0221452c3d Mon Sep 17 00:00:00 2001 From: Anton Antonov Date: Thu, 22 Dec 2022 12:01:59 +0000 Subject: [PATCH 0165/1171] armvirt: 64: Add storage support for qemu-sbsa platform Enable SATA support, which is used by the Server Base System Architecture reference board[1]. Signed-off-by: Anton Antonov Signed-off-by: Mathew McBride [1] - https://qemu.readthedocs.io/en/latest/system/arm/sbsa.html (23.05/5.15 version of 26905c96124af10a795167509116252e9357baea) --- target/linux/armvirt/64/config-5.15 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armvirt/64/config-5.15 index e77d17d07f10a3..225a8aac8d6093 100644 --- a/target/linux/armvirt/64/config-5.15 +++ b/target/linux/armvirt/64/config-5.15 @@ -62,6 +62,7 @@ CONFIG_ARM_SMMU_V3=y # CONFIG_ARM_SMMU_V3_PMU is not set # CONFIG_ARM_SMMU_V3_SVA is not set CONFIG_AT803X_PHY=y +CONFIG_ATA=y CONFIG_ATOMIC64_SELFTEST=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y # CONFIG_AXI_DMAC is not set @@ -392,6 +393,9 @@ CONFIG_RTC_DRV_MV=y # CONFIG_RTC_DRV_MXC is not set # CONFIG_RTC_DRV_MXC_V2 is not set CONFIG_RTC_I2C_AND_SPI=y +CONFIG_SATA_AHCI=y +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_SATA_HOST=y # CONFIG_SERIAL_8250_EXAR is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_IMX=y From a86b74cbfea33814fb78946d75e73b7fdb496e43 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Sat, 11 Feb 2023 03:58:09 +0000 Subject: [PATCH 0166/1171] armvirt: 64: add Marvell (formerly Cavium) ThunderX series network driver Based on working configuration supplied by Anton Antonov. Signed-off-by: Mathew McBride (cherry picked from commit 5d2a5f739840caa6e72b5c907d355f6aaca227d4) --- target/linux/armvirt/image/Makefile | 4 ++-- target/linux/armvirt/modules.mk | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index 693ae38c08db82..928ee3ce855b71 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -108,8 +108,8 @@ define Device/generic DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ - kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec \ - kmod-phy-aquantia kmod-phy-broadcom kmod-phy-marvell \ + kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ + kmod-phy-aquantia kmod-phy-broadcom kmod-phy-marvell kmod-phy-marvell-10g kmod-atlantic endef TARGET_DEVICES += generic diff --git a/target/linux/armvirt/modules.mk b/target/linux/armvirt/modules.mk index 1750fe73d74afb..e9555f0184be59 100644 --- a/target/linux/armvirt/modules.mk +++ b/target/linux/armvirt/modules.mk @@ -233,6 +233,24 @@ endef $(eval $(call KernelPackage,dwmac-imx)) +define KernelPackage/thunderx-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell (Cavium) ThunderX/2 network drivers + DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink + KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \ + CONFIG_THUNDER_NIC_PF \ + CONFIG_THUNDER_NIC_VF \ + CONFIG_THUNDER_NIC_BGX \ + CONFIG_THUNDER_NIC_RGX + FILES=$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicvf.ko \ + $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicpf.ko \ + $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_xcv.ko \ + $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_bgx.ko + AUTOLOAD=$(call AutoLoad,40,nicpf nicvf thunder_xcv thunder_bgx) +endef + +$(eval $(call KernelPackage,thunderx-net)) + define KernelPackage/wdt-sp805 SUBMENU:=$(OTHER_MENU) TITLE:=ARM SP805 Watchdog From 4d13a09ba0835d5d60ae6f04818cb592a1cd59dd Mon Sep 17 00:00:00 2001 From: Luiz Angelo Daros de Luca Date: Thu, 8 Jun 2023 23:41:54 -0300 Subject: [PATCH 0167/1171] kernel: modules: fix mdio-bus-mux description Simple error during copy/paste Fixes: 2dbeb607251b ("kernel: add mdio-bus-mux support") Signed-off-by: Luiz Angelo Daros de Luca (cherry picked from commit 1e4bc13eaa3fdba897ca1721b2bfe9f2dbb30770) --- package/kernel/linux/modules/netsupport.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 580ebb2d1b6cf4..7f1905311fc94f 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -1368,7 +1368,7 @@ define KernelPackage/mdio-bus-mux AUTOLOAD:=$(call AutoLoad,32,mdio-mux) endef -define KernelPackage/mdio/description +define KernelPackage/mdio-bus-mux/description Kernel framework for MDIO bus multiplexers. endef From bbd1676cd2bb02f537cc19366c2872c1f5b6cc96 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 20 Mar 2023 02:53:31 +0000 Subject: [PATCH 0168/1171] armvirt: 64: add Allwinner A3/A83T/A64 (sun8i family) Ethernet Add support for the dwmac (stmmac) variant used by Allwinner Arm64 boards. Signed-off-by: Mathew McBride (cherry picked from commit 847467a5729995a98aa34329f6fa0ed4cb79d210) --- target/linux/armvirt/image/Makefile | 2 +- target/linux/armvirt/modules.mk | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index 928ee3ce855b71..a4c0c17ec605df 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -109,7 +109,7 @@ define Device/generic kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ - kmod-phy-aquantia kmod-phy-broadcom kmod-phy-marvell + kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom kmod-phy-marvell \ kmod-phy-marvell-10g kmod-atlantic endef TARGET_DEVICES += generic diff --git a/target/linux/armvirt/modules.mk b/target/linux/armvirt/modules.mk index e9555f0184be59..f94b25aad43b91 100644 --- a/target/linux/armvirt/modules.mk +++ b/target/linux/armvirt/modules.mk @@ -233,6 +233,17 @@ endef $(eval $(call KernelPackage,dwmac-imx)) +define KernelPackage/dwmac-sun8i + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=Allwinner H3/A83T/A64 (sun8i) Ethernet + DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux + KCONFIG:=CONFIG_DWMAC_SUN8I + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.ko + AUTOLOAD=$(call AutoLoad,45,dwmac-sun8i) +endef + +$(eval $(call KernelPackage,dwmac-sun8i)) + define KernelPackage/thunderx-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell (Cavium) ThunderX/2 network drivers From 4177b69b465e35c735ea57e9e57e233965c10568 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 18 Apr 2023 03:34:23 +0000 Subject: [PATCH 0169/1171] armvirt: package and select Rockchip DWMAC Ethernet driver For devices that implement the "rockchip,*-gmac" compatible controller, including: - RK3328 - RK3399 - RK3568 - RK3588 - PX30 Signed-off-by: Mathew McBride (cherry picked from commit abbffe55ddded36d2a4d0eee6e96c742eaffbbd2) --- target/linux/armvirt/image/Makefile | 4 ++-- target/linux/armvirt/modules.mk | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile index a4c0c17ec605df..e3031d5a138cf7 100644 --- a/target/linux/armvirt/image/Makefile +++ b/target/linux/armvirt/image/Makefile @@ -109,8 +109,8 @@ define Device/generic kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ - kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom kmod-phy-marvell \ - kmod-phy-marvell-10g kmod-atlantic + kmod-dwmac-rockchip kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom \ + kmod-phy-marvell kmod-phy-marvell-10g kmod-atlantic endef TARGET_DEVICES += generic diff --git a/target/linux/armvirt/modules.mk b/target/linux/armvirt/modules.mk index f94b25aad43b91..5826c545b73ba2 100644 --- a/target/linux/armvirt/modules.mk +++ b/target/linux/armvirt/modules.mk @@ -244,6 +244,17 @@ endef $(eval $(call KernelPackage,dwmac-sun8i)) +define KernelPackage/dwmac-rockchip + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=Rockchip RK3328/RK3399/RK3568 Ethernet + DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux + KCONFIG:=CONFIG_DWMAC_ROCKCHIP + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.ko + AUTOLOAD=$(call AutoLoad,45,dwmac-rk) +endef + +$(eval $(call KernelPackage,dwmac-rockchip)) + define KernelPackage/thunderx-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell (Cavium) ThunderX/2 network drivers From 067f252331ec62001b302c8cc540ed531cee9c68 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 5 Sep 2022 16:55:02 +1000 Subject: [PATCH 0170/1171] armvirt: config changes required for framebuffer console These Kconfig options are required to get a screen console working with the VMware Fusion ARM (Apple Silicon) preview. They are likely to be the same for other Arm standard "desktop" hardware that may emerge. Signed-off-by: Mathew McBride (23.05/5.15 version of 83f564f7464c34c7713b20b61007b24b217f0b88) --- target/linux/armvirt/config-5.15 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target/linux/armvirt/config-5.15 b/target/linux/armvirt/config-5.15 index a45126ead22889..530a4d5bd761e7 100644 --- a/target/linux/armvirt/config-5.15 +++ b/target/linux/armvirt/config-5.15 @@ -77,6 +77,7 @@ CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y # CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_PM=y @@ -122,6 +123,9 @@ CONFIG_FIX_EARLYCON_MEM=y CONFIG_FONT_8x16=y CONFIG_FONT_AUTOSELECT=y CONFIG_FONT_SUPPORT=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set CONFIG_FRAME_POINTER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y @@ -162,6 +166,8 @@ CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y +CONFIG_HID=y +CONFIG_HID_GENERIC=y CONFIG_HOTPLUG_CPU=y CONFIG_HOTPLUG_PCI_ACPI=y CONFIG_HVC_DRIVER=y @@ -173,6 +179,7 @@ CONFIG_I2C_HID_ACPI=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 # CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT_KEYBOARD=y CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y @@ -282,6 +289,9 @@ CONFIG_TREE_SRCU=y CONFIG_UCS2_STRING=y CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_USB=y +CONFIG_USB_HID=y +CONFIG_USB_HIDDEV=y +CONFIG_USB_PCI=y CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USB_XHCI_HCD=y @@ -298,6 +308,9 @@ CONFIG_VIRTIO_PCI_LEGACY=y CONFIG_VIRTIO_PCI_LIB=y CONFIG_VMAP_STACK=y CONFIG_WATCHDOG_CORE=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set CONFIG_WDAT_WDT=y CONFIG_XPS=y CONFIG_ZONE_DMA32=y From bacc385dc56440a9c2bf1a574ba26d72d25d2d74 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 5 Sep 2022 16:56:49 +1000 Subject: [PATCH 0171/1171] armvirt: base-files: add tty0 to inittab tty0 is the default console for devices with screens/framebuffers. Signed-off-by: Mathew McBride (cherry picked from commit e41b82f619ca02f427f34ae439d4584ab441e245) --- target/linux/armvirt/base-files/etc/inittab | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/armvirt/base-files/etc/inittab b/target/linux/armvirt/base-files/etc/inittab index 83b1888c5c33be..51832eb77564f8 100644 --- a/target/linux/armvirt/base-files/etc/inittab +++ b/target/linux/armvirt/base-files/etc/inittab @@ -2,6 +2,7 @@ ::shutdown:/etc/init.d/rcS K shutdown ttyAMA0::askfirst:/usr/libexec/login.sh ttyS0::askfirst:/usr/libexec/login.sh +tty0::askfirst:/usr/libexec/login.sh hvc0::askfirst:/usr/libexec/login.sh ttymxc0::askfirst:/usr/libexec/login.sh ttymxc1::askfirst:/usr/libexec/login.sh From 86b50228c09acf09266fdb2f166a121ff7cc23e2 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 13 Feb 2023 06:51:26 +0000 Subject: [PATCH 0172/1171] armvirt: 64: disable CONFIG_SMC91X The SMC91X family is a ISA-age Ethernet controller. I'm not particularly sure what it's doing in armvirt/64, as it's unlikely there is a QEMU or real hardware configuration that exists with it. Signed-off-by: Mathew McBride (23.05/5.15 version of commit 214e94cddf1bfd4e6141f79a70f532267fe1bea0) --- target/linux/armvirt/64/config-5.15 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armvirt/64/config-5.15 index 225a8aac8d6093..54dd78a8aa1558 100644 --- a/target/linux/armvirt/64/config-5.15 +++ b/target/linux/armvirt/64/config-5.15 @@ -405,7 +405,7 @@ CONFIG_SERIAL_MVEBU_CONSOLE=y CONFIG_SERIAL_MVEBU_UART=y CONFIG_SERIAL_SAMSUNG=y CONFIG_SERIAL_SAMSUNG_CONSOLE=y -CONFIG_SMC91X=y +# CONFIG_SMC91X is not set # CONFIG_SND_SUN4I_I2S is not set # CONFIG_SND_SUN50I_CODEC_ANALOG is not set # CONFIG_SND_SUN50I_DMIC is not set From 963ce6990f231d9457cf700275963563901c05cc Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 5 Oct 2022 12:40:22 +1100 Subject: [PATCH 0173/1171] kernel: kmod-amazon-ena: move to top level netdevices The Amazon ENA network devices are also used on the AWS Arm (Graviton) instance types, so move it from the x86-only module file to the top level netdevices. Signed-off-by: Mathew McBride (cherry picked from commit 3a7c8fd15e89237c8c9db62393d057f3a47429d2) --- package/kernel/linux/modules/netdevices.mk | 16 +++++++++++++++- target/linux/x86/modules.mk | 17 ----------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index dd458ece4cfd47..e9821c56ec1b15 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1522,7 +1522,6 @@ endef $(eval $(call KernelPackage,atlantic)) - define KernelPackage/lan743x SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Microchip LAN743x PCI Express Gigabit Ethernet NIC @@ -1538,3 +1537,18 @@ endef $(eval $(call KernelPackage,lan743x)) +define KernelPackage/amazon-ena + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Elastic Network Adapter (for Amazon AWS) + DEPENDS:=@TARGET_x86_64||TARGET_armvirt_64 + KCONFIG:=CONFIG_ENA_ETHERNET + FILES:=$(LINUX_DIR)/drivers/net/ethernet/amazon/ena/ena.ko + AUTOLOAD:=$(call AutoLoad,12,ena) +endef + +define KernelPackage/amazon-ena/description + This driver supports Elastic Network Adapter (ENA) + used by Amazon AWS T3 (2018) and later instances. +endef + +$(eval $(call KernelPackage,amazon-ena)) diff --git a/target/linux/x86/modules.mk b/target/linux/x86/modules.mk index f6a7c6c440b4e0..511410d614bc81 100644 --- a/target/linux/x86/modules.mk +++ b/target/linux/x86/modules.mk @@ -2,23 +2,6 @@ # # Copyright (C) 2017 Cezary Jackiewicz -define KernelPackage/amazon-ena - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Elastic Network Adapter (for Amazon AWS T3) - DEPENDS:=@TARGET_x86_64 - KCONFIG:=CONFIG_ENA_ETHERNET - FILES:=$(LINUX_DIR)/drivers/net/ethernet/amazon/ena/ena.ko - AUTOLOAD:=$(call AutoLoad,12,ena) -endef - -define KernelPackage/amazon-ena/description - This driver supports Elastic Network Adapter (ENA) - used by Amazon AWS T3 instances. -endef - -$(eval $(call KernelPackage,amazon-ena)) - - define KernelPackage/amd-xgbe SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=AMD Ethernet on SoC support From 7198185e3af80ca2807ecea610bee6e4bc7f90ba Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 9 Jun 2023 00:43:33 +0000 Subject: [PATCH 0174/1171] armsr: rename from armvirt Now that the armvirt target supports real hardware, not just VMs, thanks to the addition of EFI, rename it to something more appropriate. 'armsr' (Arm SystemReady) was chosen after the name of the Arm standards program. The 32 and 64 bit targets have also been renamed armv7 and armv8 respectively, to allow future profiles where required (such as armv9). See https://developer.arm.com/documentation/102858/0100/Introduction for more information. Signed-off-by: Mathew McBride (23.05 version of commit 40b02a230167626def69389452f19b7109aaeac1) --- target/linux/{armvirt => armsr}/Makefile | 4 +-- target/linux/{armvirt => armsr}/README | 30 +++++++++++-------- .../{armvirt/32 => armsr/armv7}/config-5.15 | 0 .../{armvirt/32 => armsr/armv7}/target.mk | 4 +-- .../{armvirt/64 => armsr/armv8}/config-5.15 | 0 .../{armvirt/64 => armsr/armv8}/target.mk | 4 +-- .../base-files/etc/board.d/01_led | 0 .../base-files/etc/board.d/02_network | 0 .../base-files/etc/board.d/03_gpio_switches | 0 .../{armvirt => armsr}/base-files/etc/inittab | 0 .../base-files/lib/preinit/01_sysinfo_acpi | 0 .../base-files/lib/upgrade/platform.sh | 0 target/linux/{armvirt => armsr}/config-5.15 | 0 .../linux/{armvirt => armsr}/image/Makefile | 0 .../{armvirt => armsr}/image/grub-efi.cfg | 0 target/linux/{armvirt => armsr}/modules.mk | 30 +++++++++---------- ...221-armsr-armv7-disable-gc_sections.patch} | 0 .../701-dpaa2-eth-do-not-hold-rtnl_lock.patch | 0 ...2-mac-add-support-for-more-10G-modes.patch | 0 19 files changed, 38 insertions(+), 34 deletions(-) rename target/linux/{armvirt => armsr}/Makefile (88%) rename target/linux/{armvirt => armsr}/README (63%) rename target/linux/{armvirt/32 => armsr/armv7}/config-5.15 (100%) rename target/linux/{armvirt/32 => armsr/armv7}/target.mk (70%) rename target/linux/{armvirt/64 => armsr/armv8}/config-5.15 (100%) rename target/linux/{armvirt/64 => armsr/armv8}/target.mk (69%) rename target/linux/{armvirt => armsr}/base-files/etc/board.d/01_led (100%) rename target/linux/{armvirt => armsr}/base-files/etc/board.d/02_network (100%) rename target/linux/{armvirt => armsr}/base-files/etc/board.d/03_gpio_switches (100%) rename target/linux/{armvirt => armsr}/base-files/etc/inittab (100%) rename target/linux/{armvirt => armsr}/base-files/lib/preinit/01_sysinfo_acpi (100%) rename target/linux/{armvirt => armsr}/base-files/lib/upgrade/platform.sh (100%) rename target/linux/{armvirt => armsr}/config-5.15 (100%) rename target/linux/{armvirt => armsr}/image/Makefile (100%) rename target/linux/{armvirt => armsr}/image/grub-efi.cfg (100%) rename target/linux/{armvirt => armsr}/modules.mk (89%) rename target/linux/{armvirt/patches-5.15/221-armvirt-disable-gc_sections.patch => armsr/patches-5.15/221-armsr-armv7-disable-gc_sections.patch} (100%) rename target/linux/{armvirt => armsr}/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch (100%) rename target/linux/{armvirt => armsr}/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch (100%) diff --git a/target/linux/armvirt/Makefile b/target/linux/armsr/Makefile similarity index 88% rename from target/linux/armvirt/Makefile rename to target/linux/armsr/Makefile index 04ff914b96e33a..755c77f4465dc3 100644 --- a/target/linux/armvirt/Makefile +++ b/target/linux/armsr/Makefile @@ -4,8 +4,8 @@ include $(TOPDIR)/rules.mk -BOARD:=armvirt -BOARDNAME:=QEMU ARM Virtual Machine +BOARD:=armsr +BOARDNAME:=Arm SystemReady (EFI) compliant FEATURES:=fpu pci pcie rtc usb boot-part rootfs-part FEATURES+=cpiogz ext4 ramdisk squashfs targz vmdk diff --git a/target/linux/armvirt/README b/target/linux/armsr/README similarity index 63% rename from target/linux/armvirt/README rename to target/linux/armsr/README index b4409f8f1135f6..bce839ddfc4742 100644 --- a/target/linux/armvirt/README +++ b/target/linux/armsr/README @@ -1,37 +1,41 @@ This target generates images that can be used on ARM machines with EFI support (e.g EDKII/TianoCore or U-Boot with bootefi). +There are two subtargets: +- armv7 for 32-bit machines +- armv8 for 64-bit machines + The kernel and filesystem images can also be used directly by QEMU: Run with qemu-system-arm # boot with initramfs embedded in - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-initramfs-kernel.bin + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-initramfs-kernel.bin # boot with accel=kvm qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel - openwrt-armvirt-32-generic-initramfs-kernel.bin + openwrt-armsr-armv7-generic-initramfs-kernel.bin # boot with a separate rootfs - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \ - -drive file=openwrt-armvirt-32-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait' + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-kernel.bin \ + -drive file=openwrt-armsr-armv7-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait' # boot with local dir as rootfs - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \ - -fsdev local,id=rootdev,path=root-armvirt/,security_model=none \ + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-kernel.bin \ + -fsdev local,id=rootdev,path=root-armsr/,security_model=none \ -device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \ -append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p' Run with kvmtool # start a named machine - lkvm run -k openwrt-armvirt-32-zImage -i openwrt-armvirt-32-rootfs.cpio --name armvirt0 + lkvm run -k openwrt-armsr-armv7-zImage -i openwrt-armsr-armv7-rootfs.cpio --name armsr0 # start with virtio-9p rootfs - lkvm run -k openwrt-armvirt-32-zImage -d root-armvirt/ + lkvm run -k openwrt-armsr-armv7-zImage -d root-armsr/ - # stop "armvirt0" - lkvm stop --name armvirt0 + # stop "armsr0" + lkvm stop --name armsr0 # stop all lkvm stop --all @@ -39,13 +43,13 @@ Run with kvmtool The multi-platform ARMv8 target can be used with QEMU: qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \ - -kernel openwrt-armvirt-64-generic-initramfs-kernel.bin \ + -kernel openwrt-armsr-armv8-generic-initramfs-kernel.bin \ With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use these images in EFI mode: 32-bit: -gunzip -c bin/targets/armvirt/32/openwrt-armvirt-32-generic-ext4-combined.img.gz > openwrt-arm-32.img +gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined.img.gz > openwrt-arm-32.img qemu-system-arm -nographic \ -cpu cortex-a15 -machine virt \ -bios QEMU_EFI_32.fd \ @@ -56,7 +60,7 @@ qemu-system-arm -nographic \ -netdev user,id=testwan -net nic,netdev=testwan 64-bit: -gunzip -c bin/targets/armvirt/64/openwrt-armvirt-64-generic-ext4-combined.img.gz > openwrt-arm-64.img +gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined.img.gz > openwrt-arm-64.img qemu-system-aarch64 -nographic \ -cpu cortex-a53 -machine virt \ -bios QEMU_EFI_64.fd \ diff --git a/target/linux/armvirt/32/config-5.15 b/target/linux/armsr/armv7/config-5.15 similarity index 100% rename from target/linux/armvirt/32/config-5.15 rename to target/linux/armsr/armv7/config-5.15 diff --git a/target/linux/armvirt/32/target.mk b/target/linux/armsr/armv7/target.mk similarity index 70% rename from target/linux/armvirt/32/target.mk rename to target/linux/armsr/armv7/target.mk index df220402411cfd..fbad3abb260f61 100644 --- a/target/linux/armvirt/32/target.mk +++ b/target/linux/armsr/armv7/target.mk @@ -1,6 +1,6 @@ ARCH:=arm -SUBTARGET:=32 -BOARDNAME:=32-bit ARM QEMU Virtual Machine +SUBTARGET:=armv7 +BOARDNAME:=32-bit (armv7) machines CPU_TYPE:=cortex-a15 CPU_SUBTYPE:=neon-vfpv4 KERNELNAME:=zImage diff --git a/target/linux/armvirt/64/config-5.15 b/target/linux/armsr/armv8/config-5.15 similarity index 100% rename from target/linux/armvirt/64/config-5.15 rename to target/linux/armsr/armv8/config-5.15 diff --git a/target/linux/armvirt/64/target.mk b/target/linux/armsr/armv8/target.mk similarity index 69% rename from target/linux/armvirt/64/target.mk rename to target/linux/armsr/armv8/target.mk index ac5a60d848b858..654e5976cae996 100644 --- a/target/linux/armvirt/64/target.mk +++ b/target/linux/armsr/armv8/target.mk @@ -1,6 +1,6 @@ ARCH:=aarch64 -SUBTARGET:=64 -BOARDNAME:=64-bit ARM machines +SUBTARGET:=armv8 +BOARDNAME:=64-bit (armv8) machines define Target/Description Build multi-platform images for the ARMv8 instruction set architecture diff --git a/target/linux/armvirt/base-files/etc/board.d/01_led b/target/linux/armsr/base-files/etc/board.d/01_led similarity index 100% rename from target/linux/armvirt/base-files/etc/board.d/01_led rename to target/linux/armsr/base-files/etc/board.d/01_led diff --git a/target/linux/armvirt/base-files/etc/board.d/02_network b/target/linux/armsr/base-files/etc/board.d/02_network similarity index 100% rename from target/linux/armvirt/base-files/etc/board.d/02_network rename to target/linux/armsr/base-files/etc/board.d/02_network diff --git a/target/linux/armvirt/base-files/etc/board.d/03_gpio_switches b/target/linux/armsr/base-files/etc/board.d/03_gpio_switches similarity index 100% rename from target/linux/armvirt/base-files/etc/board.d/03_gpio_switches rename to target/linux/armsr/base-files/etc/board.d/03_gpio_switches diff --git a/target/linux/armvirt/base-files/etc/inittab b/target/linux/armsr/base-files/etc/inittab similarity index 100% rename from target/linux/armvirt/base-files/etc/inittab rename to target/linux/armsr/base-files/etc/inittab diff --git a/target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi b/target/linux/armsr/base-files/lib/preinit/01_sysinfo_acpi similarity index 100% rename from target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi rename to target/linux/armsr/base-files/lib/preinit/01_sysinfo_acpi diff --git a/target/linux/armvirt/base-files/lib/upgrade/platform.sh b/target/linux/armsr/base-files/lib/upgrade/platform.sh similarity index 100% rename from target/linux/armvirt/base-files/lib/upgrade/platform.sh rename to target/linux/armsr/base-files/lib/upgrade/platform.sh diff --git a/target/linux/armvirt/config-5.15 b/target/linux/armsr/config-5.15 similarity index 100% rename from target/linux/armvirt/config-5.15 rename to target/linux/armsr/config-5.15 diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armsr/image/Makefile similarity index 100% rename from target/linux/armvirt/image/Makefile rename to target/linux/armsr/image/Makefile diff --git a/target/linux/armvirt/image/grub-efi.cfg b/target/linux/armsr/image/grub-efi.cfg similarity index 100% rename from target/linux/armvirt/image/grub-efi.cfg rename to target/linux/armsr/image/grub-efi.cfg diff --git a/target/linux/armvirt/modules.mk b/target/linux/armsr/modules.mk similarity index 89% rename from target/linux/armvirt/modules.mk rename to target/linux/armsr/modules.mk index 5826c545b73ba2..86acc8c4c796ce 100644 --- a/target/linux/armvirt/modules.mk +++ b/target/linux/armsr/modules.mk @@ -1,7 +1,7 @@ define KernelPackage/acpi-mdio SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=ACPI MDIO support - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-mdio-devres + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-mdio-devres KCONFIG:=CONFIG_ACPI_MDIO FILES:=$(LINUX_DIR)/drivers/net/mdio/acpi_mdio.ko AUTOLOAD:=$(call AutoLoad,11,acpi_mdio) @@ -15,7 +15,7 @@ $(eval $(call KernelPackage,acpi-mdio)) define KernelPackage/fsl-pcs-lynx SUBMENU=$(NETWORK_DEVICES_MENU) - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-phylink + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-phylink TITLE:=NXP (Freescale) Lynx PCS HIDDEN:=1 KCONFIG:=CONFIG_PCS_LYNX @@ -28,7 +28,7 @@ $(eval $(call KernelPackage,fsl-pcs-lynx)) define KernelPackage/pcs-xpcs SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Synopsis DesignWare PCS driver - DEPENDS:=@(TARGET_armvirt_64) + DEPENDS:=@(TARGET_armsr_armv8) KCONFIG:=CONFIG_PCS_XPCS FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs) @@ -38,7 +38,7 @@ $(eval $(call KernelPackage,pcs-xpcs)) define KernelPackage/fsl-fec SUBMENU:=$(NETWORK_DEVICES_MENU) - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio \ + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio \ +kmod-ptp +kmod-net-selftests TITLE:=NXP (Freescale) FEC Ethernet controller (i.MX) KCONFIG:=CONFIG_FEC @@ -50,7 +50,7 @@ $(eval $(call KernelPackage,fsl-fec)) define KernelPackage/fsl-xgmac-mdio SUBMENU=$(NETWORK_DEVICES_MENU) - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio TITLE:=NXP (Freescale) MDIO bus KCONFIG:=CONFIG_FSL_XGMAC_MDIO FILES=$(LINUX_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko @@ -74,7 +74,7 @@ $(eval $(call KernelPackage,fsl-mc-dpio)) define KernelPackage/fsl-enetc-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=:NXP ENETC (LS1028A) Ethernet - DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-fsl-pcs-lynx + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-fsl-pcs-lynx KCONFIG:= \ CONFIG_FSL_ENETC \ CONFIG_FSL_ENETC_VF \ @@ -92,7 +92,7 @@ $(eval $(call KernelPackage,fsl-enetc-net)) define KernelPackage/fsl-dpaa1-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=NXP DPAA1 (LS1043/LS1046) Ethernet - DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32 + DEPENDS:=@(TARGET_armsr_armv8) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32 KCONFIG:= \ CONFIG_FSL_DPAA=y \ CONFIG_FSL_DPAA_ETH \ @@ -112,7 +112,7 @@ $(eval $(call KernelPackage,fsl-dpaa1-net)) define KernelPackage/fsl-dpaa2-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=NXP DPAA2 Ethernet - DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-phylink \ + DEPENDS:=@(TARGET_armsr_armv8) +kmod-fsl-xgmac-mdio +kmod-phylink \ +kmod-fsl-pcs-lynx +kmod-fsl-mc-dpio KCONFIG:= \ CONFIG_FSL_MC_UAPI_SUPPORT=y \ @@ -127,7 +127,7 @@ $(eval $(call KernelPackage,fsl-dpaa2-net)) define KernelPackage/fsl-dpaa2-console SUBMENU:=$(OTHER_MENU) TITLE:=NXP DPAA2 Debug console - DEPENDS:=@(TARGET_armvirt_64) + DEPENDS:=@(TARGET_armsr_armv8) KCONFIG:=CONFIG_DPAA2_CONSOLE FILES=$(LINUX_DIR)/drivers/soc/fsl/dpaa2-console.ko AUTOLOAD=$(call AutoLoad,40,dpaa2-console) @@ -143,7 +143,7 @@ $(eval $(call KernelPackage,fsl-dpaa2-console)) define KernelPackage/marvell-mdio SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell Armada platform MDIO driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio KCONFIG:=CONFIG_MVMDIO FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvmdio.ko AUTOLOAD=$(call AutoLoad,30,marvell-mdio) @@ -154,7 +154,7 @@ $(eval $(call KernelPackage,marvell-mdio)) define KernelPackage/phy-marvell-10g SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell Alaska 10G PHY driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy KCONFIG:=CONFIG_MARVELL_10G_PHY FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko AUTOLOAD=$(call AutoLoad,35,marvell10g) @@ -165,7 +165,7 @@ $(eval $(call KernelPackage,phy-marvell-10g)) define KernelPackage/mvneta SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell Armada 370/38x/XP/37xx network driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink + DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink KCONFIG:=CONFIG_MVNETA FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvneta.ko AUTOLOAD=$(call AutoLoad,40,mvneta) @@ -176,7 +176,7 @@ $(eval $(call KernelPackage,mvneta)) define KernelPackage/mvpp2 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell Armada 375/7K/8K network driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink + DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink KCONFIG:=CONFIG_MVPP2 \ CONFIG_MVPP2_PTP=n FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko @@ -208,7 +208,7 @@ $(eval $(call KernelPackage,imx7-ulp-wdt)) define KernelPackage/stmmac-core SUBMENU=$(NETWORK_DEVICES_MENU) TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others) - DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-pcs-xpcs +kmod-ptp + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-pcs-xpcs +kmod-ptp KCONFIG:=CONFIG_STMMAC_ETH \ CONFIG_STMMAC_SELFTESTS=n \ CONFIG_STMMAC_PLATFORM \ @@ -258,7 +258,7 @@ $(eval $(call KernelPackage,dwmac-rockchip)) define KernelPackage/thunderx-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell (Cavium) ThunderX/2 network drivers - DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \ CONFIG_THUNDER_NIC_PF \ CONFIG_THUNDER_NIC_VF \ diff --git a/target/linux/armvirt/patches-5.15/221-armvirt-disable-gc_sections.patch b/target/linux/armsr/patches-5.15/221-armsr-armv7-disable-gc_sections.patch similarity index 100% rename from target/linux/armvirt/patches-5.15/221-armvirt-disable-gc_sections.patch rename to target/linux/armsr/patches-5.15/221-armsr-armv7-disable-gc_sections.patch diff --git a/target/linux/armvirt/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch b/target/linux/armsr/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch similarity index 100% rename from target/linux/armvirt/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch rename to target/linux/armsr/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch diff --git a/target/linux/armvirt/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch b/target/linux/armsr/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch similarity index 100% rename from target/linux/armvirt/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch rename to target/linux/armsr/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch From a6afb3a7bcab650f4a005b254af59aceeaef84ff Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 6 Jun 2023 23:22:01 +0000 Subject: [PATCH 0175/1171] config: change references from armvirt to armsr armvirt target has been renamed to armsr (Arm SystemReady), so the config defaults need to be changed as well. Signed-off-by: Mathew McBride (cherry picked from commit 40ce6a7920a8f56d07228795a526576a8762aead) --- config/Config-images.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/Config-images.in b/config/Config-images.in index d92c31ec5fcefa..ea7b3d37c3d5de 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -204,12 +204,12 @@ menu "Target Images" config GRUB_EFI_IMAGES bool "Build GRUB EFI images (Linux x86 or x86_64 host only)" - depends on TARGET_x86 || TARGET_armvirt + depends on TARGET_x86 || TARGET_armsr depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS select PACKAGE_grub2 if TARGET_x86 select PACKAGE_grub2-efi if TARGET_x86 select PACKAGE_grub2-bios-setup if TARGET_x86 - select PACKAGE_grub2-efi-arm if TARGET_armvirt + select PACKAGE_grub2-efi-arm if TARGET_armsr select PACKAGE_kmod-fs-vfat default y @@ -267,7 +267,7 @@ menu "Target Images" config VMDK_IMAGES bool "Build VMware image files (VMDK)" - depends on TARGET_x86 || TARGET_armvirt + depends on TARGET_x86 || TARGET_armsr depends on GRUB_IMAGES || GRUB_EFI_IMAGES select PACKAGE_kmod-e1000 @@ -279,7 +279,7 @@ menu "Target Images" config TARGET_IMAGES_GZIP bool "GZip images" - depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta + depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armsr || TARGET_malta default y comment "Image Options" @@ -292,7 +292,7 @@ menu "Target Images" depends on USES_BOOT_PART default 8 if TARGET_apm821xx_sata default 64 if TARGET_bcm27xx - default 128 if TARGET_armvirt + default 128 if TARGET_armsr default 16 config TARGET_ROOTFS_PARTSIZE From 4b48f8a3e75532ac6a22deeb8e1f53b692412f49 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 6 Jun 2023 23:22:36 +0000 Subject: [PATCH 0176/1171] grub2: change armvirt reference to armsr The armvirt target has been renamed to armsr (Arm SystemReady), so the GRUB configuration also needs to change. Signed-off-by: Mathew McBride (cherry picked from commit 4ce7d6c8885a0e1873011f8f48b67e2ecd18e43d) --- package/boot/grub2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index 50bf96360d645f..865feee9ad1bfb 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -41,7 +41,7 @@ endef Package/grub2=$(call Package/grub2/Default,x86,pc) Package/grub2-efi=$(call Package/grub2/Default,x86,efi) -Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi) +Package/grub2-efi-arm=$(call Package/grub2/Default,armsr,efi) define Package/grub2-editenv CATEGORY:=Utilities From 23a828f23068f2f2f85093758ca5d8ba001a36ee Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 6 Jun 2023 23:23:33 +0000 Subject: [PATCH 0177/1171] kernel: netdevices: change armvirt references to armsr armvirt target has been renamed to armsr (Arm SystemReady) Signed-off-by: Mathew McBride (cherry picked from commit c0bcfde58e751d674adfac51944df9e20ab978e4) --- package/kernel/linux/modules/netdevices.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index e9821c56ec1b15..9a47e974fd00a0 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -141,7 +141,7 @@ $(eval $(call KernelPackage,mii)) define KernelPackage/mdio-devres SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Supports MDIO device registration - DEPENDS:=+kmod-libphy +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio + DEPENDS:=+kmod-libphy +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio KCONFIG:=CONFIG_MDIO_DEVRES HIDDEN:=1 FILES:=$(LINUX_DIR)/drivers/net/phy/mdio_devres.ko @@ -158,7 +158,7 @@ $(eval $(call KernelPackage,mdio-devres)) define KernelPackage/mdio-gpio SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:= Supports GPIO lib-based MDIO busses - DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio + DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio KCONFIG:= \ CONFIG_MDIO_BITBANG \ CONFIG_MDIO_GPIO @@ -437,7 +437,7 @@ $(eval $(call KernelPackage,switch-rtl8306)) define KernelPackage/switch-rtl8366-smi SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Realtek RTL8366 SMI switch interface support - DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio + DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio KCONFIG:=CONFIG_RTL8366_SMI FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366_smi.ko AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi,1) @@ -1540,7 +1540,7 @@ $(eval $(call KernelPackage,lan743x)) define KernelPackage/amazon-ena SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Elastic Network Adapter (for Amazon AWS) - DEPENDS:=@TARGET_x86_64||TARGET_armvirt_64 + DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 KCONFIG:=CONFIG_ENA_ETHERNET FILES:=$(LINUX_DIR)/drivers/net/ethernet/amazon/ena/ena.ko AUTOLOAD:=$(call AutoLoad,12,ena) From e9ea57165707d5707317aa92e6ef9f572fa11f8c Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 6 Jun 2023 23:24:18 +0000 Subject: [PATCH 0178/1171] wolfssl: change armvirt reference to armsr armvirt target has been renamed to armsr (Arm SystemReady). Signed-off-by: Mathew McBride (cherry picked from commit 203deef82cdcb2c4deb01e2a4cee62a600723320) --- package/libs/wolfssl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 260335c34f642a..d9426d75fc303d 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -100,8 +100,8 @@ This variant uses AES CPU instructions (Intel AESNI or ARMv8 Crypto Extension) endef define Package/libwolfsslcpu-crypto/config - if TARGET_armvirt && PACKAGE_libwolfsslcpu-crypto = y - comment "You are about to build libwolfsslcpu-crypto into an armvirt_64 image." + if TARGET_armsr && PACKAGE_libwolfsslcpu-crypto = y + comment "You are about to build libwolfsslcpu-crypto into an armsr_64 image." comment "Ensure all of your installation targets support the Crypto Extension. " comment "Look for the 'aes' feature in /proc/cpuinfo. This library does not do " comment "run-time detection and will crash if the CPU does not support it. " From ded67a320c81b0736a725f17116ae42b3a615b37 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 9 Jun 2023 02:19:40 +0000 Subject: [PATCH 0179/1171] scripts: qemustart: change armvirt references to armsr The armvirt target has been renamed to 'armsr' (Arm SystemReady) after inclusion of EFI support. Change references (including subtargets) accordingly. Signed-off-by: Mathew McBride (cherry picked from commit 36bf9d861082d30fdb1cf1d00f819e60b8bb84a7) --- scripts/qemustart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/qemustart b/scripts/qemustart index 764b0e65afa24b..f6a46551294fc3 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -109,10 +109,10 @@ Examples $SELF malta be -m 64 $SELF malta le64 $SELF malta be-glibc - $SELF armvirt 32 \\ + $SELF armsr armv7 \\ --machine virt,highmem=off \\ - --kernel bin/targets/armvirt/32/openwrt-armvirt-32-zImage \\ - --rootfs bin/targets/armvirt/32/openwrt-armvirt-32-root.ext4 + --kernel bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-kernel.bin \\ + --rootfs bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-rootfs.img EOF } @@ -162,7 +162,7 @@ parse_args() { o_bindir="${CONFIG_BINARY_FOLDER:-bin}/targets/$o_target/$o_subtarget" } -start_qemu_armvirt() { +start_qemu_armsr() { local kernel="$o_kernel" local rootfs="$o_rootfs" local mach="${o_mach:-virt}" @@ -170,15 +170,15 @@ start_qemu_armvirt() { local qemu_exe case "${o_subtarget%-*}" in - 32) + armv7) qemu_exe="qemu-system-arm" cpu="cortex-a15" - [ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-zImage-initramfs" + [ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-generic-initramfs-kernel.bin" ;; - 64) + armv8) qemu_exe="qemu-system-aarch64" cpu="cortex-a57" - [ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-Image-initramfs" + [ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-generic-initramfs-kernel.bin" ;; *) __errmsg "target $o_target: unknown subtarget $o_subtarget" @@ -328,7 +328,7 @@ start_qemu_x86() { start_qemu() { case "$o_target" in - armvirt) start_qemu_armvirt ;; + armsr) start_qemu_armsr ;; malta) start_qemu_malta ;; x86) start_qemu_x86 ;; *) From 8d557d47445e027134811415899efd685db257da Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 9 Jun 2023 03:57:52 +0000 Subject: [PATCH 0180/1171] CI: change armvirt reference to armsr The armvirt target has been renamed to armsr. Signed-off-by: Mathew McBride (cherry picked from commit 3df01b1aa40a8e783dbbebdbe6088a49aed186f8) --- .github/labeler.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index c0ffdaf05d421b..6303fdf7b72480 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -5,8 +5,8 @@ - "target/linux/apm821xx/**" "target/archs38": - "target/linux/archs38/**" -"target/armvirt": - - "target/linux/armvirt/**" +"target/armsr": + - "target/linux/armsr/**" "target/at91": - "target/linux/at91/**" - "package/boot/at91bootstrap/**" From c05c0699d4798b02f8ee88159236142e08c0c4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 2 Jun 2023 13:54:20 +0200 Subject: [PATCH 0181/1171] u-boot.mk: add support for config customization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to easily customize U-Boot config options via new `UBOOT_CUSTOMIZE_CONFIG` variable, so we don't need to patch config files or override config step with shell hackery. This generic approach uses `config` CLI to tweak the .config as needed, for example: UBOOT_CUSTOMIZE_CONFIG := \ --enable CMD_EFIDEBUG \ --enable CMD_BOOTMENU \ --enable AUTOBOOT \ --enable AUTOBOOT_MENU_SHOW \ --disable AUTOBOOT_KEYED \ --disable AUTOBOOT_USE_MENUKEY \ --disable BOOTMENU_DISABLE_UBOOT_CONSOLE \ --set-val BOOTDELAY 2 Signed-off-by: Petr Štetiar (cherry picked from commit 186b97590b9b2f47abc535c9df0687e00e60f78e) --- include/u-boot.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/u-boot.mk b/include/u-boot.mk index 8945e8e2b8f568..2b8106410f5921 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -83,6 +83,9 @@ endef define Build/Configure/U-Boot +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config + $(if $(strip $(UBOOT_CUSTOMIZE_CONFIG)), + $(PKG_BUILD_DIR)/scripts/config --file $(PKG_BUILD_DIR)/.config $(UBOOT_CUSTOMIZE_CONFIG) + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) oldconfig) endef DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc) From 848759c2362fc60fef8aa76f2adeb228af3cae65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 2 Jun 2023 13:48:38 +0200 Subject: [PATCH 0182/1171] uboot-armsr: add support for QEMU armv7/armv8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new package so we can use self-compiled bootloader during QEMU based testing and development. Backported fix[1] is needed for EFI boot from virtio devices. 1. https://patchwork.ozlabs.org/project/uboot/patch/20230424134946.v10.7.Ia5f5e39c882ac22b5f71c4d576941b34e868eeba@changeid/ Signed-off-by: Petr Štetiar (cherry picked from commit b8e3fa2d1205213c71bc356744e9bed6cd8e69f9) --- package/boot/uboot-armsr/Makefile | 36 +++++++++++ ...ss-device-numbers-to-set-efi-bootdev.patch | 62 +++++++++++++++++++ target/linux/armsr/README | 9 ++- target/linux/armsr/image/Makefile | 3 +- 4 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 package/boot/uboot-armsr/Makefile create mode 100644 package/boot/uboot-armsr/patches/001-v2023.07-bootstd-Use-blk-uclass-device-numbers-to-set-efi-bootdev.patch diff --git a/package/boot/uboot-armsr/Makefile b/package/boot/uboot-armsr/Makefile new file mode 100644 index 00000000000000..ce53d19b79676e --- /dev/null +++ b/package/boot/uboot-armsr/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_VERSION:=2023.04 +PKG_RELEASE:=1 + +PKG_HASH:=e31cac91545ff41b71cec5d8c22afd695645cd6e2a442ccdacacd60534069341 + +include $(INCLUDE_DIR)/u-boot.mk +include $(INCLUDE_DIR)/package.mk + +define U-Boot/Default + BUILD_TARGET:=armsr +endef + +define U-Boot/qemu_armv7 + NAME:=QEMU ARM Virtual Machine 32-bit + BUILD_SUBTARGET:=armv7 + BUILD_DEVICES:=generic + UBOOT_CONFIG:=qemu_arm +endef + +define U-Boot/qemu_armv8 + NAME:=QEMU ARM Virtual Machine 64-bit + BUILD_SUBTARGET:=armv8 + BUILD_DEVICES:=generic + UBOOT_CONFIG:=qemu_arm64 +endef + +UBOOT_TARGETS := \ + qemu_armv7 \ + qemu_armv8 + +UBOOT_CUSTOMIZE_CONFIG := \ + --enable CMD_EFIDEBUG + +$(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-armsr/patches/001-v2023.07-bootstd-Use-blk-uclass-device-numbers-to-set-efi-bootdev.patch b/package/boot/uboot-armsr/patches/001-v2023.07-bootstd-Use-blk-uclass-device-numbers-to-set-efi-bootdev.patch new file mode 100644 index 00000000000000..f4c811895213ae --- /dev/null +++ b/package/boot/uboot-armsr/patches/001-v2023.07-bootstd-Use-blk-uclass-device-numbers-to-set-efi-bootdev.patch @@ -0,0 +1,62 @@ +From: Simon Glass +To: U-Boot Mailing List +Subject: [PATCH v10 7/9] bootstd: Use blk uclass device numbers to set efi + bootdev +Date: Mon, 24 Apr 2023 13:49:50 +1200 +Message-ID: + <20230424134946.v10.7.Ia5f5e39c882ac22b5f71c4d576941b34e868eeba@changeid> + +From: Mathew McBride + +When loading a file from a block device, efiload_read_file +was using the seq_num of the device (e.g "35" of virtio_blk#35) +instead of the block device id (e.g what you get from running +the corresponding device scan command, like "virtio 0") + +This cause EFI booting from these devices to fail as an +invalid device number is passed to blk_get_device_part_str: + + Scanning bootdev 'virtio-blk#35.bootdev': + distro_efi_read_bootflow_file start (efi,fname=) + distro_efi_read_bootflow_file start (efi,fname=) + setting bootdev virtio, 35, efi/boot/bootaa64.efi, 00000000beef9a40, 170800 + efi_dp_from_name calling blk_get_device_part_str + dev=virtio devnr=35 path=efi/boot/bootaa64.efi + blk_get_device_part_str (virtio,35) + blk_get_device_by_str (virtio, 35) + ** Bad device specification virtio 35 ** + Using default device tree: dtb/qemu-arm.dtb + No device tree available + 0 efi ready virtio 1 virtio-blk#35.bootdev.par efi/boot/bootaa64.efi + ** Booting bootflow 'virtio-blk#35.bootdev.part_1' with efi + blk_get_device_part_str (virtio,0:1) + blk_get_device_by_str (virtio, 0) + No UEFI binary known at beef9a40 (image buf=00000000beef9a40,addr=0000000000000000) + Boot failed (err=-22) + +Signed-off-by: Mathew McBride +Signed-off-by: Simon Glass +Signed-off-by: Petr Štetiar [backport to 2023.04] +--- + +(no changes since v8) + +Changes in v8: +- Add new patch to use blk uclass device numbers to set efi bootdev + + boot/bootmeth_efi.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/boot/bootmeth_efi.c ++++ b/boot/bootmeth_efi.c +@@ -117,7 +117,9 @@ static int efiload_read_file(struct blk_ + * this can go away. + */ + media_dev = dev_get_parent(bflow->dev); +- snprintf(devnum_str, sizeof(devnum_str), "%x", dev_seq(media_dev)); ++ snprintf(devnum_str, sizeof(devnum_str), "%x:%x", ++ desc ? desc->devnum : dev_seq(media_dev), ++ bflow->part); + + strlcpy(dirname, bflow->fname, sizeof(dirname)); + last_slash = strrchr(dirname, '/'); diff --git a/target/linux/armsr/README b/target/linux/armsr/README index bce839ddfc4742..b4b9012826a2ca 100644 --- a/target/linux/armsr/README +++ b/target/linux/armsr/README @@ -52,7 +52,7 @@ images in EFI mode: gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined.img.gz > openwrt-arm-32.img qemu-system-arm -nographic \ -cpu cortex-a15 -machine virt \ - -bios QEMU_EFI_32.fd \ + -bios bin/targets/armsr/armv7/u-boot-qemu_armv7/u-boot.bin \ -smp 1 -m 1024 \ -device virtio-rng-pci \ -drive file=openwrt-arm-32.img,format=raw,index=0,media=disk \ @@ -63,14 +63,13 @@ qemu-system-arm -nographic \ gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined.img.gz > openwrt-arm-64.img qemu-system-aarch64 -nographic \ -cpu cortex-a53 -machine virt \ - -bios QEMU_EFI_64.fd \ + -bios bin/targets/armsr/armv8/u-boot-qemu_armv8/u-boot.bin \ -smp 1 -m 1024 \ -device virtio-rng-pci \ -drive file=openwrt-arm-64.img,format=raw,index=0,media=disk \ -netdev user,id=testlan -net nic,netdev=testlan \ -netdev user,id=testwan -net nic,netdev=testwan -One can find EFI/BIOS binaries from: -- Compile mainline U-Boot for the QEMU ARM virtual machine (qemu_arm_defconfig/qemu_arm64_defconfig) -- From distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian) +One can obtain other EFI/BIOS binaries from: +- Distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian) - Community builds, like retrage/edk2-nightly: https://retrage.github.io/edk2-nightly/ diff --git a/target/linux/armsr/image/Makefile b/target/linux/armsr/image/Makefile index e3031d5a138cf7..e4ba7988ec131b 100644 --- a/target/linux/armsr/image/Makefile +++ b/target/linux/armsr/image/Makefile @@ -73,7 +73,7 @@ define Build/grub-install $(INSTALL_DIR) $@.grub2 endef -DEVICE_VARS += GRUB2_VARIANT +DEVICE_VARS += GRUB2_VARIANT UBOOT define Device/efi-default IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE) IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip @@ -105,6 +105,7 @@ define Device/generic DEVICE_TITLE := Generic EFI Boot GRUB2_VARIANT := generic FILESYSTEMS := ext4 squashfs + UBOOT := $(if $(CONFIG_aarch64),qemu_armv8,qemu_armv7) DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ From 341e312ada4dda207a9f2c8402e73cc13b195983 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sun, 16 Dec 2018 10:45:53 +0100 Subject: [PATCH 0183/1171] generic: groundwork for RISC-V Add build infrastructure for RISC-V. Signed-off-by: Zoltan HERPAI (cherry picked from commit 50c05f6cd721130701cbbc77a75d2e090259c4e5) --- include/kernel.mk | 2 ++ include/site/riscv64 | 30 ++++++++++++++++++++++++++++++ include/target.mk | 4 ++++ target/Config.in | 5 +++++ 4 files changed, 41 insertions(+) create mode 100644 include/site/riscv64 diff --git a/include/kernel.mk b/include/kernel.mk index c657bf5d82e7f0..b1ae42534dc434 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -90,6 +90,8 @@ else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el )) LINUX_KARCH := mips else ifneq (,$(findstring $(ARCH) , powerpc64 )) LINUX_KARCH := powerpc +else ifneq (,$(findstring $(ARCH) , riscv64 )) + LINUX_KARCH := riscv else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 )) LINUX_KARCH := sh else ifneq (,$(findstring $(ARCH) , i386 x86_64 )) diff --git a/include/site/riscv64 b/include/site/riscv64 new file mode 100644 index 00000000000000..c5aa9c5543d081 --- /dev/null +++ b/include/site/riscv64 @@ -0,0 +1,30 @@ +#!/bin/sh +. $TOPDIR/include/site/linux +ac_cv_c_littleendian=${ac_cv_c_littleendian=yes} +ac_cv_c_bigendian=${ac_cv_c_bigendian=no} + +ac_cv_sizeof___int64=8 +ac_cv_sizeof_char=1 +ac_cv_sizeof_int=4 +ac_cv_sizeof_int16_t=2 +ac_cv_sizeof_int32_t=4 +ac_cv_sizeof_int64_t=8 +ac_cv_sizeof_long_int=8 +ac_cv_sizeof_long_long=8 +ac_cv_sizeof_long=8 +ac_cv_sizeof_off_t=8 +ac_cv_sizeof_short_int=2 +ac_cv_sizeof_short=2 +ac_cv_sizeof_size_t=8 +ac_cv_sizeof_ssize_t=8 +ac_cv_sizeof_u_int16_t=2 +ac_cv_sizeof_u_int32_t=4 +ac_cv_sizeof_u_int64_t=8 +ac_cv_sizeof_uint16_t=2 +ac_cv_sizeof_uint32_t=4 +ac_cv_sizeof_uint64_t=8 +ac_cv_sizeof_unsigned_int=4 +ac_cv_sizeof_unsigned_long=8 +ac_cv_sizeof_unsigned_long_long=8 +ac_cv_sizeof_unsigned_short=2 +ac_cv_sizeof_void_p=8 diff --git a/include/target.mk b/include/target.mk index 992f95534442c5..b5e3e7ff6fdeca 100644 --- a/include/target.mk +++ b/include/target.mk @@ -260,6 +260,10 @@ ifeq ($(DUMP),1) CPU_CFLAGS_arc700 = -mcpu=arc700 CPU_CFLAGS_archs = -mcpu=archs endif + ifeq ($(ARCH),riscv64) + CPU_TYPE ?= riscv64 + CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc + endif ifneq ($(CPU_TYPE),) ifndef CPU_CFLAGS_$(CPU_TYPE) $(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type) diff --git a/target/Config.in b/target/Config.in index a6b3351a61886a..ac0f1f9826bf9d 100644 --- a/target/Config.in +++ b/target/Config.in @@ -184,6 +184,10 @@ config powerpc64 select ARCH_64BIT bool +config riscv64 + select ARCH_64BIT + bool + config sh3 bool @@ -223,6 +227,7 @@ config ARCH default "mips64el" if mips64el default "powerpc" if powerpc default "powerpc64" if powerpc64 + default "riscv64" if riscv64 default "sh3" if sh3 default "sh3eb" if sh3eb default "sh4" if sh4 From 08247ffedadcb3198b7fa460f9445d049c936402 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sun, 26 Jan 2020 23:45:48 +0100 Subject: [PATCH 0184/1171] opensbi: add package for RISC-V OpenSBI is a form of a first-stage bootloader, which initializes certain parts of an SoC and then passes on control to the second stage bootloader i.e. an u-boot image. We're introducing the package with release v1.2, which provides SBI v0.3 and the SBI SRST extensions which helps to gracefully reboot/shutdown various HiFive-U SoCs. Tested on SiFive Unleashed and Unmatched boards. Signed-off-by: Zoltan HERPAI (cherry picked from commit 944b13b3ee1d89e11a0121fbeeaa465ab1e25c3c) --- package/boot/opensbi/Makefile | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 package/boot/opensbi/Makefile diff --git a/package/boot/opensbi/Makefile b/package/boot/opensbi/Makefile new file mode 100644 index 00000000000000..01348e50aad4a8 --- /dev/null +++ b/package/boot/opensbi/Makefile @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 OpenWrt.org +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=opensbi +PKG_RELEASE:=1.2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/riscv/opensbi +PKG_SOURCE_DATE:=2022-12-24 +PKG_SOURCE_VERSION:=6b5188ca14e59ce7bf71afe4e7d3d557c3d31bf8 +PKG_MIRROR_HASH:=edcdd99da6c62975171981c0aa2b73a27091067da11ccd49816b5ad27d000858 + +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_TARGETS:=bin +PKG_FLAGS:=nonshared +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=COPYING.BSD +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=Zoltan HERPAI + +include $(INCLUDE_DIR)/package.mk + +define Package/opensbi + SECTION:=boot + CATEGORY:=Boot Loaders + DEPENDS:=@TARGET_sifiveu + URL:=https://github.com/riscv/opensbi/blob/master/README.md + VARIANT:=$(subst _,/,$(subst opensbi_,,$(1))) + TITLE:=OpenSBI generic + OPENSBI_IMAGE:= + PLAT:= +endef + +define Package/opensbi_generic + $(Package/opensbi) + TITLE:=OpenSBI generic + OPENSBI_IMAGE:=fw_dynamic.bin + PLAT:=generic +endef + +export GCC_HONOUR_COPTS=s + +MAKE_VARS = \ + CROSS_COMPILE="$(TARGET_CROSS)" + +define Build/Compile + $(eval $(Package/opensbi_$(BUILD_VARIANT))) \ + +$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \ + PLATFORM=$(PLAT) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/build/platform/$(PLAT)/firmware/fw_dynamic.bin $(STAGING_DIR_IMAGE)/fw_dynamic-${BUILD_VARIANT}.bin +endef + +$(eval $(call BuildPackage,opensbi_generic)) From cd650f1e91a81c4fb0f9f8c488f17dc2c871a640 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Wed, 15 May 2019 17:21:45 +0200 Subject: [PATCH 0185/1171] openssl: add linux-riscv64 into the targets list Add "linux-riscv64-openwrt" into openssl configurations to enable building on riscv64. Signed-off-by: Zoltan HERPAI (cherry picked from commit a0840ecd5309921b62fcf5f563180ef8f955509e) --- package/libs/openssl/patches/110-openwrt_targets.patch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/libs/openssl/patches/110-openwrt_targets.patch b/package/libs/openssl/patches/110-openwrt_targets.patch index 5abedd400e3b19..a97c603fa7c224 100644 --- a/package/libs/openssl/patches/110-openwrt_targets.patch +++ b/package/libs/openssl/patches/110-openwrt_targets.patch @@ -9,7 +9,7 @@ Signed-off-by: Eneas U de Queiroz --- /dev/null +++ b/Configurations/25-openwrt.conf -@@ -0,0 +1,52 @@ +@@ -0,0 +1,56 @@ +## Openwrt "CONFIG_ARCH" matching targets. + +# The targets need to end in '-openwrt' for the AFALG patch to work @@ -53,6 +53,10 @@ Signed-off-by: Eneas U de Queiroz + inherit_from => [ "linux-ppc64", "openwrt" ], + perlasm_scheme => "linux64v2", + }, ++ "linux-riscv64-openwrt" => { ++ inherit_from => [ "linux-generic64", "openwrt" ], ++ perlasm_scheme => "linux64", ++ }, + "linux-x86_64-openwrt" => { + inherit_from => [ "linux-x86_64", "openwrt" ], + }, From 0f30f47d61815ad77934693456226076f6e40a49 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sat, 23 Apr 2022 19:06:28 +0200 Subject: [PATCH 0186/1171] firmware-utils: ptgen: add SiFive-related GUID types Add patch until it gets accepted in firmware-utils upstream. The SiFive RISC-V SoCs use two special partition types in the boot process. As a first step, the ZSBL (zero-stage bootloader) in the CPU looks for a partition with a GUID of 5B193300-FC78-40CD-8002-E86C45580B47 to load the first-stage bootloader - which in OpenWrt's case is an SPL image. The FSBL (SPL) then looks for a partition with a GUID of 2E54B353-1271-4842-806F-E436D6AF6985 to load the SSBL which is usually an u-boot. With ptgen already supporting GPT partition creation, add the required GUID types and name them accordingly to be invoked with the '-T ' parameter. Signed-off-by: Zoltan HERPAI (cherry picked from commit 18238c442866a6ae93533e2421a6f44bc9e57ac6) --- .../patches/001-add-sifiveu-guid-types.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch diff --git a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch b/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch new file mode 100644 index 00000000000000..45900e982c9c4c --- /dev/null +++ b/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch @@ -0,0 +1,38 @@ +diff -ruN firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c firmware-utils-2022-02-28-002cfaf0/src/ptgen.c +--- firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c 2022-04-23 19:02:07.307896842 +0200 ++++ firmware-utils-2022-02-28-002cfaf0/src/ptgen.c 2022-04-22 18:48:54.477970950 +0200 +@@ -82,6 +82,14 @@ + GUID_INIT( 0x0fc63daf, 0x8483, 0x4772, \ + 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4) + ++#define GUID_PARTITION_SIFIVE_SPL \ ++ GUID_INIT( 0x5b193300, 0xfc78, 0x40cd, \ ++ 0x80, 0x02, 0xe8, 0x6c, 0x45, 0x58, 0x0b, 0x47) ++ ++#define GUID_PARTITION_SIFIVE_UBOOT \ ++ GUID_INIT( 0x2e54b353, 0x1271, 0x4842, \ ++ 0x80, 0x6f, 0xe4, 0x36, 0xd6, 0xaf, 0x69, 0x85) ++ + #define GPT_HEADER_SIZE 92 + #define GPT_ENTRY_SIZE 128 + #define GPT_ENTRY_MAX 128 +@@ -276,6 +284,19 @@ + (1ULL << 56); /* success=1 */ + return true; + } ++ ++ if (!strcmp(type, "sifiveu_spl")) { ++ part->has_guid = true; ++ part->guid = GUID_PARTITION_SIFIVE_SPL; ++ return true; ++ } ++ ++ if (!strcmp(type, "sifiveu_uboot")) { ++ part->has_guid = true; ++ part->guid = GUID_PARTITION_SIFIVE_UBOOT; ++ return true; ++ } ++ + return false; + } + From a11f2e6044394bdc18cdb564ae0326d7332db5ac Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sun, 26 Jan 2020 23:46:18 +0100 Subject: [PATCH 0187/1171] uboot-sifiveu: add bootloader package for SiFive Ux40 boards Add new package for building bootloader for the SiFive U-series boards. Supported boards at this stage are the HiFive Unleashed and HiFive Unmatched. Signed-off-by: Zoltan HERPAI (cherry picked from commit 91406797f9d06c0008f0a8c2c8455abfb37bf28c) --- package/boot/uboot-sifiveu/Makefile | 63 ++++++++++ ...-Initialized-the-PWM-setting-in-the-.patch | 104 ++++++++++++++++ ...-LED-s-color-to-purple-in-the-U-boot.patch | 68 +++++++++++ ...-LED-s-color-to-blue-before-jumping-.patch | 30 +++++ ...-Set-remote-thermal-of-TMP451-to-85-.patch | 111 ++++++++++++++++++ .../0008-riscv-dts-Add-few-PMU-events.patch | 36 ++++++ ...009-riscv-Fix-build-against-binutils.patch | 50 ++++++++ ...-environment-for-dtc-binary-location.patch | 35 ++++++ .../patches/110-no-kwbimage.patch | 10 ++ .../patches/130-fix-mkimage-host-build.patch | 24 ++++ .../patches/300-force-pylibfdt-build.patch | 30 +++++ package/boot/uboot-sifiveu/uEnv-default.txt | 5 + 12 files changed, 566 insertions(+) create mode 100644 package/boot/uboot-sifiveu/Makefile create mode 100644 package/boot/uboot-sifiveu/patches/0002-board-sifive-spl-Initialized-the-PWM-setting-in-the-.patch create mode 100644 package/boot/uboot-sifiveu/patches/0003-board-sifive-Set-LED-s-color-to-purple-in-the-U-boot.patch create mode 100644 package/boot/uboot-sifiveu/patches/0004-board-sifive-Set-LED-s-color-to-blue-before-jumping-.patch create mode 100644 package/boot/uboot-sifiveu/patches/0005-board-sifive-spl-Set-remote-thermal-of-TMP451-to-85-.patch create mode 100644 package/boot/uboot-sifiveu/patches/0008-riscv-dts-Add-few-PMU-events.patch create mode 100644 package/boot/uboot-sifiveu/patches/0009-riscv-Fix-build-against-binutils.patch create mode 100644 package/boot/uboot-sifiveu/patches/100-mkimage-check-environment-for-dtc-binary-location.patch create mode 100644 package/boot/uboot-sifiveu/patches/110-no-kwbimage.patch create mode 100644 package/boot/uboot-sifiveu/patches/130-fix-mkimage-host-build.patch create mode 100644 package/boot/uboot-sifiveu/patches/300-force-pylibfdt-build.patch create mode 100644 package/boot/uboot-sifiveu/uEnv-default.txt diff --git a/package/boot/uboot-sifiveu/Makefile b/package/boot/uboot-sifiveu/Makefile new file mode 100644 index 00000000000000..5def1c1fcb801b --- /dev/null +++ b/package/boot/uboot-sifiveu/Makefile @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 OpenWrt.org +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_RELEASE:=1 +PKG_VERSION:=2022.10 +PKG_HASH:=50b4482a505bc281ba8470c399a3c26e145e29b23500bc35c50debd7fa46bdf8 + +include $(INCLUDE_DIR)/u-boot.mk +include $(INCLUDE_DIR)/package.mk + +define U-Boot/Default + BUILD_TARGET:=sifiveu + BUILD_DEVICES=$(1) + UBOOT_IMAGE:=u-boot.itb + DTS_DIR:=arch/riscv/dts + UENV:=default + DEFAULT:=y +endef + +define U-Boot/sifive_unleashed + NAME:=SiFive Unleashed + OPENSBI:=generic + DEPENDS:=+opensbi_generic + UBOOT_DTS:=hifive-unleashed-a00.dtb + BUILD_DEVICES:=sifive_unleashed +endef + +define U-Boot/sifive_unmatched + NAME:=SiFive Unmatched + OPENSBI:=generic + DEPENDS:=+opensbi_generic + UBOOT_DTS:=hifive-unmatched-a00.dtb + BUILD_DEVICES:=sifive_unmatched +endef + +UBOOT_TARGETS := \ + sifive_unleashed \ + sifive_unmatched + +UBOOT_MAKE_FLAGS += \ + OPENSBI=$(STAGING_DIR_IMAGE)/fw_dynamic-${OPENSBI}.bin + +define Build/Configure + $(call Build/Configure/U-Boot) + sed -i 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/spl/u-boot-spl.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE)-spl + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(DTS_DIR)/$(UBOOT_DTS) $(STAGING_DIR_IMAGE)/$(UBOOT_DTS) + + mkimage -C none -A arm -T script -d uEnv-$(UENV).txt \ + $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-boot.scr +endef + +$(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-sifiveu/patches/0002-board-sifive-spl-Initialized-the-PWM-setting-in-the-.patch b/package/boot/uboot-sifiveu/patches/0002-board-sifive-spl-Initialized-the-PWM-setting-in-the-.patch new file mode 100644 index 00000000000000..27cda75326f8a8 --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/0002-board-sifive-spl-Initialized-the-PWM-setting-in-the-.patch @@ -0,0 +1,104 @@ +From 725595e667cc4423347c255da8ca4c5b3aa0980a Mon Sep 17 00:00:00 2001 +From: Vincent Chen +Date: Mon, 15 Nov 2021 03:31:04 -0800 +Subject: [PATCH 2/8] board: sifive: spl: Initialized the PWM setting in the + SPL stage + +LEDs and multiple fans can be controlled by SPL. This patch ensures +that all fans have been enabled in the SPL stage. In addition, the +LED's color will be set to yellow. +--- + board/sifive/unmatched/Makefile | 1 + + board/sifive/unmatched/pwm.c | 57 +++++++++++++++++++++++++++++++++ + board/sifive/unmatched/spl.c | 2 ++ + 3 files changed, 60 insertions(+) + create mode 100644 board/sifive/unmatched/pwm.c + +diff --git a/board/sifive/unmatched/Makefile b/board/sifive/unmatched/Makefile +index 1345330089..5df01982e9 100644 +--- a/board/sifive/unmatched/Makefile ++++ b/board/sifive/unmatched/Makefile +@@ -9,3 +9,4 @@ obj-y += spl.o + else + obj-y += unmatched.o + endif ++obj-y += pwm.o +diff --git a/board/sifive/unmatched/pwm.c b/board/sifive/unmatched/pwm.c +new file mode 100644 +index 0000000000..e1cc02310a +--- /dev/null ++++ b/board/sifive/unmatched/pwm.c +@@ -0,0 +1,57 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (c) 2021, SiFive Inc ++ * ++ * Authors: ++ * Vincent Chen ++ * David Abdurachmanov ++ */ ++ ++#include ++#include ++ ++struct pwm_sifive_regs { ++ unsigned int cfg; /* PWM configuration register */ ++ unsigned int pad0; /* Reserved */ ++ unsigned int cnt; /* PWM count register */ ++ unsigned int pad1; /* Reserved */ ++ unsigned int pwms; /* Scaled PWM count register */ ++ unsigned int pad2; /* Reserved */ ++ unsigned int pad3; /* Reserved */ ++ unsigned int pad4; /* Reserved */ ++ unsigned int cmp0; /* PWM 0 compare register */ ++ unsigned int cmp1; /* PWM 1 compare register */ ++ unsigned int cmp2; /* PWM 2 compare register */ ++ unsigned int cmp3; /* PWM 3 compare register */ ++}; ++ ++#define PWM0_BASE 0x10020000 ++#define PWM1_BASE 0x10021000 ++#define PWM_CFG_INIT 0x1000 ++#define PWM_CMP_ENABLE_VAL 0x0 ++#define PWM_CMP_DISABLE_VAL 0xffff ++ ++void pwm_device_init(void) ++{ ++ struct pwm_sifive_regs *pwm0, *pwm1; ++ pwm0 = (struct pwm_sifive_regs *)PWM0_BASE; ++ pwm1 = (struct pwm_sifive_regs *)PWM1_BASE; ++ writel(PWM_CMP_DISABLE_VAL, (void *)&pwm0->cmp0); ++ /* Set the 3-color PWM LEDs to yellow in SPL */ ++ writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp1); ++ writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp2); ++ writel(PWM_CMP_DISABLE_VAL, (void *)&pwm0->cmp3); ++ writel(PWM_CFG_INIT, (void *)&pwm0->cfg); ++ ++ writel(PWM_CMP_DISABLE_VAL, (void *)&pwm0->cmp3); ++ /* Turn on all the fans, (J21), (J23) and (J24), on the unmatched board */ ++ /* The SoC fan(J21) on the rev3 board cannot be controled by PWM_COMP0, ++ so here sets the initial value of PWM_COMP0 as DISABLE */ ++ if (get_pcb_revision_from_eeprom() == PCB_REVISION_REV3) ++ writel(PWM_CMP_DISABLE_VAL, (void *)&pwm1->cmp1); ++ else ++ writel(PWM_CMP_ENABLE_VAL, (void *)&pwm1->cmp1); ++ writel(PWM_CMP_ENABLE_VAL, (void *)&pwm1->cmp2); ++ writel(PWM_CMP_ENABLE_VAL, (void *)&pwm1->cmp3); ++ writel(PWM_CFG_INIT, (void *)&pwm1->cfg); ++} +diff --git a/board/sifive/unmatched/spl.c b/board/sifive/unmatched/spl.c +index 7c0beedc08..f3a661a81e 100644 +--- a/board/sifive/unmatched/spl.c ++++ b/board/sifive/unmatched/spl.c +@@ -90,6 +90,8 @@ int spl_board_init_f(void) + goto end; + } + ++ pwm_device_init(); ++ + ret = spl_gemgxl_init(); + if (ret) { + debug("Gigabit ethernet PHY (VSC8541) init failed: %d\n", ret); +-- +2.27.0 + diff --git a/package/boot/uboot-sifiveu/patches/0003-board-sifive-Set-LED-s-color-to-purple-in-the-U-boot.patch b/package/boot/uboot-sifiveu/patches/0003-board-sifive-Set-LED-s-color-to-purple-in-the-U-boot.patch new file mode 100644 index 00000000000000..9820d2e2f9df9e --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/0003-board-sifive-Set-LED-s-color-to-purple-in-the-U-boot.patch @@ -0,0 +1,68 @@ +From 7ead6d662a2f9d8498af6650ea38418c64b52048 Mon Sep 17 00:00:00 2001 +From: Vincent Chen +Date: Mon, 24 Jan 2022 02:42:02 -0800 +Subject: [PATCH 3/8] board: sifive: Set LED's color to purple in the U-boot + stage + +Set LED's color to purple in the U-boot stage. Because there are still +some functions to be executed before board_early_init_f(), it means +the LED's is not changed to purple instantly when entering the U-boot +stage. +--- + board/sifive/unmatched/pwm.c | 7 +++++++ + board/sifive/unmatched/unmatched.c | 6 ++++++ + configs/sifive_unmatched_defconfig | 1 + + 3 files changed, 14 insertions(+) + +diff --git a/board/sifive/unmatched/pwm.c b/board/sifive/unmatched/pwm.c +index e1cc02310a..bd67672c22 100644 +--- a/board/sifive/unmatched/pwm.c ++++ b/board/sifive/unmatched/pwm.c +@@ -36,6 +36,7 @@ void pwm_device_init(void) + struct pwm_sifive_regs *pwm0, *pwm1; + pwm0 = (struct pwm_sifive_regs *)PWM0_BASE; + pwm1 = (struct pwm_sifive_regs *)PWM1_BASE; ++#ifdef CONFIG_SPL_BUILD + writel(PWM_CMP_DISABLE_VAL, (void *)&pwm0->cmp0); + /* Set the 3-color PWM LEDs to yellow in SPL */ + writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp1); +@@ -54,4 +55,10 @@ void pwm_device_init(void) + writel(PWM_CMP_ENABLE_VAL, (void *)&pwm1->cmp2); + writel(PWM_CMP_ENABLE_VAL, (void *)&pwm1->cmp3); + writel(PWM_CFG_INIT, (void *)&pwm1->cfg); ++#else ++ /* Set the 3-color PWM LEDs to purple in U-boot */ ++ writel(PWM_CMP_DISABLE_VAL, (void *)&pwm0->cmp1); ++ writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp2); ++ writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp3); ++#endif + } +diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c +index 6295deeae2..30c082d001 100644 +--- a/board/sifive/unmatched/unmatched.c ++++ b/board/sifive/unmatched/unmatched.c +@@ -22,6 +22,12 @@ void *board_fdt_blob_setup(int *err) + return (ulong *)&_end; + } + ++int board_early_init_f(void) ++{ ++ pwm_device_init(); ++ return 0; ++} ++ + int board_init(void) + { + /* enable all cache ways */ +diff --git a/configs/sifive_unmatched_defconfig b/configs/sifive_unmatched_defconfig +index d400ed0b23..0758f8e90f 100644 +--- a/configs/sifive_unmatched_defconfig ++++ b/configs/sifive_unmatched_defconfig +@@ -51,3 +51,4 @@ CONFIG_DM_SCSI=y + CONFIG_USB=y + CONFIG_USB_XHCI_HCD=y + CONFIG_USB_XHCI_PCI=y ++CONFIG_BOARD_EARLY_INIT_F=y +-- +2.27.0 + diff --git a/package/boot/uboot-sifiveu/patches/0004-board-sifive-Set-LED-s-color-to-blue-before-jumping-.patch b/package/boot/uboot-sifiveu/patches/0004-board-sifive-Set-LED-s-color-to-blue-before-jumping-.patch new file mode 100644 index 00000000000000..b5bffd22bd6728 --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/0004-board-sifive-Set-LED-s-color-to-blue-before-jumping-.patch @@ -0,0 +1,30 @@ +From 6ef7023c0dcfde320015ab19e0e0d423921be77d Mon Sep 17 00:00:00 2001 +From: Vincent Chen +Date: Mon, 15 Nov 2021 03:39:07 -0800 +Subject: [PATCH 1/2] board: sifive: Set LED's color to blue before jumping to + Linux + +The LED's color wil be changed from purple to blue before executing +the sysboot command. Because the sysboot command includes the image loading +from the boot partition, It means the LED's color is blue when executing +"Retrieving file: /Image.gz". +--- + include/configs/sifive-unmatched.h | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/include/configs/sifive-unmatched.h ++++ b/include/configs/sifive-unmatched.h +@@ -49,7 +49,12 @@ + "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \ + "partitions=" PARTS_DEFAULT "\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ +- BOOTENV ++ "setled_blue=mw.l 0x10020024 0x0000ffff; mw.l 0x10020028 0x0000ffff; mw.l 0x1002002c 0x0\0" \ ++ BOOTENV \ ++ "boot_extlinux=" \ ++ "run setled_blue; " \ ++ "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \ ++ "${scriptaddr} ${prefix}${boot_syslinux_conf};\0" + + #define CONFIG_SYS_EEPROM_BUS_NUM 0 + diff --git a/package/boot/uboot-sifiveu/patches/0005-board-sifive-spl-Set-remote-thermal-of-TMP451-to-85-.patch b/package/boot/uboot-sifiveu/patches/0005-board-sifive-spl-Set-remote-thermal-of-TMP451-to-85-.patch new file mode 100644 index 00000000000000..dc0d04151faae1 --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/0005-board-sifive-spl-Set-remote-thermal-of-TMP451-to-85-.patch @@ -0,0 +1,111 @@ +From 07f84ed283b913cbdf87181ae2ed65467d923df5 Mon Sep 17 00:00:00 2001 +From: Vincent Chen +Date: Mon, 24 Jan 2022 02:57:40 -0800 +Subject: [PATCH 2/2] board: sifive: spl: Set remote thermal of TMP451 to 85 + deg C for the unmatched board + +For TMP451 on the unmatched board, the default value of the remote +thermal threshold is 108 deg C. This commit initilizes it to 85 deg C at SPL. +--- + board/sifive/unmatched/spl.c | 29 +++++++++++++++++++++++++++++ + drivers/misc/Kconfig | 10 ++++++++++ + include/configs/sifive-unmatched.h | 4 ++++ + scripts/config_whitelist.txt | 1 + + 4 files changed, 44 insertions(+) + +--- a/board/sifive/unmatched/spl.c ++++ b/board/sifive/unmatched/spl.c +@@ -10,6 +10,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -26,6 +28,27 @@ + #define MODE_SELECT_SD 0xb + #define MODE_SELECT_MASK GENMASK(3, 0) + ++#define TMP451_REMOTE_THERM_LIMIT_REG_OFFSET 0x19 ++#define TMP451_REMOTE_THERM_LIMIT_INIT_VALUE 0x55 ++ ++static inline int init_tmp451_remote_therm_limit(void) ++{ ++ struct udevice *dev; ++ unsigned char r_therm_limit = TMP451_REMOTE_THERM_LIMIT_INIT_VALUE; ++ int ret; ++ ++ ret = i2c_get_chip_for_busnum(CONFIG_SYS_TMP451_BUS_NUM, ++ CONFIG_SYS_I2C_TMP451_ADDR, ++ CONFIG_SYS_I2C_TMP451_ADDR_LEN, ++ &dev); ++ ++ if (!ret) ++ ret = dm_i2c_write(dev, TMP451_REMOTE_THERM_LIMIT_REG_OFFSET, ++ &r_therm_limit, ++ sizeof(unsigned char)); ++ return ret; ++} ++ + static inline int spl_reset_device_by_gpio(const char *label, int pin, int low_width) + { + int ret; +@@ -92,6 +115,12 @@ int spl_board_init_f(void) + + pwm_device_init(); + ++ ret = init_tmp451_remote_therm_limit(); ++ if (ret) { ++ debug("TMP451 remote THERM limit init failed: %d\n", ret); ++ goto end; ++ } ++ + ret = spl_gemgxl_init(); + if (ret) { + debug("Gigabit ethernet PHY (VSC8541) init failed: %d\n", ret); +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -536,8 +536,18 @@ config SYS_I2C_EEPROM_ADDR + depends on ID_EEPROM || I2C_EEPROM || SPL_I2C_EEPROM || CMD_EEPROM || ENV_IS_IN_EEPROM + default 0 + ++config SYS_I2C_TMP451_ADDR ++ hex "Chip address of the TMP451 device" ++ default 0 ++ + if I2C_EEPROM + ++config SYS_I2C_TMP451_ADDR_LEN ++ int "Length in bytes of the TMP451 memory array address" ++ default 1 ++ help ++ Note: This is NOT the chip address length! ++ + config SYS_I2C_EEPROM_ADDR_OVERFLOW + hex "EEPROM Address Overflow" + default 0x0 +--- a/include/configs/sifive-unmatched.h ++++ b/include/configs/sifive-unmatched.h +@@ -15,6 +15,10 @@ + + #define CONFIG_STANDALONE_LOAD_ADDR 0x80200000 + ++#define CONFIG_SYS_TMP451_BUS_NUM 0 ++#define CONFIG_SYS_I2C_TMP451_ADDR 0x4c ++#define CONFIG_SYS_I2C_TMP451_ADDR_LEN 0x1 ++ + /* Environment options */ + + #define BOOT_TARGET_DEVICES(func) \ +--- a/scripts/config_whitelist.txt ++++ b/scripts/config_whitelist.txt +@@ -1268,6 +1268,7 @@ CONFIG_SYS_TIMER_BASE + CONFIG_SYS_TIMER_COUNTER + CONFIG_SYS_TIMER_COUNTS_DOWN + CONFIG_SYS_TIMER_RATE ++CONFIG_SYS_TMP451_BUS_NUM + CONFIG_SYS_TMPVIRT + CONFIG_SYS_TSEC1_OFFSET + CONFIG_SYS_TX_ETH_BUFFER diff --git a/package/boot/uboot-sifiveu/patches/0008-riscv-dts-Add-few-PMU-events.patch b/package/boot/uboot-sifiveu/patches/0008-riscv-dts-Add-few-PMU-events.patch new file mode 100644 index 00000000000000..3f3feb9da70c65 --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/0008-riscv-dts-Add-few-PMU-events.patch @@ -0,0 +1,36 @@ +From c29e4d84cfa17ab96eff2a9044f486ba3c8b5c43 Mon Sep 17 00:00:00 2001 +From: Atish Patra +Date: Mon, 25 Oct 2021 11:35:41 -0700 +Subject: [PATCH] riscv: dts: Add few PMU events + +fu740 has 2 HPM counters and many HPM events defined in the fu740 manual[1]. +This patch adds some of these events and their mapping as per the +OpenSBI PMU DT binding for now. + +[1]https://sifive.cdn.prismic.io/sifive/de1491e5-077c-461d-9605-e8a0ce57337d_fu740-c000-manual-v1p3.pdf + +Signed-off-by: Atish Patra +--- + arch/riscv/dts/fu740-c000.dtsi | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/arch/riscv/dts/fu740-c000.dtsi ++++ b/arch/riscv/dts/fu740-c000.dtsi +@@ -140,6 +140,17 @@ + #size-cells = <2>; + compatible = "simple-bus"; + ranges; ++ pmu { ++ compatible = "riscv,pmu"; ++ riscv,raw-event-to-mhpmcounters = <0x00000000 0x200 0x18 ++ 0x00000000 0x400 0x18 ++ 0x00000000 0x800 0x18>; ++ riscv,event-to-mhpmcounters = <0x05 0x06 0x18 ++ 0x10009 0x10009 0x18>; ++ riscv,event-to-mhpmevent = <0x05 0x00000000 0x4000 ++ 0x06 0x00000000 0x4001 ++ 0x10008 0x00000000 0x102>; ++ }; + plic0: interrupt-controller@c000000 { + #interrupt-cells = <1>; + #address-cells = <0>; diff --git a/package/boot/uboot-sifiveu/patches/0009-riscv-Fix-build-against-binutils.patch b/package/boot/uboot-sifiveu/patches/0009-riscv-Fix-build-against-binutils.patch new file mode 100644 index 00000000000000..87dbf984ec54aa --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/0009-riscv-Fix-build-against-binutils.patch @@ -0,0 +1,50 @@ +commit 1dde977518f13824b847e23275001191139bc384 +Author: Alexandre Ghiti +Date: Mon Oct 3 18:07:54 2022 +0200 + + riscv: Fix build against binutils 2.38 + + The following description is copied from the equivalent patch for the + Linux Kernel proposed by Aurelien Jarno: + + >From version 2.38, binutils default to ISA spec version 20191213. This + means that the csr read/write (csrr*/csrw*) instructions and fence.i + instruction has separated from the `I` extension, become two standalone + extensions: Zicsr and Zifencei. As the kernel uses those instruction, + this causes the following build failure: + + arch/riscv/cpu/mtrap.S: Assembler messages: + arch/riscv/cpu/mtrap.S:65: Error: unrecognized opcode `csrr a0,scause' + arch/riscv/cpu/mtrap.S:66: Error: unrecognized opcode `csrr a1,sepc' + arch/riscv/cpu/mtrap.S:67: Error: unrecognized opcode `csrr a2,stval' + arch/riscv/cpu/mtrap.S:70: Error: unrecognized opcode `csrw sepc,a0' + + Signed-off-by: Alexandre Ghiti + Reviewed-by: Bin Meng + Tested-by: Heinrich Schuchardt + Tested-by: Heiko Stuebner + Tested-by: Christian Stewart + Reviewed-by: Rick Chen + +diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile +index 0b80eb8d86..53d1194ffb 100644 +--- a/arch/riscv/Makefile ++++ b/arch/riscv/Makefile +@@ -24,7 +24,16 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) + CMODEL = medany + endif + +-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \ ++RISCV_MARCH = $(ARCH_BASE)$(ARCH_A)$(ARCH_C) ++ ++# Newer binutils versions default to ISA spec version 20191213 which moves some ++# instructions from the I extension to the Zicsr and Zifencei extensions. ++toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH)_zicsr_zifencei) ++ifeq ($(toolchain-need-zicsr-zifencei),y) ++ RISCV_MARCH := $(RISCV_MARCH)_zicsr_zifencei ++endif ++ ++ARCH_FLAGS = -march=$(RISCV_MARCH) -mabi=$(ABI) \ + -mcmodel=$(CMODEL) + + PLATFORM_CPPFLAGS += $(ARCH_FLAGS) diff --git a/package/boot/uboot-sifiveu/patches/100-mkimage-check-environment-for-dtc-binary-location.patch b/package/boot/uboot-sifiveu/patches/100-mkimage-check-environment-for-dtc-binary-location.patch new file mode 100644 index 00000000000000..482aa1a3693cb0 --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/100-mkimage-check-environment-for-dtc-binary-location.patch @@ -0,0 +1,35 @@ +From 637800493945ffed2f454756300437a4ec86e3b1 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Wed, 19 Jul 2017 22:23:15 +0200 +Subject: mkimage: check environment for dtc binary location + +Currently mkimage assumes the dtc binary is in the path and fails +otherwise. This patch makes it check the DTC environment variable first +for the dtc binary and then fall back to the default path. This makes +it possible to call the u-boot build with make DTC=... and build a fit +image with the dtc binary not being the the default path. + +Signed-off-by: Hauke Mehrtens +Cc: Simon Glass +--- + tools/fit_image.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/tools/fit_image.c ++++ b/tools/fit_image.c +@@ -726,9 +726,14 @@ static int fit_handle_file(struct image_ + } + *cmd = '\0'; + } else if (params->datafile) { ++ const char* dtc = getenv("DTC"); ++ ++ if (!dtc) ++ dtc = MKIMAGE_DTC; ++ + /* dtc -I dts -O dtb -p 500 -o tmpfile datafile */ + snprintf(cmd, sizeof(cmd), "%s %s -o \"%s\" \"%s\"", +- MKIMAGE_DTC, params->dtc, tmpfile, params->datafile); ++ dtc, params->dtc, tmpfile, params->datafile); + debug("Trying to execute \"%s\"\n", cmd); + } else { + snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"", diff --git a/package/boot/uboot-sifiveu/patches/110-no-kwbimage.patch b/package/boot/uboot-sifiveu/patches/110-no-kwbimage.patch new file mode 100644 index 00000000000000..65d14f5bece8bd --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/110-no-kwbimage.patch @@ -0,0 +1,10 @@ +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -119,7 +119,6 @@ dumpimage-mkimage-objs := aisimage.o \ + imximage.o \ + imx8image.o \ + imx8mimage.o \ +- kwbimage.o \ + lib/md5.o \ + lpc32xximage.o \ + mxsimage.o \ diff --git a/package/boot/uboot-sifiveu/patches/130-fix-mkimage-host-build.patch b/package/boot/uboot-sifiveu/patches/130-fix-mkimage-host-build.patch new file mode 100644 index 00000000000000..cd65c1321fc320 --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/130-fix-mkimage-host-build.patch @@ -0,0 +1,24 @@ +--- a/tools/image-host.c ++++ b/tools/image-host.c +@@ -1125,6 +1125,7 @@ static int fit_config_add_verification_d + * 2) get public key (X509_get_pubkey) + * 3) provide der format (d2i_RSAPublicKey) + */ ++#ifdef CONFIG_TOOLS_LIBCRYPTO + static int read_pub_key(const char *keydir, const void *name, + unsigned char **pubkey, int *pubkey_len) + { +@@ -1178,6 +1179,13 @@ err_cert: + fclose(f); + return ret; + } ++#else ++static int read_pub_key(const char *keydir, const void *name, ++ unsigned char **pubkey, int *pubkey_len) ++{ ++ return -ENOSYS; ++} ++#endif + + int fit_pre_load_data(const char *keydir, void *keydest, void *fit) + { diff --git a/package/boot/uboot-sifiveu/patches/300-force-pylibfdt-build.patch b/package/boot/uboot-sifiveu/patches/300-force-pylibfdt-build.patch new file mode 100644 index 00000000000000..4abf13eda869fe --- /dev/null +++ b/package/boot/uboot-sifiveu/patches/300-force-pylibfdt-build.patch @@ -0,0 +1,30 @@ +--- a/Makefile ++++ b/Makefile +@@ -2028,26 +2028,7 @@ endif + # Check dtc and pylibfdt, if DTC is provided, else build them + PHONY += scripts_dtc + scripts_dtc: scripts_basic +- $(Q)if test "$(DTC)" = "$(DTC_INTREE)"; then \ +- $(MAKE) $(build)=scripts/dtc; \ +- else \ +- if ! $(DTC) -v >/dev/null; then \ +- echo '*** Failed to check dtc version: $(DTC)'; \ +- false; \ +- else \ +- if test "$(call dtc-version)" -lt $(DTC_MIN_VERSION); then \ +- echo '*** Your dtc is too old, please upgrade to dtc $(DTC_MIN_VERSION) or newer'; \ +- false; \ +- else \ +- if [ -n "$(CONFIG_PYLIBFDT)" ]; then \ +- if ! echo "import libfdt" | $(PYTHON3) 2>/dev/null; then \ +- echo '*** pylibfdt does not seem to be available with $(PYTHON3)'; \ +- false; \ +- fi; \ +- fi; \ +- fi; \ +- fi; \ +- fi ++ $(MAKE) $(build)=scripts/dtc + + # --------------------------------------------------------------------------- + quiet_cmd_cpp_lds = LDS $@ diff --git a/package/boot/uboot-sifiveu/uEnv-default.txt b/package/boot/uboot-sifiveu/uEnv-default.txt new file mode 100644 index 00000000000000..8468a3cace04be --- /dev/null +++ b/package/boot/uboot-sifiveu/uEnv-default.txt @@ -0,0 +1,5 @@ +setenv loadkernel fatload mmc 0:3 \$kernel_addr_r Image +setenv loaddtb fatload mmc 0:3 \$fdt_addr_r dtb +setenv bootargs console=ttySIF0,115200 earlycon=sbi root=/dev/mmcblk0p4 rootwait +setenv uenvcmd run loadkernel \&\& run loaddtb \&\& booti \$kernel_addr_r - \$fdt_addr_r +run uenvcmd From 4a281a778999776b9e4c86288152630c6d3db27b Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sun, 16 Dec 2018 11:05:58 +0100 Subject: [PATCH 0188/1171] sifiveu: add new target for SiFive U-based boards RISC-V is a new CPU architecture aimed to be fully free and open. This target will add support for it, based on 5.15. Supports running on: - HiFive Unleashed - FU540, first generation - HiFive Unmatched - FU740, current latest generation, PCIe SD-card images are generated, where the partitions are required to have specific type codes. As it is commonplace nowadays, OpenSBI is used as the first stage, with U-boot following as the proper bootloader. Specifications: HiFive Unleashed: - CPU: SiFive FU540 quad-core RISC-V (U54, RV64IMAFDC or RV64GC) - Memory: 8Gb - Ethernet: 1x 10/100/1000 - Console: via microUSB HiFive Unmatched: - CPU: SiFive FU740 quad-core RISC-V (U74, RV64IMAFDCB or RV64GCB) - Memory: 16Gb - Ethernet: 1x 10/100/1000 - USB: 4x USB 3.2 - PCIe: - 1x PCIe Gen3 x8 - 1x M.2 key M (PCIe x4) - 1x M.2 Key E (PCIe x1 / USB2.0) - Console: via microUSB Installation: Standard SD-card installation via dd-ing the generated image to an SD-card of at least 256Mb. Signed-off-by: Zoltan HERPAI (cherry picked from commit a3469a90c47edd94daae6a23b810b74cd8389ce3) --- target/linux/sifiveu/Makefile | 23 ++ .../sifiveu/base-files/etc/board.d/01_leds | 21 + .../sifiveu/base-files/etc/board.d/02_network | 18 + target/linux/sifiveu/base-files/etc/inittab | 4 + .../base-files/lib/preinit/79_move_config | 19 + .../base-files/lib/upgrade/platform.sh | 86 +++++ target/linux/sifiveu/config-5.15 | 363 ++++++++++++++++++ target/linux/sifiveu/generic/target.mk | 1 + target/linux/sifiveu/image/Config.in | 5 + target/linux/sifiveu/image/Makefile | 56 +++ .../sifiveu/image/gen_sifiveu_sdcard_img.sh | 28 ++ ...40-cpu-1-2-3-4-set-compatible-to-sif.patch | 49 +++ ...e-unmatched-update-regulators-values.patch | 104 +++++ ...scv-sifive-unmatched-define-PWM-LEDs.patch | 69 ++++ ...ive-unmatched-add-gpio-poweroff-node.patch | 26 ++ ...e-unleashed-define-opp-table-cpufreq.patch | 116 ++++++ .../0006-riscv-sbi-srst-support.patch | 301 +++++++++++++++ 17 files changed, 1289 insertions(+) create mode 100644 target/linux/sifiveu/Makefile create mode 100644 target/linux/sifiveu/base-files/etc/board.d/01_leds create mode 100644 target/linux/sifiveu/base-files/etc/board.d/02_network create mode 100644 target/linux/sifiveu/base-files/etc/inittab create mode 100644 target/linux/sifiveu/base-files/lib/preinit/79_move_config create mode 100644 target/linux/sifiveu/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/sifiveu/config-5.15 create mode 100644 target/linux/sifiveu/generic/target.mk create mode 100644 target/linux/sifiveu/image/Config.in create mode 100644 target/linux/sifiveu/image/Makefile create mode 100755 target/linux/sifiveu/image/gen_sifiveu_sdcard_img.sh create mode 100644 target/linux/sifiveu/patches-5.15/0001-riscv-sifive-fu740-cpu-1-2-3-4-set-compatible-to-sif.patch create mode 100644 target/linux/sifiveu/patches-5.15/0002-riscv-sifive-unmatched-update-regulators-values.patch create mode 100644 target/linux/sifiveu/patches-5.15/0003-riscv-sifive-unmatched-define-PWM-LEDs.patch create mode 100644 target/linux/sifiveu/patches-5.15/0004-riscv-sifive-unmatched-add-gpio-poweroff-node.patch create mode 100644 target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch create mode 100644 target/linux/sifiveu/patches-5.15/0006-riscv-sbi-srst-support.patch diff --git a/target/linux/sifiveu/Makefile b/target/linux/sifiveu/Makefile new file mode 100644 index 00000000000000..f88164e7af330b --- /dev/null +++ b/target/linux/sifiveu/Makefile @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Toco Technologies +# +include $(TOPDIR)/rules.mk + +ARCH:=riscv64 +BOARD:=sifiveu +BOARDNAME:=SiFive U-based RISC-V boards +FEATURES:=ext4 +KERNELNAME:=Image dtbs +SUBTARGETS:=generic + +KERNEL_PATCHVER:=5.15 + +include $(INCLUDE_DIR)/target.mk + +define Target/Description + Build firmware images for the SiFive U-based boards + (HiFive boards) +endef + +$(eval $(call BuildTarget)) diff --git a/target/linux/sifiveu/base-files/etc/board.d/01_leds b/target/linux/sifiveu/base-files/etc/board.d/01_leds new file mode 100644 index 00000000000000..5610a791ecd058 --- /dev/null +++ b/target/linux/sifiveu/base-files/etc/board.d/01_leds @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in +sifive,hifive-unleashed-a00) + ucidef_set_led_netdev "lan" "LAN" "green:d3" "eth0" + ;; +sifive,hifive-unmatched-a00) + ucidef_set_led_netdev "lan" "LAN" "green:d2" "eth0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/sifiveu/base-files/etc/board.d/02_network b/target/linux/sifiveu/base-files/etc/board.d/02_network new file mode 100644 index 00000000000000..ca9f7f200808e7 --- /dev/null +++ b/target/linux/sifiveu/base-files/etc/board.d/02_network @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in +*) + ucidef_set_interface_lan 'eth0' + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/sifiveu/base-files/etc/inittab b/target/linux/sifiveu/base-files/etc/inittab new file mode 100644 index 00000000000000..69f97c47c814d3 --- /dev/null +++ b/target/linux/sifiveu/base-files/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +ttySIF0::askfirst:/usr/libexec/login.sh +tty1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/sifiveu/base-files/lib/preinit/79_move_config b/target/linux/sifiveu/base-files/lib/preinit/79_move_config new file mode 100644 index 00000000000000..2796c4d01b64e5 --- /dev/null +++ b/target/linux/sifiveu/base-files/lib/preinit/79_move_config @@ -0,0 +1,19 @@ +# Copyright (C) 2012-2015 OpenWrt.org + +move_config() { + local partdev + + . /lib/upgrade/common.sh + + if export_bootdevice && export_partdevice partdev 3; then + if mount -t vfat -o rw,noatime "/dev/$partdev" /mnt; then + if [ -f "/mnt/$BACKUP_FILE" ]; then + mv -f "/mnt/$BACKUP_FILE" / + fi + umount /mnt + fi + fi +} + +boot_hook_add preinit_mount_root move_config + diff --git a/target/linux/sifiveu/base-files/lib/upgrade/platform.sh b/target/linux/sifiveu/base-files/lib/upgrade/platform.sh new file mode 100644 index 00000000000000..b5f6bada41937d --- /dev/null +++ b/target/linux/sifiveu/base-files/lib/upgrade/platform.sh @@ -0,0 +1,86 @@ +platform_check_image() { + local diskdev partdev diff + + export_bootdevice && export_partdevice diskdev 0 || { + echo "Unable to determine upgrade device" + return 1 + } + + get_partitions "/dev/$diskdev" bootdisk + + #extract the boot sector from the image + get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + + rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image + + if [ -n "$diff" ]; then + echo "Partition layout has changed. Full image will be written." + ask_bool 0 "Abort" && exit 1 + return 0 + fi +} + +platform_copy_config() { + local partdev + + if export_partdevice partdev 3; then + mount -t vfat -o rw,noatime "/dev/$partdev" /mnt + cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" + umount /mnt + fi +} + +platform_do_upgrade() { + local diskdev partdev diff + + export_bootdevice && export_partdevice diskdev 0 || { + echo "Unable to determine upgrade device" + return 1 + } + + sync + + if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then + get_partitions "/dev/$diskdev" bootdisk + + #extract the boot sector from the image + get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + else + diff=1 + fi + + if [ -n "$diff" ]; then + get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync + + # Separate removal and addtion is necessary; otherwise, partition 1 + # will be missing if it overlaps with the old partition 2 + partx -d - "/dev/$diskdev" + partx -a - "/dev/$diskdev" + + return 0 + fi + + #iterate over each partition from the image and write it to the boot disk + while read part start size; do + if export_partdevice partdev $part; then + echo "Writing image to /dev/$partdev..." + get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync + else + echo "Unable to find partition $part device, skipped." + fi + done < /tmp/partmap.image + + #copy partition uuid + echo "Writing new UUID to /dev/$diskdev..." + get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync +} diff --git a/target/linux/sifiveu/config-5.15 b/target/linux/sifiveu/config-5.15 new file mode 100644 index 00000000000000..fce0f659e3ff67 --- /dev/null +++ b/target/linux/sifiveu/config-5.15 @@ -0,0 +1,363 @@ +CONFIG_64BIT=y +CONFIG_ARCH_CLOCKSOURCE_INIT=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +# CONFIG_ARCH_RV32I is not set +CONFIG_ARCH_RV64I=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_STACKWALK=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_ATA=y +CONFIG_ATA_VERBOSE_ERROR=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_MQ_VIRTIO=y +CONFIG_CAVIUM_PTP=y +CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y +CONFIG_CLK_ANALOGBITS_WRPLL_CLN28HPC=y +CONFIG_CLK_SIFIVE=y +CONFIG_CLK_SIFIVE_PRCI=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CLZ_TAB=y +CONFIG_CMODEL_MEDANY=y +# CONFIG_CMODEL_MEDLOW is not set +CONFIG_COMMON_CLK=y +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_COMPAT_BRK=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_COREDUMP=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_CPU_ISOLATION=y +CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +# CONFIG_CRC32_SARWATE is not set +CONFIG_CRC32_SLICEBY8=y +CONFIG_CRC7=y +CONFIG_CRC_ITU_T=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_DRBG_HMAC=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_ECHAINIV=y +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1 +CONFIG_CRYPTO_LIB_SHA256=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_RSA=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +CONFIG_DEBUG_BUGVERBOSE=y +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DNOTIFY=y +CONFIG_DTC=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_EDAC=y +# CONFIG_EDAC_DEBUG is not set +CONFIG_EDAC_LEGACY_SYSFS=y +CONFIG_EDAC_SIFIVE=y +CONFIG_EDAC_SUPPORT=y +CONFIG_EFI=y +CONFIG_EFIVAR_FS=m +# CONFIG_EFI_BOOTLOADER_CONTROL is not set +# CONFIG_EFI_CAPSULE_LOADER is not set +# CONFIG_EFI_DISABLE_PCI_DMA is not set +CONFIG_EFI_EARLYCON=y +CONFIG_EFI_ESRT=y +CONFIG_EFI_GENERIC_STUB=y +CONFIG_EFI_PARAMS_FROM_FDT=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_STUB=y +# CONFIG_EFI_TEST is not set +CONFIG_ELF_CORE=y +CONFIG_ERRATA_SIFIVE=y +CONFIG_ERRATA_SIFIVE_CIP_1200=y +CONFIG_ERRATA_SIFIVE_CIP_453=y +CONFIG_EXT4_FS=y +CONFIG_FAILOVER=y +CONFIG_FHANDLE=y +CONFIG_FIXED_PHY=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FONT_8x16=y +CONFIG_FONT_AUTOSELECT=y +CONFIG_FONT_SUPPORT=y +CONFIG_FPU=y +CONFIG_FRAME_POINTER=y +CONFIG_FRAME_WARN=2048 +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FWNODE_MDIO=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IOREMAP=y +CONFIG_GENERIC_IRQ_INJECTION=y +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GLOB=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_CDEV_V1=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_SIFIVE=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HID=y +CONFIG_HID_GENERIC=y +CONFIG_HOTPLUG_PCI=y +# CONFIG_HOTPLUG_PCI_CPCI is not set +CONFIG_HOTPLUG_PCI_PCIE=y +CONFIG_HOTPLUG_PCI_SHPC=y +CONFIG_HVC_DRIVER=y +CONFIG_HVC_RISCV_SBI=y +CONFIG_HW_CONSOLE=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_OCORES=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +# CONFIG_IOMMU_DEBUGFS is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_IO_URING=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_KALLSYMS=y +CONFIG_KEYS=y +CONFIG_LEDS_PWM=y +CONFIG_LEDS_TRIGGER_DISK=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LIBFDT=y +CONFIG_LOCALVERSION_AUTO=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_MACB=y +# CONFIG_MACB_PCI is not set +CONFIG_MACB_USE_HWSTAMP=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MEMFD_CREATE=y +CONFIG_MFD_CORE=y +CONFIG_MFD_SYSCON=y +CONFIG_MICROSEMI_PHY=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_CADENCE=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SPI=y +CONFIG_MMIOWB=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MODULE_SECTIONS=y +CONFIG_MPILIB=y +CONFIG_MQ_IOSCHED_DEADLINE=y +CONFIG_MQ_IOSCHED_KYBER=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NET_FAILOVER=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NET_SELFTESTS=y +CONFIG_NLS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NR_CPUS=8 +CONFIG_NVMEM=y +CONFIG_NVMEM_SYSFS=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OID_REGISTRY=y +CONFIG_PADATA=y +CONFIG_PAGE_OFFSET=0xffffffe000000000 +CONFIG_PAGE_REPORTING=y +CONFIG_PA_BITS=56 +CONFIG_PCI=y +CONFIG_PCIEAER=y +CONFIG_PCIEAER_INJECT=m +CONFIG_PCIEASPM=y +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_PERFORMANCE is not set +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set +CONFIG_PCIEPORTBUS=y +CONFIG_PCIE_DPC=y +CONFIG_PCIE_DW=y +CONFIG_PCIE_DW_HOST=y +CONFIG_PCIE_ECRC=y +CONFIG_PCIE_FU740=y +CONFIG_PCIE_PTM=y +CONFIG_PCIE_XILINX=y +CONFIG_PCI_DEBUG=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_ECAM=y +CONFIG_PCI_HOST_COMMON=y +CONFIG_PCI_HOST_GENERIC=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PCI_SW_SWITCHTEC=y +CONFIG_PGTABLE_LEVELS=3 +CONFIG_PHYLIB=y +CONFIG_PHYLINK=y +CONFIG_PHYS_ADDR_T_64BIT=y +# CONFIG_PHYS_RAM_BASE_FIXED is not set +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +CONFIG_POWER_RESET_RESTART=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_PPS=y +CONFIG_PRINTK_TIME=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_PWM=y +CONFIG_PWM_SIFIVE=y +CONFIG_PWM_SYSFS=y +CONFIG_RATIONAL=y +CONFIG_RCU_TRACE=y +CONFIG_RD_GZIP=y +CONFIG_REALTEK_PHY=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_IRQ=y +CONFIG_REGMAP_MMIO=y +# CONFIG_RESET_ATTACK_MITIGATION is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_SIMPLE=y +CONFIG_RFS_ACCEL=y +CONFIG_RISCV=y +CONFIG_RISCV_ERRATA_ALTERNATIVE=y +CONFIG_RISCV_INTC=y +CONFIG_RISCV_ISA_C=y +CONFIG_RISCV_SBI=y +CONFIG_RISCV_SBI_V01=y +CONFIG_RISCV_TIMER=y +CONFIG_RPS=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_DRV_EFI is not set +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SCHED_DEBUG=y +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_EXAR=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_EARLYCON_RISCV_SBI=y +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_SIFIVE=y +CONFIG_SERIAL_SIFIVE_CONSOLE=y +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +CONFIG_SG_POOL=y +CONFIG_SIFIVE_L2=y +CONFIG_SIFIVE_PLIC=y +CONFIG_SLUB_DEBUG=y +CONFIG_SMP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +# CONFIG_SOC_MICROCHIP_POLARFIRE is not set +CONFIG_SOC_SIFIVE=y +# CONFIG_SOC_VIRT is not set +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +CONFIG_SPI_SIFIVE=y +CONFIG_SRCU=y +CONFIG_STACKTRACE=y +CONFIG_SWIOTLB=y +CONFIG_SWPHY=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYSFB=y +# CONFIG_SYSFB_SIMPLEFB is not set +CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TRACE_CLOCK=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_TUNE_GENERIC=y +CONFIG_UCS2_STRING=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_USB=y +CONFIG_USB_COMMON=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +CONFIG_USB_EHCI_PCI=y +CONFIG_USB_HID=y +CONFIG_USB_NET_DRIVERS=y +CONFIG_USB_PCI=y +CONFIG_USB_STORAGE=y +CONFIG_USB_SUPPORT=y +# CONFIG_USB_UHCI_HCD is not set +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y +# CONFIG_USB_XHCI_PLATFORM is not set +CONFIG_VA_BITS=39 +CONFIG_VFAT_FS=y +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +CONFIG_VMAP_STACK=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_WATCHDOG_CORE=y +CONFIG_XPS=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZONE_DMA32=y diff --git a/target/linux/sifiveu/generic/target.mk b/target/linux/sifiveu/generic/target.mk new file mode 100644 index 00000000000000..f5cb1fb19b943f --- /dev/null +++ b/target/linux/sifiveu/generic/target.mk @@ -0,0 +1 @@ +BOARDNAME:=Generic diff --git a/target/linux/sifiveu/image/Config.in b/target/linux/sifiveu/image/Config.in new file mode 100644 index 00000000000000..640869b92c8136 --- /dev/null +++ b/target/linux/sifiveu/image/Config.in @@ -0,0 +1,5 @@ +config SIFIVEU_SD_BOOT_PARTSIZE + int "Boot (SD Card) filesystem partition size (in MB)" + depends on TARGET_sifiveu + default 32 + diff --git a/target/linux/sifiveu/image/Makefile b/target/linux/sifiveu/image/Makefile new file mode 100644 index 00000000000000..ef3b13eeec4574 --- /dev/null +++ b/target/linux/sifiveu/image/Makefile @@ -0,0 +1,56 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Toco Technologies +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +FAT32_BLOCK_SIZE=1024 +FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SIFIVEU_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) + +KERNEL_LOADADDR:=0x80200000 + +define Build/riscv-sdcard + rm -f $@.boot #$(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img + mkfs.fat $@.boot -C $(FAT32_BLOCKS) + + mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr + mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::dtb + mcopy -i $@.boot $(IMAGE_KERNEL) ::Image + + ./gen_sifiveu_sdcard_img.sh \ + $@ \ + $@.boot \ + $(IMAGE_ROOTFS) \ + $(CONFIG_SIFIVEU_SD_BOOT_PARTSIZE) \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) \ + $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.itb \ + $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.itb-spl +endef + +define Device/Default + PROFILES := Default + KERNEL_NAME := Image + KERNEL := kernel-bin | libdeflate-gzip + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := riscv-sdcard | append-metadata | gzip +endef + +define Device/sifive_unleashed + DEVICE_VENDOR := SiFive + DEVICE_MODEL := Unleashed (FU540) + DEVICE_DTS := sifive/hifive-unleashed-a00 + UBOOT := sifive_unleashed +endef +TARGET_DEVICES += sifive_unleashed + +define Device/sifive_unmatched + DEVICE_VENDOR := SiFive + DEVICE_MODEL := Unmatched (FU740) + DEVICE_DTS := sifive/hifive-unmatched-a00 + DEVICE_PACKAGES += kmod-eeprom-at24 kmod-hwmon-lm90 + UBOOT := sifive_unmatched +endef +TARGET_DEVICES += sifive_unmatched + +$(eval $(call BuildImage)) diff --git a/target/linux/sifiveu/image/gen_sifiveu_sdcard_img.sh b/target/linux/sifiveu/image/gen_sifiveu_sdcard_img.sh new file mode 100755 index 00000000000000..172f62485d8ed5 --- /dev/null +++ b/target/linux/sifiveu/image/gen_sifiveu_sdcard_img.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 OpenWrt.org +# + +set -ex +[ $# -eq 7 ] || { + echo "SYNTAX: $0 " + exit 1 +} + +OUTPUT="$1" +BOOTFS="$2" +ROOTFS="$3" +BOOTFSSIZE="$4" +ROOTFSSIZE="$5" +UBOOT="$6" +UBOOT_SPL="$7" + +set $(ptgen -o $OUTPUT -v -g -T sifiveu_spl -N loader1 -p 1024 -T sifiveu_uboot -N loader2 -p 4096 -t ef -N boot -p ${BOOTFSSIZE}M -N rootfs -p ${ROOTFSSIZE}M) + +ROOTFSOFFSET=$(($7 / 512)) + +dd bs=512 if="$UBOOT_SPL" of="$OUTPUT" seek=34 conv=notrunc +dd bs=512 if="$UBOOT" of="$OUTPUT" seek=2082 conv=notrunc +dd bs=512 if="$BOOTFS" of="$OUTPUT" seek=10274 conv=notrunc +dd bs=512 if="$ROOTFS" of="$OUTPUT" seek=${ROOTFSOFFSET} conv=notrunc diff --git a/target/linux/sifiveu/patches-5.15/0001-riscv-sifive-fu740-cpu-1-2-3-4-set-compatible-to-sif.patch b/target/linux/sifiveu/patches-5.15/0001-riscv-sifive-fu740-cpu-1-2-3-4-set-compatible-to-sif.patch new file mode 100644 index 00000000000000..9a1c96813907bf --- /dev/null +++ b/target/linux/sifiveu/patches-5.15/0001-riscv-sifive-fu740-cpu-1-2-3-4-set-compatible-to-sif.patch @@ -0,0 +1,49 @@ +From ab5c8f5492cce16ff2104393e2f1fa64a3ff6e88 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Wed, 17 Feb 2021 06:06:14 -0800 +Subject: [PATCH 1/7] riscv: sifive: fu740: cpu{1,2,3,4} set compatible to + sifive,u74-mc + +Signed-off-by: David Abdurachmanov +--- + arch/riscv/boot/dts/sifive/fu740-c000.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/riscv/boot/dts/sifive/fu740-c000.dtsi ++++ b/arch/riscv/boot/dts/sifive/fu740-c000.dtsi +@@ -39,7 +39,7 @@ + }; + }; + cpu1: cpu@1 { +- compatible = "sifive,bullet0", "riscv"; ++ compatible = "sifive,u74-mc", "sifive,bullet0", "riscv"; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; +@@ -63,7 +63,7 @@ + }; + }; + cpu2: cpu@2 { +- compatible = "sifive,bullet0", "riscv"; ++ compatible = "sifive,u74-mc", "sifive,bullet0", "riscv"; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; +@@ -87,7 +87,7 @@ + }; + }; + cpu3: cpu@3 { +- compatible = "sifive,bullet0", "riscv"; ++ compatible = "sifive,u74-mc", "sifive,bullet0", "riscv"; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; +@@ -111,7 +111,7 @@ + }; + }; + cpu4: cpu@4 { +- compatible = "sifive,bullet0", "riscv"; ++ compatible = "sifive,u74-mc", "sifive,bullet0", "riscv"; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; diff --git a/target/linux/sifiveu/patches-5.15/0002-riscv-sifive-unmatched-update-regulators-values.patch b/target/linux/sifiveu/patches-5.15/0002-riscv-sifive-unmatched-update-regulators-values.patch new file mode 100644 index 00000000000000..ac316e9d9b97d7 --- /dev/null +++ b/target/linux/sifiveu/patches-5.15/0002-riscv-sifive-unmatched-update-regulators-values.patch @@ -0,0 +1,104 @@ +From 657819ff477dd73cd71075609698aa57ba098d8c Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Wed, 15 Sep 2021 07:10:02 -0700 +Subject: [PATCH 2/7] riscv: sifive: unmatched: update regulators values + +These are the regulators values from the schematics for Rev3{A,B} boards. + +Note this is not fully correct as bcore1/bcore2 and bmem/bio are merged, but +it's only supported in v5.15 kernel. See: + +541ee8f640327f951e7039278057827322231ab0 ("regulator: da9063: Add support for +full-current mode.") + +This will be changed for v5.15 kernel based on the patch above. + +Signed-off-by: David Abdurachmanov +--- + .../riscv/boot/dts/sifive/hifive-unmatched-a00.dts | 32 +++++++++++----------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +--- a/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts ++++ b/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts +@@ -73,16 +73,16 @@ + + regulators { + vdd_bcore1: bcore1 { +- regulator-min-microvolt = <900000>; +- regulator-max-microvolt = <900000>; ++ regulator-min-microvolt = <1050000>; ++ regulator-max-microvolt = <1050000>; + regulator-min-microamp = <5000000>; + regulator-max-microamp = <5000000>; + regulator-always-on; + }; + + vdd_bcore2: bcore2 { +- regulator-min-microvolt = <900000>; +- regulator-max-microvolt = <900000>; ++ regulator-min-microvolt = <1050000>; ++ regulator-max-microvolt = <1050000>; + regulator-min-microamp = <5000000>; + regulator-max-microamp = <5000000>; + regulator-always-on; +@@ -137,48 +137,48 @@ + }; + + vdd_ldo3: ldo3 { +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + regulator-min-microamp = <200000>; + regulator-max-microamp = <200000>; + regulator-always-on; + }; + + vdd_ldo4: ldo4 { +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-min-microvolt = <2500000>; ++ regulator-max-microvolt = <2500000>; + regulator-min-microamp = <200000>; + regulator-max-microamp = <200000>; + regulator-always-on; + }; + + vdd_ldo5: ldo5 { +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + regulator-min-microamp = <100000>; + regulator-max-microamp = <100000>; + regulator-always-on; + }; + + vdd_ldo6: ldo6 { +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; + regulator-min-microamp = <200000>; + regulator-max-microamp = <200000>; + regulator-always-on; + }; + + vdd_ldo7: ldo7 { +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + regulator-min-microamp = <200000>; + regulator-max-microamp = <200000>; + regulator-always-on; + }; + + vdd_ldo8: ldo8 { +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + regulator-min-microamp = <200000>; + regulator-max-microamp = <200000>; + regulator-always-on; diff --git a/target/linux/sifiveu/patches-5.15/0003-riscv-sifive-unmatched-define-PWM-LEDs.patch b/target/linux/sifiveu/patches-5.15/0003-riscv-sifive-unmatched-define-PWM-LEDs.patch new file mode 100644 index 00000000000000..661e15905f9d53 --- /dev/null +++ b/target/linux/sifiveu/patches-5.15/0003-riscv-sifive-unmatched-define-PWM-LEDs.patch @@ -0,0 +1,69 @@ +From 2c2d8ac8c124a2938c9326c14b2dffd46d76b4a8 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Mon, 13 Sep 2021 02:15:37 -0700 +Subject: [PATCH 3/7] riscv: sifive: unmatched: define PWM LEDs + +Add D2 (RGB) and D12 (green) LEDs for SiFive Unmatched board. + +Signed-off-by: David Abdurachmanov +--- + .../riscv/boot/dts/sifive/hifive-unmatched-a00.dts | 41 ++++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +--- a/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts ++++ b/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts +@@ -4,6 +4,8 @@ + #include "fu740-c000.dtsi" + #include + #include ++#include ++#include + + /* Clock frequency (in Hz) of the PCB crystal for rtcclk */ + #define RTCCLK_FREQ 1000000 +@@ -31,6 +33,45 @@ + soc { + }; + ++ pwmleds { ++ compatible = "pwm-leds"; ++ green-d12 { ++ label = "green:d12"; ++ color = ; ++ pwms = <&pwm0 0 7812500 PWM_POLARITY_INVERTED>; ++ active-low = <1>; ++ max-brightness = <255>; ++ linux,default-trigger = "none"; ++ }; ++ ++ green-d2 { ++ label = "green:d2"; ++ color = ; ++ pwms = <&pwm0 1 7812500 PWM_POLARITY_INVERTED>; ++ active-low = <1>; ++ max-brightness = <255>; ++ linux,default-trigger = "none"; ++ }; ++ ++ red-d2 { ++ label = "red:d2"; ++ color = ; ++ pwms = <&pwm0 2 7812500 PWM_POLARITY_INVERTED>; ++ active-low = <1>; ++ max-brightness = <255>; ++ linux,default-trigger = "none"; ++ }; ++ ++ blue-d2 { ++ label = "blue:d2"; ++ color = ; ++ pwms = <&pwm0 3 7812500 PWM_POLARITY_INVERTED>; ++ active-low = <1>; ++ max-brightness = <255>; ++ linux,default-trigger = "none"; ++ }; ++ }; ++ + hfclk: hfclk { + #clock-cells = <0>; + compatible = "fixed-clock"; diff --git a/target/linux/sifiveu/patches-5.15/0004-riscv-sifive-unmatched-add-gpio-poweroff-node.patch b/target/linux/sifiveu/patches-5.15/0004-riscv-sifive-unmatched-add-gpio-poweroff-node.patch new file mode 100644 index 00000000000000..6d09628cb3bd32 --- /dev/null +++ b/target/linux/sifiveu/patches-5.15/0004-riscv-sifive-unmatched-add-gpio-poweroff-node.patch @@ -0,0 +1,26 @@ +From 14ede57943bc4209755d08daf93ac7be967d7fbe Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Mon, 13 Sep 2021 02:18:30 -0700 +Subject: [PATCH 4/7] riscv: sifive: unmatched: add gpio-poweroff node + +Add gpio-poweroff node to allow powering off the system. + +Signed-off-by: David Abdurachmanov +--- + arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts ++++ b/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts +@@ -85,6 +85,11 @@ + clock-frequency = ; + clock-output-names = "rtcclk"; + }; ++ ++ gpio-poweroff { ++ compatible = "gpio-poweroff"; ++ gpios = <&gpio 2 GPIO_ACTIVE_LOW>; ++ }; + }; + + &uart0 { diff --git a/target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch b/target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch new file mode 100644 index 00000000000000..b5779e09cb0d9d --- /dev/null +++ b/target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch @@ -0,0 +1,116 @@ +From d3cf2859a056273400fbdf9d389b75750ff6ca5e Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Fri, 14 May 2021 05:27:51 -0700 +Subject: [PATCH 6/7] riscv: sifive: unleashed: define opp table (cpufreq) + +Source: https://github.com/sifive/riscv-linux/commits/dev/paulw/cpufreq-dt-aloe-v5.3-rc4 + +Signed-off-by: David Abdurachmanov +--- + arch/riscv/Kconfig | 8 +++++ + arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 5 ++++ + .../riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 34 ++++++++++++++++++++++ + 3 files changed, 47 insertions(+) + +--- a/arch/riscv/Kconfig ++++ b/arch/riscv/Kconfig +@@ -565,6 +565,14 @@ config BUILTIN_DTB + depends on OF + default y if XIP_KERNEL + ++menu "CPU Power Management" ++ ++source "drivers/cpuidle/Kconfig" ++ ++source "drivers/cpufreq/Kconfig" ++ ++endmenu ++ + menu "Power management options" + + source "kernel/power/Kconfig" +--- a/arch/riscv/boot/dts/sifive/fu540-c000.dtsi ++++ b/arch/riscv/boot/dts/sifive/fu540-c000.dtsi +@@ -30,6 +30,7 @@ + i-cache-size = <16384>; + reg = <0>; + riscv,isa = "rv64imac"; ++ clocks = <&prci PRCI_CLK_COREPLL>; + status = "disabled"; + cpu0_intc: interrupt-controller { + #interrupt-cells = <1>; +@@ -54,6 +55,7 @@ + reg = <1>; + riscv,isa = "rv64imafdc"; + tlb-split; ++ clocks = <&prci PRCI_CLK_COREPLL>; + next-level-cache = <&l2cache>; + cpu1_intc: interrupt-controller { + #interrupt-cells = <1>; +@@ -78,6 +80,7 @@ + reg = <2>; + riscv,isa = "rv64imafdc"; + tlb-split; ++ clocks = <&prci PRCI_CLK_COREPLL>; + next-level-cache = <&l2cache>; + cpu2_intc: interrupt-controller { + #interrupt-cells = <1>; +@@ -102,6 +105,7 @@ + reg = <3>; + riscv,isa = "rv64imafdc"; + tlb-split; ++ clocks = <&prci PRCI_CLK_COREPLL>; + next-level-cache = <&l2cache>; + cpu3_intc: interrupt-controller { + #interrupt-cells = <1>; +@@ -126,6 +130,7 @@ + reg = <4>; + riscv,isa = "rv64imafdc"; + tlb-split; ++ clocks = <&prci PRCI_CLK_COREPLL>; + next-level-cache = <&l2cache>; + cpu4_intc: interrupt-controller { + #interrupt-cells = <1>; +--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts ++++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts +@@ -84,6 +84,40 @@ + label = "d4"; + }; + }; ++ ++ fu540_c000_opp_table: opp-table { ++ compatible = "operating-points-v2"; ++ opp-shared; ++ ++ opp-350000000 { ++ opp-hz = /bits/ 64 <350000000>; ++ }; ++ opp-700000000 { ++ opp-hz = /bits/ 64 <700000000>; ++ }; ++ opp-999999999 { ++ opp-hz = /bits/ 64 <999999999>; ++ }; ++ opp-1400000000 { ++ opp-hz = /bits/ 64 <1400000000>; ++ }; ++ }; ++}; ++ ++&cpu0 { ++ operating-points-v2 = <&fu540_c000_opp_table>; ++}; ++&cpu1 { ++ operating-points-v2 = <&fu540_c000_opp_table>; ++}; ++&cpu2 { ++ operating-points-v2 = <&fu540_c000_opp_table>; ++}; ++&cpu3 { ++ operating-points-v2 = <&fu540_c000_opp_table>; ++}; ++&cpu4 { ++ operating-points-v2 = <&fu540_c000_opp_table>; + }; + + &uart0 { diff --git a/target/linux/sifiveu/patches-5.15/0006-riscv-sbi-srst-support.patch b/target/linux/sifiveu/patches-5.15/0006-riscv-sbi-srst-support.patch new file mode 100644 index 00000000000000..409001bcfa8c6c --- /dev/null +++ b/target/linux/sifiveu/patches-5.15/0006-riscv-sbi-srst-support.patch @@ -0,0 +1,301 @@ +From mboxrd@z Thu Jan 1 00:00:00 1970 +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-21.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, + DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, + INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,MSGID_FROM_MTA_HEADER, + SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable + autolearn_force=no version=3.4.0 +Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) + by smtp.lore.kernel.org (Postfix) with ESMTP id 9A34CC48BCD + for ; Wed, 9 Jun 2021 12:50:08 +0000 (UTC) +Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.kernel.org (Postfix) with ESMTPS id 69795611C9 + for ; Wed, 9 Jun 2021 12:50:08 +0000 (UTC) +DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69795611C9 +Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com +Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20210309; h=Sender: + Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: + Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: + Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: + List-Owner; bh=64gRxQ9bX8C6wjLq0KuJ2lv98bQdXijt0LPnNpch3NU=; b=rgeSpoSWQ+Nca2 + 9PLsgI7dOYVdTu48CyVJStiizsvIvVFN2rBAgELHF2nRCCtoSiPMxgcpCKtDcm7sh9lC8AblCoBjN + LXiPRHVYJAcRNiWiQ0qOTqHdTbezFdzSjNOs6drbaiI4B8AZtychw1hP+ubsb5czAaz6510OEVct/ + h5M4Tlljcn/WIyulBd/tnuUOZPT0XL6rb2+TvRQvjXDBFHN+bWqP8OjXKnE1FTvy5MF8OTlUgI6wr + 3f4t/eS/PPbtXRD5raJzEwEQLJ6XY6NJABs40tKpWZNuUaqTfmonNdbP9y1htWhByhsAk+fw5WK/C + /KocvM6IzPmqGIBWcTdQ==; +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) + id 1lqxeS-00Do8i-Hj; Wed, 09 Jun 2021 12:49:44 +0000 +Received: from esa4.hgst.iphmx.com ([216.71.154.42]) + by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) + id 1lqx5h-00DbCQ-K0 + for linux-riscv@lists.infradead.org; Wed, 09 Jun 2021 12:13:51 +0000 +DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; + d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; + t=1623240829; x=1654776829; + h=from:to:cc:subject:date:message-id:in-reply-to: + references:content-transfer-encoding:mime-version; + bh=s4va/Owvq7MQI8rUsD/e02RmaYfJNzYNcxlXspGRY7g=; + b=G5GD9eN+rv669E7jyRnRAt0jw83CxhIrSiDIjXuPmhWyMhKeQGD7ACRm + ii6o0zmOREhGihtwB6X/xpY/2ZvK+cxcHmJXa+Ykyn8QN+/YKFtg3svfj + eiTN7U/mEozCoGNd1wXu59RQj11Xz60DN/qEUlYFaL6SjukUgifFVgbvG + uUj8AM8+xf1jKHi3Q/6nVPpJX8uiW/NPFHrwI8hxUwYr9viQwxXvc7FNr + fR8bH2c/HiGacGYEHosgP0WT//d9Huqn4JNINvjidK4ZSJ74cXlr8KwMG + 8snmfx4UjEWMhK1lCYalJEU7nxXFfih/6DMuFRorETpWQ+424BAKUJdDH Q==; +IronPort-SDR: pYhRsIZkhfmi45K4HfnZj39kxfUGpxs1e+q+Wh8kDE+ySh35HkJaaUcpP04mb7VeIVtPRx/h6Q + imv6sn8fYo/V8ezHAq4jpd1QadqInKi1ubLnCE3Zy7GnhVBepoV6FbI14Y01V+5QIUwYdFNcGG + RsxDOTQyU5AljH0Rc6WkrpdVf5jsrXXMddmlDdi6QsfKGy7MwQ/NYojNIqyLhRSgu5w2uTIE7X + atSbjb8j2a+EJUY0WgYTGfNHKCdQLAhjcsWZgU7Iu0vSaBU6A7seCkqun24dvF/zYuzEj7wedD + TvE= +X-IronPort-AV: E=Sophos;i="5.83,260,1616428800"; d="scan'208";a="170575129" +Received: from mail-dm6nam12lp2169.outbound.protection.outlook.com (HELO + NAM12-DM6-obe.outbound.protection.outlook.com) ([104.47.59.169]) + by ob1.hgst.iphmx.com with ESMTP; 09 Jun 2021 20:13:48 +0800 +ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; + b=hrlr4Qi66FmbQW45zI7QeA9nEYSvxO+tR++vUyFHxjRqnr6WtjKgHM8hPpp8oHXaK82U0+KQUc2+WjLbe8LihexXFQs5zRwBDwuArmkKt85cL3utD3OBzTkr4A9ZhRS5mzztnn9kvTFNplPjSydXPetJQIZ9WKmihJrdeaGQ+zQ//6TdDWVpLyBbqiBVUbUwlKQbpbbfHvzQCHYQbIiUcGn4vaSXYp2Xp1Z5yYVtrfDK+TemKG/8fKQoJjg/tdmDtQ97Cgw7nX6Oc9kdmoTIxFilMy4XjPciPcNOPdLmboGCt6+TMBeftLc1VFNnr7PwuxOogv4I7eJ/P9UaK57k5A== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; + s=arcselector9901; + h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; + bh=Ibi36Vj2s7bu56DZaU1uSl4xNA3OB2FHlI/rBKn+8xo=; + b=CE3o+0GFLPMQuw0AK1IRf/vX00diXsjayn0MmpS7ntSVXgxXIAPT9aDtk7x0NovJBTk2LHI5Mtxvz6SwVnJzUqZmNsXUktEj5Iwdd8EPIIxgCOjugo/6WC0FqaFKNvJB4hQ0tjFxv+J5DexSJ8+mPx6Ucr4DwtUXrCWzOeXyF5YK68mU5FgttbyutW3CGsGkPgaPAdOxXOgJqyYu8X25unmzG12Jq2xC4oVKsbA+RfDiaMKm97q2Bhy+LcgJNS6/ktlFKSOVu1HQ0POYgba3mtldN3vg73wLbxrfsdoe4261aJpkM05GJFDzdTNp4t3rEGhNuLR1+8OmKfLlPeSU9w== +ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass + smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass + header.d=wdc.com; arc=none +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; + h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; + bh=Ibi36Vj2s7bu56DZaU1uSl4xNA3OB2FHlI/rBKn+8xo=; + b=Z76YsVxTHK6/ta19C5vwaBPYmtDa2GIM/ml4myQZfIaHFNzXPzZ+PFcYy/Xf1Ixd0GZHcuSZQYgs/SPHWATh+rOWBAislGv1zmSAG/g0tiDckB8WaCwh1e3qGW4ZmUTmAU7dxB0vn0pRSLTnc1hdCUZ73buM78qo9qwsQZv41d0= +Authentication-Results: dabbelt.com; dkim=none (message not signed) + header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; +Received: from CO6PR04MB7812.namprd04.prod.outlook.com (2603:10b6:303:138::6) + by CO6PR04MB7794.namprd04.prod.outlook.com (2603:10b6:303:13f::7) + with Microsoft SMTP Server (version=TLS1_2, + cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Wed, 9 Jun + 2021 12:13:47 +0000 +Received: from CO6PR04MB7812.namprd04.prod.outlook.com + ([fe80::a153:b7f8:c87f:89f8]) by CO6PR04MB7812.namprd04.prod.outlook.com + ([fe80::a153:b7f8:c87f:89f8%9]) with mapi id 15.20.4219.021; Wed, 9 Jun 2021 + 12:13:47 +0000 +From: Anup Patel +To: Palmer Dabbelt , + Palmer Dabbelt , + Paul Walmsley , Albert Ou +Cc: Atish Patra , + Alistair Francis , + Anup Patel , linux-riscv@lists.infradead.org, + linux-kernel@vger.kernel.org, Anup Patel +Subject: [PATCH v7 1/1] RISC-V: Use SBI SRST extension when available +Date: Wed, 9 Jun 2021 17:43:22 +0530 +Message-Id: <20210609121322.3058-2-anup.patel@wdc.com> +X-Mailer: git-send-email 2.25.1 +In-Reply-To: <20210609121322.3058-1-anup.patel@wdc.com> +References: <20210609121322.3058-1-anup.patel@wdc.com> +X-Originating-IP: [122.172.176.125] +X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM + (2603:1096:a00:22::22) To CO6PR04MB7812.namprd04.prod.outlook.com + (2603:10b6:303:138::6) +MIME-Version: 1.0 +X-MS-Exchange-MessageSentRepresentingType: 1 +Received: from wdc.com (122.172.176.125) by + MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) with + Microsoft SMTP Server (version=TLS1_2, + cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend + Transport; Wed, 9 Jun 2021 12:13:44 +0000 +X-MS-PublicTrafficType: Email +X-MS-Office365-Filtering-Correlation-Id: 17406ef0-e8d7-4dc3-eee9-08d92b40085b +X-MS-TrafficTypeDiagnostic: CO6PR04MB7794: +X-MS-Exchange-Transport-Forked: True +X-Microsoft-Antispam-PRVS: +WDCIPOUTBOUND: EOP-TRUE +X-MS-Oob-TLC-OOBClassifiers: OLM:2887; +X-MS-Exchange-SenderADCheck: 1 +X-Microsoft-Antispam: BCL:0; +X-Microsoft-Antispam-Message-Info: IxB9oKL9LkeXCQ7mZ1A5qIcKlICr/TPZ/8V0ErM5hbqnvfK6Mf0mQL0tqqlJAOvLpCEVIyX7FllGqSlWsNG3ik/WbbDYQb9wAFCuFSAlGAeGppnJjJf0zfDAmp4NONB7kshKqtUYfGltTHTkV4ni+VEwWf/Q3T4vA0k3Jkt34iZFi9tOsSHkSWxPTsQyviBdCp3/36ZCVhYs6bXkf8sh0sA4Ql/l8t2zpcEUwjAm14ie3hOUBEp1W9qOz6StmR4xyl+zy49U38byeHu5XDF/qFT8FI4WclwFwxbDeTm8cU7MMg4D0xeR0Ytm2wVrgAdiapgQYLmxPIjIG96TRTbCupyuaJXmYcI6/x27PtiQYFwcpbRUjXDKRVX2WW74WHm88OOlTexD/OsbGHD6PVnc+InniK38yNcx06U9fIkDGSYWrJqLysALlO0V5gfkc35Fhttum638ES0S2sldGkFufM372EZeooczK7jeLMpoOTAnaLtPdTCGsHnnEDDbOK7NiptQlrLMhrNQ/70harAMmB6Vvdl+jvJi34DsuX+57WeQU8Ya1cyVxzFkWX2DwvPRsAnp/VNHzeQLc5MAIUYpwQvkJBcqihYMKrLMNOT94HmxBYmY2bcW/K9fXrPQ/whyJ5HoQuxydeiy7+QKg6FWnhguTACaaTKGKKIDIlfYA5FXYlZOaQ2iJFtiZP1GbxQnDEwz4SfGgCgBdiwqFm1NfGG7wRhqQa/Kgp3jBTHwaysCwcWu/Xdz/yiCV4lfQD/PTiOr5hmtld29G7WVDy9m6Q== +X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; + IPV:NLI; SFV:NSPM; H:CO6PR04MB7812.namprd04.prod.outlook.com; PTR:; CAT:NONE; + SFS:(4636009)(396003)(39860400002)(136003)(346002)(366004)(376002)(8676002)(316002)(55236004)(38100700002)(38350700002)(110136005)(86362001)(54906003)(4326008)(956004)(966005)(478600001)(26005)(186003)(55016002)(8936002)(2616005)(7696005)(52116002)(16526019)(5660300002)(8886007)(6666004)(1076003)(66476007)(66556008)(36756003)(66946007)(83380400001)(2906002)(44832011); + DIR:OUT; SFP:1102; +X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 +X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2kfiFAcyFkAMcwkoCUqJGxdVnwsuTm5WWTXA4Pq0ZNAjWsfYI4MNugTA9f8C?= + =?us-ascii?Q?WaQrYEizTkvIlgRDqeKVRS0vaMaeU9XaSzO6UAJMnd0jY3BzkJgKUU9xj1aU?= + =?us-ascii?Q?vmwXKxCS+vZ2VKgLifaU1JCeemiJqV9aW+6AJEycq722bz9yXmcaJsaHWtX3?= + =?us-ascii?Q?4sSoLeVPvfzwzDZEEoGsZZi1G7inY2imGEgY/r3m5/qYvavJQ3An4e4sjEqZ?= + =?us-ascii?Q?Z4a4FAd/6c3X8cjmNwGvgWoAIM5WaJYFQe30MQ79alCUfZyiKB4tR0+5OGFd?= + =?us-ascii?Q?P/rQ169Z644JNKKcEabikpL7qZZJ6OMPTS7XR9x/7GzWOJ7soV3/3I2tfCdi?= + =?us-ascii?Q?xVsOK1DRF4y6gi5udvnb+Uu1U5wC1NlT0U/+TrnTSeY/IuLmMgFUysw+fQ+D?= + =?us-ascii?Q?DIVN44TKrMoEZKx9SKcx4jYpUGYvaCH4sVOAx3zWQC0Oz1Nz3/a/isywpQW9?= + =?us-ascii?Q?1I1kl/2N97K0EoWIPf6qPjyLVWXg1dOHfk6SjNW64JIIPUNnM3h7k2igDX3o?= + =?us-ascii?Q?d7lWyFfzoWhNC7opS71uzta+ti8aHxo+xzvYvf2wLb+fdyEP9t+oQVrEQYIW?= + =?us-ascii?Q?rAUKPqjEfAZOYBB28SaabfVt/QF6hFfV/0yJ/JV/Ie8ivC1t6iO+QZQscV7K?= + =?us-ascii?Q?d4Pg+xVSE+m+LsgNwO36cTTe6hSLBPnWU1NMOW2cxTRKGm0Lwd2HyjyKTBMD?= + =?us-ascii?Q?BcnKo9GXAVgOAGCG5cwEBN76q6sXxbWy0pjni3O2bLYBg4CIYCB/JNzOIfE0?= + =?us-ascii?Q?Toz6Qwc4aw5NxRLqz9IygGT6ZunRVUWUsgJrIt5U20elX+lRmtX1cqrQNTON?= + =?us-ascii?Q?ZHzuAI587pB0zK4EiS25hc9C8RtwjlY67heuMsYZDww5TU+NV3+0WN1/NrCX?= + =?us-ascii?Q?3kB7O188tvm1sWVhCaC6hk9s19nKGRgMS5OHXTMxhmyw1Dn/zorMYff3r9ZE?= + =?us-ascii?Q?sNiBI7fwru/Jsxt2/jNCpFaEYUa9JkrdSse76BXo/UxLALnxO3bzpym3Dq+T?= + =?us-ascii?Q?s4uEA8UncKM0e+Mhp9hW1c3DR61Qjj8wb+LV3XB0qYK/1rHs8IDdJ97tw1fp?= + =?us-ascii?Q?Ux9SlgS9YE2bEp6wxcX6TpA5DoYjqdlK50/4/DZ3YTXWlPTaQbt/j36TbEgZ?= + =?us-ascii?Q?hhIV08WX7EDjBz1QrFRppEtBghOJikHLdvPo6GnZkHNQ9cxaa8Jrk0iypK4d?= + =?us-ascii?Q?bMj47kiugWCGY+ZW2ioGV1GgH1aZEvAukQgTiAAiyGU83td11Q5Pv2N5ytvk?= + =?us-ascii?Q?i+Ux/DUoeU4VyqYnb69asjdyKI5RzIxQPdQAQ7x/TBlyPp/Yj2/v31b6lCYT?= + =?us-ascii?Q?b1iYdeIKK+6I6A+e/EUnPOKC?= +X-OriginatorOrg: wdc.com +X-MS-Exchange-CrossTenant-Network-Message-Id: 17406ef0-e8d7-4dc3-eee9-08d92b40085b +X-MS-Exchange-CrossTenant-AuthSource: CO6PR04MB7812.namprd04.prod.outlook.com +X-MS-Exchange-CrossTenant-AuthAs: Internal +X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2021 12:13:47.1304 (UTC) +X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted +X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 +X-MS-Exchange-CrossTenant-MailboxType: HOSTED +X-MS-Exchange-CrossTenant-UserPrincipalName: rHld9c5jovIZF30ZL04ehEJ81O0isWetsUM3vlp/0cN1LoJ5z8guKzUTANDGVGM0Eua+2cZ1jQGTC49NwWH4hA== +X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR04MB7794 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20210609_051349_766689_30430D67 +X-CRM114-Status: GOOD ( 15.29 ) +X-BeenThere: linux-riscv@lists.infradead.org +X-Mailman-Version: 2.1.34 +Precedence: list +List-Id: +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Sender: "linux-riscv" +Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org + +The SBI SRST extension provides a standard way to poweroff and +reboot the system irrespective to whether Linux RISC-V S-mode +is running natively (HS-mode) or inside Guest/VM (VS-mode). + +The SBI SRST extension is available in the SBI v0.3 specification. +(Refer, https://github.com/riscv/riscv-sbi-doc/releases/tag/v0.3.0-rc1) + +This patch extends Linux RISC-V SBI implementation to detect +and use SBI SRST extension. + +Signed-off-by: Anup Patel +Reviewed-by: Atish Patra +--- + arch/riscv/include/asm/sbi.h | 24 ++++++++++++++++++++++++ + arch/riscv/kernel/sbi.c | 35 +++++++++++++++++++++++++++++++++++ + 2 files changed, 59 insertions(+) + +--- a/arch/riscv/include/asm/sbi.h ++++ b/arch/riscv/include/asm/sbi.h +@@ -27,6 +27,7 @@ enum sbi_ext_id { + SBI_EXT_IPI = 0x735049, + SBI_EXT_RFENCE = 0x52464E43, + SBI_EXT_HSM = 0x48534D, ++ SBI_EXT_SRST = 0x53525354, + }; + + enum sbi_ext_base_fid { +@@ -70,6 +71,21 @@ enum sbi_hsm_hart_status { + SBI_HSM_HART_STATUS_STOP_PENDING, + }; + ++enum sbi_ext_srst_fid { ++ SBI_EXT_SRST_RESET = 0, ++}; ++ ++enum sbi_srst_reset_type { ++ SBI_SRST_RESET_TYPE_SHUTDOWN = 0, ++ SBI_SRST_RESET_TYPE_COLD_REBOOT, ++ SBI_SRST_RESET_TYPE_WARM_REBOOT, ++}; ++ ++enum sbi_srst_reset_reason { ++ SBI_SRST_RESET_REASON_NONE = 0, ++ SBI_SRST_RESET_REASON_SYS_FAILURE, ++}; ++ + #define SBI_SPEC_VERSION_DEFAULT 0x1 + #define SBI_SPEC_VERSION_MAJOR_SHIFT 24 + #define SBI_SPEC_VERSION_MAJOR_MASK 0x7f +@@ -148,6 +164,14 @@ static inline unsigned long sbi_minor_ve + return sbi_spec_version & SBI_SPEC_VERSION_MINOR_MASK; + } + ++/* Make SBI version */ ++static inline unsigned long sbi_mk_version(unsigned long major, ++ unsigned long minor) ++{ ++ return ((major & SBI_SPEC_VERSION_MAJOR_MASK) << ++ SBI_SPEC_VERSION_MAJOR_SHIFT) | minor; ++} ++ + int sbi_err_map_linux_errno(int err); + #else /* CONFIG_RISCV_SBI */ + static inline int sbi_remote_fence_i(const unsigned long *hart_mask) { return -1; } +--- a/arch/riscv/kernel/sbi.c ++++ b/arch/riscv/kernel/sbi.c +@@ -7,6 +7,7 @@ + + #include + #include ++#include + #include + #include + +@@ -501,6 +502,32 @@ int sbi_remote_hfence_vvma_asid(const un + } + EXPORT_SYMBOL(sbi_remote_hfence_vvma_asid); + ++static void sbi_srst_reset(unsigned long type, unsigned long reason) ++{ ++ sbi_ecall(SBI_EXT_SRST, SBI_EXT_SRST_RESET, type, reason, ++ 0, 0, 0, 0); ++ pr_warn("%s: type=0x%lx reason=0x%lx failed\n", ++ __func__, type, reason); ++} ++ ++static int sbi_srst_reboot(struct notifier_block *this, ++ unsigned long mode, void *cmd) ++{ ++ sbi_srst_reset((mode == REBOOT_WARM || mode == REBOOT_SOFT) ? ++ SBI_SRST_RESET_TYPE_WARM_REBOOT : ++ SBI_SRST_RESET_TYPE_COLD_REBOOT, ++ SBI_SRST_RESET_REASON_NONE); ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block sbi_srst_reboot_nb; ++ ++static void sbi_srst_power_off(void) ++{ ++ sbi_srst_reset(SBI_SRST_RESET_TYPE_SHUTDOWN, ++ SBI_SRST_RESET_REASON_NONE); ++} ++ + /** + * sbi_probe_extension() - Check if an SBI extension ID is supported or not. + * @extid: The extension ID to be probed. +@@ -608,6 +635,14 @@ void __init sbi_init(void) + } else { + __sbi_rfence = __sbi_rfence_v01; + } ++ if ((sbi_spec_version >= sbi_mk_version(0, 3)) && ++ (sbi_probe_extension(SBI_EXT_SRST) > 0)) { ++ pr_info("SBI SRST extension detected\n"); ++ pm_power_off = sbi_srst_power_off; ++ sbi_srst_reboot_nb.notifier_call = sbi_srst_reboot; ++ sbi_srst_reboot_nb.priority = 192; ++ register_restart_handler(&sbi_srst_reboot_nb); ++ } + } else { + __sbi_set_timer = __sbi_set_timer_v01; + __sbi_send_ipi = __sbi_send_ipi_v01; From 753be3837f80c63f7db62588feeac76fbe433158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 14 Jun 2023 23:21:34 +0200 Subject: [PATCH 0189/1171] kernel: mtd: bcm-wfi: add cferam name support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some devices rename cferam bootloader using specific patterns and don't follow broadcom standards for renaming cferam files. This requires supporting different cferam file names. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 8813edd8d9695d4e3939fdaa3c530c682f91de11) --- .../drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c index 1ddcf6745facd4..1cafc91fded3dc 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c @@ -31,6 +31,7 @@ #define CFERAM_NAME "cferam" #define CFERAM_NAME_LEN (sizeof(CFERAM_NAME) - 1) +#define CFERAM_NAME_MAX_LEN 32 #define KERNEL_NAME "vmlinux.lz" #define KERNEL_NAME_LEN (sizeof(KERNEL_NAME) - 1) #define OPENWRT_NAME "1-openwrt" @@ -157,17 +158,28 @@ static int parse_bcm_wfi(struct mtd_info *master, const struct mtd_partition **pparts, uint8_t *buf, loff_t off, loff_t size, bool cfe_part) { + struct device_node *mtd_node; struct mtd_partition *parts; loff_t cfe_off, kernel_off, rootfs_off; unsigned int num_parts = BCM_WFI_PARTS, cur_part = 0; + const char *cferam_name = CFERAM_NAME; + size_t cferam_name_len; int ret; + mtd_node = mtd_get_of_node(master); + if (mtd_node) + of_property_read_string(mtd_node, "brcm,cferam", &cferam_name); + + cferam_name_len = strnlen(cferam_name, CFERAM_NAME_MAX_LEN); + if (cferam_name_len > 0) + cferam_name_len--; + if (cfe_part) { num_parts++; cfe_off = off; - ret = jffs2_find_file(master, buf, CFERAM_NAME, - CFERAM_NAME_LEN, &cfe_off, + ret = jffs2_find_file(master, buf, cferam_name, + cferam_name_len, &cfe_off, size - (cfe_off - off), NULL, NULL); if (ret) return ret; From 18a85ecc29d95b72130cda2baa8b15d75691b7ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 14 Jun 2023 23:23:14 +0200 Subject: [PATCH 0190/1171] bmips: fix NETGEAR DGND3700v2 boot loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DGND3700v2 renames the cferam bootloader from cferam to cfeXXX, where XXX is the number of firmware upgrades performed by the bootloader. Other bcm63xx devices rename cferam.000 to cferam.XXX, but this device is special because the cferam name isn't changed on the first firmware flashing but it's changed on the subsequent ones. Therefore, we need to look for "cfe" instead of "cferam" to properly detect the cferam partition and fix the bootlop. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 915e914cfaa243ea36f8c7a4f0f045ec890304fa) --- target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index 46bb3e8bf651f9..a335218be07d3d 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -222,6 +222,7 @@ compatible = "brcm,wfi"; label = "wfi"; reg = <0x0004000 0x1c7c000>; + brcm,cferam = "cfe"; }; partition@1c80000 { From 3506efe29c963cd6e021896fee09d060bb70b937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 14 Jun 2023 23:27:29 +0200 Subject: [PATCH 0191/1171] bcm63xx: fix NETGEAR DGND3700v2 boot loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DGND3700v2 renames the cferam bootloader from cferam to cfeXXX, where XXX is the number of firmware upgrades performed by the bootloader. Other bcm63xx devices rename cferam.000 to cferam.XXX, but this device is special because the cferam name isn't changed on the first firmware flashing but it's changed on the subsequent ones. Therefore, we need to look for "cfe" instead of "cferam" to properly detect the cferam partition and fix the bootlop. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit cdfcac6e246de9f237d1425e498db3f34ddebbaf) --- target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts index 50133265f7ea72..4bef5908e03596 100644 --- a/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -167,6 +167,7 @@ compatible = "brcm,wfi"; label = "wfi"; reg = <0x0004000 0x1c7c000>; + brcm,cferam = "cfe"; }; partition@1c80000 { From 25f6252620f2b00b4be922df011cec936aeeff42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 15 Jun 2023 10:46:10 +0200 Subject: [PATCH 0192/1171] base-files: upgrade: nand: add JFFS2 cleanmarkers support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some Broadcom MIPS devices require JFFS2 cleanmarkers to be present on the kernel partition or the bootloader will identify the partition as corrupt and won't boot the kernel. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 434df8df549a4d709be9eb19c0d2bd8abb4d4881) --- package/base-files/files/lib/upgrade/nand.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index fa29d575a81daf..d910bf17915982 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -301,6 +301,7 @@ nand_upgrade_fit() { nand_upgrade_tar() { local tar_file="$1" local gz="$2" + local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}" # WARNING: This fails if tar contains more than one 'sysupgrade-*' directory. local board_dir="$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')" @@ -329,6 +330,7 @@ nand_upgrade_tar() { ubi_kernel_length="$kernel_length" fi fi + local has_env=0 nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$ubi_kernel_length" "$has_env" || return 1 @@ -340,8 +342,14 @@ nand_upgrade_tar() { fi if [ "$kernel_length" ]; then if [ "$kernel_mtd" ]; then - tar xO${gz}f "$tar_file" "$board_dir/kernel" | \ - mtd write - "$CI_KERNPART" + if [ "$jffs2_markers" = 1 ]; then + flash_erase -j "/dev/mtd${kernel_mtd}" 0 0 + tar xO${gz}f "$tar_file" "$board_dir/kernel" | \ + nandwrite "/dev/mtd${kernel_mtd}" - + else + tar xO${gz}f "$tar_file" "$board_dir/kernel" | \ + mtd write - "$CI_KERNPART" + fi else local ubidev="$( nand_find_ubi "${CI_KERN_UBIPART:-$CI_UBIPART}" )" local kern_ubivol="$( nand_find_volume $ubidev "$CI_KERNPART" )" From 70afa8e6b66f30a613d0f79697bf13fa673978ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 15 Jun 2023 10:48:25 +0200 Subject: [PATCH 0193/1171] bmips: switch to standard nand_do_upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that JFFS2 cleanmarkers are supported on the standard nand_do_upgrade function we can start using it on bmips. Signed-off-by: Álvaro Fernández Rojas (cherry picked from 464dfac049daecad145184f8c2dd4a46a7fdd37c) --- .../base-files/lib/upgrade/cfe-jffs2-nand.sh | 37 ------------------- .../base-files/lib/upgrade/platform.sh | 5 +-- .../base-files/lib/upgrade/platform.sh | 2 - .../base-files/lib/upgrade/platform.sh | 5 +-- 4 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 target/linux/bmips/base-files/lib/upgrade/cfe-jffs2-nand.sh diff --git a/target/linux/bmips/base-files/lib/upgrade/cfe-jffs2-nand.sh b/target/linux/bmips/base-files/lib/upgrade/cfe-jffs2-nand.sh deleted file mode 100644 index 64b8df652b9c76..00000000000000 --- a/target/linux/bmips/base-files/lib/upgrade/cfe-jffs2-nand.sh +++ /dev/null @@ -1,37 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -cfe_jffs2_nand_upgrade() { - local tar_file="$1" - local kernel_mtd="$(find_mtd_index $CI_KERNPART)" - - if [ -z "$kernel_mtd" ]; then - echo "$CI_KERNPART partition not found" - return 1 - fi - - local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') - board_dir=${board_dir%/} - - local kernel_length=$(tar xf $tar_file ${board_dir}/kernel -O | wc -c 2> /dev/null) - local rootfs_length=$(tar xf $tar_file ${board_dir}/root -O | wc -c 2> /dev/null) - - if [ "$kernel_length" = 0 ]; then - echo "kernel cannot be empty" - return 1 - fi - - flash_erase -j /dev/mtd${kernel_mtd} 0 0 - tar xf $tar_file ${board_dir}/kernel -O | nandwrite /dev/mtd${kernel_mtd} - - - local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)" - - nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "0" "0" - - local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - - local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" - tar xf $tar_file ${board_dir}/root -O | \ - ubiupdatevol /dev/$root_ubivol -s $rootfs_length - - - nand_do_upgrade_success -} diff --git a/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh b/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh index 0aaf10442bb264..befffd346e14e8 100644 --- a/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -. /lib/upgrade/cfe-jffs2-nand.sh - PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 @@ -12,7 +10,8 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in comtrend,vr-3032u) - cfe_jffs2_nand_upgrade "$1" + CI_JFFS2_CLEAN_MARKERS=1 + nand_do_upgrade "$1" ;; sercomm,h500-s-lowi |\ sercomm,h500-s-vfes |\ diff --git a/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh b/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh index eb1d7fd0e5bb15..1cf95be26a5f0a 100644 --- a/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -. /lib/upgrade/cfe-jffs2-nand.sh - PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 diff --git a/target/linux/bmips/bcm6362/base-files/lib/upgrade/platform.sh b/target/linux/bmips/bcm6362/base-files/lib/upgrade/platform.sh index 9175cf4255e9e0..ded966e4cca0b9 100644 --- a/target/linux/bmips/bcm6362/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/bcm6362/base-files/lib/upgrade/platform.sh @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -. /lib/upgrade/cfe-jffs2-nand.sh - PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 @@ -13,7 +11,8 @@ platform_do_upgrade() { case "$(board_name)" in huawei,hg253s-v2 |\ netgear,dgnd3700-v2) - cfe_jffs2_nand_upgrade "$1" + CI_JFFS2_CLEAN_MARKERS=1 + nand_do_upgrade "$1" ;; *) default_do_upgrade "$1" From e6acfe03dd0c5afdfeeff2826ebb2258b43fe8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 15 Jun 2023 10:53:08 +0200 Subject: [PATCH 0194/1171] bcm63xx: switch to standard nand_do_upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that JFFS2 cleanmarkers are supported on the standard nand_do_upgrade function we can start using it on bcm63xx. Signed-off-by: Álvaro Fernández Rojas (cherry picked from 60fc3bc9487cbda7092e1b926467b07ea041bc60) --- .../base-files/lib/upgrade/platform.sh | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh index 0d836729ee6d0e..620e0ab4f42b95 100644 --- a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh @@ -29,42 +29,6 @@ platform_check_image() { esac } -cfe_jffs2_upgrade_tar() { - local tar_file="$1" - local kernel_mtd="$(find_mtd_index $CI_KERNPART)" - - if [ -z "$kernel_mtd" ]; then - echo "$CI_KERNPART partition not found" - return 1 - fi - - local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') - board_dir=${board_dir%/} - - local kernel_length=$(tar xf $tar_file ${board_dir}/kernel -O | wc -c 2> /dev/null) - local rootfs_length=$(tar xf $tar_file ${board_dir}/root -O | wc -c 2> /dev/null) - - if [ "$kernel_length" = 0 ]; then - echo "kernel cannot be empty" - return 1 - fi - - flash_erase -j /dev/mtd${kernel_mtd} 0 0 - tar xf $tar_file ${board_dir}/kernel -O | nandwrite /dev/mtd${kernel_mtd} - - - local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)" - - nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "0" "0" - - local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - - local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" - tar xf $tar_file ${board_dir}/root -O | \ - ubiupdatevol /dev/$root_ubivol -s $rootfs_length - - - nand_do_upgrade_success -} - platform_do_upgrade() { case "$(board_name)" in comtrend,vg-8050|\ @@ -72,7 +36,8 @@ platform_do_upgrade() { huawei,hg253s-v2|\ netgear,dgnd3700-v2) REQUIRE_IMAGE_METADATA=1 - cfe_jffs2_upgrade_tar "$1" + CI_JFFS2_CLEAN_MARKERS=1 + nand_do_upgrade "$1" ;; sercomm,ad1018|\ sercomm,h500-s-lowi|\ From 40966d612efa6fb7909b9ae2140c2fd9d37f331e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Tue, 13 Jun 2023 22:45:53 +0200 Subject: [PATCH 0195/1171] bmips: add support for Actiontec R1000H MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Actiontec R1000H is a gigabit wifi router, 2.4 GHz single band with two external antennas. It comes with a coaxial HomePNA port. Hardware: - SoC: Broadcom BCM6368 - CPU: dual core BMIPS4350 V3.1 @400Mhz - RAM: 64 MB DDR - Flash: 32 MB parallel NOR - LAN switch: Broadcom BCM53115, 5x 1Gbit - LAN coaxial : 1x HPNA 3.1, CG3211 + CG3213 - Wifi 2.4 GHz: Broadcom BCM4322 802.11bgn - USB: 1x 2.0 - Buttons: 2x, 1 reset - LEDs: 7x - UART: yes The HPNA hardware probably needs a firmware to make the coaxial port work. In the OEM firmware, it's apparently sent with an utility (inhpna) through the ethernet port. Installation via CFE web UI: 1. Connect the UART serial port. 2. Power on the router and press enter at the console prompt to stop the bootloader. 4. Browse to http://192.168.1.1 and upload the OpenWrt CFE firmware 5. Wait a few minutes for it to finish Signed-off-by: Daniel González Cabanelas (cherry picked from commit e1a55de7a7eafd40a4fab5f29153a1a3c3606818) --- .../bcm6368/base-files/etc/board.d/01_leds | 4 + .../bcm6368/base-files/etc/board.d/02_network | 1 + .../base-files/etc/uci-defaults/09_fix_crc | 1 + .../bmips/dts/bcm6368-actiontec-r1000h.dts | 220 ++++++++++++++++++ target/linux/bmips/image/bcm6368.mk | 15 ++ 5 files changed, 241 insertions(+) create mode 100644 target/linux/bmips/dts/bcm6368-actiontec-r1000h.dts diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds index c7e61fe72f35a6..9af5257c1160e3 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/01_leds @@ -6,6 +6,10 @@ board_config_update case "$(board_name)" in +actiontec,r1000h) + ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" + ;; comtrend,wap-5813n) ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" ;; diff --git a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network index 58fba05fec3a3e..fabc4216cd5f73 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6368/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ comtrend,vr-3025un) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 iptv" ;; +actiontec,r1000h |\ comtrend,wap-5813n |\ netgear,dgnd3700-v1 |\ netgear,dgnd3800b |\ diff --git a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc index 63d10c9a8e8082..f3b1eafdfc66fc 100644 --- a/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6368/base-files/etc/uci-defaults/09_fix_crc @@ -3,6 +3,7 @@ . /lib/functions.sh case "$(board_name)" in +actiontec,r1000h |\ comtrend,vr-3025u |\ comtrend,vr-3025un |\ comtrend,wap-5813n |\ diff --git a/target/linux/bmips/dts/bcm6368-actiontec-r1000h.dts b/target/linux/bmips/dts/bcm6368-actiontec-r1000h.dts new file mode 100644 index 00000000000000..ff115afb8fbd1a --- /dev/null +++ b/target/linux/bmips/dts/bcm6368-actiontec-r1000h.dts @@ -0,0 +1,220 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6368.dtsi" + +/ { + model = "Actiontec R1000H"; + compatible = "actiontec,r1000h", "brcm,bcm6368"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led@5 { + label = "green:wan"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + + led@21 { + label = "green:usb"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + }; + + led_power_green: led@22 { + label = "green:power"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + }; + + led@23 { + label = "green:wps"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + + led_power_red: led@24 { + label = "red:power"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + led@30 { + label = "red:wps"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + }; + + led@31 { + label = "red:wan"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&mdio_ext { + switch@1e { + compatible = "brcm,bcm53115"; + reg = <30>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@5 { + /* HPNA coaxial port */ + reg = <5>; + label = "coax"; + + phy-mode = "mii"; + + fixed-link { + speed = <100>; + full-duplex; + }; + }; + + port@8 { + reg = <8>; + + phy-mode = "rgmii"; + ethernet = <&switch0port5>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + switch0port5: port@5 { + reg = <5>; + label = "extsw"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "CFE"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x020000 0x1fc0000>; + compatible = "brcm,bcm963xx-imagetag"; + }; + + partition@fe0000 { + label = "nvram"; + reg = <0x1fe0000 0x020000>; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&pci { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6368.mk b/target/linux/bmips/image/bcm6368.mk index 83cd096959ba30..39fcb023182542 100644 --- a/target/linux/bmips/image/bcm6368.mk +++ b/target/linux/bmips/image/bcm6368.mk @@ -1,5 +1,20 @@ # SPDX-License-Identifier: GPL-2.0-or-later +define Device/actiontec_r1000h + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := Actiontec + DEVICE_MODEL := R1000H + CHIP_ID := 6368 + CFE_BOARD_ID := 96368VVW + BLOCKSIZE := 0x20000 + FLASH_MB := 32 + CFE_EXTRAS += --signature "$$(DEVICE_VENDOR)" + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) \ + kmod-leds-gpio +endef +TARGET_DEVICES += actiontec_r1000h + define Device/comtrend_vr-3025u $(Device/bcm63xx-cfe) DEVICE_VENDOR := Comtrend From b8bbe0d8006f086ab90ec0d304a4d1afdf91b1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 15 Jun 2023 13:21:18 +0200 Subject: [PATCH 0196/1171] bmips: bump LOADER_ENTRY to RAM + 16M MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed on devices like Sercomm AD1018 for booting recent kernels due to bigger kernels. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 434434ca4748ba669176ce38b70a6525f90598b6) --- target/linux/bmips/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bmips/image/Makefile b/target/linux/bmips/image/Makefile index 5ce026c5842234..9311e2df096fc0 100644 --- a/target/linux/bmips/image/Makefile +++ b/target/linux/bmips/image/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk KERNEL_LOADADDR := 0x80010000 # RAM start + 64K -LOADER_ENTRY := 0x80a00000 # RAM start + 10M, for relocate +LOADER_ENTRY := 0x81000000 # RAM start + 16M, for relocate LZMA_TEXT_START := 0x82000000 # RAM start + 32M DEVICE_VARS += CFE_BOARD_ID CFE_EXTRAS From 3d66e7f1db70c98876ea6e9aeb57622d6d30c5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 12 Jun 2023 19:51:22 +0200 Subject: [PATCH 0197/1171] bmips: add support for Sercomm AD1018 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Sercomm AD1018 is a wifi fast ethernet router, 2.4 GHz single band with two internal antennas. Hardware: - SoC: Broadcom BCM6328 - CPU: single core BMIPS4350 @ 320Mhz - RAM: 64 MB (v1) / 128 MB (v2) DDR - Flash: 128 MB NAND - Ethernet LAN: 4x 100Mbit - Wifi 2.4 GHz: miniPCI Broadcom BCM43217 802.11bgn - USB: 1x 2.0 - Buttons: 3x (reset) - LEDs: yes - UART: yes Installation via OEM web UI: 1. Use the admin credentials to login via web UI 2. Go to Managament->Update firmware and select the OpenWrt CFE firmware 3. Press "Update Firmware" button and wait some minutes until it finish Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 38ebb2eafde604ff6d9b0021d1d21208070a2d09) --- .../bcm6328/base-files/etc/board.d/01_leds | 16 + .../bcm6328/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 3 + .../bmips/dts/bcm6328-sercomm-ad1018.dts | 312 ++++++++++++++++++ target/linux/bmips/image/bcm6328.mk | 18 + 5 files changed, 353 insertions(+) create mode 100644 target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds create mode 100644 target/linux/bmips/dts/bcm6328-sercomm-ad1018.dts diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds new file mode 100644 index 00000000000000..5ece1f7ba1b0c3 --- /dev/null +++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/leds.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in +sercomm,ad1018) + ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network index c9c704067e9ebb..66f9282e48869f 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network @@ -10,6 +10,10 @@ comtrend,ar-5387un) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; +sercomm,ad1018) + ucidef_set_bridge_device switch + ucidef_set_interface_lan "lan1 lan2 lan3 fibre" + ;; esac board_config_flush diff --git a/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh b/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh index 1cf95be26a5f0a..d820b20718801d 100644 --- a/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/bcm6328/base-files/lib/upgrade/platform.sh @@ -9,6 +9,9 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in + sercomm,ad1018) + nand_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;; diff --git a/target/linux/bmips/dts/bcm6328-sercomm-ad1018.dts b/target/linux/bmips/dts/bcm6328-sercomm-ad1018.dts new file mode 100644 index 00000000000000..5d182668188700 --- /dev/null +++ b/target/linux/bmips/dts/bcm6328-sercomm-ad1018.dts @@ -0,0 +1,312 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6328.dtsi" + +/ { + model = "Sercomm AD1018"; + compatible = "sercomm,ad1018", "brcm,bcm6328"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_green; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wlan { + label = "wlan"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&gpio 31 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + bcm432217-sprom { + compatible = "brcm,bcma-sprom"; + + pci-bus = <1>; + pci-dev = <0>; + + nvmem-cells = <&macaddr_cferom_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm43217-sprom.bin"; + brcm,sprom-fixups = <6 0x1c00>, + <65 0x1256>, + <96 0x2046>, + <97 0xfe69>, + <98 0x1726>, + <99 0xfa5c>, + <112 0x2046>, + <113 0xfea8>, + <114 0x1978>, + <115 0xfa26>, + <161 0x2222>, + <169 0x2222>, + <171 0x2222>, + <173 0x2222>, + <174 0x4444>, + <175 0x2222>, + <176 0x4444>; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cferom_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led + &pinctrl_ephy0_spd_led &pinctrl_ephy1_act_led + &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>; + + brcm,serial-leds; + brcm,serial-shift-inv; + brcm,serial-dat-low; + + led@0 { + reg = <0>; + active-low; + label = "red:internet"; + }; + + led@1 { + reg = <1>; + active-low; + label = "green:internet"; + }; + + led_power_green: led@8 { + reg = <8>; + active-low; + label = "green:power"; + default-state = "on"; + }; + + led@10 { + reg = <10>; + active-low; + label = "green:adsl"; + }; + + led@11 { + reg = <11>; + active-low; + label = "red:adsl"; + }; + + led@12 { + reg = <12>; + active-low; + label = "green:phone"; + }; + + led@13 { + reg = <13>; + active-low; + label = "green:wps"; + }; + + led@14 { + reg = <14>; + active-low; + label = "green:wifi"; + }; + + led@15 { + reg = <15>; + active-low; + label = "green:usb"; + }; + + led@17 { + /* EPHY0 Spd */ + reg = <17>; + brcm,hardware-controlled; + }; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio0", "gpio1"; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <15>; + nand-on-flash-bbt; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cferom: partition@0 { + label = "cferom"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + label = "mmap"; + reg = <0x0020000 0x00a0000>; + read-only; + }; + + partition@c0000 { + label = "cferam1"; + reg = <0x00c0000 0x0140000>; + read-only; + }; + + partition@200000 { + label = "cferam2"; + reg = <0x0200000 0x0140000>; + read-only; + }; + + partition@340000 { + label = "serial"; + reg = <0x0340000 0x00a0000>; + read-only; + }; + + partition@3e0000 { + label = "protect"; + reg = <0x03e0000 0x0140000>; + read-only; + }; + + partition@6920000 { + label = "bootflag1"; + reg = <0x6920000 0x0140000>; + read-only; + }; + + partition@6a60000 { + label = "bootflag2"; + reg = <0x6a60000 0x0140000>; + read-only; + }; + + partition@520000 { + compatible = "sercomm,wfi"; + label = "wfi"; + reg = <0x0520000 0x6400000>; + }; + + partition@6ba0000 { + label = "xml_cfg"; + reg = <0x6ba0000 0x0280000>; + read-only; + }; + + partition@6e20000 { + label = "app_dat"; + reg = <0x6e20000 0x0280000>; + read-only; + }; + }; + }; +}; + +&switch0 { + ports { + port@0 { + reg = <0>; + label = "fibre"; + + phy-handle = <&phy1>; + phy-mode = "mii"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + + phy-handle = <&phy2>; + phy-mode = "mii"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + + phy-handle = <&phy3>; + phy-mode = "mii"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + + phy-handle = <&phy4>; + phy-mode = "mii"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cferom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cferom_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6328.mk b/target/linux/bmips/image/bcm6328.mk index dfa134df94673a..ef74410f1e0d0f 100644 --- a/target/linux/bmips/image/bcm6328.mk +++ b/target/linux/bmips/image/bcm6328.mk @@ -25,3 +25,21 @@ define Device/comtrend_ar-5387un kmod-leds-bcm6328 endef TARGET_DEVICES += comtrend_ar-5387un + +define Device/sercomm_ad1018 + $(Device/sercomm-nand) + DEVICE_VENDOR := Sercomm + DEVICE_MODEL := AD1018 + CHIP_ID := 6328 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-43217-sprom \ + kmod-leds-bcm6328 + SERCOMM_FSVER := 1001 + SERCOMM_HWVER := 1415153 + SERCOMM_SWVER := 3013 +endef +TARGET_DEVICES += sercomm_ad1018 From b073d6cf7a7116d92f3de4bb59124e3ed0466420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 15 Jun 2023 20:53:11 +0200 Subject: [PATCH 0198/1171] bmips: dts: dgnd3700: fix WAN port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All switch ports are labeled as port@address so let's follow the same pattern. Fixes: ed79519b8d89 ("bmips: add support for Netgear DGND3700 v1, DGND3800B") Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit d9210c5ff797896317d1b6293a5ad768b7482cfe) --- target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi index 74494556310601..c878dd2cffa2b1 100644 --- a/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi +++ b/target/linux/bmips/dts/bcm6368-netgear-dgnd3700.dtsi @@ -123,7 +123,7 @@ #address-cells = <1>; #size-cells = <0>; - wan@0 { + port@0 { reg = <0>; label = "wan"; }; From 66e1bef8f73b5857e7791d04643e2e580741dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 15 Jun 2023 18:16:21 +0200 Subject: [PATCH 0199/1171] bmips: add support for Comtrend VG-8050 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Comtrend VG-8050 is a wifi gigabit ethernet router, 2.4 GHz single band with two external antennas. Hardware: - SoC: Broadcom BCM63169 - CPU: dual core BMIPS4350 @ 400Mhz - RAM: 128 MB DDR - Flash: 128 MB NAND - LAN switch: Broadcom BCM53125, 5x 1Gbit - Wifi 2.4 GHz: SoC (BCM63268) 802.11bgn - USB: 1x 2.0 (optional) - Buttons: 2x (reset) - LEDs: yes - UART: yes Installation via CFE web UI: 1. Power off the router. 2. Press reset button near the power switch. 3. Keep it pressed while powering up during ~20+ seconds. 4. Browse to http://192.168.1.1 and upload the firmware. 5. Wait a few minutes for it to finish. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 47cc09aa7a9a12cb7b18ef96f0b5d0bcb5d84b9e) --- .../base-files/etc/board.d/02_network | 1 + .../base-files/lib/upgrade/platform.sh | 1 + .../bmips/dts/bcm63169-comtrend-vg-8050.dts | 237 ++++++++++++++++++ target/linux/bmips/image/bcm63268.mk | 19 ++ 4 files changed, 258 insertions(+) create mode 100644 target/linux/bmips/dts/bcm63169-comtrend-vg-8050.dts diff --git a/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network b/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network index ad7f2432e20cba..7fb9333cc18aa8 100644 --- a/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network @@ -16,6 +16,7 @@ sercomm,h500-s-vfes) ucidef_set_interface "qtn" device "wifi" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.252" uci add_list firewall.@zone[0].network='qtn' ;; +comtrend,vg-8050 |\ sercomm,shg2500) ucidef_set_bridge_device switch ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" diff --git a/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh b/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh index befffd346e14e8..fd309d380994f2 100644 --- a/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh @@ -9,6 +9,7 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in + comtrend,vg-8050 |\ comtrend,vr-3032u) CI_JFFS2_CLEAN_MARKERS=1 nand_do_upgrade "$1" diff --git a/target/linux/bmips/dts/bcm63169-comtrend-vg-8050.dts b/target/linux/bmips/dts/bcm63169-comtrend-vg-8050.dts new file mode 100644 index 00000000000000..bf96673af8af8d --- /dev/null +++ b/target/linux/bmips/dts/bcm63169-comtrend-vg-8050.dts @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm63268.dtsi" + +/ { + model = "Comtrend VG-8050"; + compatible = "comtrend,vg-8050", "brcm,bcm63169", "brcm,bcm63268"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cferom_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&hsspi { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_hsspi_cs5>; + + switch@5 { + compatible = "brcm,bcm53125"; + reg = <5>; + spi-max-frequency = <781000>; + spi-cpha; + spi-cpol; + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan4"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@8 { + reg = <8>; + + phy-mode = "rgmii"; + ethernet = <&switch0port6>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&leds { + status = "okay"; + + brcm,serial-leds; + brcm,serial-dat-low; + brcm,serial-shift-inv; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_serial_led>; + + led@2 { + reg = <2>; + active-low; + label = "red:internet"; + }; + + led_power_red: led@3 { + reg = <3>; + active-low; + label = "red:power"; + panic-indicator; + }; + + led_power_green: led@6 { + reg = <6>; + active-low; + label = "green:power"; + }; + + led@7 { + reg = <7>; + active-low; + label = "green:wps"; + }; + + led@8 { + reg = <8>; + active-low; + label = "green:internet"; + }; + + led@10 { + reg = <10>; + active-low; + label = "green:voip"; + }; + + led@12 { + reg = <12>; + active-low; + label = "red:voip"; + }; + + led@14 { + reg = <14>; + active-low; + label = "red:wps"; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <15>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cferom: partition@0 { + label = "cferom"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + compatible = "brcm,wfi-split"; + label = "wfi"; + reg = <0x0020000 0x7ac0000>; + }; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + switch0port6: port@6 { + reg = <6>; + label = "extsw"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cferom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cferom_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm63268.mk b/target/linux/bmips/image/bcm63268.mk index 6e27b16624ff7e..941e83f71bf6bd 100644 --- a/target/linux/bmips/image/bcm63268.mk +++ b/target/linux/bmips/image/bcm63268.mk @@ -1,5 +1,24 @@ # SPDX-License-Identifier: GPL-2.0-or-later +define Device/comtrend_vg-8050 + $(Device/bcm63xx-nand) + DEVICE_VENDOR := Comtrend + DEVICE_MODEL := VG-8050 + CHIP_ID := 63268 + SOC := bcm63169 + CFE_RAM_FILE := comtrend,vg-8050/cferam.000 + CFE_RAM_JFFS2_NAME := cferam.000 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + kmod-leds-bcm6328 + CFE_WFI_FLASH_TYPE := 3 + CFE_WFI_VERSION := 0x5732 +endef +TARGET_DEVICES += comtrend_vg-8050 + define Device/comtrend_vr-3032u $(Device/bcm63xx-nand) DEVICE_VENDOR := Comtrend From dee8ca626c7108540795506eb1675aff586d9066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Fri, 16 Jun 2023 14:24:13 +0200 Subject: [PATCH 0200/1171] bcm63xx: fix the Home Hub 2a power LED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Power LED register is wrong at dts. Fix it. Fixes: 9ceeaf4c6cac ("brcm63xx: switch to hardware led controllers") Signed-off-by: Daniel González Cabanelas (cherry picked from commit 0e01ba93610240ad84f9bbc5fc6e5982a07d39f9) --- target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts b/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts index b5eea3dcb124a4..10aea48783b317 100644 --- a/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts +++ b/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts @@ -60,7 +60,7 @@ }; led_power_green: led@1 { - reg = <0>; + reg = <1>; active-low; label = "green:power"; default-state = "on"; From 7390068e4f89e09d8fc281fddeb2504f5412382e Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 10 Jun 2023 19:08:04 +0800 Subject: [PATCH 0201/1171] toolchain: gcc: backport inline subword atomic support for riscv RISC-V has no support for subword atomic operations; code currently generates libatomic library calls. This patch changes the default behavior to fast inline subword atomic calls that do not require libatomic. Signed-off-by: Tianling Shen (cherry picked from commit 7b4a966de88aa0e1f9b7faa62a4d6cb7b01e9f8f) --- .../700-RISCV-Inline-subword-atomic-ops.patch | 2021 +++++++++++++++++ ...linux-Don-t-add-latomic-with-pthread.patch | 36 + .../gcc/patches-11.x/910-mbsd_multi.patch | 2 +- .../700-RISCV-Inline-subword-atomic-ops.patch | 2021 +++++++++++++++++ ...linux-Don-t-add-latomic-with-pthread.patch | 36 + .../gcc/patches-12.x/910-mbsd_multi.patch | 2 +- .../700-RISCV-Inline-subword-atomic-ops.patch | 2021 +++++++++++++++++ ...linux-Don-t-add-latomic-with-pthread.patch | 36 + .../gcc/patches-13.x/910-mbsd_multi.patch | 2 +- 9 files changed, 6174 insertions(+), 3 deletions(-) create mode 100644 toolchain/gcc/patches-11.x/700-RISCV-Inline-subword-atomic-ops.patch create mode 100644 toolchain/gcc/patches-11.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch create mode 100644 toolchain/gcc/patches-12.x/700-RISCV-Inline-subword-atomic-ops.patch create mode 100644 toolchain/gcc/patches-12.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch create mode 100644 toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch create mode 100644 toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch diff --git a/toolchain/gcc/patches-11.x/700-RISCV-Inline-subword-atomic-ops.patch b/toolchain/gcc/patches-11.x/700-RISCV-Inline-subword-atomic-ops.patch new file mode 100644 index 00000000000000..0da7eb4af66693 --- /dev/null +++ b/toolchain/gcc/patches-11.x/700-RISCV-Inline-subword-atomic-ops.patch @@ -0,0 +1,2021 @@ +From f797260adaf52bee0ec0e16190bbefbe1bfc3692 Mon Sep 17 00:00:00 2001 +From: Patrick O'Neill +Date: Tue, 18 Apr 2023 14:33:13 -0700 +Subject: [PATCH] RISCV: Inline subword atomic ops + +RISC-V has no support for subword atomic operations; code currently +generates libatomic library calls. + +This patch changes the default behavior to inline subword atomic calls +(using the same logic as the existing library call). +Behavior can be specified using the -minline-atomics and +-mno-inline-atomics command line flags. + +gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm. +This will need to stay for backwards compatibility and the +-mno-inline-atomics flag. + +2023-04-18 Patrick O'Neill + +gcc/ChangeLog: + PR target/104338 + * config/riscv/riscv-protos.h: Add helper function stubs. + * config/riscv/riscv.cc: Add helper functions for subword masking. + * config/riscv/riscv.opt: Add command-line flag. + * config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op, + fetch_and_nand, CAS, and exchange ops. + * doc/invoke.texi: Add blurb regarding command-line flag. + +libgcc/ChangeLog: + PR target/104338 + * config/riscv/atomic.c: Add reference to duplicate logic. + +gcc/testsuite/ChangeLog: + PR target/104338 + * gcc.target/riscv/inline-atomics-1.c: New test. + * gcc.target/riscv/inline-atomics-2.c: New test. + * gcc.target/riscv/inline-atomics-3.c: New test. + * gcc.target/riscv/inline-atomics-4.c: New test. + * gcc.target/riscv/inline-atomics-5.c: New test. + * gcc.target/riscv/inline-atomics-6.c: New test. + * gcc.target/riscv/inline-atomics-7.c: New test. + * gcc.target/riscv/inline-atomics-8.c: New test. + +Signed-off-by: Patrick O'Neill +Signed-off-by: Palmer Dabbelt +--- + gcc/config/riscv/riscv-protos.h | 2 + + gcc/config/riscv/riscv.cc | 49 ++ + gcc/config/riscv/riscv.opt | 4 + + gcc/config/riscv/sync.md | 301 +++++++++ + gcc/doc/invoke.texi | 10 +- + .../gcc.target/riscv/inline-atomics-1.c | 18 + + .../gcc.target/riscv/inline-atomics-2.c | 9 + + .../gcc.target/riscv/inline-atomics-3.c | 569 ++++++++++++++++++ + .../gcc.target/riscv/inline-atomics-4.c | 566 +++++++++++++++++ + .../gcc.target/riscv/inline-atomics-5.c | 87 +++ + .../gcc.target/riscv/inline-atomics-6.c | 87 +++ + .../gcc.target/riscv/inline-atomics-7.c | 69 +++ + .../gcc.target/riscv/inline-atomics-8.c | 69 +++ + libgcc/config/riscv/atomic.c | 2 + + 14 files changed, 1841 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-1.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-2.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-3.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-4.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-5.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-6.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-7.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-8.c + +--- a/gcc/config/riscv/riscv-protos.h ++++ b/gcc/config/riscv/riscv-protos.h +@@ -74,6 +74,8 @@ extern bool riscv_expand_block_move (rtx + extern bool riscv_store_data_bypass_p (rtx_insn *, rtx_insn *); + extern rtx riscv_gen_gpr_save_insn (struct riscv_frame_info *); + extern bool riscv_gpr_save_operation_p (rtx); ++extern void riscv_subword_address (rtx, rtx *, rtx *, rtx *, rtx *); ++extern void riscv_lshift_subword (machine_mode, rtx, rtx, rtx *); + + /* Routines implemented in riscv-c.c. */ + void riscv_cpu_cpp_builtins (cpp_reader *); +--- a/gcc/config/riscv/riscv.c ++++ b/gcc/config/riscv/riscv.c +@@ -5351,6 +5351,55 @@ riscv_asan_shadow_offset (void) + return TARGET_64BIT ? (HOST_WIDE_INT_1 << 29) : 0; + } + ++/* Given memory reference MEM, expand code to compute the aligned ++ memory address, shift and mask values and store them into ++ *ALIGNED_MEM, *SHIFT, *MASK and *NOT_MASK. */ ++ ++void ++riscv_subword_address (rtx mem, rtx *aligned_mem, rtx *shift, rtx *mask, ++ rtx *not_mask) ++{ ++ /* Align the memory address to a word. */ ++ rtx addr = force_reg (Pmode, XEXP (mem, 0)); ++ ++ rtx addr_mask = gen_int_mode (-4, Pmode); ++ ++ rtx aligned_addr = gen_reg_rtx (Pmode); ++ emit_move_insn (aligned_addr, gen_rtx_AND (Pmode, addr, addr_mask)); ++ ++ *aligned_mem = change_address (mem, SImode, aligned_addr); ++ ++ /* Calculate the shift amount. */ ++ emit_move_insn (*shift, gen_rtx_AND (SImode, gen_lowpart (SImode, addr), ++ gen_int_mode (3, SImode))); ++ emit_move_insn (*shift, gen_rtx_ASHIFT (SImode, *shift, ++ gen_int_mode (3, SImode))); ++ ++ /* Calculate the mask. */ ++ int unshifted_mask = GET_MODE_MASK (GET_MODE (mem)); ++ ++ emit_move_insn (*mask, gen_int_mode (unshifted_mask, SImode)); ++ ++ emit_move_insn (*mask, gen_rtx_ASHIFT (SImode, *mask, ++ gen_lowpart (QImode, *shift))); ++ ++ emit_move_insn (*not_mask, gen_rtx_NOT(SImode, *mask)); ++} ++ ++/* Leftshift a subword within an SImode register. */ ++ ++void ++riscv_lshift_subword (machine_mode mode, rtx value, rtx shift, ++ rtx *shifted_value) ++{ ++ rtx value_reg = gen_reg_rtx (SImode); ++ emit_move_insn (value_reg, simplify_gen_subreg (SImode, value, ++ mode, 0)); ++ ++ emit_move_insn(*shifted_value, gen_rtx_ASHIFT (SImode, value_reg, ++ gen_lowpart (QImode, shift))); ++} ++ + /* Initialize the GCC target structure. */ + #undef TARGET_ASM_ALIGNED_HI_OP + #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" +--- a/gcc/config/riscv/riscv.opt ++++ b/gcc/config/riscv/riscv.opt +@@ -195,6 +195,10 @@ long riscv_stack_protector_guard_offset + TargetVariable + int riscv_zi_subext + ++minline-atomics ++Target Var(TARGET_INLINE_SUBWORD_ATOMIC) Init(1) ++Always inline subword atomic operations. ++ + Enum + Name(isa_spec_class) Type(enum riscv_isa_spec_class) + Supported ISA specs (for use with the -misa-spec= option): +--- a/gcc/config/riscv/sync.md ++++ b/gcc/config/riscv/sync.md +@@ -21,8 +21,11 @@ + + (define_c_enum "unspec" [ + UNSPEC_COMPARE_AND_SWAP ++ UNSPEC_COMPARE_AND_SWAP_SUBWORD + UNSPEC_SYNC_OLD_OP ++ UNSPEC_SYNC_OLD_OP_SUBWORD + UNSPEC_SYNC_EXCHANGE ++ UNSPEC_SYNC_EXCHANGE_SUBWORD + UNSPEC_ATOMIC_STORE + UNSPEC_MEMORY_BARRIER + ]) +@@ -92,6 +95,135 @@ + "%F3amo.%A3 %0,%z2,%1" + [(set (attr "length") (const_int 8))]) + ++(define_insn "subword_atomic_fetch_strong_" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(any_atomic:SI (match_dup 1) ++ (match_operand:SI 2 "register_operand" "rI")) ;; value for op ++ (match_operand:SI 3 "register_operand" "rI")] ;; mask ++ UNSPEC_SYNC_OLD_OP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1 ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "\t%5, %0, %2\;" ++ "and\t%5, %5, %3\;" ++ "and\t%6, %0, %4\;" ++ "or\t%6, %6, %5\;" ++ "sc.w.rl\t%5, %6, %1\;" ++ "bnez\t%5, 1b"; ++ } ++ [(set (attr "length") (const_int 28))]) ++ ++(define_expand "atomic_fetch_nand" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (not:SHORT (and:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "reg_or_0_operand"))) ;; value for op ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_fetch_strong_nand to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_fetch_strong_nand (old, aligned_mem, ++ shifted_value, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ ++(define_insn "subword_atomic_fetch_strong_nand" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(not:SI (and:SI (match_dup 1) ++ (match_operand:SI 2 "register_operand" "rI"))) ;; value for op ++ (match_operand:SI 3 "register_operand" "rI")] ;; mask ++ UNSPEC_SYNC_OLD_OP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1 ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%5, %0, %2\;" ++ "not\t%5, %5\;" ++ "and\t%5, %5, %3\;" ++ "and\t%6, %0, %4\;" ++ "or\t%6, %6, %5\;" ++ "sc.w.rl\t%5, %6, %1\;" ++ "bnez\t%5, 1b"; ++ } ++ [(set (attr "length") (const_int 32))]) ++ ++(define_expand "atomic_fetch_" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (any_atomic:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "reg_or_0_operand")) ;; value for op ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_fetch_strong_ to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_fetch_strong_ (old, aligned_mem, ++ shifted_value, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ + (define_insn "atomic_exchange" + [(set (match_operand:GPR 0 "register_operand" "=&r") + (unspec_volatile:GPR +@@ -104,6 +236,56 @@ + "%F3amoswap.%A3 %0,%z2,%1" + [(set (attr "length") (const_int 8))]) + ++(define_expand "atomic_exchange" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "register_operand") ;; value ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_exchange_strong (old, aligned_mem, ++ shifted_value, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ DONE; ++}) ++ ++(define_insn "subword_atomic_exchange_strong" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(match_operand:SI 2 "reg_or_0_operand" "rI") ;; value ++ (match_operand:SI 3 "reg_or_0_operand" "rI")] ;; not_mask ++ UNSPEC_SYNC_EXCHANGE_SUBWORD)) ++ (clobber (match_scratch:SI 4 "=&r"))] ;; tmp_1 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%4, %0, %3\;" ++ "or\t%4, %4, %2\;" ++ "sc.w.rl\t%4, %4, %1\;" ++ "bnez\t%4, 1b"; ++ } ++ [(set (attr "length") (const_int 20))]) ++ + (define_insn "atomic_cas_value_strong" + [(set (match_operand:GPR 0 "register_operand" "=&r") + (match_operand:GPR 1 "memory_operand" "+A")) +@@ -152,6 +334,125 @@ + DONE; + }) + ++(define_expand "atomic_compare_and_swap" ++ [(match_operand:SI 0 "register_operand") ;; bool output ++ (match_operand:SHORT 1 "register_operand") ;; val output ++ (match_operand:SHORT 2 "memory_operand") ;; memory ++ (match_operand:SHORT 3 "reg_or_0_operand") ;; expected value ++ (match_operand:SHORT 4 "reg_or_0_operand") ;; desired value ++ (match_operand:SI 5 "const_int_operand") ;; is_weak ++ (match_operand:SI 6 "const_int_operand") ;; mod_s ++ (match_operand:SI 7 "const_int_operand")] ;; mod_f ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ emit_insn (gen_atomic_cas_value_strong (operands[1], operands[2], ++ operands[3], operands[4], ++ operands[6], operands[7])); ++ ++ rtx val = gen_reg_rtx (SImode); ++ if (operands[1] != const0_rtx) ++ emit_move_insn (val, gen_rtx_SIGN_EXTEND (SImode, operands[1])); ++ else ++ emit_move_insn (val, const0_rtx); ++ ++ rtx exp = gen_reg_rtx (SImode); ++ if (operands[3] != const0_rtx) ++ emit_move_insn (exp, gen_rtx_SIGN_EXTEND (SImode, operands[3])); ++ else ++ emit_move_insn (exp, const0_rtx); ++ ++ rtx compare = val; ++ if (exp != const0_rtx) ++ { ++ rtx difference = gen_rtx_MINUS (SImode, val, exp); ++ compare = gen_reg_rtx (SImode); ++ emit_move_insn (compare, difference); ++ } ++ ++ if (word_mode != SImode) ++ { ++ rtx reg = gen_reg_rtx (word_mode); ++ emit_move_insn (reg, gen_rtx_SIGN_EXTEND (word_mode, compare)); ++ compare = reg; ++ } ++ ++ emit_move_insn (operands[0], gen_rtx_EQ (SImode, compare, const0_rtx)); ++ DONE; ++}) ++ ++(define_expand "atomic_cas_value_strong" ++ [(match_operand:SHORT 0 "register_operand") ;; val output ++ (match_operand:SHORT 1 "memory_operand") ;; memory ++ (match_operand:SHORT 2 "reg_or_0_operand") ;; expected value ++ (match_operand:SHORT 3 "reg_or_0_operand") ;; desired value ++ (match_operand:SI 4 "const_int_operand") ;; mod_s ++ (match_operand:SI 5 "const_int_operand") ;; mod_f ++ (match_scratch:SHORT 6)] ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_cas_strong to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx o = operands[2]; ++ rtx n = operands[3]; ++ rtx shifted_o = gen_reg_rtx (SImode); ++ rtx shifted_n = gen_reg_rtx (SImode); ++ ++ riscv_lshift_subword (mode, o, shift, &shifted_o); ++ riscv_lshift_subword (mode, n, shift, &shifted_n); ++ ++ emit_move_insn (shifted_o, gen_rtx_AND (SImode, shifted_o, mask)); ++ emit_move_insn (shifted_n, gen_rtx_AND (SImode, shifted_n, mask)); ++ ++ emit_insn (gen_subword_atomic_cas_strong (old, aligned_mem, ++ shifted_o, shifted_n, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ ++(define_insn "subword_atomic_cas_strong" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI [(match_operand:SI 2 "reg_or_0_operand" "rJ") ;; expected value ++ (match_operand:SI 3 "reg_or_0_operand" "rJ")] ;; desired value ++ UNSPEC_COMPARE_AND_SWAP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; mask ++ (match_operand:SI 5 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_1 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%6, %0, %4\;" ++ "bne\t%6, %z2, 1f\;" ++ "and\t%6, %0, %5\;" ++ "or\t%6, %6, %3\;" ++ "sc.w.rl\t%6, %6, %1\;" ++ "bnez\t%6, 1b\;" ++ "1:"; ++ } ++ [(set (attr "length") (const_int 28))]) ++ + (define_expand "atomic_test_and_set" + [(match_operand:QI 0 "register_operand" "") ;; bool output + (match_operand:QI 1 "memory_operand" "+A") ;; memory +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -734,7 +734,8 @@ Objective-C and Objective-C++ Dialects}. + -moverride=@var{string} -mverbose-cost-dump @gol + -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol + -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol +--moutline-atomics } ++-moutline-atomics ++-minline-atomics -mno-inline-atomics} + + @emph{Adapteva Epiphany Options} + @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol +@@ -26742,6 +26743,13 @@ Do or don't use smaller but slower prolo + library function calls. The default is to use fast inline prologues and + epilogues. + ++@opindex minline-atomics ++@item -minline-atomics ++@itemx -mno-inline-atomics ++Do or don't use smaller but slower subword atomic emulation code that uses ++libatomic function calls. The default is to use fast inline subword atomics ++that do not require libatomic. ++ + @item -mshorten-memrefs + @itemx -mno-shorten-memrefs + @opindex mshorten-memrefs +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-1.c +@@ -0,0 +1,18 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mno-inline-atomics" } */ ++/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_add_1" } } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_nand_1" } } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_bool_compare_and_swap_1" } } */ ++ ++char foo; ++char bar; ++char baz; ++ ++int ++main () ++{ ++ __sync_fetch_and_add(&foo, 1); ++ __sync_fetch_and_nand(&bar, 1); ++ __sync_bool_compare_and_swap (&baz, 1, 2); ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-2.c +@@ -0,0 +1,9 @@ ++/* { dg-do compile } */ ++/* Verify that subword atomics do not generate calls. */ ++/* { dg-options "-minline-atomics" } */ ++/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_add_1" } } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_nand_1" } } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_bool_compare_and_swap_1" } } */ ++ ++#include "inline-atomics-1.c" +\ No newline at end of file +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-3.c +@@ -0,0 +1,569 @@ ++/* Check all char alignments. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-1.c */ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */ ++ ++/* Test the execution of the __atomic_*OP builtin routines for a char. */ ++ ++extern void abort(void); ++ ++char count, res; ++const char init = ~0; ++ ++struct A ++{ ++ char a; ++ char b; ++ char c; ++ char d; ++} __attribute__ ((packed)) A; ++ ++/* The fetch_op routines return the original value before the operation. */ ++ ++void ++test_fetch_add (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5) ++ abort (); ++} ++ ++ ++void ++test_fetch_sub (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--) ++ abort (); ++} ++ ++void ++test_fetch_and (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_fetch_nand (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 ) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_xor (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_or (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31) ++ abort (); ++} ++ ++/* The OP_fetch routines return the new value after the operation. */ ++ ++void ++test_add_fetch (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6) ++ abort (); ++} ++ ++ ++void ++test_sub_fetch (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res) ++ abort (); ++} ++ ++void ++test_and_fetch (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ *v = init; ++ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_nand_fetch (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor_fetch (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_or_fetch (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63) ++ abort (); ++} ++ ++ ++/* Test the OP routines with a result which isn't used. Use both variations ++ within each function. */ ++ ++void ++test_add (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_add_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_CONSUME); ++ if (*v != 2) ++ abort (); ++ ++ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE); ++ if (*v != 3) ++ abort (); ++ ++ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE); ++ if (*v != 4) ++ abort (); ++ ++ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 5) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 6) ++ abort (); ++} ++ ++ ++void ++test_sub (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST); ++ if (*v != --res) ++ abort (); ++} ++ ++void ++test_and (char* v) ++{ ++ *v = init; ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED); ++ if (*v != 0) ++ abort (); ++ ++ *v = init; ++ __atomic_fetch_and (v, init, __ATOMIC_CONSUME); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, init, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_nand (char* v) ++{ ++ *v = init; ++ ++ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_or (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_or_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_CONSUME); ++ if (*v != 3) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE); ++ if (*v != 7) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE); ++ if (*v != 15) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 31) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 63) ++ abort (); ++} ++ ++int ++main () ++{ ++ char* V[] = {&A.a, &A.b, &A.c, &A.d}; ++ ++ for (int i = 0; i < 4; i++) { ++ test_fetch_add (V[i]); ++ test_fetch_sub (V[i]); ++ test_fetch_and (V[i]); ++ test_fetch_nand (V[i]); ++ test_fetch_xor (V[i]); ++ test_fetch_or (V[i]); ++ ++ test_add_fetch (V[i]); ++ test_sub_fetch (V[i]); ++ test_and_fetch (V[i]); ++ test_nand_fetch (V[i]); ++ test_xor_fetch (V[i]); ++ test_or_fetch (V[i]); ++ ++ test_add (V[i]); ++ test_sub (V[i]); ++ test_and (V[i]); ++ test_nand (V[i]); ++ test_xor (V[i]); ++ test_or (V[i]); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-4.c +@@ -0,0 +1,566 @@ ++/* Check all short alignments. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-2.c */ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */ ++ ++/* Test the execution of the __atomic_*OP builtin routines for a short. */ ++ ++extern void abort(void); ++ ++short count, res; ++const short init = ~0; ++ ++struct A ++{ ++ short a; ++ short b; ++} __attribute__ ((packed)) A; ++ ++/* The fetch_op routines return the original value before the operation. */ ++ ++void ++test_fetch_add (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5) ++ abort (); ++} ++ ++ ++void ++test_fetch_sub (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--) ++ abort (); ++} ++ ++void ++test_fetch_and (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_fetch_nand (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 ) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_xor (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_or (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31) ++ abort (); ++} ++ ++/* The OP_fetch routines return the new value after the operation. */ ++ ++void ++test_add_fetch (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6) ++ abort (); ++} ++ ++ ++void ++test_sub_fetch (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res) ++ abort (); ++} ++ ++void ++test_and_fetch (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ *v = init; ++ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_nand_fetch (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor_fetch (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_or_fetch (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63) ++ abort (); ++} ++ ++ ++/* Test the OP routines with a result which isn't used. Use both variations ++ within each function. */ ++ ++void ++test_add (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_add_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_CONSUME); ++ if (*v != 2) ++ abort (); ++ ++ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE); ++ if (*v != 3) ++ abort (); ++ ++ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE); ++ if (*v != 4) ++ abort (); ++ ++ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 5) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 6) ++ abort (); ++} ++ ++ ++void ++test_sub (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST); ++ if (*v != --res) ++ abort (); ++} ++ ++void ++test_and (short* v) ++{ ++ *v = init; ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED); ++ if (*v != 0) ++ abort (); ++ ++ *v = init; ++ __atomic_fetch_and (v, init, __ATOMIC_CONSUME); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, init, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_nand (short* v) ++{ ++ *v = init; ++ ++ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_or (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_or_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_CONSUME); ++ if (*v != 3) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE); ++ if (*v != 7) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE); ++ if (*v != 15) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 31) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 63) ++ abort (); ++} ++ ++int ++main () { ++ short* V[] = {&A.a, &A.b}; ++ ++ for (int i = 0; i < 2; i++) { ++ test_fetch_add (V[i]); ++ test_fetch_sub (V[i]); ++ test_fetch_and (V[i]); ++ test_fetch_nand (V[i]); ++ test_fetch_xor (V[i]); ++ test_fetch_or (V[i]); ++ ++ test_add_fetch (V[i]); ++ test_sub_fetch (V[i]); ++ test_and_fetch (V[i]); ++ test_nand_fetch (V[i]); ++ test_xor_fetch (V[i]); ++ test_or_fetch (V[i]); ++ ++ test_add (V[i]); ++ test_sub (V[i]); ++ test_and (V[i]); ++ test_nand (V[i]); ++ test_xor (V[i]); ++ test_or (V[i]); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-5.c +@@ -0,0 +1,87 @@ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_compare_exchange_n builtin for a char. */ ++ ++extern void abort(void); ++ ++char v = 0; ++char expected = 0; ++char max = ~0; ++char desired = ~0; ++char zero = 0; ++ ++#define STRONG 0 ++#define WEAK 1 ++ ++int ++main () ++{ ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ /* Now test the generic version. */ ++ ++ v = 0; ++ ++ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-6.c +@@ -0,0 +1,87 @@ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_compare_exchange_n builtin for a short. */ ++ ++extern void abort(void); ++ ++short v = 0; ++short expected = 0; ++short max = ~0; ++short desired = ~0; ++short zero = 0; ++ ++#define STRONG 0 ++#define WEAK 1 ++ ++int ++main () ++{ ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ /* Now test the generic version. */ ++ ++ v = 0; ++ ++ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-7.c +@@ -0,0 +1,69 @@ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-1.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_exchange_n builtin for a char. */ ++ ++extern void abort(void); ++ ++char v, count, ret; ++ ++int ++main () ++{ ++ v = 0; ++ count = 0; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) ++ abort (); ++ count++; ++ ++ /* Now test the generic version. */ ++ ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-8.c +@@ -0,0 +1,69 @@ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-2.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_X builtin for a short. */ ++ ++extern void abort(void); ++ ++short v, count, ret; ++ ++int ++main () ++{ ++ v = 0; ++ count = 0; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) ++ abort (); ++ count++; ++ ++ /* Now test the generic version. */ ++ ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ return 0; ++} +--- a/libgcc/config/riscv/atomic.c ++++ b/libgcc/config/riscv/atomic.c +@@ -30,6 +30,8 @@ see the files COPYING3 and COPYING.RUNTI + #define INVERT "not %[tmp1], %[tmp1]\n\t" + #define DONT_INVERT "" + ++/* Logic duplicated in gcc/gcc/config/riscv/sync.md for use when inlining is enabled */ ++ + #define GENERATE_FETCH_AND_OP(type, size, opname, insn, invert, cop) \ + type __sync_fetch_and_ ## opname ## _ ## size (type *p, type v) \ + { \ diff --git a/toolchain/gcc/patches-11.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch b/toolchain/gcc/patches-11.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch new file mode 100644 index 00000000000000..328c7be9ce8ec4 --- /dev/null +++ b/toolchain/gcc/patches-11.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch @@ -0,0 +1,36 @@ +From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Sat, 23 Apr 2022 15:48:42 +0200 +Subject: [PATCH] riscv/linux: Don't add -latomic with -pthread + +Now that we have support for inline subword atomic operations, it is no +longer necessary to link against libatomic. This also fixes testsuite +failures because the framework does not properly set up the linker flags +for finding libatomic. +The use of atomic operations is also independent of the use of libpthread. + +gcc/ + * config/riscv/linux.h (LIB_SPEC): Don't redefine. +--- + gcc/config/riscv/linux.h | 10 ---------- + 1 file changed, 10 deletions(-) + +--- a/gcc/config/riscv/linux.h ++++ b/gcc/config/riscv/linux.h +@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3. + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" + +-/* Because RISC-V only has word-sized atomics, it requries libatomic where +- others do not. So link libatomic by default, as needed. */ +-#undef LIB_SPEC +-#ifdef LD_AS_NEEDED_OPTION +-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \ +- " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}" +-#else +-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic " +-#endif +- + #define ICACHE_FLUSH_FUNC "__riscv_flush_icache" + + #define CPP_SPEC "%{pthread:-D_REENTRANT}" diff --git a/toolchain/gcc/patches-11.x/910-mbsd_multi.patch b/toolchain/gcc/patches-11.x/910-mbsd_multi.patch index 21f532043eb99e..2d1c3d1b80d5d7 100644 --- a/toolchain/gcc/patches-11.x/910-mbsd_multi.patch +++ b/toolchain/gcc/patches-11.x/910-mbsd_multi.patch @@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 ; On SVR4 targets, it also controls whether or not to emit a --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi -@@ -9058,6 +9058,17 @@ This option is only supported for C and +@@ -9059,6 +9059,17 @@ This option is only supported for C and @option{-Wall} and by @option{-Wpedantic}, which can be disabled with @option{-Wno-pointer-sign}. diff --git a/toolchain/gcc/patches-12.x/700-RISCV-Inline-subword-atomic-ops.patch b/toolchain/gcc/patches-12.x/700-RISCV-Inline-subword-atomic-ops.patch new file mode 100644 index 00000000000000..b164c76522265a --- /dev/null +++ b/toolchain/gcc/patches-12.x/700-RISCV-Inline-subword-atomic-ops.patch @@ -0,0 +1,2021 @@ +From f797260adaf52bee0ec0e16190bbefbe1bfc3692 Mon Sep 17 00:00:00 2001 +From: Patrick O'Neill +Date: Tue, 18 Apr 2023 14:33:13 -0700 +Subject: [PATCH] RISCV: Inline subword atomic ops + +RISC-V has no support for subword atomic operations; code currently +generates libatomic library calls. + +This patch changes the default behavior to inline subword atomic calls +(using the same logic as the existing library call). +Behavior can be specified using the -minline-atomics and +-mno-inline-atomics command line flags. + +gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm. +This will need to stay for backwards compatibility and the +-mno-inline-atomics flag. + +2023-04-18 Patrick O'Neill + +gcc/ChangeLog: + PR target/104338 + * config/riscv/riscv-protos.h: Add helper function stubs. + * config/riscv/riscv.cc: Add helper functions for subword masking. + * config/riscv/riscv.opt: Add command-line flag. + * config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op, + fetch_and_nand, CAS, and exchange ops. + * doc/invoke.texi: Add blurb regarding command-line flag. + +libgcc/ChangeLog: + PR target/104338 + * config/riscv/atomic.c: Add reference to duplicate logic. + +gcc/testsuite/ChangeLog: + PR target/104338 + * gcc.target/riscv/inline-atomics-1.c: New test. + * gcc.target/riscv/inline-atomics-2.c: New test. + * gcc.target/riscv/inline-atomics-3.c: New test. + * gcc.target/riscv/inline-atomics-4.c: New test. + * gcc.target/riscv/inline-atomics-5.c: New test. + * gcc.target/riscv/inline-atomics-6.c: New test. + * gcc.target/riscv/inline-atomics-7.c: New test. + * gcc.target/riscv/inline-atomics-8.c: New test. + +Signed-off-by: Patrick O'Neill +Signed-off-by: Palmer Dabbelt +--- + gcc/config/riscv/riscv-protos.h | 2 + + gcc/config/riscv/riscv.cc | 49 ++ + gcc/config/riscv/riscv.opt | 4 + + gcc/config/riscv/sync.md | 301 +++++++++ + gcc/doc/invoke.texi | 10 +- + .../gcc.target/riscv/inline-atomics-1.c | 18 + + .../gcc.target/riscv/inline-atomics-2.c | 9 + + .../gcc.target/riscv/inline-atomics-3.c | 569 ++++++++++++++++++ + .../gcc.target/riscv/inline-atomics-4.c | 566 +++++++++++++++++ + .../gcc.target/riscv/inline-atomics-5.c | 87 +++ + .../gcc.target/riscv/inline-atomics-6.c | 87 +++ + .../gcc.target/riscv/inline-atomics-7.c | 69 +++ + .../gcc.target/riscv/inline-atomics-8.c | 69 +++ + libgcc/config/riscv/atomic.c | 2 + + 14 files changed, 1841 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-1.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-2.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-3.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-4.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-5.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-6.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-7.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-8.c + +--- a/gcc/config/riscv/riscv-protos.h ++++ b/gcc/config/riscv/riscv-protos.h +@@ -74,6 +74,8 @@ extern bool riscv_expand_block_move (rtx + extern bool riscv_store_data_bypass_p (rtx_insn *, rtx_insn *); + extern rtx riscv_gen_gpr_save_insn (struct riscv_frame_info *); + extern bool riscv_gpr_save_operation_p (rtx); ++extern void riscv_subword_address (rtx, rtx *, rtx *, rtx *, rtx *); ++extern void riscv_lshift_subword (machine_mode, rtx, rtx, rtx *); + + /* Routines implemented in riscv-c.cc. */ + void riscv_cpu_cpp_builtins (cpp_reader *); +--- a/gcc/config/riscv/riscv.cc ++++ b/gcc/config/riscv/riscv.cc +@@ -5605,6 +5605,55 @@ riscv_asan_shadow_offset (void) + return TARGET_64BIT ? (HOST_WIDE_INT_1 << 29) : 0; + } + ++/* Given memory reference MEM, expand code to compute the aligned ++ memory address, shift and mask values and store them into ++ *ALIGNED_MEM, *SHIFT, *MASK and *NOT_MASK. */ ++ ++void ++riscv_subword_address (rtx mem, rtx *aligned_mem, rtx *shift, rtx *mask, ++ rtx *not_mask) ++{ ++ /* Align the memory address to a word. */ ++ rtx addr = force_reg (Pmode, XEXP (mem, 0)); ++ ++ rtx addr_mask = gen_int_mode (-4, Pmode); ++ ++ rtx aligned_addr = gen_reg_rtx (Pmode); ++ emit_move_insn (aligned_addr, gen_rtx_AND (Pmode, addr, addr_mask)); ++ ++ *aligned_mem = change_address (mem, SImode, aligned_addr); ++ ++ /* Calculate the shift amount. */ ++ emit_move_insn (*shift, gen_rtx_AND (SImode, gen_lowpart (SImode, addr), ++ gen_int_mode (3, SImode))); ++ emit_move_insn (*shift, gen_rtx_ASHIFT (SImode, *shift, ++ gen_int_mode (3, SImode))); ++ ++ /* Calculate the mask. */ ++ int unshifted_mask = GET_MODE_MASK (GET_MODE (mem)); ++ ++ emit_move_insn (*mask, gen_int_mode (unshifted_mask, SImode)); ++ ++ emit_move_insn (*mask, gen_rtx_ASHIFT (SImode, *mask, ++ gen_lowpart (QImode, *shift))); ++ ++ emit_move_insn (*not_mask, gen_rtx_NOT(SImode, *mask)); ++} ++ ++/* Leftshift a subword within an SImode register. */ ++ ++void ++riscv_lshift_subword (machine_mode mode, rtx value, rtx shift, ++ rtx *shifted_value) ++{ ++ rtx value_reg = gen_reg_rtx (SImode); ++ emit_move_insn (value_reg, simplify_gen_subreg (SImode, value, ++ mode, 0)); ++ ++ emit_move_insn(*shifted_value, gen_rtx_ASHIFT (SImode, value_reg, ++ gen_lowpart (QImode, shift))); ++} ++ + /* Initialize the GCC target structure. */ + #undef TARGET_ASM_ALIGNED_HI_OP + #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" +--- a/gcc/config/riscv/riscv.opt ++++ b/gcc/config/riscv/riscv.opt +@@ -209,6 +209,10 @@ int riscv_vector_elen_flags + TargetVariable + int riscv_zvl_flags + ++minline-atomics ++Target Var(TARGET_INLINE_SUBWORD_ATOMIC) Init(1) ++Always inline subword atomic operations. ++ + Enum + Name(isa_spec_class) Type(enum riscv_isa_spec_class) + Supported ISA specs (for use with the -misa-spec= option): +--- a/gcc/config/riscv/sync.md ++++ b/gcc/config/riscv/sync.md +@@ -21,8 +21,11 @@ + + (define_c_enum "unspec" [ + UNSPEC_COMPARE_AND_SWAP ++ UNSPEC_COMPARE_AND_SWAP_SUBWORD + UNSPEC_SYNC_OLD_OP ++ UNSPEC_SYNC_OLD_OP_SUBWORD + UNSPEC_SYNC_EXCHANGE ++ UNSPEC_SYNC_EXCHANGE_SUBWORD + UNSPEC_ATOMIC_STORE + UNSPEC_MEMORY_BARRIER + ]) +@@ -92,6 +95,135 @@ + "%F3amo.%A3 %0,%z2,%1" + [(set (attr "length") (const_int 8))]) + ++(define_insn "subword_atomic_fetch_strong_" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(any_atomic:SI (match_dup 1) ++ (match_operand:SI 2 "register_operand" "rI")) ;; value for op ++ (match_operand:SI 3 "register_operand" "rI")] ;; mask ++ UNSPEC_SYNC_OLD_OP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1 ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "\t%5, %0, %2\;" ++ "and\t%5, %5, %3\;" ++ "and\t%6, %0, %4\;" ++ "or\t%6, %6, %5\;" ++ "sc.w.rl\t%5, %6, %1\;" ++ "bnez\t%5, 1b"; ++ } ++ [(set (attr "length") (const_int 28))]) ++ ++(define_expand "atomic_fetch_nand" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (not:SHORT (and:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "reg_or_0_operand"))) ;; value for op ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_fetch_strong_nand to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_fetch_strong_nand (old, aligned_mem, ++ shifted_value, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ ++(define_insn "subword_atomic_fetch_strong_nand" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(not:SI (and:SI (match_dup 1) ++ (match_operand:SI 2 "register_operand" "rI"))) ;; value for op ++ (match_operand:SI 3 "register_operand" "rI")] ;; mask ++ UNSPEC_SYNC_OLD_OP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1 ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%5, %0, %2\;" ++ "not\t%5, %5\;" ++ "and\t%5, %5, %3\;" ++ "and\t%6, %0, %4\;" ++ "or\t%6, %6, %5\;" ++ "sc.w.rl\t%5, %6, %1\;" ++ "bnez\t%5, 1b"; ++ } ++ [(set (attr "length") (const_int 32))]) ++ ++(define_expand "atomic_fetch_" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (any_atomic:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "reg_or_0_operand")) ;; value for op ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_fetch_strong_ to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_fetch_strong_ (old, aligned_mem, ++ shifted_value, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ + (define_insn "atomic_exchange" + [(set (match_operand:GPR 0 "register_operand" "=&r") + (unspec_volatile:GPR +@@ -104,6 +236,56 @@ + "%F3amoswap.%A3 %0,%z2,%1" + [(set (attr "length") (const_int 8))]) + ++(define_expand "atomic_exchange" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "register_operand") ;; value ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_exchange_strong (old, aligned_mem, ++ shifted_value, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ DONE; ++}) ++ ++(define_insn "subword_atomic_exchange_strong" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(match_operand:SI 2 "reg_or_0_operand" "rI") ;; value ++ (match_operand:SI 3 "reg_or_0_operand" "rI")] ;; not_mask ++ UNSPEC_SYNC_EXCHANGE_SUBWORD)) ++ (clobber (match_scratch:SI 4 "=&r"))] ;; tmp_1 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%4, %0, %3\;" ++ "or\t%4, %4, %2\;" ++ "sc.w.rl\t%4, %4, %1\;" ++ "bnez\t%4, 1b"; ++ } ++ [(set (attr "length") (const_int 20))]) ++ + (define_insn "atomic_cas_value_strong" + [(set (match_operand:GPR 0 "register_operand" "=&r") + (match_operand:GPR 1 "memory_operand" "+A")) +@@ -152,6 +334,125 @@ + DONE; + }) + ++(define_expand "atomic_compare_and_swap" ++ [(match_operand:SI 0 "register_operand") ;; bool output ++ (match_operand:SHORT 1 "register_operand") ;; val output ++ (match_operand:SHORT 2 "memory_operand") ;; memory ++ (match_operand:SHORT 3 "reg_or_0_operand") ;; expected value ++ (match_operand:SHORT 4 "reg_or_0_operand") ;; desired value ++ (match_operand:SI 5 "const_int_operand") ;; is_weak ++ (match_operand:SI 6 "const_int_operand") ;; mod_s ++ (match_operand:SI 7 "const_int_operand")] ;; mod_f ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ emit_insn (gen_atomic_cas_value_strong (operands[1], operands[2], ++ operands[3], operands[4], ++ operands[6], operands[7])); ++ ++ rtx val = gen_reg_rtx (SImode); ++ if (operands[1] != const0_rtx) ++ emit_move_insn (val, gen_rtx_SIGN_EXTEND (SImode, operands[1])); ++ else ++ emit_move_insn (val, const0_rtx); ++ ++ rtx exp = gen_reg_rtx (SImode); ++ if (operands[3] != const0_rtx) ++ emit_move_insn (exp, gen_rtx_SIGN_EXTEND (SImode, operands[3])); ++ else ++ emit_move_insn (exp, const0_rtx); ++ ++ rtx compare = val; ++ if (exp != const0_rtx) ++ { ++ rtx difference = gen_rtx_MINUS (SImode, val, exp); ++ compare = gen_reg_rtx (SImode); ++ emit_move_insn (compare, difference); ++ } ++ ++ if (word_mode != SImode) ++ { ++ rtx reg = gen_reg_rtx (word_mode); ++ emit_move_insn (reg, gen_rtx_SIGN_EXTEND (word_mode, compare)); ++ compare = reg; ++ } ++ ++ emit_move_insn (operands[0], gen_rtx_EQ (SImode, compare, const0_rtx)); ++ DONE; ++}) ++ ++(define_expand "atomic_cas_value_strong" ++ [(match_operand:SHORT 0 "register_operand") ;; val output ++ (match_operand:SHORT 1 "memory_operand") ;; memory ++ (match_operand:SHORT 2 "reg_or_0_operand") ;; expected value ++ (match_operand:SHORT 3 "reg_or_0_operand") ;; desired value ++ (match_operand:SI 4 "const_int_operand") ;; mod_s ++ (match_operand:SI 5 "const_int_operand") ;; mod_f ++ (match_scratch:SHORT 6)] ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_cas_strong to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx o = operands[2]; ++ rtx n = operands[3]; ++ rtx shifted_o = gen_reg_rtx (SImode); ++ rtx shifted_n = gen_reg_rtx (SImode); ++ ++ riscv_lshift_subword (mode, o, shift, &shifted_o); ++ riscv_lshift_subword (mode, n, shift, &shifted_n); ++ ++ emit_move_insn (shifted_o, gen_rtx_AND (SImode, shifted_o, mask)); ++ emit_move_insn (shifted_n, gen_rtx_AND (SImode, shifted_n, mask)); ++ ++ emit_insn (gen_subword_atomic_cas_strong (old, aligned_mem, ++ shifted_o, shifted_n, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ ++(define_insn "subword_atomic_cas_strong" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI [(match_operand:SI 2 "reg_or_0_operand" "rJ") ;; expected value ++ (match_operand:SI 3 "reg_or_0_operand" "rJ")] ;; desired value ++ UNSPEC_COMPARE_AND_SWAP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; mask ++ (match_operand:SI 5 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_1 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%6, %0, %4\;" ++ "bne\t%6, %z2, 1f\;" ++ "and\t%6, %0, %5\;" ++ "or\t%6, %6, %3\;" ++ "sc.w.rl\t%6, %6, %1\;" ++ "bnez\t%6, 1b\;" ++ "1:"; ++ } ++ [(set (attr "length") (const_int 28))]) ++ + (define_expand "atomic_test_and_set" + [(match_operand:QI 0 "register_operand" "") ;; bool output + (match_operand:QI 1 "memory_operand" "+A") ;; memory +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -753,7 +753,8 @@ Objective-C and Objective-C++ Dialects}. + -moverride=@var{string} -mverbose-cost-dump @gol + -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol + -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol +--moutline-atomics } ++-moutline-atomics ++-minline-atomics -mno-inline-atomics} + + @emph{Adapteva Epiphany Options} + @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol +@@ -28035,6 +28036,13 @@ Do or don't use smaller but slower prolo + library function calls. The default is to use fast inline prologues and + epilogues. + ++@opindex minline-atomics ++@item -minline-atomics ++@itemx -mno-inline-atomics ++Do or don't use smaller but slower subword atomic emulation code that uses ++libatomic function calls. The default is to use fast inline subword atomics ++that do not require libatomic. ++ + @item -mshorten-memrefs + @itemx -mno-shorten-memrefs + @opindex mshorten-memrefs +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-1.c +@@ -0,0 +1,18 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mno-inline-atomics" } */ ++/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_add_1" } } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_nand_1" } } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_bool_compare_and_swap_1" } } */ ++ ++char foo; ++char bar; ++char baz; ++ ++int ++main () ++{ ++ __sync_fetch_and_add(&foo, 1); ++ __sync_fetch_and_nand(&bar, 1); ++ __sync_bool_compare_and_swap (&baz, 1, 2); ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-2.c +@@ -0,0 +1,9 @@ ++/* { dg-do compile } */ ++/* Verify that subword atomics do not generate calls. */ ++/* { dg-options "-minline-atomics" } */ ++/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_add_1" } } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_nand_1" } } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_bool_compare_and_swap_1" } } */ ++ ++#include "inline-atomics-1.c" +\ No newline at end of file +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-3.c +@@ -0,0 +1,569 @@ ++/* Check all char alignments. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-1.c */ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */ ++ ++/* Test the execution of the __atomic_*OP builtin routines for a char. */ ++ ++extern void abort(void); ++ ++char count, res; ++const char init = ~0; ++ ++struct A ++{ ++ char a; ++ char b; ++ char c; ++ char d; ++} __attribute__ ((packed)) A; ++ ++/* The fetch_op routines return the original value before the operation. */ ++ ++void ++test_fetch_add (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5) ++ abort (); ++} ++ ++ ++void ++test_fetch_sub (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--) ++ abort (); ++} ++ ++void ++test_fetch_and (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_fetch_nand (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 ) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_xor (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_or (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31) ++ abort (); ++} ++ ++/* The OP_fetch routines return the new value after the operation. */ ++ ++void ++test_add_fetch (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6) ++ abort (); ++} ++ ++ ++void ++test_sub_fetch (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res) ++ abort (); ++} ++ ++void ++test_and_fetch (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ *v = init; ++ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_nand_fetch (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor_fetch (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_or_fetch (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63) ++ abort (); ++} ++ ++ ++/* Test the OP routines with a result which isn't used. Use both variations ++ within each function. */ ++ ++void ++test_add (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_add_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_CONSUME); ++ if (*v != 2) ++ abort (); ++ ++ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE); ++ if (*v != 3) ++ abort (); ++ ++ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE); ++ if (*v != 4) ++ abort (); ++ ++ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 5) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 6) ++ abort (); ++} ++ ++ ++void ++test_sub (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST); ++ if (*v != --res) ++ abort (); ++} ++ ++void ++test_and (char* v) ++{ ++ *v = init; ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED); ++ if (*v != 0) ++ abort (); ++ ++ *v = init; ++ __atomic_fetch_and (v, init, __ATOMIC_CONSUME); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, init, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_nand (char* v) ++{ ++ *v = init; ++ ++ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_or (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_or_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_CONSUME); ++ if (*v != 3) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE); ++ if (*v != 7) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE); ++ if (*v != 15) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 31) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 63) ++ abort (); ++} ++ ++int ++main () ++{ ++ char* V[] = {&A.a, &A.b, &A.c, &A.d}; ++ ++ for (int i = 0; i < 4; i++) { ++ test_fetch_add (V[i]); ++ test_fetch_sub (V[i]); ++ test_fetch_and (V[i]); ++ test_fetch_nand (V[i]); ++ test_fetch_xor (V[i]); ++ test_fetch_or (V[i]); ++ ++ test_add_fetch (V[i]); ++ test_sub_fetch (V[i]); ++ test_and_fetch (V[i]); ++ test_nand_fetch (V[i]); ++ test_xor_fetch (V[i]); ++ test_or_fetch (V[i]); ++ ++ test_add (V[i]); ++ test_sub (V[i]); ++ test_and (V[i]); ++ test_nand (V[i]); ++ test_xor (V[i]); ++ test_or (V[i]); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-4.c +@@ -0,0 +1,566 @@ ++/* Check all short alignments. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-2.c */ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */ ++ ++/* Test the execution of the __atomic_*OP builtin routines for a short. */ ++ ++extern void abort(void); ++ ++short count, res; ++const short init = ~0; ++ ++struct A ++{ ++ short a; ++ short b; ++} __attribute__ ((packed)) A; ++ ++/* The fetch_op routines return the original value before the operation. */ ++ ++void ++test_fetch_add (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5) ++ abort (); ++} ++ ++ ++void ++test_fetch_sub (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--) ++ abort (); ++} ++ ++void ++test_fetch_and (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_fetch_nand (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 ) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_xor (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_or (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31) ++ abort (); ++} ++ ++/* The OP_fetch routines return the new value after the operation. */ ++ ++void ++test_add_fetch (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6) ++ abort (); ++} ++ ++ ++void ++test_sub_fetch (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res) ++ abort (); ++} ++ ++void ++test_and_fetch (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ *v = init; ++ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_nand_fetch (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor_fetch (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_or_fetch (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63) ++ abort (); ++} ++ ++ ++/* Test the OP routines with a result which isn't used. Use both variations ++ within each function. */ ++ ++void ++test_add (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_add_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_CONSUME); ++ if (*v != 2) ++ abort (); ++ ++ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE); ++ if (*v != 3) ++ abort (); ++ ++ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE); ++ if (*v != 4) ++ abort (); ++ ++ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 5) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 6) ++ abort (); ++} ++ ++ ++void ++test_sub (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST); ++ if (*v != --res) ++ abort (); ++} ++ ++void ++test_and (short* v) ++{ ++ *v = init; ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED); ++ if (*v != 0) ++ abort (); ++ ++ *v = init; ++ __atomic_fetch_and (v, init, __ATOMIC_CONSUME); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, init, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_nand (short* v) ++{ ++ *v = init; ++ ++ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_or (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_or_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_CONSUME); ++ if (*v != 3) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE); ++ if (*v != 7) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE); ++ if (*v != 15) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 31) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 63) ++ abort (); ++} ++ ++int ++main () { ++ short* V[] = {&A.a, &A.b}; ++ ++ for (int i = 0; i < 2; i++) { ++ test_fetch_add (V[i]); ++ test_fetch_sub (V[i]); ++ test_fetch_and (V[i]); ++ test_fetch_nand (V[i]); ++ test_fetch_xor (V[i]); ++ test_fetch_or (V[i]); ++ ++ test_add_fetch (V[i]); ++ test_sub_fetch (V[i]); ++ test_and_fetch (V[i]); ++ test_nand_fetch (V[i]); ++ test_xor_fetch (V[i]); ++ test_or_fetch (V[i]); ++ ++ test_add (V[i]); ++ test_sub (V[i]); ++ test_and (V[i]); ++ test_nand (V[i]); ++ test_xor (V[i]); ++ test_or (V[i]); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-5.c +@@ -0,0 +1,87 @@ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_compare_exchange_n builtin for a char. */ ++ ++extern void abort(void); ++ ++char v = 0; ++char expected = 0; ++char max = ~0; ++char desired = ~0; ++char zero = 0; ++ ++#define STRONG 0 ++#define WEAK 1 ++ ++int ++main () ++{ ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ /* Now test the generic version. */ ++ ++ v = 0; ++ ++ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-6.c +@@ -0,0 +1,87 @@ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_compare_exchange_n builtin for a short. */ ++ ++extern void abort(void); ++ ++short v = 0; ++short expected = 0; ++short max = ~0; ++short desired = ~0; ++short zero = 0; ++ ++#define STRONG 0 ++#define WEAK 1 ++ ++int ++main () ++{ ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ /* Now test the generic version. */ ++ ++ v = 0; ++ ++ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-7.c +@@ -0,0 +1,69 @@ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-1.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_exchange_n builtin for a char. */ ++ ++extern void abort(void); ++ ++char v, count, ret; ++ ++int ++main () ++{ ++ v = 0; ++ count = 0; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) ++ abort (); ++ count++; ++ ++ /* Now test the generic version. */ ++ ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-8.c +@@ -0,0 +1,69 @@ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-2.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_X builtin for a short. */ ++ ++extern void abort(void); ++ ++short v, count, ret; ++ ++int ++main () ++{ ++ v = 0; ++ count = 0; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) ++ abort (); ++ count++; ++ ++ /* Now test the generic version. */ ++ ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ return 0; ++} +--- a/libgcc/config/riscv/atomic.c ++++ b/libgcc/config/riscv/atomic.c +@@ -30,6 +30,8 @@ see the files COPYING3 and COPYING.RUNTI + #define INVERT "not %[tmp1], %[tmp1]\n\t" + #define DONT_INVERT "" + ++/* Logic duplicated in gcc/gcc/config/riscv/sync.md for use when inlining is enabled */ ++ + #define GENERATE_FETCH_AND_OP(type, size, opname, insn, invert, cop) \ + type __sync_fetch_and_ ## opname ## _ ## size (type *p, type v) \ + { \ diff --git a/toolchain/gcc/patches-12.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch b/toolchain/gcc/patches-12.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch new file mode 100644 index 00000000000000..328c7be9ce8ec4 --- /dev/null +++ b/toolchain/gcc/patches-12.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch @@ -0,0 +1,36 @@ +From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Sat, 23 Apr 2022 15:48:42 +0200 +Subject: [PATCH] riscv/linux: Don't add -latomic with -pthread + +Now that we have support for inline subword atomic operations, it is no +longer necessary to link against libatomic. This also fixes testsuite +failures because the framework does not properly set up the linker flags +for finding libatomic. +The use of atomic operations is also independent of the use of libpthread. + +gcc/ + * config/riscv/linux.h (LIB_SPEC): Don't redefine. +--- + gcc/config/riscv/linux.h | 10 ---------- + 1 file changed, 10 deletions(-) + +--- a/gcc/config/riscv/linux.h ++++ b/gcc/config/riscv/linux.h +@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3. + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" + +-/* Because RISC-V only has word-sized atomics, it requries libatomic where +- others do not. So link libatomic by default, as needed. */ +-#undef LIB_SPEC +-#ifdef LD_AS_NEEDED_OPTION +-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \ +- " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}" +-#else +-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic " +-#endif +- + #define ICACHE_FLUSH_FUNC "__riscv_flush_icache" + + #define CPP_SPEC "%{pthread:-D_REENTRANT}" diff --git a/toolchain/gcc/patches-12.x/910-mbsd_multi.patch b/toolchain/gcc/patches-12.x/910-mbsd_multi.patch index 0f75d0ce0eb04e..9233c6a1d7896b 100644 --- a/toolchain/gcc/patches-12.x/910-mbsd_multi.patch +++ b/toolchain/gcc/patches-12.x/910-mbsd_multi.patch @@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 ; On SVR4 targets, it also controls whether or not to emit a --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi -@@ -9596,6 +9596,17 @@ This option is only supported for C and +@@ -9597,6 +9597,17 @@ This option is only supported for C and @option{-Wall} and by @option{-Wpedantic}, which can be disabled with @option{-Wno-pointer-sign}. diff --git a/toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch b/toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch new file mode 100644 index 00000000000000..752480bc4c5799 --- /dev/null +++ b/toolchain/gcc/patches-13.x/700-RISCV-Inline-subword-atomic-ops.patch @@ -0,0 +1,2021 @@ +From f797260adaf52bee0ec0e16190bbefbe1bfc3692 Mon Sep 17 00:00:00 2001 +From: Patrick O'Neill +Date: Tue, 18 Apr 2023 14:33:13 -0700 +Subject: [PATCH] RISCV: Inline subword atomic ops + +RISC-V has no support for subword atomic operations; code currently +generates libatomic library calls. + +This patch changes the default behavior to inline subword atomic calls +(using the same logic as the existing library call). +Behavior can be specified using the -minline-atomics and +-mno-inline-atomics command line flags. + +gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm. +This will need to stay for backwards compatibility and the +-mno-inline-atomics flag. + +2023-04-18 Patrick O'Neill + +gcc/ChangeLog: + PR target/104338 + * config/riscv/riscv-protos.h: Add helper function stubs. + * config/riscv/riscv.cc: Add helper functions for subword masking. + * config/riscv/riscv.opt: Add command-line flag. + * config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op, + fetch_and_nand, CAS, and exchange ops. + * doc/invoke.texi: Add blurb regarding command-line flag. + +libgcc/ChangeLog: + PR target/104338 + * config/riscv/atomic.c: Add reference to duplicate logic. + +gcc/testsuite/ChangeLog: + PR target/104338 + * gcc.target/riscv/inline-atomics-1.c: New test. + * gcc.target/riscv/inline-atomics-2.c: New test. + * gcc.target/riscv/inline-atomics-3.c: New test. + * gcc.target/riscv/inline-atomics-4.c: New test. + * gcc.target/riscv/inline-atomics-5.c: New test. + * gcc.target/riscv/inline-atomics-6.c: New test. + * gcc.target/riscv/inline-atomics-7.c: New test. + * gcc.target/riscv/inline-atomics-8.c: New test. + +Signed-off-by: Patrick O'Neill +Signed-off-by: Palmer Dabbelt +--- + gcc/config/riscv/riscv-protos.h | 2 + + gcc/config/riscv/riscv.cc | 49 ++ + gcc/config/riscv/riscv.opt | 4 + + gcc/config/riscv/sync.md | 301 +++++++++ + gcc/doc/invoke.texi | 10 +- + .../gcc.target/riscv/inline-atomics-1.c | 18 + + .../gcc.target/riscv/inline-atomics-2.c | 9 + + .../gcc.target/riscv/inline-atomics-3.c | 569 ++++++++++++++++++ + .../gcc.target/riscv/inline-atomics-4.c | 566 +++++++++++++++++ + .../gcc.target/riscv/inline-atomics-5.c | 87 +++ + .../gcc.target/riscv/inline-atomics-6.c | 87 +++ + .../gcc.target/riscv/inline-atomics-7.c | 69 +++ + .../gcc.target/riscv/inline-atomics-8.c | 69 +++ + libgcc/config/riscv/atomic.c | 2 + + 14 files changed, 1841 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-1.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-2.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-3.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-4.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-5.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-6.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-7.c + create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-8.c + +--- a/gcc/config/riscv/riscv-protos.h ++++ b/gcc/config/riscv/riscv-protos.h +@@ -79,6 +79,8 @@ extern void riscv_reinit (void); + extern poly_uint64 riscv_regmode_natural_size (machine_mode); + extern bool riscv_v_ext_vector_mode_p (machine_mode); + extern bool riscv_shamt_matches_mask_p (int, HOST_WIDE_INT); ++extern void riscv_subword_address (rtx, rtx *, rtx *, rtx *, rtx *); ++extern void riscv_lshift_subword (machine_mode, rtx, rtx, rtx *); + + /* Routines implemented in riscv-c.cc. */ + void riscv_cpu_cpp_builtins (cpp_reader *); +--- a/gcc/config/riscv/riscv.cc ++++ b/gcc/config/riscv/riscv.cc +@@ -7143,6 +7143,55 @@ riscv_zero_call_used_regs (HARD_REG_SET + & ~zeroed_hardregs); + } + ++/* Given memory reference MEM, expand code to compute the aligned ++ memory address, shift and mask values and store them into ++ *ALIGNED_MEM, *SHIFT, *MASK and *NOT_MASK. */ ++ ++void ++riscv_subword_address (rtx mem, rtx *aligned_mem, rtx *shift, rtx *mask, ++ rtx *not_mask) ++{ ++ /* Align the memory address to a word. */ ++ rtx addr = force_reg (Pmode, XEXP (mem, 0)); ++ ++ rtx addr_mask = gen_int_mode (-4, Pmode); ++ ++ rtx aligned_addr = gen_reg_rtx (Pmode); ++ emit_move_insn (aligned_addr, gen_rtx_AND (Pmode, addr, addr_mask)); ++ ++ *aligned_mem = change_address (mem, SImode, aligned_addr); ++ ++ /* Calculate the shift amount. */ ++ emit_move_insn (*shift, gen_rtx_AND (SImode, gen_lowpart (SImode, addr), ++ gen_int_mode (3, SImode))); ++ emit_move_insn (*shift, gen_rtx_ASHIFT (SImode, *shift, ++ gen_int_mode (3, SImode))); ++ ++ /* Calculate the mask. */ ++ int unshifted_mask = GET_MODE_MASK (GET_MODE (mem)); ++ ++ emit_move_insn (*mask, gen_int_mode (unshifted_mask, SImode)); ++ ++ emit_move_insn (*mask, gen_rtx_ASHIFT (SImode, *mask, ++ gen_lowpart (QImode, *shift))); ++ ++ emit_move_insn (*not_mask, gen_rtx_NOT(SImode, *mask)); ++} ++ ++/* Leftshift a subword within an SImode register. */ ++ ++void ++riscv_lshift_subword (machine_mode mode, rtx value, rtx shift, ++ rtx *shifted_value) ++{ ++ rtx value_reg = gen_reg_rtx (SImode); ++ emit_move_insn (value_reg, simplify_gen_subreg (SImode, value, ++ mode, 0)); ++ ++ emit_move_insn(*shifted_value, gen_rtx_ASHIFT (SImode, value_reg, ++ gen_lowpart (QImode, shift))); ++} ++ + /* Initialize the GCC target structure. */ + #undef TARGET_ASM_ALIGNED_HI_OP + #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" +--- a/gcc/config/riscv/riscv.opt ++++ b/gcc/config/riscv/riscv.opt +@@ -238,6 +238,10 @@ int riscv_sv_subext + TargetVariable + int riscv_xthead_subext + ++minline-atomics ++Target Var(TARGET_INLINE_SUBWORD_ATOMIC) Init(1) ++Always inline subword atomic operations. ++ + Enum + Name(isa_spec_class) Type(enum riscv_isa_spec_class) + Supported ISA specs (for use with the -misa-spec= option): +--- a/gcc/config/riscv/sync.md ++++ b/gcc/config/riscv/sync.md +@@ -21,8 +21,11 @@ + + (define_c_enum "unspec" [ + UNSPEC_COMPARE_AND_SWAP ++ UNSPEC_COMPARE_AND_SWAP_SUBWORD + UNSPEC_SYNC_OLD_OP ++ UNSPEC_SYNC_OLD_OP_SUBWORD + UNSPEC_SYNC_EXCHANGE ++ UNSPEC_SYNC_EXCHANGE_SUBWORD + UNSPEC_ATOMIC_STORE + UNSPEC_MEMORY_BARRIER + ]) +@@ -91,6 +94,135 @@ + [(set_attr "type" "atomic") + (set (attr "length") (const_int 8))]) + ++(define_insn "subword_atomic_fetch_strong_" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(any_atomic:SI (match_dup 1) ++ (match_operand:SI 2 "register_operand" "rI")) ;; value for op ++ (match_operand:SI 3 "register_operand" "rI")] ;; mask ++ UNSPEC_SYNC_OLD_OP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1 ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "\t%5, %0, %2\;" ++ "and\t%5, %5, %3\;" ++ "and\t%6, %0, %4\;" ++ "or\t%6, %6, %5\;" ++ "sc.w.rl\t%5, %6, %1\;" ++ "bnez\t%5, 1b"; ++ } ++ [(set (attr "length") (const_int 28))]) ++ ++(define_expand "atomic_fetch_nand" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (not:SHORT (and:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "reg_or_0_operand"))) ;; value for op ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_fetch_strong_nand to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_fetch_strong_nand (old, aligned_mem, ++ shifted_value, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ ++(define_insn "subword_atomic_fetch_strong_nand" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(not:SI (and:SI (match_dup 1) ++ (match_operand:SI 2 "register_operand" "rI"))) ;; value for op ++ (match_operand:SI 3 "register_operand" "rI")] ;; mask ++ UNSPEC_SYNC_OLD_OP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1 ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%5, %0, %2\;" ++ "not\t%5, %5\;" ++ "and\t%5, %5, %3\;" ++ "and\t%6, %0, %4\;" ++ "or\t%6, %6, %5\;" ++ "sc.w.rl\t%5, %6, %1\;" ++ "bnez\t%5, 1b"; ++ } ++ [(set (attr "length") (const_int 32))]) ++ ++(define_expand "atomic_fetch_" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (any_atomic:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "reg_or_0_operand")) ;; value for op ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_fetch_strong_ to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_fetch_strong_ (old, aligned_mem, ++ shifted_value, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ + (define_insn "atomic_exchange" + [(set (match_operand:GPR 0 "register_operand" "=&r") + (unspec_volatile:GPR +@@ -104,6 +236,56 @@ + [(set_attr "type" "atomic") + (set (attr "length") (const_int 8))]) + ++(define_expand "atomic_exchange" ++ [(match_operand:SHORT 0 "register_operand") ;; old value at mem ++ (match_operand:SHORT 1 "memory_operand") ;; mem location ++ (match_operand:SHORT 2 "register_operand") ;; value ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx value = operands[2]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx shifted_value = gen_reg_rtx (SImode); ++ riscv_lshift_subword (mode, value, shift, &shifted_value); ++ ++ emit_insn (gen_subword_atomic_exchange_strong (old, aligned_mem, ++ shifted_value, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ DONE; ++}) ++ ++(define_insn "subword_atomic_exchange_strong" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(match_operand:SI 2 "reg_or_0_operand" "rI") ;; value ++ (match_operand:SI 3 "reg_or_0_operand" "rI")] ;; not_mask ++ UNSPEC_SYNC_EXCHANGE_SUBWORD)) ++ (clobber (match_scratch:SI 4 "=&r"))] ;; tmp_1 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%4, %0, %3\;" ++ "or\t%4, %4, %2\;" ++ "sc.w.rl\t%4, %4, %1\;" ++ "bnez\t%4, 1b"; ++ } ++ [(set (attr "length") (const_int 20))]) ++ + (define_insn "atomic_cas_value_strong" + [(set (match_operand:GPR 0 "register_operand" "=&r") + (match_operand:GPR 1 "memory_operand" "+A")) +@@ -153,6 +335,125 @@ + DONE; + }) + ++(define_expand "atomic_compare_and_swap" ++ [(match_operand:SI 0 "register_operand") ;; bool output ++ (match_operand:SHORT 1 "register_operand") ;; val output ++ (match_operand:SHORT 2 "memory_operand") ;; memory ++ (match_operand:SHORT 3 "reg_or_0_operand") ;; expected value ++ (match_operand:SHORT 4 "reg_or_0_operand") ;; desired value ++ (match_operand:SI 5 "const_int_operand") ;; is_weak ++ (match_operand:SI 6 "const_int_operand") ;; mod_s ++ (match_operand:SI 7 "const_int_operand")] ;; mod_f ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ emit_insn (gen_atomic_cas_value_strong (operands[1], operands[2], ++ operands[3], operands[4], ++ operands[6], operands[7])); ++ ++ rtx val = gen_reg_rtx (SImode); ++ if (operands[1] != const0_rtx) ++ emit_move_insn (val, gen_rtx_SIGN_EXTEND (SImode, operands[1])); ++ else ++ emit_move_insn (val, const0_rtx); ++ ++ rtx exp = gen_reg_rtx (SImode); ++ if (operands[3] != const0_rtx) ++ emit_move_insn (exp, gen_rtx_SIGN_EXTEND (SImode, operands[3])); ++ else ++ emit_move_insn (exp, const0_rtx); ++ ++ rtx compare = val; ++ if (exp != const0_rtx) ++ { ++ rtx difference = gen_rtx_MINUS (SImode, val, exp); ++ compare = gen_reg_rtx (SImode); ++ emit_move_insn (compare, difference); ++ } ++ ++ if (word_mode != SImode) ++ { ++ rtx reg = gen_reg_rtx (word_mode); ++ emit_move_insn (reg, gen_rtx_SIGN_EXTEND (word_mode, compare)); ++ compare = reg; ++ } ++ ++ emit_move_insn (operands[0], gen_rtx_EQ (SImode, compare, const0_rtx)); ++ DONE; ++}) ++ ++(define_expand "atomic_cas_value_strong" ++ [(match_operand:SHORT 0 "register_operand") ;; val output ++ (match_operand:SHORT 1 "memory_operand") ;; memory ++ (match_operand:SHORT 2 "reg_or_0_operand") ;; expected value ++ (match_operand:SHORT 3 "reg_or_0_operand") ;; desired value ++ (match_operand:SI 4 "const_int_operand") ;; mod_s ++ (match_operand:SI 5 "const_int_operand") ;; mod_f ++ (match_scratch:SHORT 6)] ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++{ ++ /* We have no QImode/HImode atomics, so form a mask, then use ++ subword_atomic_cas_strong to implement a LR/SC version of the ++ operation. */ ++ ++ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining ++ is disabled */ ++ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ rtx mask = gen_reg_rtx (SImode); ++ rtx not_mask = gen_reg_rtx (SImode); ++ ++ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask); ++ ++ rtx o = operands[2]; ++ rtx n = operands[3]; ++ rtx shifted_o = gen_reg_rtx (SImode); ++ rtx shifted_n = gen_reg_rtx (SImode); ++ ++ riscv_lshift_subword (mode, o, shift, &shifted_o); ++ riscv_lshift_subword (mode, n, shift, &shifted_n); ++ ++ emit_move_insn (shifted_o, gen_rtx_AND (SImode, shifted_o, mask)); ++ emit_move_insn (shifted_n, gen_rtx_AND (SImode, shifted_n, mask)); ++ ++ emit_insn (gen_subword_atomic_cas_strong (old, aligned_mem, ++ shifted_o, shifted_n, ++ mask, not_mask)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, ++ gen_lowpart (QImode, shift))); ++ ++ emit_move_insn (operands[0], gen_lowpart (mode, old)); ++ ++ DONE; ++}) ++ ++(define_insn "subword_atomic_cas_strong" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem ++ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location ++ (set (match_dup 1) ++ (unspec_volatile:SI [(match_operand:SI 2 "reg_or_0_operand" "rJ") ;; expected value ++ (match_operand:SI 3 "reg_or_0_operand" "rJ")] ;; desired value ++ UNSPEC_COMPARE_AND_SWAP_SUBWORD)) ++ (match_operand:SI 4 "register_operand" "rI") ;; mask ++ (match_operand:SI 5 "register_operand" "rI") ;; not_mask ++ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_1 ++ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC" ++ { ++ return "1:\;" ++ "lr.w.aq\t%0, %1\;" ++ "and\t%6, %0, %4\;" ++ "bne\t%6, %z2, 1f\;" ++ "and\t%6, %0, %5\;" ++ "or\t%6, %6, %3\;" ++ "sc.w.rl\t%6, %6, %1\;" ++ "bnez\t%6, 1b\;" ++ "1:"; ++ } ++ [(set (attr "length") (const_int 28))]) ++ + (define_expand "atomic_test_and_set" + [(match_operand:QI 0 "register_operand" "") ;; bool output + (match_operand:QI 1 "memory_operand" "+A") ;; memory +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -1226,7 +1226,8 @@ See RS/6000 and PowerPC Options. + -mbig-endian -mlittle-endian + -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} + -mstack-protector-guard-offset=@var{offset} +--mcsr-check -mno-csr-check} ++-mcsr-check -mno-csr-check ++-minline-atomics -mno-inline-atomics} + + @emph{RL78 Options} + @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs +@@ -29006,6 +29007,13 @@ Do or don't use smaller but slower prolo + library function calls. The default is to use fast inline prologues and + epilogues. + ++@opindex minline-atomics ++@item -minline-atomics ++@itemx -mno-inline-atomics ++Do or don't use smaller but slower subword atomic emulation code that uses ++libatomic function calls. The default is to use fast inline subword atomics ++that do not require libatomic. ++ + @opindex mshorten-memrefs + @item -mshorten-memrefs + @itemx -mno-shorten-memrefs +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-1.c +@@ -0,0 +1,18 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mno-inline-atomics" } */ ++/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_add_1" } } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_nand_1" } } */ ++/* { dg-final { scan-assembler "\tcall\t__sync_bool_compare_and_swap_1" } } */ ++ ++char foo; ++char bar; ++char baz; ++ ++int ++main () ++{ ++ __sync_fetch_and_add(&foo, 1); ++ __sync_fetch_and_nand(&bar, 1); ++ __sync_bool_compare_and_swap (&baz, 1, 2); ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-2.c +@@ -0,0 +1,9 @@ ++/* { dg-do compile } */ ++/* Verify that subword atomics do not generate calls. */ ++/* { dg-options "-minline-atomics" } */ ++/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_add_1" } } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_nand_1" } } */ ++/* { dg-final { scan-assembler-not "\tcall\t__sync_bool_compare_and_swap_1" } } */ ++ ++#include "inline-atomics-1.c" +\ No newline at end of file +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-3.c +@@ -0,0 +1,569 @@ ++/* Check all char alignments. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-1.c */ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */ ++ ++/* Test the execution of the __atomic_*OP builtin routines for a char. */ ++ ++extern void abort(void); ++ ++char count, res; ++const char init = ~0; ++ ++struct A ++{ ++ char a; ++ char b; ++ char c; ++ char d; ++} __attribute__ ((packed)) A; ++ ++/* The fetch_op routines return the original value before the operation. */ ++ ++void ++test_fetch_add (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5) ++ abort (); ++} ++ ++ ++void ++test_fetch_sub (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--) ++ abort (); ++} ++ ++void ++test_fetch_and (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_fetch_nand (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 ) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_xor (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_or (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31) ++ abort (); ++} ++ ++/* The OP_fetch routines return the new value after the operation. */ ++ ++void ++test_add_fetch (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6) ++ abort (); ++} ++ ++ ++void ++test_sub_fetch (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res) ++ abort (); ++} ++ ++void ++test_and_fetch (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ *v = init; ++ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_nand_fetch (char* v) ++{ ++ *v = init; ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor_fetch (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_or_fetch (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63) ++ abort (); ++} ++ ++ ++/* Test the OP routines with a result which isn't used. Use both variations ++ within each function. */ ++ ++void ++test_add (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_add_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_CONSUME); ++ if (*v != 2) ++ abort (); ++ ++ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE); ++ if (*v != 3) ++ abort (); ++ ++ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE); ++ if (*v != 4) ++ abort (); ++ ++ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 5) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 6) ++ abort (); ++} ++ ++ ++void ++test_sub (char* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST); ++ if (*v != --res) ++ abort (); ++} ++ ++void ++test_and (char* v) ++{ ++ *v = init; ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED); ++ if (*v != 0) ++ abort (); ++ ++ *v = init; ++ __atomic_fetch_and (v, init, __ATOMIC_CONSUME); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, init, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_nand (char* v) ++{ ++ *v = init; ++ ++ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor (char* v) ++{ ++ *v = init; ++ count = 0; ++ ++ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_or (char* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_or_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_CONSUME); ++ if (*v != 3) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE); ++ if (*v != 7) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE); ++ if (*v != 15) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 31) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 63) ++ abort (); ++} ++ ++int ++main () ++{ ++ char* V[] = {&A.a, &A.b, &A.c, &A.d}; ++ ++ for (int i = 0; i < 4; i++) { ++ test_fetch_add (V[i]); ++ test_fetch_sub (V[i]); ++ test_fetch_and (V[i]); ++ test_fetch_nand (V[i]); ++ test_fetch_xor (V[i]); ++ test_fetch_or (V[i]); ++ ++ test_add_fetch (V[i]); ++ test_sub_fetch (V[i]); ++ test_and_fetch (V[i]); ++ test_nand_fetch (V[i]); ++ test_xor_fetch (V[i]); ++ test_or_fetch (V[i]); ++ ++ test_add (V[i]); ++ test_sub (V[i]); ++ test_and (V[i]); ++ test_nand (V[i]); ++ test_xor (V[i]); ++ test_or (V[i]); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-4.c +@@ -0,0 +1,566 @@ ++/* Check all short alignments. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-2.c */ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */ ++ ++/* Test the execution of the __atomic_*OP builtin routines for a short. */ ++ ++extern void abort(void); ++ ++short count, res; ++const short init = ~0; ++ ++struct A ++{ ++ short a; ++ short b; ++} __attribute__ ((packed)) A; ++ ++/* The fetch_op routines return the original value before the operation. */ ++ ++void ++test_fetch_add (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3) ++ abort (); ++ ++ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4) ++ abort (); ++ ++ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5) ++ abort (); ++} ++ ++ ++void ++test_fetch_sub (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--) ++ abort (); ++ ++ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--) ++ abort (); ++} ++ ++void ++test_fetch_and (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_fetch_nand (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 ) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_xor (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++void ++test_fetch_or (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31) ++ abort (); ++} ++ ++/* The OP_fetch routines return the new value after the operation. */ ++ ++void ++test_add_fetch (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3) ++ abort (); ++ ++ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5) ++ abort (); ++ ++ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6) ++ abort (); ++} ++ ++ ++void ++test_sub_fetch (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res) ++ abort (); ++ ++ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res) ++ abort (); ++} ++ ++void ++test_and_fetch (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0) ++ abort (); ++ ++ *v = init; ++ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0) ++ abort (); ++ ++ *v = ~*v; ++ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_nand_fetch (short* v) ++{ ++ *v = init; ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor_fetch (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init) ++ abort (); ++ ++ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0) ++ abort (); ++} ++ ++void ++test_or_fetch (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31) ++ abort (); ++ ++ count *= 2; ++ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63) ++ abort (); ++} ++ ++ ++/* Test the OP routines with a result which isn't used. Use both variations ++ within each function. */ ++ ++void ++test_add (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_add_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_CONSUME); ++ if (*v != 2) ++ abort (); ++ ++ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE); ++ if (*v != 3) ++ abort (); ++ ++ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE); ++ if (*v != 4) ++ abort (); ++ ++ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 5) ++ abort (); ++ ++ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 6) ++ abort (); ++} ++ ++ ++void ++test_sub (short* v) ++{ ++ *v = res = 20; ++ count = 0; ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL); ++ if (*v != --res) ++ abort (); ++ ++ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST); ++ if (*v != --res) ++ abort (); ++} ++ ++void ++test_and (short* v) ++{ ++ *v = init; ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED); ++ if (*v != 0) ++ abort (); ++ ++ *v = init; ++ __atomic_fetch_and (v, init, __ATOMIC_CONSUME); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, init, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != 0) ++ abort (); ++ ++ *v = ~*v; ++ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_nand (short* v) ++{ ++ *v = init; ++ ++ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST); ++ if (*v != init) ++ abort (); ++} ++ ++ ++ ++void ++test_xor (short* v) ++{ ++ *v = init; ++ count = 0; ++ ++ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE); ++ if (*v != 0) ++ abort (); ++ ++ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE); ++ if (*v != init) ++ abort (); ++ ++ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL); ++ if (*v != init) ++ abort (); ++ ++ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST); ++ if (*v != 0) ++ abort (); ++} ++ ++void ++test_or (short* v) ++{ ++ *v = 0; ++ count = 1; ++ ++ __atomic_or_fetch (v, count, __ATOMIC_RELAXED); ++ if (*v != 1) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_CONSUME); ++ if (*v != 3) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE); ++ if (*v != 7) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE); ++ if (*v != 15) ++ abort (); ++ ++ count *= 2; ++ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL); ++ if (*v != 31) ++ abort (); ++ ++ count *= 2; ++ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST); ++ if (*v != 63) ++ abort (); ++} ++ ++int ++main () { ++ short* V[] = {&A.a, &A.b}; ++ ++ for (int i = 0; i < 2; i++) { ++ test_fetch_add (V[i]); ++ test_fetch_sub (V[i]); ++ test_fetch_and (V[i]); ++ test_fetch_nand (V[i]); ++ test_fetch_xor (V[i]); ++ test_fetch_or (V[i]); ++ ++ test_add_fetch (V[i]); ++ test_sub_fetch (V[i]); ++ test_and_fetch (V[i]); ++ test_nand_fetch (V[i]); ++ test_xor_fetch (V[i]); ++ test_or_fetch (V[i]); ++ ++ test_add (V[i]); ++ test_sub (V[i]); ++ test_and (V[i]); ++ test_nand (V[i]); ++ test_xor (V[i]); ++ test_or (V[i]); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-5.c +@@ -0,0 +1,87 @@ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_compare_exchange_n builtin for a char. */ ++ ++extern void abort(void); ++ ++char v = 0; ++char expected = 0; ++char max = ~0; ++char desired = ~0; ++char zero = 0; ++ ++#define STRONG 0 ++#define WEAK 1 ++ ++int ++main () ++{ ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ /* Now test the generic version. */ ++ ++ v = 0; ++ ++ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-6.c +@@ -0,0 +1,87 @@ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_compare_exchange_n builtin for a short. */ ++ ++extern void abort(void); ++ ++short v = 0; ++short expected = 0; ++short max = ~0; ++short desired = ~0; ++short zero = 0; ++ ++#define STRONG 0 ++#define WEAK 1 ++ ++int ++main () ++{ ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ /* Now test the generic version. */ ++ ++ v = 0; ++ ++ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) ++ abort (); ++ if (expected != max) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != max) ++ abort (); ++ if (v != 0) ++ abort (); ++ ++ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ ++ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ abort (); ++ if (expected != 0) ++ abort (); ++ if (v != max) ++ abort (); ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-7.c +@@ -0,0 +1,69 @@ ++/* Test __atomic routines for existence and proper execution on 1 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-1.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_exchange_n builtin for a char. */ ++ ++extern void abort(void); ++ ++char v, count, ret; ++ ++int ++main () ++{ ++ v = 0; ++ count = 0; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) ++ abort (); ++ count++; ++ ++ /* Now test the generic version. */ ++ ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ return 0; ++} +--- /dev/null ++++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-8.c +@@ -0,0 +1,69 @@ ++/* Test __atomic routines for existence and proper execution on 2 byte ++ values with each valid memory model. */ ++/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-2.c */ ++/* { dg-do run } */ ++/* { dg-options "-minline-atomics" } */ ++ ++/* Test the execution of the __atomic_X builtin for a short. */ ++ ++extern void abort(void); ++ ++short v, count, ret; ++ ++int ++main () ++{ ++ v = 0; ++ count = 0; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) ++ abort (); ++ count++; ++ ++ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) ++ abort (); ++ count++; ++ ++ /* Now test the generic version. */ ++ ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); ++ if (ret != count - 1 || v != count) ++ abort (); ++ count++; ++ ++ return 0; ++} +--- a/libgcc/config/riscv/atomic.c ++++ b/libgcc/config/riscv/atomic.c +@@ -30,6 +30,8 @@ see the files COPYING3 and COPYING.RUNTI + #define INVERT "not %[tmp1], %[tmp1]\n\t" + #define DONT_INVERT "" + ++/* Logic duplicated in gcc/gcc/config/riscv/sync.md for use when inlining is enabled */ ++ + #define GENERATE_FETCH_AND_OP(type, size, opname, insn, invert, cop) \ + type __sync_fetch_and_ ## opname ## _ ## size (type *p, type v) \ + { \ diff --git a/toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch b/toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch new file mode 100644 index 00000000000000..328c7be9ce8ec4 --- /dev/null +++ b/toolchain/gcc/patches-13.x/701-riscv-linux-Don-t-add-latomic-with-pthread.patch @@ -0,0 +1,36 @@ +From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Sat, 23 Apr 2022 15:48:42 +0200 +Subject: [PATCH] riscv/linux: Don't add -latomic with -pthread + +Now that we have support for inline subword atomic operations, it is no +longer necessary to link against libatomic. This also fixes testsuite +failures because the framework does not properly set up the linker flags +for finding libatomic. +The use of atomic operations is also independent of the use of libpthread. + +gcc/ + * config/riscv/linux.h (LIB_SPEC): Don't redefine. +--- + gcc/config/riscv/linux.h | 10 ---------- + 1 file changed, 10 deletions(-) + +--- a/gcc/config/riscv/linux.h ++++ b/gcc/config/riscv/linux.h +@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3. + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" + +-/* Because RISC-V only has word-sized atomics, it requries libatomic where +- others do not. So link libatomic by default, as needed. */ +-#undef LIB_SPEC +-#ifdef LD_AS_NEEDED_OPTION +-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \ +- " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}" +-#else +-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic " +-#endif +- + #define ICACHE_FLUSH_FUNC "__riscv_flush_icache" + + #define CPP_SPEC "%{pthread:-D_REENTRANT}" diff --git a/toolchain/gcc/patches-13.x/910-mbsd_multi.patch b/toolchain/gcc/patches-13.x/910-mbsd_multi.patch index 095fc62f69e07c..8af05c99946acf 100644 --- a/toolchain/gcc/patches-13.x/910-mbsd_multi.patch +++ b/toolchain/gcc/patches-13.x/910-mbsd_multi.patch @@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 ; On SVR4 targets, it also controls whether or not to emit a --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi -@@ -10061,6 +10061,17 @@ This option is only supported for C and +@@ -10062,6 +10062,17 @@ This option is only supported for C and @option{-Wall} and by @option{-Wpedantic}, which can be disabled with @option{-Wno-pointer-sign}. From 55993f1fc13c415a4b5a70c69d5586421bad9073 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Mon, 12 Jun 2023 21:22:52 +0200 Subject: [PATCH 0202/1171] CI: labeler: add sifiveu target Add support for 'sifiveu' target and its specific packages in labeler. Signed-off-by: Piotr Dymacz (cherry picked from commit 92b8b18c2685e9e509d2b8b797de7e03424d17d1) --- .github/labeler.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 6303fdf7b72480..6d53d581063726 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -94,6 +94,10 @@ - "target/linux/rockchip/**" - "package/boot/arm-trusted-firmware-rockchip/**" - "package/boot/uboot-rockchip/**" +"target/sifiveu": + - "target/linux/sifiveu/**" + - "package/boot/uboot-sifiveu/**" + - "package/boot/opensbi/**" "target/sunxi": - "target/linux/sunxi/**" - "package/boot/arm-trusted-firmware-sunxi/**" From 11ad38f0bb5e3a34bd328a299e61d49b84b326b2 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 16 Jun 2023 11:32:52 +0200 Subject: [PATCH 0203/1171] Revert "ipq806x: disable cache and fabric devfreq driver to improve stability" This reverts commit 60fc93b35935a88b1e31d853a0abacf0847d8de4. Reenable devfreq and revert for both 5.15 and 6.1. Signed-off-by: Christian Marangi (cherry picked from commit 37e459321360aab13ed89647ed5c5033281047ae) --- target/linux/ipq806x/config-5.15 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 286f327e39da3c..720e3236a35d88 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -35,8 +35,8 @@ CONFIG_ARM_CPU_SUSPEND=y CONFIG_ARM_CRYPTO=y CONFIG_ARM_GIC=y CONFIG_ARM_HAS_SG_CHAIN=y -# CONFIG_ARM_IPQ806X_FAB_DEVFREQ is not set -# CONFIG_ARM_KRAIT_CACHE_DEVFREQ is not set +CONFIG_ARM_IPQ806X_FAB_DEVFREQ=y +CONFIG_ARM_KRAIT_CACHE_DEVFREQ=y CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_ARM_L1_CACHE_SHIFT_6=y CONFIG_ARM_PATCH_IDIV=y From 6f9495b896f53172855cd015ac4024f6b7758e0a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 16 Jun 2023 11:18:05 +0200 Subject: [PATCH 0204/1171] ipq806x: set PERFORMANCE as the default cpufreq governor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move default cpufreq governor from ONDEMAND to PERFORMANCE. The temp increase is just 2°C and Watt usage the change is minimal in the order of additional millwatt. The SoC and krait in general looks to suffer for some problem with cache scaling. To have better system stability, force cpu freq and cache freq to the max value supported by the system. This follows mvebu platform where cpufreq is broken and cause minimal temp/watt increase. User can still tweak the governor to ondemand using sysfs entry if needed. Signed-off-by: Christian Marangi (cherry picked from commit 6f5ea752d7c95ba426ca21a6588cae8812bb3e7c) --- target/linux/ipq806x/config-5.15 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 720e3236a35d88..25d63f8b04cb06 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -71,8 +71,8 @@ CONFIG_CPU_COPY_V6=y CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y # CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set From 68bc059c55ee71d273fc7d00eddd96f97dcc50d5 Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 6 Jun 2023 10:45:47 -0400 Subject: [PATCH 0205/1171] kernel: bump 5.15 to 5.15.115 Manually rebased: backport-5.15/603-v5.19-page_pool-Add-recycle-stats-to-page_pool_put_page_bu.patch pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch* Removed upstreamed: generic-backport/610-v6.3-net-page_pool-use-in_softirq-instead.patch[1] backport-5.15/705-12-v6.0-net-dsa-mt7530-rework-mt753-01-_setup.patch[2] backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch[3] backport-5.15/703-10-v5.16-net-dsa-introduce-helpers-for-iterating-through-port.patch[4] All other patches automatically rebased. * Modified to define the variable i as suggested by DragonBluep in PR discussion. See: https://github.com/openwrt/openwrt/pull/12823#issuecomment-1578518576 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.115&id=3af319d5147454dc63665ef451229c674b538377 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.115&id=0753c1ef24194580f7165ae6e259b59a851392f2 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.115&id=5a7266feaa6d708fc6880a161786eaa884ef3c8e 4. https://github.com/gregkh/linux/commit/9902f91cf666124a6b50bbcf483b46ecb09ef408 Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia (cherry picked from commit 5714660643e9170920be2abbb2297d9aac0b9533) --- include/kernel-5.15 | 4 +- ...v5.18-page_pool-Add-allocation-stats.patch | 16 +- ...01-v5.18-page_pool-Add-recycle-stats.patch | 14 +- ...d-function-to-batch-and-return-stats.patch | 2 +- ...cycle-stats-to-page_pool_put_page_bu.patch | 10 +- ...et-page_pool-introduce-ethtool-stats.patch | 6 +- ...gs-support-to-xdp_return_-buff-frame.patch | 6 +- ...net-page_pool-use-in_softirq-instead.patch | 56 ------- ...uce-tagger-owned-storage-for-private.patch | 2 +- ...populate-supported_interfaces-member.patch | 2 +- ...phylink_get_interfaces-with-phylink_.patch | 2 +- ...d-support-for-phylink-mac_select_pcs.patch | 2 +- ...e-helpers-for-iterating-through-port.patch | 68 --------- ...opulate-supported_interfaces-and-mac.patch | 16 +- ...t-dsa-mt7530-remove-interface-checks.patch | 16 +- ...rop-use-of-phylink_helper_basex_spee.patch | 2 +- ...nly-indicate-linkmodes-that-can-be-s.patch | 6 +- ...-switch-to-use-phylink_get_linkmodes.patch | 12 +- ...530-partially-convert-to-phylink_pcs.patch | 30 ++-- ...ove-autoneg-handling-to-PCS-validati.patch | 6 +- ...19-net-dsa-mt7530-mark-as-non-legacy.patch | 2 +- ...mt753x-fix-pcs-conversion-regression.patch | 4 +- ...et-dsa-mt7530-rework-mt753-01-_setup.patch | 75 --------- ...-add-support-for-in-band-link-status.patch | 12 +- ...t-dsa-mt7530-use-external-PCS-driver.patch | 20 +-- ...a-mt7530-refactor-SGMII-PCS-creation.patch | 4 +- ...mt7530-use-unlocked-regmap-accessors.patch | 6 +- ...se-regmap-to-access-switch-register-.patch | 10 +- ...ove-SGMII-PCS-creation-to-mt7530_pro.patch | 6 +- ...ntroduce-mt7530_probe_common-helper-.patch | 6 +- ...ntroduce-mt7530_remove_common-helper.patch | 4 +- ...plit-off-common-parts-from-mt7531_se.patch | 143 ------------------ ...t7530-introduce-separate-MDIO-driver.patch | 12 +- ...ntroduce-driver-for-MT7988-built-in-.patch | 14 +- ...-dsa-mt7530-fix-support-for-MT7531BE.patch | 2 +- ...e-all-MACs-are-powered-down-before-r.patch | 15 +- 36 files changed, 140 insertions(+), 473 deletions(-) delete mode 100644 target/linux/generic/backport-5.15/610-v6.3-net-page_pool-use-in_softirq-instead.patch delete mode 100644 target/linux/generic/backport-5.15/703-10-v5.16-net-dsa-introduce-helpers-for-iterating-through-port.patch delete mode 100644 target/linux/generic/backport-5.15/705-12-v6.0-net-dsa-mt7530-rework-mt753-01-_setup.patch delete mode 100644 target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 4c18bc35c2258c..b8b89583b41be3 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .114 -LINUX_KERNEL_HASH-5.15.114 = e981ea5d219f77735bf5a3f7e84a8af578df8ac3e1c4ff1b0649e2b0795277d2 +LINUX_VERSION-5.15 = .115 +LINUX_KERNEL_HASH-5.15.115 = 1b076860779235e90519e867c1ec78c7a34d1125d8fdba787ff495c7c14f1214 diff --git a/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch b/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch index 9e383de92cda6c..f4c5b9afee4dd9 100644 --- a/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch +++ b/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch @@ -87,9 +87,9 @@ Signed-off-by: David S. Miller help --- a/net/core/page_pool.c +++ b/net/core/page_pool.c -@@ -26,6 +26,13 @@ - - #define BIAS_MAX LONG_MAX +@@ -49,6 +49,13 @@ static void page_pool_producer_unlock(st + spin_unlock_bh(&pool->ring.producer_lock); + } +#ifdef CONFIG_PAGE_POOL_STATS +/* alloc_stat_inc is intended to be used in softirq context */ @@ -101,7 +101,7 @@ Signed-off-by: David S. Miller static int page_pool_init(struct page_pool *pool, const struct page_pool_params *params) { -@@ -117,8 +124,10 @@ static struct page *page_pool_refill_all +@@ -140,8 +147,10 @@ static struct page *page_pool_refill_all int pref_nid; /* preferred NUMA node */ /* Quicker fallback, avoid locks when ring is empty */ @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller /* Softirq guarantee CPU and thus NUMA node is stable. This, * assumes CPU refilling driver RX-ring will also run RX-NAPI. -@@ -148,14 +157,17 @@ static struct page *page_pool_refill_all +@@ -171,14 +180,17 @@ static struct page *page_pool_refill_all * This limit stress on page buddy alloactor. */ page_pool_return_page(pool, page); @@ -132,7 +132,7 @@ Signed-off-by: David S. Miller spin_unlock(&r->consumer_lock); return page; -@@ -170,6 +182,7 @@ static struct page *__page_pool_get_cach +@@ -193,6 +205,7 @@ static struct page *__page_pool_get_cach if (likely(pool->alloc.count)) { /* Fast-path */ page = pool->alloc.cache[--pool->alloc.count]; @@ -140,7 +140,7 @@ Signed-off-by: David S. Miller } else { page = page_pool_refill_alloc_cache(pool); } -@@ -241,6 +254,7 @@ static struct page *__page_pool_alloc_pa +@@ -264,6 +277,7 @@ static struct page *__page_pool_alloc_pa return NULL; } @@ -148,7 +148,7 @@ Signed-off-by: David S. Miller page_pool_set_pp_info(pool, page); /* Track how many pages are held 'in-flight' */ -@@ -295,10 +309,12 @@ static struct page *__page_pool_alloc_pa +@@ -318,10 +332,12 @@ static struct page *__page_pool_alloc_pa } /* Return last page */ diff --git a/target/linux/generic/backport-5.15/601-v5.18-page_pool-Add-recycle-stats.patch b/target/linux/generic/backport-5.15/601-v5.18-page_pool-Add-recycle-stats.patch index fb11f0035f863b..b425b78c7530c5 100644 --- a/target/linux/generic/backport-5.15/601-v5.18-page_pool-Add-recycle-stats.patch +++ b/target/linux/generic/backport-5.15/601-v5.18-page_pool-Add-recycle-stats.patch @@ -53,7 +53,7 @@ Signed-off-by: David S. Miller /* A page_pool is strictly tied to a single RX-queue being --- a/net/core/page_pool.c +++ b/net/core/page_pool.c -@@ -29,8 +29,15 @@ +@@ -52,8 +52,15 @@ static void page_pool_producer_unlock(st #ifdef CONFIG_PAGE_POOL_STATS /* alloc_stat_inc is intended to be used in softirq context */ #define alloc_stat_inc(pool, __stat) (pool->alloc_stats.__stat++) @@ -69,7 +69,7 @@ Signed-off-by: David S. Miller #endif static int page_pool_init(struct page_pool *pool, -@@ -80,6 +87,12 @@ static int page_pool_init(struct page_po +@@ -103,6 +110,12 @@ static int page_pool_init(struct page_po pool->p.flags & PP_FLAG_PAGE_FRAG) return -EINVAL; @@ -82,7 +82,7 @@ Signed-off-by: David S. Miller if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) return -ENOMEM; -@@ -412,7 +425,12 @@ static bool page_pool_recycle_in_ring(st +@@ -435,7 +448,12 @@ static bool page_pool_recycle_in_ring(st else ret = ptr_ring_produce_bh(&pool->ring, page); @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller } /* Only allow direct recycling in special circumstances, into the -@@ -423,11 +441,14 @@ static bool page_pool_recycle_in_ring(st +@@ -446,11 +464,14 @@ static bool page_pool_recycle_in_ring(st static bool page_pool_recycle_in_cache(struct page *page, struct page_pool *pool) { @@ -112,7 +112,7 @@ Signed-off-by: David S. Miller return true; } -@@ -482,6 +503,7 @@ __page_pool_put_page(struct page_pool *p +@@ -505,6 +526,7 @@ __page_pool_put_page(struct page_pool *p * doing refcnt based recycle tricks, meaning another process * will be invoking put_page. */ @@ -120,7 +120,7 @@ Signed-off-by: David S. Miller /* Do not replace this with page_pool_return_page() */ page_pool_release_page(pool, page); put_page(page); -@@ -495,6 +517,7 @@ void page_pool_put_page(struct page_pool +@@ -518,6 +540,7 @@ void page_pool_put_page(struct page_pool page = __page_pool_put_page(pool, page, dma_sync_size, allow_direct); if (page && !page_pool_recycle_in_ring(pool, page)) { /* Cache full, fallback to free pages */ @@ -128,7 +128,7 @@ Signed-off-by: David S. Miller page_pool_return_page(pool, page); } } -@@ -641,6 +664,9 @@ static void page_pool_free(struct page_p +@@ -665,6 +688,9 @@ static void page_pool_free(struct page_p if (pool->p.flags & PP_FLAG_DMA_MAP) put_device(pool->p.dev); diff --git a/target/linux/generic/backport-5.15/602-v5.18-page_pool-Add-function-to-batch-and-return-stats.patch b/target/linux/generic/backport-5.15/602-v5.18-page_pool-Add-function-to-batch-and-return-stats.patch index 41188fb7f2792c..e1a7635133cd15 100644 --- a/target/linux/generic/backport-5.15/602-v5.18-page_pool-Add-function-to-batch-and-return-stats.patch +++ b/target/linux/generic/backport-5.15/602-v5.18-page_pool-Add-function-to-batch-and-return-stats.patch @@ -43,7 +43,7 @@ Signed-off-by: David S. Miller struct page_pool { --- a/net/core/page_pool.c +++ b/net/core/page_pool.c -@@ -35,6 +35,31 @@ +@@ -58,6 +58,31 @@ static void page_pool_producer_unlock(st struct page_pool_recycle_stats __percpu *s = pool->recycle_stats; \ this_cpu_inc(s->__stat); \ } while (0) diff --git a/target/linux/generic/backport-5.15/603-v5.19-page_pool-Add-recycle-stats-to-page_pool_put_page_bu.patch b/target/linux/generic/backport-5.15/603-v5.19-page_pool-Add-recycle-stats-to-page_pool_put_page_bu.patch index 6ae3fb71331b1b..f438ef3a599794 100644 --- a/target/linux/generic/backport-5.15/603-v5.19-page_pool-Add-recycle-stats-to-page_pool_put_page_bu.patch +++ b/target/linux/generic/backport-5.15/603-v5.19-page_pool-Add-recycle-stats-to-page_pool_put_page_bu.patch @@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/page_pool.c +++ b/net/core/page_pool.c -@@ -36,6 +36,12 @@ +@@ -59,6 +59,12 @@ static void page_pool_producer_unlock(st this_cpu_inc(s->__stat); \ } while (0) @@ -29,7 +29,7 @@ Signed-off-by: Paolo Abeni bool page_pool_get_stats(struct page_pool *pool, struct page_pool_stats *stats) { -@@ -63,6 +69,7 @@ EXPORT_SYMBOL(page_pool_get_stats); +@@ -86,6 +92,7 @@ EXPORT_SYMBOL(page_pool_get_stats); #else #define alloc_stat_inc(pool, __stat) #define recycle_stat_inc(pool, __stat) @@ -37,9 +37,9 @@ Signed-off-by: Paolo Abeni #endif static int page_pool_init(struct page_pool *pool, -@@ -569,9 +576,13 @@ void page_pool_put_page_bulk(struct page +@@ -593,9 +600,13 @@ void page_pool_put_page_bulk(struct page /* Bulk producer into ptr_ring page_pool cache */ - page_pool_ring_lock(pool); + in_softirq = page_pool_producer_lock(pool); for (i = 0; i < bulk_len; i++) { - if (__ptr_ring_produce(&pool->ring, data[i])) - break; /* ring full */ @@ -50,6 +50,6 @@ Signed-off-by: Paolo Abeni + } } + recycle_stat_add(pool, ring, i); - page_pool_ring_unlock(pool); + page_pool_producer_unlock(pool, in_softirq); /* Hopefully all pages was return into ptr_ring */ diff --git a/target/linux/generic/backport-5.15/604-v5.19-net-page_pool-introduce-ethtool-stats.patch b/target/linux/generic/backport-5.15/604-v5.19-net-page_pool-introduce-ethtool-stats.patch index e5cf91ceeede47..3ff136b084265a 100644 --- a/target/linux/generic/backport-5.15/604-v5.19-net-page_pool-introduce-ethtool-stats.patch +++ b/target/linux/generic/backport-5.15/604-v5.19-net-page_pool-introduce-ethtool-stats.patch @@ -62,7 +62,7 @@ Signed-off-by: David S. Miller #include -@@ -42,6 +43,20 @@ +@@ -65,6 +66,20 @@ static void page_pool_producer_unlock(st this_cpu_add(s->__stat, val); \ } while (0) @@ -83,7 +83,7 @@ Signed-off-by: David S. Miller bool page_pool_get_stats(struct page_pool *pool, struct page_pool_stats *stats) { -@@ -50,7 +65,13 @@ bool page_pool_get_stats(struct page_poo +@@ -73,7 +88,13 @@ bool page_pool_get_stats(struct page_poo if (!stats) return false; @@ -98,7 +98,7 @@ Signed-off-by: David S. Miller for_each_possible_cpu(cpu) { const struct page_pool_recycle_stats *pcpu = -@@ -66,6 +87,46 @@ bool page_pool_get_stats(struct page_poo +@@ -89,6 +110,46 @@ bool page_pool_get_stats(struct page_poo return true; } EXPORT_SYMBOL(page_pool_get_stats); diff --git a/target/linux/generic/backport-5.15/606-v5.18-xdp-add-frags-support-to-xdp_return_-buff-frame.patch b/target/linux/generic/backport-5.15/606-v5.18-xdp-add-frags-support-to-xdp_return_-buff-frame.patch index 86d24367dd69d0..e126b21417f192 100644 --- a/target/linux/generic/backport-5.15/606-v5.18-xdp-add-frags-support-to-xdp_return_-buff-frame.patch +++ b/target/linux/generic/backport-5.15/606-v5.18-xdp-add-frags-support-to-xdp_return_-buff-frame.patch @@ -48,7 +48,7 @@ Signed-off-by: Alexei Starovoitov int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq, --- a/net/core/xdp.c +++ b/net/core/xdp.c -@@ -376,12 +376,38 @@ static void __xdp_return(void *data, str +@@ -409,12 +409,38 @@ static void __xdp_return(void *data, str void xdp_return_frame(struct xdp_frame *xdpf) { @@ -87,7 +87,7 @@ Signed-off-by: Alexei Starovoitov __xdp_return(xdpf->data, &xdpf->mem, true, NULL); } EXPORT_SYMBOL_GPL(xdp_return_frame_rx_napi); -@@ -417,7 +443,7 @@ void xdp_return_frame_bulk(struct xdp_fr +@@ -450,7 +476,7 @@ void xdp_return_frame_bulk(struct xdp_fr struct xdp_mem_allocator *xa; if (mem->type != MEM_TYPE_PAGE_POOL) { @@ -96,7 +96,7 @@ Signed-off-by: Alexei Starovoitov return; } -@@ -436,12 +462,38 @@ void xdp_return_frame_bulk(struct xdp_fr +@@ -469,12 +495,38 @@ void xdp_return_frame_bulk(struct xdp_fr bq->xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params); } diff --git a/target/linux/generic/backport-5.15/610-v6.3-net-page_pool-use-in_softirq-instead.patch b/target/linux/generic/backport-5.15/610-v6.3-net-page_pool-use-in_softirq-instead.patch deleted file mode 100644 index 71e11405958abf..00000000000000 --- a/target/linux/generic/backport-5.15/610-v6.3-net-page_pool-use-in_softirq-instead.patch +++ /dev/null @@ -1,56 +0,0 @@ -From: Qingfang DENG -Date: Fri, 3 Feb 2023 09:16:11 +0800 -Subject: [PATCH] net: page_pool: use in_softirq() instead - -We use BH context only for synchronization, so we don't care if it's -actually serving softirq or not. - -As a side node, in case of threaded NAPI, in_serving_softirq() will -return false because it's in process context with BH off, making -page_pool_recycle_in_cache() unreachable. - -Signed-off-by: Qingfang DENG ---- - ---- a/include/net/page_pool.h -+++ b/include/net/page_pool.h -@@ -357,7 +357,7 @@ static inline void page_pool_nid_changed - static inline void page_pool_ring_lock(struct page_pool *pool) - __acquires(&pool->ring.producer_lock) - { -- if (in_serving_softirq()) -+ if (in_softirq()) - spin_lock(&pool->ring.producer_lock); - else - spin_lock_bh(&pool->ring.producer_lock); -@@ -366,7 +366,7 @@ static inline void page_pool_ring_lock(s - static inline void page_pool_ring_unlock(struct page_pool *pool) - __releases(&pool->ring.producer_lock) - { -- if (in_serving_softirq()) -+ if (in_softirq()) - spin_unlock(&pool->ring.producer_lock); - else - spin_unlock_bh(&pool->ring.producer_lock); ---- a/net/core/page_pool.c -+++ b/net/core/page_pool.c -@@ -512,8 +512,8 @@ static void page_pool_return_page(struct - static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page) - { - int ret; -- /* BH protection not needed if current is serving softirq */ -- if (in_serving_softirq()) -+ /* BH protection not needed if current is softirq */ -+ if (in_softirq()) - ret = ptr_ring_produce(&pool->ring, page); - else - ret = ptr_ring_produce_bh(&pool->ring, page); -@@ -576,7 +576,7 @@ __page_pool_put_page(struct page_pool *p - page_pool_dma_sync_for_device(pool, page, - dma_sync_size); - -- if (allow_direct && in_serving_softirq() && -+ if (allow_direct && in_softirq() && - page_pool_recycle_in_cache(page, pool)) - return NULL; - diff --git a/target/linux/generic/backport-5.15/700-v5.17-net-dsa-introduce-tagger-owned-storage-for-private.patch b/target/linux/generic/backport-5.15/700-v5.17-net-dsa-introduce-tagger-owned-storage-for-private.patch index f2b651f0c6134d..f56a9685895691 100644 --- a/target/linux/generic/backport-5.15/700-v5.17-net-dsa-introduce-tagger-owned-storage-for-private.patch +++ b/target/linux/generic/backport-5.15/700-v5.17-net-dsa-introduce-tagger-owned-storage-for-private.patch @@ -94,7 +94,7 @@ Signed-off-by: David S. Miller /* * Configuration data for this switch. */ -@@ -584,6 +589,13 @@ struct dsa_switch_ops { +@@ -612,6 +617,13 @@ struct dsa_switch_ops { enum dsa_tag_protocol mprot); int (*change_tag_protocol)(struct dsa_switch *ds, int port, enum dsa_tag_protocol proto); diff --git a/target/linux/generic/backport-5.15/703-03-v5.16-net-dsa-populate-supported_interfaces-member.patch b/target/linux/generic/backport-5.15/703-03-v5.16-net-dsa-populate-supported_interfaces-member.patch index b10e6da0e9a79d..b4387865363f71 100644 --- a/target/linux/generic/backport-5.15/703-03-v5.16-net-dsa-populate-supported_interfaces-member.patch +++ b/target/linux/generic/backport-5.15/703-03-v5.16-net-dsa-populate-supported_interfaces-member.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller --- a/include/net/dsa.h +++ b/include/net/dsa.h -@@ -626,6 +626,8 @@ struct dsa_switch_ops { +@@ -654,6 +654,8 @@ struct dsa_switch_ops { /* * PHYLINK integration */ diff --git a/target/linux/generic/backport-5.15/703-05-v5.17-net-dsa-replace-phylink_get_interfaces-with-phylink_.patch b/target/linux/generic/backport-5.15/703-05-v5.17-net-dsa-replace-phylink_get_interfaces-with-phylink_.patch index d70b9aa6a47195..1d9616c0db7f7b 100644 --- a/target/linux/generic/backport-5.15/703-05-v5.17-net-dsa-replace-phylink_get_interfaces-with-phylink_.patch +++ b/target/linux/generic/backport-5.15/703-05-v5.17-net-dsa-replace-phylink_get_interfaces-with-phylink_.patch @@ -24,7 +24,7 @@ Signed-off-by: Jakub Kicinski --- a/include/net/dsa.h +++ b/include/net/dsa.h -@@ -626,8 +626,8 @@ struct dsa_switch_ops { +@@ -654,8 +654,8 @@ struct dsa_switch_ops { /* * PHYLINK integration */ diff --git a/target/linux/generic/backport-5.15/703-06-v5.18-net-dsa-add-support-for-phylink-mac_select_pcs.patch b/target/linux/generic/backport-5.15/703-06-v5.18-net-dsa-add-support-for-phylink-mac_select_pcs.patch index 2af5cb9d9db7b7..9791ad2ac9189a 100644 --- a/target/linux/generic/backport-5.15/703-06-v5.18-net-dsa-add-support-for-phylink-mac_select_pcs.patch +++ b/target/linux/generic/backport-5.15/703-06-v5.18-net-dsa-add-support-for-phylink-mac_select_pcs.patch @@ -16,7 +16,7 @@ Signed-off-by: David S. Miller --- a/include/net/dsa.h +++ b/include/net/dsa.h -@@ -631,6 +631,9 @@ struct dsa_switch_ops { +@@ -659,6 +659,9 @@ struct dsa_switch_ops { void (*phylink_validate)(struct dsa_switch *ds, int port, unsigned long *supported, struct phylink_link_state *state); diff --git a/target/linux/generic/backport-5.15/703-10-v5.16-net-dsa-introduce-helpers-for-iterating-through-port.patch b/target/linux/generic/backport-5.15/703-10-v5.16-net-dsa-introduce-helpers-for-iterating-through-port.patch deleted file mode 100644 index a55623519ce960..00000000000000 --- a/target/linux/generic/backport-5.15/703-10-v5.16-net-dsa-introduce-helpers-for-iterating-through-port.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 82b318983c515f29b8b3a0dad9f6a5fe8a68a7f4 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Wed, 20 Oct 2021 20:49:49 +0300 -Subject: [PATCH] net: dsa: introduce helpers for iterating through ports using - dp - -Since the DSA conversion from the ds->ports array into the dst->ports -list, the DSA API has encouraged driver writers, as well as the core -itself, to write inefficient code. - -Currently, code that wants to filter by a specific type of port when -iterating, like {!unused, user, cpu, dsa}, uses the dsa_is_*_port helper. -Under the hood, this uses dsa_to_port which iterates again through -dst->ports. But the driver iterates through the port list already, so -the complexity is quadratic for the typical case of a single-switch -tree. - -This patch introduces some iteration helpers where the iterator is -already a struct dsa_port *dp, so that the other variant of the -filtering functions, dsa_port_is_{unused,user,cpu_dsa}, can be used -directly on the iterator. This eliminates the second lookup. - -These functions can be used both by the core and by drivers. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - include/net/dsa.h | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - ---- a/include/net/dsa.h -+++ b/include/net/dsa.h -@@ -476,6 +476,34 @@ static inline bool dsa_is_user_port(stru - return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_USER; - } - -+#define dsa_tree_for_each_user_port(_dp, _dst) \ -+ list_for_each_entry((_dp), &(_dst)->ports, list) \ -+ if (dsa_port_is_user((_dp))) -+ -+#define dsa_switch_for_each_port(_dp, _ds) \ -+ list_for_each_entry((_dp), &(_ds)->dst->ports, list) \ -+ if ((_dp)->ds == (_ds)) -+ -+#define dsa_switch_for_each_port_safe(_dp, _next, _ds) \ -+ list_for_each_entry_safe((_dp), (_next), &(_ds)->dst->ports, list) \ -+ if ((_dp)->ds == (_ds)) -+ -+#define dsa_switch_for_each_port_continue_reverse(_dp, _ds) \ -+ list_for_each_entry_continue_reverse((_dp), &(_ds)->dst->ports, list) \ -+ if ((_dp)->ds == (_ds)) -+ -+#define dsa_switch_for_each_available_port(_dp, _ds) \ -+ dsa_switch_for_each_port((_dp), (_ds)) \ -+ if (!dsa_port_is_unused((_dp))) -+ -+#define dsa_switch_for_each_user_port(_dp, _ds) \ -+ dsa_switch_for_each_port((_dp), (_ds)) \ -+ if (dsa_port_is_user((_dp))) -+ -+#define dsa_switch_for_each_cpu_port(_dp, _ds) \ -+ dsa_switch_for_each_port((_dp), (_ds)) \ -+ if (dsa_port_is_cpu((_dp))) -+ - static inline u32 dsa_user_ports(struct dsa_switch *ds) - { - u32 mask = 0; diff --git a/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch b/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch index 435f282845ffb7..f2ead18c36e1f9 100644 --- a/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch +++ b/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch @@ -23,7 +23,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2412,6 +2412,32 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2444,6 +2444,32 @@ mt7531_setup(struct dsa_switch *ds) return 0; } @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni static bool mt7530_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) -@@ -2448,6 +2474,37 @@ static bool mt7531_is_rgmii_port(struct +@@ -2480,6 +2506,37 @@ static bool mt7531_is_rgmii_port(struct return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII); } @@ -94,7 +94,7 @@ Signed-off-by: Paolo Abeni static bool mt7531_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) -@@ -2924,6 +2981,18 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -2956,6 +3013,18 @@ mt7531_cpu_port_config(struct dsa_switch return 0; } @@ -113,7 +113,7 @@ Signed-off-by: Paolo Abeni static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, unsigned long *supported) -@@ -3159,6 +3228,7 @@ static const struct dsa_switch_ops mt753 +@@ -3191,6 +3260,7 @@ static const struct dsa_switch_ops mt753 .port_vlan_del = mt7530_port_vlan_del, .port_mirror_add = mt753x_port_mirror_add, .port_mirror_del = mt753x_port_mirror_del, @@ -121,7 +121,7 @@ Signed-off-by: Paolo Abeni .phylink_validate = mt753x_phylink_validate, .phylink_mac_link_state = mt753x_phylink_mac_link_state, .phylink_mac_config = mt753x_phylink_mac_config, -@@ -3176,6 +3246,7 @@ static const struct mt753x_info mt753x_t +@@ -3208,6 +3278,7 @@ static const struct mt753x_info mt753x_t .phy_read = mt7530_phy_read, .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, @@ -129,7 +129,7 @@ Signed-off-by: Paolo Abeni .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, -@@ -3187,6 +3258,7 @@ static const struct mt753x_info mt753x_t +@@ -3219,6 +3290,7 @@ static const struct mt753x_info mt753x_t .phy_read = mt7530_phy_read, .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, @@ -137,7 +137,7 @@ Signed-off-by: Paolo Abeni .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, -@@ -3199,6 +3271,7 @@ static const struct mt753x_info mt753x_t +@@ -3231,6 +3303,7 @@ static const struct mt753x_info mt753x_t .phy_write = mt7531_ind_phy_write, .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni .phy_mode_supported = mt7531_phy_mode_supported, .mac_port_validate = mt7531_mac_port_validate, .mac_port_get_state = mt7531_phylink_mac_link_state, -@@ -3261,6 +3334,7 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3293,6 +3366,7 @@ mt7530_probe(struct mdio_device *mdiodev */ if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || diff --git a/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch b/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch index 38a24dc46b0db7..228016383d936d 100644 --- a/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch +++ b/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch @@ -21,7 +21,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2438,37 +2438,6 @@ static void mt7530_mac_port_get_caps(str +@@ -2470,37 +2470,6 @@ static void mt7530_mac_port_get_caps(str } } @@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni static bool mt7531_is_rgmii_port(struct mt7530_priv *priv, u32 port) { return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII); -@@ -2505,44 +2474,6 @@ static void mt7531_mac_port_get_caps(str +@@ -2537,44 +2506,6 @@ static void mt7531_mac_port_get_caps(str } } @@ -104,7 +104,7 @@ Signed-off-by: Paolo Abeni static int mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) { -@@ -2797,9 +2728,6 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2829,9 +2760,6 @@ mt753x_phylink_mac_config(struct dsa_swi struct mt7530_priv *priv = ds->priv; u32 mcr_cur, mcr_new; @@ -114,7 +114,7 @@ Signed-off-by: Paolo Abeni switch (port) { case 0 ... 4: /* Internal phy */ if (state->interface != PHY_INTERFACE_MODE_GMII) -@@ -3015,12 +2943,6 @@ mt753x_phylink_validate(struct dsa_switc +@@ -3047,12 +2975,6 @@ mt753x_phylink_validate(struct dsa_switc __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; struct mt7530_priv *priv = ds->priv; @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni phylink_set_port_modes(mask); if (state->interface != PHY_INTERFACE_MODE_TRGMII && -@@ -3247,7 +3169,6 @@ static const struct mt753x_info mt753x_t +@@ -3279,7 +3201,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -135,7 +135,7 @@ Signed-off-by: Paolo Abeni .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, -@@ -3259,7 +3180,6 @@ static const struct mt753x_info mt753x_t +@@ -3291,7 +3212,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -143,7 +143,7 @@ Signed-off-by: Paolo Abeni .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, -@@ -3272,7 +3192,6 @@ static const struct mt753x_info mt753x_t +@@ -3304,7 +3224,6 @@ static const struct mt753x_info mt753x_t .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, @@ -151,7 +151,7 @@ Signed-off-by: Paolo Abeni .mac_port_validate = mt7531_mac_port_validate, .mac_port_get_state = mt7531_phylink_mac_link_state, .mac_port_config = mt7531_mac_config, -@@ -3335,7 +3254,6 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3367,7 +3286,6 @@ mt7530_probe(struct mdio_device *mdiodev if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || diff --git a/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch b/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch index e607a3c7d2cf0c..1a1802a1670470 100644 --- a/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch +++ b/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2967,11 +2967,6 @@ mt753x_phylink_validate(struct dsa_switc +@@ -2999,11 +2999,6 @@ mt753x_phylink_validate(struct dsa_switc linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); diff --git a/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch b/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch index 63a331763030fd..636353c2d64640 100644 --- a/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch +++ b/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch @@ -23,7 +23,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2545,12 +2545,13 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2577,12 +2577,13 @@ static int mt7531_rgmii_setup(struct mt7 } static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port, @@ -38,7 +38,7 @@ Signed-off-by: Paolo Abeni phylink_set(supported, 2500baseX_Full); phylink_set(supported, 2500baseT_Full); } -@@ -2923,16 +2924,18 @@ static void mt753x_phylink_get_caps(stru +@@ -2955,16 +2956,18 @@ static void mt753x_phylink_get_caps(stru static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, @@ -58,7 +58,7 @@ Signed-off-by: Paolo Abeni } static void -@@ -2955,12 +2958,13 @@ mt753x_phylink_validate(struct dsa_switc +@@ -2987,12 +2990,13 @@ mt753x_phylink_validate(struct dsa_switc } /* This switch only supports 1G full-duplex. */ diff --git a/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch b/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch index 97699d4c5e3367..4d7569b4ce374c 100644 --- a/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch +++ b/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2544,19 +2544,6 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2576,19 +2576,6 @@ static int mt7531_rgmii_setup(struct mt7 return 0; } @@ -40,7 +40,7 @@ Signed-off-by: Paolo Abeni static void mt7531_sgmii_link_up_force(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, -@@ -2923,51 +2910,21 @@ static void mt753x_phylink_get_caps(stru +@@ -2955,51 +2942,21 @@ static void mt753x_phylink_get_caps(stru } static void @@ -97,7 +97,7 @@ Signed-off-by: Paolo Abeni linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); -@@ -3168,7 +3125,6 @@ static const struct mt753x_info mt753x_t +@@ -3200,7 +3157,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -105,7 +105,7 @@ Signed-off-by: Paolo Abeni .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, -@@ -3179,7 +3135,6 @@ static const struct mt753x_info mt753x_t +@@ -3211,7 +3167,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -113,7 +113,7 @@ Signed-off-by: Paolo Abeni .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, -@@ -3191,7 +3146,6 @@ static const struct mt753x_info mt753x_t +@@ -3223,7 +3178,6 @@ static const struct mt753x_info mt753x_t .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, @@ -121,7 +121,7 @@ Signed-off-by: Paolo Abeni .mac_port_get_state = mt7531_phylink_mac_link_state, .mac_port_config = mt7531_mac_config, .mac_pcs_an_restart = mt7531_sgmii_restart_an, -@@ -3253,7 +3207,6 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3285,7 +3239,6 @@ mt7530_probe(struct mdio_device *mdiodev if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || diff --git a/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch b/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch index b9b74833d22379..fdf2a964ccfce4 100644 --- a/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch +++ b/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch @@ -33,7 +33,7 @@ Signed-off-by: Paolo Abeni /* String, offset, and register size in bytes if different from 4 bytes */ static const struct mt7530_mib_desc mt7530_mib[] = { MIB_DESC(1, 0x00, "TxDrop"), -@@ -2544,12 +2549,11 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2576,12 +2581,11 @@ static int mt7531_rgmii_setup(struct mt7 return 0; } @@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni unsigned int val; /* For adjusting speed and duplex of SGMII force mode. */ -@@ -2575,6 +2579,9 @@ mt7531_sgmii_link_up_force(struct dsa_sw +@@ -2607,6 +2611,9 @@ mt7531_sgmii_link_up_force(struct dsa_sw /* MT7531 SGMII 1G force mode can only work in full duplex mode, * no matter MT7531_SGMII_FORCE_HALF_DUPLEX is set or not. @@ -60,7 +60,7 @@ Signed-off-by: Paolo Abeni */ if ((speed == SPEED_10 || speed == SPEED_100) && duplex != DUPLEX_FULL) -@@ -2650,9 +2657,10 @@ static int mt7531_sgmii_setup_mode_an(st +@@ -2682,9 +2689,10 @@ static int mt7531_sgmii_setup_mode_an(st return 0; } @@ -73,7 +73,7 @@ Signed-off-by: Paolo Abeni u32 val; /* Only restart AN when AN is enabled */ -@@ -2709,6 +2717,24 @@ mt753x_mac_config(struct dsa_switch *ds, +@@ -2741,6 +2749,24 @@ mt753x_mac_config(struct dsa_switch *ds, return priv->info->mac_port_config(ds, port, mode, state->interface); } @@ -98,7 +98,7 @@ Signed-off-by: Paolo Abeni static void mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, const struct phylink_link_state *state) -@@ -2770,17 +2796,6 @@ unsupported: +@@ -2802,17 +2828,6 @@ unsupported: mt7530_write(priv, MT7530_PMCR_P(port), mcr_new); } @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni static void mt753x_phylink_mac_link_down(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) -@@ -2790,16 +2805,13 @@ static void mt753x_phylink_mac_link_down +@@ -2822,16 +2837,13 @@ static void mt753x_phylink_mac_link_down mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK); } @@ -139,7 +139,7 @@ Signed-off-by: Paolo Abeni } static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, -@@ -2812,8 +2824,6 @@ static void mt753x_phylink_mac_link_up(s +@@ -2844,8 +2856,6 @@ static void mt753x_phylink_mac_link_up(s struct mt7530_priv *priv = ds->priv; u32 mcr; @@ -148,7 +148,7 @@ Signed-off-by: Paolo Abeni mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK; /* MT753x MAC works in 1G full duplex mode for all up-clocked -@@ -2891,6 +2901,8 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -2923,6 +2933,8 @@ mt7531_cpu_port_config(struct dsa_switch return ret; mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPU_PORT_SETTING(priv->id)); @@ -157,7 +157,7 @@ Signed-off-by: Paolo Abeni mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL, speed, DUPLEX_FULL, true, true); -@@ -2930,16 +2942,13 @@ mt753x_phylink_validate(struct dsa_switc +@@ -2962,16 +2974,13 @@ mt753x_phylink_validate(struct dsa_switc linkmode_and(state->advertising, state->advertising, mask); } @@ -178,7 +178,7 @@ Signed-off-by: Paolo Abeni pmsr = mt7530_read(priv, MT7530_PMSR_P(port)); state->link = (pmsr & PMSR_LINK); -@@ -2966,8 +2975,6 @@ mt7530_phylink_mac_link_state(struct dsa +@@ -2998,8 +3007,6 @@ mt7530_phylink_mac_link_state(struct dsa state->pause |= MLO_PAUSE_RX; if (pmsr & PMSR_TX_FC) state->pause |= MLO_PAUSE_TX; @@ -187,7 +187,7 @@ Signed-off-by: Paolo Abeni } static int -@@ -3009,32 +3016,49 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 +@@ -3041,32 +3048,49 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 return 0; } @@ -249,7 +249,7 @@ Signed-off-by: Paolo Abeni if (ret) return ret; -@@ -3047,6 +3071,13 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3079,6 +3103,13 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); @@ -263,7 +263,7 @@ Signed-off-by: Paolo Abeni return ret; } -@@ -3108,9 +3139,8 @@ static const struct dsa_switch_ops mt753 +@@ -3140,9 +3171,8 @@ static const struct dsa_switch_ops mt753 .port_mirror_del = mt753x_port_mirror_del, .phylink_get_caps = mt753x_phylink_get_caps, .phylink_validate = mt753x_phylink_validate, @@ -274,7 +274,7 @@ Signed-off-by: Paolo Abeni .phylink_mac_link_down = mt753x_phylink_mac_link_down, .phylink_mac_link_up = mt753x_phylink_mac_link_up, .get_mac_eee = mt753x_get_mac_eee, -@@ -3120,36 +3150,34 @@ static const struct dsa_switch_ops mt753 +@@ -3152,36 +3182,34 @@ static const struct dsa_switch_ops mt753 static const struct mt753x_info mt753x_table[] = { [ID_MT7621] = { .id = ID_MT7621, @@ -314,7 +314,7 @@ Signed-off-by: Paolo Abeni }, }; -@@ -3207,7 +3235,7 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3239,7 +3267,7 @@ mt7530_probe(struct mdio_device *mdiodev if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || diff --git a/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch b/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch index 4aa013aad7912b..7b2fa36699bf67 100644 --- a/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch +++ b/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2921,25 +2921,16 @@ static void mt753x_phylink_get_caps(stru +@@ -2953,25 +2953,16 @@ static void mt753x_phylink_get_caps(stru priv->info->mac_port_get_caps(ds, port, config); } @@ -55,7 +55,7 @@ Signed-off-by: Paolo Abeni } static void mt7530_pcs_get_state(struct phylink_pcs *pcs, -@@ -3041,12 +3032,14 @@ static void mt7530_pcs_an_restart(struct +@@ -3073,12 +3064,14 @@ static void mt7530_pcs_an_restart(struct } static const struct phylink_pcs_ops mt7530_pcs_ops = { @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni .pcs_get_state = mt7531_pcs_get_state, .pcs_config = mt753x_pcs_config, .pcs_an_restart = mt7531_pcs_an_restart, -@@ -3138,7 +3131,6 @@ static const struct dsa_switch_ops mt753 +@@ -3170,7 +3163,6 @@ static const struct dsa_switch_ops mt753 .port_mirror_add = mt753x_port_mirror_add, .port_mirror_del = mt753x_port_mirror_del, .phylink_get_caps = mt753x_phylink_get_caps, diff --git a/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch b/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch index d921d78733d484..8bb587f5f57d69 100644 --- a/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch +++ b/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch @@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2918,6 +2918,12 @@ static void mt753x_phylink_get_caps(stru +@@ -2950,6 +2950,12 @@ static void mt753x_phylink_get_caps(stru config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; diff --git a/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch b/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch index e797b1ecb425ce..438c02ade6fcae 100644 --- a/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch +++ b/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch @@ -81,7 +81,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3056,9 +3056,16 @@ static int +@@ -3088,9 +3088,16 @@ static int mt753x_setup(struct dsa_switch *ds) { struct mt7530_priv *priv = ds->priv; @@ -100,7 +100,7 @@ Signed-off-by: Jakub Kicinski if (ret) return ret; -@@ -3070,13 +3077,6 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3102,13 +3109,6 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/backport-5.15/705-12-v6.0-net-dsa-mt7530-rework-mt753-01-_setup.patch b/target/linux/generic/backport-5.15/705-12-v6.0-net-dsa-mt7530-rework-mt753-01-_setup.patch deleted file mode 100644 index b02705cc701165..00000000000000 --- a/target/linux/generic/backport-5.15/705-12-v6.0-net-dsa-mt7530-rework-mt753-01-_setup.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 1f0dfd443eea7fc3e818e96f7c8264913ba41859 Mon Sep 17 00:00:00 2001 -From: Frank Wunderlich -Date: Fri, 10 Jun 2022 19:05:38 +0200 -Subject: [PATCH 12/13] net: dsa: mt7530: rework mt753[01]_setup - -Enumerate available cpu-ports instead of using hardcoded constant. - -Suggested-by: Vladimir Oltean -Signed-off-by: Frank Wunderlich -Reviewed-by: Vladimir Oltean -Reviewed-by: Florian Fainelli -Signed-off-by: Jakub Kicinski ---- - drivers/net/dsa/mt7530.c | 25 +++++++++++++++++++++---- - 1 file changed, 21 insertions(+), 4 deletions(-) - ---- a/drivers/net/dsa/mt7530.c -+++ b/drivers/net/dsa/mt7530.c -@@ -2101,11 +2101,12 @@ static int - mt7530_setup(struct dsa_switch *ds) - { - struct mt7530_priv *priv = ds->priv; -+ struct device_node *dn = NULL; - struct device_node *phy_node; - struct device_node *mac_np; - struct mt7530_dummy_poll p; - phy_interface_t interface; -- struct device_node *dn; -+ struct dsa_port *cpu_dp; - u32 id, val; - int ret, i; - -@@ -2113,7 +2114,19 @@ mt7530_setup(struct dsa_switch *ds) - * controller also is the container for two GMACs nodes representing - * as two netdev instances. - */ -- dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; -+ dsa_switch_for_each_cpu_port(cpu_dp, ds) { -+ dn = cpu_dp->master->dev.of_node->parent; -+ /* It doesn't matter which CPU port is found first, -+ * their masters should share the same parent OF node -+ */ -+ break; -+ } -+ -+ if (!dn) { -+ dev_err(ds->dev, "parent OF node of DSA master not found"); -+ return -EINVAL; -+ } -+ - ds->assisted_learning_on_cpu_port = true; - ds->mtu_enforcement_ingress = true; - -@@ -2286,6 +2299,7 @@ mt7531_setup(struct dsa_switch *ds) - { - struct mt7530_priv *priv = ds->priv; - struct mt7530_dummy_poll p; -+ struct dsa_port *cpu_dp; - u32 val, id; - int ret, i; - -@@ -2360,8 +2374,11 @@ mt7531_setup(struct dsa_switch *ds) - CORE_PLL_GROUP4, val); - - /* BPDU to CPU port */ -- mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, -- BIT(MT7530_CPU_PORT)); -+ dsa_switch_for_each_cpu_port(cpu_dp, ds) { -+ mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, -+ BIT(cpu_dp->index)); -+ break; -+ } - mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, - MT753X_BPDU_CPU_ONLY); - diff --git a/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch b/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch index ebfbaccc9d76aa..377ee76171c055 100644 --- a/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch +++ b/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2721,9 +2721,6 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2736,9 +2736,6 @@ mt7531_mac_config(struct dsa_switch *ds, case PHY_INTERFACE_MODE_NA: case PHY_INTERFACE_MODE_1000BASEX: case PHY_INTERFACE_MODE_2500BASEX: @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller return mt7531_sgmii_setup_mode_force(priv, port, interface); default: return -EINVAL; -@@ -2799,13 +2796,6 @@ unsupported: +@@ -2814,13 +2811,6 @@ unsupported: return; } @@ -43,7 +43,7 @@ Signed-off-by: David S. Miller mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); mcr_new = mcr_cur; mcr_new &= ~PMCR_LINK_SETTINGS_MASK; -@@ -2942,6 +2932,9 @@ static void mt753x_phylink_get_caps(stru +@@ -2957,6 +2947,9 @@ static void mt753x_phylink_get_caps(stru config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; @@ -53,7 +53,7 @@ Signed-off-by: David S. Miller /* This driver does not make use of the speed, duplex, pause or the * advertisement in its mac_config, so it is safe to mark this driver * as non-legacy. -@@ -3007,6 +3000,7 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 +@@ -3022,6 +3015,7 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 status = mt7530_read(priv, MT7531_PCS_CONTROL_1(port)); state->link = !!(status & MT7531_SGMII_LINK_STATUS); @@ -61,7 +61,7 @@ Signed-off-by: David S. Miller if (state->interface == PHY_INTERFACE_MODE_SGMII && (status & MT7531_SGMII_AN_ENABLE)) { val = mt7530_read(priv, MT7531_PCS_SPEED_ABILITY(port)); -@@ -3037,16 +3031,44 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 +@@ -3052,16 +3046,44 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 return 0; } @@ -109,7 +109,7 @@ Signed-off-by: David S. Miller } static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode, -@@ -3087,6 +3109,8 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3102,6 +3124,8 @@ mt753x_setup(struct dsa_switch *ds) priv->pcs[i].pcs.ops = priv->info->pcs_ops; priv->pcs[i].priv = priv; priv->pcs[i].port = i; diff --git a/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch b/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch index ee12399140b659..9e445f1300cd8f 100644 --- a/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch +++ b/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch @@ -81,7 +81,7 @@ Tested-by: Frank Wunderlich #include #include #include -@@ -2573,128 +2574,11 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2588,128 +2589,11 @@ static int mt7531_rgmii_setup(struct mt7 return 0; } @@ -210,7 +210,7 @@ Tested-by: Frank Wunderlich static int mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) -@@ -2717,11 +2601,11 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2732,11 +2616,11 @@ mt7531_mac_config(struct dsa_switch *ds, phydev = dp->slave->phydev; return mt7531_rgmii_setup(priv, port, interface, phydev); case PHY_INTERFACE_MODE_SGMII: @@ -224,7 +224,7 @@ Tested-by: Frank Wunderlich default: return -EINVAL; } -@@ -2746,11 +2630,11 @@ mt753x_phylink_mac_select_pcs(struct dsa +@@ -2761,11 +2645,11 @@ mt753x_phylink_mac_select_pcs(struct dsa switch (interface) { case PHY_INTERFACE_MODE_TRGMII: @@ -238,7 +238,7 @@ Tested-by: Frank Wunderlich default: return NULL; } -@@ -2991,86 +2875,6 @@ static void mt7530_pcs_get_state(struct +@@ -3006,86 +2890,6 @@ static void mt7530_pcs_get_state(struct state->pause |= MLO_PAUSE_TX; } @@ -325,7 +325,7 @@ Tested-by: Frank Wunderlich static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode, phy_interface_t interface, const unsigned long *advertising, -@@ -3090,18 +2894,57 @@ static const struct phylink_pcs_ops mt75 +@@ -3105,18 +2909,57 @@ static const struct phylink_pcs_ops mt75 .pcs_an_restart = mt7530_pcs_an_restart, }; @@ -389,7 +389,7 @@ Tested-by: Frank Wunderlich int i, ret; /* Initialise the PCS devices */ -@@ -3109,8 +2952,6 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3124,8 +2967,6 @@ mt753x_setup(struct dsa_switch *ds) priv->pcs[i].pcs.ops = priv->info->pcs_ops; priv->pcs[i].priv = priv; priv->pcs[i].port = i; @@ -398,7 +398,7 @@ Tested-by: Frank Wunderlich } ret = priv->info->sw_setup(ds); -@@ -3125,6 +2966,16 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3140,6 +2981,16 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); @@ -415,7 +415,7 @@ Tested-by: Frank Wunderlich return ret; } -@@ -3216,7 +3067,7 @@ static const struct mt753x_info mt753x_t +@@ -3231,7 +3082,7 @@ static const struct mt753x_info mt753x_t }, [ID_MT7531] = { .id = ID_MT7531, @@ -424,7 +424,7 @@ Tested-by: Frank Wunderlich .sw_setup = mt7531_setup, .phy_read = mt7531_ind_phy_read, .phy_write = mt7531_ind_phy_write, -@@ -3324,7 +3175,7 @@ static void +@@ -3339,7 +3190,7 @@ static void mt7530_remove(struct mdio_device *mdiodev) { struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); @@ -433,7 +433,7 @@ Tested-by: Frank Wunderlich if (!priv) return; -@@ -3343,6 +3194,10 @@ mt7530_remove(struct mdio_device *mdiode +@@ -3358,6 +3209,10 @@ mt7530_remove(struct mdio_device *mdiode mt7530_free_irq(priv); dsa_unregister_switch(priv->ds); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch b/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch index 8963d93d107ac5..a933d376c8871e 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2926,26 +2926,56 @@ static const struct regmap_bus mt7531_re +@@ -2941,26 +2941,56 @@ static const struct regmap_bus mt7531_re .reg_update_bits = mt7530_regmap_update_bits, }; @@ -88,7 +88,7 @@ Signed-off-by: David S. Miller int i, ret; /* Initialise the PCS devices */ -@@ -2967,15 +2997,11 @@ mt753x_setup(struct dsa_switch *ds) +@@ -2982,15 +3012,11 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch b/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch index 1b4a9561992f36..5f6990f117832e 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2899,7 +2899,7 @@ static int mt7530_regmap_read(void *cont +@@ -2914,7 +2914,7 @@ static int mt7530_regmap_read(void *cont { struct mt7530_priv *priv = context; @@ -28,7 +28,7 @@ Signed-off-by: David S. Miller return 0; }; -@@ -2907,23 +2907,25 @@ static int mt7530_regmap_write(void *con +@@ -2922,23 +2922,25 @@ static int mt7530_regmap_write(void *con { struct mt7530_priv *priv = context; @@ -62,7 +62,7 @@ Signed-off-by: David S. Miller }; static int -@@ -2949,6 +2951,9 @@ mt7531_create_sgmii(struct mt7530_priv * +@@ -2964,6 +2966,9 @@ mt7531_create_sgmii(struct mt7530_priv * mt7531_pcs_config[i]->reg_stride = 4; mt7531_pcs_config[i]->reg_base = MT7531_SGMII_REG_BASE(5 + i); mt7531_pcs_config[i]->max_register = 0x17c; diff --git a/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch b/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch index 2d8bab9da63e59..9499ca598fbf8e 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch @@ -133,7 +133,7 @@ Signed-off-by: David S. Miller } static void -@@ -2895,22 +2916,6 @@ static const struct phylink_pcs_ops mt75 +@@ -2910,22 +2931,6 @@ static const struct phylink_pcs_ops mt75 .pcs_an_restart = mt7530_pcs_an_restart, }; @@ -156,7 +156,7 @@ Signed-off-by: David S. Miller static void mt7530_mdio_regmap_lock(void *mdio_lock) { -@@ -2923,7 +2928,7 @@ mt7530_mdio_regmap_unlock(void *mdio_loc +@@ -2938,7 +2943,7 @@ mt7530_mdio_regmap_unlock(void *mdio_loc mutex_unlock(mdio_lock); } @@ -165,7 +165,7 @@ Signed-off-by: David S. Miller .reg_write = mt7530_regmap_write, .reg_read = mt7530_regmap_read, }; -@@ -2956,7 +2961,7 @@ mt7531_create_sgmii(struct mt7530_priv * +@@ -2971,7 +2976,7 @@ mt7531_create_sgmii(struct mt7530_priv * mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; regmap = devm_regmap_init(priv->dev, @@ -174,7 +174,7 @@ Signed-off-by: David S. Miller mt7531_pcs_config[i]); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); -@@ -3121,6 +3126,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match) +@@ -3136,6 +3141,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match) static int mt7530_probe(struct mdio_device *mdiodev) { @@ -182,7 +182,7 @@ Signed-off-by: David S. Miller struct mt7530_priv *priv; struct device_node *dn; -@@ -3200,6 +3206,21 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3215,6 +3221,21 @@ mt7530_probe(struct mdio_device *mdiodev mutex_init(&priv->reg_mutex); dev_set_drvdata(&mdiodev->dev, priv); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch b/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch index 0bb64c3c5e9924..44c31a4f6f2a29 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3007,12 +3007,6 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3022,12 +3022,6 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); @@ -31,7 +31,7 @@ Signed-off-by: David S. Miller return ret; } -@@ -3129,6 +3123,7 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3144,6 +3138,7 @@ mt7530_probe(struct mdio_device *mdiodev static struct regmap_config *regmap_config; struct mt7530_priv *priv; struct device_node *dn; @@ -39,7 +39,7 @@ Signed-off-by: David S. Miller dn = mdiodev->dev.of_node; -@@ -3221,6 +3216,12 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3236,6 +3231,12 @@ mt7530_probe(struct mdio_device *mdiodev if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch b/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch index 34a1bd7372d536..aeb1e37a1a11ee 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3135,44 +3135,21 @@ static const struct of_device_id mt7530_ +@@ -3150,44 +3150,21 @@ static const struct of_device_id mt7530_ MODULE_DEVICE_TABLE(of, mt7530_of_match); static int @@ -67,7 +67,7 @@ Signed-off-by: David S. Miller if (!priv->info) return -EINVAL; -@@ -3186,23 +3163,53 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3201,23 +3178,53 @@ mt7530_probe(struct mdio_device *mdiodev return -EINVAL; priv->id = priv->info->id; @@ -131,7 +131,7 @@ Signed-off-by: David S. Miller priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(priv->reset)) { -@@ -3211,12 +3218,15 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3226,12 +3233,15 @@ mt7530_probe(struct mdio_device *mdiodev } } diff --git a/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch b/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch index 2881365ec77d7b..2651f4591835f1 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3253,6 +3253,17 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3268,6 +3268,17 @@ mt7530_probe(struct mdio_device *mdiodev } static void @@ -35,7 +35,7 @@ Signed-off-by: David S. Miller mt7530_remove(struct mdio_device *mdiodev) { struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); -@@ -3271,16 +3282,11 @@ mt7530_remove(struct mdio_device *mdiode +@@ -3286,16 +3297,11 @@ mt7530_remove(struct mdio_device *mdiode dev_err(priv->dev, "Failed to disable io pwr: %d\n", ret); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch b/target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch deleted file mode 100644 index c8e7d93026ddfa..00000000000000 --- a/target/linux/generic/backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 7f54cc9772ced2d76ac11832f0ada43798443ac9 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Mon, 3 Apr 2023 02:19:02 +0100 -Subject: [PATCH 13/16] net: dsa: mt7530: split-off common parts from - mt7531_setup - -MT7988 shares a significant part of the setup function with MT7531. -Split-off those parts into a shared function which is going to be used -also by mt7988_setup. - -Signed-off-by: Daniel Golle -Reviewed-by: Andrew Lunn -Signed-off-by: David S. Miller ---- - drivers/net/dsa/mt7530.c | 99 ++++++++++++++++++++++------------------ - 1 file changed, 55 insertions(+), 44 deletions(-) - ---- a/drivers/net/dsa/mt7530.c -+++ b/drivers/net/dsa/mt7530.c -@@ -2348,11 +2348,64 @@ mt7530_setup(struct dsa_switch *ds) - } - - static int -+mt7531_setup_common(struct dsa_switch *ds) -+{ -+ struct mt7530_priv *priv = ds->priv; -+ struct dsa_port *cpu_dp; -+ int ret, i; -+ -+ /* BPDU to CPU port */ -+ dsa_switch_for_each_cpu_port(cpu_dp, ds) { -+ mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, -+ BIT(cpu_dp->index)); -+ break; -+ } -+ mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, -+ MT753X_BPDU_CPU_ONLY); -+ -+ /* Enable and reset MIB counters */ -+ mt7530_mib_reset(ds); -+ -+ for (i = 0; i < MT7530_NUM_PORTS; i++) { -+ /* Disable forwarding by default on all ports */ -+ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, -+ PCR_MATRIX_CLR); -+ -+ /* Disable learning by default on all ports */ -+ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); -+ -+ mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); -+ -+ if (dsa_is_cpu_port(ds, i)) { -+ ret = mt753x_cpu_port_enable(ds, i); -+ if (ret) -+ return ret; -+ } else { -+ mt7530_port_disable(ds, i); -+ -+ /* Set default PVID to 0 on all user ports */ -+ mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, -+ G0_PORT_VID_DEF); -+ } -+ -+ /* Enable consistent egress tag */ -+ mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, -+ PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); -+ } -+ -+ /* Flush the FDB table */ -+ ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); -+ if (ret < 0) -+ return ret; -+ -+ return 0; -+} -+ -+static int - mt7531_setup(struct dsa_switch *ds) - { - struct mt7530_priv *priv = ds->priv; - struct mt7530_dummy_poll p; -- struct dsa_port *cpu_dp; - u32 val, id; - int ret, i; - -@@ -2426,44 +2479,7 @@ mt7531_setup(struct dsa_switch *ds) - mt7531_ind_c45_phy_write(priv, MT753X_CTRL_PHY_ADDR, MDIO_MMD_VEND2, - CORE_PLL_GROUP4, val); - -- /* BPDU to CPU port */ -- dsa_switch_for_each_cpu_port(cpu_dp, ds) { -- mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, -- BIT(cpu_dp->index)); -- break; -- } -- mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, -- MT753X_BPDU_CPU_ONLY); -- -- /* Enable and reset MIB counters */ -- mt7530_mib_reset(ds); -- -- for (i = 0; i < MT7530_NUM_PORTS; i++) { -- /* Disable forwarding by default on all ports */ -- mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, -- PCR_MATRIX_CLR); -- -- /* Disable learning by default on all ports */ -- mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); -- -- mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); -- -- if (dsa_is_cpu_port(ds, i)) { -- ret = mt753x_cpu_port_enable(ds, i); -- if (ret) -- return ret; -- } else { -- mt7530_port_disable(ds, i); -- -- /* Set default PVID to 0 on all user ports */ -- mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, -- G0_PORT_VID_DEF); -- } -- -- /* Enable consistent egress tag */ -- mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, -- PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); -- } -+ mt7531_setup_common(ds); - - /* Setup VLAN ID 0 for VLAN-unaware bridges */ - ret = mt7530_setup_vlan0(priv); -@@ -2473,11 +2489,6 @@ mt7531_setup(struct dsa_switch *ds) - ds->assisted_learning_on_cpu_port = true; - ds->mtu_enforcement_ingress = true; - -- /* Flush the FDB table */ -- ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); -- if (ret < 0) -- return ret; -- - return 0; - } - diff --git a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch index 96afa041aad180..51346d0620d3a9 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch @@ -416,7 +416,7 @@ Signed-off-by: David S. Miller static u32 mt7530_mii_read(struct mt7530_priv *priv, u32 reg) { -@@ -2944,72 +2895,6 @@ static const struct phylink_pcs_ops mt75 +@@ -2948,72 +2899,6 @@ static const struct phylink_pcs_ops mt75 .pcs_an_restart = mt7530_pcs_an_restart, }; @@ -489,7 +489,7 @@ Signed-off-by: David S. Miller static int mt753x_setup(struct dsa_switch *ds) { -@@ -3068,7 +2953,7 @@ static int mt753x_set_mac_eee(struct dsa +@@ -3072,7 +2957,7 @@ static int mt753x_set_mac_eee(struct dsa return 0; } @@ -498,7 +498,7 @@ Signed-off-by: David S. Miller .get_tag_protocol = mtk_get_tag_protocol, .setup = mt753x_setup, .get_strings = mt7530_get_strings, -@@ -3102,8 +2987,9 @@ static const struct dsa_switch_ops mt753 +@@ -3106,8 +2991,9 @@ static const struct dsa_switch_ops mt753 .get_mac_eee = mt753x_get_mac_eee, .set_mac_eee = mt753x_set_mac_eee, }; @@ -509,7 +509,7 @@ Signed-off-by: David S. Miller [ID_MT7621] = { .id = ID_MT7621, .pcs_ops = &mt7530_pcs_ops, -@@ -3136,16 +3022,9 @@ static const struct mt753x_info mt753x_t +@@ -3140,16 +3026,9 @@ static const struct mt753x_info mt753x_t .mac_port_config = mt7531_mac_config, }, }; @@ -528,7 +528,7 @@ Signed-off-by: David S. Miller mt7530_probe_common(struct mt7530_priv *priv) { struct device *dev = priv->dev; -@@ -3182,88 +3061,9 @@ mt7530_probe_common(struct mt7530_priv * +@@ -3186,88 +3065,9 @@ mt7530_probe_common(struct mt7530_priv * return 0; } @@ -619,7 +619,7 @@ Signed-off-by: David S. Miller mt7530_remove_common(struct mt7530_priv *priv) { if (priv->irq) -@@ -3274,57 +3074,6 @@ mt7530_remove_common(struct mt7530_priv +@@ -3278,57 +3078,6 @@ mt7530_remove_common(struct mt7530_priv mutex_destroy(&priv->reg_mutex); } diff --git a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch index 8210aae27ce0c7..00f4b25c44e1de 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch @@ -250,7 +250,7 @@ Signed-off-by: David S. Miller if (!priv->irq_domain) { dev_err(dev, "failed to create IRQ domain\n"); return -ENOMEM; -@@ -2507,6 +2555,25 @@ static void mt7531_mac_port_get_caps(str +@@ -2511,6 +2559,25 @@ static void mt7531_mac_port_get_caps(str } } @@ -276,7 +276,7 @@ Signed-off-by: David S. Miller static int mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) { -@@ -2583,6 +2650,17 @@ static bool mt753x_is_mac_port(u32 port) +@@ -2587,6 +2654,17 @@ static bool mt753x_is_mac_port(u32 port) } static int @@ -294,7 +294,7 @@ Signed-off-by: David S. Miller mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { -@@ -2652,7 +2730,8 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2656,7 +2734,8 @@ mt753x_phylink_mac_config(struct dsa_swi switch (port) { case 0 ... 4: /* Internal phy */ @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller goto unsupported; break; case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */ -@@ -2730,7 +2809,8 @@ static void mt753x_phylink_mac_link_up(s +@@ -2734,7 +2813,8 @@ static void mt753x_phylink_mac_link_up(s /* MT753x MAC works in 1G full duplex mode for all up-clocked * variants. */ @@ -314,7 +314,7 @@ Signed-off-by: David S. Miller (phy_interface_mode_is_8023z(interface))) { speed = SPEED_1000; duplex = DUPLEX_FULL; -@@ -2810,6 +2890,21 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -2814,6 +2894,21 @@ mt7531_cpu_port_config(struct dsa_switch return 0; } @@ -336,7 +336,7 @@ Signed-off-by: David S. Miller static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, struct phylink_config *config) { -@@ -2955,6 +3050,27 @@ static int mt753x_set_mac_eee(struct dsa +@@ -2959,6 +3054,27 @@ static int mt753x_set_mac_eee(struct dsa return 0; } @@ -364,7 +364,7 @@ Signed-off-by: David S. Miller const struct dsa_switch_ops mt7530_switch_ops = { .get_tag_protocol = mtk_get_tag_protocol, .setup = mt753x_setup, -@@ -3023,6 +3139,17 @@ const struct mt753x_info mt753x_table[] +@@ -3027,6 +3143,17 @@ const struct mt753x_info mt753x_table[] .mac_port_get_caps = mt7531_mac_port_get_caps, .mac_port_config = mt7531_mac_config, }, diff --git a/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch b/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch index 5259730996d1c5..ed8bca7d1c1276 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch @@ -73,7 +73,7 @@ Signed-off-by: Jakub Kicinski } --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3017,6 +3017,12 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3021,6 +3021,12 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch b/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch index bd806a7a6dfa0e..a3274906a4332e 100644 --- a/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch +++ b/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch @@ -10,12 +10,21 @@ The datasheet [1] explicit describes it as requirement for a reset. Signed-off-by: Alexander Couzens --- - drivers/net/dsa/mt7530.c | 4 ++++ - 1 file changed, 4 insertions(+) + drivers/net/dsa/mt7530.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2440,6 +2440,10 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2412,7 +2412,7 @@ mt7531_setup(struct dsa_switch *ds) + struct mt7530_priv *priv = ds->priv; + struct mt7530_dummy_poll p; + u32 val, id; +- int ret; ++ int ret, i; + + /* Reset whole chip through gpio pin or memory-mapped registers for + * different type of hardware +@@ -2444,6 +2444,10 @@ mt7531_setup(struct dsa_switch *ds) return -ENODEV; } From 81979018e09a2b5362089284dfd4db907fde12c4 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 11 Jun 2023 13:11:52 -0400 Subject: [PATCH 0206/1171] kernel: add CONFIG_DRM_RCAR_USE_LVDS is not set Added missing symbol. Signed-off-by: John Audia (cherry picked from commit fc3383a55877150ffe8068c46fe61f6881b1033c) --- target/linux/generic/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 4635a423ffc6b4..2e9ad886066b33 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -1634,6 +1634,7 @@ CONFIG_DQL=y # CONFIG_DRM_RADEON_USERPTR is not set # CONFIG_DRM_RCAR_DW_HDMI is not set # CONFIG_DRM_RCAR_LVDS is not set +# CONFIG_DRM_RCAR_USE_LVDS is not set # CONFIG_DRM_ROCKCHIP is not set # CONFIG_DRM_SII902X is not set # CONFIG_DRM_SII9234 is not set From 1de5f740623cb37cf7f38838fee587cbbfd9565c Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 10 Jun 2023 16:57:15 -0400 Subject: [PATCH 0207/1171] kernel: bump 5.15 to 5.15.116 All patches rebased automatically. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia (cherry picked from commit 5dc78d8f18e8f536317d9438b096a484a9c49862) --- include/kernel-5.15 | 4 ++-- .../ath79/patches-5.15/910-unaligned_access_hacks.patch | 2 +- .../950-0080-Added-Device-IDs-for-August-DVB-T-205.patch | 2 +- ...d-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch | 2 +- ...18-regmap-add-configurable-downshift-for-addresses.patch | 4 ++-- ...gmap-allow-a-defined-reg_base-to-be-added-to-every.patch | 4 ++-- ...gmap-apply-reg_base-and-reg_downshift-for-single-r.patch | 4 ++-- ...807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch | 2 +- target/linux/generic/hack-5.15/259-regmap_dynamic.patch | 2 +- .../linux/generic/pending-5.15/630-packet_socket_type.patch | 6 +++--- .../710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch | 2 +- .../patches-5.15/810-uvc-add-iPassion-iP2970-support.patch | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index b8b89583b41be3..6db270a3741a79 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .115 -LINUX_KERNEL_HASH-5.15.115 = 1b076860779235e90519e867c1ec78c7a34d1125d8fdba787ff495c7c14f1214 +LINUX_VERSION-5.15 = .116 +LINUX_KERNEL_HASH-5.15.116 = f617c9d1bb5326cc93495938f43eb8cb9aea9d2f451e5a99bce2893f296e179a diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 88693d5f1ad46e..5c659b3d2ca418 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -336,7 +336,7 @@ SVN-Revision: 35130 #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1475,8 +1475,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1477,8 +1477,8 @@ struct sk_buff *inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; diff --git a/target/linux/bcm27xx/patches-5.15/950-0080-Added-Device-IDs-for-August-DVB-T-205.patch b/target/linux/bcm27xx/patches-5.15/950-0080-Added-Device-IDs-for-August-DVB-T-205.patch index b42e6423fd518b..1b19eb45d2f9e1 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0080-Added-Device-IDs-for-August-DVB-T-205.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0080-Added-Device-IDs-for-August-DVB-T-205.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Added Device IDs for August DVB-T 205 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c -@@ -1944,6 +1944,10 @@ static const struct usb_device_id rtl28x +@@ -1964,6 +1964,10 @@ static const struct usb_device_id rtl28x &rtl28xxu_props, "Compro VideoMate U650F", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394, &rtl28xxu_props, "MaxMedia HU394-T", NULL) }, diff --git a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 92c5eaacb13665..82085e6ff56fde 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch @@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell #define USB_VENDOR_ID_BELKIN 0x050d #define USB_DEVICE_ID_FLIP_KVM 0x3201 -@@ -1316,6 +1319,9 @@ +@@ -1317,6 +1320,9 @@ #define USB_VENDOR_ID_XAT 0x2505 #define USB_DEVICE_ID_XAT_CSR 0x0220 diff --git a/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch b/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch index 99cd89ea002f43..690e85d34bec4f 100644 --- a/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch +++ b/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch @@ -53,7 +53,7 @@ Signed-off-by: Mark Brown map->format.format_write(map, reg, val); trace_regmap_hw_write_start(map, reg, 1); -@@ -2346,6 +2349,7 @@ static int _regmap_raw_multi_reg_write(s +@@ -2348,6 +2351,7 @@ static int _regmap_raw_multi_reg_write(s unsigned int reg = regs[i].reg; unsigned int val = regs[i].def; trace_regmap_hw_write_start(map, reg, 1); @@ -61,7 +61,7 @@ Signed-off-by: Mark Brown map->format.format_reg(u8, reg, map->reg_shift); u8 += reg_bytes + pad_bytes; map->format.format_val(u8, val, 0); -@@ -2673,6 +2677,7 @@ static int _regmap_raw_read(struct regma +@@ -2675,6 +2679,7 @@ static int _regmap_raw_read(struct regma return ret; } diff --git a/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch b/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch index 0f32288fcab5b3..ffde9e5d0c53d7 100644 --- a/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch +++ b/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch @@ -58,7 +58,7 @@ Signed-off-by: Mark Brown reg >>= map->format.reg_downshift; map->format.format_write(map, reg, val); -@@ -2349,6 +2353,7 @@ static int _regmap_raw_multi_reg_write(s +@@ -2351,6 +2355,7 @@ static int _regmap_raw_multi_reg_write(s unsigned int reg = regs[i].reg; unsigned int val = regs[i].def; trace_regmap_hw_write_start(map, reg, 1); @@ -66,7 +66,7 @@ Signed-off-by: Mark Brown reg >>= map->format.reg_downshift; map->format.format_reg(u8, reg, map->reg_shift); u8 += reg_bytes + pad_bytes; -@@ -2677,6 +2682,7 @@ static int _regmap_raw_read(struct regma +@@ -2679,6 +2684,7 @@ static int _regmap_raw_read(struct regma return ret; } diff --git a/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch b/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch index 804f68d23c50a5..34b587f5582118 100644 --- a/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch +++ b/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch @@ -37,7 +37,7 @@ Signed-off-by: Mark Brown return map->bus->reg_write(map->bus_context, reg, val); } -@@ -2703,6 +2705,8 @@ static int _regmap_bus_reg_read(void *co +@@ -2705,6 +2707,8 @@ static int _regmap_bus_reg_read(void *co { struct regmap *map = context; @@ -46,7 +46,7 @@ Signed-off-by: Mark Brown return map->bus->reg_read(map->bus_context, reg, val); } -@@ -3078,6 +3082,8 @@ static int _regmap_update_bits(struct re +@@ -3080,6 +3084,8 @@ static int _regmap_update_bits(struct re *change = false; if (regmap_volatile(map, reg) && map->reg_update_bits) { diff --git a/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch b/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch index ae02439bd734d2..4410fc4d615fc9 100644 --- a/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch @@ -28,7 +28,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig -@@ -1125,10 +1125,10 @@ CONFIG_TI_PIPE3=y +@@ -1124,10 +1124,10 @@ CONFIG_TI_PIPE3=y CONFIG_TWL4030_USB=m CONFIG_RAS=y CONFIG_NVMEM_IMX_OCOTP=y diff --git a/target/linux/generic/hack-5.15/259-regmap_dynamic.patch b/target/linux/generic/hack-5.15/259-regmap_dynamic.patch index 76a5ace6f31536..e0820ccfc0dbf3 100644 --- a/target/linux/generic/hack-5.15/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-5.15/259-regmap_dynamic.patch @@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -3358,3 +3359,5 @@ static int __init regmap_initcall(void) +@@ -3360,3 +3361,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); diff --git a/target/linux/generic/pending-5.15/630-packet_socket_type.patch b/target/linux/generic/pending-5.15/630-packet_socket_type.patch index b95ceebac76a69..ee13ce2a5c8d77 100644 --- a/target/linux/generic/pending-5.15/630-packet_socket_type.patch +++ b/target/linux/generic/pending-5.15/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3340,6 +3342,7 @@ static int packet_create(struct net *net +@@ -3342,6 +3344,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3977,6 +3980,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3979,6 +3982,16 @@ packet_setsockopt(struct socket *sock, i WRITE_ONCE(po->xmit, val ? packet_direct_xmit : dev_queue_xmit); return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4033,6 +4046,13 @@ static int packet_getsockopt(struct sock +@@ -4035,6 +4048,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch index 2a2ca7f1faeeba..7e8ed5455d9867 100644 --- a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch +++ b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch @@ -161,7 +161,7 @@ Signed-off-by: Felix Fietkau struct rtnl_link { rtnl_doit_func doit; -@@ -4700,7 +4700,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu +@@ -4706,7 +4706,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu brport_nla_put_flag(skb, flags, mask, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD) || brport_nla_put_flag(skb, flags, mask, diff --git a/target/linux/ramips/patches-5.15/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-5.15/810-uvc-add-iPassion-iP2970-support.patch index 2d56440610e4fc..88809ae68d0ce4 100644 --- a/target/linux/ramips/patches-5.15/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-5.15/810-uvc-add-iPassion-iP2970-support.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3152,6 +3152,18 @@ static const struct usb_device_id uvc_id +@@ -3158,6 +3158,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, From 1b6f2af1483eb10a575ebe2f555ea00b98009d20 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 15 Jun 2023 16:00:09 -0400 Subject: [PATCH 0208/1171] kernel: bump 5.15 to 5.15.117 Manually rebased: generic/backport-5.15/346-v5.18-01-Revert-ata-ahci-mvebu-Make-SATA-PHY-optional-for-Arm.patch Removed upstreamed: generic/backport-5.15/830-v6.2-ata-ahci-fix-enum-constants-for-gcc-13.patch All other patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 0e89ba8430a5d9a638f71d9534ea4152fc26e278) --- include/kernel-5.15 | 4 +- .../910-unaligned_access_hacks.patch | 2 +- ...mvebu-Make-SATA-PHY-optional-for-Arm.patch | 14 +- ..._eth_soc-implement-flow-offloading-t.patch | 4 +- ...a-ahci-fix-enum-constants-for-gcc-13.patch | 348 ------------------ ...t-size-the-hashtable-more-adequately.patch | 2 +- .../721-net-add-packet-mangeling.patch | 10 +- ...T-skip-GRO-for-foreign-MAC-addresses.patch | 12 +- ...ional-threading-for-backlog-processi.patch | 20 +- ...move-drivers-from-strlcpy-to-strscpy.patch | 2 +- ...e-unleashed-define-opp-table-cpufreq.patch | 2 +- 11 files changed, 36 insertions(+), 384 deletions(-) delete mode 100644 target/linux/generic/backport-5.15/830-v6.2-ata-ahci-fix-enum-constants-for-gcc-13.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 6db270a3741a79..fc637450b53dfa 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .116 -LINUX_KERNEL_HASH-5.15.116 = f617c9d1bb5326cc93495938f43eb8cb9aea9d2f451e5a99bce2893f296e179a +LINUX_VERSION-5.15 = .117 +LINUX_KERNEL_HASH-5.15.117 = a9a8331f3c0e004b40a41f30d688b53bf85405597ac41c2c89be7f4fbcf7239f diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 5c659b3d2ca418..c2b646643e0389 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -311,7 +311,7 @@ SVN-Revision: 35130 case IPV6_2292HOPOPTS: --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c -@@ -1009,7 +1009,7 @@ static bool ipv6_hop_jumbo(struct sk_buf +@@ -1002,7 +1002,7 @@ static bool ipv6_hop_jumbo(struct sk_buf goto drop; } diff --git a/target/linux/generic/backport-5.15/346-v5.18-01-Revert-ata-ahci-mvebu-Make-SATA-PHY-optional-for-Arm.patch b/target/linux/generic/backport-5.15/346-v5.18-01-Revert-ata-ahci-mvebu-Make-SATA-PHY-optional-for-Arm.patch index b254e7c0b3fbcb..f225a210570194 100644 --- a/target/linux/generic/backport-5.15/346-v5.18-01-Revert-ata-ahci-mvebu-Make-SATA-PHY-optional-for-Arm.patch +++ b/target/linux/generic/backport-5.15/346-v5.18-01-Revert-ata-ahci-mvebu-Make-SATA-PHY-optional-for-Arm.patch @@ -31,13 +31,13 @@ Signed-off-by: Vinod Koul --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h -@@ -240,8 +240,6 @@ enum { - as default lpm_policy */ - AHCI_HFLAG_SUSPEND_PHYS = (1 << 26), /* handle PHYs during - suspend/resume */ -- AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = (1 << 27), /* ignore -EOPNOTSUPP -- from phy_power_on() */ - AHCI_HFLAG_NO_SXS = (1 << 28), /* SXS not supported */ +@@ -241,8 +241,6 @@ enum { + as default lpm_policy */ + AHCI_HFLAG_SUSPEND_PHYS = BIT(26), /* handle PHYs during + suspend/resume */ +- AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = BIT(27), /* ignore -EOPNOTSUPP +- from phy_power_on() */ + AHCI_HFLAG_NO_SXS = BIT(28), /* SXS not supported */ /* ap->flags bits */ --- a/drivers/ata/ahci_mvebu.c diff --git a/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch b/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch index 50d65b1eb6ff53..ef2f53aa3847d7 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch @@ -233,7 +233,7 @@ Signed-off-by: Felix Fietkau static inline void --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -872,6 +872,7 @@ enum net_device_path_type { +@@ -875,6 +875,7 @@ enum net_device_path_type { DEV_PATH_BRIDGE, DEV_PATH_PPPOE, DEV_PATH_DSA, @@ -241,7 +241,7 @@ Signed-off-by: Felix Fietkau }; struct net_device_path { -@@ -897,6 +898,12 @@ struct net_device_path { +@@ -900,6 +901,12 @@ struct net_device_path { int port; u16 proto; } dsa; diff --git a/target/linux/generic/backport-5.15/830-v6.2-ata-ahci-fix-enum-constants-for-gcc-13.patch b/target/linux/generic/backport-5.15/830-v6.2-ata-ahci-fix-enum-constants-for-gcc-13.patch deleted file mode 100644 index 0d81d24e09cf30..00000000000000 --- a/target/linux/generic/backport-5.15/830-v6.2-ata-ahci-fix-enum-constants-for-gcc-13.patch +++ /dev/null @@ -1,348 +0,0 @@ -From f07788079f515ca4a681c5f595bdad19cfbd7b1d Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann -Date: Sat, 3 Dec 2022 11:54:25 +0100 -Subject: [PATCH] ata: ahci: fix enum constants for gcc-13 - -gcc-13 slightly changes the type of constant expressions that are defined -in an enum, which triggers a compile time sanity check in libata: - -linux/drivers/ata/libahci.c: In function 'ahci_led_store': -linux/include/linux/compiler_types.h:357:45: error: call to '__compiletime_assert_302' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long) -357 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) - -The new behavior is that sizeof() returns the same value for the -constant as it does for the enum type, which is generally more sensible -and consistent. - -The problem in libata is that it contains a single enum definition for -lots of unrelated constants, some of which are large positive (unsigned) -integers like 0xffffffff, while others like (1<<31) are interpreted as -negative integers, and this forces the enum type to become 64 bit wide -even though most constants would still fit into a signed 32-bit 'int'. - -Fix this by changing the entire enum definition to use BIT(x) in place -of (1< -Cc: linux-ide@vger.kernel.org -Cc: Damien Le Moal -Cc: stable@vger.kernel.org -Cc: Randy Dunlap -Signed-off-by: Arnd Bergmann -Tested-by: Luis Machado -Signed-off-by: Damien Le Moal ---- - drivers/ata/ahci.h | 245 +++++++++++++++++++++++---------------------- - 1 file changed, 123 insertions(+), 122 deletions(-) - ---- a/drivers/ata/ahci.h -+++ b/drivers/ata/ahci.h -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - /* Enclosure Management Control */ - #define EM_CTRL_MSG_TYPE 0x000f0000 -@@ -54,12 +55,12 @@ enum { - AHCI_PORT_PRIV_FBS_DMA_SZ = AHCI_CMD_SLOT_SZ + - AHCI_CMD_TBL_AR_SZ + - (AHCI_RX_FIS_SZ * 16), -- AHCI_IRQ_ON_SG = (1 << 31), -- AHCI_CMD_ATAPI = (1 << 5), -- AHCI_CMD_WRITE = (1 << 6), -- AHCI_CMD_PREFETCH = (1 << 7), -- AHCI_CMD_RESET = (1 << 8), -- AHCI_CMD_CLR_BUSY = (1 << 10), -+ AHCI_IRQ_ON_SG = BIT(31), -+ AHCI_CMD_ATAPI = BIT(5), -+ AHCI_CMD_WRITE = BIT(6), -+ AHCI_CMD_PREFETCH = BIT(7), -+ AHCI_CMD_RESET = BIT(8), -+ AHCI_CMD_CLR_BUSY = BIT(10), - - RX_FIS_PIO_SETUP = 0x20, /* offset of PIO Setup FIS data */ - RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ -@@ -77,37 +78,37 @@ enum { - HOST_CAP2 = 0x24, /* host capabilities, extended */ - - /* HOST_CTL bits */ -- HOST_RESET = (1 << 0), /* reset controller; self-clear */ -- HOST_IRQ_EN = (1 << 1), /* global IRQ enable */ -- HOST_MRSM = (1 << 2), /* MSI Revert to Single Message */ -- HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ -+ HOST_RESET = BIT(0), /* reset controller; self-clear */ -+ HOST_IRQ_EN = BIT(1), /* global IRQ enable */ -+ HOST_MRSM = BIT(2), /* MSI Revert to Single Message */ -+ HOST_AHCI_EN = BIT(31), /* AHCI enabled */ - - /* HOST_CAP bits */ -- HOST_CAP_SXS = (1 << 5), /* Supports External SATA */ -- HOST_CAP_EMS = (1 << 6), /* Enclosure Management support */ -- HOST_CAP_CCC = (1 << 7), /* Command Completion Coalescing */ -- HOST_CAP_PART = (1 << 13), /* Partial state capable */ -- HOST_CAP_SSC = (1 << 14), /* Slumber state capable */ -- HOST_CAP_PIO_MULTI = (1 << 15), /* PIO multiple DRQ support */ -- HOST_CAP_FBS = (1 << 16), /* FIS-based switching support */ -- HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ -- HOST_CAP_ONLY = (1 << 18), /* Supports AHCI mode only */ -- HOST_CAP_CLO = (1 << 24), /* Command List Override support */ -- HOST_CAP_LED = (1 << 25), /* Supports activity LED */ -- HOST_CAP_ALPM = (1 << 26), /* Aggressive Link PM support */ -- HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ -- HOST_CAP_MPS = (1 << 28), /* Mechanical presence switch */ -- HOST_CAP_SNTF = (1 << 29), /* SNotification register */ -- HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ -- HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ -+ HOST_CAP_SXS = BIT(5), /* Supports External SATA */ -+ HOST_CAP_EMS = BIT(6), /* Enclosure Management support */ -+ HOST_CAP_CCC = BIT(7), /* Command Completion Coalescing */ -+ HOST_CAP_PART = BIT(13), /* Partial state capable */ -+ HOST_CAP_SSC = BIT(14), /* Slumber state capable */ -+ HOST_CAP_PIO_MULTI = BIT(15), /* PIO multiple DRQ support */ -+ HOST_CAP_FBS = BIT(16), /* FIS-based switching support */ -+ HOST_CAP_PMP = BIT(17), /* Port Multiplier support */ -+ HOST_CAP_ONLY = BIT(18), /* Supports AHCI mode only */ -+ HOST_CAP_CLO = BIT(24), /* Command List Override support */ -+ HOST_CAP_LED = BIT(25), /* Supports activity LED */ -+ HOST_CAP_ALPM = BIT(26), /* Aggressive Link PM support */ -+ HOST_CAP_SSS = BIT(27), /* Staggered Spin-up */ -+ HOST_CAP_MPS = BIT(28), /* Mechanical presence switch */ -+ HOST_CAP_SNTF = BIT(29), /* SNotification register */ -+ HOST_CAP_NCQ = BIT(30), /* Native Command Queueing */ -+ HOST_CAP_64 = BIT(31), /* PCI DAC (64-bit DMA) support */ - - /* HOST_CAP2 bits */ -- HOST_CAP2_BOH = (1 << 0), /* BIOS/OS handoff supported */ -- HOST_CAP2_NVMHCI = (1 << 1), /* NVMHCI supported */ -- HOST_CAP2_APST = (1 << 2), /* Automatic partial to slumber */ -- HOST_CAP2_SDS = (1 << 3), /* Support device sleep */ -- HOST_CAP2_SADM = (1 << 4), /* Support aggressive DevSlp */ -- HOST_CAP2_DESO = (1 << 5), /* DevSlp from slumber only */ -+ HOST_CAP2_BOH = BIT(0), /* BIOS/OS handoff supported */ -+ HOST_CAP2_NVMHCI = BIT(1), /* NVMHCI supported */ -+ HOST_CAP2_APST = BIT(2), /* Automatic partial to slumber */ -+ HOST_CAP2_SDS = BIT(3), /* Support device sleep */ -+ HOST_CAP2_SADM = BIT(4), /* Support aggressive DevSlp */ -+ HOST_CAP2_DESO = BIT(5), /* DevSlp from slumber only */ - - /* registers for each SATA port */ - PORT_LST_ADDR = 0x00, /* command list DMA addr */ -@@ -129,24 +130,24 @@ enum { - PORT_DEVSLP = 0x44, /* device sleep */ - - /* PORT_IRQ_{STAT,MASK} bits */ -- PORT_IRQ_COLD_PRES = (1 << 31), /* cold presence detect */ -- PORT_IRQ_TF_ERR = (1 << 30), /* task file error */ -- PORT_IRQ_HBUS_ERR = (1 << 29), /* host bus fatal error */ -- PORT_IRQ_HBUS_DATA_ERR = (1 << 28), /* host bus data error */ -- PORT_IRQ_IF_ERR = (1 << 27), /* interface fatal error */ -- PORT_IRQ_IF_NONFATAL = (1 << 26), /* interface non-fatal error */ -- PORT_IRQ_OVERFLOW = (1 << 24), /* xfer exhausted available S/G */ -- PORT_IRQ_BAD_PMP = (1 << 23), /* incorrect port multiplier */ -- -- PORT_IRQ_PHYRDY = (1 << 22), /* PhyRdy changed */ -- PORT_IRQ_DEV_ILCK = (1 << 7), /* device interlock */ -- PORT_IRQ_CONNECT = (1 << 6), /* port connect change status */ -- PORT_IRQ_SG_DONE = (1 << 5), /* descriptor processed */ -- PORT_IRQ_UNK_FIS = (1 << 4), /* unknown FIS rx'd */ -- PORT_IRQ_SDB_FIS = (1 << 3), /* Set Device Bits FIS rx'd */ -- PORT_IRQ_DMAS_FIS = (1 << 2), /* DMA Setup FIS rx'd */ -- PORT_IRQ_PIOS_FIS = (1 << 1), /* PIO Setup FIS rx'd */ -- PORT_IRQ_D2H_REG_FIS = (1 << 0), /* D2H Register FIS rx'd */ -+ PORT_IRQ_COLD_PRES = BIT(31), /* cold presence detect */ -+ PORT_IRQ_TF_ERR = BIT(30), /* task file error */ -+ PORT_IRQ_HBUS_ERR = BIT(29), /* host bus fatal error */ -+ PORT_IRQ_HBUS_DATA_ERR = BIT(28), /* host bus data error */ -+ PORT_IRQ_IF_ERR = BIT(27), /* interface fatal error */ -+ PORT_IRQ_IF_NONFATAL = BIT(26), /* interface non-fatal error */ -+ PORT_IRQ_OVERFLOW = BIT(24), /* xfer exhausted available S/G */ -+ PORT_IRQ_BAD_PMP = BIT(23), /* incorrect port multiplier */ -+ -+ PORT_IRQ_PHYRDY = BIT(22), /* PhyRdy changed */ -+ PORT_IRQ_DEV_ILCK = BIT(7), /* device interlock */ -+ PORT_IRQ_CONNECT = BIT(6), /* port connect change status */ -+ PORT_IRQ_SG_DONE = BIT(5), /* descriptor processed */ -+ PORT_IRQ_UNK_FIS = BIT(4), /* unknown FIS rx'd */ -+ PORT_IRQ_SDB_FIS = BIT(3), /* Set Device Bits FIS rx'd */ -+ PORT_IRQ_DMAS_FIS = BIT(2), /* DMA Setup FIS rx'd */ -+ PORT_IRQ_PIOS_FIS = BIT(1), /* PIO Setup FIS rx'd */ -+ PORT_IRQ_D2H_REG_FIS = BIT(0), /* D2H Register FIS rx'd */ - - PORT_IRQ_FREEZE = PORT_IRQ_HBUS_ERR | - PORT_IRQ_IF_ERR | -@@ -162,34 +163,34 @@ enum { - PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS, - - /* PORT_CMD bits */ -- PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */ -- PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ -- PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ -- PORT_CMD_FBSCP = (1 << 22), /* FBS Capable Port */ -- PORT_CMD_ESP = (1 << 21), /* External Sata Port */ -- PORT_CMD_HPCP = (1 << 18), /* HotPlug Capable Port */ -- PORT_CMD_PMP = (1 << 17), /* PMP attached */ -- PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ -- PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ -- PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */ -- PORT_CMD_CLO = (1 << 3), /* Command list override */ -- PORT_CMD_POWER_ON = (1 << 2), /* Power up device */ -- PORT_CMD_SPIN_UP = (1 << 1), /* Spin up device */ -- PORT_CMD_START = (1 << 0), /* Enable port DMA engine */ -- -- PORT_CMD_ICC_MASK = (0xf << 28), /* i/f ICC state mask */ -- PORT_CMD_ICC_ACTIVE = (0x1 << 28), /* Put i/f in active state */ -- PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ -- PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ -+ PORT_CMD_ASP = BIT(27), /* Aggressive Slumber/Partial */ -+ PORT_CMD_ALPE = BIT(26), /* Aggressive Link PM enable */ -+ PORT_CMD_ATAPI = BIT(24), /* Device is ATAPI */ -+ PORT_CMD_FBSCP = BIT(22), /* FBS Capable Port */ -+ PORT_CMD_ESP = BIT(21), /* External Sata Port */ -+ PORT_CMD_HPCP = BIT(18), /* HotPlug Capable Port */ -+ PORT_CMD_PMP = BIT(17), /* PMP attached */ -+ PORT_CMD_LIST_ON = BIT(15), /* cmd list DMA engine running */ -+ PORT_CMD_FIS_ON = BIT(14), /* FIS DMA engine running */ -+ PORT_CMD_FIS_RX = BIT(4), /* Enable FIS receive DMA engine */ -+ PORT_CMD_CLO = BIT(3), /* Command list override */ -+ PORT_CMD_POWER_ON = BIT(2), /* Power up device */ -+ PORT_CMD_SPIN_UP = BIT(1), /* Spin up device */ -+ PORT_CMD_START = BIT(0), /* Enable port DMA engine */ -+ -+ PORT_CMD_ICC_MASK = (0xfu << 28), /* i/f ICC state mask */ -+ PORT_CMD_ICC_ACTIVE = (0x1u << 28), /* Put i/f in active state */ -+ PORT_CMD_ICC_PARTIAL = (0x2u << 28), /* Put i/f in partial state */ -+ PORT_CMD_ICC_SLUMBER = (0x6u << 28), /* Put i/f in slumber state */ - - /* PORT_FBS bits */ - PORT_FBS_DWE_OFFSET = 16, /* FBS device with error offset */ - PORT_FBS_ADO_OFFSET = 12, /* FBS active dev optimization offset */ - PORT_FBS_DEV_OFFSET = 8, /* FBS device to issue offset */ - PORT_FBS_DEV_MASK = (0xf << PORT_FBS_DEV_OFFSET), /* FBS.DEV */ -- PORT_FBS_SDE = (1 << 2), /* FBS single device error */ -- PORT_FBS_DEC = (1 << 1), /* FBS device error clear */ -- PORT_FBS_EN = (1 << 0), /* Enable FBS */ -+ PORT_FBS_SDE = BIT(2), /* FBS single device error */ -+ PORT_FBS_DEC = BIT(1), /* FBS device error clear */ -+ PORT_FBS_EN = BIT(0), /* Enable FBS */ - - /* PORT_DEVSLP bits */ - PORT_DEVSLP_DM_OFFSET = 25, /* DITO multiplier offset */ -@@ -197,50 +198,50 @@ enum { - PORT_DEVSLP_DITO_OFFSET = 15, /* DITO offset */ - PORT_DEVSLP_MDAT_OFFSET = 10, /* Minimum assertion time */ - PORT_DEVSLP_DETO_OFFSET = 2, /* DevSlp exit timeout */ -- PORT_DEVSLP_DSP = (1 << 1), /* DevSlp present */ -- PORT_DEVSLP_ADSE = (1 << 0), /* Aggressive DevSlp enable */ -+ PORT_DEVSLP_DSP = BIT(1), /* DevSlp present */ -+ PORT_DEVSLP_ADSE = BIT(0), /* Aggressive DevSlp enable */ - - /* hpriv->flags bits */ - - #define AHCI_HFLAGS(flags) .private_data = (void *)(flags) - -- AHCI_HFLAG_NO_NCQ = (1 << 0), -- AHCI_HFLAG_IGN_IRQ_IF_ERR = (1 << 1), /* ignore IRQ_IF_ERR */ -- AHCI_HFLAG_IGN_SERR_INTERNAL = (1 << 2), /* ignore SERR_INTERNAL */ -- AHCI_HFLAG_32BIT_ONLY = (1 << 3), /* force 32bit */ -- AHCI_HFLAG_MV_PATA = (1 << 4), /* PATA port */ -- AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */ -- AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ -- AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ -- AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */ -- AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */ -- AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = (1 << 11), /* treat SRST timeout as -+ AHCI_HFLAG_NO_NCQ = BIT(0), -+ AHCI_HFLAG_IGN_IRQ_IF_ERR = BIT(1), /* ignore IRQ_IF_ERR */ -+ AHCI_HFLAG_IGN_SERR_INTERNAL = BIT(2), /* ignore SERR_INTERNAL */ -+ AHCI_HFLAG_32BIT_ONLY = BIT(3), /* force 32bit */ -+ AHCI_HFLAG_MV_PATA = BIT(4), /* PATA port */ -+ AHCI_HFLAG_NO_MSI = BIT(5), /* no PCI MSI */ -+ AHCI_HFLAG_NO_PMP = BIT(6), /* no PMP */ -+ AHCI_HFLAG_SECT255 = BIT(8), /* max 255 sectors */ -+ AHCI_HFLAG_YES_NCQ = BIT(9), /* force NCQ cap on */ -+ AHCI_HFLAG_NO_SUSPEND = BIT(10), /* don't suspend */ -+ AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = BIT(11), /* treat SRST timeout as - link offline */ -- AHCI_HFLAG_NO_SNTF = (1 << 12), /* no sntf */ -- AHCI_HFLAG_NO_FPDMA_AA = (1 << 13), /* no FPDMA AA */ -- AHCI_HFLAG_YES_FBS = (1 << 14), /* force FBS cap on */ -- AHCI_HFLAG_DELAY_ENGINE = (1 << 15), /* do not start engine on -+ AHCI_HFLAG_NO_SNTF = BIT(12), /* no sntf */ -+ AHCI_HFLAG_NO_FPDMA_AA = BIT(13), /* no FPDMA AA */ -+ AHCI_HFLAG_YES_FBS = BIT(14), /* force FBS cap on */ -+ AHCI_HFLAG_DELAY_ENGINE = BIT(15), /* do not start engine on - port start (wait until - error-handling stage) */ -- AHCI_HFLAG_NO_DEVSLP = (1 << 17), /* no device sleep */ -- AHCI_HFLAG_NO_FBS = (1 << 18), /* no FBS */ -+ AHCI_HFLAG_NO_DEVSLP = BIT(17), /* no device sleep */ -+ AHCI_HFLAG_NO_FBS = BIT(18), /* no FBS */ - - #ifdef CONFIG_PCI_MSI -- AHCI_HFLAG_MULTI_MSI = (1 << 20), /* per-port MSI(-X) */ -+ AHCI_HFLAG_MULTI_MSI = BIT(20), /* per-port MSI(-X) */ - #else - /* compile out MSI infrastructure */ - AHCI_HFLAG_MULTI_MSI = 0, - #endif -- AHCI_HFLAG_WAKE_BEFORE_STOP = (1 << 22), /* wake before DMA stop */ -- AHCI_HFLAG_YES_ALPM = (1 << 23), /* force ALPM cap on */ -- AHCI_HFLAG_NO_WRITE_TO_RO = (1 << 24), /* don't write to read -+ AHCI_HFLAG_WAKE_BEFORE_STOP = BIT(22), /* wake before DMA stop */ -+ AHCI_HFLAG_YES_ALPM = BIT(23), /* force ALPM cap on */ -+ AHCI_HFLAG_NO_WRITE_TO_RO = BIT(24), /* don't write to read - only registers */ -- AHCI_HFLAG_IS_MOBILE = (1 << 25), /* mobile chipset, use -+ AHCI_HFLAG_IS_MOBILE = BIT(25), /* mobile chipset, use - SATA_MOBILE_LPM_POLICY - as default lpm_policy */ -- AHCI_HFLAG_SUSPEND_PHYS = (1 << 26), /* handle PHYs during -+ AHCI_HFLAG_SUSPEND_PHYS = BIT(26), /* handle PHYs during - suspend/resume */ -- AHCI_HFLAG_NO_SXS = (1 << 28), /* SXS not supported */ -+ AHCI_HFLAG_NO_SXS = BIT(28), /* SXS not supported */ - - /* ap->flags bits */ - -@@ -256,22 +257,22 @@ enum { - EM_MAX_RETRY = 5, - - /* em_ctl bits */ -- EM_CTL_RST = (1 << 9), /* Reset */ -- EM_CTL_TM = (1 << 8), /* Transmit Message */ -- EM_CTL_MR = (1 << 0), /* Message Received */ -- EM_CTL_ALHD = (1 << 26), /* Activity LED */ -- EM_CTL_XMT = (1 << 25), /* Transmit Only */ -- EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ -- EM_CTL_SGPIO = (1 << 19), /* SGPIO messages supported */ -- EM_CTL_SES = (1 << 18), /* SES-2 messages supported */ -- EM_CTL_SAFTE = (1 << 17), /* SAF-TE messages supported */ -- EM_CTL_LED = (1 << 16), /* LED messages supported */ -+ EM_CTL_RST = BIT(9), /* Reset */ -+ EM_CTL_TM = BIT(8), /* Transmit Message */ -+ EM_CTL_MR = BIT(0), /* Message Received */ -+ EM_CTL_ALHD = BIT(26), /* Activity LED */ -+ EM_CTL_XMT = BIT(25), /* Transmit Only */ -+ EM_CTL_SMB = BIT(24), /* Single Message Buffer */ -+ EM_CTL_SGPIO = BIT(19), /* SGPIO messages supported */ -+ EM_CTL_SES = BIT(18), /* SES-2 messages supported */ -+ EM_CTL_SAFTE = BIT(17), /* SAF-TE messages supported */ -+ EM_CTL_LED = BIT(16), /* LED messages supported */ - - /* em message type */ -- EM_MSG_TYPE_LED = (1 << 0), /* LED */ -- EM_MSG_TYPE_SAFTE = (1 << 1), /* SAF-TE */ -- EM_MSG_TYPE_SES2 = (1 << 2), /* SES-2 */ -- EM_MSG_TYPE_SGPIO = (1 << 3), /* SGPIO */ -+ EM_MSG_TYPE_LED = BIT(0), /* LED */ -+ EM_MSG_TYPE_SAFTE = BIT(1), /* SAF-TE */ -+ EM_MSG_TYPE_SES2 = BIT(2), /* SES-2 */ -+ EM_MSG_TYPE_SGPIO = BIT(3), /* SGPIO */ - }; - - struct ahci_cmd_hdr { diff --git a/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch b/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch index 683aa8a8df35f5..2fa91deece4b37 100644 --- a/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch +++ b/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch @@ -14,7 +14,7 @@ Signed-off-by: Rui Salvaterra --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c -@@ -2735,7 +2735,7 @@ int nf_conntrack_init_start(void) +@@ -2738,7 +2738,7 @@ int nf_conntrack_init_start(void) if (!nf_conntrack_htable_size) { nf_conntrack_htable_size diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index 2593f7c0fcbcf6..b4e92b4a185dc5 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -1679,6 +1679,10 @@ enum netdev_priv_flags { +@@ -1682,6 +1682,10 @@ enum netdev_priv_flags { IFF_TX_SKB_NO_LINEAR = BIT_ULL(31), }; @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN #define IFF_EBRIDGE IFF_EBRIDGE #define IFF_BONDING IFF_BONDING -@@ -1711,6 +1715,7 @@ enum netdev_priv_flags { +@@ -1714,6 +1718,7 @@ enum netdev_priv_flags { #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER #define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK #define IFF_TX_SKB_NO_LINEAR IFF_TX_SKB_NO_LINEAR @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau /* Specifies the type of the struct net_device::ml_priv pointer */ enum netdev_ml_priv_type { -@@ -2012,6 +2017,7 @@ struct net_device { +@@ -2015,6 +2020,7 @@ struct net_device { /* Read-mostly cache-line for fast-path access */ unsigned int flags; unsigned int priv_flags; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau const struct net_device_ops *netdev_ops; int ifindex; unsigned short gflags; -@@ -2072,6 +2078,11 @@ struct net_device { +@@ -2075,6 +2081,11 @@ struct net_device { const struct tlsdev_ops *tlsdev_ops; #endif @@ -58,7 +58,7 @@ Signed-off-by: Felix Fietkau const struct header_ops *header_ops; unsigned char operstate; -@@ -2146,6 +2157,10 @@ struct net_device { +@@ -2149,6 +2160,10 @@ struct net_device { struct mctp_dev __rcu *mctp_ptr; #endif diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index e56fd325123a41..4ccf229026a288 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -2098,6 +2098,8 @@ struct net_device { +@@ -2101,6 +2101,8 @@ struct net_device { struct netdev_hw_addr_list mc; struct netdev_hw_addr_list dev_addrs; @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau __u8 inner_protocol_type:1; --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6067,6 +6067,9 @@ static enum gro_result dev_gro_receive(s +@@ -6069,6 +6069,9 @@ static enum gro_result dev_gro_receive(s int same_flow; int grow; @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -8081,6 +8084,48 @@ static void __netdev_adjacent_dev_unlink +@@ -8083,6 +8086,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info, -@@ -8132,6 +8177,7 @@ static int __netdev_upper_dev_link(struc +@@ -8134,6 +8179,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -8228,6 +8274,7 @@ static void __netdev_upper_dev_unlink(st +@@ -8230,6 +8276,7 @@ static void __netdev_upper_dev_unlink(st __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); -@@ -9047,6 +9094,7 @@ int dev_set_mac_address(struct net_devic +@@ -9049,6 +9096,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch index 67e9d6419bcb42..d846a05a2487bc 100644 --- a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch +++ b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau /** * napi_disable - prevent NAPI from scheduling -@@ -3365,6 +3366,7 @@ struct softnet_data { +@@ -3368,6 +3369,7 @@ struct softnet_data { unsigned int processed; unsigned int time_squeeze; unsigned int received_rps; @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #endif --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4576,7 +4576,7 @@ static int rps_ipi_queued(struct softnet +@@ -4578,7 +4578,7 @@ static int rps_ipi_queued(struct softnet #ifdef CONFIG_RPS struct softnet_data *mysd = this_cpu_ptr(&softnet_data); @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5757,6 +5757,8 @@ static DEFINE_PER_CPU(struct work_struct +@@ -5759,6 +5759,8 @@ static DEFINE_PER_CPU(struct work_struct /* Network device is going away, flush any packets still pending */ static void flush_backlog(struct work_struct *work) { @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau struct sk_buff *skb, *tmp; struct softnet_data *sd; -@@ -5772,9 +5774,18 @@ static void flush_backlog(struct work_st +@@ -5774,9 +5776,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->process_queue); -@@ -5782,7 +5793,18 @@ static void flush_backlog(struct work_st +@@ -5784,7 +5795,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau } static bool flush_required(int cpu) -@@ -6465,6 +6487,7 @@ static int process_backlog(struct napi_s +@@ -6467,6 +6489,7 @@ static int process_backlog(struct napi_s local_irq_disable(); rps_lock(sd); @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6474,7 +6497,8 @@ static int process_backlog(struct napi_s +@@ -6476,7 +6499,8 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6891,6 +6915,57 @@ int dev_set_threaded(struct net_device * +@@ -6893,6 +6917,57 @@ int dev_set_threaded(struct net_device * } EXPORT_SYMBOL(dev_set_threaded); @@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -11369,6 +11444,9 @@ static int dev_cpu_dead(unsigned int old +@@ -11371,6 +11446,9 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; oldsd->rps_ipi_list = NULL; -@@ -11708,6 +11786,7 @@ static int __init net_dev_init(void) +@@ -11710,6 +11788,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index 506689965d36c6..1520a6cbe6d191 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -334,7 +334,7 @@ Signed-off-by: Wolfram Sang --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c -@@ -989,7 +989,7 @@ mv64xxx_i2c_probe(struct platform_device +@@ -1000,7 +1000,7 @@ mv64xxx_i2c_probe(struct platform_device if (IS_ERR(drv_data->reg_base)) return PTR_ERR(drv_data->reg_base); diff --git a/target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch b/target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch index b5779e09cb0d9d..c6b997dbbed54e 100644 --- a/target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch +++ b/target/linux/sifiveu/patches-5.15/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch @@ -14,7 +14,7 @@ Signed-off-by: David Abdurachmanov --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig -@@ -565,6 +565,14 @@ config BUILTIN_DTB +@@ -566,6 +566,14 @@ config BUILTIN_DTB depends on OF default y if XIP_KERNEL From a46e5ce4adaa02263bbe14568e0e714b297e6b91 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 14 Jun 2023 19:25:28 +0800 Subject: [PATCH 0209/1171] rockchip: fix setup network config for nanopi r2c Without it the WAN port won't be initialized properly. Fixes: 8f578c15b314 ("rockchip: add NanoPi R2C support") Reviewed-by: Robert Marko Signed-off-by: Tianling Shen (cherry picked from commit d312f12b1a6ee41e7bf1e07ec0349e141c07b92e) --- target/linux/rockchip/armv8/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network index c10e0cbcc9d185..7ac5148275a4d7 100644 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network @@ -7,6 +7,7 @@ rockchip_setup_interfaces() local board="$1" case "$board" in + friendlyarm,nanopi-r2c|\ friendlyarm,nanopi-r2s|\ friendlyarm,nanopi-r4s|\ xunlong,orangepi-r1-plus|\ From e9d2ff8045f803ec5c90b965946fa1162d5a5699 Mon Sep 17 00:00:00 2001 From: Jitao Lu Date: Wed, 14 Jun 2023 17:25:03 +0800 Subject: [PATCH 0210/1171] openssl: passing cflags to configure openssl sets additional cflags in its configuration script. We need to make it aware of our custom cflags to avoid adding conflicting cflags. Fixes: #12866 Signed-off-by: Jitao Lu (cherry picked from commit 51f57e7c2dd2799e34036ec74b3436bf490fade0) --- package/libs/openssl/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index a34a7849733c1d..0d09114f06e307 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_VERSION:=3.0.9 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_FLAGS:=no-mips16 gc-sections PKG_BUILD_PARALLEL:=1 @@ -366,6 +366,7 @@ define Build/Configure --libdir=lib \ --openssldir=/etc/ssl \ --cross-compile-prefix="$(TARGET_CROSS)" \ + $(TARGET_CFLAGS) \ $(TARGET_CPPFLAGS) \ $(TARGET_LDFLAGS) \ $(OPENSSL_OPTIONS) && \ From 63942b569e08a6190ec9096a03d184127b8f3f71 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Fri, 2 Dec 2022 15:26:17 +0000 Subject: [PATCH 0211/1171] scripts: sercomm-kernel-header.py: improve compatibility This improves compatibility with the elder stock firmwares of the following devices, which have not yet been merged into OpenWrt: - Beeline SmartBox Pro - Beeline SmartBox Turbo+ - WiFire S1500.NBN Without this, OpenWrt factory image installation may fail. Signed-off-by: Mikhail Zhilkin Signed-off-by: Maximilian Weinmann (cherry picked from commit 35a4418d3966ccf6229916b0021bd18871ef22dd) --- scripts/sercomm-kernel-header.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/sercomm-kernel-header.py b/scripts/sercomm-kernel-header.py index bfb29c6fe07b96..40bcbb138534ca 100755 --- a/scripts/sercomm-kernel-header.py +++ b/scripts/sercomm-kernel-header.py @@ -48,12 +48,12 @@ def get_kernel_header(args): struct.pack_into(' Date: Wed, 7 Dec 2022 23:44:09 +0700 Subject: [PATCH 0212/1171] ramips: Add support for Beeline SmartBox TURBO+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds support for Beeline Smart Box TURBO+ (Serсomm S3 CQR) router. Device specification -------------------- SoC Type: MediaTek MT7621AT (880 MHz, 2 cores) RAM (Nanya NT5CC64M16GP): 128 MiB Flash (Macronix MX30LF1G18AC): 128 MiB Wireless 2.4 GHz (MT7603EN): b/g/n, 2x2 Wireless 5 GHz (MT7615N): a/n/ac, 4x4 Ethernet: 5 ports - 5×GbE (WAN, LAN1-4) USB ports: 1xUSB3.0 Buttons: 2 button (reset, wps) LEDs: Red, Green, Blue Zigbee (EFR32MG1B232GG): 3.0 Stock bootloader: U-Boot 1.1.3 Power: 12 VDC, 1.5 A Installation (fw 2.0.9) ----------------------- 1. Login to the web interface under SuperUser (root) credentials. Password: SDXXXXXXXXXX, where SDXXXXXXXXXX is serial number of the device written on the backplate stick. 2. Navigate to Setting -> WAN. Add: Name - WAN1 Connection Type - Static IP Address - 172.16.0.1 Netmask - 255.255.255.0 Save -> Apply. Set default: WAN1 3. Enable SSH and HTTP on WAN. Setting -> Remote control. Add: Protocol - SSH Port - 22 IP Address - 172.16.0.1 Netmask - 255.255.255.0 WAN Interface - WAN1 Save ->Apply Add: Protocol - HTTP Port - 80 IP Address - 172.16.0.1 Netmask - 255.255.255.0 WAN interface - WAN1 Save -> Apply 4. Set up your PC ethernet: Connection Type - Static IP Address - 172.16.0.2 Netmask - 255.255.255.0 Gateway - 172.16.0.1 5. Connect PC using ethernet cable to the WAN port of the router 6. Connect to the router using SSH shell under SuperUser account 7. Make a mtd backup (optional, see related section) 8. Change bootflag to Sercomm1 and reboot: printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3 reboot 9. Login to the router web interface under admin account 10. Remove dots from the OpenWrt factory image filename 11. Update firmware via web using OpenWrt factory image Revert to stock --------------- Change bootflag to Sercomm1 in OpenWrt CLI and then reboot: printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3 mtd backup ---------- 1. Set up a tftp server (e.g. tftpd64 for windows) 2. Connect to a router using SSH shell and run the following commands: cd /tmp for i in 0 1 2 3 4 5 6 7 8 9 10; do nanddump -f mtd$i /dev/mtd$i; \ tftp -l mtd$i -p 172.16.0.2; md5sum mtd$i >> mtd.md5; rm mtd$i; done tftp -l mtd.md5 -p 171.16.0.2 Recovery -------- Use sercomm-recovery tool. Link: https://github.com/danitool/sercomm-recovery MAC Addresses (fw 2.0.9) ------------------------ +-----+------------+---------+ | use | address | example | +-----+------------+---------+ | LAN | label | *:e8 | | WAN | label + 1 | *:e9 | | 2g | label + 4 | *:ec | | 5g | label + 5 | *:ed | +-----+------------+---------+ The label MAC address was found in Factory 0x21000 Factory image format -------------------- +---+-------------------+-------------+--------------------+ | # | Offset | Size | Description | +---+-------------------+-------------+--------------------+ | 1 | 0x0 | 0x200 | Tag Header Factory | | 2 | 0x200 | 0x100 | Tag Header Kernel1 | | 3 | 0x300 | 0x100 | Tag Header Kernel2 | | 4 | 0x400 | SIZE_KERNEL | Kernel | | 5 | 0x400+SIZE_KERNEL | SIZE_ROOTFS | RootFS(UBI) | +---+-------------------+-------------+--------------------+ Co-authored-by: Mikhail Zhilkin Signed-off-by: Maximilian Weinmann (cherry picked from commit 8fcfb21b16e7537b9a871a1f67cb218c6be93149) --- package/boot/uboot-envtools/files/ramips | 1 + .../mt7621_beeline_smartbox-turbo-plus.dts | 248 ++++++++++++++++++ target/linux/ramips/image/common-sercomm.mk | 65 ++++- target/linux/ramips/image/mt7621.mk | 12 + .../mt7621/base-files/etc/board.d/01_leds | 1 + .../mt7621/base-files/etc/init.d/bootcount | 1 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 7 files changed, 320 insertions(+), 9 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 6f351af212294a..b3f37c7c3ebdf3 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -39,6 +39,7 @@ ampedwireless,ally-r1900k) ;; beeline,smartbox-giga|\ beeline,smartbox-turbo|\ +beeline,smartbox-turbo-plus|\ etisalat,s3|\ rostelecom,rt-sf-1) ubootenv_add_uci_config "/dev/mtd0" "0x80000" "0x1000" "0x20000" diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts new file mode 100644 index 00000000000000..507920bac22c0e --- /dev/null +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo-plus.dts @@ -0,0 +1,248 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "beeline,smartbox-turbo-plus", "mediatek,mt7621-soc"; + model = "Beeline SmartBox TURBO+"; + + aliases { + label-mac-device = &gmac0; + + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "blue:wan"; + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: led-1 { + label = "green:status"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: led-2 { + label = "red:status"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + ubi-concat { + compatible = "mtd-concat"; + devices = <&ubiconcat0 &ubiconcat1 &ubiconcat2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x4f80000>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "sercomm,sc-partitions", "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x100000>; + sercomm,scpart-id = <0>; + read-only; + }; + + partition@100000 { + label = "dynamic partition map"; + reg = <0x100000 0x100000>; + sercomm,scpart-id = <1>; + read-only; + }; + + factory: partition@200000 { + label = "Factory"; + reg = <0x200000 0x100000>; + sercomm,scpart-id = <2>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_21000: macaddr@21000 { + reg = <0x21000 0x6>; + }; + }; + + partition@300000 { + label = "Boot Flag"; + reg = <0x300000 0x100000>; + sercomm,scpart-id = <3>; + }; + + partition@400000 { + label = "kernel"; + reg = <0x400000 0x600000>; + sercomm,scpart-id = <4>; + }; + + partition@a00000 { + label = "Kernel 2"; + reg = <0xa00000 0x600000>; + sercomm,scpart-id = <5>; + read-only; + }; + + ubiconcat0: partition@1000000 { + label = "File System 1"; + reg = <0x1000000 0x2000000>; + sercomm,scpart-id = <6>; + }; + + partition@3000000 { + label = "File System 2"; + reg = <0x3000000 0x2000000>; + sercomm,scpart-id = <7>; + read-only; + }; + + ubiconcat1: partition@5000000 { + label = "Configuration/log"; + reg = <0x5000000 0x1400000>; + sercomm,scpart-id = <8>; + }; + + ubiconcat2: partition@6400000 { + label = "application tmp buffer (Ftool)"; + reg = <0x6400000 0x1b80000>; + sercomm,scpart-id = <9>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(5)>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + ieee80211-freq-limit = <2400000 2500000>; + + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(4)>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(1)>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan3"; + }; + + port@4 { + status = "okay"; + label = "lan4"; + }; + }; +}; + +&uartlite3 { + status = "okay"; + current-speed = <57600>; +}; + +&state_default { + gpio { + groups = "i2c", "jtag"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/common-sercomm.mk b/target/linux/ramips/image/common-sercomm.mk index 83bb2a742c98f9..fbe29d701749be 100644 --- a/target/linux/ramips/image/common-sercomm.mk +++ b/target/linux/ramips/image/common-sercomm.mk @@ -1,4 +1,5 @@ DEVICE_VARS += SERCOMM_KERNEL_OFFSET SERCOMM_ROOTFS_OFFSET +DEVICE_VARS += SERCOMM_KERNEL2_OFFSET SERCOMM_ROOTFS2_OFFSET define Build/sercomm-crypto $(TOPDIR)/scripts/sercomm-crypto.py \ @@ -16,6 +17,23 @@ define Build/sercomm-crypto rm -f $@.enc $@.key endef +define Build/sercomm-factory-cqr + $(TOPDIR)/scripts/sercomm-pid.py \ + --hw-version $(SERCOMM_HWVER) \ + --hw-id $(SERCOMM_HWID) \ + --sw-version $(SERCOMM_SWVER) \ + --pid-file $@.fhdr + printf $$(stat -c%s $(IMAGE_KERNEL)) | \ + dd seek=$$((0x70)) of=$@.fhdr bs=1 conv=notrunc 2>/dev/null + printf $$(($$(stat -c%s $@)-$$(stat -c%s $(IMAGE_KERNEL))-$$((0x200)))) | \ + dd seek=$$((0x80)) of=$@.fhdr bs=1 conv=notrunc 2>/dev/null + dd bs=$$((0x200)) skip=1 if=$@ conv=notrunc 2>/dev/null | \ + $(MKHASH) md5 | awk '{print $$1}' | tr -d '\n' | \ + dd seek=$$((0x1e0)) of=$@.fhdr bs=1 conv=notrunc 2>/dev/null + dd if=$@ >> $@.fhdr 2>/dev/null + mv $@.fhdr $@ +endef + define Build/sercomm-kernel $(TOPDIR)/scripts/sercomm-kernel-header.py \ --kernel-image $@ \ @@ -26,6 +44,22 @@ define Build/sercomm-kernel mv $@.hdr $@ endef +define Build/sercomm-kernel-factory + $(TOPDIR)/scripts/sercomm-kernel-header.py \ + --kernel-image $@ \ + --kernel-offset $(SERCOMM_KERNEL_OFFSET) \ + --rootfs-offset $(SERCOMM_ROOTFS_OFFSET) \ + --output-header $@.khdr1 + $(TOPDIR)/scripts/sercomm-kernel-header.py \ + --kernel-image $@ \ + --kernel-offset $(SERCOMM_KERNEL2_OFFSET) \ + --rootfs-offset $(SERCOMM_ROOTFS2_OFFSET) \ + --output-header $@.khdr2 + cat $@.khdr1 $@.khdr2 > $@.khdr + dd if=$@ >> $@.khdr 2>/dev/null + mv $@.khdr $@ +endef + define Build/sercomm-part-tag $(call Build/sercomm-part-tag-common,$(word 1,$(1)) $@) endef @@ -64,24 +98,37 @@ define Build/sercomm-prepend-tagged-kernel mv $(IMAGE_KERNEL).tagged $@ endef -define Device/sercomm_dxx - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 6144k - UBINIZE_OPTS := -E 5 +define Device/sercomm + $(Device/nand) LOADER_TYPE := bin + KERNEL_SIZE := 6144k KERNEL_LOADADDR := 0x81001000 LZMA_TEXT_START := 0x82800000 + SERCOMM_KERNEL_OFFSET := 0x400100 + SERCOMM_ROOTFS_OFFSET := 0x1000000 + IMAGES += factory.img +endef + +define Device/sercomm_cxx + $(Device/sercomm) + SERCOMM_KERNEL2_OFFSET := 0xa00100 + SERCOMM_ROOTFS2_OFFSET := 0x3000000 + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma -a0 | \ + uImage lzma + IMAGE/sysupgrade.bin := append-kernel | sercomm-kernel | \ + sysupgrade-tar kernel=$$$$@ | append-metadata + IMAGE/factory.img := append-kernel | sercomm-kernel-factory | \ + append-ubi | sercomm-factory-cqr +endef + +define Device/sercomm_dxx + $(Device/sercomm) KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma -a0 | \ uImage lzma | sercomm-kernel KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | \ lzma -a0 | uImage lzma - IMAGES += factory.img IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.img := append-ubi | check-size | \ sercomm-part-tag rootfs | sercomm-prepend-tagged-kernel kernel | \ gzip | sercomm-payload | sercomm-crypto - SERCOMM_KERNEL_OFFSET := 0x400100 - SERCOMM_ROOTFS_OFFSET := 0x1000000 endef diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 340d4ba4a1b321..b8fa0cefdb3fb1 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -410,6 +410,18 @@ define Device/beeline_smartbox-turbo endef TARGET_DEVICES += beeline_smartbox-turbo +define Device/beeline_smartbox-turbo-plus + $(Device/sercomm_cxx) + IMAGE_SIZE := 32768k + SERCOMM_HWID := CQR + SERCOMM_HWVER := 10000 + SERCOMM_SWVER := 2010 + DEVICE_VENDOR := Beeline + DEVICE_MODEL := SmartBox TURBO+ + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 +endef +TARGET_DEVICES += beeline_smartbox-turbo-plus + define Device/belkin_rt1800 $(Device/nand) IMAGE_SIZE := 49152k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index b243acbbbf439b..9b15da0d22b636 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -35,6 +35,7 @@ asus,rt-n56u-b1) beeline,smartbox-flash|\ beeline,smartbox-giga|\ beeline,smartbox-turbo|\ +beeline,smartbox-turbo-plus|\ etisalat,s3|\ rostelecom,rt-sf-1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index 597c2da60fb9a7..9db700bff5560b 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -9,6 +9,7 @@ boot() { echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s - ;; beeline,smartbox-turbo|\ + beeline,smartbox-turbo-plus|\ rostelecom,rt-sf-1) [[ $(hexdump -n 1 -e '/1 "%1d"' -s $((0x20001)) /dev/mtd3) == \ $((0xff)) ]] || printf '\xff' | dd of=/dev/mtdblock3 \ diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index ce5fdd61ed0578..cef58ec3bad2b4 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -60,6 +60,7 @@ platform_do_upgrade() { beeline,smartbox-flash|\ beeline,smartbox-giga|\ beeline,smartbox-turbo|\ + beeline,smartbox-turbo-plus|\ belkin,rt1800|\ dlink,dap-x1860-a1|\ dlink,dir-1960-a1|\ From 6d3770501d883c3adbfa29b5b4e9451ae84d3ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 10 Jun 2023 17:17:11 +0200 Subject: [PATCH 0213/1171] bmips: fix DMA RAC flush MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BMIPS_GET_CBR() returns an invalid address on some SoCs. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 62cdca25edc7e02249a7dd01c2218ee83e6ed145) --- .../203-mips-bmips-dma-fix-CBR-address.patch | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 target/linux/bmips/patches-5.15/203-mips-bmips-dma-fix-CBR-address.patch diff --git a/target/linux/bmips/patches-5.15/203-mips-bmips-dma-fix-CBR-address.patch b/target/linux/bmips/patches-5.15/203-mips-bmips-dma-fix-CBR-address.patch new file mode 100644 index 00000000000000..57bf395e2e0daf --- /dev/null +++ b/target/linux/bmips/patches-5.15/203-mips-bmips-dma-fix-CBR-address.patch @@ -0,0 +1,84 @@ +From 3e4c3863e0cfb8c2abdff6bb494ca69d3d2aed9c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Sat, 10 Jun 2023 17:01:40 +0200 +Subject: [PATCH] mips: bmips: dma: fix CBR address +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some BCM63xx SoCs may return CBR address as 0. + +Signed-off-by: Álvaro Fernández Rojas +--- + arch/mips/bmips/dma.c | 12 ++++-------- + arch/mips/bmips/setup.c | 11 ++++------- + 2 files changed, 8 insertions(+), 15 deletions(-) + +--- a/arch/mips/bmips/dma.c ++++ b/arch/mips/bmips/dma.c +@@ -64,11 +64,10 @@ phys_addr_t dma_to_phys(struct device *d + return dma_addr; + } + +-bool bmips_rac_flush_disable; ++void __iomem *bmips_cbr_addr; + + void arch_sync_dma_for_cpu_all(void) + { +- void __iomem *cbr = BMIPS_GET_CBR(); + u32 cfg; + + if (boot_cpu_type() != CPU_BMIPS3300 && +@@ -76,13 +75,10 @@ void arch_sync_dma_for_cpu_all(void) + boot_cpu_type() != CPU_BMIPS4380) + return; + +- if (unlikely(bmips_rac_flush_disable)) +- return; +- + /* Flush stale data out of the readahead cache */ +- cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG); +- __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG); +- __raw_readl(cbr + BMIPS_RAC_CONFIG); ++ cfg = __raw_readl(bmips_cbr_addr + BMIPS_RAC_CONFIG); ++ __raw_writel(cfg | 0x100, bmips_cbr_addr + BMIPS_RAC_CONFIG); ++ __raw_readl(bmips_cbr_addr + BMIPS_RAC_CONFIG); + } + + static int __init bmips_init_dma_ranges(void) +--- a/arch/mips/bmips/setup.c ++++ b/arch/mips/bmips/setup.c +@@ -89,7 +89,7 @@ + + #define DDR_CSEND_REG 0x8 + +-extern bool bmips_rac_flush_disable; ++extern void __iomem *bmips_cbr_addr; + + static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000; + +@@ -170,12 +170,6 @@ static void bcm6358_quirks(void) + * disable SMP for now + */ + bmips_smp_enabled = 0; +- +- /* +- * RAC flush causes kernel panics on BCM6358 when booting from TP1 +- * because the bootloader is not initializing it properly. +- */ +- bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31)); + } + + static void bcm6368_quirks(void) +@@ -198,6 +192,11 @@ static const struct bmips_quirk bmips_qu + + void __init prom_init(void) + { ++ if (!(read_c0_brcm_cbr() >> 18)) ++ bmips_cbr_addr = (void __iomem *)0xff400000; ++ else ++ bmips_cbr_addr = BMIPS_GET_CBR(); ++ + bmips_cpu_setup(); + register_bmips_smp_ops(); + } From 43746c4c5a85e1762edf383909f1734ad0543825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Sat, 17 Jun 2023 19:34:05 +0200 Subject: [PATCH 0214/1171] bmips: enable the data Read Ahead Cache for BMIPS4350 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The data RAC is left disabled by the bootloader in some SoCs, at least in the core it boots from. Enabling this feature increases the performance up to +30% depending on the task. The kernel enables the whole RAC unconditionally on BMIPS3300 CPUs. Enable the data RAC in a similar way also for BMIPS4350. Tested on DGND3700 v1 (BCM6368) and HG556a (BCM6358). Signed-off-by: Daniel González Cabanelas (cherry picked from commit 6d1265b14850abaf8980e5cebef3e559b1fdcfb9) --- ...4-mips-bmips-enable-RAC-on-BMIPS4350.patch | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 target/linux/bmips/patches-5.15/204-mips-bmips-enable-RAC-on-BMIPS4350.patch diff --git a/target/linux/bmips/patches-5.15/204-mips-bmips-enable-RAC-on-BMIPS4350.patch b/target/linux/bmips/patches-5.15/204-mips-bmips-enable-RAC-on-BMIPS4350.patch new file mode 100644 index 00000000000000..26bd03e3298af0 --- /dev/null +++ b/target/linux/bmips/patches-5.15/204-mips-bmips-enable-RAC-on-BMIPS4350.patch @@ -0,0 +1,42 @@ +From 7f862eaedac56b67972393f0a9affcd2fe53479b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= +Date: Sun, 18 Jun 2023 19:59:25 +0200 +Subject: [PATCH] mips: bmips: enable RAC on BMIPS4350 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The data RAC is left disabled by the bootloader in some SoCs, at least in +the core it boots from. +Enabling this feature increases the performance up to +30% depending on the +task. + +Signed-off-by: Daniel González Cabanelas +Signed-off-by: Álvaro Fernández Rojas +--- + arch/mips/kernel/smp-bmips.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/arch/mips/kernel/smp-bmips.c ++++ b/arch/mips/kernel/smp-bmips.c +@@ -614,6 +614,20 @@ void bmips_cpu_setup(void) + __raw_readl(cbr + BMIPS_RAC_ADDRESS_RANGE); + break; + ++ case CPU_BMIPS4350: ++ /* Enable data RAC */ ++ if (!(read_c0_brcm_cmt_local() & (1 << 31))) { ++ cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG); ++ __raw_writel(cfg | 0xa, cbr + BMIPS_RAC_CONFIG); ++ __raw_readl(cbr + BMIPS_RAC_CONFIG); ++ } else { ++ cbr = (void __iomem *)0xff400000; ++ cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG_1); ++ __raw_writel(cfg | 0xa, cbr + BMIPS_RAC_CONFIG_1); ++ __raw_readl(cbr + BMIPS_RAC_CONFIG_1); ++ } ++ break; ++ + case CPU_BMIPS4380: + /* CBG workaround for early BMIPS4380 CPUs */ + switch (read_c0_prid()) { From ac6832110ac4a6c6f2c4a789d2ab6fa4075a6bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Sun, 18 Jun 2023 21:34:59 +0200 Subject: [PATCH 0215/1171] bmips: add support for NuCom R5010UNv2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NuCom R5010UNv2 is a wifi fast ethernet router, 2.4 GHz single band with two external antennas. Hardware: - SoC: Broadcom BCM6328 - CPU: single core BMIPS4350 V7.5 @ 320Mhz - RAM: 64 MB DDR2 - Flash: 16 MB SPI NOR - Ethernet LAN: 4x 100Mbit - Wifi 2.4 GHz: Broadcom BCM43217 802.11bgn (onboard) - USB: 1x 2.0 - Buttons: 2x - ADSL: yes, unsupported - LEDs: 7x - UART: yes Installation via CFE web UI: 1. Power off the router and press the RESET button 2. Power on the router and wait 12 or more seconds 3. Release the RESET button 4. Browse to http://192.168.1.1 and upload the Openwrt cfe firmware 5. Wait a few minutes for it to finish Signed-off-by: Daniel González Cabanelas (cherry picked from commit 6cb3328b4fd4939f3800d4be9d52744b753de1b6) --- .../bcm6328/base-files/etc/board.d/01_leds | 1 + .../bcm6328/base-files/etc/board.d/02_network | 3 +- .../base-files/etc/uci-defaults/09_fix_crc | 3 +- .../bmips/dts/bcm6328-nucom-r5010unv2.dts | 216 ++++++++++++++++++ target/linux/bmips/image/bcm6328.mk | 13 ++ 5 files changed, 234 insertions(+), 2 deletions(-) create mode 100644 target/linux/bmips/dts/bcm6328-nucom-r5010unv2.dts diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds index 5ece1f7ba1b0c3..5e80eb34e736e4 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds +++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds @@ -6,6 +6,7 @@ board_config_update case "$(board_name)" in +nucom,r5010unv2 |\ sercomm,ad1018) ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" ;; diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network index 66f9282e48869f..bfedad9e455835 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network @@ -6,7 +6,8 @@ board_config_update case "$(board_name)" in comtrend,ar-5381u |\ -comtrend,ar-5387un) +comtrend,ar-5387un |\ +nucom,r5010unv2) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; diff --git a/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc index 21f18b4b819502..2056ea017ff997 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc @@ -4,7 +4,8 @@ case "$(board_name)" in comtrend,ar-5381u |\ -comtrend,ar-5387un) +comtrend,ar-5387un |\ +nucom,r5010unv2) mtd fixtrx firmware ;; esac diff --git a/target/linux/bmips/dts/bcm6328-nucom-r5010unv2.dts b/target/linux/bmips/dts/bcm6328-nucom-r5010unv2.dts new file mode 100644 index 00000000000000..826b2a61e25c5e --- /dev/null +++ b/target/linux/bmips/dts/bcm6328-nucom-r5010unv2.dts @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6328.dtsi" + +/ { + model = "NuCom R5010UNv2"; + compatible = "nucom,r5010unv2", "brcm,bcm6328"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + bcm43217-sprom { + compatible = "brcm,bcma-sprom"; + + pci-bus = <1>; + pci-dev = <0>; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm43217-sprom.bin"; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&hsspi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <16666667>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "cfe"; + reg = <0x000000 0x010000>; + read-only; + }; + + partition@10000 { + compatible = "brcm,bcm963xx-imagetag"; + label = "firmware"; + reg = <0x010000 0xfe0000>; + }; + + partition@ff0000 { + label = "nvram"; + reg = <0xff0000 0x010000>; + }; + }; + }; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ephy0_act_led &pinctrl_ephy1_act_led + &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led + &pinctrl_leds>; + + led@1 { + reg = <1>; + active-low; + label = "green:internet"; + }; + + led@2 { + reg = <2>; + active-low; + label = "red:internet"; + }; + + led@3 { + reg = <3>; + active-low; + label = "green:dsl"; + }; + + led_power_green: led@4 { + reg = <4>; + active-low; + label = "green:power"; + }; + + led_power_red: led@5 { + reg = <5>; + active-low; + label = "red:power"; + panic-indicator; + }; + + led@10 { + reg = <10>; + active-low; + label = "green:wps"; + }; + + led@11 { + reg = <11>; + active-low; + label = "green:usb"; + }; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio1", "gpio2", "gpio3", + "gpio4", "gpio5", "gpio10", + "gpio11"; + }; +}; + +&switch0 { + ports { + port@0 { + reg = <0>; + label = "lan1"; + + phy-handle = <&phy1>; + phy-mode = "mii"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + + phy-handle = <&phy2>; + phy-mode = "mii"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + + phy-handle = <&phy3>; + phy-mode = "mii"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + + phy-handle = <&phy4>; + phy-mode = "mii"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6328.mk b/target/linux/bmips/image/bcm6328.mk index ef74410f1e0d0f..8023ef8fa1eef9 100644 --- a/target/linux/bmips/image/bcm6328.mk +++ b/target/linux/bmips/image/bcm6328.mk @@ -26,6 +26,19 @@ define Device/comtrend_ar-5387un endef TARGET_DEVICES += comtrend_ar-5387un +define Device/nucom_r5010unv2 + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := NuCom + DEVICE_MODEL := R5010UNv2 + CHIP_ID := 6328 + CFE_BOARD_ID := 96328ang + FLASH_MB := 16 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-43217-sprom \ + kmod-leds-bcm6328 +endef +TARGET_DEVICES += nucom_r5010unv2 + define Device/sercomm_ad1018 $(Device/sercomm-nand) DEVICE_VENDOR := Sercomm From 09322f3c0ce0750f7983bfe55ec035fdd0ac9580 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sat, 10 Jun 2023 23:13:33 -0400 Subject: [PATCH 0216/1171] kernel: remove bridge offload hack This patch initially introduced in 94b4da9b4aaded6ed8a5bd93bf38a7c92753fe68 breaks mvebu devices when using vlan filtering with kernel 5.15 or 6.1, it was working ok in 5.10. With this patch, frame that should exit untagged from the switch exit tagged. Running 'tcpdump -Q out -evnnli eth1' (eth1 being the dsa interface) - with the hack, frame is sent directly to the destination port 4 with VID 2, so the switch leave the tag as instructed: 11:22:33:44:55:66 > 77:88:99:aa:bb:cc, Marvell EDSA ethertype 0xdada (Unknown), rsvd 0 0, mode From CPU, target dev 0, port 4, tagged, VID 2, FPri 0, ethertype ARP (0x0806), length 50: Ethernet (len 6), IPv4 (len 4), Request who-has 5.6.7.8 tell 1.2.3.4, length 28 - without the hack, frame is sent to the switch that performs the forwarding decision and untagging: 11:22:33:44:55:66 > 77:88:99:aa:bb:cc, Marvell EDSA ethertype 0xdada (Unknown), rsvd 0 0, mode Forward, dev 1, port 0, tagged, VID 2, FPri 0, ethertype ARP (0x0806), length 50: Ethernet (len 6), IPv4 (len 4), Request who-has 5.6.7.8 tell 1.2.3.4, length 28 Removing this patch makes my Turris Omnia usable with vlan filtering, ie wifi device can talk to wired device again. Using kernel 5.15 some broadcast/multicast traffic is still leaked (on a VLAN 2 access port I see tagged VLAN 3 frame), using kernel 6.1 fixes that. People needing the extra performance should try the bridger package. Acked-by: Felix Fietkau Signed-off-by: Etienne Champetier (cherry picked from commit 244328b19c3943bb145b72f0d85062f535e56fbd) --- .../hack-5.15/600-bridge_offload.patch | 846 ------------------ 1 file changed, 846 deletions(-) delete mode 100644 target/linux/generic/hack-5.15/600-bridge_offload.patch diff --git a/target/linux/generic/hack-5.15/600-bridge_offload.patch b/target/linux/generic/hack-5.15/600-bridge_offload.patch deleted file mode 100644 index 9d71a741b25d5c..00000000000000 --- a/target/linux/generic/hack-5.15/600-bridge_offload.patch +++ /dev/null @@ -1,846 +0,0 @@ -From 11c3fae5afa6cac444d12622e2cf5af60a99c1ef Mon Sep 17 00:00:00 2001 -From: OpenWrt community -Date: Wed, 13 Jul 2022 13:43:15 +0200 -Subject: [PATCH] net/bridge: add bridge offload - ---- - include/linux/if_bridge.h | 1 + - net/bridge/Makefile | 2 +- - net/bridge/br.c | 8 + - net/bridge/br_device.c | 2 + - net/bridge/br_fdb.c | 5 + - net/bridge/br_forward.c | 3 + - net/bridge/br_if.c | 6 +- - net/bridge/br_input.c | 5 + - net/bridge/br_offload.c | 438 ++++++++++++++++++++++++++++++++ - net/bridge/br_private.h | 22 +- - net/bridge/br_private_offload.h | 23 ++ - net/bridge/br_stp.c | 3 + - net/bridge/br_sysfs_br.c | 35 +++ - net/bridge/br_sysfs_if.c | 2 + - net/bridge/br_vlan_tunnel.c | 3 + - 15 files changed, 555 insertions(+), 3 deletions(-) - create mode 100644 net/bridge/br_offload.c - create mode 100644 net/bridge/br_private_offload.h - ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -59,6 +59,7 @@ struct br_ip_list { - #define BR_MRP_LOST_IN_CONT BIT(19) - #define BR_TX_FWD_OFFLOAD BIT(20) - #define BR_BPDU_FILTER BIT(21) -+#define BR_OFFLOAD BIT(22) - - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - ---- a/net/bridge/Makefile -+++ b/net/bridge/Makefile -@@ -5,7 +5,7 @@ - - obj-$(CONFIG_BRIDGE) += bridge.o - --bridge-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \ -+bridge-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o br_offload.o \ - br_ioctl.o br_stp.o br_stp_bpdu.o \ - br_stp_if.o br_stp_timer.o br_netlink.o \ - br_netlink_tunnel.o br_arp_nd_proxy.o ---- a/net/bridge/br.c -+++ b/net/bridge/br.c -@@ -18,6 +18,7 @@ - #include - - #include "br_private.h" -+#include "br_private_offload.h" - - /* - * Handle changes in state of network devices enslaved to a bridge. -@@ -381,6 +382,10 @@ static int __init br_init(void) - if (err) - goto err_out; - -+ err = br_offload_init(); -+ if (err) -+ goto err_out0; -+ - err = register_pernet_subsys(&br_net_ops); - if (err) - goto err_out1; -@@ -430,6 +435,8 @@ err_out3: - err_out2: - unregister_pernet_subsys(&br_net_ops); - err_out1: -+ br_offload_fini(); -+err_out0: - br_fdb_fini(); - err_out: - stp_proto_unregister(&br_stp_proto); -@@ -452,6 +459,7 @@ static void __exit br_deinit(void) - #if IS_ENABLED(CONFIG_ATM_LANE) - br_fdb_test_addr_hook = NULL; - #endif -+ br_offload_fini(); - br_fdb_fini(); - } - ---- a/net/bridge/br_device.c -+++ b/net/bridge/br_device.c -@@ -524,6 +524,8 @@ void br_dev_setup(struct net_device *dev - br->bridge_hello_time = br->hello_time = 2 * HZ; - br->bridge_forward_delay = br->forward_delay = 15 * HZ; - br->bridge_ageing_time = br->ageing_time = BR_DEFAULT_AGEING_TIME; -+ br->offload_cache_size = 128; -+ br->offload_cache_reserved = 8; - dev->max_mtu = ETH_MAX_MTU; - - br_netfilter_rtable_init(br); ---- a/net/bridge/br_fdb.c -+++ b/net/bridge/br_fdb.c -@@ -23,6 +23,7 @@ - #include - #include - #include "br_private.h" -+#include "br_private_offload.h" - - static const struct rhashtable_params br_fdb_rht_params = { - .head_offset = offsetof(struct net_bridge_fdb_entry, rhnode), -@@ -518,6 +519,8 @@ static struct net_bridge_fdb_entry *fdb_ - fdb->key.vlan_id = vid; - fdb->flags = flags; - fdb->updated = fdb->used = jiffies; -+ INIT_HLIST_HEAD(&fdb->offload_in); -+ INIT_HLIST_HEAD(&fdb->offload_out); - if (rhashtable_lookup_insert_fast(&br->fdb_hash_tbl, - &fdb->rhnode, - br_fdb_rht_params)) { -@@ -794,6 +797,8 @@ static void fdb_notify(struct net_bridge - struct sk_buff *skb; - int err = -ENOBUFS; - -+ br_offload_fdb_update(fdb); -+ - if (swdev_notify) - br_switchdev_fdb_notify(br, fdb, type); - ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -16,6 +16,7 @@ - #include - #include - #include "br_private.h" -+#include "br_private_offload.h" - - /* Don't forward packets to originating port or forwarding disabled */ - static inline int should_deliver(const struct net_bridge_port *p, -@@ -32,6 +33,8 @@ static inline int should_deliver(const s - - int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb) - { -+ br_offload_output(skb); -+ - skb_push(skb, ETH_HLEN); - if (!is_skb_forwardable(skb->dev, skb)) - goto drop; ---- a/net/bridge/br_if.c -+++ b/net/bridge/br_if.c -@@ -25,6 +25,7 @@ - #include - - #include "br_private.h" -+#include "br_private_offload.h" - - /* - * Determine initial path cost based on speed. -@@ -428,7 +429,7 @@ static struct net_bridge_port *new_nbp(s - p->path_cost = port_cost(dev); - p->priority = 0x8000 >> BR_PORT_BITS; - p->port_no = index; -- p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD; -+ p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD | BR_OFFLOAD; - br_init_port(p); - br_set_state(p, BR_STATE_DISABLED); - br_stp_port_timer_init(p); -@@ -771,6 +772,9 @@ void br_port_flags_change(struct net_bri - - if (mask & BR_NEIGH_SUPPRESS) - br_recalculate_neigh_suppress_enabled(br); -+ -+ if (mask & BR_OFFLOAD) -+ br_offload_port_state(p); - } - - bool br_port_flag_is_set(const struct net_device *dev, unsigned long flag) ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -22,6 +22,7 @@ - #include - #include "br_private.h" - #include "br_private_tunnel.h" -+#include "br_private_offload.h" - - static int - br_netif_receive_skb(struct net *net, struct sock *sk, struct sk_buff *skb) -@@ -171,6 +172,7 @@ int br_handle_frame_finish(struct net *n - dst->used = now; - br_forward(dst->dst, skb, local_rcv, false); - } else { -+ br_offload_skb_disable(skb); - if (!mcast_hit) - br_flood(br, skb, pkt_type, local_rcv, false); - else -@@ -304,6 +306,9 @@ static rx_handler_result_t br_handle_fra - memset(skb->cb, 0, sizeof(struct br_input_skb_cb)); - - p = br_port_get_rcu(skb->dev); -+ if (br_offload_input(p, skb)) -+ return RX_HANDLER_CONSUMED; -+ - if (p->flags & BR_VLAN_TUNNEL) - br_handle_ingress_vlan_tunnel(skb, p, nbp_vlan_group_rcu(p)); - ---- /dev/null -+++ b/net/bridge/br_offload.c -@@ -0,0 +1,438 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+#include -+#include -+#include "br_private.h" -+#include "br_private_offload.h" -+ -+static DEFINE_SPINLOCK(offload_lock); -+ -+struct bridge_flow_key { -+ u8 dest[ETH_ALEN]; -+ u8 src[ETH_ALEN]; -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ u16 vlan_tag; -+ bool vlan_present; -+#endif -+}; -+ -+struct bridge_flow { -+ struct net_bridge_port *port; -+ struct rhash_head node; -+ struct bridge_flow_key key; -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ bool vlan_out_present; -+ u16 vlan_out; -+#endif -+ -+ unsigned long used; -+ struct net_bridge_fdb_entry *fdb_in, *fdb_out; -+ struct hlist_node fdb_list_in, fdb_list_out; -+ -+ struct rcu_head rcu; -+}; -+ -+static const struct rhashtable_params flow_params = { -+ .automatic_shrinking = true, -+ .head_offset = offsetof(struct bridge_flow, node), -+ .key_len = sizeof(struct bridge_flow_key), -+ .key_offset = offsetof(struct bridge_flow, key), -+}; -+ -+static struct kmem_cache *offload_cache __read_mostly; -+ -+static void -+flow_rcu_free(struct rcu_head *head) -+{ -+ struct bridge_flow *flow; -+ -+ flow = container_of(head, struct bridge_flow, rcu); -+ kmem_cache_free(offload_cache, flow); -+} -+ -+static void -+__br_offload_flow_free(struct bridge_flow *flow) -+{ -+ flow->used = 0; -+ hlist_del(&flow->fdb_list_in); -+ hlist_del(&flow->fdb_list_out); -+ -+ call_rcu(&flow->rcu, flow_rcu_free); -+} -+ -+static void -+br_offload_flow_free(struct bridge_flow *flow) -+{ -+ if (rhashtable_remove_fast(&flow->port->offload.rht, &flow->node, -+ flow_params) != 0) -+ return; -+ -+ __br_offload_flow_free(flow); -+} -+ -+static bool -+br_offload_flow_fdb_refresh_time(struct bridge_flow *flow, -+ struct net_bridge_fdb_entry *fdb) -+{ -+ if (!time_after(flow->used, fdb->updated)) -+ return false; -+ -+ fdb->updated = flow->used; -+ -+ return true; -+} -+ -+ -+static void -+br_offload_flow_refresh_time(struct bridge_flow *flow) -+{ -+ br_offload_flow_fdb_refresh_time(flow, flow->fdb_in); -+ br_offload_flow_fdb_refresh_time(flow, flow->fdb_out); -+} -+ -+static void -+br_offload_destroy_cb(void *ptr, void *arg) -+{ -+ struct bridge_flow *flow = ptr; -+ -+ __br_offload_flow_free(flow); -+} -+ -+static bool -+br_offload_need_gc(struct net_bridge_port *p) -+{ -+ return (atomic_read(&p->offload.rht.nelems) + -+ p->br->offload_cache_reserved) >= p->br->offload_cache_size; -+} -+ -+static void -+br_offload_gc_work(struct work_struct *work) -+{ -+ struct rhashtable_iter hti; -+ struct net_bridge_port *p; -+ struct bridge_flow *gc_flow = NULL; -+ struct bridge_flow *flow; -+ unsigned long gc_used; -+ -+ p = container_of(work, struct net_bridge_port, offload.gc_work); -+ -+ if (!br_offload_need_gc(p)) -+ return; -+ -+ rhashtable_walk_enter(&p->offload.rht, &hti); -+ rhashtable_walk_start(&hti); -+ while ((flow = rhashtable_walk_next(&hti)) != NULL) { -+ unsigned long used; -+ -+ if (IS_ERR(flow)) -+ continue; -+ -+ used = READ_ONCE(flow->used); -+ if (!used) -+ continue; -+ -+ if (gc_flow && !time_before(used, gc_used)) -+ continue; -+ -+ gc_flow = flow; -+ gc_used = used; -+ } -+ rhashtable_walk_stop(&hti); -+ rhashtable_walk_exit(&hti); -+ -+ if (!gc_flow) -+ return; -+ -+ spin_lock_bh(&offload_lock); -+ if (br_offload_need_gc(p) && gc_flow && -+ gc_flow->used == gc_used) -+ br_offload_flow_free(gc_flow); -+ if (p->offload.enabled && br_offload_need_gc(p)) -+ queue_work(system_long_wq, work); -+ spin_unlock_bh(&offload_lock); -+ -+} -+ -+void br_offload_port_state(struct net_bridge_port *p) -+{ -+ struct net_bridge_port_offload *o = &p->offload; -+ bool enabled = true; -+ bool flush = false; -+ -+ if (p->state != BR_STATE_FORWARDING || -+ !(p->flags & BR_OFFLOAD)) -+ enabled = false; -+ -+ spin_lock_bh(&offload_lock); -+ if (o->enabled == enabled) -+ goto out; -+ -+ if (enabled) { -+ if (!o->gc_work.func) -+ INIT_WORK(&o->gc_work, br_offload_gc_work); -+ rhashtable_init(&o->rht, &flow_params); -+ } else { -+ flush = true; -+ rhashtable_free_and_destroy(&o->rht, br_offload_destroy_cb, o); -+ } -+ -+ o->enabled = enabled; -+ -+out: -+ spin_unlock_bh(&offload_lock); -+ -+ if (flush) -+ flush_work(&o->gc_work); -+} -+ -+void br_offload_fdb_update(const struct net_bridge_fdb_entry *fdb) -+{ -+ struct bridge_flow *f; -+ struct hlist_node *tmp; -+ -+ spin_lock_bh(&offload_lock); -+ -+ hlist_for_each_entry_safe(f, tmp, &fdb->offload_in, fdb_list_in) -+ br_offload_flow_free(f); -+ -+ hlist_for_each_entry_safe(f, tmp, &fdb->offload_out, fdb_list_out) -+ br_offload_flow_free(f); -+ -+ spin_unlock_bh(&offload_lock); -+} -+ -+static void -+br_offload_prepare_key(struct net_bridge_port *p, struct bridge_flow_key *key, -+ struct sk_buff *skb) -+{ -+ memset(key, 0, sizeof(*key)); -+ memcpy(key, eth_hdr(skb), 2 * ETH_ALEN); -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ if (!br_opt_get(p->br, BROPT_VLAN_ENABLED)) -+ return; -+ -+ if (!skb_vlan_tag_present(skb) || skb->vlan_proto != p->br->vlan_proto) -+ return; -+ -+ key->vlan_present = true; -+ key->vlan_tag = skb_vlan_tag_get_id(skb); -+#endif -+} -+ -+void br_offload_output(struct sk_buff *skb) -+{ -+ struct net_bridge_port_offload *o; -+ struct br_input_skb_cb *cb = (struct br_input_skb_cb *)skb->cb; -+ struct net_bridge_port *p, *inp; -+ struct net_device *dev; -+ struct net_bridge_fdb_entry *fdb_in, *fdb_out; -+ struct net_bridge_vlan_group *vg; -+ struct bridge_flow_key key; -+ struct bridge_flow *flow; -+ u16 vlan; -+ -+ if (!cb->offload) -+ return; -+ -+ rcu_read_lock(); -+ -+ p = br_port_get_rcu(skb->dev); -+ if (!p) -+ goto out; -+ -+ o = &p->offload; -+ if (!o->enabled) -+ goto out; -+ -+ if (atomic_read(&p->offload.rht.nelems) >= p->br->offload_cache_size) -+ goto out; -+ -+ dev = dev_get_by_index_rcu(dev_net(p->br->dev), cb->input_ifindex); -+ if (!dev) -+ goto out; -+ -+ inp = br_port_get_rcu(dev); -+ if (!inp) -+ goto out; -+ -+ vg = nbp_vlan_group_rcu(inp); -+ vlan = cb->input_vlan_present ? cb->input_vlan_tag : br_get_pvid(vg); -+ fdb_in = br_fdb_find_rcu(p->br, eth_hdr(skb)->h_source, vlan); -+ if (!fdb_in || !fdb_in->dst) -+ goto out; -+ -+ vg = nbp_vlan_group_rcu(p); -+ vlan = skb_vlan_tag_present(skb) ? skb_vlan_tag_get_id(skb) : br_get_pvid(vg); -+ fdb_out = br_fdb_find_rcu(p->br, eth_hdr(skb)->h_dest, vlan); -+ if (!fdb_out || !fdb_out->dst) -+ goto out; -+ -+ br_offload_prepare_key(p, &key, skb); -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ key.vlan_present = cb->input_vlan_present; -+ key.vlan_tag = cb->input_vlan_tag; -+#endif -+ -+ flow = kmem_cache_alloc(offload_cache, GFP_ATOMIC); -+ flow->port = inp; -+ memcpy(&flow->key, &key, sizeof(key)); -+ -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ flow->vlan_out_present = skb_vlan_tag_present(skb); -+ flow->vlan_out = skb_vlan_tag_get(skb); -+#endif -+ -+ flow->fdb_in = fdb_in; -+ flow->fdb_out = fdb_out; -+ flow->used = jiffies; -+ -+ spin_lock_bh(&offload_lock); -+ if (!o->enabled || -+ atomic_read(&p->offload.rht.nelems) >= p->br->offload_cache_size || -+ rhashtable_insert_fast(&inp->offload.rht, &flow->node, flow_params)) { -+ kmem_cache_free(offload_cache, flow); -+ goto out_unlock; -+ } -+ -+ hlist_add_head(&flow->fdb_list_in, &fdb_in->offload_in); -+ hlist_add_head(&flow->fdb_list_out, &fdb_out->offload_out); -+ -+ if (br_offload_need_gc(p)) -+ queue_work(system_long_wq, &p->offload.gc_work); -+ -+out_unlock: -+ spin_unlock_bh(&offload_lock); -+ -+out: -+ rcu_read_unlock(); -+} -+ -+bool br_offload_input(struct net_bridge_port *p, struct sk_buff *skb) -+{ -+ struct net_bridge_port_offload *o = &p->offload; -+ struct br_input_skb_cb *cb = (struct br_input_skb_cb *)skb->cb; -+ struct bridge_flow_key key; -+ struct net_bridge_port *dst; -+ struct bridge_flow *flow; -+ unsigned long now = jiffies; -+ bool ret = false; -+ -+ if (skb->len < sizeof(key)) -+ return false; -+ -+ if (!o->enabled) -+ return false; -+ -+ if (is_multicast_ether_addr(eth_hdr(skb)->h_dest)) -+ return false; -+ -+ br_offload_prepare_key(p, &key, skb); -+ -+ rcu_read_lock(); -+ flow = rhashtable_lookup(&o->rht, &key, flow_params); -+ if (!flow) { -+ cb->offload = 1; -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ cb->input_vlan_present = key.vlan_present != 0; -+ cb->input_vlan_tag = key.vlan_tag; -+#endif -+ cb->input_ifindex = p->dev->ifindex; -+ goto out; -+ } -+ -+ if (flow->fdb_in->dst != p) -+ goto out; -+ -+ dst = flow->fdb_out->dst; -+ if (!dst) -+ goto out; -+ -+ ret = true; -+#ifdef CONFIG_BRIDGE_VLAN_FILTERING -+ if (!flow->vlan_out_present && key.vlan_present) { -+ __vlan_hwaccel_clear_tag(skb); -+ } else if (flow->vlan_out_present) { -+ if (skb_vlan_tag_present(skb) && -+ skb->vlan_proto != p->br->vlan_proto) { -+ /* Protocol-mismatch, empty out vlan_tci for new tag */ -+ skb_push(skb, ETH_HLEN); -+ skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto, -+ skb_vlan_tag_get(skb)); -+ if (unlikely(!skb)) -+ goto out; -+ -+ skb_pull(skb, ETH_HLEN); -+ skb_reset_mac_len(skb); -+ } -+ -+ __vlan_hwaccel_put_tag(skb, p->br->vlan_proto, -+ flow->vlan_out); -+ } -+#endif -+ -+ skb->dev = dst->dev; -+ skb_push(skb, ETH_HLEN); -+ -+ if (skb_warn_if_lro(skb) || !is_skb_forwardable(skb->dev, skb)) { -+ kfree_skb(skb); -+ goto out; -+ } -+ -+ if (now - flow->used >= HZ) { -+ flow->used = now; -+ br_offload_flow_refresh_time(flow); -+ } -+ -+ skb_forward_csum(skb); -+ dev_queue_xmit(skb); -+ -+out: -+ rcu_read_unlock(); -+ return ret; -+} -+ -+static void -+br_offload_check_gc(struct net_bridge *br) -+{ -+ struct net_bridge_port *p; -+ -+ spin_lock_bh(&br->lock); -+ list_for_each_entry(p, &br->port_list, list) -+ if (br_offload_need_gc(p)) -+ queue_work(system_long_wq, &p->offload.gc_work); -+ spin_unlock_bh(&br->lock); -+} -+ -+ -+int br_offload_set_cache_size(struct net_bridge *br, unsigned long val, -+ struct netlink_ext_ack *extack) -+{ -+ br->offload_cache_size = val; -+ br_offload_check_gc(br); -+ -+ return 0; -+} -+ -+int br_offload_set_cache_reserved(struct net_bridge *br, unsigned long val, -+ struct netlink_ext_ack *extack) -+{ -+ br->offload_cache_reserved = val; -+ br_offload_check_gc(br); -+ -+ return 0; -+} -+ -+int __init br_offload_init(void) -+{ -+ offload_cache = kmem_cache_create("bridge_offload_cache", -+ sizeof(struct bridge_flow), -+ 0, SLAB_HWCACHE_ALIGN, NULL); -+ if (!offload_cache) -+ return -ENOMEM; -+ -+ return 0; -+} -+ -+void br_offload_fini(void) -+{ -+ kmem_cache_destroy(offload_cache); -+} ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -268,7 +268,13 @@ struct net_bridge_fdb_entry { - unsigned long updated ____cacheline_aligned_in_smp; - unsigned long used; - -- struct rcu_head rcu; -+ union { -+ struct { -+ struct hlist_head offload_in; -+ struct hlist_head offload_out; -+ }; -+ struct rcu_head rcu; -+ }; - }; - - #define MDB_PG_FLAGS_PERMANENT BIT(0) -@@ -343,6 +349,12 @@ struct net_bridge_mdb_entry { - struct rcu_head rcu; - }; - -+struct net_bridge_port_offload { -+ struct rhashtable rht; -+ struct work_struct gc_work; -+ bool enabled; -+}; -+ - struct net_bridge_port { - struct net_bridge *br; - struct net_device *dev; -@@ -403,6 +415,7 @@ struct net_bridge_port { - u16 backup_redirected_cnt; - - struct bridge_stp_xstats stp_xstats; -+ struct net_bridge_port_offload offload; - }; - - #define kobj_to_brport(obj) container_of(obj, struct net_bridge_port, kobj) -@@ -519,6 +532,9 @@ struct net_bridge { - struct kobject *ifobj; - u32 auto_cnt; - -+ u32 offload_cache_size; -+ u32 offload_cache_reserved; -+ - #ifdef CONFIG_NET_SWITCHDEV - /* Counter used to make sure that hardware domains get unique - * identifiers in case a bridge spans multiple switchdev instances. -@@ -553,6 +569,10 @@ struct br_input_skb_cb { - #ifdef CONFIG_NETFILTER_FAMILY_BRIDGE - u8 br_netfilter_broute:1; - #endif -+ u8 offload:1; -+ u8 input_vlan_present:1; -+ u16 input_vlan_tag; -+ int input_ifindex; - - #ifdef CONFIG_NET_SWITCHDEV - /* Set if TX data plane offloading is used towards at least one ---- /dev/null -+++ b/net/bridge/br_private_offload.h -@@ -0,0 +1,23 @@ -+#ifndef __BR_OFFLOAD_H -+#define __BR_OFFLOAD_H -+ -+bool br_offload_input(struct net_bridge_port *p, struct sk_buff *skb); -+void br_offload_output(struct sk_buff *skb); -+void br_offload_port_state(struct net_bridge_port *p); -+void br_offload_fdb_update(const struct net_bridge_fdb_entry *fdb); -+int br_offload_init(void); -+void br_offload_fini(void); -+int br_offload_set_cache_size(struct net_bridge *br, unsigned long val, -+ struct netlink_ext_ack *extack); -+int br_offload_set_cache_reserved(struct net_bridge *br, unsigned long val, -+ struct netlink_ext_ack *extack); -+ -+static inline void br_offload_skb_disable(struct sk_buff *skb) -+{ -+ struct br_input_skb_cb *cb = (struct br_input_skb_cb *)skb->cb; -+ -+ if (cb->offload) -+ cb->offload = 0; -+} -+ -+#endif ---- a/net/bridge/br_stp.c -+++ b/net/bridge/br_stp.c -@@ -12,6 +12,7 @@ - - #include "br_private.h" - #include "br_private_stp.h" -+#include "br_private_offload.h" - - /* since time values in bpdu are in jiffies and then scaled (1/256) - * before sending, make sure that is at least one STP tick. -@@ -52,6 +53,8 @@ void br_set_state(struct net_bridge_port - (unsigned int) p->port_no, p->dev->name, - br_port_state_names[p->state]); - -+ br_offload_port_state(p); -+ - if (p->br->stp_enabled == BR_KERNEL_STP) { - switch (p->state) { - case BR_STATE_BLOCKING: ---- a/net/bridge/br_sysfs_br.c -+++ b/net/bridge/br_sysfs_br.c -@@ -18,6 +18,7 @@ - #include - - #include "br_private.h" -+#include "br_private_offload.h" - - /* IMPORTANT: new bridge options must be added with netlink support only - * please do not add new sysfs entries -@@ -930,6 +931,38 @@ static ssize_t vlan_stats_per_port_store - static DEVICE_ATTR_RW(vlan_stats_per_port); - #endif - -+static ssize_t offload_cache_size_show(struct device *d, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct net_bridge *br = to_bridge(d); -+ return sprintf(buf, "%u\n", br->offload_cache_size); -+} -+ -+static ssize_t offload_cache_size_store(struct device *d, -+ struct device_attribute *attr, -+ const char *buf, size_t len) -+{ -+ return store_bridge_parm(d, buf, len, br_offload_set_cache_size); -+} -+static DEVICE_ATTR_RW(offload_cache_size); -+ -+static ssize_t offload_cache_reserved_show(struct device *d, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct net_bridge *br = to_bridge(d); -+ return sprintf(buf, "%u\n", br->offload_cache_reserved); -+} -+ -+static ssize_t offload_cache_reserved_store(struct device *d, -+ struct device_attribute *attr, -+ const char *buf, size_t len) -+{ -+ return store_bridge_parm(d, buf, len, br_offload_set_cache_reserved); -+} -+static DEVICE_ATTR_RW(offload_cache_reserved); -+ - static struct attribute *bridge_attrs[] = { - &dev_attr_forward_delay.attr, - &dev_attr_hello_time.attr, -@@ -984,6 +1017,8 @@ static struct attribute *bridge_attrs[] - &dev_attr_vlan_stats_enabled.attr, - &dev_attr_vlan_stats_per_port.attr, - #endif -+ &dev_attr_offload_cache_size.attr, -+ &dev_attr_offload_cache_reserved.attr, - NULL - }; - ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -241,6 +241,7 @@ BRPORT_ATTR_FLAG(broadcast_flood, BR_BCA - BRPORT_ATTR_FLAG(neigh_suppress, BR_NEIGH_SUPPRESS); - BRPORT_ATTR_FLAG(isolated, BR_ISOLATED); - BRPORT_ATTR_FLAG(bpdu_filter, BR_BPDU_FILTER); -+BRPORT_ATTR_FLAG(offload, BR_OFFLOAD); - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) -@@ -295,6 +296,7 @@ static const struct brport_attribute *br - &brport_attr_isolated, - &brport_attr_bpdu_filter, - &brport_attr_backup_port, -+ &brport_attr_offload, - NULL - }; - ---- a/net/bridge/br_vlan_tunnel.c -+++ b/net/bridge/br_vlan_tunnel.c -@@ -15,6 +15,7 @@ - - #include "br_private.h" - #include "br_private_tunnel.h" -+#include "br_private_offload.h" - - static inline int br_vlan_tunid_cmp(struct rhashtable_compare_arg *arg, - const void *ptr) -@@ -180,6 +181,7 @@ void br_handle_ingress_vlan_tunnel(struc - skb_dst_drop(skb); - - __vlan_hwaccel_put_tag(skb, p->br->vlan_proto, vlan->vid); -+ br_offload_skb_disable(skb); - } - - int br_handle_egress_vlan_tunnel(struct sk_buff *skb, -@@ -201,6 +203,7 @@ int br_handle_egress_vlan_tunnel(struct - if (err) - return err; - -+ br_offload_skb_disable(skb); - tunnel_dst = rcu_dereference(vlan->tinfo.tunnel_dst); - if (tunnel_dst && dst_hold_safe(&tunnel_dst->dst)) - skb_dst_set(skb, &tunnel_dst->dst); From aa256ab580ee03b39a2139383faf682f12eda64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Wed, 21 Jun 2023 23:14:02 +0200 Subject: [PATCH 0217/1171] bmips: add support for Arcadyan AR7516 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Arcadyan AR7516, AKA Orange Bright Box or EE Bright Box 1, is a wifi fast ethernet router, 2.4 GHz single band with two internal antennas. It comes with a horizontal stand black shiny casing. Newer Bright Box 1 model stands vertically, and comes with a totally different board inside, not compatible with this firmware. Hardware: - SoC: Broadcom BCM6328 - CPU: single core BMIPS4350 V7.5 @ 320Mhz - RAM: 64 MB DDR2 - Flash: 8 MB SPI NOR - Ethernet LAN: 4x 100Mbit - Wifi 2.4 GHz: Broadcom BCM43227 802.11bgn (onboard) - USB: 1x 2.0 - ADSL: yes, unsupported - Buttons: 2x - LEDs: 9x, power LED is hardware controlled - UART: yes Installation in two steps, new CFE bootloader and firmware: Install new CFE: 1. Power off the router and press the RESET button 2. Power on the router and wait some seconds 3. Release the RESET button 3. Browse to http://192.168.1.1, this web interface will offer both firmware (“Software”) upgrade and bootloader upgrade; be sure to use the bootloader section of the upload form. 4. Upload the new CFE (availabe at the wiki page) 5. Wait about a minute for flashing to finish and reboot into the new bootloader. Install OpenWrt via new CFE web UI: 1. After installing the new CFE, visit http://192.168.1.1 2. Upload the Openwrt cfe firmware 5. Wait a few minutes for it to finish Signed-off-by: Daniel González Cabanelas (cherry-picked from df8e4b6c2e6440bc9a31467de1739c69c328e391) --- .../bcm6328/base-files/etc/board.d/01_leds | 4 + .../bcm6328/base-files/etc/board.d/02_network | 4 + .../base-files/etc/uci-defaults/09_fix_crc | 1 + .../bmips/dts/bcm6328-arcadyan-ar7516.dts | 186 ++++++++++++++++++ target/linux/bmips/image/bcm6328.mk | 13 ++ 5 files changed, 208 insertions(+) create mode 100644 target/linux/bmips/dts/bcm6328-arcadyan-ar7516.dts diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds index 5e80eb34e736e4..b2ccc9a60e9b49 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds +++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds @@ -6,6 +6,10 @@ board_config_update case "$(board_name)" in +arcadyan,ar7516) + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" + ucidef_set_led_netdev "wlan0" "WiFi" "green:wifi" "phy0-ap0" + ;; nucom,r5010unv2 |\ sercomm,ad1018) ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network index bfedad9e455835..391e38c4dcb906 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/02_network @@ -5,6 +5,10 @@ board_config_update case "$(board_name)" in +arcadyan,ar7516) + ucidef_set_bridge_device switch + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ;; comtrend,ar-5381u |\ comtrend,ar-5387un |\ nucom,r5010unv2) diff --git a/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc index 2056ea017ff997..e521af36ba613a 100644 --- a/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bmips/bcm6328/base-files/etc/uci-defaults/09_fix_crc @@ -3,6 +3,7 @@ . /lib/functions.sh case "$(board_name)" in +arcadyan,ar7516 |\ comtrend,ar-5381u |\ comtrend,ar-5387un |\ nucom,r5010unv2) diff --git a/target/linux/bmips/dts/bcm6328-arcadyan-ar7516.dts b/target/linux/bmips/dts/bcm6328-arcadyan-ar7516.dts new file mode 100644 index 00000000000000..cc50f5754994d1 --- /dev/null +++ b/target/linux/bmips/dts/bcm6328-arcadyan-ar7516.dts @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm6328.dtsi" + +/ { + model = "Arcadyan AR7516"; + compatible = "arcadyan,ar7516", "brcm,bcm6328"; + + aliases { + led-failsafe = &led_upgrade_green; + led-upgrade = &led_upgrade_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + bcm43227-sprom { + compatible = "brcm,bcma-sprom"; + + pci-bus = <1>; + pci-dev = <0>; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + brcm,sprom = "brcm/bcm43227-sprom.bin"; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&hsspi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <16666667>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe: partition@0 { + label = "cfe"; + reg = <0x000000 0x010000>; + read-only; + }; + + partition@10000 { + compatible = "brcm,bcm963xx-imagetag"; + label = "firmware"; + reg = <0x010000 0x7e0000>; + }; + + partition@7f0000 { + label = "nvram"; + reg = <0x7f0000 0x010000>; + }; + }; + }; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ephy0_act_led &pinctrl_ephy1_act_led + &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led + &pinctrl_leds>; + + led_upgrade_green: led@1 { + reg = <1>; + label = "green:upgrade"; + }; + + led@6 { + reg = <6>; + active-low; + label = "green:wan"; + }; + + led@7 { + reg = <7>; + active-low; + label = "green:wifi"; + }; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio1", "gpio6", "gpio7"; + }; +}; + +&switch0 { + ports { + port@0 { + reg = <0>; + label = "lan1"; + + phy-handle = <&phy1>; + phy-mode = "mii"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + + phy-handle = <&phy2>; + phy-mode = "mii"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + + phy-handle = <&phy3>; + phy-mode = "mii"; + }; + + port@3 { + reg = <3>; + label = "wan"; + + phy-handle = <&phy4>; + phy-mode = "mii"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cfe { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm6328.mk b/target/linux/bmips/image/bcm6328.mk index 8023ef8fa1eef9..fd0cf16dbb001b 100644 --- a/target/linux/bmips/image/bcm6328.mk +++ b/target/linux/bmips/image/bcm6328.mk @@ -1,5 +1,18 @@ # SPDX-License-Identifier: GPL-2.0-or-later +define Device/arcadyan_ar7516 + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := Arcadyan + DEVICE_MODEL := AR7516 + CHIP_ID := 6328 + CFE_BOARD_ID := AR7516AAW + FLASH_MB := 8 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + $(B43_PACKAGES) broadcom-43227-sprom \ + kmod-leds-bcm6328 +endef +TARGET_DEVICES += arcadyan_ar7516 + define Device/comtrend_ar-5381u $(Device/bcm63xx-cfe) DEVICE_VENDOR := Comtrend From b6f2c58dd60f1e2da6c2ccfc1feb2cc1fcc158da Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 3 Apr 2023 13:56:58 +0200 Subject: [PATCH 0218/1171] ath79: add support for Aruba AP-115 Hardware ======== CPU Qualcomm Atheros QCA9558 RAM 256MB DDR2 FLASH 2x 16M SPI-NOR (Macronix MX25L12805D) WIFI Qualcomm Atheros QCA9558 Atheros AR9590 Installation ============ 1. Attach to the serial console of the AP-105. Interrupt autoboot and change the U-Boot env. $ setenv rb_openwrt "setenv ipaddr 192.168.1.1; setenv serverip 192.168.1.66; netget 0x80060000 ap115.bin; go 0x80060000" $ setenv fb_openwrt "bank 1; cp.b 0xbf100040 0x80060000 0x10000; go 0x80060000" $ setenv bootcmd "run fb_openwrt" $ saveenv 2. Load the OpenWrt initramfs image on the device using TFTP. Place the initramfs image as "ap105.bin" in the TFTP server root directory, connect it to the AP and make the server reachable at 192.168.1.66/24. $ run rb_openwrt 3. Once OpenWrt booted, transfer the sysupgrade image to the device using scp and use sysupgrade to install the firmware. Signed-off-by: David Bauer (cherry picked from commit 1b467a902ec9b8bf29805c6928627e8bbad0f14c) --- package/boot/uboot-envtools/files/ath79 | 1 + .../linux/ath79/dts/qca9558_aruba_ap-115.dts | 239 ++++++++++++++++++ .../etc/hotplug.d/firmware/10-ath9k-eeprom | 6 + target/linux/ath79/image/generic.mk | 15 ++ 4 files changed, 261 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_aruba_ap-115.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 7c30aa052a6b39..5201b8b27a3ad7 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -93,6 +93,7 @@ zyxel,nbg6616) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; aruba,ap-105|\ +aruba,ap-115|\ aruba,ap-175|\ dongwon,dw02-412h-64m|\ dongwon,dw02-412h-128m|\ diff --git a/target/linux/ath79/dts/qca9558_aruba_ap-115.dts b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts new file mode 100644 index 00000000000000..b8aed4c283a611 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts @@ -0,0 +1,239 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include + +/ { + compatible = "aruba,ap-115", "qca,qca9558"; + model = "Aruba AP-115"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_red; + label-mac-device = ð0; + }; + + chosen { + bootargs = "console=ttyS0,9600n8"; + }; + + /** + * Currently unused GPIOs in OpenWrt: + * + * TPM-CLK: 19 + * TPM-IO: 20 + * ETH-PHY-Interrupt: 11 + * Power-DC: 22 + * Power-PoE: 23 + * Power-PoE-8023af: 17 + */ + + leds { + compatible = "gpio-leds"; + + led_power_green: power-green { + label = "green:power"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led_power_red: power-red { + label = "red:power"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + radio-24-green { + label = "green:radio-24"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + radio-24-amber { + label = "amber:radio-24"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + + radio-5-green { + label = "green:radio-5"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + radio-5-amber { + label = "amber:radio-5"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + }; + + reg_usb_vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 3 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + +&pcie0 { + status = "okay"; + + ath9k: wifi@0,0 { + compatible = "pci168c,0033"; + reg = <0x0000 0 0 0 0>; + qca,no-eeprom; + + nvmem-cells = <&macaddr_oemdata_1d>; + nvmem-cell-names = "mac-address"; + + mac-address-increment = <1>; + }; +}; + +&pinmux { + /** + * Ugly hack ahead! + * + * GPIO05: Bank1-CS / Bank2-CLK + * GPIO14: Bank1-CLK / Bank2-CS + * + * We can not support this with OpenWrt, as this + * would require us to influence the pinmux based on the CS. + * + * We force-select Bank 1. Remember to blame Aruba for that. + */ + cs0_pin5: spi-cs0-pin5 { + pinctrl-single,bits = <0x4 0x900 0xff00>; + }; + + clk_pin14: spi-cs1-pin14 { + pinctrl-single,bits = <0xc 0x0a0000 0xff0000>; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&cs0_pin5 &clk_pin14>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@1 { + label = "flash-full"; + reg = <0x0 0x1000000>; + read-only; + }; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + /* Here be dragons */ + + partition@100000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x100000 0xe00000>; + }; + + oemdata: partition@fe0000 { + label = "oemdata"; + reg = <0xfe0000 0x010000>; + read-only; + }; + + partition@ff0000 { + label = "u-boot-env"; + reg = <0xff0000 0x10000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + qca,no-eeprom; + nvmem-cells = <&macaddr_oemdata_1d>; + nvmem-cell-names = "mac-address"; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + + reset-gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_oemdata_1d>; + nvmem-cell-names = "mac-address"; + + phy-handle = <&phy0>; + phy-mode = "rgmii-id"; + + pll-data = <0xa6000000 0xa0000101 0xa0001313>; + + gmac-config { + device = <&gmac>; + ge0-sgmii = <0>; + txen-delay = <3>; + txd-delay = <3>; + rxdv-delay = <3>; + rxd-delay = <3>; + rgmii-enabled = <1>; + }; +}; + +&oemdata { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_oemdata_1d: macaddr@1d { + reg = <0x1d 0x6>; + }; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + dr_mode = "host"; + status = "okay"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index a57479b87cf9ef..c46573ece5448e 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -12,6 +12,9 @@ case "$FIRMWARE" in 8dev,lima) caldata_extract "art" 0x1000 0x800 ;; + aruba,ap-115) + caldata_extract "oemdata" 0x1000 0x440 + ;; asus,pl-ac56|\ asus,rp-ac51|\ asus,rp-ac66) @@ -79,6 +82,9 @@ case "$FIRMWARE" in ;; "ath9k-eeprom-pci-0000:00:00.0.bin") case $board in + aruba,ap-115) + caldata_extract "oemdata" 0x5000 0x440 + ;; avm,fritz300e) caldata_extract_reverse "urloader" 0x1541 0x440 ;; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 788520120de5ba..1a558c30a05433 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -413,6 +413,21 @@ define Device/aruba_ap-105 endef TARGET_DEVICES += aruba_ap-105 +define Device/aruba_ap-115 + SOC := qca9558 + DEVICE_VENDOR := Aruba + DEVICE_MODEL := AP-115 + IMAGE_SIZE := 16000k + DEVICE_PACKAGES := kmod-usb2 + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x102000 + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 8128 | uImage none + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel +endef +TARGET_DEVICES += aruba_ap-115 + define Device/aruba_ap-175 SOC := ar7161 DEVICE_VENDOR := Aruba From e962f866b2b7e9d413224b84fa90de7e2a1b9225 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 17 May 2023 12:04:00 +0200 Subject: [PATCH 0219/1171] mac80211: always use mac80211 loss detection ath10k does not report excessive loss in case of broken block-ack sessions. The loss is communicated to the host-os, but ath10k does not trigger a low-ack events by itself. The mac80211 framework for loss detection however detects this circumstance well in case of ath10k. So use it regardless of ath10k's own loss detection mechanism. Signed-off-by: David Bauer (cherry picked from commit ed816f6ba8b5e3df609e5fc53f7bcb09bdaa16be) --- ...1-always-use-mac80211-loss-detection.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch diff --git a/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch b/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch new file mode 100644 index 00000000000000..e084773fd9c5a4 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch @@ -0,0 +1,36 @@ +From cdf461888f900c3a149b10a04d72b4a590ecdec3 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Tue, 16 May 2023 23:11:32 +0200 +Subject: [PATCH] mac80211: always use mac80211 loss detection + +ath10k does not report excessive loss in case of broken block-ack +sessions. The loss is communicated to the host-os, but ath10k does not +trigger a low-ack events by itself. + +The mac80211 framework for loss detection however detects this +circumstance well in case of ath10k. So use it regardless of ath10k's +own loss detection mechanism. + +Patching this in mac80211 does allow this hack to be used with any +flavor of ath10k/ath11k. + +Signed-off-by: David Bauer +--- + net/mac80211/status.c | 6 ------ + 1 file changed, 6 deletions(-) + +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -794,12 +794,6 @@ static void ieee80211_lost_packet(struct + unsigned long pkt_time = STA_LOST_PKT_TIME; + unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD; + +- /* If driver relies on its own algorithm for station kickout, skip +- * mac80211 packet loss mechanism. +- */ +- if (ieee80211_hw_check(&sta->local->hw, REPORTS_LOW_ACK)) +- return; +- + /* This packet was aggregated but doesn't carry status info */ + if ((info->flags & IEEE80211_TX_CTL_AMPDU) && + !(info->flags & IEEE80211_TX_STAT_AMPDU)) From 2cef1c3277fc972b5fff249a218bf1e22b6282d9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 23 Jun 2023 17:44:10 +0200 Subject: [PATCH 0220/1171] netfilter: fix typo in nf-socket and nf-tproxy kconfig Fix a typo where the wrong KCONFIG was used and fix selecting the correct kernel config option to use these packages. Fixes: 4f443c885ded ("netfilter: separate packages for kmod-ipt-socket and kmod-ipt-tproxy") Signed-off-by: Christian Marangi (cherry picked from commit 3ebebf08be950a8a0f3bf5b2c3db910621f2cc21) --- package/kernel/linux/modules/netfilter.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 5bd1bfbbc724c9..0d2f8a9140e761 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -197,7 +197,7 @@ $(eval $(call KernelPackage,nf-flow)) define KernelPackage/nf-socket SUBMENU:=$(NF_MENU) TITLE:=Netfilter socket lookup support - KCONFIG:= $(KCOFNIG_NF_SOCKET) + KCONFIG:= $(KCONFIG_NF_SOCKET) FILES:=$(foreach mod,$(NF_SOCKET-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_SOCKET-m))) endef @@ -208,7 +208,7 @@ $(eval $(call KernelPackage,nf-socket)) define KernelPackage/nf-tproxy SUBMENU:=$(NF_MENU) TITLE:=Netfilter tproxy support - KCONFIG:= $(KCOFNIG_NF_TPROXY) + KCONFIG:= $(KCONFIG_NF_TPROXY) FILES:=$(foreach mod,$(NF_TPROXY-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_TPROXY-m))) endef From 02a37dee1b59c33e6915b6edb020c3939b809daa Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 24 Jun 2023 19:06:42 +0200 Subject: [PATCH 0221/1171] odhcpd: bump to latest git HEAD 5211264 odhcpd: add support for dhcpv6_pd_min_len parameter c6bff6f router: Add PREF64 (RFC 8781) support Signed-off-by: Christian Marangi (cherry picked from commit acd9981b4ef750544202df9d9e2d0143a6dfd478) --- package/network/services/odhcpd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index c471c7c75d2fad..0eadcc9a5d5b20 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git -PKG_MIRROR_HASH:=c2851b577d1ee632c902eca1864444fa22cad98956bfa852019e6d621c0f8d2a -PKG_SOURCE_DATE:=2023-04-05 -PKG_SOURCE_VERSION:=40ab806bf4c8698ac925d094ce11ce1d57ae2e46 +PKG_MIRROR_HASH:=e2e00e2bb6b7bacda5dcb713e4f9a4b1e316d75b140a4aa77145471bf6fe5c17 +PKG_SOURCE_DATE:=2023-06-24 +PKG_SOURCE_VERSION:=52112643308bb02a3b4fa2894dd7d4340ba4a237 PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 From 0a63e72fbbf9dce54e9425f7f9eba1421bf777c4 Mon Sep 17 00:00:00 2001 From: Kim DoHyoung Date: Thu, 11 Aug 2022 08:13:35 +0000 Subject: [PATCH 0222/1171] ramips: mt7621: add support for Zbtlink ZBT-WG1608 (32M) Zbtlink ZBT-WG1608 is a Wi-Fi router intendent to use with WWAN (4G/5G) modems. Specifications: * SoC: MediaTek MT7621A * RAM: 256/512 MiB * Flash: 16/32 MiB (SPI NOR) * Wi-Fi: * MediaTek MT7603E : 2.4Ghz * MediaTek MT7613BE : 5Ghz * Ethernet: 10/100/1000 Mbps Ethernet x5 ports (4xLAN + WAN) * M.2: 1x slot with USB&SIM * EM7455/EM12-G/EM160R/RM500Q-AE * USB: 1x 3.0 Type-A port * External storage: 1x microSD (SDXC) slot * UART: console (115200 baud) * LED: * 1 power indicator * 1 WLAN 2.4G controlled (wlan 2G) * 3 SoC controlled (wlan 5G, wwan, internet) * 5 per Eth phy (4xLAN + WAN) MAC Addresses: * LAN : f8:5e:3c:xx:xx:e0 (Factory, 0xe000 (hex)) * WAN : f8:5e:3c:xx:xx:e1 (Factory, 0xe006 (hex)) * 2.4 GHz: f8:5e:3c:xx:xx:de (Factory, 0x0004 (hex)) * 5 GHz : f8:5e:3c:xx:xx:df (Factory, 0x8004 (hex)) Installation: * Vendor's firmware is OpenWrt (LEDE) based, so the sysupgrade image can be directly used to install OpenWrt. Firmware must be upgraded using the 'force' and 'do not save configuration' command line options (or correspondig web interface checkboxes) since the vendor firmware is from the pre-DSA era. Recovery Mode: * Press reset button, power up the device, wait for about 10sec. * Upload sysupgrade image through the firmware recovery mode web page at 192.168.1.1. Signed-off-by: Kim DoHyoung (cherry picked from commit 0bbd5699c81d6887c4d895e85b56d8c23b1211ec) --- .../ramips/dts/mt7621_zbtlink_zbt-wg1608-32m.dts | 16 ++++++++++++++++ .../ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi | 2 +- target/linux/ramips/image/mt7621.mk | 12 ++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-32m.dts diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-32m.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-32m.dts new file mode 100644 index 00000000000000..00feec2ff3daa6 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-32m.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_zbtlink_zbt-wg1608.dtsi" + +/ { + compatible = "zbtlink,zbt-wg1608-32m", "mediatek,mt7621-soc"; + model = "Zbtlink ZBT-WG1608 (32M)"; +}; + +&flash0 { + broken-flash-reset; +}; + +&firmware { + reg = <0x50000 0x1fb0000>; +}; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi index 59fab90ed1d2d5..303708fab0e842 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi @@ -61,7 +61,7 @@ &spi0 { status = "okay"; - flash@0 { + flash0: flash@0 { compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <50000000>; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index b8fa0cefdb3fb1..a5b69839a7b976 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2706,6 +2706,18 @@ define Device/zbtlink_zbt-wg1608-16m endef TARGET_DEVICES += zbtlink_zbt-wg1608-16m +define Device/zbtlink_zbt-wg1608-32m + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 32448k + DEVICE_VENDOR := Zbtlink + DEVICE_MODEL := ZBT-WG1608 + DEVICE_VARIANT := 32M + DEVICE_PACKAGES := kmod-sdhci-mt7620 kmod-mt7603 kmod-mt7615e \ + kmod-mt7663-firmware-ap kmod-usb3 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += zbtlink_zbt-wg1608-32m + define Device/zbtlink_zbt-wg2626 $(Device/dsa-migration) $(Device/uimage-lzma-loader) From fca03ea4584e08e53e766d71f12c840d62f3e5ec Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Wed, 21 Jun 2023 21:53:07 +0200 Subject: [PATCH 0223/1171] ramips: fix lan leds for Wavlink WL-WN535K1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously both lan1 and lan2 leds were wrongly labelled as lan2. Moreover they were connected to the wrong lan port. Fixes 8fde82095ba0 ("ramips: add support for Wavlink WL-WN535K1") Reported-by: Nicolò Maria Semprini Signed-off-by: Davide Fioravanti (cherry picked from commit c71dada92654a53c63bbc5bebcc40fe924750ed7) --- target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts | 4 ++-- target/linux/ramips/mt7620/base-files/etc/board.d/01_leds | 4 ++-- target/linux/ramips/mt7620/base-files/etc/board.d/02_network | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts index 67a7d8d4889bf2..bbb3e01add9673 100644 --- a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts +++ b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts @@ -48,12 +48,12 @@ lan1 { label = "green:lan1"; - gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; }; lan2 { label = "green:lan2"; - gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; }; wan { diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index 2deda0861a933e..6a097ab8e3dc1d 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -219,8 +219,8 @@ tplink,re200-v1) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; wavlink,wl-wn535k1) - ucidef_set_led_switch "lan1" "lan2" "green:lan1" "switch0" "0x04" - ucidef_set_led_switch "lan2" "lan2" "green:lan2" "switch0" "0x20" + ucidef_set_led_switch "lan1" "lan1" "green:lan1" "switch0" "0x20" + ucidef_set_led_switch "lan2" "lan2" "green:lan2" "switch0" "0x04" ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10" ;; wavlink,wl-wn579x3) diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 787e123e31be10..e571dc1f6f5fea 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -235,7 +235,7 @@ ramips_setup_interfaces() ;; wavlink,wl-wn535k1) ucidef_add_switch "switch0" \ - "2:lan" "5:lan" "4:wan" "6@eth0" + "2:lan:2" "5:lan:1" "4:wan" "6@eth0" ;; wavlink,wl-wn579x3) ucidef_add_switch "switch0" \ From b1b829ad6a71f32c0f8a669db53264cf5b1f259b Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Wed, 21 Jun 2023 02:30:20 +0200 Subject: [PATCH 0224/1171] ipq40xx: meraki-mr33, meraki-mr74: disable image generation After migrating to kernel 5.15, upgrading causes the units to become soft-bricked, hanging forever at the kernel startup. Kernel size limitation of 4000000 bytes is suspected here, but this is not fully confirmed. Disable the images to protect users from inadvertent bricking of units, because recovery of those is painful with Cisco's U-boot, until the root cause is found and fixed. Signed-off-by: Lech Perczak (cherry picked from commit 9d64cc068fbb15d9e6498c1eba79851823b2f4f5) --- target/linux/ipq40xx/image/generic.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 59d4f082ff8b48..671fca16827e53 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -764,6 +764,7 @@ define Device/meraki_mr33 BLOCKSIZE := 128k PAGESIZE := 2048 DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct + DEFAULT := n endef TARGET_DEVICES += meraki_mr33 @@ -776,6 +777,7 @@ define Device/meraki_mr74 PAGESIZE := 2048 DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct DEVICE_DTS_CONFIG := config@3 + DEFAULT := n endef TARGET_DEVICES += meraki_mr74 From 51c397c33fc47202d50ca90c779f1c3239ebbc3f Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 21 Jun 2023 12:17:06 -0400 Subject: [PATCH 0225/1171] kernel: bump 5.15 to 5.15.118 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia (cherry picked from commit 1f5fce27c195373fedcf233a48470de97752058f) --- include/kernel-5.15 | 4 ++-- target/linux/ath25/patches-5.15/107-ar5312_gpio.patch | 2 +- .../patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch | 2 +- .../ath79/patches-5.15/910-unaligned_access_hacks.patch | 2 +- .../950-0035-cgroup-Disable-cgroup-memory-by-default.patch | 4 ++-- .../950-0070-MMC-added-alternative-MMC-driver.patch | 6 +++--- .../950-0195-of-overlay-Correct-symbol-path-fixups.patch | 2 +- ...0-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch | 2 +- ...cumentation-devicetree-Add-documentation-for-imx37.patch | 2 +- ...-bindings-media-i2c-Add-IMX519-CMOS-sensor-binding.patch | 2 +- ...0-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch | 2 +- ...c-block-Don-t-do-single-sector-reads-during-recove.patch | 2 +- .../322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch | 2 +- .../patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch | 2 +- .../bmips/patches-5.15/600-mips-bmips-add-pci-support.patch | 2 +- .../600-v5.18-page_pool-Add-allocation-stats.patch | 2 +- ...707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch | 2 +- ...0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch | 2 +- ...t-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch | 2 +- ...y-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch | 2 +- ...-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch | 2 +- .../806-v6.0-0001-nvmem-microchip-otpc-add-support.patch | 2 +- ...-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch | 2 +- target/linux/generic/hack-5.15/251-kconfig.patch | 2 +- target/linux/generic/hack-5.15/280-rfkill-stubs.patch | 2 +- .../generic/hack-5.15/721-net-add-packet-mangeling.patch | 6 +++--- .../hack-5.15/780-usb-net-MeigLink_modem_support.patch | 2 +- .../generic/pending-5.15/300-mips_expose_boot_raw.patch | 4 ++-- .../680-NET-skip-GRO-for-foreign-MAC-addresses.patch | 2 +- ...t-core-add-optional-threading-for-backlog-processi.patch | 6 +++--- target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch | 2 +- .../patches-5.15/701-staging-add-fsl_ppfe-driver.patch | 2 +- ...t-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch | 2 +- ...INTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch | 2 +- .../octeon/patches-5.15/100-mips_image_cmdline_hack.patch | 2 +- .../314-MIPS-add-bootargs-override-property.patch | 4 ++-- .../patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch | 4 ++-- .../008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch | 2 +- .../patches-5.15/300-mips-add-rtl838x-platform.patch | 2 +- 39 files changed, 50 insertions(+), 50 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index fc637450b53dfa..aa4541d277a71e 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .117 -LINUX_KERNEL_HASH-5.15.117 = a9a8331f3c0e004b40a41f30d688b53bf85405597ac41c2c89be7f4fbcf7239f +LINUX_VERSION-5.15 = .118 +LINUX_KERNEL_HASH-5.15.118 = 4e6bf4dadb04d5d11d1d4cc37c0eabcf33bc333b7dd3dc2143c3099a823eb5b3 diff --git a/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch b/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch index 4ad1d40facd2fb..e6e1290d35a4b8 100644 --- a/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch +++ b/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch @@ -202,7 +202,7 @@ +subsys_initcall(ar5312_gpio_init); --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -230,6 +230,7 @@ config ATH25 +@@ -231,6 +231,7 @@ config ATH25 select CEVT_R4K select CSRC_R4K select DMA_NONCOHERENT diff --git a/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch b/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch index 9bce3a2633305f..9d014434ecb339 100644 --- a/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch +++ b/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch @@ -15,7 +15,7 @@ Signed-off-by: John Crispin --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -256,6 +256,8 @@ config ATH79 +@@ -257,6 +257,8 @@ config ATH79 select SYS_SUPPORTS_BIG_ENDIAN select SYS_SUPPORTS_MIPS16 select SYS_SUPPORTS_ZBOOT_UART_PROM diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index c2b646643e0389..ad685fb13b81f9 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -784,7 +784,7 @@ SVN-Revision: 35130 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h -@@ -275,8 +275,10 @@ static inline bool neigh_key_eq128(const +@@ -270,8 +270,10 @@ static inline bool neigh_key_eq128(const const u32 *n32 = (const u32 *)n->primary_key; const u32 *p32 = pkey; diff --git a/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch b/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch index 087d28300d245f..fbf8e6114456b6 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6503,6 +6512,10 @@ static int __init cgroup_disable(char *s +@@ -6502,6 +6511,10 @@ static int __init cgroup_disable(char *s strcmp(token, ss->legacy_name)) continue; @@ -51,7 +51,7 @@ Signed-off-by: Phil Elwell static_branch_disable(cgroup_subsys_enabled_key[i]); pr_info("Disabling %s control group subsystem\n", ss->name); -@@ -6521,6 +6534,31 @@ static int __init cgroup_disable(char *s +@@ -6520,6 +6533,31 @@ static int __init cgroup_disable(char *s } __setup("cgroup_disable=", cgroup_disable); diff --git a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch index 799b5c8eabb0fe..f296bb3ff735d6 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch @@ -244,7 +244,7 @@ bcm2835-mmc: uninitialized_var is no more static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, -@@ -2936,6 +2943,8 @@ static int mmc_blk_probe(struct mmc_card +@@ -2941,6 +2948,8 @@ static int mmc_blk_probe(struct mmc_card { struct mmc_blk_data *md; int ret = 0; @@ -253,7 +253,7 @@ bcm2835-mmc: uninitialized_var is no more /* * Check that the card supports the command class(es) we need. -@@ -2943,7 +2952,16 @@ static int mmc_blk_probe(struct mmc_card +@@ -2948,7 +2957,16 @@ static int mmc_blk_probe(struct mmc_card if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; @@ -271,7 +271,7 @@ bcm2835-mmc: uninitialized_var is no more card->complete_wq = alloc_workqueue("mmc_complete", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); -@@ -2958,6 +2976,17 @@ static int mmc_blk_probe(struct mmc_card +@@ -2963,6 +2981,17 @@ static int mmc_blk_probe(struct mmc_card goto out_free; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0195-of-overlay-Correct-symbol-path-fixups.patch b/target/linux/bcm27xx/patches-5.15/950-0195-of-overlay-Correct-symbol-path-fixups.patch index fbadb7f575c9d8..021e6f9fcf79f3 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0195-of-overlay-Correct-symbol-path-fixups.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0195-of-overlay-Correct-symbol-path-fixups.patch @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c -@@ -243,6 +243,8 @@ static struct property *dup_and_fixup_sy +@@ -241,6 +241,8 @@ static struct property *dup_and_fixup_sy if (!target_path) return NULL; target_path_len = strlen(target_path); diff --git a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch index bb0afb1a2a352e..289b7d8a933c4d 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch @@ -25,7 +25,7 @@ Signed-off-by: Naushir Patuck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17541,6 +17541,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -17534,6 +17534,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch index f9021eea55f1da..c93b69c0aa3042 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17555,6 +17555,7 @@ M: Raspberry Pi Kernel Maintenance +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17559,6 +17559,14 @@ F: Documentation/devicetree/bindings/med +@@ -17552,6 +17552,14 @@ F: Documentation/devicetree/bindings/med F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch index 442e10add259f3..dfae5566d9fd03 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch @@ -63,7 +63,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20220227124713.39766-6-noral --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -5980,6 +5980,14 @@ T: git git://anongit.freedesktop.org/drm +@@ -5973,6 +5973,14 @@ T: git git://anongit.freedesktop.org/drm F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt F: drivers/gpu/drm/tiny/mi0283qt.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch b/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch index 5e491a6f5a928a..5c96783ed7d56b 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch @@ -23,7 +23,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c -@@ -1883,7 +1883,11 @@ static void mmc_blk_mq_rw_recovery(struc +@@ -1886,7 +1886,11 @@ static void mmc_blk_mq_rw_recovery(struc return; } diff --git a/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch b/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch index a848165ac5f516..aff3f4a1a0e4b0 100644 --- a/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch +++ b/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonas Gorski --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -331,6 +331,9 @@ config BCM63XX +@@ -332,6 +332,9 @@ config BCM63XX select SYNC_R4K select DMA_NONCOHERENT select IRQ_MIPS_CPU diff --git a/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch b/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch index c39df850a03448..eb3f1c1d5cecb7 100644 --- a/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch +++ b/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch @@ -13,7 +13,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -274,25 +274,20 @@ config BMIPS_GENERIC +@@ -275,25 +275,20 @@ config BMIPS_GENERIC select SYNC_R4K select COMMON_CLK select BCM6345_L1_IRQ diff --git a/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch b/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch index 36b09105b72721..e2ca75a3930e71 100644 --- a/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch +++ b/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch @@ -14,7 +14,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -274,6 +274,7 @@ config BMIPS_GENERIC +@@ -275,6 +275,7 @@ config BMIPS_GENERIC select SYNC_R4K select COMMON_CLK select BCM6345_L1_IRQ diff --git a/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch b/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch index f4c5b9afee4dd9..dca1062be9c95b 100644 --- a/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch +++ b/target/linux/generic/backport-5.15/600-v5.18-page_pool-Add-allocation-stats.patch @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp); --- a/net/Kconfig +++ b/net/Kconfig -@@ -434,6 +434,19 @@ config NET_DEVLINK +@@ -432,6 +432,19 @@ config NET_DEVLINK config PAGE_POOL bool diff --git a/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch b/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch index 9743a3f2062fb2..3668a821ef758f 100644 --- a/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch +++ b/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch @@ -32,7 +32,7 @@ Signed-off-by: Jakub Kicinski --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11789,6 +11789,14 @@ L: netdev@vger.kernel.org +@@ -11782,6 +11782,14 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/mediatek/ diff --git a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch index 51346d0620d3a9..d5ba5dbf66260c 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11901,6 +11901,7 @@ M: Landen Chao L: netdev@vger.kernel.org S: Maintained diff --git a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch index 00f4b25c44e1de..b748fb5f8f19da 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch @@ -28,7 +28,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11899,9 +11899,11 @@ MEDIATEK SWITCH DRIVER +@@ -11892,9 +11892,11 @@ MEDIATEK SWITCH DRIVER M: Sean Wang M: Landen Chao M: DENG Qingfang diff --git a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch index e2a0e25a7941f7..eb51b410b54441 100644 --- a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch +++ b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch @@ -21,7 +21,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -12700,6 +12700,7 @@ F: include/uapi/linux/meye.h +@@ -12693,6 +12693,7 @@ F: include/uapi/linux/meye.h MOTORCOMM PHY DRIVER M: Peter Geis diff --git a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch index ae177e0cb036e6..6ad9257d60e4e1 100644 --- a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch +++ b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17965,6 +17965,11 @@ L: netdev@vger.kernel.org +@@ -17958,6 +17958,11 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/dlink/sundance.c diff --git a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch index ad0460d4f36fdf..f7ea61626c5069 100644 --- a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch +++ b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch @@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -12364,6 +12364,14 @@ S: Supported +@@ -12357,6 +12357,14 @@ S: Supported F: Documentation/devicetree/bindings/mtd/atmel-nand.txt F: drivers/mtd/nand/raw/atmel/* diff --git a/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch b/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch index 25802be7e3d036..41d3e121de195f 100644 --- a/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch +++ b/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c -@@ -1314,6 +1314,7 @@ static const struct usb_device_id produc +@@ -1316,6 +1316,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ {QMI_FIXED_INTF(0x19d2, 0x1432, 3)}, /* ZTE ME3620 */ diff --git a/target/linux/generic/hack-5.15/251-kconfig.patch b/target/linux/generic/hack-5.15/251-kconfig.patch index 0e24c3e8041f34..9350e366d8668c 100644 --- a/target/linux/generic/hack-5.15/251-kconfig.patch +++ b/target/linux/generic/hack-5.15/251-kconfig.patch @@ -199,7 +199,7 @@ Signed-off-by: John Crispin bool --- a/net/Kconfig +++ b/net/Kconfig -@@ -432,7 +432,7 @@ config NET_DEVLINK +@@ -430,7 +430,7 @@ config NET_DEVLINK default n config PAGE_POOL diff --git a/target/linux/generic/hack-5.15/280-rfkill-stubs.patch b/target/linux/generic/hack-5.15/280-rfkill-stubs.patch index 7a650d132eb3ae..ff6638f7a05b4c 100644 --- a/target/linux/generic/hack-5.15/280-rfkill-stubs.patch +++ b/target/linux/generic/hack-5.15/280-rfkill-stubs.patch @@ -26,7 +26,7 @@ Signed-off-by: John Crispin * @name: name of the struct -- the string is not copied internally --- a/net/Makefile +++ b/net/Makefile -@@ -52,7 +52,7 @@ obj-$(CONFIG_TIPC) += tipc/ +@@ -51,7 +51,7 @@ obj-$(CONFIG_TIPC) += tipc/ obj-$(CONFIG_NETLABEL) += netlabel/ obj-$(CONFIG_IUCV) += iucv/ obj-$(CONFIG_SMC) += smc/ diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index b4e92b4a185dc5..69771cef398d90 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau /* Specifies the type of the struct net_device::ml_priv pointer */ enum netdev_ml_priv_type { -@@ -2015,6 +2020,7 @@ struct net_device { +@@ -2014,6 +2019,7 @@ struct net_device { /* Read-mostly cache-line for fast-path access */ unsigned int flags; unsigned int priv_flags; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau const struct net_device_ops *netdev_ops; int ifindex; unsigned short gflags; -@@ -2075,6 +2081,11 @@ struct net_device { +@@ -2074,6 +2080,11 @@ struct net_device { const struct tlsdev_ops *tlsdev_ops; #endif @@ -58,7 +58,7 @@ Signed-off-by: Felix Fietkau const struct header_ops *header_ops; unsigned char operstate; -@@ -2149,6 +2160,10 @@ struct net_device { +@@ -2145,6 +2156,10 @@ struct net_device { struct mctp_dev __rcu *mctp_ptr; #endif diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 367d66fc666dc4..96d800669a81e6 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1169,6 +1171,11 @@ static const struct usb_device_id option +@@ -1173,6 +1175,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch index 05d024925df0d9..436c2cc767cffe 100644 --- a/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch +++ b/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch @@ -9,7 +9,7 @@ Acked-by: Rob Landley --- --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1100,9 +1100,6 @@ config FW_ARC +@@ -1101,9 +1101,6 @@ config FW_ARC config ARCH_MAY_HAVE_PC_FDC bool @@ -19,7 +19,7 @@ Acked-by: Rob Landley config CEVT_BCM1480 bool -@@ -3182,6 +3179,18 @@ choice +@@ -3183,6 +3180,18 @@ choice bool "Extend builtin kernel arguments with bootloader arguments" endchoice diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 4ccf229026a288..f01348d349df73 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -2101,6 +2101,8 @@ struct net_device { +@@ -2100,6 +2100,8 @@ struct net_device { struct netdev_hw_addr_list mc; struct netdev_hw_addr_list dev_addrs; diff --git a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch index d846a05a2487bc..1ccdea6d993e14 100644 --- a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch +++ b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau /** * napi_disable - prevent NAPI from scheduling -@@ -3368,6 +3369,7 @@ struct softnet_data { +@@ -3364,6 +3365,7 @@ struct softnet_data { unsigned int processed; unsigned int time_squeeze; unsigned int received_rps; @@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -11371,6 +11446,9 @@ static int dev_cpu_dead(unsigned int old +@@ -11369,6 +11444,9 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; oldsd->rps_ipi_list = NULL; -@@ -11710,6 +11788,7 @@ static int __init net_dev_init(void) +@@ -11708,6 +11786,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif diff --git a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch index 49861945484ddf..6758d4a0f22d9d 100644 --- a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch +++ b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch @@ -1,6 +1,6 @@ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -2429,6 +2429,12 @@ config MIPS_VPE_LOADER +@@ -2430,6 +2430,12 @@ config MIPS_VPE_LOADER Includes a loader for loading an elf relocatable object onto another VPE and running it. diff --git a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch index 6130bf0030ff3f..e8a69153500f8b 100644 --- a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch +++ b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch @@ -854,7 +854,7 @@ Signed-off-by: Pawel Dembicki +}; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -7526,6 +7526,14 @@ F: drivers/ptp/ptp_qoriq.c +@@ -7519,6 +7519,14 @@ F: drivers/ptp/ptp_qoriq.c F: drivers/ptp/ptp_qoriq_debugfs.c F: include/linux/fsl/ptp_qoriq.h diff --git a/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch index b8d1a6061917f2..0f06c298676e3e 100644 --- a/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch +++ b/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch @@ -21,7 +21,7 @@ Signed-off-by: Daniel Golle --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11797,6 +11797,15 @@ S: Maintained +@@ -11790,6 +11790,15 @@ S: Maintained F: drivers/net/pcs/pcs-mtk-lynxi.c F: include/linux/pcs/pcs-mtk-lynxi.h diff --git a/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch b/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch index b8accf180bb005..242a6c1e00abba 100644 --- a/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch +++ b/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch @@ -16,7 +16,7 @@ Cc: Robert Marko --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -9063,6 +9063,22 @@ F: include/net/nl802154.h +@@ -9056,6 +9056,22 @@ F: include/net/nl802154.h F: net/ieee802154/ F: net/mac802154/ diff --git a/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch b/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch index 15e233aceb2c12..4b225277f9deb8 100644 --- a/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch +++ b/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1180,6 +1180,10 @@ config MIPS_MSC +@@ -1181,6 +1181,10 @@ config MIPS_MSC config SYNC_R4K bool diff --git a/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch b/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch index 07635a9d86a8d9..ef45aac61bda92 100644 --- a/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch +++ b/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch @@ -17,7 +17,7 @@ Signed-off-by: David Bauer --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c -@@ -544,8 +544,28 @@ static int __init bootcmdline_scan_chose +@@ -545,8 +545,28 @@ static int __init bootcmdline_scan_chose #endif /* CONFIG_OF_EARLY_FLATTREE */ @@ -46,7 +46,7 @@ Signed-off-by: David Bauer bool dt_bootargs = false; /* -@@ -559,6 +579,14 @@ static void __init bootcmdline_init(void +@@ -560,6 +580,14 @@ static void __init bootcmdline_init(void } /* diff --git a/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch b/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch index f36f028cab3845..d49429f7a3b862 100644 --- a/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch +++ b/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c -@@ -686,7 +686,6 @@ static void __init arch_mem_init(char ** +@@ -687,7 +687,6 @@ static void __init arch_mem_init(char ** mips_reserve_vmcore(); mips_parse_crashkernel(); @@ -18,7 +18,7 @@ Signed-off-by: John Crispin /* * In order to reduce the possibility of kernel panic when failed to -@@ -803,6 +802,7 @@ void __init setup_arch(char **cmdline_p) +@@ -804,6 +803,7 @@ void __init setup_arch(char **cmdline_p) cpu_cache_init(); paging_init(); diff --git a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch index 17ff729f525650..dfe7ab28d73b9e 100644 --- a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch +++ b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch @@ -32,7 +32,7 @@ Signed-off-by: Guenter Roeck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -15902,6 +15902,13 @@ S: Maintained +@@ -15895,6 +15895,13 @@ S: Maintained F: include/sound/rt*.h F: sound/soc/codecs/rt* diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index 6407a49fb6b627..f853ef4feef752 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1053,8 +1053,58 @@ config NLM_XLP_BOARD +@@ -1054,8 +1054,58 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. From 106c83a1eafcccb6059a0427953b7780d184c692 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 25 Jun 2023 20:03:42 +0200 Subject: [PATCH 0226/1171] uhttpd: update to latest git HEAD 34a8a74 uhttpd/file: fix string out of buffer range on uh_defer_script Signed-off-by: Hauke Mehrtens (cherry picked from commit 7a6f6b812632a5983cd34ab5c41271d5d4de5fbf) --- package/network/services/uhttpd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 3923e55b072e16..02a02405fd69ea 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git -PKG_SOURCE_DATE:=2023-01-28 -PKG_SOURCE_VERSION:=47561aa13574068403d48f13ea310f8511057b2b -PKG_MIRROR_HASH:=84500cf0c8224fe80b5717c9b6bad8ac13f44f286e3a88e8b12adfcf02e22c7c +PKG_SOURCE_DATE:=2023-06-25 +PKG_SOURCE_VERSION:=34a8a74dbdec3c0de38abc1b08f6a73c51263792 +PKG_MIRROR_HASH:=8206885eebed5d1827763bcc5bcf9ca3510ae22b0ad1f6432114f1136c32dde2 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC From cd17d8df2a38ccdd98aa1a7b361aa255d53ea5ac Mon Sep 17 00:00:00 2001 From: Flole Systems Date: Mon, 10 Apr 2023 23:36:59 +0200 Subject: [PATCH 0227/1171] filogic: add support for Netgear WAX220 Hardware -------- SOC: MediaTek MT7986 RAM: 1024MB DDR3 FLASH: 128MB SPI-NAND (Winbond) WIFI: Mediatek MT7986 DBDC 802.11ax 2.4/5 GHz ETH: Realtek RTL8221B-VB-CG 2.5 N-Base-T PHY with PoE UART: 3V3 115200 8N1 (Pinout silkscreened / Do not connect VCC) Installation ------------ 1. Download the OpenWrt initramfs image. Copy the image to a TFTP server 2. Connect the TFTP server to the WAX220. Conect to the serial console, interrupt the autoboot process by pressing '0' when prompted. 3. Download & Boot the OpenWrt initramfs image. $ setenv ipaddr 192.168.2.1 $ setenv serverip 192.168.2.2 $ tftpboot openwrt.bin $ bootm 4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n Signed-off-by: Flole Systems Signed-off-by: Stefan Agner (cherry picked from commit 984786a2f7ec622c99e8c9cdada65d0ea0cf4e0b) --- .../uboot-envtools/files/mediatek_filogic | 3 + .../mediatek/dts/mt7986b-netgear-wax220.dts | 288 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 5 + .../filogic/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + target/linux/mediatek/image/filogic.mk | 16 + 6 files changed, 324 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986b-netgear-wax220.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index b638a65a4e8a64..154944a8ebb739 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -37,6 +37,9 @@ bananapi,bpi-r3) ;; esac ;; +netgear,wax220) + ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x20000" "0x20000" + ;; xiaomi,redmi-router-ax6000-stock) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000" diff --git a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts new file mode 100644 index 00000000000000..f7da6e3630b949 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts @@ -0,0 +1,288 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include +#include + +#include "mt7986b.dtsi" + +/ { + #address-cells = <0x2>; + #size-cells = <0x2>; + model = "Netgear WAX220"; + compatible = "netgear,wax220", "mediatek,mt7986b-spim-snand-rfb"; + + aliases { + serial0 = &uart0; + led-boot = &led_power_blue; + led-failsafe = &led_power_amber; + led-running = &led_power_green; + led-upgrade = &led_power_amber; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "reset"; + }; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + wlan5g_green { + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + label = "green:wlan5g"; + }; + + led_power_amber: power_amber { + gpios = <&pio 15 GPIO_ACTIVE_LOW>; + label = "amber:power"; + }; + + wlan2g_green { + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + label = "green:wlan2g"; + }; + + led_power_blue: power_blue { + gpios = <&pio 7 GPIO_ACTIVE_HIGH>; + label = "blue:power"; + }; + + led_power_green: power_green { + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + label = "green:power"; + }; + + wlan2g_blue { + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + label = "blue:wlan2g"; + }; + + lan_green { + gpios = <&pio 22 GPIO_ACTIVE_HIGH>; + label = "green:lan"; + }; + + lan_amber { + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + label = "amber:lan"; + }; + + wlan5g_blue { + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + label = "blue:wlan5g"; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-handle = <&phy6>; + phy-mode = "2500base-x"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + #address-cells = <1>; + #size-cells = <0>; + phy6: ethernet-phy@6 { + reg = <6>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <46 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <20000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions: partitions { + #address-cells = <0x1>; + #size-cells = <0x1>; + compatible = "fixed-partitions"; + + partition@5fc0000 { + label = "Traffic"; + reg = <0x5fc0000 0x200000>; + }; + + partition@63c0000 { + label = "NTGRcryptD"; + reg = <0x63c0000 0x500000>; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x5140000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + }; + + partition@69c0000 { + label = "User_data"; + reg = <0x69c0000 0x640000>; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + + partition@68c0000 { + label = "LOG"; + reg = <0x68c0000 0x100000>; + }; + + partition@5ac0000 { + label = "POT"; + reg = <0x5ac0000 0x100000>; + }; + + partition@0 { + label = "BL2"; + read-only; + reg = <0x0 0x100000>; + }; + + partition@5bc0000 { + label = "Language"; + reg = <0x5bc0000 0x400000>; + }; + + partition@61c0000 { + label = "Cert"; + reg = <0x61c0000 0x100000>; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + }; + + partition@56c0000 { + label = "RAE"; + reg = <0x56c0000 0x400000>; + }; + + partition@62c0000 { + label = "NTGRcryptK"; + reg = <0x62c0000 0x100000>; + }; + }; + }; + +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 1cb00ce26db3dc..0ba825fd2b933e 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -9,6 +9,11 @@ case $board in cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; +netgear,wax220) + ucidef_set_led_netdev "eth0" "LAN" "green:lan" "eth0" + ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "phy0-ap0" + ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5g" "phy1-ap0" + ;; xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_led_netdev "wan" "wan" "rgb:network" "wan" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index a327a46108acd9..8803326b2791e2 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -11,6 +11,9 @@ mediatek_setup_interfaces() asus,tuf-ax4200) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; + netgear,wax220) + ucidef_set_interface_lan "eth0" + ;; bananapi,bpi-r3) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan" ;; @@ -66,6 +69,10 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + netgear,wax220) + lan_mac=$(mtd_get_mac_ascii u-boot-env mac) + label_mac=$lan_mac + ;; qihoo,360t7) lan_mac=$(mtd_get_mac_ascii factory lanMac) wan_mac=$(macaddr_add "$lan_mac" 1) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index a3db00f5e8ffd0..3969a7bfe47d9c 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -32,6 +32,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress ;; + netgear,wax220) + hw_mac_addr=$(mtd_get_mac_ascii u-boot-env mac) + [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress + ;; qihoo,360t7) addr=$(mtd_get_mac_ascii factory lanMac) [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 6323a05de2a625..ae25aee2ed8e31 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -176,6 +176,22 @@ define Device/glinet_gl-mt3000 endef TARGET_DEVICES += glinet_gl-mt3000 +define Device/netgear_wax220 + DEVICE_VENDOR := Netgear + DEVICE_MODEL := WAX220 + DEVICE_DTS := mt7986b-netgear-wax220 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware + IMAGES := sysupgrade.bin + KERNEL_IN_UBI := 1 + KERNEL := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += netgear_wax220 + define Device/mediatek_mt7986a-rfb-nand DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7986 rfba AP (NAND) From 55ae516f61fa9d38a5080630795070a8e6673088 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 28 Jun 2023 00:08:24 +0200 Subject: [PATCH 0228/1171] OpenWrt v23.05.0-rc2: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..255b7cc9579706 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^8939b43659dabe9b737feee02976949ad0355adc +src-git luci https://git.openwrt.org/project/luci.git^3e14e055a177dec4bd3a4bd40883b56a6930fd7c +src-git routing https://git.openwrt.org/feed/routing.git^6bbcdd7f1fda46a370226ad1fc794e690974339c +src-git telephony https://git.openwrt.org/feed/telephony.git^129c8e0a9d68a39ad2dd550cf79dc8fc678f4a38 diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..66864a75595cf6 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc2) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23228-cd17d8df2a) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc2) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..d6d63f83551f95 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.0-rc2" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..e0a9d36af1c786 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23228-cd17d8df2a diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..94da2486e9f856 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1687778439 From 123afce696584a0a0088dd4c4ebe4c446774dd33 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 28 Jun 2023 00:08:33 +0200 Subject: [PATCH 0229/1171] OpenWrt v23.05.0-rc2: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index 255b7cc9579706..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^8939b43659dabe9b737feee02976949ad0355adc -src-git luci https://git.openwrt.org/project/luci.git^3e14e055a177dec4bd3a4bd40883b56a6930fd7c -src-git routing https://git.openwrt.org/feed/routing.git^6bbcdd7f1fda46a370226ad1fc794e690974339c -src-git telephony https://git.openwrt.org/feed/telephony.git^129c8e0a9d68a39ad2dd550cf79dc8fc678f4a38 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index 66864a75595cf6..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc2) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23228-cd17d8df2a) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc2) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index d6d63f83551f95..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.0-rc2" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index e0a9d36af1c786..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23228-cd17d8df2a diff --git a/version.date b/version.date deleted file mode 100644 index 94da2486e9f856..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1687778439 From 42c99789ac15de2d130c08347f50b80a3d038a26 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Mon, 5 Jun 2023 03:02:07 +0000 Subject: [PATCH 0230/1171] uboot-envtools: Add u-boot env config for GL-MT3000 This commit add u-boot env config for GL-MT3000, so that we can use fw_printenv to print u-boot env and use fw_setenv to set u-boot env in GL-MT3000. Signed-off-by: Jianhui Zhao (cherry picked from commit 6892603efa11603c6f365bee1cf94e98336d72aa) --- package/boot/uboot-envtools/files/mediatek_filogic | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 154944a8ebb739..881d0c45011a97 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -37,6 +37,9 @@ bananapi,bpi-r3) ;; esac ;; +glinet,gl-mt3000) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" + ;; netgear,wax220) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x20000" "0x20000" ;; From a9c92b913ac4d4a9205f8e3cd87cc67e424568be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Sun, 14 May 2023 16:39:15 +0200 Subject: [PATCH 0231/1171] ipq40xx: Enable gpio-restart in kernel configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some ZTE devices require the gpio-restart driver to support restarting the LTE modem along with OpenWrt Signed-off-by: Andreas Böhler (cherry picked from commit 9ffdaa7fa1478146b5d8c77d4b3a5d4d4007a487) --- target/linux/ipq40xx/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/config-5.15 b/target/linux/ipq40xx/config-5.15 index d5bde551783e8b..0acc013a813083 100644 --- a/target/linux/ipq40xx/config-5.15 +++ b/target/linux/ipq40xx/config-5.15 @@ -376,6 +376,7 @@ CONFIG_PINCTRL_MSM=y # CONFIG_PINCTRL_SM8250 is not set CONFIG_PM_OPP=y CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_POWER_RESET_MSM=y CONFIG_POWER_SUPPLY=y CONFIG_PPS=y From 023a8853c84fb2f7f9a508e78b4eab1f4ef897e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Wed, 7 Jun 2023 21:24:18 +0200 Subject: [PATCH 0232/1171] ipq4019: add support for ZTE MF287+ aka DreiNeo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ZTE MF287+ is a LTE router used (exclusively?) by the network operator "3". The MF287 (i.e. non-plus aka 3Neo) is also supported (the only difference is the LTE modem) Specifications ============== SoC: IPQ4018 RAM: 256MiB Flash: 8MiB SPI-NOR + 128MiB SPI-NAND LAN: 4x GBit LAN LTE: ZTE Cat12 (MF287+) / ZTE Cat6 (MF287) WiFi: 802.11a/b/g/n/ac SoC-integrated MAC addresses ============= LAN: from config + 2 WiFi 1: from config WiFi 2: from config + 1 Installation ============ Option 1 - TFTP --------------- TFTP installation using UART is preferred. Disassemble the device and connect serial. Put the initramfs image as openwrt.bin to your TFTP server and configure a static IP of 192.168.1.100. Load the initramfs image by typing: setenv serverip 192.168.1.100 setenv ipaddr 192.168.1.1 tftpboot 0x82000000 openwrt.bin bootm 0x82000000 From this intiramfs boot you can take a backup of the currently installed partitions as no vendor firmware is available for download: ubiattach -m14 cat /dev/ubi0_0 > /tmp/ubi0_0 cat /dev/ubi0_1 > /tmp/ubi0_1 Copy the files /tmp/ubi0_0 and /tmp/ubi0_1 somewhere save. Once booted, transfer the sysupgrade image and run sysupgrade. You might have to delete the stock volumes first: ubirmvol /dev/ubi0 -N ubi_rootfs ubirmvol /dev/ubi0 -N kernel Option 2 - From stock firmware ------------------------------ The installation from stock requires an exploit first. The exploit consists of a backup file that forces the firmware to download telnetd via TFTP from 192.168.0.22 and run it. Once exploited, you can connect via telnet and login as admin:admin. The exploit will be available at the device wiki page. Once inside the stock firmware, you can transfer the -factory.bin file to /tmp by using "scp" from the stock frmware or "tftp". ZTE has blocked writing to the NAND. Fortunately, it's easy to allow write access - you need to read from one file in /proc. Once done, you need to erase the UBI partition and flash OpenWrt. Before performing the operation, make sure that mtd13 is the partition labelled "rootfs" by calling "cat /proc/mtd". Complete commands: cd /tmp tftp -g -r factory.bin 192.168.0.22 cat /proc/driver/sensor_id flash_erase /dev/mtd13 0 0 dd if=/tmp/factory.bin of=/dev/mtdblock13 bs=131072 Afterwards, reboot your device and you should have a working OpenWrt installation. Restore Stock ============= Option 1 - via UART ------------------- Boot an OpenWrt initramfs image via TFTP as for the initial installation. Transfer the two backed-up files to your box to /tmp. Then, run the following commands - replace $kernel_length and $rootfs_size by the size of ubi0_0 and ubi0_1 in bytes. ubiattach -m 14 ubirmvol /dev/ubi0 -N kernel ubirmvol /dev/ubi0 -N rootfs ubirmvol /dev/ubi0 -N rootfs_data ubimkvol /dev/ubi0 -N kernel -s $kernel_length ubimkvol /dev/ubi0 -N ubi_rootfs -s $rootfs_size ubiupdatevol /dev/ubi0_0 /tmp/ubi0_0 ubiupdatevol /dev/ubi0_1 /tmp/ubi0_1 Option 2 - from within OpenWrt ------------------------------ This option requires to flash an initramfs version first so that access to the flash is possible. This can be achieved by sysupgrading to the recovery.bin version and rebooting. Once rebooted, you are again in a default OpenWrt installation, but no partition is mounted. Follow the commands from Option 1 to flash back to stock. LTE Modem ========= The LTE modem is similar to other ZTE devices and controls some more LEDs and battery management. Configuring the connection using uqmi works properly, the modem provides three serial ports and a QMI CDC ethernet interface. Signed-off-by: Andreas Böhler (cherry picked from commit f70ee53b08466f612546f699c556cbdaa39e1466) --- package/firmware/ipq-wifi/Makefile | 2 + .../ipq40xx/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 2 + .../arm/boot/dts/qcom-ipq4018-mf287plus.dts | 384 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 18 + 5 files changed, 410 insertions(+) create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 0c6941050b0a43..faee191c349e1f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -40,6 +40,7 @@ ALLWIFIBOARDS:= \ wallys_dr40x9 \ xiaomi_ax3600 \ xiaomi_ax9000 \ + zte_mf287plus \ zyxel_nbg7815 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -126,6 +127,7 @@ $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) +$(eval $(call generate-ipq-wifi-package,zte_mf287plus,ZTE MF287Plus)) $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index b131d0d6182fe4..1a74fb792ce217 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -107,6 +107,10 @@ ipq40xx_setup_interfaces() zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; + zte,mf287plus) + ucidef_set_interface_lan "lan1 lan2 lan3 lan4" + ucidef_set_interface "wan" device "/dev/cdc-wdm0" protocol "qmi" + ;; *) echo "Unsupported hardware. Network interfaces not initialized" ;; diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 988921fa8c1976..e6e99b9d2122c4 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -27,6 +27,7 @@ EOF ;; zte,mf18a |\ zte,mf286d |\ + zte,mf287plus |\ zte,mf289f) CI_UBIPART="rootfs" local mtdnum="$( find_mtd_index $CI_UBIPART )" @@ -208,6 +209,7 @@ platform_do_upgrade() { teltonika,rutx10 |\ zte,mf18a |\ zte,mf286d |\ + zte,mf287plus |\ zte,mf289f) CI_UBIPART="rootfs" nand_do_upgrade "$1" diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts new file mode 100644 index 00000000000000..6c285f4b8adaa4 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts @@ -0,0 +1,384 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// Copyright (c) 2022, Pawel Dembicki . +// Copyright (c) 2022, Giammarco Marzano . +// Copyright (c) 2023, Andreas Böhler + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + model = "ZTE MF287Plus"; + compatible = "zte,mf287plus"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + /* + * bootargs forced by u-boot bootipq command: + * 'ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs rootwait' + */ + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + /* + * This node is used to restart modem module to avoid anomalous + * behaviours on initial communication. + */ + gpio-restart { + compatible = "gpio-restart"; + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led-0 { + label = "blue:power"; + function = LED_FUNCTION_POWER; + color = ; + gpios = <&tlmm 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + key-reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + }; + + key-wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; + }; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + status = "okay"; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + }; +}; + +&mdio { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&blsp_dma { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>, + <&tlmm 59 GPIO_ACTIVE_HIGH>, + <&tlmm 1 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "0:QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "0:CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "0:APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = <0xf0000 0xc0000>; + read-only; + }; + + partition@1b0000 { + label = "0:reserved1"; + reg = <0x1b0000 0x50000>; + read-only; + }; + }; + }; + + spi-nand@1 { /* flash@1 ? */ + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = <0x0 0x140000>; + read-only; + }; + + partition@140000 { + label = "ART"; + reg = <0x140000 0x140000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + + partition@280000 { + label = "mac"; + reg = <0x280000 0x140000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mac_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + partition@3c0000 { + label = "cfg-param"; + reg = <0x3c0000 0x600000>; + read-only; + }; + + partition@9c0000 { + label = "oops"; + reg = <0x9c0000 0x140000>; + }; + + partition@b00000 { + label = "web"; + reg = <0xb00000 0x800000>; + }; + + partition@1300000 { + label = "rootfs"; + reg = <0x1300000 0x2200000>; + }; + + partition@3500000 { + label = "data"; + reg = <0x3500000 0x1900000>; + }; + + partition@4e00000 { + label = "fota"; + reg = <0x4e00000 0x3200000>; + }; + }; + }; + + zigbee@2 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "silabs,em3581"; + reg = <2>; + spi-max-frequency = <12000000>; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&gmac { + status = "okay"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_mac_0>; + mac-address-increment = <2>; +}; + +&switch { + status = "okay"; +}; + +&swport2 { + status = "okay"; + + label = "lan1"; +}; + +&swport3 { + status = "okay"; + + label = "lan2"; +}; + +&swport4 { + status = "okay"; + + label = "lan3"; +}; + +&swport5 { + status = "okay"; + + label = "lan4"; +}; + +&qpic_bam { + status = "okay"; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio55", "gpio56", "gpio57"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio54", "gpio59", "gpio1"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_1000>, <&macaddr_mac_0>; + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; + +&wifi1 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_5000>, <&macaddr_mac_0>; + mac-address-increment = <1>; + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 671fca16827e53..b9e9e478d9f470 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1148,6 +1148,24 @@ define Device/zte_mf286d endef TARGET_DEVICES += zte_mf286d +define Device/zte_mf287plus + $(call Device/zte_mf28x_common) + DEVICE_DTS_CONFIG := config@ap.dk01.1-c2 + DEVICE_MODEL := MF287Plus + DEVICE_ALT0_VENDOR := ZTE + DEVICE_ALT0_MODEL := MF287 + DEVICE_PACKAGES += ipq-wifi-zte_mf287plus + SOC := qcom-ipq4018 +# The recovery image is used to return back to stock (an initramfs-based image +# that can be flashed to the device via sysupgrade +# The factory image is used to install from the stock firmware by using an +# exploit for the web interface + IMAGES += factory.bin recovery.bin + IMAGE/factory.bin := append-ubi + IMAGE/recovery.bin := append-squashfs4-fakeroot | sysupgrade-tar kernel=$$$$(BIN_DIR)/openwrt-$$(BOARD)$$(if $$(SUBTARGET),-$$(SUBTARGET))-$$(DEVICE_NAME)-initramfs-zImage.itb rootfs=$$$$@ | append-metadata +endef +TARGET_DEVICES += zte_mf287plus + define Device/zte_mf289f $(call Device/zte_mf28x_common) DEVICE_MODEL := MF289F From 7ff95775a2d741f19c22ed0ce66d0e6b18623bfb Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 13 May 2023 13:51:45 +0000 Subject: [PATCH 0233/1171] mediatek: add support for Mercusys MR90X v1 This commit adds support for Mercusys MR90X(EU) v1 router. Device specification -------------------- SoC Type: MediaTek MT7986BLA, Cortex-A53, 64-bit RAM: MediaTek MT7986BLA (512MB) Flash: SPI NAND GigaDevice GD5F1GQ5UEYIGY (128 MB) Ethernet: MediaTek MT7531AE + 2.5GbE MaxLinear GPY211C0VC (SLNW8) Ethernet: 1x2.5Gbe (WAN/LAN 2.5Gbps), 3xGbE (WAN/LAN 1Gbps, LAN1, LAN2) WLAN 2g: MediaTek MT7975N, b/g/n/ax, MIMO 4x4 WLAN 5g: MediaTek MT7975P(N), a/n/ac/ax, MIMO 4x4 LEDs: 1 orange and 1 green status LEDs, 4 green gpio-controlled LEDs on ethernet ports Button: 1 (Reset) USB ports: No Power: 12 VDC, 2 A Connector: Barrel Bootloader: Main U-Boot - U-Boot 2022.01-rc4. Additionally, both UBI slots contain "seconduboot" (also U-Boot 2022.01-rc4) Serial console (UART) --------------------- V +-------+-------+-------+-------+ | +3.3V | GND | TX | RX | +---+---+-------+-------+-------+ | +--- Don't connect The R3 (TX line) and R6 (RX line) are absent on the PCB. You should solder them or solder the jumpers. Installation (UART) ------------------- 1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2 2. Attach UART, switch on the router and interrupt the boot process by pressing 'Ctrl-C' 3. Load and run OpenWrt initramfs image: tftpboot initramfs-kernel.bin bootm 4. Once inside OpenWrt, set / update env variables: fw_setenv baudrate 115200 fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit" fw_setenv fdtcontroladdr 5ffc0e70 fw_setenv ipaddr 192.168.1.1 fw_setenv loadaddr 0x46000000 fw_setenv mtdids "spi-nand0=spi-nand0" fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)" fw_setenv netmask 255.255.255.0 fw_setenv serverip 192.168.1.2 fw_setenv stderr serial@11002000 fw_setenv stdin serial@11002000 fw_setenv stdout serial@11002000 fw_setenv tp_boot_idx 0 5. Run 'sysupgrade -n' with the sysupgrade OpenWrt image Installation (without UART) --------------------------- 1. Login as root via SSH (router IP, port 20001, password - your web interface password) 2. Open for editing /etc/hotplug.d/iface/65-iptv (e.g., using WinSCP and SSH settings from the p.1) 3. Add a newline after "#!/bin/sh": telnetd -l /bin/login.sh 4. Save "65-iptv" file 5. Toggle "IPTV/VLAN Enable" checkbox in the router web interface and save 6. Make sure that telnetd is running: netstat -ltunp | grep 23 7. Login via telnet to router IP, port 23 (no username and password are required) 8 Upload OpenWrt "initramfs-kernel.bin" to the "/tmp" folder of the router (e.g., using WinSCP and SSH settings from the p.1) 9. Stock busybox doesn't contain ubiupdatevol command. Hence, we need to download and upload the full version of busybox to the router. For example, from here: https://github.com/xerta555/Busybox-Binaries/raw/master/busybox-arm64 Upload busybox-arm64 to the /tmp dir of the router and run: in the telnet shell: cd /tmp chmod a+x busybox-arm64 10. Check "initramfs-kernel.bin" size: du -h initramfs-kernel.bin 11. Delete old and create new "kernel" volume with appropriate size (greater than "initramfs-kernel.bin" size): ubirmvol /dev/ubi0 -N kernel ubimkvol /dev/ubi0 -n 1 -N kernel -s 9MiB 12. Write OpenWrt "initramfs-kernel.bin" to the flash: ./busybox-arm64 ubiupdatevol /dev/ubi0_1 /tmp/initramfs-kernel.bin 13. u-boot-env can be empty so lets create it (or overwrite it if it already exists) with the necessary values: fw_setenv baudrate 115200 fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit" fw_setenv fdtcontroladdr 5ffc0e70 fw_setenv ipaddr 192.168.1.1 fw_setenv loadaddr 0x46000000 fw_setenv mtdids "spi-nand0=spi-nand0" fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)" fw_setenv netmask 255.255.255.0 fw_setenv serverip 192.168.1.2 fw_setenv stderr serial@11002000 fw_setenv stdin serial@11002000 fw_setenv stdout serial@11002000 fw_setenv tp_boot_idx 0 14. Reboot to OpenWrt initramfs: reboot 15. Login as root via SSH (IP 192.168.1.1, port 22) 16. Upload OpenWrt sysupgrade.bin image to the /tmp dir of the router 17. Run sysupgrade: sysupgrade -n /tmp/sysupgrade.bin Recovery -------- 1. Press Reset button and power on the router 2. Navigate to U-Boot recovery web server (http://192.168.1.1/) and upload the OEM firmware Recovery (UART) --------------- 1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2 2. Attach UART, switch on the router and interrupt the boot process by pressing 'Ctrl-C' 3. Load and run OpenWrt initramfs image: tftpboot initramfs-kernel.bin bootm 4. Do what you need (restore partitions from a backup, install OpenWrt etc.) Stock layout ------------ 0x000000000000-0x000000200000 : "boot" 0x000000200000-0x000000300000 : "u-boot-env" 0x000000300000-0x000003500000 : "ubi0" 0x000003500000-0x000006700000 : "ubi1" 0x000006700000-0x000006f00000 : "userconfig" 0x000006f00000-0x000007300000 : "tp_data" ubi0/ubi1 format ---------------- U-Boot at boot checks that all volumes are in place: +-------------------------------+ | Volume Name: uboot Vol ID: 0| | Volume Name: kernel Vol ID: 1| | Volume Name: rootfs Vol ID: 2| +-------------------------------+ MAC addresses ------------- +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | label | 00:eb:xx:xx:xx:be | label | | LAN | 00:eb:xx:xx:xx:be | label | | WAN | 00:eb:xx:xx:xx:bf | label+1 | | WLAN 2g | 00:eb:xx:xx:xx:be | label | | WLAN 5g | 00:eb:xx:xx:xx:bd | label-1 | +---------+-------------------+-----------+ label MAC address was found in UBI partition "tp_data", file "default-mac". OEM wireless eeprom is also there (file "MT7986_EEPROM.bin"). Signed-off-by: Mikhail Zhilkin (cherry picked from commit e4fe3097ef6a961874b66932a0ac4be18070630a) [Fix merging conflict] Signed-off-by: Mikhail Zhilkin --- .../uboot-envtools/files/mediatek_filogic | 4 + .../dts/mt7986b-mercusys-mr90x-v1.dts | 276 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 6 + .../filogic/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/preinit/09_mount_cfg_part | 23 ++ .../base-files/lib/preinit/10_fix_eth_mac.sh | 6 + .../base-files/lib/preinit/81_fix_eeprom | 16 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 14 + 10 files changed, 361 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts create mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part create mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 881d0c45011a97..7918bdacfcdb76 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -40,6 +40,10 @@ bananapi,bpi-r3) glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; +mercusys,mr90x-v1) + local envdev=/dev/mtd$(find_mtd_index "u-boot-env") + ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" + ;; netgear,wax220) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x20000" "0x20000" ;; diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts new file mode 100644 index 00000000000000..8b8858ccef7962 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts @@ -0,0 +1,276 @@ +// SPDX-License-Identifier: (GL-2.0 OR MIT) + +/dts-v1/; +#include +#include + +#include "mt7986b.dtsi" + +/ { + compatible = "mercusys,mr90x-v1", "mediatek,mt7986b"; + model = "Mercusys MR90X v1"; + + aliases { + serial0 = &uart0; + + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "green:lan2"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-1 { + label = "green:lan1"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-2 { + label = "green:lan0"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led-3 { + label = "green:wan"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led-4 { + label = "orange:status"; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: led-5 { + label = "green:status"; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-handle = <&phy6>; + phy-mode = "2500base-x"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + #address-cells = <1>; + #size-cells = <0>; + + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <1500000>; + reset-post-delay-us = <1000000>; + + /* WAN/LAN 2.5Gbps phy + MaxLinear GPY211C0VC (SLNW8) */ + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + }; + + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + /* WAN/LAN 1Gbps port */ + port@0 { + reg = <0>; + label = "lan0"; + }; + + /* LAN1 port */ + port@1 { + reg = <1>; + label = "lan1"; + }; + + /* LAN2 port */ + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <20000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "boot"; + reg = <0x0 0x200000>; + read-only; + }; + + partition@200000 { + label = "u-boot-env"; + reg = <0x200000 0x100000>; + }; + + partition@300000 { + label = "ubi0"; + reg = <0x300000 0x3200000>; + }; + + partition@3500000 { + label = "ubi1"; + reg = <0x3500000 0x3200000>; + read-only; + }; + + partition@6700000 { + label = "userconfig"; + reg = <0x6700000 0x800000>; + read-only; + }; + + partition@6f00000 { + label = "tp_data"; + reg = <0x6f00000 0x400000>; + read-only; + }; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&wf_2g_5g_pins>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 0ba825fd2b933e..c81bd2cd975198 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -9,6 +9,12 @@ case $board in cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; +mercusys,mr90x-v1) + ucidef_set_led_netdev "lan0" "lan0" "green:lan0" "lan0" "link tx rx" + ucidef_set_led_netdev "lan1" "lan2" "green:lan1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "green:wan" "eth1" "link tx rx" + ;; netgear,wax220) ucidef_set_led_netdev "eth0" "LAN" "green:lan" "eth0" ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "phy0-ap0" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 8803326b2791e2..c05c5d25e46218 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -32,6 +32,9 @@ mediatek_setup_interfaces() mediatek,mt7988a-dsa-10g-spim-snand) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "eth1 eth2" ;; + mercusys,mr90x-v1) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 + ;; qihoo,360t7) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; @@ -69,6 +72,10 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + mercusys,mr90x-v1) + label_mac=$(get_mac_binary "/tmp/tp_data/default-mac" 0) + lan_mac=$label_mac + ;; netgear,wax220) lan_mac=$(mtd_get_mac_ascii u-boot-env mac) label_mac=$lan_mac diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 3969a7bfe47d9c..4b7047eec5e5ab 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -32,6 +32,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress ;; + mercusys,mr90x-v1) + addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr -1 > /sys${DEVPATH}/macaddress + ;; netgear,wax220) hw_mac_addr=$(mtd_get_mac_ascii u-boot-env mac) [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part new file mode 100644 index 00000000000000..819df40d080f01 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part @@ -0,0 +1,23 @@ +. /lib/functions/system.sh + +mount_ubi_part() { + local part_name="$1" + local mtd_num=$(grep $part_name /proc/mtd | cut -c4) + local ubi_num=$(ubiattach -m $mtd_num | \ + awk -F',' '/UBI device number [0-9]{1,}/{print $1}' | \ + awk '{print $4}') + mkdir /tmp/$part_name + mount -r -t ubifs ubi$ubi_num:$part_name /tmp/$part_name +} + +preinit_mount_cfg_part() { + case $(board_name) in + mercusys,mr90x-v1) + mount_ubi_part "tp_data" + ;; + *) + ;; + esac +} + +boot_hook_add preinit_main preinit_mount_cfg_part diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index ec078741c986ef..cfddd9cedcccc5 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -8,6 +8,12 @@ preinit_set_mac_address() { ip link set dev eth0 address "$addr" ip link set dev eth1 address "$addr" ;; + mercusys,mr90x-v1) + addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) + ip link set dev eth1 address "$(macaddr_add $addr 1)" + ;; + *) + ;; esac } diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom b/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom new file mode 100644 index 00000000000000..0a842facca8851 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom @@ -0,0 +1,16 @@ +. /lib/functions/system.sh + +preinit_fix_eeprom() { + case $(board_name) in + mercusys,mr90x-v1) + eeprom="/lib/firmware/mediatek/mt7986_eeprom_mt7975_dual.bin" + oem="/tmp/tp_data/MT7986_EEPROM.bin" + [ ! -L $eeprom -a -e $oem ] && \ + mv -f $eeprom $eeprom.bak && ln -s $oem $eeprom + ;; + *) + ;; + esac +} + +boot_hook_add preinit_main preinit_fix_eeprom diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 5b624bc5517146..11c2c5c66439de 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -70,6 +70,10 @@ platform_do_upgrade() { cudy,wr3000-v1) default_do_upgrade "$1" ;; + mercusys,mr90x-v1) + CI_UBIPART="ubi0" + nand_do_upgrade "$1" + ;; qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index ae25aee2ed8e31..fd83b9d4416f99 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -250,6 +250,20 @@ define Device/mediatek_mt7988a-rfb-nand endef TARGET_DEVICES += mediatek_mt7988a-rfb-nand +define Device/mercusys_mr90x-v1 + DEVICE_VENDOR := Mercusys + DEVICE_MODEL := MR90X v1 + DEVICE_DTS := mt7986b-mercusys-mr90x-v1 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 51200k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += mercusys_mr90x-v1 + define Device/qihoo_360t7 DEVICE_VENDOR := Qihoo DEVICE_MODEL := 360T7 From 649d9e359005377b9efc445466db58f54a547875 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 22 Jun 2023 19:37:13 +0200 Subject: [PATCH 0234/1171] mt76: update to the latest version 2c9c8ffe9d8c wifi: mt76: mt7615: fix possible race in mt7615_mac_sta_poll 3365c80f4202 wifi: mt76: connac: fix stats->tx_bytes calculation b69d82130b47 wifi: mt76: connac: do not check WED status for non-mmio devices 1f9cd65b55d7 wifi: mt76: mt7921e: fix probe timeout after reboot 42dace9ce247 wifi: mt76: mt7921: Fix use-after-free in fw features query. 540adbb38205 wifi: mt76: mt7921: add Netgear AXE3000 (A8000) support 150e2d0ffc0c wifi: mt76: mt7996: fix possible NULL pointer dereference in mt7996_mac_write_txwi() 5b7519be2bf6 wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE 40f6e433f747 wifi: mt76: mt76x02: remove WEP support 84ea1a24f5b5 mt76: mt7921: don't assume adequate headroom for SDIO headers 5c28e17f8c78 wifi: mt76: mt7996: fix header translation logic 2386cec860fa wifi: mt76: mt7996: enable BSS_CHANGED_MU_GROUPS support 748d4a2bfebd wifi: mt76: mt7615: enable BSS_CHANGED_MU_GROUPS support 458ad0af21be wifi: mt76: enable UNII-4 channel 177 support 7fb046011293 wifi: mt76: mt7915: fix background radar event being blocked d2a77a9954bb wifi: mt76: mt7915: report tx retries/failed counts for non-WED path f76b102b09ca wifi: mt76: mt7915: rework tx packets counting when WED is active 5637d9e37d9e wifi: mt76: mt7915: rework tx bytes counting when WED is active 34bdc7fcb4c0 wifi: mt76: report non-binding skb tx rate when WED is active d71aa7b992a3 wifi: mt76: mt7915: drop return in mt7915_sta_statistics 251c363c3087 wifi: mt76: mt7996: drop return in mt7996_sta_statistics 150bb95cb153 wifi: mt76: mt7921: do not support one stream on secondary antenna only d480c3281f21 wifi: mt76: mt7921: remove macro duplication in regs.h 18b1027e5b6e wifi: mt76: mt7915: move mib_stats structure in mt76.h 25ec4b91020e wifi: mt76: mt7996: rely on mib_stats shared definition 6541afa88b3b wifi: mt76: mt7921: rely on mib_stats shared definition eeb60eb9a5a0 wifi: mt76: mt7915: add support for MT7981 [sync with upstream] d5b7e6a3d735 wifi: mt76: mt7921e: report tx retries/failed counts in tx free event f0f19cea6646 wifi: mt76: mt7921: fix skb leak by txs missing in AMSDU edd8a830f6e3 wifi: mt76: add tx_nss histogram to ethtool stats e48235308b3e wifi: mt76: mt7915: accumulate mu-mimo ofdma muru stats a729242363d9 wifi: mt76: mt7921: fix non-PSC channel scan fail 8d52436ee0cd wifi: mt76: mt7921: Support temp sensor d152c8688c14 wifi: mt76: mt7915: disable WFDMA Tx/Rx during SER recovery d07785c344ac wifi: mt76: mt7996: disable WFDMA Tx/Rx during SER recovery 2a19784137f9 wifi: mt76: mt7921: make mt7921_mac_sta_poll static da8e33a15e71 wifi: mt76: mt7915: fix command timeout in AP stop period cc58d5c4a9c9 mt76: mt7996: rely on mt76_sta_stats in mt76_wcid 98a37c82a373 wifi: mt76: mt7921: get rid of MT7921_RESET_TIMEOUT marco ece724cf562b wifi: mt76: mt7996: move radio ctrl commands to proper functions 527cbbc5ede7 wifi: mt76: connac: add support for dsp firmware download 44e323340637 wifi: mt76: mt7996: fix bss wlan_idx when sending bss_info command 63f0053df07a wifi: mt76: mt7996: enable VHT extended NSS BW feature e1bb4ef7b2bb wifi: mt76: connac: add support to set ifs time by mcu command 080ca19cc686 wifi: mt76: mt7996: use correct phy for background radar event 2c163f1812a3 wifi: mt76: mt7996: fix WA event ring size b511a437ace4 wifi: mt76: mt7996: add muru support ece67c98dc1c wifi: mt76: mt7996: increase tx token size 7c2515d85117 wifi: mt76: mt7921e: fix init command fail with enabled device 30706095c566 wifi: mt76: mt7915: move sta_poll_list and sta_poll_lock in mt76_dev b06ed10ee271 wifi: mt76: mt7603: rely on shared sta_poll_list and sta_poll_lock b59bdae339de wifi: mt76: mt7615: rely on shared sta_poll_list and sta_poll_lock 6da2e0e4ef54 wifi: mt76: mt7996: rely on shared sta_poll_list and sta_poll_lock b19d3ad88e8b wifi: mt76: mt7921: rely on shared sta_poll_list and sta_poll_lock 595b033275a3 wifi: mt76: mt7915: move poll_list in mt76_wcid 16fcad171849 wifi: mt76: mt7603: rely on shared poll_list field e19f84091d2e wifi: mt76: mt7615: rely on shared poll_list field b87e4dad1e84 wifi: mt76: mt7996: rely on shared poll_list field 6d7950e258d0 wifi: mt76: mt7921: rely on shared poll_list field f5c5eece5038 wifi: mt76: move ampdu_state in mt76_wcid 7e44467469fe mt76: connac: move more mt7921/mt7915 mac shared code in connac lib 39a70710ddcd wifi: mt76: move rate info in mt76_vif 0dc4326991df wifi: mt76: connac: move connac3 definitions in mt76_connac3_mac.h 29cfabbb4b90 wifi: mt76: connac: add connac3 mac library d60b401867f4 linux-firmware: update firmware for MT7922 WiFi device 9404601a6c97 linux-firmware: update firmware for MT7922 WiFi device 2f851902d6b1 linux-firmware: update firmware for MT7921 WiFi device f36b921692b9 Revert "wifi: mt76: mt76x02: remove WEP support c50be0b54cdd wifi: mt76: mt7915: fix capabilities in non-AP mode d7d7479b00e9 wifi: mt7915: fix beaconing in mesh mode 1377f586c6f5 wifi: mt7915: move capability check to start_ap Signed-off-by: Felix Fietkau (cherry picked from commit 01885bc6a33dbfa6f3c9e97778fd8f4f60e2514f) (cherry picked from commit 86ebaef5d427c5732847168f6ceeda12bf528414) --- package/kernel/mt76/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 04db7fe32c2422..297c3d19b447b5 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-05-13 -PKG_SOURCE_VERSION:=969b7b5ebd129068ca56e4b0d831593a2f92382f -PKG_MIRROR_HASH:=d28869591d1cb9a967b72f5cd8215c7b2c3388b7b31147b7b18c797018ab8ffb +PKG_SOURCE_DATE:=2023-06-30 +PKG_SOURCE_VERSION:=1377f586c6f520a6d032053a2e9c0ebc8b277e9b +PKG_MIRROR_HASH:=785e7588139d3d56e4b142d63c5fc8b83e38bcc9c45edc7d96a0927a9a8c472d PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 @@ -266,7 +266,7 @@ define KernelPackage/mt7921-common $(KernelPackage/mt76-default) TITLE:=MediaTek MT7615 wireless driver common code HIDDEN:=1 - DEPENDS+=+kmod-mt76-connac +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT + DEPENDS+=+kmod-mt76-connac +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT +kmod-hwmon-core FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921-common.ko endef From 7be76a973540fd21704204c8d58b66d2e9a49ad2 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 1 Jul 2023 22:09:07 +0200 Subject: [PATCH 0235/1171] mt76: fix download hash Signed-off-by: Felix Fietkau (cherry picked from commit a3e173e00e7a7f647528ec04be432bccfb5995ad) --- package/kernel/mt76/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 297c3d19b447b5..8551c941440266 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -10,7 +10,7 @@ PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2023-06-30 PKG_SOURCE_VERSION:=1377f586c6f520a6d032053a2e9c0ebc8b277e9b -PKG_MIRROR_HASH:=785e7588139d3d56e4b142d63c5fc8b83e38bcc9c45edc7d96a0927a9a8c472d +PKG_MIRROR_HASH:=247d045d4cbc6907b9856432ee8028a0fd573bb3ffe3c42a3e366abfdb624259 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From c719dfd29f8e76ae31264425b2397eae59814a03 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 28 Jun 2023 06:53:45 -0400 Subject: [PATCH 0236/1171] kernel: bump 5.15 to 5.15.119 Build system: x86_64 Build-tested: x86_64/ACEMAGICIAN T8PLUS, ramips/tplink_archer-a6-v3 Run-tested: x86_64/ACEMAGICIAN T8PLUS, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 42cb0f0f260484ac07e3d698ebc5c546e1800051) --- include/kernel-5.15 | 4 +-- .../910-unaligned_access_hacks.patch | 2 +- ...oup-Disable-cgroup-memory-by-default.patch | 8 ++--- ...-t-prevent-IRQ-usage-of-output-GPIOs.patch | 4 +-- ...tree-gpio-hogs-on-dual-role-gpio-pin.patch | 4 +-- ...terate-using-dsa_switch_for_each_use.patch | 4 +-- ...opulate-supported_interfaces-and-mac.patch | 16 +++++----- ...t-dsa-mt7530-remove-interface-checks.patch | 16 +++++----- ...rop-use-of-phylink_helper_basex_spee.patch | 2 +- ...nly-indicate-linkmodes-that-can-be-s.patch | 6 ++-- ...-switch-to-use-phylink_get_linkmodes.patch | 12 ++++---- ...530-partially-convert-to-phylink_pcs.patch | 30 +++++++++---------- ...ove-autoneg-handling-to-PCS-validati.patch | 6 ++-- ...19-net-dsa-mt7530-mark-as-non-legacy.patch | 2 +- ...mt753x-fix-pcs-conversion-regression.patch | 4 +-- ...t7530-rework-mt7530_hw_vlan_-add-del.patch | 6 ++-- ...et-cpu-port-via-dp-cpu_dp-instead-of.patch | 16 +++++----- ...-add-support-for-in-band-link-status.patch | 12 ++++---- ...t-dsa-mt7530-use-external-PCS-driver.patch | 20 ++++++------- ...a-mt7530-refactor-SGMII-PCS-creation.patch | 4 +-- ...mt7530-use-unlocked-regmap-accessors.patch | 6 ++-- ...se-regmap-to-access-switch-register-.patch | 10 +++---- ...ove-SGMII-PCS-creation-to-mt7530_pro.patch | 6 ++-- ...t-dsa-mt7530-introduce-mutex-helpers.patch | 12 ++++---- ...ntroduce-mt7530_probe_common-helper-.patch | 6 ++-- ...ntroduce-mt7530_remove_common-helper.patch | 4 +-- ...t7530-introduce-separate-MDIO-driver.patch | 12 ++++---- ...ntroduce-driver-for-MT7988-built-in-.patch | 18 +++++------ ...-dsa-mt7530-fix-support-for-MT7531BE.patch | 2 +- ...e-all-MACs-are-powered-down-before-r.patch | 4 +-- ...gister-OF-node-for-internal-MDIO-bus.patch | 4 +-- 31 files changed, 131 insertions(+), 131 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index aa4541d277a71e..ac48a2e8b117a4 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .118 -LINUX_KERNEL_HASH-5.15.118 = 4e6bf4dadb04d5d11d1d4cc37c0eabcf33bc333b7dd3dc2143c3099a823eb5b3 +LINUX_VERSION-5.15 = .119 +LINUX_KERNEL_HASH-5.15.119 = 7aa5a0fd3520947e5599e811d28acdc30e36446c016c7dcee3793e6d1cbecfcf diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index ad685fb13b81f9..55539d7d539113 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -737,7 +737,7 @@ SVN-Revision: 35130 | TCPOLEN_TIMESTAMP)) --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c -@@ -166,8 +166,8 @@ int xfrm_parse_spi(struct sk_buff *skb, +@@ -167,8 +167,8 @@ int xfrm_parse_spi(struct sk_buff *skb, if (!pskb_may_pull(skb, hlen)) return -EINVAL; diff --git a/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch b/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch index fbf8e6114456b6..f6bf48693d1777 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c -@@ -5875,6 +5875,9 @@ int __init cgroup_init_early(void) +@@ -5889,6 +5889,9 @@ int __init cgroup_init_early(void) return 0; } @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /** * cgroup_init - cgroup initialization * -@@ -5913,6 +5916,12 @@ int __init cgroup_init(void) +@@ -5927,6 +5930,12 @@ int __init cgroup_init(void) mutex_unlock(&cgroup_mutex); @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6502,6 +6511,10 @@ static int __init cgroup_disable(char *s +@@ -6516,6 +6525,10 @@ static int __init cgroup_disable(char *s strcmp(token, ss->legacy_name)) continue; @@ -51,7 +51,7 @@ Signed-off-by: Phil Elwell static_branch_disable(cgroup_subsys_enabled_key[i]); pr_info("Disabling %s control group subsystem\n", ss->name); -@@ -6520,6 +6533,31 @@ static int __init cgroup_disable(char *s +@@ -6534,6 +6547,31 @@ static int __init cgroup_disable(char *s } __setup("cgroup_disable=", cgroup_disable); diff --git a/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch b/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch index 85e98e7d687112..8be256bf1cd9b1 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell /* Device and char device-related information */ static DEFINE_IDA(gpio_ida); static dev_t gpio_devt; -@@ -2395,8 +2397,8 @@ int gpiod_direction_output(struct gpio_d +@@ -2408,8 +2410,8 @@ int gpiod_direction_output(struct gpio_d value = !!value; /* GPIOs used for enabled IRQs shall not be set as output */ @@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell gpiod_err(desc, "%s: tried to set a GPIO tied to an IRQ as output\n", __func__); -@@ -3213,8 +3215,8 @@ int gpiochip_lock_as_irq(struct gpio_chi +@@ -3226,8 +3228,8 @@ int gpiochip_lock_as_irq(struct gpio_chi } /* To be valid for IRQ the line needs to be input or open drain */ diff --git a/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch b/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch index 4874fd1237980c..4b3e87cbbfd3b2 100644 --- a/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch +++ b/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch @@ -116,7 +116,7 @@ Signed-off-by: Jonas Gorski } --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c -@@ -1802,7 +1802,8 @@ int gpiochip_add_pingroup_range(struct g +@@ -1815,7 +1815,8 @@ int gpiochip_add_pingroup_range(struct g list_add_tail(&pin_range->node, &gdev->pin_ranges); @@ -126,7 +126,7 @@ Signed-off-by: Jonas Gorski } EXPORT_SYMBOL_GPL(gpiochip_add_pingroup_range); -@@ -1859,7 +1860,7 @@ int gpiochip_add_pin_range(struct gpio_c +@@ -1872,7 +1873,7 @@ int gpiochip_add_pin_range(struct gpio_c list_add_tail(&pin_range->node, &gdev->pin_ranges); diff --git a/target/linux/generic/backport-5.15/705-01-v5.17-net-dsa-mt7530-iterate-using-dsa_switch_for_each_use.patch b/target/linux/generic/backport-5.15/705-01-v5.17-net-dsa-mt7530-iterate-using-dsa_switch_for_each_use.patch index 4142fd1d5081ff..d54819120ea0d5 100644 --- a/target/linux/generic/backport-5.15/705-01-v5.17-net-dsa-mt7530-iterate-using-dsa_switch_for_each_use.patch +++ b/target/linux/generic/backport-5.15/705-01-v5.17-net-dsa-mt7530-iterate-using-dsa_switch_for_each_use.patch @@ -21,7 +21,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1190,27 +1190,31 @@ static int +@@ -1198,27 +1198,31 @@ static int mt7530_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *bridge) { @@ -65,7 +65,7 @@ Signed-off-by: Jakub Kicinski } /* Add the all other ports to this port matrix. */ -@@ -1315,24 +1319,28 @@ static void +@@ -1323,24 +1327,28 @@ static void mt7530_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *bridge) { diff --git a/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch b/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch index f2ead18c36e1f9..391934a30af825 100644 --- a/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch +++ b/target/linux/generic/backport-5.15/705-02-v5.19-net-dsa-mt7530-populate-supported_interfaces-and-mac.patch @@ -23,7 +23,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2444,6 +2444,32 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2454,6 +2454,32 @@ mt7531_setup(struct dsa_switch *ds) return 0; } @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni static bool mt7530_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) -@@ -2480,6 +2506,37 @@ static bool mt7531_is_rgmii_port(struct +@@ -2490,6 +2516,37 @@ static bool mt7531_is_rgmii_port(struct return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII); } @@ -94,7 +94,7 @@ Signed-off-by: Paolo Abeni static bool mt7531_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) -@@ -2956,6 +3013,18 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -2966,6 +3023,18 @@ mt7531_cpu_port_config(struct dsa_switch return 0; } @@ -113,7 +113,7 @@ Signed-off-by: Paolo Abeni static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, unsigned long *supported) -@@ -3191,6 +3260,7 @@ static const struct dsa_switch_ops mt753 +@@ -3201,6 +3270,7 @@ static const struct dsa_switch_ops mt753 .port_vlan_del = mt7530_port_vlan_del, .port_mirror_add = mt753x_port_mirror_add, .port_mirror_del = mt753x_port_mirror_del, @@ -121,7 +121,7 @@ Signed-off-by: Paolo Abeni .phylink_validate = mt753x_phylink_validate, .phylink_mac_link_state = mt753x_phylink_mac_link_state, .phylink_mac_config = mt753x_phylink_mac_config, -@@ -3208,6 +3278,7 @@ static const struct mt753x_info mt753x_t +@@ -3218,6 +3288,7 @@ static const struct mt753x_info mt753x_t .phy_read = mt7530_phy_read, .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, @@ -129,7 +129,7 @@ Signed-off-by: Paolo Abeni .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, -@@ -3219,6 +3290,7 @@ static const struct mt753x_info mt753x_t +@@ -3229,6 +3300,7 @@ static const struct mt753x_info mt753x_t .phy_read = mt7530_phy_read, .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, @@ -137,7 +137,7 @@ Signed-off-by: Paolo Abeni .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, -@@ -3231,6 +3303,7 @@ static const struct mt753x_info mt753x_t +@@ -3241,6 +3313,7 @@ static const struct mt753x_info mt753x_t .phy_write = mt7531_ind_phy_write, .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni .phy_mode_supported = mt7531_phy_mode_supported, .mac_port_validate = mt7531_mac_port_validate, .mac_port_get_state = mt7531_phylink_mac_link_state, -@@ -3293,6 +3366,7 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3303,6 +3376,7 @@ mt7530_probe(struct mdio_device *mdiodev */ if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || diff --git a/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch b/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch index 228016383d936d..ac1916331053df 100644 --- a/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch +++ b/target/linux/generic/backport-5.15/705-03-v5.19-net-dsa-mt7530-remove-interface-checks.patch @@ -21,7 +21,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2470,37 +2470,6 @@ static void mt7530_mac_port_get_caps(str +@@ -2480,37 +2480,6 @@ static void mt7530_mac_port_get_caps(str } } @@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni static bool mt7531_is_rgmii_port(struct mt7530_priv *priv, u32 port) { return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII); -@@ -2537,44 +2506,6 @@ static void mt7531_mac_port_get_caps(str +@@ -2547,44 +2516,6 @@ static void mt7531_mac_port_get_caps(str } } @@ -104,7 +104,7 @@ Signed-off-by: Paolo Abeni static int mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) { -@@ -2829,9 +2760,6 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2839,9 +2770,6 @@ mt753x_phylink_mac_config(struct dsa_swi struct mt7530_priv *priv = ds->priv; u32 mcr_cur, mcr_new; @@ -114,7 +114,7 @@ Signed-off-by: Paolo Abeni switch (port) { case 0 ... 4: /* Internal phy */ if (state->interface != PHY_INTERFACE_MODE_GMII) -@@ -3047,12 +2975,6 @@ mt753x_phylink_validate(struct dsa_switc +@@ -3057,12 +2985,6 @@ mt753x_phylink_validate(struct dsa_switc __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; struct mt7530_priv *priv = ds->priv; @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni phylink_set_port_modes(mask); if (state->interface != PHY_INTERFACE_MODE_TRGMII && -@@ -3279,7 +3201,6 @@ static const struct mt753x_info mt753x_t +@@ -3289,7 +3211,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -135,7 +135,7 @@ Signed-off-by: Paolo Abeni .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, -@@ -3291,7 +3212,6 @@ static const struct mt753x_info mt753x_t +@@ -3301,7 +3222,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -143,7 +143,7 @@ Signed-off-by: Paolo Abeni .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, -@@ -3304,7 +3224,6 @@ static const struct mt753x_info mt753x_t +@@ -3314,7 +3234,6 @@ static const struct mt753x_info mt753x_t .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, @@ -151,7 +151,7 @@ Signed-off-by: Paolo Abeni .mac_port_validate = mt7531_mac_port_validate, .mac_port_get_state = mt7531_phylink_mac_link_state, .mac_port_config = mt7531_mac_config, -@@ -3367,7 +3286,6 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3377,7 +3296,6 @@ mt7530_probe(struct mdio_device *mdiodev if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || diff --git a/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch b/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch index 1a1802a1670470..63f6e9b9547baf 100644 --- a/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch +++ b/target/linux/generic/backport-5.15/705-04-v5.19-net-dsa-mt7530-drop-use-of-phylink_helper_basex_spee.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2999,11 +2999,6 @@ mt753x_phylink_validate(struct dsa_switc +@@ -3009,11 +3009,6 @@ mt753x_phylink_validate(struct dsa_switc linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); diff --git a/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch b/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch index 636353c2d64640..5a3098ade3ee8e 100644 --- a/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch +++ b/target/linux/generic/backport-5.15/705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch @@ -23,7 +23,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2577,12 +2577,13 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2587,12 +2587,13 @@ static int mt7531_rgmii_setup(struct mt7 } static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port, @@ -38,7 +38,7 @@ Signed-off-by: Paolo Abeni phylink_set(supported, 2500baseX_Full); phylink_set(supported, 2500baseT_Full); } -@@ -2955,16 +2956,18 @@ static void mt753x_phylink_get_caps(stru +@@ -2965,16 +2966,18 @@ static void mt753x_phylink_get_caps(stru static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, @@ -58,7 +58,7 @@ Signed-off-by: Paolo Abeni } static void -@@ -2987,12 +2990,13 @@ mt753x_phylink_validate(struct dsa_switc +@@ -2997,12 +3000,13 @@ mt753x_phylink_validate(struct dsa_switc } /* This switch only supports 1G full-duplex. */ diff --git a/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch b/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch index 4d7569b4ce374c..c779cb141ef478 100644 --- a/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch +++ b/target/linux/generic/backport-5.15/705-06-v5.19-net-dsa-mt7530-switch-to-use-phylink_get_linkmodes.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2576,19 +2576,6 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2586,19 +2586,6 @@ static int mt7531_rgmii_setup(struct mt7 return 0; } @@ -40,7 +40,7 @@ Signed-off-by: Paolo Abeni static void mt7531_sgmii_link_up_force(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, -@@ -2955,51 +2942,21 @@ static void mt753x_phylink_get_caps(stru +@@ -2965,51 +2952,21 @@ static void mt753x_phylink_get_caps(stru } static void @@ -97,7 +97,7 @@ Signed-off-by: Paolo Abeni linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); -@@ -3200,7 +3157,6 @@ static const struct mt753x_info mt753x_t +@@ -3210,7 +3167,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -105,7 +105,7 @@ Signed-off-by: Paolo Abeni .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, -@@ -3211,7 +3167,6 @@ static const struct mt753x_info mt753x_t +@@ -3221,7 +3177,6 @@ static const struct mt753x_info mt753x_t .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, @@ -113,7 +113,7 @@ Signed-off-by: Paolo Abeni .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, -@@ -3223,7 +3178,6 @@ static const struct mt753x_info mt753x_t +@@ -3233,7 +3188,6 @@ static const struct mt753x_info mt753x_t .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, @@ -121,7 +121,7 @@ Signed-off-by: Paolo Abeni .mac_port_get_state = mt7531_phylink_mac_link_state, .mac_port_config = mt7531_mac_config, .mac_pcs_an_restart = mt7531_sgmii_restart_an, -@@ -3285,7 +3239,6 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3295,7 +3249,6 @@ mt7530_probe(struct mdio_device *mdiodev if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || diff --git a/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch b/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch index fdf2a964ccfce4..3854d0e6d52cc4 100644 --- a/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch +++ b/target/linux/generic/backport-5.15/705-07-v5.19-net-dsa-mt7530-partially-convert-to-phylink_pcs.patch @@ -33,7 +33,7 @@ Signed-off-by: Paolo Abeni /* String, offset, and register size in bytes if different from 4 bytes */ static const struct mt7530_mib_desc mt7530_mib[] = { MIB_DESC(1, 0x00, "TxDrop"), -@@ -2576,12 +2581,11 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2586,12 +2591,11 @@ static int mt7531_rgmii_setup(struct mt7 return 0; } @@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni unsigned int val; /* For adjusting speed and duplex of SGMII force mode. */ -@@ -2607,6 +2611,9 @@ mt7531_sgmii_link_up_force(struct dsa_sw +@@ -2617,6 +2621,9 @@ mt7531_sgmii_link_up_force(struct dsa_sw /* MT7531 SGMII 1G force mode can only work in full duplex mode, * no matter MT7531_SGMII_FORCE_HALF_DUPLEX is set or not. @@ -60,7 +60,7 @@ Signed-off-by: Paolo Abeni */ if ((speed == SPEED_10 || speed == SPEED_100) && duplex != DUPLEX_FULL) -@@ -2682,9 +2689,10 @@ static int mt7531_sgmii_setup_mode_an(st +@@ -2692,9 +2699,10 @@ static int mt7531_sgmii_setup_mode_an(st return 0; } @@ -73,7 +73,7 @@ Signed-off-by: Paolo Abeni u32 val; /* Only restart AN when AN is enabled */ -@@ -2741,6 +2749,24 @@ mt753x_mac_config(struct dsa_switch *ds, +@@ -2751,6 +2759,24 @@ mt753x_mac_config(struct dsa_switch *ds, return priv->info->mac_port_config(ds, port, mode, state->interface); } @@ -98,7 +98,7 @@ Signed-off-by: Paolo Abeni static void mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, const struct phylink_link_state *state) -@@ -2802,17 +2828,6 @@ unsupported: +@@ -2812,17 +2838,6 @@ unsupported: mt7530_write(priv, MT7530_PMCR_P(port), mcr_new); } @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni static void mt753x_phylink_mac_link_down(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) -@@ -2822,16 +2837,13 @@ static void mt753x_phylink_mac_link_down +@@ -2832,16 +2847,13 @@ static void mt753x_phylink_mac_link_down mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK); } @@ -139,7 +139,7 @@ Signed-off-by: Paolo Abeni } static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, -@@ -2844,8 +2856,6 @@ static void mt753x_phylink_mac_link_up(s +@@ -2854,8 +2866,6 @@ static void mt753x_phylink_mac_link_up(s struct mt7530_priv *priv = ds->priv; u32 mcr; @@ -148,7 +148,7 @@ Signed-off-by: Paolo Abeni mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK; /* MT753x MAC works in 1G full duplex mode for all up-clocked -@@ -2923,6 +2933,8 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -2933,6 +2943,8 @@ mt7531_cpu_port_config(struct dsa_switch return ret; mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPU_PORT_SETTING(priv->id)); @@ -157,7 +157,7 @@ Signed-off-by: Paolo Abeni mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL, speed, DUPLEX_FULL, true, true); -@@ -2962,16 +2974,13 @@ mt753x_phylink_validate(struct dsa_switc +@@ -2972,16 +2984,13 @@ mt753x_phylink_validate(struct dsa_switc linkmode_and(state->advertising, state->advertising, mask); } @@ -178,7 +178,7 @@ Signed-off-by: Paolo Abeni pmsr = mt7530_read(priv, MT7530_PMSR_P(port)); state->link = (pmsr & PMSR_LINK); -@@ -2998,8 +3007,6 @@ mt7530_phylink_mac_link_state(struct dsa +@@ -3008,8 +3017,6 @@ mt7530_phylink_mac_link_state(struct dsa state->pause |= MLO_PAUSE_RX; if (pmsr & PMSR_TX_FC) state->pause |= MLO_PAUSE_TX; @@ -187,7 +187,7 @@ Signed-off-by: Paolo Abeni } static int -@@ -3041,32 +3048,49 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 +@@ -3051,32 +3058,49 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 return 0; } @@ -249,7 +249,7 @@ Signed-off-by: Paolo Abeni if (ret) return ret; -@@ -3079,6 +3103,13 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3089,6 +3113,13 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); @@ -263,7 +263,7 @@ Signed-off-by: Paolo Abeni return ret; } -@@ -3140,9 +3171,8 @@ static const struct dsa_switch_ops mt753 +@@ -3150,9 +3181,8 @@ static const struct dsa_switch_ops mt753 .port_mirror_del = mt753x_port_mirror_del, .phylink_get_caps = mt753x_phylink_get_caps, .phylink_validate = mt753x_phylink_validate, @@ -274,7 +274,7 @@ Signed-off-by: Paolo Abeni .phylink_mac_link_down = mt753x_phylink_mac_link_down, .phylink_mac_link_up = mt753x_phylink_mac_link_up, .get_mac_eee = mt753x_get_mac_eee, -@@ -3152,36 +3182,34 @@ static const struct dsa_switch_ops mt753 +@@ -3162,36 +3192,34 @@ static const struct dsa_switch_ops mt753 static const struct mt753x_info mt753x_table[] = { [ID_MT7621] = { .id = ID_MT7621, @@ -314,7 +314,7 @@ Signed-off-by: Paolo Abeni }, }; -@@ -3239,7 +3267,7 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3249,7 +3277,7 @@ mt7530_probe(struct mdio_device *mdiodev if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || diff --git a/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch b/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch index 7b2fa36699bf67..220e34d1dfb2c2 100644 --- a/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch +++ b/target/linux/generic/backport-5.15/705-08-v5.19-net-dsa-mt7530-move-autoneg-handling-to-PCS-validati.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2953,25 +2953,16 @@ static void mt753x_phylink_get_caps(stru +@@ -2963,25 +2963,16 @@ static void mt753x_phylink_get_caps(stru priv->info->mac_port_get_caps(ds, port, config); } @@ -55,7 +55,7 @@ Signed-off-by: Paolo Abeni } static void mt7530_pcs_get_state(struct phylink_pcs *pcs, -@@ -3073,12 +3064,14 @@ static void mt7530_pcs_an_restart(struct +@@ -3083,12 +3074,14 @@ static void mt7530_pcs_an_restart(struct } static const struct phylink_pcs_ops mt7530_pcs_ops = { @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni .pcs_get_state = mt7531_pcs_get_state, .pcs_config = mt753x_pcs_config, .pcs_an_restart = mt7531_pcs_an_restart, -@@ -3170,7 +3163,6 @@ static const struct dsa_switch_ops mt753 +@@ -3180,7 +3173,6 @@ static const struct dsa_switch_ops mt753 .port_mirror_add = mt753x_port_mirror_add, .port_mirror_del = mt753x_port_mirror_del, .phylink_get_caps = mt753x_phylink_get_caps, diff --git a/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch b/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch index 8bb587f5f57d69..71ececd074bc93 100644 --- a/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch +++ b/target/linux/generic/backport-5.15/705-09-v5.19-net-dsa-mt7530-mark-as-non-legacy.patch @@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2950,6 +2950,12 @@ static void mt753x_phylink_get_caps(stru +@@ -2960,6 +2960,12 @@ static void mt753x_phylink_get_caps(stru config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; diff --git a/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch b/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch index 438c02ade6fcae..26c465d67e5749 100644 --- a/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch +++ b/target/linux/generic/backport-5.15/705-10-v5.19-net-dsa-mt753x-fix-pcs-conversion-regression.patch @@ -81,7 +81,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3088,9 +3088,16 @@ static int +@@ -3098,9 +3098,16 @@ static int mt753x_setup(struct dsa_switch *ds) { struct mt7530_priv *priv = ds->priv; @@ -100,7 +100,7 @@ Signed-off-by: Jakub Kicinski if (ret) return ret; -@@ -3102,13 +3109,6 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3112,13 +3119,6 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/backport-5.15/705-11-v6.0-net-dsa-mt7530-rework-mt7530_hw_vlan_-add-del.patch b/target/linux/generic/backport-5.15/705-11-v6.0-net-dsa-mt7530-rework-mt7530_hw_vlan_-add-del.patch index 26d207ca6ab75f..4adb167199995d 100644 --- a/target/linux/generic/backport-5.15/705-11-v6.0-net-dsa-mt7530-rework-mt7530_hw_vlan_-add-del.patch +++ b/target/linux/generic/backport-5.15/705-11-v6.0-net-dsa-mt7530-rework-mt7530_hw_vlan_-add-del.patch @@ -26,7 +26,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1536,11 +1536,11 @@ static void +@@ -1544,11 +1544,11 @@ static void mt7530_hw_vlan_add(struct mt7530_priv *priv, struct mt7530_hw_vlan_entry *entry) { @@ -40,7 +40,7 @@ Signed-off-by: Jakub Kicinski /* Validate the entry with independent learning, create egress tag per * VLAN and joining the port as one of the port members. -@@ -1551,22 +1551,20 @@ mt7530_hw_vlan_add(struct mt7530_priv *p +@@ -1559,22 +1559,20 @@ mt7530_hw_vlan_add(struct mt7530_priv *p /* Decide whether adding tag or not for those outgoing packets from the * port inside the VLAN. @@ -72,7 +72,7 @@ Signed-off-by: Jakub Kicinski } static void -@@ -1585,11 +1583,7 @@ mt7530_hw_vlan_del(struct mt7530_priv *p +@@ -1593,11 +1591,7 @@ mt7530_hw_vlan_del(struct mt7530_priv *p return; } diff --git a/target/linux/generic/backport-5.15/705-13-v6.0-net-dsa-mt7530-get-cpu-port-via-dp-cpu_dp-instead-of.patch b/target/linux/generic/backport-5.15/705-13-v6.0-net-dsa-mt7530-get-cpu-port-via-dp-cpu_dp-instead-of.patch index 2bfa1ef438e732..276251f509ea73 100644 --- a/target/linux/generic/backport-5.15/705-13-v6.0-net-dsa-mt7530-get-cpu-port-via-dp-cpu_dp-instead-of.patch +++ b/target/linux/generic/backport-5.15/705-13-v6.0-net-dsa-mt7530-get-cpu-port-via-dp-cpu_dp-instead-of.patch @@ -21,7 +21,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1040,6 +1040,7 @@ static int +@@ -1048,6 +1048,7 @@ static int mt7530_port_enable(struct dsa_switch *ds, int port, struct phy_device *phy) { @@ -29,7 +29,7 @@ Signed-off-by: Jakub Kicinski struct mt7530_priv *priv = ds->priv; mutex_lock(&priv->reg_mutex); -@@ -1048,7 +1049,11 @@ mt7530_port_enable(struct dsa_switch *ds +@@ -1056,7 +1057,11 @@ mt7530_port_enable(struct dsa_switch *ds * restore the port matrix if the port is the member of a certain * bridge. */ @@ -42,7 +42,7 @@ Signed-off-by: Jakub Kicinski priv->ports[port].enable = true; mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, priv->ports[port].pm); -@@ -1196,7 +1201,8 @@ mt7530_port_bridge_join(struct dsa_switc +@@ -1204,7 +1209,8 @@ mt7530_port_bridge_join(struct dsa_switc struct net_device *bridge) { struct dsa_port *dp = dsa_to_port(ds, port), *other_dp; @@ -52,7 +52,7 @@ Signed-off-by: Jakub Kicinski struct mt7530_priv *priv = ds->priv; mutex_lock(&priv->reg_mutex); -@@ -1273,9 +1279,12 @@ mt7530_port_set_vlan_unaware(struct dsa_ +@@ -1281,9 +1287,12 @@ mt7530_port_set_vlan_unaware(struct dsa_ * the CPU port get out of VLAN filtering mode. */ if (all_user_ports_removed) { @@ -67,7 +67,7 @@ Signed-off-by: Jakub Kicinski | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); } } -@@ -1325,6 +1334,7 @@ mt7530_port_bridge_leave(struct dsa_swit +@@ -1333,6 +1342,7 @@ mt7530_port_bridge_leave(struct dsa_swit struct net_device *bridge) { struct dsa_port *dp = dsa_to_port(ds, port), *other_dp; @@ -75,7 +75,7 @@ Signed-off-by: Jakub Kicinski struct mt7530_priv *priv = ds->priv; mutex_lock(&priv->reg_mutex); -@@ -1353,8 +1363,8 @@ mt7530_port_bridge_leave(struct dsa_swit +@@ -1361,8 +1371,8 @@ mt7530_port_bridge_leave(struct dsa_swit */ if (priv->ports[port].enable) mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, @@ -86,7 +86,7 @@ Signed-off-by: Jakub Kicinski /* When a port is removed from the bridge, the port would be set up * back to the default as is at initial boot which is a VLAN-unaware -@@ -1517,6 +1527,9 @@ static int +@@ -1525,6 +1535,9 @@ static int mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack) { @@ -96,7 +96,7 @@ Signed-off-by: Jakub Kicinski if (vlan_filtering) { /* The port is being kept as VLAN-unaware port when bridge is * set up with vlan_filtering not being set, Otherwise, the -@@ -1524,7 +1537,7 @@ mt7530_port_vlan_filtering(struct dsa_sw +@@ -1532,7 +1545,7 @@ mt7530_port_vlan_filtering(struct dsa_sw * for becoming a VLAN-aware port. */ mt7530_port_set_vlan_aware(ds, port); diff --git a/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch b/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch index 377ee76171c055..8d55ffb8b688fb 100644 --- a/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch +++ b/target/linux/generic/backport-5.15/782-v6.1-net-dsa-mt7530-add-support-for-in-band-link-status.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2736,9 +2736,6 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2746,9 +2746,6 @@ mt7531_mac_config(struct dsa_switch *ds, case PHY_INTERFACE_MODE_NA: case PHY_INTERFACE_MODE_1000BASEX: case PHY_INTERFACE_MODE_2500BASEX: @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller return mt7531_sgmii_setup_mode_force(priv, port, interface); default: return -EINVAL; -@@ -2814,13 +2811,6 @@ unsupported: +@@ -2824,13 +2821,6 @@ unsupported: return; } @@ -43,7 +43,7 @@ Signed-off-by: David S. Miller mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); mcr_new = mcr_cur; mcr_new &= ~PMCR_LINK_SETTINGS_MASK; -@@ -2957,6 +2947,9 @@ static void mt753x_phylink_get_caps(stru +@@ -2967,6 +2957,9 @@ static void mt753x_phylink_get_caps(stru config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; @@ -53,7 +53,7 @@ Signed-off-by: David S. Miller /* This driver does not make use of the speed, duplex, pause or the * advertisement in its mac_config, so it is safe to mark this driver * as non-legacy. -@@ -3022,6 +3015,7 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 +@@ -3032,6 +3025,7 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 status = mt7530_read(priv, MT7531_PCS_CONTROL_1(port)); state->link = !!(status & MT7531_SGMII_LINK_STATUS); @@ -61,7 +61,7 @@ Signed-off-by: David S. Miller if (state->interface == PHY_INTERFACE_MODE_SGMII && (status & MT7531_SGMII_AN_ENABLE)) { val = mt7530_read(priv, MT7531_PCS_SPEED_ABILITY(port)); -@@ -3052,16 +3046,44 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 +@@ -3062,16 +3056,44 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 return 0; } @@ -109,7 +109,7 @@ Signed-off-by: David S. Miller } static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode, -@@ -3102,6 +3124,8 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3112,6 +3134,8 @@ mt753x_setup(struct dsa_switch *ds) priv->pcs[i].pcs.ops = priv->info->pcs_ops; priv->pcs[i].priv = priv; priv->pcs[i].port = i; diff --git a/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch b/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch index 9e445f1300cd8f..2642cd4fafcd15 100644 --- a/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch +++ b/target/linux/generic/backport-5.15/788-v6.3-net-dsa-mt7530-use-external-PCS-driver.patch @@ -81,7 +81,7 @@ Tested-by: Frank Wunderlich #include #include #include -@@ -2588,128 +2589,11 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2598,128 +2599,11 @@ static int mt7531_rgmii_setup(struct mt7 return 0; } @@ -210,7 +210,7 @@ Tested-by: Frank Wunderlich static int mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) -@@ -2732,11 +2616,11 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2742,11 +2626,11 @@ mt7531_mac_config(struct dsa_switch *ds, phydev = dp->slave->phydev; return mt7531_rgmii_setup(priv, port, interface, phydev); case PHY_INTERFACE_MODE_SGMII: @@ -224,7 +224,7 @@ Tested-by: Frank Wunderlich default: return -EINVAL; } -@@ -2761,11 +2645,11 @@ mt753x_phylink_mac_select_pcs(struct dsa +@@ -2771,11 +2655,11 @@ mt753x_phylink_mac_select_pcs(struct dsa switch (interface) { case PHY_INTERFACE_MODE_TRGMII: @@ -238,7 +238,7 @@ Tested-by: Frank Wunderlich default: return NULL; } -@@ -3006,86 +2890,6 @@ static void mt7530_pcs_get_state(struct +@@ -3016,86 +2900,6 @@ static void mt7530_pcs_get_state(struct state->pause |= MLO_PAUSE_TX; } @@ -325,7 +325,7 @@ Tested-by: Frank Wunderlich static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode, phy_interface_t interface, const unsigned long *advertising, -@@ -3105,18 +2909,57 @@ static const struct phylink_pcs_ops mt75 +@@ -3115,18 +2919,57 @@ static const struct phylink_pcs_ops mt75 .pcs_an_restart = mt7530_pcs_an_restart, }; @@ -389,7 +389,7 @@ Tested-by: Frank Wunderlich int i, ret; /* Initialise the PCS devices */ -@@ -3124,8 +2967,6 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3134,8 +2977,6 @@ mt753x_setup(struct dsa_switch *ds) priv->pcs[i].pcs.ops = priv->info->pcs_ops; priv->pcs[i].priv = priv; priv->pcs[i].port = i; @@ -398,7 +398,7 @@ Tested-by: Frank Wunderlich } ret = priv->info->sw_setup(ds); -@@ -3140,6 +2981,16 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3150,6 +2991,16 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); @@ -415,7 +415,7 @@ Tested-by: Frank Wunderlich return ret; } -@@ -3231,7 +3082,7 @@ static const struct mt753x_info mt753x_t +@@ -3241,7 +3092,7 @@ static const struct mt753x_info mt753x_t }, [ID_MT7531] = { .id = ID_MT7531, @@ -424,7 +424,7 @@ Tested-by: Frank Wunderlich .sw_setup = mt7531_setup, .phy_read = mt7531_ind_phy_read, .phy_write = mt7531_ind_phy_write, -@@ -3339,7 +3190,7 @@ static void +@@ -3349,7 +3200,7 @@ static void mt7530_remove(struct mdio_device *mdiodev) { struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); @@ -433,7 +433,7 @@ Tested-by: Frank Wunderlich if (!priv) return; -@@ -3358,6 +3209,10 @@ mt7530_remove(struct mdio_device *mdiode +@@ -3368,6 +3219,10 @@ mt7530_remove(struct mdio_device *mdiode mt7530_free_irq(priv); dsa_unregister_switch(priv->ds); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch b/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch index a933d376c8871e..983423aaff6a11 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0002-net-dsa-mt7530-refactor-SGMII-PCS-creation.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2941,26 +2941,56 @@ static const struct regmap_bus mt7531_re +@@ -2951,26 +2951,56 @@ static const struct regmap_bus mt7531_re .reg_update_bits = mt7530_regmap_update_bits, }; @@ -88,7 +88,7 @@ Signed-off-by: David S. Miller int i, ret; /* Initialise the PCS devices */ -@@ -2982,15 +3012,11 @@ mt753x_setup(struct dsa_switch *ds) +@@ -2992,15 +3022,11 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch b/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch index 5f6990f117832e..9d8f67ba957f39 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0003-net-dsa-mt7530-use-unlocked-regmap-accessors.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2914,7 +2914,7 @@ static int mt7530_regmap_read(void *cont +@@ -2924,7 +2924,7 @@ static int mt7530_regmap_read(void *cont { struct mt7530_priv *priv = context; @@ -28,7 +28,7 @@ Signed-off-by: David S. Miller return 0; }; -@@ -2922,23 +2922,25 @@ static int mt7530_regmap_write(void *con +@@ -2932,23 +2932,25 @@ static int mt7530_regmap_write(void *con { struct mt7530_priv *priv = context; @@ -62,7 +62,7 @@ Signed-off-by: David S. Miller }; static int -@@ -2964,6 +2966,9 @@ mt7531_create_sgmii(struct mt7530_priv * +@@ -2974,6 +2976,9 @@ mt7531_create_sgmii(struct mt7530_priv * mt7531_pcs_config[i]->reg_stride = 4; mt7531_pcs_config[i]->reg_base = MT7531_SGMII_REG_BASE(5 + i); mt7531_pcs_config[i]->max_register = 0x17c; diff --git a/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch b/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch index 9499ca598fbf8e..bd1d5c98a7ce3c 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0004-net-dsa-mt7530-use-regmap-to-access-switch-register-.patch @@ -133,7 +133,7 @@ Signed-off-by: David S. Miller } static void -@@ -2910,22 +2931,6 @@ static const struct phylink_pcs_ops mt75 +@@ -2920,22 +2941,6 @@ static const struct phylink_pcs_ops mt75 .pcs_an_restart = mt7530_pcs_an_restart, }; @@ -156,7 +156,7 @@ Signed-off-by: David S. Miller static void mt7530_mdio_regmap_lock(void *mdio_lock) { -@@ -2938,7 +2943,7 @@ mt7530_mdio_regmap_unlock(void *mdio_loc +@@ -2948,7 +2953,7 @@ mt7530_mdio_regmap_unlock(void *mdio_loc mutex_unlock(mdio_lock); } @@ -165,7 +165,7 @@ Signed-off-by: David S. Miller .reg_write = mt7530_regmap_write, .reg_read = mt7530_regmap_read, }; -@@ -2971,7 +2976,7 @@ mt7531_create_sgmii(struct mt7530_priv * +@@ -2981,7 +2986,7 @@ mt7531_create_sgmii(struct mt7530_priv * mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; regmap = devm_regmap_init(priv->dev, @@ -174,7 +174,7 @@ Signed-off-by: David S. Miller mt7531_pcs_config[i]); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); -@@ -3136,6 +3141,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match) +@@ -3146,6 +3151,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match) static int mt7530_probe(struct mdio_device *mdiodev) { @@ -182,7 +182,7 @@ Signed-off-by: David S. Miller struct mt7530_priv *priv; struct device_node *dn; -@@ -3215,6 +3221,21 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3225,6 +3231,21 @@ mt7530_probe(struct mdio_device *mdiodev mutex_init(&priv->reg_mutex); dev_set_drvdata(&mdiodev->dev, priv); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch b/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch index 44c31a4f6f2a29..8c11bc3733ec57 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0005-net-dsa-mt7530-move-SGMII-PCS-creation-to-mt7530_pro.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3022,12 +3022,6 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3032,12 +3032,6 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); @@ -31,7 +31,7 @@ Signed-off-by: David S. Miller return ret; } -@@ -3144,6 +3138,7 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3154,6 +3148,7 @@ mt7530_probe(struct mdio_device *mdiodev static struct regmap_config *regmap_config; struct mt7530_priv *priv; struct device_node *dn; @@ -39,7 +39,7 @@ Signed-off-by: David S. Miller dn = mdiodev->dev.of_node; -@@ -3236,6 +3231,12 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3246,6 +3241,12 @@ mt7530_probe(struct mdio_device *mdiodev if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch b/target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch index c23f96e7a6605a..4d75c55647c150 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0006-net-dsa-mt7530-introduce-mutex-helpers.patch @@ -214,7 +214,7 @@ Signed-off-by: David S. Miller return ret; } -@@ -1109,7 +1109,6 @@ static int +@@ -1117,7 +1117,6 @@ static int mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct mt7530_priv *priv = ds->priv; @@ -222,7 +222,7 @@ Signed-off-by: David S. Miller int length; u32 val; -@@ -1120,7 +1119,7 @@ mt7530_port_change_mtu(struct dsa_switch +@@ -1128,7 +1127,7 @@ mt7530_port_change_mtu(struct dsa_switch if (!dsa_is_cpu_port(ds, port)) return 0; @@ -231,7 +231,7 @@ Signed-off-by: David S. Miller val = mt7530_mii_read(priv, MT7530_GMACCR); val &= ~MAX_RX_PKT_LEN_MASK; -@@ -1141,7 +1140,7 @@ mt7530_port_change_mtu(struct dsa_switch +@@ -1149,7 +1148,7 @@ mt7530_port_change_mtu(struct dsa_switch mt7530_mii_write(priv, MT7530_GMACCR, val); @@ -240,7 +240,7 @@ Signed-off-by: David S. Miller return 0; } -@@ -1937,10 +1936,10 @@ mt7530_irq_thread_fn(int irq, void *dev_ +@@ -1945,10 +1944,10 @@ mt7530_irq_thread_fn(int irq, void *dev_ u32 val; int p; @@ -253,7 +253,7 @@ Signed-off-by: David S. Miller for (p = 0; p < MT7530_NUM_PHYS; p++) { if (BIT(p) & val) { -@@ -1976,7 +1975,7 @@ mt7530_irq_bus_lock(struct irq_data *d) +@@ -1984,7 +1983,7 @@ mt7530_irq_bus_lock(struct irq_data *d) { struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); @@ -262,7 +262,7 @@ Signed-off-by: David S. Miller } static void -@@ -1985,7 +1984,7 @@ mt7530_irq_bus_sync_unlock(struct irq_da +@@ -1993,7 +1992,7 @@ mt7530_irq_bus_sync_unlock(struct irq_da struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); mt7530_mii_write(priv, MT7530_SYS_INT_EN, priv->irq_enable); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch b/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch index aeb1e37a1a11ee..00dd91bbc957fb 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0008-net-dsa-mt7530-introduce-mt7530_probe_common-helper-.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3150,44 +3150,21 @@ static const struct of_device_id mt7530_ +@@ -3160,44 +3160,21 @@ static const struct of_device_id mt7530_ MODULE_DEVICE_TABLE(of, mt7530_of_match); static int @@ -67,7 +67,7 @@ Signed-off-by: David S. Miller if (!priv->info) return -EINVAL; -@@ -3201,23 +3178,53 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3211,23 +3188,53 @@ mt7530_probe(struct mdio_device *mdiodev return -EINVAL; priv->id = priv->info->id; @@ -131,7 +131,7 @@ Signed-off-by: David S. Miller priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(priv->reset)) { -@@ -3226,12 +3233,15 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3236,12 +3243,15 @@ mt7530_probe(struct mdio_device *mdiodev } } diff --git a/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch b/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch index 2651f4591835f1..be73b67c948ce5 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0009-net-dsa-mt7530-introduce-mt7530_remove_common-helper.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3268,6 +3268,17 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -3278,6 +3278,17 @@ mt7530_probe(struct mdio_device *mdiodev } static void @@ -35,7 +35,7 @@ Signed-off-by: David S. Miller mt7530_remove(struct mdio_device *mdiodev) { struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); -@@ -3286,16 +3297,11 @@ mt7530_remove(struct mdio_device *mdiode +@@ -3296,16 +3307,11 @@ mt7530_remove(struct mdio_device *mdiode dev_err(priv->dev, "Failed to disable io pwr: %d\n", ret); diff --git a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch index d5ba5dbf66260c..c0e29fa00fbf0e 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch @@ -416,7 +416,7 @@ Signed-off-by: David S. Miller static u32 mt7530_mii_read(struct mt7530_priv *priv, u32 reg) { -@@ -2948,72 +2899,6 @@ static const struct phylink_pcs_ops mt75 +@@ -2958,72 +2909,6 @@ static const struct phylink_pcs_ops mt75 .pcs_an_restart = mt7530_pcs_an_restart, }; @@ -489,7 +489,7 @@ Signed-off-by: David S. Miller static int mt753x_setup(struct dsa_switch *ds) { -@@ -3072,7 +2957,7 @@ static int mt753x_set_mac_eee(struct dsa +@@ -3082,7 +2967,7 @@ static int mt753x_set_mac_eee(struct dsa return 0; } @@ -498,7 +498,7 @@ Signed-off-by: David S. Miller .get_tag_protocol = mtk_get_tag_protocol, .setup = mt753x_setup, .get_strings = mt7530_get_strings, -@@ -3106,8 +2991,9 @@ static const struct dsa_switch_ops mt753 +@@ -3116,8 +3001,9 @@ static const struct dsa_switch_ops mt753 .get_mac_eee = mt753x_get_mac_eee, .set_mac_eee = mt753x_set_mac_eee, }; @@ -509,7 +509,7 @@ Signed-off-by: David S. Miller [ID_MT7621] = { .id = ID_MT7621, .pcs_ops = &mt7530_pcs_ops, -@@ -3140,16 +3026,9 @@ static const struct mt753x_info mt753x_t +@@ -3150,16 +3036,9 @@ static const struct mt753x_info mt753x_t .mac_port_config = mt7531_mac_config, }, }; @@ -528,7 +528,7 @@ Signed-off-by: David S. Miller mt7530_probe_common(struct mt7530_priv *priv) { struct device *dev = priv->dev; -@@ -3186,88 +3065,9 @@ mt7530_probe_common(struct mt7530_priv * +@@ -3196,88 +3075,9 @@ mt7530_probe_common(struct mt7530_priv * return 0; } @@ -619,7 +619,7 @@ Signed-off-by: David S. Miller mt7530_remove_common(struct mt7530_priv *priv) { if (priv->irq) -@@ -3278,57 +3078,6 @@ mt7530_remove_common(struct mt7530_priv +@@ -3288,57 +3088,6 @@ mt7530_remove_common(struct mt7530_priv mutex_destroy(&priv->reg_mutex); } diff --git a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch index b748fb5f8f19da..89dc30c7dffb7c 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch @@ -184,7 +184,7 @@ Signed-off-by: David S. Miller +MODULE_LICENSE("GPL"); --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1984,6 +1984,47 @@ static const struct irq_domain_ops mt753 +@@ -1992,6 +1992,47 @@ static const struct irq_domain_ops mt753 }; static void @@ -232,7 +232,7 @@ Signed-off-by: David S. Miller mt7530_setup_mdio_irq(struct mt7530_priv *priv) { struct dsa_switch *ds = priv->ds; -@@ -2017,8 +2058,15 @@ mt7530_setup_irq(struct mt7530_priv *pri +@@ -2025,8 +2066,15 @@ mt7530_setup_irq(struct mt7530_priv *pri return priv->irq ? : -EINVAL; } @@ -250,7 +250,7 @@ Signed-off-by: David S. Miller if (!priv->irq_domain) { dev_err(dev, "failed to create IRQ domain\n"); return -ENOMEM; -@@ -2511,6 +2559,25 @@ static void mt7531_mac_port_get_caps(str +@@ -2521,6 +2569,25 @@ static void mt7531_mac_port_get_caps(str } } @@ -276,7 +276,7 @@ Signed-off-by: David S. Miller static int mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) { -@@ -2587,6 +2654,17 @@ static bool mt753x_is_mac_port(u32 port) +@@ -2597,6 +2664,17 @@ static bool mt753x_is_mac_port(u32 port) } static int @@ -294,7 +294,7 @@ Signed-off-by: David S. Miller mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { -@@ -2656,7 +2734,8 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2666,7 +2744,8 @@ mt753x_phylink_mac_config(struct dsa_swi switch (port) { case 0 ... 4: /* Internal phy */ @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller goto unsupported; break; case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */ -@@ -2734,7 +2813,8 @@ static void mt753x_phylink_mac_link_up(s +@@ -2744,7 +2823,8 @@ static void mt753x_phylink_mac_link_up(s /* MT753x MAC works in 1G full duplex mode for all up-clocked * variants. */ @@ -314,7 +314,7 @@ Signed-off-by: David S. Miller (phy_interface_mode_is_8023z(interface))) { speed = SPEED_1000; duplex = DUPLEX_FULL; -@@ -2814,6 +2894,21 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -2824,6 +2904,21 @@ mt7531_cpu_port_config(struct dsa_switch return 0; } @@ -336,7 +336,7 @@ Signed-off-by: David S. Miller static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, struct phylink_config *config) { -@@ -2959,6 +3054,27 @@ static int mt753x_set_mac_eee(struct dsa +@@ -2969,6 +3064,27 @@ static int mt753x_set_mac_eee(struct dsa return 0; } @@ -364,7 +364,7 @@ Signed-off-by: David S. Miller const struct dsa_switch_ops mt7530_switch_ops = { .get_tag_protocol = mtk_get_tag_protocol, .setup = mt753x_setup, -@@ -3027,6 +3143,17 @@ const struct mt753x_info mt753x_table[] +@@ -3037,6 +3153,17 @@ const struct mt753x_info mt753x_table[] .mac_port_get_caps = mt7531_mac_port_get_caps, .mac_port_config = mt7531_mac_config, }, diff --git a/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch b/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch index ed8bca7d1c1276..40e18167267d2d 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0014-net-dsa-mt7530-fix-support-for-MT7531BE.patch @@ -73,7 +73,7 @@ Signed-off-by: Jakub Kicinski } --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3021,6 +3021,12 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3031,6 +3031,12 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch b/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch index a3274906a4332e..4ff7f321de93e8 100644 --- a/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch +++ b/target/linux/generic/pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch @@ -15,7 +15,7 @@ Signed-off-by: Alexander Couzens --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2412,7 +2412,7 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2422,7 +2422,7 @@ mt7531_setup(struct dsa_switch *ds) struct mt7530_priv *priv = ds->priv; struct mt7530_dummy_poll p; u32 val, id; @@ -24,7 +24,7 @@ Signed-off-by: Alexander Couzens /* Reset whole chip through gpio pin or memory-mapped registers for * different type of hardware -@@ -2444,6 +2444,10 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2454,6 +2454,10 @@ mt7531_setup(struct dsa_switch *ds) return -ENODEV; } diff --git a/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch b/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch index 8a64a2a985eaf4..98fd6e9c7a7c1d 100644 --- a/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch +++ b/target/linux/generic/pending-5.15/795-mt7530-register-OF-node-for-internal-MDIO-bus.patch @@ -16,7 +16,7 @@ Signed-off-by: David Bauer --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2121,10 +2121,13 @@ mt7530_setup_mdio(struct mt7530_priv *pr +@@ -2129,10 +2129,13 @@ mt7530_setup_mdio(struct mt7530_priv *pr { struct dsa_switch *ds = priv->ds; struct device *dev = priv->dev; @@ -30,7 +30,7 @@ Signed-off-by: David Bauer bus = devm_mdiobus_alloc(dev); if (!bus) return -ENOMEM; -@@ -2141,7 +2144,9 @@ mt7530_setup_mdio(struct mt7530_priv *pr +@@ -2149,7 +2152,9 @@ mt7530_setup_mdio(struct mt7530_priv *pr if (priv->irq) mt7530_setup_mdio_irq(priv); From 5399d0362fc49767da4395683622e6832ae449a1 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 11 Jun 2023 20:48:49 +0000 Subject: [PATCH 0237/1171] ramips: sercomm.mk: preparation for Sercomm s1500 devices support This commit moves a part of the code from the "sercomm-factory-cqr" recipe to the separate "sercomm-mkhash" recipe. This simplifies recipes and allows insert additional recipes between these code blocks (required for the future support for Beeline SmartBox PRO router). dd automatically fills the file by 0x00 if the filesize is less than offset where we start writing. We drop such dd command so we need to add --extra-padding-size 0x190 to the sercomm-pid.py call. Signed-off-by: Mikhail Zhilkin (cherry picked from commit f560be583a858bc3099f2b1f0aa0ddec62cfd91c) --- target/linux/ramips/image/common-sercomm.mk | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/image/common-sercomm.mk b/target/linux/ramips/image/common-sercomm.mk index fbe29d701749be..b743df440809f5 100644 --- a/target/linux/ramips/image/common-sercomm.mk +++ b/target/linux/ramips/image/common-sercomm.mk @@ -22,14 +22,12 @@ define Build/sercomm-factory-cqr --hw-version $(SERCOMM_HWVER) \ --hw-id $(SERCOMM_HWID) \ --sw-version $(SERCOMM_SWVER) \ - --pid-file $@.fhdr + --pid-file $@.fhdr \ + --extra-padding-size 0x190 printf $$(stat -c%s $(IMAGE_KERNEL)) | \ dd seek=$$((0x70)) of=$@.fhdr bs=1 conv=notrunc 2>/dev/null printf $$(($$(stat -c%s $@)-$$(stat -c%s $(IMAGE_KERNEL))-$$((0x200)))) | \ dd seek=$$((0x80)) of=$@.fhdr bs=1 conv=notrunc 2>/dev/null - dd bs=$$((0x200)) skip=1 if=$@ conv=notrunc 2>/dev/null | \ - $(MKHASH) md5 | awk '{print $$1}' | tr -d '\n' | \ - dd seek=$$((0x1e0)) of=$@.fhdr bs=1 conv=notrunc 2>/dev/null dd if=$@ >> $@.fhdr 2>/dev/null mv $@.fhdr $@ endef @@ -60,6 +58,12 @@ define Build/sercomm-kernel-factory mv $@.khdr $@ endef +define Build/sercomm-mkhash + dd bs=$$((0x400)) skip=1 if=$@ conv=notrunc 2>/dev/null | \ + $(MKHASH) md5 | awk '{print $$1}' | tr -d '\n' | \ + dd seek=$$((0x1e0)) of=$@ bs=1 conv=notrunc 2>/dev/null +endef + define Build/sercomm-part-tag $(call Build/sercomm-part-tag-common,$(word 1,$(1)) $@) endef @@ -118,7 +122,7 @@ define Device/sercomm_cxx IMAGE/sysupgrade.bin := append-kernel | sercomm-kernel | \ sysupgrade-tar kernel=$$$$@ | append-metadata IMAGE/factory.img := append-kernel | sercomm-kernel-factory | \ - append-ubi | sercomm-factory-cqr + append-ubi | sercomm-factory-cqr | sercomm-mkhash endef define Device/sercomm_dxx From 436ef3772809e5e34e18b623e8ff93d34af1ea5d Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 11 Jun 2023 20:50:23 +0000 Subject: [PATCH 0238/1171] ramips: add support for Sercomm S1500 devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds support for following wireless routers: - Beeline SmartBox PRO (Serсomm S1500 AWI) - WiFire S1500.NBN (Serсomm S1500 BUC) This commit is based on this PR: - Link: https://github.com/openwrt/openwrt/pull/4770 - Author: Maximilian Weinmann The opening of this PR was agreed with author. My changes: - Sorting, minor changes and some movings between dts and dtsi - Move leds to dts when possible - Recipes for the factory image - Update of the installation/recovery/return to stock guides - Add reset GPIO for the pcie1 Common specification -------------------- SoC: MediaTek MT7621AT (880 MHz, 2 cores) Switch: MediaTek MT7530 (via SoC MT7621AT) Wireless: 2.4 GHz, MT7602EN, b/g/n, 2x2 Wireless: 5 GHz, MT7612EN, a/n/ac, 2x2 Ethernet: 5 ports - 5×GbE (WAN, LAN1-4) Mini PCIe: via J2 on PCB, not soldered on the board UART: J4 -> GND[], TX, VCC(3.3V), RX BootLoader: U-Boot SerComm/Mediatek Beeline SmartBox PRO specification ---------------------------------- RAM (Nanya NT5CB128M16FP): 256 MiB NAND-Flash (ESMT F59L2G81A): 256 MiB USB ports: 2xUSB2.0 LEDs: Status (white), WPS (blue), 2g (white), 5g (white) + 10 LED Ethernet Buttons: 2 button (reset, wps), 1 switch button (ROUT<->REP) Power: 12 VDC, 1.5 A PCB Sticker: 970AWI0QW00N256SMT Ver. 1.0 CSN: SG15******** MAC LAN: 94:4A:0C:**:**:** Manufacturer's code: 0AWI0500QW1 WiFire S1500.NBN specification ------------------------------ RAM (Nanya NT5CC64M16GP): 128 MiB NAND-Flash (ESMT F59L1G81MA): 128 MiB USB ports: 1xUSB2.0 LEDs: Status (white), WPS (white), 2g (white), 5g (white) + 10 LED Ethernet Buttons: 2 button (RESET, WPS) Power: 12 VDC, 1.0 A PCB Sticker: 970BUC0RW00N128SMT Ver. 1.0 CSN: MH16******** MAC WAN: E0:60:66:**:**:** Manufacturer's code: 0BUC0500RW1 MAC address table (PRO) ----------------------- use address source LAN *:23 factory 0x1000 (label) WAN *:24 factory $label +1 2g *:23 factory $label 5g *:25 factory $label +2 MAC addresses (NBN) ------------------- use address source LAN *:0e factory 0x1000 WAN *:0f LAN +1 (label) 2g *:0f LAN +1 5g *:10 LAN +2 OEM easy installation --------------------- 1. Remove all dots from the factory image filename (except the dot before file extension) 2. Upload and update the firmware via the original web interface 3. Two options are possible after the reboot: a. OpenWrt - that's OK, the mission accomplished b. Stock firmware - install Stock firmware (to switch booflag from Sercomm0 to Sercomm1) and then OpenWrt factory image. Return to Stock --------------- 1. Change the bootflag to Sercomm1 in OpenWrt CLI and then reboot: printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock2 reboot 2. Install stock firmware via the web OEM firmware interface Recovery -------- Use sercomm-recovery tool. Link: https://github.com/danitool/sercomm-recovery Tested-by: Pavel Ivanov Tested-by: Denis Myshaev Tested-by: Oleg Galeev Tested-By: Ivan Pavlov Co-authored-by: Maximilian Weinmann Signed-off-by: Mikhail Zhilkin (cherry picked from commit 2d6784a033a994043759fa3b94c48afd5df81f88) --- package/boot/uboot-envtools/files/ramips | 12 +- .../dts/mt7621_beeline_smartbox-pro.dts | 118 ++++++++ .../ramips/dts/mt7621_sercomm_s1500.dtsi | 281 ++++++++++++++++++ .../ramips/dts/mt7621_wifire_s1500-nbn.dts | 81 +++++ target/linux/ramips/image/common-sercomm.mk | 39 ++- target/linux/ramips/image/mt7621.mk | 35 +++ .../mt7621/base-files/etc/board.d/01_leds | 8 + .../mt7621/base-files/lib/upgrade/platform.sh | 2 + 8 files changed, 568 insertions(+), 8 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts create mode 100644 target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi create mode 100644 target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index b3f37c7c3ebdf3..5fb5c45a51bc21 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -44,6 +44,13 @@ etisalat,s3|\ rostelecom,rt-sf-1) ubootenv_add_uci_config "/dev/mtd0" "0x80000" "0x1000" "0x20000" ;; +beeline,smartbox-pro|\ +tplink,ec330-g5u-v1|\ +wifire,s1500-nbn) + idx="$(find_mtd_index u-boot-env)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x20000" + ;; buffalo,wsr-1166dhp|\ buffalo,wsr-600dhp|\ kroks,kndrt31r16|\ @@ -96,11 +103,6 @@ snr,cpe-w4n-mt) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x1000" ;; -tplink,ec330-g5u-v1) - idx="$(find_mtd_index u-boot-env)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x20000" - ;; xiaomi,mi-router-3g-v2|\ xiaomi,mi-router-4a-gigabit|\ xiaomi,miwifi-3c) diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts new file mode 100644 index 00000000000000..e3e248d48f960e --- /dev/null +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-pro.dts @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621_sercomm_s1500.dtsi" + +/ { + compatible = "beeline,smartbox-pro", "mediatek,mt7621-soc"; + model = "Beeline SmartBox PRO"; + + aliases { + label-mac-device = &gmac0; + }; + + keys { + switch_bt { + label = "ROUT<->REP Switch_bt"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,input-type = ; + linux,code = ; + debounce-interval = <60>; + }; + }; + + ubi-concat { + compatible = "mtd-concat"; + devices = <&ubiconcat0 &ubiconcat1 &ubiconcat2 &ubiconcat3 \ + &ubiconcat4 &ubiconcat5 &ubiconcat6>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0xd2e0000>; + }; + }; + }; +}; + +&led_wps { + label = "blue:wps"; + color = ; +}; + +&partitions { + partition@0_all { + label = "ALL"; + reg = <0x0 0xff80000>; + read-only; + }; + + partition@200000 { + label = "sys_data"; + reg = <0x200000 0x1400000>; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + ubiconcat5: partition@0 { + label = "sys_data_1"; + reg = <0x0 0x600000>; + }; + + /* + * Sercomm U-Boot saves the environment at 0x800000 from + * the start of the NAND, destroying the "sys_data" + * partition. To prevent this, we split "sys_data" into + * two parts with "u-boot-env" partition between them. + */ + partition@600000 { + label = "u-boot-env"; + reg = <0x600000 0x20000>; + }; + + ubiconcat6: partition@620000 { + label = "sys_data_2"; + reg = <0x620000 0xde0000>; + }; + }; + + ubiconcat0: partition@1f00000 { + label = "RootFS_1"; + reg = <0x1f00000 0x1e00000>; + }; + + partition@3d00000 { + label = "RootFS_2"; + reg = <0x3d00000 0x1e00000>; + read-only; + }; + + ubiconcat1: partition@5b00000 { + label = "JVM/OSGI1"; + reg = <0x5b00000 0x3200000>; + }; + + ubiconcat2: partition@8d00000 { + label = "JVM/OSGI2"; + reg = <0x8d00000 0x3200000>; + }; + + ubiconcat3: partition@bf00000 { + label = "OSGI data"; + reg = <0xbf00000 0x3c00000>; + }; + + ubiconcat4: partition@fb00000 { + label = "Ftool"; + reg = <0xfb00000 0x100000>; + }; + + /* + * 4 MiB Reserved for the Bad Blocka + * 0x10000000-0xfc00000=0x400000 + */ +}; diff --git a/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi b/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi new file mode 100644 index 00000000000000..91053f15bc1468 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_sercomm_s1500.dtsi @@ -0,0 +1,281 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + aliases { + led-boot = &led_status; + led-running = &led_status; + led-upgrade = &led_wps; + led-failsafe = &led_wps; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "amber:lan4"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <0>; + linux,default-trigger = "mt7530-0:00:1Gbps"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + led-1 { + label = "green:lan4"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led-2 { + label = "amber:lan3"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + linux,default-trigger = "mt7530-0:01:1Gbps"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + + led-3 { + label = "green:lan3"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + led-4 { + label = "amber:lan2"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + linux,default-trigger = "mt7530-0:02:1Gbps"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led-5 { + label = "amber:lan1"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <5>; + linux,default-trigger = "mt7530-0:03:1Gbps"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + led-6 { + label = "green:lan1"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <6>; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + + led-7 { + label = "amber:wan"; + color = ; + function = LED_FUNCTION_WAN; + function-enumerator = <0>; + linux,default-trigger = "mt7530-0:04:1Gbps"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + }; + + led-8 { + label = "green:wan"; + color = ; + function = LED_FUNCTION_WAN; + function-enumerator = <1>; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + }; + + led-9 { + label = "green:lan2"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <7>; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + }; + + led-10 { + label = "white:wlan2g"; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <0>; + linux,default-trigger = "phy1radio"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + }; + + led_wps: led-11 { + function = LED_FUNCTION_WPS; + function-enumerator = <0>; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + panic-indicator; + }; + + led_status: led-12 { + label = "white:status"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + }; + + led-13 { + label = "white:wlan5g"; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <1>; + linux,default-trigger = "phy0radio"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_1000>; + nvmem-cell-names = "mac-address"; +}; + +&nand { + status = "okay"; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x100000>; + read-only; + }; + + factory: partition@100000 { + label = "Factory"; + reg = <0x100000 0x100000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_1000: macaddr@1000 { + reg = <0x1000 0x6>; + }; + }; + + partition@1600000 { + label = "boot_flag"; + reg = <0x1600000 0x100000>; + }; + + partition@1700000 { + label = "kernel"; + reg = <0x1700000 0x400000>; + }; + + partition@1b00000 { + label = "Kernel_2"; + reg = <0x1b00000 0x400000>; + read-only; + }; + }; +}; + +&pcie { + status = "okay"; + + reset-gpios = <&gpio 8 GPIO_ACTIVE_LOW>, + <&gpio 19 GPIO_ACTIVE_LOW>; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,mtd-eeprom = <&factory 0x8000>; + + nvmem-cells = <&macaddr_factory_1000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <2>; + }; +}; + +&pcie1 { + wlan_2g: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <2400000 2500000>; + mediatek,mtd-eeprom = <&factory 0x0>; + + nvmem-cells = <&macaddr_factory_1000>; + nvmem-cell-names = "mac-address"; + }; +}; + +&state_default { + gpio { + groups = "wdt", "uart3", "jtag", "uart2", "i2c", "rgmii2"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan4"; + }; + + port@1 { + status = "okay"; + label = "lan3"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan1"; + }; + + wan: port@4 { + status = "okay"; + label = "wan"; + + nvmem-cells = <&macaddr_factory_1000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts b/target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts new file mode 100644 index 00000000000000..6c0e2965aa0d10 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_wifire_s1500-nbn.dts @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621_sercomm_s1500.dtsi" + +/ { + compatible = "wifire,s1500-nbn", "mediatek,mt7621-soc"; + model = "WiFire S1500.NBN"; + + aliases { + label-mac-device = &wan; + }; + + ubi-concat { + compatible = "mtd-concat"; + devices = <&ubiconcat0 &ubiconcat1 &ubiconcat2 &ubiconcat3>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x4680000>; + }; + }; + }; +}; + +&led_wps { + label = "white:wps"; + color = ; +}; + +&partitions { + partition@0_all { + label = "ALL"; + reg = <0x0 0x7f80000>; + read-only; + }; + + partition@80000 { + label = "u-boot-env"; + reg = <0x80000 0x20000>; + }; + + ubiconcat1: partition@200000 { + label = "sys_data"; + reg = <0x200000 0x1400000>; + }; + + ubiconcat0: partition@1f00000 { + label = "RootFS_1"; + reg = <0x1f00000 0x2e00000>; + }; + + partition@4d00000 { + label = "RootFS_2"; + reg = <0x4d00000 0x2e00000>; + read-only; + }; + + ubiconcat2: partition@7b00000 { + label = "Ftool"; + reg = <0x7b00000 0x100000>; + }; + + ubiconcat3: partition@7c00000 { + label = "BCT"; + reg = <0x7c00000 0x380000>; + }; + + /* + * 512 KiB reserved for the Bad Blocks + * 0x8000000-0x7f80000=0x80000 + */ +}; + +&wlan_2g { + mac-address-increment = <1>; +}; diff --git a/target/linux/ramips/image/common-sercomm.mk b/target/linux/ramips/image/common-sercomm.mk index b743df440809f5..4060da092357ef 100644 --- a/target/linux/ramips/image/common-sercomm.mk +++ b/target/linux/ramips/image/common-sercomm.mk @@ -1,6 +1,12 @@ DEVICE_VARS += SERCOMM_KERNEL_OFFSET SERCOMM_ROOTFS_OFFSET DEVICE_VARS += SERCOMM_KERNEL2_OFFSET SERCOMM_ROOTFS2_OFFSET +define Build/sercomm-append-tail + printf 16 | dd seek=$$((0x90)) of=$@ bs=1 conv=notrunc 2>/dev/null + printf 11223344556677889900112233445566 | \ + sed 's/../\\x&/g' | xargs -d . printf >> $@ +endef + define Build/sercomm-crypto $(TOPDIR)/scripts/sercomm-crypto.py \ --input-file $@ \ @@ -32,6 +38,10 @@ define Build/sercomm-factory-cqr mv $@.fhdr $@ endef +define Build/sercomm-fix-buc-pid + printf 1 | dd seek=$$((0x13)) of=$@ bs=1 conv=notrunc 2>/dev/null +endef + define Build/sercomm-kernel $(TOPDIR)/scripts/sercomm-kernel-header.py \ --kernel-image $@ \ @@ -102,19 +112,28 @@ define Build/sercomm-prepend-tagged-kernel mv $(IMAGE_KERNEL).tagged $@ endef +define Build/sercomm-reset-slot1-chksum + printf "\xff\xff\xff\xff" | \ + dd of=$@ seek=$$((0x118)) bs=1 conv=notrunc 2>/dev/null +endef + define Device/sercomm $(Device/nand) LOADER_TYPE := bin + IMAGES += factory.img +endef + +define Device/sercomm_cxx_dxx + $(Device/sercomm) KERNEL_SIZE := 6144k KERNEL_LOADADDR := 0x81001000 LZMA_TEXT_START := 0x82800000 SERCOMM_KERNEL_OFFSET := 0x400100 SERCOMM_ROOTFS_OFFSET := 0x1000000 - IMAGES += factory.img endef define Device/sercomm_cxx - $(Device/sercomm) + $(Device/sercomm_cxx_dxx) SERCOMM_KERNEL2_OFFSET := 0xa00100 SERCOMM_ROOTFS2_OFFSET := 0x3000000 KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma -a0 | \ @@ -126,7 +145,7 @@ define Device/sercomm_cxx endef define Device/sercomm_dxx - $(Device/sercomm) + $(Device/sercomm_cxx_dxx) KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma -a0 | \ uImage lzma | sercomm-kernel KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | \ @@ -136,3 +155,17 @@ define Device/sercomm_dxx sercomm-part-tag rootfs | sercomm-prepend-tagged-kernel kernel | \ gzip | sercomm-payload | sercomm-crypto endef + +define Device/sercomm_s1500 + $(Device/sercomm) + SERCOMM_KERNEL_OFFSET := 0x1700100 + SERCOMM_ROOTFS_OFFSET := 0x1f00000 + SERCOMM_KERNEL2_OFFSET := 0x1b00100 + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma -a0 | \ + uImage lzma + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | \ + lzma -a0 | uImage lzma + IMAGE/sysupgrade.bin := append-kernel | sercomm-kernel | \ + sysupgrade-tar kernel=$$$$@ | append-metadata + DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 +endef diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index a5b69839a7b976..e426eac5b6efd3 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -398,6 +398,23 @@ define Device/beeline_smartbox-giga endef TARGET_DEVICES += beeline_smartbox-giga +define Device/beeline_smartbox-pro + $(Device/sercomm_s1500) + DEVICE_VENDOR := Beeline + DEVICE_MODEL := SmartBox PRO + DEVICE_ALT0_VENDOR := Sercomm + DEVICE_ALT0_MODEL := S1500 AWI + IMAGE_SIZE := 34816k + IMAGE/factory.img := append-kernel | sercomm-kernel-factory | \ + sercomm-reset-slot1-chksum | append-ubi | check-size | \ + sercomm-factory-cqr | sercomm-append-tail | sercomm-mkhash + SERCOMM_HWID := AWI + SERCOMM_HWVER := 10000 + SERCOMM_ROOTFS2_OFFSET := 0x3d00000 + SERCOMM_SWVER := 2020 +endef +TARGET_DEVICES += beeline_smartbox-pro + define Device/beeline_smartbox-turbo $(Device/sercomm_dxx) IMAGE_SIZE := 32768k @@ -2427,6 +2444,24 @@ define Device/wevo_w2914ns-v2 endef TARGET_DEVICES += wevo_w2914ns-v2 +define Device/wifire_s1500-nbn + $(Device/sercomm_s1500) + DEVICE_VENDOR := WiFire + DEVICE_MODEL := S1500.NBN + DEVICE_ALT0_VENDOR := Sercomm + DEVICE_ALT0_MODEL := S1500 BUC + IMAGE_SIZE := 51200k + IMAGE/factory.img := append-kernel | sercomm-kernel-factory | \ + sercomm-reset-slot1-chksum | append-ubi | check-size | \ + sercomm-factory-cqr | sercomm-fix-buc-pid | sercomm-mkhash | \ + sercomm-crypto + SERCOMM_HWID := BUC + SERCOMM_HWVER := 10000 + SERCOMM_ROOTFS2_OFFSET := 0x4d00000 + SERCOMM_SWVER := 2015 +endef +TARGET_DEVICES += wifire_s1500-nbn + define Device/winstars_ws-wn583a6 $(Device/dsa-migration) $(Device/uimage-lzma-loader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 9b15da0d22b636..1f91905bd84ee0 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -40,6 +40,14 @@ etisalat,s3|\ rostelecom,rt-sf-1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; +beeline,smartbox-pro|\ +wifire,s1500-nbn) + ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan3" "lan3" "green:lan3" "lan3" "link tx rx" + ucidef_set_led_netdev "lan4" "lan4" "green:lan4" "lan4" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" + ;; belkin,rt1800) ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index cef58ec3bad2b4..5d8305b788cce3 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -59,6 +59,7 @@ platform_do_upgrade() { asus,rt-ax54|\ beeline,smartbox-flash|\ beeline,smartbox-giga|\ + beeline,smartbox-pro|\ beeline,smartbox-turbo|\ beeline,smartbox-turbo-plus|\ belkin,rt1800|\ @@ -106,6 +107,7 @@ platform_do_upgrade() { sercomm,na502s|\ sim,simax1800t|\ tplink,ec330-g5u-v1|\ + wifire,s1500-nbn|\ xiaomi,mi-router-3g|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ From fbb4aac69bde73051f95d3ebc9a10a8feb8fdfd9 Mon Sep 17 00:00:00 2001 From: Joshua O'Leary Date: Wed, 7 Jun 2023 11:32:22 +0100 Subject: [PATCH 0239/1171] zbt-wd323: add GPIO WDT support Watchdog has not been properly configured for this router - the PCB has a hardware watchdog connected to one of the GPIO pin 21 [1] This commit provides this fix [2] Without this fix, the ZBT-WD323 is unusable in OpenWRT because it power cycles every 30 seconds due to the watchdog tripping [1] https://forum.openwrt.org/t/zbt-wd323-router-power-cycles-every-30-seconds/77535/7 [2] https://forum.openwrt.org/t/zbt-wd323-images-unusable-proposed-workaround/162145/5 Signed-off-by: Joshua O'Leary (cherry picked from commit 008cc836fe42577af2843730dfefd31b750c7de6) --- target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts b/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts index 8fc21be1dcb496..8dc1ceb666608c 100644 --- a/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts +++ b/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts @@ -59,6 +59,14 @@ gpios = <&gpio 22 GPIO_ACTIVE_LOW>; }; }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <30000>; + always-running; + }; }; &wdt { From 0d324c682cceb2576bbb2e31a6bf60f650f6794c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 27 Jun 2023 10:11:44 +0200 Subject: [PATCH 0240/1171] generic: filter out CONFIG_FRAME_WARN CONFIG_FRAME_WARN value is set by config/Config-kernel.in based on the target type dynamically since commit: 16a2051 ("kernel: Set CONFIG_FRAME_WARN depending on target"). However, CONFIG_FRAME_WARN was not set to get filtered out so it ended up in multiple target configs during refreshes. So, lets filter out CONFIG_FRAME_WARN as its set dynamically to prevent it ending up in more target configs. Signed-off-by: Robert Marko (cherry picked from commit 7a9a4168bb7f4b77c300afb99c163c793305e84f) --- target/linux/generic/config-filter | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-filter b/target/linux/generic/config-filter index e7aa90f8b548f4..e7eda471d04838 100644 --- a/target/linux/generic/config-filter +++ b/target/linux/generic/config-filter @@ -5,6 +5,7 @@ # CONFIG_CC_(CAN|HAS|IS|VERSION)_.* is not set CONFIG_CLANG_VERSION=.* # CONFIG_GCC_VERSION is not set +CONFIG_FRAME_WARN=.* # CONFIG_HAVE_(?!(ARCH_TIMER|TCM|SMP)).* is not set # CONFIG_INLINE_.* is not set # CONFIG_LD_.* is not set From c54ec81c999e2de23d6a368b5f69dee68b24e9ff Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 27 Jun 2023 01:23:40 +0000 Subject: [PATCH 0241/1171] linux-firmware: ibt-firmware: install sfi/ddc files for AX210 card When using an Intel AX210 card, the Bluetooth hci interface failed to start due to a missing "ibt-0041-0041.sfi" file. Bluetooth: hci0: Failed to load Intel firmware file intel/ibt-0041-0041.sfi (-2) A device specific configuration file (DDC) is also required: Bluetooth: hci0: Found device firmware: intel/ibt-0041-0041.sfi Bluetooth: hci0: Waiting for firmware download to complete ... Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-0041-0041.ddc Bluetooth: hci0: Applying Intel DDC parameters completed Bluetooth: hci0: Firmware timestamp 2023.13 buildtype 1 build 62562 Fixes: #8558 Signed-off-by: Mathew McBride (cherry picked from commit fff6833d4c01205156f9431a111a51f96642b476) --- package/firmware/linux-firmware/Makefile | 2 +- package/firmware/linux-firmware/intel.mk | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index bed11fdbe1f559..63259cae36abd0 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware PKG_VERSION:=20230515 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 97694572b0bbce..23b58358b4eb7f 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -3,6 +3,8 @@ define Package/ibt-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/intel $(CP) \ $(PKG_BUILD_DIR)/intel/*.bseq \ + $(PKG_BUILD_DIR)/intel/ibt*.sfi \ + $(PKG_BUILD_DIR)/intel/ibt*.ddc \ $(1)/lib/firmware/intel endef $(eval $(call BuildPackage,ibt-firmware)) From f9fadb8de2b7322b6c8ac05402d9fd3a61335b9c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 1 Jul 2023 12:06:34 +0200 Subject: [PATCH 0242/1171] libnl-tiny: update to latest git HEAD d433990 Make struct nla_policy and struct nlattr const Signed-off-by: Hauke Mehrtens (cherry picked from commit 513bcfdf78d7ffbcf244da2e6910a3d04b17ae01) --- package/libs/libnl-tiny/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libnl-tiny/Makefile b/package/libs/libnl-tiny/Makefile index 7239c286fdd510..048c3e79397de9 100644 --- a/package/libs/libnl-tiny/Makefile +++ b/package/libs/libnl-tiny/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git -PKG_SOURCE_DATE:=2023-04-02 -PKG_SOURCE_VERSION:=11b7c5f0745af2637b48131287f28689bb80ed3e -PKG_MIRROR_HASH:=9bcae026ad1fde81865ea113d24bbc70c2bd1945655d51cd00181c41b70570d2 +PKG_SOURCE_DATE:=2023-07-01 +PKG_SOURCE_VERSION:=d433990c00e804593f253cc709b8fe901492b530 +PKG_MIRROR_HASH:=fffb2782c7ed2ebabc7d57e5513f52ac53d1828014bc9a8ea131f50eab093086 CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 From fa1822a8e9beb10f6a6de548b5fe7482b695a866 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 30 Jun 2023 19:30:09 +0200 Subject: [PATCH 0243/1171] mediatek: define NMBM management region for WAX220 The NETGEAR WAX220 employs NMBM on SPI-NAND. In order to avoid dealing with invalid factory data, enable NMBM in the area preceding the UBI volume. Signed-off-by: David Bauer (cherry picked from commit 92eec257dd562547bc08ee76c1901eb22b66937c) --- target/linux/mediatek/dts/mt7986b-netgear-wax220.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts index f7da6e3630b949..ac2a4b08246eca 100644 --- a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts +++ b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts @@ -186,6 +186,11 @@ spi-tx-buswidth = <4>; spi-rx-buswidth = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <256>; + mediatek,bmt-remap-range = <0x0 0x580000>; + partitions: partitions { #address-cells = <0x1>; #size-cells = <0x1>; From 2cece6e2b078e6acb97f3ed99ffc58f0f8fa2365 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 29 Jun 2023 16:13:33 +0200 Subject: [PATCH 0244/1171] firmware-utils: bump to git HEAD Add support for a number of new TP-Link devices. 9e2de8515be1 tplink-safeloader: add EAP610 v3 and EAP613 v1 bb12cf5c3fa9 tplink-safeloader: Add support for TP-Link Deco M5 a2d49fb1e188 tplink-safeloader: add RU support-list entry for Archer C6U v1 Signed-off-by: Sander Vanheule (cherry picked from commit 0cdcf0338290a83d7679005e80cf7f547860bfc5) --- tools/firmware-utils/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 0ef79f4c76e92a..72103411677531 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2023-05-18 -PKG_SOURCE_VERSION:=02cdbc6a4d61605c008efef09162f772f553fcde -PKG_MIRROR_HASH:=f5188fc38bb03ddbcc34763ff049597e2d8af98c0854910dc87f10e5927096e2 +PKG_SOURCE_DATE:=2023-06-29 +PKG_SOURCE_VERSION:=9e2de8515be15e2b61ae518ce592e5b446ef2d48 +PKG_MIRROR_HASH:=e43d1796dd482ec364e5196f224bb1563dbb0494f0f28fb4e206ef7ef31260fb include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From cd878b1b55b669e95237732f5780e0907e2bb222 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 24 Jun 2023 22:18:35 +0200 Subject: [PATCH 0245/1171] ramips: mt7621: add TP-Link EAP613 v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TP-Link EAP613 v1 is a ceiling-mount 802.11ax access point. It can be powered via PoE or a DC barrel connector (12V). Connecting to the UART requires fine soldering and careful manipulation of any soldered wires. Device details: * SoC: MT7621AT * Flash: 16 MiB SPI NOR * RAM: 256 MiB DDR3L * Wi-Fi: * MT7905DA + MT7975D: 2.4 GHz + 5 GHz (DBDC), 2x2:2 * Two stamped metal antennas (ANT1, ANT2) * One PCB antenna (ANT3) * One unpopulated antenna (ANT4) * Ethernet: * 1× 10/100/1000 Mbps port with PoE * LEDs: * Array of four blue LEDs with one control line * Buttons: * Reset * Board test points: * UART: next to CPU RF-shield and power circuits * JTAG: under CPU RF-shield (untested) * Watchdog: 3PEAK TPV706 (not implemented) Althought three antennas are populated, the MT7905DA does not support the additional Rx chain for background DFS detection (or Bluetooth) according to commit 6cbcc34f50a3 ("ramips: disable unsupported background radar detection"). MAC addresses: * LAN: 48:22:54:xx:xx:a2 (device label) * WLAN 2.4 GHz: 48:22:54:xx:xx:a2 * WLAN 5 GHz: 48:22:54:xx:xx:a3 The radio calibration blob stored in flash also contains valid MAC addresses for both radio bands (OUI 00:0c:43). Factory install: 1. Enable SSH on the device via web interface 2. Log in with SSH, and run `cliclientd stopcs` 3. Upload -factory.bin image via web interface. It may be necessary to shorten the filename of the image to e.g. 'factory.bin'. Recovery: 1. Open the device by unscrewing four screws from the backside 2. Carefully remove board from the housing 3. Connect to UART (3.3V): * Find test points labelled "VCC", "GND", "UART_TX", "UART_RX" * Solder wires to test points or connect otherwise. Be careful not to damage the PCB e.g. by pulling on soldered wires. * Open console with 115200n8 settings 4. Interrupt bootloader and use tftpboot to start an initramfs: setenv ipaddr $DEVICE_IP setenv serverip $SERVER_IP tftpboot 84000000 openwrt-initramfs-kernel.bin bootm DO NOT use saveenv to store modified u-boot environment variables. The environment is saved at flash offset 0x30000, which erases part of the (secondary) bootloader. The device uses two bootloader stages. The first stage will load the second stage from a uImage stored at flash offset 0x10000. In case of a damaged second stage, the first stage should allow uploading a new image via y-modem (untested). Signed-off-by: Sander Vanheule (cherry picked from commit 11588c52b47c2c3b2cdc7849ce9e4804bfdb8bb5) --- .../ramips/dts/mt7621_tplink_eap613-v1.dts | 151 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 13 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 1 + 4 files changed, 166 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts diff --git a/target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts b/target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts new file mode 100644 index 00000000000000..d25bf5756022e5 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "tplink,eap613-v1", "mediatek,mt7621-soc"; + model = "TP-Link EAP613 v1"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_status: status { + label = "blue:status"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "partition-table"; + reg = <0x80000 0x10000>; + read-only; + }; + + partition@90000 { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + label = "product-info"; + reg = <0x90000 0x10000>; + read-only; + + macaddr: macaddr@8 { + reg = <0x8 0x6>; + }; + }; + + partition@a0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0xa0000 0xcf0000>; + }; + + partition@d90000 { + label = "user-config"; + reg = <0xd90000 0x60000>; + read-only; + }; + + partition@f30000 { + label = "mutil-log"; + reg = <0xf30000 0x80000>; + read-only; + }; + + partition@fb0000 { + label = "oops"; + reg = <0xfb0000 0x40000>; + read-only; + }; + + radio: partition@ff0000 { + label = "radio"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "uart3"; + function = "gpio"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&radio 0x0>; + mediatek,disable-radar-background; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index e426eac5b6efd3..fa4c83dbe18db3 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2132,6 +2132,19 @@ define Device/tplink_eap235-wall-v1 endef TARGET_DEVICES += tplink_eap235-wall-v1 +define Device/tplink_eap613-v1 + $(Device/dsa-migration) + $(Device/tplink-safeloader) + DEVICE_MODEL := EAP613 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools + TPLINK_BOARD_ID := EAP610-V3 + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | pad-to 64k + KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd + IMAGE_SIZE := 13248k +endef +TARGET_DEVICES += tplink_eap613-v1 + define Device/tplink_eap615-wall-v1 $(Device/dsa-migration) $(Device/tplink-safeloader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index cd746e84eeae88..6057c171922e98 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -24,6 +24,7 @@ ramips_setup_interfaces() sercomm,na502|\ sercomm,na502s|\ thunder,timecloud|\ + tplink,eap613-v1|\ tplink,re350-v1|\ tplink,re500-v1|\ tplink,re650-v1|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 80c72735430017..3467e783f04826 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -158,6 +158,7 @@ case "$board" in hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress ;; + tplink,eap613-v1|\ tplink,eap615-wall-v1) hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)" macaddr_add "$hw_mac_addr" "$PHYNBR" > "/sys${DEVPATH}/macaddress" From a70d030fb33c246c3eb222beccbd69c427b3a66f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 4 Jul 2023 06:16:44 +0200 Subject: [PATCH 0246/1171] mt76: update to the latest version f704e4f83c6f mt76: mt7915: fix copy&paste issue on capability check rework Signed-off-by: Felix Fietkau (cherry picked from commit 816933bee6e6b68156f6aeea083117208bf859f8) --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 8551c941440266..0dfe7600df0094 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-06-30 -PKG_SOURCE_VERSION:=1377f586c6f520a6d032053a2e9c0ebc8b277e9b -PKG_MIRROR_HASH:=247d045d4cbc6907b9856432ee8028a0fd573bb3ffe3c42a3e366abfdb624259 +PKG_SOURCE_DATE:=2023-07-04 +PKG_SOURCE_VERSION:=f704e4f83c6fd21fb39046fa328efb51bee6383b +PKG_MIRROR_HASH:=651d2963a0d624943601dcad971e4942401274af81d39913c6d3d91be2f8d8b1 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 894b2086fdf91409980df99ffe6ab8808de0302d Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Tue, 4 Jul 2023 20:42:22 +0200 Subject: [PATCH 0247/1171] ipq-wifi: fix upstream board-2.bin ZTE M289F snafu The upstream board-2.bin file in the linux-firmware.git repository for the QCA4019 contains a packed board-2.bin for this device for both 2.4G and 5G wifis. This isn't something that the ath10k driver supports. Until this feature either gets implemented - which is very unlikely -, or the upstream boardfile is mended (both, the original submitter and ath10k-firmware custodian have been notified). OpenWrt will go back and use its own bespoke boardfile. This unfortunately means that 2.4G and on some revisions the 5G WiFi is not available in the initramfs image for this device. Fixes: #12886 Reported-by: Christian Heuff Debugged-by: Georgios Kourachanis Signed-off-by: Christian Lamparter (cherry picked from commit 75505c5ec724b9b961dcb411bac1d4b9aede3e1d) --- package/firmware/ipq-wifi/Makefile | 4 +++- target/linux/ipq40xx/image/generic.mk | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index faee191c349e1f..8936a1dd60a55f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/version.mk PKG_NAME:=ipq-wifi -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git @@ -40,6 +40,7 @@ ALLWIFIBOARDS:= \ wallys_dr40x9 \ xiaomi_ax3600 \ xiaomi_ax9000 \ + zte_mf289f \ zte_mf287plus \ zyxel_nbg7815 @@ -127,6 +128,7 @@ $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) +$(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F)) $(eval $(call generate-ipq-wifi-package,zte_mf287plus,ZTE MF287Plus)) $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815)) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index b9e9e478d9f470..f15463ae8ca5e6 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1169,7 +1169,7 @@ TARGET_DEVICES += zte_mf287plus define Device/zte_mf289f $(call Device/zte_mf28x_common) DEVICE_MODEL := MF289F - DEVICE_PACKAGES += ath10k-firmware-qca9984-ct + DEVICE_PACKAGES += ipq-wifi-zte_mf289f ath10k-firmware-qca9984-ct endef TARGET_DEVICES += zte_mf289f From 4a79a94e37a5b451ef4f9cb1f68917ef0ebd2cf2 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sun, 29 Jan 2023 18:26:10 +0100 Subject: [PATCH 0248/1171] mxs: rework image generation Migrate to "new" image generation method. Device profiles will be generated based on image/Makefile instead of profiles/ , which will also allow to automatically build images for all supported devices via buildbot. Signed-off-by: Zoltan HERPAI --- package/boot/uboot-mxs/Makefile | 12 +- target/linux/mxs/image/Config.in | 4 +- target/linux/mxs/image/Makefile | 103 +++++++++--------- target/linux/mxs/profiles/01-duckbill.mk | 17 --- .../linux/mxs/profiles/02-olinuxino-maxi.mk | 16 --- .../linux/mxs/profiles/03-olinuxino-micro.mk | 16 --- 6 files changed, 65 insertions(+), 103 deletions(-) delete mode 100644 target/linux/mxs/profiles/01-duckbill.mk delete mode 100644 target/linux/mxs/profiles/02-olinuxino-maxi.mk delete mode 100644 target/linux/mxs/profiles/03-olinuxino-micro.mk diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile index 6ae767f67739e7..afd73e191b1277 100644 --- a/package/boot/uboot-mxs/Makefile +++ b/package/boot/uboot-mxs/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_VERSION:=2020.04 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372 @@ -27,10 +27,12 @@ endef define U-Boot/mx23_olinuxino NAME:=Olinuxino i.MX233 + BUILD_DEVICES:=olinuxino_maxi olinuxino_micro endef define U-Boot/duckbill NAME:=I2SE Duckbill + BUILD_DEVICES:=i2se_duckbill endef UBOOT_TARGETS := \ @@ -40,8 +42,12 @@ UBOOT_TARGETS := \ UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE) define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) + $(foreach device,$(BUILD_DEVICES), \ + $(INSTALL_DIR) $(STAGING_DIR_IMAGE)/$(device) + ) + $(foreach device,$(BUILD_DEVICES), \ + $(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(STAGING_DIR_IMAGE)/$(device)/ + ) endef $(eval $(call BuildPackage/U-Boot)) diff --git a/target/linux/mxs/image/Config.in b/target/linux/mxs/image/Config.in index a04700a440b72d..b4318390c24318 100644 --- a/target/linux/mxs/image/Config.in +++ b/target/linux/mxs/image/Config.in @@ -1,6 +1,6 @@ -config TARGET_BOOTFS_PARTSIZE +config MXS_SD_BOOT_PARTSIZE int "Boot (SD Card) filesystem partition size (in MB)" - depends on TARGET_mxs_generic_olinuxino-maxi || TARGET_mxs_generic_olinuxino-micro + depends on TARGET_mxs default 8 help On the Olimex OLinuXino boards, mainline U-Boot loads the diff --git a/target/linux/mxs/image/Makefile b/target/linux/mxs/image/Makefile index bcb6001bac26ab..f1847dec1eda0a 100644 --- a/target/linux/mxs/image/Makefile +++ b/target/linux/mxs/image/Makefile @@ -5,72 +5,77 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -BOARDS:= \ - imx23-olinuxino \ - imx28-duckbill - FAT32_BLOCK_SIZE=1024 -FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_BOOTFS_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) +FAT32_BLOCKS=$(shell echo $$(($(CONFIG_MXS_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) -define Image/BuildKernel - mkimage -A arm -O linux -T kernel -C none \ - -a 0x40008000 -e 0x40008000 \ - -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(KDIR)/zImage $(KDIR)/uImage - cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage -endef +KERNEL_LOADADDR:=0x40008000 -define Image/InstallKernel - mkdir -p $(TARGET_DIR)/boot - cp \ - $(KDIR)/zImage $(KDIR)/uImage \ - $(foreach board,$(BOARDS),$(DTS_DIR)/$(board).dtb) \ - $(TARGET_DIR)/boot/ +define Build/mxs-sdcard-ext4-ext4 + ./gen_sdcard_ext4_ext4.sh \ + $@ \ + $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/u-boot.sb \ + $(IMAGE_ROOTFS) \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) endef -define Image/Build/SDCard-vfat-ext4 - rm -f $(KDIR)/boot.img - mkfs.fat $(KDIR)/boot.img -C $(FAT32_BLOCKS) +define Build/mxs-sdcard-vfat-ext4 + rm -f $@.boot + mkfs.fat $@.boot -C $(FAT32_BLOCKS) - mcopy -i $(KDIR)/boot.img $(DTS_DIR)/$(3).dtb ::$(3).dtb - mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage + mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::$(DEVICE_DTS).dtb + mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage ./gen_sdcard_vfat_ext4.sh \ - $(BIN_DIR)/$(2) \ - $(STAGING_DIR_IMAGE)/$(4)-u-boot.sb \ - $(KDIR)/boot.img \ - $(KDIR)/root.$(1) \ - $(CONFIG_TARGET_BOOTFS_PARTSIZE) \ - $(CONFIG_TARGET_ROOTFS_PARTSIZE) - $(call Image/Gzip,$(BIN_DIR)/$(2)) -endef - -define Image/Build/SDCard-ext4-ext4 - ./gen_sdcard_ext4_ext4.sh \ - $(BIN_DIR)/$(2) \ - $(STAGING_DIR_IMAGE)/$(4)-u-boot.sb \ - $(KDIR)/root.$(1) \ + $@ \ + $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/u-boot.sb \ + $@.boot \ + $(IMAGE_ROOTFS) \ + $(CONFIG_MXS_SD_BOOT_PARTSIZE) \ $(CONFIG_TARGET_ROOTFS_PARTSIZE) - $(call Image/Gzip,$(BIN_DIR)/$(2)) endef -define Image/Build/Profile/olinuxino-maxi - $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino) +define Device/Default + PROFILES := Default + KERNEL_NAME := zImage + KERNEL := kernel-bin | uImage none + IMAGES := sdcard.img.gz + DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1))) endef -define Image/Build/Profile/olinuxino-micro - $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino) +define Device/i2se_duckbill + DEVICE_VENDOR := I2SE + DEVICE_MODEL := Duckbill + DEVICE_PACKAGES := -dnsmasq -firewall -ppp -ip6tables -iptables -6relayd -mtd \ + uboot-envtools kmod-leds-gpio -kmod-ipt-nathelper + SUPPORTED_DEVICES:=i2se,duckbill + SOC:=imx28 + DEVICE_DTS:=imx28-duckbill + IMAGE/sdcard.img.gz = mxs-sdcard-ext4-ext4 | append-metadata | gzip endef +TARGET_DEVICES += i2se_duckbill -define Image/Build/Profile/duckbill - $(call Image/Build/SDCard-ext4-ext4,$(1),$(2),imx28-duckbill,duckbill) +define Device/olinuxino_maxi + DEVICE_VENDOR := Olimex + DEVICE_MODEL := OLinuXino Maxi + DEVICE_PACKAGES := kmod-usb-net-smsc95xx kmod-pinctrl-mcp23s08-i2c \ + kmod-pinctrl-mcp23s08-spi kmod-leds-gpio kmod-sound-core + SUPPORTED_DEVICES:=olimex,imx23-olinuxino + SOC:=imx23 + DEVICE_DTS:=imx23-olinuxino + IMAGE/sdcard.img.gz = mxs-sdcard-vfat-ext4 | append-metadata | gzip endef +TARGET_DEVICES += olinuxino_maxi -define Image/Build - $(call Image/Build/$(1),$(1)) - $(call Image/Build/Profile/$(PROFILE),$(1),$(IMG_PREFIX)-$(PROFILE)-sdcard.img) - dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync - $(call Image/Gzip,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)) +define Device/olinuxino_micro + DEVICE_VENDOR := Olimex + DEVICE_MODEL := OLinuXino Micro + DEVICE_PACKAGES := kmod-pinctrl-mcp23s08-spi kmod-pinctrl-mcp23s08-i2c \ + kmod-leds-gpio + SUPPORTED_DEVICES:=olimex,imx23-olinuxino + SOC:=imx23 + DEVICE_DTS:=imx23-olinuxino + IMAGE/sdcard.img.gz = mxs-sdcard-vfat-ext4 | append-metadata | gzip endef +TARGET_DEVICES += olinuxino_micro $(eval $(call BuildImage)) diff --git a/target/linux/mxs/profiles/01-duckbill.mk b/target/linux/mxs/profiles/01-duckbill.mk deleted file mode 100644 index d7202a44226e31..00000000000000 --- a/target/linux/mxs/profiles/01-duckbill.mk +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2013 OpenWrt.org - -define Profile/duckbill - NAME:=I2SE Duckbill boards - FEATURES+=usbgadget - PACKAGES+= \ - -dnsmasq -firewall -ppp -ip6tables -iptables -6relayd -mtd uboot-envtools \ - kmod-leds-gpio -kmod-ipt-nathelper uboot-mxs-duckbill -endef - -define Profile/duckbill/Description - I2SE's Duckbill devices -endef - -$(eval $(call Profile,duckbill)) diff --git a/target/linux/mxs/profiles/02-olinuxino-maxi.mk b/target/linux/mxs/profiles/02-olinuxino-maxi.mk deleted file mode 100644 index dd333629b8d66b..00000000000000 --- a/target/linux/mxs/profiles/02-olinuxino-maxi.mk +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2013 OpenWrt.org - -define Profile/olinuxino-maxi - NAME:=Olimex OLinuXino Maxi/Mini boards - PACKAGES += imx-bootlets uboot-mxs-mx23_olinuxino \ - kmod-usb-net-smsc95xx kmod-pinctrl-mcp23s08-i2c \ - kmod-pinctrl-mcp23s08-spi kmod-leds-gpio kmod-sound-core -endef - -define Profile/olinuxino-maxi/Description - Olimex OLinuXino Maxi/Mini boards -endef - -$(eval $(call Profile,olinuxino-maxi)) diff --git a/target/linux/mxs/profiles/03-olinuxino-micro.mk b/target/linux/mxs/profiles/03-olinuxino-micro.mk deleted file mode 100644 index 8413ebbdca0250..00000000000000 --- a/target/linux/mxs/profiles/03-olinuxino-micro.mk +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2013 OpenWrt.org - -define Profile/olinuxino-micro - NAME:=Olimex OLinuXino Micro/Nano boards - PACKAGES += imx-bootlets uboot-mxs-mx23_olinuxino \ - kmod-pinctrl-mcp23s08-spi kmod-pinctrl-mcp23s08-i2c \ - kmod-leds-gpio -endef - -define Profile/olinuxino-micro/Description - Olimex OLinuXino Micro/Nano boards -endef - -$(eval $(call Profile,olinuxino-micro)) From e4d7917be6beccaf272d14e109cc26ac6d0f5e73 Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 3 Jul 2023 05:25:56 -0400 Subject: [PATCH 0249/1171] x86: set CONFIG_X86_AMD_PLATFORM_DEVICE Needed by AMD processors using Carrizo and later chipsets Signed-off-by: John Audia (cherry picked from commit 946100ba4128dbee8faf3c03afb692bca74d75fa) --- target/linux/x86/64/config-5.15 | 2 +- target/linux/x86/generic/config-5.15 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index d972668e543fbc..d1ada5c2f5e93a 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -478,7 +478,7 @@ CONFIG_X86_64_SMP=y CONFIG_X86_ACPI_CPUFREQ=y # CONFIG_X86_ACPI_CPUFREQ_CPB is not set CONFIG_X86_AMD_FREQ_SENSITIVITY=y -# CONFIG_X86_AMD_PLATFORM_DEVICE is not set +CONFIG_X86_AMD_PLATFORM_DEVICE=y CONFIG_X86_CPUID=y CONFIG_X86_DIRECT_GBPAGES=y CONFIG_X86_HV_CALLBACK_VECTOR=y diff --git a/target/linux/x86/generic/config-5.15 b/target/linux/x86/generic/config-5.15 index 1da6ad555dae0d..5fda82dd296d10 100644 --- a/target/linux/x86/generic/config-5.15 +++ b/target/linux/x86/generic/config-5.15 @@ -415,7 +415,7 @@ CONFIG_X86_32_SMP=y CONFIG_X86_ACPI_CPUFREQ=y # CONFIG_X86_ACPI_CPUFREQ_CPB is not set CONFIG_X86_AMD_FREQ_SENSITIVITY=y -# CONFIG_X86_AMD_PLATFORM_DEVICE is not set +CONFIG_X86_AMD_PLATFORM_DEVICE=y # CONFIG_X86_BIGSMP is not set CONFIG_X86_CPUID=y # CONFIG_X86_E_POWERSAVER is not set From 27f68a39fdd17e0182e16547f8e3443e839ce8bf Mon Sep 17 00:00:00 2001 From: John Thomson Date: Sat, 1 Jul 2023 10:23:35 +1000 Subject: [PATCH 0250/1171] kernel: fix KernelPackage when all KCONFIG are versioned If a kernel package was defined where all KCONFIG symbols were dynamic, and versioned, no FILES would be installed, as the foreach evaluation was providing the value of the variable defined by the KCONFIG symbol name including the version test Fix this by calling the version_filter function on the list of KCONFIG variable names run through by foreach Example, kernel 6.1: KCONFIG:=CONFIG_OLD@lt6.1 CONFIG_NEW@ge6.1 filter-out any KCONFIG settings forced by package: CONFIG_OLD@lt6.1 CONFIG_NEW@ge6.1 there are dynamic settings, so for each of them, get the value of the make variable defined by symbol name: CONFIG_OLD@lt6.1 is not set CONFIG_NEW@ge6.1 is not set versus CONFIG_OLD is not set CONFIG_NEW=m test if any of these are m, or y if yes, install files, otherwise, nothing to install Signed-off-by: John Thomson (cherry picked from commit b3448b3fdb59d25dce05991dc8f322c1020b090b) --- include/kernel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel.mk b/include/kernel.mk index b1ae42534dc434..3012eb899352e2 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -236,7 +236,7 @@ $(call KernelPackage/$(1)/config) $(call KernelPackage/depends) $(call KernelPackage/hooks) - ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),) + ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(call version_filter,$(filter-out %=y %=n %=m,$(KCONFIG))),$($(c)))),.),) define Package/kmod-$(1)/install @for mod in $$(call version_filter,$$(FILES)); do \ if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \ From f2a98977c48881b0fce96a899816880154521fb6 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 2 Apr 2023 23:32:11 +0200 Subject: [PATCH 0251/1171] wolfssl: update to 5.6.3 Release Notes: - https://github.com/wolfSSL/wolfssl/releases/tag/v5.6.0-stable - https://github.com/wolfSSL/wolfssl/releases/tag/v5.6.2-stable - https://github.com/wolfSSL/wolfssl/releases/tag/v5.6.3-stable Refresh patch: - 100-disable-hardening-check.patch Backport patch: - 001-fix-detection-of-cut-tool-in-configure.ac.patch Signed-off-by: Nick Hainke (cherry picked from commit 0e83b5e6cc8e2970905a2b32c990fa7491ff733c) --- package/libs/wolfssl/Makefile | 6 ++--- ...etection-of-cut-tool-in-configure.ac.patch | 25 +++++++++++++++++++ .../patches/100-disable-hardening-check.patch | 6 ++--- 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index d9426d75fc303d..ae802e210e7ca2 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=5.5.4-stable -PKG_RELEASE:=4 +PKG_VERSION:=5.6.3-stable +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) -PKG_HASH:=b7ee150e49def77c765bc02aac92ddeb0bebefd4cb12aa263d8f95e405221fb8 +PKG_HASH:=2e74a397fa797c2902d7467d500de904907666afb4ff80f6464f6efd5afb114a PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 diff --git a/package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch b/package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch new file mode 100644 index 00000000000000..0d0c8b54236ee1 --- /dev/null +++ b/package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch @@ -0,0 +1,25 @@ +From 41d248461bd9ad44193a4806ecb5361513e8944e Mon Sep 17 00:00:00 2001 +From: jordan +Date: Tue, 27 Jun 2023 13:18:25 -0500 +Subject: [PATCH] fix detection of cut tool in configure.ac + +--- + configure.ac | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -8723,10 +8723,11 @@ echo "extern \"C\" {" >> $OPTION_FILE + echo "#endif" >> $OPTION_FILE + echo "" >> $OPTION_FILE + +-# check for supported command to trim option with ++# Check for supported command to trim option with. ++# note: cut requires an argument to exit with success. + if colrm >/dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 Date: Wed, 5 Jul 2023 16:54:48 -0400 Subject: [PATCH 0252/1171] kernel: bump 5.15 to 5.15.120 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia (cherry picked from commit 0dc0504fc8e5f0c3cafe6c1da7192f51a09c5bc3) --- include/kernel-5.15 | 4 ++-- .../020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch | 2 +- .../020-v6.1-05-mm-multi-gen-LRU-groundwork.patch | 4 ++-- .../backport-5.15/020-v6.3-19-mm-add-vma_has_recency.patch | 2 +- ...thermal-drivers-mtk-use-function-pointer-for-raw_to_.patch | 2 +- ...2-thermal-mediatek-add-support-for-MT7986-and-MT7981.patch | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index ac48a2e8b117a4..bf681e2edbe858 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .119 -LINUX_KERNEL_HASH-5.15.119 = 7aa5a0fd3520947e5599e811d28acdc30e36446c016c7dcee3793e6d1cbecfcf +LINUX_VERSION-5.15 = .120 +LINUX_KERNEL_HASH-5.15.120 = 6499089eae6b271063cb3e873ab7f4ba0543cfb21dcc9c54d9bcf5357db683f6 diff --git a/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch b/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch index df854ffd3d81a5..73acadd804c0bf 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch @@ -414,7 +414,7 @@ Signed-off-by: Andrew Morton #ifndef arch_wants_old_prefaulted_pte static inline bool arch_wants_old_prefaulted_pte(void) { -@@ -2782,7 +2770,7 @@ static inline bool cow_user_page(struct +@@ -2791,7 +2779,7 @@ static inline int cow_user_page(struct p * On architectures with software "accessed" bits, we would * take a double page fault, so mark it accessed here. */ diff --git a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch index 237bd84875dbc2..25457926a48973 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch @@ -612,7 +612,7 @@ Signed-off-by: Andrew Morton mem_cgroup_id_remove(memcg); --- a/mm/memory.c +++ b/mm/memory.c -@@ -4792,6 +4792,27 @@ static inline void mm_account_fault(stru +@@ -4805,6 +4805,27 @@ static inline void mm_account_fault(stru perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); } @@ -640,7 +640,7 @@ Signed-off-by: Andrew Morton /* * By the time we get here, we already hold the mm semaphore * -@@ -4823,11 +4844,15 @@ vm_fault_t handle_mm_fault(struct vm_are +@@ -4836,11 +4857,15 @@ vm_fault_t handle_mm_fault(struct vm_are if (flags & FAULT_FLAG_USER) mem_cgroup_enter_user_fault(); diff --git a/target/linux/generic/backport-5.15/020-v6.3-19-mm-add-vma_has_recency.patch b/target/linux/generic/backport-5.15/020-v6.3-19-mm-add-vma_has_recency.patch index d740c5bd1d5183..0e9ed9a7eb2d05 100644 --- a/target/linux/generic/backport-5.15/020-v6.3-19-mm-add-vma_has_recency.patch +++ b/target/linux/generic/backport-5.15/020-v6.3-19-mm-add-vma_has_recency.patch @@ -92,7 +92,7 @@ Signed-off-by: Andrew Morton mark_page_accessed(page); } rss[mm_counter(page)]--; -@@ -4795,8 +4795,8 @@ static inline void mm_account_fault(stru +@@ -4808,8 +4808,8 @@ static inline void mm_account_fault(stru #ifdef CONFIG_LRU_GEN static void lru_gen_enter_fault(struct vm_area_struct *vma) { diff --git a/target/linux/mediatek/patches-5.15/805-v6.2-thermal-drivers-mtk-use-function-pointer-for-raw_to_.patch b/target/linux/mediatek/patches-5.15/805-v6.2-thermal-drivers-mtk-use-function-pointer-for-raw_to_.patch index b142b22eb8d3cf..c58ae96403ad7d 100644 --- a/target/linux/mediatek/patches-5.15/805-v6.2-thermal-drivers-mtk-use-function-pointer-for-raw_to_.patch +++ b/target/linux/mediatek/patches-5.15/805-v6.2-thermal-drivers-mtk-use-function-pointer-for-raw_to_.patch @@ -42,7 +42,7 @@ Signed-off-by: Daniel Golle /* * The first read of a sensor often contains very high bogus -@@ -1085,6 +1083,11 @@ static int mtk_thermal_probe(struct plat +@@ -1075,6 +1073,11 @@ static int mtk_thermal_probe(struct plat mtk_thermal_release_periodic_ts(mt, auxadc_base); } diff --git a/target/linux/mediatek/patches-5.15/806-v6.2-thermal-mediatek-add-support-for-MT7986-and-MT7981.patch b/target/linux/mediatek/patches-5.15/806-v6.2-thermal-mediatek-add-support-for-MT7986-and-MT7981.patch index 3ac2e7fc28cb14..65311d5718d9f9 100644 --- a/target/linux/mediatek/patches-5.15/806-v6.2-thermal-mediatek-add-support-for-MT7986-and-MT7981.patch +++ b/target/linux/mediatek/patches-5.15/806-v6.2-thermal-mediatek-add-support-for-MT7986-and-MT7981.patch @@ -210,7 +210,7 @@ Signed-off-by: Daniel Golle .compatible = "mediatek,mt8183-thermal", .data = (void *)&mt8183_thermal_data, }, { -@@ -1078,15 +1196,24 @@ static int mtk_thermal_probe(struct plat +@@ -1068,15 +1186,24 @@ static int mtk_thermal_probe(struct plat goto err_disable_clk_auxadc; } From ac2d6cf573ef781c3a61ebe2f979b9ef97c33955 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Mon, 22 May 2023 23:27:52 +0200 Subject: [PATCH 0253/1171] kernel: sort generic configuration This was done by executing these commands: $ ./scripts/kconfig.pl '+' target/linux/generic/config-5.15 /dev/null > target/linux/generic/config-5.15-new $ mv target/linux/generic/config-5.15-new target/linux/generic/config-5.15 $ ./scripts/kconfig.pl '+' target/linux/generic/config-6.1 /dev/null > target/linux/generic/config-6.1-new $ mv target/linux/generic/config-6.1-new target/linux/generic/config-6.1 Signed-off-by: Aleksander Jan Bajkowski (cherry picked from commit 4f197f91342bc5e1f202c091c2c2f90e949d0749) --- target/linux/generic/config-5.15 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 2e9ad886066b33..637b845ac4fdfd 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -7262,7 +7262,6 @@ CONFIG_VHOST_MENU=y # CONFIG_VIDEO_HEXIUM_ORION is not set # CONFIG_VIDEO_HI556 is not set # CONFIG_VIDEO_I2C is not set -# CONFIG_VIDEO_IMX_PXP is not set # CONFIG_VIDEO_IMX208 is not set # CONFIG_VIDEO_IMX214 is not set # CONFIG_VIDEO_IMX219 is not set @@ -7276,6 +7275,7 @@ CONFIG_VHOST_MENU=y # CONFIG_VIDEO_IMX412 is not set # CONFIG_VIDEO_IMX477 is not set # CONFIG_VIDEO_IMX8_JPEG is not set +# CONFIG_VIDEO_IMX_PXP is not set # CONFIG_VIDEO_IRS1125 is not set # CONFIG_VIDEO_IR_I2C is not set # CONFIG_VIDEO_IVTV is not set From c49654f4f0c217959542a1093e052851a3909119 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 30 Jun 2023 14:46:19 +0200 Subject: [PATCH 0254/1171] ramips/mt7621: disable the cpufreq driver It causes a noticeable performance decrease Signed-off-by: Felix Fietkau (cherry picked from commit dc38199b96ee3ef0ac52873893c42e28fa0564fa) --- target/linux/ramips/mt7621/config-5.15 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/mt7621/config-5.15 b/target/linux/ramips/mt7621/config-5.15 index 1b4330c2d16648..b366dac723a591 100644 --- a/target/linux/ramips/mt7621/config-5.15 +++ b/target/linux/ramips/mt7621/config-5.15 @@ -3,7 +3,6 @@ CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 -CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y @@ -24,8 +23,6 @@ CONFIG_CPU_HAS_DIEI=y CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_RIXI=y CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_TEO=y CONFIG_CPU_LITTLE_ENDIAN=y CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set @@ -34,7 +31,6 @@ CONFIG_CPU_MIPSR2=y CONFIG_CPU_MIPSR2_IRQ_EI=y CONFIG_CPU_MIPSR2_IRQ_VI=y CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_PM=y CONFIG_CPU_R4K_CACHE_TLB=y CONFIG_CPU_RMAP=y CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y @@ -62,7 +58,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -136,9 +131,7 @@ CONFIG_MIPS_CM=y CONFIG_MIPS_CMDLINE_FROM_DTB=y CONFIG_MIPS_CPC=y CONFIG_MIPS_CPS=y -CONFIG_MIPS_CPS_CPUIDLE=y # CONFIG_MIPS_CPS_NS16550_BOOL is not set -CONFIG_MIPS_CPS_PM=y CONFIG_MIPS_CPU_SCACHE=y CONFIG_MIPS_EBPF_JIT=y CONFIG_MIPS_GIC=y @@ -206,12 +199,15 @@ CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y CONFIG_PADATA=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_POOL_STATS=y CONFIG_PCI=y CONFIG_PCIE_MT7621=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS_GENERIC=y CONFIG_PCI_DRIVERS_GENERIC=y +CONFIG_PCS_MTK_LYNXI=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y From f4e1f999617b0d968fcb9ff2e5a4e1171d8d5d9f Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Tue, 27 Jun 2023 09:57:53 +0200 Subject: [PATCH 0255/1171] kernel: net: phy: realtek: fix rtl822x_probe on unsupported devices Calling rtl822x_probe() on phy devices which uses the rtl822x_read_mmd() and rtl822x_write_mmd() functions makes no sense and the probe ends with an EOPNOTSUPP error. Signed-off-by: Martin Schiller (cherry picked from commit 5af7d47cd7fb936dc7d640e1ba63443152d0416a) --- ...-phy-realtek-introduce-rtl822x_probe.patch | 24 ++++--------------- ...tek-detect-early-version-of-RTL8221B.patch | 2 +- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/target/linux/generic/pending-5.15/729-net-phy-realtek-introduce-rtl822x_probe.patch b/target/linux/generic/pending-5.15/729-net-phy-realtek-introduce-rtl822x_probe.patch index 87102d38187501..cea3511b8306f1 100644 --- a/target/linux/generic/pending-5.15/729-net-phy-realtek-introduce-rtl822x_probe.patch +++ b/target/linux/generic/pending-5.15/729-net-phy-realtek-introduce-rtl822x_probe.patch @@ -50,23 +50,7 @@ Signed-off-by: Daniel Golle static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); -@@ -1013,6 +1036,7 @@ static struct phy_driver realtek_drvs[] - .match_phy_device = rtl8226_match_phy_device, - .get_features = rtl822x_get_features, - .config_aneg = rtl822x_config_aneg, -+ .probe = rtl822x_probe, - .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, -@@ -1026,6 +1050,7 @@ static struct phy_driver realtek_drvs[] - .name = "RTL8226B_RTL8221B 2.5Gbps PHY", - .get_features = rtl822x_get_features, - .config_aneg = rtl822x_config_aneg, -+ .probe = rtl822x_probe, - .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, -@@ -1039,6 +1064,7 @@ static struct phy_driver realtek_drvs[] +@@ -1039,6 +1062,7 @@ static struct phy_driver realtek_drvs[] .name = "RTL8226-CG 2.5Gbps PHY", .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, @@ -74,7 +58,7 @@ Signed-off-by: Daniel Golle .read_status = rtl822x_read_status, .suspend = genphy_suspend, .resume = rtlgen_resume, -@@ -1050,6 +1076,7 @@ static struct phy_driver realtek_drvs[] +@@ -1050,6 +1074,7 @@ static struct phy_driver realtek_drvs[] .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, @@ -82,7 +66,7 @@ Signed-off-by: Daniel Golle .read_status = rtl822x_read_status, .suspend = genphy_suspend, .resume = rtlgen_resume, -@@ -1062,6 +1089,7 @@ static struct phy_driver realtek_drvs[] +@@ -1062,6 +1087,7 @@ static struct phy_driver realtek_drvs[] .get_features = rtl822x_get_features, .config_init = rtl8221b_config_init, .config_aneg = rtl822x_config_aneg, @@ -90,7 +74,7 @@ Signed-off-by: Daniel Golle .read_status = rtl822x_read_status, .suspend = genphy_suspend, .resume = rtlgen_resume, -@@ -1074,6 +1102,7 @@ static struct phy_driver realtek_drvs[] +@@ -1074,6 +1100,7 @@ static struct phy_driver realtek_drvs[] .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl8221b_config_init, diff --git a/target/linux/generic/pending-5.15/730-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-5.15/730-net-phy-realtek-detect-early-version-of-RTL8221B.patch index 6d414bfbade9b2..b1e7a35a556d6b 100644 --- a/target/linux/generic/pending-5.15/730-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-5.15/730-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle static int rtl822x_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; -@@ -1084,7 +1116,7 @@ static struct phy_driver realtek_drvs[] +@@ -1082,7 +1114,7 @@ static struct phy_driver realtek_drvs[] .write_page = rtl821x_write_page, .soft_reset = genphy_soft_reset, }, { From ef7d8003336544198b83b0b606b9bc0767183f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 16 Jun 2023 09:16:39 +0200 Subject: [PATCH 0256/1171] kernel: backport NVMEM patches queued for the v6.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes some driver changes and support for fixed cells layout. Signed-off-by: Rafał Miłecki (cherry picked from commit 07bdc5551558287f7a99f6ae8e6d82d7d09d5781) --- ...set-varaiable-imx_ocotp_layout-stora.patch | 31 +++ ...Reverse-MAC-addresses-on-all-i.MX-de.patch | 71 ++++++ ...ram-add-.read_post_process-for-MACs.patch} | 6 +- ...tp-Add-clks-and-reg_read-to-rockchip.patch | 166 +++++++++++++ ...tp-Generalize-rockchip_otp_wait_stat.patch | 62 +++++ ...tp-Use-devm_reset_control_array_get_.patch | 31 +++ ...hip-otp-Improve-probe-error-handling.patch | 71 ++++++ ...-rockchip-otp-Add-support-for-RK3588.patch | 129 ++++++++++ ...-Switch-xilinx.com-emails-to-amd.com.patch | 26 ++ ...-0010-nvmem-imx-support-i.MX93-OCOTP.patch | 230 ++++++++++++++++++ ...e-add-support-for-fixed-cells-layout.patch | 96 ++++++++ target/linux/imx/config-5.15 | 1 + target/linux/layerscape/armv7/config-5.15 | 1 + 13 files changed, 920 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0001-nvmem-imx-ocotp-set-varaiable-imx_ocotp_layout-stora.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0002-nvmem-imx-ocotp-Reverse-MAC-addresses-on-all-i.MX-de.patch rename target/linux/generic/backport-5.15/{813-v6.5-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch => 813-v6.5-0003-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch} (87%) create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0004-nvmem-rockchip-otp-Add-clks-and-reg_read-to-rockchip.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0005-nvmem-rockchip-otp-Generalize-rockchip_otp_wait_stat.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0006-nvmem-rockchip-otp-Use-devm_reset_control_array_get_.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0007-nvmem-rockchip-otp-Improve-probe-error-handling.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0008-nvmem-rockchip-otp-Add-support-for-RK3588.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0009-nvmem-zynqmp-Switch-xilinx.com-emails-to-amd.com.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0010-nvmem-imx-support-i.MX93-OCOTP.patch create mode 100644 target/linux/generic/backport-5.15/813-v6.5-0011-nvmem-core-add-support-for-fixed-cells-layout.patch diff --git a/target/linux/generic/backport-5.15/813-v6.5-0001-nvmem-imx-ocotp-set-varaiable-imx_ocotp_layout-stora.patch b/target/linux/generic/backport-5.15/813-v6.5-0001-nvmem-imx-ocotp-set-varaiable-imx_ocotp_layout-stora.patch new file mode 100644 index 00000000000000..38cfccd5ef9b29 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0001-nvmem-imx-ocotp-set-varaiable-imx_ocotp_layout-stora.patch @@ -0,0 +1,31 @@ +From eebc6573ad940b62a87776db3917e912b4f52d78 Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Sun, 11 Jun 2023 15:03:05 +0100 +Subject: [PATCH] nvmem: imx-ocotp: set varaiable imx_ocotp_layout + storage-class-specifier to static + +smatch reports +drivers/nvmem/imx-ocotp.c:599:21: warning: symbol + 'imx_ocotp_layout' was not declared. Should it be static? + +This variable is only used in one file so should be static. + +Signed-off-by: Tom Rix +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-2-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -596,7 +596,7 @@ static void imx_ocotp_fixup_cell_info(st + cell->read_post_process = imx_ocotp_cell_pp; + } + +-struct nvmem_layout imx_ocotp_layout = { ++static struct nvmem_layout imx_ocotp_layout = { + .fixup_cell_info = imx_ocotp_fixup_cell_info, + }; + diff --git a/target/linux/generic/backport-5.15/813-v6.5-0002-nvmem-imx-ocotp-Reverse-MAC-addresses-on-all-i.MX-de.patch b/target/linux/generic/backport-5.15/813-v6.5-0002-nvmem-imx-ocotp-Reverse-MAC-addresses-on-all-i.MX-de.patch new file mode 100644 index 00000000000000..7523e5ebf645a7 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0002-nvmem-imx-ocotp-Reverse-MAC-addresses-on-all-i.MX-de.patch @@ -0,0 +1,71 @@ +From 8a00fc606312c68b98add8fe8e6f7a013ce29e78 Mon Sep 17 00:00:00 2001 +From: Alexander Stein +Date: Sun, 11 Jun 2023 15:03:06 +0100 +Subject: [PATCH] nvmem: imx-ocotp: Reverse MAC addresses on all i.MX derivates + +Not just i.MX8M, but all i.MX6/7 (and subtypes) need to reverse the +MAC address read from fuses. Exceptions are i.MX6SLL and i.MX7ULP which +do not support ethernet at all. + +Fixes: d0221a780cbc ("nvmem: imx-ocotp: add support for post processing") +Signed-off-by: Alexander Stein +Tested-by: Richard Leitner # imx6q +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-3-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -97,7 +97,6 @@ struct ocotp_params { + unsigned int bank_address_words; + void (*set_timing)(struct ocotp_priv *priv); + struct ocotp_ctrl_reg ctrl; +- bool reverse_mac_address; + }; + + static int imx_ocotp_wait_for_busy(struct ocotp_priv *priv, u32 flags) +@@ -545,7 +544,6 @@ static const struct ocotp_params imx8mq_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, +- .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mm_params = { +@@ -553,7 +551,6 @@ static const struct ocotp_params imx8mm_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, +- .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mn_params = { +@@ -561,7 +558,6 @@ static const struct ocotp_params imx8mn_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, +- .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mp_params = { +@@ -569,7 +565,6 @@ static const struct ocotp_params imx8mp_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_8MP, +- .reverse_mac_address = true, + }; + + static const struct of_device_id imx_ocotp_dt_ids[] = { +@@ -624,8 +619,7 @@ static int imx_ocotp_probe(struct platfo + imx_ocotp_nvmem_config.size = 4 * priv->params->nregs; + imx_ocotp_nvmem_config.dev = dev; + imx_ocotp_nvmem_config.priv = priv; +- if (priv->params->reverse_mac_address) +- imx_ocotp_nvmem_config.layout = &imx_ocotp_layout; ++ imx_ocotp_nvmem_config.layout = &imx_ocotp_layout; + + priv->config = &imx_ocotp_nvmem_config; + diff --git a/target/linux/generic/backport-5.15/813-v6.5-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch b/target/linux/generic/backport-5.15/813-v6.5-0003-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch similarity index 87% rename from target/linux/generic/backport-5.15/813-v6.5-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch rename to target/linux/generic/backport-5.15/813-v6.5-0003-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch index 8749cad7f77033..fb4d346a95add1 100644 --- a/target/linux/generic/backport-5.15/813-v6.5-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch +++ b/target/linux/generic/backport-5.15/813-v6.5-0003-nvmem-brcm_nvram-add-.read_post_process-for-MACs.patch @@ -1,5 +1,6 @@ +From 73bcd133c910bff3b6d3b3834d0d14be9444e90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 6 Apr 2023 12:46:16 +0200 +Date: Sun, 11 Jun 2023 15:03:08 +0100 Subject: [PATCH] nvmem: brcm_nvram: add .read_post_process() for MACs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,6 +10,9 @@ Content-Transfer-Encoding: 8bit 2. Calculate relative addresses based on index argument Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-5-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/Kconfig | 1 + drivers/nvmem/brcm_nvram.c | 28 ++++++++++++++++++++++++++++ diff --git a/target/linux/generic/backport-5.15/813-v6.5-0004-nvmem-rockchip-otp-Add-clks-and-reg_read-to-rockchip.patch b/target/linux/generic/backport-5.15/813-v6.5-0004-nvmem-rockchip-otp-Add-clks-and-reg_read-to-rockchip.patch new file mode 100644 index 00000000000000..3b6e6e57f52b44 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0004-nvmem-rockchip-otp-Add-clks-and-reg_read-to-rockchip.patch @@ -0,0 +1,166 @@ +From 8dc61364164e79e44c07fa2ac0a7b6939f00d5db Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Sun, 11 Jun 2023 15:03:13 +0100 +Subject: [PATCH] nvmem: rockchip-otp: Add clks and reg_read to rockchip_data + +In preparation to support new Rockchip OTP memory devices with different +clock configurations and register layout, extend rockchip_data struct +with the related members: clks, num_clks, reg_read. + +Additionally, to avoid managing redundant driver data, drop num_clks +member from rockchip_otp struct and update all references to point to +the equivalent member in rockchip_data. + +Signed-off-by: Cristian Ciocaltea +Tested-by: Vincent Legoll +Reviewed-by: Heiko Stuebner +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-10-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rockchip-otp.c | 79 ++++++++++++++++++++++-------------- + 1 file changed, 49 insertions(+), 30 deletions(-) + +--- a/drivers/nvmem/rockchip-otp.c ++++ b/drivers/nvmem/rockchip-otp.c +@@ -54,21 +54,19 @@ + + #define OTPC_TIMEOUT 10000 + ++struct rockchip_data { ++ int size; ++ const char * const *clks; ++ int num_clks; ++ nvmem_reg_read_t reg_read; ++}; ++ + struct rockchip_otp { + struct device *dev; + void __iomem *base; +- struct clk_bulk_data *clks; +- int num_clks; ++ struct clk_bulk_data *clks; + struct reset_control *rst; +-}; +- +-/* list of required clocks */ +-static const char * const rockchip_otp_clocks[] = { +- "otp", "apb_pclk", "phy", +-}; +- +-struct rockchip_data { +- int size; ++ const struct rockchip_data *data; + }; + + static int rockchip_otp_reset(struct rockchip_otp *otp) +@@ -132,29 +130,23 @@ static int rockchip_otp_ecc_enable(struc + return ret; + } + +-static int rockchip_otp_read(void *context, unsigned int offset, +- void *val, size_t bytes) ++static int px30_otp_read(void *context, unsigned int offset, ++ void *val, size_t bytes) + { + struct rockchip_otp *otp = context; + u8 *buf = val; +- int ret = 0; +- +- ret = clk_bulk_prepare_enable(otp->num_clks, otp->clks); +- if (ret < 0) { +- dev_err(otp->dev, "failed to prepare/enable clks\n"); +- return ret; +- } ++ int ret; + + ret = rockchip_otp_reset(otp); + if (ret) { + dev_err(otp->dev, "failed to reset otp phy\n"); +- goto disable_clks; ++ return ret; + } + + ret = rockchip_otp_ecc_enable(otp, false); + if (ret < 0) { + dev_err(otp->dev, "rockchip_otp_ecc_enable err\n"); +- goto disable_clks; ++ return ret; + } + + writel(OTPC_USE_USER | OTPC_USE_USER_MASK, otp->base + OTPC_USER_CTRL); +@@ -174,8 +166,28 @@ static int rockchip_otp_read(void *conte + + read_end: + writel(0x0 | OTPC_USE_USER_MASK, otp->base + OTPC_USER_CTRL); +-disable_clks: +- clk_bulk_disable_unprepare(otp->num_clks, otp->clks); ++ ++ return ret; ++} ++ ++static int rockchip_otp_read(void *context, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ struct rockchip_otp *otp = context; ++ int ret; ++ ++ if (!otp->data || !otp->data->reg_read) ++ return -EINVAL; ++ ++ ret = clk_bulk_prepare_enable(otp->data->num_clks, otp->clks); ++ if (ret < 0) { ++ dev_err(otp->dev, "failed to prepare/enable clks\n"); ++ return ret; ++ } ++ ++ ret = otp->data->reg_read(context, offset, val, bytes); ++ ++ clk_bulk_disable_unprepare(otp->data->num_clks, otp->clks); + + return ret; + } +@@ -189,8 +201,15 @@ static struct nvmem_config otp_config = + .reg_read = rockchip_otp_read, + }; + ++static const char * const px30_otp_clocks[] = { ++ "otp", "apb_pclk", "phy", ++}; ++ + static const struct rockchip_data px30_data = { + .size = 0x40, ++ .clks = px30_otp_clocks, ++ .num_clks = ARRAY_SIZE(px30_otp_clocks), ++ .reg_read = px30_otp_read, + }; + + static const struct of_device_id rockchip_otp_match[] = { +@@ -225,21 +244,21 @@ static int rockchip_otp_probe(struct pla + if (!otp) + return -ENOMEM; + ++ otp->data = data; + otp->dev = dev; + otp->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(otp->base)) + return PTR_ERR(otp->base); + +- otp->num_clks = ARRAY_SIZE(rockchip_otp_clocks); +- otp->clks = devm_kcalloc(dev, otp->num_clks, +- sizeof(*otp->clks), GFP_KERNEL); ++ otp->clks = devm_kcalloc(dev, data->num_clks, sizeof(*otp->clks), ++ GFP_KERNEL); + if (!otp->clks) + return -ENOMEM; + +- for (i = 0; i < otp->num_clks; ++i) +- otp->clks[i].id = rockchip_otp_clocks[i]; ++ for (i = 0; i < data->num_clks; ++i) ++ otp->clks[i].id = data->clks[i]; + +- ret = devm_clk_bulk_get(dev, otp->num_clks, otp->clks); ++ ret = devm_clk_bulk_get(dev, data->num_clks, otp->clks); + if (ret) + return ret; + diff --git a/target/linux/generic/backport-5.15/813-v6.5-0005-nvmem-rockchip-otp-Generalize-rockchip_otp_wait_stat.patch b/target/linux/generic/backport-5.15/813-v6.5-0005-nvmem-rockchip-otp-Generalize-rockchip_otp_wait_stat.patch new file mode 100644 index 00000000000000..b5b66cfc5ac0d1 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0005-nvmem-rockchip-otp-Generalize-rockchip_otp_wait_stat.patch @@ -0,0 +1,62 @@ +From 30fd21cfb1e64ef20035559a8246f5fbf682c40e Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Sun, 11 Jun 2023 15:03:14 +0100 +Subject: [PATCH] nvmem: rockchip-otp: Generalize rockchip_otp_wait_status() + +In preparation to support additional Rockchip OTP memory devices with +different register layout, generalize rockchip_otp_wait_status() to +accept a new parameter for specifying the offset of the status register. + +Signed-off-by: Cristian Ciocaltea +Tested-by: Vincent Legoll +Reviewed-by: Heiko Stuebner +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-11-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rockchip-otp.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/rockchip-otp.c ++++ b/drivers/nvmem/rockchip-otp.c +@@ -90,18 +90,19 @@ static int rockchip_otp_reset(struct roc + return 0; + } + +-static int rockchip_otp_wait_status(struct rockchip_otp *otp, u32 flag) ++static int rockchip_otp_wait_status(struct rockchip_otp *otp, ++ unsigned int reg, u32 flag) + { + u32 status = 0; + int ret; + +- ret = readl_poll_timeout_atomic(otp->base + OTPC_INT_STATUS, status, ++ ret = readl_poll_timeout_atomic(otp->base + reg, status, + (status & flag), 1, OTPC_TIMEOUT); + if (ret) + return ret; + + /* clean int status */ +- writel(flag, otp->base + OTPC_INT_STATUS); ++ writel(flag, otp->base + reg); + + return 0; + } +@@ -123,7 +124,7 @@ static int rockchip_otp_ecc_enable(struc + + writel(SBPI_ENABLE_MASK | SBPI_ENABLE, otp->base + OTPC_SBPI_CTRL); + +- ret = rockchip_otp_wait_status(otp, OTPC_SBPI_DONE); ++ ret = rockchip_otp_wait_status(otp, OTPC_INT_STATUS, OTPC_SBPI_DONE); + if (ret < 0) + dev_err(otp->dev, "timeout during ecc_enable\n"); + +@@ -156,7 +157,7 @@ static int px30_otp_read(void *context, + otp->base + OTPC_USER_ADDR); + writel(OTPC_USER_FSM_ENABLE | OTPC_USER_FSM_ENABLE_MASK, + otp->base + OTPC_USER_ENABLE); +- ret = rockchip_otp_wait_status(otp, OTPC_USER_DONE); ++ ret = rockchip_otp_wait_status(otp, OTPC_INT_STATUS, OTPC_USER_DONE); + if (ret < 0) { + dev_err(otp->dev, "timeout during read setup\n"); + goto read_end; diff --git a/target/linux/generic/backport-5.15/813-v6.5-0006-nvmem-rockchip-otp-Use-devm_reset_control_array_get_.patch b/target/linux/generic/backport-5.15/813-v6.5-0006-nvmem-rockchip-otp-Use-devm_reset_control_array_get_.patch new file mode 100644 index 00000000000000..3a17479d959ba2 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0006-nvmem-rockchip-otp-Use-devm_reset_control_array_get_.patch @@ -0,0 +1,31 @@ +From d325c9dd2b6e94040ca722ddcadcd6af358dd2be Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Sun, 11 Jun 2023 15:03:15 +0100 +Subject: [PATCH] nvmem: rockchip-otp: Use + devm_reset_control_array_get_exclusive() + +In preparation to support new Rockchip OTP memory devices having +specific reset configurations, switch devm_reset_control_get() to +devm_reset_control_array_get_exclusive(). + +Signed-off-by: Cristian Ciocaltea +Tested-by: Vincent Legoll +Reviewed-by: Heiko Stuebner +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-12-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rockchip-otp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/rockchip-otp.c ++++ b/drivers/nvmem/rockchip-otp.c +@@ -263,7 +263,7 @@ static int rockchip_otp_probe(struct pla + if (ret) + return ret; + +- otp->rst = devm_reset_control_get(dev, "phy"); ++ otp->rst = devm_reset_control_array_get_exclusive(dev); + if (IS_ERR(otp->rst)) + return PTR_ERR(otp->rst); + diff --git a/target/linux/generic/backport-5.15/813-v6.5-0007-nvmem-rockchip-otp-Improve-probe-error-handling.patch b/target/linux/generic/backport-5.15/813-v6.5-0007-nvmem-rockchip-otp-Improve-probe-error-handling.patch new file mode 100644 index 00000000000000..37cb927b100220 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0007-nvmem-rockchip-otp-Improve-probe-error-handling.patch @@ -0,0 +1,71 @@ +From 912517345b867a69542dc9f5c2cc3e9d8beaccf5 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Sun, 11 Jun 2023 15:03:16 +0100 +Subject: [PATCH] nvmem: rockchip-otp: Improve probe error handling + +Enhance error handling in the probe function by making use of +dev_err_probe(), which ensures the error code is always printed, in +addition to the specified error message. + +Signed-off-by: Cristian Ciocaltea +Tested-by: Vincent Legoll +Reviewed-by: Heiko Stuebner +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-13-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rockchip-otp.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +--- a/drivers/nvmem/rockchip-otp.c ++++ b/drivers/nvmem/rockchip-otp.c +@@ -235,10 +235,8 @@ static int rockchip_otp_probe(struct pla + int ret, i; + + data = of_device_get_match_data(dev); +- if (!data) { +- dev_err(dev, "failed to get match data\n"); +- return -EINVAL; +- } ++ if (!data) ++ return dev_err_probe(dev, -EINVAL, "failed to get match data\n"); + + otp = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_otp), + GFP_KERNEL); +@@ -249,7 +247,8 @@ static int rockchip_otp_probe(struct pla + otp->dev = dev; + otp->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(otp->base)) +- return PTR_ERR(otp->base); ++ return dev_err_probe(dev, PTR_ERR(otp->base), ++ "failed to ioremap resource\n"); + + otp->clks = devm_kcalloc(dev, data->num_clks, sizeof(*otp->clks), + GFP_KERNEL); +@@ -261,18 +260,22 @@ static int rockchip_otp_probe(struct pla + + ret = devm_clk_bulk_get(dev, data->num_clks, otp->clks); + if (ret) +- return ret; ++ return dev_err_probe(dev, ret, "failed to get clocks\n"); + + otp->rst = devm_reset_control_array_get_exclusive(dev); + if (IS_ERR(otp->rst)) +- return PTR_ERR(otp->rst); ++ return dev_err_probe(dev, PTR_ERR(otp->rst), ++ "failed to get resets\n"); + + otp_config.size = data->size; + otp_config.priv = otp; + otp_config.dev = dev; +- nvmem = devm_nvmem_register(dev, &otp_config); + +- return PTR_ERR_OR_ZERO(nvmem); ++ nvmem = devm_nvmem_register(dev, &otp_config); ++ if (IS_ERR(nvmem)) ++ return dev_err_probe(dev, PTR_ERR(nvmem), ++ "failed to register nvmem device\n"); ++ return 0; + } + + static struct platform_driver rockchip_otp_driver = { diff --git a/target/linux/generic/backport-5.15/813-v6.5-0008-nvmem-rockchip-otp-Add-support-for-RK3588.patch b/target/linux/generic/backport-5.15/813-v6.5-0008-nvmem-rockchip-otp-Add-support-for-RK3588.patch new file mode 100644 index 00000000000000..c1e2231c9ec940 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0008-nvmem-rockchip-otp-Add-support-for-RK3588.patch @@ -0,0 +1,129 @@ +From 8ab099fafbbc8c9607c399d21a774784a6cb8b45 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Sun, 11 Jun 2023 15:03:17 +0100 +Subject: [PATCH] nvmem: rockchip-otp: Add support for RK3588 + +Add support for the OTP memory device found on the Rockchip RK3588 SoC. + +While here, remove the unnecessary 'void *' casts in the OF device ID +table. + +Co-developed-by: Finley Xiao +Signed-off-by: Finley Xiao +Signed-off-by: Cristian Ciocaltea +Tested-by: Vincent Legoll +Reviewed-by: Heiko Stuebner +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-14-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rockchip-otp.c | 78 +++++++++++++++++++++++++++++++++++- + 1 file changed, 76 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/rockchip-otp.c ++++ b/drivers/nvmem/rockchip-otp.c +@@ -54,6 +54,19 @@ + + #define OTPC_TIMEOUT 10000 + ++/* RK3588 Register */ ++#define RK3588_OTPC_AUTO_CTRL 0x04 ++#define RK3588_OTPC_AUTO_EN 0x08 ++#define RK3588_OTPC_INT_ST 0x84 ++#define RK3588_OTPC_DOUT0 0x20 ++#define RK3588_NO_SECURE_OFFSET 0x300 ++#define RK3588_NBYTES 4 ++#define RK3588_BURST_NUM 1 ++#define RK3588_BURST_SHIFT 8 ++#define RK3588_ADDR_SHIFT 16 ++#define RK3588_AUTO_EN BIT(0) ++#define RK3588_RD_DONE BIT(1) ++ + struct rockchip_data { + int size; + const char * const *clks; +@@ -171,6 +184,52 @@ read_end: + return ret; + } + ++static int rk3588_otp_read(void *context, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ struct rockchip_otp *otp = context; ++ unsigned int addr_start, addr_end, addr_len; ++ int ret, i = 0; ++ u32 data; ++ u8 *buf; ++ ++ addr_start = round_down(offset, RK3588_NBYTES) / RK3588_NBYTES; ++ addr_end = round_up(offset + bytes, RK3588_NBYTES) / RK3588_NBYTES; ++ addr_len = addr_end - addr_start; ++ addr_start += RK3588_NO_SECURE_OFFSET; ++ ++ buf = kzalloc(array_size(addr_len, RK3588_NBYTES), GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ while (addr_len--) { ++ writel((addr_start << RK3588_ADDR_SHIFT) | ++ (RK3588_BURST_NUM << RK3588_BURST_SHIFT), ++ otp->base + RK3588_OTPC_AUTO_CTRL); ++ writel(RK3588_AUTO_EN, otp->base + RK3588_OTPC_AUTO_EN); ++ ++ ret = rockchip_otp_wait_status(otp, RK3588_OTPC_INT_ST, ++ RK3588_RD_DONE); ++ if (ret < 0) { ++ dev_err(otp->dev, "timeout during read setup\n"); ++ goto read_end; ++ } ++ ++ data = readl(otp->base + RK3588_OTPC_DOUT0); ++ memcpy(&buf[i], &data, RK3588_NBYTES); ++ ++ i += RK3588_NBYTES; ++ addr_start++; ++ } ++ ++ memcpy(val, buf + offset % RK3588_NBYTES, bytes); ++ ++read_end: ++ kfree(buf); ++ ++ return ret; ++} ++ + static int rockchip_otp_read(void *context, unsigned int offset, + void *val, size_t bytes) + { +@@ -213,14 +272,29 @@ static const struct rockchip_data px30_d + .reg_read = px30_otp_read, + }; + ++static const char * const rk3588_otp_clocks[] = { ++ "otp", "apb_pclk", "phy", "arb", ++}; ++ ++static const struct rockchip_data rk3588_data = { ++ .size = 0x400, ++ .clks = rk3588_otp_clocks, ++ .num_clks = ARRAY_SIZE(rk3588_otp_clocks), ++ .reg_read = rk3588_otp_read, ++}; ++ + static const struct of_device_id rockchip_otp_match[] = { + { + .compatible = "rockchip,px30-otp", +- .data = (void *)&px30_data, ++ .data = &px30_data, + }, + { + .compatible = "rockchip,rk3308-otp", +- .data = (void *)&px30_data, ++ .data = &px30_data, ++ }, ++ { ++ .compatible = "rockchip,rk3588-otp", ++ .data = &rk3588_data, + }, + { /* sentinel */ }, + }; diff --git a/target/linux/generic/backport-5.15/813-v6.5-0009-nvmem-zynqmp-Switch-xilinx.com-emails-to-amd.com.patch b/target/linux/generic/backport-5.15/813-v6.5-0009-nvmem-zynqmp-Switch-xilinx.com-emails-to-amd.com.patch new file mode 100644 index 00000000000000..220e3e9a05f303 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0009-nvmem-zynqmp-Switch-xilinx.com-emails-to-amd.com.patch @@ -0,0 +1,26 @@ +From 9734408969e978a1c0d5d752be63dd638288e374 Mon Sep 17 00:00:00 2001 +From: Michal Simek +Date: Sun, 11 Jun 2023 15:03:23 +0100 +Subject: [PATCH] nvmem: zynqmp: Switch @xilinx.com emails to @amd.com + +@xilinx.com is still working but better to switch to new amd.com after +AMD/Xilinx acquisition. + +Signed-off-by: Michal Simek +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-20-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/zynqmp_nvmem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/zynqmp_nvmem.c ++++ b/drivers/nvmem/zynqmp_nvmem.c +@@ -76,6 +76,6 @@ static struct platform_driver zynqmp_nvm + + module_platform_driver(zynqmp_nvmem_driver); + +-MODULE_AUTHOR("Michal Simek , Nava kishore Manne "); ++MODULE_AUTHOR("Michal Simek , Nava kishore Manne "); + MODULE_DESCRIPTION("ZynqMP NVMEM driver"); + MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/813-v6.5-0010-nvmem-imx-support-i.MX93-OCOTP.patch b/target/linux/generic/backport-5.15/813-v6.5-0010-nvmem-imx-support-i.MX93-OCOTP.patch new file mode 100644 index 00000000000000..f8e6be4241604a --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0010-nvmem-imx-support-i.MX93-OCOTP.patch @@ -0,0 +1,230 @@ +From 22e9e6fcfb5042cb6d6c7874c459b034800092f1 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Sun, 11 Jun 2023 15:03:25 +0100 +Subject: [PATCH] nvmem: imx: support i.MX93 OCOTP + +Add i.MX93 OCOTP support. i.MX93 OCOTP has two parts: Fuse shadow +block(fsb) and fuse managed by ELE. The FSB part could be directly +accessed with MMIO, the ELE could only be accessed with ELE API. + +Currently the ELE API is not ready, so NULL function callback is used, +but it was tested with downstream ELE API. + +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-22-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 9 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/imx-ocotp-ele.c | 175 ++++++++++++++++++++++++++++++++++ + 3 files changed, 186 insertions(+) + create mode 100644 drivers/nvmem/imx-ocotp-ele.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -83,6 +83,15 @@ config NVMEM_IMX_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-imx-ocotp. + ++config NVMEM_IMX_OCOTP_ELE ++ tristate "i.MX On-Chip OTP Controller support" ++ depends on ARCH_MXC || COMPILE_TEST ++ depends on HAS_IOMEM ++ depends on OF ++ help ++ This is a driver for the On-Chip OTP Controller (OCOTP) ++ available on i.MX SoCs which has ELE. ++ + config NVMEM_IMX_OCOTP_SCU + tristate "i.MX8 SCU On-Chip OTP Controller support" + depends on IMX_SCU +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -18,6 +18,8 @@ obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-im + nvmem-imx-iim-y := imx-iim.o + obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o + nvmem-imx-ocotp-y := imx-ocotp.o ++obj-$(CONFIG_NVMEM_IMX_OCOTP_ELE) += nvmem-imx-ocotp-ele.o ++nvmem-imx-ocotp-ele-y := imx-ocotp-ele.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o + obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o +--- /dev/null ++++ b/drivers/nvmem/imx-ocotp-ele.c +@@ -0,0 +1,175 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * i.MX9 OCOTP fusebox driver ++ * ++ * Copyright 2023 NXP ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++enum fuse_type { ++ FUSE_FSB = 1, ++ FUSE_ELE = 2, ++ FUSE_INVALID = -1 ++}; ++ ++struct ocotp_map_entry { ++ u32 start; /* start word */ ++ u32 num; /* num words */ ++ enum fuse_type type; ++}; ++ ++struct ocotp_devtype_data { ++ u32 reg_off; ++ char *name; ++ u32 size; ++ u32 num_entry; ++ u32 flag; ++ nvmem_reg_read_t reg_read; ++ struct ocotp_map_entry entry[]; ++}; ++ ++struct imx_ocotp_priv { ++ struct device *dev; ++ void __iomem *base; ++ struct nvmem_config config; ++ struct mutex lock; ++ const struct ocotp_devtype_data *data; ++}; ++ ++static enum fuse_type imx_ocotp_fuse_type(void *context, u32 index) ++{ ++ struct imx_ocotp_priv *priv = context; ++ const struct ocotp_devtype_data *data = priv->data; ++ u32 start, end; ++ int i; ++ ++ for (i = 0; i < data->num_entry; i++) { ++ start = data->entry[i].start; ++ end = data->entry[i].start + data->entry[i].num; ++ ++ if (index >= start && index < end) ++ return data->entry[i].type; ++ } ++ ++ return FUSE_INVALID; ++} ++ ++static int imx_ocotp_reg_read(void *context, unsigned int offset, void *val, size_t bytes) ++{ ++ struct imx_ocotp_priv *priv = context; ++ void __iomem *reg = priv->base + priv->data->reg_off; ++ u32 count, index, num_bytes; ++ enum fuse_type type; ++ u32 *buf; ++ void *p; ++ int i; ++ ++ index = offset; ++ num_bytes = round_up(bytes, 4); ++ count = num_bytes >> 2; ++ ++ if (count > ((priv->data->size >> 2) - index)) ++ count = (priv->data->size >> 2) - index; ++ ++ p = kzalloc(num_bytes, GFP_KERNEL); ++ if (!p) ++ return -ENOMEM; ++ ++ mutex_lock(&priv->lock); ++ ++ buf = p; ++ ++ for (i = index; i < (index + count); i++) { ++ type = imx_ocotp_fuse_type(context, i); ++ if (type == FUSE_INVALID || type == FUSE_ELE) { ++ *buf++ = 0; ++ continue; ++ } ++ ++ *buf++ = readl_relaxed(reg + (i << 2)); ++ } ++ ++ memcpy(val, (u8 *)p, bytes); ++ ++ mutex_unlock(&priv->lock); ++ ++ kfree(p); ++ ++ return 0; ++}; ++ ++static int imx_ele_ocotp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct imx_ocotp_priv *priv; ++ struct nvmem_device *nvmem; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->data = of_device_get_match_data(dev); ++ ++ priv->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(priv->base)) ++ return PTR_ERR(priv->base); ++ ++ priv->config.dev = dev; ++ priv->config.name = "ELE-OCOTP"; ++ priv->config.id = NVMEM_DEVID_AUTO; ++ priv->config.owner = THIS_MODULE; ++ priv->config.size = priv->data->size; ++ priv->config.reg_read = priv->data->reg_read; ++ priv->config.word_size = 4; ++ priv->config.stride = 1; ++ priv->config.priv = priv; ++ priv->config.read_only = true; ++ mutex_init(&priv->lock); ++ ++ nvmem = devm_nvmem_register(dev, &priv->config); ++ if (IS_ERR(nvmem)) ++ return PTR_ERR(nvmem); ++ ++ return 0; ++} ++ ++static const struct ocotp_devtype_data imx93_ocotp_data = { ++ .reg_off = 0x8000, ++ .reg_read = imx_ocotp_reg_read, ++ .size = 2048, ++ .num_entry = 6, ++ .entry = { ++ { 0, 52, FUSE_FSB }, ++ { 63, 1, FUSE_ELE}, ++ { 128, 16, FUSE_ELE }, ++ { 182, 1, FUSE_ELE }, ++ { 188, 1, FUSE_ELE }, ++ { 312, 200, FUSE_FSB } ++ }, ++}; ++ ++static const struct of_device_id imx_ele_ocotp_dt_ids[] = { ++ { .compatible = "fsl,imx93-ocotp", .data = &imx93_ocotp_data, }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, imx_ele_ocotp_dt_ids); ++ ++static struct platform_driver imx_ele_ocotp_driver = { ++ .driver = { ++ .name = "imx_ele_ocotp", ++ .of_match_table = imx_ele_ocotp_dt_ids, ++ }, ++ .probe = imx_ele_ocotp_probe, ++}; ++module_platform_driver(imx_ele_ocotp_driver); ++ ++MODULE_DESCRIPTION("i.MX OCOTP/ELE driver"); ++MODULE_AUTHOR("Peng Fan "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/813-v6.5-0011-nvmem-core-add-support-for-fixed-cells-layout.patch b/target/linux/generic/backport-5.15/813-v6.5-0011-nvmem-core-add-support-for-fixed-cells-layout.patch new file mode 100644 index 00000000000000..59b2f9fa2c6707 --- /dev/null +++ b/target/linux/generic/backport-5.15/813-v6.5-0011-nvmem-core-add-support-for-fixed-cells-layout.patch @@ -0,0 +1,96 @@ +From 27f699e578b1a72df89dfa3bc42e093a01dc8d10 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 11 Jun 2023 15:03:29 +0100 +Subject: [PATCH] nvmem: core: add support for fixed cells *layout* +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds support for the "fixed-layout" NVMEM layout binding. It allows +defining NVMEM cells in a layout DT node named "nvmem-layout". + +While NVMEM subsystem supports layout drivers it has been discussed that +"fixed-layout" may actually be supperted internally. It's because: +1. It's a very basic layout +2. It allows sharing code with legacy syntax parsing +3. It's safer for soc_device_match() due to -EPROBE_DEFER +4. This will make the syntax transition easier + +Signed-off-by: Rafał Miłecki +Reviewed-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +Message-ID: <20230611140330.154222-26-srinivas.kandagatla@linaro.org> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 32 +++++++++++++++++++++++++++++--- + 1 file changed, 29 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -696,7 +696,7 @@ static int nvmem_validate_keepouts(struc + return 0; + } + +-static int nvmem_add_cells_from_of(struct nvmem_device *nvmem) ++static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) + { + struct nvmem_layout *layout = nvmem->layout; + struct device *dev = &nvmem->dev; +@@ -704,7 +704,7 @@ static int nvmem_add_cells_from_of(struc + const __be32 *addr; + int len, ret; + +- for_each_child_of_node(dev->of_node, child) { ++ for_each_child_of_node(np, child) { + struct nvmem_cell_info info = {0}; + + addr = of_get_property(child, "reg", &len); +@@ -742,6 +742,28 @@ static int nvmem_add_cells_from_of(struc + return 0; + } + ++static int nvmem_add_cells_from_legacy_of(struct nvmem_device *nvmem) ++{ ++ return nvmem_add_cells_from_dt(nvmem, nvmem->dev.of_node); ++} ++ ++static int nvmem_add_cells_from_fixed_layout(struct nvmem_device *nvmem) ++{ ++ struct device_node *layout_np; ++ int err = 0; ++ ++ layout_np = of_nvmem_layout_get_container(nvmem); ++ if (!layout_np) ++ return 0; ++ ++ if (of_device_is_compatible(layout_np, "fixed-layout")) ++ err = nvmem_add_cells_from_dt(nvmem, layout_np); ++ ++ of_node_put(layout_np); ++ ++ return err; ++} ++ + int __nvmem_layout_register(struct nvmem_layout *layout, struct module *owner) + { + layout->owner = owner; +@@ -972,7 +994,7 @@ struct nvmem_device *nvmem_register(cons + if (rval) + goto err_remove_cells; + +- rval = nvmem_add_cells_from_of(nvmem); ++ rval = nvmem_add_cells_from_legacy_of(nvmem); + if (rval) + goto err_remove_cells; + +@@ -982,6 +1004,10 @@ struct nvmem_device *nvmem_register(cons + if (rval) + goto err_remove_cells; + ++ rval = nvmem_add_cells_from_fixed_layout(nvmem); ++ if (rval) ++ goto err_remove_cells; ++ + rval = nvmem_add_cells_from_layout(nvmem); + if (rval) + goto err_remove_cells; diff --git a/target/linux/imx/config-5.15 b/target/linux/imx/config-5.15 index 73d0b3fe786675..7caaacbed7098a 100644 --- a/target/linux/imx/config-5.15 +++ b/target/linux/imx/config-5.15 @@ -295,6 +295,7 @@ CONFIG_NR_CPUS=4 CONFIG_NVMEM=y # CONFIG_NVMEM_IMX_IIM is not set CONFIG_NVMEM_IMX_OCOTP=y +# CONFIG_NVMEM_IMX_OCOTP_ELE is not set # CONFIG_NVMEM_SNVS_LPGPR is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/layerscape/armv7/config-5.15 b/target/linux/layerscape/armv7/config-5.15 index d7f151438b6c4a..b5df343f4eb905 100644 --- a/target/linux/layerscape/armv7/config-5.15 +++ b/target/linux/layerscape/armv7/config-5.15 @@ -413,6 +413,7 @@ CONFIG_NR_CPUS=16 CONFIG_NTFS_FS=y CONFIG_NVMEM=y # CONFIG_NVMEM_IMX_IIM is not set +# CONFIG_NVMEM_IMX_OCOTP_ELE is not set # CONFIG_NVMEM_SNVS_LPGPR is not set # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y From e341d51e0655e8d1442676181e136364eb090c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 10 Jul 2023 11:38:01 +0200 Subject: [PATCH 0257/1171] bcm47xx: fix bgmac MTU patch filename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 4970dd027bce ("bcm47xx: revert bgmac back to the old limited max frame size") Signed-off-by: Rafał Miłecki (cherry picked from commit 83aeb0bbd47638b42ee6cdda351d0c51e014d790) --- ...01-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename target/linux/bcm47xx/patches-5.15/{701-net-bgmac-connect-to-PHY-even-if-it-is-BGMAC_PHY_NOR.patch => 701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch} (100%) diff --git a/target/linux/bcm47xx/patches-5.15/701-net-bgmac-connect-to-PHY-even-if-it-is-BGMAC_PHY_NOR.patch b/target/linux/bcm47xx/patches-5.15/701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch similarity index 100% rename from target/linux/bcm47xx/patches-5.15/701-net-bgmac-connect-to-PHY-even-if-it-is-BGMAC_PHY_NOR.patch rename to target/linux/bcm47xx/patches-5.15/701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch From a210fced85b9d052580084802c7dfe9243901452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 10 Jul 2023 11:38:23 +0200 Subject: [PATCH 0258/1171] kernel: bgmac: fix regressed support for BCM53573 SoCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit d54f3b2cfdbd34aa61ca67fd590eebfdf3db51cf) --- ...ne-turning-IRQs-off-to-avoid-SoC-han.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch diff --git a/target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch b/target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch new file mode 100644 index 00000000000000..26e9ae3bcd2204 --- /dev/null +++ b/target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch @@ -0,0 +1,45 @@ +From e7731194fdf085f46d58b1adccfddbd0dfee4873 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 7 Jul 2023 08:53:25 +0200 +Subject: [PATCH] net: bgmac: postpone turning IRQs off to avoid SoC hangs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Turning IRQs off is done by accessing Ethernet controller registers. +That can't be done until device's clock is enabled. It results in a SoC +hang otherwise. + +This bug remained unnoticed for years as most bootloaders keep all +Ethernet interfaces turned on. It seems to only affect a niche SoC +family BCM47189. It has two Ethernet controllers but CFE bootloader uses +only the first one. + +Fixes: 34322615cbaa ("net: bgmac: Mask interrupts during probe") +Signed-off-by: Rafał Miłecki +Reviewed-by: Michal Kubiak +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/broadcom/bgmac.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -1492,8 +1492,6 @@ int bgmac_enet_probe(struct bgmac *bgmac + + bgmac->in_init = true; + +- bgmac_chip_intrs_off(bgmac); +- + net_dev->irq = bgmac->irq; + SET_NETDEV_DEV(net_dev, bgmac->dev); + dev_set_drvdata(bgmac->dev, bgmac); +@@ -1511,6 +1509,8 @@ int bgmac_enet_probe(struct bgmac *bgmac + */ + bgmac_clk_enable(bgmac, 0); + ++ bgmac_chip_intrs_off(bgmac); ++ + /* This seems to be fixing IRQ by assigning OOB #6 to the core */ + if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) { + if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6) From a4792d79e899b28cefdb6d54c43cf0c13a9646e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 11 Jul 2023 10:30:08 +0200 Subject: [PATCH 0259/1171] bcm53xx: backport DT changes from v6.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 8674b41c0d84f09e14bf8ebe08e1d6dc6ac5fa64) --- .../bcm53xx/base-files/etc/board.d/02_network | 2 +- .../base-files/lib/upgrade/platform.sh | 12 +- ...-Add-devicetree-for-D-Link-DWL-8610A.patch | 2 +- ...-Add-devicetree-for-D-Link-DIR-890L.patch} | 0 ...Correct-description-of-TP-Link-part.patch} | 0 ...m-align-LED-node-names-with-dtschema.patch | 1700 +++++++++++++++++ ...-Relicense-Rafa-s-code-to-the-GPL-2..patch | 487 +++++ ...-Relicense-Florian-s-code-to-the-GPL.patch | 136 ++ ...X-Drop-clock-names-from-the-SPI-node.patch | 32 + ...-Relicense-Hauke-s-code-to-the-GPL-2.patch | 249 +++ ...-Relicense-AXI-interrupts-code-to-th.patch | 203 ++ ...-Specify-MAC-addresses-on-Luxul-devi.patch | 336 ++++ ...-Use-updated-device-compatible-strin.patch | 90 + ...-Use-updated-spi-gpio-binding-proper.patch | 82 + ...-dts-BCM5301X-Drop-invalid-usb-cells.patch | 54 + ...-Drop-invalid-properties-from-Meraki.patch | 31 + ...-Relicense-Christian-s-code-to-the-G.patch | 106 + ...-Describe-switch-ports-in-the-main-D.patch | 838 ++++++++ ...-MR26-MR32-remove-bogus-nand-ecc-alg.patch | 63 + ...-MR32-remove-partition-index-numbers.patch | 54 + ...BCM5301X-fix-duplex-full-full-duplex.patch | 44 + ...-Add-Netgear-R8000-WiFi-regulator-ma.patch | 61 + ...M5301X-Add-cells-sizes-to-PCIe-nodes.patch | 59 + ... 080-v6.2-bcma-support-SPROM-rev-11.patch} | 0 ...-Specify-switch-ports-for-remaining-.patch | 2 +- 25 files changed, 4634 insertions(+), 9 deletions(-) rename target/linux/bcm53xx/patches-5.15/{035-v6.2-0001-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch => 035-v6.2-0002-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch} (100%) rename target/linux/bcm53xx/patches-5.15/{035-v6.2-0001-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch => 035-v6.2-0003-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch} (100%) create mode 100644 target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0002-ARM-dts-BCM5301X-Relicense-Florian-s-code-to-the-GPL.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0004-ARM-dts-BCM5301X-Relicense-Hauke-s-code-to-the-GPL-2.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0005-ARM-dts-BCM5301X-Relicense-AXI-interrupts-code-to-th.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0006-ARM-dts-BCM5301X-Specify-MAC-addresses-on-Luxul-devi.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0007-ARM-dts-BCM5301X-Use-updated-device-compatible-strin.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0008-ARM-dts-BCM5301X-Use-updated-spi-gpio-binding-proper.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0009-ARM-dts-BCM5301X-Drop-invalid-usb-cells.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0010-ARM-dts-BCM5301X-Drop-invalid-properties-from-Meraki.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0011-ARM-dts-BCM5301X-Relicense-Christian-s-code-to-the-G.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0012-ARM-dts-BCM5301X-Describe-switch-ports-in-the-main-D.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0013-ARM-dts-BCM5301X-MR26-MR32-remove-bogus-nand-ecc-alg.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0014-ARM-dts-BCM5301X-MR32-remove-partition-index-numbers.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0016-ARM-dts-BCM5301X-Add-Netgear-R8000-WiFi-regulator-ma.patch create mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0017-ARM-dts-BCM5301X-Add-cells-sizes-to-PCIe-nodes.patch rename target/linux/bcm53xx/patches-5.15/{036-v6.2-bcma-support-SPROM-rev-11.patch => 080-v6.2-bcma-support-SPROM-rev-11.patch} (100%) diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network index 6bec600540ead0..13e7311e797571 100644 --- a/target/linux/bcm53xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network @@ -57,7 +57,7 @@ bcm53xx_setup_macs() etXmacaddr=$(nvram get et2macaddr) offset=1 ;; - luxul,xwr-3100v1 | \ + luxul,xwr-3100-v1 | \ luxul,xwr-3150-v1) etXmacaddr=$(nvram get et0macaddr) offset=5 diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh index 3ebde77d3f944c..d9dc497cdac360 100644 --- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh @@ -39,18 +39,18 @@ platform_expected_image() { "dlink,dir-885l") echo "seamaseal wrgac42_dlink.2015_dir885l"; return;; "luxul,abr-4500-v1") echo "lxl ABR-4500"; return;; "luxul,xap-810-v1") echo "lxl XAP-810"; return;; - "luxul,xap-1410v1") echo "lxl XAP-1410"; return;; + "luxul,xap-1410-v1") echo "lxl XAP-1410"; return;; "luxul,xap-1440-v1") echo "lxl XAP-1440"; return;; - "luxul,xap-1510v1") echo "lxl XAP-1510"; return;; + "luxul,xap-1510-v1") echo "lxl XAP-1510"; return;; "luxul,xap-1610-v1") echo "lxl XAP-1610"; return;; "luxul,xbr-4500-v1") echo "lxl XBR-4500"; return;; "luxul,xwc-1000") echo "lxl XWC-1000"; return;; "luxul,xwc-2000-v1") echo "lxl XWC-2000"; return;; - "luxul,xwr-1200v1") echo "lxl XWR-1200"; return;; - "luxul,xwr-3100v1") echo "lxl XWR-3100"; return;; + "luxul,xwr-1200-v1") echo "lxl XWR-1200"; return;; + "luxul,xwr-3100-v1") echo "lxl XWR-3100"; return;; "luxul,xwr-3150-v1") echo "lxl XWR-3150"; return;; - "netgear,r6250v1") echo "chk U12H245T00_NETGEAR"; return;; - "netgear,r6300v2") echo "chk U12H240T00_NETGEAR"; return;; + "netgear,r6250-v1") echo "chk U12H245T00_NETGEAR"; return;; + "netgear,r6300-v2") echo "chk U12H240T00_NETGEAR"; return;; "netgear,r7000") echo "chk U12H270T00_NETGEAR"; return;; "netgear,r7900") echo "chk U12H315T30_NETGEAR"; return;; "netgear,r8000") echo "chk U12H315T00_NETGEAR"; return;; diff --git a/target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch b/target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch index b7528e9f716b55..206726f5f60098 100644 --- a/target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch +++ b/target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch @@ -21,7 +21,7 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -132,6 +132,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ +@@ -131,6 +131,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ bcm47094-netgear-r8500.dtb \ bcm47094-phicomm-k3.dtb \ bcm53015-meraki-mr26.dtb \ diff --git a/target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch b/target/linux/bcm53xx/patches-5.15/035-v6.2-0002-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch rename to target/linux/bcm53xx/patches-5.15/035-v6.2-0002-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch diff --git a/target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch b/target/linux/bcm53xx/patches-5.15/035-v6.2-0003-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.15/035-v6.2-0001-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch rename to target/linux/bcm53xx/patches-5.15/035-v6.2-0003-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch diff --git a/target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch b/target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch new file mode 100644 index 00000000000000..d6bf49d0cd2127 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch @@ -0,0 +1,1700 @@ +From af84101e3f2258a303fa2461ebec0878ce23ea10 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Fri, 25 Nov 2022 15:41:27 +0100 +Subject: [PATCH] ARM: dts: broadcom: align LED node names with dtschema + +The node names should be generic and DT schema expects certain pattern: + + bcm4708-asus-rt-ac68u.dtb: leds: 'logo', 'power', 'usb2', 'usb3' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20221125144128.477059-1-krzysztof.kozlowski@linaro.org +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts | 15 +++++----- + arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts | 8 +++--- + .../bcm4708-buffalo-wzr-1166dhp-common.dtsi | 16 +++++------ + .../boot/dts/bcm4708-buffalo-wzr-1750dhp.dts | 16 +++++------ + arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 6 ++-- + arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts | 2 +- + arch/arm/boot/dts/bcm4708-netgear-r6250.dts | 10 +++---- + .../arm/boot/dts/bcm4708-netgear-r6300-v2.dts | 10 +++---- + arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts | 22 +++++++-------- + arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts | 10 +++---- + .../boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 14 +++++----- + .../boot/dts/bcm47081-buffalo-wzr-900dhp.dts | 16 +++++------ + arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 6 ++-- + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 20 ++++++------- + .../boot/dts/bcm47081-tplink-archer-c5-v2.dts | 18 ++++++------ + arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts | 6 ++-- + .../boot/dts/bcm4709-buffalo-wxr-1900dhp.dts | 18 ++++++------ + arch/arm/boot/dts/bcm4709-netgear-r7000.dts | 16 +++++------ + arch/arm/boot/dts/bcm4709-netgear-r8000.dts | 22 +++++++-------- + .../boot/dts/bcm4709-tplink-archer-c9-v1.dts | 18 ++++++------ + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 12 ++++---- + arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 14 +++++----- + arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts | 16 +++++------ + .../boot/dts/bcm47094-linksys-panamera.dts | 28 +++++++++---------- + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 4 +-- + arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts | 6 ++-- + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 4 +-- + arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 2 +- + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 20 ++++++------- + .../boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 10 +++---- + arch/arm/boot/dts/bcm47094-netgear-r8500.dts | 14 +++++----- + arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts | 4 +-- + arch/arm/boot/dts/bcm47189-luxul-xap-810.dts | 10 +++---- + arch/arm/boot/dts/bcm47189-tenda-ac9.dts | 14 +++++----- + .../boot/dts/bcm53016-dlink-dwl-8610ap.dts | 8 +++--- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 6 ++-- + arch/arm/boot/dts/bcm947189acdbmr.dts | 6 ++-- + 37 files changed, 223 insertions(+), 224 deletions(-) + +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts +@@ -28,40 +28,39 @@ + leds { + compatible = "gpio-leds"; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:blue:usb3"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + }; + +- wan { ++ led-wan { + label = "bcm53xx:blue:wan"; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + +- lan { ++ led-lan { + label = "bcm53xx:blue:lan"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + }; + +- power { ++ led-power { + label = "bcm53xx:blue:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- all { ++ led-all { + label = "bcm53xx:blue:all"; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; + }; + +- +- usb2 { ++ led-usb2 { + label = "bcm53xx:blue:usb2"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts +@@ -28,24 +28,24 @@ + leds { + compatible = "gpio-leds"; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:blue:usb2"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + }; + +- power { ++ led-power { + label = "bcm53xx:blue:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- logo { ++ led-logo { + label = "bcm53xx:white:logo"; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:blue:usb3"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi +@@ -37,7 +37,7 @@ + leds { + compatible = "gpio-leds"; + +- usb { ++ led-usb { + /* label = "bcm53xx:blue:usb"; */ + function = LED_FUNCTION_USB; + color = ; +@@ -48,14 +48,14 @@ + linux,default-trigger = "usbport"; + }; + +- power0 { ++ led-power0 { + /* label = "bcm53xx:red:power"; */ + function = LED_FUNCTION_FAULT; + color = ; + gpios = <&hc595 1 GPIO_ACTIVE_HIGH>; + }; + +- power1 { ++ led-power1 { + /* label = "bcm53xx:white:power"; */ + function = LED_FUNCTION_POWER; + color = ; +@@ -63,7 +63,7 @@ + linux,default-trigger = "default-on"; + }; + +- router0 { ++ led-router0 { + /* label = "bcm53xx:blue:router"; */ + function = LED_FUNCTION_STATUS; + color = ; +@@ -71,14 +71,14 @@ + linux,default-trigger = "default-on"; + }; + +- router1 { ++ led-router1 { + /* label = "bcm53xx:amber:router"; */ + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&hc595 4 GPIO_ACTIVE_HIGH>; + }; + +- wan { ++ led-wan { + /* label = "bcm53xx:blue:wan"; */ + function = LED_FUNCTION_WAN; + color = ; +@@ -86,14 +86,14 @@ + linux,default-trigger = "default-on"; + }; + +- wireless0 { ++ led-wireless0 { + /* label = "bcm53xx:blue:wireless"; */ + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&hc595 6 GPIO_ACTIVE_HIGH>; + }; + +- wireless1 { ++ led-wireless1 { + /* label = "bcm53xx:amber:wireless"; */ + function = LED_FUNCTION_WLAN; + color = ; +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +@@ -49,7 +49,7 @@ + leds { + compatible = "gpio-leds"; + +- usb { ++ led-usb { + label = "bcm53xx:blue:usb"; + gpios = <&hc595 0 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +@@ -58,40 +58,40 @@ + linux,default-trigger = "usbport"; + }; + +- power0 { ++ led-power0 { + label = "bcm53xx:red:power"; + gpios = <&hc595 1 GPIO_ACTIVE_HIGH>; + }; + +- power1 { ++ led-power1 { + label = "bcm53xx:white:power"; + gpios = <&hc595 2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- router0 { ++ led-router0 { + label = "bcm53xx:blue:router"; + gpios = <&hc595 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- router1 { ++ led-router1 { + label = "bcm53xx:amber:router"; + gpios = <&hc595 4 GPIO_ACTIVE_HIGH>; + }; + +- wan { ++ led-wan { + label = "bcm53xx:blue:wan"; + gpios = <&hc595 5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- wireless0 { ++ led-wireless0 { + label = "bcm53xx:blue:wireless"; + gpios = <&hc595 6 GPIO_ACTIVE_HIGH>; + }; + +- wireless1 { ++ led-wireless1 { + label = "bcm53xx:amber:wireless"; + gpios = <&hc595 7 GPIO_ACTIVE_HIGH>; + }; +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -23,19 +23,19 @@ + leds { + compatible = "gpio-leds"; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; +--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts +@@ -42,7 +42,7 @@ + leds { + compatible = "gpio-leds"; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "timer"; +--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts +@@ -29,24 +29,24 @@ + leds { + compatible = "gpio-leds"; + +- logo { ++ led-logo { + label = "bcm53xx:white:logo"; + gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- power0 { ++ led-power0 { + label = "bcm53xx:green:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- power1 { ++ led-power1 { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- usb { ++ led-usb { + label = "bcm53xx:blue:usb"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +@@ -54,7 +54,7 @@ + linux,default-trigger = "usbport"; + }; + +- wireless { ++ led-wireless { + label = "bcm53xx:blue:wireless"; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts +@@ -28,29 +28,29 @@ + leds { + compatible = "gpio-leds"; + +- logo { ++ led-logo { + label = "bcm53xx:white:logo"; + gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- power0 { ++ led-power0 { + label = "bcm53xx:green:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + }; + +- power1 { ++ led-power1 { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- usb { ++ led-usb { + label = "bcm53xx:blue:usb"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + }; + +- wireless { ++ led-wireless { + label = "bcm53xx:blue:wireless"; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts ++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts +@@ -28,64 +28,64 @@ + leds { + compatible = "gpio-leds"; + +- power-white { ++ led-power-white { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- power-amber { ++ led-power-amber { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_HIGH>; + }; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:white:usb2"; + gpios = <&chipcommon 3 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port2>, <&ehci_port2>; + linux,default-trigger = "usbport"; + }; + +- usb3-white { ++ led-usb3-white { + label = "bcm53xx:white:usb3"; + gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; + trigger-sources = <&xhci_port1>; + linux,default-trigger = "usbport"; + }; + +- usb3-green { ++ led-usb3-green { + label = "bcm53xx:green:usb3"; + gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + +- wps { ++ led-wps { + label = "bcm53xx:white:wps"; + gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>; + }; + +- status-red { ++ led-status-red { + label = "bcm53xx:red:status"; + gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>; + }; + +- status-green { ++ led-status-green { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + }; + +- status-blue { ++ led-status-blue { + label = "bcm53xx:blue:status"; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + }; + +- wan-white { ++ led-wan-white { + label = "bcm53xx:white:wan"; + gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; + +- wan-red { ++ led-wan-red { + label = "bcm53xx:red:wan"; + gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + }; +--- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts ++++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts +@@ -28,30 +28,30 @@ + leds { + compatible = "gpio-leds"; + +- power { ++ led-power { + label = "bcm53xx:blue:power"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:blue:usb2"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- wan { ++ led-wan { + label = "bcm53xx:blue:wan"; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- lan { ++ led-lan { + label = "bcm53xx:blue:lan"; + gpios = <&chipcommon 9 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:blue:usb3"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -49,40 +49,40 @@ + leds { + compatible = "gpio-leds"; + +- power0 { ++ led-power0 { + label = "bcm53xx:green:power"; + gpios = <&hc595 1 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- power1 { ++ led-power1 { + label = "bcm53xx:red:power"; + gpios = <&hc595 2 GPIO_ACTIVE_HIGH>; + }; + +- router0 { ++ led-router0 { + label = "bcm53xx:green:router"; + gpios = <&hc595 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- router1 { ++ led-router1 { + label = "bcm53xx:amber:router"; + gpios = <&hc595 4 GPIO_ACTIVE_HIGH>; + }; + +- wan { ++ led-wan { + label = "bcm53xx:green:wan"; + gpios = <&hc595 5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- wireless0 { ++ led-wireless0 { + label = "bcm53xx:green:wireless"; + gpios = <&hc595 6 GPIO_ACTIVE_HIGH>; + }; + +- wireless1 { ++ led-wireless1 { + label = "bcm53xx:amber:wireless"; + gpios = <&hc595 7 GPIO_ACTIVE_HIGH>; + }; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts +@@ -49,45 +49,45 @@ + leds { + compatible = "gpio-leds"; + +- usb { ++ led-usb { + label = "bcm53xx:green:usb"; + gpios = <&hc595 0 GPIO_ACTIVE_HIGH>; + }; + +- power0 { ++ led-power0 { + label = "bcm53xx:green:power"; + gpios = <&hc595 1 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- power1 { ++ led-power1 { + label = "bcm53xx:red:power"; + gpios = <&hc595 2 GPIO_ACTIVE_HIGH>; + }; + +- router0 { ++ led-router0 { + label = "bcm53xx:green:router"; + gpios = <&hc595 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- router1 { ++ led-router1 { + label = "bcm53xx:amber:router"; + gpios = <&hc595 4 GPIO_ACTIVE_HIGH>; + }; + +- wan { ++ led-wan { + label = "bcm53xx:green:wan"; + gpios = <&hc595 5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- wireless0 { ++ led-wireless0 { + label = "bcm53xx:green:wireless"; + gpios = <&hc595 6 GPIO_ACTIVE_HIGH>; + }; + +- wireless1 { ++ led-wireless1 { + label = "bcm53xx:amber:wireless"; + gpios = <&hc595 7 GPIO_ACTIVE_HIGH>; + }; +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -23,19 +23,19 @@ + leds { + compatible = "gpio-leds"; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -29,62 +29,62 @@ + leds { + compatible = "gpio-leds"; + +- power { ++ led-power { + label = "bcm53xx:green:power"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- lan3 { ++ led-lan3 { + label = "bcm53xx:green:lan3"; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- lan4 { ++ led-lan4 { + label = "bcm53xx:green:lan4"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- wan { ++ led-wan { + label = "bcm53xx:green:wan"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- lan2 { ++ led-lan2 { + label = "bcm53xx:green:lan2"; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- usb { ++ led-usb { + label = "bcm53xx:green:usb"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port2>, <&ehci_port2>; + linux,default-trigger = "usbport"; + }; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:green:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:green:5ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + +- lan1 { ++ led-lan1 { + label = "bcm53xx:green:lan1"; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; +--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts ++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +@@ -23,50 +23,50 @@ + leds { + compatible = "gpio-leds"; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:green:2ghz"; + gpios = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + }; + +- lan { ++ led-lan { + label = "bcm53xx:green:lan"; + gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>; + }; + +- usb2-port1 { ++ led-usb2-port1 { + label = "bcm53xx:green:usb2-port1"; + gpios = <&chipcommon 2 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + +- power { ++ led-power { + label = "bcm53xx:green:power"; + gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- wan-green { ++ led-wan-green { + label = "bcm53xx:green:wan"; + gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; + }; + +- wps { ++ led-wps { + label = "bcm53xx:green:wps"; + gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>; + }; + +- wan-amber { ++ led-wan-amber { + label = "bcm53xx:amber:wan"; + gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:green:5ghz"; + gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; + +- usb2-port2 { ++ led-usb2-port2 { + label = "bcm53xx:green:usb2-port2"; + gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port2>, <&ehci_port2>; +--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts ++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +@@ -28,18 +28,18 @@ + leds { + compatible = "gpio-leds"; + +- wps { ++ led-wps { + label = "bcm53xx:blue:wps"; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + +- power { ++ led-power { + label = "bcm53xx:blue:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- wan { ++ led-wan { + label = "bcm53xx:red:wan"; + gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts ++++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +@@ -28,48 +28,48 @@ + leds { + compatible = "gpio-leds"; + +- usb { ++ led-usb { + label = "bcm53xx:green:usb"; + gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; + }; + +- power-amber { ++ led-power-amber { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; + }; + +- power-white { ++ led-power-white { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- router-amber { ++ led-router-amber { + label = "bcm53xx:amber:router"; + gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>; + }; + +- router-white { ++ led-router-white { + label = "bcm53xx:white:router"; + gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>; + }; + +- wan-amber { ++ led-wan-amber { + label = "bcm53xx:amber:wan"; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + }; + +- wan-white { ++ led-wan-white { + label = "bcm53xx:white:wan"; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + }; + +- wireless-amber { ++ led-wireless-amber { + label = "bcm53xx:amber:wireless"; + gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; + }; + +- wireless-white { ++ led-wireless-white { + label = "bcm53xx:white:wireless"; + gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; +--- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +@@ -28,43 +28,43 @@ + leds { + compatible = "gpio-leds"; + +- power-white { ++ led-power-white { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- power-amber { ++ led-power-amber { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:white:5ghz"; + gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:white:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ led-wps { + label = "bcm53xx:white:wps"; + gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>; + }; + +- wireless { ++ led-wireless { + label = "bcm53xx:white:wireless"; + gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:white:usb3"; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; + }; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:white:usb2"; + gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -39,59 +39,59 @@ + leds { + compatible = "gpio-leds"; + +- power-white { ++ led-power-white { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- power-amber { ++ led-power-amber { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- wan-white { ++ led-wan-white { + label = "bcm53xx:white:wan"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- wan-amber { ++ led-wan-amber { + label = "bcm53xx:amber:wan"; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + }; + +- 5ghz-1 { ++ led-5ghz-1 { + label = "bcm53xx:white:5ghz-1"; + gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:white:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- wireless { ++ led-wireless { + label = "bcm53xx:white:wireless"; + gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>; + }; + +- wps { ++ led-wps { + label = "bcm53xx:white:wps"; + gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>; + }; + +- 5ghz-2 { ++ led-5ghz-2 { + label = "bcm53xx:white:5ghz-2"; + gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:white:usb3"; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; + }; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:white:usb2"; + gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts ++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +@@ -23,27 +23,27 @@ + leds { + compatible = "gpio-leds"; + +- lan { ++ led-lan { + label = "bcm53xx:blue:lan"; + gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>; + }; + +- wps { ++ led-wps { + label = "bcm53xx:blue:wps"; + gpios = <&chipcommon 2 GPIO_ACTIVE_HIGH>; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:blue:usb3"; + gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +@@ -51,24 +51,24 @@ + linux,default-trigger = "usbport"; + }; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:blue:usb2"; + gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port2>, <&ehci_port2>; + linux,default-trigger = "usbport"; + }; + +- wan-blue { ++ led-wan-blue { + label = "bcm53xx:blue:wan"; + gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>; + }; + +- wan-amber { ++ led-wan-amber { + label = "bcm53xx:amber:wan"; + gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>; + }; + +- power { ++ led-power { + label = "bcm53xx:blue:power"; + gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -33,37 +33,37 @@ + leds { + compatible = "gpio-leds"; + +- power { ++ led-power { + label = "white:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- wan-red { ++ led-wan-red { + label = "red:wan"; + gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; + }; + +- lan { ++ led-lan { + label = "white:lan"; + gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>; + }; + +- usb2 { ++ led-usb2 { + label = "white:usb2"; + gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; + trigger-sources = <&ehci_port2>; + linux,default-trigger = "usbport"; + }; + +- usb3 { ++ led-usb3 { + label = "white:usb3"; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; + trigger-sources = <&ehci_port1>, <&xhci_port1>; + linux,default-trigger = "usbport"; + }; + +- wps { ++ led-wps { + label = "white:wps"; + gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -43,28 +43,28 @@ + leds { + compatible = "gpio-leds"; + +- power-white { ++ led-power-white { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- wan-white { ++ led-wan-white { + label = "bcm53xx:white:wan"; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + +- power-amber { ++ led-power-amber { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + }; + +- wan-amber { ++ led-wan-amber { + label = "bcm53xx:amber:wan"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- usb3-white { ++ led-usb3-white { + label = "bcm53xx:white:usb3"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +@@ -72,12 +72,12 @@ + linux,default-trigger = "usbport"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:white:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:white:5ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts +@@ -41,47 +41,47 @@ + */ + compatible = "gpio-leds"; + +- power-white { ++ led-power-white { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- wan-white { ++ led-wan-white { + label = "bcm53xx:white:wan"; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + +- power-amber { ++ led-power-amber { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + }; + +- wan-amber { ++ led-wan-amber { + label = "bcm53xx:amber:wan"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- usb3-white { ++ led-usb3-white { + label = "bcm53xx:white:usb3"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + trigger-sources = <&xhci_port1>; + linux,default-trigger = "usbport"; + }; + +- usb2-white { ++ led-usb2-white { + label = "bcm53xx:white:usb2"; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:white:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:white:5ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -52,19 +52,19 @@ + leds { + compatible = "gpio-leds"; + +- wps { ++ led-wps { + label = "bcm53xx:white:wps"; + gpios = <&chipcommon 22 GPIO_ACTIVE_LOW>; + }; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:green:usb2"; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port2>, <&ehci_port2>; + linux,default-trigger = "usbport"; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:green:usb3"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +@@ -72,58 +72,58 @@ + linux,default-trigger = "usbport"; + }; + +- power { ++ led-power { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + +- wifi-disabled { ++ led-wifi-disabled { + label = "bcm53xx:amber:wifi-disabled"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + }; + +- wifi-enabled { ++ led-wifi-enabled { + label = "bcm53xx:white:wifi-enabled"; + gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; + }; + +- bluebar1 { ++ led-bluebar1 { + label = "bcm53xx:white:bluebar1"; + gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; + }; + +- bluebar2 { ++ led-bluebar2 { + label = "bcm53xx:white:bluebar2"; + gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; + +- bluebar3 { ++ led-bluebar3 { + label = "bcm53xx:white:bluebar3"; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + }; + +- bluebar4 { ++ led-bluebar4 { + label = "bcm53xx:white:bluebar4"; + gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; + +- bluebar5 { ++ led-bluebar5 { + label = "bcm53xx:white:bluebar5"; + gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>; + }; + +- bluebar6 { ++ led-bluebar6 { + label = "bcm53xx:white:bluebar6"; + gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>; + }; + +- bluebar7 { ++ led-bluebar7 { + label = "bcm53xx:white:bluebar7"; + gpios = <&chipcommon 21 GPIO_ACTIVE_HIGH>; + }; + +- bluebar8 { ++ led-bluebar8 { + label = "bcm53xx:white:bluebar8"; + gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -30,13 +30,13 @@ + leds { + compatible = "gpio-leds"; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:green:usb3"; + gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts +@@ -23,18 +23,18 @@ + leds { + compatible = "gpio-leds"; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -30,13 +30,13 @@ + leds { + compatible = "gpio-leds"; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "timer"; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:green:usb3"; + gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -25,7 +25,7 @@ + leds { + compatible = "gpio-leds"; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -30,38 +30,38 @@ + leds { + compatible = "gpio-leds"; + +- power { ++ led-power { + label = "bcm53xx:green:power"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- lan3 { ++ led-lan3 { + label = "bcm53xx:green:lan3"; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + +- lan4 { ++ led-lan4 { + label = "bcm53xx:green:lan4"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + }; + +- wan { ++ led-wan { + label = "bcm53xx:green:wan"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- lan1 { ++ led-lan1 { + label = "bcm53xx:green:lan1"; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + +- lan2 { ++ led-lan2 { + label = "bcm53xx:green:lan2"; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:green:usb3"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +@@ -69,18 +69,18 @@ + linux,default-trigger = "usbport"; + }; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:green:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:green:5ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -33,13 +33,13 @@ + leds { + compatible = "gpio-leds"; + +- power { ++ led-power { + label = "bcm53xx:green:power"; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:green:usb3"; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>, +@@ -47,18 +47,18 @@ + linux,default-trigger = "usbport"; + }; + +- status { ++ led-status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:green:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:green:5ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts ++++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts +@@ -25,38 +25,38 @@ + leds { + compatible = "gpio-leds"; + +- power0 { ++ led-power0 { + label = "bcm53xx:white:power"; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + +- power1 { ++ led-power1 { + label = "bcm53xx:amber:power"; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- 5ghz-1 { ++ led-5ghz-1 { + label = "bcm53xx:white:5ghz-1"; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + +- 5ghz-2 { ++ led-5ghz-2 { + label = "bcm53xx:white:5ghz-2"; + gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:white:2ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + +- usb2 { ++ led-usb2 { + label = "bcm53xx:white:usb2"; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; + }; + +- usb3 { ++ led-usb3 { + label = "bcm53xx:white:usb3"; + gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; + }; +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -23,13 +23,13 @@ + leds { + compatible = "gpio-leds"; + +- wlan { ++ led-wlan { + label = "bcm53xx:blue:wlan"; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-off"; + }; + +- system { ++ led-system { + label = "bcm53xx:green:system"; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -20,26 +20,26 @@ + reg = <0x00000000 0x08000000>; + }; + +- leds { ++ leds-0 { + compatible = "gpio-leds"; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-off"; + }; + +- system { ++ led-system { + label = "bcm53xx:green:system"; + gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "timer"; + }; + }; + +- pcie0_leds { ++ leds-1 { + compatible = "gpio-leds"; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&pcie0_chipcommon 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-off"; +--- a/arch/arm/boot/dts/bcm47189-tenda-ac9.dts ++++ b/arch/arm/boot/dts/bcm47189-tenda-ac9.dts +@@ -20,37 +20,37 @@ + reg = <0x00000000 0x08000000>; + }; + +- leds { ++ leds-0 { + compatible = "gpio-leds"; + +- usb { ++ led-usb { + label = "bcm53xx:blue:usb"; + gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + +- wps { ++ led-wps { + label = "bcm53xx:blue:wps"; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; + }; + +- system { ++ led-system { + label = "bcm53xx:blue:system"; + gpios = <&chipcommon 15 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "timer"; + }; + }; + +- pcie0_leds { ++ leds-1 { + compatible = "gpio-leds"; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&pcie0_chipcommon 3 GPIO_ACTIVE_HIGH>; + }; +--- a/arch/arm/boot/dts/bcm53016-dlink-dwl-8610ap.dts ++++ b/arch/arm/boot/dts/bcm53016-dlink-dwl-8610ap.dts +@@ -20,14 +20,14 @@ + leds { + compatible = "gpio-leds"; + +- power { ++ led-power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + +- diag { ++ led-diag { + /* Actually "diag" unclear what this means */ + function = LED_FUNCTION_INDICATOR; + color = ; +@@ -36,13 +36,13 @@ + linux,default-trigger = "heartbeat"; + }; + +- wlan-2g { ++ led-wlan-2g { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; + }; + +- wlan-5g { ++ led-wlan-5g { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -58,7 +58,7 @@ + pwm-leds { + compatible = "pwm-leds"; + +- red { ++ led-0 { + /* SYS-LED 1 - Tricolor */ + function = LED_FUNCTION_INDICATOR; + color = ; +@@ -66,7 +66,7 @@ + max-brightness = <255>; + }; + +- green { ++ led-1 { + /* SYS-LED 1 - Tricolor */ + function = LED_FUNCTION_POWER; + color = ; +@@ -74,7 +74,7 @@ + max-brightness = <255>; + }; + +- blue { ++ led-2 { + /* SYS-LED 1 - Tricolor */ + function = LED_FUNCTION_INDICATOR; + color = ; +--- a/arch/arm/boot/dts/bcm947189acdbmr.dts ++++ b/arch/arm/boot/dts/bcm947189acdbmr.dts +@@ -25,17 +25,17 @@ + leds { + compatible = "gpio-leds"; + +- wps { ++ led-wps { + label = "bcm53xx:blue:wps"; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + }; + +- 5ghz { ++ led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; + }; + +- 2ghz { ++ led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch new file mode 100644 index 00000000000000..9c6f0b8e5341b4 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch @@ -0,0 +1,487 @@ +From 915fac07f053418d0ab9075af64da2872ca8a7f8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 3 May 2023 14:16:10 +0200 +Subject: [PATCH] =?UTF-8?q?ARM:=20dts:=20BCM5301X:=20Relicense=20Rafa?= + =?UTF-8?q?=C5=82's=20code=20to=20the=20GPL=202.0+=20/=20MIT?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +All BCM5301X device DTS files use dual licensing. Try the same for SoC. +Introduce a new .dtsi file with a proper SPDX tag. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230503121611.1629-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + MAINTAINERS | 1 + + arch/arm/boot/dts/bcm-ns.dtsi | 202 ++++++++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm5301x.dtsi | 192 +----------------------------- + 3 files changed, 205 insertions(+), 190 deletions(-) + create mode 100644 arch/arm/boot/dts/bcm-ns.dtsi + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -3579,6 +3579,7 @@ M: Rafał Miłecki + M: bcm-kernel-feedback-list@broadcom.com + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) + S: Maintained ++F: arch/arm/boot/dts/bcm-ns.dtsi + F: arch/arm/boot/dts/bcm470* + F: arch/arm/boot/dts/bcm5301* + F: arch/arm/boot/dts/bcm953012* +--- /dev/null ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -0,0 +1,202 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include ++#include ++#include ++#include ++#include ++ ++/ { ++ axi@18000000 { ++ compatible = "brcm,bus-axi"; ++ reg = <0x18000000 0x1000>; ++ ranges = <0x00000000 0x18000000 0x00100000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ chipcommon: chipcommon@0 { ++ reg = <0x00000000 0x1000>; ++ ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; ++ ++ pcie0: pcie@12000 { ++ reg = <0x00012000 0x1000>; ++ }; ++ ++ pcie1: pcie@13000 { ++ reg = <0x00013000 0x1000>; ++ }; ++ ++ usb2: usb2@21000 { ++ reg = <0x00021000 0x1000>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ ++ interrupt-parent = <&gic>; ++ ++ ehci: usb@21000 { ++ #usb-cells = <0>; ++ ++ compatible = "generic-ehci"; ++ reg = <0x00021000 0x1000>; ++ interrupts = ; ++ phys = <&usb2_phy>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ehci_port1: port@1 { ++ reg = <1>; ++ #trigger-source-cells = <0>; ++ }; ++ ++ ehci_port2: port@2 { ++ reg = <2>; ++ #trigger-source-cells = <0>; ++ }; ++ }; ++ ++ ohci: usb@22000 { ++ #usb-cells = <0>; ++ ++ compatible = "generic-ohci"; ++ reg = <0x00022000 0x1000>; ++ interrupts = ; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ohci_port1: port@1 { ++ reg = <1>; ++ #trigger-source-cells = <0>; ++ }; ++ ++ ohci_port2: port@2 { ++ reg = <2>; ++ #trigger-source-cells = <0>; ++ }; ++ }; ++ }; ++ ++ usb3: usb3@23000 { ++ reg = <0x00023000 0x1000>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ ++ interrupt-parent = <&gic>; ++ ++ xhci: usb@23000 { ++ #usb-cells = <0>; ++ ++ compatible = "generic-xhci"; ++ reg = <0x00023000 0x1000>; ++ interrupts = ; ++ phys = <&usb3_phy>; ++ phy-names = "usb"; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ xhci_port1: port@1 { ++ reg = <1>; ++ #trigger-source-cells = <0>; ++ }; ++ }; ++ }; ++ }; ++ ++ mdio: mdio@18003000 { ++ compatible = "brcm,iproc-mdio"; ++ reg = <0x18003000 0x8>; ++ #size-cells = <0>; ++ #address-cells = <1>; ++ }; ++ ++ dmu-bus@1800c000 { ++ compatible = "simple-bus"; ++ ranges = <0 0x1800c000 0x1000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ cru-bus@100 { ++ compatible = "brcm,ns-cru", "simple-mfd"; ++ reg = <0x100 0x1a4>; ++ ranges; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ usb2_phy: phy@164 { ++ compatible = "brcm,ns-usb2-phy"; ++ reg = <0x164 0x4>; ++ brcm,syscon-clkset = <&cru_clkset>; ++ clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; ++ clock-names = "phy-ref-clk"; ++ #phy-cells = <0>; ++ }; ++ ++ cru_clkset: syscon@180 { ++ compatible = "brcm,cru-clkset", "syscon"; ++ reg = <0x180 0x4>; ++ }; ++ ++ pinctrl: pinctrl@1c0 { ++ compatible = "brcm,bcm4708-pinmux"; ++ reg = <0x1c0 0x24>; ++ reg-names = "cru_gpio_control"; ++ ++ spi-pins { ++ groups = "spi_grp"; ++ function = "spi"; ++ }; ++ ++ pinmux_i2c: i2c-pins { ++ groups = "i2c_grp"; ++ function = "i2c"; ++ }; ++ ++ pinmux_pwm: pwm-pins { ++ groups = "pwm0_grp", "pwm1_grp", ++ "pwm2_grp", "pwm3_grp"; ++ function = "pwm"; ++ }; ++ ++ pinmux_uart1: uart1-pins { ++ groups = "uart1_grp"; ++ function = "uart1"; ++ }; ++ }; ++ ++ thermal: thermal@2c0 { ++ compatible = "brcm,ns-thermal"; ++ reg = <0x2c0 0x10>; ++ #thermal-sensor-cells = <0>; ++ }; ++ }; ++ }; ++ ++ thermal-zones { ++ cpu_thermal: cpu-thermal { ++ polling-delay-passive = <0>; ++ polling-delay = <1000>; ++ coefficients = <(-556) 418000>; ++ thermal-sensors = <&thermal>; ++ ++ trips { ++ cpu-crit { ++ temperature = <125000>; ++ hysteresis = <0>; ++ type = "critical"; ++ }; ++ }; ++ ++ cooling-maps { ++ }; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -8,11 +8,7 @@ + * Licensed under the GNU/GPL. See COPYING for details. + */ + +-#include +-#include +-#include +-#include +-#include ++#include "bcm-ns.dtsi" + + / { + #address-cells = <1>; +@@ -149,12 +145,6 @@ + }; + + axi@18000000 { +- compatible = "brcm,bus-axi"; +- reg = <0x18000000 0x1000>; +- ranges = <0x00000000 0x18000000 0x00100000>; +- #address-cells = <1>; +- #size-cells = <1>; +- + #interrupt-cells = <1>; + interrupt-map-mask = <0x000fffff 0xffff>; + interrupt-map = +@@ -228,108 +218,15 @@ + <0x00028000 6 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, + <0x00028000 7 &gic GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; + +- chipcommon: chipcommon@0 { +- reg = <0x00000000 0x1000>; +- +- gpio-controller; +- #gpio-cells = <2>; ++ chipcommon@0 { + interrupt-controller; + #interrupt-cells = <2>; + }; + +- pcie0: pcie@12000 { +- reg = <0x00012000 0x1000>; +- }; +- +- pcie1: pcie@13000 { +- reg = <0x00013000 0x1000>; +- }; +- + pcie2: pcie@14000 { + reg = <0x00014000 0x1000>; + }; + +- usb2: usb2@21000 { +- reg = <0x00021000 0x1000>; +- +- #address-cells = <1>; +- #size-cells = <1>; +- ranges; +- +- interrupt-parent = <&gic>; +- +- ehci: usb@21000 { +- #usb-cells = <0>; +- +- compatible = "generic-ehci"; +- reg = <0x00021000 0x1000>; +- interrupts = ; +- phys = <&usb2_phy>; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- ehci_port1: port@1 { +- reg = <1>; +- #trigger-source-cells = <0>; +- }; +- +- ehci_port2: port@2 { +- reg = <2>; +- #trigger-source-cells = <0>; +- }; +- }; +- +- ohci: usb@22000 { +- #usb-cells = <0>; +- +- compatible = "generic-ohci"; +- reg = <0x00022000 0x1000>; +- interrupts = ; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- ohci_port1: port@1 { +- reg = <1>; +- #trigger-source-cells = <0>; +- }; +- +- ohci_port2: port@2 { +- reg = <2>; +- #trigger-source-cells = <0>; +- }; +- }; +- }; +- +- usb3: usb3@23000 { +- reg = <0x00023000 0x1000>; +- +- #address-cells = <1>; +- #size-cells = <1>; +- ranges; +- +- interrupt-parent = <&gic>; +- +- xhci: usb@23000 { +- #usb-cells = <0>; +- +- compatible = "generic-xhci"; +- reg = <0x00023000 0x1000>; +- interrupts = ; +- phys = <&usb3_phy>; +- phy-names = "usb"; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- xhci_port1: port@1 { +- reg = <1>; +- #trigger-source-cells = <0>; +- }; +- }; +- }; +- + gmac0: ethernet@24000 { + reg = <0x24000 0x800>; + }; +@@ -355,13 +252,6 @@ + status = "disabled"; + }; + +- mdio: mdio@18003000 { +- compatible = "brcm,iproc-mdio"; +- reg = <0x18003000 0x8>; +- #size-cells = <0>; +- #address-cells = <1>; +- }; +- + mdio-mux@18003000 { + compatible = "mdio-mux-mmioreg", "mdio-mux"; + mdio-parent-bus = <&mdio>; +@@ -409,18 +299,7 @@ + }; + + dmu-bus@1800c000 { +- compatible = "simple-bus"; +- ranges = <0 0x1800c000 0x1000>; +- #address-cells = <1>; +- #size-cells = <1>; +- + cru-bus@100 { +- compatible = "brcm,ns-cru", "simple-mfd"; +- reg = <0x100 0x1a4>; +- ranges; +- #address-cells = <1>; +- #size-cells = <1>; +- + lcpll0: clock-controller@100 { + #clock-cells = <1>; + compatible = "brcm,nsp-lcpll0"; +@@ -440,53 +319,6 @@ + "usbclk", "iprocfast", + "sata1", "sata2"; + }; +- +- usb2_phy: phy@164 { +- compatible = "brcm,ns-usb2-phy"; +- reg = <0x164 0x4>; +- brcm,syscon-clkset = <&cru_clkset>; +- clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; +- clock-names = "phy-ref-clk"; +- #phy-cells = <0>; +- }; +- +- cru_clkset: syscon@180 { +- compatible = "brcm,cru-clkset", "syscon"; +- reg = <0x180 0x4>; +- }; +- +- pinctrl: pinctrl@1c0 { +- compatible = "brcm,bcm4708-pinmux"; +- reg = <0x1c0 0x24>; +- reg-names = "cru_gpio_control"; +- +- spi-pins { +- groups = "spi_grp"; +- function = "spi"; +- }; +- +- pinmux_i2c: i2c-pins { +- groups = "i2c_grp"; +- function = "i2c"; +- }; +- +- pinmux_pwm: pwm-pins { +- groups = "pwm0_grp", "pwm1_grp", +- "pwm2_grp", "pwm3_grp"; +- function = "pwm"; +- }; +- +- pinmux_uart1: uart1-pins { +- groups = "uart1_grp"; +- function = "uart1"; +- }; +- }; +- +- thermal: thermal@2c0 { +- compatible = "brcm,ns-thermal"; +- reg = <0x2c0 0x10>; +- #thermal-sensor-cells = <0>; +- }; + }; + }; + +@@ -558,24 +390,4 @@ + }; + }; + }; +- +- thermal-zones { +- cpu_thermal: cpu-thermal { +- polling-delay-passive = <0>; +- polling-delay = <1000>; +- coefficients = <(-556) 418000>; +- thermal-sensors = <&thermal>; +- +- trips { +- cpu-crit { +- temperature = <125000>; +- hysteresis = <0>; +- type = "critical"; +- }; +- }; +- +- cooling-maps { +- }; +- }; +- }; + }; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0002-ARM-dts-BCM5301X-Relicense-Florian-s-code-to-the-GPL.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0002-ARM-dts-BCM5301X-Relicense-Florian-s-code-to-the-GPL.patch new file mode 100644 index 00000000000000..b98f2daa6764e7 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0002-ARM-dts-BCM5301X-Relicense-Florian-s-code-to-the-GPL.patch @@ -0,0 +1,136 @@ +From 916553449561c4f0b61c71b751b7bb583f5dddd4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 3 May 2023 14:16:11 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Relicense Florian's code to the GPL 2.0+ + / MIT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +All BCM5301X device DTS files use dual licensing. Try the same for SoC. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230503121611.1629-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-ns.dtsi | 36 ++++++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm5301x.dtsi | 39 --------------------------------- + 2 files changed, 36 insertions(+), 39 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -19,6 +19,8 @@ + + gpio-controller; + #gpio-cells = <2>; ++ interrupt-controller; ++ #interrupt-cells = <2>; + }; + + pcie0: pcie@12000 { +@@ -109,6 +111,22 @@ + }; + }; + }; ++ ++ gmac0: ethernet@24000 { ++ reg = <0x24000 0x800>; ++ }; ++ ++ gmac1: ethernet@25000 { ++ reg = <0x25000 0x800>; ++ }; ++ ++ gmac2: ethernet@26000 { ++ reg = <0x26000 0x800>; ++ }; ++ ++ gmac3: ethernet@27000 { ++ reg = <0x27000 0x800>; ++ }; + }; + + mdio: mdio@18003000 { +@@ -118,6 +136,24 @@ + #address-cells = <1>; + }; + ++ rng: rng@18004000 { ++ compatible = "brcm,bcm5301x-rng"; ++ reg = <0x18004000 0x14>; ++ }; ++ ++ srab: ethernet-switch@18007000 { ++ compatible = "brcm,bcm53011-srab", "brcm,bcm5301x-srab"; ++ reg = <0x18007000 0x1000>; ++ ++ status = "disabled"; ++ ++ /* ports are defined in board DTS */ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ + dmu-bus@1800c000 { + compatible = "simple-bus"; + ranges = <0 0x1800c000 0x1000>; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -218,30 +218,9 @@ + <0x00028000 6 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, + <0x00028000 7 &gic GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; + +- chipcommon@0 { +- interrupt-controller; +- #interrupt-cells = <2>; +- }; +- + pcie2: pcie@14000 { + reg = <0x00014000 0x1000>; + }; +- +- gmac0: ethernet@24000 { +- reg = <0x24000 0x800>; +- }; +- +- gmac1: ethernet@25000 { +- reg = <0x25000 0x800>; +- }; +- +- gmac2: ethernet@26000 { +- reg = <0x26000 0x800>; +- }; +- +- gmac3: ethernet@27000 { +- reg = <0x27000 0x800>; +- }; + }; + + pwm: pwm@18002000 { +@@ -322,24 +301,6 @@ + }; + }; + +- srab: ethernet-switch@18007000 { +- compatible = "brcm,bcm53011-srab", "brcm,bcm5301x-srab"; +- reg = <0x18007000 0x1000>; +- +- status = "disabled"; +- +- /* ports are defined in board DTS */ +- ports { +- #address-cells = <1>; +- #size-cells = <0>; +- }; +- }; +- +- rng: rng@18004000 { +- compatible = "brcm,bcm5301x-rng"; +- reg = <0x18004000 0x14>; +- }; +- + nand_controller: nand-controller@18028000 { + compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1", "brcm,brcmnand"; + reg = <0x18028000 0x600>, <0x1811a408 0x600>, <0x18028f00 0x20>; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch new file mode 100644 index 00000000000000..4065db8366af15 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch @@ -0,0 +1,32 @@ +From d3c8e2c5757153bbfad70019ec1decbca86f3def Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 3 May 2023 14:28:30 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Drop "clock-names" from the SPI node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There is no such property in the SPI controller binding documentation. +Also Linux driver doesn't look for it. + +This fixes: +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: spi@18029200: Unevaluated properties are not allowed ('clock-names' was unexpected) + From schema: Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.yaml + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230503122830.3200-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x.dtsi | 1 - + 1 file changed, 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -335,7 +335,6 @@ + "spi_lr_session_done", + "spi_lr_overread"; + clocks = <&iprocmed>; +- clock-names = "iprocmed"; + num-cs = <2>; + #address-cells = <1>; + #size-cells = <0>; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0004-ARM-dts-BCM5301X-Relicense-Hauke-s-code-to-the-GPL-2.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0004-ARM-dts-BCM5301X-Relicense-Hauke-s-code-to-the-GPL-2.patch new file mode 100644 index 00000000000000..328748c8e0f739 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0004-ARM-dts-BCM5301X-Relicense-Hauke-s-code-to-the-GPL-2.patch @@ -0,0 +1,249 @@ +From b3b3cd885ed39cb4b38319a1c4fa4e41db6fee72 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 May 2023 17:19:20 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Relicense Hauke's code to the GPL 2.0+ / + MIT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move code added by Hauke to the bcm-ns.dtsi which uses dual licensing. +That syncs more Northstar code to be based on the same licensing schema. + +Signed-off-by: Rafał Miłecki +Cc: Hauke Mehrtens +Acked-by: Hauke Mehrtens +Link: https://lore.kernel.org/r/20230515151921.25021-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-ns.dtsi | 90 +++++++++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm5301x.dtsi | 85 ------------------------------- + 2 files changed, 90 insertions(+), 85 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -1,4 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Copyright 2013-2014 Hauke Mehrtens ++ */ + + #include + #include +@@ -7,6 +10,81 @@ + #include + + / { ++ interrupt-parent = <&gic>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ chipcommon-a-bus@18000000 { ++ compatible = "simple-bus"; ++ ranges = <0x00000000 0x18000000 0x00001000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ uart0: serial@300 { ++ compatible = "ns16550"; ++ reg = <0x0300 0x100>; ++ interrupts = ; ++ clocks = <&iprocslow>; ++ status = "disabled"; ++ }; ++ ++ uart1: serial@400 { ++ compatible = "ns16550"; ++ reg = <0x0400 0x100>; ++ interrupts = ; ++ clocks = <&iprocslow>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinmux_uart1>; ++ status = "disabled"; ++ }; ++ }; ++ ++ mpcore-bus@19000000 { ++ compatible = "simple-bus"; ++ ranges = <0x00000000 0x19000000 0x00023000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ scu@20000 { ++ compatible = "arm,cortex-a9-scu"; ++ reg = <0x20000 0x100>; ++ }; ++ ++ timer@20200 { ++ compatible = "arm,cortex-a9-global-timer"; ++ reg = <0x20200 0x100>; ++ interrupts = ; ++ clocks = <&periph_clk>; ++ }; ++ ++ timer@20600 { ++ compatible = "arm,cortex-a9-twd-timer"; ++ reg = <0x20600 0x20>; ++ interrupts = ; ++ clocks = <&periph_clk>; ++ }; ++ ++ gic: interrupt-controller@21000 { ++ compatible = "arm,cortex-a9-gic"; ++ #interrupt-cells = <3>; ++ #address-cells = <0>; ++ interrupt-controller; ++ reg = <0x21000 0x1000>, ++ <0x20100 0x100>; ++ }; ++ ++ L2: cache-controller@22000 { ++ compatible = "arm,pl310-cache"; ++ reg = <0x22000 0x1000>; ++ cache-unified; ++ arm,shared-override; ++ prefetch-data = <1>; ++ prefetch-instr = <1>; ++ cache-level = <2>; ++ }; ++ }; ++ + axi@18000000 { + compatible = "brcm,bus-axi"; + reg = <0x18000000 0x1000>; +@@ -216,6 +294,18 @@ + }; + }; + ++ nand_controller: nand-controller@18028000 { ++ compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1", "brcm,brcmnand"; ++ reg = <0x18028000 0x600>, <0x1811a408 0x600>, <0x18028f00 0x20>; ++ reg-names = "nand", "iproc-idm", "iproc-ext"; ++ interrupts = ; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ brcm,nand-has-wp; ++ }; ++ + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <0>; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -11,41 +11,7 @@ + #include "bcm-ns.dtsi" + + / { +- #address-cells = <1>; +- #size-cells = <1>; +- interrupt-parent = <&gic>; +- +- chipcommon-a-bus@18000000 { +- compatible = "simple-bus"; +- ranges = <0x00000000 0x18000000 0x00001000>; +- #address-cells = <1>; +- #size-cells = <1>; +- +- uart0: serial@300 { +- compatible = "ns16550"; +- reg = <0x0300 0x100>; +- interrupts = ; +- clocks = <&iprocslow>; +- status = "disabled"; +- }; +- +- uart1: serial@400 { +- compatible = "ns16550"; +- reg = <0x0400 0x100>; +- interrupts = ; +- clocks = <&iprocslow>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinmux_uart1>; +- status = "disabled"; +- }; +- }; +- + mpcore-bus@19000000 { +- compatible = "simple-bus"; +- ranges = <0x00000000 0x19000000 0x00023000>; +- #address-cells = <1>; +- #size-cells = <1>; +- + a9pll: arm_clk@0 { + #clock-cells = <0>; + compatible = "brcm,nsp-armpll"; +@@ -53,26 +19,6 @@ + reg = <0x00000 0x1000>; + }; + +- scu@20000 { +- compatible = "arm,cortex-a9-scu"; +- reg = <0x20000 0x100>; +- }; +- +- timer@20200 { +- compatible = "arm,cortex-a9-global-timer"; +- reg = <0x20200 0x100>; +- interrupts = ; +- clocks = <&periph_clk>; +- }; +- +- timer@20600 { +- compatible = "arm,cortex-a9-twd-timer"; +- reg = <0x20600 0x20>; +- interrupts = ; +- clocks = <&periph_clk>; +- }; +- + watchdog@20620 { + compatible = "arm,cortex-a9-twd-wdt"; + reg = <0x20620 0x20>; +@@ -80,25 +26,6 @@ + IRQ_TYPE_EDGE_RISING)>; + clocks = <&periph_clk>; + }; +- +- gic: interrupt-controller@21000 { +- compatible = "arm,cortex-a9-gic"; +- #interrupt-cells = <3>; +- #address-cells = <0>; +- interrupt-controller; +- reg = <0x21000 0x1000>, +- <0x20100 0x100>; +- }; +- +- L2: cache-controller@22000 { +- compatible = "arm,pl310-cache"; +- reg = <0x22000 0x1000>; +- cache-unified; +- arm,shared-override; +- prefetch-data = <1>; +- prefetch-instr = <1>; +- cache-level = <2>; +- }; + }; + + pmu { +@@ -301,18 +228,6 @@ + }; + }; + +- nand_controller: nand-controller@18028000 { +- compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1", "brcm,brcmnand"; +- reg = <0x18028000 0x600>, <0x1811a408 0x600>, <0x18028f00 0x20>; +- reg-names = "nand", "iproc-idm", "iproc-ext"; +- interrupts = ; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- brcm,nand-has-wp; +- }; +- + spi@18029200 { + compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; + reg = <0x18029200 0x184>, diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0005-ARM-dts-BCM5301X-Relicense-AXI-interrupts-code-to-th.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0005-ARM-dts-BCM5301X-Relicense-AXI-interrupts-code-to-th.patch new file mode 100644 index 00000000000000..ef29266d0b7ffb --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0005-ARM-dts-BCM5301X-Relicense-AXI-interrupts-code-to-th.patch @@ -0,0 +1,203 @@ +From 3b3e35b279bee5e51580c648399e20323467f58c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 May 2023 17:19:21 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Relicense AXI interrupts code to the GPL + 2.0+ / MIT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Those entries were added by: +1. Hauke in commits dec378827c4a ("ARM: BCM5301X: Add IRQs to Broadcom's + bus-axi in DTS file") and 1f80de6863ca ("ARM: BCM5301X: add IRQ + numbers for PCIe controller") +2. Florian in the commit 2cd0c0202f13 ("ARM: dts: BCM5301X: Add SRAB + interrupts") + +Move them to the bcm-ns.dtsi which uses dual licensing. That syncs more +Northstar code to be based on the same licensing schema. + +Signed-off-by: Rafał Miłecki +Cc: Hauke Mehrtens +Cc: Florian Fainelli +Acked-by: Hauke Mehrtens +Link: https://lore.kernel.org/r/20230515151921.25021-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-ns.dtsi | 73 ++++++++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm5301x.dtsi | 75 --------------------------------- + 2 files changed, 73 insertions(+), 75 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -92,6 +92,79 @@ + #address-cells = <1>; + #size-cells = <1>; + ++ #interrupt-cells = <1>; ++ interrupt-map-mask = <0x000fffff 0xffff>; ++ interrupt-map = ++ /* ChipCommon */ ++ <0x00000000 0 &gic GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* Switch Register Access Block */ ++ <0x00007000 0 &gic GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 1 &gic GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 2 &gic GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 3 &gic GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 4 &gic GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 5 &gic GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 6 &gic GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 7 &gic GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 8 &gic GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 9 &gic GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 10 &gic GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 11 &gic GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00007000 12 &gic GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* PCIe Controller 0 */ ++ <0x00012000 0 &gic GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 1 &gic GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 2 &gic GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 3 &gic GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 4 &gic GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00012000 5 &gic GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* PCIe Controller 1 */ ++ <0x00013000 0 &gic GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00013000 1 &gic GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00013000 2 &gic GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00013000 3 &gic GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00013000 4 &gic GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00013000 5 &gic GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* PCIe Controller 2 */ ++ <0x00014000 0 &gic GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00014000 1 &gic GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00014000 2 &gic GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00014000 3 &gic GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00014000 4 &gic GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00014000 5 &gic GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* USB 2.0 Controller */ ++ <0x00021000 0 &gic GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* USB 3.0 Controller */ ++ <0x00023000 0 &gic GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* Ethernet Controller 0 */ ++ <0x00024000 0 &gic GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* Ethernet Controller 1 */ ++ <0x00025000 0 &gic GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* Ethernet Controller 2 */ ++ <0x00026000 0 &gic GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* Ethernet Controller 3 */ ++ <0x00027000 0 &gic GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>, ++ ++ /* NAND Controller */ ++ <0x00028000 0 &gic GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00028000 1 &gic GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00028000 2 &gic GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00028000 3 &gic GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00028000 4 &gic GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00028000 5 &gic GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00028000 6 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, ++ <0x00028000 7 &gic GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; ++ + chipcommon: chipcommon@0 { + reg = <0x00000000 0x1000>; + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -3,8 +3,6 @@ + * Generic DTS part for all BCM53010, BCM53011, BCM53012, BCM53014, BCM53015, + * BCM53016, BCM53017, BCM53018, BCM4707, BCM4708 and BCM4709 SoCs + * +- * Copyright 2013-2014 Hauke Mehrtens +- * + * Licensed under the GNU/GPL. See COPYING for details. + */ + +@@ -72,79 +70,6 @@ + }; + + axi@18000000 { +- #interrupt-cells = <1>; +- interrupt-map-mask = <0x000fffff 0xffff>; +- interrupt-map = +- /* ChipCommon */ +- <0x00000000 0 &gic GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>, +- +- /* Switch Register Access Block */ +- <0x00007000 0 &gic GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 1 &gic GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 2 &gic GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 3 &gic GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 4 &gic GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 5 &gic GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 6 &gic GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 7 &gic GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 8 &gic GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 9 &gic GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 10 &gic GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 11 &gic GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>, +- <0x00007000 12 &gic GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>, +- +- /* PCIe Controller 0 */ +- <0x00012000 0 &gic GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>, +- <0x00012000 1 &gic GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>, +- <0x00012000 2 &gic GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>, +- <0x00012000 3 &gic GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>, +- <0x00012000 4 &gic GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>, +- <0x00012000 5 &gic GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, +- +- /* PCIe Controller 1 */ +- <0x00013000 0 &gic GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>, +- <0x00013000 1 &gic GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>, +- <0x00013000 2 &gic GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>, +- <0x00013000 3 &gic GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>, +- <0x00013000 4 &gic GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, +- <0x00013000 5 &gic GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, +- +- /* PCIe Controller 2 */ +- <0x00014000 0 &gic GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, +- <0x00014000 1 &gic GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, +- <0x00014000 2 &gic GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>, +- <0x00014000 3 &gic GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>, +- <0x00014000 4 &gic GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, +- <0x00014000 5 &gic GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>, +- +- /* USB 2.0 Controller */ +- <0x00021000 0 &gic GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>, +- +- /* USB 3.0 Controller */ +- <0x00023000 0 &gic GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>, +- +- /* Ethernet Controller 0 */ +- <0x00024000 0 &gic GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>, +- +- /* Ethernet Controller 1 */ +- <0x00025000 0 &gic GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>, +- +- /* Ethernet Controller 2 */ +- <0x00026000 0 &gic GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>, +- +- /* Ethernet Controller 3 */ +- <0x00027000 0 &gic GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>, +- +- /* NAND Controller */ +- <0x00028000 0 &gic GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>, +- <0x00028000 1 &gic GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, +- <0x00028000 2 &gic GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>, +- <0x00028000 3 &gic GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>, +- <0x00028000 4 &gic GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, +- <0x00028000 5 &gic GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, +- <0x00028000 6 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, +- <0x00028000 7 &gic GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; +- + pcie2: pcie@14000 { + reg = <0x00014000 0x1000>; + }; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0006-ARM-dts-BCM5301X-Specify-MAC-addresses-on-Luxul-devi.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0006-ARM-dts-BCM5301X-Specify-MAC-addresses-on-Luxul-devi.patch new file mode 100644 index 00000000000000..7d9b2971915090 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0006-ARM-dts-BCM5301X-Specify-MAC-addresses-on-Luxul-devi.patch @@ -0,0 +1,336 @@ +From dfa6570eb5ce2f24059caadbe2ed70034b5337bc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 15 May 2023 10:33:08 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Specify MAC addresses on Luxul devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use NRAM (NVMEM device) and its "et0macaddr" variable (NVMEM cell) to +point Ethernet devices to their MAC addresses. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230515083308.7612-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 13 +++++++++++++ + arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts | 13 +++++++++++++ + arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 13 +++++++++++++ + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 11 +++++++++++ + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 11 +++++++++++ + arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts | 13 +++++++++++++ + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 11 +++++++++++ + arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 13 +++++++++++++ + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 11 +++++++++++ + arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 5 ++++- + 10 files changed, 113 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -20,6 +20,14 @@ + reg = <0x00000000 0x08000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ }; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -53,6 +61,11 @@ + }; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts +@@ -24,6 +24,14 @@ + reg = <0x00000000 0x08000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ }; ++ }; ++ + nand_controller: nand-controller@18028000 { + nand@0 { + partitions { +@@ -60,6 +68,11 @@ + }; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -20,6 +20,14 @@ + reg = <0x00000000 0x08000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ }; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -53,6 +61,11 @@ + }; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -24,6 +24,10 @@ + nvram@1eff0000 { + compatible = "brcm,nvram"; + reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ #nvmem-cell-cells = <1>; ++ }; + }; + + leds { +@@ -106,6 +110,11 @@ + vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr 0>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +@@ -137,6 +146,8 @@ + port@4 { + reg = <4>; + label = "wan"; ++ nvmem-cells = <&et0macaddr 5>; ++ nvmem-cell-names = "mac-address"; + }; + + port@5 { +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -25,6 +25,10 @@ + nvram@1eff0000 { + compatible = "brcm,nvram"; + reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ #nvmem-cell-cells = <1>; ++ }; + }; + + leds { +@@ -61,6 +65,11 @@ + vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr 0>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +@@ -76,6 +85,8 @@ + port@0 { + reg = <0>; + label = "wan"; ++ nvmem-cells = <&et0macaddr 1>; ++ nvmem-cell-names = "mac-address"; + }; + + port@1 { +--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts +@@ -20,6 +20,14 @@ + reg = <0x00000000 0x08000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ }; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -51,6 +59,11 @@ + }; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -25,6 +25,10 @@ + nvram@1eff0000 { + compatible = "brcm,nvram"; + reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ #nvmem-cell-cells = <1>; ++ }; + }; + + leds { +@@ -61,6 +65,11 @@ + vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr 0>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +@@ -76,6 +85,8 @@ + port@0 { + reg = <0>; + label = "wan"; ++ nvmem-cells = <&et0macaddr 1>; ++ nvmem-cell-names = "mac-address"; + }; + + port@1 { +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -22,6 +22,14 @@ + <0x88000000 0x18000000>; + }; + ++ nvram@1eff0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ }; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -47,6 +55,11 @@ + status = "okay"; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -25,6 +25,10 @@ + nvram@1eff0000 { + compatible = "brcm,nvram"; + reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ #nvmem-cell-cells = <1>; ++ }; + }; + + leds { +@@ -101,6 +105,11 @@ + vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr 0>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +@@ -136,6 +145,8 @@ + port@4 { + reg = <4>; + label = "wan"; ++ nvmem-cells = <&et0macaddr 5>; ++ nvmem-cell-names = "mac-address"; + }; + + port@5 { +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -27,6 +27,7 @@ + reg = <0x1eff0000 0x10000>; + + et0macaddr: et0macaddr { ++ #nvmem-cell-cells = <1>; + }; + }; + +@@ -76,7 +77,7 @@ + }; + + &gmac0 { +- nvmem-cells = <&et0macaddr>; ++ nvmem-cells = <&et0macaddr 0>; + nvmem-cell-names = "mac-address"; + }; + +@@ -119,6 +120,8 @@ + port@4 { + reg = <4>; + label = "wan"; ++ nvmem-cells = <&et0macaddr 5>; ++ nvmem-cell-names = "mac-address"; + }; + + port@5 { diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0007-ARM-dts-BCM5301X-Use-updated-device-compatible-strin.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0007-ARM-dts-BCM5301X-Use-updated-device-compatible-strin.patch new file mode 100644 index 00000000000000..5f5890e2915f3c --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0007-ARM-dts-BCM5301X-Use-updated-device-compatible-strin.patch @@ -0,0 +1,90 @@ +From 9d7121f1d2faa0b50bf5b462adcd2dd91970c45e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 20 May 2023 13:26:01 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Use updated device "compatible" strings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Northstar binding was updated to use minus/hyphen char between model and +version for all devices. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20230520112601.11821-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 2 +- + arch/arm/boot/dts/bcm4708-netgear-r6250.dts | 2 +- + arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts | 2 +- + arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 2 +- + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 2 +- + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 2 +- + 6 files changed, 6 insertions(+), 6 deletions(-) + +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -8,7 +8,7 @@ + #include "bcm4708.dtsi" + + / { +- compatible = "luxul,xap-1510v1", "brcm,bcm4708"; ++ compatible = "luxul,xap-1510-v1", "brcm,bcm4708"; + model = "Luxul XAP-1510 V1"; + + chosen { +--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts +@@ -13,7 +13,7 @@ + #include "bcm5301x-nand-cs0-bch8.dtsi" + + / { +- compatible = "netgear,r6250v1", "brcm,bcm4708"; ++ compatible = "netgear,r6250-v1", "brcm,bcm4708"; + model = "Netgear R6250 V1 (BCM4708)"; + + chosen { +--- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts +@@ -12,7 +12,7 @@ + #include "bcm5301x-nand-cs0-bch8.dtsi" + + / { +- compatible = "netgear,r6300v2", "brcm,bcm4708"; ++ compatible = "netgear,r6300-v2", "brcm,bcm4708"; + model = "Netgear R6300 V2 (BCM4708)"; + + chosen { +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -8,7 +8,7 @@ + #include "bcm47081.dtsi" + + / { +- compatible = "luxul,xap-1410v1", "brcm,bcm47081", "brcm,bcm4708"; ++ compatible = "luxul,xap-1410-v1", "brcm,bcm47081", "brcm,bcm4708"; + model = "Luxul XAP-1410 V1"; + + chosen { +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -9,7 +9,7 @@ + #include "bcm5301x-nand-cs0-bch4.dtsi" + + / { +- compatible = "luxul,xwr-1200v1", "brcm,bcm47081", "brcm,bcm4708"; ++ compatible = "luxul,xwr-1200-v1", "brcm,bcm47081", "brcm,bcm4708"; + model = "Luxul XWR-1200 V1"; + + chosen { +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -9,7 +9,7 @@ + #include "bcm5301x-nand-cs0-bch4.dtsi" + + / { +- compatible = "luxul,xwr-3100v1", "brcm,bcm47094", "brcm,bcm4708"; ++ compatible = "luxul,xwr-3100-v1", "brcm,bcm47094", "brcm,bcm4708"; + model = "Luxul XWR-3100 V1"; + + chosen { diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0008-ARM-dts-BCM5301X-Use-updated-spi-gpio-binding-proper.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0008-ARM-dts-BCM5301X-Use-updated-spi-gpio-binding-proper.patch new file mode 100644 index 00000000000000..c16587f6840d02 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0008-ARM-dts-BCM5301X-Use-updated-spi-gpio-binding-proper.patch @@ -0,0 +1,82 @@ +From 04afb51c1dce90051487d3c7b70a1b1b246ce29a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 2 Jun 2023 17:10:23 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Use updated "spi-gpio" binding properties +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Switch away from deprecated properties. + +This fixes: +arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dtb: spi: gpio-sck: False schema does not allow [[6, 7, 0]] + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml +arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dtb: spi: gpio-mosi: False schema does not allow [[6, 4, 0]] + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml +arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dtb: spi: 'sck-gpios' is a required property + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml +arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dtb: spi: Unevaluated properties are not allowed ('gpio-mosi', 'gpio-sck' were unexpected) + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230602151023.8607-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi | 4 ++-- + arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts | 4 ++-- + arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 4 ++-- + arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts | 4 ++-- + 4 files changed, 8 insertions(+), 8 deletions(-) + +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi +@@ -16,8 +16,8 @@ + spi { + compatible = "spi-gpio"; + num-chipselects = <1>; +- gpio-sck = <&chipcommon 7 0>; +- gpio-mosi = <&chipcommon 4 0>; ++ sck-gpios = <&chipcommon 7 0>; ++ mosi-gpios = <&chipcommon 4 0>; + cs-gpios = <&chipcommon 6 0>; + #address-cells = <1>; + #size-cells = <0>; +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +@@ -28,8 +28,8 @@ + spi { + compatible = "spi-gpio"; + num-chipselects = <1>; +- gpio-sck = <&chipcommon 7 0>; +- gpio-mosi = <&chipcommon 4 0>; ++ sck-gpios = <&chipcommon 7 0>; ++ mosi-gpios = <&chipcommon 4 0>; + cs-gpios = <&chipcommon 6 0>; + #address-cells = <1>; + #size-cells = <0>; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -28,8 +28,8 @@ + spi { + compatible = "spi-gpio"; + num-chipselects = <1>; +- gpio-sck = <&chipcommon 7 0>; +- gpio-mosi = <&chipcommon 4 0>; ++ sck-gpios = <&chipcommon 7 0>; ++ mosi-gpios = <&chipcommon 4 0>; + cs-gpios = <&chipcommon 6 0>; + #address-cells = <1>; + #size-cells = <0>; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts +@@ -28,8 +28,8 @@ + spi { + compatible = "spi-gpio"; + num-chipselects = <1>; +- gpio-sck = <&chipcommon 7 0>; +- gpio-mosi = <&chipcommon 4 0>; ++ sck-gpios = <&chipcommon 7 0>; ++ mosi-gpios = <&chipcommon 4 0>; + cs-gpios = <&chipcommon 6 0>; + #address-cells = <1>; + #size-cells = <0>; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0009-ARM-dts-BCM5301X-Drop-invalid-usb-cells.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0009-ARM-dts-BCM5301X-Drop-invalid-usb-cells.patch new file mode 100644 index 00000000000000..59fa457aee6972 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0009-ARM-dts-BCM5301X-Drop-invalid-usb-cells.patch @@ -0,0 +1,54 @@ +From c3acdd4901192bc69dc577012663d5abae21661e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 2 Jun 2023 15:34:54 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Drop invalid #usb-cells +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Such property simply doesn't exist (is not documented or used anywhere). + +This fixes: +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: usb@21000: Unevaluated properties are not allowed ('#usb-cells' was unexpected) + From schema: Documentation/devicetree/bindings/usb/generic-ehci.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: usb@22000: Unevaluated properties are not allowed ('#usb-cells' was unexpected) + From schema: Documentation/devicetree/bindings/usb/generic-ohci.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: usb@23000: Unevaluated properties are not allowed ('#usb-cells' was unexpected) + From schema: Documentation/devicetree/bindings/usb/generic-xhci.yaml + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230602133455.7441-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-ns.dtsi | 6 ------ + 1 file changed, 6 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -192,8 +192,6 @@ + interrupt-parent = <&gic>; + + ehci: usb@21000 { +- #usb-cells = <0>; +- + compatible = "generic-ehci"; + reg = <0x00021000 0x1000>; + interrupts = ; +@@ -214,8 +212,6 @@ + }; + + ohci: usb@22000 { +- #usb-cells = <0>; +- + compatible = "generic-ohci"; + reg = <0x00022000 0x1000>; + interrupts = ; +@@ -245,8 +241,6 @@ + interrupt-parent = <&gic>; + + xhci: usb@23000 { +- #usb-cells = <0>; +- + compatible = "generic-xhci"; + reg = <0x00023000 0x1000>; + interrupts = ; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0010-ARM-dts-BCM5301X-Drop-invalid-properties-from-Meraki.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0010-ARM-dts-BCM5301X-Drop-invalid-properties-from-Meraki.patch new file mode 100644 index 00000000000000..b8411fc7196ea2 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0010-ARM-dts-BCM5301X-Drop-invalid-properties-from-Meraki.patch @@ -0,0 +1,31 @@ +From 676bf7d062c14191c3fc12f1e36e1f3809041483 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 2 Jun 2023 15:34:55 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Drop invalid properties from Meraki MR32 + keys +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes: +arch/arm/boot/dts/bcm53015-meraki-mr26.dtb: keys: '#address-cells', '#size-cells' do not match any of the regexes: '^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$', 'pinctrl-[0-9]+' + From schema: Documentation/devicetree/bindings/input/gpio-keys.yaml + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230602133455.7441-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 2 -- + 1 file changed, 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts +@@ -39,8 +39,6 @@ + + keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + key-restart { + label = "Reset"; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0011-ARM-dts-BCM5301X-Relicense-Christian-s-code-to-the-G.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0011-ARM-dts-BCM5301X-Relicense-Christian-s-code-to-the-G.patch new file mode 100644 index 00000000000000..7496321269f542 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0011-ARM-dts-BCM5301X-Relicense-Christian-s-code-to-the-G.patch @@ -0,0 +1,106 @@ +From 1d5682ccc7d6088179b6cfd50a3e3bb6d2b0527e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 5 Jun 2023 08:10:49 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Relicense Christian's code to the GPL + 2.0+ / MIT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move code added by Christian to the bcm-ns.dtsi which uses dual +licensing. That syncs more Northstar code to be based on the same +licensing schema. + +Cc: Christian Lamparter +Signed-off-by: Rafał Miłecki +Acked-by: Christian Lamparter +Link: https://lore.kernel.org/r/20230605061049.16136-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-ns.dtsi | 21 +++++++++++++++++++++ + arch/arm/boot/dts/bcm5301x.dtsi | 23 ----------------------- + 2 files changed, 21 insertions(+), 23 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -182,6 +182,10 @@ + reg = <0x00013000 0x1000>; + }; + ++ pcie2: pcie@14000 { ++ reg = <0x00014000 0x1000>; ++ }; ++ + usb2: usb2@21000 { + reg = <0x00021000 0x1000>; + +@@ -274,6 +278,14 @@ + }; + }; + ++ pwm: pwm@18002000 { ++ compatible = "brcm,iproc-pwm"; ++ reg = <0x18002000 0x28>; ++ clocks = <&osc>; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ + mdio: mdio@18003000 { + compatible = "brcm,iproc-mdio"; + reg = <0x18003000 0x8>; +@@ -299,6 +311,15 @@ + }; + }; + ++ uart2: serial@18008000 { ++ compatible = "ns16550a"; ++ reg = <0x18008000 0x20>; ++ clocks = <&iprocslow>; ++ interrupts = ; ++ reg-shift = <2>; ++ status = "disabled"; ++ }; ++ + dmu-bus@1800c000 { + compatible = "simple-bus"; + ranges = <0 0x1800c000 0x1000>; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -69,20 +69,6 @@ + }; + }; + +- axi@18000000 { +- pcie2: pcie@14000 { +- reg = <0x00014000 0x1000>; +- }; +- }; +- +- pwm: pwm@18002000 { +- compatible = "brcm,iproc-pwm"; +- reg = <0x18002000 0x28>; +- clocks = <&osc>; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- + mdio-mux@18003000 { + compatible = "mdio-mux-mmioreg", "mdio-mux"; + mdio-parent-bus = <&mdio>; +@@ -110,15 +96,6 @@ + reg = <0x18105000 0x1000>; + }; + +- uart2: serial@18008000 { +- compatible = "ns16550a"; +- reg = <0x18008000 0x20>; +- clocks = <&iprocslow>; +- interrupts = ; +- reg-shift = <2>; +- status = "disabled"; +- }; +- + i2c0: i2c@18009000 { + compatible = "brcm,iproc-i2c"; + reg = <0x18009000 0x50>; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0012-ARM-dts-BCM5301X-Describe-switch-ports-in-the-main-D.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0012-ARM-dts-BCM5301X-Describe-switch-ports-in-the-main-D.patch new file mode 100644 index 00000000000000..fa2f21af532504 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0012-ARM-dts-BCM5301X-Describe-switch-ports-in-the-main-D.patch @@ -0,0 +1,838 @@ +From ba4aebce23b2affb810b8a60eae853674d2cded2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 5 Jun 2023 15:21:09 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Describe switch ports in the main DTS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +All Northstar SoCs have BCM5301x switches (BCM53011, BCM53012) with 8 +ports (0-8 without 6). By design 3 switch ports (5, 7 and 8) are +hardwired to 3 on-SoC Ethernet interfaces. Switch port 8 requires +forcing link state. + +It seems that global Northstar .dtsi file is the best place to describe +those hw details. Only device specific bits (like labels) should go to +device .dts files. + +This seems to fit well with a tiny exception of Asus RT-AC88U which +somehow was designed to have switch 5 connected to an extra switch. This +case was simply handled with a /delete-property/. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Christian Lamparter (MR32+MR26) +Link: https://lore.kernel.org/r/20230605132109.7933-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-ns.dtsi | 41 ++++++++++++++++++- + .../bcm4708-buffalo-wzr-1166dhp-common.dtsi | 7 ---- + arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 4 -- + arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts | 3 -- + arch/arm/boot/dts/bcm4708-netgear-r6250.dts | 7 ---- + arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts | 7 ---- + .../boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 7 ---- + arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 3 -- + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 7 ---- + arch/arm/boot/dts/bcm4709-netgear-r8000.dts | 12 ------ + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 17 +------- + arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 12 ------ + arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts | 12 ------ + .../boot/dts/bcm47094-linksys-panamera.dts | 34 ++++----------- + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 7 ---- + arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts | 4 -- + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 7 ---- + arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 3 -- + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 7 ---- + .../boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 7 ---- + arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 3 -- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 3 -- + 22 files changed, 51 insertions(+), 163 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -304,10 +304,49 @@ + + status = "disabled"; + +- /* ports are defined in board DTS */ + ports { + #address-cells = <1>; + #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ ethernet = <&gmac0>; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ ethernet = <&gmac1>; ++ }; ++ ++ port@8 { ++ reg = <8>; ++ ethernet = <&gmac2>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; + }; + }; + +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi +@@ -159,34 +159,27 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan1"; + }; + + port@1 { +- reg = <1>; + label = "lan2"; + }; + + port@2 { +- reg = <2>; + label = "lan3"; + }; + + port@3 { +- reg = <3>; + label = "lan4"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -75,19 +75,15 @@ + + ports { + port@0 { +- reg = <0>; + label = "poe"; + }; + + port@4 { +- reg = <4>; + label = "lan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts +@@ -82,14 +82,11 @@ + + ports { + port@4 { +- reg = <4>; + label = "lan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts +@@ -100,34 +100,27 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan4"; + }; + + port@1 { +- reg = <1>; + label = "lan3"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan1"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts ++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts +@@ -123,34 +123,27 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan4"; + }; + + port@1 { +- reg = <1>; + label = "lan3"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan1"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -123,34 +123,27 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan1"; + }; + + port@1 { +- reg = <1>; + label = "lan2"; + }; + + port@2 { +- reg = <2>; + label = "lan3"; + }; + + port@3 { +- reg = <3>; + label = "lan4"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -75,14 +75,11 @@ + + ports { + port@4 { +- reg = <4>; + label = "poe"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -124,36 +124,29 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan4"; + }; + + port@1 { +- reg = <1>; + label = "lan3"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan1"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + nvmem-cells = <&et0macaddr 5>; + nvmem-cell-names = "mac-address"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -191,39 +191,27 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan1"; + }; + + port@1 { +- reg = <1>; + label = "lan2"; + }; + + port@2 { +- reg = <2>; + label = "lan3"; + }; + + port@3 { +- reg = <3>; + label = "lan4"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@8 { +- reg = <8>; + label = "cpu"; +- ethernet = <&gmac2>; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -181,32 +181,28 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan4"; + }; + + port@1 { +- reg = <1>; + label = "lan3"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan1"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + sw0_p5: port@5 { +- reg = <5>; ++ /delete-property/ethernet; ++ + label = "extsw"; + phy-mode = "rgmii"; + +@@ -218,8 +214,6 @@ + }; + + port@7 { +- reg = <7>; +- ethernet = <&gmac1>; + label = "cpu"; + + fixed-link { +@@ -229,14 +223,7 @@ + }; + + port@8 { +- reg = <8>; +- ethernet = <&gmac2>; + label = "cpu"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -124,39 +124,27 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan4"; + }; + + port@1 { +- reg = <1>; + label = "lan3"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan1"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@8 { +- reg = <8>; + label = "cpu"; +- ethernet = <&gmac2>; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts +@@ -172,40 +172,28 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan1"; + }; + + port@1 { +- reg = <1>; + label = "lan2"; + }; + + port@2 { +- reg = <2>; + label = "lan3"; + }; + + port@3 { +- reg = <3>; + label = "lan4"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@8 { +- reg = <8>; + label = "cpu"; +- ethernet = <&gmac2>; + phy-mode = "rgmii"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -207,29 +207,32 @@ + dsa,member = <0 0>; + + ports { ++ sw0_p0: port@0 { ++ label = "extsw"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ + port@1 { +- reg = <1>; + label = "lan7"; + }; + + port@2 { +- reg = <2>; + label = "lan4"; + }; + + port@3 { +- reg = <3>; + label = "lan8"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + }; + + port@5 { +- reg = <5>; +- ethernet = <&gmac0>; + label = "cpu"; + status = "disabled"; + +@@ -240,8 +243,6 @@ + }; + + port@7 { +- reg = <7>; +- ethernet = <&gmac1>; + label = "cpu"; + status = "disabled"; + +@@ -252,24 +253,7 @@ + }; + + port@8 { +- reg = <8>; +- ethernet = <&gmac2>; + label = "cpu"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; +- }; +- +- sw0_p0: port@0 { +- reg = <0>; +- label = "extsw"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -83,36 +83,29 @@ + + ports { + port@0 { +- reg = <0>; + label = "wan"; + nvmem-cells = <&et0macaddr 1>; + nvmem-cell-names = "mac-address"; + }; + + port@1 { +- reg = <1>; + label = "lan4"; + }; + + port@2 { +- reg = <2>; + label = "lan3"; + }; + + port@3 { +- reg = <3>; + label = "lan2"; + }; + + port@4 { +- reg = <4>; + label = "lan1"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts +@@ -73,19 +73,15 @@ + + ports { + port@0 { +- reg = <0>; + label = "poe"; + }; + + port@1 { +- reg = <1>; + label = "lan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -83,36 +83,29 @@ + + ports { + port@0 { +- reg = <0>; + label = "wan"; + nvmem-cells = <&et0macaddr 1>; + nvmem-cell-names = "mac-address"; + }; + + port@1 { +- reg = <1>; + label = "lan4"; + }; + + port@2 { +- reg = <2>; + label = "lan3"; + }; + + port@3 { +- reg = <3>; + label = "lan2"; + }; + + port@4 { +- reg = <4>; + label = "lan1"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -69,14 +69,11 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -123,36 +123,29 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan4"; + }; + + port@1 { +- reg = <1>; + label = "lan3"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan1"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + nvmem-cells = <&et0macaddr 5>; + nvmem-cell-names = "mac-address"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -98,36 +98,29 @@ + + ports { + port@0 { +- reg = <0>; + label = "lan4"; + }; + + port@1 { +- reg = <1>; + label = "lan3"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan1"; + }; + + port@4 { +- reg = <4>; + label = "wan"; + nvmem-cells = <&et0macaddr 5>; + nvmem-cell-names = "mac-address"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts +@@ -115,14 +115,11 @@ + + ports { + port@0 { +- reg = <0>; + label = "poe"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + + fixed-link { + speed = <1000>; +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -176,14 +176,11 @@ + + ports { + port@0 { +- reg = <0>; + label = "poe"; + }; + + port@5 { +- reg = <5>; + label = "cpu"; +- ethernet = <&gmac0>; + + fixed-link { + speed = <1000>; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0013-ARM-dts-BCM5301X-MR26-MR32-remove-bogus-nand-ecc-alg.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0013-ARM-dts-BCM5301X-MR26-MR32-remove-bogus-nand-ecc-alg.patch new file mode 100644 index 00000000000000..ea571f459ab5a9 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0013-ARM-dts-BCM5301X-MR26-MR32-remove-bogus-nand-ecc-alg.patch @@ -0,0 +1,63 @@ +From a6a1a156f5debaebf9f61850d111b966e9be9ee9 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 8 Jun 2023 17:36:27 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: MR26: MR32: remove bogus nand-ecc-algo + property +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +| bcm53015-meraki-mr26.dtb: nand-controller@18028000: +| nand@0:nand-ecc-algo:0: 'hw' is not one of ['hamming', 'bch', 'rs'] +| From schema: Documentation/[...]/nand-controller.yaml +| bcm53016-meraki-mr32.dtb: nand-controller@18028000: +| nand@0:nand-ecc-algo:0: 'hw' is not one of ['hamming', 'bch', 'rs'] +| From schema: Documentation/[...]/nand-controller.yaml + +original ECC values for these old Merakis are sadly not +provided by the vendor. It looks like Meraki just stuck +with what Broadcom's SDK was doing... which left this +up to the proprietary nand driver. + +Note: The invalid setting was and is handled by brcmnand. It +falls back to "bch" in brcmnand_setup_dev() when ecc.algo is +set to NAND_ECC_ALGO_UNKNOWN (since "hw" is not in the list +above). + +A correct nand-ecc-algo = "bch"; is already specified in the +included "bcm5301x-nand-cs0-bch8.dtsi". So this line can be +dropped. + +Reported-by: Rafał Miłecki (per Mail) +Fixes: 935327a73553 ("ARM: dts: BCM5301X: Add DT for Meraki MR26") +Fixes: ec88a9c344d9 ("ARM: BCM5301X: Add DT for Meraki MR32") +Signed-off-by: Christian Lamparter +Link: https://lore.kernel.org/r/2c4d00dd40124c2ddc0b139cbce7531b108f9052.1686238550.git.chunkeey@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 2 -- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 2 -- + 2 files changed, 4 deletions(-) + +--- a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts +@@ -72,8 +72,6 @@ + }; + + &nandcs { +- nand-ecc-algo = "hw"; +- + partitions { + compatible = "fixed-partitions"; + #address-cells = <0x1>; +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -125,8 +125,6 @@ + }; + + &nandcs { +- nand-ecc-algo = "hw"; +- + partitions { + /* + * The partition autodetection does not work for this device. diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0014-ARM-dts-BCM5301X-MR32-remove-partition-index-numbers.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0014-ARM-dts-BCM5301X-MR32-remove-partition-index-numbers.patch new file mode 100644 index 00000000000000..8eb5442d1714f9 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0014-ARM-dts-BCM5301X-MR32-remove-partition-index-numbers.patch @@ -0,0 +1,54 @@ +From d68b2f7d7d06872450d4f39d84d5926d7e7ae88c Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 8 Jun 2023 17:36:28 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: MR32: remove partition index numbers + +removes the partition indexes in the node names under. +This brings the device tree source in line with others. + +Signed-off-by: Christian Lamparter +Link: https://lore.kernel.org/r/627f57d568030a56499361790524b4d4f3381619.1686238550.git.chunkeey@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -138,31 +138,31 @@ + #address-cells = <0x1>; + #size-cells = <0x1>; + +- partition0@0 { ++ partition@0 { + label = "u-boot"; + reg = <0x0 0x100000>; + read-only; + }; + +- partition1@100000 { ++ partition@100000 { + label = "bootkernel1"; + reg = <0x100000 0x300000>; + read-only; + }; + +- partition2@400000 { ++ partition@400000 { + label = "nvram"; + reg = <0x400000 0x100000>; + read-only; + }; + +- partition3@500000 { ++ partition@500000 { + label = "bootkernel2"; + reg = <0x500000 0x300000>; + read-only; + }; + +- partition4@800000 { ++ partition@800000 { + label = "ubi"; + reg = <0x800000 0x7780000>; + }; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch new file mode 100644 index 00000000000000..805dcf54ebbda4 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch @@ -0,0 +1,44 @@ +From fd274b733bfdde3ca72f0fa2a37f032f3a8c402c Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 8 Jun 2023 17:36:29 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: fix duplex-full => full-duplex + +this typo was found by the dtbs_check +| ports:port@5:fixed-link: 'oneOf' conditional failed, +| {'speed': [[1000]], 'duplex-full': True} is not of type 'array' +| 'duplex-full' does not match any of the regexes: 'pinctrl-[0-]..." + +this should have been full-duplex; + +Fixes: 935327a73553 ("ARM: dts: BCM5301X: Add DT for Meraki MR26") +Fixes: ec88a9c344d9 ("ARM: BCM5301X: Add DT for Meraki MR32") +Signed-off-by: Christian Lamparter +Link: https://lore.kernel.org/r/50522f45566951a9eabd22820647924cc6b4a264.1686238550.git.chunkeey@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 2 +- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts +@@ -121,7 +121,7 @@ + + fixed-link { + speed = <1000>; +- duplex-full; ++ full-duplex; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -182,7 +182,7 @@ + + fixed-link { + speed = <1000>; +- duplex-full; ++ full-duplex; + }; + }; + }; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0016-ARM-dts-BCM5301X-Add-Netgear-R8000-WiFi-regulator-ma.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0016-ARM-dts-BCM5301X-Add-Netgear-R8000-WiFi-regulator-ma.patch new file mode 100644 index 00000000000000..3ffe0b2f170e53 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0016-ARM-dts-BCM5301X-Add-Netgear-R8000-WiFi-regulator-ma.patch @@ -0,0 +1,61 @@ +From 752a63b8dbe6cc6900efd1035bea427a778a4b55 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 2 Jun 2023 15:59:25 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Add Netgear R8000 WiFi regulator mappings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows setting FullMAC firmware regulatory domain. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230602135925.14143-3-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4709-netgear-r8000.dts | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -137,8 +137,10 @@ + #size-cells = <2>; + + wifi@0,1,0 { ++ compatible = "brcm,bcm4366-fmac", "brcm,bcm4329-fmac"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5735000 5835000>; ++ brcm,ccode-map = "JP-JP-78", "US-Q2-86"; + }; + }; + }; +@@ -159,6 +161,19 @@ + #address-cells = <3>; + #size-cells = <2>; + ++ bridge@1,0 { ++ reg = <0x800 0 0 0 0>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ wifi@0,0 { ++ compatible = "brcm,bcm4366-fmac", "brcm,bcm4329-fmac"; ++ reg = <0x0000 0 0 0 0>; ++ brcm,ccode-map = "JP-JP-78", "US-Q2-86"; ++ }; ++ }; ++ + bridge@1,2,2 { + reg = <0x1000 0 0 0 0>; + +@@ -166,8 +181,10 @@ + #size-cells = <2>; + + wifi@1,4,0 { ++ compatible = "brcm,bcm4366-fmac", "brcm,bcm4329-fmac"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5170000 5730000>; ++ brcm,ccode-map = "JP-JP-78", "US-Q2-86"; + }; + }; + }; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0017-ARM-dts-BCM5301X-Add-cells-sizes-to-PCIe-nodes.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0017-ARM-dts-BCM5301X-Add-cells-sizes-to-PCIe-nodes.patch new file mode 100644 index 00000000000000..454ce4c278f5b6 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0017-ARM-dts-BCM5301X-Add-cells-sizes-to-PCIe-nodes.patch @@ -0,0 +1,59 @@ +From b67cad33176e472df6d16a24ee7624299bdcd5d5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Jun 2023 12:58:27 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Add cells sizes to PCIe nodes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes: +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: pcie@12000: '#address-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: pcie@12000: '#size-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: pcie@13000: '#address-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: pcie@13000: '#size-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: pcie@14000: '#address-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: pcie@14000: '#size-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml + +Two properties that need to be added later are "device_type" and +"ranges". Adding "device_type" on its own causes a new warning and the +value of "ranges" needs to be determined yet. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230616105827.21656-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-ns.dtsi | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -176,14 +176,23 @@ + + pcie0: pcie@12000 { + reg = <0x00012000 0x1000>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; + }; + + pcie1: pcie@13000 { + reg = <0x00013000 0x1000>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; + }; + + pcie2: pcie@14000 { + reg = <0x00014000 0x1000>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; + }; + + usb2: usb2@21000 { diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.2-bcma-support-SPROM-rev-11.patch b/target/linux/bcm53xx/patches-5.15/080-v6.2-bcma-support-SPROM-rev-11.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.15/036-v6.2-bcma-support-SPROM-rev-11.patch rename to target/linux/bcm53xx/patches-5.15/080-v6.2-bcma-support-SPROM-rev-11.patch diff --git a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch index 0fb29e99d34f71..d15506f6d7b339 100644 --- a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch +++ b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts +++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts -@@ -93,3 +93,40 @@ +@@ -92,3 +92,40 @@ &usb3_phy { status = "okay"; }; From 7bb616d3006e5efc7474e552e861bfece453fa70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 15 Jun 2023 15:59:44 +0200 Subject: [PATCH 0260/1171] ath79: mikrotik: extract common bits for RB951x-2HnD devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mikrotik RouterBOARD 951Ui-2HnD and Mikrotik RouterBOARD RB951G-2HnD are very similar devices. Extract the DTS bits that are identical for these two boards to a separate DTSI file. Signed-off-by: Michał Kępień (cherry picked from commit c6ef4170945c6ab5432382110389f31fea92a76c) --- ...ar9344_mikrotik_routerboard-951ui-2hnd.dts | 81 +----------------- ...ar9344_mikrotik_routerboard-951x-2hnd.dtsi | 82 +++++++++++++++++++ 2 files changed, 83 insertions(+), 80 deletions(-) create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts index 3d59a30f1128fa..65003cb9a1fa02 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "ar9344_mikrotik_routerboard.dtsi" +#include "ar9344_mikrotik_routerboard-951x-2hnd.dtsi" / { compatible = "mikrotik,routerboard-951ui-2hnd", "qca,ar9344"; @@ -59,77 +59,6 @@ }; }; -&gpio { - nand_power { - gpio-hog; - gpios = <14 GPIO_ACTIVE_LOW>; - output-high; - }; -}; - -&nand { - status = "okay"; - - nand-ecc-mode = "soft"; - qca,nand-swap-dma; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "booter"; - reg = <0x0000000 0x0040000>; - read-only; - }; - - partition@40000 { - label = "kernel"; - reg = <0x0040000 0x03c0000>; - }; - - partition@400000 { - label = "ubi"; - reg = <0x0400000 0x7c00000>; - }; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "mikrotik,routerboot-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "routerboot"; - reg = <0x0 0x0>; - read-only; - }; - - hard_config: hard_config { - read-only; - }; - - bios { - size = <0x1000>; - read-only; - }; - - soft_config { - }; - }; - }; -}; - ð0 { phy-handle = <&swphy4>; @@ -143,11 +72,3 @@ &wmac { qca,led-pin = /bits/ 8 <11>; }; - -&usb { - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi new file mode 100644 index 00000000000000..5d135f1ca6d053 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_mikrotik_routerboard.dtsi" + +&gpio { + nand_power { + gpio-hog; + gpios = <14 GPIO_ACTIVE_LOW>; + output-high; + }; +}; + +&nand { + status = "okay"; + + nand-ecc-mode = "soft"; + qca,nand-swap-dma; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "booter"; + reg = <0x0000000 0x0040000>; + read-only; + }; + + partition@40000 { + label = "kernel"; + reg = <0x0040000 0x03c0000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x0400000 0x7c00000>; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "routerboot"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config: hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + soft_config { + }; + }; + }; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; From 98b397d4fb56a7049eeda00ff138f439db32dcef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Sat, 17 Jun 2023 19:12:21 +0200 Subject: [PATCH 0261/1171] ath79: add support for MikroTik RB951G-2HnD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MikroTik RB951G-2HnD is a wireless SOHO router that was previously supported by the ar71xx target, see commit 7a709573d7 ("ar71xx: add kernel support for the Mikrotik RB951G board"). Specifications -------------- - SoC: Atheros AR9344 (600 MHz) - RAM: 128 MB (2x 64 MB) - Storage: 128 MB NAND flash (various manufacturers) - Ethernet: Atheros AR8327 switch, 5x 10/100/1000 Mbit/s - 1x PoE in (port 1, 8-30 V input) - Wireless: Atheros AR9340 (802.11b/g/n) - USB: 2.0 (1A) - 8x LED: - 1x power (green, not configurable) - 1x user (green, not configurable) - 5x GE ports (green, not configurable) - 1x wireless (green, not configurable) - 1x button (restart) Unlike on the RB951Ui-2HnD, none of the LEDs on this device seem to be GPIO-controllable, which was also the case for older OpenWRT versions that supported this board via a mach file. The Ethernet port LEDs are controlled by the switch chip. See https://mikrotik.com/product/RB951G-2HnD for more details. Flashing -------- TFTP boot initramfs image and then perform sysupgrade. Follow common MikroTik procedures at https://openwrt.org/toh/mikrotik/common. Signed-off-by: Michał Kępień (cherry picked from commit db02cecd6ad2e5962e6e9d8307da34855a083ad6) --- .../ar9344_mikrotik_routerboard-951g-2hnd.dts | 58 +++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 9 +++ .../base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + .../base-files/lib/upgrade/platform.sh | 1 + 5 files changed, 70 insertions(+) create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts new file mode 100644 index 00000000000000..16da7a3c950803 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_mikrotik_routerboard-951x-2hnd.dtsi" + +/ { + compatible = "mikrotik,routerboard-951g-2hnd", "qca,ar9344"; + model = "Mikrotik RouterBOARD 951G-2HnD"; + + /delete-node/ aliases; + /delete-node/ leds; + + gpio-export { + compatible = "gpio-export"; + + gpio_usb_power { + gpio-export,name = "rb951g-2hnd:power:usb"; + gpio-export,output = <1>; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&ref { + clock-frequency = <25000000>; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PAD0_MODE */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x6f000000 0x00000101 0x00001616>; + + phy-mode = "rgmii"; + phy-handle = <&phy0>; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + rxd-delay = <1>; + switch-only-mode = <1>; + }; +}; + +ð1 { + status = "disabled"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 3f65b35c8c5627..683e9a33304dc0 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -48,6 +48,15 @@ define Device/mikrotik_routerboard-922uags-5hpacd endef TARGET_DEVICES += mikrotik_routerboard-922uags-5hpacd +define Device/mikrotik_routerboard-951g-2hnd + $(Device/mikrotik_nand) + SOC := ar9344 + DEVICE_MODEL := RouterBOARD 951G-2HnD + DEVICE_PACKAGES += kmod-usb-ohci kmod-usb2 + SUPPORTED_DEVICES += rb-951g-2hnd +endef +TARGET_DEVICES += mikrotik_routerboard-951g-2hnd + define Device/mikrotik_routerboard-951ui-2hnd $(Device/mikrotik_nand) SOC := ar9344 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index aba811fb2d15a7..68c8cfb96e7534 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -35,6 +35,7 @@ ath79_setup_interfaces() mikrotik,routerboard-map-2nd) ucidef_set_interface_lan "eth0 eth1" ;; + mikrotik,routerboard-951g-2hnd|\ mikrotik,routerboard-962uigs-5hact2hnt) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index b23bd05bcd5567..cc05ba080bf3a6 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -46,6 +46,7 @@ case "$FIRMWARE" in mikrotik,routerboard-962uigs-5hact2hnt) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 7) ;; + mikrotik,routerboard-951g-2hnd|\ mikrotik,routerboard-951ui-2hnd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" +11) ;; diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh index cefbc5d3341513..e3887bfc50d261 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -33,6 +33,7 @@ platform_do_upgrade() { mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-922uags-5hpacd|\ + mikrotik,routerboard-951g-2hnd|\ mikrotik,routerboard-951ui-2hnd|\ mikrotik,routerboard-sxt-5nd-r2) platform_do_upgrade_mikrotik_nand "$1" From b7fac1bf8c6f975607427734f85318c69aacaeb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Perni=C4=8Dka?= Date: Tue, 27 Jun 2023 18:34:03 +0200 Subject: [PATCH 0262/1171] ath79: DTS improvement for buzzer on RB951G-2HnD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mikrotik RB951 router has a buzzer on the board, which makes annoying noises due to the interference caused by PoE input or Wifi transmission when no GPIO pin state is set. I added buzzer node to device's DTS in order to set deault level to 1 and to provide easier access for it. Signed-off-by: Pavel Pernička (cherry picked from commit dac0a133cf8dbf0bd9afabecdc1092456c451ec7) --- .../ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts index 16da7a3c950803..6229eefb1f0c8e 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts @@ -17,6 +17,12 @@ gpio-export,output = <1>; gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; }; + + buzzer { + gpio-export,name = "buzzer"; + gpio-export,output = <1>; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + }; }; }; From 977ee439d7068e405361322013e9a2114bfefcda Mon Sep 17 00:00:00 2001 From: Wenli Looi Date: Thu, 30 Mar 2023 22:27:11 +0000 Subject: [PATCH 0263/1171] image: add additional fields to Netgear encrypted image These fields are used for EAX12 and EX6250v2 series, and perhaps other devices. Compatibility is preserved with the WAX202 and WAX206. In addition, adds the related vars to DEVICE_VARS so that the variables work correctly with multiple devices. References in GPL source: https://www.downloads.netgear.com/files/GPL/EAX12_EAX11v2_EAX15v2_GPL_V1.0.3.34_src.tar.gz * tools/imgencoder/src/gj_enc.c Contains code that generates the encrypted image. Signed-off-by: Wenli Looi (cherry picked from commit 0a1ebccc8702cadc50bc096f1e185472f3927786) --- include/image-commands.mk | 2 ++ scripts/netgear-encrypted-factory.py | 15 +++++++++++++-- target/linux/mediatek/image/Makefile | 6 ++++++ target/linux/ramips/image/Makefile | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 1d694850195457..dc6ee6e7c160c0 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -423,6 +423,8 @@ define Build/netgear-encrypted-factory --output-file $@ \ --model $(NETGEAR_ENC_MODEL) \ --region $(NETGEAR_ENC_REGION) \ + $(if $(NETGEAR_ENC_HW_ID_LIST),--hw-id-list "$(NETGEAR_ENC_HW_ID_LIST)") \ + $(if $(NETGEAR_ENC_MODEL_LIST),--model-list "$(NETGEAR_ENC_MODEL_LIST)") \ --version V1.0.0.0.$(shell cat $(VERSION_DIST)| sed -e 's/[[:space:]]/-/g').$(firstword $(subst -, ,$(REVISION))) \ --encryption-block-size 0x20000 \ --openssl-bin "$(STAGING_DIR_HOST)/bin/openssl" \ diff --git a/scripts/netgear-encrypted-factory.py b/scripts/netgear-encrypted-factory.py index b6bb72f3b87ebd..40cfd9df0d2e0e 100755 --- a/scripts/netgear-encrypted-factory.py +++ b/scripts/netgear-encrypted-factory.py @@ -14,6 +14,8 @@ def main(): parser.add_argument('--model', type=str, required=True) parser.add_argument('--region', type=str, required=True) parser.add_argument('--version', type=str, required=True) + parser.add_argument('--hw-id-list', type=str) + parser.add_argument('--model-list', type=str) parser.add_argument('--encryption-block-size', type=str, required=True) parser.add_argument('--openssl-bin', type=str, required=True) parser.add_argument('--key', type=str, required=True) @@ -26,6 +28,10 @@ def main(): assert (encryption_block_size > 0 and encryption_block_size % 16 == 0), 'Encryption block size must be a multiple of the AES block size (16)' + hw_id_list = args.hw_id_list.split(';') if args.hw_id_list else [] + model_list = args.model_list.split(';') if args.model_list else [] + hw_info = ';'.join(hw_id_list + model_list) + image = open(args.input_file, 'rb').read() image_enc = [] for i in range(0, len(image), encryption_block_size): @@ -45,13 +51,18 @@ def main(): image_enc = b''.join(image_enc) image_with_header = struct.pack( - '>32s32s64s64s64s256s12sII', + '>32s32s64s64sIBBB13s200s100s12sII', args.model.encode('ascii'), args.region.encode('ascii'), args.version.encode('ascii'), b'Thu Jan 1 00:00:00 1970', # static date for reproducibility + 0, # product hw model + 0, # model index + len(hw_id_list), + len(model_list), + b'', # reserved + hw_info.encode('ascii'), b'', # reserved - b'', # RSA signature - omitted for now b'encrpted_img', len(image_enc), encryption_block_size, diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile index 97164428e05c9e..d4f79ec97499bd 100644 --- a/target/linux/mediatek/image/Makefile +++ b/target/linux/mediatek/image/Makefile @@ -6,6 +6,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk +DEVICE_VARS += NETGEAR_ENC_MODEL NETGEAR_ENC_REGION NETGEAR_ENC_HW_ID_LIST NETGEAR_ENC_MODEL_LIST + loadaddr-$(CONFIG_TARGET_mediatek_mt7622) := 0x44000000 loadaddr-$(CONFIG_TARGET_mediatek_mt7623) := 0x80008000 loadaddr-$(CONFIG_TARGET_mediatek_mt7629) := 0x40008000 @@ -22,6 +24,10 @@ define Device/Default KERNEL_LOADADDR = $(loadaddr-y) FILESYSTEMS := squashfs DEVICE_DTS_DIR := $(DTS_DIR) + NETGEAR_ENC_MODEL := + NETGEAR_ENC_REGION := + NETGEAR_ENC_HW_ID_LIST := + NETGEAR_ENC_MODEL_LIST := IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | \ pad-rootfs | append-metadata diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index c080456e7a7527..265e9fb5e0c33a 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -7,6 +7,7 @@ include $(INCLUDE_DIR)/image.mk DEVICE_VARS += LOADER_TYPE LOADER_FLASH_OFFS LZMA_TEXT_START DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID +DEVICE_VARS += NETGEAR_ENC_MODEL NETGEAR_ENC_REGION NETGEAR_ENC_HW_ID_LIST NETGEAR_ENC_MODEL_LIST DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK DEVICE_VARS += SERCOMM_HWNAME SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER @@ -179,6 +180,10 @@ define Device/Default SOC := $(DEFAULT_SOC) DEVICE_DTS_DIR := ../dts DEVICE_DTS = $$(SOC)_$(1) + NETGEAR_ENC_MODEL := + NETGEAR_ENC_REGION := + NETGEAR_ENC_HW_ID_LIST := + NETGEAR_ENC_MODEL_LIST := IMAGES := sysupgrade.bin COMPILE := sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs From 23d6474e451216d2e9c7b3b5d29df336b9523b5c Mon Sep 17 00:00:00 2001 From: Wenli Looi Date: Thu, 30 Mar 2023 19:46:19 +0000 Subject: [PATCH 0264/1171] mediatek: add support for Netgear EX6250v2 series Netgear EX6250v2, EX6400v3, EX6410v2, EX6470 are wall-plug 802.11ac (Wi-Fi 5) extenders. Like other MT7629 devices, Wi-Fi does not work currently as there is no driver. Related: https://github.com/openwrt/openwrt/pull/5084 For future reference, 2.4GHz MAC = LAN+1, 5GHz MAC = LAN+2. Specifications: * MT7629, 256 MiB RAM, 16 MiB SPI NOR * MT7761N (2.4GHz) / MT7762N (5GHz) - no driver * Ethernet: 1 port 10/100/1000 * UART: 115200 baud (labeled on board) Installation: * Flash the factory image through the stock web interface, or TFTP to the bootloader. NMRP can be used to TFTP without opening the case. * After installation, perform a factory reset. Wait for the device to boot, then hold the reset button for 10 seconds. This is needed because sysupgrade in the stock firmware will attempt to preserve its configuration using sysupgrade.tgz. See https://github.com/openwrt/openwrt/pull/4182 Revert to stock firmware: * Flash the stock firmware to the bootloader using TFTP/NMRP. Signed-off-by: Wenli Looi (cherry picked from commit 73de41898fcd06d837b013449c370c493bcdc595) --- .../boot/uboot-envtools/files/mediatek_mt7629 | 3 +- .../mediatek/dts/mt7629-netgear-ex6250-v2.dts | 238 ++++++++++++++++++ target/linux/mediatek/image/mt7629.mk | 26 ++ .../mt7629/base-files/etc/board.d/01_leds | 4 + .../mt7629/base-files/etc/board.d/02_network | 11 + 5 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7629-netgear-ex6250-v2.dts diff --git a/package/boot/uboot-envtools/files/mediatek_mt7629 b/package/boot/uboot-envtools/files/mediatek_mt7629 index a5aa2b58a61de7..313fb6a44809e7 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7629 +++ b/package/boot/uboot-envtools/files/mediatek_mt7629 @@ -12,7 +12,8 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in -iptime,a6004mx) +iptime,a6004mx|\ +netgear,ex6250-v2) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" ;; esac diff --git a/target/linux/mediatek/dts/mt7629-netgear-ex6250-v2.dts b/target/linux/mediatek/dts/mt7629-netgear-ex6250-v2.dts new file mode 100644 index 00000000000000..5645ad799e9247 --- /dev/null +++ b/target/linux/mediatek/dts/mt7629-netgear-ex6250-v2.dts @@ -0,0 +1,238 @@ +// SPDX-License-Identifier: GPL-2.0 + +/dts-v1/; +#include +#include "mt7629.dtsi" + +/ { + model = "Netgear EX6250 v2"; + compatible = "netgear,ex6250-v2", "mediatek,mt7629"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_red; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 60 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&pio 58 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + ap_mode { + label = "ap_mode"; + gpios = <&pio 54 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + extender_mode { + label = "extender_mode"; + gpios = <&pio 53 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "green:power"; + gpios = <&pio 21 GPIO_ACTIVE_LOW>; + }; + + led_power_red: power_red { + label = "red:power"; + gpios = <&pio 61 GPIO_ACTIVE_LOW>; + }; + + client_green { + label = "green:client"; + gpios = <&pio 59 GPIO_ACTIVE_LOW>; + }; + + client_red { + label = "red:client"; + gpios = <&pio 24 GPIO_ACTIVE_LOW>; + }; + + router_green { + label = "green:router"; + gpios = <&pio 55 GPIO_ACTIVE_LOW>; + }; + + router_red { + label = "red:router"; + gpios = <&pio 56 GPIO_ACTIVE_LOW>; + }; + + wps_green { + label = "green:wps"; + gpios = <&pio 57 GPIO_ACTIVE_LOW>; + }; + + eth_green { + label = "green:eth"; + gpios = <&pio 16 GPIO_ACTIVE_LOW>; + }; + + eth_yellow { + label = "yellow:eth"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + pinctrl-1 = <&ephy_leds_pins>; + status = "okay"; + + mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&phy0>; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + }; +}; + +&qspi { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&qspi_pins>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x60000>; + read-only; + }; + + partition@60000 { + label = "Config"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = "Factory"; + reg = <0x70000 0x10000>; + read-only; + }; + + partition@80000 { + label = "firmware"; + reg = <0x80000 0xcd0000>; + compatible = "denx,fit"; + }; + + partition@d50000 { + label = "CFG"; + reg = <0xd50000 0x80000>; + read-only; + }; + + partition@dd0000 { + label = "RAE"; + reg = <0xdd0000 0x200000>; + read-only; + }; + + partition@fd0000 { + label = "POT"; + reg = <0xfd0000 0x10000>; + read-only; + }; + + partition@fe0000 { + label = "LOG"; + reg = <0xfe0000 0x20000>; + read-only; + }; + }; + }; +}; + +&pio { + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio"; + }; + }; + + ephy_leds_pins: ephy-leds-pins { + mux { + function = "led"; + groups = "ephy_leds"; + }; + }; + + qspi_pins: qspi-pins { + mux { + function = "flash"; + groups = "spi_nor"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_txd_rxd" ; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; diff --git a/target/linux/mediatek/image/mt7629.mk b/target/linux/mediatek/image/mt7629.mk index 3f5b2e257940ff..33c557190f64d3 100644 --- a/target/linux/mediatek/image/mt7629.mk +++ b/target/linux/mediatek/image/mt7629.mk @@ -22,3 +22,29 @@ define Device/iptime_a6004mx IMAGE/recovery.bin := append-kernel | pad-to 128k | append-ubi | append-metadata endef TARGET_DEVICES += iptime_a6004mx + +define Device/netgear_ex6250-v2 + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := EX6250 + DEVICE_VARIANT := v2 + DEVICE_ALT0_VENDOR := NETGEAR + DEVICE_ALT0_MODEL := EX6400 + DEVICE_ALT0_VARIANT := v3 + DEVICE_ALT1_VENDOR := NETGEAR + DEVICE_ALT1_MODEL := EX6410 + DEVICE_ALT1_VARIANT := v2 + DEVICE_ALT2_VENDOR := NETGEAR + DEVICE_ALT2_MODEL := EX6470 + DEVICE_DTS := mt7629-netgear-ex6250-v2 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := uboot-envtools + NETGEAR_ENC_MODEL := EX6250v2 + NETGEAR_ENC_REGION := US + NETGEAR_ENC_HW_ID_LIST := 1010000003630000_NETGEAR;1010000003540000_NETGEAR + NETGEAR_ENC_MODEL_LIST := EX6250v2;EX6400v3;EX6470;EX6410v2 + IMAGE_SIZE := 13120k + IMAGES += factory.img + IMAGE/factory.img := append-kernel | pad-to 128k | append-rootfs | \ + pad-rootfs | check-size | netgear-encrypted-factory +endef +TARGET_DEVICES += netgear_ex6250-v2 diff --git a/target/linux/mediatek/mt7629/base-files/etc/board.d/01_leds b/target/linux/mediatek/mt7629/base-files/etc/board.d/01_leds index 42b6fcbbb35265..c42ab4713b9ad9 100644 --- a/target/linux/mediatek/mt7629/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/mt7629/base-files/etc/board.d/01_leds @@ -9,6 +9,10 @@ case $board in iptime,a6004mx) ucidef_set_led_netdev "wan" "WAN" "orange:wan" "eth1" ;; +netgear,ex6250-v2) + ucidef_set_led_netdev "eth_act" "LAN act" "yellow:eth" "eth0" "tx rx" + ucidef_set_led_netdev "eth_link" "LAN link" "green:eth" "eth0" "link" + ;; esac board_config_flush diff --git a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network index 4254f39ca0aa64..db931c8334e962 100644 --- a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network @@ -16,6 +16,9 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "6@eth0" ;; + netgear,ex6250-v2) + ucidef_set_interface_lan "eth0" + ;; esac } @@ -24,7 +27,15 @@ mediatek_setup_macs() local board="$1" case $board in + netgear,ex6250-v2) + lan_mac=$(mtd_get_mac_ascii Config mac) + label_mac=$lan_mac + ;; esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac + [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac } board_config_update From f7daeec3bd54fd5f21b31c0aab15e7573d325009 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Sat, 20 May 2023 23:03:06 +0800 Subject: [PATCH 0265/1171] uboot-mediatek: add H3C Magic NX30 Pro support The OEM uboot limit brush into 3rd-party firmware. So add a custom uboot build to support openwrt. Signed-off-by: Chukun Pan (cherry picked from commit 437e79ad6d01100afac9786d287976de6d5cf363) --- .../uboot-envtools/files/mediatek_filogic | 1 + package/boot/uboot-mediatek/Makefile | 13 + .../patches/435-add-h3c_magic-nx30-pro.patch | 440 ++++++++++++++++++ 3 files changed, 454 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 7918bdacfcdb76..77c9d964db37b6 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -51,6 +51,7 @@ xiaomi,redmi-router-ax6000-stock) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000" ;; +h3c,magic-nx30-pro|\ qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 8ea05b9159e627..33fd7e086e8b8f 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -176,6 +176,18 @@ define U-Boot/mt7629_rfb UBOOT_CONFIG:=mt7629_rfb endef +define U-Boot/mt7981_h3c_magic-nx30-pro + NAME:=H3C Magic NX30 Pro + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=h3c_magic-nx30-pro + UBOOT_CONFIG:=mt7981_h3c_magic-nx30-pro + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + define U-Boot/mt7981_qihoo_360t7 NAME:=Qihoo 360T7 BUILD_SUBTARGET:=filogic @@ -313,6 +325,7 @@ UBOOT_TARGETS := \ mt7628_rfb \ ravpower_rp-wd009 \ mt7629_rfb \ + mt7981_h3c_magic-nx30-pro \ mt7981_qihoo_360t7 \ mt7986_bananapi_bpi-r3-emmc \ mt7986_bananapi_bpi-r3-sdmmc \ diff --git a/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch b/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch new file mode 100644 index 00000000000000..e7d1ce764cbb77 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch @@ -0,0 +1,440 @@ +--- /dev/null ++++ b/configs/mt7981_h3c_magic-nx30-pro_defconfig +@@ -0,0 +1,175 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981_h3c_magic-nx30-pro" ++CONFIG_DEFAULT_ENV_FILE="h3c_magic-nx30-pro_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_h3c_magic-nx30-pro.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_AHCI=y ++CONFIG_AHCI_PCI=y ++CONFIG_SCSI_AHCI=y ++CONFIG_SCSI=y ++CONFIG_CMD_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_HEXDUMP=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/arch/arm/dts/mt7981_h3c_magic-nx30-pro.dts +@@ -0,0 +1,200 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "H3C Magic NX30 Pro"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ factory { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wps { ++ label = "wps"; ++ linux,code = ; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status_red { ++ label = "red:status"; ++ gpios = <&gpio 4 GPIO_ACTIVE_LOW>; ++ }; ++ ++ status_green { ++ label = "green:status"; ++ gpios = <&gpio 5 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "disabled"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "sgmii"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++ ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_1"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++ ++ pwm_pins: pwm0-pins-func-1 { ++ mux { ++ function = "pwm"; ++ groups = "pwm0_1", "pwm1_0"; ++ }; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0000000 0x0100000>; ++ }; ++ ++ partition@100000 { ++ label = "orig-env"; ++ reg = <0x0100000 0x0080000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x0180000 0x0200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x0380000 0x0200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x0580000 0x4000000>; ++ }; ++ ++ partition@4580000 { ++ label = "pdt_data"; ++ reg = <0x4580000 0x0600000>; ++ }; ++ ++ partition@4b80000 { ++ label = "pdt_data_1"; ++ reg = <0x4b80000 0x0600000>; ++ }; ++ ++ partition@5180000 { ++ label = "exp"; ++ reg = <0x5180000 0x0100000>; ++ }; ++ ++ partition@5280000 { ++ label = "plugin"; ++ reg = <0x5280000 0x2580000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/h3c_magic-nx30-pro_env +@@ -0,0 +1,56 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-h3c_magic-nx30-pro-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-h3c_magic-nx30-pro-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-h3c_magic-nx30-pro-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-h3c_magic-nx30-pro-squashfs-sysupgrade.itb ++bootled_pwr=green:status ++bootled_rec=red:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++part_default=production ++part_recovery=recovery ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" From cf81850ccea9cce9ae64e638d49bf75838e518d9 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Sun, 21 May 2023 23:00:16 +0800 Subject: [PATCH 0266/1171] mediatek: filogic: add H3C Magic NX30 Pro support Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: W25N01GVZEIG 128MB RAM: NT5CB128M16JR-FL 256MB Ethernet: 4x 10/100/1000 Mbps Switch: MediaTek MT7531AE WiFi: MediaTek MT7976C Button: Reset, WPS Power: DC 12V 1A Flash instructions: 1. PC run command: "telnet 192.168.124.1 99" Username: H3C, password is the web login password of the router. 2. Download preloader.bin and bl31-uboot.fip 3. PC run command: "python3 -m http.server 80" 4. Download files in the telnet window: "wget http://192.168.124.xx/xxx.bin" Replace xx with your PC's IP and the preloader.bin and bl31-uboot.fip. 5. Flushing openwrt's uboot: "mtd write xxx-preloader.bin BL2" "mtd write xxx-bl31-uboot.fip FIP" 6. Connect to the router via the Lan port, set a static ip of your PC. (ip 192.168.1.254, gateway 192.168.1.1) 7. Download initramfs image, reboot router, waiting for tftp recovery to complete. 8. After openwrt boots up, perform sysupgrade. Note: 1. The u-boot-env partition on mtd is empty, OEM stores their env on ubi:u-boot-env. 2. Back up all mtd partitions before flashing. Signed-off-by: Chukun Pan (cherry picked from commit e78d1a06c8a47be9ea5a306bfb43f3d7ceb89646) --- .../dts/mt7981b-h3c-magic-nx30-pro.dts | 239 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 8 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 25 ++ 5 files changed, 278 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts diff --git a/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts b/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts new file mode 100644 index 00000000000000..358365adba44bd --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts @@ -0,0 +1,239 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "H3C Magic NX30 Pro"; + compatible = "h3c,magic-nx30-pro", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: green { + label = "green:status"; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + }; + + led_status_red: red { + label = "red:status"; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x0000000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x0180000 0x0200000>; + read-only; + }; + + partition@380000 { + label = "FIP"; + reg = <0x0380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x0580000 0x4000000>; + }; + + /* yaffs partition */ + partition@4580000 { + label = "pdt_data"; + reg = <0x4580000 0x0600000>; + read-only; + }; + + /* yaffs partition */ + partition@4b80000 { + label = "pdt_data_1"; + reg = <0x4b80000 0x0600000>; + read-only; + }; + + partition@5180000 { + label = "exp"; + reg = <0x5180000 0x0100000>; + read-only; + }; + + partition@5280000 { + label = "plugin"; + reg = <0x5280000 0x2580000>; + read-only; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index c05c5d25e46218..6abc81a0b0561d 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -23,6 +23,9 @@ mediatek_setup_interfaces() glinet,gl-mt3000) ucidef_set_interfaces_lan_wan eth1 eth0 ;; + h3c,magic-nx30-pro) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 + ;; mediatek,mt7986a-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan6" "eth1 wan" ;; @@ -72,6 +75,11 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + h3c,magic-nx30-pro) + wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr) + lan_mac=$(macaddr_add "$wan_mac" 1) + label_mac=$wan_mac + ;; mercusys,mr90x-v1) label_mac=$(get_mac_binary "/tmp/tp_data/default-mac" 0) lan_mac=$label_mac diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 4b7047eec5e5ab..ab23b100444ce4 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -32,6 +32,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress ;; + h3c,magic-nx30-pro) + addr=$(mtd_get_mac_ascii pdt_data_1 ethaddr) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress + ;; mercusys,mr90x-v1) addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 11c2c5c66439de..186abfa5a8d82e 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -74,6 +74,7 @@ platform_do_upgrade() { CI_UBIPART="ubi0" nand_do_upgrade "$1" ;; + h3c,magic-nx30-pro|\ qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index fd83b9d4416f99..2ace305140b2e5 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -176,6 +176,31 @@ define Device/glinet_gl-mt3000 endef TARGET_DEVICES += glinet_gl-mt3000 +define Device/h3c_magic-nx30-pro + DEVICE_VENDOR := H3C + DEVICE_MODEL := Magic NX30 Pro + DEVICE_DTS := mt7981b-h3c-magic-nx30-pro + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGE_SIZE := 65536k + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot h3c_magic-nx30-pro +endef +TARGET_DEVICES += h3c_magic-nx30-pro + define Device/netgear_wax220 DEVICE_VENDOR := Netgear DEVICE_MODEL := WAX220 From 0af05cd32a69b2e92f11e9b8307a1537c7406d34 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 8 Jul 2023 16:27:25 +0100 Subject: [PATCH 0267/1171] mediatek: dts: mt7988a: wire-up mediatek,pio for PHY LEDs The PHY driver needs to read a register containing the values of the bootstrap pins (which happen to be the PHY LEDs) to determine the LED polarities. Allow regmap access to first pinctrl bank by adding the 'syscon' compatible, and reference the pinctrl in the MDIO bus where the PHY driver will look for it. Signed-off-by: Daniel Golle (cherry picked from commit 1f1e0b1144ebaa4ba8b948a12d989a0a6fc9b76f) --- .../arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts | 1 + .../files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts index 98dbf8d6913ff1..e204dc4f166a42 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts @@ -156,6 +156,7 @@ mdio { #address-cells = <1>; #size-cells = <0>; + mediatek,pio = <&pio>; gsw_phy0: ethernet-phy@0 { compatible = "ethernet-phy-id03a2.9481"; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi index 13ad39500d1b93..17de885629e18b 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi @@ -215,7 +215,7 @@ }; pio: pinctrl@1001f000 { - compatible = "mediatek,mt7988-pinctrl"; + compatible = "mediatek,mt7988-pinctrl", "syscon"; reg = <0 0x1001f000 0 0x1000>, <0 0x11c10000 0 0x1000>, <0 0x11d00000 0 0x1000>, From 6092c39c13232dcccf9794c2b9e4b4a820ba1c4a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 8 Jul 2023 17:21:27 +0100 Subject: [PATCH 0268/1171] mediatek: use backported Ethernet PHY driver also for 5.15 Backport in-SoC Gigabit Ethernet PHY driver instead of carrying the driver in files-5.15. Signed-off-by: Daniel Golle (cherry picked from commit 9fac59009657068d5a58b3d0255d4ca1507dd457) --- .../drivers/net/phy/mediatek-ge-soc.c | 1263 ----------------- ...er-for-MediaTek-SoC-built-in-GE-PHYs.patch | 82 -- ...er-for-MediaTek-SoC-built-in-GE-PHYs.patch | 1204 ++++++++++++++++ ...-ge-soc-initialize-MT7988-PHY-LEDs-d.patch | 213 +++ 4 files changed, 1417 insertions(+), 1345 deletions(-) delete mode 100644 target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c delete mode 100644 target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch create mode 100644 target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch create mode 100644 target/linux/mediatek/patches-5.15/731-net-phy-mediatek-ge-soc-initialize-MT7988-PHY-LEDs-d.patch diff --git a/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c b/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c deleted file mode 100644 index e48502ac3fdd16..00000000000000 --- a/target/linux/mediatek/files-5.15/drivers/net/phy/mediatek-ge-soc.c +++ /dev/null @@ -1,1263 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -#include -#include -#include -#include -#include -#include -#include - -#define MTK_GPHY_ID_MT7981 0x03a29461 -#define MTK_GPHY_ID_MT7988 0x03a29481 - -#define MTK_EXT_PAGE_ACCESS 0x1f -#define MTK_PHY_PAGE_STANDARD 0x0000 -#define MTK_PHY_PAGE_EXTENDED_3 0x0003 - -#define MTK_PHY_LPI_REG_14 0x14 -#define MTK_PHY_LPI_WAKE_TIMER_1000_MASK GENMASK(8, 0) - -#define MTK_PHY_LPI_REG_1c 0x1c -#define MTK_PHY_SMI_DET_ON_THRESH_MASK GENMASK(13, 8) - -#define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30 -#define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 - -#define ANALOG_INTERNAL_OPERATION_MAX_US 20 -#define TXRESERVE_MIN 0 -#define TXRESERVE_MAX 7 - -#define MTK_PHY_ANARG_RG 0x10 -#define MTK_PHY_TCLKOFFSET_MASK GENMASK(12, 8) - -/* Registers on MDIO_MMD_VEND1 */ -#define MTK_PHY_TXVLD_DA_RG 0x12 -#define MTK_PHY_DA_TX_I2MPB_A_GBE_MASK GENMASK(15, 10) -#define MTK_PHY_DA_TX_I2MPB_A_TBT_MASK GENMASK(5, 0) - -#define MTK_PHY_TX_I2MPB_TEST_MODE_A2 0x16 -#define MTK_PHY_DA_TX_I2MPB_A_HBT_MASK GENMASK(15, 10) -#define MTK_PHY_DA_TX_I2MPB_A_TST_MASK GENMASK(5, 0) - -#define MTK_PHY_TX_I2MPB_TEST_MODE_B1 0x17 -#define MTK_PHY_DA_TX_I2MPB_B_GBE_MASK GENMASK(13, 8) -#define MTK_PHY_DA_TX_I2MPB_B_TBT_MASK GENMASK(5, 0) - -#define MTK_PHY_TX_I2MPB_TEST_MODE_B2 0x18 -#define MTK_PHY_DA_TX_I2MPB_B_HBT_MASK GENMASK(13, 8) -#define MTK_PHY_DA_TX_I2MPB_B_TST_MASK GENMASK(5, 0) - -#define MTK_PHY_TX_I2MPB_TEST_MODE_C1 0x19 -#define MTK_PHY_DA_TX_I2MPB_C_GBE_MASK GENMASK(13, 8) -#define MTK_PHY_DA_TX_I2MPB_C_TBT_MASK GENMASK(5, 0) - -#define MTK_PHY_TX_I2MPB_TEST_MODE_C2 0x20 -#define MTK_PHY_DA_TX_I2MPB_C_HBT_MASK GENMASK(13, 8) -#define MTK_PHY_DA_TX_I2MPB_C_TST_MASK GENMASK(5, 0) - -#define MTK_PHY_TX_I2MPB_TEST_MODE_D1 0x21 -#define MTK_PHY_DA_TX_I2MPB_D_GBE_MASK GENMASK(13, 8) -#define MTK_PHY_DA_TX_I2MPB_D_TBT_MASK GENMASK(5, 0) - -#define MTK_PHY_TX_I2MPB_TEST_MODE_D2 0x22 -#define MTK_PHY_DA_TX_I2MPB_D_HBT_MASK GENMASK(13, 8) -#define MTK_PHY_DA_TX_I2MPB_D_TST_MASK GENMASK(5, 0) - -#define MTK_PHY_RXADC_CTRL_RG7 0xc6 -#define MTK_PHY_DA_AD_BUF_BIAS_LP_MASK GENMASK(9, 8) - -#define MTK_PHY_RXADC_CTRL_RG9 0xc8 -#define MTK_PHY_DA_RX_PSBN_TBT_MASK GENMASK(14, 12) -#define MTK_PHY_DA_RX_PSBN_HBT_MASK GENMASK(10, 8) -#define MTK_PHY_DA_RX_PSBN_GBE_MASK GENMASK(6, 4) -#define MTK_PHY_DA_RX_PSBN_LP_MASK GENMASK(2, 0) - -#define MTK_PHY_LDO_OUTPUT_V 0xd7 - -#define MTK_PHY_RG_ANA_CAL_RG0 0xdb -#define MTK_PHY_RG_CAL_CKINV BIT(12) -#define MTK_PHY_RG_ANA_CALEN BIT(8) -#define MTK_PHY_RG_ZCALEN_A BIT(0) - -#define MTK_PHY_RG_ANA_CAL_RG1 0xdc -#define MTK_PHY_RG_ZCALEN_B BIT(12) -#define MTK_PHY_RG_ZCALEN_C BIT(8) -#define MTK_PHY_RG_ZCALEN_D BIT(4) -#define MTK_PHY_RG_TXVOS_CALEN BIT(0) - -#define MTK_PHY_RG_ANA_CAL_RG5 0xe0 -#define MTK_PHY_RG_REXT_TRIM_MASK GENMASK(13, 8) - -#define MTK_PHY_RG_TX_FILTER 0xfe - -#define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG120 0x120 -#define MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK GENMASK(12, 8) -#define MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK GENMASK(4, 0) - -#define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122 0x122 -#define MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK GENMASK(7, 0) - -#define MTK_PHY_RG_TESTMUX_ADC_CTRL 0x144 -#define MTK_PHY_RG_TXEN_DIG_MASK GENMASK(5, 5) - -#define MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B 0x172 -#define MTK_PHY_CR_TX_AMP_OFFSET_A_MASK GENMASK(13, 8) -#define MTK_PHY_CR_TX_AMP_OFFSET_B_MASK GENMASK(6, 0) - -#define MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D 0x173 -#define MTK_PHY_CR_TX_AMP_OFFSET_C_MASK GENMASK(13, 8) -#define MTK_PHY_CR_TX_AMP_OFFSET_D_MASK GENMASK(6, 0) - -#define MTK_PHY_RG_AD_CAL_COMP 0x17a -#define MTK_PHY_AD_CAL_COMP_OUT_SHIFT (8) - -#define MTK_PHY_RG_AD_CAL_CLK 0x17b -#define MTK_PHY_DA_CAL_CLK BIT(0) - -#define MTK_PHY_RG_AD_CALIN 0x17c -#define MTK_PHY_DA_CALIN_FLAG BIT(0) - -#define MTK_PHY_RG_DASN_DAC_IN0_A 0x17d -#define MTK_PHY_DASN_DAC_IN0_A_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DASN_DAC_IN0_B 0x17e -#define MTK_PHY_DASN_DAC_IN0_B_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DASN_DAC_IN0_C 0x17f -#define MTK_PHY_DASN_DAC_IN0_C_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DASN_DAC_IN0_D 0x180 -#define MTK_PHY_DASN_DAC_IN0_D_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DASN_DAC_IN1_A 0x181 -#define MTK_PHY_DASN_DAC_IN1_A_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DASN_DAC_IN1_B 0x182 -#define MTK_PHY_DASN_DAC_IN1_B_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DASN_DAC_IN1_C 0x183 -#define MTK_PHY_DASN_DAC_IN1_C_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DASN_DAC_IN1_D 0x184 -#define MTK_PHY_DASN_DAC_IN1_D_MASK GENMASK(9, 0) - -#define MTK_PHY_RG_DEV1E_REG19b 0x19b -#define MTK_PHY_BYPASS_DSP_LPI_READY BIT(8) - -#define MTK_PHY_RG_LP_IIR2_K1_L 0x22a -#define MTK_PHY_RG_LP_IIR2_K1_U 0x22b -#define MTK_PHY_RG_LP_IIR2_K2_L 0x22c -#define MTK_PHY_RG_LP_IIR2_K2_U 0x22d -#define MTK_PHY_RG_LP_IIR2_K3_L 0x22e -#define MTK_PHY_RG_LP_IIR2_K3_U 0x22f -#define MTK_PHY_RG_LP_IIR2_K4_L 0x230 -#define MTK_PHY_RG_LP_IIR2_K4_U 0x231 -#define MTK_PHY_RG_LP_IIR2_K5_L 0x232 -#define MTK_PHY_RG_LP_IIR2_K5_U 0x233 - -#define MTK_PHY_RG_DEV1E_REG234 0x234 -#define MTK_PHY_TR_OPEN_LOOP_EN_MASK GENMASK(0, 0) -#define MTK_PHY_LPF_X_AVERAGE_MASK GENMASK(7, 4) -#define MTK_PHY_TR_LP_IIR_EEE_EN BIT(12) - -#define MTK_PHY_RG_LPF_CNT_VAL 0x235 - -#define MTK_PHY_RG_DEV1E_REG238 0x238 -#define MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK GENMASK(8, 0) -#define MTK_PHY_LPI_SLV_SEND_TX_EN BIT(12) - -#define MTK_PHY_RG_DEV1E_REG239 0x239 -#define MTK_PHY_LPI_SEND_LOC_TIMER_MASK GENMASK(8, 0) -#define MTK_PHY_LPI_TXPCS_LOC_RCV BIT(12) - -#define MTK_PHY_RG_DEV1E_REG27C 0x27c -#define MTK_PHY_VGASTATE_FFE_THR_ST1_MASK GENMASK(12, 8) -#define MTK_PHY_RG_DEV1E_REG27D 0x27d -#define MTK_PHY_VGASTATE_FFE_THR_ST2_MASK GENMASK(4, 0) - -#define MTK_PHY_RG_DEV1E_REG2C7 0x2c7 -#define MTK_PHY_MAX_GAIN_MASK GENMASK(4, 0) -#define MTK_PHY_MIN_GAIN_MASK GENMASK(12, 8) - -#define MTK_PHY_RG_DEV1E_REG2D1 0x2d1 -#define MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK GENMASK(7, 0) -#define MTK_PHY_LPI_SKIP_SD_SLV_TR BIT(8) -#define MTK_PHY_LPI_TR_READY BIT(9) -#define MTK_PHY_LPI_VCO_EEE_STG0_EN BIT(10) - -#define MTK_PHY_RG_DEV1E_REG323 0x323 -#define MTK_PHY_EEE_WAKE_MAS_INT_DC BIT(0) -#define MTK_PHY_EEE_WAKE_SLV_INT_DC BIT(4) - -#define MTK_PHY_RG_DEV1E_REG324 0x324 -#define MTK_PHY_SMI_DETCNT_MAX_MASK GENMASK(5, 0) -#define MTK_PHY_SMI_DET_MAX_EN BIT(8) - -#define MTK_PHY_RG_DEV1E_REG326 0x326 -#define MTK_PHY_LPI_MODE_SD_ON BIT(0) -#define MTK_PHY_RESET_RANDUPD_CNT BIT(1) -#define MTK_PHY_TREC_UPDATE_ENAB_CLR BIT(2) -#define MTK_PHY_LPI_QUIT_WAIT_DFE_SIG_DET_OFF BIT(4) -#define MTK_PHY_TR_READY_SKIP_AFE_WAKEUP BIT(5) - -#define MTK_PHY_LDO_PUMP_EN_PAIRAB 0x502 -#define MTK_PHY_LDO_PUMP_EN_PAIRCD 0x503 - -#define MTK_PHY_DA_TX_R50_PAIR_A 0x53d -#define MTK_PHY_DA_TX_R50_PAIR_B 0x53e -#define MTK_PHY_DA_TX_R50_PAIR_C 0x53f -#define MTK_PHY_DA_TX_R50_PAIR_D 0x540 - -/* Registers on MDIO_MMD_VEND2 */ -#define MTK_PHY_LED0_ON_CTRL 0x24 -#define MTK_PHY_LED0_ON_MASK GENMASK(6, 0) -#define MTK_PHY_LED0_ON_LINK1000 BIT(0) -#define MTK_PHY_LED0_ON_LINK100 BIT(1) -#define MTK_PHY_LED0_ON_LINK10 BIT(2) -#define MTK_PHY_LED0_ON_LINKDOWN BIT(3) -#define MTK_PHY_LED0_ON_FDX BIT(4) /* Full duplex */ -#define MTK_PHY_LED0_ON_HDX BIT(5) /* Half duplex */ -#define MTK_PHY_LED0_FORCE_ON BIT(6) -#define MTK_PHY_LED0_POLARITY BIT(14) -#define MTK_PHY_LED0_ENABLE BIT(15) - -#define MTK_PHY_LED0_BLINK_CTRL 0x25 -#define MTK_PHY_LED0_1000TX BIT(0) -#define MTK_PHY_LED0_1000RX BIT(1) -#define MTK_PHY_LED0_100TX BIT(2) -#define MTK_PHY_LED0_100RX BIT(3) -#define MTK_PHY_LED0_10TX BIT(4) -#define MTK_PHY_LED0_10RX BIT(5) -#define MTK_PHY_LED0_COLLISION BIT(6) -#define MTK_PHY_LED0_RX_CRC_ERR BIT(7) -#define MTK_PHY_LED0_RX_IDLE_ERR BIT(8) -#define MTK_PHY_LED0_FORCE_BLINK BIT(9) - -#define MTK_PHY_LED1_ON_CTRL 0x26 -#define MTK_PHY_LED1_ON_MASK GENMASK(6, 0) -#define MTK_PHY_LED1_ON_LINK1000 BIT(0) -#define MTK_PHY_LED1_ON_LINK100 BIT(1) -#define MTK_PHY_LED1_ON_LINK10 BIT(2) -#define MTK_PHY_LED1_ON_LINKDOWN BIT(3) -#define MTK_PHY_LED1_ON_FDX BIT(4) /* Full duplex */ -#define MTK_PHY_LED1_ON_HDX BIT(5) /* Half duplex */ -#define MTK_PHY_LED1_FORCE_ON BIT(6) -#define MTK_PHY_LED1_POLARITY BIT(14) -#define MTK_PHY_LED1_ENABLE BIT(15) - -#define MTK_PHY_LED1_BLINK_CTRL 0x27 -#define MTK_PHY_LED1_1000TX BIT(0) -#define MTK_PHY_LED1_1000RX BIT(1) -#define MTK_PHY_LED1_100TX BIT(2) -#define MTK_PHY_LED1_100RX BIT(3) -#define MTK_PHY_LED1_10TX BIT(4) -#define MTK_PHY_LED1_10RX BIT(5) -#define MTK_PHY_LED1_COLLISION BIT(6) -#define MTK_PHY_LED1_RX_CRC_ERR BIT(7) -#define MTK_PHY_LED1_RX_IDLE_ERR BIT(8) -#define MTK_PHY_LED1_FORCE_BLINK BIT(9) - -#define MTK_PHY_RG_BG_RASEL 0x115 -#define MTK_PHY_RG_BG_RASEL_MASK GENMASK(2, 0) - -/* These macro privides efuse parsing for internal phy. */ -#define EFS_DA_TX_I2MPB_A(x) (((x) >> 0) & GENMASK(5, 0)) -#define EFS_DA_TX_I2MPB_B(x) (((x) >> 6) & GENMASK(5, 0)) -#define EFS_DA_TX_I2MPB_C(x) (((x) >> 12) & GENMASK(5, 0)) -#define EFS_DA_TX_I2MPB_D(x) (((x) >> 18) & GENMASK(5, 0)) -#define EFS_DA_TX_AMP_OFFSET_A(x) (((x) >> 24) & GENMASK(5, 0)) - -#define EFS_DA_TX_AMP_OFFSET_B(x) (((x) >> 0) & GENMASK(5, 0)) -#define EFS_DA_TX_AMP_OFFSET_C(x) (((x) >> 6) & GENMASK(5, 0)) -#define EFS_DA_TX_AMP_OFFSET_D(x) (((x) >> 12) & GENMASK(5, 0)) -#define EFS_DA_TX_R50_A(x) (((x) >> 18) & GENMASK(5, 0)) -#define EFS_DA_TX_R50_B(x) (((x) >> 24) & GENMASK(5, 0)) - -#define EFS_DA_TX_R50_C(x) (((x) >> 0) & GENMASK(5, 0)) -#define EFS_DA_TX_R50_D(x) (((x) >> 6) & GENMASK(5, 0)) - -#define EFS_RG_BG_RASEL(x) (((x) >> 4) & GENMASK(2, 0)) -#define EFS_RG_REXT_TRIM(x) (((x) >> 7) & GENMASK(5, 0)) - -enum { - NO_PAIR, - PAIR_A, - PAIR_B, - PAIR_C, - PAIR_D, -}; - -enum { - GPHY_PORT0, - GPHY_PORT1, - GPHY_PORT2, - GPHY_PORT3, -}; - -enum calibration_mode { - EFUSE_K, - SW_K -}; - -enum CAL_ITEM { - REXT, - TX_OFFSET, - TX_AMP, - TX_R50, - TX_VCM -}; - -enum CAL_MODE { - EFUSE_M, - SW_M -}; - -struct mtk_socphy_shared_priv { - u32 boottrap; -}; - -static int mtk_socphy_read_page(struct phy_device *phydev) -{ - return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); -} - -static int mtk_socphy_write_page(struct phy_device *phydev, int page) -{ - return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page); -} - -/* One calibration cycle consists of: - * 1.Set DA_CALIN_FLAG high to start calibration. Keep it high - * until AD_CAL_COMP is ready to output calibration result. - * 2.Wait until DA_CAL_CLK is available. - * 3.Fetch AD_CAL_COMP_OUT. - */ -static int cal_cycle(struct phy_device *phydev, int devad, - u32 regnum, u16 mask, u16 cal_val) -{ - int reg_val; - int ret; - - phy_modify_mmd(phydev, devad, regnum, - mask, cal_val); - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, - MTK_PHY_DA_CALIN_FLAG); - - ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_AD_CAL_CLK, reg_val, - reg_val & MTK_PHY_DA_CAL_CLK, 500, - ANALOG_INTERNAL_OPERATION_MAX_US, false); - if (ret) { - phydev_err(phydev, "Calibration cycle timeout\n"); - return ret; - } - - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, - MTK_PHY_DA_CALIN_FLAG); - ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CAL_COMP) >> - MTK_PHY_AD_CAL_COMP_OUT_SHIFT; - phydev_dbg(phydev, "cal_val: 0x%x, ret: %d\n", cal_val, ret); - - return ret; -} - -static int rext_fill_result(struct phy_device *phydev, u16 *buf) -{ - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, - MTK_PHY_RG_REXT_TRIM_MASK, buf[0] << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_BG_RASEL, - MTK_PHY_RG_BG_RASEL_MASK, buf[1]); - - return 0; -} - -static int rext_cal_efuse(struct phy_device *phydev, u32 *buf) -{ - u16 rext_cal_val[2]; - - rext_cal_val[0] = EFS_RG_REXT_TRIM(buf[3]); - rext_cal_val[1] = EFS_RG_BG_RASEL(buf[3]); - rext_fill_result(phydev, rext_cal_val); - - return 0; -} - -static int tx_offset_fill_result(struct phy_device *phydev, u16 *buf) -{ - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, - MTK_PHY_CR_TX_AMP_OFFSET_A_MASK, buf[0] << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, - MTK_PHY_CR_TX_AMP_OFFSET_B_MASK, buf[1]); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, - MTK_PHY_CR_TX_AMP_OFFSET_C_MASK, buf[2] << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, - MTK_PHY_CR_TX_AMP_OFFSET_D_MASK, buf[3]); - - return 0; -} - -static int tx_offset_cal_efuse(struct phy_device *phydev, u32 *buf) -{ - u16 tx_offset_cal_val[4]; - - tx_offset_cal_val[0] = EFS_DA_TX_AMP_OFFSET_A(buf[0]); - tx_offset_cal_val[1] = EFS_DA_TX_AMP_OFFSET_B(buf[1]); - tx_offset_cal_val[2] = EFS_DA_TX_AMP_OFFSET_C(buf[1]); - tx_offset_cal_val[3] = EFS_DA_TX_AMP_OFFSET_D(buf[1]); - - tx_offset_fill_result(phydev, tx_offset_cal_val); - - return 0; -} - -static int tx_amp_fill_result(struct phy_device *phydev, u16 *buf) -{ - int i; - int bias[16] = {}; - const int vals_9461[16] = { 7, 1, 4, 7, - 7, 1, 4, 7, - 7, 1, 4, 7, - 7, 1, 4, 7 }; - const int vals_9481[16] = { 10, 6, 6, 10, - 10, 6, 6, 10, - 10, 6, 6, 10, - 10, 6, 6, 10 }; - switch (phydev->drv->phy_id) { - case MTK_GPHY_ID_MT7981: - /* We add some calibration to efuse values - * due to board level influence. - * GBE: +7, TBT: +1, HBT: +4, TST: +7 - */ - memcpy(bias, (const void *)vals_9461, sizeof(bias)); - break; - case MTK_GPHY_ID_MT7988: - memcpy(bias, (const void *)vals_9481, sizeof(bias)); - break; - } - - /* Prevent overflow */ - for (i = 0; i < 12; i++) { - if (buf[i >> 2] + bias[i] > 63) { - buf[i >> 2] = 63; - bias[i] = 0; - } - } - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, - MTK_PHY_DA_TX_I2MPB_A_GBE_MASK, (buf[0] + bias[0]) << 10); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, - MTK_PHY_DA_TX_I2MPB_A_TBT_MASK, buf[0] + bias[1]); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, - MTK_PHY_DA_TX_I2MPB_A_HBT_MASK, (buf[0] + bias[2]) << 10); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, - MTK_PHY_DA_TX_I2MPB_A_TST_MASK, buf[0] + bias[3]); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, - MTK_PHY_DA_TX_I2MPB_B_GBE_MASK, (buf[1] + bias[4]) << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, - MTK_PHY_DA_TX_I2MPB_B_TBT_MASK, buf[1] + bias[5]); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, - MTK_PHY_DA_TX_I2MPB_B_HBT_MASK, (buf[1] + bias[6]) << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, - MTK_PHY_DA_TX_I2MPB_B_TST_MASK, buf[1] + bias[7]); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, - MTK_PHY_DA_TX_I2MPB_C_GBE_MASK, (buf[2] + bias[8]) << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, - MTK_PHY_DA_TX_I2MPB_C_TBT_MASK, buf[2] + bias[9]); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, - MTK_PHY_DA_TX_I2MPB_C_HBT_MASK, (buf[2] + bias[10]) << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, - MTK_PHY_DA_TX_I2MPB_C_TST_MASK, buf[2] + bias[11]); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, - MTK_PHY_DA_TX_I2MPB_D_GBE_MASK, (buf[3] + bias[12]) << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, - MTK_PHY_DA_TX_I2MPB_D_TBT_MASK, buf[3] + bias[13]); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, - MTK_PHY_DA_TX_I2MPB_D_HBT_MASK, (buf[3] + bias[14]) << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, - MTK_PHY_DA_TX_I2MPB_D_TST_MASK, buf[3] + bias[15]); - - return 0; -} - -static int tx_amp_cal_efuse(struct phy_device *phydev, u32 *buf) -{ - u16 tx_amp_cal_val[4]; - - tx_amp_cal_val[0] = EFS_DA_TX_I2MPB_A(buf[0]); - tx_amp_cal_val[1] = EFS_DA_TX_I2MPB_B(buf[0]); - tx_amp_cal_val[2] = EFS_DA_TX_I2MPB_C(buf[0]); - tx_amp_cal_val[3] = EFS_DA_TX_I2MPB_D(buf[0]); - tx_amp_fill_result(phydev, tx_amp_cal_val); - - return 0; -} - -static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val, - u8 txg_calen_x) -{ - int bias = 0; - u16 reg, val; - - if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988) - bias = -2; - - val = clamp_val(bias + tx_r50_cal_val, 0, 63); - - switch (txg_calen_x) { - case PAIR_A: - reg = MTK_PHY_DA_TX_R50_PAIR_A; - break; - case PAIR_B: - reg = MTK_PHY_DA_TX_R50_PAIR_B; - break; - case PAIR_C: - reg = MTK_PHY_DA_TX_R50_PAIR_C; - break; - case PAIR_D: - reg = MTK_PHY_DA_TX_R50_PAIR_D; - break; - default: - return -EINVAL; - } - - phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, val | val << 8); - - return 0; -} - -static int tx_r50_cal_efuse(struct phy_device *phydev, u32 *buf, - u8 txg_calen_x) -{ - u16 tx_r50_cal_val; - - switch (txg_calen_x) { - case PAIR_A: - tx_r50_cal_val = EFS_DA_TX_R50_A(buf[1]); - break; - case PAIR_B: - tx_r50_cal_val = EFS_DA_TX_R50_B(buf[1]); - break; - case PAIR_C: - tx_r50_cal_val = EFS_DA_TX_R50_C(buf[2]); - break; - case PAIR_D: - tx_r50_cal_val = EFS_DA_TX_R50_D(buf[2]); - break; - default: - return -EINVAL; - } - tx_r50_fill_result(phydev, tx_r50_cal_val, txg_calen_x); - - return 0; -} - -static int tx_vcm_cal_sw(struct phy_device *phydev, u8 rg_txreserve_x) -{ - u8 lower_idx, upper_idx, txreserve_val; - u8 lower_ret, upper_ret; - int ret; - - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, - MTK_PHY_RG_ANA_CALEN); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, - MTK_PHY_RG_CAL_CKINV); - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, - MTK_PHY_RG_TXVOS_CALEN); - - switch (rg_txreserve_x) { - case PAIR_A: - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN0_A, - MTK_PHY_DASN_DAC_IN0_A_MASK); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN1_A, - MTK_PHY_DASN_DAC_IN1_A_MASK); - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_ANA_CAL_RG0, - MTK_PHY_RG_ZCALEN_A); - break; - case PAIR_B: - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN0_B, - MTK_PHY_DASN_DAC_IN0_B_MASK); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN1_B, - MTK_PHY_DASN_DAC_IN1_B_MASK); - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_ANA_CAL_RG1, - MTK_PHY_RG_ZCALEN_B); - break; - case PAIR_C: - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN0_C, - MTK_PHY_DASN_DAC_IN0_C_MASK); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN1_C, - MTK_PHY_DASN_DAC_IN1_C_MASK); - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_ANA_CAL_RG1, - MTK_PHY_RG_ZCALEN_C); - break; - case PAIR_D: - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN0_D, - MTK_PHY_DASN_DAC_IN0_D_MASK); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DASN_DAC_IN1_D, - MTK_PHY_DASN_DAC_IN1_D_MASK); - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_ANA_CAL_RG1, - MTK_PHY_RG_ZCALEN_D); - break; - default: - ret = -EINVAL; - goto restore; - } - - lower_idx = TXRESERVE_MIN; - upper_idx = TXRESERVE_MAX; - - phydev_dbg(phydev, "Start TX-VCM SW cal.\n"); - while ((upper_idx - lower_idx) > 1) { - txreserve_val = DIV_ROUND_CLOSEST(lower_idx + upper_idx, 2); - ret = cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, - MTK_PHY_DA_RX_PSBN_TBT_MASK | - MTK_PHY_DA_RX_PSBN_HBT_MASK | - MTK_PHY_DA_RX_PSBN_GBE_MASK | - MTK_PHY_DA_RX_PSBN_LP_MASK, - txreserve_val << 12 | txreserve_val << 8 | - txreserve_val << 4 | txreserve_val); - if (ret == 1) { - upper_idx = txreserve_val; - upper_ret = ret; - } else if (ret == 0) { - lower_idx = txreserve_val; - lower_ret = ret; - } else { - goto restore; - } - } - - if (lower_idx == TXRESERVE_MIN) { - lower_ret = cal_cycle(phydev, MDIO_MMD_VEND1, - MTK_PHY_RXADC_CTRL_RG9, - MTK_PHY_DA_RX_PSBN_TBT_MASK | - MTK_PHY_DA_RX_PSBN_HBT_MASK | - MTK_PHY_DA_RX_PSBN_GBE_MASK | - MTK_PHY_DA_RX_PSBN_LP_MASK, - lower_idx << 12 | lower_idx << 8 | - lower_idx << 4 | lower_idx); - ret = lower_ret; - } else if (upper_idx == TXRESERVE_MAX) { - upper_ret = cal_cycle(phydev, MDIO_MMD_VEND1, - MTK_PHY_RXADC_CTRL_RG9, - MTK_PHY_DA_RX_PSBN_TBT_MASK | - MTK_PHY_DA_RX_PSBN_HBT_MASK | - MTK_PHY_DA_RX_PSBN_GBE_MASK | - MTK_PHY_DA_RX_PSBN_LP_MASK, - upper_idx << 12 | upper_idx << 8 | - upper_idx << 4 | upper_idx); - ret = upper_ret; - } - if (ret < 0) - goto restore; - - /* We calibrate TX-VCM in different logic. Check upper index and then - * lower index. If this calibration is valid, apply lower index's result. - */ - ret = upper_ret - lower_ret; - if (ret == 1) { - ret = 0; - /* Make sure we use upper_idx in our calibration system */ - cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, - MTK_PHY_DA_RX_PSBN_TBT_MASK | - MTK_PHY_DA_RX_PSBN_HBT_MASK | - MTK_PHY_DA_RX_PSBN_GBE_MASK | - MTK_PHY_DA_RX_PSBN_LP_MASK, - upper_idx << 12 | upper_idx << 8 | - upper_idx << 4 | upper_idx); - phydev_dbg(phydev, "TX-VCM SW cal result: 0x%x\n", upper_idx); - } else if (lower_idx == TXRESERVE_MIN && upper_ret == 1 && - lower_ret == 1) { - ret = 0; - cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, - MTK_PHY_DA_RX_PSBN_TBT_MASK | - MTK_PHY_DA_RX_PSBN_HBT_MASK | - MTK_PHY_DA_RX_PSBN_GBE_MASK | - MTK_PHY_DA_RX_PSBN_LP_MASK, - lower_idx << 12 | lower_idx << 8 | - lower_idx << 4 | lower_idx); - phydev_warn(phydev, "TX-VCM SW cal result at low margin 0x%x\n", - lower_idx); - } else if (upper_idx == TXRESERVE_MAX && upper_ret == 0 && - lower_ret == 0) { - ret = 0; - phydev_warn(phydev, "TX-VCM SW cal result at high margin 0x%x\n", - upper_idx); - } else { - ret = -EINVAL; - } - -restore: - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, - MTK_PHY_RG_ANA_CALEN); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, - MTK_PHY_RG_TXVOS_CALEN); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, - MTK_PHY_RG_ZCALEN_A); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, - MTK_PHY_RG_ZCALEN_B | MTK_PHY_RG_ZCALEN_C | - MTK_PHY_RG_ZCALEN_D); - - return ret; -} - -static void mt798x_phy_common_finetune(struct phy_device *phydev) -{ - phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); - /* EnabRandUpdTrig = 1 */ - __phy_write(phydev, 0x11, 0x2f00); - __phy_write(phydev, 0x12, 0xe); - __phy_write(phydev, 0x10, 0x8fb0); - - /* NormMseLoThresh = 85 */ - __phy_write(phydev, 0x11, 0x55a0); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x83aa); - - /* TrFreeze = 0 */ - __phy_write(phydev, 0x11, 0x0); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x9686); - - /* SSTrKp1000Slv = 5 */ - __phy_write(phydev, 0x11, 0xbaef); - __phy_write(phydev, 0x12, 0x2e); - __phy_write(phydev, 0x10, 0x968c); - - /* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2, - * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2 - */ - __phy_write(phydev, 0x11, 0xd10a); - __phy_write(phydev, 0x12, 0x34); - __phy_write(phydev, 0x10, 0x8f82); - - /* VcoSlicerThreshBitsHigh */ - __phy_write(phydev, 0x11, 0x5555); - __phy_write(phydev, 0x12, 0x55); - __phy_write(phydev, 0x10, 0x8ec0); - phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); - - /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/ - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234, - MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK, - BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9)); - - /* rg_tr_lpf_cnt_val = 512 */ - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x200); - - /* IIR2 related */ - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_L, 0x82); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_U, 0x0); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_L, 0x103); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_U, 0x0); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_L, 0x82); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_U, 0x0); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_L, 0xd177); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_U, 0x3); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_L, 0x2c82); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_U, 0xe); - - /* FFE peaking */ - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27C, - MTK_PHY_VGASTATE_FFE_THR_ST1_MASK, 0x1b << 8); - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27D, - MTK_PHY_VGASTATE_FFE_THR_ST2_MASK, 0x1e); - - /* Disable LDO pump */ - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRAB, 0x0); - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRCD, 0x0); - /* Adjust LDO output voltage */ - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222); -} - -static void mt7981_phy_finetune(struct phy_device *phydev) -{ - u16 val[8] = { 0x01ce, 0x01c1, - 0x020f, 0x0202, - 0x03d0, 0x03c0, - 0x0013, 0x0005 }; - int i, k; - - /* 100M eye finetune: - * Keep middle level of TX MLT3 shapper as default. - * Only change TX MLT3 overshoot level here. - */ - for (k = 0, i = 1; i < 12; i++) { - if (i % 3 == 0) - continue; - phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]); - } - - phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); - /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */ - __phy_write(phydev, 0x11, 0xc71); - __phy_write(phydev, 0x12, 0xc); - __phy_write(phydev, 0x10, 0x8fae); - - /* ResetSyncOffset = 6 */ - __phy_write(phydev, 0x11, 0x600); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x8fc0); - - /* VgaDecRate = 1 */ - __phy_write(phydev, 0x11, 0x4c2a); - __phy_write(phydev, 0x12, 0x3e); - __phy_write(phydev, 0x10, 0x8fa4); - - /* FfeUpdGainForce = 4 */ - __phy_write(phydev, 0x11, 0x240); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x9680); - - phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); -} - -static void mt7988_phy_finetune(struct phy_device *phydev) -{ - u16 val[12] = { 0x0187, 0x01cd, 0x01c8, 0x0182, - 0x020d, 0x0206, 0x0384, 0x03d0, - 0x03c6, 0x030a, 0x0011, 0x0005 }; - int i; - - /* Set default MLT3 shaper first */ - for (i = 0; i < 12; i++) - phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[i]); - - /* TCT finetune */ - phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5); - - /* Disable TX power saving */ - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7, - MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8); - - phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); - - /* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */ - __phy_write(phydev, 0x11, 0x671); - __phy_write(phydev, 0x12, 0xc); - __phy_write(phydev, 0x10, 0x8fae); - - /* ResetSyncOffset = 5 */ - __phy_write(phydev, 0x11, 0x500); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x8fc0); - - /* VgaDecRate is 1 at default on mt7988 */ - - phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); - - phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30); - /* TxClkOffset = 2 */ - __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK, - FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2)); - phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); -} - -static void mt798x_phy_eee(struct phy_device *phydev) -{ - phy_modify_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG120, - MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK | - MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK, - FIELD_PREP(MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK, 0x0) | - FIELD_PREP(MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK, 0x14)); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122, - MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, - FIELD_PREP(MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, - 0xff)); - - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_TESTMUX_ADC_CTRL, - MTK_PHY_RG_TXEN_DIG_MASK); - - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DEV1E_REG19b, MTK_PHY_BYPASS_DSP_LPI_READY); - - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_DEV1E_REG234, MTK_PHY_TR_LP_IIR_EEE_EN); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG238, - MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK | - MTK_PHY_LPI_SLV_SEND_TX_EN, - FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120)); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239, - MTK_PHY_LPI_SEND_LOC_TIMER_MASK | - MTK_PHY_LPI_TXPCS_LOC_RCV, - FIELD_PREP(MTK_PHY_LPI_SEND_LOC_TIMER_MASK, 0x117)); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7, - MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK, - FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) | - FIELD_PREP(MTK_PHY_MIN_GAIN_MASK, 0x13)); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2D1, - MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK, - FIELD_PREP(MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK, - 0x33) | - MTK_PHY_LPI_SKIP_SD_SLV_TR | MTK_PHY_LPI_TR_READY | - MTK_PHY_LPI_VCO_EEE_STG0_EN); - - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG323, - MTK_PHY_EEE_WAKE_MAS_INT_DC | - MTK_PHY_EEE_WAKE_SLV_INT_DC); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG324, - MTK_PHY_SMI_DETCNT_MAX_MASK, - FIELD_PREP(MTK_PHY_SMI_DETCNT_MAX_MASK, 0x3f) | - MTK_PHY_SMI_DET_MAX_EN); - - phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG326, - MTK_PHY_LPI_MODE_SD_ON | MTK_PHY_RESET_RANDUPD_CNT | - MTK_PHY_TREC_UPDATE_ENAB_CLR | - MTK_PHY_LPI_QUIT_WAIT_DFE_SIG_DET_OFF | - MTK_PHY_TR_READY_SKIP_AFE_WAKEUP); - - phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); - /* Regsigdet_sel_1000 = 0 */ - __phy_write(phydev, 0x11, 0xb); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x9690); - - /* REG_EEE_st2TrKf1000 = 3 */ - __phy_write(phydev, 0x11, 0x114f); - __phy_write(phydev, 0x12, 0x2); - __phy_write(phydev, 0x10, 0x969a); - - /* RegEEE_slv_wake_tr_timer_tar = 6, RegEEE_slv_remtx_timer_tar = 20 */ - __phy_write(phydev, 0x11, 0x3028); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x969e); - - /* RegEEE_slv_wake_int_timer_tar = 8 */ - __phy_write(phydev, 0x11, 0x5010); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x96a0); - - /* RegEEE_trfreeze_timer2 = 586 */ - __phy_write(phydev, 0x11, 0x24a); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x96a8); - - /* RegEEE100Stg1_tar = 16 */ - __phy_write(phydev, 0x11, 0x3210); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x96b8); - - /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */ - __phy_write(phydev, 0x11, 0x1463); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x96ca); - - /* DfeTailEnableVgaThresh1000 = 27 */ - __phy_write(phydev, 0x11, 0x36); - __phy_write(phydev, 0x12, 0x0); - __phy_write(phydev, 0x10, 0x8f80); - phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); - - phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_3); - __phy_modify(phydev, MTK_PHY_LPI_REG_14, MTK_PHY_LPI_WAKE_TIMER_1000_MASK, - FIELD_PREP(MTK_PHY_LPI_WAKE_TIMER_1000_MASK, 0x19c)); - - __phy_modify(phydev, MTK_PHY_LPI_REG_1c, MTK_PHY_SMI_DET_ON_THRESH_MASK, - FIELD_PREP(MTK_PHY_SMI_DET_ON_THRESH_MASK, 0xc)); - phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); - - phy_modify_mmd(phydev, MDIO_MMD_VEND1, - MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122, - MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, - FIELD_PREP(MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, 0xff)); -} - -static int cal_sw(struct phy_device *phydev, enum CAL_ITEM cal_item, - u8 start_pair, u8 end_pair) -{ - u8 pair_n; - int ret; - - for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { - /* TX_OFFSET & TX_AMP have no SW calibration. */ - switch (cal_item) { - case TX_VCM: - ret = tx_vcm_cal_sw(phydev, pair_n); - break; - default: - return -EINVAL; - } - if (ret) - return ret; - } - return 0; -} - -static int cal_efuse(struct phy_device *phydev, enum CAL_ITEM cal_item, - u8 start_pair, u8 end_pair, u32 *buf) -{ - u8 pair_n; - int ret; - - for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { - /* TX_VCM has no efuse calibration. */ - switch (cal_item) { - case REXT: - ret = rext_cal_efuse(phydev, buf); - break; - case TX_OFFSET: - ret = tx_offset_cal_efuse(phydev, buf); - break; - case TX_AMP: - ret = tx_amp_cal_efuse(phydev, buf); - break; - case TX_R50: - ret = tx_r50_cal_efuse(phydev, buf, pair_n); - break; - default: - return -EINVAL; - } - if (ret) - return ret; - } - - return 0; -} - -static int start_cal(struct phy_device *phydev, enum CAL_ITEM cal_item, - enum CAL_MODE cal_mode, u8 start_pair, - u8 end_pair, u32 *buf) -{ - int ret; - - switch (cal_mode) { - case EFUSE_M: - ret = cal_efuse(phydev, cal_item, start_pair, - end_pair, buf); - break; - case SW_M: - ret = cal_sw(phydev, cal_item, start_pair, end_pair); - break; - default: - return -EINVAL; - } - - if (ret) { - phydev_err(phydev, "cal %d failed\n", cal_item); - return -EIO; - } - - return 0; -} - -static int mt798x_phy_calibration(struct phy_device *phydev) -{ - int ret = 0; - u32 *buf; - size_t len; - struct nvmem_cell *cell; - - cell = nvmem_cell_get(&phydev->mdio.dev, "phy-cal-data"); - if (IS_ERR(cell)) { - if (PTR_ERR(cell) == -EPROBE_DEFER) - return PTR_ERR(cell); - return 0; - } - - buf = (u32 *)nvmem_cell_read(cell, &len); - if (IS_ERR(buf)) - return PTR_ERR(buf); - nvmem_cell_put(cell); - - if (!buf[0] || !buf[1] || !buf[2] || !buf[3] || len < 4 * sizeof(u32)) { - phydev_err(phydev, "invalid efuse data\n"); - ret = -EINVAL; - goto out; - } - - ret = start_cal(phydev, REXT, EFUSE_M, NO_PAIR, NO_PAIR, buf); - if (ret) - goto out; - ret = start_cal(phydev, TX_OFFSET, EFUSE_M, NO_PAIR, NO_PAIR, buf); - if (ret) - goto out; - ret = start_cal(phydev, TX_AMP, EFUSE_M, NO_PAIR, NO_PAIR, buf); - if (ret) - goto out; - ret = start_cal(phydev, TX_R50, EFUSE_M, PAIR_A, PAIR_D, buf); - if (ret) - goto out; - ret = start_cal(phydev, TX_VCM, SW_M, PAIR_A, PAIR_A, buf); - if (ret) - goto out; - -out: - kfree(buf); - return ret; -} - -static int mt798x_phy_config_init(struct phy_device *phydev) -{ - switch (phydev->drv->phy_id) { - case MTK_GPHY_ID_MT7981: - mt7981_phy_finetune(phydev); - break; - case MTK_GPHY_ID_MT7988: - mt7988_phy_finetune(phydev); - break; - } - - mt798x_phy_common_finetune(phydev); - mt798x_phy_eee(phydev); - - return mt798x_phy_calibration(phydev); -} - -static int mt7988_phy_setup_led(struct phy_device *phydev) -{ - struct mtk_socphy_shared_priv *priv = phydev->shared->priv; - int port = phydev->mdio.addr; - u32 reg = priv->boottrap; - struct pinctrl *pinctrl; - - phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, - MTK_PHY_LED0_ENABLE | MTK_PHY_LED0_POLARITY | - MTK_PHY_LED0_ON_LINK10 | - MTK_PHY_LED0_ON_LINK100 | - MTK_PHY_LED0_ON_LINK1000); - phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_ON_CTRL, - MTK_PHY_LED1_ENABLE | MTK_PHY_LED1_POLARITY | - MTK_PHY_LED1_ON_LINK10 | - MTK_PHY_LED1_ON_LINK100 | - MTK_PHY_LED1_ON_LINK1000); - - if ((port == GPHY_PORT0 && reg & BIT(8)) || - (port == GPHY_PORT1 && reg & BIT(9)) || - (port == GPHY_PORT2 && reg & BIT(10)) || - (port == GPHY_PORT3 && reg & BIT(11))) { - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, - MTK_PHY_LED0_POLARITY); - phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_ON_CTRL, - MTK_PHY_LED1_POLARITY); - } - - phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_BLINK_CTRL, - MTK_PHY_LED0_1000TX | MTK_PHY_LED0_1000RX | - MTK_PHY_LED0_100TX | MTK_PHY_LED0_100RX | - MTK_PHY_LED0_10TX | MTK_PHY_LED0_10RX); - phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_BLINK_CTRL, - MTK_PHY_LED1_1000TX | MTK_PHY_LED1_1000RX | - MTK_PHY_LED1_100TX | MTK_PHY_LED1_100RX | - MTK_PHY_LED1_10TX | MTK_PHY_LED1_10RX); - - pinctrl = devm_pinctrl_get_select(&phydev->mdio.dev, "gbe-led"); - if (IS_ERR(pinctrl)) { - dev_err(&phydev->mdio.bus->dev, "Failed to setup LED pins\n"); - return PTR_ERR(pinctrl); - } - - return 0; -} - -static int mt7988_phy_probe_shared(struct phy_device *phydev) -{ - struct mtk_socphy_shared_priv *priv = phydev->shared->priv; - void __iomem *boottrap; - struct device_node *np; - u32 reg; - - np = of_find_compatible_node(NULL, NULL, "mediatek,boottrap"); - if (!np) - return -ENOENT; - - boottrap = of_iomap(np, 0); - if (!boottrap) - return -ENOMEM; - - reg = readl(boottrap); - iounmap(boottrap); - - priv->boottrap = reg; - - return 0; -} - -static int mt7981_phy_probe(struct phy_device *phydev) -{ - return mt798x_phy_calibration(phydev); -} - -static int mt7988_phy_probe(struct phy_device *phydev) -{ - int err; - - err = devm_phy_package_join(&phydev->mdio.dev, phydev, 0, - sizeof(struct mtk_socphy_shared_priv)); - if (err) - return err; - - if (phy_package_probe_once(phydev)) { - err = mt7988_phy_probe_shared(phydev); - if (err) - return err; - } - - mt7988_phy_setup_led(phydev); - - return mt798x_phy_calibration(phydev); -} - -static struct phy_driver mtk_socphy_driver[] = { - { - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), - .name = "MediaTek MT7981 PHY", - .config_init = mt798x_phy_config_init, - .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, - .probe = mt7981_phy_probe, - .suspend = genphy_suspend, - .resume = genphy_resume, - .read_page = mtk_socphy_read_page, - .write_page = mtk_socphy_write_page, - }, - { - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988), - .name = "MediaTek MT7988 PHY", - .config_init = mt798x_phy_config_init, - .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, - .probe = mt7988_phy_probe, - .suspend = genphy_suspend, - .resume = genphy_resume, - .read_page = mtk_socphy_read_page, - .write_page = mtk_socphy_write_page, - }, -}; - -module_phy_driver(mtk_socphy_driver); - -static struct mdio_device_id __maybe_unused mtk_socphy_tbl[] = { - { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981) }, - { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988) }, - { } -}; - -MODULE_DESCRIPTION("MediaTek SoC Gigabit Ethernet PHY driver"); -MODULE_AUTHOR("Daniel Golle "); -MODULE_AUTHOR("SkyLake Huang "); -MODULE_LICENSE("GPL"); - -MODULE_DEVICE_TABLE(mdio, mtk_socphy_tbl); diff --git a/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch deleted file mode 100644 index 0f06c298676e3e..00000000000000 --- a/target/linux/mediatek/patches-5.15/730-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 60ed9eb9605656c19ca402b7bd3f47552e901601 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Mon, 13 Feb 2023 02:33:14 +0000 -Subject: [PATCH] net: phy: add driver for MediaTek SoC built-in GE PHYs - -Some of MediaTek's Filogic SoCs come with built-in gigabit Ethernet -PHYs which require calibration data from the SoC's efuse. -Despite the similar design the driver doesn't share any code with the -existing mediatek-ge.c, so add support for these PHYs by introducing a -new driver for only MediaTek's ARM64 SoCs. - -Signed-off-by: Daniel Golle ---- - MAINTAINERS | 9 + - drivers/net/phy/Kconfig | 12 + - drivers/net/phy/Makefile | 1 + - drivers/net/phy/mediatek-ge-soc.c | 1263 +++++++++++++++++++++++++++++ - drivers/net/phy/mediatek-ge.c | 3 +- - 5 files changed, 1287 insertions(+), 1 deletion(-) - create mode 100644 drivers/net/phy/mediatek-ge-soc.c - ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -11790,6 +11790,15 @@ S: Maintained - F: drivers/net/pcs/pcs-mtk-lynxi.c - F: include/linux/pcs/pcs-mtk-lynxi.h - -+MEDIATEK ETHERNET PHY DRIVERS -+M: Daniel Golle -+M: Qingfang Deng -+M: SkyLake Huang -+L: netdev@vger.kernel.org -+S: Maintained -+F: drivers/net/phy/mediatek-ge-soc.c -+F: drivers/net/phy/mediatek-ge.c -+ - MEDIATEK I2C CONTROLLER DRIVER - M: Qii Wang - L: linux-i2c@vger.kernel.org ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -292,6 +292,18 @@ config MEDIATEK_GE_PHY - help - Supports the MediaTek Gigabit Ethernet PHYs. - -+config MEDIATEK_GE_SOC_PHY -+ tristate "MediaTek SoC Ethernet PHYs" -+ depends on (ARM64 && ARCH_MEDIATEK) || COMPILE_TEST -+ select NVMEM_MTK_EFUSE -+ help -+ Supports MediaTek SoC built-in Gigabit Ethernet PHYs. -+ -+ Include support for built-in Ethernet PHYs which are present in -+ the MT7981 and MT7988 SoCs. These PHYs need calibration data -+ present in the SoCs efuse and will dynamically calibrate VCM -+ (common-mode voltage) during startup. -+ - config MICREL_PHY - tristate "Micrel PHYs" - help ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -81,6 +81,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o - obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o - obj-$(CONFIG_MAXLINEAR_GPHY) += mxl-gpy.o - obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o -+obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o - obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o - obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o - obj-$(CONFIG_MICREL_PHY) += micrel.o ---- a/drivers/net/phy/mediatek-ge.c -+++ b/drivers/net/phy/mediatek-ge.c -@@ -136,7 +136,8 @@ static struct phy_driver mtk_gephy_drive - module_phy_driver(mtk_gephy_driver); - - static struct mdio_device_id __maybe_unused mtk_gephy_tbl[] = { -- { PHY_ID_MATCH_VENDOR(0x03a29400) }, -+ { PHY_ID_MATCH_EXACT(0x03a29441) }, -+ { PHY_ID_MATCH_EXACT(0x03a29412) }, - { } - }; - diff --git a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch new file mode 100644 index 00000000000000..26ebcb6733b7aa --- /dev/null +++ b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch @@ -0,0 +1,1204 @@ +From 98c485eaf509bc0e2a85f9b58d17cd501f274c4e Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 11 Jun 2023 00:48:10 +0100 +Subject: [PATCH] net: phy: add driver for MediaTek SoC built-in GE PHYs + +Some of MediaTek's Filogic SoCs come with built-in gigabit Ethernet +PHYs which require calibration data from the SoC's efuse. +Despite the similar design the driver doesn't share any code with the +existing mediatek-ge.c. +Add support for such PHYs by introducing a new driver with basic +support for MediaTek SoCs MT7981 and MT7988 built-in 1GE PHYs. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + MAINTAINERS | 9 + + drivers/net/phy/Kconfig | 12 + + drivers/net/phy/Makefile | 1 + + drivers/net/phy/mediatek-ge-soc.c | 1116 +++++++++++++++++++++++++++++ + drivers/net/phy/mediatek-ge.c | 3 +- + 5 files changed, 1140 insertions(+), 1 deletion(-) + create mode 100644 drivers/net/phy/mediatek-ge-soc.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -11790,6 +11790,15 @@ S: Maintained + F: drivers/net/pcs/pcs-mtk-lynxi.c + F: include/linux/pcs/pcs-mtk-lynxi.h + ++MEDIATEK ETHERNET PHY DRIVERS ++M: Daniel Golle ++M: Qingfang Deng ++M: SkyLake Huang ++L: netdev@vger.kernel.org ++S: Maintained ++F: drivers/net/phy/mediatek-ge-soc.c ++F: drivers/net/phy/mediatek-ge.c ++ + MEDIATEK I2C CONTROLLER DRIVER + M: Qii Wang + L: linux-i2c@vger.kernel.org +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -293,6 +293,18 @@ config MEDIATEK_GE_PHY + help + Supports the MediaTek Gigabit Ethernet PHYs. + ++config MEDIATEK_GE_SOC_PHY ++ tristate "MediaTek SoC Ethernet PHYs" ++ depends on (ARM64 && ARCH_MEDIATEK) || COMPILE_TEST ++ select NVMEM_MTK_EFUSE ++ help ++ Supports MediaTek SoC built-in Gigabit Ethernet PHYs. ++ ++ Include support for built-in Ethernet PHYs which are present in ++ the MT7981 and MT7988 SoCs. These PHYs need calibration data ++ present in the SoCs efuse and will dynamically calibrate VCM ++ (common-mode voltage) during startup. ++ + config MICREL_PHY + tristate "Micrel PHYs" + help +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -81,6 +81,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o + obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o + obj-$(CONFIG_MAXLINEAR_GPHY) += mxl-gpy.o + obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o ++obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o + obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o + obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o + obj-$(CONFIG_MICREL_PHY) += micrel.o +--- /dev/null ++++ b/drivers/net/phy/mediatek-ge-soc.c +@@ -0,0 +1,1116 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MTK_GPHY_ID_MT7981 0x03a29461 ++#define MTK_GPHY_ID_MT7988 0x03a29481 ++ ++#define MTK_EXT_PAGE_ACCESS 0x1f ++#define MTK_PHY_PAGE_STANDARD 0x0000 ++#define MTK_PHY_PAGE_EXTENDED_3 0x0003 ++ ++#define MTK_PHY_LPI_REG_14 0x14 ++#define MTK_PHY_LPI_WAKE_TIMER_1000_MASK GENMASK(8, 0) ++ ++#define MTK_PHY_LPI_REG_1c 0x1c ++#define MTK_PHY_SMI_DET_ON_THRESH_MASK GENMASK(13, 8) ++ ++#define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30 ++#define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 ++ ++#define ANALOG_INTERNAL_OPERATION_MAX_US 20 ++#define TXRESERVE_MIN 0 ++#define TXRESERVE_MAX 7 ++ ++#define MTK_PHY_ANARG_RG 0x10 ++#define MTK_PHY_TCLKOFFSET_MASK GENMASK(12, 8) ++ ++/* Registers on MDIO_MMD_VEND1 */ ++#define MTK_PHY_TXVLD_DA_RG 0x12 ++#define MTK_PHY_DA_TX_I2MPB_A_GBE_MASK GENMASK(15, 10) ++#define MTK_PHY_DA_TX_I2MPB_A_TBT_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_TX_I2MPB_TEST_MODE_A2 0x16 ++#define MTK_PHY_DA_TX_I2MPB_A_HBT_MASK GENMASK(15, 10) ++#define MTK_PHY_DA_TX_I2MPB_A_TST_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_TX_I2MPB_TEST_MODE_B1 0x17 ++#define MTK_PHY_DA_TX_I2MPB_B_GBE_MASK GENMASK(13, 8) ++#define MTK_PHY_DA_TX_I2MPB_B_TBT_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_TX_I2MPB_TEST_MODE_B2 0x18 ++#define MTK_PHY_DA_TX_I2MPB_B_HBT_MASK GENMASK(13, 8) ++#define MTK_PHY_DA_TX_I2MPB_B_TST_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_TX_I2MPB_TEST_MODE_C1 0x19 ++#define MTK_PHY_DA_TX_I2MPB_C_GBE_MASK GENMASK(13, 8) ++#define MTK_PHY_DA_TX_I2MPB_C_TBT_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_TX_I2MPB_TEST_MODE_C2 0x20 ++#define MTK_PHY_DA_TX_I2MPB_C_HBT_MASK GENMASK(13, 8) ++#define MTK_PHY_DA_TX_I2MPB_C_TST_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_TX_I2MPB_TEST_MODE_D1 0x21 ++#define MTK_PHY_DA_TX_I2MPB_D_GBE_MASK GENMASK(13, 8) ++#define MTK_PHY_DA_TX_I2MPB_D_TBT_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_TX_I2MPB_TEST_MODE_D2 0x22 ++#define MTK_PHY_DA_TX_I2MPB_D_HBT_MASK GENMASK(13, 8) ++#define MTK_PHY_DA_TX_I2MPB_D_TST_MASK GENMASK(5, 0) ++ ++#define MTK_PHY_RXADC_CTRL_RG7 0xc6 ++#define MTK_PHY_DA_AD_BUF_BIAS_LP_MASK GENMASK(9, 8) ++ ++#define MTK_PHY_RXADC_CTRL_RG9 0xc8 ++#define MTK_PHY_DA_RX_PSBN_TBT_MASK GENMASK(14, 12) ++#define MTK_PHY_DA_RX_PSBN_HBT_MASK GENMASK(10, 8) ++#define MTK_PHY_DA_RX_PSBN_GBE_MASK GENMASK(6, 4) ++#define MTK_PHY_DA_RX_PSBN_LP_MASK GENMASK(2, 0) ++ ++#define MTK_PHY_LDO_OUTPUT_V 0xd7 ++ ++#define MTK_PHY_RG_ANA_CAL_RG0 0xdb ++#define MTK_PHY_RG_CAL_CKINV BIT(12) ++#define MTK_PHY_RG_ANA_CALEN BIT(8) ++#define MTK_PHY_RG_ZCALEN_A BIT(0) ++ ++#define MTK_PHY_RG_ANA_CAL_RG1 0xdc ++#define MTK_PHY_RG_ZCALEN_B BIT(12) ++#define MTK_PHY_RG_ZCALEN_C BIT(8) ++#define MTK_PHY_RG_ZCALEN_D BIT(4) ++#define MTK_PHY_RG_TXVOS_CALEN BIT(0) ++ ++#define MTK_PHY_RG_ANA_CAL_RG5 0xe0 ++#define MTK_PHY_RG_REXT_TRIM_MASK GENMASK(13, 8) ++ ++#define MTK_PHY_RG_TX_FILTER 0xfe ++ ++#define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG120 0x120 ++#define MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK GENMASK(12, 8) ++#define MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK GENMASK(4, 0) ++ ++#define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122 0x122 ++#define MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK GENMASK(7, 0) ++ ++#define MTK_PHY_RG_TESTMUX_ADC_CTRL 0x144 ++#define MTK_PHY_RG_TXEN_DIG_MASK GENMASK(5, 5) ++ ++#define MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B 0x172 ++#define MTK_PHY_CR_TX_AMP_OFFSET_A_MASK GENMASK(13, 8) ++#define MTK_PHY_CR_TX_AMP_OFFSET_B_MASK GENMASK(6, 0) ++ ++#define MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D 0x173 ++#define MTK_PHY_CR_TX_AMP_OFFSET_C_MASK GENMASK(13, 8) ++#define MTK_PHY_CR_TX_AMP_OFFSET_D_MASK GENMASK(6, 0) ++ ++#define MTK_PHY_RG_AD_CAL_COMP 0x17a ++#define MTK_PHY_AD_CAL_COMP_OUT_SHIFT (8) ++ ++#define MTK_PHY_RG_AD_CAL_CLK 0x17b ++#define MTK_PHY_DA_CAL_CLK BIT(0) ++ ++#define MTK_PHY_RG_AD_CALIN 0x17c ++#define MTK_PHY_DA_CALIN_FLAG BIT(0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN0_A 0x17d ++#define MTK_PHY_DASN_DAC_IN0_A_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN0_B 0x17e ++#define MTK_PHY_DASN_DAC_IN0_B_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN0_C 0x17f ++#define MTK_PHY_DASN_DAC_IN0_C_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN0_D 0x180 ++#define MTK_PHY_DASN_DAC_IN0_D_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN1_A 0x181 ++#define MTK_PHY_DASN_DAC_IN1_A_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN1_B 0x182 ++#define MTK_PHY_DASN_DAC_IN1_B_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN1_C 0x183 ++#define MTK_PHY_DASN_DAC_IN1_C_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DASN_DAC_IN1_D 0x184 ++#define MTK_PHY_DASN_DAC_IN1_D_MASK GENMASK(9, 0) ++ ++#define MTK_PHY_RG_DEV1E_REG19b 0x19b ++#define MTK_PHY_BYPASS_DSP_LPI_READY BIT(8) ++ ++#define MTK_PHY_RG_LP_IIR2_K1_L 0x22a ++#define MTK_PHY_RG_LP_IIR2_K1_U 0x22b ++#define MTK_PHY_RG_LP_IIR2_K2_L 0x22c ++#define MTK_PHY_RG_LP_IIR2_K2_U 0x22d ++#define MTK_PHY_RG_LP_IIR2_K3_L 0x22e ++#define MTK_PHY_RG_LP_IIR2_K3_U 0x22f ++#define MTK_PHY_RG_LP_IIR2_K4_L 0x230 ++#define MTK_PHY_RG_LP_IIR2_K4_U 0x231 ++#define MTK_PHY_RG_LP_IIR2_K5_L 0x232 ++#define MTK_PHY_RG_LP_IIR2_K5_U 0x233 ++ ++#define MTK_PHY_RG_DEV1E_REG234 0x234 ++#define MTK_PHY_TR_OPEN_LOOP_EN_MASK GENMASK(0, 0) ++#define MTK_PHY_LPF_X_AVERAGE_MASK GENMASK(7, 4) ++#define MTK_PHY_TR_LP_IIR_EEE_EN BIT(12) ++ ++#define MTK_PHY_RG_LPF_CNT_VAL 0x235 ++ ++#define MTK_PHY_RG_DEV1E_REG238 0x238 ++#define MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK GENMASK(8, 0) ++#define MTK_PHY_LPI_SLV_SEND_TX_EN BIT(12) ++ ++#define MTK_PHY_RG_DEV1E_REG239 0x239 ++#define MTK_PHY_LPI_SEND_LOC_TIMER_MASK GENMASK(8, 0) ++#define MTK_PHY_LPI_TXPCS_LOC_RCV BIT(12) ++ ++#define MTK_PHY_RG_DEV1E_REG27C 0x27c ++#define MTK_PHY_VGASTATE_FFE_THR_ST1_MASK GENMASK(12, 8) ++#define MTK_PHY_RG_DEV1E_REG27D 0x27d ++#define MTK_PHY_VGASTATE_FFE_THR_ST2_MASK GENMASK(4, 0) ++ ++#define MTK_PHY_RG_DEV1E_REG2C7 0x2c7 ++#define MTK_PHY_MAX_GAIN_MASK GENMASK(4, 0) ++#define MTK_PHY_MIN_GAIN_MASK GENMASK(12, 8) ++ ++#define MTK_PHY_RG_DEV1E_REG2D1 0x2d1 ++#define MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK GENMASK(7, 0) ++#define MTK_PHY_LPI_SKIP_SD_SLV_TR BIT(8) ++#define MTK_PHY_LPI_TR_READY BIT(9) ++#define MTK_PHY_LPI_VCO_EEE_STG0_EN BIT(10) ++ ++#define MTK_PHY_RG_DEV1E_REG323 0x323 ++#define MTK_PHY_EEE_WAKE_MAS_INT_DC BIT(0) ++#define MTK_PHY_EEE_WAKE_SLV_INT_DC BIT(4) ++ ++#define MTK_PHY_RG_DEV1E_REG324 0x324 ++#define MTK_PHY_SMI_DETCNT_MAX_MASK GENMASK(5, 0) ++#define MTK_PHY_SMI_DET_MAX_EN BIT(8) ++ ++#define MTK_PHY_RG_DEV1E_REG326 0x326 ++#define MTK_PHY_LPI_MODE_SD_ON BIT(0) ++#define MTK_PHY_RESET_RANDUPD_CNT BIT(1) ++#define MTK_PHY_TREC_UPDATE_ENAB_CLR BIT(2) ++#define MTK_PHY_LPI_QUIT_WAIT_DFE_SIG_DET_OFF BIT(4) ++#define MTK_PHY_TR_READY_SKIP_AFE_WAKEUP BIT(5) ++ ++#define MTK_PHY_LDO_PUMP_EN_PAIRAB 0x502 ++#define MTK_PHY_LDO_PUMP_EN_PAIRCD 0x503 ++ ++#define MTK_PHY_DA_TX_R50_PAIR_A 0x53d ++#define MTK_PHY_DA_TX_R50_PAIR_B 0x53e ++#define MTK_PHY_DA_TX_R50_PAIR_C 0x53f ++#define MTK_PHY_DA_TX_R50_PAIR_D 0x540 ++ ++#define MTK_PHY_RG_BG_RASEL 0x115 ++#define MTK_PHY_RG_BG_RASEL_MASK GENMASK(2, 0) ++ ++/* These macro privides efuse parsing for internal phy. */ ++#define EFS_DA_TX_I2MPB_A(x) (((x) >> 0) & GENMASK(5, 0)) ++#define EFS_DA_TX_I2MPB_B(x) (((x) >> 6) & GENMASK(5, 0)) ++#define EFS_DA_TX_I2MPB_C(x) (((x) >> 12) & GENMASK(5, 0)) ++#define EFS_DA_TX_I2MPB_D(x) (((x) >> 18) & GENMASK(5, 0)) ++#define EFS_DA_TX_AMP_OFFSET_A(x) (((x) >> 24) & GENMASK(5, 0)) ++ ++#define EFS_DA_TX_AMP_OFFSET_B(x) (((x) >> 0) & GENMASK(5, 0)) ++#define EFS_DA_TX_AMP_OFFSET_C(x) (((x) >> 6) & GENMASK(5, 0)) ++#define EFS_DA_TX_AMP_OFFSET_D(x) (((x) >> 12) & GENMASK(5, 0)) ++#define EFS_DA_TX_R50_A(x) (((x) >> 18) & GENMASK(5, 0)) ++#define EFS_DA_TX_R50_B(x) (((x) >> 24) & GENMASK(5, 0)) ++ ++#define EFS_DA_TX_R50_C(x) (((x) >> 0) & GENMASK(5, 0)) ++#define EFS_DA_TX_R50_D(x) (((x) >> 6) & GENMASK(5, 0)) ++ ++#define EFS_RG_BG_RASEL(x) (((x) >> 4) & GENMASK(2, 0)) ++#define EFS_RG_REXT_TRIM(x) (((x) >> 7) & GENMASK(5, 0)) ++ ++enum { ++ NO_PAIR, ++ PAIR_A, ++ PAIR_B, ++ PAIR_C, ++ PAIR_D, ++}; ++ ++enum { ++ GPHY_PORT0, ++ GPHY_PORT1, ++ GPHY_PORT2, ++ GPHY_PORT3, ++}; ++ ++enum calibration_mode { ++ EFUSE_K, ++ SW_K ++}; ++ ++enum CAL_ITEM { ++ REXT, ++ TX_OFFSET, ++ TX_AMP, ++ TX_R50, ++ TX_VCM ++}; ++ ++enum CAL_MODE { ++ EFUSE_M, ++ SW_M ++}; ++ ++static int mtk_socphy_read_page(struct phy_device *phydev) ++{ ++ return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); ++} ++ ++static int mtk_socphy_write_page(struct phy_device *phydev, int page) ++{ ++ return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page); ++} ++ ++/* One calibration cycle consists of: ++ * 1.Set DA_CALIN_FLAG high to start calibration. Keep it high ++ * until AD_CAL_COMP is ready to output calibration result. ++ * 2.Wait until DA_CAL_CLK is available. ++ * 3.Fetch AD_CAL_COMP_OUT. ++ */ ++static int cal_cycle(struct phy_device *phydev, int devad, ++ u32 regnum, u16 mask, u16 cal_val) ++{ ++ int reg_val; ++ int ret; ++ ++ phy_modify_mmd(phydev, devad, regnum, ++ mask, cal_val); ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, ++ MTK_PHY_DA_CALIN_FLAG); ++ ++ ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_AD_CAL_CLK, reg_val, ++ reg_val & MTK_PHY_DA_CAL_CLK, 500, ++ ANALOG_INTERNAL_OPERATION_MAX_US, false); ++ if (ret) { ++ phydev_err(phydev, "Calibration cycle timeout\n"); ++ return ret; ++ } ++ ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN, ++ MTK_PHY_DA_CALIN_FLAG); ++ ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CAL_COMP) >> ++ MTK_PHY_AD_CAL_COMP_OUT_SHIFT; ++ phydev_dbg(phydev, "cal_val: 0x%x, ret: %d\n", cal_val, ret); ++ ++ return ret; ++} ++ ++static int rext_fill_result(struct phy_device *phydev, u16 *buf) ++{ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG5, ++ MTK_PHY_RG_REXT_TRIM_MASK, buf[0] << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_RG_BG_RASEL, ++ MTK_PHY_RG_BG_RASEL_MASK, buf[1]); ++ ++ return 0; ++} ++ ++static int rext_cal_efuse(struct phy_device *phydev, u32 *buf) ++{ ++ u16 rext_cal_val[2]; ++ ++ rext_cal_val[0] = EFS_RG_REXT_TRIM(buf[3]); ++ rext_cal_val[1] = EFS_RG_BG_RASEL(buf[3]); ++ rext_fill_result(phydev, rext_cal_val); ++ ++ return 0; ++} ++ ++static int tx_offset_fill_result(struct phy_device *phydev, u16 *buf) ++{ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, ++ MTK_PHY_CR_TX_AMP_OFFSET_A_MASK, buf[0] << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_A_B, ++ MTK_PHY_CR_TX_AMP_OFFSET_B_MASK, buf[1]); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, ++ MTK_PHY_CR_TX_AMP_OFFSET_C_MASK, buf[2] << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_CR_TX_AMP_OFFSET_C_D, ++ MTK_PHY_CR_TX_AMP_OFFSET_D_MASK, buf[3]); ++ ++ return 0; ++} ++ ++static int tx_offset_cal_efuse(struct phy_device *phydev, u32 *buf) ++{ ++ u16 tx_offset_cal_val[4]; ++ ++ tx_offset_cal_val[0] = EFS_DA_TX_AMP_OFFSET_A(buf[0]); ++ tx_offset_cal_val[1] = EFS_DA_TX_AMP_OFFSET_B(buf[1]); ++ tx_offset_cal_val[2] = EFS_DA_TX_AMP_OFFSET_C(buf[1]); ++ tx_offset_cal_val[3] = EFS_DA_TX_AMP_OFFSET_D(buf[1]); ++ ++ tx_offset_fill_result(phydev, tx_offset_cal_val); ++ ++ return 0; ++} ++ ++static int tx_amp_fill_result(struct phy_device *phydev, u16 *buf) ++{ ++ int i; ++ int bias[16] = {}; ++ const int vals_9461[16] = { 7, 1, 4, 7, ++ 7, 1, 4, 7, ++ 7, 1, 4, 7, ++ 7, 1, 4, 7 }; ++ const int vals_9481[16] = { 10, 6, 6, 10, ++ 10, 6, 6, 10, ++ 10, 6, 6, 10, ++ 10, 6, 6, 10 }; ++ switch (phydev->drv->phy_id) { ++ case MTK_GPHY_ID_MT7981: ++ /* We add some calibration to efuse values ++ * due to board level influence. ++ * GBE: +7, TBT: +1, HBT: +4, TST: +7 ++ */ ++ memcpy(bias, (const void *)vals_9461, sizeof(bias)); ++ break; ++ case MTK_GPHY_ID_MT7988: ++ memcpy(bias, (const void *)vals_9481, sizeof(bias)); ++ break; ++ } ++ ++ /* Prevent overflow */ ++ for (i = 0; i < 12; i++) { ++ if (buf[i >> 2] + bias[i] > 63) { ++ buf[i >> 2] = 63; ++ bias[i] = 0; ++ } ++ } ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, ++ MTK_PHY_DA_TX_I2MPB_A_GBE_MASK, (buf[0] + bias[0]) << 10); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG, ++ MTK_PHY_DA_TX_I2MPB_A_TBT_MASK, buf[0] + bias[1]); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, ++ MTK_PHY_DA_TX_I2MPB_A_HBT_MASK, (buf[0] + bias[2]) << 10); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_A2, ++ MTK_PHY_DA_TX_I2MPB_A_TST_MASK, buf[0] + bias[3]); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, ++ MTK_PHY_DA_TX_I2MPB_B_GBE_MASK, (buf[1] + bias[4]) << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B1, ++ MTK_PHY_DA_TX_I2MPB_B_TBT_MASK, buf[1] + bias[5]); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, ++ MTK_PHY_DA_TX_I2MPB_B_HBT_MASK, (buf[1] + bias[6]) << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_B2, ++ MTK_PHY_DA_TX_I2MPB_B_TST_MASK, buf[1] + bias[7]); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, ++ MTK_PHY_DA_TX_I2MPB_C_GBE_MASK, (buf[2] + bias[8]) << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C1, ++ MTK_PHY_DA_TX_I2MPB_C_TBT_MASK, buf[2] + bias[9]); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, ++ MTK_PHY_DA_TX_I2MPB_C_HBT_MASK, (buf[2] + bias[10]) << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, ++ MTK_PHY_DA_TX_I2MPB_C_TST_MASK, buf[2] + bias[11]); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, ++ MTK_PHY_DA_TX_I2MPB_D_GBE_MASK, (buf[3] + bias[12]) << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, ++ MTK_PHY_DA_TX_I2MPB_D_TBT_MASK, buf[3] + bias[13]); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, ++ MTK_PHY_DA_TX_I2MPB_D_HBT_MASK, (buf[3] + bias[14]) << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, ++ MTK_PHY_DA_TX_I2MPB_D_TST_MASK, buf[3] + bias[15]); ++ ++ return 0; ++} ++ ++static int tx_amp_cal_efuse(struct phy_device *phydev, u32 *buf) ++{ ++ u16 tx_amp_cal_val[4]; ++ ++ tx_amp_cal_val[0] = EFS_DA_TX_I2MPB_A(buf[0]); ++ tx_amp_cal_val[1] = EFS_DA_TX_I2MPB_B(buf[0]); ++ tx_amp_cal_val[2] = EFS_DA_TX_I2MPB_C(buf[0]); ++ tx_amp_cal_val[3] = EFS_DA_TX_I2MPB_D(buf[0]); ++ tx_amp_fill_result(phydev, tx_amp_cal_val); ++ ++ return 0; ++} ++ ++static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val, ++ u8 txg_calen_x) ++{ ++ int bias = 0; ++ u16 reg, val; ++ ++ if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988) ++ bias = -2; ++ ++ val = clamp_val(bias + tx_r50_cal_val, 0, 63); ++ ++ switch (txg_calen_x) { ++ case PAIR_A: ++ reg = MTK_PHY_DA_TX_R50_PAIR_A; ++ break; ++ case PAIR_B: ++ reg = MTK_PHY_DA_TX_R50_PAIR_B; ++ break; ++ case PAIR_C: ++ reg = MTK_PHY_DA_TX_R50_PAIR_C; ++ break; ++ case PAIR_D: ++ reg = MTK_PHY_DA_TX_R50_PAIR_D; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, val | val << 8); ++ ++ return 0; ++} ++ ++static int tx_r50_cal_efuse(struct phy_device *phydev, u32 *buf, ++ u8 txg_calen_x) ++{ ++ u16 tx_r50_cal_val; ++ ++ switch (txg_calen_x) { ++ case PAIR_A: ++ tx_r50_cal_val = EFS_DA_TX_R50_A(buf[1]); ++ break; ++ case PAIR_B: ++ tx_r50_cal_val = EFS_DA_TX_R50_B(buf[1]); ++ break; ++ case PAIR_C: ++ tx_r50_cal_val = EFS_DA_TX_R50_C(buf[2]); ++ break; ++ case PAIR_D: ++ tx_r50_cal_val = EFS_DA_TX_R50_D(buf[2]); ++ break; ++ default: ++ return -EINVAL; ++ } ++ tx_r50_fill_result(phydev, tx_r50_cal_val, txg_calen_x); ++ ++ return 0; ++} ++ ++static int tx_vcm_cal_sw(struct phy_device *phydev, u8 rg_txreserve_x) ++{ ++ u8 lower_idx, upper_idx, txreserve_val; ++ u8 lower_ret, upper_ret; ++ int ret; ++ ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, ++ MTK_PHY_RG_ANA_CALEN); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, ++ MTK_PHY_RG_CAL_CKINV); ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, ++ MTK_PHY_RG_TXVOS_CALEN); ++ ++ switch (rg_txreserve_x) { ++ case PAIR_A: ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN0_A, ++ MTK_PHY_DASN_DAC_IN0_A_MASK); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN1_A, ++ MTK_PHY_DASN_DAC_IN1_A_MASK); ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_ANA_CAL_RG0, ++ MTK_PHY_RG_ZCALEN_A); ++ break; ++ case PAIR_B: ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN0_B, ++ MTK_PHY_DASN_DAC_IN0_B_MASK); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN1_B, ++ MTK_PHY_DASN_DAC_IN1_B_MASK); ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_ANA_CAL_RG1, ++ MTK_PHY_RG_ZCALEN_B); ++ break; ++ case PAIR_C: ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN0_C, ++ MTK_PHY_DASN_DAC_IN0_C_MASK); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN1_C, ++ MTK_PHY_DASN_DAC_IN1_C_MASK); ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_ANA_CAL_RG1, ++ MTK_PHY_RG_ZCALEN_C); ++ break; ++ case PAIR_D: ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN0_D, ++ MTK_PHY_DASN_DAC_IN0_D_MASK); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DASN_DAC_IN1_D, ++ MTK_PHY_DASN_DAC_IN1_D_MASK); ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_ANA_CAL_RG1, ++ MTK_PHY_RG_ZCALEN_D); ++ break; ++ default: ++ ret = -EINVAL; ++ goto restore; ++ } ++ ++ lower_idx = TXRESERVE_MIN; ++ upper_idx = TXRESERVE_MAX; ++ ++ phydev_dbg(phydev, "Start TX-VCM SW cal.\n"); ++ while ((upper_idx - lower_idx) > 1) { ++ txreserve_val = DIV_ROUND_CLOSEST(lower_idx + upper_idx, 2); ++ ret = cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, ++ MTK_PHY_DA_RX_PSBN_TBT_MASK | ++ MTK_PHY_DA_RX_PSBN_HBT_MASK | ++ MTK_PHY_DA_RX_PSBN_GBE_MASK | ++ MTK_PHY_DA_RX_PSBN_LP_MASK, ++ txreserve_val << 12 | txreserve_val << 8 | ++ txreserve_val << 4 | txreserve_val); ++ if (ret == 1) { ++ upper_idx = txreserve_val; ++ upper_ret = ret; ++ } else if (ret == 0) { ++ lower_idx = txreserve_val; ++ lower_ret = ret; ++ } else { ++ goto restore; ++ } ++ } ++ ++ if (lower_idx == TXRESERVE_MIN) { ++ lower_ret = cal_cycle(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RXADC_CTRL_RG9, ++ MTK_PHY_DA_RX_PSBN_TBT_MASK | ++ MTK_PHY_DA_RX_PSBN_HBT_MASK | ++ MTK_PHY_DA_RX_PSBN_GBE_MASK | ++ MTK_PHY_DA_RX_PSBN_LP_MASK, ++ lower_idx << 12 | lower_idx << 8 | ++ lower_idx << 4 | lower_idx); ++ ret = lower_ret; ++ } else if (upper_idx == TXRESERVE_MAX) { ++ upper_ret = cal_cycle(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RXADC_CTRL_RG9, ++ MTK_PHY_DA_RX_PSBN_TBT_MASK | ++ MTK_PHY_DA_RX_PSBN_HBT_MASK | ++ MTK_PHY_DA_RX_PSBN_GBE_MASK | ++ MTK_PHY_DA_RX_PSBN_LP_MASK, ++ upper_idx << 12 | upper_idx << 8 | ++ upper_idx << 4 | upper_idx); ++ ret = upper_ret; ++ } ++ if (ret < 0) ++ goto restore; ++ ++ /* We calibrate TX-VCM in different logic. Check upper index and then ++ * lower index. If this calibration is valid, apply lower index's result. ++ */ ++ ret = upper_ret - lower_ret; ++ if (ret == 1) { ++ ret = 0; ++ /* Make sure we use upper_idx in our calibration system */ ++ cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, ++ MTK_PHY_DA_RX_PSBN_TBT_MASK | ++ MTK_PHY_DA_RX_PSBN_HBT_MASK | ++ MTK_PHY_DA_RX_PSBN_GBE_MASK | ++ MTK_PHY_DA_RX_PSBN_LP_MASK, ++ upper_idx << 12 | upper_idx << 8 | ++ upper_idx << 4 | upper_idx); ++ phydev_dbg(phydev, "TX-VCM SW cal result: 0x%x\n", upper_idx); ++ } else if (lower_idx == TXRESERVE_MIN && upper_ret == 1 && ++ lower_ret == 1) { ++ ret = 0; ++ cal_cycle(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG9, ++ MTK_PHY_DA_RX_PSBN_TBT_MASK | ++ MTK_PHY_DA_RX_PSBN_HBT_MASK | ++ MTK_PHY_DA_RX_PSBN_GBE_MASK | ++ MTK_PHY_DA_RX_PSBN_LP_MASK, ++ lower_idx << 12 | lower_idx << 8 | ++ lower_idx << 4 | lower_idx); ++ phydev_warn(phydev, "TX-VCM SW cal result at low margin 0x%x\n", ++ lower_idx); ++ } else if (upper_idx == TXRESERVE_MAX && upper_ret == 0 && ++ lower_ret == 0) { ++ ret = 0; ++ phydev_warn(phydev, "TX-VCM SW cal result at high margin 0x%x\n", ++ upper_idx); ++ } else { ++ ret = -EINVAL; ++ } ++ ++restore: ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, ++ MTK_PHY_RG_ANA_CALEN); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, ++ MTK_PHY_RG_TXVOS_CALEN); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG0, ++ MTK_PHY_RG_ZCALEN_A); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_ANA_CAL_RG1, ++ MTK_PHY_RG_ZCALEN_B | MTK_PHY_RG_ZCALEN_C | ++ MTK_PHY_RG_ZCALEN_D); ++ ++ return ret; ++} ++ ++static void mt798x_phy_common_finetune(struct phy_device *phydev) ++{ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); ++ /* EnabRandUpdTrig = 1 */ ++ __phy_write(phydev, 0x11, 0x2f00); ++ __phy_write(phydev, 0x12, 0xe); ++ __phy_write(phydev, 0x10, 0x8fb0); ++ ++ /* NormMseLoThresh = 85 */ ++ __phy_write(phydev, 0x11, 0x55a0); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x83aa); ++ ++ /* TrFreeze = 0 */ ++ __phy_write(phydev, 0x11, 0x0); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x9686); ++ ++ /* SSTrKp1000Slv = 5 */ ++ __phy_write(phydev, 0x11, 0xbaef); ++ __phy_write(phydev, 0x12, 0x2e); ++ __phy_write(phydev, 0x10, 0x968c); ++ ++ /* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2, ++ * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2 ++ */ ++ __phy_write(phydev, 0x11, 0xd10a); ++ __phy_write(phydev, 0x12, 0x34); ++ __phy_write(phydev, 0x10, 0x8f82); ++ ++ /* VcoSlicerThreshBitsHigh */ ++ __phy_write(phydev, 0x11, 0x5555); ++ __phy_write(phydev, 0x12, 0x55); ++ __phy_write(phydev, 0x10, 0x8ec0); ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++ ++ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234, ++ MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK, ++ BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9)); ++ ++ /* rg_tr_lpf_cnt_val = 512 */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x200); ++ ++ /* IIR2 related */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_L, 0x82); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K1_U, 0x0); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_L, 0x103); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K2_U, 0x0); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_L, 0x82); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K3_U, 0x0); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_L, 0xd177); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K4_U, 0x3); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_L, 0x2c82); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LP_IIR2_K5_U, 0xe); ++ ++ /* FFE peaking */ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27C, ++ MTK_PHY_VGASTATE_FFE_THR_ST1_MASK, 0x1b << 8); ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG27D, ++ MTK_PHY_VGASTATE_FFE_THR_ST2_MASK, 0x1e); ++ ++ /* Disable LDO pump */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRAB, 0x0); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRCD, 0x0); ++ /* Adjust LDO output voltage */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222); ++} ++ ++static void mt7981_phy_finetune(struct phy_device *phydev) ++{ ++ u16 val[8] = { 0x01ce, 0x01c1, ++ 0x020f, 0x0202, ++ 0x03d0, 0x03c0, ++ 0x0013, 0x0005 }; ++ int i, k; ++ ++ /* 100M eye finetune: ++ * Keep middle level of TX MLT3 shapper as default. ++ * Only change TX MLT3 overshoot level here. ++ */ ++ for (k = 0, i = 1; i < 12; i++) { ++ if (i % 3 == 0) ++ continue; ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]); ++ } ++ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); ++ /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */ ++ __phy_write(phydev, 0x11, 0xc71); ++ __phy_write(phydev, 0x12, 0xc); ++ __phy_write(phydev, 0x10, 0x8fae); ++ ++ /* ResetSyncOffset = 6 */ ++ __phy_write(phydev, 0x11, 0x600); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x8fc0); ++ ++ /* VgaDecRate = 1 */ ++ __phy_write(phydev, 0x11, 0x4c2a); ++ __phy_write(phydev, 0x12, 0x3e); ++ __phy_write(phydev, 0x10, 0x8fa4); ++ ++ /* FfeUpdGainForce = 4 */ ++ __phy_write(phydev, 0x11, 0x240); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x9680); ++ ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++} ++ ++static void mt7988_phy_finetune(struct phy_device *phydev) ++{ ++ u16 val[12] = { 0x0187, 0x01cd, 0x01c8, 0x0182, ++ 0x020d, 0x0206, 0x0384, 0x03d0, ++ 0x03c6, 0x030a, 0x0011, 0x0005 }; ++ int i; ++ ++ /* Set default MLT3 shaper first */ ++ for (i = 0; i < 12; i++) ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[i]); ++ ++ /* TCT finetune */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5); ++ ++ /* Disable TX power saving */ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7, ++ MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8); ++ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); ++ ++ /* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */ ++ __phy_write(phydev, 0x11, 0x671); ++ __phy_write(phydev, 0x12, 0xc); ++ __phy_write(phydev, 0x10, 0x8fae); ++ ++ /* ResetSyncOffset = 5 */ ++ __phy_write(phydev, 0x11, 0x500); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x8fc0); ++ ++ /* VgaDecRate is 1 at default on mt7988 */ ++ ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30); ++ /* TxClkOffset = 2 */ ++ __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK, ++ FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2)); ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++} ++ ++static void mt798x_phy_eee(struct phy_device *phydev) ++{ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG120, ++ MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK | ++ MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK, ++ FIELD_PREP(MTK_PHY_LPI_SIG_EN_LO_THRESH1000_MASK, 0x0) | ++ FIELD_PREP(MTK_PHY_LPI_SIG_EN_HI_THRESH1000_MASK, 0x14)); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122, ++ MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, ++ FIELD_PREP(MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, ++ 0xff)); ++ ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_TESTMUX_ADC_CTRL, ++ MTK_PHY_RG_TXEN_DIG_MASK); ++ ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DEV1E_REG19b, MTK_PHY_BYPASS_DSP_LPI_READY); ++ ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_DEV1E_REG234, MTK_PHY_TR_LP_IIR_EEE_EN); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG238, ++ MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK | ++ MTK_PHY_LPI_SLV_SEND_TX_EN, ++ FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120)); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239, ++ MTK_PHY_LPI_SEND_LOC_TIMER_MASK | ++ MTK_PHY_LPI_TXPCS_LOC_RCV, ++ FIELD_PREP(MTK_PHY_LPI_SEND_LOC_TIMER_MASK, 0x117)); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7, ++ MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK, ++ FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) | ++ FIELD_PREP(MTK_PHY_MIN_GAIN_MASK, 0x13)); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2D1, ++ MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK, ++ FIELD_PREP(MTK_PHY_VCO_SLICER_THRESH_BITS_HIGH_EEE_MASK, ++ 0x33) | ++ MTK_PHY_LPI_SKIP_SD_SLV_TR | MTK_PHY_LPI_TR_READY | ++ MTK_PHY_LPI_VCO_EEE_STG0_EN); ++ ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG323, ++ MTK_PHY_EEE_WAKE_MAS_INT_DC | ++ MTK_PHY_EEE_WAKE_SLV_INT_DC); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG324, ++ MTK_PHY_SMI_DETCNT_MAX_MASK, ++ FIELD_PREP(MTK_PHY_SMI_DETCNT_MAX_MASK, 0x3f) | ++ MTK_PHY_SMI_DET_MAX_EN); ++ ++ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG326, ++ MTK_PHY_LPI_MODE_SD_ON | MTK_PHY_RESET_RANDUPD_CNT | ++ MTK_PHY_TREC_UPDATE_ENAB_CLR | ++ MTK_PHY_LPI_QUIT_WAIT_DFE_SIG_DET_OFF | ++ MTK_PHY_TR_READY_SKIP_AFE_WAKEUP); ++ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); ++ /* Regsigdet_sel_1000 = 0 */ ++ __phy_write(phydev, 0x11, 0xb); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x9690); ++ ++ /* REG_EEE_st2TrKf1000 = 3 */ ++ __phy_write(phydev, 0x11, 0x114f); ++ __phy_write(phydev, 0x12, 0x2); ++ __phy_write(phydev, 0x10, 0x969a); ++ ++ /* RegEEE_slv_wake_tr_timer_tar = 6, RegEEE_slv_remtx_timer_tar = 20 */ ++ __phy_write(phydev, 0x11, 0x3028); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x969e); ++ ++ /* RegEEE_slv_wake_int_timer_tar = 8 */ ++ __phy_write(phydev, 0x11, 0x5010); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x96a0); ++ ++ /* RegEEE_trfreeze_timer2 = 586 */ ++ __phy_write(phydev, 0x11, 0x24a); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x96a8); ++ ++ /* RegEEE100Stg1_tar = 16 */ ++ __phy_write(phydev, 0x11, 0x3210); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x96b8); ++ ++ /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */ ++ __phy_write(phydev, 0x11, 0x1463); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x96ca); ++ ++ /* DfeTailEnableVgaThresh1000 = 27 */ ++ __phy_write(phydev, 0x11, 0x36); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x8f80); ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_3); ++ __phy_modify(phydev, MTK_PHY_LPI_REG_14, MTK_PHY_LPI_WAKE_TIMER_1000_MASK, ++ FIELD_PREP(MTK_PHY_LPI_WAKE_TIMER_1000_MASK, 0x19c)); ++ ++ __phy_modify(phydev, MTK_PHY_LPI_REG_1c, MTK_PHY_SMI_DET_ON_THRESH_MASK, ++ FIELD_PREP(MTK_PHY_SMI_DET_ON_THRESH_MASK, 0xc)); ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, ++ MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG122, ++ MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, ++ FIELD_PREP(MTK_PHY_LPI_NORM_MSE_HI_THRESH1000_MASK, 0xff)); ++} ++ ++static int cal_sw(struct phy_device *phydev, enum CAL_ITEM cal_item, ++ u8 start_pair, u8 end_pair) ++{ ++ u8 pair_n; ++ int ret; ++ ++ for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { ++ /* TX_OFFSET & TX_AMP have no SW calibration. */ ++ switch (cal_item) { ++ case TX_VCM: ++ ret = tx_vcm_cal_sw(phydev, pair_n); ++ break; ++ default: ++ return -EINVAL; ++ } ++ if (ret) ++ return ret; ++ } ++ return 0; ++} ++ ++static int cal_efuse(struct phy_device *phydev, enum CAL_ITEM cal_item, ++ u8 start_pair, u8 end_pair, u32 *buf) ++{ ++ u8 pair_n; ++ int ret; ++ ++ for (pair_n = start_pair; pair_n <= end_pair; pair_n++) { ++ /* TX_VCM has no efuse calibration. */ ++ switch (cal_item) { ++ case REXT: ++ ret = rext_cal_efuse(phydev, buf); ++ break; ++ case TX_OFFSET: ++ ret = tx_offset_cal_efuse(phydev, buf); ++ break; ++ case TX_AMP: ++ ret = tx_amp_cal_efuse(phydev, buf); ++ break; ++ case TX_R50: ++ ret = tx_r50_cal_efuse(phydev, buf, pair_n); ++ break; ++ default: ++ return -EINVAL; ++ } ++ if (ret) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int start_cal(struct phy_device *phydev, enum CAL_ITEM cal_item, ++ enum CAL_MODE cal_mode, u8 start_pair, ++ u8 end_pair, u32 *buf) ++{ ++ int ret; ++ ++ switch (cal_mode) { ++ case EFUSE_M: ++ ret = cal_efuse(phydev, cal_item, start_pair, ++ end_pair, buf); ++ break; ++ case SW_M: ++ ret = cal_sw(phydev, cal_item, start_pair, end_pair); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (ret) { ++ phydev_err(phydev, "cal %d failed\n", cal_item); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++static int mt798x_phy_calibration(struct phy_device *phydev) ++{ ++ int ret = 0; ++ u32 *buf; ++ size_t len; ++ struct nvmem_cell *cell; ++ ++ cell = nvmem_cell_get(&phydev->mdio.dev, "phy-cal-data"); ++ if (IS_ERR(cell)) { ++ if (PTR_ERR(cell) == -EPROBE_DEFER) ++ return PTR_ERR(cell); ++ return 0; ++ } ++ ++ buf = (u32 *)nvmem_cell_read(cell, &len); ++ if (IS_ERR(buf)) ++ return PTR_ERR(buf); ++ nvmem_cell_put(cell); ++ ++ if (!buf[0] || !buf[1] || !buf[2] || !buf[3] || len < 4 * sizeof(u32)) { ++ phydev_err(phydev, "invalid efuse data\n"); ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ ret = start_cal(phydev, REXT, EFUSE_M, NO_PAIR, NO_PAIR, buf); ++ if (ret) ++ goto out; ++ ret = start_cal(phydev, TX_OFFSET, EFUSE_M, NO_PAIR, NO_PAIR, buf); ++ if (ret) ++ goto out; ++ ret = start_cal(phydev, TX_AMP, EFUSE_M, NO_PAIR, NO_PAIR, buf); ++ if (ret) ++ goto out; ++ ret = start_cal(phydev, TX_R50, EFUSE_M, PAIR_A, PAIR_D, buf); ++ if (ret) ++ goto out; ++ ret = start_cal(phydev, TX_VCM, SW_M, PAIR_A, PAIR_A, buf); ++ if (ret) ++ goto out; ++ ++out: ++ kfree(buf); ++ return ret; ++} ++ ++static int mt798x_phy_config_init(struct phy_device *phydev) ++{ ++ switch (phydev->drv->phy_id) { ++ case MTK_GPHY_ID_MT7981: ++ mt7981_phy_finetune(phydev); ++ break; ++ case MTK_GPHY_ID_MT7988: ++ mt7988_phy_finetune(phydev); ++ break; ++ } ++ ++ mt798x_phy_common_finetune(phydev); ++ mt798x_phy_eee(phydev); ++ ++ return mt798x_phy_calibration(phydev); ++} ++ ++static struct phy_driver mtk_socphy_driver[] = { ++ { ++ PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), ++ .name = "MediaTek MT7981 PHY", ++ .config_init = mt798x_phy_config_init, ++ .config_intr = genphy_no_config_intr, ++ .handle_interrupt = genphy_handle_interrupt_no_ack, ++ .probe = mt798x_phy_calibration, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = mtk_socphy_read_page, ++ .write_page = mtk_socphy_write_page, ++ }, ++ { ++ PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988), ++ .name = "MediaTek MT7988 PHY", ++ .config_init = mt798x_phy_config_init, ++ .config_intr = genphy_no_config_intr, ++ .handle_interrupt = genphy_handle_interrupt_no_ack, ++ .probe = mt798x_phy_calibration, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = mtk_socphy_read_page, ++ .write_page = mtk_socphy_write_page, ++ }, ++}; ++ ++module_phy_driver(mtk_socphy_driver); ++ ++static struct mdio_device_id __maybe_unused mtk_socphy_tbl[] = { ++ { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981) }, ++ { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988) }, ++ { } ++}; ++ ++MODULE_DESCRIPTION("MediaTek SoC Gigabit Ethernet PHY driver"); ++MODULE_AUTHOR("Daniel Golle "); ++MODULE_AUTHOR("SkyLake Huang "); ++MODULE_LICENSE("GPL"); ++ ++MODULE_DEVICE_TABLE(mdio, mtk_socphy_tbl); +--- a/drivers/net/phy/mediatek-ge.c ++++ b/drivers/net/phy/mediatek-ge.c +@@ -136,7 +136,8 @@ static struct phy_driver mtk_gephy_drive + module_phy_driver(mtk_gephy_driver); + + static struct mdio_device_id __maybe_unused mtk_gephy_tbl[] = { +- { PHY_ID_MATCH_VENDOR(0x03a29400) }, ++ { PHY_ID_MATCH_EXACT(0x03a29441) }, ++ { PHY_ID_MATCH_EXACT(0x03a29412) }, + { } + }; + diff --git a/target/linux/mediatek/patches-5.15/731-net-phy-mediatek-ge-soc-initialize-MT7988-PHY-LEDs-d.patch b/target/linux/mediatek/patches-5.15/731-net-phy-mediatek-ge-soc-initialize-MT7988-PHY-LEDs-d.patch new file mode 100644 index 00000000000000..83d0f26bf41824 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/731-net-phy-mediatek-ge-soc-initialize-MT7988-PHY-LEDs-d.patch @@ -0,0 +1,213 @@ +From 5d2d78860f98eb5c03bc404eb024606878901ac8 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 13 Jun 2023 03:27:14 +0100 +Subject: [PATCH] net: phy: mediatek-ge-soc: initialize MT7988 PHY LEDs default + state + +Initialize LEDs and set sane default values. +Read boottrap register and apply LED polarities accordingly to get +uniform behavior from all LEDs on MT7988. +Requires syscon phandle 'mediatek,pio' present in parenting MDIO bus +which should point to the syscon holding the boottrap register. + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/mediatek-ge-soc.c | 144 ++++++++++++++++++++++++++++-- + 1 file changed, 136 insertions(+), 8 deletions(-) + +--- a/drivers/net/phy/mediatek-ge-soc.c ++++ b/drivers/net/phy/mediatek-ge-soc.c +@@ -1,11 +1,13 @@ + // SPDX-License-Identifier: GPL-2.0+ + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + + #define MTK_GPHY_ID_MT7981 0x03a29461 + #define MTK_GPHY_ID_MT7988 0x03a29481 +@@ -208,9 +210,40 @@ + #define MTK_PHY_DA_TX_R50_PAIR_C 0x53f + #define MTK_PHY_DA_TX_R50_PAIR_D 0x540 + ++/* Registers on MDIO_MMD_VEND2 */ ++#define MTK_PHY_LED0_ON_CTRL 0x24 ++#define MTK_PHY_LED1_ON_CTRL 0x26 ++#define MTK_PHY_LED_ON_MASK GENMASK(6, 0) ++#define MTK_PHY_LED_ON_LINK1000 BIT(0) ++#define MTK_PHY_LED_ON_LINK100 BIT(1) ++#define MTK_PHY_LED_ON_LINK10 BIT(2) ++#define MTK_PHY_LED_ON_LINKDOWN BIT(3) ++#define MTK_PHY_LED_ON_FDX BIT(4) /* Full duplex */ ++#define MTK_PHY_LED_ON_HDX BIT(5) /* Half duplex */ ++#define MTK_PHY_LED_FORCE_ON BIT(6) ++#define MTK_PHY_LED_POLARITY BIT(14) ++#define MTK_PHY_LED_ENABLE BIT(15) ++ ++#define MTK_PHY_LED0_BLINK_CTRL 0x25 ++#define MTK_PHY_LED1_BLINK_CTRL 0x27 ++#define MTK_PHY_LED_1000TX BIT(0) ++#define MTK_PHY_LED_1000RX BIT(1) ++#define MTK_PHY_LED_100TX BIT(2) ++#define MTK_PHY_LED_100RX BIT(3) ++#define MTK_PHY_LED_10TX BIT(4) ++#define MTK_PHY_LED_10RX BIT(5) ++#define MTK_PHY_LED_COLLISION BIT(6) ++#define MTK_PHY_LED_RX_CRC_ERR BIT(7) ++#define MTK_PHY_LED_RX_IDLE_ERR BIT(8) ++#define MTK_PHY_LED_FORCE_BLINK BIT(9) ++ + #define MTK_PHY_RG_BG_RASEL 0x115 + #define MTK_PHY_RG_BG_RASEL_MASK GENMASK(2, 0) + ++/* Register in boottrap syscon defining the initial state of the 4 PHY LEDs */ ++#define RG_GPIO_MISC_TPBANK0 0x6f0 ++#define RG_GPIO_MISC_TPBANK0_BOOTMODE GENMASK(11, 8) ++ + /* These macro privides efuse parsing for internal phy. */ + #define EFS_DA_TX_I2MPB_A(x) (((x) >> 0) & GENMASK(5, 0)) + #define EFS_DA_TX_I2MPB_B(x) (((x) >> 6) & GENMASK(5, 0)) +@@ -238,13 +271,6 @@ enum { + PAIR_D, + }; + +-enum { +- GPHY_PORT0, +- GPHY_PORT1, +- GPHY_PORT2, +- GPHY_PORT3, +-}; +- + enum calibration_mode { + EFUSE_K, + SW_K +@@ -263,6 +289,10 @@ enum CAL_MODE { + SW_M + }; + ++struct mtk_socphy_shared { ++ u32 boottrap; ++}; ++ + static int mtk_socphy_read_page(struct phy_device *phydev) + { + return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); +@@ -1073,6 +1103,104 @@ static int mt798x_phy_config_init(struct + return mt798x_phy_calibration(phydev); + } + ++static int mt798x_phy_setup_led(struct phy_device *phydev, bool inverted) ++{ ++ struct pinctrl *pinctrl; ++ const u16 led_on_ctrl_defaults = MTK_PHY_LED_ENABLE | ++ MTK_PHY_LED_ON_LINK1000 | ++ MTK_PHY_LED_ON_LINK100 | ++ MTK_PHY_LED_ON_LINK10; ++ const u16 led_blink_defaults = MTK_PHY_LED_1000TX | ++ MTK_PHY_LED_1000RX | ++ MTK_PHY_LED_100TX | ++ MTK_PHY_LED_100RX | ++ MTK_PHY_LED_10TX | ++ MTK_PHY_LED_10RX; ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, ++ led_on_ctrl_defaults ^ ++ (inverted ? MTK_PHY_LED_POLARITY : 0)); ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_ON_CTRL, ++ led_on_ctrl_defaults); ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_BLINK_CTRL, ++ led_blink_defaults); ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_BLINK_CTRL, ++ led_blink_defaults); ++ ++ pinctrl = devm_pinctrl_get_select(&phydev->mdio.dev, "gbe-led"); ++ if (IS_ERR(pinctrl)) ++ dev_err(&phydev->mdio.bus->dev, "Failed to setup PHY LED\n"); ++ ++ return 0; ++} ++ ++static int mt7988_phy_probe_shared(struct phy_device *phydev) ++{ ++ struct device_node *np = dev_of_node(&phydev->mdio.bus->dev); ++ struct mtk_socphy_shared *priv = phydev->shared->priv; ++ struct regmap *regmap; ++ u32 reg; ++ int ret; ++ ++ /* The LED0 of the 4 PHYs in MT7988 are wired to SoC pins LED_A, LED_B, ++ * LED_C and LED_D respectively. At the same time those pins are used to ++ * bootstrap configuration of the reference clock source (LED_A), ++ * DRAM DDRx16b x2/x1 (LED_B) and boot device (LED_C, LED_D). ++ * In practise this is done using a LED and a resistor pulling the pin ++ * either to GND or to VIO. ++ * The detected value at boot time is accessible at run-time using the ++ * TPBANK0 register located in the gpio base of the pinctrl, in order ++ * to read it here it needs to be referenced by a phandle called ++ * 'mediatek,pio' in the MDIO bus hosting the PHY. ++ * The 4 bits in TPBANK0 are kept as package shared data and are used to ++ * set LED polarity for each of the LED0. ++ */ ++ regmap = syscon_regmap_lookup_by_phandle(np, "mediatek,pio"); ++ if (IS_ERR(regmap)) ++ return PTR_ERR(regmap); ++ ++ ret = regmap_read(regmap, RG_GPIO_MISC_TPBANK0, ®); ++ if (ret) ++ return ret; ++ ++ priv->boottrap = FIELD_GET(RG_GPIO_MISC_TPBANK0_BOOTMODE, reg); ++ ++ return 0; ++} ++ ++static bool mt7988_phy_get_boottrap_polarity(struct phy_device *phydev) ++{ ++ struct mtk_socphy_shared *priv = phydev->shared->priv; ++ ++ if (priv->boottrap & BIT(phydev->mdio.addr)) ++ return false; ++ ++ return true; ++} ++ ++static int mt7988_phy_probe(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = devm_phy_package_join(&phydev->mdio.dev, phydev, 0, ++ sizeof(struct mtk_socphy_shared)); ++ if (err) ++ return err; ++ ++ if (phy_package_probe_once(phydev)) { ++ err = mt7988_phy_probe_shared(phydev); ++ if (err) ++ return err; ++ } ++ ++ mt798x_phy_setup_led(phydev, mt7988_phy_get_boottrap_polarity(phydev)); ++ ++ return mt798x_phy_calibration(phydev); ++} ++ + static struct phy_driver mtk_socphy_driver[] = { + { + PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), +@@ -1092,7 +1220,7 @@ static struct phy_driver mtk_socphy_driv + .config_init = mt798x_phy_config_init, + .config_intr = genphy_no_config_intr, + .handle_interrupt = genphy_handle_interrupt_no_ack, +- .probe = mt798x_phy_calibration, ++ .probe = mt7988_phy_probe, + .suspend = genphy_suspend, + .resume = genphy_resume, + .read_page = mtk_socphy_read_page, From f94cda01873b3d477758ee2e4da69c99e0c1081e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 8 Jul 2023 16:48:39 +0100 Subject: [PATCH 0269/1171] mediatek: dts: mt7988a: remove boottrap hack The PHY driver now uses regmap created from pio syscon, we no longer need the boottrap device. Signed-off-by: Daniel Golle (cherry picked from commit f321a49fd523a8d393be8e3cd2de41d67855da91) --- .../files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi index 17de885629e18b..94aa8251bd0f78 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi @@ -303,11 +303,6 @@ }; }; - boottrap: boottrap@1001f6f0 { - compatible = "mediatek,boottrap"; - reg = <0 0x1001f6f0 0 0x4>; - }; - sgmiisys0: syscon@10060000 { compatible = "mediatek,mt7988-sgmiisys", "mediatek,mt7988-sgmiisys_0", From 40a26239ff00ad7bc271e33dbbef0e402eebe325 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 8 Jul 2023 17:31:24 +0100 Subject: [PATCH 0270/1171] mediatek: replace hack for MaxLinear 2.5G PHY Replace hack with proper patch also for Linux 5.15. Signed-off-by: Daniel Golle (cherry picked from commit 712fa3eff82086da8a13e7e5bc577df17892a581) --- ...et-phy-hack-mxl-gpy-disable-sgmii-an.patch | 166 ------------------ ...-don-t-use-SGMII-AN-if-using-phylink.patch | 63 +++++++ ...hy-add-driver-for-MediaTek-2.5G-PHY.patch} | 0 3 files changed, 63 insertions(+), 166 deletions(-) delete mode 100644 target/linux/mediatek/patches-5.15/731-net-phy-hack-mxl-gpy-disable-sgmii-an.patch create mode 100644 target/linux/mediatek/patches-5.15/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch rename target/linux/mediatek/patches-5.15/{732-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch => 733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch} (100%) diff --git a/target/linux/mediatek/patches-5.15/731-net-phy-hack-mxl-gpy-disable-sgmii-an.patch b/target/linux/mediatek/patches-5.15/731-net-phy-hack-mxl-gpy-disable-sgmii-an.patch deleted file mode 100644 index 2e39ca3c26aad2..00000000000000 --- a/target/linux/mediatek/patches-5.15/731-net-phy-hack-mxl-gpy-disable-sgmii-an.patch +++ /dev/null @@ -1,166 +0,0 @@ ---- a/drivers/net/phy/mxl-gpy.c -+++ b/drivers/net/phy/mxl-gpy.c -@@ -126,6 +126,12 @@ static int gpy_config_init(struct phy_de - if (ret < 0) - return ret; - -+ /* Disable SGMII auto-negotiation */ -+ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, -+ VSPEC1_SGMII_CTRL_ANEN, 0); -+ if (ret < 0) -+ return ret; -+ - return gpy_led_write(phydev); - } - -@@ -151,65 +157,6 @@ static int gpy_probe(struct phy_device * - return 0; - } - --static bool gpy_sgmii_need_reaneg(struct phy_device *phydev) --{ -- int fw_ver, fw_type, fw_minor; -- size_t i; -- -- fw_ver = phy_read(phydev, PHY_FWV); -- if (fw_ver < 0) -- return true; -- -- fw_type = FIELD_GET(PHY_FWV_TYPE_MASK, fw_ver); -- fw_minor = FIELD_GET(PHY_FWV_MINOR_MASK, fw_ver); -- -- for (i = 0; i < ARRAY_SIZE(ver_need_sgmii_reaneg); i++) { -- if (fw_type != ver_need_sgmii_reaneg[i].type) -- continue; -- if (fw_minor < ver_need_sgmii_reaneg[i].minor) -- return true; -- break; -- } -- -- return false; --} -- --static bool gpy_2500basex_chk(struct phy_device *phydev) --{ -- int ret; -- -- ret = phy_read(phydev, PHY_MIISTAT); -- if (ret < 0) { -- phydev_err(phydev, "Error: MDIO register access failed: %d\n", -- ret); -- return false; -- } -- -- if (!(ret & PHY_MIISTAT_LS) || -- FIELD_GET(PHY_MIISTAT_SPD_MASK, ret) != PHY_MIISTAT_SPD_2500) -- return false; -- -- phydev->speed = SPEED_2500; -- phydev->interface = PHY_INTERFACE_MODE_2500BASEX; -- phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, -- VSPEC1_SGMII_CTRL_ANEN, 0); -- return true; --} -- --static bool gpy_sgmii_aneg_en(struct phy_device *phydev) --{ -- int ret; -- -- ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL); -- if (ret < 0) { -- phydev_err(phydev, "Error: MMD register access failed: %d\n", -- ret); -- return true; -- } -- -- return (ret & VSPEC1_SGMII_CTRL_ANEN) ? true : false; --} -- - static int gpy_config_aneg(struct phy_device *phydev) - { - bool changed = false; -@@ -248,53 +195,11 @@ static int gpy_config_aneg(struct phy_de - phydev->interface == PHY_INTERFACE_MODE_INTERNAL) - return 0; - -- /* No need to trigger re-ANEG if link speed is 2.5G or SGMII ANEG is -- * disabled. -- */ -- if (!gpy_sgmii_need_reaneg(phydev) || gpy_2500basex_chk(phydev) || -- !gpy_sgmii_aneg_en(phydev)) -- return 0; -- -- /* There is a design constraint in GPY2xx device where SGMII AN is -- * only triggered when there is change of speed. If, PHY link -- * partner`s speed is still same even after PHY TPI is down and up -- * again, SGMII AN is not triggered and hence no new in-band message -- * from GPY to MAC side SGMII. -- * This could cause an issue during power up, when PHY is up prior to -- * MAC. At this condition, once MAC side SGMII is up, MAC side SGMII -- * wouldn`t receive new in-band message from GPY with correct link -- * status, speed and duplex info. -- * -- * 1) If PHY is already up and TPI link status is still down (such as -- * hard reboot), TPI link status is polled for 4 seconds before -- * retriggerring SGMII AN. -- * 2) If PHY is already up and TPI link status is also up (such as soft -- * reboot), polling of TPI link status is not needed and SGMII AN is -- * immediately retriggered. -- * 3) Other conditions such as PHY is down, speed change etc, skip -- * retriggering SGMII AN. Note: in case of speed change, GPY FW will -- * initiate SGMII AN. -- */ -- -- if (phydev->state != PHY_UP) -- return 0; -- -- ret = phy_read_poll_timeout(phydev, MII_BMSR, ret, ret & BMSR_LSTATUS, -- 20000, 4000000, false); -- if (ret == -ETIMEDOUT) -- return 0; -- else if (ret < 0) -- return ret; -- -- /* Trigger SGMII AN. */ -- return phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, -- VSPEC1_SGMII_CTRL_ANRS, VSPEC1_SGMII_CTRL_ANRS); -+ return 0; - } - - static void gpy_update_interface(struct phy_device *phydev) - { -- int ret; -- - /* Interface mode is fixed for USXGMII and integrated PHY */ - if (phydev->interface == PHY_INTERFACE_MODE_USXGMII || - phydev->interface == PHY_INTERFACE_MODE_INTERNAL) -@@ -306,29 +211,11 @@ static void gpy_update_interface(struct - switch (phydev->speed) { - case SPEED_2500: - phydev->interface = PHY_INTERFACE_MODE_2500BASEX; -- ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, -- VSPEC1_SGMII_CTRL_ANEN, 0); -- if (ret < 0) -- phydev_err(phydev, -- "Error: Disable of SGMII ANEG failed: %d\n", -- ret); - break; - case SPEED_1000: - case SPEED_100: - case SPEED_10: - phydev->interface = PHY_INTERFACE_MODE_SGMII; -- if (gpy_sgmii_aneg_en(phydev)) -- break; -- /* Enable and restart SGMII ANEG for 10/100/1000Mbps link speed -- * if ANEG is disabled (in 2500-BaseX mode). -- */ -- ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, -- VSPEC1_SGMII_ANEN_ANRS, -- VSPEC1_SGMII_ANEN_ANRS); -- if (ret < 0) -- phydev_err(phydev, -- "Error: Enable of SGMII ANEG failed: %d\n", -- ret); - break; - } - } diff --git a/target/linux/mediatek/patches-5.15/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch b/target/linux/mediatek/patches-5.15/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch new file mode 100644 index 00000000000000..598d9d0d2180ab --- /dev/null +++ b/target/linux/mediatek/patches-5.15/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch @@ -0,0 +1,63 @@ +From a969b663c866129ed9eb217785a6574fbe826f1d Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 6 Apr 2023 23:36:50 +0100 +Subject: [PATCH] net: phy: mxl-gpy: don't use SGMII AN if using phylink + +MAC drivers using phylink expect SGMII in-band-status to be switched off +when attached to a PHY. Make sure this is the case also for mxl-gpy which +keeps SGMII in-band-status in case of SGMII interface mode is used. + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/mxl-gpy.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/mxl-gpy.c ++++ b/drivers/net/phy/mxl-gpy.c +@@ -191,8 +191,11 @@ static bool gpy_2500basex_chk(struct phy + + phydev->speed = SPEED_2500; + phydev->interface = PHY_INTERFACE_MODE_2500BASEX; +- phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, +- VSPEC1_SGMII_CTRL_ANEN, 0); ++ ++ if (!phydev->phylink) ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, ++ VSPEC1_SGMII_CTRL_ANEN, 0); ++ + return true; + } + +@@ -216,6 +219,14 @@ static int gpy_config_aneg(struct phy_de + u32 adv; + int ret; + ++ /* Disable SGMII auto-negotiation if using phylink */ ++ if (phydev->phylink) { ++ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, ++ VSPEC1_SGMII_CTRL_ANEN, 0); ++ if (ret < 0) ++ return ret; ++ } ++ + if (phydev->autoneg == AUTONEG_DISABLE) { + /* Configure half duplex with genphy_setup_forced, + * because genphy_c45_pma_setup_forced does not support. +@@ -306,6 +317,8 @@ static void gpy_update_interface(struct + switch (phydev->speed) { + case SPEED_2500: + phydev->interface = PHY_INTERFACE_MODE_2500BASEX; ++ if (phydev->phylink) ++ break; + ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, + VSPEC1_SGMII_CTRL_ANEN, 0); + if (ret < 0) +@@ -317,7 +330,7 @@ static void gpy_update_interface(struct + case SPEED_100: + case SPEED_10: + phydev->interface = PHY_INTERFACE_MODE_SGMII; +- if (gpy_sgmii_aneg_en(phydev)) ++ if (phydev->phylink || gpy_sgmii_aneg_en(phydev)) + break; + /* Enable and restart SGMII ANEG for 10/100/1000Mbps link speed + * if ANEG is disabled (in 2500-BaseX mode). diff --git a/target/linux/mediatek/patches-5.15/732-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch b/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch similarity index 100% rename from target/linux/mediatek/patches-5.15/732-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch rename to target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch From 5bd5be03bb5a80338824f7bc9223261a5a14f59d Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 12 Jun 2023 04:06:40 +0100 Subject: [PATCH 0271/1171] uboot-mediatek: support classic uImage.FIT with internal images in imszb The side-effect and main motivation is to also drop the FIT structure size limit because with multiple device tree overlays it may easily grow beyond the previous 4kB limit in the future. Signed-off-by: Daniel Golle (cherry picked from commit 98e3f82c3fb729c1d9de78fef215322528b50cb4) --- .../patches/200-cmd-add-imsz-and-imszb.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch index 7cf0778e47d88e..fcbb6b28a060fb 100644 --- a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch +++ b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch @@ -70,7 +70,7 @@ { --- a/boot/image-fit.c +++ b/boot/image-fit.c -@@ -2051,6 +2051,50 @@ static const char *fit_get_image_type_pr +@@ -2051,6 +2051,49 @@ static const char *fit_get_image_type_pr return "unknown"; } @@ -89,9 +89,8 @@ + + hdrsize = fdt_totalsize(fit); + -+ /* simple FIT with internal images */ -+ if (hdrsize > 0x1000) -+ return hdrsize; ++ /* take care of simple FIT with internal images */ ++ max_size = hdrsize; + + images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); + if (images_noffset < 0) { From 50507f5af3d3b3630a448412581707dcf60b08fa Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 12 Jun 2023 04:07:57 +0100 Subject: [PATCH 0272/1171] scripts/mkits.sh: DT overlays don't need a loadaddr DT overlays do not need relocation in order to be applied, so drop defining the load address for dtbos. Signed-off-by: Daniel Golle (cherry picked from commit cff3786bd54cec8276f1fd08d5c6697846f393a5) --- scripts/mkits.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/mkits.sh b/scripts/mkits.sh index b1c6f988674711..bd6cddabf44c73 100755 --- a/scripts/mkits.sh +++ b/scripts/mkits.sh @@ -88,11 +88,6 @@ if [ -n "${COMPATIBLE}" ]; then COMPATIBLE_PROP="compatible = \"${COMPATIBLE}\";" fi -[ "$DTOVERLAY" ] && { - dtbsize=$(wc -c "$DTB" | awk '{print $1}') - DTADDR=$(printf "0x%08x" $(($LOAD_ADDR - $dtbsize)) ) -} - [ "$FDTADDR" ] && { DTADDR="$FDTADDR" } @@ -170,7 +165,6 @@ OVCONFIGS="" ovnode="fdt-$ovname" ovsize=$(wc -c "$overlay_blob" | awk '{print $1}') echo "$ovname ($overlay_blob) : $ovsize" >&2 - DTADDR=$(printf "0x%08x" $(($DTADDR - $ovsize))) FDTOVERLAY_NODE="$FDTOVERLAY_NODE $ovnode { @@ -179,7 +173,6 @@ OVCONFIGS="" data = /incbin/(\"${overlay_blob}\"); type = \"flat_dt\"; arch = \"${ARCH}\"; - load = <${DTADDR}>; compression = \"none\"; hash@1 { algo = \"crc32\"; From b32a4bc33f0d604b2f1e9c7768b5e456d312b63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 14 Jul 2023 12:35:26 +0200 Subject: [PATCH 0273/1171] bcm53xx: backport DT changes queued for v6.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 37ff916af789911fdefb802ce9903e866eb82435) --- ...ts-broadcom-add-missing-space-before.patch | 37 ++++++ ...-Add-Wi-Fi-regulatory-mappings-for-L.patch | 107 ++++++++++++++++++ ...M5301X-Add-Ethernet-interfaces-links.patch | 53 +++++++++ ...-Drop-nonexistent-default-off-LED-tr.patch | 57 ++++++++++ ...-BCM53573-Drop-nonexistent-usb-cells.patch | 32 ++++++ ...CM53573-Add-cells-sizes-to-PCIe-node.patch | 37 ++++++ ...-Use-updated-spi-gpio-binding-proper.patch | 44 +++++++ ...Extend-RAM-to-full-256MB-for-Linksy.patch} | 13 ++- ...-Fix-Ethernet-info-for-Luxul-devices.patch | 72 ++++++++++++ ...-Specify-switch-ports-for-remaining-.patch | 2 +- 10 files changed, 450 insertions(+), 4 deletions(-) create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0001-ARM-dts-broadcom-add-missing-space-before.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0002-ARM-dts-BCM5301X-Add-Wi-Fi-regulatory-mappings-for-L.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0003-ARM-dts-BCM5301X-Add-Ethernet-interfaces-links.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch rename target/linux/bcm53xx/patches-5.15/{315-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch => 037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch} (61%) create mode 100644 target/linux/bcm53xx/patches-5.15/130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0001-ARM-dts-broadcom-add-missing-space-before.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0001-ARM-dts-broadcom-add-missing-space-before.patch new file mode 100644 index 00000000000000..9811757ee2a465 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0001-ARM-dts-broadcom-add-missing-space-before.patch @@ -0,0 +1,37 @@ +From 4b8e16de053fc88eac406ad63da2693dd8279043 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 5 Jul 2023 17:01:07 +0200 +Subject: [PATCH] ARM: dts: broadcom: add missing space before { + +Add missing whitespace between node name/label and opening {. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20230705150108.293999-1-krzysztof.kozlowski@linaro.org +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm47094-linksys-panamera.dts | 2 +- + arch/arm/boot/dts/broadcom/bcm47094-phicomm-k3.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -279,7 +279,7 @@ + reg = <0x080000 0x0100000>; + }; + +- partition@180000{ ++ partition@180000 { + label = "devinfo"; + reg = <0x0180000 0x080000>; + }; +--- a/arch/arm/boot/dts/bcm47094-phicomm-k3.dts ++++ b/arch/arm/boot/dts/bcm47094-phicomm-k3.dts +@@ -55,7 +55,7 @@ + reg = <0x0080000 0x0100000>; + }; + +- partition@180000{ ++ partition@180000 { + label = "phicomm"; + reg = <0x0180000 0x0280000>; + read-only; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0002-ARM-dts-BCM5301X-Add-Wi-Fi-regulatory-mappings-for-L.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0002-ARM-dts-BCM5301X-Add-Wi-Fi-regulatory-mappings-for-L.patch new file mode 100644 index 00000000000000..e5143abf58ef84 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0002-ARM-dts-BCM5301X-Add-Wi-Fi-regulatory-mappings-for-L.patch @@ -0,0 +1,107 @@ +From 8960f095de3b80beb3639075f0c8161b6ea98c61 Mon Sep 17 00:00:00 2001 +From: Dan Haab +Date: Wed, 5 Jul 2023 09:32:51 -0600 +Subject: [PATCH] ARM: dts: BCM5301X: Add Wi-Fi regulatory mappings for Luxul + devices + +This allows setting FullMAC firmware regulatory domain. + +Signed-off-by: Dan Haab +Link: https://lore.kernel.org/r/20230705153251.739236-1-riproute@gmail.com +Signed-off-by: Florian Fainelli +--- + .../dts/broadcom/bcm47094-luxul-xap-1610.dts | 37 +++++++++++++++++++ + .../broadcom/bcm47094-luxul-xwr-3150-v1.dts | 36 ++++++++++++++++++ + 2 files changed, 73 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts +@@ -64,6 +64,43 @@ + nvmem-cell-names = "mac-address"; + }; + ++ ++&pcie0 { ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ bridge@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ wifi@0,0 { ++ compatible = "brcm,bcm4366-fmac", "brcm,bcm4329-fmac"; ++ reg = <0x0000 0 0 0 0>; ++ brcm,ccode-map = "AU-AU-920", "CA-CA-892", "GB-DE-964", "NZ-AU-920", "US-US-825"; ++ }; ++ }; ++}; ++ ++&pcie1 { ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ bridge@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ wifi@0,0 { ++ compatible = "brcm,bcm4366-fmac", "brcm,bcm4329-fmac"; ++ reg = <0x0000 0 0 0 0>; ++ brcm,ccode-map = "AU-AU-920", "CA-CA-892", "GB-DE-964", "NZ-AU-920", "US-US-825"; ++ }; ++ }; ++}; ++ + &spi_nor { + status = "okay"; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -81,6 +81,42 @@ + nvmem-cell-names = "mac-address"; + }; + ++&pcie0 { ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ bridge@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ wifi@0,0 { ++ compatible = "brcm,bcm4366-fmac", "brcm,bcm4329-fmac"; ++ reg = <0x0000 0 0 0 0>; ++ brcm,ccode-map = "AU-AU-953", "CA-CA-946", "GB-E0-846", "NZ-AU-953", "US-Q2-930"; ++ }; ++ }; ++}; ++ ++&pcie1 { ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ bridge@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ++ wifi@0,0 { ++ compatible = "brcm,bcm4366-fmac", "brcm,bcm4329-fmac"; ++ reg = <0x0000 0 0 0 0>; ++ brcm,ccode-map = "AU-AU-953", "CA-CA-946", "GB-E0-846", "NZ-AU-953", "US-Q2-930"; ++ }; ++ }; ++}; ++ + &usb3 { + vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0003-ARM-dts-BCM5301X-Add-Ethernet-interfaces-links.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0003-ARM-dts-BCM5301X-Add-Ethernet-interfaces-links.patch new file mode 100644 index 00000000000000..4b2e608ec2ecf1 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0003-ARM-dts-BCM5301X-Add-Ethernet-interfaces-links.patch @@ -0,0 +1,53 @@ +From 2ce61fa62183cf994666fcc911da34075c7183b5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 7 Jul 2023 11:15:19 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Add Ethernet interfaces links +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Northstar SoCs have 3 usable Ethernet interfaces each connected to one +of switch ports. They all use fixed links. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230707091519.21673-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm-ns.dtsi | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -272,14 +272,32 @@ + + gmac0: ethernet@24000 { + reg = <0x24000 0x800>; ++ phy-mode = "internal"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; + }; + + gmac1: ethernet@25000 { + reg = <0x25000 0x800>; ++ phy-mode = "internal"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; + }; + + gmac2: ethernet@26000 { + reg = <0x26000 0x800>; ++ phy-mode = "internal"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; + }; + + gmac3: ethernet@27000 { diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch new file mode 100644 index 00000000000000..8bad76edcaaf8d --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch @@ -0,0 +1,57 @@ +From be7e1e5b0f67c58ec4be0a54db23b6a4fa6e2116 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 7 Jul 2023 13:40:01 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Drop nonexistent "default-off" LED + trigger +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There is no such trigger documented or implemented in Linux. It was a +copy & paste mistake. + +This fixes: +arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: leds: led-wlan:linux,default-trigger: 'oneOf' conditional failed, one must be fixed: + 'default-off' is not one of ['backlight', 'default-on', 'heartbeat', 'disk-activity', 'disk-read', 'disk-write', 'timer', 'pattern', 'audio-micmute', 'audio-mute', 'bluetooth-power', 'flash', 'kbd-capslock', 'mtd', 'nand-disk', 'none', 'torch', 'usb-gadget', 'usb-host', 'usbport'] + 'default-off' does not match '^cpu[0-9]*$' + 'default-off' does not match '^hci[0-9]+-power$' + 'default-off' does not match '^mmc[0-9]+$' + 'default-off' does not match '^phy[0-9]+tx$' + From schema: Documentation/devicetree/bindings/leds/leds-gpio.yaml + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230707114004.2740-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dts | 1 - + arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-810.dts | 2 -- + 2 files changed, 3 deletions(-) + +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -26,7 +26,6 @@ + led-wlan { + label = "bcm53xx:blue:wlan"; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; +- linux,default-trigger = "default-off"; + }; + + led-system { +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -26,7 +26,6 @@ + led-5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "default-off"; + }; + + led-system { +@@ -42,7 +41,6 @@ + led-2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&pcie0_chipcommon 3 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "default-off"; + }; + }; + diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch new file mode 100644 index 00000000000000..7836d560a16967 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch @@ -0,0 +1,32 @@ +From 05d2c3d552b8c92fc397377d9d1112fc58e2cd59 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 7 Jul 2023 13:40:02 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Drop nonexistent #usb-cells +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Such property simply doesn't exist (is not documented or used anywhere). + +This fixes: +arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: usb@d000: Unevaluated properties are not allowed ('#usb-cells' was unexpected) + From schema: Documentation/devicetree/bindings/usb/generic-ohci.yaml + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230707114004.2740-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm53573.dtsi | 2 -- + 1 file changed, 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -156,8 +156,6 @@ + }; + + ohci: usb@d000 { +- #usb-cells = <0>; +- + compatible = "generic-ohci"; + reg = <0xd000 0x1000>; + interrupt-parent = <&gic>; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch new file mode 100644 index 00000000000000..86a52aa505724b --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch @@ -0,0 +1,37 @@ +From 3392ef368d9b04622fe758b1079b512664b6110a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 7 Jul 2023 13:40:03 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Add cells sizes to PCIe node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes: +arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#address-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml +arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#size-cells' is a required property + From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml + +Two properties that need to be added later are "device_type" and +"ranges". Adding "device_type" on its own causes a new warning and the +value of "ranges" needs to be determined yet. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230707114004.2740-3-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm53573.dtsi | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -127,6 +127,9 @@ + + pcie0: pcie@2000 { + reg = <0x00002000 0x1000>; ++ ++ #address-cells = <3>; ++ #size-cells = <2>; + }; + + usb2: usb2@4000 { diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch new file mode 100644 index 00000000000000..28d89949e46440 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch @@ -0,0 +1,44 @@ +From 2c0fd6b3d0778ceab40205315ccef74568490f17 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 7 Jul 2023 13:40:04 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Use updated "spi-gpio" binding properties +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Switch away from deprecated properties. + +This fixes: +arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-sck: False schema does not allow [[3, 21, 0]] + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml +arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-miso: False schema does not allow [[3, 22, 0]] + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml +arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-mosi: False schema does not allow [[3, 23, 0]] + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml +arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: 'sck-gpios' is a required property + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml +arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: Unevaluated properties are not allowed ('gpio-miso', 'gpio-mosi', 'gpio-sck' were unexpected) + From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230707114004.2740-4-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm947189acdbmr.dts | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/arm/boot/dts/bcm947189acdbmr.dts ++++ b/arch/arm/boot/dts/bcm947189acdbmr.dts +@@ -60,9 +60,9 @@ + spi { + compatible = "spi-gpio"; + num-chipselects = <1>; +- gpio-sck = <&chipcommon 21 0>; +- gpio-miso = <&chipcommon 22 0>; +- gpio-mosi = <&chipcommon 23 0>; ++ sck-gpios = <&chipcommon 21 0>; ++ miso-gpios = <&chipcommon 22 0>; ++ mosi-gpios = <&chipcommon 23 0>; + cs-gpios = <&chipcommon 24 0>; + #address-cells = <1>; + #size-cells = <0>; diff --git a/target/linux/bcm53xx/patches-5.15/315-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch similarity index 61% rename from target/linux/bcm53xx/patches-5.15/315-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch rename to target/linux/bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch index 068d676962814a..6ae8aad3c34f10 100644 --- a/target/linux/bcm53xx/patches-5.15/315-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch @@ -1,16 +1,23 @@ -From e492f69e4da879db7b3e9a2290e5b6620f1335b5 Mon Sep 17 00:00:00 2001 From: Aleksey Nasibulin -Date: Thu, 13 Oct 2022 08:16:51 +0000 +Date: Wed, 12 Jul 2023 03:40:17 +0200 Subject: [PATCH] ARM: dts: BCM5301X: Extend RAM to full 256MB for Linksys EA6500 V2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit Linksys ea6500-v2 have 256MB of ram. Currently we only use 128MB. Expand the definition to use all the available RAM. Fixes: 03e96644d7a8 ("ARM: dts: BCM5301X: Add basic DT for Linksys EA6500 V2") Signed-off-by: Aleksey Nasibulin +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org +Acked-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230712014017.28123-1-ansuelsmth@gmail.com +Signed-off-by: Florian Fainelli --- - arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts | 3 ++- + arch/arm/boot/dts/broadcom/bcm4708-linksys-ea6500-v2.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts diff --git a/target/linux/bcm53xx/patches-5.15/130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch b/target/linux/bcm53xx/patches-5.15/130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch new file mode 100644 index 00000000000000..381a8c389437a5 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch @@ -0,0 +1,72 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 13 Jul 2023 13:05:44 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Fix Ethernet info for Luxul devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Both Luxul's XAP devices (XAP-810 and XAP-1440) are access points that +use a non-default design. They don't include switch but have a single +Ethernet port and BCM54210E PHY connected to the Ethernet controller's +MDIO bus. + +Support for those devices regressed due to two changes: + +1. Describing MDIO bus with switch +After commit 9fb90ae6cae7 ("ARM: dts: BCM53573: Describe on-SoC BCM53125 +rev 4 switch") Linux stopped probing for MDIO devices. + +2. Dropping hardcoded BCM54210E delays +In commit fea7fda7f50a ("net: phy: broadcom: Fix RGMII delays +configuration for BCM54210E") support for other PHY modes was added but +that requires a proper "phy-mode" value in DT. + +Both above changes are correct (they don't need to be reverted or +anything) but they need this fix for DT data to be correct and for Linux +to work properly. + +Fixes: 9fb90ae6cae7 ("ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch") +Signed-off-by: Rafał Miłecki +--- + .../boot/dts/broadcom/bcm47189-luxul-xap-1440.dts | 13 +++++++++++++ + .../boot/dts/broadcom/bcm47189-luxul-xap-810.dts | 13 +++++++++++++ + 2 files changed, 26 insertions(+) + +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -45,3 +45,16 @@ + }; + }; + }; ++ ++&gmac0 { ++ phy-mode = "rgmii"; ++ phy-handle = <&bcm54210e>; ++ ++ mdio { ++ /delete-node/ switch@1e; ++ ++ bcm54210e: ethernet-phy@0 { ++ reg = <0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -81,3 +81,16 @@ + }; + }; + }; ++ ++&gmac0 { ++ phy-mode = "rgmii"; ++ phy-handle = <&bcm54210e>; ++ ++ mdio { ++ /delete-node/ switch@1e; ++ ++ bcm54210e: ethernet-phy@0 { ++ reg = <0>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch index d15506f6d7b339..e0832524f4ca7b 100644 --- a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch +++ b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -182,7 +182,7 @@ Signed-off-by: Rafał Miłecki +}; --- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts +++ b/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts -@@ -42,3 +42,40 @@ +@@ -43,3 +43,40 @@ &usb3_phy { status = "okay"; }; From 62496e9a1a0470ee7a4a7719073824defa81cb8c Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 15 Jul 2023 21:33:41 +0200 Subject: [PATCH 0274/1171] armsr: v8: fix NVMEM_IMX_OCOTP_ELE build error there's a new symbol NVMEM_IMX_OCOTP_ELE that needs to be defined. otherwise the build will fail: | i.MX On-Chip OTP Controller support (NVMEM_IMX_OCOTP_ELE) [N/m/y/?] (NEW) | make[6]: *** [scripts/kconfig/Makefile:77: syncconfig] Error 1 | make[5]: *** [Makefile:628: syncconfig] Error 2 Signed-off-by: Christian Lamparter --- target/linux/armsr/armv8/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index 54dd78a8aa1558..6b8b735059a94f 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -286,6 +286,7 @@ CONFIG_NR_CPUS=64 CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y # CONFIG_NVMEM_IMX_IIM is not set CONFIG_NVMEM_IMX_OCOTP=y +CONFIG_NVMEM_IMX_OCOTP_ELE=y CONFIG_NVMEM_IMX_OCOTP_SCU=y # CONFIG_NVMEM_LAYERSCAPE_SFP is not set CONFIG_NVMEM_ROCKCHIP_EFUSE=y From 4ab8abfbf7b1e4aa006507e220a4f2db17421845 Mon Sep 17 00:00:00 2001 From: Adones Pitogo Date: Tue, 11 Jul 2023 13:31:50 +0800 Subject: [PATCH 0275/1171] build: fix generation of large .vdi images Instead of loading the whole image into the memory when generating the sha256 sum, we load the file in chunks and update the hash incrementally to avoid MemoryError in python. Also remove a stray empty line. Fixes: #13056 Signed-off-by: Adones Pitogo (mention empty line removal, adds Fixes from PR) Signed-off-by: Christian Lamparter (cherry picked from commit bdb4b78210cfb6bc8a6cda62fc990dd45ec3054c) --- scripts/json_add_image_info.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/json_add_image_info.py b/scripts/json_add_image_info.py index 0c441b93344bd8..aded743bcc7440 100755 --- a/scripts/json_add_image_info.py +++ b/scripts/json_add_image_info.py @@ -13,7 +13,6 @@ json_path = Path(argv[1]) file_path = Path(getenv("FILE_DIR")) / getenv("FILE_NAME") - if not file_path.is_file(): print("Skip JSON creation for non existing file", file_path) exit(0) @@ -37,7 +36,14 @@ def get_titles(): device_id = getenv("DEVICE_ID") -hash_file = hashlib.sha256(file_path.read_bytes()).hexdigest() + +sha256_hash = hashlib.sha256() +with open(str(file_path),"rb") as f: + # Read and update hash string value in blocks of 4K + for byte_block in iter(lambda: f.read(4096),b""): + sha256_hash.update(byte_block) + +hash_file = sha256_hash.hexdigest() if file_path.with_suffix(file_path.suffix + ".sha256sum").exists(): hash_unsigned = ( From b52cfba97ab708906fcbf36bba062e7c2e0f07dd Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Tue, 11 Jul 2023 16:09:49 +0200 Subject: [PATCH 0276/1171] sdk: rename README + update Makefile 'help' target fails not finding a file, so follow up on a change[2] made as a fix for main README[1]. 1. d0113711a31f ("README: port to 21st century") 2. 751486b31fd9 ("build: fix README.md reference after rename") Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit 2d5f7035cf45801158bed6f5d0ac0de0002c1810) (cherry picked from commit e9911f10e482f3174f745a36c0c9fd7964758caf) Signed-off-by: Christian Lamparter --- target/sdk/Makefile | 2 +- target/sdk/files/{README.SDK => README.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename target/sdk/files/{README.SDK => README.md} (100%) diff --git a/target/sdk/Makefile b/target/sdk/Makefile index b688eb4cba0239..667d00b43f67cd 100644 --- a/target/sdk/Makefile +++ b/target/sdk/Makefile @@ -145,7 +145,7 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean ./files/Config.in \ ./files/Makefile \ ./files/include/prepare.mk \ - ./files/README.SDK \ + ./files/README.md \ $(SDK_BUILD_DIR)/ mkdir -p $(SDK_BUILD_DIR)/package/kernel $(CP) \ diff --git a/target/sdk/files/README.SDK b/target/sdk/files/README.md similarity index 100% rename from target/sdk/files/README.SDK rename to target/sdk/files/README.md From b58955e92461b285ab9ea14c7a5fc61f738940bd Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Tue, 11 Jul 2023 16:06:21 +0200 Subject: [PATCH 0277/1171] ib: split out processing user provided packages Some device recipes remove default target packages. If user tries to add them back they will be ignored, since packages list is processed in one go. Process the device recipe packages first and do user ones later, so additions won't get filtered out. Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit e40b9a7fa002154e85459791101a0444d99dfb86) --- target/imagebuilder/files/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 5020373792450b..78ec7e2e94a94e 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -127,9 +127,11 @@ _call_info: FORCE echo 'Available Profiles:' echo; $(PROFILE_LIST) -BUILD_PACKAGES:=$(USER_PACKAGES) $(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) +BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) # "-pkgname" in the package list means remove "pkgname" from the package list BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) +BUILD_PACKAGES:=$(USER_PACKAGES) $(BUILD_PACKAGES) +BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) PACKAGES:= _call_image: staging_dir/host/.prereq-build From 00d4a3190bd7e1465cc377481647dabfcedd88d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Spie=C3=9F?= Date: Wed, 12 Jul 2023 10:41:25 +0200 Subject: [PATCH 0278/1171] octeon: ubnt-edgerouter-e300: fix LED settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LEDs on Edgerouter 6P didn't work correctly: blue /white LED swapped, on/off state inverted Fixed in device tree: swap the GPIO ports for power:blue and power:white LEDs change LED activity from LOW to HIGH Tested on Edgerouter 6P Signed-off-by: Carsten Spieß (cherry picked from commit 9009672930f7bda99ec8f6f09a92eb49b6c9aac8) --- .../boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi index 7eafa32cf6d7be..e63598fc974ac2 100644 --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi @@ -33,12 +33,12 @@ led_power_blue: power_blue { label = "blue:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; }; led_power_white: power_white { label = "white:power"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; }; }; From abe659efba3e28b5657143ef604c5bc42d1edb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Spie=C3=9F?= Date: Wed, 12 Jul 2023 10:16:27 +0200 Subject: [PATCH 0279/1171] octeon: ubnt-edgerouter-e300: fix missing MTD partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MAC addresses should be read from 3rd MTD partition, but only two MTD partitions are populated. To fix it, a partitions node has to surround the partition nodes in device tree. Tested with Edgerouter 6P Signed-off-by: Carsten Spieß (fixed checkpatch complains) Signed-off-by: Christian Lamparter (cherry picked from commit 2b1d7965c7e74e1b31ff29a966eaf6334b0d7057) --- .../cn7130_ubnt_edgerouter-e300.dtsi | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi index e63598fc974ac2..855736b2091a5b 100644 --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi @@ -99,22 +99,28 @@ reg = <0>; spi-max-frequency = <25000000>; - partition@0 { - label = "boot0"; - read-only; - reg = <0x000000 0x300000>; - }; - - partition@300000 { - label = "dummy"; - read-only; - reg = <0x300000 0x100000>; - }; - - eeprom: partition@400000 { - label = "eeprom"; - read-only; - reg = <0x400000 0x10000>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "boot0"; + read-only; + reg = <0x000000 0x300000>; + }; + + partition@300000 { + label = "dummy"; + read-only; + reg = <0x300000 0x100000>; + }; + + eeprom: partition@400000 { + label = "eeprom"; + read-only; + reg = <0x400000 0x10000>; + }; }; }; }; From 345bce75a14328bd3503e2d3ee86db7245e12417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Spie=C3=9F?= Date: Wed, 12 Jul 2023 10:24:11 +0200 Subject: [PATCH 0280/1171] octeon: ubnt-edgerouter-4/6p: devicetree cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit removed redundant eeprom partition nodes from cn7130_ubnt_edgerouter-4.dts and cn7130_ubnt_edgerouter-6p.dts as they are identically defined in cn7130_ubnt_edgerouter-e300.dtsi. Signed-off-by: Carsten Spieß (integrated eeprom referenced node in the .dtsi) Signed-off-by: Christian Lamparter (cherry picked from commit 700f11aaadb7baa38285ed8f928e976a29a72eed) --- .../cn7130_ubnt_edgerouter-4.dts | 10 --------- .../cn7130_ubnt_edgerouter-6p.dts | 9 -------- .../cn7130_ubnt_edgerouter-e300.dtsi | 21 +++++++++---------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts index 75e2c794b9e665..f8d511b599012d 100644 --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts @@ -19,13 +19,3 @@ }; }; }; - -&eeprom { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_eeprom_0: macaddr@0 { - reg = <0x0 0x6>; - }; -}; diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts index c1a41cbf705da7..f354d08199a866 100644 --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-6p.dts @@ -62,12 +62,3 @@ }; }; -&eeprom { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_eeprom_0: macaddr@0 { - reg = <0x0 0x6>; - }; -}; diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi index 855736b2091a5b..9be52f917592f3 100644 --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi @@ -116,10 +116,18 @@ reg = <0x300000 0x100000>; }; - eeprom: partition@400000 { + partition@400000 { + compatible = "nvmem-cells"; + reg = <0x400000 0x10000>; label = "eeprom"; read-only; - reg = <0x400000 0x10000>; + + #address-cells = <1>; + #size-cells = <1>; + + macaddr_eeprom_0: macaddr@0 { + reg = <0x0 0x6>; + }; }; }; }; @@ -213,12 +221,3 @@ }; }; -&eeprom { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_eeprom_0: macaddr@0 { - reg = <0x0 0x6>; - }; -}; From 57e7188e6394cdae3605154d1b11baa9c2de24ad Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 9 Jul 2023 16:01:47 -0400 Subject: [PATCH 0281/1171] linux-firmware: update to 20230625 Change from git log --oneline: ee91452d (tag: 20230625) Makefile, copy-firmware: support xz/zstd compressed firmware ad2ce8be copy-firmware: silence the last shellcheck warnings 67bf50e7 copy-firmware: drop obsolete backticks, quote 77f31a80 copy-firmware: tweak sed invocation 40fa2b20 copy-firmware: quote deskdir and dirname 77f92e0b check_whence: error if symlinks are in-tree f2671b1f check_whence: error if File: is actually a link 4b539e7a check_whence: strip quotation marks 32693d3b linux-firmware: wilc1000: update WILC1000 firmware to v16.0 109b23c5 ice: update ice DDP wireless_edge package to 1.3.10.0 ade163aa amdgpu: DMCUB updates for DCN 3.1.4 and 3.1.5 045b2136 amdgpu: update DMCUB to v0.0.172.0 for various AMDGPU ASICs 5a1842ce Merge branch 'rb3-update' of https://github.com/lumag/linux-firmware 2f81bd9f fix broken cirrus firmware symlinks 01a7a844 qcom: Update the microcode files for Adreno a630 GPUs. 94120467 qcom: sdm845: rename the modem firmware 1c599488 qcom: sdm845: update remoteproc firmware 1cd1c871 rtl_bt: Update RTL8852A BT USB firmware to 0xDAC7_480D 55e74485 rtl_bt: Update RTL8852C BT USB firmware to 0x040D_7225 9dbd8ec2 amdgpu: DMCUB updates for various AMDGPU asics 9a47adc7 Merge branch 'mtl_huc_v8.5.0' of git://anongit.freedesktop.org/drm/drm-firmware eb3ae841 linux-firmware: update firmware for MT7922 WiFi device 5ce06b9e linux-firmware: update firmware for MT7921 WiFi device 2c50361c linux-firmware: update firmware for mediatek bluetooth chip (MT7922) 185f49df linux-firmware: update firmware for mediatek bluetooth chip (MT7921) 05f94af7 Merge branch 'v2.0.21478' of https://github.com/yunfei-mtk/linux_fw_scp 5de33fb4 i915: Add HuC v8.5.0 for MTL 795aea91 mediatek: Update mt8195 SCP firmware to support hevc fc90c59b Merge branch 'db410c' of https://github.com/lumag/linux-firmware 9d4c9a52 qcom: apq8016: add Dragonboard 410c WiFi and modem firmware 1f9667eb Merge branch 'for-upstream' of http://git.chelsio.net/pub/git/linux-firmware b544e2b0 Merge branch 'for-upstream' of https://github.com/CirrusLogic/linux-firmware 244d6b5c cirrus: Add firmware for new Asus ROG Laptops d11ae984 brcm: Add symlinks from Pine64 devices to AW-CM256SM.txt 1c513ec7 amdgpu: Update GC 11.0.1 and 11.0.4 8449fcd0 Merge https://github.com/pkshih/linux-firmware c10facaf rtw89: 8851b: add firmware v0.29.41.0 1ba3519e Merge branch 'dev-queue' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/firmware 2e775450 amdgpu: update yellow carp firmware for amd.5.5 release 5eccb3c1 amdgpu: update navi14 firmware for amd.5.5 release c70d3c3b amdgpu: update navi12 firmware for amd.5.5 release 0e4f17cc amdgpu: update vega20 firmware for amd.5.5 release 413348f3 amdgpu: update vega12 firmware for amd.5.5 release c167587d amdgpu: update navi10 firmware for amd.5.5 release 3c98630a amdgpu: update vega10 firmware for amd.5.5 release d13ef0cb amdgpu: update PSP 13.0.11 firmware for amd.5.5 release 31f8f526 amdgpu: update GC 11.0.4 firmware for amd.5.5 release f0ce7026 amdgpu: update SDMA 6.0.1 firmware for amd.5.5 release 47424464 amdgpu: update PSP 13.0.4 firmware for amd.5.5 release 60dc78a7 amdgpu: update GC 11.0.1 firmware for amd.5.5 release ba70041c amdgpu: update 13.0.8 firmware for amd.5.5 release 9c48881f amdgpu: update GC 10.3.7 firmware for amd.5.5 release bb4d7250 amdgpu: update vangogh firmware for amd.5.5 release 102a4138 amdgpu: update VCN 4.0.4 firmware for amd.5.5 release a7fe4aa1 amdgpu: update SMU 13.0.7 firmware for amd.5.5 release 80b2d561 amdgpu: update PSP 13.0.7 firmware for amd.5.5 release a5d7b4df amdgpu: update GC 11.0.2 firmware for amd.5.5 release c1db00c5 amdgpu: update renoir firmware for amd.5.5 release 683c91f7 amdgpu: update VCN 4.0.0 firmware for amd.5.5 release 39d6fcc7 amdgpu: update SMU 13.0.0 firmware for amd.5.5 release 56832557 amdgpu: update PSP 13.0.0 firmware for amd.5.5 release ffe1a41e amdgpu: update GC 11.0.0 firmware for amd.5.5 release 72d525d7 amdgpu: update green sardine firmware for amd.5.5 release ceba765d amdgpu: update beige goby firmware for amd.5.5 release 95eb53c9 amdgpu: update dimgrey cavefish firmware for amd.5.5 release 909cef98 amdgpu: update arcturus firmware for amd.5.5 release 91251d16 amdgpu: update vcn 3.1.2 firmware for amd.5.5 release 9eaff866 amdgpu: update psp 13.0.5 firmware for amd.5.5 release 44772528 amdgpu: update GC 10.3.6 firmware for amd.5.5 release 3bffc9f8 amdgpu: update navy flounder firmware for amd.5.5 release 3b920773 amdgpu: update sienna cichlid firmware for amd.5.5 release 84d5550e amdgpu: update aldebaran firmware for amd.5.5 release dcd30473 amdgpu: DMCUB updates for various AMDGPU asics c9e4034a ice: update ice DDP comms package to 1.3.40.0 601c1813 Merge https://github.com/pkshih/linux-firmware 08b854f0 rtlwifi: Add firmware v6.0 for RTL8192FU b72c69dd rtlwifi: Update firmware for RTL8188EU to v28.0 51290942 (tag: 20230515) Merge branch 'main' of https://github.com/CirrusLogic/linux-firmware Signed-off-by: John Audia (cherry picked from commit a5005508f069c9bd0c1d33970e9b3ecbe5040380) --- package/firmware/linux-firmware/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index 63259cae36abd0..680f8fb104c815 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware -PKG_VERSION:=20230515 -PKG_RELEASE:=2 +PKG_VERSION:=20230625 +PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=8b1acfa16f1ee94732a6acb50d9d6c835cf53af11068bd89ed207bbe04a1e951 +PKG_HASH:=87597111c0d4b71b31e53cb85a92c386921b84c825a402db8c82e0e86015500d PKG_MAINTAINER:=Felix Fietkau From 8d7d9aa4a46366a0057b3ccf461322dda8008552 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 6 Jul 2023 08:16:50 +0200 Subject: [PATCH 0282/1171] hostapd: update to 2023-06-22 Removed, merged upstream: - 170-wpa_supplicant-fix-compiling-without-IEEE8021X_EAPOL.patch Manually refreshed: - 040-mesh-allow-processing-authentication-frames-in-block.patch - 600-ubus_support.patch - 761-shared_das_port.patch Fixes: #12661 Fixes: 304423a4 ("hostapd: update to 2023-03-29") Signed-off-by: Andre Heider (cherry picked from commit cd804c1ebb34c9740f8ad9fe393a81f3efb7b009) --- package/network/services/hostapd/Makefile | 6 +- ...hannels-to-be-selected-if-dfs-is-ena.patch | 22 +++--- ...erministic-channel-on-channel-switch.patch | 2 +- ...ix-sta-add-after-previous-connection.patch | 4 +- ...use-of-uninitialized-stack-variables.patch | 2 +- ...ewrite-neigh-code-to-not-depend-on-l.patch | 14 ++-- ...ssing-authentication-frames-in-block.patch | 4 +- ...ix-compiling-without-IEEE8021X_EAPOL.patch | 41 ---------- .../hostapd/patches/200-multicall.patch | 22 +++--- .../services/hostapd/patches/300-noscan.patch | 2 +- .../hostapd/patches/301-mesh-noscan.patch | 8 +- .../patches/310-rescan_immediately.patch | 2 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/340-reload_freq_change.patch | 8 +- .../patches/350-nl80211_del_beacon_bss.patch | 6 +- .../patches/360-ctrl_iface_reload.patch | 4 +- .../hostapd/patches/370-ap_sta_support.patch | 26 +++---- .../patches/380-disable_ctrl_iface_mib.patch | 12 +-- .../patches/420-indicate-features.patch | 4 +- .../hostapd/patches/450-scan_wait.patch | 10 +-- ...dd-new-config-params-to-be-used-with.patch | 6 +- .../patches/463-add-mcast_rate-to-11s.patch | 6 +- .../patches/464-fix-mesh-obss-check.patch | 2 +- .../patches/590-rrm-wnm-statistics.patch | 6 +- .../hostapd/patches/600-ubus_support.patch | 77 ++++++++++--------- .../hostapd/patches/700-wifi-reload.patch | 26 +++---- .../patches/720-iface_max_num_sta.patch | 8 +- .../hostapd/patches/730-ft_iface.patch | 2 +- ...750-qos_map_set_without_interworking.patch | 10 +-- .../751-qos_map_ignore_when_unsupported.patch | 2 +- .../hostapd/patches/760-dynamic_own_ip.patch | 2 +- .../hostapd/patches/761-shared_das_port.patch | 16 ++-- 32 files changed, 162 insertions(+), 202 deletions(-) delete mode 100644 package/network/services/hostapd/patches/170-wpa_supplicant-fix-compiling-without-IEEE8021X_EAPOL.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index b8921e84527a23..287a70c80e31c2 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=1.2 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-03-29 -PKG_SOURCE_VERSION:=bb945b98fefc64887dffb40773a19d77585cee42 -PKG_MIRROR_HASH:=1da8a39c7c81ce257994874402a86d00080a6145b5eb5c5fc44b2fae1853fe8d +PKG_SOURCE_DATE:=2023-06-22 +PKG_SOURCE_VERSION:=599d00be9de2846c6ea18c1487d8329522ade22b +PKG_MIRROR_HASH:=828810c558ea181e45ed0c8b940f5c41e55775e2979a15aed8cf0ab17dd7723c PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch index 761fe368cd2a9c..0a51c84d2158b2 100644 --- a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +++ b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2621,7 +2621,7 @@ static int drv_supports_vht(struct wpa_s +@@ -2638,7 +2638,7 @@ static int drv_supports_vht(struct wpa_s } @@ -23,7 +23,7 @@ Signed-off-by: Peter Oh { int i; -@@ -2630,7 +2630,10 @@ static bool ibss_mesh_is_80mhz_avail(int +@@ -2647,7 +2647,10 @@ static bool ibss_mesh_is_80mhz_avail(int chan = hw_get_channel_chan(mode, i, NULL); if (!chan || @@ -35,7 +35,7 @@ Signed-off-by: Peter Oh return false; } -@@ -2757,7 +2760,7 @@ static void ibss_mesh_select_40mhz(struc +@@ -2774,7 +2777,7 @@ static void ibss_mesh_select_40mhz(struc const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode, struct hostapd_freq_params *freq, @@ -44,7 +44,7 @@ Signed-off-by: Peter Oh int chan_idx; struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL; int i, res; -@@ -2781,8 +2784,11 @@ static void ibss_mesh_select_40mhz(struc +@@ -2798,8 +2801,11 @@ static void ibss_mesh_select_40mhz(struc return; /* Check primary channel flags */ @@ -57,7 +57,7 @@ Signed-off-by: Peter Oh #ifdef CONFIG_HT_OVERRIDES if (ssid->disable_ht40) -@@ -2808,8 +2814,11 @@ static void ibss_mesh_select_40mhz(struc +@@ -2825,8 +2831,11 @@ static void ibss_mesh_select_40mhz(struc return; /* Check secondary channel flags */ @@ -70,7 +70,7 @@ Signed-off-by: Peter Oh if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) -@@ -2863,7 +2872,7 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -2880,7 +2889,7 @@ static bool ibss_mesh_select_80_160mhz(s const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode, struct hostapd_freq_params *freq, @@ -79,7 +79,7 @@ Signed-off-by: Peter Oh static const int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5825, 5955, 6035, 6115, 6195, 6275, 6355, 6435, -@@ -2908,7 +2917,7 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -2925,7 +2934,7 @@ static bool ibss_mesh_select_80_160mhz(s goto skip_80mhz; /* Use 40 MHz if channel not usable */ @@ -88,7 +88,7 @@ Signed-off-by: Peter Oh goto skip_80mhz; chwidth = CONF_OPER_CHWIDTH_80MHZ; -@@ -2922,7 +2931,7 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -2939,7 +2948,7 @@ static bool ibss_mesh_select_80_160mhz(s if ((mode->he_capab[ieee80211_mode].phy_cap[ HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && is_6ghz && @@ -97,7 +97,7 @@ Signed-off-by: Peter Oh for (j = 0; j < ARRAY_SIZE(bw160); j++) { if (freq->freq == bw160[j]) { chwidth = CONF_OPER_CHWIDTH_160MHZ; -@@ -2950,10 +2959,12 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -2967,10 +2976,12 @@ static bool ibss_mesh_select_80_160mhz(s if (!chan) continue; @@ -113,7 +113,7 @@ Signed-off-by: Peter Oh /* Found a suitable second segment for 80+80 */ chwidth = CONF_OPER_CHWIDTH_80P80MHZ; -@@ -3008,6 +3019,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3025,6 +3036,7 @@ void ibss_mesh_setup_freq(struct wpa_sup int i, obss_scan = 1; u8 channel; bool is_6ghz; @@ -121,7 +121,7 @@ Signed-off-by: Peter Oh freq->freq = ssid->frequency; -@@ -3053,9 +3065,9 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3070,9 +3082,9 @@ void ibss_mesh_setup_freq(struct wpa_sup freq->channel = channel; /* Setup higher BW only for 5 GHz */ if (mode->mode == HOSTAPD_MODE_IEEE80211A) { diff --git a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch index 20a8bee072758f..9b11f0e8031033 100644 --- a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch +++ b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch @@ -68,7 +68,7 @@ Signed-off-by: Markus Theil if (!chan) { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -10739,6 +10739,10 @@ static int nl80211_switch_channel(void * +@@ -10977,6 +10977,10 @@ static int nl80211_switch_channel(void * if (ret) goto error; diff --git a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch index 827e122baf4ea3..4ee43b5186a5d2 100644 --- a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch +++ b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch @@ -1,6 +1,6 @@ --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4168,6 +4168,13 @@ static int add_associated_sta(struct hos +@@ -4601,6 +4601,13 @@ static int add_associated_sta(struct hos * drivers to accept the STA parameter configuration. Since this is * after a new FT-over-DS exchange, a new TK has been derived, so key * reinstallation is not a concern for this case. @@ -14,7 +14,7 @@ */ wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)", -@@ -4181,7 +4188,8 @@ static int add_associated_sta(struct hos +@@ -4614,7 +4621,8 @@ static int add_associated_sta(struct hos (!(sta->flags & WLAN_STA_AUTHORIZED) || (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) || (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) && diff --git a/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch index f4f56f5107cf6c..8dec325c985bf0 100644 --- a/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch +++ b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -3562,7 +3562,7 @@ static int hostapd_change_config_freq(st +@@ -3764,7 +3764,7 @@ static int hostapd_change_config_freq(st struct hostapd_freq_params *old_params) { int channel; diff --git a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch b/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch index c02d4b497e2aee..19248e80d8c975 100644 --- a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch +++ b/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -5590,26 +5587,29 @@ fail: +@@ -5783,26 +5780,29 @@ fail: static void rtnl_neigh_delete_fdb_entry(struct i802_bss *bss, const u8 *addr) { @@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau if (err < 0) { wpa_printf(MSG_DEBUG, "nl80211: bridge FDB entry delete for " MACSTR " ifindex=%d failed: %s", MAC2STR(addr), -@@ -5619,9 +5619,8 @@ static void rtnl_neigh_delete_fdb_entry( +@@ -5812,9 +5812,8 @@ static void rtnl_neigh_delete_fdb_entry( MACSTR, MAC2STR(addr)); } @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau } -@@ -8275,7 +8274,6 @@ static void *i802_init(struct hostapd_da +@@ -8492,7 +8491,6 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau if (bss->added_if_into_bridge || bss->already_in_bridge) { int err; -@@ -8292,7 +8290,6 @@ static void *i802_init(struct hostapd_da +@@ -8509,7 +8507,6 @@ static void *i802_init(struct hostapd_da goto failed; } } @@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { wpa_printf(MSG_DEBUG, -@@ -11605,13 +11602,14 @@ static int wpa_driver_br_add_ip_neigh(vo +@@ -11843,13 +11840,14 @@ static int wpa_driver_br_add_ip_neigh(vo const u8 *ipaddr, int prefixlen, const u8 *addr) { @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau int res; if (!ipaddr || prefixlen == 0 || !addr) -@@ -11630,85 +11628,66 @@ static int wpa_driver_br_add_ip_neigh(vo +@@ -11868,85 +11866,66 @@ static int wpa_driver_br_add_ip_neigh(vo } if (version == 4) { @@ -220,7 +220,7 @@ Signed-off-by: Felix Fietkau addrsize = 16; } else { return -EINVAL; -@@ -11726,41 +11705,30 @@ static int wpa_driver_br_delete_ip_neigh +@@ -11964,41 +11943,30 @@ static int wpa_driver_br_delete_ip_neigh return -1; } diff --git a/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch b/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch index 179d47ecc4ed02..f98d3806dc1689 100644 --- a/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch +++ b/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2948,15 +2948,6 @@ static void handle_auth(struct hostapd_d +@@ -3012,15 +3012,6 @@ static void handle_auth(struct hostapd_d seq_ctrl); return; } @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau - sta->plink_state == PLINK_BLOCKED) { - wpa_printf(MSG_DEBUG, "Mesh peer " MACSTR - " is blocked - drop Authentication frame", -- MAC2STR(mgmt->sa)); +- MAC2STR(sa)); - return; - } -#endif /* CONFIG_MESH */ diff --git a/package/network/services/hostapd/patches/170-wpa_supplicant-fix-compiling-without-IEEE8021X_EAPOL.patch b/package/network/services/hostapd/patches/170-wpa_supplicant-fix-compiling-without-IEEE8021X_EAPOL.patch deleted file mode 100644 index 7724f1ae8d6496..00000000000000 --- a/package/network/services/hostapd/patches/170-wpa_supplicant-fix-compiling-without-IEEE8021X_EAPOL.patch +++ /dev/null @@ -1,41 +0,0 @@ -From c85ce84d942e1eabde33e120b18e5b1f1637b76e Mon Sep 17 00:00:00 2001 -From: Nick Hainke -Date: Tue, 14 Mar 2023 21:40:53 +0100 -Subject: [PATCH] wpa_supplicant: fix compiling without IEEE8021X_EAPOL - -If IEEE8021X_EAPOL is not defined wpa_supplicant will not compile with -following error: - - events.c: In function 'wpa_supplicant_connect': - events.c:1827:14: warning: implicit declaration of function 'eap_is_wps_pbc_enrollee' [-Wimplicit-function-declaration] - 1827 | if ((eap_is_wps_pbc_enrollee(&ssid->eap) && - | ^~~~~~~~~~~~~~~~~~~~~~~ - events.c:1827:43: error: 'struct wpa_ssid' has no member named 'eap' - 1827 | if ((eap_is_wps_pbc_enrollee(&ssid->eap) && - | ^~ - -Adding ifdef statements around the calling function fixes the issue. - -Signed-off-by: Nick Hainke ---- - wpa_supplicant/events.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/wpa_supplicant/events.c -+++ b/wpa_supplicant/events.c -@@ -1824,6 +1824,7 @@ int wpa_supplicant_connect(struct wpa_su - struct wpa_bss *selected, - struct wpa_ssid *ssid) - { -+#ifdef IEEE8021X_EAPOL - if ((eap_is_wps_pbc_enrollee(&ssid->eap) && - wpas_wps_partner_link_overlap_detect(wpa_s)) || - wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) { -@@ -1846,6 +1847,7 @@ int wpa_supplicant_connect(struct wpa_su - #endif /* CONFIG_WPS */ - return -1; - } -+#endif /* IEEE8021X_EAPOL */ - - wpa_msg(wpa_s, MSG_DEBUG, - "Considering connect request: reassociate: %d selected: " diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index f12aeb0ca9e37a..f7e797a9c800ec 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6544,8 +6544,8 @@ union wpa_event_data { +@@ -6651,8 +6651,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -6557,7 +6557,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6664,7 +6664,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -178,7 +178,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1887,8 +1887,8 @@ err: +@@ -1994,8 +1994,8 @@ err: #endif /* CONFIG_OWE */ @@ -189,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -2161,7 +2161,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2271,7 +2271,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -5237,8 +5237,8 @@ static void wpas_event_unprot_beacon(str +@@ -5345,8 +5345,8 @@ static void wpas_link_reconfig(struct wp } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -6149,7 +6149,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6264,7 +6264,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7408,7 +7408,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -7435,7 +7435,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -7443,6 +7442,11 @@ static int wpa_supplicant_match_existing +@@ -7470,6 +7469,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -7699,6 +7703,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -7726,6 +7730,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ @@ -284,7 +284,7 @@ wpa_debug_open_file(params->wpa_debug_file_path); --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -595,6 +595,11 @@ fail: +@@ -685,6 +685,11 @@ fail: return -1; } @@ -296,7 +296,7 @@ #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -688,6 +693,8 @@ int main(int argc, char *argv[]) +@@ -778,6 +783,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 91e1aaad8333a5..c6f9eba9d53863 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1061,6 +1061,8 @@ struct hostapd_config { +@@ -1072,6 +1072,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index 8a1bdaa1854a72..6b5416f0ea57ec 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2599,6 +2599,7 @@ static const struct parse_data ssid_fiel +@@ -2600,6 +2600,7 @@ static const struct parse_data ssid_fiel #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, #endif /* CONFIG_MESH */ @@ -31,7 +31,7 @@ /* --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2693,7 +2693,7 @@ static bool ibss_mesh_can_use_vht(struct +@@ -2710,7 +2710,7 @@ static bool ibss_mesh_can_use_vht(struct const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode) { @@ -40,7 +40,7 @@ return false; if (!drv_supports_vht(wpa_s, ssid)) -@@ -2766,7 +2766,7 @@ static void ibss_mesh_select_40mhz(struc +@@ -2783,7 +2783,7 @@ static void ibss_mesh_select_40mhz(struc int i, res; unsigned int j; static const int ht40plus[] = { @@ -49,7 +49,7 @@ 184, 192 }; int ht40 = -1; -@@ -3016,7 +3016,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3033,7 +3033,7 @@ void ibss_mesh_setup_freq(struct wpa_sup int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode); enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index 033f763094d5c2..a47546d38fc2f9 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5713,7 +5713,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -5740,7 +5740,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index 93a03a6db670b4..c11c9572169ffe 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5224,7 +5224,7 @@ static int nl80211_set_channel(struct i8 +@@ -5407,7 +5407,7 @@ static int nl80211_set_channel(struct i8 freq->he_enabled, freq->eht_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch index 9a468079d1a54a..ae6cd81ea4d801 100644 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -142,6 +142,29 @@ static void hostapd_reload_bss(struct ho +@@ -143,6 +143,29 @@ static void hostapd_reload_bss(struct ho #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; @@ -30,7 +30,7 @@ if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -250,6 +273,7 @@ int hostapd_reload_config(struct hostapd +@@ -251,6 +274,7 @@ int hostapd_reload_config(struct hostapd struct hostapd_data *hapd = iface->bss[0]; struct hostapd_config *newconf, *oldconf; size_t j; @@ -38,7 +38,7 @@ if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ -@@ -300,6 +324,17 @@ int hostapd_reload_config(struct hostapd +@@ -301,6 +325,17 @@ int hostapd_reload_config(struct hostapd } iface->conf = newconf; @@ -56,7 +56,7 @@ for (j = 0; j < iface->num_bss; j++) { hapd = iface->bss[j]; if (!hapd->conf->config_id || !newconf->bss[j]->config_id || -@@ -307,21 +342,6 @@ int hostapd_reload_config(struct hostapd +@@ -308,21 +343,6 @@ int hostapd_reload_config(struct hostapd newconf->bss[j]->config_id) != 0) hostapd_clear_old_bss(hapd); hapd->iconf = newconf; diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index a943395b5640ab..647ca2cbf9751e 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -3006,12 +3006,12 @@ static int wpa_driver_nl80211_del_beacon +@@ -3008,12 +3008,12 @@ static int wpa_driver_nl80211_del_beacon return 0; wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)", @@ -15,7 +15,7 @@ if (!msg) return -ENOBUFS; -@@ -5907,7 +5907,7 @@ static void nl80211_teardown_ap(struct i +@@ -6100,7 +6100,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -24,7 +24,7 @@ } -@@ -8642,8 +8642,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -8859,8 +8859,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index e9f46ce9d36f32..4d85ea11f906b8 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -78,7 +78,7 @@ #ifdef NEED_AP_MLME static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, -@@ -3529,6 +3586,8 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3564,6 +3621,8 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); @@ -89,7 +89,7 @@ #ifdef RADIUS_SERVER --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -1008,7 +1008,13 @@ int hostapd_parse_csa_settings(const cha +@@ -1023,7 +1023,13 @@ int hostapd_parse_csa_settings(const cha int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) { diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index 24064839f13e31..3baad2a52e5008 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -172,7 +172,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -2520,6 +2572,8 @@ void wpa_supplicant_associate(struct wpa +@@ -2537,6 +2589,8 @@ void wpa_supplicant_associate(struct wpa return; } wpa_s->current_bss = bss; @@ -181,7 +181,7 @@ #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -7010,6 +7064,16 @@ static int wpa_supplicant_init_iface(str +@@ -7037,6 +7091,16 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -198,7 +198,7 @@ /* RSNA Supplicant Key Management - INITIALIZE */ eapol_sm_notify_portEnabled(wpa_s->eapol, false); eapol_sm_notify_portValid(wpa_s->eapol, false); -@@ -7352,6 +7416,11 @@ static void wpa_supplicant_deinit_iface( +@@ -7379,6 +7443,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -235,7 +235,7 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2716,6 +2716,12 @@ static int hostapd_ctrl_iface_chan_switc +@@ -2751,6 +2751,12 @@ static int hostapd_ctrl_iface_chan_switc return 0; } @@ -250,7 +250,7 @@ /* Save CHAN_SWITCH VHT, HE, and EHT config */ --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -2052,11 +2052,6 @@ static int __ieee802_11_set_beacon(struc +@@ -2108,11 +2108,6 @@ static int __ieee802_11_set_beacon(struc return -1; } @@ -264,7 +264,7 @@ if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -5237,6 +5237,60 @@ static void wpas_event_unprot_beacon(str +@@ -5345,6 +5345,60 @@ static void wpas_link_reconfig(struct wp } @@ -325,7 +325,7 @@ void supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { -@@ -5586,8 +5640,10 @@ void supplicant_event(void *ctx, enum wp +@@ -5697,8 +5751,10 @@ void supplicant_event(void *ctx, enum wp channel_width_to_string(data->ch_switch.ch_width), data->ch_switch.cf1, data->ch_switch.cf2); @@ -339,7 +339,7 @@ wpa_s->current_ssid->frequency = data->ch_switch.freq; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6324,6 +6324,7 @@ union wpa_event_data { +@@ -6421,6 +6421,7 @@ union wpa_event_data { /** * struct ch_switch @@ -347,7 +347,7 @@ * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -6334,6 +6335,7 @@ union wpa_event_data { +@@ -6431,6 +6432,7 @@ union wpa_event_data { * @punct_bitmap: Puncturing bitmap */ struct ch_switch { @@ -357,7 +357,7 @@ int ch_offset; --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c -@@ -997,6 +997,7 @@ static void mlme_event_ch_switch(struct +@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct struct nlattr *bw, struct nlattr *cf1, struct nlattr *cf2, struct nlattr *punct_bitmap, @@ -365,7 +365,7 @@ int finished) { struct i802_bss *bss; -@@ -1060,6 +1061,8 @@ static void mlme_event_ch_switch(struct +@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct data.ch_switch.cf1 = nla_get_u32(cf1); if (cf2) data.ch_switch.cf2 = nla_get_u32(cf2); @@ -374,7 +374,7 @@ if (finished) bss->flink->freq = data.ch_switch.freq; -@@ -3604,6 +3607,7 @@ static void do_process_drv_event(struct +@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], tb[NL80211_ATTR_PUNCT_BITMAP], @@ -382,7 +382,7 @@ 0); break; case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -3616,6 +3620,7 @@ static void do_process_drv_event(struct +@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], tb[NL80211_ATTR_PUNCT_BITMAP], diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index b886ab74927402..456599db09217b 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3342,6 +3342,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3377,6 +3377,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3383,6 +3384,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3418,6 +3419,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -172,7 +172,7 @@ if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2753,6 +2753,7 @@ static const char * bool_txt(bool val) +@@ -2834,6 +2834,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -180,7 +180,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2939,6 +2940,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -3020,6 +3021,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -190,7 +190,7 @@ static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -4786,6 +4786,7 @@ static const char * wpa_bool_txt(int val +@@ -5328,6 +5328,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -198,7 +198,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -4938,7 +4939,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -5480,7 +5481,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch index 356d5f8c6814e6..786b83d3151d64 100644 --- a/package/network/services/hostapd/patches/420-indicate-features.patch +++ b/package/network/services/hostapd/patches/420-indicate-features.patch @@ -9,7 +9,7 @@ struct hapd_global { void **drv_priv; -@@ -696,7 +696,7 @@ int main(int argc, char *argv[]) +@@ -786,7 +786,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -18,7 +18,7 @@ if (c < 0) break; switch (c) { -@@ -733,6 +733,8 @@ int main(int argc, char *argv[]) +@@ -823,6 +823,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch index e265d1ac7ca9f0..45886896ee9b30 100644 --- a/package/network/services/hostapd/patches/450-scan_wait.patch +++ b/package/network/services/hostapd/patches/450-scan_wait.patch @@ -24,16 +24,16 @@ /** * hostapd_driver_init - Preparate driver interface -@@ -164,6 +174,8 @@ static int hostapd_driver_init(struct ho - return -1; +@@ -217,6 +227,8 @@ static int hostapd_driver_init(struct ho } + #endif /* CONFIG_IEEE80211BE */ + hapd->setup_complete_cb = hostapd_setup_complete_cb; + /* Initialize the driver interface */ if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) b = NULL; -@@ -407,8 +419,6 @@ static void hostapd_global_deinit(const +@@ -497,8 +509,6 @@ static void hostapd_global_deinit(const #endif /* CONFIG_NATIVE_WINDOWS */ eap_server_unregister_methods(); @@ -42,7 +42,7 @@ } -@@ -434,18 +444,6 @@ static int hostapd_global_run(struct hap +@@ -524,18 +534,6 @@ static int hostapd_global_run(struct hap } #endif /* EAP_SERVER_TNC */ @@ -61,7 +61,7 @@ eloop_run(); return 0; -@@ -649,8 +647,7 @@ int main(int argc, char *argv[]) +@@ -739,8 +737,7 @@ int main(int argc, char *argv[]) struct hapd_interfaces interfaces; int ret = 1; size_t i, j; diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index 80987774597e6f..4c728681393cd7 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -22,7 +22,7 @@ Signed-hostap: Antonio Quartulli #include "common/defs.h" #include "common/ieee802_11_defs.h" #include "common/wpa_common.h" -@@ -936,6 +937,9 @@ struct wpa_driver_associate_params { +@@ -953,6 +954,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2673,6 +2765,8 @@ static const struct parse_data ssid_fiel +@@ -2674,6 +2766,8 @@ static const struct parse_data ssid_fiel { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4177,6 +4177,12 @@ static void wpas_start_assoc_cb(struct w +@@ -4203,6 +4203,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index e738ea131641a6..be9e0507d6daf3 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -19,7 +19,7 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1768,6 +1768,7 @@ struct wpa_driver_mesh_join_params { +@@ -1827,6 +1827,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; bool handle_dfs; @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -11388,6 +11388,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -11626,6 +11626,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -11449,6 +11461,7 @@ static int nl80211_join_mesh(struct i802 +@@ -11687,6 +11699,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index 73ccc65ad985ec..c7e8cf25ce8fd9 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3077,6 +3077,10 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3094,6 +3094,10 @@ void ibss_mesh_setup_freq(struct wpa_sup freq->freq = ssid->frequency; diff --git a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch index a6f43171ccddc3..0efa6db9085f2b 100644 --- a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch +++ b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -162,6 +162,21 @@ struct hostapd_sae_commit_queue { +@@ -163,6 +163,21 @@ struct hostapd_sae_commit_queue { }; /** @@ -22,9 +22,9 @@ * struct hostapd_data - hostapd per-BSS data structure */ struct hostapd_data { -@@ -175,6 +190,9 @@ struct hostapd_data { +@@ -182,6 +197,9 @@ struct hostapd_data { - u8 own_addr[ETH_ALEN]; + struct hostapd_data *mld_first_bss; + /* OpenWrt specific statistics */ + struct hostapd_openwrt_stats openwrt_stats; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index aa68079fb26683..f3936342a5f118 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -31,7 +31,7 @@ }; enum hostapd_chan_status { -@@ -183,6 +184,7 @@ struct hostapd_data { +@@ -184,6 +185,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -39,7 +39,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -682,6 +684,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -695,6 +697,7 @@ hostapd_alloc_bss_data(struct hostapd_if struct hostapd_bss_config *bss); int hostapd_setup_interface(struct hostapd_iface *iface); int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); @@ -49,7 +49,7 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -435,6 +435,7 @@ void hostapd_free_hapd_data(struct hosta +@@ -455,6 +455,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -57,7 +57,7 @@ accounting_deinit(hapd); hostapd_deinit_wpa(hapd); vlan_deinit(hapd); -@@ -1185,6 +1186,8 @@ static int hostapd_start_beacon(struct h +@@ -1207,6 +1208,8 @@ static int hostapd_start_beacon(struct h if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -66,7 +66,7 @@ return 0; } -@@ -2126,6 +2129,7 @@ static int hostapd_setup_interface_compl +@@ -2295,6 +2298,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -74,15 +74,15 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2342,6 +2346,7 @@ dfs_offload: +@@ -2514,6 +2518,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); + hostapd_ubus_free_iface(iface); - hostapd_set_state(iface, HAPD_IFACE_DISABLED); - wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); - #ifdef CONFIG_FST -@@ -2817,6 +2822,7 @@ void hostapd_interface_deinit_free(struc + + if (iface->is_no_ir) { + hostapd_set_state(iface, HAPD_IFACE_NO_IR); +@@ -3004,6 +3009,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -92,7 +92,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2740,13 +2740,18 @@ static void handle_auth(struct hostapd_d +@@ -2778,7 +2778,7 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -101,9 +101,10 @@ u16 fc; const u8 *challenge = NULL; u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; - size_t resp_ies_len = 0; - u16 seq_ctrl; +@@ -2787,6 +2787,11 @@ static void handle_auth(struct hostapd_d struct radius_sta rad_info; + const u8 *dst, *sa, *bssid; + bool mld_sta = false; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_AUTH_REQ, + .mgmt_frame = mgmt, @@ -112,7 +113,7 @@ if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -2914,6 +2919,13 @@ static void handle_auth(struct hostapd_d +@@ -2978,6 +2983,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -126,7 +127,7 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -4695,7 +4707,7 @@ static void handle_assoc(struct hostapd_ +@@ -5141,7 +5153,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; const u8 *pos; @@ -135,7 +136,7 @@ struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -4908,6 +4920,11 @@ static void handle_assoc(struct hostapd_ +@@ -5354,6 +5366,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -147,7 +148,7 @@ /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -5006,6 +5023,13 @@ static void handle_assoc(struct hostapd_ +@@ -5452,6 +5469,13 @@ static void handle_assoc(struct hostapd_ } #endif /* CONFIG_FILS */ @@ -161,26 +162,26 @@ fail: /* -@@ -5099,6 +5123,7 @@ static void handle_disassoc(struct hosta - wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", - MAC2STR(mgmt->sa), - le_to_host16(mgmt->u.disassoc.reason_code)); +@@ -5733,6 +5757,7 @@ static void handle_disassoc(struct hosta + (unsigned long) len); + return; + } + hostapd_ubus_notify(hapd, "disassoc", mgmt->sa); sta = ap_get_sta(hapd, mgmt->sa); - if (sta == NULL) { -@@ -5168,6 +5193,8 @@ static void handle_deauth(struct hostapd + if (!sta) { +@@ -5764,6 +5789,8 @@ static void handle_deauth(struct hostapd /* Clear the PTKSA cache entries for PASN */ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); + hostapd_ubus_notify(hapd, "deauth", mgmt->sa); + sta = ap_get_sta(hapd, mgmt->sa); - if (sta == NULL) { - wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " + if (!sta) { + wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1006,6 +1006,12 @@ void handle_probe_req(struct hostapd_dat +@@ -1036,6 +1036,12 @@ void handle_probe_req(struct hostapd_dat u16 csa_offs[2]; size_t csa_offs_len; struct radius_sta rad_info; @@ -193,7 +194,7 @@ if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && ssi_signal < hapd->iconf->rssi_ignore_probe_request) -@@ -1192,6 +1198,12 @@ void handle_probe_req(struct hostapd_dat +@@ -1222,6 +1228,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ @@ -234,7 +235,7 @@ wpabuf_free(sta->p2p_ie); --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c -@@ -460,6 +460,7 @@ void ap_handle_timer(void *eloop_ctx, vo +@@ -471,6 +471,7 @@ void ap_handle_timer(void *eloop_ctx, vo hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_INFO, "deauthenticated due to " "local deauth request"); @@ -242,7 +243,7 @@ ap_free_sta(hapd, sta); return; } -@@ -615,6 +616,7 @@ skip_poll: +@@ -626,6 +627,7 @@ skip_poll: mlme_deauthenticate_indication( hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); @@ -250,7 +251,7 @@ ap_free_sta(hapd, sta); break; } -@@ -1305,15 +1307,28 @@ void ap_sta_set_authorized(struct hostap +@@ -1344,15 +1346,28 @@ void ap_sta_set_authorized(struct hostap sta->addr, authorized, dev_addr); if (authorized) { @@ -279,7 +280,7 @@ #ifdef CONFIG_P2P if (wpa_auth_get_ip_addr(sta->wpa_sm, ip_addr_buf) == 0) { os_snprintf(ip_addr, sizeof(ip_addr), -@@ -1323,6 +1338,13 @@ void ap_sta_set_authorized(struct hostap +@@ -1362,6 +1377,13 @@ void ap_sta_set_authorized(struct hostap } #endif /* CONFIG_P2P */ @@ -293,7 +294,7 @@ keyid = ap_sta_wpa_get_keyid(hapd, sta); if (keyid) { os_snprintf(keyid_buf, sizeof(keyid_buf), -@@ -1341,17 +1363,19 @@ void ap_sta_set_authorized(struct hostap +@@ -1380,17 +1402,19 @@ void ap_sta_set_authorized(struct hostap dpp_pkhash, SHA256_MAC_LEN); } @@ -354,7 +355,7 @@ CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7608,6 +7608,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7635,6 +7635,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -363,7 +364,7 @@ return wpa_s; } -@@ -7634,6 +7636,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -7661,6 +7663,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -372,7 +373,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -7980,8 +7984,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -8007,8 +8011,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -433,7 +434,7 @@ --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -901,6 +901,7 @@ int main(int argc, char *argv[]) +@@ -991,6 +991,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -441,7 +442,7 @@ if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -910,6 +911,7 @@ int main(int argc, char *argv[]) +@@ -1000,6 +1001,7 @@ int main(int argc, char *argv[]) ret = 0; out: @@ -574,7 +575,7 @@ } --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -293,6 +293,7 @@ struct sta_info { +@@ -322,6 +322,7 @@ struct sta_info { #endif /* CONFIG_TESTING_OPTIONS */ #ifdef CONFIG_AIRTIME_POLICY unsigned int airtime_weight; diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index 5ac7f711a5cdee..e0da149c443d9e 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "channel") == 0) { --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c -@@ -997,6 +997,7 @@ void hostapd_config_free(struct hostapd_ +@@ -998,6 +998,7 @@ void hostapd_config_free(struct hostapd_ for (i = 0; i < conf->num_bss; i++) hostapd_config_free_bss(conf->bss[i]); @@ -30,7 +30,7 @@ os_free(conf->basic_rates); --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -987,6 +987,7 @@ struct eht_phy_capabilities_info { +@@ -998,6 +998,7 @@ struct eht_phy_capabilities_info { struct hostapd_config { struct hostapd_bss_config **bss, *last_bss; size_t num_bss; @@ -40,7 +40,7 @@ int rts_threshold; --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -254,6 +254,10 @@ static int hostapd_iface_conf_changed(st +@@ -255,6 +255,10 @@ static int hostapd_iface_conf_changed(st { size_t i; @@ -51,7 +51,7 @@ if (newconf->num_bss != oldconf->num_bss) return 1; -@@ -267,7 +271,7 @@ static int hostapd_iface_conf_changed(st +@@ -268,7 +272,7 @@ static int hostapd_iface_conf_changed(st } @@ -60,7 +60,7 @@ { struct hapd_interfaces *interfaces = iface->interfaces; struct hostapd_data *hapd = iface->bss[0]; -@@ -295,6 +299,9 @@ int hostapd_reload_config(struct hostapd +@@ -296,6 +300,9 @@ int hostapd_reload_config(struct hostapd char *fname; int res; @@ -70,7 +70,7 @@ hostapd_clear_old(iface); wpa_printf(MSG_DEBUG, -@@ -321,6 +328,24 @@ int hostapd_reload_config(struct hostapd +@@ -322,6 +329,24 @@ int hostapd_reload_config(struct hostapd wpa_printf(MSG_ERROR, "Failed to enable interface on config reload"); return res; @@ -95,7 +95,7 @@ } iface->conf = newconf; -@@ -337,6 +362,12 @@ int hostapd_reload_config(struct hostapd +@@ -338,6 +363,12 @@ int hostapd_reload_config(struct hostapd for (j = 0; j < iface->num_bss; j++) { hapd = iface->bss[j]; @@ -108,7 +108,7 @@ if (!hapd->conf->config_id || !newconf->bss[j]->config_id || os_strcmp(hapd->conf->config_id, newconf->bss[j]->config_id) != 0) -@@ -2514,6 +2545,10 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2700,6 +2731,10 @@ hostapd_alloc_bss_data(struct hostapd_if hapd->iconf = conf; hapd->conf = bss; hapd->iface = hapd_iface; @@ -130,7 +130,7 @@ struct hostapd_config * (*config_read_cb)(const char *config_fname); int (*ctrl_iface_init)(struct hostapd_data *hapd); void (*ctrl_iface_deinit)(struct hostapd_data *hapd); -@@ -185,6 +185,7 @@ struct hostapd_data { +@@ -186,6 +186,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -138,7 +138,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -676,7 +677,7 @@ struct hostapd_iface { +@@ -689,7 +690,7 @@ struct hostapd_iface { int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -149,7 +149,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5054,6 +5054,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -5322,6 +5322,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); @@ -157,7 +157,7 @@ + ret = 0; + bss->flink->beacon_set = 0; } else { - bss->flink->beacon_set = 1; + link->beacon_set = 1; nl80211_set_bss(bss, params->cts_protect, params->preamble, --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -172,7 +172,7 @@ } --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -320,7 +320,7 @@ static void handle_term(int sig, void *s +@@ -410,7 +410,7 @@ static void handle_term(int sig, void *s static int handle_reload_iface(struct hostapd_iface *iface, void *ctx) { diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch index a06f141c83fcc8..bf7e8e7617541d 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -17,7 +17,7 @@ } else if (os_strcmp(buf, "extended_key_id") == 0) { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -721,6 +721,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -734,6 +734,7 @@ void hostapd_cleanup_cs_params(struct ho void hostapd_periodic_iface(struct hostapd_iface *iface); int hostapd_owe_trans_get_info(struct hostapd_data *hapd); void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); @@ -27,7 +27,7 @@ void hostapd_cleanup_cca_params(struct hostapd_data *hapd); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -271,6 +271,30 @@ static int hostapd_iface_conf_changed(st +@@ -272,6 +272,30 @@ static int hostapd_iface_conf_changed(st } @@ -60,7 +60,7 @@ struct hapd_interfaces *interfaces = iface->interfaces; --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1222,7 +1222,7 @@ void handle_probe_req(struct hostapd_dat +@@ -1252,7 +1252,7 @@ void handle_probe_req(struct hostapd_dat if (hapd->conf->no_probe_resp_if_max_sta && is_multicast_ether_addr(mgmt->da) && is_multicast_ether_addr(mgmt->bssid) && @@ -71,7 +71,7 @@ " since no room for additional STA", --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1026,6 +1026,8 @@ struct hostapd_config { +@@ -1037,6 +1037,8 @@ struct hostapd_config { unsigned int track_sta_max_num; unsigned int track_sta_max_age; diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index 1826c97623622b..0795ed15a1402b 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -21,7 +21,7 @@ int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -1616,8 +1616,12 @@ int hostapd_setup_wpa(struct hostapd_dat +@@ -1727,8 +1727,12 @@ int hostapd_setup_wpa(struct hostapd_dat wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt)) { const char *ft_iface; diff --git a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch index c3a77bc6537b2a..e06e36c37d1988 100644 --- a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch +++ b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch @@ -32,7 +32,7 @@ os_free(bss->dump_msk_file); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1499,6 +1499,7 @@ static int hostapd_setup_bss(struct host +@@ -1534,6 +1534,7 @@ static int hostapd_setup_bss(struct host wpa_printf(MSG_ERROR, "GAS server initialization failed"); return -1; } @@ -40,7 +40,7 @@ if (conf->qos_map_set_len && hostapd_drv_set_qos_map(hapd, conf->qos_map_set, -@@ -1506,7 +1507,6 @@ static int hostapd_setup_bss(struct host +@@ -1541,7 +1542,6 @@ static int hostapd_setup_bss(struct host wpa_printf(MSG_ERROR, "Failed to initialize QoS Map"); return -1; } @@ -50,7 +50,7 @@ wpa_printf(MSG_ERROR, "BSS Load initialization failed"); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -2672,8 +2672,6 @@ void wnm_bss_keep_alive_deinit(struct wp +@@ -2683,8 +2683,6 @@ void wnm_bss_keep_alive_deinit(struct wp } @@ -59,7 +59,7 @@ static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map, size_t len) { -@@ -2706,8 +2704,6 @@ static void interworking_process_assoc_r +@@ -2717,8 +2715,6 @@ static void interworking_process_assoc_r } } @@ -68,7 +68,7 @@ static void wpa_supplicant_set_4addr_mode(struct wpa_supplicant *wpa_s) { -@@ -3087,10 +3083,8 @@ static int wpa_supplicant_event_associnf +@@ -3098,10 +3094,8 @@ static int wpa_supplicant_event_associnf wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, data->assoc_info.resp_ies_len); #endif /* CONFIG_WNM */ diff --git a/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch b/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch index 1fc4e8a77cf2f6..f5ebab70d1db36 100644 --- a/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch +++ b/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch @@ -1,6 +1,6 @@ --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c -@@ -874,7 +874,8 @@ int hostapd_start_dfs_cac(struct hostapd +@@ -927,7 +927,8 @@ int hostapd_start_dfs_cac(struct hostapd int hostapd_drv_set_qos_map(struct hostapd_data *hapd, const u8 *qos_map_set, u8 qos_map_set_len) { diff --git a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch index 2f5015892b7b46..2c705a68cf0acf 100644 --- a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch +++ b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch @@ -85,7 +85,7 @@ RadiusType msg_type, const u8 *addr); --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -535,6 +535,10 @@ int add_common_radius_attr(struct hostap +@@ -598,6 +598,10 @@ int add_common_radius_attr(struct hostap struct hostapd_radius_attr *attr; int len; diff --git a/package/network/services/hostapd/patches/761-shared_das_port.patch b/package/network/services/hostapd/patches/761-shared_das_port.patch index 59c2a967953d5e..dad7afddf13b66 100644 --- a/package/network/services/hostapd/patches/761-shared_das_port.patch +++ b/package/network/services/hostapd/patches/761-shared_das_port.patch @@ -10,14 +10,14 @@ unsigned int time_window; --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1442,6 +1442,7 @@ static int hostapd_setup_bss(struct host - struct radius_das_conf das_conf; - os_memset(&das_conf, 0, sizeof(das_conf)); - das_conf.port = conf->radius_das_port; -+ das_conf.nas_identifier = conf->nas_identifier; - das_conf.shared_secret = conf->radius_das_shared_secret; - das_conf.shared_secret_len = - conf->radius_das_shared_secret_len; +@@ -1471,6 +1471,7 @@ static int hostapd_setup_bss(struct host + + os_memset(&das_conf, 0, sizeof(das_conf)); + das_conf.port = conf->radius_das_port; ++ das_conf.nas_identifier = conf->nas_identifier; + das_conf.shared_secret = conf->radius_das_shared_secret; + das_conf.shared_secret_len = + conf->radius_das_shared_secret_len; --- a/src/radius/radius_das.c +++ b/src/radius/radius_das.c @@ -12,13 +12,26 @@ From 2f71a7ecd8a7fd2a08560537743351ec86aeb8b3 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 12 Jul 2023 23:38:51 +0200 Subject: [PATCH 0283/1171] libnftnl: update to 1.2.6 Release Notes: https://lists.netfilter.org/pipermail/netfilter-announce/2023/000250.html Signed-off-by: Nick Hainke (cherry picked from commit e57a752217113d066cdea2073f35e8c7c1fafaa6) --- package/libs/libnftnl/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index 05437d020b96bb..b512d4d58fe616 100644 --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnftnl PKG_CPE_ID:=cpe:/a:netfilter:libnftnl -PKG_VERSION:=1.2.5 -PKG_RELEASE:=2 +PKG_VERSION:=1.2.6 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=966de0a8120c8a53db859889749368bfb2cba0c4f0b4c1a30d264eccc45f1226 +PKG_HASH:=ceeaea2cd92147da19f13a35a7f1a4bc2767ff897e838e4b479cf54b59c777f4 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0-or-later From 0b087073e6af6012614c60aa1136f75c2f9fd108 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Fri, 14 Jul 2023 15:26:06 +0200 Subject: [PATCH 0284/1171] nftables: update to 1.0.8 ChangeLog: https://www.netfilter.org/projects/nftables/files/changes-nftables-1.0.8.txt Signed-off-by: Nick Hainke (cherry picked from commit 58c498247b3d06c0ff1967d2f48ba84084a6cf25) --- package/network/utils/nftables/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index 55a6a4bcf69c34..3078f5605ff318 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nftables -PKG_VERSION:=1.0.7 +PKG_VERSION:=1.0.8 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=c12ac941fff9adaedf17367d5ce213789b98a0d314277bc22b3d71e10891f412 +PKG_HASH:=9373740de41a82dbc98818e0a46a073faeb8a8d0689fa4fa1a74399c32bf3d50 PKG_MAINTAINER:= PKG_LICENSE:=GPL-2.0 From b607cd30c7e861f37be293eeb454ddd18514ba50 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sun, 16 Jul 2023 18:22:59 -0700 Subject: [PATCH 0285/1171] libbpf: Update to v1.2.2 Update to the latest upstream release to include recent bugfixes: Link: https://github.com/libbpf/libbpf/compare/v1.2.0...v1.2.2 Signed-off-by: Tony Ambardar (cherry picked from commit 1d5e7b85ccc58f3d010a54e82ccea81fc102262b) --- package/libs/libbpf/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libbpf/Makefile b/package/libs/libbpf/Makefile index ee7666f734d891..316a56627432e1 100644 --- a/package/libs/libbpf/Makefile +++ b/package/libs/libbpf/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libbpf -PKG_VERSION:=1.2.0 +PKG_VERSION:=1.2.2 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/libbpf/libbpf +PKG_MIRROR_HASH:=d20f5a226e5729c87c367f3fba61c44d5e13176ef12637d0e0b30629fa3ab0d6 PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=fbd60dbff51c870f5e80a17c4f2fd639eb80af90 -PKG_MIRROR_HASH:=80a80dfba71576e017b596fb28068e2a92de629e426f063e4b37314c8d576336 +PKG_SOURCE_VERSION:=1728e3e4bef0e138ea95ffe62163eb9a6ac6fa32 PKG_ABI_VERSION:=$(firstword $(subst .,$(space),$(PKG_VERSION))) PKG_MAINTAINER:=Tony Ambardar From b28d74090fa59c6ddf6e4ff21f8521bc0dec3766 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 22 Jul 2023 12:30:43 +0100 Subject: [PATCH 0286/1171] mediatek: filogic: set DEVICE_DTS_LOADADDR for BPi-R3 U-Boot complains that the overlayed DT needs relocation, so set DEVICE_DTS_LOADADDR to have it relocated. Signed-off-by: Daniel Golle (cherry picked from commit b1d10e0174f71099016a7e6dcd27b65a77fd51b4) --- target/linux/mediatek/image/filogic.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 2ace305140b2e5..8d5caad113137c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -98,6 +98,7 @@ define Device/bananapi_bpi-r3 DEVICE_DTS_CONFIG := config-mt7986a-bananapi-bpi-r3 DEVICE_DTS_OVERLAY:= mt7986a-bananapi-bpi-r3-emmc mt7986a-bananapi-bpi-r3-nand mt7986a-bananapi-bpi-r3-nor mt7986a-bananapi-bpi-r3-sd DEVICE_DTS_DIR := $(DTS_DIR)/ + DEVICE_DTS_LOADADDR := 0x43f00000 DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-i2c-gpio kmod-mt7986-firmware kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs mt7986-wo-firmware IMAGES := sysupgrade.itb KERNEL_LOADADDR := 0x44000000 From 476bf135fcec4c1ceb5114029e539a07131e970f Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 15 Jul 2023 18:10:31 +0200 Subject: [PATCH 0287/1171] mediatek: add support for ZyXEL NWA50AX Pro Hardware -------- CPU: Mediatek MT7981 RAM: 512M DDR4 FLASH: 256M NAND ETH: MaxLinear GPY211 (2.5GbE N Base-T) WiFi: Mediatek MT7981 (2.4GHz 2T2R:2 5GHz 3T3R:2 802.11ax) BTN: 1x Reset LED: 1x Multi-Color UART Console ------------ Available below the rubber cover next to the ethernet port. Settings: 115200 8N1 Layout: <12V> GND-RX-TX-VCC Logic-Level is 3V3. Don't connect VCC to your UART adapter! Installation Web-UI ------------------- Upload the Factory image using the devices Web-Interface. As the device uses a dual-image partition layout, OpenWrt can only installed on Slot A. This requires the current active image prior flashing the device to be on Slot B. In case this is not the case, OpenWrt will boot only one time, returning to the ZyXEL firmware the second boot. If this happens, first install a ZyXEL firmware upgrade of any version and install OpenWrt after that. Installation TFTP / Recovery ---------------------------- This installation routine is especially useful in case of a bricked device. Attach to the UART console header of the device. Interrupt the boot procedure by pressing Enter. The bootloader has a reduced command-set available from CLI, but more commands can be executed by abusing the atns command. Boot a OpenWrt initramfs image available on a TFTP server at 192.168.1.66. Rename the image to nwa50axpro-openwrt-initramfs.bin. $ atnf nwa50axpro-openwrt-initramfs.bin $ atna 192.168.1.88 $ atns "192.168.1.66; tftpboot; setenv fdt_high 0xffffffffffffffff; bootm" Upon booting, set the booted image to the correct slot: $ zyxel-bootconfig /dev/mtd9 get-status $ zyxel-bootconfig /dev/mtd9 set-image-status 0 valid $ zyxel-bootconfig /dev/mtd9 set-active-image 0 Copy the OpenWrt sysupgrade image to the device using scp. Write the sysupgrade image to NAND using sysupgrade. $ sysupgrade -n image.bin Signed-off-by: David Bauer (cherry picked from commit f0445746f6fd96fc7c5394b238153bd2ff22bc5b) --- .../files/95_apply_bootconfig | 1 + scripts/mkits-zyxel-fit-filogic.sh | 40 ++++ .../dts/mt7981b-zyxel-nwa50ax-pro.dts | 225 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + target/linux/mediatek/image/filogic.mk | 25 ++ 6 files changed, 298 insertions(+), 1 deletion(-) create mode 100755 scripts/mkits-zyxel-fit-filogic.sh create mode 100644 target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts diff --git a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig index 500b81234a60f6..c98bc8fbe24ae5 100644 --- a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig +++ b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig @@ -3,6 +3,7 @@ apply_bootconfig() { case $(board_name) in zyxel,nwa50ax|\ + zyxel,nwa50ax-pro|\ zyxel,nwa55axe) mtd_idx=$(find_mtd_index "bootconfig") zyxel-bootconfig "/dev/mtd$mtd_idx" set-image-status 0 valid diff --git a/scripts/mkits-zyxel-fit-filogic.sh b/scripts/mkits-zyxel-fit-filogic.sh new file mode 100755 index 00000000000000..319e187f5a965e --- /dev/null +++ b/scripts/mkits-zyxel-fit-filogic.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# +# Licensed under the terms of the GNU GPL License version 2 or later. +# Author: David Bauer , based on mkits-zyxel-factory.sh. + +usage() { + echo "Usage: `basename $0` output file compat-models" + exit 1 +} + +# We need at least 3 arguments +[ "$#" -lt 3 ] && usage + +# Target output file +OUTPUT="$1"; shift +FILE="$1"; shift +MODELS="$1"; shift + +# Create a default, fully populated DTS file +echo "\ +/dts-v1/; + +/ { + timestamp = <0x684090B4>; + description = \"Zyxel FIT (Flattened Image Tree)\"; + compat-models = [${MODELS}]; + fw_version = \"9.99(###.1)\"; + #address-cells = <1>; + + images { + ubi { + data = /incbin/(\"${FILE}\"); + type = \"firmware\"; + compression = \"none\"; + hash { + algo = \"sha256\"; + }; + }; + }; +};" > ${OUTPUT} diff --git a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts new file mode 100644 index 00000000000000..75dd84c9d7e564 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts @@ -0,0 +1,225 @@ +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "ZyXEL NWA50AX Pro"; + compatible = "zyxel,nwa50ax-pro", "mediatek,mt7981"; + + aliases { + led-boot = &led_green; + led-failsafe = &led_red; + led-running = &led_green; + led-upgrade = &led_red; + serial0 = &uart0; + label-mac-device = &gmac1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_green: led@0 { + label = "green:system"; + gpios = <&pio 4 GPIO_ACTIVE_HIGH>; + }; + + led@1 { + label = "blue:system"; + gpios = <&pio 6 GPIO_ACTIVE_HIGH>; + }; + + led_red: led@2 { + label = "red:system"; + gpios = <&pio 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + + phy-handle = <&phy0>; + + nvmem-cells = <&macaddr_mrd_1fff8>; + nvmem-cell-names = "mac-address"; + }; +}; + +&mdio_bus { + reset-gpios = <&pio 12 GPIO_ACTIVE_LOW>; + reset-delay-us = <1500000>; + reset-post-delay-us = <1000000>; + + phy0: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c45"; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + mediatek,bmt-remap-range = + <0x0 0x580000>, + <0xef00000 0xef80000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr: macaddr@a { + reg = <0xa 0x6>; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x3200000>; + }; + + partition@3780000 { + label = "ubi_1"; + reg = <0x3780000 0x3200000>; + read-only; + }; + + partition@6980000 { + label = "rootfs-data"; + reg = <0x6980000 0x3c00000>; + read-only; + }; + + partition@a580000 { + label = "logs"; + reg = <0xa580000 0x3a80000>; + read-only; + }; + + partition@e000000 { + label = "myzyxel"; + reg = <0xe000000 0xf00000>; + read-only; + }; + + partition@ef00000 { + label = "bootconfig"; + reg = <0xef00000 0x80000>; + }; + + partition@ef80000 { + label = "mrd"; + reg = <0xef80000 0x80000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mrd_1fff8: macaddr@1fff8 { + reg = <0x1fff8 0x6>; + }; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + + pwm_pins: pwm0-pins { + mux { + function = "pwm"; + groups = "pwm0_1"; + }; + }; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 6abc81a0b0561d..3b170ddc1885fc 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -11,7 +11,8 @@ mediatek_setup_interfaces() asus,tuf-ax4200) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; - netgear,wax220) + netgear,wax220|\ + zyxel,nwa50ax-pro) ucidef_set_interface_lan "eth0" ;; bananapi,bpi-r3) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index ab23b100444ce4..3620e3a6fbc032 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -61,4 +61,9 @@ case "$board" in addr=$(mtd_get_mac_binary "Factory" 0x4) [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress ;; + zyxel,nwa50ax-pro) + hw_mac_addr="$(mtd_get_mac_binary mrd 0x1fff8)" + [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress + ;; esac diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 8d5caad113137c..c41cba3a642dce 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -75,6 +75,13 @@ define Build/append-gl-metadata } endef +define Build/zyxel-nwa-fit-filogic + $(TOPDIR)/scripts/mkits-zyxel-fit-filogic.sh \ + $@.its $@ "80 e1 ff ff ff ff ff ff ff ff" + PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new + @mv $@.new $@ +endef + define Device/asus_tuf-ax4200 DEVICE_VENDOR := ASUS DEVICE_MODEL := TUF-AX4200 @@ -424,3 +431,21 @@ define Device/zyxel_ex5601-t0-stock fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd endef TARGET_DEVICES += zyxel_ex5601-t0-stock + +define Device/zyxel_nwa50ax-pro + DEVICE_VENDOR := ZyXEL + DEVICE_MODEL := NWA50AX Pro + DEVICE_DTS := mt7981b-zyxel-nwa50ax-pro + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware zyxel-bootconfig + DEVICE_DTS_LOADADDR := 0x44000000 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 51200k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) | zyxel-nwa-fit-filogic + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += zyxel_nwa50ax-pro From e5dea9e37f1953d0cc4b846a530ff4247bf08ee0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Jul 2023 13:17:44 +0200 Subject: [PATCH 0288/1171] ramips: mt7621: disable highmem support and remove highmem offset patch On MT7621 it was observed, that enabling highmem support causes a significant performance drop, as documented in: https://github.com/openwrt/openwrt/issues/13151 By adjusting the highmem start offset, we avoid leaving any RAM unaddressable, even on devices with 512 MB Fixes: https://github.com/openwrt/openwrt/issues/13151 Signed-off-by: Felix Fietkau (cherry picked from commit cd2b74e01e8d5f5b80b82db1cb204c13ed99dd58) --- target/linux/ramips/mt7621/config-5.15 | 3 --- .../120-highmem-start-offset.patch | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 target/linux/ramips/patches-5.15/120-highmem-start-offset.patch diff --git a/target/linux/ramips/mt7621/config-5.15 b/target/linux/ramips/mt7621/config-5.15 index b366dac723a591..05e4c1ce87799c 100644 --- a/target/linux/ramips/mt7621/config-5.15 +++ b/target/linux/ramips/mt7621/config-5.15 @@ -7,7 +7,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_BOARD_SCACHE=y -CONFIG_BOUNCE=y CONFIG_CEVT_R4K=y CONFIG_CLKSRC_MIPS_GIC=y CONFIG_CLK_MT7621=y @@ -91,7 +90,6 @@ CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y -CONFIG_HIGHMEM=y CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y @@ -106,7 +104,6 @@ CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y -CONFIG_KMAP_LOCAL=y CONFIG_LED_TRIGGER_PHY=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y diff --git a/target/linux/ramips/patches-5.15/120-highmem-start-offset.patch b/target/linux/ramips/patches-5.15/120-highmem-start-offset.patch new file mode 100644 index 00000000000000..629c7bfa5cd30b --- /dev/null +++ b/target/linux/ramips/patches-5.15/120-highmem-start-offset.patch @@ -0,0 +1,19 @@ +From: Felix Fietkau +Date: Mon Jul 24 13:29:13 CEST 2023 +Subject: [PATCH] mips: ralink: increase highmem start + +Increase highmem start address in order to support devices with 512 MB memory +and MT7621 SoC + +Signed-off-by: Felix Fietkau +--- +--- a/arch/mips/include/asm/mach-ralink/spaces.h ++++ b/arch/mips/include/asm/mach-ralink/spaces.h +@@ -5,6 +5,7 @@ + #define PCI_IOBASE _AC(0xa0000000, UL) + #define PCI_IOSIZE SZ_16M + #define IO_SPACE_LIMIT (PCI_IOSIZE - 1) ++#define HIGHMEM_START _AC(0x24000000, UL) + + #include + #endif From 339e71cbd3f86e5901f600a6bb32c9d2613f3793 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Jul 2023 14:43:03 +0200 Subject: [PATCH 0289/1171] kernel: drop mips highmem offset start overrides The maximum offset that can be supported is 0x20000000 Do not override it to to something bigger than that on MT7621, as that could cause issues based on the fixed memory mappings. This makes the last 64 MB RAM unusable on MT7621 devices with 512 MB but avoids incurring a heavy performance hit Fixes: cd2b74e01e8d ("ramips: mt7621: disable highmem support and remove highmem offset patch") Signed-off-by: Felix Fietkau (cherry picked from commit a110de8152df46a1e2adf7010ba75fb3b1236cd8) --- .../307-mips_highmem_offset.patch | 19 ------------------- .../120-highmem-start-offset.patch | 19 ------------------- 2 files changed, 38 deletions(-) delete mode 100644 target/linux/generic/pending-5.15/307-mips_highmem_offset.patch delete mode 100644 target/linux/ramips/patches-5.15/120-highmem-start-offset.patch diff --git a/target/linux/generic/pending-5.15/307-mips_highmem_offset.patch b/target/linux/generic/pending-5.15/307-mips_highmem_offset.patch deleted file mode 100644 index 0529b0c5c8aa88..00000000000000 --- a/target/linux/generic/pending-5.15/307-mips_highmem_offset.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Subject: kernel: adjust mips highmem offset to avoid the need for -mlong-calls on systems with >256M RAM - -Signed-off-by: Felix Fietkau ---- - arch/mips/include/asm/mach-generic/spaces.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/include/asm/mach-generic/spaces.h -+++ b/arch/mips/include/asm/mach-generic/spaces.h -@@ -46,7 +46,7 @@ - * Memory above this physical address will be considered highmem. - */ - #ifndef HIGHMEM_START --#define HIGHMEM_START _AC(0x20000000, UL) -+#define HIGHMEM_START _AC(0x10000000, UL) - #endif - - #endif /* CONFIG_32BIT */ diff --git a/target/linux/ramips/patches-5.15/120-highmem-start-offset.patch b/target/linux/ramips/patches-5.15/120-highmem-start-offset.patch deleted file mode 100644 index 629c7bfa5cd30b..00000000000000 --- a/target/linux/ramips/patches-5.15/120-highmem-start-offset.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Date: Mon Jul 24 13:29:13 CEST 2023 -Subject: [PATCH] mips: ralink: increase highmem start - -Increase highmem start address in order to support devices with 512 MB memory -and MT7621 SoC - -Signed-off-by: Felix Fietkau ---- ---- a/arch/mips/include/asm/mach-ralink/spaces.h -+++ b/arch/mips/include/asm/mach-ralink/spaces.h -@@ -5,6 +5,7 @@ - #define PCI_IOBASE _AC(0xa0000000, UL) - #define PCI_IOSIZE SZ_16M - #define IO_SPACE_LIMIT (PCI_IOSIZE - 1) -+#define HIGHMEM_START _AC(0x24000000, UL) - - #include - #endif From dc370ad19adaedfaca2f14c3bb3aea0af28f625c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 14 Jul 2023 11:20:30 +0200 Subject: [PATCH 0290/1171] mt76: update to the latest version bb3937d5c3e0 wifi: mt76: mt7915: remove VHT160 capability on MT7915 Signed-off-by: Felix Fietkau (cherry picked from commit 063641f8cf7990731919b950c1bf9eb15d1e74c9) --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 0dfe7600df0094..2ab6d6d6ebe85b 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-07-04 -PKG_SOURCE_VERSION:=f704e4f83c6fd21fb39046fa328efb51bee6383b -PKG_MIRROR_HASH:=651d2963a0d624943601dcad971e4942401274af81d39913c6d3d91be2f8d8b1 +PKG_SOURCE_DATE:=2023-07-14 +PKG_SOURCE_VERSION:=bb3937d5c3e0b13c0d08747ec0fc9726fb4fd870 +PKG_MIRROR_HASH:=498d9cfdafe06572d0668d49e89f1014715100fa59c4f89b8495cd869c8c9b0b PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 4d880318b0a0e26a5173c301f8d2108ea6070d7b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 26 Jul 2023 11:20:58 +0200 Subject: [PATCH 0291/1171] mt76: update to the latest version 53edfc7aaa34 wifi: mt76: mt7603: fix beacon interval after disabling a single vif 7ef4dd12d982 wifi: mt76: mt7603: fix tx filter/flush function 152608a40aa7 wifi: mt76: mt7615: do not advertise 5 GHz on first phy of MT7615D (DBDC) cacac3902a63 wifi: mt76: split get_of_eeprom in subfunction cd3dfe392769 wifi: mt76: add support for providing eeprom in nvmem cells Signed-off-by: Felix Fietkau (cherry picked from commit 4395236a100b558d96d0e836ddc76df19b33ddfb) --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 2ab6d6d6ebe85b..42d0e6a070f2c5 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-07-14 -PKG_SOURCE_VERSION:=bb3937d5c3e0b13c0d08747ec0fc9726fb4fd870 -PKG_MIRROR_HASH:=498d9cfdafe06572d0668d49e89f1014715100fa59c4f89b8495cd869c8c9b0b +PKG_SOURCE_DATE:=2023-07-26 +PKG_SOURCE_VERSION:=cd3dfe39276905307cc028ac8edf2c06963cda23 +PKG_MIRROR_HASH:=413d2d0faa81d834ba13cb9e503e1e3a61e3e071014da6b525a123e5da053f90 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 65c1f418e3add2d32b036696530dffddaba64d72 Mon Sep 17 00:00:00 2001 From: Felix Baumann Date: Fri, 21 Jul 2023 22:32:46 +0000 Subject: [PATCH 0292/1171] kernel: update patches for mediatek filogic Fix complaint from actions Check Kernel patches (mediatek, filogic) https://github.com/openwrt/openwrt/actions/runs/5569719763/job/15081672586?pr=13072 Signed-off-by: Felix Baumann --- ...5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch index 26ebcb6733b7aa..85e6b03a59eacb 100644 --- a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch +++ b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch @@ -42,7 +42,7 @@ Signed-off-by: David S. Miller L: linux-i2c@vger.kernel.org --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -293,6 +293,18 @@ config MEDIATEK_GE_PHY +@@ -292,6 +292,18 @@ config MEDIATEK_GE_PHY help Supports the MediaTek Gigabit Ethernet PHYs. From 9d15baee6b435318576b0c0978d82959f7eb64cc Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sun, 21 May 2023 23:02:17 +0200 Subject: [PATCH 0293/1171] lantiq: add patches headers This commit adds headers to the patches, so they can be applied with the git am command. Signed-off-by: Aleksander Jan Bajkowski (cherry picked from commit 5d51079fd064a86119c6f44920e737cf5e25d3a0) --- .../patches-5.15/0101-find_active_root.patch | 10 ++++ .../0151-lantiq-ifxmips_pcie-use-of.patch | 34 +++++++---- .../lantiq/patches-5.15/0152-lantiq-VPE.patch | 57 ++++++++++++------- .../0154-lantiq-pci-bar11mask-fix.patch | 10 ++++ .../patches-5.15/0155-lantiq-VPE-nosmp.patch | 10 ++++ .../0160-owrt-lantiq-multiple-flash.patch | 10 ++++ ...-cmdset-0001-disable-buffered-writes.patch | 10 ++++ ...add-gphy-clk-src-device-tree-binding.patch | 10 ++++ .../0701-NET-lantiq-etop-of-mido.patch | 10 ++++ 9 files changed, 129 insertions(+), 32 deletions(-) diff --git a/target/linux/lantiq/patches-5.15/0101-find_active_root.patch b/target/linux/lantiq/patches-5.15/0101-find_active_root.patch index 925ac9dbbace77..14dc83f1f77fc6 100644 --- a/target/linux/lantiq/patches-5.15/0101-find_active_root.patch +++ b/target/linux/lantiq/patches-5.15/0101-find_active_root.patch @@ -1,3 +1,13 @@ +From 2c82524000cca691c89c9fda251b55ef04eabcb6 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Mon, 2 May 2016 18:50:00 +0000 +Subject: [PATCH] find active root + +Signed-off-by: Mathias Kresin +--- + drivers/mtd/parsers/ofpart_core.c | 49 ++++++++++++++++++++++++++++++- + 1 file changed, 48 insertions(+), 1 deletion(-) + --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c @@ -38,6 +38,38 @@ static bool node_has_compatible(struct d diff --git a/target/linux/lantiq/patches-5.15/0151-lantiq-ifxmips_pcie-use-of.patch b/target/linux/lantiq/patches-5.15/0151-lantiq-ifxmips_pcie-use-of.patch index 10633199e67ffc..0b99b91bd9156a 100644 --- a/target/linux/lantiq/patches-5.15/0151-lantiq-ifxmips_pcie-use-of.patch +++ b/target/linux/lantiq/patches-5.15/0151-lantiq-ifxmips_pcie-use-of.patch @@ -1,3 +1,26 @@ +From 1d1885f4a7abd7272f47b835b03d8662fb981d19 Mon Sep 17 00:00:00 2001 +From: Eddi De Pieri +Date: Tue, 14 Oct 2014 11:04:00 +0000 +Subject: [PATCH] MIPS: lantiq: ifxmips_pcie: use of + +Signed-off-by: Eddi De Pieri +--- + arch/mips/pci/Makefile | 2 +- + arch/mips/pci/ifxmips_pcie.c | 151 +++++++++++++++++++++++++++---- + arch/mips/pci/ifxmips_pcie_vr9.h | 105 --------------------- + 3 files changed, 133 insertions(+), 125 deletions(-) + +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -43,7 +43,7 @@ obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o + obj-$(CONFIG_SOC_MT7620) += pci-mt7620.o + obj-$(CONFIG_SOC_RT288X) += pci-rt2880.o + obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o +-obj-$(CONFIG_PCIE_LANTIQ) += ifxmips_pcie_phy.o ifxmips_pcie.o fixup-lantiq-pcie.o ++obj-$(CONFIG_PCIE_LANTIQ) += ifxmips_pcie.o fixup-lantiq-pcie.o + obj-$(CONFIG_PCIE_LANTIQ_MSI) += pcie-lantiq-msi.o + obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o + obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o --- a/arch/mips/pci/ifxmips_pcie.c +++ b/arch/mips/pci/ifxmips_pcie.c @@ -16,8 +16,15 @@ @@ -374,14 +397,3 @@ static inline void pcie_core_pmu_setup(int pcie_port) { struct clk *clk; ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -43,7 +43,7 @@ obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o - obj-$(CONFIG_SOC_MT7620) += pci-mt7620.o - obj-$(CONFIG_SOC_RT288X) += pci-rt2880.o - obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o --obj-$(CONFIG_PCIE_LANTIQ) += ifxmips_pcie_phy.o ifxmips_pcie.o fixup-lantiq-pcie.o -+obj-$(CONFIG_PCIE_LANTIQ) += ifxmips_pcie.o fixup-lantiq-pcie.o - obj-$(CONFIG_PCIE_LANTIQ_MSI) += pcie-lantiq-msi.o - obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o - obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o diff --git a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch index 6758d4a0f22d9d..6776d35ecec37a 100644 --- a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch +++ b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch @@ -1,3 +1,18 @@ +From 4d48a3d1ef6f8d036bd926e3c1f70b56fcc679b2 Mon Sep 17 00:00:00 2001 +From: Stefan Koch +Date: Thu, 20 Oct 2016 21:32:00 +0200 +Subject: [PATCH] lantiq: vpe + +Signed-off-by: Stefan Koch +--- + arch/mips/Kconfig | 6 ++++ + arch/mips/include/asm/mipsmtregs.h | 5 ++++ + arch/mips/include/asm/vpe.h | 9 ++++++ + arch/mips/kernel/vpe-mt.c | 47 ++++++++++++++++++++++++++++++ + arch/mips/kernel/vpe.c | 35 ++++++++++++++++++++++ + arch/mips/lantiq/prom.c | 4 +++ + 6 files changed, 106 insertions(+) + --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2430,6 +2430,12 @@ config MIPS_VPE_LOADER @@ -13,6 +28,27 @@ config MIPS_VPE_LOADER_CMP bool default "y" +--- a/arch/mips/include/asm/mipsmtregs.h ++++ b/arch/mips/include/asm/mipsmtregs.h +@@ -32,6 +32,9 @@ + #define read_c0_vpeconf1() __read_32bit_c0_register($1, 3) + #define write_c0_vpeconf1(val) __write_32bit_c0_register($1, 3, val) + ++#define read_c0_vpeopt() __read_32bit_c0_register($1, 7) ++#define write_c0_vpeopt(val) __write_32bit_c0_register($1, 7, val) ++ + #define read_c0_tcstatus() __read_32bit_c0_register($2, 1) + #define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val) + +@@ -378,6 +381,8 @@ do { \ + #define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) + #define read_vpe_c0_vpeconf1() mftc0(1, 3) + #define write_vpe_c0_vpeconf1(val) mttc0(1, 3, val) ++#define read_vpe_c0_vpeopt() mftc0(1, 7) ++#define write_vpe_c0_vpeopt(val) mttc0(1, 7, val) + #define read_vpe_c0_count() mftc0(9, 0) + #define write_vpe_c0_count(val) mttc0(9, 0, val) + #define read_vpe_c0_status() mftc0(12, 0) --- a/arch/mips/include/asm/vpe.h +++ b/arch/mips/include/asm/vpe.h @@ -124,4 +124,13 @@ void cleanup_tc(struct tc *tc); @@ -157,24 +193,3 @@ int ltq_soc_type(void) { ---- a/arch/mips/include/asm/mipsmtregs.h -+++ b/arch/mips/include/asm/mipsmtregs.h -@@ -32,6 +32,9 @@ - #define read_c0_vpeconf1() __read_32bit_c0_register($1, 3) - #define write_c0_vpeconf1(val) __write_32bit_c0_register($1, 3, val) - -+#define read_c0_vpeopt() __read_32bit_c0_register($1, 7) -+#define write_c0_vpeopt(val) __write_32bit_c0_register($1, 7, val) -+ - #define read_c0_tcstatus() __read_32bit_c0_register($2, 1) - #define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val) - -@@ -378,6 +381,8 @@ do { \ - #define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) - #define read_vpe_c0_vpeconf1() mftc0(1, 3) - #define write_vpe_c0_vpeconf1(val) mttc0(1, 3, val) -+#define read_vpe_c0_vpeopt() mftc0(1, 7) -+#define write_vpe_c0_vpeopt(val) mttc0(1, 7, val) - #define read_vpe_c0_count() mftc0(9, 0) - #define write_vpe_c0_count(val) mttc0(9, 0, val) - #define read_vpe_c0_status() mftc0(12, 0) diff --git a/target/linux/lantiq/patches-5.15/0154-lantiq-pci-bar11mask-fix.patch b/target/linux/lantiq/patches-5.15/0154-lantiq-pci-bar11mask-fix.patch index d6556d115df432..9214f786d7b9cc 100644 --- a/target/linux/lantiq/patches-5.15/0154-lantiq-pci-bar11mask-fix.patch +++ b/target/linux/lantiq/patches-5.15/0154-lantiq-pci-bar11mask-fix.patch @@ -1,3 +1,13 @@ +From 3c92a781de062064e36b867c0ab22f9aba48f3d3 Mon Sep 17 00:00:00 2001 +From: Eddi De Pieri +Date: Tue, 8 Nov 2016 17:38:00 +0100 +Subject: [PATCH] lantiq: pci: bar11mask fix + +Signed-off-by: Eddi De Pieri +--- + arch/mips/pci/pci-lantiq.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + --- a/arch/mips/pci/pci-lantiq.c +++ b/arch/mips/pci/pci-lantiq.c @@ -59,6 +59,8 @@ diff --git a/target/linux/lantiq/patches-5.15/0155-lantiq-VPE-nosmp.patch b/target/linux/lantiq/patches-5.15/0155-lantiq-VPE-nosmp.patch index 898c2d48212990..6562dc8bdab7be 100644 --- a/target/linux/lantiq/patches-5.15/0155-lantiq-VPE-nosmp.patch +++ b/target/linux/lantiq/patches-5.15/0155-lantiq-VPE-nosmp.patch @@ -1,3 +1,13 @@ +From 07ce9e9bc4dcd5ac4728e587901112eef95bbe7b Mon Sep 17 00:00:00 2001 +From: Stefan Koch +Date: Mon, 13 Mar 2017 23:42:00 +0100 +Subject: [PATCH] lantiq: vpe nosmp + +Signed-off-by: Stefan Koch +--- + arch/mips/kernel/vpe-mt.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + --- a/arch/mips/kernel/vpe-mt.c +++ b/arch/mips/kernel/vpe-mt.c @@ -132,7 +132,10 @@ int vpe_run(struct vpe *v) diff --git a/target/linux/lantiq/patches-5.15/0160-owrt-lantiq-multiple-flash.patch b/target/linux/lantiq/patches-5.15/0160-owrt-lantiq-multiple-flash.patch index 796220b2bc27d6..a83325c094d97c 100644 --- a/target/linux/lantiq/patches-5.15/0160-owrt-lantiq-multiple-flash.patch +++ b/target/linux/lantiq/patches-5.15/0160-owrt-lantiq-multiple-flash.patch @@ -1,3 +1,13 @@ +From ebaae1cd68cd79c7eee67c9c5c0fa45809e84525 Mon Sep 17 00:00:00 2001 +From: Maikel Bloemendal +Date: Fri, 14 Nov 2014 17:06:00 +0000 +Subject: [PATCH] owrt: lantiq: multiple flash + +Signed-off-by: Maikel Bloemendal +--- + drivers/mtd/maps/lantiq-flash.c | 168 +++++++++++++++++++++----------- + 1 file changed, 109 insertions(+), 59 deletions(-) + --- a/drivers/mtd/maps/lantiq-flash.c +++ b/drivers/mtd/maps/lantiq-flash.c @@ -17,6 +17,7 @@ diff --git a/target/linux/lantiq/patches-5.15/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch b/target/linux/lantiq/patches-5.15/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch index d153c521d33e4a..f62d16707844a0 100644 --- a/target/linux/lantiq/patches-5.15/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch +++ b/target/linux/lantiq/patches-5.15/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch @@ -1,3 +1,13 @@ +From 5e93c85ac3e5626d1aa7e7f9c0a008b2a4224f04 Mon Sep 17 00:00:00 2001 +From: Matti Laakso +Date: Sat, 14 Feb 2015 20:48:00 +0000 +Subject: [PATCH] MTD: cfi_cmdset_0001: disable buffered writes + +Signed-off-by: Matti Laakso +--- + drivers/mtd/chips/cfi_cmdset_0001.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -39,7 +39,7 @@ diff --git a/target/linux/lantiq/patches-5.15/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch b/target/linux/lantiq/patches-5.15/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch index 92c4b564930b1f..6dacba56d5a2eb 100644 --- a/target/linux/lantiq/patches-5.15/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch +++ b/target/linux/lantiq/patches-5.15/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch @@ -1,3 +1,13 @@ +From 5502ef9d40ab20b2ac683660d1565a7c4968bcc8 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Mon, 2 May 2016 18:50:00 +0000 +Subject: [PATCH] xrx200: add gphy clk src device tree binding + +Signed-off-by: Mathias Kresin +--- + arch/mips/lantiq/xway/sysctrl.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + --- a/arch/mips/lantiq/xway/sysctrl.c +++ b/arch/mips/lantiq/xway/sysctrl.c @@ -440,6 +440,20 @@ static void clkdev_add_clkout(void) diff --git a/target/linux/lantiq/patches-5.15/0701-NET-lantiq-etop-of-mido.patch b/target/linux/lantiq/patches-5.15/0701-NET-lantiq-etop-of-mido.patch index 2cc541ae3cf9c9..7e49b47e028248 100644 --- a/target/linux/lantiq/patches-5.15/0701-NET-lantiq-etop-of-mido.patch +++ b/target/linux/lantiq/patches-5.15/0701-NET-lantiq-etop-of-mido.patch @@ -1,3 +1,13 @@ +From 870ed9cae083ff8a60a739ef7e74c5a1800533be Mon Sep 17 00:00:00 2001 +From: Johann Neuhauser +Date: Thu, 17 May 2018 19:12:35 +0200 +Subject: [PATCH] net: lantiq_etop: of mdio + +Signed-off-by: Johann Neuhauser +--- + drivers/net/ethernet/lantiq_etop.c | 555 +++++++++++++++++++++++++----------- + 1 file changed, 389 insertions(+), 166 deletions(-) + --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c @@ -30,6 +30,7 @@ From 3ac300c753df4352ea67654313641d6e7a7af6c8 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 22 Jun 2023 00:32:32 +0800 Subject: [PATCH 0294/1171] ramips: backport upstream mt762x PCIe driver error log fixes These patches silence some mt762x PCIe driver error messeges by removing the useless debugging codes and replacing incorrectly used 'dev_err()' with 'dev_info()': PCI: mt7621: Use dev_info() to log PCIe card detection [1] mips: pci-mt7620: do not print NFTS register value as error log [2] mips: pci-mt7620: use dev_info() to log PCIe device detection result [3] Patch [1] has already been merged into the Linux 6.3 branch. Patches [2] and [3] have been merged into the "mips-next" tree, and they will be part of the upcoming Linux 6.5. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.4-rc7&id=50233e105a0332ec0f3bc83180c416e6b200471e [2] https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?id=9f9a035e6156a57d9da062b26d2a48d031744a1e [3] https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?id=89ec9bbe60b61cc6ae3eddd6d4f43e128f8a88de Signed-off-by: Shiji Yang (cherry picked from commit 4e74777fa8111a2bdf63164a4920a42917faec28) --- ...do-not-print-NFTS-register-value-as-.patch | 32 +++++++++++++++ ...use-dev_info-to-log-PCIe-device-dete.patch | 39 +++++++++++++++++++ ...-dev_info-to-log-PCIe-card-detection.patch | 31 +++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch create mode 100644 target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch create mode 100644 target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch diff --git a/target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch b/target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch new file mode 100644 index 00000000000000..704e861b8211dc --- /dev/null +++ b/target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch @@ -0,0 +1,32 @@ +From 9f9a035e6156a57d9da062b26d2a48d031744a1e Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Tue, 20 Jun 2023 18:43:22 +0800 +Subject: [PATCH 1/2] mips: pci-mt7620: do not print NFTS register value as + error log + +These codes are used to read NFTS_TIMEOUT_DELAY register value and +write it into kernel log after writing the register. they are only +used for debugging during driver development, so there is no need +to keep them now. + +Tested on MT7628AN router Motorola MWR03. + +Signed-off-by: Shiji Yang +Reviewed-by: Sergio Paracuellos +Signed-off-by: Thomas Bogendoerfer +--- + arch/mips/pci/pci-mt7620.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/arch/mips/pci/pci-mt7620.c ++++ b/arch/mips/pci/pci-mt7620.c +@@ -274,9 +274,6 @@ static int mt7628_pci_hw_init(struct pla + val |= 0x50 << 8; + pci_config_write(NULL, 0, 0x70c, 4, val); + +- pci_config_read(NULL, 0, 0x70c, 4, &val); +- dev_err(&pdev->dev, "Port 0 N_FTS = %x\n", (unsigned int) val); +- + return 0; + } + diff --git a/target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch b/target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch new file mode 100644 index 00000000000000..5898a110ea972c --- /dev/null +++ b/target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch @@ -0,0 +1,39 @@ +From 89ec9bbe60b61cc6ae3eddd6d4f43e128f8a88de Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Tue, 20 Jun 2023 18:43:23 +0800 +Subject: [PATCH 2/2] mips: pci-mt7620: use dev_info() to log PCIe device + detection result + +Usually, We only need to print the error log when there is a PCIe card but +initialization fails. Whether the driver finds the PCIe card or not is the +expected behavior. So it's better to log these information with dev_info(). + +Tested on MT7628AN router Motorola MWR03. + +Signed-off-by: Shiji Yang +Reviewed-by: Sergio Paracuellos +Signed-off-by: Thomas Bogendoerfer +--- + arch/mips/pci/pci-mt7620.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/pci/pci-mt7620.c ++++ b/arch/mips/pci/pci-mt7620.c +@@ -331,7 +331,7 @@ static int mt7620_pci_probe(struct platf + rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1); + if (ralink_soc == MT762X_SOC_MT7620A) + rt_sysc_m32(LC_CKDRVPD, PDRV_SW_SET, PPLL_DRV); +- dev_err(&pdev->dev, "PCIE0 no card, disable it(RST&CLK)\n"); ++ dev_info(&pdev->dev, "PCIE0 no card, disable it(RST&CLK)\n"); + return -1; + } + +@@ -374,7 +374,7 @@ int pcibios_map_irq(const struct pci_dev + dev->bus->number, slot); + return 0; + } +- dev_err(&dev->dev, "card - bus=0x%x, slot = 0x%x irq=%d\n", ++ dev_info(&dev->dev, "card - bus=0x%x, slot = 0x%x irq=%d\n", + dev->bus->number, slot, irq); + + /* configure the cache line size to 0x14 */ diff --git a/target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch b/target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch new file mode 100644 index 00000000000000..94519b9c01a177 --- /dev/null +++ b/target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch @@ -0,0 +1,31 @@ +From 50233e105a0332ec0f3bc83180c416e6b200471e Mon Sep 17 00:00:00 2001 +From: Sergio Paracuellos +Date: Fri, 24 Mar 2023 08:37:33 +0100 +Subject: PCI: mt7621: Use dev_info() to log PCIe card detection + +When there is no card plugged on a PCIe port a log reporting that +the port will be disabled is flagged as an error (dev_err()). + +Since this is not an error at all, change the log level by using +dev_info() instead. + +Link: https://lore.kernel.org/r/20230324073733.1596231-1-sergio.paracuellos@gmail.com +Signed-off-by: Sergio Paracuellos +Signed-off-by: Lorenzo Pieralisi +--- + drivers/pci/controller/pcie-mt7621.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pci/controller/pcie-mt7621.c ++++ b/drivers/pci/controller/pcie-mt7621.c +@@ -383,8 +383,8 @@ static int mt7621_pcie_init_ports(struct + u32 slot = port->slot; + + if (!mt7621_pcie_port_is_linkup(port)) { +- dev_err(dev, "pcie%d no card, disable it (RST & CLK)\n", +- slot); ++ dev_info(dev, "pcie%d no card, disable it (RST & CLK)\n", ++ slot); + mt7621_control_assert(port); + port->enabled = false; + num_disabled++; From ead5860c569cfdf577408953ce7e3e0092d8866a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 23 Jun 2023 02:05:21 +0800 Subject: [PATCH 0295/1171] ramips: do not print error log when mdio bus is disabled The mdio bus is used to control externel switch. In most cases, they are disabled, which is the normal behavior. Treating this as an error makes no sense, so we need to change the notification level from error to info. Fixes: a2acdf960704 ("ramips: mt7620: remove useless GMAC nodes") Signed-off-by: Shiji Yang (cherry picked from commit 285f0668f4058a935389985eb80353c8a5adbc7d) --- target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c index a6448443c01f3e..7e896644f8a332 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c @@ -257,7 +257,7 @@ int fe_mdio_init(struct fe_priv *priv) err_put_node: of_node_put(mii_np); err_no_bus: - dev_err(priv->dev, "%s disabled", "mdio-bus"); + dev_info(priv->dev, "%s disabled", "mdio-bus"); priv->mii_bus = NULL; return err; } From 8d6a9051cda56fb78d5f9e1b5653de94a249656c Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 5 Jul 2023 01:35:02 +0200 Subject: [PATCH 0296/1171] mac80211: partly revert force-mac80211 loss detection This patch will only force mac80211 loss detection upon ath10k by masking the driver-specific loss-detection bit. Ref: commit ed816f6ba8b5 ("mac80211: always use mac80211 loss detection") Signed-off-by: David Bauer (cherry picked from commit d9070f8d23621931c4869980f6e5ae17abbe3e58) [felix.bau@gmx.de: replace path 6.2 with 5.15, refresh patches] Signed-off-by: Felix Baumann --- ...k-always-use-mac80211-loss-detection.patch | 28 +++++++++++++++ ...k-always-use-mac80211-loss-detection.patch | 28 +++++++++++++++ ...1-always-use-mac80211-loss-detection.patch | 36 ------------------- 3 files changed, 56 insertions(+), 36 deletions(-) create mode 100644 package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch create mode 100644 package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch delete mode 100644 package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch diff --git a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch new file mode 100644 index 00000000000000..ec6270c34c3315 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch @@ -0,0 +1,28 @@ +From f7d6edafe4358e3880a26775cfde4cd5c71ba063 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Wed, 5 Jul 2023 01:30:29 +0200 +Subject: [PATCH] ath10k: always use mac80211 loss detection + +ath10k does not report excessive loss in case of broken block-ack +sessions. The loss is communicated to the host-os, but ath10k does not +trigger a low-ack events by itself. + +The mac80211 framework for loss detection however detects this +circumstance well in case of ath10k. So use it regardless of ath10k's +own loss detection mechanism. + +Signed-off-by: David Bauer +--- + ath10k-5.15/mac.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/ath10k-5.15/mac.c ++++ b/ath10k-5.15/mac.c +@@ -11246,7 +11246,6 @@ int ath10k_mac_register(struct ath10k *a + ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); + ieee80211_hw_set(ar->hw, QUEUE_CONTROL); + ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); +- ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); + + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) + ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); diff --git a/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch new file mode 100644 index 00000000000000..f025fea63b7ad6 --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch @@ -0,0 +1,28 @@ +From f7d6edafe4358e3880a26775cfde4cd5c71ba063 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Wed, 5 Jul 2023 01:30:29 +0200 +Subject: [PATCH] ath10k: always use mac80211 loss detection + +ath10k does not report excessive loss in case of broken block-ack +sessions. The loss is communicated to the host-os, but ath10k does not +trigger a low-ack events by itself. + +The mac80211 framework for loss detection however detects this +circumstance well in case of ath10k. So use it regardless of ath10k's +own loss detection mechanism. + +Signed-off-by: David Bauer +--- + drivers/net/wireless/ath/ath10k/mac.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -10080,7 +10080,6 @@ int ath10k_mac_register(struct ath10k *a + ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); + ieee80211_hw_set(ar->hw, QUEUE_CONTROL); + ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); +- ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); + + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) + ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); diff --git a/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch b/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch deleted file mode 100644 index e084773fd9c5a4..00000000000000 --- a/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch +++ /dev/null @@ -1,36 +0,0 @@ -From cdf461888f900c3a149b10a04d72b4a590ecdec3 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Tue, 16 May 2023 23:11:32 +0200 -Subject: [PATCH] mac80211: always use mac80211 loss detection - -ath10k does not report excessive loss in case of broken block-ack -sessions. The loss is communicated to the host-os, but ath10k does not -trigger a low-ack events by itself. - -The mac80211 framework for loss detection however detects this -circumstance well in case of ath10k. So use it regardless of ath10k's -own loss detection mechanism. - -Patching this in mac80211 does allow this hack to be used with any -flavor of ath10k/ath11k. - -Signed-off-by: David Bauer ---- - net/mac80211/status.c | 6 ------ - 1 file changed, 6 deletions(-) - ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -794,12 +794,6 @@ static void ieee80211_lost_packet(struct - unsigned long pkt_time = STA_LOST_PKT_TIME; - unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD; - -- /* If driver relies on its own algorithm for station kickout, skip -- * mac80211 packet loss mechanism. -- */ -- if (ieee80211_hw_check(&sta->local->hw, REPORTS_LOW_ACK)) -- return; -- - /* This packet was aggregated but doesn't carry status info */ - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && - !(info->flags & IEEE80211_TX_STAT_AMPDU)) From 2b889aa71a1a3974979cff8c4357f1d64f79e3df Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 12 Mar 2022 14:39:18 +0100 Subject: [PATCH 0297/1171] uqmi: support split-APN IPv4 and IPv6 dual-stack Add two new "v6apn" and "v6profile" properties, to support split-APN dual-stack onfiguration. This extends the existing ipv4v6 PDP type, allowing simultaneous connection to two distinct APNs, one for IPv4 and one for IPv6. The parameters override existing 'apn' and 'profile' respectively, if set, but only for IPv6 part of the connection. If unset, they default to their original values, constituting a standard IPv4v6 setup. If a different APN is set for IPv6, a corresponding profile MUST also be configured, with a different ID, than the IPv4 profile, for example, profile 2. Both APNs must match ones configured through QMI or through 'AT+CGDCONT' command. Example configuration in UCI: config interface 'wan' option proto 'qmi' option device '/dev/cdc-wdm0' option autoconnect '1' option pdptype 'ipv4v6' option apn 'internet' option v6apn 'internetipv6' option profile '1' option v6profile '2' Corresponding profile configuration: AT+CGDCONT? +CGDCONT: 1,"IP","internet","0.0.0.0",0,0,0,0 +CGDCONT: 2,"IPV6","internetipv6","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0 Signed-off-by: Lech Perczak (cherry picked from commit 48e8bf1b8f3d2750f215765f583c847ff02deca2) --- .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index c271cb86607525..fd90d581e128d7 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -11,6 +11,7 @@ proto_qmi_init_config() { no_device=1 proto_config_add_string "device:device" proto_config_add_string apn + proto_config_add_string v6apn proto_config_add_string auth proto_config_add_string username proto_config_add_string password @@ -19,6 +20,7 @@ proto_qmi_init_config() { proto_config_add_string modes proto_config_add_string pdptype proto_config_add_int profile + proto_config_add_int v6profile proto_config_add_boolean dhcp proto_config_add_boolean dhcpv6 proto_config_add_boolean autoconnect @@ -31,14 +33,14 @@ proto_qmi_init_config() { proto_qmi_setup() { local interface="$1" local dataformat connstat plmn_mode mcc mnc - local device apn auth username password pincode delay modes pdptype - local profile dhcp dhcpv6 autoconnect plmn timeout mtu $PROTO_DEFAULT_OPTIONS + local device apn v6apn auth username password pincode delay modes pdptype + local profile v6profile dhcp dhcpv6 autoconnect plmn timeout mtu $PROTO_DEFAULT_OPTIONS local ip4table ip6table local cid_4 pdh_4 cid_6 pdh_6 local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 - json_get_vars device apn auth username password pincode delay modes - json_get_vars pdptype profile dhcp dhcpv6 autoconnect plmn ip4table + json_get_vars device apn v6apn auth username password pincode delay modes + json_get_vars pdptype profile v6profile dhcp dhcpv6 autoconnect plmn ip4table json_get_vars ip6table timeout mtu $PROTO_DEFAULT_OPTIONS [ "$timeout" = "" ] && timeout="10" @@ -309,10 +311,13 @@ proto_qmi_setup() { uqmi -s -d "$device" --set-client-id wds,"$cid_6" --set-ip-family ipv6 > /dev/null 2>&1 + : "${v6apn:=${apn}}" + : "${v6profile:=${profile}}" + pdh_6=$(uqmi -s -d "$device" --set-client-id wds,"$cid_6" \ --start-network \ - ${apn:+--apn $apn} \ - ${profile:+--profile $profile} \ + ${v6apn:+--apn $v6apn} \ + ${v6profile:+--profile $v6profile} \ ${auth:+--auth-type $auth} \ ${username:+--username $username} \ ${password:+--password $password} \ From e54e5bc415ceea61391a22cf0bfe88181690ce3e Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 12 Mar 2022 17:57:44 +0100 Subject: [PATCH 0298/1171] uqmi: do not start 464xlat for dual-stack configurations If dual-stack configuration is in use, and dhcpv6 option is set, do not start 464xlat sub-interface for dhcpv6 sub-interace , as the configuration already provides IPv4 connectivty, be it through single or dual APN configuration. Signed-off-by: Lech Perczak (cherry picked from commit a9237c1af9c2eee0a49d96f2588be85d24489f20) --- package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index fd90d581e128d7..6c5104bccd8347 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -388,6 +388,7 @@ proto_qmi_setup() { json_init json_add_string name "${interface}_6" json_add_string ifname "@$interface" + [ "$pdptype" = "ipv4v6" ] && json_add_string iface_464xlat "0" json_add_string proto "dhcpv6" [ -n "$ip6table" ] && json_add_string ip6table "$ip6table" proto_add_dynamic_defaults From 68a4c60b5cb3ec48d74a40fb403417ef1606893d Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 6 Jun 2023 06:24:11 +0000 Subject: [PATCH 0299/1171] layerscape: armv8_64b: add Traverse Ten64 NAND variant The Ten64 board[1] is based around NXP's Layerscape LS1088A SoC. It is capable of booting both standard Linux distributions from disk devices, using EFI, and booting OpenWrt from NAND. See the online manual for more information, including the flash layout[2]. This patchset adds support for generating Ten64 images for NAND boot. For disk boot, one can use the EFI support that was recently added to the armvirt target. We previously supported NAND users by building inside our armvirt/EFI target[3], but this approach is not suitable for OpenWrt upstream. Users who used our supplied NAND images will be able to upgrade to this via sysupgrade. Signed-off-by: Mathew McBride [1] - https://www.traverse.com.au/hardware/ten64 [2] - https://ten64doc.traverse.com.au/hardware/flash/ [3] - Example: https://gitlab.com/traversetech/ls1088firmware/openwrt/-/commit/285e4360e1604eb466880d245d48efd9962143a5 (cherry picked from commit af0546da3440dba24217949527e503820350ff05) --- package/boot/uboot-envtools/files/layerscape | 3 ++ target/linux/layerscape/armv8_64b/config-5.15 | 3 +- .../layerscape/base-files/etc/board.d/01_led | 4 +++ .../base-files/etc/board.d/02_network | 4 +++ .../base-files/etc/board.d/03_gpio_switches | 8 +++++ .../base-files/lib/upgrade/platform.sh | 27 ++++++++++++++++ target/linux/layerscape/image/Makefile | 13 ++++++++ target/linux/layerscape/image/armv8_64b.mk | 32 +++++++++++++++++++ 8 files changed, 93 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-envtools/files/layerscape b/package/boot/uboot-envtools/files/layerscape index b11587d8765fd0..bc7dcf24f9edbe 100644 --- a/package/boot/uboot-envtools/files/layerscape +++ b/package/boot/uboot-envtools/files/layerscape @@ -16,6 +16,9 @@ case "$board" in traverse,ls1043s) ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000" "0x20000" ;; + traverse,ten64) + ubootenv_add_uci_config "/dev/mtd3" "0x0000" "0x80000" "0x80000" + ;; esac config_load ubootenv diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15 index 69edc7a3f0703a..0e8ab0c25340e4 100644 --- a/target/linux/layerscape/armv8_64b/config-5.15 +++ b/target/linux/layerscape/armv8_64b/config-5.15 @@ -508,6 +508,7 @@ CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_NAND_FSL_IFC=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAW_NAND=y +CONFIG_MTD_SPI_NAND=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y CONFIG_MTD_SPLIT_FIRMWARE=y @@ -515,7 +516,7 @@ CONFIG_MTD_SPLIT_FIT_FW=y CONFIG_MTD_SST25L=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_BLOCK is not set +CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MULTIPLEXER=y CONFIG_MUTEX_SPIN_ON_OWNER=y diff --git a/target/linux/layerscape/base-files/etc/board.d/01_led b/target/linux/layerscape/base-files/etc/board.d/01_led index 7fddfa08245569..a21c21980abb7d 100644 --- a/target/linux/layerscape/base-files/etc/board.d/01_led +++ b/target/linux/layerscape/base-files/etc/board.d/01_led @@ -17,6 +17,10 @@ traverse,ls1043s) ucidef_set_led_netdev "xgact" "10G Activity" "ls1043s:yellow:10gact" "eth6" ucidef_set_led_netdev "xglink" "10G Link" "ls1043s:green:10glink" "eth6" ;; +traverse,ten64) + ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx" + ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx" + ;; esac board_config_flush diff --git a/target/linux/layerscape/base-files/etc/board.d/02_network b/target/linux/layerscape/base-files/etc/board.d/02_network index 172172c12c6760..7bc5f9b50296b6 100644 --- a/target/linux/layerscape/base-files/etc/board.d/02_network +++ b/target/linux/layerscape/base-files/etc/board.d/02_network @@ -17,6 +17,10 @@ case "$(board_name)" in ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth6" ucidef_set_interface_wan "eth4" ;; + traverse,ten64) + ucidef_set_interface_lan "eth0 eth1 eth2 eth3" + ucidef_set_interface_wan "eth6" + ;; esac board_config_flush diff --git a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches index df3b759916d594..5e0e24ef28726e 100644 --- a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches @@ -20,6 +20,14 @@ traverse,ls1043s) ucidef_add_gpio_switch "lte_disable" "LTE Airplane Mode" "394" ucidef_add_gpio_switch "lte_power" "LTE Power" "395" ;; +traverse,ten64) + ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376" + ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377" + ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "378" + ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "379" + ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "369" + ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "373" + ;; esac board_config_flush diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh index e88dfdf145c9d4..c63cf05e5cc1e0 100644 --- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh +++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh @@ -49,6 +49,26 @@ platform_do_upgrade_traverse_nandubi() { nand_do_upgrade "$1" || (echo "Upgrade failed, setting bootsys ${bootsys}" && fw_setenv bootsys $bootsys) } + +platform_do_upgrade_traverse_slotubi() { + part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')" + echo "Active boot slot: ${part}" + new_active_sys="b" + + if [ ! -z "${part}" ]; then + if [ "${part}" = "ubia" ]; then + CI_UBIPART="ubib" + else + CI_UBIPART="ubia" + new_active_sys="a" + fi + fi + echo "Updating UBI part ${CI_UBIPART}" + fw_setenv "openwrt_active_sys" "${new_active_sys}" + nand_do_upgrade "$1" + return $? +} + platform_copy_config_sdboot() { local diskdev partdev parttype=ext4 @@ -90,6 +110,10 @@ platform_check_image() { nand_do_platform_check "traverse-ls1043" $1 return $? ;; + traverse,ten64) + nand_do_platform_check "ten64-mtd" $1 + return $? + ;; fsl,ls1012a-frdm | \ fsl,ls1012a-frwy-sdboot | \ fsl,ls1012a-rdb | \ @@ -130,6 +154,9 @@ platform_do_upgrade() { traverse,ls1043s) platform_do_upgrade_traverse_nandubi "$1" ;; + traverse,ten64) + platform_do_upgrade_traverse_slotubi "${1}" + ;; fsl,ls1012a-frdm | \ fsl,ls1012a-rdb | \ fsl,ls1021a-twr | \ diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile index 52dc532c34f299..1463a3eaea0586 100644 --- a/target/linux/layerscape/image/Makefile +++ b/target/linux/layerscape/image/Makefile @@ -64,6 +64,19 @@ define Build/traverse-fit @mv -f $@.new $@ endef +define Build/traverse-fit-ls1088 + ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) \ + -v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \ + -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ + -C gzip -c 1 -c 2 \ + -d $(DTS_DIR)/freescale/fsl-ls1088a-ten64.dtb \ + -D "TEN64" -n "ten64" -a $(FDT_LOADADDR) -c 1 \ + -d $(DTS_DIR)/freescale/fsl-ls1088a-rdb.dtb \ + -D "LS1088ARDB" -n "ls1088ardb" -a $(FDT_LOADADDR) -c 2 + PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new + @mv -f $@.new $@ +endef + define Device/fix-sysupgrade DEVICE_COMPAT_VERSION := 2.0 DEVICE_COMPAT_MESSAGE := DTB was added to sysupgrade. Image format is different. \ diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk index f5a6a055fb20a5..0016e3bde8253f 100644 --- a/target/linux/layerscape/image/armv8_64b.mk +++ b/target/linux/layerscape/image/armv8_64b.mk @@ -451,3 +451,35 @@ define Device/traverse_ls1043 SUPPORTED_DEVICES := traverse,ls1043s traverse,ls1043v endef TARGET_DEVICES += traverse_ls1043 + +define Device/traverse_ten64_mtd + DEVICE_VENDOR := Traverse + DEVICE_MODEL := Ten64 (NAND boot) + DEVICE_NAME := ten64-mtd + DEVICE_PACKAGES += \ + uboot-envtools \ + kmod-rtc-rx8025 \ + kmod-sfp \ + kmod-i2c-mux-pca954x \ + restool + DEVICE_DESCRIPTION = \ + Generate images for booting from NAND/ubifs on Traverse Ten64 (LS1088A) \ + family boards. For disk (NVMe/USB/SD) boot, use the armvirt target instead. + FILESYSTEMS := squashfs + KERNEL_LOADADDR := 0x80000000 + KERNEL_ENTRY_POINT := 0x80000000 + FDT_LOADADDR := 0x90000000 + KERNEL_SUFFIX := -kernel.itb + DEVICE_DTS := freescale/fsl-ls1088a-ten64 + IMAGES := nand.ubi sysupgrade.bin + KERNEL := kernel-bin | gzip | traverse-fit-ls1088 gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/nand.ubi := append-ubi + KERNEL_IN_UBI := 1 + BLOCKSIZE := 128KiB + PAGESIZE := 2048 + MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 600 + SUPPORTED_DEVICES = traverse,ten64 +endef +TARGET_DEVICES += traverse_ten64_mtd + From cef98caf6e8d3c466ab303d376324304bbe6c365 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 27 Jun 2023 04:20:50 +0000 Subject: [PATCH 0300/1171] layerscape: remove Traverse LS1043 boards The Traverse LS1043 boards were not publicly released, all the production has been going to OEM customers who do not use the image format defined in the OpenWrt tree. Only a few samples were circulated outside Traverse and our OEM customers. The public release (then called Five64) of this series was cancelled in favour of our LS1088A based design (Ten64). It is best to remove these boards to avoid wasting OpenWrt project and contributor resources. Signed-off-by: Mathew McBride (cherry picked from commit 8e7ba6fbae80838c2219ee38307af9c883606c2c) --- package/boot/uboot-envtools/files/layerscape | 4 - .../layerscape/base-files/etc/board.d/01_led | 8 - .../base-files/etc/board.d/02_network | 8 - .../base-files/etc/board.d/03_gpio_switches | 11 - .../lib/preinit/05_layerscape_reorder_eth | 26 -- .../base-files/lib/upgrade/platform.sh | 26 -- .../boot/dts/freescale/traverse-ls1043s.dts | 332 ------------------ .../boot/dts/freescale/traverse-ls1043v.dts | 253 ------------- target/linux/layerscape/image/Makefile | 13 - target/linux/layerscape/image/armv8_64b.mk | 32 -- ...0-add-DTS-for-Traverse-LS1043-Boards.patch | 26 -- 11 files changed, 739 deletions(-) delete mode 100644 target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth delete mode 100644 target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts delete mode 100644 target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts delete mode 100644 target/linux/layerscape/patches-5.15/300-add-DTS-for-Traverse-LS1043-Boards.patch diff --git a/package/boot/uboot-envtools/files/layerscape b/package/boot/uboot-envtools/files/layerscape index bc7dcf24f9edbe..acc5a073ad9b45 100644 --- a/package/boot/uboot-envtools/files/layerscape +++ b/package/boot/uboot-envtools/files/layerscape @@ -12,10 +12,6 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in - traverse,ls1043v|\ - traverse,ls1043s) - ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000" "0x20000" - ;; traverse,ten64) ubootenv_add_uci_config "/dev/mtd3" "0x0000" "0x80000" "0x80000" ;; diff --git a/target/linux/layerscape/base-files/etc/board.d/01_led b/target/linux/layerscape/base-files/etc/board.d/01_led index a21c21980abb7d..8a0e5c4b956516 100644 --- a/target/linux/layerscape/base-files/etc/board.d/01_led +++ b/target/linux/layerscape/base-files/etc/board.d/01_led @@ -9,14 +9,6 @@ board_config_update board=$(board_name) case "$board" in -traverse,ls1043v) - ucidef_set_led_netdev "wan" "WAN LED" "ls1043v:yellow:wan" "eth4" - ;; -traverse,ls1043s) - ucidef_set_led_netdev "wan" "WAN LED" "ls1043s:yellow:wan" "eth4" - ucidef_set_led_netdev "xgact" "10G Activity" "ls1043s:yellow:10gact" "eth6" - ucidef_set_led_netdev "xglink" "10G Link" "ls1043s:green:10glink" "eth6" - ;; traverse,ten64) ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx" ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx" diff --git a/target/linux/layerscape/base-files/etc/board.d/02_network b/target/linux/layerscape/base-files/etc/board.d/02_network index 7bc5f9b50296b6..0a423238011190 100644 --- a/target/linux/layerscape/base-files/etc/board.d/02_network +++ b/target/linux/layerscape/base-files/etc/board.d/02_network @@ -9,14 +9,6 @@ case "$(board_name)" in fsl,ls1028a-rdb-sdboot) ucidef_set_interfaces_lan_wan "swp0 swp1 swp2 swp3" "eth0" ;; - traverse,ls1043v) - ucidef_set_interface_lan "eth0 eth1 eth2 eth3" - ucidef_set_interface_wan "eth4" - ;; - traverse,ls1043s) - ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth6" - ucidef_set_interface_wan "eth4" - ;; traverse,ten64) ucidef_set_interface_lan "eth0 eth1 eth2 eth3" ucidef_set_interface_wan "eth6" diff --git a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches index 5e0e24ef28726e..46e54b960da77d 100644 --- a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches @@ -9,17 +9,6 @@ board_config_update board=$(board_name) case "$board" in -traverse,ls1043v) - ucidef_add_gpio_switch "lte_reset" "LTE Reset" "377" - ucidef_add_gpio_switch "lte_disable" "LTE Airplane mode" "378" - ;; -traverse,ls1043s) - ucidef_add_gpio_switch "tensfp_txdisable" "SFP+ TX Disable" "378" - ucidef_add_gpio_switch "gigsfp_txdisable" "SFP TX Disable" "381" - ucidef_add_gpio_switch "lte_reset" "LTE Reset" "502" - ucidef_add_gpio_switch "lte_disable" "LTE Airplane Mode" "394" - ucidef_add_gpio_switch "lte_power" "LTE Power" "395" - ;; traverse,ten64) ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376" ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377" diff --git a/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth deleted file mode 100644 index c6b741a5ce38d6..00000000000000 --- a/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth +++ /dev/null @@ -1,26 +0,0 @@ -reorder_layerscape_interfaces() { - if [ ! -f /tmp/sysinfo/board_name ]; then - echo "No board name found, not doing reorder_layerscape_interfaces" - return 0 - fi - - board=$(cat /tmp/sysinfo/board_name) - case "$board" in - traverse,ls1043v|\ - traverse,ls1043s) - - # Reorder ethernet interfaces to match the physical order - ip link set eth2 name fm1-mac3 - ip link set eth4 name eth2 - ip link set eth3 name fm1-mac4 - ip link set eth5 name eth3 - ip link set fm1-mac3 name eth4 - ip link set fm1-mac4 name eth5 - ;; - default) - echo "Unknown board $board" - ;; - esac -} - -boot_hook_add preinit_main reorder_layerscape_interfaces diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh index c63cf05e5cc1e0..0b5d14b579cfbb 100644 --- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh +++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh @@ -31,23 +31,6 @@ platform_do_upgrade_sdboot() { echo "Writing rootfs..." tar xf $tar_file ${board_dir}/root -O | dd of=/dev/mmcblk0p2 bs=512k > /dev/null 2>&1 -} -platform_do_upgrade_traverse_nandubi() { - bootsys=$(fw_printenv bootsys | awk -F= '{{print $2}}') - newbootsys=2 - if [ "$bootsys" -eq "2" ]; then - newbootsys=1 - fi - - # If nand_do_upgrade succeeds, we don't have an opportunity to add any actions of - # our own, so do it here and set back on failure - echo "Setting bootsys to #${newbootsys}" - fw_setenv bootsys $newbootsys - CI_UBIPART="nandubi" - CI_KERNPART="kernel${newbootsys}" - CI_ROOTPART="rootfs${newbootsys}" - nand_do_upgrade "$1" || (echo "Upgrade failed, setting bootsys ${bootsys}" && fw_setenv bootsys $bootsys) - } platform_do_upgrade_traverse_slotubi() { @@ -105,11 +88,6 @@ platform_check_image() { local board=$(board_name) case "$board" in - traverse,ls1043v | \ - traverse,ls1043s) - nand_do_platform_check "traverse-ls1043" $1 - return $? - ;; traverse,ten64) nand_do_platform_check "ten64-mtd" $1 return $? @@ -150,10 +128,6 @@ platform_do_upgrade() { touch /var/lock/fw_printenv.lock case "$board" in - traverse,ls1043v | \ - traverse,ls1043s) - platform_do_upgrade_traverse_nandubi "$1" - ;; traverse,ten64) platform_do_upgrade_traverse_slotubi "${1}" ;; diff --git a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts deleted file mode 100644 index 81044aab3acd69..00000000000000 --- a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Device Tree Include file for Traverse LS1043S board. - * - * Copyright 2014-2015, Freescale Semiconductor - * Copyright 2017-2018, Traverse Technologies - * - * This file is dual-licensed: you can use it either under the terms - * of the GPLv2 or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "fsl-ls1043a.dtsi" -#include -#include - -/ { - model = "Traverse LS1043S"; - compatible = "traverse,ls1043s"; - - aliases { - crypto = &crypto; - ethernet0 = &EMAC0; - ethernet1 = &EMAC1; - ethernet2 = &EMAC2; - ethernet3 = &EMAC3; - ethernet4 = &EMAC4; - ethernet5 = &EMAC5; - }; - - leds { - compatible = "gpio-leds"; - gpio0 { - label = "ls1043s:green:user0"; - gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; - }; - gpio1 { - label = "ls1043s:green:user1"; - gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>; - }; - /* LED D17 */ - gpio2 { - label = "ls1043s:green:wan"; - gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; - }; - gpio3 { - label = "ls1043s:yellow:wan"; - gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; - }; - /* LED D18 */ - gpio4 { - label = "ls1043s:green:mgmt"; - gpios = <&gpio1 28 GPIO_ACTIVE_LOW>; - }; - gpio5 { - label = "ls1043s:yellow:mgmt"; - gpios = <&gpio1 29 GPIO_ACTIVE_LOW>; - }; - /* LED D6 */ - gpio6 { - label = "ls1043s:green:user2"; - gpios = <&gpio1 31 GPIO_ACTIVE_HIGH>; - }; - - /* SFP+ LEDs - these are for chassis - * with lightpipes only - */ - teng_act { - label = "ls1043s:yellow:10gact"; - gpios = <&gpio4 0 GPIO_ACTIVE_LOW>; - }; - - teng_link { - label = "ls1043s:green:10glink"; - gpios = <&gpio4 1 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <1000>; - /* This button may not be loaded on all boards */ - button@0 { - label = "Front button"; - linux,code = ; - gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; - }; - /* This is wired to header S3 */ - button@1 { - label = "Rear button"; - linux,code = ; - gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&esdhc { - mmc-hs200-1_8v; - sd-uhs-sdr104; - sd-uhs-sdr50; - sd-uhs-sdr25; - sd-uhs-sdr12; -}; - -&i2c0 { - status = "okay"; - rtc@6f { - compatible = "intersil,isl1208"; - reg = <0x6f>; - }; - - sfp_pca9534: pca9534@24 { - compatible = "ti,tca9534", "nxp,pca9534"; - gpio-controller; - #gpio-cells = <2>; - reg = <0x24>; - gpio-base = <100>; - }; - - controller@50 { - compatible = "traverse,controller"; - reg = <0x50>; - }; - - ds125df111@18 { - compatible = "ti,ds125df111"; - reg = <0x18>; - }; - - emc1704@4c { - compatible = "microchip,emc1704"; - reg = <0x4c>; - }; - - pac1934@16 { - compatible = "microchip,pac1934"; - reg = <0x16>; - /* Monitoring 3.3V, 5V, Vin/12V (voltage only), Vbat/RTC (voltage only) */ - shunt-resistors = <4000 12000 0 0>; - }; - - pmic@8 { - compatible = "freescale,mc34vr500"; - reg = <0x08>; - }; -}; - -/* I2C Bus for SFP EEPROM and control - * These are multiplexed so - * they don't collide when loaded - */ -&i2c3 { - status = "okay"; - i2c-switch@70 { - compatible = "nxp,pca9540"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x70>; - - gigsfp_i2c: i2c@0 { - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - }; - tensfp_i2c: i2c@1 { - #address-cells = <1>; - #size-cells = <0>; - reg = <1>; - }; - }; -}; - -&ifc { - status = "okay"; - #address-cells = <2>; - #size-cells = <1>; - /* Only NAND flash is used on this board */ - ranges = <0x0 0x0 0x0 0x7e800000 0x00010000>; - - nand@1,0 { - compatible = "fsl,ifc-nand"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x0 0x0 0x10000>; - }; -}; - -&duart0 { - status = "okay"; -}; - -&duart1 { - status = "okay"; -}; - -#include "fsl-ls1043-post.dtsi" - -&fman0 { - EMAC0: ethernet@e0000 { - phy-handle = <&qsgmii_phy1>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 01]; - }; - - EMAC1: ethernet@e2000 { - phy-handle = <&qsgmii_phy2>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 02]; - }; - - EMAC2: ethernet@e8000 { - phy-handle = <&qsgmii_phy3>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 03]; - }; - - EMAC3: ethernet@ea000 { - phy-handle = <&qsgmii_phy4>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 04]; - }; - - /* SFP via AR8031 - * We treat this as a fixed-link as the - * AR8031 is hard-configured into - * 1000BASE-X mode - * Should MII control be desired, remove - * fixed-link and add - * phy-handle = <&rgmii_phy1>; - */ - EMAC4: ethernet@e4000 { - phy-connection-type = "rgmii"; - local-mac-address = [0A 00 00 00 00 05]; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - /* Connection to Expansion (M.2) slot - * Future WAN (i.e xDSL) plugin - */ - EMAC5: ethernet@e6000 { - phy-connection-type = "rgmii-id"; - local-mac-address = [00 00 00 00 00 06]; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - /* 10G SFP+ interface - * This can also run at 1.25 and 2.5G with - * the appropriate SerDes protocol setting in RCW - */ - TENSFP: ethernet@f0000 { - status = "okay"; - phy-connection-type = "xgmii"; - fixed-link { - speed = <10000>; - full-duplex; - }; - }; - - mdio@fc000 { - rgmii_phy1: ethernet-phy@2 { - reg = <0x2>; - }; - qsgmii_phy1: ethernet-phy@4 { - reg = <0x4>; - }; - qsgmii_phy2: ethernet-phy@5 { - reg = <0x5>; - }; - qsgmii_phy3: ethernet-phy@6 { - reg = <0x6>; - }; - qsgmii_phy4: ethernet-phy@7 { - reg = <0x7>; - }; - }; -}; - -/* No QUICC engine functions on this board - - * pins are used for other functions (GPIO, I2C etc.) - */ -&uqe { - status = "disabled"; -}; - -/* LS1043S does not use the QorIQ AHCI - * controller. - */ -&sata { - status = "disabled"; -}; diff --git a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts deleted file mode 100644 index 936875101f9678..00000000000000 --- a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Device Tree Include file for Traverse LS1043V board. - * - * Copyright 2014-2015, Freescale Semiconductor - * Copyright 2017, Traverse Technologies - * - * This file is dual-licensed: you can use it either under the terms - * of the GPLv2 or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "fsl-ls1043a.dtsi" -#include -#include - -/ { - model = "Traverse LS1043V"; - compatible = "traverse,ls1043v"; - - aliases { - crypto = &crypto; - ethernet0 = &EMAC0; - ethernet1 = &EMAC1; - ethernet2 = &EMAC2; - ethernet3 = &EMAC3; - ethernet4 = &EMAC4; - ethernet5 = &EMAC5; - pca9555 = &pca9555; - }; - - leds { - compatible = "gpio-leds"; - gpio0 { - label = "ls1043v:green:user0"; - gpios = <&pca9555 0 GPIO_ACTIVE_LOW>; - }; - gpio1 { - label = "ls1043v:yellow:user0"; - gpios = <&pca9555 1 GPIO_ACTIVE_LOW>; - }; - gpio2 { - label = "ls1043v:green:user1"; - gpios = <&pca9555 2 GPIO_ACTIVE_LOW>; - }; - gpio3 { - label = "ls1043v:yellow:user1"; - gpios = <&pca9555 3 GPIO_ACTIVE_LOW>; - }; - gpio4 { - label = "ls1043v:green:user2"; - gpios = <&pca9555 4 GPIO_ACTIVE_HIGH>; - }; - gpio5 { - label = "ls1043v:yellow:wlan"; - gpios = <&pca9555 5 GPIO_ACTIVE_HIGH>; - }; - gpio6 { - label = "ls1043v:yellow:wan"; - gpios = <&pca9555 6 GPIO_ACTIVE_HIGH>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <1000>; - button@0 { - label = "Front button"; - linux,code = ; - gpios = <&pca9555 14 GPIO_ACTIVE_LOW>; - }; - button@1 { - label = "Rear button"; - linux,code = ; - gpios = <&pca9555 15 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&i2c0 { - status = "okay"; - rtc@6f { - compatible = "intersil,isl1208"; - reg = <0x6f>; - }; - - pca9555: pca9555@20 { - compatible = "nxp,pca9555"; - gpio-controller; - #gpio-cells = <2>; - reg = <0x20>; - gpio-base = <0>; - }; - - /* CPU core temp sensor and VDD (1.0V) sensor */ - ltc2990@4c { - compatible = "lltc,ltc2990"; - reg = <0x4C>; - lltc,meas-mode = <4 3>; - }; - - /* 3.3V and 5V monitor (may not be loaded on some SKUs) */ - ltc2990@4f { - compatible = "lltc,ltc2990"; - reg = <0x4F>; - lltc,meas-mode = <6 3>; - }; -}; - -&ifc { - status = "okay"; - #address-cells = <2>; - #size-cells = <1>; - /* Only NAND flash is used on this board */ - ranges = <0x0 0x0 0x0 0x7e800000 0x00010000>; - - nand@1,0 { - compatible = "fsl,ifc-nand"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x0 0x0 0x10000>; - }; -}; - -&duart0 { - status = "okay"; -}; - -&duart1 { - status = "okay"; -}; - -#include "fsl-ls1043-post.dtsi" - -&fman0 { - EMAC0: ethernet@e0000 { - phy-handle = <&qsgmii_phy1>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 01]; - }; - - EMAC1: ethernet@e2000 { - phy-handle = <&qsgmii_phy2>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 02]; - }; - - EMAC2: ethernet@e8000 { - phy-handle = <&qsgmii_phy3>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 03]; - }; - - EMAC3: ethernet@ea000 { - phy-handle = <&qsgmii_phy4>; - phy-connection-type = "qsgmii"; - local-mac-address = [0A 00 00 00 00 04]; - }; - EMAC4: ethernet@e4000 { - phy-handle = <&rgmii_phy1>; - phy-connection-type = "rgmii"; - local-mac-address = [0A 00 00 00 00 05]; - }; - - /* Connection to VDSL SoC */ - EMAC5: ethernet@e6000 { - phy-connection-type = "rgmii-id"; - local-mac-address = [00 00 00 00 00 06]; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - /* 10G XFI interface - not in use on this platform */ - TENSFP: ethernet@f0000 { - status = "disabled"; - - phy-connection-type = "sgmii"; - fixed-link { - /* NB: speed = 1000 and sgmii allows forward compatibility - * with both 1G and 10G, the same is not true - * in the reverse. - */ - speed = <1000>; - full-duplex; - }; - }; - - mdio@fc000 { - rgmii_phy1: ethernet-phy@3 { - reg = <0x3>; - }; - qsgmii_phy1: ethernet-phy@4 { - reg = <0x4>; - }; - qsgmii_phy2: ethernet-phy@5 { - reg = <0x5>; - }; - qsgmii_phy3: ethernet-phy@6 { - reg = <0x6>; - }; - qsgmii_phy4: ethernet-phy@7 { - reg = <0x7>; - }; - }; -}; - -/* No QUICC engine functions on this board */ -&uqe { - status = "disabled"; -}; - -/* No SATA/AHCI on this board */ -&sata { - status = "disabled"; -}; diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile index 1463a3eaea0586..dfbda85b3651bf 100644 --- a/target/linux/layerscape/image/Makefile +++ b/target/linux/layerscape/image/Makefile @@ -51,19 +51,6 @@ define Build/ls-append-sdhead dd if=$(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img >> $@ endef -define Build/traverse-fit - ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) \ - -v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \ - -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ - -C gzip -c 1 -c 2 \ - -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043s.dtb \ - -D "Traverse_LS1043S" -n "ls1043s" -a $(FDT_LOADADDR) -c 1 \ - -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043v.dtb \ - -D "Traverse_LS1043V" -n "ls1043v" -a $(FDT_LOADADDR) -c 2 - PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new - @mv -f $@.new $@ -endef - define Build/traverse-fit-ls1088 ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) \ -v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \ diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk index 0016e3bde8253f..259bacee314270 100644 --- a/target/linux/layerscape/image/armv8_64b.mk +++ b/target/linux/layerscape/image/armv8_64b.mk @@ -420,38 +420,6 @@ define Device/fsl_lx2160a-rdb-sdboot endef TARGET_DEVICES += fsl_lx2160a-rdb-sdboot -define Device/traverse_ls1043 - DEVICE_VENDOR := Traverse - DEVICE_MODEL := LS1043 Boards - KERNEL_NAME := Image - KERNEL_SUFFIX := -kernel.itb - KERNEL_INSTALL := 1 - FDT_LOADADDR = 0x90000000 - FILESYSTEMS := ubifs - MKUBIFS_OPTS := -m 1 -e 262016 -c 128 - DEVICE_PACKAGES += \ - layerscape-fman \ - uboot-envtools \ - kmod-i2c-mux-pca954x \ - kmod-hwmon-core \ - kmod-gpio-pca953x kmod-input-gpio-keys-polled \ - kmod-rtc-isl1208 - DEVICE_DESCRIPTION = \ - Build images for Traverse LS1043 boards. This generates a single image \ - capable of booting on any of the boards in this family. - DEVICE_DTS = freescale/traverse-ls1043s - DEVICE_DTS_DIR = $(LINUX_DIR)/arch/arm64/boot/dts - DEVICE_DTS_CONFIG = ls1043s - KERNEL := kernel-bin | gzip | traverse-fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb - KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb - IMAGES = root sysupgrade.bin - IMAGE/root = append-rootfs - IMAGE/sysupgrade.bin = sysupgrade-tar | append-metadata - MKUBIFS_OPTS := -m 2048 -e 124KiB -c 4096 - SUPPORTED_DEVICES := traverse,ls1043s traverse,ls1043v -endef -TARGET_DEVICES += traverse_ls1043 - define Device/traverse_ten64_mtd DEVICE_VENDOR := Traverse DEVICE_MODEL := Ten64 (NAND boot) diff --git a/target/linux/layerscape/patches-5.15/300-add-DTS-for-Traverse-LS1043-Boards.patch b/target/linux/layerscape/patches-5.15/300-add-DTS-for-Traverse-LS1043-Boards.patch deleted file mode 100644 index 110afedefd51c0..00000000000000 --- a/target/linux/layerscape/patches-5.15/300-add-DTS-for-Traverse-LS1043-Boards.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 5b35aae22b4ca2400e49561c9267aa01346f91d4 Mon Sep 17 00:00:00 2001 -From: Mathew McBride -Date: Tue, 17 Apr 2018 10:01:03 +1000 -Subject: [PATCH] add DTS for Traverse LS1043 Boards - -Signed-off-by: Mathew McBride -[rebase] -Signed-off-by: Yangbo Lu ---- - arch/arm64/boot/dts/freescale/Makefile | 3 +++ - arch/arm64/boot/dts/freescale/traverse-ls1043s.dts | 29 ++++++++++++++++++++++ - arch/arm64/boot/dts/freescale/traverse-ls1043v.dts | 29 ++++++++++++++++++++++ - 3 files changed, 61 insertions(+) - ---- a/arch/arm64/boot/dts/freescale/Makefile -+++ b/arch/arm64/boot/dts/freescale/Makefile -@@ -31,6 +31,9 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2 - dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb - dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2162a-qds.dtb - -+dtb-$(CONFIG_ARCH_LAYERSCAPE) += traverse-ls1043v.dtb -+dtb-$(CONFIG_ARCH_LAYERSCAPE) += traverse-ls1043s.dtb -+ - dtb-$(CONFIG_ARCH_MXC) += imx8mm-beacon-kit.dtb - dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb - dtb-$(CONFIG_ARCH_MXC) += imx8mm-ddr4-evk.dtb From 6a89cfa418ee746a590e7c6d746e7317dd58e830 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 27 Jun 2023 06:37:28 +0000 Subject: [PATCH 0301/1171] layerscape: base-files: remove redundant RAMFS_COPY_* additions All the tools (e.g fw_setenv, ubiupdatevol) and config (fw_env.config) needed for sysupgrade are already included in /lib/upgrade/stage2 Signed-off-by: Mathew McBride (cherry picked from commit 094c37708ace9040e294c5aa7be34bc9e7a8dcc1) --- target/linux/layerscape/base-files/lib/upgrade/platform.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh index 0b5d14b579cfbb..8ad9df4a13dbc3 100644 --- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh +++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh @@ -3,8 +3,8 @@ # Copyright 2020 NXP # -RAMFS_COPY_BIN="/usr/sbin/fw_printenv /usr/sbin/fw_setenv /usr/sbin/ubinfo /bin/echo" -RAMFS_COPY_DATA="/etc/fw_env.config /var/lock/fw_printenv.lock" +RAMFS_COPY_BIN="" +RAMFS_COPY_DATA="" REQUIRE_IMAGE_METADATA=1 From 21f0ab503c57d72a49d0e889d384f724b38ea406 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 21 Jul 2023 01:38:30 +0000 Subject: [PATCH 0302/1171] kernel: move NXP DPAA2 SFP patches to generic patches These are used by both the armsr (EFI boot) and layerscape targets for phylink-controlled SFP support on NXP DPAA2 platforms (LS1088,LS2088,LX2160). This is in place of commit a7bd96c98f8f ("layerscape: add patches for SFP support on DPAA2 platforms") in the main branch. armsr in main started at kernel 6.1 so there is not an equivalent 5.15 commit to cherry pick. Signed-off-by: Mathew McBride --- ...-v5.16-net-dpaa2-mac-add-support-for-more-10G-modes.patch} | 0 .../726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch} | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename target/linux/{armsr/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch => generic/backport-5.15/792-v5.16-net-dpaa2-mac-add-support-for-more-10G-modes.patch} (100%) rename target/linux/{armsr/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch => generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch} (95%) diff --git a/target/linux/armsr/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch b/target/linux/generic/backport-5.15/792-v5.16-net-dpaa2-mac-add-support-for-more-10G-modes.patch similarity index 100% rename from target/linux/armsr/patches-5.15/702-net-dpaa2-mac-add-support-for-more-10G-modes.patch rename to target/linux/generic/backport-5.15/792-v5.16-net-dpaa2-mac-add-support-for-more-10G-modes.patch diff --git a/target/linux/armsr/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch b/target/linux/generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch similarity index 95% rename from target/linux/armsr/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch rename to target/linux/generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch index 447266fa1438dc..c7d16e5c4c3261 100644 --- a/target/linux/armsr/patches-5.15/701-dpaa2-eth-do-not-hold-rtnl_lock.patch +++ b/target/linux/generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch @@ -52,7 +52,7 @@ Signed-off-by: Russell King dpaa2_eth_dl_traps_unregister(priv); --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c -@@ -351,7 +351,9 @@ int dpaa2_mac_connect(struct dpaa2_mac * +@@ -357,7 +357,9 @@ int dpaa2_mac_connect(struct dpaa2_mac * if (mac->pcs) phylink_set_pcs(mac->phylink, &mac->pcs->pcs); @@ -62,7 +62,7 @@ Signed-off-by: Russell King if (err) { netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); goto err_phylink_destroy; -@@ -372,7 +374,9 @@ void dpaa2_mac_disconnect(struct dpaa2_m +@@ -378,7 +380,9 @@ void dpaa2_mac_disconnect(struct dpaa2_m if (!mac->phylink) return; From 23953cfa5afa2e8cd9e1c1475d065cb954d8ceb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kwiatek?= Date: Wed, 12 Jul 2023 21:39:39 +0200 Subject: [PATCH 0303/1171] ath11k-firmware: update to stable WLAN.HK.2.9.0.1-01837 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog from quic: Bug fixes, stability improvements from previous releases are present. There are no backward comatibility issues with this release. Tested-by: Michał Kwiatek # Xiaomi AX3600 Signed-off-by: Michał Kwiatek [ improve commit description ] Signed-off-by: Christian Marangi (cherry picked from commit 1c56801dd2e696cac7da45912b5e3ea1165549d5) --- package/firmware/ath11k-firmware/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/firmware/ath11k-firmware/Makefile b/package/firmware/ath11k-firmware/Makefile index fc7968a95764a4..7acc233b6fc889 100644 --- a/package/firmware/ath11k-firmware/Makefile +++ b/package/firmware/ath11k-firmware/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath11k-firmware -PKG_SOURCE_DATE:=2023-03-31 -PKG_SOURCE_VERSION:=a039049a9349722fa5c74185452ab04644a0d351 -PKG_MIRROR_HASH:=ed401e3f6e91d70565b3396139193f7e815f410db93700697205ac8ed1b828c5 +PKG_SOURCE_DATE:=2023-07-06 +PKG_SOURCE_VERSION:=69f6b7346b64784188dba791a9cfb614eefa441f +PKG_MIRROR_HASH:=0f0203f755cb6713f6a1f41397dcd0f1a24e5cdbe75258af961343b927ebb3e9 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -60,14 +60,14 @@ $(eval $(call Download,qcn9074-board)) define Package/ath11k-firmware-ipq8074/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ8074 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/testing/2.9.0.1/WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/2.9.0.1/WLAN.HK.2.9.0.1-01837-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/IPQ8074/ endef define Package/ath11k-firmware-qcn9074/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/QCN9074/hw1.0 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/testing/2.9.0.1/WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-01837-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/ath11k/QCN9074/hw1.0/ $(INSTALL_BIN) \ $(DL_DIR)/$(QCN9074_BOARD_FILE) $(1)/lib/firmware/ath11k/QCN9074/hw1.0/board-2.bin From ee910d1e67c5ebba3bc2c136c8c6b5358a8c17b5 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Mon, 10 Jul 2023 07:56:05 +0200 Subject: [PATCH 0304/1171] dropbear: add ed25519 for failsafe key At least Fedora and RHEL 9 set RSAMinSize=2048, so when trying to use failsafe, we get 'Bad server host key: Invalid key length' To workaround the issue, we can use: ssh -o RSAMinSize=1024 ... Generating 2048 bits RSA is extremely slow, so add ed25519. We keep RSA 1024 to be as compatible as possible. Signed-off-by: Etienne Champetier (cherry picked from commit 6ac61dead99ff6b9df00c29b7a858772449718b2) --- package/network/services/dropbear/files/dropbear.failsafe | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/network/services/dropbear/files/dropbear.failsafe b/package/network/services/dropbear/files/dropbear.failsafe index a98ede459adf0b..97bd12d58a1891 100755 --- a/package/network/services/dropbear/files/dropbear.failsafe +++ b/package/network/services/dropbear/files/dropbear.failsafe @@ -1,8 +1,9 @@ #!/bin/sh failsafe_dropbear () { - dropbearkey -t rsa -s 1024 -f /tmp/dropbear_failsafe_host_key - dropbear -r /tmp/dropbear_failsafe_host_key <> /dev/null 2>&1 + dropbearkey -t rsa -s 1024 -f /tmp/dropbear_rsa_failsafe_host_key + dropbearkey -t ed25519 -f /tmp/dropbear_ed25519_failsafe_host_key + dropbear -r /tmp/dropbear_rsa_failsafe_host_key -r /tmp/dropbear_ed25519_failsafe_host_key <> /dev/null 2>&1 } boot_hook_add failsafe failsafe_dropbear From 1face854a2fd8c79fc568877068cf9c608a6360e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 6 May 2023 16:51:18 +0200 Subject: [PATCH 0305/1171] ipq40xx: move Teltonika RUT STM32 IO to specific DTS Prepare to re-use the DTS for the RUTX50. Signed-off-by: David Bauer (cherry picked from commit dbc4be142e206e681ac53afa3fd1e4018e7843b7) --- .../arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi | 37 ------------------- .../arch/arm/boot/dts/qcom-ipq4018-rutx10.dts | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi index 230b62a94ee3c1..df9425b12a880c 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi @@ -44,43 +44,6 @@ linux,code = ; }; }; - - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - gpio_out { - gpio-export,name = "gpio_out"; - gpio-export,output = <0>; - gpio-export,direction_may_change = <0>; - gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>; - }; - - gpio_in { - gpio-export,name = "gpio_in"; - gpio-export,input = <0>; - gpio-export,direction_may_change = <0>; - gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>; - }; - }; - }; -}; - -&blsp1_i2c3 { - status = "okay"; - pinctrl-0 = <&i2c_0_pins>; - pinctrl-names = "default"; - clock-frequency = <400000>; - - stm32_io: stm32@74 { - compatible = "tlt,stm32v1"; - #gpio-cells = <2>; - #interrupt-cells = <2>; - gpio-controller; - interrupt-controller; - interrupt-parent = <&tlmm>; - interrupts = <5 2>; - reg = <0x74>; }; }; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx10.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx10.dts index 31d14aa6ae1847..8fc976a11b1fe6 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx10.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx10.dts @@ -22,6 +22,43 @@ linux,default-trigger = "phy1tpt"; }; }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + gpio_out { + gpio-export,name = "gpio_out"; + gpio-export,output = <0>; + gpio-export,direction_may_change = <0>; + gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>; + }; + + gpio_in { + gpio-export,name = "gpio_in"; + gpio-export,input = <0>; + gpio-export,direction_may_change = <0>; + gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>; + }; + }; + }; +}; + +&blsp1_i2c3 { + status = "okay"; + pinctrl-0 = <&i2c_0_pins>; + pinctrl-names = "default"; + clock-frequency = <400000>; + + stm32_io: stm32@74 { + compatible = "tlt,stm32v1"; + #gpio-cells = <2>; + #interrupt-cells = <2>; + gpio-controller; + interrupt-controller; + interrupt-parent = <&tlmm>; + interrupts = <5 2>; + reg = <0x74>; }; }; From 897d55bcdf864f4d40cf50396b963ca240bbc1fc Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 6 May 2023 16:57:18 +0200 Subject: [PATCH 0306/1171] ipq40xx: add support for Teltonika RUTX50 Hardware -------- CPU: Qualcomm IPQ4018 RAM: 256M Flash: 16MB SPI-NOR (W25Q128) 128MB SPI-NAND (XTX) WiFi: 2T2R (2GHz 802.11n ; 5 GHz 802.11ac) ETH: 4x LAN ; 1x WAN (Gigabit) CELL: Quectel RG501Q 3G/4G/5G UART: Available on the goldfinger connector (Pinout silkscreened) 115200 8N1 3V3 - Only connect RX / TX / GND Installation ------------ 1. Enable SSH in the Teltonika UI (System --> Administration --> Access Control) 2. Check from which partition set the device is currently running from. $ cat /proc/boot_info/rootfs/primaryboot In case this output reads 0, install a Software update from Teltonika first. After upgrade completion, check this file now reads 1 before continuing. 2. Transfer the OpenWrt factory image to the device using scp. Use the same password (user root!) as used for the Web-UI. $ scp -O openwrt-factory.bin root@192.168.1.1:/tmp 3. Connect to the device using ssh as the root user. 4. Install OpenWrt by writing the factory image to flash. $ ubiformat /dev/mtd16 -y -f /tmp/openwrt-factory.bin 5. Instruct the bootloaer to boot from the first partition set. $ echo 0 > /proc/boot_info/rootfs/primaryboot $ cat /proc/boot_info/getbinary_bootconfig > /tmp/bootconfig.bin $ cat /proc/boot_info/getbinary_bootconfig1 > /tmp/bootconfig1.bin $ mtd write /tmp/bootconfig.bin /dev/mtd2 $ mtd write /tmp/bootconfig1.bin /dev/mtd3 6. Reboot the device. $ reboot Signed-off-by: David Bauer (cherry picked from commit 844bb4bfad84cc6267f9b138d1f63b07ed3b77d0) --- .../ipq40xx/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 6 +- .../base-files/lib/upgrade/platform.sh | 1 + .../arch/arm/boot/dts/qcom-ipq4018-rutx50.dts | 181 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 16 ++ 5 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx50.dts diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 1a74fb792ce217..c297566dd85de0 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -24,6 +24,7 @@ ipq40xx_setup_interfaces() p2w,r619ac-64m|\ p2w,r619ac-128m|\ pakedge,wr-1|\ + teltonika,rutx50|\ zyxel,nbg6617) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 7f41bdcfcc58c2..c8cf297e8104a2 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -131,7 +131,8 @@ case "$FIRMWARE" in caldata_extract "0:ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(get_mac_label) 2) ;; - teltonika,rutx10) + teltonika,rutx10|\ + teltonika,rutx50) caldata_extract "0:ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 2) ;; @@ -227,7 +228,8 @@ case "$FIRMWARE" in caldata_extract "0:ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(get_mac_label) 4) ;; - teltonika,rutx10) + teltonika,rutx10|\ + teltonika,rutx50) caldata_extract "0:ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 3) ;; diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index e6e99b9d2122c4..8807f844e59aa3 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -207,6 +207,7 @@ platform_do_upgrade() { sony_emmc_do_upgrade "$1" ;; teltonika,rutx10 |\ + teltonika,rutx50 |\ zte,mf18a |\ zte,mf286d |\ zte,mf287plus |\ diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx50.dts new file mode 100644 index 00000000000000..ea2102f7d6a7ef --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx50.dts @@ -0,0 +1,181 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4018-rutx.dtsi" + +/ { + model = "Teltonika RUTX50"; + compatible = "teltonika,rutx50"; + + aliases { + led-boot = &led_rssi0; + led-failsafe = &led_rssi0; + led-running = &led_rssi0; + led-upgrade = &led_rssi0; + label-mac-device = &gmac; + }; + + soc { + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + gpio_modem_reset { + gpio-export,name = "modem_reset"; + gpio-export,output = <0>; + gpios = <&shift_io 8 GPIO_ACTIVE_HIGH>; + }; + + gpio_modem_power { + gpio-export,name = "modem_power"; + gpio-export,output = <0>; + gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>; + }; + + gpio_out_1 { + gpio-export,name = "sim-select"; + /* 0 = SIM1 ; 1 = SIM2 */ + gpio-export,output = <0>; + gpios = <&shift_io 10 GPIO_ACTIVE_HIGH>; + }; + + gpio_in_1 { + gpio-export,name = "sim-detect"; + gpio-export,input = <0>; + gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "green:sim1"; + gpios = <&shift_io 14 GPIO_ACTIVE_HIGH>; + }; + + led-1 { + label = "green:sim2"; + gpios = <&shift_io 15 GPIO_ACTIVE_HIGH>; + }; + + led-2 { + label = "green:eth"; + gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>; + }; + + led-3 { + label = "green:wifi"; + gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>; + }; + + led-4 { + label = "green:3g"; + gpios = <&shift_io 5 GPIO_ACTIVE_HIGH>; + }; + + led-5 { + label = "green:4g"; + gpios = <&shift_io 4 GPIO_ACTIVE_HIGH>; + }; + + led-6 { + label = "green:5g"; + gpios = <&shift_io 3 GPIO_ACTIVE_HIGH>; + }; + + led_rssi0: led-7 { + label = "green:rssi0"; + gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>; + }; + + led-8 { + label = "green:rssi1"; + gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>; + }; + + led-9 { + label = "green:rssi2"; + gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>; + }; + + led-10 { + label = "green:wifi2g"; + gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>; + }; + + led-11 { + label = "green:wifi5g"; + gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>; + }; + }; + + spi-gpio { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + gpio-sck = <&tlmm 1 GPIO_ACTIVE_HIGH>; + gpio-mosi = <&tlmm 3 GPIO_ACTIVE_HIGH>; + cs-gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>; + num-chipselects = <1>; + + shift_io: shift_io@0 { + compatible = "fairchild,74hc595"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + /* Attn: This is specific to RUTX50 in Teltonika GPL */ + registers-number = <2>; + spi-max-frequency = <10000000>; + }; + }; + }; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "Teltonika-RUTX10"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "Teltonika-RUTX10"; +}; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport1 { + status = "okay"; + + label = "lan1"; +}; + +&swport2 { + status = "okay"; + + label = "lan2"; +}; + +&swport3 { + status = "okay"; + + label = "lan3"; +}; + +&swport4 { + status = "okay"; + + label = "lan4"; +}; + +&swport5 { + status = "okay"; + + label = "wan"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index f15463ae8ca5e6..a9dd2aa0912f6a 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1076,6 +1076,22 @@ endef # Missing DSA Setup #TARGET_DEVICES += teltonika_rutx10 +define Device/teltonika_rutx50 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Teltonika + DEVICE_MODEL := RUTX50 + SOC := qcom-ipq4018 + DEVICE_DTS_CONFIG := config@5 + KERNEL_INSTALL := 1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + FILESYSTEMS := squashfs + IMAGE/factory.ubi := append-ubi + DEVICE_PACKAGES := ipq-wifi-teltonika_rutx kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi +endef +TARGET_DEVICES += teltonika_rutx50 + define Device/tel_x1pro $(call Device/FitImage) DEVICE_VENDOR := Telco From 5ded0a3975f8757f23d542dae370bca59e4b4525 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 9 Jun 2023 14:12:47 +0200 Subject: [PATCH 0307/1171] scripts: use sep-char for hash nodes U-Boot with enabled secure-boot will not boot images with the @-character used for hash node-names. Use the existing separation character configurable for each device. Signed-off-by: David Bauer (cherry picked from commit 2b133ab19cd5d741f3191f917c607667943f5f58) --- scripts/mkits.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/mkits.sh b/scripts/mkits.sh index bd6cddabf44c73..46ab5ee023f542 100755 --- a/scripts/mkits.sh +++ b/scripts/mkits.sh @@ -103,10 +103,10 @@ if [ -n "${DTB}" ]; then ${DTADDR:+load = <${DTADDR}>;} arch = \"${ARCH}\"; compression = \"none\"; - hash@1 { + hash${REFERENCE_CHAR}1 { algo = \"crc32\"; }; - hash@2 { + hash${REFERENCE_CHAR}2 { algo = \"${HASH}\"; }; }; @@ -123,10 +123,10 @@ if [ -n "${INITRD}" ]; then type = \"ramdisk\"; arch = \"${ARCH}\"; os = \"linux\"; - hash@1 { + hash${REFERENCE_CHAR}1 { algo = \"crc32\"; }; - hash@2 { + hash${REFERENCE_CHAR}2 { algo = \"${HASH}\"; }; }; @@ -145,10 +145,10 @@ if [ -n "${ROOTFS}" ]; then type = \"filesystem\"; arch = \"${ARCH}\"; compression = \"none\"; - hash@1 { + hash${REFERENCE_CHAR}1 { algo = \"crc32\"; }; - hash@2 { + hash${REFERENCE_CHAR}2 { algo = \"${HASH}\"; }; }; @@ -174,10 +174,10 @@ OVCONFIGS="" type = \"flat_dt\"; arch = \"${ARCH}\"; compression = \"none\"; - hash@1 { + hash${REFERENCE_CHAR}1 { algo = \"crc32\"; }; - hash@2 { + hash${REFERENCE_CHAR}2 { algo = \"${HASH}\"; }; }; @@ -209,10 +209,10 @@ DATA="/dts-v1/; compression = \"${COMPRESS}\"; load = <${LOAD_ADDR}>; entry = <${ENTRY_ADDR}>; - hash@1 { + hash${REFERENCE_CHAR}1 { algo = \"crc32\"; }; - hash@2 { + hash${REFERENCE_CHAR}2 { algo = \"$HASH\"; }; }; From 77b8ce64fa77ae6d79e9374658e114a4b1709a97 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 27 Jul 2023 11:27:46 +0200 Subject: [PATCH 0308/1171] libnl-tiny: update to latest Git HEAD 8667347 build: allow passing SOVERSION value for dynamic library Also adjust packaging of the library to only ship the SOVERSION suffixed library object, to allow for concurrent installation of ABI-incompible versions in the future. Fixes: #13082 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 4af0a72a65d7c92ed4e7c2455090f695f424903d) --- package/libs/libnl-tiny/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package/libs/libnl-tiny/Makefile b/package/libs/libnl-tiny/Makefile index 048c3e79397de9..4bdd7c1c397f4b 100644 --- a/package/libs/libnl-tiny/Makefile +++ b/package/libs/libnl-tiny/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git -PKG_SOURCE_DATE:=2023-07-01 -PKG_SOURCE_VERSION:=d433990c00e804593f253cc709b8fe901492b530 -PKG_MIRROR_HASH:=fffb2782c7ed2ebabc7d57e5513f52ac53d1828014bc9a8ea131f50eab093086 +PKG_SOURCE_DATE:=2023-07-27 +PKG_SOURCE_VERSION:=bc92a280186f9becc53c0f17e4e43cfbdeec7e7b +PKG_MIRROR_HASH:=57c5ac75fdb4413e98e525bee7de419fc6cce5f23389581dafd9ffe22321224d CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 @@ -27,7 +27,7 @@ define Package/libnl-tiny SECTION:=libs CATEGORY:=Libraries TITLE:=netlink socket library - ABI_VERSION:=$(PKG_SOURCE_DATE) + ABI_VERSION:=1 endef define Package/libnl-tiny/description @@ -37,13 +37,13 @@ endef define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(1)/usr/include/libnl-tiny $(CP) $(PKG_INSTALL_DIR)/usr/include/libnl-tiny/* $(1)/usr/include/libnl-tiny - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libnl-tiny.so $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-tiny.so* $(1)/usr/lib/ $(INSTALL_DATA) $(PKG_BUILD_DIR)/libnl-tiny.pc $(1)/usr/lib/pkgconfig endef define Package/libnl-tiny/install $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libnl-tiny.so $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-tiny.so.* $(1)/usr/lib/ endef $(eval $(call BuildPackage,libnl-tiny)) From 680a4c7e12381309e21f13b04e0114a4b25c85bc Mon Sep 17 00:00:00 2001 From: Alexander Friese Date: Wed, 12 Jul 2023 16:46:01 +0200 Subject: [PATCH 0309/1171] ipq4019: fix support for AVM FRITZ!Repeater 3000 new versions of the device have NAND with 8bit ECC which was not yet supported before. This change removes ECC restrictions. Signed-off-by: Alexander Friese (cherry picked from commit 6b11f0ec83ceb9747dcbb0ffca0882b90da46b59) --- .../arch/arm/boot/dts/qcom-ipq4019-fritzrepeater-3000.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzrepeater-3000.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzrepeater-3000.dts index 8d88bc1521109f..41dec72542421d 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzrepeater-3000.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzrepeater-3000.dts @@ -121,6 +121,9 @@ status = "okay"; nand@0 { + /delete-property/ nand-ecc-strength; + /delete-property/ nand-ecc-step-size; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; From 3bac348387b6aab8a906c752980b853fb9d85df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 23 Jul 2023 22:41:18 +0200 Subject: [PATCH 0310/1171] bcm53xx: add BCM53573 Ethernet fix sent upstream for v6.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that DSA-based b53 driver never worked with BCM53573 SoCs and BCM53125. In case of swconfig-based b53 this fixes a regression. Switching bgmac from using mdiobus_register() to of_mdiobus_register() resulted in MDIO device (BCM53125) having of_node set (see of_mdiobus_register_phy()). That made downstream b53 driver read invalid data from DT and broke Ethernet support. Signed-off-by: Rafał Miłecki (cherry picked from commit 79fd3e62b4910731c13692b2daa2083e0f95c023) --- ...M53573-Fix-Tenda-AC9-switch-CPU-port.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.15/131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch diff --git a/target/linux/bcm53xx/patches-5.15/131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch b/target/linux/bcm53xx/patches-5.15/131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch new file mode 100644 index 00000000000000..7a35dcad813843 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch @@ -0,0 +1,28 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 23 Jul 2023 19:48:13 +0200 +Subject: [PATCH 1/3] ARM: dts: BCM53573: Fix Tenda AC9 switch CPU port +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Primary Ethernet interface is connected to the port 8 (not 5). + +Fixes: 64612828628c ("ARM: dts: BCM53573: Add Tenda AC9 switch ports") +Signed-off-by: Rafał Miłecki +--- + arch/arm/boot/dts/broadcom/bcm47189-tenda-ac9.dts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm47189-tenda-ac9.dts ++++ b/arch/arm/boot/dts/bcm47189-tenda-ac9.dts +@@ -135,8 +135,8 @@ + label = "lan4"; + }; + +- port@5 { +- reg = <5>; ++ port@8 { ++ reg = <8>; + label = "cpu"; + ethernet = <&gmac0>; + }; From e0c4da1ff0c00f2c4d78025523c38ea6395175d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 29 Jul 2023 17:02:28 +0200 Subject: [PATCH 0311/1171] bcm53xx: backport more DT changes queued for v6.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those sort out BCM53573 Ethernet info finally. Signed-off-by: Rafał Miłecki (cherry picked from commit ca8868a51127f6081a524d47eab937b90af0bf05) --- ...Fix-Ethernet-info-for-Luxul-devices.patch} | 5 +- ...M-dts-bcm5301x-Add-SEAMA-compatibles.patch | 36 +++++++ ...53573-Fix-Tenda-AC9-switch-CPU-port.patch} | 7 +- ...-Describe-BCM53125-switch-ports-in-t.patch | 97 +++++++++++++++++++ ...-BCM53573-Add-BCM53125-switch-port-5.patch | 36 +++++++ ...M53573-Add-Ethernet-interfaces-links.patch | 73 ++++++++++++++ ...-Disable-second-Ethernet-on-Luxul-de.patch | 39 ++++++++ ...-BCM5301X-Describe-partition-formats.patch | 25 ----- 8 files changed, 290 insertions(+), 28 deletions(-) rename target/linux/bcm53xx/patches-5.15/{130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch => 037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch} (88%) create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0010-ARM-dts-bcm5301x-Add-SEAMA-compatibles.patch rename target/linux/bcm53xx/patches-5.15/{131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch => 037-v6.6-0011-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch} (69%) create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0012-ARM-dts-BCM53573-Describe-BCM53125-switch-ports-in-t.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0013-ARM-dts-BCM53573-Add-BCM53125-switch-port-5.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0014-ARM-dts-BCM53573-Add-Ethernet-interfaces-links.patch create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch delete mode 100644 target/linux/bcm53xx/patches-5.15/321-ARM-dts-BCM5301X-Describe-partition-formats.patch diff --git a/target/linux/bcm53xx/patches-5.15/130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch similarity index 88% rename from target/linux/bcm53xx/patches-5.15/130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch rename to target/linux/bcm53xx/patches-5.15/037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch index 381a8c389437a5..07dd9296b69359 100644 --- a/target/linux/bcm53xx/patches-5.15/130-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch @@ -1,5 +1,6 @@ +From 44ad8207806973f4e4f7d870fff36cc01f494250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 13 Jul 2023 13:05:44 +0200 +Date: Thu, 13 Jul 2023 13:11:45 +0200 Subject: [PATCH] ARM: dts: BCM53573: Fix Ethernet info for Luxul devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -27,6 +28,8 @@ to work properly. Fixes: 9fb90ae6cae7 ("ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch") Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230713111145.14864-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli --- .../boot/dts/broadcom/bcm47189-luxul-xap-1440.dts | 13 +++++++++++++ .../boot/dts/broadcom/bcm47189-luxul-xap-810.dts | 13 +++++++++++++ diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0010-ARM-dts-bcm5301x-Add-SEAMA-compatibles.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0010-ARM-dts-bcm5301x-Add-SEAMA-compatibles.patch new file mode 100644 index 00000000000000..f23873e1112da8 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0010-ARM-dts-bcm5301x-Add-SEAMA-compatibles.patch @@ -0,0 +1,36 @@ +From 72ec77d74d28be7359ef77971cdee38b60af9e49 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Thu, 13 Jul 2023 00:16:42 +0200 +Subject: [PATCH] ARM: dts: bcm5301x: Add SEAMA compatibles + +This adds SEAMA compatibles to the firmware partition of these +two D-Link devices. + +Signed-off-by: Linus Walleij +Link: https://lore.kernel.org/r/20230713-seama-partitions-v4-2-69e577453d40@linaro.org +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm47094-dlink-dir-885l.dts | 1 + + arch/arm/boot/dts/broadcom/bcm47094-dlink-dir-890l.dts | 1 + + 2 files changed, 2 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -33,6 +33,7 @@ + #size-cells = <1>; + + partition@0 { ++ compatible = "seama"; + label = "firmware"; + reg = <0x00000000 0x08000000>; + }; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts +@@ -149,6 +149,7 @@ + * partitions: this device uses SEAMA. + */ + firmware@0 { ++ compatible = "seama"; + label = "firmware"; + reg = <0x00000000 0x08000000>; + }; diff --git a/target/linux/bcm53xx/patches-5.15/131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0011-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch similarity index 69% rename from target/linux/bcm53xx/patches-5.15/131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch rename to target/linux/bcm53xx/patches-5.15/037-v6.6-0011-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch index 7a35dcad813843..d5cb817e8e246e 100644 --- a/target/linux/bcm53xx/patches-5.15/131-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0011-ARM-dts-BCM53573-Fix-Tenda-AC9-switch-CPU-port.patch @@ -1,6 +1,7 @@ +From 7141209db9c335ab261a17933809a3e660ebdc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sun, 23 Jul 2023 19:48:13 +0200 -Subject: [PATCH 1/3] ARM: dts: BCM53573: Fix Tenda AC9 switch CPU port +Date: Sun, 23 Jul 2023 21:54:14 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Fix Tenda AC9 switch CPU port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -9,6 +10,8 @@ Primary Ethernet interface is connected to the port 8 (not 5). Fixes: 64612828628c ("ARM: dts: BCM53573: Add Tenda AC9 switch ports") Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230723195416.7831-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli --- arch/arm/boot/dts/broadcom/bcm47189-tenda-ac9.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0012-ARM-dts-BCM53573-Describe-BCM53125-switch-ports-in-t.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0012-ARM-dts-BCM53573-Describe-BCM53125-switch-ports-in-t.patch new file mode 100644 index 00000000000000..ab27495078aaef --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0012-ARM-dts-BCM53573-Describe-BCM53125-switch-ports-in-t.patch @@ -0,0 +1,97 @@ +From 8d6b61ecad2f1c939813c5c4517d53e04672dc48 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 23 Jul 2023 21:54:15 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Describe BCM53125 switch ports in the + main DTS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM53125 always has 5 ports with GPHYs (for LAN/WAN ports) and 2 IMP +ports. It seems the best place to describe that in the main .dtsi. +Device specific bits can go to device .dts files. This will help +avoiding some code duplication. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230723195416.7831-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + .../boot/dts/broadcom/bcm47189-tenda-ac9.dts | 7 ----- + arch/arm/boot/dts/broadcom/bcm53573.dtsi | 26 ++++++++++++++++++- + 2 files changed, 25 insertions(+), 8 deletions(-) + +--- a/arch/arm/boot/dts/bcm47189-tenda-ac9.dts ++++ b/arch/arm/boot/dts/bcm47189-tenda-ac9.dts +@@ -111,34 +111,27 @@ + + ports { + port@0 { +- reg = <0>; + label = "wan"; + }; + + port@1 { +- reg = <1>; + label = "lan1"; + }; + + port@2 { +- reg = <2>; + label = "lan2"; + }; + + port@3 { +- reg = <3>; + label = "lan3"; + }; + + port@4 { +- reg = <4>; + label = "lan4"; + }; + + port@8 { +- reg = <8>; + label = "cpu"; +- ethernet = <&gmac0>; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -192,10 +192,34 @@ + + status = "disabled"; + +- /* ports are defined in board DTS */ + ports { + #address-cells = <1>; + #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ }; ++ ++ port@8 { ++ reg = <8>; ++ ethernet = <&gmac0>; ++ }; + }; + }; + }; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0013-ARM-dts-BCM53573-Add-BCM53125-switch-port-5.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0013-ARM-dts-BCM53573-Add-BCM53125-switch-port-5.patch new file mode 100644 index 00000000000000..cc9e86ac751fb3 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0013-ARM-dts-BCM53573-Add-BCM53125-switch-port-5.patch @@ -0,0 +1,36 @@ +From d95b1caeea194962220db1778ce7fe71cdba788b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 23 Jul 2023 21:54:16 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Add BCM53125 switch port 5 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's connected to the extra Ethernet interface. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230723195416.7831-3-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm53573.dtsi | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -216,6 +216,16 @@ + reg = <4>; + }; + ++ port@5 { ++ reg = <5>; ++ ethernet = <&gmac1>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ + port@8 { + reg = <8>; + ethernet = <&gmac0>; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0014-ARM-dts-BCM53573-Add-Ethernet-interfaces-links.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0014-ARM-dts-BCM53573-Add-Ethernet-interfaces-links.patch new file mode 100644 index 00000000000000..f97d4edd754483 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0014-ARM-dts-BCM53573-Add-Ethernet-interfaces-links.patch @@ -0,0 +1,73 @@ +From e0ae343a2c1b782a346d9b844ea65e1d49c428b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 24 Jul 2023 12:12:27 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Add Ethernet interfaces links +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM53573 has 2 Ethernet interfaces each connected to one of switch ports +in the default design. They both use fixed links. + +An exception are Luxul XAP devices that have switch replaced by a single +PHY. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230724101227.5420-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + .../boot/dts/broadcom/bcm47189-luxul-xap-1440.dts | 2 ++ + .../arm/boot/dts/broadcom/bcm47189-luxul-xap-810.dts | 2 ++ + arch/arm/boot/dts/broadcom/bcm53573.dtsi | 12 ++++++++++++ + 3 files changed, 16 insertions(+) + +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -50,6 +50,8 @@ + phy-mode = "rgmii"; + phy-handle = <&bcm54210e>; + ++ /delete-node/ fixed-link; ++ + mdio { + /delete-node/ switch@1e; + +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -86,6 +86,8 @@ + phy-mode = "rgmii"; + phy-handle = <&bcm54210e>; + ++ /delete-node/ fixed-link; ++ + mdio { + /delete-node/ switch@1e; + +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -181,6 +181,12 @@ + + gmac0: ethernet@5000 { + reg = <0x5000 0x1000>; ++ phy-mode = "internal"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; + + mdio { + #address-cells = <1>; +@@ -237,6 +243,12 @@ + + gmac1: ethernet@b000 { + reg = <0xb000 0x1000>; ++ phy-mode = "internal"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; + }; + + pmu@12000 { diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch new file mode 100644 index 00000000000000..166f602452a904 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch @@ -0,0 +1,39 @@ +From d8835601e3c306fda78f8736f1aef688e99e892d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 24 Jul 2023 12:11:59 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Disable second Ethernet on Luxul devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +XAP-810 and XAP-1440 both have a single Ethernet port and BCM54210E PHY. +Their second Ethernet interface is not connected to anything. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230724101159.5289-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dts | 4 ++++ + arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-810.dts | 4 ++++ + 2 files changed, 8 insertions(+) + +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -60,3 +60,7 @@ + }; + }; + }; ++ ++&gmac1 { ++ status = "disabled"; ++}; +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -96,3 +96,7 @@ + }; + }; + }; ++ ++&gmac1 { ++ status = "disabled"; ++}; diff --git a/target/linux/bcm53xx/patches-5.15/321-ARM-dts-BCM5301X-Describe-partition-formats.patch b/target/linux/bcm53xx/patches-5.15/321-ARM-dts-BCM5301X-Describe-partition-formats.patch deleted file mode 100644 index f2861177dd1d57..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/321-ARM-dts-BCM5301X-Describe-partition-formats.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 7166207bd1d8c46d09d640d46afc685df9bb9083 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 22 Nov 2018 09:21:49 +0100 -Subject: [PATCH] ARM: dts: BCM5301X: Describe partition formats -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's needed by OpenWrt for custom partitioning. - -Signed-off-by: Rafał Miłecki ---- - arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts -+++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts -@@ -35,6 +35,7 @@ - partition@0 { - label = "firmware"; - reg = <0x00000000 0x08000000>; -+ compatible = "seama"; - }; - }; - }; From 017827e2057a1f3ec27ea92d89cb0b86a9f893d1 Mon Sep 17 00:00:00 2001 From: Oli Ze Date: Thu, 27 Jul 2023 07:23:12 +0200 Subject: [PATCH 0312/1171] uboot-mvebu: update to version 2023.07.02 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 2021.07 multiple bugs were introduced that made it impossible to create a bootable target for mvebu. Those issues should be now fixed since 2023.07-rc1. References: #11661 Signed-off-by: Oli Ze Reviewed-by: Robert Marko Tested-by: Andre Heider # espressobin-v3-v5-1gb-2cs Signed-off-by: Petr Štetiar [facelift] (cherry picked from commit ba7d6dddc7d20222c1703b173ef50befefb3fb52) --- package/boot/uboot-mvebu/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index e3f1582f23fa47..e6120959f648e3 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2023.01 +PKG_VERSION:=2023.07.02 PKG_RELEASE:=1 -PKG_HASH:=69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f +PKG_HASH:=6b6a48581c14abb0f95bd87c1af4d740922406d7b801002a9f94727fdde021d5 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk From 7efec0acca80b231ab8e69729a4bdaf11ef84541 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 27 Jul 2023 09:22:32 -0400 Subject: [PATCH 0313/1171] kernel: bump 5.15 to 5.15.123 Manually rebased: bcm4908/patches-5.15/071-v6.1-0001-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch[*] bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch Removed upstreamed: backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch[1] backport-5.15/817-v6.5-01-leds-trigger-netdev-Recheck-NETDEV_LED_MODE_LINKUP-o.patch[2] pending-5.15/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch[3] pending-5.15/160-workqueue-fix-enum-type-for-gcc-13.patch[4] bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch[5] bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch[6] ipq807x/patches-5.15/0048-v6.1-clk-qcom-reset-Allow-specifying-custom-reset-delay.patch[7] ipq807x/patches-5.15/0049-v6.2-clk-qcom-reset-support-resetting-multiple-bits.patch[8] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=02474292a44205c1eb5a03634ead155a3c9134f4 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=86b93cbfe104e99fd3d25a49748b99fb88101573 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=79b9ab357b6f5675007f4c02ff8765cbd8dc06a2 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=d528faa9e828b9fc46dfb684a2a9fd8c2e860ed8 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=5899bc4058e89d5110a23797ff94439c53b77c25 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=95afd2c7c7d26087730dc938709e025a303e5499 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=40844343a8853a08b049d50c967e2a1e28f0ece6 8. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=6ad5ded420f5d96f7c65b68135f5787a1c7e58d7 Build system: x86/64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Co-authored-by: Hauke Mehrtens Signed-off-by: John Audia [rebased ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch ] Signed-off-by: Hauke Mehrtens (cherry picked from commit 8590531048f138ff719c8b317c443a6a7538a762) [Refreshed on top of openwrt-23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 +- .../910-unaligned_access_hacks.patch | 2 +- ...Set-base-to-0-give-expected-gpio-num.patch | 4 +- ...070-MMC-added-alternative-MMC-driver.patch | 2 +- ...ore-event-ring-segment-table-entries.patch | 4 +- ...trl-bcm2835-Remove-gpiochip-on-error.patch | 2 +- ...-interface-in-mode6-for-18-bit-color.patch | 4 +- ...-Add-a-timing-for-the-Raspberry-Pi-7.patch | 4 +- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 8 +- ...usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch | 10 +- ...nel-simple-add-Geekworm-MZP280-Panel.patch | 2 +- ...uirk-for-Superspeed-bulk-OUT-transfe.patch | 10 +- ...2835-Only-return-non-GPIOs-to-inputs.patch | 4 +- ...rs-remove-legacy_cursor_update-hacks.patch | 4 +- .../patches-5.15/791-tg3-no-pci-sleep.patch | 2 +- ...4908_enet-handle-EPROBE_DEFER-when-g.patch | 2 +- ...-Relicense-Rafa-s-code-to-the-GPL-2..patch | 2 +- ...X-Drop-clock-names-from-the-SPI-node.patch | 32 ----- ...BCM5301X-fix-duplex-full-full-duplex.patch | 44 ------- ...support-for-performing-fake-doorbell.patch | 8 +- ...configurable-downshift-for-addresses.patch | 4 +- ...efined-reg_base-to-be-added-to-every.patch | 4 +- ..._base-and-reg_downshift-for-single-r.patch | 4 +- ..._eth_soc-add-support-for-coherent-DM.patch | 6 +- ..._eth_soc-add-support-for-Wireless-Et.patch | 2 +- ..._eth_soc-allocate-struct-mtk_ppe-sep.patch | 2 +- ..._eth_soc-rework-hardware-flow-table-.patch | 2 +- ..._eth_soc-use-standard-property-for-c.patch | 2 +- ..._eth_soc-add-txd_size-to-mtk_soc_dat.patch | 12 +- ..._eth_soc-add-rxd_size-to-mtk_soc_dat.patch | 12 +- ..._eth_soc-introduce-device-register-m.patch | 14 +- ..._eth_soc-introduce-MTK_NETSYS_V2-sup.patch | 14 +- ..._eth_soc-introduce-support-for-mt798.patch | 4 +- ..._eth_soc-enable-rx-cksum-offload-for.patch | 2 +- ...populate-supported_interfaces-member.patch | 2 +- ...eth_soc-use-phylink_generic_validate.patch | 2 +- ...mark-as-a-legacy_pre_march2020-drive.patch | 2 +- ...remove-a-copy-of-the-NAPI_POLL_WEIGH.patch | 2 +- ...9-mtk_eth_soc-remove-unused-mac-mode.patch | 2 +- ...th_soc-correct-802.3z-duplex-setting.patch | 2 +- ...et-mtk_eth_soc-add-basic-XDP-support.patch | 4 +- ...net-mtk_eth_soc-add-xmit-XDP-support.patch | 2 +- ..._eth_soc-add-support-for-page_pool_g.patch | 6 +- ..._eth_soc-move-gdma_to_ppe-and-ppe_ba.patch | 2 +- ..._eth_soc-move-ppe-table-hash-offset-.patch | 8 +- ..._eth_soc-add-the-capability-to-run-m.patch | 2 +- ..._eth_soc-move-wdma_base-definitions-.patch | 2 +- ..._eth_soc-add-foe_entry_size-to-mtk_e.patch | 6 +- ..._eth_wed-add-wed-support-for-mt7986-.patch | 4 +- ..._eth_soc-introduce-flow-offloading-s.patch | 8 +- ..._eth_soc-enable-flow-offloading-supp.patch | 2 +- ..._eth_soc-fix-possible-memory-leak-in.patch | 8 +- ..._eth_soc-do-not-overwrite-mtu-config.patch | 4 +- ..._eth_soc-remove-cpu_relax-in-mtk_pen.patch | 4 +- ..._eth_soc-introduce-mtk_hw_warm_reset.patch | 4 +- ..._eth_soc-align-reset-procedure-to-ve.patch | 4 +- ..._eth_soc-add-dma-checks-to-mtk_hw_re.patch | 6 +- ..._wed-add-reset-reset_complete-callba.patch | 4 +- ..._eth_soc-avoid-port_mg-assignment-on.patch | 4 +- ..._eth_soc-implement-multi-queue-suppo.patch | 12 +- ..._eth_soc-fix-VLAN-rx-hardware-accele.patch | 2 +- ...t-mtk_eth_soc-add-support-for-MT7981.patch | 4 +- ..._eth_soc-switch-to-external-PCS-driv.patch | 10 +- ...ne-turning-IRQs-off-to-avoid-SoC-han.patch | 45 ------- ...icro-stmmac-move-queue-reset-to-dedi.patch | 4 +- ...icro-stmmac-move-dma-conf-to-dedicat.patch | 6 +- ...icro-stmmac-generate-stmmac-dma-conf.patch | 2 +- .../generic/hack-5.15/204-module_strip.patch | 12 +- .../hack-5.15/259-regmap_dynamic.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 2 +- .../generic/hack-5.15/902-debloat_proc.patch | 2 +- ...ck-usage-in-jffs2_build_xattr_subsys.patch | 121 ------------------ ...et-add-mac-address-increment-support.patch | 3 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- ...d-knob-for-filtering-rx-tx-BPDU-pack.patch | 2 +- ...iatek-ppe-add-support-for-flow-accou.patch | 10 +- ..._eth_soc-drop-generic-vlan-rx-offloa.patch | 2 +- ..._eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch | 24 ++-- ..._eth_soc-rely-on-num_devs-and-remove.patch | 14 +- ..._eth_soc-add-MTK_NETSYS_V3-capabilit.patch | 2 +- ...k_eth_soc-add-support-for-MT7988-SoC.patch | 4 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 6 +- ...pool-and-page-referenced-frags-in-GR.patch | 2 +- .../902-dts-ipq4019-ap-dk04.1.patch | 11 +- ...-Allow-specifying-custom-reset-delay.patch | 54 -------- ...eset-support-resetting-multiple-bits.patch | 59 --------- ...-ops-with-struct-pcie_cfg-in-pcie-ma.patch | 8 +- ...77-v6.0-PCI-qcom-Add-IPQ60xx-support.patch | 8 +- ...om-Add-support-for-IPQ8074-Gen3-port.patch | 2 +- .../patches-5.15/410-bt-mtk-serial-fix.patch | 2 +- ...move-drivers-from-strlcpy-to-strscpy.patch | 2 +- .../901-arm-add-cmdline-override.patch | 2 +- ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 2 +- ...ethernet-mediatek-support-net-labels.patch | 4 +- .../850-awake-rt305x-dwc2-controller.patch | 2 +- 95 files changed, 214 insertions(+), 571 deletions(-) delete mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch delete mode 100644 target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch delete mode 100644 target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch delete mode 100644 target/linux/generic/pending-5.15/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch delete mode 100644 target/linux/ipq807x/patches-5.15/0048-v6.1-clk-qcom-reset-Allow-specifying-custom-reset-delay.patch delete mode 100644 target/linux/ipq807x/patches-5.15/0049-v6.2-clk-qcom-reset-support-resetting-multiple-bits.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index bf681e2edbe858..3052c783a955f8 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .120 -LINUX_KERNEL_HASH-5.15.120 = 6499089eae6b271063cb3e873ab7f4ba0543cfb21dcc9c54d9bcf5357db683f6 +LINUX_VERSION-5.15 = .123 +LINUX_KERNEL_HASH-5.15.123 = 2de69544a12e6a059163c58fc901c13bcf22e8cac39c66b56f8fbb633399bf93 diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 55539d7d539113..f542c32d45d3f2 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -750,7 +750,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4152,14 +4152,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4158,14 +4158,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-5.15/950-0062-pinctrl-bcm2835-Set-base-to-0-give-expected-gpio-num.patch b/target/linux/bcm27xx/patches-5.15/950-0062-pinctrl-bcm2835-Set-base-to-0-give-expected-gpio-num.patch index e4aef40745b033..6aa1bda1db0e22 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0062-pinctrl-bcm2835-Set-base-to-0-give-expected-gpio-num.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0062-pinctrl-bcm2835-Set-base-to-0-give-expected-gpio-num.patch @@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -376,7 +376,7 @@ static const struct gpio_chip bcm2835_gp +@@ -374,7 +374,7 @@ static const struct gpio_chip bcm2835_gp .get = bcm2835_gpio_get, .set = bcm2835_gpio_set, .set_config = gpiochip_generic_config, @@ -29,7 +29,7 @@ Signed-off-by: Phil Elwell .ngpio = BCM2835_NUM_GPIOS, .can_sleep = false, .of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback, -@@ -393,7 +393,7 @@ static const struct gpio_chip bcm2711_gp +@@ -391,7 +391,7 @@ static const struct gpio_chip bcm2711_gp .get = bcm2835_gpio_get, .set = bcm2835_gpio_set, .set_config = gpiochip_generic_config, diff --git a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch index f296bb3ff735d6..182cf1b9980a20 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch @@ -303,7 +303,7 @@ bcm2835-mmc: uninitialized_var is no more } --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -105,6 +105,14 @@ static const struct mmc_fixup __maybe_un +@@ -119,6 +119,14 @@ static const struct mmc_fixup __maybe_un MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd, MMC_QUIRK_BROKEN_SD_DISCARD), diff --git a/target/linux/bcm27xx/patches-5.15/950-0166-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-5.15/950-0166-xhci-Use-more-event-ring-segment-table-entries.patch index b3ad5672262146..53dc6fdea59b91 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0166-xhci-Use-more-event-ring-segment-table-entries.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0166-xhci-Use-more-event-ring-segment-table-entries.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c -@@ -2520,9 +2520,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2541,9 +2541,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, * Event ring setup: Allocate a normal ring, but also setup * the event ring segment table (ERST). Section 4.9.3. */ @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell if (!xhci->event_ring) goto fail; if (xhci_check_trb_in_td_math(xhci) < 0) -@@ -2535,7 +2537,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2556,7 +2558,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, /* set ERST count with the number of entries in the segment table */ val = readl(&xhci->ir_set->erst_size); val &= ERST_SIZE_MASK; diff --git a/target/linux/bcm27xx/patches-5.15/950-0192-pinctrl-bcm2835-Remove-gpiochip-on-error.patch b/target/linux/bcm27xx/patches-5.15/950-0192-pinctrl-bcm2835-Remove-gpiochip-on-error.patch index 3c065b0ef10a5c..b1291105a9028b 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0192-pinctrl-bcm2835-Remove-gpiochip-on-error.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0192-pinctrl-bcm2835-Remove-gpiochip-on-error.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -1337,7 +1337,7 @@ static int bcm2835_pinctrl_probe(struct +@@ -1335,7 +1335,7 @@ static int bcm2835_pinctrl_probe(struct girq->default_type = IRQ_TYPE_NONE; girq->handler = handle_level_irq; diff --git a/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch b/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch index b4d5908aa0b74c..5c71f6895a5641 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch @@ -118,7 +118,7 @@ Signed-off-by: Joerg Quinten - MEDIA_BUS_FMT_RGB666_1X24_CPADHI --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -2472,6 +2472,38 @@ static const struct panel_desc innolux_a +@@ -2473,6 +2473,38 @@ static const struct panel_desc innolux_a .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE, }; @@ -157,7 +157,7 @@ Signed-off-by: Joerg Quinten static const struct drm_display_mode innolux_at070tn92_mode = { .clock = 33333, .hdisplay = 800, -@@ -4662,6 +4694,9 @@ static const struct of_device_id platfor +@@ -4664,6 +4696,9 @@ static const struct of_device_id platfor .compatible = "innolux,at043tn24", .data = &innolux_at043tn24, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch b/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch index 21aa2168ad9d8b..69298951446713 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -3761,6 +3761,31 @@ static const struct panel_desc qishenglo +@@ -3763,6 +3763,31 @@ static const struct panel_desc qishenglo .connector_type = DRM_MODE_CONNECTOR_DPI, }; @@ -47,7 +47,7 @@ Signed-off-by: Dave Stevenson static const struct display_timing rocktech_rk070er9427_timing = { .pixelclock = { 26400000, 33300000, 46800000 }, .hactive = { 800, 800, 800 }, -@@ -4841,6 +4866,9 @@ static const struct of_device_id platfor +@@ -4843,6 +4868,9 @@ static const struct of_device_id platfor .compatible = "qishenglong,gopher2b-lcd", .data = &qishenglong_gopher2b_lcd, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index cf9e3f512eaf7d..a0ec8f8b2b4448 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -50,11 +50,11 @@ Signed-off-by: Jonathan Bell addr = xhci_trb_virt_to_dma(new_seg, new_deq); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1906,6 +1906,7 @@ struct xhci_hcd { - #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) - #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) +@@ -1908,6 +1908,7 @@ struct xhci_hcd { #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) -+#define XHCI_AVOID_DQ_ON_LINK BIT_ULL(45) + #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) + #define XHCI_ZHAOXIN_HOST BIT_ULL(46) ++#define XHCI_AVOID_DQ_ON_LINK BIT_ULL(47) unsigned int num_active_eps; unsigned int limit_active_eps; diff --git a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch index 2b0030bd91d751..5c7a71b42b99a3 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch @@ -63,11 +63,11 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1908,6 +1908,7 @@ struct xhci_hcd { - #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) - #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) - #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(45) -+#define XHCI_VLI_TRB_CACHE_BUG BIT_ULL(46) +@@ -1910,6 +1910,7 @@ struct xhci_hcd { + #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) + #define XHCI_ZHAOXIN_HOST BIT_ULL(46) + #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(47) ++#define XHCI_VLI_TRB_CACHE_BUG BIT_ULL(48) unsigned int num_active_eps; unsigned int limit_active_eps; diff --git a/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch b/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch index 3b7ec4bf99d923..c6267905589eda 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch @@ -46,7 +46,7 @@ Acked-by: Maxime Ripard static const struct drm_display_mode giantplus_gpg482739qs5_mode = { .clock = 9000, .hdisplay = 480, -@@ -4704,6 +4730,9 @@ static const struct of_device_id platfor +@@ -4706,6 +4732,9 @@ static const struct of_device_id platfor .compatible = "friendlyarm,hd702e", .data = &friendlyarm_hd702e, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch index 5771cfb3d410c3..67a965eff3a056 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch @@ -86,11 +86,11 @@ Signed-off-by: Jonathan Bell first_trb = false; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1909,6 +1909,7 @@ struct xhci_hcd { - #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) - #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(45) - #define XHCI_VLI_TRB_CACHE_BUG BIT_ULL(46) -+#define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(47) +@@ -1911,6 +1911,7 @@ struct xhci_hcd { + #define XHCI_ZHAOXIN_HOST BIT_ULL(46) + #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(47) + #define XHCI_VLI_TRB_CACHE_BUG BIT_ULL(48) ++#define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(49) unsigned int num_active_eps; unsigned int limit_active_eps; diff --git a/target/linux/bcm27xx/patches-5.15/950-0801-pinctrl-bcm2835-Only-return-non-GPIOs-to-inputs.patch b/target/linux/bcm27xx/patches-5.15/950-0801-pinctrl-bcm2835-Only-return-non-GPIOs-to-inputs.patch index 831f54a0816487..b456c9fb1008fd 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0801-pinctrl-bcm2835-Only-return-non-GPIOs-to-inputs.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0801-pinctrl-bcm2835-Only-return-non-GPIOs-to-inputs.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -908,9 +908,12 @@ static int bcm2835_pmx_free(struct pinct +@@ -906,9 +906,12 @@ static int bcm2835_pmx_free(struct pinct unsigned offset) { struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); @@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell return 0; } -@@ -952,10 +955,7 @@ static void bcm2835_pmx_gpio_disable_fre +@@ -950,10 +953,7 @@ static void bcm2835_pmx_gpio_disable_fre struct pinctrl_gpio_range *range, unsigned offset) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch b/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch index 18c7a81f3a2e23..bfcbbe153b93de 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch @@ -59,7 +59,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c -@@ -1498,13 +1498,6 @@ drm_atomic_helper_wait_for_vblanks(struc +@@ -1507,13 +1507,6 @@ drm_atomic_helper_wait_for_vblanks(struc int i, ret; unsigned int crtc_mask = 0; @@ -73,7 +73,7 @@ Signed-off-by: Maxime Ripard for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { if (!new_crtc_state->active) continue; -@@ -2132,12 +2125,6 @@ int drm_atomic_helper_setup_commit(struc +@@ -2141,12 +2134,6 @@ int drm_atomic_helper_setup_commit(struc complete_all(&commit->flip_done); continue; } diff --git a/target/linux/bcm47xx/patches-5.15/791-tg3-no-pci-sleep.patch b/target/linux/bcm47xx/patches-5.15/791-tg3-no-pci-sleep.patch index 2c2f540695229c..fb78dca7588528 100644 --- a/target/linux/bcm47xx/patches-5.15/791-tg3-no-pci-sleep.patch +++ b/target/linux/bcm47xx/patches-5.15/791-tg3-no-pci-sleep.patch @@ -5,7 +5,7 @@ when a switch driver is in use. --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -4267,7 +4267,8 @@ static int tg3_power_down_prepare(struct +@@ -4268,7 +4268,8 @@ static int tg3_power_down_prepare(struct static void tg3_power_down(struct tg3 *tp) { pci_wake_from_d3(tp->pdev, tg3_flag(tp, WOL_ENABLE)); diff --git a/target/linux/bcm4908/patches-5.15/071-v6.1-0001-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch b/target/linux/bcm4908/patches-5.15/071-v6.1-0001-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch index 1cf761838c517e..85be40cef41538 100644 --- a/target/linux/bcm4908/patches-5.15/071-v6.1-0001-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch +++ b/target/linux/bcm4908/patches-5.15/071-v6.1-0001-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski @@ -720,6 +720,8 @@ static int bcm4908_enet_probe(struct pla SET_NETDEV_DEV(netdev, &pdev->dev); - err = of_get_mac_address(dev->of_node, netdev->dev_addr); + err = of_get_ethdev_address(dev->of_node, netdev); + if (err == -EPROBE_DEFER) + goto err_dma_free; if (err) diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch index 9c6f0b8e5341b4..3bb39dfd500437 100644 --- a/target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch +++ b/target/linux/bcm53xx/patches-5.15/036-v6.5-0001-ARM-dts-BCM5301X-Relicense-Rafa-s-code-to-the-GPL-2..patch @@ -460,7 +460,7 @@ Signed-off-by: Florian Fainelli }; }; -@@ -558,24 +390,4 @@ +@@ -557,24 +389,4 @@ }; }; }; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch deleted file mode 100644 index 4065db8366af15..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch +++ /dev/null @@ -1,32 +0,0 @@ -From d3c8e2c5757153bbfad70019ec1decbca86f3def Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 3 May 2023 14:28:30 +0200 -Subject: [PATCH] ARM: dts: BCM5301X: Drop "clock-names" from the SPI node -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There is no such property in the SPI controller binding documentation. -Also Linux driver doesn't look for it. - -This fixes: -arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: spi@18029200: Unevaluated properties are not allowed ('clock-names' was unexpected) - From schema: Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.yaml - -Signed-off-by: Rafał Miłecki -Link: https://lore.kernel.org/r/20230503122830.3200-1-zajec5@gmail.com -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/bcm5301x.dtsi | 1 - - 1 file changed, 1 deletion(-) - ---- a/arch/arm/boot/dts/bcm5301x.dtsi -+++ b/arch/arm/boot/dts/bcm5301x.dtsi -@@ -335,7 +335,6 @@ - "spi_lr_session_done", - "spi_lr_overread"; - clocks = <&iprocmed>; -- clock-names = "iprocmed"; - num-cs = <2>; - #address-cells = <1>; - #size-cells = <0>; diff --git a/target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch b/target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch deleted file mode 100644 index 805dcf54ebbda4..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch +++ /dev/null @@ -1,44 +0,0 @@ -From fd274b733bfdde3ca72f0fa2a37f032f3a8c402c Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Thu, 8 Jun 2023 17:36:29 +0200 -Subject: [PATCH] ARM: dts: BCM5301X: fix duplex-full => full-duplex - -this typo was found by the dtbs_check -| ports:port@5:fixed-link: 'oneOf' conditional failed, -| {'speed': [[1000]], 'duplex-full': True} is not of type 'array' -| 'duplex-full' does not match any of the regexes: 'pinctrl-[0-]..." - -this should have been full-duplex; - -Fixes: 935327a73553 ("ARM: dts: BCM5301X: Add DT for Meraki MR26") -Fixes: ec88a9c344d9 ("ARM: BCM5301X: Add DT for Meraki MR32") -Signed-off-by: Christian Lamparter -Link: https://lore.kernel.org/r/50522f45566951a9eabd22820647924cc6b4a264.1686238550.git.chunkeey@gmail.com -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 2 +- - arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - ---- a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts -+++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts -@@ -121,7 +121,7 @@ - - fixed-link { - speed = <1000>; -- duplex-full; -+ full-duplex; - }; - }; - }; ---- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts -+++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts -@@ -182,7 +182,7 @@ - - fixed-link { - speed = <1000>; -- duplex-full; -+ full-duplex; - }; - }; - }; diff --git a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index bcf4776c12a9e3..17013c75bad8c9 100644 --- a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -127,11 +127,11 @@ it on BCM4708 family. /* --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1906,6 +1906,7 @@ struct xhci_hcd { - #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) - #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) +@@ -1908,6 +1908,7 @@ struct xhci_hcd { #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) -+#define XHCI_FAKE_DOORBELL BIT_ULL(45) + #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) + #define XHCI_ZHAOXIN_HOST BIT_ULL(46) ++#define XHCI_FAKE_DOORBELL BIT_ULL(47) unsigned int num_active_eps; unsigned int limit_active_eps; diff --git a/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch b/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch index 690e85d34bec4f..99cd89ea002f43 100644 --- a/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch +++ b/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch @@ -53,7 +53,7 @@ Signed-off-by: Mark Brown map->format.format_write(map, reg, val); trace_regmap_hw_write_start(map, reg, 1); -@@ -2348,6 +2351,7 @@ static int _regmap_raw_multi_reg_write(s +@@ -2346,6 +2349,7 @@ static int _regmap_raw_multi_reg_write(s unsigned int reg = regs[i].reg; unsigned int val = regs[i].def; trace_regmap_hw_write_start(map, reg, 1); @@ -61,7 +61,7 @@ Signed-off-by: Mark Brown map->format.format_reg(u8, reg, map->reg_shift); u8 += reg_bytes + pad_bytes; map->format.format_val(u8, val, 0); -@@ -2675,6 +2679,7 @@ static int _regmap_raw_read(struct regma +@@ -2673,6 +2677,7 @@ static int _regmap_raw_read(struct regma return ret; } diff --git a/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch b/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch index ffde9e5d0c53d7..0f32288fcab5b3 100644 --- a/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch +++ b/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch @@ -58,7 +58,7 @@ Signed-off-by: Mark Brown reg >>= map->format.reg_downshift; map->format.format_write(map, reg, val); -@@ -2351,6 +2355,7 @@ static int _regmap_raw_multi_reg_write(s +@@ -2349,6 +2353,7 @@ static int _regmap_raw_multi_reg_write(s unsigned int reg = regs[i].reg; unsigned int val = regs[i].def; trace_regmap_hw_write_start(map, reg, 1); @@ -66,7 +66,7 @@ Signed-off-by: Mark Brown reg >>= map->format.reg_downshift; map->format.format_reg(u8, reg, map->reg_shift); u8 += reg_bytes + pad_bytes; -@@ -2679,6 +2684,7 @@ static int _regmap_raw_read(struct regma +@@ -2677,6 +2682,7 @@ static int _regmap_raw_read(struct regma return ret; } diff --git a/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch b/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch index 34b587f5582118..804f68d23c50a5 100644 --- a/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch +++ b/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch @@ -37,7 +37,7 @@ Signed-off-by: Mark Brown return map->bus->reg_write(map->bus_context, reg, val); } -@@ -2705,6 +2707,8 @@ static int _regmap_bus_reg_read(void *co +@@ -2703,6 +2705,8 @@ static int _regmap_bus_reg_read(void *co { struct regmap *map = context; @@ -46,7 +46,7 @@ Signed-off-by: Mark Brown return map->bus->reg_read(map->bus_context, reg, val); } -@@ -3080,6 +3084,8 @@ static int _regmap_update_bits(struct re +@@ -3078,6 +3082,8 @@ static int _regmap_update_bits(struct re *change = false; if (regmap_volatile(map, reg) && map->reg_update_bits) { diff --git a/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch index c83d659d1c06de..d6de92a487360f 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch @@ -225,7 +225,7 @@ Signed-off-by: Felix Fietkau if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { ret = device_reset(eth->dev); if (ret) { -@@ -3079,6 +3086,35 @@ free_netdev: +@@ -3072,6 +3079,35 @@ free_netdev: return err; } @@ -261,7 +261,7 @@ Signed-off-by: Felix Fietkau static int mtk_probe(struct platform_device *pdev) { struct device_node *mac_np; -@@ -3092,6 +3128,7 @@ static int mtk_probe(struct platform_dev +@@ -3085,6 +3121,7 @@ static int mtk_probe(struct platform_dev eth->soc = of_device_get_match_data(&pdev->dev); eth->dev = &pdev->dev; @@ -269,7 +269,7 @@ Signed-off-by: Felix Fietkau eth->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(eth->base)) return PTR_ERR(eth->base); -@@ -3140,6 +3177,16 @@ static int mtk_probe(struct platform_dev +@@ -3133,6 +3170,16 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch b/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch index 2f3a0827fe455b..06f948823612dd 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau static int mtk_msg_level = -1; module_param_named(msg_level, mtk_msg_level, int, 0); -@@ -3209,6 +3210,22 @@ static int mtk_probe(struct platform_dev +@@ -3202,6 +3203,22 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch b/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch index f18a816b7030d4..1951a1d6764f0f 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3301,10 +3301,11 @@ static int mtk_probe(struct platform_dev +@@ -3294,10 +3294,11 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch b/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch index 2609cbedec2e8e..9213f28b2a0aa4 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch @@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX && (trxd.rxd2 & RX_DMA_VTAG)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), -@@ -3301,7 +3307,7 @@ static int mtk_probe(struct platform_dev +@@ -3294,7 +3300,7 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch b/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch index a7c5f08f100dd5..5a7561798d55d2 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller mediatek,hifsys = <&hifsys>; --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3188,7 +3188,7 @@ static int mtk_probe(struct platform_dev +@@ -3181,7 +3181,7 @@ static int mtk_probe(struct platform_dev struct regmap *cci; cci = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, diff --git a/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch b/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch index f5206bba00b39c..5bf44cc772dcaa 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch @@ -85,7 +85,7 @@ Signed-off-by: David S. Miller eth->scratch_ring = NULL; eth->phy_scratch_ring = 0; } -@@ -3391,6 +3394,9 @@ static const struct mtk_soc_data mt2701_ +@@ -3384,6 +3387,9 @@ static const struct mtk_soc_data mt2701_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, @@ -95,7 +95,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7621_data = { -@@ -3399,6 +3405,9 @@ static const struct mtk_soc_data mt7621_ +@@ -3392,6 +3398,9 @@ static const struct mtk_soc_data mt7621_ .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -105,7 +105,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7622_data = { -@@ -3408,6 +3417,9 @@ static const struct mtk_soc_data mt7622_ +@@ -3401,6 +3410,9 @@ static const struct mtk_soc_data mt7622_ .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -115,7 +115,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7623_data = { -@@ -3416,6 +3428,9 @@ static const struct mtk_soc_data mt7623_ +@@ -3409,6 +3421,9 @@ static const struct mtk_soc_data mt7623_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .offload_version = 2, @@ -125,7 +125,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7629_data = { -@@ -3424,6 +3439,9 @@ static const struct mtk_soc_data mt7629_ +@@ -3417,6 +3432,9 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -135,7 +135,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data rt5350_data = { -@@ -3431,6 +3449,9 @@ static const struct mtk_soc_data rt5350_ +@@ -3424,6 +3442,9 @@ static const struct mtk_soc_data rt5350_ .hw_features = MTK_HW_FEATURES_MT7628, .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch b/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch index ec206f28d64c5a..127312baeca240 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch @@ -34,7 +34,7 @@ Signed-off-by: David S. Miller ring->dma = NULL; } } -@@ -3406,6 +3405,7 @@ static const struct mtk_soc_data mt2701_ +@@ -3399,6 +3398,7 @@ static const struct mtk_soc_data mt2701_ .required_pctl = true, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -42,7 +42,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3417,6 +3417,7 @@ static const struct mtk_soc_data mt7621_ +@@ -3410,6 +3410,7 @@ static const struct mtk_soc_data mt7621_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -50,7 +50,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3429,6 +3430,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3422,6 +3423,7 @@ static const struct mtk_soc_data mt7622_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3440,6 +3442,7 @@ static const struct mtk_soc_data mt7623_ +@@ -3433,6 +3435,7 @@ static const struct mtk_soc_data mt7623_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -66,7 +66,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3451,6 +3454,7 @@ static const struct mtk_soc_data mt7629_ +@@ -3444,6 +3447,7 @@ static const struct mtk_soc_data mt7629_ .required_pctl = false, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -74,7 +74,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3461,6 +3465,7 @@ static const struct mtk_soc_data rt5350_ +@@ -3454,6 +3458,7 @@ static const struct mtk_soc_data rt5350_ .required_pctl = false, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), diff --git a/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch b/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch index 272f782877f788..d694578b33e1a9 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch @@ -507,7 +507,7 @@ Signed-off-by: David S. Miller mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); return 0; -@@ -3171,14 +3234,6 @@ static int mtk_probe(struct platform_dev +@@ -3164,14 +3227,6 @@ static int mtk_probe(struct platform_dev if (IS_ERR(eth->base)) return PTR_ERR(eth->base); @@ -522,7 +522,7 @@ Signed-off-by: David S. Miller if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { eth->rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA; eth->ip_align = NET_IP_ALIGN; -@@ -3412,6 +3467,7 @@ static int mtk_remove(struct platform_de +@@ -3405,6 +3460,7 @@ static int mtk_remove(struct platform_de } static const struct mtk_soc_data mt2701_data = { @@ -530,7 +530,7 @@ Signed-off-by: David S. Miller .caps = MT7623_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, -@@ -3423,6 +3479,7 @@ static const struct mtk_soc_data mt2701_ +@@ -3416,6 +3472,7 @@ static const struct mtk_soc_data mt2701_ }; static const struct mtk_soc_data mt7621_data = { @@ -538,7 +538,7 @@ Signed-off-by: David S. Miller .caps = MT7621_CAPS, .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, -@@ -3435,6 +3492,7 @@ static const struct mtk_soc_data mt7621_ +@@ -3428,6 +3485,7 @@ static const struct mtk_soc_data mt7621_ }; static const struct mtk_soc_data mt7622_data = { @@ -546,7 +546,7 @@ Signed-off-by: David S. Miller .ana_rgc3 = 0x2028, .caps = MT7622_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, -@@ -3448,6 +3506,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3441,6 +3499,7 @@ static const struct mtk_soc_data mt7622_ }; static const struct mtk_soc_data mt7623_data = { @@ -554,7 +554,7 @@ Signed-off-by: David S. Miller .caps = MT7623_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, -@@ -3460,6 +3519,7 @@ static const struct mtk_soc_data mt7623_ +@@ -3453,6 +3512,7 @@ static const struct mtk_soc_data mt7623_ }; static const struct mtk_soc_data mt7629_data = { @@ -562,7 +562,7 @@ Signed-off-by: David S. Miller .ana_rgc3 = 0x128, .caps = MT7629_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, -@@ -3472,6 +3532,7 @@ static const struct mtk_soc_data mt7629_ +@@ -3465,6 +3525,7 @@ static const struct mtk_soc_data mt7629_ }; static const struct mtk_soc_data rt5350_data = { diff --git a/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch b/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch index 4d6c94b13b8e80..548d62a027143c 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch @@ -568,7 +568,7 @@ Signed-off-by: David S. Miller return 0; err_disable_pm: -@@ -3234,12 +3403,8 @@ static int mtk_probe(struct platform_dev +@@ -3227,12 +3396,8 @@ static int mtk_probe(struct platform_dev if (IS_ERR(eth->base)) return PTR_ERR(eth->base); @@ -582,7 +582,7 @@ Signed-off-by: David S. Miller spin_lock_init(ð->page_lock); spin_lock_init(ð->tx_irq_lock); -@@ -3475,6 +3640,10 @@ static const struct mtk_soc_data mt2701_ +@@ -3468,6 +3633,10 @@ static const struct mtk_soc_data mt2701_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -593,7 +593,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3488,6 +3657,10 @@ static const struct mtk_soc_data mt7621_ +@@ -3481,6 +3650,10 @@ static const struct mtk_soc_data mt7621_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -604,7 +604,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3502,6 +3675,10 @@ static const struct mtk_soc_data mt7622_ +@@ -3495,6 +3668,10 @@ static const struct mtk_soc_data mt7622_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -615,7 +615,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3515,6 +3692,10 @@ static const struct mtk_soc_data mt7623_ +@@ -3508,6 +3685,10 @@ static const struct mtk_soc_data mt7623_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -626,7 +626,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3528,6 +3709,10 @@ static const struct mtk_soc_data mt7629_ +@@ -3521,6 +3702,10 @@ static const struct mtk_soc_data mt7629_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -637,7 +637,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3540,6 +3725,10 @@ static const struct mtk_soc_data rt5350_ +@@ -3533,6 +3718,10 @@ static const struct mtk_soc_data rt5350_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), diff --git a/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch b/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch index a4698d7814d971..2df4b265a9b29e 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller }; void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) -@@ -3712,6 +3749,21 @@ static const struct mtk_soc_data mt7629_ +@@ -3705,6 +3742,21 @@ static const struct mtk_soc_data mt7629_ }, }; @@ -87,7 +87,7 @@ Signed-off-by: David S. Miller static const struct mtk_soc_data rt5350_data = { .reg_map = &mt7628_reg_map, .caps = MT7628_CAPS, -@@ -3734,6 +3786,7 @@ const struct of_device_id of_mtk_match[] +@@ -3727,6 +3779,7 @@ const struct of_device_id of_mtk_match[] { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, diff --git a/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch b/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch index d76df75dda8e71..2ad7b5792e9b66 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski skb->ip_summed = CHECKSUM_UNNECESSARY; else skb_checksum_none_assert(skb); -@@ -3759,6 +3765,7 @@ static const struct mtk_soc_data mt7986_ +@@ -3752,6 +3758,7 @@ static const struct mtk_soc_data mt7986_ .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), .rx_irq_done_mask = MTK_RX_DONE_INT_V2, diff --git a/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch b/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch index b6fe0dad4c8702..f6279bf13d8b74 100644 --- a/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch +++ b/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3355,6 +3355,26 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3348,6 +3348,26 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch b/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch index f695991ec1ff40..84c02992122057 100644 --- a/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch +++ b/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch @@ -72,7 +72,7 @@ Signed-off-by: David S. Miller .mac_pcs_get_state = mtk_mac_pcs_get_state, .mac_an_restart = mtk_mac_an_restart, .mac_config = mtk_mac_config, -@@ -3317,6 +3269,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3310,6 +3262,9 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch b/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch index cbff1bfbbc4c6b..a6fbde5c892067 100644 --- a/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch +++ b/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3269,6 +3269,10 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3262,6 +3262,10 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch b/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch index c0b4a61cb6e13d..63f4ef13e12017 100644 --- a/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch +++ b/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch @@ -16,7 +16,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3568,9 +3568,9 @@ static int mtk_probe(struct platform_dev +@@ -3561,9 +3561,9 @@ static int mtk_probe(struct platform_dev */ init_dummy_netdev(ð->dummy_dev); netif_napi_add(ð->dummy_dev, ð->tx_napi, mtk_napi_tx, diff --git a/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch b/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch index 5940ac27df9c43..ff3c422f26e38c 100644 --- a/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch +++ b/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch @@ -15,7 +15,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3264,7 +3264,6 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3257,7 +3257,6 @@ static int mtk_add_mac(struct mtk_eth *e /* mac config is not set */ mac->interface = PHY_INTERFACE_MODE_NA; diff --git a/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch b/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch index 78444903a8c20b..e9e3e1f745248c 100644 --- a/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch +++ b/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch @@ -38,7 +38,7 @@ Signed-off-by: Jakub Kicinski mcr &= ~(MAC_MCR_SPEED_100 | MAC_MCR_SPEED_1000 | MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | MAC_MCR_FORCE_RX_FC); -@@ -3268,9 +3278,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3261,9 +3271,7 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch b/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch index d94bdabd714f15..60e83a16513af7 100644 --- a/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch +++ b/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch @@ -257,7 +257,7 @@ Signed-off-by: David S. Miller static void ethsys_reset(struct mtk_eth *eth, u32 reset_bits) { regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL, -@@ -3005,6 +3122,12 @@ static int mtk_change_mtu(struct net_dev +@@ -2988,6 +3105,12 @@ static int mtk_change_mtu(struct net_dev struct mtk_eth *eth = mac->hw; u32 mcr_cur, mcr_new; @@ -270,7 +270,7 @@ Signed-off-by: David S. Miller if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK; -@@ -3332,6 +3455,7 @@ static const struct net_device_ops mtk_n +@@ -3314,6 +3437,7 @@ static const struct net_device_ops mtk_n .ndo_poll_controller = mtk_poll_controller, #endif .ndo_setup_tc = mtk_eth_setup_tc, diff --git a/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch b/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch index 58b49f28a25f46..8c134500117266 100644 --- a/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch +++ b/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller } mtk_tx_unmap(eth, tx_buf, true); -@@ -3478,6 +3627,7 @@ static const struct net_device_ops mtk_n +@@ -3460,6 +3609,7 @@ static const struct net_device_ops mtk_n #endif .ndo_setup_tc = mtk_eth_setup_tc, .ndo_bpf = mtk_xdp, diff --git a/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch b/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch index e93e0df544ac4d..3108d67da49c5e 100644 --- a/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch +++ b/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller MediaTek SoC family. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3488,11 +3488,18 @@ static void mtk_get_strings(struct net_d +@@ -3471,11 +3471,18 @@ static void mtk_get_strings(struct net_d int i; switch (stringset) { @@ -46,7 +46,7 @@ Signed-off-by: David S. Miller break; } } -@@ -3500,13 +3507,35 @@ static void mtk_get_strings(struct net_d +@@ -3483,13 +3490,35 @@ static void mtk_get_strings(struct net_d static int mtk_get_sset_count(struct net_device *dev, int sset) { switch (sset) { @@ -84,7 +84,7 @@ Signed-off-by: David S. Miller static void mtk_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { -@@ -3534,6 +3563,8 @@ static void mtk_get_ethtool_stats(struct +@@ -3517,6 +3546,8 @@ static void mtk_get_ethtool_stats(struct for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) *data_dst++ = *(data_src + mtk_ethtool_stats[i].offset); diff --git a/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch b/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch index f8bbea6c8586c6..dbc338cf351450 100644 --- a/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch +++ b/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch @@ -84,7 +84,7 @@ Signed-off-by: Lorenzo Bianconi refcount_set(ð->dma_refcnt, 1); } else -@@ -4048,7 +4053,9 @@ static int mtk_probe(struct platform_dev +@@ -4041,7 +4046,9 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch b/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch index 7bed2785c99b01..7cc0ab225ebeeb 100644 --- a/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch +++ b/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch @@ -44,7 +44,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4151,6 +4151,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4144,6 +4144,7 @@ static const struct mtk_soc_data mt7621_ .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -52,7 +52,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4169,6 +4170,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4162,6 +4163,7 @@ static const struct mtk_soc_data mt7622_ .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -60,7 +60,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4186,6 +4188,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4179,6 +4181,7 @@ static const struct mtk_soc_data mt7623_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .offload_version = 2, @@ -68,7 +68,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4219,6 +4222,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4212,6 +4215,7 @@ static const struct mtk_soc_data mt7986_ .caps = MT7986_CAPS, .required_clks = MT7986_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch b/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch index 93860e414573a4..6b21a82352e9cd 100644 --- a/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch +++ b/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch @@ -100,7 +100,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -4053,12 +4058,19 @@ static int mtk_probe(struct platform_dev +@@ -4046,12 +4051,19 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch b/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch index a4b285632e1a13..92de6e7963784e 100644 --- a/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch +++ b/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch @@ -39,7 +39,7 @@ Signed-off-by: Lorenzo Bianconi }; /* strings used by ethtool */ -@@ -3970,16 +3978,12 @@ static int mtk_probe(struct platform_dev +@@ -3963,16 +3971,12 @@ static int mtk_probe(struct platform_dev for (i = 0;; i++) { struct device_node *np = of_parse_phandle(pdev->dev.of_node, "mediatek,wed", i); diff --git a/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch b/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch index 2bce63c4c01b13..fdafba43d81cd4 100644 --- a/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch +++ b/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4168,6 +4168,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4161,6 +4161,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -29,7 +29,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4187,6 +4188,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4180,6 +4181,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -37,7 +37,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4205,6 +4207,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4198,6 +4200,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 2, .hash_offset = 2, diff --git a/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch b/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch index bfca7b20e453e9..f87fc4c451a414 100644 --- a/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch +++ b/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch @@ -26,7 +26,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3895,6 +3895,7 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -3888,6 +3888,7 @@ void mtk_eth_set_dma_device(struct mtk_e static int mtk_probe(struct platform_device *pdev) { @@ -34,7 +34,7 @@ Signed-off-by: Lorenzo Bianconi struct device_node *mac_np; struct mtk_eth *eth; int err, i; -@@ -3975,16 +3976,31 @@ static int mtk_probe(struct platform_dev +@@ -3968,16 +3969,31 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch b/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch index fedcb6ccd89953..50ea41240b8b50 100644 --- a/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch +++ b/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch @@ -49,7 +49,7 @@ Signed-off-by: Lorenzo Bianconi if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) mtk_ppe_check_skb(eth->ppe[0], skb, hash); -@@ -4184,7 +4185,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4177,7 +4178,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -58,7 +58,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4204,7 +4205,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4197,7 +4198,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -67,7 +67,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4223,7 +4224,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4216,7 +4217,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 2, .hash_offset = 2, @@ -76,7 +76,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4255,9 +4256,11 @@ static const struct mtk_soc_data mt7986_ +@@ -4248,9 +4249,11 @@ static const struct mtk_soc_data mt7986_ .reg_map = &mt7986_reg_map, .ana_rgc3 = 0x128, .caps = MT7986_CAPS, diff --git a/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch b/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch index e8bb85ac940eef..cd4747672de35a 100644 --- a/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch +++ b/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch @@ -16,7 +16,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4259,6 +4259,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4252,6 +4252,7 @@ static const struct mtk_soc_data mt7986_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7986_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch index b41318afd76de5..624e0178bf8c17 100644 --- a/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch +++ b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4011,19 +4011,23 @@ static int mtk_probe(struct platform_dev +@@ -4004,19 +4004,23 @@ static int mtk_probe(struct platform_dev eth->irq[i] = platform_get_irq(pdev, i); if (eth->irq[i] < 0) { dev_err(&pdev->dev, "no IRQ%d resource found\n", i); @@ -45,7 +45,7 @@ Signed-off-by: David S. Miller } eth->clks[i] = NULL; } -@@ -4034,7 +4038,7 @@ static int mtk_probe(struct platform_dev +@@ -4027,7 +4031,7 @@ static int mtk_probe(struct platform_dev err = mtk_hw_init(eth); if (err) @@ -54,7 +54,7 @@ Signed-off-by: David S. Miller eth->hwlro = MTK_HAS_CAPS(eth->soc->caps, MTK_HWLRO); -@@ -4132,6 +4136,8 @@ err_free_dev: +@@ -4125,6 +4129,8 @@ err_free_dev: mtk_free_dev(eth); err_deinit_hw: mtk_hw_deinit(eth); @@ -63,7 +63,7 @@ Signed-off-by: David S. Miller return err; } -@@ -4151,6 +4157,7 @@ static int mtk_remove(struct platform_de +@@ -4144,6 +4150,7 @@ static int mtk_remove(struct platform_de phylink_disconnect_phy(mac->phylink); } diff --git a/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch b/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch index 003ca9bae69969..78f5f1859e4fe5 100644 --- a/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch +++ b/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch @@ -63,7 +63,7 @@ Signed-off-by: David S. Miller /* Indicates CDM to parse the MTK special tag from CPU * which also is working out for untag packets. -@@ -3367,7 +3399,6 @@ static int mtk_change_mtu(struct net_dev +@@ -3350,7 +3382,6 @@ static int mtk_change_mtu(struct net_dev int length = new_mtu + MTK_RX_ETH_HLEN; struct mtk_mac *mac = netdev_priv(dev); struct mtk_eth *eth = mac->hw; @@ -71,7 +71,7 @@ Signed-off-by: David S. Miller if (rcu_access_pointer(eth->prog) && length > MTK_PP_MAX_BUF_SIZE) { -@@ -3375,23 +3406,7 @@ static int mtk_change_mtu(struct net_dev +@@ -3358,23 +3389,7 @@ static int mtk_change_mtu(struct net_dev return -EINVAL; } diff --git a/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch b/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch index 342ffb99d2f643..5b8768899dd160 100644 --- a/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch +++ b/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch @@ -12,7 +12,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3437,11 +3437,8 @@ static void mtk_pending_work(struct work +@@ -3420,11 +3420,8 @@ static void mtk_pending_work(struct work rtnl_lock(); dev_dbg(eth->dev, "[%s][%d] reset\n", __func__, __LINE__); @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller /* stop all devices to make sure that dma is properly shut down */ for (i = 0; i < MTK_MAC_COUNT; i++) { if (!eth->netdev[i]) -@@ -3475,7 +3472,7 @@ static void mtk_pending_work(struct work +@@ -3458,7 +3455,7 @@ static void mtk_pending_work(struct work dev_dbg(eth->dev, "[%s][%d] reset done\n", __func__, __LINE__); diff --git a/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch b/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch index c34e30c773e0a4..35004462d25248 100644 --- a/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch +++ b/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch @@ -87,7 +87,7 @@ Signed-off-by: Paolo Abeni if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { /* Set FE to PDMAv2 if necessary */ -@@ -3465,7 +3517,7 @@ static void mtk_pending_work(struct work +@@ -3448,7 +3500,7 @@ static void mtk_pending_work(struct work if (eth->dev->pins) pinctrl_select_state(eth->dev->pins->p, eth->dev->pins->default_state); @@ -96,7 +96,7 @@ Signed-off-by: Paolo Abeni /* restart DMA and enable IRQs */ for (i = 0; i < MTK_MAC_COUNT; i++) { -@@ -4057,7 +4109,7 @@ static int mtk_probe(struct platform_dev +@@ -4050,7 +4102,7 @@ static int mtk_probe(struct platform_dev eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); INIT_WORK(ð->pending_work, mtk_pending_work); diff --git a/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch b/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch index 29a5b6273900b2..f87b4c9e5b1fb1 100644 --- a/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch +++ b/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni return ret; } -@@ -3489,30 +3508,53 @@ static int mtk_do_ioctl(struct net_devic +@@ -3472,30 +3491,53 @@ static int mtk_do_ioctl(struct net_devic return -EOPNOTSUPP; } @@ -148,7 +148,7 @@ Signed-off-by: Paolo Abeni if (eth->dev->pins) pinctrl_select_state(eth->dev->pins->p, -@@ -3523,15 +3565,19 @@ static void mtk_pending_work(struct work +@@ -3506,15 +3548,19 @@ static void mtk_pending_work(struct work for (i = 0; i < MTK_MAC_COUNT; i++) { if (!test_bit(i, &restart)) continue; diff --git a/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch b/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch index cebb750bf64e39..bc8b9a33274716 100644 --- a/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch +++ b/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch @@ -152,7 +152,7 @@ Signed-off-by: Paolo Abeni static int mtk_hw_init(struct mtk_eth *eth, bool reset) { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | -@@ -3615,6 +3717,7 @@ static int mtk_cleanup(struct mtk_eth *e +@@ -3598,6 +3700,7 @@ static int mtk_cleanup(struct mtk_eth *e mtk_unreg_dev(eth); mtk_free_dev(eth); cancel_work_sync(ð->pending_work); @@ -160,7 +160,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -4042,6 +4145,7 @@ static int mtk_probe(struct platform_dev +@@ -4035,6 +4138,7 @@ static int mtk_probe(struct platform_dev eth->rx_dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE; INIT_WORK(ð->rx_dim.work, mtk_dim_rx); @@ -168,7 +168,7 @@ Signed-off-by: Paolo Abeni eth->tx_dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE; INIT_WORK(ð->tx_dim.work, mtk_dim_tx); -@@ -4246,6 +4350,8 @@ static int mtk_probe(struct platform_dev +@@ -4239,6 +4343,8 @@ static int mtk_probe(struct platform_dev NAPI_POLL_WEIGHT); platform_set_drvdata(pdev, eth); diff --git a/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch b/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch index 2eca26867088b6..ae0e0e959106fa 100644 --- a/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch +++ b/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch @@ -14,7 +14,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3646,6 +3646,11 @@ static void mtk_pending_work(struct work +@@ -3629,6 +3629,11 @@ static void mtk_pending_work(struct work set_bit(MTK_RESETTING, ð->state); mtk_prepare_for_reset(eth); @@ -26,7 +26,7 @@ Signed-off-by: Paolo Abeni /* stop all devices to make sure that dma is properly shut down */ for (i = 0; i < MTK_MAC_COUNT; i++) { -@@ -3683,6 +3688,8 @@ static void mtk_pending_work(struct work +@@ -3666,6 +3671,8 @@ static void mtk_pending_work(struct work clear_bit(MTK_RESETTING, ð->state); diff --git a/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch b/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch index 32dc5c37832c99..1e1ac560db7691 100644 --- a/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch +++ b/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4428,7 +4428,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4421,7 +4421,7 @@ static const struct mtk_soc_data mt7621_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau .hash_offset = 2, .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { -@@ -4467,7 +4467,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4460,7 +4460,7 @@ static const struct mtk_soc_data mt7623_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, diff --git a/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch b/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch index cfbd510c8f2ef7..2e2299c932fcf0 100644 --- a/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch +++ b/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch @@ -489,7 +489,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3717,8 +3873,12 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3700,8 +3856,12 @@ static int mtk_unreg_dev(struct mtk_eth int i; for (i = 0; i < MTK_MAC_COUNT; i++) { @@ -502,7 +502,7 @@ Signed-off-by: Felix Fietkau unregister_netdev(eth->netdev[i]); } -@@ -3935,6 +4095,23 @@ static int mtk_set_rxnfc(struct net_devi +@@ -3918,6 +4078,23 @@ static int mtk_set_rxnfc(struct net_devi return ret; } @@ -526,7 +526,7 @@ Signed-off-by: Felix Fietkau static const struct ethtool_ops mtk_ethtool_ops = { .get_link_ksettings = mtk_get_link_ksettings, .set_link_ksettings = mtk_set_link_ksettings, -@@ -3970,6 +4147,7 @@ static const struct net_device_ops mtk_n +@@ -3952,6 +4129,7 @@ static const struct net_device_ops mtk_n .ndo_setup_tc = mtk_eth_setup_tc, .ndo_bpf = mtk_xdp, .ndo_xdp_xmit = mtk_xdp_xmit, @@ -534,7 +534,7 @@ Signed-off-by: Felix Fietkau }; static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) -@@ -3979,6 +4157,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3961,6 +4139,7 @@ static int mtk_add_mac(struct mtk_eth *e struct phylink *phylink; struct mtk_mac *mac; int id, err; @@ -542,7 +542,7 @@ Signed-off-by: Felix Fietkau if (!_id) { dev_err(eth->dev, "missing mac id\n"); -@@ -3996,7 +4175,10 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3978,7 +4157,10 @@ static int mtk_add_mac(struct mtk_eth *e return -EINVAL; } @@ -554,7 +554,7 @@ Signed-off-by: Felix Fietkau if (!eth->netdev[id]) { dev_err(eth->dev, "alloc_etherdev failed\n"); return -ENOMEM; -@@ -4093,6 +4275,11 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4086,6 +4268,11 @@ static int mtk_add_mac(struct mtk_eth *e else eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; diff --git a/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch b/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch index beba07238fdb7d..6ebd1abcd0f20b 100644 --- a/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch +++ b/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch @@ -146,7 +146,7 @@ Signed-off-by: Felix Fietkau /* Enable RX VLan Offloading */ mtk_w32(eth, 1, MTK_CDMP_EG_CTRL); -@@ -3865,6 +3925,12 @@ static int mtk_free_dev(struct mtk_eth * +@@ -3848,6 +3908,12 @@ static int mtk_free_dev(struct mtk_eth * free_netdev(eth->netdev[i]); } diff --git a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch index c1cf323800c36e..36fa94a790533e 100644 --- a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch @@ -51,7 +51,7 @@ Signed-off-by: Jakub Kicinski mtk_eth_path_name(path), __func__, updated); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4755,6 +4755,26 @@ static const struct mtk_soc_data mt7629_ +@@ -4748,6 +4748,26 @@ static const struct mtk_soc_data mt7629_ }, }; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski static const struct mtk_soc_data mt7986_data = { .reg_map = &mt7986_reg_map, .ana_rgc3 = 0x128, -@@ -4797,6 +4817,7 @@ const struct of_device_id of_mtk_match[] +@@ -4790,6 +4810,7 @@ const struct of_device_id of_mtk_match[] { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, diff --git a/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch b/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch index 203c5dc48bb0fc..2e6a70d7255e16 100644 --- a/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch @@ -60,7 +60,7 @@ Signed-off-by: Jakub Kicinski } return NULL; -@@ -3977,8 +3978,17 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3960,8 +3961,17 @@ static int mtk_unreg_dev(struct mtk_eth return 0; } @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski mtk_unreg_dev(eth); mtk_free_dev(eth); cancel_work_sync(ð->pending_work); -@@ -4408,6 +4418,36 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -4401,6 +4411,36 @@ void mtk_eth_set_dma_device(struct mtk_e rtnl_unlock(); } @@ -115,7 +115,7 @@ Signed-off-by: Jakub Kicinski static int mtk_probe(struct platform_device *pdev) { struct resource *res = NULL; -@@ -4471,13 +4511,7 @@ static int mtk_probe(struct platform_dev +@@ -4464,13 +4504,7 @@ static int mtk_probe(struct platform_dev } if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) { @@ -130,7 +130,7 @@ Signed-off-by: Jakub Kicinski if (err) return err; -@@ -4488,14 +4522,17 @@ static int mtk_probe(struct platform_dev +@@ -4481,14 +4515,17 @@ static int mtk_probe(struct platform_dev "mediatek,pctl"); if (IS_ERR(eth->pctl)) { dev_err(&pdev->dev, "no pctl regmap found\n"); @@ -151,7 +151,7 @@ Signed-off-by: Jakub Kicinski } if (eth->soc->offload_version) { -@@ -4655,6 +4692,8 @@ err_deinit_hw: +@@ -4648,6 +4685,8 @@ err_deinit_hw: mtk_hw_deinit(eth); err_wed_exit: mtk_wed_exit(); diff --git a/target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch b/target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch deleted file mode 100644 index 26e9ae3bcd2204..00000000000000 --- a/target/linux/generic/backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch +++ /dev/null @@ -1,45 +0,0 @@ -From e7731194fdf085f46d58b1adccfddbd0dfee4873 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 7 Jul 2023 08:53:25 +0200 -Subject: [PATCH] net: bgmac: postpone turning IRQs off to avoid SoC hangs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Turning IRQs off is done by accessing Ethernet controller registers. -That can't be done until device's clock is enabled. It results in a SoC -hang otherwise. - -This bug remained unnoticed for years as most bootloaders keep all -Ethernet interfaces turned on. It seems to only affect a niche SoC -family BCM47189. It has two Ethernet controllers but CFE bootloader uses -only the first one. - -Fixes: 34322615cbaa ("net: bgmac: Mask interrupts during probe") -Signed-off-by: Rafał Miłecki -Reviewed-by: Michal Kubiak -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1492,8 +1492,6 @@ int bgmac_enet_probe(struct bgmac *bgmac - - bgmac->in_init = true; - -- bgmac_chip_intrs_off(bgmac); -- - net_dev->irq = bgmac->irq; - SET_NETDEV_DEV(net_dev, bgmac->dev); - dev_set_drvdata(bgmac->dev, bgmac); -@@ -1511,6 +1509,8 @@ int bgmac_enet_probe(struct bgmac *bgmac - */ - bgmac_clk_enable(bgmac, 0); - -+ bgmac_chip_intrs_off(bgmac); -+ - /* This seems to be fixing IRQ by assigning OOB #6 to the core */ - if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) { - if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6) diff --git a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch index 9b9ab04af6cb43..3c9d4e72e85271 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch @@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_tx_descriptors(priv, queue); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -7417,6 +7412,25 @@ int stmmac_suspend(struct device *dev) +@@ -7411,6 +7406,25 @@ int stmmac_suspend(struct device *dev) } EXPORT_SYMBOL_GPL(stmmac_suspend); @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski /** * stmmac_reset_queues_param - reset queue parameters * @priv: device pointer -@@ -7427,22 +7441,11 @@ static void stmmac_reset_queues_param(st +@@ -7421,22 +7435,11 @@ static void stmmac_reset_queues_param(st u32 tx_cnt = priv->plat->tx_queues_to_use; u32 queue; diff --git a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch index d4c2567a1fdfc4..34b7e1fd8d199e 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch @@ -1210,7 +1210,7 @@ Signed-off-by: Jakub Kicinski if (netif_running(dev)) ret = stmmac_open(dev); -@@ -7363,7 +7367,7 @@ int stmmac_suspend(struct device *dev) +@@ -7357,7 +7361,7 @@ int stmmac_suspend(struct device *dev) stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1219,7 +1219,7 @@ Signed-off-by: Jakub Kicinski if (priv->eee_enabled) { priv->tx_path_in_lpi_mode = false; -@@ -7414,7 +7418,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); +@@ -7408,7 +7412,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1228,7 +1228,7 @@ Signed-off-by: Jakub Kicinski rx_q->cur_rx = 0; rx_q->dirty_rx = 0; -@@ -7422,7 +7426,7 @@ static void stmmac_reset_rx_queue(struct +@@ -7416,7 +7420,7 @@ static void stmmac_reset_rx_queue(struct static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue) { diff --git a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch index e84373b47180b9..a7ee50ddd02b45 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch @@ -1150,7 +1150,7 @@ Signed-off-by: Jakub Kicinski dma_desc_error: return ret; } -@@ -7509,7 +7625,7 @@ int stmmac_resume(struct device *dev) +@@ -7503,7 +7619,7 @@ int stmmac_resume(struct device *dev) stmmac_reset_queues_param(priv); stmmac_free_tx_skbufs(priv); diff --git a/target/linux/generic/hack-5.15/204-module_strip.patch b/target/linux/generic/hack-5.15/204-module_strip.patch index dd5d93e22673e7..31bfe07c78ccd0 100644 --- a/target/linux/generic/hack-5.15/204-module_strip.patch +++ b/target/linux/generic/hack-5.15/204-module_strip.patch @@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c -@@ -2036,7 +2036,9 @@ static void read_symbols(const char *mod +@@ -2000,7 +2000,9 @@ static void read_symbols(const char *mod symname = remove_dot(info.strtab + sym->st_name); handle_symbol(mod, &info, sym, symname); @@ -153,7 +153,7 @@ Signed-off-by: Felix Fietkau } for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { -@@ -2215,8 +2217,10 @@ static void add_header(struct buffer *b, +@@ -2179,8 +2181,10 @@ static void add_header(struct buffer *b, buf_printf(b, "BUILD_SALT;\n"); buf_printf(b, "BUILD_LTO_INFO;\n"); buf_printf(b, "\n"); @@ -164,7 +164,7 @@ Signed-off-by: Felix Fietkau buf_printf(b, "\n"); buf_printf(b, "__visible struct module __this_module\n"); buf_printf(b, "__section(\".gnu.linkonce.this_module\") = {\n"); -@@ -2233,8 +2237,10 @@ static void add_header(struct buffer *b, +@@ -2197,8 +2201,10 @@ static void add_header(struct buffer *b, static void add_intree_flag(struct buffer *b, int is_intree) { @@ -175,7 +175,7 @@ Signed-off-by: Felix Fietkau } /* Cannot check for assembler */ -@@ -2247,8 +2253,10 @@ static void add_retpoline(struct buffer +@@ -2211,8 +2217,10 @@ static void add_retpoline(struct buffer static void add_staging_flag(struct buffer *b, const char *name) { @@ -186,7 +186,7 @@ Signed-off-by: Felix Fietkau } /** -@@ -2328,11 +2336,13 @@ static void add_depends(struct buffer *b +@@ -2292,11 +2300,13 @@ static void add_depends(struct buffer *b static void add_srcversion(struct buffer *b, struct module *mod) { @@ -200,7 +200,7 @@ Signed-off-by: Felix Fietkau } static void write_buf(struct buffer *b, const char *fname) -@@ -2581,7 +2591,9 @@ int main(int argc, char **argv) +@@ -2545,7 +2555,9 @@ int main(int argc, char **argv) add_staging_flag(&buf, mod->name); add_versions(&buf, mod); add_depends(&buf, mod); diff --git a/target/linux/generic/hack-5.15/259-regmap_dynamic.patch b/target/linux/generic/hack-5.15/259-regmap_dynamic.patch index e0820ccfc0dbf3..76a5ace6f31536 100644 --- a/target/linux/generic/hack-5.15/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-5.15/259-regmap_dynamic.patch @@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -3360,3 +3361,5 @@ static int __init regmap_initcall(void) +@@ -3358,3 +3359,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 96d800669a81e6..a44a5b6d89c8ca 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1173,6 +1175,11 @@ static const struct usb_device_id option +@@ -1177,6 +1179,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index 12e99280289159..b1c1c8171c122c 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3866,6 +3866,8 @@ static __net_initdata struct pernet_oper +@@ -3877,6 +3877,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { diff --git a/target/linux/generic/pending-5.15/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch b/target/linux/generic/pending-5.15/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch deleted file mode 100644 index e5a86dd29fe174..00000000000000 --- a/target/linux/generic/pending-5.15/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch +++ /dev/null @@ -1,121 +0,0 @@ -From eee53f6eb7561f516b9c4bac829ce31c48096130 Mon Sep 17 00:00:00 2001 -From: Fabian Frederick -Date: Tue, 9 May 2017 22:30:03 +0200 -Subject: [PATCH] jffs2: reduce stack usage in jffs2_build_xattr_subsystem() - -Use kcalloc() for allocation/flush of 128 pointers table to -reduce stack usage. - -Function now returns -ENOMEM or 0 on success. - -stackusage -Before: -./fs/jffs2/xattr.c:775 jffs2_build_xattr_subsystem 1208 -dynamic,bounded - -After: -./fs/jffs2/xattr.c:775 jffs2_build_xattr_subsystem 192 -dynamic,bounded - -Also update definition when CONFIG_JFFS2_FS_XATTR is not enabled - -Tested with an MTD mount point and some user set/getfattr. - -Many current target on OpenWRT also suffer from a compilation warning -(that become an error with CONFIG_WERROR) with the following output: - -fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem': -fs/jffs2/xattr.c:887:1: error: the frame size of 1088 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] - 887 | } - | ^ - -Using dynamic allocation fix this compilation warning. - -Fixes: c9f700f840bd ("[JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion") -Reported-by: Tim Gardner -Reported-by: kernel test robot -Reported-by: Ron Economos -Reported-by: Nathan Chancellor -Reviewed-by: Nick Desaulniers -Signed-off-by: Fabian Frederick -Signed-off-by: Christian Marangi -Cc: stable@vger.kernel.org ---- - fs/jffs2/build.c | 5 ++++- - fs/jffs2/xattr.c | 13 +++++++++---- - fs/jffs2/xattr.h | 4 ++-- - 3 files changed, 15 insertions(+), 7 deletions(-) - ---- a/fs/jffs2/build.c -+++ b/fs/jffs2/build.c -@@ -211,7 +211,10 @@ static int jffs2_build_filesystem(struct - ic->scan_dents = NULL; - cond_resched(); - } -- jffs2_build_xattr_subsystem(c); -+ ret = jffs2_build_xattr_subsystem(c); -+ if (ret) -+ goto exit; -+ - c->flags &= ~JFFS2_SB_FLAG_BUILDING; - - dbg_fsbuild("FS build complete\n"); ---- a/fs/jffs2/xattr.c -+++ b/fs/jffs2/xattr.c -@@ -772,10 +772,10 @@ void jffs2_clear_xattr_subsystem(struct - } - - #define XREF_TMPHASH_SIZE (128) --void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c) -+int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c) - { - struct jffs2_xattr_ref *ref, *_ref; -- struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE]; -+ struct jffs2_xattr_ref **xref_tmphash; - struct jffs2_xattr_datum *xd, *_xd; - struct jffs2_inode_cache *ic; - struct jffs2_raw_node_ref *raw; -@@ -784,9 +784,12 @@ void jffs2_build_xattr_subsystem(struct - - BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING)); - -+ xref_tmphash = kcalloc(XREF_TMPHASH_SIZE, -+ sizeof(struct jffs2_xattr_ref *), GFP_KERNEL); -+ if (!xref_tmphash) -+ return -ENOMEM; -+ - /* Phase.1 : Merge same xref */ -- for (i=0; i < XREF_TMPHASH_SIZE; i++) -- xref_tmphash[i] = NULL; - for (ref=c->xref_temp; ref; ref=_ref) { - struct jffs2_xattr_ref *tmp; - -@@ -884,6 +887,8 @@ void jffs2_build_xattr_subsystem(struct - "%u of xref (%u dead, %u orphan) found.\n", - xdatum_count, xdatum_unchecked_count, xdatum_orphan_count, - xref_count, xref_dead_count, xref_orphan_count); -+ kfree(xref_tmphash); -+ return 0; - } - - struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, ---- a/fs/jffs2/xattr.h -+++ b/fs/jffs2/xattr.h -@@ -71,7 +71,7 @@ static inline int is_xattr_ref_dead(stru - #ifdef CONFIG_JFFS2_FS_XATTR - - extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c); --extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c); -+extern int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c); - extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c); - - extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, -@@ -103,7 +103,7 @@ extern ssize_t jffs2_listxattr(struct de - #else - - #define jffs2_init_xattr_subsystem(c) --#define jffs2_build_xattr_subsystem(c) -+#define jffs2_build_xattr_subsystem(c) (0) - #define jffs2_clear_xattr_subsystem(c) - - #define jffs2_xattr_do_crccheck_inode(c, ic) diff --git a/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch b/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch index fe6faddc7d7fb2..f6ae9f31f1fa5d 100644 --- a/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch +++ b/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch @@ -20,7 +20,7 @@ Signed-off-by: Ansuel Smith --- a/net/core/of_net.c +++ b/net/core/of_net.c -@@ -119,27 +119,62 @@ static int of_get_mac_addr_nvmem(struct +@@ -119,28 +119,63 @@ static int of_get_mac_addr_nvmem(struct * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists * but is all zeros. * @@ -87,3 +87,4 @@ Signed-off-by: Ansuel Smith + return ret; } EXPORT_SYMBOL(of_get_mac_address); + diff --git a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index a4e3d2650333eb..2bc78fa05e56cc 100644 --- a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -4673,6 +4673,8 @@ static int mtk_probe(struct platform_dev +@@ -4666,6 +4666,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch index 7e8ed5455d9867..8e335967eaea57 100644 --- a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch +++ b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch @@ -161,7 +161,7 @@ Signed-off-by: Felix Fietkau struct rtnl_link { rtnl_doit_func doit; -@@ -4706,7 +4706,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu +@@ -4712,7 +4712,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu brport_nla_put_flag(skb, flags, mask, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD) || brport_nla_put_flag(skb, flags, mask, diff --git a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch index 60c32b67057a93..91ffd65c6cbfe1 100644 --- a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch +++ b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch @@ -53,7 +53,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4642,8 +4642,8 @@ static int mtk_probe(struct platform_dev +@@ -4635,8 +4635,8 @@ static int mtk_probe(struct platform_dev for (i = 0; i < num_ppe; i++) { u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; @@ -64,7 +64,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov if (!eth->ppe[i]) { err = -ENOMEM; goto err_free_dev; -@@ -4770,6 +4770,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4763,6 +4763,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -72,7 +72,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4807,6 +4808,7 @@ static const struct mtk_soc_data mt7629_ +@@ -4800,6 +4801,7 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -80,7 +80,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4827,6 +4829,7 @@ static const struct mtk_soc_data mt7981_ +@@ -4820,6 +4822,7 @@ static const struct mtk_soc_data mt7981_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), @@ -88,7 +88,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), -@@ -4847,6 +4850,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4840,6 +4843,7 @@ static const struct mtk_soc_data mt7986_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), diff --git a/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch b/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch index 35b296a2553274..f6c70e7e6aff02 100644 --- a/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch +++ b/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch @@ -180,7 +180,7 @@ Signed-off-by: Felix Fietkau /* set interrupt delays based on current Net DIM sample */ mtk_dim_rx(ð->rx_dim.work); -@@ -4365,7 +4334,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4358,7 +4327,7 @@ static int mtk_add_mac(struct mtk_eth *e eth->netdev[id]->hw_features |= NETIF_F_LRO; eth->netdev[id]->vlan_features = eth->soc->hw_features & diff --git a/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch b/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch index a8debc41bfb3ce..837a8bf0ad256d 100644 --- a/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch +++ b/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3989,7 +3989,10 @@ static void mtk_sgmii_destroy(struct mtk +@@ -3972,7 +3972,10 @@ static void mtk_sgmii_destroy(struct mtk { int i; @@ -27,7 +27,7 @@ Signed-off-by: Daniel Golle mtk_pcs_lynxi_destroy(eth->sgmii_pcs[i]); } -@@ -4432,7 +4435,12 @@ static int mtk_sgmii_init(struct mtk_eth +@@ -4425,7 +4428,12 @@ static int mtk_sgmii_init(struct mtk_eth u32 flags; int i; @@ -41,7 +41,7 @@ Signed-off-by: Daniel Golle np = of_parse_phandle(eth->dev->of_node, "mediatek,sgmiisys", i); if (!np) break; -@@ -4477,6 +4485,18 @@ static int mtk_probe(struct platform_dev +@@ -4470,6 +4478,18 @@ static int mtk_probe(struct platform_dev if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) eth->ip_align = NET_IP_ALIGN; @@ -60,7 +60,7 @@ Signed-off-by: Daniel Golle spin_lock_init(ð->page_lock); spin_lock_init(ð->tx_irq_lock); spin_lock_init(ð->rx_irq_lock); -@@ -4662,7 +4682,7 @@ static int mtk_probe(struct platform_dev +@@ -4655,7 +4675,7 @@ static int mtk_probe(struct platform_dev goto err_free_dev; } @@ -69,7 +69,7 @@ Signed-off-by: Daniel Golle if (!eth->netdev[i]) continue; -@@ -4739,6 +4759,7 @@ static const struct mtk_soc_data mt2701_ +@@ -4732,6 +4752,7 @@ static const struct mtk_soc_data mt2701_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, @@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4757,6 +4778,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4750,6 +4771,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 1, .hash_offset = 2, @@ -85,7 +85,7 @@ Signed-off-by: Daniel Golle .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4778,6 +4800,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4771,6 +4793,7 @@ static const struct mtk_soc_data mt7622_ .offload_version = 2, .hash_offset = 2, .has_accounting = true, @@ -93,7 +93,7 @@ Signed-off-by: Daniel Golle .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4797,6 +4820,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4790,6 +4813,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 1, .hash_offset = 2, @@ -101,7 +101,7 @@ Signed-off-by: Daniel Golle .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4816,6 +4840,7 @@ static const struct mtk_soc_data mt7629_ +@@ -4809,6 +4833,7 @@ static const struct mtk_soc_data mt7629_ .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, .has_accounting = true, @@ -109,7 +109,7 @@ Signed-off-by: Daniel Golle .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4837,6 +4862,7 @@ static const struct mtk_soc_data mt7981_ +@@ -4830,6 +4855,7 @@ static const struct mtk_soc_data mt7981_ .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), .has_accounting = true, @@ -117,7 +117,7 @@ Signed-off-by: Daniel Golle .txrx = { .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), -@@ -4856,6 +4882,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4849,6 +4875,7 @@ static const struct mtk_soc_data mt7986_ .required_pctl = false, .offload_version = 2, .hash_offset = 4, @@ -125,7 +125,7 @@ Signed-off-by: Daniel Golle .foe_entry_size = sizeof(struct mtk_foe_entry), .has_accounting = true, .txrx = { -@@ -4874,6 +4901,7 @@ static const struct mtk_soc_data rt5350_ +@@ -4867,6 +4894,7 @@ static const struct mtk_soc_data rt5350_ .hw_features = MTK_HW_FEATURES_MT7628, .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch b/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch index d6b36bf6368933..b11915ec104736 100644 --- a/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch +++ b/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch @@ -78,7 +78,7 @@ Signed-off-by: Daniel Golle struct net_device *dev = eth->netdev[i]; mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i)); -@@ -3909,7 +3909,7 @@ static void mtk_pending_work(struct work +@@ -3892,7 +3892,7 @@ static void mtk_pending_work(struct work mtk_prepare_for_reset(eth); /* stop all devices to make sure that dma is properly shut down */ @@ -87,7 +87,7 @@ Signed-off-by: Daniel Golle if (!eth->netdev[i] || !netif_running(eth->netdev[i])) continue; -@@ -3925,7 +3925,7 @@ static void mtk_pending_work(struct work +@@ -3908,7 +3908,7 @@ static void mtk_pending_work(struct work mtk_hw_init(eth, true); /* restart DMA and enable IRQs */ @@ -96,7 +96,7 @@ Signed-off-by: Daniel Golle if (!test_bit(i, &restart)) continue; -@@ -3953,7 +3953,7 @@ static int mtk_free_dev(struct mtk_eth * +@@ -3936,7 +3936,7 @@ static int mtk_free_dev(struct mtk_eth * { int i; @@ -105,7 +105,7 @@ Signed-off-by: Daniel Golle if (!eth->netdev[i]) continue; free_netdev(eth->netdev[i]); -@@ -3972,7 +3972,7 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3955,7 +3955,7 @@ static int mtk_unreg_dev(struct mtk_eth { int i; @@ -114,7 +114,7 @@ Signed-off-by: Daniel Golle struct mtk_mac *mac; if (!eth->netdev[i]) continue; -@@ -4277,7 +4277,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4259,7 +4259,7 @@ static int mtk_add_mac(struct mtk_eth *e } id = be32_to_cpup(_id); @@ -123,7 +123,7 @@ Signed-off-by: Daniel Golle dev_err(eth->dev, "%d is not a valid mac id\n", id); return -EINVAL; } -@@ -4407,7 +4407,7 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -4400,7 +4400,7 @@ void mtk_eth_set_dma_device(struct mtk_e rtnl_lock(); @@ -132,7 +132,7 @@ Signed-off-by: Daniel Golle dev = eth->netdev[i]; if (!dev || !(dev->flags & IFF_UP)) -@@ -4734,7 +4734,7 @@ static int mtk_remove(struct platform_de +@@ -4727,7 +4727,7 @@ static int mtk_remove(struct platform_de int i; /* stop all devices to make sure that dma is properly shut down */ diff --git a/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch b/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch index 80d729db17ff16..54b3fd024a4447 100644 --- a/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch +++ b/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch @@ -182,7 +182,7 @@ Signed-off-by: Daniel Golle /* PSE should not drop port8 and port9 packets from WDMA Tx */ mtk_w32(eth, 0x00000300, PSE_DROP_CFG); -@@ -4314,7 +4379,11 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4307,7 +4372,11 @@ static int mtk_add_mac(struct mtk_eth *e } spin_lock_init(&mac->hw_stats->stats_lock); u64_stats_init(&mac->hw_stats->syncp); diff --git a/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch b/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch index 504d2ea22664d6..e8402c0974c434 100644 --- a/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch +++ b/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch @@ -150,7 +150,7 @@ mtk_eth_soc driver. data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid); WRITE_ONCE(desc->txd4, data); -@@ -4964,6 +5065,25 @@ static const struct mtk_soc_data mt7986_ +@@ -4957,6 +5058,25 @@ static const struct mtk_soc_data mt7986_ }, }; @@ -176,7 +176,7 @@ mtk_eth_soc driver. static const struct mtk_soc_data rt5350_data = { .reg_map = &mt7628_reg_map, .caps = MT7628_CAPS, -@@ -4982,14 +5102,15 @@ static const struct mtk_soc_data rt5350_ +@@ -4975,14 +5095,15 @@ static const struct mtk_soc_data rt5350_ }; const struct of_device_id of_mtk_match[] = { diff --git a/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index 0185bed089774d..4518bcb510a5a4 100644 --- a/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -607,7 +607,7 @@ Signed-off-by: Daniel Golle mtk_w32(eth, val, MTK_PPSC); dev_dbg(eth->dev, "MDC is running on %d Hz\n", MDC_MAX_FREQ / divider); -@@ -4433,8 +4636,8 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4415,8 +4618,8 @@ static int mtk_add_mac(struct mtk_eth *e const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; @@ -617,7 +617,7 @@ Signed-off-by: Daniel Golle int txqs = 1; if (!_id) { -@@ -4525,6 +4728,32 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4518,6 +4721,32 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.supported_interfaces); } @@ -650,7 +650,7 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4712,6 +4941,13 @@ static int mtk_probe(struct platform_dev +@@ -4705,6 +4934,13 @@ static int mtk_probe(struct platform_dev if (err) return err; diff --git a/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch index 6f28e19a48351a..f2bfd14b18de31 100644 --- a/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch +++ b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch @@ -17,7 +17,7 @@ Signed-off-by: Alexander Duyck --- a/net/core/skbuff.c +++ b/net/core/skbuff.c -@@ -4347,6 +4347,15 @@ int skb_gro_receive(struct sk_buff *p, s +@@ -4352,6 +4352,15 @@ int skb_gro_receive(struct sk_buff *p, s if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush)) return -E2BIG; diff --git a/target/linux/ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch b/target/linux/ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch index 05778a638f84a6..c7688de7e896a7 100644 --- a/target/linux/ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch +++ b/target/linux/ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch @@ -116,21 +116,17 @@ spi-max-frequency = <24000000>; }; }; -@@ -103,9 +129,48 @@ +@@ -102,6 +128,45 @@ + status = "okay"; perst-gpio = <&tlmm 38 0x1>; }; - ++ + i2c0: i2c@78b7000 { /* BLSP1 QUP2 */ + pinctrl-0 = <&i2c_0_pins>; + pinctrl-names = "default"; + + status = "okay"; + }; -+ - qpic-nand@79b0000 { - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - }; + + usb3_ss_phy: ssphy@9a000 { + status = "okay"; @@ -165,3 +161,4 @@ + }; }; }; + diff --git a/target/linux/ipq807x/patches-5.15/0048-v6.1-clk-qcom-reset-Allow-specifying-custom-reset-delay.patch b/target/linux/ipq807x/patches-5.15/0048-v6.1-clk-qcom-reset-Allow-specifying-custom-reset-delay.patch deleted file mode 100644 index 6a525f2c3e6a18..00000000000000 --- a/target/linux/ipq807x/patches-5.15/0048-v6.1-clk-qcom-reset-Allow-specifying-custom-reset-delay.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 72bc31aa621e21a7c36a7da8aa6f6a77bb234e0b Mon Sep 17 00:00:00 2001 -From: Stephan Gerhold -Date: Wed, 6 Jul 2022 15:41:29 +0200 -Subject: [PATCH] clk: qcom: reset: Allow specifying custom reset delay - -The amount of time required between asserting and deasserting the reset -signal can vary depending on the involved hardware component. Sometimes -1 us might not be enough and a larger delay is necessary to conform to -the specifications. - -Usually this is worked around in the consuming drivers, by replacing -reset_control_reset() with a sequence of reset_control_assert(), waiting -for a custom delay, followed by reset_control_deassert(). - -However, in some cases the driver making use of the reset is generic and -can be used with different reset controllers. In this case the reset -time requirement is better handled directly by the reset controller -driver. - -Make this possible by adding an "udelay" field to the qcom_reset_map -that allows setting a different reset delay (in microseconds). - -Signed-off-by: Stephan Gerhold -Signed-off-by: Bjorn Andersson -Link: https://lore.kernel.org/r/20220706134132.3623415-4-stephan.gerhold@kernkonzept.com ---- - drivers/clk/qcom/reset.c | 4 +++- - drivers/clk/qcom/reset.h | 1 + - 2 files changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/clk/qcom/reset.c -+++ b/drivers/clk/qcom/reset.c -@@ -13,8 +13,10 @@ - - static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id) - { -+ struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev); -+ - rcdev->ops->assert(rcdev, id); -- udelay(1); -+ udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */ - rcdev->ops->deassert(rcdev, id); - return 0; - } ---- a/drivers/clk/qcom/reset.h -+++ b/drivers/clk/qcom/reset.h -@@ -11,6 +11,7 @@ - struct qcom_reset_map { - unsigned int reg; - u8 bit; -+ u8 udelay; - }; - - struct regmap; diff --git a/target/linux/ipq807x/patches-5.15/0049-v6.2-clk-qcom-reset-support-resetting-multiple-bits.patch b/target/linux/ipq807x/patches-5.15/0049-v6.2-clk-qcom-reset-support-resetting-multiple-bits.patch deleted file mode 100644 index e0725a66129323..00000000000000 --- a/target/linux/ipq807x/patches-5.15/0049-v6.2-clk-qcom-reset-support-resetting-multiple-bits.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 813ba3e427671ba3ff35c825087b03f0ad91cf02 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 7 Nov 2022 14:28:59 +0100 -Subject: [PATCH] clk: qcom: reset: support resetting multiple bits - -This patch adds the support for giving the complete bitmask -in reset structure and reset operation will use this bitmask -for all reset operations. - -Currently, reset structure only takes a single bit for each reset -and then calculates the bitmask by using the BIT() macro. - -However, this is not sufficient anymore for newer SoC-s like IPQ8074, -IPQ6018 and more, since their networking resets require multiple bits -to be asserted in order to properly reset the HW block completely. - -So, in order to allow asserting multiple bits add "bitmask" field to -qcom_reset_map, and then use that bitmask value if its populated in the -driver, if its not populated, then we just default to existing behaviour -and calculate the bitmask on the fly. - -Signed-off-by: Robert Marko -Signed-off-by: Bjorn Andersson -Link: https://lore.kernel.org/r/20221107132901.489240-1-robimarko@gmail.com ---- - drivers/clk/qcom/reset.c | 4 ++-- - drivers/clk/qcom/reset.h | 1 + - 2 files changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/clk/qcom/reset.c -+++ b/drivers/clk/qcom/reset.c -@@ -30,7 +30,7 @@ qcom_reset_assert(struct reset_controlle - - rst = to_qcom_reset_controller(rcdev); - map = &rst->reset_map[id]; -- mask = BIT(map->bit); -+ mask = map->bitmask ? map->bitmask : BIT(map->bit); - - return regmap_update_bits(rst->regmap, map->reg, mask, mask); - } -@@ -44,7 +44,7 @@ qcom_reset_deassert(struct reset_control - - rst = to_qcom_reset_controller(rcdev); - map = &rst->reset_map[id]; -- mask = BIT(map->bit); -+ mask = map->bitmask ? map->bitmask : BIT(map->bit); - - return regmap_update_bits(rst->regmap, map->reg, mask, 0); - } ---- a/drivers/clk/qcom/reset.h -+++ b/drivers/clk/qcom/reset.h -@@ -12,6 +12,7 @@ struct qcom_reset_map { - unsigned int reg; - u8 bit; - u8 udelay; -+ u32 bitmask; - }; - - struct regmap; diff --git a/target/linux/ipq807x/patches-5.15/0076-v5.16-PCI-qcom-Replace-ops-with-struct-pcie_cfg-in-pcie-ma.patch b/target/linux/ipq807x/patches-5.15/0076-v5.16-PCI-qcom-Replace-ops-with-struct-pcie_cfg-in-pcie-ma.patch index b29512fb76f522..817a3c64c9341d 100644 --- a/target/linux/ipq807x/patches-5.15/0076-v5.16-PCI-qcom-Replace-ops-with-struct-pcie_cfg-in-pcie-ma.patch +++ b/target/linux/ipq807x/patches-5.15/0076-v5.16-PCI-qcom-Replace-ops-with-struct-pcie_cfg-in-pcie-ma.patch @@ -30,7 +30,7 @@ Reviewed-by: Stephen Boyd struct qcom_pcie { struct dw_pcie *pci; void __iomem *parf; /* DT parf */ -@@ -1467,6 +1471,38 @@ static const struct qcom_pcie_ops ops_1_ +@@ -1469,6 +1473,38 @@ static const struct qcom_pcie_ops ops_1_ .config_sid = qcom_pcie_config_sid_sm8250, }; @@ -69,7 +69,7 @@ Reviewed-by: Stephen Boyd static const struct dw_pcie_ops dw_pcie_ops = { .link_up = qcom_pcie_link_up, .start_link = qcom_pcie_start_link, -@@ -1478,6 +1514,7 @@ static int qcom_pcie_probe(struct platfo +@@ -1480,6 +1516,7 @@ static int qcom_pcie_probe(struct platfo struct pcie_port *pp; struct dw_pcie *pci; struct qcom_pcie *pcie; @@ -77,7 +77,7 @@ Reviewed-by: Stephen Boyd int ret; pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); -@@ -1499,7 +1536,13 @@ static int qcom_pcie_probe(struct platfo +@@ -1501,7 +1538,13 @@ static int qcom_pcie_probe(struct platfo pcie->pci = pci; @@ -92,7 +92,7 @@ Reviewed-by: Stephen Boyd pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_HIGH); if (IS_ERR(pcie->reset)) { -@@ -1555,16 +1598,17 @@ err_pm_runtime_put: +@@ -1557,16 +1600,17 @@ err_pm_runtime_put: } static const struct of_device_id qcom_pcie_match[] = { diff --git a/target/linux/ipq807x/patches-5.15/0077-v6.0-PCI-qcom-Add-IPQ60xx-support.patch b/target/linux/ipq807x/patches-5.15/0077-v6.0-PCI-qcom-Add-IPQ60xx-support.patch index af8ba2a4e13dfa..6881ed6d2511cd 100644 --- a/target/linux/ipq807x/patches-5.15/0077-v6.0-PCI-qcom-Add-IPQ60xx-support.patch +++ b/target/linux/ipq807x/patches-5.15/0077-v6.0-PCI-qcom-Add-IPQ60xx-support.patch @@ -70,7 +70,7 @@ Acked-by: Stanimir Varbanov }; struct qcom_pcie; -@@ -1280,6 +1290,112 @@ static void qcom_pcie_post_deinit_2_7_0( +@@ -1282,6 +1292,112 @@ static void qcom_pcie_post_deinit_2_7_0( clk_disable_unprepare(res->pipe_clk); } @@ -183,7 +183,7 @@ Acked-by: Stanimir Varbanov static int qcom_pcie_link_up(struct dw_pcie *pci) { u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); -@@ -1471,6 +1587,15 @@ static const struct qcom_pcie_ops ops_1_ +@@ -1473,6 +1589,15 @@ static const struct qcom_pcie_ops ops_1_ .config_sid = qcom_pcie_config_sid_sm8250, }; @@ -199,7 +199,7 @@ Acked-by: Stanimir Varbanov static const struct qcom_pcie_cfg apq8084_cfg = { .ops = &ops_1_0_0, }; -@@ -1503,6 +1628,10 @@ static const struct qcom_pcie_cfg sc7280 +@@ -1505,6 +1630,10 @@ static const struct qcom_pcie_cfg sc7280 .ops = &ops_1_9_0, }; @@ -210,7 +210,7 @@ Acked-by: Stanimir Varbanov static const struct dw_pcie_ops dw_pcie_ops = { .link_up = qcom_pcie_link_up, .start_link = qcom_pcie_start_link, -@@ -1609,6 +1738,7 @@ static const struct of_device_id qcom_pc +@@ -1611,6 +1740,7 @@ static const struct of_device_id qcom_pc { .compatible = "qcom,pcie-sdm845", .data = &sdm845_cfg }, { .compatible = "qcom,pcie-sm8250", .data = &sm8250_cfg }, { .compatible = "qcom,pcie-sc7280", .data = &sc7280_cfg }, diff --git a/target/linux/ipq807x/patches-5.15/0107-PCI-qcom-Add-support-for-IPQ8074-Gen3-port.patch b/target/linux/ipq807x/patches-5.15/0107-PCI-qcom-Add-support-for-IPQ8074-Gen3-port.patch index c7a7e7ab49a4a4..ae6b1482100d09 100644 --- a/target/linux/ipq807x/patches-5.15/0107-PCI-qcom-Add-support-for-IPQ8074-Gen3-port.patch +++ b/target/linux/ipq807x/patches-5.15/0107-PCI-qcom-Add-support-for-IPQ8074-Gen3-port.patch @@ -13,7 +13,7 @@ Signed-off-by: Robert Marko --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c -@@ -1733,6 +1733,7 @@ static const struct of_device_id qcom_pc +@@ -1735,6 +1735,7 @@ static const struct of_device_id qcom_pc { .compatible = "qcom,pcie-apq8064", .data = &ipq8064_cfg }, { .compatible = "qcom,pcie-msm8996", .data = &msm8996_cfg }, { .compatible = "qcom,pcie-ipq8074", .data = &ipq8074_cfg }, diff --git a/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch index 3f4597c65d68f8..bfa90f3849c6c3 100644 --- a/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch +++ b/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch @@ -19,7 +19,7 @@ }, [PORT_NPCM] = { .name = "Nuvoton 16550", -@@ -2766,6 +2766,11 @@ serial8250_do_set_termios(struct uart_po +@@ -2763,6 +2763,11 @@ serial8250_do_set_termios(struct uart_po unsigned long flags; unsigned int baud, quot, frac = 0; diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index 1520a6cbe6d191..44d3753b142d25 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -425,7 +425,7 @@ Signed-off-by: Wolfram Sang if (ret) --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c -@@ -1878,7 +1878,7 @@ nodma: +@@ -1885,7 +1885,7 @@ nodma: qup->adap.dev.of_node = pdev->dev.of_node; qup->is_last = true; diff --git a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch index 6016128bd4a200..636452bebb8587 100644 --- a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch @@ -37,7 +37,7 @@ * managed to set the command line, unless CONFIG_CMDLINE_FORCE --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig -@@ -1942,6 +1942,14 @@ config CMDLINE_FORCE +@@ -1983,6 +1983,14 @@ config CMDLINE_FORCE endchoice diff --git a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch index 5b0db92d9e49f0..842bed4c427f7d 100644 --- a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch +++ b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch @@ -22,7 +22,7 @@ Signed-off-by: Tim Harvey #include #include #include -@@ -5854,3 +5855,34 @@ static void nvidia_ion_ahci_fixup(struct +@@ -5856,3 +5857,34 @@ static void nvidia_ion_ahci_fixup(struct pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); diff --git a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch index e57e6fa83b25ce..fce5fc856f49bc 100644 --- a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4633,6 +4633,7 @@ static const struct net_device_ops mtk_n +@@ -4615,6 +4615,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -4791,6 +4792,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4784,6 +4785,9 @@ static int mtk_add_mac(struct mtk_eth *e register_netdevice_notifier(&mac->device_notifier); } diff --git a/target/linux/ramips/patches-5.15/850-awake-rt305x-dwc2-controller.patch b/target/linux/ramips/patches-5.15/850-awake-rt305x-dwc2-controller.patch index 3f2a524a75b276..5fb3664ae53e78 100644 --- a/target/linux/ramips/patches-5.15/850-awake-rt305x-dwc2-controller.patch +++ b/target/linux/ramips/patches-5.15/850-awake-rt305x-dwc2-controller.patch @@ -1,6 +1,6 @@ --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c -@@ -498,6 +498,12 @@ static int dwc2_driver_probe(struct plat +@@ -508,6 +508,12 @@ static int dwc2_driver_probe(struct plat if (retval) return retval; From c697057b7ca17b5c80bcfb266e7c00eb699c8608 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 9 Jun 2023 13:39:52 +0200 Subject: [PATCH 0314/1171] mediatek: add support for Acer Predator W6 Hardware -------- SOC: MediaTek MT7986A RAM: 1GB DDR4 FLASH: 4GB eMMC WiFi: 2x2 2.4 GHz 802.11 b/g/n/ax MT7916 DBDC 4x4 5 GHz 802.11 a/n/ac/ax MT7986 2x2 6 GHz 802.11ax MT7916 DBDC ETH: 4x LAN 1Gbit/s (MT7531) 1x WAN 2.5Gbit/s (GPY211) BTN: RESET, WPS LED: Antenna LEDs (GPIO) Mood-LED (Kinetic KTD2601) - unsupported UART: Header nest to USB port - 3V3 115200 8N1 [BUTTON] GND - RX - TX [USB] Installation ------------ 1. Connect to the device using serial console. 2. Interrupt the Autoboot process when promted by sending '0' twice. 3. Serve the OpenWrt initramfs image using TFTP at 192.168.1.66. Name the image "predator.bin" and conenct the TFTP server to the routers LAN port. 4. Configure U-Boot to allow loading unsigned images from MMC $ setenv bootcmd 'mmc read 0x40000000 0x00004400 0x0010000; fdt addr $(fdtcontroladdr); fdt rm /signature; bootm 0x40000000'; saveenv 5. Transfer the image from U-Boot $ setenv serverip 192.168.1.66; setenv ipaddr 192.168.1.1; tftpboot 0x46000000 predator.bin; fdt addr $(fdtcontroladdr); fdt rm /signature; bootm 6. Wait for OpenWrt to boot 7. Transfer the OpenWrt sysupgrade image to the router using scp. 8. Install OpenWrt using sysupgrade. Signed-off-by: David Bauer (cherry picked from commit 7e7eb5312d7810084547bb54a4b6867c2da08182) --- .../mediatek/dts/mt7986a-acer-predator-w6.dts | 503 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 + .../etc/hotplug.d/firmware/11-mt76-caldata | 14 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 6 + .../lib/preinit/05_extract_factory_data.sh | 25 + .../base-files/lib/preinit/10_fix_eth_mac.sh | 8 + .../base-files/lib/upgrade/platform.sh | 5 + target/linux/mediatek/image/filogic.mk | 15 + 8 files changed, 579 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts create mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/05_extract_factory_data.sh diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts new file mode 100644 index 00000000000000..35a2c30bb45476 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts @@ -0,0 +1,503 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "Acer Predator W6"; + compatible = "acer,predator-w6", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "dm-mod.create=\"dm-verity,,,ro,0 31544 verity 1 PARTLABEL=rootfs PARTLABEL=rootfs 4096 4096 3943 3944 sha256 2f969fa9e9e4e20b37746f22633e85b178f5db7c143e11f92733a704299cc933 2dd56e34b15c6c84573cf26c4392028421061d2c808975217b45e9a5b49d2087\" rootfstype=squashfs,ext4 rootwait root=/dev/mmcblk0p6 fstools_ignore_partname=1"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + gpio-keys { + compatible = "gpio-keys"; + + factory { + label = "factory"; + linux,code = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; + + + leds { + compatible = "gpio-leds"; + + led_status: led@0 { + label = "ant0:red"; + gpios = <&pio 1 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@1 { + label = "ant0:green"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@2 { + label = "ant0:blue"; + gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@3 { + label = "ant1:red"; + gpios = <&pio 35 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@4 { + label = "ant1:green"; + gpios = <&pio 34 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@5 { + label = "ant1:blue"; + gpios = <&pio 33 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@6 { + label = "ant2:red"; + gpios = <&pio 38 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@7 { + label = "ant2:green"; + gpios = <&pio 37 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@8 { + label = "ant2:blue"; + gpios = <&pio 26 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@9 { + label = "ant3:red"; + gpios = <&pio 25 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@10 { + label = "ant3:green"; + gpios = <&pio 24 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@11 { + label = "ant3:blue"; + gpios = <&pio 23 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@12 { + label = "ant4:red"; + gpios = <&pio 28 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@13 { + label = "ant4:green"; + gpios = <&pio 27 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@14 { + label = "ant4:blue"; + gpios = <&pio 32 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@15 { + label = "ant5:red"; + gpios = <&pio 45 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@16 { + label = "ant5:green"; + gpios = <&pio 44 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@17 { + label = "ant5:blue"; + gpios = <&pio 43 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + /* LAN */ + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + /* WAN */ + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + + /* LED0: nc ; LED1: nc ; LED2: Amber ; LED3: Green */ + mxl,led-config = <0x0 0x0 0x370 0x80>; + }; + + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + }; +}; + +&pio { + mmc0_pins_default: mmc0-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + mmc0_pins_uhs: mmc0-uhs-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + pcie_pins: pcie-pins { + mux { + function = "pcie"; + groups = "pcie_pereset"; + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "game"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy@0 { + reg = <0>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0xc001 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@1 { + reg = <1>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0xc001 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@2 { + reg = <2>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0xc001 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@3 { + reg = <3>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0xc001 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + }; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; +}; + +&trng { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&mmc0 { + status = "okay"; + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <0x08>; + max-frequency = <200000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + mmc-hs400-1_8v; + hs400-ds-delay = <0x14014>; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; + non-removable; + no-sd; + no-sdio; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 3b170ddc1885fc..2ce5fb687b67e5 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -8,6 +8,9 @@ mediatek_setup_interfaces() local board="$1" case $board in + acer,predator-w6) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 + ;; asus,tuf-ax4200) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index 0fe4c6998870cf..c3d7c099740546 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -7,6 +7,20 @@ board=$(board_name) case "$FIRMWARE" in +"mediatek/mt7916_eeprom.bin") + case "$board" in + acer,predator-w6) + caldata_extract_mmc "factory" 0xA0000 0x1000 + ;; + esac + ;; +"mediatek/mt7986_eeprom_mt7976.bin") + case "$board" in + acer,predator-w6) + caldata_extract_mmc "factory" 0x0 0x1000 + ;; + esac + ;; "mediatek/mt7986_eeprom_mt7976_dbdc.bin") case "$board" in asus,tuf-ax4200) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 3620e3a6fbc032..ebf76640c876ec 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -10,6 +10,12 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in + acer,predator-w6) + key_path="/var/qcidata/data" + [ "$PHYNBR" = "0" ] && cat $key_path/2gMAC > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && cat $key_path/6gMAC > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && cat $key_path/5gMAC > /sys${DEVPATH}/macaddress + ;; asus,tuf-ax4200) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/05_extract_factory_data.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/05_extract_factory_data.sh new file mode 100644 index 00000000000000..87287a7d1c1c98 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/05_extract_factory_data.sh @@ -0,0 +1,25 @@ +. /lib/functions/system.sh + +predator_w6_factory_extract() { + local mmc_part + + mmc_part="$(find_mmc_part qcidata)" + + mkdir -p /var/qcidata/data + mkdir -p /var/qcidata/mount + + mount -r "$mmc_part" /var/qcidata/mount + + cp /var/qcidata/mount/factory/*MAC "/var/qcidata/data/" + umount "/var/qcidata/mount" +} + +preinit_extract_factory() { + case $(board_name) in + acer,predator-w6) + predator_w6_factory_extract + ;; + esac +} + +boot_hook_add preinit_main preinit_extract_factory diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index cfddd9cedcccc5..69d0ab6c60c54f 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -2,6 +2,14 @@ preinit_set_mac_address() { case $(board_name) in + acer,predator-w6) + key_path="/var/qcidata/data" + ip link set dev lan1 address "$(cat $key_path/LANMAC)" + ip link set dev lan2 address "$(cat $key_path/LANMAC)" + ip link set dev lan3 address "$(cat $key_path/LANMAC)" + ip link set dev game address "$(cat $key_path/LANMAC)" + ip link set dev eth1 address "$(cat $key_path/WANMAC)" + ;; asus,tuf-ax4200) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 186abfa5a8d82e..2b58cf2b43b434 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -42,6 +42,11 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in + acer,predator-w6) + CI_KERNPART="kernel" + CI_ROOTPART="rootfs" + emmc_do_upgrade "$1" + ;; asus,tuf-ax4200) CI_UBIPART="UBI_DEV" CI_KERNPART="linux" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index c41cba3a642dce..643435235d27b9 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -98,6 +98,21 @@ define Device/asus_tuf-ax4200 endef TARGET_DEVICES += asus_tuf-ax4200 +define Device/acer_predator-w6 + DEVICE_VENDOR := Acer + DEVICE_MODEL := Predator W6 + DEVICE_DTS := mt7986a-acer-predator-w6 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware kmod-mt7916-firmware mt7986-wo-firmware + IMAGES := sysupgrade.bin + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += acer_predator-w6 + define Device/bananapi_bpi-r3 DEVICE_VENDOR := Bananapi DEVICE_MODEL := BPi-R3 From d0fc9e96be5a26869ee0d273894889e21651865c Mon Sep 17 00:00:00 2001 From: Hank Moretti Date: Thu, 20 Jul 2023 17:42:58 +0000 Subject: [PATCH 0315/1171] uboot-mediatek: add support for Xiaomi WR30U Add a custom uboot build to support openwrt uboot layout. Signed-off-by: Hank Moretti --- .../uboot-envtools/files/mediatek_filogic | 2 + package/boot/uboot-mediatek/Makefile | 13 + .../434-add-xiaomi_mi-router-wr30u.patch | 456 ++++++++++++++++++ 3 files changed, 471 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 77c9d964db37b6..81b1283690cc4e 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -47,6 +47,7 @@ mercusys,mr90x-v1) netgear,wax220) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x20000" "0x20000" ;; +xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000" @@ -56,6 +57,7 @@ qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ +xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) . /lib/upgrade/nand.sh local envubi=$(nand_find_ubi ubi) diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 33fd7e086e8b8f..55965e64dbb8e2 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -200,6 +200,18 @@ define U-Boot/mt7981_qihoo_360t7 DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_xiaomi_mi-router-wr30u + NAME:=Xiaomi Router WR30U + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=xiaomi_mi-router-wr30u-ubootmod + UBOOT_CONFIG:=mt7981_xiaomi_mi-router-wr30u + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + define U-Boot/mt7986_rfb NAME:=MT7986 Reference Board BUILD_SUBTARGET:=filogic @@ -327,6 +339,7 @@ UBOOT_TARGETS := \ mt7629_rfb \ mt7981_h3c_magic-nx30-pro \ mt7981_qihoo_360t7 \ + mt7981_xiaomi_mi-router-wr30u \ mt7986_bananapi_bpi-r3-emmc \ mt7986_bananapi_bpi-r3-sdmmc \ mt7986_bananapi_bpi-r3-snand \ diff --git a/package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch b/package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch new file mode 100644 index 00000000000000..6be64e54216709 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch @@ -0,0 +1,456 @@ +--- /dev/null ++++ b/configs/mt7981_xiaomi_mi-router-wr30u_defconfig +@@ -0,0 +1,175 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981_xiaomi_mi-router-wr30u" ++CONFIG_DEFAULT_ENV_FILE="xiaomi_mi-router-wr30u_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_xiaomi_mi-router-wr30u.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_AHCI=y ++CONFIG_AHCI_PCI=y ++CONFIG_SCSI_AHCI=y ++CONFIG_SCSI=y ++CONFIG_CMD_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_HEXDUMP=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/arch/arm/dts/mt7981_xiaomi_mi-router-wr30u.dts +@@ -0,0 +1,216 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "Xiaomi Router WR30U"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ config { ++ blink_led = "yellow:network"; ++ system_led = "yellow:system"; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ }; ++ ++ mesh { ++ label = "mesh"; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ linux,input-type = ; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led_system_blue { ++ label = "blue:system"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led_system_yellow { ++ label = "yellow:system"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led_network_blue { ++ label = "blue:network"; ++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led_network_yellow { ++ label = "yellow:network"; ++ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "disabled"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "sgmii"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++ ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_1"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++ ++ pwm_pins: pwm0-pins-func-1 { ++ mux { ++ function = "pwm"; ++ groups = "pwm0_1", "pwm1_0"; ++ }; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x00 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "Nvram"; ++ reg = <0x100000 0x40000>; ++ }; ++ ++ partition@140000 { ++ label = "Bdata"; ++ reg = <0x140000 0x40000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "crash"; ++ reg = <0x580000 0x40000>; ++ }; ++ ++ partition@5c0000 { ++ label = "crash_log"; ++ reg = <0x5c0000 0x40000>; ++ }; ++ ++ partition@600000 { ++ label = "ubi"; ++ reg = <0x600000 0x7000000>; ++ }; ++ ++ partition@7600000 { ++ label = "KF"; ++ reg = <0x7600000 0x40000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/xiaomi_mi-router-wr30u_env +@@ -0,0 +1,56 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-squashfs-sysupgrade.itb ++bootled_pwr=yellow:system ++bootled_rec=yellow:network ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++part_default=production ++part_recovery=recovery ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" From 0f0ea1087b4c42a9fcdd5f003fef62cf587da40b Mon Sep 17 00:00:00 2001 From: Hank Moretti Date: Fri, 21 Jul 2023 03:54:52 +0000 Subject: [PATCH 0316/1171] mediatek: filogic: add support for Xiaomi WR30U Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: ESMT F50L1G41LB 128MB RAM: NT52B128M16JR-FL 256MB Ethernet: 4x 10/100/1000 Mbps Switch: MediaTek MT7531AE WiFi: MediaTek MT7976C Button: Reset, Mesh Power: DC 12V 1A Flash instructions: 1. Get ssh access Check this link: https://forum.openwrt.org/t/openwrt-support-for-xiaomi-ax3000ne/153769/22 2. Backup import partitions ``` dev: size erasesize name mtd1: 00100000 00020000 "BL2" mtd2: 00040000 00020000 "Nvram" mtd3: 00040000 00020000 "Bdata" mtd4: 00200000 00020000 "Factory" mtd5: 00200000 00020000 "FIP" mtd8: 02200000 00020000 "ubi" mtd9: 02200000 00020000 "ubi1" mtd12: 00040000 00020000 "KF" ``` Use these commands blow to backup your stock partitions. ``` nanddump -f /tmp/BL2.bin /dev/mtd1 nanddump -f /tmp/Nvram.bin /dev/mtd2 nanddump -f /tmp/Bdata.bin /dev/mtd3 nanddump -f /tmp/Factory.bin /dev/mtd4 nanddump -f /tmp/FIP.bin /dev/mtd5 nanddump -f /tmp/ubi.bin /dev/mtd8 nanddump -f /tmp/KF.bin /dev/mtd12 ``` Then, transfer them to your computer via scp, netcat, tftp or others and keep them in a safe place. 3. Setup Nvram Get the current stock: `cat /proc/cmdline` If you find `firmware=0` or `mtd=ubi`, use these commands: ``` nvram set boot_wait=on nvram set uart_en=1 nvram set flag_boot_rootfs=1 nvram set flag_last_success=1 nvram set flag_boot_success=1 nvram set flag_try_sys1_failed=0 nvram set flag_try_sys2_failed=0 nvram commit ``` If you find `firmware=1` or `mtd=ubi1`, use these commands: ``` nvram set boot_wait=on nvram set uart_en=1 nvram set flag_boot_rootfs=0 nvram set flag_last_success=0 nvram set flag_boot_success=1 nvram set flag_try_sys1_failed=0 nvram set flag_try_sys2_failed=0 nvram commit ``` 4. Flash stock-initramfs-factory.ubi If you find `firmware=0` or `mtd=ubi`: `ubiformat /dev/mtd9 -y -f /tmp/stock-initramfs-factory.ubi` If you find `firmware=1` or `mtd=ubi1`: `ubiformat /dev/mtd8 -y -f /tmp/stock-initramfs-factory.ubi` Then reboot your router, it should boot to the openwrt initramfs system now. 5. Setup uboot-env Now it will be setup automatically in upgrade process, you can skip this step. If your `fw_setenv` did not work, you need run this command: `echo "/dev/mtd1 0x0 0x10000 0x20000" > /etc/fw_env.config` Then setup uboot-env: ``` fw_setenv boot_wait on fw_setenv uart_en 1 fw_setenv flag_boot_rootfs 0 fw_setenv flag_last_success 1 fw_setenv flag_boot_success 1 fw_setenv flag_try_sys1_failed 8 fw_setenv flag_try_sys2_failed 8 fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata), 2048k(factory),2048k(fip),256k(crash),256k(crash_log), 34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)" ``` 6. Flash stock-squashfs-sysupgrade.bin Use shell command: `sysupgrade -n /tmp/stock-squashfs-sysupgrade.bin` Or go to luci web. If you need to change to Openwrt U-Boot layout, do next. If you do not need, please ignore it. Change to OpenWrt U-Boot: 1. Flash ubootmod-initramfs-factory.ubi Check mtd partitions: `cat /proc/mtd` ``` mtd7: 00040000 00020000 "KF" mtd8: 02200000 00020000 "ubi_kernel" mtd9: 04e00000 00020000 "ubi" ``` Run following command: `ubiformat /dev/mtd8 -y -f /tmp/ubootmod-initramfs-factory.ubi` Then reboot your router, it should boot to the openwrt initramfs system now. 2. Check mtd again ``` mtd7: 00040000 00020000 "KF" mtd8: 07000000 00020000 "ubi" ``` Make sure mtd8 is ubi. 3. Install kmod-mtd-rw Run command: `opkg update && opkg install kmod-mtd-rw` Or get it in openwrt server, or build it yourself, then install it manually Then run this command: `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1` 4. Clean up pstore Run Command: `rm -f /sys/fs/pstore/*` 5. Format ubi and create new ubootenv volume ``` ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8 ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB ``` 6. (Optional) Add recovery boot feature. ``` ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB ubiupdatevol /dev/ubi0_2 /tmp/ubootmod-initramfs-recovery.itb ``` 7. Flash Openwrt U-Boot ``` mtd write /tmp/ubootmod-preloader.bin BL2 mtd write /tmp/ubootmod-bl31-uboot.fip FIP ``` 6. Flash ubootmod-squashfs-sysupgrade.itb Use shell command: `sysupgrade -n /tmp/ubootmod-squashfs-sysupgrade.itb` Or go to luci web. Now everything is done, Enjoy! Go Back to stock from Openwrt U-Boot: 1. Force flash ubootmod-initramfs-recovery.itb Use shell command: `sysupgrade -F -n /tmp/ubootmod-initramfs-recovery.itb` Or go to luci web. Then it should boot to the openwrt initramfs system now. 2. Format ubi and Nvram ``` ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8 mtd erase Nvram ``` 3. Install kmod-mtd-rw Run command: `opkg update && opkg install kmod-mtd-rw` Or get it in openwrt server, or build it yourself, then install it manually Then run this command: `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1` 4. Flash stock U-Boot and ubi ``` mtd write /tmp/BL2.bin BL2 mtd write /tmp/FIP.bin FIP mtd write /tmp/ubi.bin ubi ``` Then reboot your router, waiting it finished rollback in minutes. Go Back to stock from stock layout Openwrt: Just run command: `ubiformat /dev/mtd8 -y -f /tmp/ubi.bin` Then reboot your router, waiting it finished rollback in minutes. Notes: 1. Openwrt U-Boot and ubootmod openwrt did not enable NMBM. Please make your backup safe. Signed-off-by: Hank Moretti --- .../mt7981b-xiaomi-mi-router-wr30u-stock.dts | 34 +++ ...t7981b-xiaomi-mi-router-wr30u-ubootmod.dts | 16 ++ .../dts/mt7981b-xiaomi-mi-router-wr30u.dtsi | 249 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 4 + .../filogic/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 17 +- target/linux/mediatek/image/filogic.mk | 45 ++++ 7 files changed, 366 insertions(+), 3 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-stock.dts create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-ubootmod.dts create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-stock.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-stock.dts new file mode 100644 index 00000000000000..7faa6e84ef8bda --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-stock.dts @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-wr30u.dtsi" + +/ { + model = "Xiaomi Mi Router WR30U (stock layout)"; + compatible = "xiaomi,mi-router-wr30u-stock", "mediatek,mt7981"; +}; + +&spi_nand { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; +}; + +&partitions { + // ubi_kernel is the ubi partition in stock. + partition@600000 { + label = "ubi_kernel"; + reg = <0x600000 0x2200000>; + }; + + /* ubi is the result of squashing + * consecutive stock partitions: + * - ubi1 + * - overlay + * - data + */ + partition@2800000 { + label = "ubi"; + reg = <0x2800000 0x4e00000>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-ubootmod.dts new file mode 100644 index 00000000000000..6d0f3feb45b237 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-ubootmod.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-wr30u.dtsi" + +/ { + model = "Xiaomi Mi Router WR30U (OpenWrt U-Boot layout)"; + compatible = "xiaomi,mi-router-wr30u-ubootmod", "mediatek,mt7981"; +}; + +&partitions { + partition@600000 { + label = "ubi"; + reg = <0x600000 0x7000000>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi new file mode 100644 index 00000000000000..9467b18a7e02ad --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + aliases { + serial0 = &uart0; + led-boot = &led_system_yellow; + led-failsafe = &led_system_yellow; + led-running = &led_system_blue; + led-upgrade = &led_system_yellow; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + mesh { + label = "mesh"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_system_blue: system_blue { + label = "blue:system"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_system_yellow: system_yellow { + label = "yellow:system"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led_network_blue { + label = "blue:network"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_network_yellow { + label = "yellow:network"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-1)>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00 0x100000>; + read-only; + }; + + partition@100000 { + label = "Nvram"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "Bdata"; + reg = <0x140000 0x40000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "crash"; + reg = <0x580000 0x40000>; + read-only; + }; + + partition@5c0000 { + label = "crash_log"; + reg = <0x5c0000 0x40000>; + read-only; + }; + + partition@7600000 { + label = "KF"; + reg = <0x7600000 0x40000>; + read-only; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index c81bd2cd975198..a125c5fccb8e2c 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -20,6 +20,10 @@ netgear,wax220) ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5g" "phy1-ap0" ;; +xiaomi,mi-router-wr30u-stock|\ +xiaomi,mi-router-wr30u-ubootmod) + ucidef_set_led_netdev "wan" "wan" "blue:network" "wan" + ;; xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_led_netdev "wan" "wan" "rgb:network" "wan" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 2ce5fb687b67e5..556560266b7806 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -52,6 +52,8 @@ mediatek_setup_interfaces() tplink,tl-xdr6086) ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 ;; + xiaomi,mi-router-wr30u-stock|\ + xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" wan @@ -97,6 +99,8 @@ mediatek_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) label_mac=$wan_mac ;; + xiaomi,mi-router-wr30u-stock|\ + xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) wan_mac=$(mtd_get_mac_ascii Bdata ethaddr_wan) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 2b58cf2b43b434..5db4dab9b24768 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -1,6 +1,6 @@ REQUIRE_IMAGE_METADATA=1 -redmi_ax6000_initial_setup() +xiaomi_initial_setup() { # initialize UBI and setup uboot-env if it's running on initramfs [ "$(rootfs_type)" = "tmpfs" ] || return 0 @@ -35,7 +35,15 @@ redmi_ax6000_initial_setup() fw_setenv flag_boot_success 1 fw_setenv flag_try_sys1_failed 8 fw_setenv flag_try_sys2_failed 8 - fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),30720k(ubi),30720k(ubi1),51200k(overlay)" + + local board=$(board_name) + case "$board" in + xiaomi,mi-router-wr30u-stock) + fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)" + xiaomi,redmi-router-ax6000-stock) + fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),30720k(ubi),30720k(ubi1),51200k(overlay)" + ;; + esac } platform_do_upgrade() { @@ -84,10 +92,12 @@ platform_do_upgrade() { tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ + xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) CI_KERNPART="fit" nand_do_upgrade "$1" ;; + xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) CI_KERN_UBIPART=ubi_kernel CI_ROOT_UBIPART=ubi @@ -140,8 +150,9 @@ platform_pre_upgrade() { local board=$(board_name) case "$board" in + xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) - redmi_ax6000_initial_setup + xiaomi_initial_setup ;; esac } diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 643435235d27b9..12085efbd4ca1e 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -380,6 +380,51 @@ define Device/tplink_tl-xdr6088 endef TARGET_DEVICES += tplink_tl-xdr6088 +define Device/xiaomi_mi-router-wr30u-stock + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router WR30U (stock layout) + DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u-stock + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel +endif + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += xiaomi_mi-router-wr30u-stock + +define Device/xiaomi_mi-router-wr30u-ubootmod + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router WR30U (OpenWrt U-Boot layout) + DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u-ubootmod + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-wr30u +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS += initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel +endif +endef +TARGET_DEVICES += xiaomi_mi-router-wr30u-ubootmod + define Device/xiaomi_redmi-router-ax6000-stock DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Redmi Router AX6000 (stock layout) From 34d8913bd563cfcb24804b24b99473871c886135 Mon Sep 17 00:00:00 2001 From: Hank Moretti Date: Wed, 26 Jul 2023 14:39:16 +0000 Subject: [PATCH 0317/1171] mediatek: filogic: add specific layout for WR30U Because this device enable NMBM by default, most users use custom U-Boot with NMBM-Enabled in Chinese forums. This layout is the same as the ubootmod layout but enabling NMBM. Signed-off-by: Hank Moretti --- .../uboot-envtools/files/mediatek_filogic | 1 + ...7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts | 22 +++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 1 + .../filogic/base-files/etc/board.d/02_network | 2 ++ .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 17 ++++++++++++++ 6 files changed, 44 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 81b1283690cc4e..4fb1af82183eee 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -47,6 +47,7 @@ mercusys,mr90x-v1) netgear,wax220) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x20000" "0x20000" ;; +xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts new file mode 100644 index 00000000000000..7244cdfd610343 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-wr30u.dtsi" + +/ { + model = "Xiaomi Mi Router WR30U (112M UBI with NMBM-Enabled layout)"; + compatible = "xiaomi,mi-router-wr30u-112m-nmbm", "mediatek,mt7981"; +}; + +&spi_nand { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; +}; + +&partitions { + partition@600000 { + label = "ubi"; + reg = <0x600000 0x7000000>; + }; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index a125c5fccb8e2c..ea126bc46f9e40 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -20,6 +20,7 @@ netgear,wax220) ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5g" "phy1-ap0" ;; +xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod) ucidef_set_led_netdev "wan" "wan" "blue:network" "wan" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 556560266b7806..4013c149f1efbc 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -52,6 +52,7 @@ mediatek_setup_interfaces() tplink,tl-xdr6086) ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 ;; + xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-stock|\ @@ -99,6 +100,7 @@ mediatek_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) label_mac=$wan_mac ;; + xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-stock|\ diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 5db4dab9b24768..f620f915e368d5 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -92,6 +92,7 @@ platform_do_upgrade() { tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ + xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) CI_KERNPART="fit" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 12085efbd4ca1e..e008c23c0afcae 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -380,6 +380,23 @@ define Device/tplink_tl-xdr6088 endef TARGET_DEVICES += tplink_tl-xdr6088 +define Device/xiaomi_mi-router-wr30u-112m-nmbm + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router WR30U (112M UBI with NMBM-Enabled layout) + DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u-112m-nmbm + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel +endif + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += xiaomi_mi-router-wr30u-112m-nmbm + define Device/xiaomi_mi-router-wr30u-stock DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router WR30U (stock layout) From 5ae1b90e03459da1650a867028223e7601cd15ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 28 Jul 2023 08:20:57 +0200 Subject: [PATCH 0318/1171] mediatek: filogic: fix broken sysupgrade script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes introduced in commit 54dc1cde48a4 ("mediatek: filogic: add support for Xiaomi WR30U") missed to end the case item with mandatory `;;` which lead to a broken sysupgrade. Fixes: 54dc1cde48a4 ("mediatek: filogic: add support for Xiaomi WR30U") Signed-off-by: Petr Štetiar --- target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index f620f915e368d5..b0585284cab239 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -40,6 +40,7 @@ xiaomi_initial_setup() case "$board" in xiaomi,mi-router-wr30u-stock) fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)" + ;; xiaomi,redmi-router-ax6000-stock) fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),30720k(ubi),30720k(ubi1),51200k(overlay)" ;; From 6ad85a6c2d733e9b06e0e2b932428cf0d171ff56 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 22 Jul 2023 15:10:54 +0100 Subject: [PATCH 0319/1171] arm-trusted-firmware-tools: update to version 2.9 147f52f3e feat(fiptool): add cca, core_swd, plat cert in FIP 0aaa382fe fix(sptool): fix concurrency issue for SP packages cb666b39d Merge "fix(sptool): fix concurrency issue for SP packages" into integration 0be2475f6 fix: 'sp_mk_generator.py' reference to undef var 1a28f290b fix(sptool): operators "is/is not" in sp_mk_gen.py cf2dd17dd refactor(security): add OpenSSL 1.x compatibility 4daeaf341 fix(sptool): add dependency to SP image 06e69f7c9 feat(fiptool): handle FIP in a disk partition 5a53c6c66 Merge "feat(fiptool): handle FIP in a disk partition" into integration 034a2e3ef refactor(fiptool): move plat_fiptool.mk to tools 0165ddd7c build(fiptool): add object dependency generation c89fdb4a5 Merge "refactor(fiptool): move plat_fiptool.mk to tools" into integration 1b491eead fix(tree): correct some typos Signed-off-by: Daniel Golle --- package/boot/arm-trusted-firmware-tools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/arm-trusted-firmware-tools/Makefile b/package/boot/arm-trusted-firmware-tools/Makefile index 81c8a99cbc21af..209e945a0b00c8 100644 --- a/package/boot/arm-trusted-firmware-tools/Makefile +++ b/package/boot/arm-trusted-firmware-tools/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=arm-trusted-firmware-tools -PKG_VERSION:=2.7 +PKG_VERSION:=2.9 PKG_RELEASE:=1 -PKG_HASH:=53422dc649153838e03820330ba17cb10afe3e330ecde0db11e4d5f1361a33e6 +PKG_HASH:=76a66a1de0c01aeb83dfc7b72b51173fe62c6e51d6fca17cc562393117bed08b PKG_MAINTAINER:=Daniel Golle PKG_HOST_ONLY:=1 From 513ab38b8c91bdecd9142f4bfbeb9991248f3caa Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 22 Jul 2023 15:12:27 +0100 Subject: [PATCH 0320/1171] arm-trusted-firmware-mediatek: update to sources of 2023-07-24 Use updated Trusted Firmware-A sources from MediaTek, now stacked on top of the ARM Trusted Firmware-A v2.9 release. Add builds for the newly added MT7988 SoC. Signed-off-by: Daniel Golle --- .../arm-trusted-firmware-mediatek/Makefile | 147 +++++++++++++++++- 1 file changed, 142 insertions(+), 5 deletions(-) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 2098d0835f83b3..0d1ad8e98a2d33 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -1,6 +1,6 @@ # # Copyright (C) 2017 Hauke Mehrtens -# Copyright (C) 2021 Daniel Golle +# Copyright (C) 2021-2023 Daniel Golle # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git -PKG_SOURCE_DATE:=2022-08-31 -PKG_SOURCE_VERSION:=7539348480af57c6d0db95aba6381f3ee7483779 -PKG_MIRROR_HASH:=125090124d77753acc379b3b124100978c1ecb3da37c4983ba9644b433b7eb08 +PKG_SOURCE_DATE:=2023-07-24 +PKG_SOURCE_VERSION:=00ac6db375b76e57e1f5e9e9bffa033e907c3581 +PKG_MIRROR_HASH:=35e84b2160a7ddc083439e469d7366bb4e6098fc43b5616e68f001364eb05835 PKG_MAINTAINER:=Daniel Golle @@ -31,6 +31,7 @@ define Trusted-Firmware-A/Default DDR_TYPE:= NAND_TYPE:= BOARD_QFN:= + DRAM_USE_COMB:= endef define Trusted-Firmware-A/mt7622-nor-1ddr @@ -214,6 +215,126 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr3 DDR_TYPE:=ddr3 endef +define Trusted-Firmware-A/mt7988-nor-ddr3 + NAME:=MediaTek MT7988 (SPI-NOR, DDR3) + BOOT_DEVICE:=nor + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7988-emmc-ddr3 + NAME:=MediaTek MT7988 (eMMC, DDR3) + BOOT_DEVICE:=emmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7988-sdmmc-ddr3 + NAME:=MediaTek MT7988 (SD card, DDR3) + BOOT_DEVICE:=sdmmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7988-snand-ddr3 + NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR3) + BOOT_DEVICE:=snand + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7988-spim-nand-ddr3 + NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR3) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr3 +endef + +define Trusted-Firmware-A/mt7988-nor-ddr4 + NAME:=MediaTek MT7988 (SPI-NOR, DDR4) + BOOT_DEVICE:=nor + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr4 +endef + +define Trusted-Firmware-A/mt7988-emmc-ddr4 + NAME:=MediaTek MT7988 (eMMC, DDR4) + BOOT_DEVICE:=emmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr4 +endef + +define Trusted-Firmware-A/mt7988-sdmmc-ddr4 + NAME:=MediaTek MT7988 (SD card, DDR4) + BOOT_DEVICE:=sdmmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr4 +endef + +define Trusted-Firmware-A/mt7988-snand-ddr4 + NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR4) + BOOT_DEVICE:=snand + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr4 +endef + +define Trusted-Firmware-A/mt7988-spim-nand-ddr4 + NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR4) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DDR_TYPE:=ddr4 +endef + +define Trusted-Firmware-A/mt7988-nor-comb + NAME:=MediaTek MT7988 (SPI-NOR) + BOOT_DEVICE:=nor + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DRAM_USE_COMB:=1 +endef + +define Trusted-Firmware-A/mt7988-emmc-comb + NAME:=MediaTek MT7988 (eMMC) + BOOT_DEVICE:=emmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DRAM_USE_COMB:=1 +endef + +define Trusted-Firmware-A/mt7988-sdmmc-comb + NAME:=MediaTek MT7988 (SD card) + BOOT_DEVICE:=sdmmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DRAM_USE_COMB:=1 +endef + +define Trusted-Firmware-A/mt7988-snand-comb + NAME:=MediaTek MT7988 (SPI-NAND via SNFI) + BOOT_DEVICE:=snand + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DRAM_USE_COMB:=1 +endef + +define Trusted-Firmware-A/mt7988-spim-nand-comb + NAME:=MediaTek MT7988 (SPI-NAND via SPIM) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7988 + DRAM_USE_COMB:=1 +endef + TFA_TARGETS:= \ mt7622-nor-1ddr \ mt7622-nor-2ddr \ @@ -237,7 +358,22 @@ TFA_TARGETS:= \ mt7986-nor-ddr4 \ mt7986-sdmmc-ddr4 \ mt7986-snand-ddr4 \ - mt7986-spim-nand-ddr4 + mt7986-spim-nand-ddr4 \ + mt7988-emmc-ddr3 \ + mt7988-nor-ddr3 \ + mt7988-sdmmc-ddr3 \ + mt7988-snand-ddr3 \ + mt7988-spim-nand-ddr3 \ + mt7988-emmc-ddr4 \ + mt7988-nor-ddr4 \ + mt7988-sdmmc-ddr4 \ + mt7988-snand-ddr4 \ + mt7988-spim-nand-ddr4 \ + mt7988-emmc-comb \ + mt7988-nor-comb \ + mt7988-sdmmc-comb \ + mt7988-snand-comb \ + mt7988-spim-nand-comb TFA_MAKE_FLAGS += \ BOOT_DEVICE=$(BOOT_DEVICE) \ @@ -247,6 +383,7 @@ TFA_MAKE_FLAGS += \ $(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \ HAVE_DRAM_OBJ_FILE=yes \ $(if $(DDR3_FLYBY),DDR3_FLYBY=1) \ + $(if $(DRAM_USE_COMB),DRAM_USE_COMB=1) \ all define Package/trusted-firmware-a/install From ecfb96195ce43012b5892d71d9717ba3608c3fe7 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 31 Jul 2023 01:12:24 +0100 Subject: [PATCH 0321/1171] arm-trusted-firmware-mediatek: fix PKG_MIRROR_HASH Instead of using the hash of the Github-generated tarball use the hash of the tarball generated by the OpenWrt build system (in this case they are different, unfortunately). Reported-by: Chen Minqiang Fixes: 07dbeb430e ("arm-trusted-firmware-mediatek: update to sources of 2023-07-24") Signed-off-by: Daniel Golle --- package/boot/arm-trusted-firmware-mediatek/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 0d1ad8e98a2d33..853049cfb0e1ee 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git PKG_SOURCE_DATE:=2023-07-24 PKG_SOURCE_VERSION:=00ac6db375b76e57e1f5e9e9bffa033e907c3581 -PKG_MIRROR_HASH:=35e84b2160a7ddc083439e469d7366bb4e6098fc43b5616e68f001364eb05835 +PKG_MIRROR_HASH:=74fc18395532c4292f530da8d00fa1873ada4e05e600c0077a7b7f85ace0d913 PKG_MAINTAINER:=Daniel Golle From 6553b1caed792ff3d3eed36be7ccb2162bbe9945 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 22 Jul 2023 15:50:27 +0100 Subject: [PATCH 0322/1171] uboot-mediatek: update to version 2023.07.02 Release 2023.07 got tagged wrongly and replaced by follow-up release 2023.07.02. Now using upstream DTS for BPi-R3. Removed two patches which made it upstream, refreshed the rest. Signed-off-by: Daniel Golle --- package/boot/uboot-mediatek/Makefile | 4 +- ...22-enable-environment-for-mt7622_rfb.patch | 2 +- ...-set-R1-R0-in-case-pullen-pullsel-su.patch | 88 ----- ...support-for-MediaTek-SPI-NAND-flash-.patch | 2 +- ...6-mtd-add-core-facility-code-of-NMBM.patch | 6 +- ...dd-support-to-initialize-NMBM-after-.patch | 2 +- .../patches/100-09-cmd-add-nmbm-command.patch | 4 +- ...new-command-for-NAND-flash-debugging.patch | 4 +- ...-add-support-to-read-flash-unique-ID.patch | 4 +- ...dd-support-for-booting-from-SPI-NAND.patch | 2 +- ...board-mt7622-use-new-spi-nand-driver.patch | 4 +- ...-reference-board-using-new-spi-nand-.patch | 4 +- ...00-21-mtd-spi-nor-add-more-flash-ids.patch | 2 +- ...i-nand-backport-from-upstream-kernel.patch | 4 +- ...support-to-display-verbose-error-log.patch | 4 +- .../patches/103-mt7988-enable-pstore.patch | 33 ++ .../patches/110-no-kwbimage.patch | 2 +- .../patches/120-use-xz-instead-of-lzma.patch | 2 +- .../patches/200-cmd-add-imsz-and-imszb.patch | 2 +- .../212-cmd-bootmenu-hack-restore-ansi.patch | 11 - .../patches/220-cmd-env-readmem.patch | 8 +- ...-of-FIT-configuration-in-chosen-node.patch | 2 +- .../patches/300-force-pylibfdt-build.patch | 2 +- ...7988-generic-reset-button-ignore-env.patch | 46 +++ .../403-add-bananapi_bpi-r64-snand.patch | 4 +- .../patches/410-add-linksys-e8450.patch | 2 +- .../patches/412-add-ubnt-unifi-6-lr.patch | 4 +- .../patches/430-add-bpi-r3.patch | 322 ------------------ 28 files changed, 117 insertions(+), 459 deletions(-) delete mode 100644 package/boot/uboot-mediatek/patches/001-pinctrl-mediatek-set-R1-R0-in-case-pullen-pullsel-su.patch create mode 100644 package/boot/uboot-mediatek/patches/103-mt7988-enable-pstore.patch delete mode 100644 package/boot/uboot-mediatek/patches/212-cmd-bootmenu-hack-restore-ansi.patch create mode 100644 package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 55965e64dbb8e2..ed8c4ae6cd74e0 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2023.04 -PKG_HASH:=e31cac91545ff41b71cec5d8c22afd695645cd6e2a442ccdacacd60534069341 +PKG_VERSION:=2023.07.02 +PKG_HASH:=6b6a48581c14abb0f95bd87c1af4d740922406d7b801002a9f94727fdde021d5 PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host include $(INCLUDE_DIR)/u-boot.mk diff --git a/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch b/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch index cd9004844c02c3..60eda91124b18e 100644 --- a/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch +++ b/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch @@ -21,7 +21,7 @@ Signed-off-by: Weijie Gao CONFIG_SYS_PROMPT="MT7622> " CONFIG_DEBUG_UART_BASE=0x11002000 CONFIG_DEBUG_UART_CLOCK=25000000 -@@ -24,6 +26,9 @@ CONFIG_CMD_SF_TEST=y +@@ -25,6 +27,9 @@ CONFIG_CMD_SF_TEST=y CONFIG_CMD_PING=y CONFIG_CMD_SMC=y CONFIG_ENV_OVERWRITE=y diff --git a/package/boot/uboot-mediatek/patches/001-pinctrl-mediatek-set-R1-R0-in-case-pullen-pullsel-su.patch b/package/boot/uboot-mediatek/patches/001-pinctrl-mediatek-set-R1-R0-in-case-pullen-pullsel-su.patch deleted file mode 100644 index 988c78cdfb8316..00000000000000 --- a/package/boot/uboot-mediatek/patches/001-pinctrl-mediatek-set-R1-R0-in-case-pullen-pullsel-su.patch +++ /dev/null @@ -1,88 +0,0 @@ -From patchwork Wed Apr 12 20:36:43 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 1768270 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Date: Wed, 12 Apr 2023 21:36:43 +0100 -From: Daniel Golle -To: u-boot@lists.denx.de, Sam Shih , - GSS_MTK_Uboot_upstream , - Chunfeng Yun , - Weijie Gao , Ryder Lee , - Frank Wunderlich -Cc: Steven Liu =?utf-8?b?KOWKieS6uuixqik=?= , - John Crispin -Subject: [PATCH] pinctrl: mediatek: set R1/R0 in case pullen/pullsel succeeded -Message-ID: -MIME-Version: 1.0 -Content-Disposition: inline -X-BeenThere: u-boot@lists.denx.de -X-Mailman-Version: 2.1.39 -Precedence: list -List-Id: U-Boot discussion -Sender: "U-Boot" - -Commit dafe0fbfb0f3 ("pinctrl: mediatek: rewrite mtk_pinconf_set and -related functions") changed the logic deciding to set R0 and R1 -registers for V1 devices. - -Before: - /* Also set PUPD/R0/R1 if the pin has them */ - err = mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_PUPD, !pullup); - if (err != -EINVAL) { - mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R0, r0); - mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R1, r1); - } - -After: - /* try pupd_r1_r0 if pullen_pullsel return error */ - err = mtk_pinconf_bias_set_pullen_pullsel(dev, pin, disable, pullup, - val); - if (err) - return mtk_pinconf_bias_set_pupd_r1_r0(dev, pin, disable, - pullup, val); - -Tracing mtk_pinconf_bias_set_pullen_pullsel shows that the function -always either returns 0 in case of success or -EINVAL in case any error -has occurred. Hence the logic responsible of the decision to program R0 -and R1 has been inverted. - -This leads to problems on BananaPi R2 (MT7623N) when booting from -SDMMC, it turns out accessing eMMC no longer works since -U-Boot 2022.07: - -MT7623> mmc dev 0 -Card did not respond to voltage select! : -110 - -The problem wasn't detected for a long time as both eMMC and SDMMC work -fine if they are used to boot from, and hence R0 and R1 were already -setup by the bootrom and/or preloader. - -Fix the logic to restore the originally intended and correct behavior -and also change the descriptive comment accordingly. - -Fixes: dafe0fbfb0f3 ("pinctrl: mediatek: rewrite mtk_pinconf_set and related functions") -Signed-off-by: Daniel Golle ---- - drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c -+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c -@@ -349,10 +349,10 @@ int mtk_pinconf_bias_set_v1(struct udevi - { - int err; - -- /* try pupd_r1_r0 if pullen_pullsel return error */ -+ /* set pupd_r1_r0 if pullen_pullsel succeeded */ - err = mtk_pinconf_bias_set_pullen_pullsel(dev, pin, disable, pullup, - val); -- if (err) -+ if (!err) - return mtk_pinconf_bias_set_pupd_r1_r0(dev, pin, disable, - pullup, val); - diff --git a/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch b/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch index a6c59d1f6664bb..311c051344017d 100644 --- a/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch +++ b/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch @@ -49,7 +49,7 @@ Signed-off-by: Weijie Gao config SYS_NAND_MAX_OOBFREE --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile -@@ -38,3 +38,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR +@@ -39,3 +39,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR obj-$(CONFIG_SPL_UBI) += ubispl/ endif diff --git a/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch b/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch index bf04f5b6e49a74..23634e64253288 100644 --- a/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch +++ b/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch @@ -31,16 +31,16 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig -@@ -272,4 +272,6 @@ source "drivers/mtd/spi/Kconfig" +@@ -274,4 +274,6 @@ source "drivers/mtd/ubi/Kconfig" - source "drivers/mtd/ubi/Kconfig" + source "drivers/mtd/nvmxip/Kconfig" +source "drivers/mtd/nmbm/Kconfig" + endmenu --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile -@@ -40,3 +40,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/ +@@ -41,3 +41,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/ endif obj-$(CONFIG_MTK_SPI_NAND) += mtk-snand/ diff --git a/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch b/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch index 1d8139e6726f96..93fc32cf9ec502 100644 --- a/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch +++ b/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch @@ -34,7 +34,7 @@ Signed-off-by: Weijie Gao #if defined(CONFIG_CMD_ONENAND) /* go init the NAND */ static int initr_onenand(void) -@@ -703,6 +717,9 @@ static init_fnc_t init_sequence_r[] = { +@@ -696,6 +710,9 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_CMD_ONENAND initr_onenand, #endif diff --git a/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch b/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch index 6b319384d516a8..35d8f115f60e0c 100644 --- a/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch +++ b/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao --- a/cmd/Kconfig +++ b/cmd/Kconfig -@@ -1352,6 +1352,12 @@ config CMD_NAND_TORTURE +@@ -1353,6 +1353,12 @@ config CMD_NAND_TORTURE endif # CMD_NAND @@ -30,7 +30,7 @@ Signed-off-by: Weijie Gao depends on NVME --- a/cmd/Makefile +++ b/cmd/Makefile -@@ -123,6 +123,7 @@ obj-y += legacy-mtd-utils.o +@@ -125,6 +125,7 @@ obj-y += legacy-mtd-utils.o endif obj-$(CONFIG_CMD_MUX) += mux.o obj-$(CONFIG_CMD_NAND) += nand.o diff --git a/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch b/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch index 31f26be053647f..f3831e07f7dfbe 100644 --- a/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch +++ b/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch @@ -26,7 +26,7 @@ Signed-off-by: Weijie Gao --- a/cmd/Kconfig +++ b/cmd/Kconfig -@@ -1352,6 +1352,14 @@ config CMD_NAND_TORTURE +@@ -1353,6 +1353,14 @@ config CMD_NAND_TORTURE endif # CMD_NAND @@ -43,7 +43,7 @@ Signed-off-by: Weijie Gao bool "nmbm" --- a/cmd/Makefile +++ b/cmd/Makefile -@@ -123,6 +123,7 @@ obj-y += legacy-mtd-utils.o +@@ -125,6 +125,7 @@ obj-y += legacy-mtd-utils.o endif obj-$(CONFIG_CMD_MUX) += mux.o obj-$(CONFIG_CMD_NAND) += nand.o diff --git a/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch b/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch index 3d79731dd14530..d9a645d20efec9 100644 --- a/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch +++ b/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c -@@ -2818,6 +2818,100 @@ static int spi_nor_init_params(struct sp +@@ -2848,6 +2848,100 @@ static int spi_nor_init_params(struct sp return 0; } @@ -114,7 +114,7 @@ Signed-off-by: Weijie Gao static int spi_nor_hwcaps2cmd(u32 hwcaps, const int table[][2], size_t size) { size_t i; -@@ -3930,6 +4024,7 @@ int spi_nor_scan(struct spi_nor *nor) +@@ -4045,6 +4139,7 @@ int spi_nor_scan(struct spi_nor *nor) nor->write = spi_nor_write_data; nor->read_reg = spi_nor_read_reg; nor->write_reg = spi_nor_write_reg; diff --git a/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch b/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch index 797d925e173095..93a940b943f7c8 100644 --- a/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch +++ b/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch @@ -23,7 +23,7 @@ Signed-off-by: Weijie Gao +++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi @@ -40,3 +40,11 @@ &snfi { - u-boot,dm-pre-reloc; + bootph-all; }; + +&pinctrl { diff --git a/package/boot/uboot-mediatek/patches/100-19-board-mt7622-use-new-spi-nand-driver.patch b/package/boot/uboot-mediatek/patches/100-19-board-mt7622-use-new-spi-nand-driver.patch index 03555d4a4b77e9..6202ddf3b015d7 100644 --- a/package/boot/uboot-mediatek/patches/100-19-board-mt7622-use-new-spi-nand-driver.patch +++ b/package/boot/uboot-mediatek/patches/100-19-board-mt7622-use-new-spi-nand-driver.patch @@ -55,7 +55,7 @@ Signed-off-by: Weijie Gao reg = <0x11014000 0x1000>; --- a/configs/mt7622_rfb_defconfig +++ b/configs/mt7622_rfb_defconfig -@@ -21,6 +21,7 @@ CONFIG_SYS_MAXARGS=8 +@@ -22,6 +22,7 @@ CONFIG_SYS_MAXARGS=8 CONFIG_SYS_PBSIZE=1049 CONFIG_CMD_BOOTMENU=y CONFIG_CMD_MMC=y @@ -63,7 +63,7 @@ Signed-off-by: Weijie Gao CONFIG_CMD_PCI=y CONFIG_CMD_SF_TEST=y CONFIG_CMD_PING=y -@@ -40,6 +41,10 @@ CONFIG_SYSCON=y +@@ -41,6 +42,10 @@ CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_MMC_HS200_SUPPORT=y CONFIG_MMC_MTK=y diff --git a/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch b/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch index cf2019fcba6874..cb3f1ff2af5182 100644 --- a/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch +++ b/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch @@ -18,14 +18,14 @@ Signed-off-by: Weijie Gao --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1288,6 +1288,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1308,6 +1308,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7623n-bananapi-bpi-r2.dtb \ mt7629-rfb.dtb \ mt7981-rfb.dtb \ + mt7981-snfi-nand-rfb.dtb \ mt7981-emmc-rfb.dtb \ mt7981-sd-rfb.dtb \ - mt7986a-rfb.dtb \ + mt7986a-bpi-r3-sd.dtb \ --- /dev/null +++ b/arch/arm/dts/mt7981-snfi-nand-rfb.dts @@ -0,0 +1,132 @@ diff --git a/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch b/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch index 08334248218df5..bd68677eb063f0 100644 --- a/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch +++ b/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c -@@ -672,6 +672,7 @@ static int set_4byte(struct spi_nor *nor +@@ -673,6 +673,7 @@ static int set_4byte(struct spi_nor *nor case SNOR_MFR_ISSI: case SNOR_MFR_MACRONIX: case SNOR_MFR_WINBOND: diff --git a/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch b/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch index 1c83479d0db137..358461a2b70674 100644 --- a/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch +++ b/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch @@ -207,8 +207,8 @@ Signed-off-by: Weijie Gao - ret = spinand_manufacturer_detect(spinand); + ret = spinand_id_detect(spinand); if (ret) { - dev_err(spinand->slave->dev, "unknown raw ID %*phN\n", - SPINAND_MAX_ID_LEN, spinand->id.data); + dev_err(spinand->slave->dev, "unknown raw ID %02x %02x %02x %02x\n", + spinand->id.data[0], spinand->id.data[1], --- a/drivers/mtd/nand/spi/gigadevice.c +++ b/drivers/mtd/nand/spi/gigadevice.c @@ -22,8 +22,13 @@ diff --git a/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch b/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch index 1709680ebbce60..0c68f429c6b0c4 100644 --- a/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch +++ b/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig -@@ -823,6 +823,14 @@ config MMC_MTK +@@ -820,6 +820,14 @@ config MMC_MTK This is needed if support for any SD/SDIO/MMC devices is required. If unsure, say N. @@ -32,7 +32,7 @@ Signed-off-by: Weijie Gao config FSL_SDHC_V2_3 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile -@@ -84,3 +84,7 @@ obj-$(CONFIG_RENESAS_SDHI) += tmio-comm +@@ -83,3 +83,7 @@ obj-$(CONFIG_RENESAS_SDHI) += tmio-comm obj-$(CONFIG_MMC_BCM2835) += bcm2835_sdhost.o obj-$(CONFIG_MMC_MTK) += mtk-sd.o obj-$(CONFIG_MMC_SDHCI_F_SDH30) += f_sdh30.o diff --git a/package/boot/uboot-mediatek/patches/103-mt7988-enable-pstore.patch b/package/boot/uboot-mediatek/patches/103-mt7988-enable-pstore.patch new file mode 100644 index 00000000000000..a34dcddd71bc79 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/103-mt7988-enable-pstore.patch @@ -0,0 +1,33 @@ +--- a/arch/arm/dts/mt7988.dtsi ++++ b/arch/arm/dts/mt7988.dtsi +@@ -61,6 +61,30 @@ + #clock-cells = <0>; + }; + ++ psci { ++ compatible = "arm,psci-0.2"; ++ method = "smc"; ++ }; ++ ++ reserved-memory { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ /* 64 KiB reserved for ramoops/pstore */ ++ ramoops@42ff0000 { ++ compatible = "ramoops"; ++ reg = <0 0x42ff0000 0 0x10000>; ++ record-size = <0x1000>; ++ }; ++ ++ /* 320 KiB reserved for ARM Trusted Firmware (BL31+BL32) */ ++ secmon_reserved: secmon@43000000 { ++ reg = <0 0x43000000 0 0x50000>; ++ no-map; ++ }; ++ }; ++ + hwver: hwver { + compatible = "mediatek,hwver", "syscon"; + reg = <0 0x8000000 0 0x1000>; diff --git a/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch b/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch index 76921b757e0d48..2d61d6f4a7ecb3 100644 --- a/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch +++ b/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch @@ -1,6 +1,6 @@ --- a/tools/Makefile +++ b/tools/Makefile -@@ -115,7 +115,6 @@ dumpimage-mkimage-objs := aisimage.o \ +@@ -116,7 +116,6 @@ dumpimage-mkimage-objs := aisimage.o \ imximage.o \ imx8image.o \ imx8mimage.o \ diff --git a/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch b/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch index 7fda30a756b6d5..411f99467b74d0 100644 --- a/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch +++ b/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -1067,7 +1067,7 @@ quiet_cmd_pad_cat = CAT $@ +@@ -1070,7 +1070,7 @@ quiet_cmd_pad_cat = CAT $@ cmd_pad_cat = $(cmd_objcopy) && $(append) || { rm -f $@; false; } quiet_cmd_lzma = LZMA $@ diff --git a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch index fcbb6b28a060fb..574259fb395764 100644 --- a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch +++ b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch @@ -122,7 +122,7 @@ int arch, int ph_type, int bootstage_id, --- a/include/image.h +++ b/include/image.h -@@ -1046,6 +1046,7 @@ int fit_parse_subimage(const char *spec, +@@ -1047,6 +1047,7 @@ int fit_parse_subimage(const char *spec, ulong *addr, const char **image_name); int fit_get_subimage_count(const void *fit, int images_noffset); diff --git a/package/boot/uboot-mediatek/patches/212-cmd-bootmenu-hack-restore-ansi.patch b/package/boot/uboot-mediatek/patches/212-cmd-bootmenu-hack-restore-ansi.patch deleted file mode 100644 index cdb1477d42321d..00000000000000 --- a/package/boot/uboot-mediatek/patches/212-cmd-bootmenu-hack-restore-ansi.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/common/menu.c -+++ b/common/menu.c -@@ -15,7 +15,7 @@ - - #include "menu.h" - --#define ansi 0 -+#define ansi 1 - - /* - * Internally, each item in a menu is represented by a struct menu_item. diff --git a/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch b/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch index 37956727b26ba6..d91b9904cbd0e9 100644 --- a/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch +++ b/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch @@ -1,6 +1,6 @@ --- a/cmd/Kconfig +++ b/cmd/Kconfig -@@ -601,6 +601,12 @@ config CMD_ENV_EXISTS +@@ -602,6 +602,12 @@ config CMD_ENV_EXISTS Check if a variable is defined in the environment for use in shell scripting. @@ -76,7 +76,7 @@ #if defined(CONFIG_CMD_ENV_CALLBACK) static int print_static_binding(const char *var_name, const char *callback_name, void *priv) -@@ -1231,6 +1285,9 @@ static struct cmd_tbl cmd_env_sub[] = { +@@ -1228,6 +1282,9 @@ static struct cmd_tbl cmd_env_sub[] = { U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""), #endif U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""), @@ -86,7 +86,7 @@ #if defined(CONFIG_CMD_RUN) U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""), #endif -@@ -1322,6 +1379,9 @@ static char env_help_text[] = +@@ -1319,6 +1376,9 @@ static char env_help_text[] = #if defined(CONFIG_CMD_NVEDIT_EFI) "env print -e [-guid guid] [-n] [name ...] - print UEFI environment\n" #endif @@ -96,7 +96,7 @@ #if defined(CONFIG_CMD_RUN) "env run var [...] - run commands in an environment variable\n" #endif -@@ -1431,6 +1491,17 @@ U_BOOT_CMD( +@@ -1428,6 +1488,17 @@ U_BOOT_CMD( ); #endif diff --git a/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch b/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch index 873d80f6f9dcf1..f087bec72a67f3 100644 --- a/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch +++ b/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch @@ -16,7 +16,7 @@ Reviewed-by: Tom Rini --- a/boot/image-fdt.c +++ b/boot/image-fdt.c -@@ -636,6 +636,12 @@ int image_setup_libfdt(struct bootm_head +@@ -637,6 +637,12 @@ int image_setup_libfdt(struct bootm_head images->fit_uname_cfg, strlen(images->fit_uname_cfg) + 1, 1); diff --git a/package/boot/uboot-mediatek/patches/300-force-pylibfdt-build.patch b/package/boot/uboot-mediatek/patches/300-force-pylibfdt-build.patch index d34ed6f2ae55aa..89cdf60f95073b 100644 --- a/package/boot/uboot-mediatek/patches/300-force-pylibfdt-build.patch +++ b/package/boot/uboot-mediatek/patches/300-force-pylibfdt-build.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -2000,26 +2000,7 @@ endif +@@ -2006,26 +2006,7 @@ endif # Check dtc and pylibfdt, if DTC is provided, else build them PHONY += scripts_dtc scripts_dtc: scripts_basic diff --git a/package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch new file mode 100644 index 00000000000000..2bbc5c1005f288 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch @@ -0,0 +1,46 @@ +--- a/board/mediatek/mt7988/mt7988_rfb.c ++++ b/board/mediatek/mt7988/mt7988_rfb.c +@@ -4,7 +4,43 @@ + * Author: Sam Shih + */ + ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifndef CONFIG_RESET_BUTTON_LABEL ++#define CONFIG_RESET_BUTTON_LABEL "reset" ++#endif ++ + int board_init(void) + { + return 0; + } ++ ++int board_late_init(void) ++{ ++ gd->env_valid = 1; //to load environment variable from persistent store ++ struct udevice *dev; ++ ++ gd->env_valid = ENV_VALID; ++ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) { ++ puts("reset button found\n"); ++#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY ++ if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) { ++ button_get_state(dev); ++ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY); ++ } ++#endif ++ if (button_get_state(dev) == BUTTON_ON) { ++ puts("button pushed, resetting environment\n"); ++ gd->env_valid = ENV_INVALID; ++ } ++ } ++ env_relocate(); ++ return 0; ++} diff --git a/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64-snand.patch b/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64-snand.patch index a414f0a8b5cbc0..c9da03c725400d 100644 --- a/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64-snand.patch +++ b/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64-snand.patch @@ -20,14 +20,14 @@ +&snand { + pinctrl-names = "default"; + pinctrl-0 = <&snfi_pins>; ++ quad-spi; status = "okay"; - - spi-flash@0{ - compatible = "jedec,spi-nor"; - reg = <0>; -- u-boot,dm-pre-reloc; +- bootph-all; - }; -+ quad-spi; }; &uart0 { diff --git a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch index 3fc2c554bb0beb..bc9b3f400108c7 100644 --- a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch +++ b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch @@ -344,7 +344,7 @@ +}; --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1285,6 +1285,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1305,6 +1305,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7622-rfb.dtb \ mt7623a-unielec-u7623-02-emmc.dtb \ mt7622-bananapi-bpi-r64.dtb \ diff --git a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch index 1955958b9b0b04..7d37b1adc6b582 100644 --- a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch +++ b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch @@ -341,7 +341,7 @@ +}; --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1286,6 +1286,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1306,6 +1306,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7623a-unielec-u7623-02-emmc.dtb \ mt7622-bananapi-bpi-r64.dtb \ mt7622-linksys-e8450-ubi.dtb \ @@ -433,7 +433,7 @@ #ifdef CONFIG_MMC static int initr_mmc(void) { -@@ -720,6 +735,9 @@ static init_fnc_t init_sequence_r[] = { +@@ -713,6 +728,9 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_NMBM_MTD initr_nmbm, #endif diff --git a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch index bcd29b974e52e9..98010a330477bc 100644 --- a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch +++ b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch @@ -1,14 +1,3 @@ ---- a/arch/arm/dts/Makefile -+++ b/arch/arm/dts/Makefile -@@ -1293,6 +1293,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ - mt7981-snfi-nand-rfb.dtb \ - mt7981-emmc-rfb.dtb \ - mt7981-sd-rfb.dtb \ -+ mt7986a-bpi-r3-sd.dtb \ -+ mt7986a-bpi-r3-emmc.dtb \ - mt7986a-rfb.dtb \ - mt7986b-rfb.dtb \ - mt7986a-sd-rfb.dtb \ --- /dev/null +++ b/configs/mt7986a_bpi-r3-emmc_defconfig @@ -0,0 +1,196 @@ @@ -806,317 +795,6 @@ +CONFIG_USE_SERVERIP=y +CONFIG_SERVERIP="192.168.1.254" --- /dev/null -+++ b/arch/arm/dts/mt7986a-bpi-r3-emmc.dts -@@ -0,0 +1,33 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Copyright (c) 2021 MediaTek Inc. -+ * Author: Sam Shih -+ */ -+ -+/dts-v1/; -+#include "mt7986a-bpi-r3-sd.dts" -+#include -+/ { -+ reg_1p8v: regulator-1p8v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-1.8V"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_default>; -+ bus-width = <8>; -+ max-frequency = <200000000>; -+ cap-mmc-highspeed; -+ cap-mmc-hw-reset; -+ vmmc-supply = <®_3p3v>; -+ vqmmc-supply = <®_1p8v>; -+ non-removable; -+ status = "okay"; -+}; -+ ---- /dev/null -+++ b/arch/arm/dts/mt7986a-bpi-r3-sd.dts -@@ -0,0 +1,272 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Copyright (c) 2021 MediaTek Inc. -+ * Author: Sam Shih -+ */ -+ -+/dts-v1/; -+#include -+#include "mt7986.dtsi" -+#include -+ -+/ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ model = "BananaPi BPi-R3"; -+ compatible = "mediatek,mt7986", "mediatek,mt7986-sd-rfb"; -+ -+ chosen { -+ stdout-path = &uart0; -+ tick-timer = &timer0; -+ }; -+ -+ reg_3p3v: regulator-3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-3.3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ keys { -+ compatible = "gpio-keys"; -+/* -+ factory { -+ label = "reset"; -+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; -+ }; -+*/ -+ wps { -+ label = "reset"; -+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; -+ linux,code = ; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ led_status_green: green { -+ label = "green:status"; -+ gpios = <&gpio 69 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ led_status_blue: blue { -+ label = "blue:status"; -+ gpios = <&gpio 86 GPIO_ACTIVE_HIGH>; -+ }; -+ }; -+ -+}; -+ -+&uart0 { -+ mediatek,force-highspeed; -+ status = "okay"; -+}; -+ -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins>; -+ status = "disabled"; -+}; -+ -+ð { -+ status = "okay"; -+ mediatek,gmac-id = <0>; -+ phy-mode = "sgmii"; -+ mediatek,switch = "mt7531"; -+ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+}; -+ -+&pinctrl { -+ spic_pins: spi1-pins-func-1 { -+ mux { -+ function = "spi"; -+ groups = "spi1_2"; -+ }; -+ }; -+ -+ uart1_pins: spi1-pins-func-3 { -+ mux { -+ function = "uart"; -+ groups = "uart1_2"; -+ }; -+ }; -+ -+ pwm_pins: pwm0-pins-func-1 { -+ mux { -+ function = "pwm"; -+ groups = "pwm0"; -+ }; -+ }; -+ -+ mmc0_pins_default: mmc0default { -+ mux { -+ function = "flash"; -+ groups = "emmc_51"; -+ }; -+ -+ conf-cmd-dat { -+ pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", -+ "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", -+ "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; -+ input-enable; -+ drive-strength = ; -+ bias-pull-up = ; -+ }; -+ -+ conf-clk { -+ pins = "EMMC_CK"; -+ drive-strength = ; -+ bias-pull-down = ; -+ }; -+ -+ conf-dsl { -+ pins = "EMMC_DSL"; -+ bias-pull-down = ; -+ }; -+ -+ conf-rst { -+ pins = "EMMC_RSTB"; -+ drive-strength = ; -+ bias-pull-up = ; -+ }; -+ }; -+ -+ spi_flash_pins: spi0-pins-func-1 { -+ mux { -+ function = "flash"; -+ groups = "spi0", "spi0_wp_hold"; -+ }; -+ -+ conf-pu { -+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; -+ drive-strength = ; -+ bias-pull-up = ; -+ }; -+ -+ conf-pd { -+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; -+ drive-strength = ; -+ bias-pull-down = ; -+ }; -+ }; -+}; -+ -+&pwm { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; -+ status = "okay"; -+}; -+ -+&spi0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi_flash_pins>; -+ status = "okay"; -+ must_tx; -+ enhance_timing; -+ dma_ext; -+ ipm_design; -+ support_quad; -+ tick_dly = <1>; -+ sample_sel = <0>; -+ -+ spi_nor@0 { -+ compatible = "jedec,spi-nor"; -+ reg = <0>; -+ spi-max-frequency = <52000000>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "bl2"; -+ reg = <0x0 0x40000>; -+ }; -+ -+ partition@40000 { -+ label = "u-boot-env"; -+ reg = <0x40000 0x40000>; -+ }; -+ -+ partition@80000 { -+ label = "reserved"; -+ reg = <0x80000 0x80000>; -+ }; -+ -+ partition@100000 { -+ label = "fip"; -+ reg = <0x100000 0x80000>; -+ }; -+ -+ partition@180000 { -+ label = "recovery"; -+ reg = <0x180000 0xa80000>; -+ }; -+ -+ partition@c00000 { -+ label = "fit"; -+ reg = <0xc00000 0x1400000>; -+ }; -+ }; -+ }; -+ -+ spi_nand@1 { -+ compatible = "spi-nand"; -+ reg = <1>; -+ spi-max-frequency = <52000000>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "bl2"; -+ reg = <0x0 0x80000>; -+ }; -+ -+ partition@80000 { -+ label = "factory"; -+ reg = <0x80000 0x300000>; -+ }; -+ -+ partition@380000 { -+ label = "fip"; -+ reg = <0x380000 0x200000>; -+ }; -+ -+ partition@580000 { -+ label = "ubi"; -+ reg = <0x580000 0x7a80000>; -+ }; -+ }; -+ }; -+}; -+ -+&watchdog { -+ status = "disabled"; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_default>; -+ bus-width = <4>; -+ max-frequency = <52000000>; -+ cap-sd-highspeed; -+ r_smpl = <1>; -+ vmmc-supply = <®_3p3v>; -+ vqmmc-supply = <®_3p3v>; -+ status = "okay"; -+}; -+ ---- /dev/null +++ b/bananapi_bpi-r3_sdmmc_env @@ -0,0 +1,80 @@ +ipaddr=192.168.1.1 From b7e9445d6dcea9c4a6cd5f017a797ccc269c8c7a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 22 Jul 2023 18:55:32 +0100 Subject: [PATCH 0323/1171] uboot-mediatek: add patches for MT7988 and builds for RFB Import pending patches adding support for MT7988 and provide builds for the reference board for all possible boot media. Signed-off-by: Daniel Golle --- package/boot/uboot-mediatek/Makefile | 67 +- ...rieve-ram_base-from-dts-node-for-arm.patch | 297 +++ ...board-mediatek-update-config-headers.patch | 129 + ...-mtk_spim-get-spi-clk-rate-only-once.patch | 84 + ...4-spi-mtk_spim-clear-IRQ-enable-bits.patch | 35 + ...l-mtk-initial-priv-data-before-using.patch | 25 + ...heck-malloc-return-valaue-before-use.patch | 26 + ...ediatek-fix-I2C-usability-for-MT7981.patch | 125 + ...able-i2c-support-for-MediaTek-MT7981.patch | 36 + ...-add-support-for-MediaTek-MT7988-SoC.patch | 34 + ...-clock-driver-support-for-MediaTek-M.patch | 1505 +++++++++++ ...dd-reset-definition-for-MediaTek-MT7.patch | 49 + ...ek-convert-most-definitions-to-const.patch | 2267 +++++++++++++++++ ...-fix-the-return-value-in-driving-con.patch | 37 + ...-mediatek-add-pinmux_set-ops-support.patch | 43 + ...ek-add-pinctrl-driver-for-MT7988-SoC.patch | 1315 ++++++++++ ...nect-switch-to-PSE-only-when-startin.patch | 138 + ...imize-the-switch-reset-delay-wait-ti.patch | 56 + ...-direct-MDIO-clause-45-access-via-So.patch | 34 + ...ediatek-add-missing-static-qualifier.patch | 36 + ...-support-for-SGMII-1Gbps-auto-negoti.patch | 149 ++ ...-convert-gmac-link-mode-to-2500base-.patch | 214 ++ ...-support-for-GMAC-USB3-PHY-mux-mode-.patch | 138 + ...-add-infracfg-registers-to-support-G.patch | 36 + ...-24-net-mediatek-add-USXGMII-support.patch | 341 +++ ...t-mediatek-add-support-for-NETSYS-v3.patch | 221 ++ ...-add-support-for-MediaTek-MT7988-SoC.patch | 327 +++ ...use-uint32_t-for-ghf-header-magic-an.patch | 55 + ...-add-support-for-MediaTek-MT7988-SoC.patch | 606 +++++ ...mediatek-add-MT7988-reference-boards.patch | 575 +++++ ...7622-generic-reset-button-ignore-env.patch | 4 +- .../patches/410-add-linksys-e8450.patch | 4 +- .../patches/412-add-ubnt-unifi-6-lr.patch | 4 +- .../patches/432-add-tplink-xdr608x.patch | 4 +- .../patches/433-add-qihoo_360t7.patch | 4 +- .../patches/435-add-h3c_magic-nx30-pro.patch | 4 +- 36 files changed, 9011 insertions(+), 13 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/101-01-arm-mediatek-retrieve-ram_base-from-dts-node-for-arm.patch create mode 100644 package/boot/uboot-mediatek/patches/101-02-board-mediatek-update-config-headers.patch create mode 100644 package/boot/uboot-mediatek/patches/101-03-spi-mtk_spim-get-spi-clk-rate-only-once.patch create mode 100644 package/boot/uboot-mediatek/patches/101-04-spi-mtk_spim-clear-IRQ-enable-bits.patch create mode 100644 package/boot/uboot-mediatek/patches/101-05-serial-mtk-initial-priv-data-before-using.patch create mode 100644 package/boot/uboot-mediatek/patches/101-06-reset-mediatek-check-malloc-return-valaue-before-use.patch create mode 100644 package/boot/uboot-mediatek/patches/101-07-i2c-mediatek-fix-I2C-usability-for-MT7981.patch create mode 100644 package/boot/uboot-mediatek/patches/101-08-arm-dts-enable-i2c-support-for-MediaTek-MT7981.patch create mode 100644 package/boot/uboot-mediatek/patches/101-09-pwm-mtk-add-support-for-MediaTek-MT7988-SoC.patch create mode 100644 package/boot/uboot-mediatek/patches/101-10-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch create mode 100644 package/boot/uboot-mediatek/patches/101-11-reset-mediatek-add-reset-definition-for-MediaTek-MT7.patch create mode 100644 package/boot/uboot-mediatek/patches/101-12-pinctrl-mediatek-convert-most-definitions-to-const.patch create mode 100644 package/boot/uboot-mediatek/patches/101-13-pinctrl-mediatek-fix-the-return-value-in-driving-con.patch create mode 100644 package/boot/uboot-mediatek/patches/101-14-pinctrl-mediatek-add-pinmux_set-ops-support.patch create mode 100644 package/boot/uboot-mediatek/patches/101-15-pinctrl-mediatek-add-pinctrl-driver-for-MT7988-SoC.patch create mode 100644 package/boot/uboot-mediatek/patches/101-16-net-mediatek-connect-switch-to-PSE-only-when-startin.patch create mode 100644 package/boot/uboot-mediatek/patches/101-17-net-mediatek-optimize-the-switch-reset-delay-wait-ti.patch create mode 100644 package/boot/uboot-mediatek/patches/101-18-net-mediatek-fix-direct-MDIO-clause-45-access-via-So.patch create mode 100644 package/boot/uboot-mediatek/patches/101-19-net-mediatek-add-missing-static-qualifier.patch create mode 100644 package/boot/uboot-mediatek/patches/101-20-net-mediatek-add-support-for-SGMII-1Gbps-auto-negoti.patch create mode 100644 package/boot/uboot-mediatek/patches/101-21-arm-dts-medaitek-convert-gmac-link-mode-to-2500base-.patch create mode 100644 package/boot/uboot-mediatek/patches/101-22-net-mediatek-add-support-for-GMAC-USB3-PHY-mux-mode-.patch create mode 100644 package/boot/uboot-mediatek/patches/101-23-arm-dts-mediatek-add-infracfg-registers-to-support-G.patch create mode 100644 package/boot/uboot-mediatek/patches/101-24-net-mediatek-add-USXGMII-support.patch create mode 100644 package/boot/uboot-mediatek/patches/101-25-net-mediatek-add-support-for-NETSYS-v3.patch create mode 100644 package/boot/uboot-mediatek/patches/101-26-net-mediatek-add-support-for-MediaTek-MT7988-SoC.patch create mode 100644 package/boot/uboot-mediatek/patches/101-27-tools-mtk_image-use-uint32_t-for-ghf-header-magic-an.patch create mode 100644 package/boot/uboot-mediatek/patches/101-28-arm-mediatek-add-support-for-MediaTek-MT7988-SoC.patch create mode 100644 package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index ed8c4ae6cd74e0..a5401860c2be3b 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -321,6 +321,66 @@ define U-Boot/mt7986_xiaomi_redmi-router-ax6000 DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4 endef +define U-Boot/mt7988_rfb-spim-nand + NAME:=MT7988 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + UBOOT_CONFIG:=mt7988_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7988 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-ddr4 +endef + +define U-Boot/mt7988_rfb-snand + NAME:=MT7988 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + UBOOT_CONFIG:=mt7988_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=snand + BL2_SOC:=mt7988 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7988-snand-ddr4 +endef + +define U-Boot/mt7988_rfb-nor + NAME:=MT7988 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + UBOOT_CONFIG:=mt7988_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=nor + BL2_SOC:=mt7988 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7988-nor-ddr4 +endef + +define U-Boot/mt7988_rfb-emmc + NAME:=MT7988 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + UBOOT_CONFIG:=mt7988_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=emmc + BL2_SOC:=mt7988 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7988-emmc-ddr4 +endef + +define U-Boot/mt7988_rfb-sd + NAME:=MT7988 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + UBOOT_CONFIG:=mt7988_sd_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=sdmmc + BL2_SOC:=mt7988 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-ddr4 +endef + UBOOT_TARGETS := \ mt7620_mt7530_rfb \ mt7620_rfb \ @@ -348,7 +408,12 @@ UBOOT_TARGETS := \ mt7986_tplink_tl-xdr6086 \ mt7986_tplink_tl-xdr6088 \ mt7986_xiaomi_redmi-router-ax6000 \ - mt7986_rfb + mt7986_rfb \ + mt7988_rfb-spim-nand \ + mt7988_rfb-snand \ + mt7988_rfb-nor \ + mt7988_rfb-emmc \ + mt7988_rfb-sd ifdef CONFIG_TARGET_mediatek UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin) diff --git a/package/boot/uboot-mediatek/patches/101-01-arm-mediatek-retrieve-ram_base-from-dts-node-for-arm.patch b/package/boot/uboot-mediatek/patches/101-01-arm-mediatek-retrieve-ram_base-from-dts-node-for-arm.patch new file mode 100644 index 00000000000000..645b7801c8b8e0 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-01-arm-mediatek-retrieve-ram_base-from-dts-node-for-arm.patch @@ -0,0 +1,297 @@ +From 63336ec7fd7d480ac58a91f3b20d08bf1b3a13ad Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:15:41 +0800 +Subject: [PATCH 01/29] arm: mediatek: retrieve ram_base from dts node for + armv8 platform + +Now we use fdtdec_setup_mem_size_base() to get DRAM base from fdt ram node +and update gd->ram_base. CFG_SYS_SDRAM_BASE is unused and will be removed. + +Also, since mt7622 always passes fdt to linux kernel, there's no need to +assign value to gd->bd->bi_boot_params. + +Signed-off-by: Weijie Gao +--- + arch/arm/dts/mt7981-emmc-rfb.dts | 5 +++++ + arch/arm/dts/mt7981-rfb.dts | 5 +++++ + arch/arm/dts/mt7981-sd-rfb.dts | 5 +++++ + arch/arm/dts/mt7986a-bpi-r3-sd.dts | 5 +++++ + arch/arm/dts/mt7986a-rfb.dts | 5 +++++ + arch/arm/dts/mt7986a-sd-rfb.dts | 5 +++++ + arch/arm/dts/mt7986b-rfb.dts | 5 +++++ + arch/arm/dts/mt7986b-sd-rfb.dts | 5 +++++ + arch/arm/mach-mediatek/mt7622/init.c | 13 +++++++++---- + arch/arm/mach-mediatek/mt7981/init.c | 11 +++++++++-- + arch/arm/mach-mediatek/mt7986/init.c | 11 +++++++++-- + board/mediatek/mt7622/mt7622_rfb.c | 1 - + include/configs/mt7622.h | 10 ---------- + include/configs/mt7981.h | 9 --------- + include/configs/mt7986.h | 9 --------- + 15 files changed, 67 insertions(+), 37 deletions(-) + +--- a/arch/arm/dts/mt7981-emmc-rfb.dts ++++ b/arch/arm/dts/mt7981-emmc-rfb.dts +@@ -18,6 +18,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; +--- a/arch/arm/dts/mt7981-rfb.dts ++++ b/arch/arm/dts/mt7981-rfb.dts +@@ -17,6 +17,11 @@ + stdout-path = &uart0; + tick-timer = &timer0; + }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; + }; + + &uart0 { +--- a/arch/arm/dts/mt7981-sd-rfb.dts ++++ b/arch/arm/dts/mt7981-sd-rfb.dts +@@ -18,6 +18,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; +--- a/arch/arm/dts/mt7986a-bpi-r3-sd.dts ++++ b/arch/arm/dts/mt7986a-bpi-r3-sd.dts +@@ -19,6 +19,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x80000000>; ++ }; ++ + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; +--- a/arch/arm/dts/mt7986a-rfb.dts ++++ b/arch/arm/dts/mt7986a-rfb.dts +@@ -18,6 +18,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; +--- a/arch/arm/dts/mt7986a-sd-rfb.dts ++++ b/arch/arm/dts/mt7986a-sd-rfb.dts +@@ -19,6 +19,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; +--- a/arch/arm/dts/mt7986b-rfb.dts ++++ b/arch/arm/dts/mt7986b-rfb.dts +@@ -18,6 +18,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; +--- a/arch/arm/dts/mt7986b-sd-rfb.dts ++++ b/arch/arm/dts/mt7986b-sd-rfb.dts +@@ -19,6 +19,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; +--- a/arch/arm/mach-mediatek/mt7622/init.c ++++ b/arch/arm/mach-mediatek/mt7622/init.c +@@ -4,11 +4,14 @@ + * Author: Sam Shih + */ + +-#include + #include + #include + #include +-#include ++#include ++#include ++#include ++ ++DECLARE_GLOBAL_DATA_PTR; + + int print_cpuinfo(void) + { +@@ -20,11 +23,13 @@ int dram_init(void) + { + int ret; + +- ret = fdtdec_setup_memory_banksize(); ++ ret = fdtdec_setup_mem_size_base(); + if (ret) + return ret; +- return fdtdec_setup_mem_size_base(); + ++ gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_2G); ++ ++ return 0; + } + + void reset_cpu(void) +--- a/arch/arm/mach-mediatek/mt7981/init.c ++++ b/arch/arm/mach-mediatek/mt7981/init.c +@@ -4,18 +4,25 @@ + * Author: Sam Shih + */ + +-#include ++#include + #include + #include + #include + #include ++#include + #include + + DECLARE_GLOBAL_DATA_PTR; + + int dram_init(void) + { +- gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_2G); ++ int ret; ++ ++ ret = fdtdec_setup_mem_size_base(); ++ if (ret) ++ return ret; ++ ++ gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_1G); + + return 0; + } +--- a/arch/arm/mach-mediatek/mt7986/init.c ++++ b/arch/arm/mach-mediatek/mt7986/init.c +@@ -4,18 +4,25 @@ + * Author: Sam Shih + */ + +-#include ++#include + #include + #include + #include + #include ++#include + #include + + DECLARE_GLOBAL_DATA_PTR; + + int dram_init(void) + { +- gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_2G); ++ int ret; ++ ++ ret = fdtdec_setup_mem_size_base(); ++ if (ret) ++ return ret; ++ ++ gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_2G); + + return 0; + } +--- a/board/mediatek/mt7622/mt7622_rfb.c ++++ b/board/mediatek/mt7622/mt7622_rfb.c +@@ -19,7 +19,6 @@ DECLARE_GLOBAL_DATA_PTR; + + int board_init(void) + { +- gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100; + return 0; + } + +--- a/include/configs/mt7622.h ++++ b/include/configs/mt7622.h +@@ -9,14 +9,4 @@ + #ifndef __MT7622_H + #define __MT7622_H + +-/* Uboot definition */ +-#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE +- +-/* SPL -> Uboot */ +-#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE +-/* DRAM */ +-#define CFG_SYS_SDRAM_BASE 0x40000000 +- +-/* Ethernet */ +- + #endif +--- a/include/configs/mt7981.h ++++ b/include/configs/mt7981.h +@@ -9,13 +9,4 @@ + #ifndef __MT7981_H + #define __MT7981_H + +-/* Uboot definition */ +-#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE +- +-/* SPL -> Uboot */ +-#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE +- +-/* DRAM */ +-#define CFG_SYS_SDRAM_BASE 0x40000000 +- + #endif +--- a/include/configs/mt7986.h ++++ b/include/configs/mt7986.h +@@ -9,13 +9,4 @@ + #ifndef __MT7986_H + #define __MT7986_H + +-/* Uboot definition */ +-#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE +- +-/* SPL -> Uboot */ +-#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE +- +-/* DRAM */ +-#define CFG_SYS_SDRAM_BASE 0x40000000 +- + #endif diff --git a/package/boot/uboot-mediatek/patches/101-02-board-mediatek-update-config-headers.patch b/package/boot/uboot-mediatek/patches/101-02-board-mediatek-update-config-headers.patch new file mode 100644 index 00000000000000..b64ee15171fa3d --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-02-board-mediatek-update-config-headers.patch @@ -0,0 +1,129 @@ +From df3a0091b249ea82198ea019d145d05a7cf49c0d Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:15:47 +0800 +Subject: [PATCH 02/29] board: mediatek: update config headers + +Remove unused information from include/configs/mtxxxx.h + +Signed-off-by: Weijie Gao +--- + include/configs/mt7620.h | 3 +-- + include/configs/mt7621.h | 6 ++---- + include/configs/mt7623.h | 8 -------- + include/configs/mt7628.h | 5 ++--- + include/configs/mt7629.h | 13 +------------ + 5 files changed, 6 insertions(+), 29 deletions(-) + +--- a/include/configs/mt7620.h ++++ b/include/configs/mt7620.h +@@ -10,10 +10,9 @@ + + #define CFG_SYS_SDRAM_BASE 0x80000000 + +-#define CFG_SYS_INIT_SP_OFFSET 0x400000 ++#define CFG_SYS_INIT_SP_OFFSET 0x400000 + + /* SPL */ +- + #define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE + + /* Dummy value */ +--- a/include/configs/mt7621.h ++++ b/include/configs/mt7621.h +@@ -12,13 +12,11 @@ + + #define CFG_MAX_MEM_MAPPED 0x1c000000 + +-#define CFG_SYS_INIT_SP_OFFSET 0x800000 ++#define CFG_SYS_INIT_SP_OFFSET 0x800000 + + /* MMC */ + #define MMC_SUPPORTS_TUNING + +-/* NAND */ +- + /* Serial SPL */ + #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_SERIAL) + #define CFG_SYS_NS16550_CLK 50000000 +@@ -26,7 +24,7 @@ + #endif + + /* Serial common */ +-#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ ++#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ + 230400, 460800, 921600 } + + /* Dummy value */ +--- a/include/configs/mt7623.h ++++ b/include/configs/mt7623.h +@@ -11,12 +11,6 @@ + + #include + +-/* Miscellaneous configurable options */ +- +-/* Environment */ +- +-/* Preloader -> Uboot */ +- + /* MMC */ + #define MMC_SUPPORTS_TUNING + +@@ -32,8 +26,6 @@ + "fdt_addr_r=" FDT_HIGH "\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" + +-/* Ethernet */ +- + #ifdef CONFIG_DISTRO_DEFAULTS + + #define BOOT_TARGET_DEVICES(func) \ +--- a/include/configs/mt7628.h ++++ b/include/configs/mt7628.h +@@ -10,7 +10,7 @@ + + #define CFG_SYS_SDRAM_BASE 0x80000000 + +-#define CFG_SYS_INIT_SP_OFFSET 0x80000 ++#define CFG_SYS_INIT_SP_OFFSET 0x80000 + + /* Serial SPL */ + #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_SERIAL) +@@ -19,11 +19,10 @@ + #endif + + /* Serial common */ +-#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ ++#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ + 230400, 460800, 921600 } + + /* SPL */ +- + #define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE + + /* Dummy value */ +--- a/include/configs/mt7629.h ++++ b/include/configs/mt7629.h +@@ -9,21 +9,10 @@ + #ifndef __MT7629_H + #define __MT7629_H + +-#include +- +-/* Miscellaneous configurable options */ +- +-/* Environment */ +- ++/* SPL */ + #define CFG_SYS_UBOOT_BASE (0x30000000 + CONFIG_SPL_PAD_TO) + +-/* SPL -> Uboot */ +- +-/* UBoot -> Kernel */ +- + /* DRAM */ + #define CFG_SYS_SDRAM_BASE 0x40000000 + +-/* Ethernet */ +- + #endif diff --git a/package/boot/uboot-mediatek/patches/101-03-spi-mtk_spim-get-spi-clk-rate-only-once.patch b/package/boot/uboot-mediatek/patches/101-03-spi-mtk_spim-get-spi-clk-rate-only-once.patch new file mode 100644 index 00000000000000..323bb249332ccb --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-03-spi-mtk_spim-get-spi-clk-rate-only-once.patch @@ -0,0 +1,84 @@ +From 0d6d8a408f80358dd47984320ea9c65e555ac4c9 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:15:54 +0800 +Subject: [PATCH 03/29] spi: mtk_spim: get spi clk rate only once + +We don't really need to switch clk rate during operating SPIM controller. +Get clk rate only once at driver probing. + +Signed-off-by: SkyLake.Huang +Signed-off-by: Weijie Gao +Reviewed-by: Jagan Teki +--- + drivers/spi/mtk_spim.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +--- a/drivers/spi/mtk_spim.c ++++ b/drivers/spi/mtk_spim.c +@@ -137,6 +137,8 @@ struct mtk_spim_capability { + * @state: Controller state + * @sel_clk: Pad clock + * @spi_clk: Core clock ++ * @pll_clk_rate: Controller's PLL source clock rate, which is different ++ * from SPI bus clock rate + * @xfer_len: Current length of data for transfer + * @hw_cap: Controller capabilities + * @tick_dly: Used to postpone SPI sampling time +@@ -149,6 +151,7 @@ struct mtk_spim_priv { + void __iomem *base; + u32 state; + struct clk sel_clk, spi_clk; ++ u32 pll_clk_rate; + u32 xfer_len; + struct mtk_spim_capability hw_cap; + u32 tick_dly; +@@ -253,11 +256,10 @@ static int mtk_spim_hw_init(struct spi_s + static void mtk_spim_prepare_transfer(struct mtk_spim_priv *priv, + u32 speed_hz) + { +- u32 spi_clk_hz, div, sck_time, cs_time, reg_val; ++ u32 div, sck_time, cs_time, reg_val; + +- spi_clk_hz = clk_get_rate(&priv->spi_clk); +- if (speed_hz <= spi_clk_hz / 4) +- div = DIV_ROUND_UP(spi_clk_hz, speed_hz); ++ if (speed_hz <= priv->pll_clk_rate / 4) ++ div = DIV_ROUND_UP(priv->pll_clk_rate, speed_hz); + else + div = 4; + +@@ -404,7 +406,7 @@ static int mtk_spim_transfer_wait(struct + { + struct udevice *bus = dev_get_parent(slave->dev); + struct mtk_spim_priv *priv = dev_get_priv(bus); +- u32 sck_l, sck_h, spi_bus_clk, clk_count, reg; ++ u32 sck_l, sck_h, clk_count, reg; + ulong us = 1; + int ret = 0; + +@@ -413,12 +415,11 @@ static int mtk_spim_transfer_wait(struct + else + clk_count = op->data.nbytes; + +- spi_bus_clk = clk_get_rate(&priv->spi_clk); + sck_l = readl(priv->base + SPI_CFG2_REG) >> SPI_CFG2_SCK_LOW_OFFSET; + sck_h = readl(priv->base + SPI_CFG2_REG) & SPI_CFG2_SCK_HIGH_MASK; +- do_div(spi_bus_clk, sck_l + sck_h + 2); ++ do_div(priv->pll_clk_rate, sck_l + sck_h + 2); + +- us = CLK_TO_US(spi_bus_clk, clk_count * 8); ++ us = CLK_TO_US(priv->pll_clk_rate, clk_count * 8); + us += 1000 * 1000; /* 1s tolerance */ + + if (us > UINT_MAX) +@@ -662,6 +663,10 @@ static int mtk_spim_probe(struct udevice + clk_enable(&priv->sel_clk); + clk_enable(&priv->spi_clk); + ++ priv->pll_clk_rate = clk_get_rate(&priv->spi_clk); ++ if (priv->pll_clk_rate == 0) ++ return -EINVAL; ++ + return 0; + } + diff --git a/package/boot/uboot-mediatek/patches/101-04-spi-mtk_spim-clear-IRQ-enable-bits.patch b/package/boot/uboot-mediatek/patches/101-04-spi-mtk_spim-clear-IRQ-enable-bits.patch new file mode 100644 index 00000000000000..e8577f63bf1f41 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-04-spi-mtk_spim-clear-IRQ-enable-bits.patch @@ -0,0 +1,35 @@ +From a7b630f02bb12f71f23866aee6f9a1a07497d475 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:02 +0800 +Subject: [PATCH 04/29] spi: mtk_spim: clear IRQ enable bits + +In u-boot we don't use IRQ. Instead, we poll busy bit in SPI_STATUS. + +However these IRQ enable bits may be set in previous boot stage (BootROM). + +If we leave these bits not cleared, although u-boot has disabled IRQ and +nothing will happen, the linux kernel may encounter panic during +initializing the spim driver due to IRQ event happens before IRQ handler +is properly setup. + +This patch clear IRQ bits to prevent this from happening. + +Signed-off-by: SkyLake.Huang +Signed-off-by: Weijie Gao +Reviewed-by: Jagan Teki +--- + drivers/spi/mtk_spim.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/spi/mtk_spim.c ++++ b/drivers/spi/mtk_spim.c +@@ -242,6 +242,9 @@ static int mtk_spim_hw_init(struct spi_s + reg_val &= ~SPI_CMD_SAMPLE_SEL; + } + ++ /* Disable interrupt enable for pause mode & normal mode */ ++ reg_val &= ~(SPI_CMD_PAUSE_IE | SPI_CMD_FINISH_IE); ++ + /* disable dma mode */ + reg_val &= ~(SPI_CMD_TX_DMA | SPI_CMD_RX_DMA); + diff --git a/package/boot/uboot-mediatek/patches/101-05-serial-mtk-initial-priv-data-before-using.patch b/package/boot/uboot-mediatek/patches/101-05-serial-mtk-initial-priv-data-before-using.patch new file mode 100644 index 00000000000000..6f805765c1fdfb --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-05-serial-mtk-initial-priv-data-before-using.patch @@ -0,0 +1,25 @@ +From 73060da8b54e74c51ef6c1fd31c4fac6ad6b8d0e Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:07 +0800 +Subject: [PATCH 05/29] serial: mtk: initial priv data before using + +This patch ensures driver private data being fully initialized in +_debug_uart_init which is not covered by .priv_auto ops. + +Signed-off-by: Sam Shih +Signed-off-by: Weijie Gao +Reviewed-by: Stefan Roese +--- + drivers/serial/serial_mtk.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/serial/serial_mtk.c ++++ b/drivers/serial/serial_mtk.c +@@ -439,6 +439,7 @@ static inline void _debug_uart_init(void + { + struct mtk_serial_priv priv; + ++ memset(&priv, 0, sizeof(struct mtk_serial_priv)); + priv.regs = (void *) CONFIG_VAL(DEBUG_UART_BASE); + priv.fixed_clk_rate = CONFIG_DEBUG_UART_CLOCK; + diff --git a/package/boot/uboot-mediatek/patches/101-06-reset-mediatek-check-malloc-return-valaue-before-use.patch b/package/boot/uboot-mediatek/patches/101-06-reset-mediatek-check-malloc-return-valaue-before-use.patch new file mode 100644 index 00000000000000..b319f5e27eb61e --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-06-reset-mediatek-check-malloc-return-valaue-before-use.patch @@ -0,0 +1,26 @@ +From 06e6d224f7d564a34407eba21b51797da7f22628 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:11 +0800 +Subject: [PATCH 06/29] reset: mediatek: check malloc return valaue before use + +This patch add missing return value check for allocating the driver's +private data. -ENOMEM will be returned if malloc() fails. + +Signed-off-by: Sam Shih +Signed-off-by: Weijie Gao +--- + drivers/reset/reset-mediatek.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/reset/reset-mediatek.c ++++ b/drivers/reset/reset-mediatek.c +@@ -79,6 +79,9 @@ int mediatek_reset_bind(struct udevice * + return ret; + + priv = malloc(sizeof(struct mediatek_reset_priv)); ++ if (!priv) ++ return -ENOMEM; ++ + priv->regofs = regofs; + priv->nr_resets = num_regs * 32; + dev_set_priv(rst_dev, priv); diff --git a/package/boot/uboot-mediatek/patches/101-07-i2c-mediatek-fix-I2C-usability-for-MT7981.patch b/package/boot/uboot-mediatek/patches/101-07-i2c-mediatek-fix-I2C-usability-for-MT7981.patch new file mode 100644 index 00000000000000..dd00104c391ec2 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-07-i2c-mediatek-fix-I2C-usability-for-MT7981.patch @@ -0,0 +1,125 @@ +From 77898faf6ce56eb08109cdb853f074bad5acee55 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:15 +0800 +Subject: [PATCH 07/29] i2c: mediatek: fix I2C usability for MT7981 + +MT7981 actually uses MediaTek I2C controller v3 instead of v1. +This patch adds support for I2C controller v3 fix fixes the I2C usability +for MT7981. + +Signed-off-by: Sam Shih +Signed-off-by: Weijie Gao +--- + drivers/i2c/mtk_i2c.c | 45 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 43 insertions(+), 2 deletions(-) + +--- a/drivers/i2c/mtk_i2c.c ++++ b/drivers/i2c/mtk_i2c.c +@@ -183,9 +183,36 @@ static const uint mt_i2c_regs_v2[] = { + [REG_DCM_EN] = 0xf88, + }; + ++static const uint mt_i2c_regs_v3[] = { ++ [REG_PORT] = 0x0, ++ [REG_INTR_MASK] = 0x8, ++ [REG_INTR_STAT] = 0xc, ++ [REG_CONTROL] = 0x10, ++ [REG_TRANSFER_LEN] = 0x14, ++ [REG_TRANSAC_LEN] = 0x18, ++ [REG_DELAY_LEN] = 0x1c, ++ [REG_TIMING] = 0x20, ++ [REG_START] = 0x24, ++ [REG_EXT_CONF] = 0x28, ++ [REG_LTIMING] = 0x2c, ++ [REG_HS] = 0x30, ++ [REG_IO_CONFIG] = 0x34, ++ [REG_FIFO_ADDR_CLR] = 0x38, ++ [REG_TRANSFER_LEN_AUX] = 0x44, ++ [REG_CLOCK_DIV] = 0x48, ++ [REG_SOFTRESET] = 0x50, ++ [REG_SLAVE_ADDR] = 0x94, ++ [REG_DEBUGSTAT] = 0xe4, ++ [REG_DEBUGCTRL] = 0xe8, ++ [REG_FIFO_STAT] = 0xf4, ++ [REG_FIFO_THRESH] = 0xf8, ++ [REG_DCM_EN] = 0xf88, ++}; ++ + struct mtk_i2c_soc_data { + const uint *regs; + uint dma_sync: 1; ++ uint ltiming_adjust: 1; + }; + + struct mtk_i2c_priv { +@@ -401,6 +428,10 @@ static int mtk_i2c_set_speed(struct udev + (sample_cnt << HS_SAMPLE_OFFSET) | + (step_cnt << HS_STEP_OFFSET); + i2c_writel(priv, REG_HS, high_speed_reg); ++ if (priv->soc_data->ltiming_adjust) { ++ timing_reg = (sample_cnt << 12) | (step_cnt << 9); ++ i2c_writel(priv, REG_LTIMING, timing_reg); ++ } + } else { + ret = mtk_i2c_calculate_speed(clk_src, priv->speed, + &step_cnt, &sample_cnt); +@@ -412,7 +443,12 @@ static int mtk_i2c_set_speed(struct udev + high_speed_reg = I2C_TIME_CLR_VALUE; + i2c_writel(priv, REG_TIMING, timing_reg); + i2c_writel(priv, REG_HS, high_speed_reg); ++ if (priv->soc_data->ltiming_adjust) { ++ timing_reg = (sample_cnt << 6) | step_cnt; ++ i2c_writel(priv, REG_LTIMING, timing_reg); ++ } + } ++ + exit: + if (mtk_i2c_clk_disable(priv)) + return log_msg_ret("set_speed disable clk", -1); +@@ -725,7 +761,6 @@ static int mtk_i2c_probe(struct udevice + return log_msg_ret("probe enable clk", -1); + + mtk_i2c_init_hw(priv); +- + if (mtk_i2c_clk_disable(priv)) + return log_msg_ret("probe disable clk", -1); + +@@ -750,31 +785,37 @@ static int mtk_i2c_deblock(struct udevic + static const struct mtk_i2c_soc_data mt76xx_soc_data = { + .regs = mt_i2c_regs_v1, + .dma_sync = 0, ++ .ltiming_adjust = 0, + }; + + static const struct mtk_i2c_soc_data mt7981_soc_data = { +- .regs = mt_i2c_regs_v1, ++ .regs = mt_i2c_regs_v3, + .dma_sync = 1, ++ .ltiming_adjust = 1, + }; + + static const struct mtk_i2c_soc_data mt7986_soc_data = { + .regs = mt_i2c_regs_v1, + .dma_sync = 1, ++ .ltiming_adjust = 0, + }; + + static const struct mtk_i2c_soc_data mt8183_soc_data = { + .regs = mt_i2c_regs_v2, + .dma_sync = 1, ++ .ltiming_adjust = 0, + }; + + static const struct mtk_i2c_soc_data mt8518_soc_data = { + .regs = mt_i2c_regs_v1, + .dma_sync = 0, ++ .ltiming_adjust = 0, + }; + + static const struct mtk_i2c_soc_data mt8512_soc_data = { + .regs = mt_i2c_regs_v1, + .dma_sync = 1, ++ .ltiming_adjust = 0, + }; + + static const struct dm_i2c_ops mtk_i2c_ops = { diff --git a/package/boot/uboot-mediatek/patches/101-08-arm-dts-enable-i2c-support-for-MediaTek-MT7981.patch b/package/boot/uboot-mediatek/patches/101-08-arm-dts-enable-i2c-support-for-MediaTek-MT7981.patch new file mode 100644 index 00000000000000..77c4023493ad96 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-08-arm-dts-enable-i2c-support-for-MediaTek-MT7981.patch @@ -0,0 +1,36 @@ +From e9467f40d4327cfcb80944a0f12ae195b0d7cd40 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:19 +0800 +Subject: [PATCH 08/29] arm: dts: enable i2c support for MediaTek MT7981 + +This patch enables i2c support for MediaTek MT7981 + +Signed-off-by: Sam Shih +Signed-off-by: Weijie Gao +--- + arch/arm/dts/mt7981.dtsi | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/arch/arm/dts/mt7981.dtsi ++++ b/arch/arm/dts/mt7981.dtsi +@@ -181,6 +181,20 @@ + status = "disabled"; + }; + ++ i2c0: i2c@11007000 { ++ compatible = "mediatek,mt7981-i2c"; ++ reg = <0x11007000 0x1000>, ++ <0x10217080 0x80>; ++ interrupts = ; ++ clock-div = <1>; ++ clocks = <&infracfg_ao CK_INFRA_I2CO_CK>, ++ <&infracfg_ao CK_INFRA_AP_DMA_CK>; ++ clock-names = "main", "dma"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ + uart0: serial@11002000 { + compatible = "mediatek,hsuart"; + reg = <0x11002000 0x400>; diff --git a/package/boot/uboot-mediatek/patches/101-09-pwm-mtk-add-support-for-MediaTek-MT7988-SoC.patch b/package/boot/uboot-mediatek/patches/101-09-pwm-mtk-add-support-for-MediaTek-MT7988-SoC.patch new file mode 100644 index 00000000000000..6ef62811cb1fa9 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-09-pwm-mtk-add-support-for-MediaTek-MT7988-SoC.patch @@ -0,0 +1,34 @@ +From 646dab4a8e853b2d0789fa2ff64e7c48f5396cfa Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:24 +0800 +Subject: [PATCH 09/29] pwm: mtk: add support for MediaTek MT7988 SoC + +This patch adds PWM support for MediaTek MT7988 SoC. + +Signed-off-by: Weijie Gao +--- + drivers/pwm/pwm-mtk.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/pwm/pwm-mtk.c ++++ b/drivers/pwm/pwm-mtk.c +@@ -205,12 +205,19 @@ static const struct mtk_pwm_soc mt7986_d + .reg_ver = PWM_REG_V1, + }; + ++static const struct mtk_pwm_soc mt7988_data = { ++ .num_pwms = 8, ++ .pwm45_fixup = false, ++ .reg_ver = PWM_REG_V2, ++}; ++ + static const struct udevice_id mtk_pwm_ids[] = { + { .compatible = "mediatek,mt7622-pwm", .data = (ulong)&mt7622_data }, + { .compatible = "mediatek,mt7623-pwm", .data = (ulong)&mt7623_data }, + { .compatible = "mediatek,mt7629-pwm", .data = (ulong)&mt7629_data }, + { .compatible = "mediatek,mt7981-pwm", .data = (ulong)&mt7981_data }, + { .compatible = "mediatek,mt7986-pwm", .data = (ulong)&mt7986_data }, ++ { .compatible = "mediatek,mt7988-pwm", .data = (ulong)&mt7988_data }, + { } + }; + diff --git a/package/boot/uboot-mediatek/patches/101-10-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch b/package/boot/uboot-mediatek/patches/101-10-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch new file mode 100644 index 00000000000000..12eda828fa9b9e --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-10-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch @@ -0,0 +1,1505 @@ +From 94306126baa215c39e9fd5328550586dedf00230 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:28 +0800 +Subject: [PATCH 10/29] clk: mediatek: add clock driver support for MediaTek + MT7988 SoC + +This patch adds clock driver support for MediaTek MT7988 SoC + +Signed-off-by: Weijie Gao +--- + drivers/clk/mediatek/Makefile | 1 + + drivers/clk/mediatek/clk-mt7988.c | 1123 ++++++++++++++++++++++++ + include/dt-bindings/clock/mt7988-clk.h | 349 ++++++++ + 3 files changed, 1473 insertions(+) + create mode 100644 drivers/clk/mediatek/clk-mt7988.c + create mode 100644 include/dt-bindings/clock/mt7988-clk.h + +--- a/drivers/clk/mediatek/Makefile ++++ b/drivers/clk/mediatek/Makefile +@@ -9,6 +9,7 @@ obj-$(CONFIG_TARGET_MT7622) += clk-mt762 + obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o + obj-$(CONFIG_TARGET_MT7986) += clk-mt7986.o + obj-$(CONFIG_TARGET_MT7981) += clk-mt7981.o ++obj-$(CONFIG_TARGET_MT7988) += clk-mt7988.o + obj-$(CONFIG_TARGET_MT8183) += clk-mt8183.o + obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o + obj-$(CONFIG_TARGET_MT8518) += clk-mt8518.o +--- /dev/null ++++ b/drivers/clk/mediatek/clk-mt7988.c +@@ -0,0 +1,1123 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * MediaTek clock driver for MT7988 SoC ++ * ++ * Copyright (C) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "clk-mtk.h" ++ ++#define MT7988_CLK_PDN 0x250 ++#define MT7988_CLK_PDN_EN_WRITE BIT(31) ++ ++#define MT7988_ETHDMA_RST_CTRL_OFS 0x34 ++#define MT7988_ETHWARP_RST_CTRL_OFS 0x8 ++ ++#define XTAL_FACTOR(_id, _name, _parent, _mult, _div) \ ++ FACTOR(_id, _parent, _mult, _div, CLK_PARENT_XTAL) ++ ++#define PLL_FACTOR(_id, _name, _parent, _mult, _div) \ ++ FACTOR(_id, _parent, _mult, _div, CLK_PARENT_APMIXED) ++ ++#define TOP_FACTOR(_id, _name, _parent, _mult, _div) \ ++ FACTOR(_id, _parent, _mult, _div, CLK_PARENT_TOPCKGEN) ++ ++#define INFRA_FACTOR(_id, _name, _parent, _mult, _div) \ ++ FACTOR(_id, _parent, _mult, _div, CLK_PARENT_INFRASYS) ++ ++/* FIXED PLLS */ ++static const struct mtk_fixed_clk apmixedsys_mtk_plls[] = { ++ FIXED_CLK(CK_APMIXED_NETSYSPLL, CLK_XTAL, 850000000), ++ FIXED_CLK(CK_APMIXED_MPLL, CLK_XTAL, 416000000), ++ FIXED_CLK(CK_APMIXED_MMPLL, CLK_XTAL, 720000000), ++ FIXED_CLK(CK_APMIXED_APLL2, CLK_XTAL, 196608000), ++ FIXED_CLK(CK_APMIXED_NET1PLL, CLK_XTAL, 2500000000), ++ FIXED_CLK(CK_APMIXED_NET2PLL, CLK_XTAL, 800000000), ++ FIXED_CLK(CK_APMIXED_WEDMCUPLL, CLK_XTAL, 208000000), ++ FIXED_CLK(CK_APMIXED_SGMPLL, CLK_XTAL, 325000000), ++ FIXED_CLK(CK_APMIXED_ARM_B, CLK_XTAL, 1500000000), ++ FIXED_CLK(CK_APMIXED_CCIPLL2_B, CLK_XTAL, 960000000), ++ FIXED_CLK(CK_APMIXED_USXGMIIPLL, CLK_XTAL, 644533000), ++ FIXED_CLK(CK_APMIXED_MSDCPLL, CLK_XTAL, 400000000), ++}; ++ ++/* TOPCKGEN FIXED DIV */ ++static const struct mtk_fixed_factor topckgen_mtk_fixed_factors[] = { ++ XTAL_FACTOR(CK_TOP_CB_CKSQ_40M, "cb_cksq_40m", CLK_XTAL, 1, 1), ++ PLL_FACTOR(CK_TOP_CB_M_416M, "cb_m_416m", CK_APMIXED_MPLL, 1, 1), ++ PLL_FACTOR(CK_TOP_CB_M_D2, "cb_m_d2", CK_APMIXED_MPLL, 1, 2), ++ PLL_FACTOR(CK_TOP_M_D3_D2, "m_d3_d2", CK_APMIXED_MPLL, 1, 2), ++ PLL_FACTOR(CK_TOP_CB_M_D4, "cb_m_d4", CK_APMIXED_MPLL, 1, 4), ++ PLL_FACTOR(CK_TOP_CB_M_D8, "cb_m_d8", CK_APMIXED_MPLL, 1, 8), ++ PLL_FACTOR(CK_TOP_M_D8_D2, "m_d8_d2", CK_APMIXED_MPLL, 1, 16), ++ PLL_FACTOR(CK_TOP_CB_MM_720M, "cb_mm_720m", CK_APMIXED_MMPLL, 1, 1), ++ PLL_FACTOR(CK_TOP_CB_MM_D2, "cb_mm_d2", CK_APMIXED_MMPLL, 1, 2), ++ PLL_FACTOR(CK_TOP_CB_MM_D3_D5, "cb_mm_d3_d5", CK_APMIXED_MMPLL, 1, 15), ++ PLL_FACTOR(CK_TOP_CB_MM_D4, "cb_mm_d4", CK_APMIXED_MMPLL, 1, 4), ++ PLL_FACTOR(CK_TOP_MM_D6_D2, "mm_d6_d2", CK_APMIXED_MMPLL, 1, 12), ++ PLL_FACTOR(CK_TOP_CB_MM_D8, "cb_mm_d8", CK_APMIXED_MMPLL, 1, 8), ++ PLL_FACTOR(CK_TOP_CB_APLL2_196M, "cb_apll2_196m", CK_APMIXED_APLL2, 1, ++ 1), ++ PLL_FACTOR(CK_TOP_CB_APLL2_D4, "cb_apll2_d4", CK_APMIXED_APLL2, 1, 4), ++ PLL_FACTOR(CK_TOP_CB_NET1_D4, "cb_net1_d4", CK_APMIXED_NET1PLL, 1, 4), ++ PLL_FACTOR(CK_TOP_CB_NET1_D5, "cb_net1_d5", CK_APMIXED_NET1PLL, 1, 5), ++ PLL_FACTOR(CK_TOP_NET1_D5_D2, "net1_d5_d2", CK_APMIXED_NET1PLL, 1, 10), ++ PLL_FACTOR(CK_TOP_NET1_D5_D4, "net1_d5_d4", CK_APMIXED_NET1PLL, 1, 20), ++ PLL_FACTOR(CK_TOP_CB_NET1_D8, "cb_net1_d8", CK_APMIXED_NET1PLL, 1, 8), ++ PLL_FACTOR(CK_TOP_NET1_D8_D2, "net1_d8_d2", CK_APMIXED_NET1PLL, 1, 16), ++ PLL_FACTOR(CK_TOP_NET1_D8_D4, "net1_d8_d4", CK_APMIXED_NET1PLL, 1, 32), ++ PLL_FACTOR(CK_TOP_NET1_D8_D8, "net1_d8_d8", CK_APMIXED_NET1PLL, 1, 64), ++ PLL_FACTOR(CK_TOP_NET1_D8_D16, "net1_d8_d16", CK_APMIXED_NET1PLL, 1, ++ 128), ++ PLL_FACTOR(CK_TOP_CB_NET2_800M, "cb_net2_800m", CK_APMIXED_NET2PLL, 1, ++ 1), ++ PLL_FACTOR(CK_TOP_CB_NET2_D2, "cb_net2_d2", CK_APMIXED_NET2PLL, 1, 2), ++ PLL_FACTOR(CK_TOP_CB_NET2_D4, "cb_net2_d4", CK_APMIXED_NET2PLL, 1, 4), ++ PLL_FACTOR(CK_TOP_NET2_D4_D4, "net2_d4_d4", CK_APMIXED_NET2PLL, 1, 16), ++ PLL_FACTOR(CK_TOP_NET2_D4_D8, "net2_d4_d8", CK_APMIXED_NET2PLL, 1, 32), ++ PLL_FACTOR(CK_TOP_CB_NET2_D6, "cb_net2_d6", CK_APMIXED_NET2PLL, 1, 6), ++ PLL_FACTOR(CK_TOP_CB_NET2_D8, "cb_net2_d8", CK_APMIXED_NET2PLL, 1, 8), ++ PLL_FACTOR(CK_TOP_CB_WEDMCU_208M, "cb_wedmcu_208m", ++ CK_APMIXED_WEDMCUPLL, 1, 1), ++ PLL_FACTOR(CK_TOP_CB_SGM_325M, "cb_sgm_325m", CK_APMIXED_SGMPLL, 1, 1), ++ PLL_FACTOR(CK_TOP_CB_NETSYS_850M, "cb_netsys_850m", ++ CK_APMIXED_NETSYSPLL, 1, 1), ++ PLL_FACTOR(CK_TOP_CB_MSDC_400M, "cb_msdc_400m", CK_APMIXED_MSDCPLL, 1, ++ 1), ++ TOP_FACTOR(CK_TOP_CKSQ_40M_D2, "cksq_40m_d2", CK_TOP_CB_CKSQ_40M, 1, 2), ++ TOP_FACTOR(CK_TOP_CB_RTC_32K, "cb_rtc_32k", CK_TOP_CB_CKSQ_40M, 1, ++ 1250), ++ TOP_FACTOR(CK_TOP_CB_RTC_32P7K, "cb_rtc_32p7k", CK_TOP_CB_CKSQ_40M, 1, ++ 1220), ++ TOP_FACTOR(CK_TOP_INFRA_F32K, "csw_infra_f32k", CK_TOP_CB_RTC_32P7K, 1, ++ 1), ++ XTAL_FACTOR(CK_TOP_CKSQ_SRC, "cksq_src", CLK_XTAL, 1, 1), ++ TOP_FACTOR(CK_TOP_NETSYS_2X, "netsys_2x", CK_TOP_NETSYS_2X_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_NETSYS_GSW, "netsys_gsw", CK_TOP_NETSYS_GSW_SEL, 1, ++ 1), ++ TOP_FACTOR(CK_TOP_NETSYS_WED_MCU, "netsys_wed_mcu", ++ CK_TOP_NETSYS_MCU_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_EIP197, "eip197", CK_TOP_EIP197_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_EMMC_250M, "emmc_250m", CK_TOP_EMMC_250M_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_EMMC_400M, "emmc_400m", CK_TOP_EMMC_400M_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_SPI, "spi", CK_TOP_SPI_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_SPIM_MST, "spim_mst", CK_TOP_SPIM_MST_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_NFI1X, "nfi1x", CK_TOP_NFI1X_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_SPINFI_BCK, "spinfi_bck", CK_TOP_SPINFI_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_I2C_BCK, "i2c_bck", CK_TOP_I2C_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_USB_SYS, "usb_sys", CK_TOP_USB_SYS_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_USB_SYS_P1, "usb_sys_p1", CK_TOP_USB_SYS_P1_SEL, 1, ++ 1), ++ TOP_FACTOR(CK_TOP_USB_XHCI, "usb_xhci", CK_TOP_USB_XHCI_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_USB_XHCI_P1, "usb_xhci_p1", CK_TOP_USB_XHCI_P1_SEL, 1, ++ 1), ++ TOP_FACTOR(CK_TOP_USB_FRMCNT, "usb_frmcnt", CK_TOP_USB_FRMCNT_SEL, 1, ++ 1), ++ TOP_FACTOR(CK_TOP_USB_FRMCNT_P1, "usb_frmcnt_p1", ++ CK_TOP_USB_FRMCNT_P1_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_AUD, "aud", CK_TOP_AUD_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_A1SYS, "a1sys", CK_TOP_A1SYS_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_AUD_L, "aud_l", CK_TOP_AUD_L_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_A_TUNER, "a_tuner", CK_TOP_A_TUNER_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_SYSAXI, "sysaxi", CK_TOP_SYSAXI_SEL, 1, 1), ++ TOP_FACTOR(CK_TOP_INFRA_F26M, "csw_infra_f26m", CK_TOP_INFRA_F26M_SEL, ++ 1, 1), ++ TOP_FACTOR(CK_TOP_USB_REF, "usb_ref", CK_TOP_CKSQ_SRC, 1, 1), ++ TOP_FACTOR(CK_TOP_USB_CK_P1, "usb_ck_p1", CK_TOP_CKSQ_SRC, 1, 1), ++}; ++ ++/* TOPCKGEN MUX PARENTS */ ++static const int netsys_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NET2_D2, ++ CK_TOP_CB_MM_D2 }; ++ ++static const int netsys_500m_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET1_D5, ++ CK_TOP_NET1_D5_D2 }; ++ ++static const int netsys_2x_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET2_800M, ++ CK_TOP_CB_MM_720M }; ++ ++static const int netsys_gsw_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NET1_D4, ++ CK_TOP_CB_NET1_D5 }; ++ ++static const int eth_gmii_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D5_D4 }; ++ ++static const int netsys_mcu_parents[] = { ++ CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NET2_800M, CK_TOP_CB_MM_720M, ++ CK_TOP_CB_NET1_D4, CK_TOP_CB_NET1_D5, CK_TOP_CB_M_416M ++}; ++ ++static const int eip197_parents[] = { ++ CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NETSYS_850M, CK_TOP_CB_NET2_800M, ++ CK_TOP_CB_MM_720M, CK_TOP_CB_NET1_D4, CK_TOP_CB_NET1_D5 ++}; ++ ++static const int axi_infra_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_NET1_D8_D2 }; ++ ++static const int uart_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_M_D8, ++ CK_TOP_M_D8_D2 }; ++ ++static const int emmc_250m_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D5_D2, ++ CK_TOP_CB_MM_D4 }; ++ ++static const int emmc_400m_parents[] = { ++ CK_TOP_CB_CKSQ_40M, CK_TOP_CB_MSDC_400M, CK_TOP_CB_MM_D2, ++ CK_TOP_CB_M_D2, CK_TOP_CB_MM_D4, CK_TOP_NET1_D8_D2 ++}; ++ ++static const int spi_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_M_D2, ++ CK_TOP_CB_MM_D4, CK_TOP_NET1_D8_D2, ++ CK_TOP_CB_NET2_D6, CK_TOP_NET1_D5_D4, ++ CK_TOP_CB_M_D4, CK_TOP_NET1_D8_D4 }; ++ ++static const int nfi1x_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_MM_D4, ++ CK_TOP_NET1_D8_D2, CK_TOP_CB_NET2_D6, ++ CK_TOP_CB_M_D4, CK_TOP_CB_MM_D8, ++ CK_TOP_NET1_D8_D4, CK_TOP_CB_M_D8 }; ++ ++static const int spinfi_parents[] = { CK_TOP_CKSQ_40M_D2, CK_TOP_CB_CKSQ_40M, ++ CK_TOP_NET1_D5_D4, CK_TOP_CB_M_D4, ++ CK_TOP_CB_MM_D8, CK_TOP_NET1_D8_D4, ++ CK_TOP_MM_D6_D2, CK_TOP_CB_M_D8 }; ++ ++static const int pwm_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D8_D2, ++ CK_TOP_NET1_D5_D4, CK_TOP_CB_M_D4, ++ CK_TOP_M_D8_D2, CK_TOP_CB_RTC_32K }; ++ ++static const int i2c_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D5_D4, ++ CK_TOP_CB_M_D4, CK_TOP_NET1_D8_D4 }; ++ ++static const int pcie_mbist_250m_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_NET1_D5_D2 }; ++ ++static const int pextp_tl_ck_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET2_D6, CK_TOP_CB_MM_D8, ++ CK_TOP_M_D8_D2, CK_TOP_CB_RTC_32K }; ++ ++static const int usb_frmcnt_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_MM_D3_D5 }; ++ ++static const int aud_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_APLL2_196M }; ++ ++static const int a1sys_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_APLL2_D4 }; ++ ++static const int aud_l_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_APLL2_196M, ++ CK_TOP_M_D8_D2 }; ++ ++static const int sspxtp_parents[] = { CK_TOP_CKSQ_40M_D2, CK_TOP_M_D8_D2 }; ++ ++static const int usxgmii_sbus_0_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_NET1_D8_D4 }; ++ ++static const int sgm_0_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_SGM_325M }; ++ ++static const int sysapb_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_M_D3_D2 }; ++ ++static const int eth_refck_50m_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_NET2_D4_D4 }; ++ ++static const int eth_sys_200m_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET2_D4 }; ++ ++static const int eth_xgmii_parents[] = { CK_TOP_CKSQ_40M_D2, CK_TOP_NET1_D8_D8, ++ CK_TOP_NET1_D8_D16 }; ++ ++static const int bus_tops_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NET1_D5, ++ CK_TOP_CB_NET2_D2 }; ++ ++static const int npu_tops_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET2_800M }; ++ ++static const int dramc_md32_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_M_D2, ++ CK_TOP_CB_WEDMCU_208M }; ++ ++static const int da_xtp_glb_p0_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET2_D8 }; ++ ++static const int mcusys_backup_625m_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET1_D4 }; ++ ++static const int macsec_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_SGM_325M, ++ CK_TOP_CB_NET1_D8 }; ++ ++static const int netsys_tops_400m_parents[] = { CK_TOP_CB_CKSQ_40M, ++ CK_TOP_CB_NET2_D2 }; ++ ++static const int eth_mii_parents[] = { CK_TOP_CKSQ_40M_D2, CK_TOP_NET2_D4_D8 }; ++ ++#define TOP_MUX(_id, _name, _parents, _mux_ofs, _mux_set_ofs, _mux_clr_ofs, \ ++ _shift, _width, _gate, _upd_ofs, _upd) \ ++ { \ ++ .id = _id, .mux_reg = _mux_ofs, .mux_set_reg = _mux_set_ofs, \ ++ .mux_clr_reg = _mux_clr_ofs, .upd_reg = _upd_ofs, \ ++ .upd_shift = _upd, .mux_shift = _shift, \ ++ .mux_mask = BIT(_width) - 1, .gate_reg = _mux_ofs, \ ++ .gate_shift = _gate, .parent = _parents, \ ++ .num_parents = ARRAY_SIZE(_parents), \ ++ .flags = CLK_MUX_SETCLR_UPD, \ ++ } ++ ++/* TOPCKGEN MUX_GATE */ ++static const struct mtk_composite topckgen_mtk_muxes[] = { ++ TOP_MUX(CK_TOP_NETSYS_SEL, "netsys_sel", netsys_parents, 0x0, 0x4, 0x8, ++ 0, 2, 7, 0x1c0, 0), ++ TOP_MUX(CK_TOP_NETSYS_500M_SEL, "netsys_500m_sel", netsys_500m_parents, ++ 0x0, 0x4, 0x8, 8, 2, 15, 0x1c0, 1), ++ TOP_MUX(CK_TOP_NETSYS_2X_SEL, "netsys_2x_sel", netsys_2x_parents, 0x0, ++ 0x4, 0x8, 16, 2, 23, 0x1c0, 2), ++ TOP_MUX(CK_TOP_NETSYS_GSW_SEL, "netsys_gsw_sel", netsys_gsw_parents, ++ 0x0, 0x4, 0x8, 24, 2, 31, 0x1c0, 3), ++ TOP_MUX(CK_TOP_ETH_GMII_SEL, "eth_gmii_sel", eth_gmii_parents, 0x10, ++ 0x14, 0x18, 0, 1, 7, 0x1c0, 4), ++ TOP_MUX(CK_TOP_NETSYS_MCU_SEL, "netsys_mcu_sel", netsys_mcu_parents, ++ 0x10, 0x14, 0x18, 8, 3, 15, 0x1c0, 5), ++ TOP_MUX(CK_TOP_NETSYS_PAO_2X_SEL, "netsys_pao_2x_sel", ++ netsys_mcu_parents, 0x10, 0x14, 0x18, 16, 3, 23, 0x1c0, 6), ++ TOP_MUX(CK_TOP_EIP197_SEL, "eip197_sel", eip197_parents, 0x10, 0x14, ++ 0x18, 24, 3, 31, 0x1c0, 7), ++ TOP_MUX(CK_TOP_AXI_INFRA_SEL, "axi_infra_sel", axi_infra_parents, 0x20, ++ 0x24, 0x28, 0, 1, 7, 0x1c0, 8), ++ TOP_MUX(CK_TOP_UART_SEL, "uart_sel", uart_parents, 0x20, 0x24, 0x28, 8, ++ 2, 15, 0x1c0, 9), ++ TOP_MUX(CK_TOP_EMMC_250M_SEL, "emmc_250m_sel", emmc_250m_parents, 0x20, ++ 0x24, 0x28, 16, 2, 23, 0x1c0, 10), ++ TOP_MUX(CK_TOP_EMMC_400M_SEL, "emmc_400m_sel", emmc_400m_parents, 0x20, ++ 0x24, 0x28, 24, 3, 31, 0x1c0, 11), ++ TOP_MUX(CK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x30, 0x34, 0x38, 0, 3, ++ 7, 0x1c0, 12), ++ TOP_MUX(CK_TOP_SPIM_MST_SEL, "spim_mst_sel", spi_parents, 0x30, 0x34, ++ 0x38, 8, 3, 15, 0x1c0, 13), ++ TOP_MUX(CK_TOP_NFI1X_SEL, "nfi1x_sel", nfi1x_parents, 0x30, 0x34, 0x38, ++ 16, 3, 23, 0x1c0, 14), ++ TOP_MUX(CK_TOP_SPINFI_SEL, "spinfi_sel", spinfi_parents, 0x30, 0x34, ++ 0x38, 24, 3, 31, 0x1c0, 15), ++ TOP_MUX(CK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 0x40, 0x44, 0x48, 0, 3, ++ 7, 0x1c0, 16), ++ TOP_MUX(CK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 0x40, 0x44, 0x48, 8, 2, ++ 15, 0x1c0, 17), ++ TOP_MUX(CK_TOP_PCIE_MBIST_250M_SEL, "pcie_mbist_250m_sel", ++ pcie_mbist_250m_parents, 0x40, 0x44, 0x48, 16, 1, 23, 0x1c0, ++ 18), ++ TOP_MUX(CK_TOP_PEXTP_TL_SEL, "pextp_tl_ck_sel", pextp_tl_ck_parents, ++ 0x40, 0x44, 0x48, 24, 3, 31, 0x1c0, 19), ++ TOP_MUX(CK_TOP_PEXTP_TL_P1_SEL, "pextp_tl_ck_p1_sel", ++ pextp_tl_ck_parents, 0x50, 0x54, 0x58, 0, 3, 7, 0x1c0, 20), ++ TOP_MUX(CK_TOP_PEXTP_TL_P2_SEL, "pextp_tl_ck_p2_sel", ++ pextp_tl_ck_parents, 0x50, 0x54, 0x58, 8, 3, 15, 0x1c0, 21), ++ TOP_MUX(CK_TOP_PEXTP_TL_P3_SEL, "pextp_tl_ck_p3_sel", ++ pextp_tl_ck_parents, 0x50, 0x54, 0x58, 16, 3, 23, 0x1c0, 22), ++ TOP_MUX(CK_TOP_USB_SYS_SEL, "usb_sys_sel", eth_gmii_parents, 0x50, 0x54, ++ 0x58, 24, 1, 31, 0x1c0, 23), ++ TOP_MUX(CK_TOP_USB_SYS_P1_SEL, "usb_sys_p1_sel", eth_gmii_parents, 0x60, ++ 0x64, 0x68, 0, 1, 7, 0x1c0, 24), ++ TOP_MUX(CK_TOP_USB_XHCI_SEL, "usb_xhci_sel", eth_gmii_parents, 0x60, ++ 0x64, 0x68, 8, 1, 15, 0x1c0, 25), ++ TOP_MUX(CK_TOP_USB_XHCI_P1_SEL, "usb_xhci_p1_sel", eth_gmii_parents, ++ 0x60, 0x64, 0x68, 16, 1, 23, 0x1c0, 26), ++ TOP_MUX(CK_TOP_USB_FRMCNT_SEL, "usb_frmcnt_sel", usb_frmcnt_parents, ++ 0x60, 0x64, 0x68, 24, 1, 31, 0x1c0, 27), ++ TOP_MUX(CK_TOP_USB_FRMCNT_P1_SEL, "usb_frmcnt_p1_sel", ++ usb_frmcnt_parents, 0x70, 0x74, 0x78, 0, 1, 7, 0x1c0, 28), ++ TOP_MUX(CK_TOP_AUD_SEL, "aud_sel", aud_parents, 0x70, 0x74, 0x78, 8, 1, ++ 15, 0x1c0, 29), ++ TOP_MUX(CK_TOP_A1SYS_SEL, "a1sys_sel", a1sys_parents, 0x70, 0x74, 0x78, ++ 16, 1, 23, 0x1c0, 30), ++ TOP_MUX(CK_TOP_AUD_L_SEL, "aud_l_sel", aud_l_parents, 0x70, 0x74, 0x78, ++ 24, 2, 31, 0x1c4, 0), ++ TOP_MUX(CK_TOP_A_TUNER_SEL, "a_tuner_sel", a1sys_parents, 0x80, 0x84, ++ 0x88, 0, 1, 7, 0x1c4, 1), ++ TOP_MUX(CK_TOP_SSPXTP_SEL, "sspxtp_sel", sspxtp_parents, 0x80, 0x84, ++ 0x88, 8, 1, 15, 0x1c4, 2), ++ TOP_MUX(CK_TOP_USB_PHY_SEL, "usb_phy_sel", sspxtp_parents, 0x80, 0x84, ++ 0x88, 16, 1, 23, 0x1c4, 3), ++ TOP_MUX(CK_TOP_USXGMII_SBUS_0_SEL, "usxgmii_sbus_0_sel", ++ usxgmii_sbus_0_parents, 0x80, 0x84, 0x88, 24, 1, 31, 0x1c4, 4), ++ TOP_MUX(CK_TOP_USXGMII_SBUS_1_SEL, "usxgmii_sbus_1_sel", ++ usxgmii_sbus_0_parents, 0x90, 0x94, 0x98, 0, 1, 7, 0x1c4, 5), ++ TOP_MUX(CK_TOP_SGM_0_SEL, "sgm_0_sel", sgm_0_parents, 0x90, 0x94, 0x98, ++ 8, 1, 15, 0x1c4, 6), ++ TOP_MUX(CK_TOP_SGM_SBUS_0_SEL, "sgm_sbus_0_sel", usxgmii_sbus_0_parents, ++ 0x90, 0x94, 0x98, 16, 1, 23, 0x1c4, 7), ++ TOP_MUX(CK_TOP_SGM_1_SEL, "sgm_1_sel", sgm_0_parents, 0x90, 0x94, 0x98, ++ 24, 1, 31, 0x1c4, 8), ++ TOP_MUX(CK_TOP_SGM_SBUS_1_SEL, "sgm_sbus_1_sel", usxgmii_sbus_0_parents, ++ 0xa0, 0xa4, 0xa8, 0, 1, 7, 0x1c4, 9), ++ TOP_MUX(CK_TOP_XFI_PHY_0_XTAL_SEL, "xfi_phy_0_xtal_sel", sspxtp_parents, ++ 0xa0, 0xa4, 0xa8, 8, 1, 15, 0x1c4, 10), ++ TOP_MUX(CK_TOP_XFI_PHY_1_XTAL_SEL, "xfi_phy_1_xtal_sel", sspxtp_parents, ++ 0xa0, 0xa4, 0xa8, 16, 1, 23, 0x1c4, 11), ++ TOP_MUX(CK_TOP_SYSAXI_SEL, "sysaxi_sel", axi_infra_parents, 0xa0, 0xa4, ++ 0xa8, 24, 1, 31, 0x1c4, 12), ++ TOP_MUX(CK_TOP_SYSAPB_SEL, "sysapb_sel", sysapb_parents, 0xb0, 0xb4, ++ 0xb8, 0, 1, 7, 0x1c4, 13), ++ TOP_MUX(CK_TOP_ETH_REFCK_50M_SEL, "eth_refck_50m_sel", ++ eth_refck_50m_parents, 0xb0, 0xb4, 0xb8, 8, 1, 15, 0x1c4, 14), ++ TOP_MUX(CK_TOP_ETH_SYS_200M_SEL, "eth_sys_200m_sel", ++ eth_sys_200m_parents, 0xb0, 0xb4, 0xb8, 16, 1, 23, 0x1c4, 15), ++ TOP_MUX(CK_TOP_ETH_SYS_SEL, "eth_sys_sel", pcie_mbist_250m_parents, ++ 0xb0, 0xb4, 0xb8, 24, 1, 31, 0x1c4, 16), ++ TOP_MUX(CK_TOP_ETH_XGMII_SEL, "eth_xgmii_sel", eth_xgmii_parents, 0xc0, ++ 0xc4, 0xc8, 0, 2, 7, 0x1c4, 17), ++ TOP_MUX(CK_TOP_BUS_TOPS_SEL, "bus_tops_sel", bus_tops_parents, 0xc0, ++ 0xc4, 0xc8, 8, 2, 15, 0x1c4, 18), ++ TOP_MUX(CK_TOP_NPU_TOPS_SEL, "npu_tops_sel", npu_tops_parents, 0xc0, ++ 0xc4, 0xc8, 16, 1, 23, 0x1c4, 19), ++ TOP_MUX(CK_TOP_DRAMC_SEL, "dramc_sel", sspxtp_parents, 0xc0, 0xc4, 0xc8, ++ 24, 1, 31, 0x1c4, 20), ++ TOP_MUX(CK_TOP_DRAMC_MD32_SEL, "dramc_md32_sel", dramc_md32_parents, ++ 0xd0, 0xd4, 0xd8, 0, 2, 7, 0x1c4, 21), ++ TOP_MUX(CK_TOP_INFRA_F26M_SEL, "csw_infra_f26m_sel", sspxtp_parents, ++ 0xd0, 0xd4, 0xd8, 8, 1, 15, 0x1c4, 22), ++ TOP_MUX(CK_TOP_PEXTP_P0_SEL, "pextp_p0_sel", sspxtp_parents, 0xd0, 0xd4, ++ 0xd8, 16, 1, 23, 0x1c4, 23), ++ TOP_MUX(CK_TOP_PEXTP_P1_SEL, "pextp_p1_sel", sspxtp_parents, 0xd0, 0xd4, ++ 0xd8, 24, 1, 31, 0x1c4, 24), ++ TOP_MUX(CK_TOP_PEXTP_P2_SEL, "pextp_p2_sel", sspxtp_parents, 0xe0, 0xe4, ++ 0xe8, 0, 1, 7, 0x1c4, 25), ++ TOP_MUX(CK_TOP_PEXTP_P3_SEL, "pextp_p3_sel", sspxtp_parents, 0xe0, 0xe4, ++ 0xe8, 8, 1, 15, 0x1c4, 26), ++ TOP_MUX(CK_TOP_DA_XTP_GLB_P0_SEL, "da_xtp_glb_p0_sel", ++ da_xtp_glb_p0_parents, 0xe0, 0xe4, 0xe8, 16, 1, 23, 0x1c4, 27), ++ TOP_MUX(CK_TOP_DA_XTP_GLB_P1_SEL, "da_xtp_glb_p1_sel", ++ da_xtp_glb_p0_parents, 0xe0, 0xe4, 0xe8, 24, 1, 31, 0x1c4, 28), ++ TOP_MUX(CK_TOP_DA_XTP_GLB_P2_SEL, "da_xtp_glb_p2_sel", ++ da_xtp_glb_p0_parents, 0xf0, 0xf4, 0xf8, 0, 1, 7, 0x1c4, 29), ++ TOP_MUX(CK_TOP_DA_XTP_GLB_P3_SEL, "da_xtp_glb_p3_sel", ++ da_xtp_glb_p0_parents, 0xf0, 0xf4, 0xf8, 8, 1, 15, 0x1c4, 30), ++ TOP_MUX(CK_TOP_CKM_SEL, "ckm_sel", sspxtp_parents, 0xf0, 0xf4, 0xf8, 16, ++ 1, 23, 0x1c8, 0), ++ TOP_MUX(CK_TOP_DA_SELM_XTAL_SEL, "da_selm_xtal_sel", sspxtp_parents, ++ 0xf0, 0xf4, 0xf8, 24, 1, 31, 0x1c8, 1), ++ TOP_MUX(CK_TOP_PEXTP_SEL, "pextp_sel", sspxtp_parents, 0x100, 0x104, ++ 0x108, 0, 1, 7, 0x1c8, 2), ++ TOP_MUX(CK_TOP_TOPS_P2_26M_SEL, "tops_p2_26m_sel", sspxtp_parents, ++ 0x100, 0x104, 0x108, 8, 1, 15, 0x1c8, 3), ++ TOP_MUX(CK_TOP_MCUSYS_BACKUP_625M_SEL, "mcusys_backup_625m_sel", ++ mcusys_backup_625m_parents, 0x100, 0x104, 0x108, 16, 1, 23, ++ 0x1c8, 4), ++ TOP_MUX(CK_TOP_NETSYS_SYNC_250M_SEL, "netsys_sync_250m_sel", ++ pcie_mbist_250m_parents, 0x100, 0x104, 0x108, 24, 1, 31, 0x1c8, ++ 5), ++ TOP_MUX(CK_TOP_MACSEC_SEL, "macsec_sel", macsec_parents, 0x110, 0x114, ++ 0x118, 0, 2, 7, 0x1c8, 6), ++ TOP_MUX(CK_TOP_NETSYS_TOPS_400M_SEL, "netsys_tops_400m_sel", ++ netsys_tops_400m_parents, 0x110, 0x114, 0x118, 8, 1, 15, 0x1c8, ++ 7), ++ TOP_MUX(CK_TOP_NETSYS_PPEFB_250M_SEL, "netsys_ppefb_250m_sel", ++ pcie_mbist_250m_parents, 0x110, 0x114, 0x118, 16, 1, 23, 0x1c8, ++ 8), ++ TOP_MUX(CK_TOP_NETSYS_WARP_SEL, "netsys_warp_sel", netsys_parents, ++ 0x110, 0x114, 0x118, 24, 2, 31, 0x1c8, 9), ++ TOP_MUX(CK_TOP_ETH_MII_SEL, "eth_mii_sel", eth_mii_parents, 0x120, ++ 0x124, 0x128, 0, 1, 7, 0x1c8, 10), ++ TOP_MUX(CK_TOP_CK_NPU_SEL_CM_TOPS_SEL, "ck_npu_sel_cm_tops_sel", ++ netsys_2x_parents, 0x120, 0x124, 0x128, 8, 2, 15, 0x1c8, 11), ++}; ++ ++/* INFRA FIXED DIV */ ++static const struct mtk_fixed_factor infracfg_mtk_fixed_factor[] = { ++ TOP_FACTOR(CK_INFRA_CK_F26M, "infra_ck_f26m", CK_TOP_INFRA_F26M_SEL, 1, ++ 1), ++ TOP_FACTOR(CK_INFRA_PWM_O, "infra_pwm_o", CK_TOP_PWM_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_PCIE_OCC_P0, "infra_pcie_ck_occ_p0", ++ CK_TOP_PEXTP_TL_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_PCIE_OCC_P1, "infra_pcie_ck_occ_p1", ++ CK_TOP_PEXTP_TL_P1_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_PCIE_OCC_P2, "infra_pcie_ck_occ_p2", ++ CK_TOP_PEXTP_TL_P2_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_PCIE_OCC_P3, "infra_pcie_ck_occ_p3", ++ CK_TOP_PEXTP_TL_P3_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_133M_HCK, "infra_133m_hck", CK_TOP_SYSAXI, 1, 1), ++ INFRA_FACTOR(CK_INFRA_133M_PHCK, "infra_133m_phck", CK_INFRA_133M_HCK, ++ 1, 1), ++ INFRA_FACTOR(CK_INFRA_66M_PHCK, "infra_66m_phck", CK_INFRA_133M_HCK, 1, ++ 1), ++ TOP_FACTOR(CK_INFRA_FAUD_L_O, "infra_faud_l_o", CK_TOP_AUD_L, 1, 1), ++ TOP_FACTOR(CK_INFRA_FAUD_AUD_O, "infra_faud_aud_o", CK_TOP_A1SYS, 1, 1), ++ TOP_FACTOR(CK_INFRA_FAUD_EG2_O, "infra_faud_eg2_o", CK_TOP_A_TUNER, 1, ++ 1), ++ TOP_FACTOR(CK_INFRA_I2C_O, "infra_i2c_o", CK_TOP_I2C_BCK, 1, 1), ++ TOP_FACTOR(CK_INFRA_UART_O0, "infra_uart_o0", CK_TOP_UART_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_UART_O1, "infra_uart_o1", CK_TOP_UART_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_UART_O2, "infra_uart_o2", CK_TOP_UART_SEL, 1, 1), ++ TOP_FACTOR(CK_INFRA_NFI_O, "infra_nfi_o", CK_TOP_NFI1X, 1, 1), ++ TOP_FACTOR(CK_INFRA_SPINFI_O, "infra_spinfi_o", CK_TOP_SPINFI_BCK, 1, ++ 1), ++ TOP_FACTOR(CK_INFRA_SPI0_O, "infra_spi0_o", CK_TOP_SPI, 1, 1), ++ TOP_FACTOR(CK_INFRA_SPI1_O, "infra_spi1_o", CK_TOP_SPIM_MST, 1, 1), ++ INFRA_FACTOR(CK_INFRA_LB_MUX_FRTC, "infra_lb_mux_frtc", CK_INFRA_FRTC, ++ 1, 1), ++ TOP_FACTOR(CK_INFRA_FRTC, "infra_frtc", CK_TOP_CB_RTC_32K, 1, 1), ++ TOP_FACTOR(CK_INFRA_FMSDC400_O, "infra_fmsdc400_o", CK_TOP_EMMC_400M, 1, ++ 1), ++ TOP_FACTOR(CK_INFRA_FMSDC2_HCK_OCC, "infra_fmsdc2_hck_occ", ++ CK_TOP_EMMC_250M, 1, 1), ++ TOP_FACTOR(CK_INFRA_PERI_133M, "infra_peri_133m", CK_TOP_SYSAXI, 1, 1), ++ TOP_FACTOR(CK_INFRA_USB_O, "infra_usb_o", CK_TOP_USB_REF, 1, 1), ++ TOP_FACTOR(CK_INFRA_USB_O_P1, "infra_usb_o_p1", CK_TOP_USB_CK_P1, 1, 1), ++ TOP_FACTOR(CK_INFRA_USB_FRMCNT_O, "infra_usb_frmcnt_o", ++ CK_TOP_USB_FRMCNT, 1, 1), ++ TOP_FACTOR(CK_INFRA_USB_FRMCNT_O_P1, "infra_usb_frmcnt_o_p1", ++ CK_TOP_USB_FRMCNT_P1, 1, 1), ++ TOP_FACTOR(CK_INFRA_USB_XHCI_O, "infra_usb_xhci_o", CK_TOP_USB_XHCI, 1, ++ 1), ++ TOP_FACTOR(CK_INFRA_USB_XHCI_O_P1, "infra_usb_xhci_o_p1", ++ CK_TOP_USB_XHCI_P1, 1, 1), ++ XTAL_FACTOR(CK_INFRA_USB_PIPE_O, "infra_usb_pipe_o", CLK_XTAL, 1, 1), ++ XTAL_FACTOR(CK_INFRA_USB_PIPE_O_P1, "infra_usb_pipe_o_p1", CLK_XTAL, 1, ++ 1), ++ XTAL_FACTOR(CK_INFRA_USB_UTMI_O, "infra_usb_utmi_o", CLK_XTAL, 1, 1), ++ XTAL_FACTOR(CK_INFRA_USB_UTMI_O_P1, "infra_usb_utmi_o_p1", CLK_XTAL, 1, ++ 1), ++ XTAL_FACTOR(CK_INFRA_PCIE_PIPE_OCC_P0, "infra_pcie_pipe_ck_occ_p0", ++ CLK_XTAL, 1, 1), ++ XTAL_FACTOR(CK_INFRA_PCIE_PIPE_OCC_P1, "infra_pcie_pipe_ck_occ_p1", ++ CLK_XTAL, 1, 1), ++ XTAL_FACTOR(CK_INFRA_PCIE_PIPE_OCC_P2, "infra_pcie_pipe_ck_occ_p2", ++ CLK_XTAL, 1, 1), ++ XTAL_FACTOR(CK_INFRA_PCIE_PIPE_OCC_P3, "infra_pcie_pipe_ck_occ_p3", ++ CLK_XTAL, 1, 1), ++ TOP_FACTOR(CK_INFRA_F26M_O0, "infra_f26m_o0", CK_TOP_INFRA_F26M, 1, 1), ++ TOP_FACTOR(CK_INFRA_F26M_O1, "infra_f26m_o1", CK_TOP_INFRA_F26M, 1, 1), ++ TOP_FACTOR(CK_INFRA_133M_MCK, "infra_133m_mck", CK_TOP_SYSAXI, 1, 1), ++ TOP_FACTOR(CK_INFRA_66M_MCK, "infra_66m_mck", CK_TOP_SYSAXI, 1, 1), ++ TOP_FACTOR(CK_INFRA_PERI_66M_O, "infra_peri_66m_o", CK_TOP_SYSAXI, 1, ++ 1), ++ TOP_FACTOR(CK_INFRA_USB_SYS_O, "infra_usb_sys_o", CK_TOP_USB_SYS, 1, 1), ++ TOP_FACTOR(CK_INFRA_USB_SYS_O_P1, "infra_usb_sys_o_p1", ++ CK_TOP_USB_SYS_P1, 1, 1), ++}; ++ ++/* INFRASYS MUX PARENTS */ ++static const int infra_mux_uart0_parents[] = { CK_INFRA_CK_F26M, ++ CK_INFRA_UART_O0 }; ++ ++static const int infra_mux_uart1_parents[] = { CK_INFRA_CK_F26M, ++ CK_INFRA_UART_O1 }; ++ ++static const int infra_mux_uart2_parents[] = { CK_INFRA_CK_F26M, ++ CK_INFRA_UART_O2 }; ++ ++static const int infra_mux_spi0_parents[] = { CK_INFRA_I2C_O, CK_INFRA_SPI0_O }; ++ ++static const int infra_mux_spi1_parents[] = { CK_INFRA_I2C_O, CK_INFRA_SPI1_O }; ++ ++static const int infra_pwm_bck_parents[] = { CK_TOP_INFRA_F32K, ++ CK_INFRA_CK_F26M, CK_INFRA_66M_MCK, ++ CK_INFRA_PWM_O }; ++ ++static const int infra_pcie_gfmux_tl_ck_o_p0_parents[] = { ++ CK_TOP_INFRA_F32K, CK_INFRA_CK_F26M, CK_INFRA_CK_F26M, ++ CK_INFRA_PCIE_OCC_P0 ++}; ++ ++static const int infra_pcie_gfmux_tl_ck_o_p1_parents[] = { ++ CK_TOP_INFRA_F32K, CK_INFRA_CK_F26M, CK_INFRA_CK_F26M, ++ CK_INFRA_PCIE_OCC_P1 ++}; ++ ++static const int infra_pcie_gfmux_tl_ck_o_p2_parents[] = { ++ CK_TOP_INFRA_F32K, CK_INFRA_CK_F26M, CK_INFRA_CK_F26M, ++ CK_INFRA_PCIE_OCC_P2 ++}; ++ ++static const int infra_pcie_gfmux_tl_ck_o_p3_parents[] = { ++ CK_TOP_INFRA_F32K, CK_INFRA_CK_F26M, CK_INFRA_CK_F26M, ++ CK_INFRA_PCIE_OCC_P3 ++}; ++ ++#define INFRA_MUX(_id, _name, _parents, _reg, _shift, _width) \ ++ { \ ++ .id = _id, .mux_reg = _reg + 0x8, .mux_set_reg = _reg + 0x0, \ ++ .mux_clr_reg = _reg + 0x4, .mux_shift = _shift, \ ++ .mux_mask = BIT(_width) - 1, .parent = _parents, \ ++ .num_parents = ARRAY_SIZE(_parents), \ ++ .flags = CLK_MUX_SETCLR_UPD | CLK_PARENT_INFRASYS, \ ++ } ++ ++/* INFRA MUX */ ++static const struct mtk_composite infracfg_mtk_mux[] = { ++ INFRA_MUX(CK_INFRA_MUX_UART0_SEL, "infra_mux_uart0_sel", ++ infra_mux_uart0_parents, 0x10, 0, 1), ++ INFRA_MUX(CK_INFRA_MUX_UART1_SEL, "infra_mux_uart1_sel", ++ infra_mux_uart1_parents, 0x10, 1, 1), ++ INFRA_MUX(CK_INFRA_MUX_UART2_SEL, "infra_mux_uart2_sel", ++ infra_mux_uart2_parents, 0x10, 2, 1), ++ INFRA_MUX(CK_INFRA_MUX_SPI0_SEL, "infra_mux_spi0_sel", ++ infra_mux_spi0_parents, 0x10, 4, 1), ++ INFRA_MUX(CK_INFRA_MUX_SPI1_SEL, "infra_mux_spi1_sel", ++ infra_mux_spi1_parents, 0x10, 5, 1), ++ INFRA_MUX(CK_INFRA_MUX_SPI2_SEL, "infra_mux_spi2_sel", ++ infra_mux_spi0_parents, 0x10, 6, 1), ++ INFRA_MUX(CK_INFRA_PWM_SEL, "infra_pwm_sel", infra_pwm_bck_parents, ++ 0x10, 14, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK1_SEL, "infra_pwm_ck1_sel", ++ infra_pwm_bck_parents, 0x10, 16, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK2_SEL, "infra_pwm_ck2_sel", ++ infra_pwm_bck_parents, 0x10, 18, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK3_SEL, "infra_pwm_ck3_sel", ++ infra_pwm_bck_parents, 0x10, 20, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK4_SEL, "infra_pwm_ck4_sel", ++ infra_pwm_bck_parents, 0x10, 22, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK5_SEL, "infra_pwm_ck5_sel", ++ infra_pwm_bck_parents, 0x10, 24, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK6_SEL, "infra_pwm_ck6_sel", ++ infra_pwm_bck_parents, 0x10, 26, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK7_SEL, "infra_pwm_ck7_sel", ++ infra_pwm_bck_parents, 0x10, 28, 2), ++ INFRA_MUX(CK_INFRA_PWM_CK8_SEL, "infra_pwm_ck8_sel", ++ infra_pwm_bck_parents, 0x10, 30, 2), ++ INFRA_MUX(CK_INFRA_PCIE_GFMUX_TL_O_P0_SEL, ++ "infra_pcie_gfmux_tl_o_p0_sel", ++ infra_pcie_gfmux_tl_ck_o_p0_parents, 0x20, 0, 2), ++ INFRA_MUX(CK_INFRA_PCIE_GFMUX_TL_O_P1_SEL, ++ "infra_pcie_gfmux_tl_o_p1_sel", ++ infra_pcie_gfmux_tl_ck_o_p1_parents, 0x20, 2, 2), ++ INFRA_MUX(CK_INFRA_PCIE_GFMUX_TL_O_P2_SEL, ++ "infra_pcie_gfmux_tl_o_p2_sel", ++ infra_pcie_gfmux_tl_ck_o_p2_parents, 0x20, 4, 2), ++ INFRA_MUX(CK_INFRA_PCIE_GFMUX_TL_O_P3_SEL, ++ "infra_pcie_gfmux_tl_o_p3_sel", ++ infra_pcie_gfmux_tl_ck_o_p3_parents, 0x20, 6, 2), ++}; ++ ++static const struct mtk_gate_regs infra_0_cg_regs = { ++ .set_ofs = 0x10, ++ .clr_ofs = 0x14, ++ .sta_ofs = 0x18, ++}; ++ ++static const struct mtk_gate_regs infra_1_cg_regs = { ++ .set_ofs = 0x40, ++ .clr_ofs = 0x44, ++ .sta_ofs = 0x48, ++}; ++ ++static const struct mtk_gate_regs infra_2_cg_regs = { ++ .set_ofs = 0x50, ++ .clr_ofs = 0x54, ++ .sta_ofs = 0x58, ++}; ++ ++static const struct mtk_gate_regs infra_3_cg_regs = { ++ .set_ofs = 0x60, ++ .clr_ofs = 0x64, ++ .sta_ofs = 0x68, ++}; ++ ++#define GATE_INFRA0(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = &infra_0_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_SETCLR | CLK_PARENT_INFRASYS, \ ++ } ++ ++#define GATE_INFRA1(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = &infra_1_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_SETCLR | CLK_PARENT_INFRASYS, \ ++ } ++ ++#define GATE_INFRA2(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = &infra_2_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_SETCLR | CLK_PARENT_INFRASYS, \ ++ } ++ ++#define GATE_INFRA3(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = &infra_3_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_SETCLR | CLK_PARENT_INFRASYS, \ ++ } ++ ++/* INFRA GATE */ ++static const struct mtk_gate infracfg_mtk_gates[] = { ++ GATE_INFRA1(CK_INFRA_66M_GPT_BCK, "infra_hf_66m_gpt_bck", ++ CK_INFRA_66M_MCK, 0), ++ GATE_INFRA1(CK_INFRA_66M_PWM_HCK, "infra_hf_66m_pwm_hck", ++ CK_INFRA_66M_MCK, 1), ++ GATE_INFRA1(CK_INFRA_66M_PWM_BCK, "infra_hf_66m_pwm_bck", ++ CK_INFRA_PWM_SEL, 2), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK1, "infra_hf_66m_pwm_ck1", ++ CK_INFRA_PWM_CK1_SEL, 3), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK2, "infra_hf_66m_pwm_ck2", ++ CK_INFRA_PWM_CK2_SEL, 4), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK3, "infra_hf_66m_pwm_ck3", ++ CK_INFRA_PWM_CK3_SEL, 5), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK4, "infra_hf_66m_pwm_ck4", ++ CK_INFRA_PWM_CK4_SEL, 6), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK5, "infra_hf_66m_pwm_ck5", ++ CK_INFRA_PWM_CK5_SEL, 7), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK6, "infra_hf_66m_pwm_ck6", ++ CK_INFRA_PWM_CK6_SEL, 8), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK7, "infra_hf_66m_pwm_ck7", ++ CK_INFRA_PWM_CK7_SEL, 9), ++ GATE_INFRA1(CK_INFRA_66M_PWM_CK8, "infra_hf_66m_pwm_ck8", ++ CK_INFRA_PWM_CK8_SEL, 10), ++ GATE_INFRA1(CK_INFRA_133M_CQDMA_BCK, "infra_hf_133m_cqdma_bck", ++ CK_INFRA_133M_MCK, 12), ++ GATE_INFRA1(CK_INFRA_66M_AUD_SLV_BCK, "infra_66m_aud_slv_bck", ++ CK_INFRA_66M_PHCK, 13), ++ GATE_INFRA1(CK_INFRA_AUD_26M, "infra_f_faud_26m", CK_INFRA_CK_F26M, 14), ++ GATE_INFRA1(CK_INFRA_AUD_L, "infra_f_faud_l", CK_INFRA_FAUD_L_O, 15), ++ GATE_INFRA1(CK_INFRA_AUD_AUD, "infra_f_aud_aud", CK_INFRA_FAUD_AUD_O, ++ 16), ++ GATE_INFRA1(CK_INFRA_AUD_EG2, "infra_f_faud_eg2", CK_INFRA_FAUD_EG2_O, ++ 18), ++ GATE_INFRA1(CK_INFRA_DRAMC_F26M, "infra_dramc_f26m", CK_INFRA_CK_F26M, ++ 19), ++ GATE_INFRA1(CK_INFRA_133M_DBG_ACKM, "infra_hf_133m_dbg_ackm", ++ CK_INFRA_133M_MCK, 20), ++ GATE_INFRA1(CK_INFRA_66M_AP_DMA_BCK, "infra_66m_ap_dma_bck", ++ CK_INFRA_66M_MCK, 21), ++ GATE_INFRA1(CK_INFRA_66M_SEJ_BCK, "infra_hf_66m_sej_bck", ++ CK_INFRA_66M_MCK, 29), ++ GATE_INFRA1(CK_INFRA_PRE_CK_SEJ_F13M, "infra_pre_ck_sej_f13m", ++ CK_INFRA_CK_F26M, 30), ++ GATE_INFRA1(CK_INFRA_66M_TRNG, "infra_hf_66m_trng", CK_INFRA_PERI_66M_O, ++ 31), ++ GATE_INFRA2(CK_INFRA_26M_THERM_SYSTEM, "infra_hf_26m_therm_system", ++ CK_INFRA_CK_F26M, 0), ++ GATE_INFRA2(CK_INFRA_I2C_BCK, "infra_i2c_bck", CK_INFRA_I2C_O, 1), ++ GATE_INFRA2(CK_INFRA_66M_UART0_PCK, "infra_hf_66m_uart0_pck", ++ CK_INFRA_66M_MCK, 3), ++ GATE_INFRA2(CK_INFRA_66M_UART1_PCK, "infra_hf_66m_uart1_pck", ++ CK_INFRA_66M_MCK, 4), ++ GATE_INFRA2(CK_INFRA_66M_UART2_PCK, "infra_hf_66m_uart2_pck", ++ CK_INFRA_66M_MCK, 5), ++ GATE_INFRA2(CK_INFRA_52M_UART0_CK, "infra_f_52m_uart0", ++ CK_INFRA_MUX_UART0_SEL, 3), ++ GATE_INFRA2(CK_INFRA_52M_UART1_CK, "infra_f_52m_uart1", ++ CK_INFRA_MUX_UART1_SEL, 4), ++ GATE_INFRA2(CK_INFRA_52M_UART2_CK, "infra_f_52m_uart2", ++ CK_INFRA_MUX_UART2_SEL, 5), ++ GATE_INFRA2(CK_INFRA_NFI, "infra_f_fnfi", CK_INFRA_NFI_O, 9), ++ GATE_INFRA2(CK_INFRA_SPINFI, "infra_f_fspinfi", CK_INFRA_SPINFI_O, 10), ++ GATE_INFRA2(CK_INFRA_66M_NFI_HCK, "infra_hf_66m_nfi_hck", ++ CK_INFRA_66M_MCK, 11), ++ GATE_INFRA2(CK_INFRA_104M_SPI0, "infra_hf_104m_spi0", ++ CK_INFRA_MUX_SPI0_SEL, 12), ++ GATE_INFRA2(CK_INFRA_104M_SPI1, "infra_hf_104m_spi1", ++ CK_INFRA_MUX_SPI1_SEL, 13), ++ GATE_INFRA2(CK_INFRA_104M_SPI2_BCK, "infra_hf_104m_spi2_bck", ++ CK_INFRA_MUX_SPI2_SEL, 14), ++ GATE_INFRA2(CK_INFRA_66M_SPI0_HCK, "infra_hf_66m_spi0_hck", ++ CK_INFRA_66M_MCK, 15), ++ GATE_INFRA2(CK_INFRA_66M_SPI1_HCK, "infra_hf_66m_spi1_hck", ++ CK_INFRA_66M_MCK, 16), ++ GATE_INFRA2(CK_INFRA_66M_SPI2_HCK, "infra_hf_66m_spi2_hck", ++ CK_INFRA_66M_MCK, 17), ++ GATE_INFRA2(CK_INFRA_66M_FLASHIF_AXI, "infra_hf_66m_flashif_axi", ++ CK_INFRA_66M_MCK, 18), ++ GATE_INFRA2(CK_INFRA_RTC, "infra_f_frtc", CK_INFRA_LB_MUX_FRTC, 19), ++ GATE_INFRA2(CK_INFRA_26M_ADC_BCK, "infra_f_26m_adc_bck", ++ CK_INFRA_F26M_O1, 20), ++ GATE_INFRA2(CK_INFRA_RC_ADC, "infra_f_frc_adc", CK_INFRA_26M_ADC_BCK, ++ 21), ++ GATE_INFRA2(CK_INFRA_MSDC400, "infra_f_fmsdc400", CK_INFRA_FMSDC400_O, ++ 22), ++ GATE_INFRA2(CK_INFRA_MSDC2_HCK, "infra_f_fmsdc2_hck", ++ CK_INFRA_FMSDC2_HCK_OCC, 23), ++ GATE_INFRA2(CK_INFRA_133M_MSDC_0_HCK, "infra_hf_133m_msdc_0_hck", ++ CK_INFRA_PERI_133M, 24), ++ GATE_INFRA2(CK_INFRA_66M_MSDC_0_HCK, "infra_66m_msdc_0_hck", ++ CK_INFRA_66M_PHCK, 25), ++ GATE_INFRA2(CK_INFRA_133M_CPUM_BCK, "infra_hf_133m_cpum_bck", ++ CK_INFRA_133M_MCK, 26), ++ GATE_INFRA2(CK_INFRA_BIST2FPC, "infra_hf_fbist2fpc", CK_INFRA_NFI_O, ++ 27), ++ GATE_INFRA2(CK_INFRA_I2C_X16W_MCK_CK_P1, "infra_hf_i2c_x16w_mck_ck_p1", ++ CK_INFRA_133M_MCK, 29), ++ GATE_INFRA2(CK_INFRA_I2C_X16W_PCK_CK_P1, "infra_hf_i2c_x16w_pck_ck_p1", ++ CK_INFRA_66M_PHCK, 31), ++ GATE_INFRA3(CK_INFRA_133M_USB_HCK, "infra_133m_usb_hck", ++ CK_INFRA_133M_PHCK, 0), ++ GATE_INFRA3(CK_INFRA_133M_USB_HCK_CK_P1, "infra_133m_usb_hck_ck_p1", ++ CK_INFRA_133M_PHCK, 1), ++ GATE_INFRA3(CK_INFRA_66M_USB_HCK, "infra_66m_usb_hck", ++ CK_INFRA_66M_PHCK, 2), ++ GATE_INFRA3(CK_INFRA_66M_USB_HCK_CK_P1, "infra_66m_usb_hck_ck_p1", ++ CK_INFRA_66M_PHCK, 3), ++ GATE_INFRA3(CK_INFRA_USB_SYS, "infra_usb_sys", CK_INFRA_USB_SYS_O, 4), ++ GATE_INFRA3(CK_INFRA_USB_SYS_CK_P1, "infra_usb_sys_ck_p1", ++ CK_INFRA_USB_SYS_O_P1, 5), ++ GATE_INFRA3(CK_INFRA_USB_REF, "infra_usb_ref", CK_INFRA_USB_O, 6), ++ GATE_INFRA3(CK_INFRA_USB_CK_P1, "infra_usb_ck_p1", CK_INFRA_USB_O_P1, ++ 7), ++ GATE_INFRA3(CK_INFRA_USB_FRMCNT, "infra_usb_frmcnt", ++ CK_INFRA_USB_FRMCNT_O, 8), ++ GATE_INFRA3(CK_INFRA_USB_FRMCNT_CK_P1, "infra_usb_frmcnt_ck_p1", ++ CK_INFRA_USB_FRMCNT_O_P1, 9), ++ GATE_INFRA3(CK_INFRA_USB_PIPE, "infra_usb_pipe", CK_INFRA_USB_PIPE_O, ++ 10), ++ GATE_INFRA3(CK_INFRA_USB_PIPE_CK_P1, "infra_usb_pipe_ck_p1", ++ CK_INFRA_USB_PIPE_O_P1, 11), ++ GATE_INFRA3(CK_INFRA_USB_UTMI, "infra_usb_utmi", CK_INFRA_USB_UTMI_O, ++ 12), ++ GATE_INFRA3(CK_INFRA_USB_UTMI_CK_P1, "infra_usb_utmi_ck_p1", ++ CK_INFRA_USB_UTMI_O_P1, 13), ++ GATE_INFRA3(CK_INFRA_USB_XHCI, "infra_usb_xhci", CK_INFRA_USB_XHCI_O, ++ 14), ++ GATE_INFRA3(CK_INFRA_USB_XHCI_CK_P1, "infra_usb_xhci_ck_p1", ++ CK_INFRA_USB_XHCI_O_P1, 15), ++ GATE_INFRA3(CK_INFRA_PCIE_GFMUX_TL_P0, "infra_pcie_gfmux_tl_ck_p0", ++ CK_INFRA_PCIE_GFMUX_TL_O_P0_SEL, 20), ++ GATE_INFRA3(CK_INFRA_PCIE_GFMUX_TL_P1, "infra_pcie_gfmux_tl_ck_p1", ++ CK_INFRA_PCIE_GFMUX_TL_O_P1_SEL, 21), ++ GATE_INFRA3(CK_INFRA_PCIE_GFMUX_TL_P2, "infra_pcie_gfmux_tl_ck_p2", ++ CK_INFRA_PCIE_GFMUX_TL_O_P2_SEL, 22), ++ GATE_INFRA3(CK_INFRA_PCIE_GFMUX_TL_P3, "infra_pcie_gfmux_tl_ck_p3", ++ CK_INFRA_PCIE_GFMUX_TL_O_P3_SEL, 23), ++ GATE_INFRA3(CK_INFRA_PCIE_PIPE_P0, "infra_pcie_pipe_ck_p0", ++ CK_INFRA_PCIE_PIPE_OCC_P0, 24), ++ GATE_INFRA3(CK_INFRA_PCIE_PIPE_P1, "infra_pcie_pipe_ck_p1", ++ CK_INFRA_PCIE_PIPE_OCC_P1, 25), ++ GATE_INFRA3(CK_INFRA_PCIE_PIPE_P2, "infra_pcie_pipe_ck_p2", ++ CK_INFRA_PCIE_PIPE_OCC_P2, 26), ++ GATE_INFRA3(CK_INFRA_PCIE_PIPE_P3, "infra_pcie_pipe_ck_p3", ++ CK_INFRA_PCIE_PIPE_OCC_P3, 27), ++ GATE_INFRA3(CK_INFRA_133M_PCIE_CK_P0, "infra_133m_pcie_ck_p0", ++ CK_INFRA_133M_PHCK, 28), ++ GATE_INFRA3(CK_INFRA_133M_PCIE_CK_P1, "infra_133m_pcie_ck_p1", ++ CK_INFRA_133M_PHCK, 29), ++ GATE_INFRA3(CK_INFRA_133M_PCIE_CK_P2, "infra_133m_pcie_ck_p2", ++ CK_INFRA_133M_PHCK, 30), ++ GATE_INFRA3(CK_INFRA_133M_PCIE_CK_P3, "infra_133m_pcie_ck_p3", ++ CK_INFRA_133M_PHCK, 31), ++ GATE_INFRA0(CK_INFRA_PCIE_PERI_26M_CK_P0, ++ "infra_pcie_peri_ck_26m_ck_p0", CK_INFRA_F26M_O0, 7), ++ GATE_INFRA0(CK_INFRA_PCIE_PERI_26M_CK_P1, ++ "infra_pcie_peri_ck_26m_ck_p1", CK_INFRA_F26M_O0, 8), ++ GATE_INFRA0(CK_INFRA_PCIE_PERI_26M_CK_P2, ++ "infra_pcie_peri_ck_26m_ck_p2", CK_INFRA_F26M_O0, 9), ++ GATE_INFRA0(CK_INFRA_PCIE_PERI_26M_CK_P3, ++ "infra_pcie_peri_ck_26m_ck_p3", CK_INFRA_F26M_O0, 10), ++}; ++ ++static const struct mtk_clk_tree mt7988_fixed_pll_clk_tree = { ++ .fdivs_offs = ARRAY_SIZE(apmixedsys_mtk_plls), ++ .fclks = apmixedsys_mtk_plls, ++ .xtal_rate = 40 * MHZ, ++}; ++ ++static const struct mtk_clk_tree mt7988_topckgen_clk_tree = { ++ .fdivs_offs = CK_TOP_CB_CKSQ_40M, ++ .muxes_offs = CK_TOP_NETSYS_SEL, ++ .fdivs = topckgen_mtk_fixed_factors, ++ .muxes = topckgen_mtk_muxes, ++ .flags = CLK_BYPASS_XTAL, ++ .xtal_rate = 40 * MHZ, ++}; ++ ++static const struct mtk_clk_tree mt7988_infracfg_clk_tree = { ++ .fdivs_offs = CK_INFRA_CK_F26M, ++ .muxes_offs = CK_INFRA_MUX_UART0_SEL, ++ .fdivs = infracfg_mtk_fixed_factor, ++ .muxes = infracfg_mtk_mux, ++ .flags = CLK_BYPASS_XTAL, ++ .xtal_rate = 40 * MHZ, ++}; ++ ++static const struct udevice_id mt7988_fixed_pll_compat[] = { ++ { .compatible = "mediatek,mt7988-fixed-plls" }, ++ {} ++}; ++ ++static const struct udevice_id mt7988_topckgen_compat[] = { ++ { .compatible = "mediatek,mt7988-topckgen" }, ++ {} ++}; ++ ++static int mt7988_fixed_pll_probe(struct udevice *dev) ++{ ++ return mtk_common_clk_init(dev, &mt7988_fixed_pll_clk_tree); ++} ++ ++static int mt7988_topckgen_probe(struct udevice *dev) ++{ ++ struct mtk_clk_priv *priv = dev_get_priv(dev); ++ ++ priv->base = dev_read_addr_ptr(dev); ++ if (!priv->base) ++ return -ENOENT; ++ ++ writel(MT7988_CLK_PDN_EN_WRITE, priv->base + MT7988_CLK_PDN); ++ return mtk_common_clk_init(dev, &mt7988_topckgen_clk_tree); ++} ++ ++U_BOOT_DRIVER(mtk_clk_apmixedsys) = { ++ .name = "mt7988-clock-fixed-pll", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_fixed_pll_compat, ++ .probe = mt7988_fixed_pll_probe, ++ .priv_auto = sizeof(struct mtk_clk_priv), ++ .ops = &mtk_clk_topckgen_ops, ++ .flags = DM_FLAG_PRE_RELOC, ++}; ++ ++U_BOOT_DRIVER(mtk_clk_topckgen) = { ++ .name = "mt7988-clock-topckgen", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_topckgen_compat, ++ .probe = mt7988_topckgen_probe, ++ .priv_auto = sizeof(struct mtk_clk_priv), ++ .ops = &mtk_clk_topckgen_ops, ++ .flags = DM_FLAG_PRE_RELOC, ++}; ++ ++static const struct udevice_id mt7988_infracfg_compat[] = { ++ { .compatible = "mediatek,mt7988-infracfg" }, ++ {} ++}; ++ ++static const struct udevice_id mt7988_infracfg_ao_cgs_compat[] = { ++ { .compatible = "mediatek,mt7988-infracfg_ao_cgs" }, ++ {} ++}; ++ ++static int mt7988_infracfg_probe(struct udevice *dev) ++{ ++ return mtk_common_clk_init(dev, &mt7988_infracfg_clk_tree); ++} ++ ++static int mt7988_infracfg_ao_cgs_probe(struct udevice *dev) ++{ ++ return mtk_common_clk_gate_init(dev, &mt7988_infracfg_clk_tree, ++ infracfg_mtk_gates); ++} ++ ++U_BOOT_DRIVER(mtk_clk_infracfg) = { ++ .name = "mt7988-clock-infracfg", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_infracfg_compat, ++ .probe = mt7988_infracfg_probe, ++ .priv_auto = sizeof(struct mtk_clk_priv), ++ .ops = &mtk_clk_infrasys_ops, ++ .flags = DM_FLAG_PRE_RELOC, ++}; ++ ++U_BOOT_DRIVER(mtk_clk_infracfg_ao_cgs) = { ++ .name = "mt7988-clock-infracfg_ao_cgs", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_infracfg_ao_cgs_compat, ++ .probe = mt7988_infracfg_ao_cgs_probe, ++ .priv_auto = sizeof(struct mtk_cg_priv), ++ .ops = &mtk_clk_gate_ops, ++ .flags = DM_FLAG_PRE_RELOC, ++}; ++ ++/* ETHDMA */ ++ ++static const struct mtk_gate_regs ethdma_cg_regs = { ++ .set_ofs = 0x30, ++ .clr_ofs = 0x30, ++ .sta_ofs = 0x30, ++}; ++ ++#define GATE_ETHDMA(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = ðdma_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ ++ } ++ ++static const struct mtk_gate ethdma_mtk_gate[] = { ++ GATE_ETHDMA(CK_ETHDMA_FE_EN, "ethdma_fe_en", CK_TOP_NETSYS_2X, 6), ++}; ++ ++static int mt7988_ethdma_probe(struct udevice *dev) ++{ ++ return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree, ++ ethdma_mtk_gate); ++} ++ ++static int mt7988_ethdma_bind(struct udevice *dev) ++{ ++ int ret = 0; ++ ++ if (CONFIG_IS_ENABLED(RESET_MEDIATEK)) { ++ ret = mediatek_reset_bind(dev, MT7988_ETHDMA_RST_CTRL_OFS, 1); ++ if (ret) ++ debug("Warning: failed to bind reset controller\n"); ++ } ++ ++ return ret; ++} ++ ++static const struct udevice_id mt7988_ethdma_compat[] = { ++ { ++ .compatible = "mediatek,mt7988-ethdma", ++ }, ++ {} ++}; ++ ++U_BOOT_DRIVER(mtk_clk_ethdma) = { ++ .name = "mt7988-clock-ethdma", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_ethdma_compat, ++ .probe = mt7988_ethdma_probe, ++ .bind = mt7988_ethdma_bind, ++ .priv_auto = sizeof(struct mtk_cg_priv), ++ .ops = &mtk_clk_gate_ops, ++}; ++ ++/* SGMIISYS_0 */ ++ ++static const struct mtk_gate_regs sgmii0_cg_regs = { ++ .set_ofs = 0xE4, ++ .clr_ofs = 0xE4, ++ .sta_ofs = 0xE4, ++}; ++ ++#define GATE_SGMII0(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = &sgmii0_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ ++ } ++ ++static const struct mtk_gate sgmiisys_0_mtk_gate[] = { ++ /* connect to fake clock, so use CK_TOP_CB_CKSQ_40M as the clock parent */ ++ GATE_SGMII0(CK_SGM0_TX_EN, "sgm0_tx_en", CK_TOP_CB_CKSQ_40M, 2), ++ /* connect to fake clock, so use CK_TOP_CB_CKSQ_40M as the clock parent */ ++ GATE_SGMII0(CK_SGM0_RX_EN, "sgm0_rx_en", CK_TOP_CB_CKSQ_40M, 3), ++}; ++ ++static int mt7988_sgmiisys_0_probe(struct udevice *dev) ++{ ++ return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree, ++ sgmiisys_0_mtk_gate); ++} ++ ++static const struct udevice_id mt7988_sgmiisys_0_compat[] = { ++ { ++ .compatible = "mediatek,mt7988-sgmiisys_0", ++ }, ++ {} ++}; ++ ++U_BOOT_DRIVER(mtk_clk_sgmiisys_0) = { ++ .name = "mt7988-clock-sgmiisys_0", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_sgmiisys_0_compat, ++ .probe = mt7988_sgmiisys_0_probe, ++ .priv_auto = sizeof(struct mtk_cg_priv), ++ .ops = &mtk_clk_gate_ops, ++}; ++ ++/* SGMIISYS_1 */ ++ ++static const struct mtk_gate_regs sgmii1_cg_regs = { ++ .set_ofs = 0xE4, ++ .clr_ofs = 0xE4, ++ .sta_ofs = 0xE4, ++}; ++ ++#define GATE_SGMII1(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = &sgmii1_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ ++ } ++ ++static const struct mtk_gate sgmiisys_1_mtk_gate[] = { ++ /* connect to fake clock, so use CK_TOP_CB_CKSQ_40M as the clock parent */ ++ GATE_SGMII1(CK_SGM1_TX_EN, "sgm1_tx_en", CK_TOP_CB_CKSQ_40M, 2), ++ /* connect to fake clock, so use CK_TOP_CB_CKSQ_40M as the clock parent */ ++ GATE_SGMII1(CK_SGM1_RX_EN, "sgm1_rx_en", CK_TOP_CB_CKSQ_40M, 3), ++}; ++ ++static int mt7988_sgmiisys_1_probe(struct udevice *dev) ++{ ++ return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree, ++ sgmiisys_1_mtk_gate); ++} ++ ++static const struct udevice_id mt7988_sgmiisys_1_compat[] = { ++ { ++ .compatible = "mediatek,mt7988-sgmiisys_1", ++ }, ++ {} ++}; ++ ++U_BOOT_DRIVER(mtk_clk_sgmiisys_1) = { ++ .name = "mt7988-clock-sgmiisys_1", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_sgmiisys_1_compat, ++ .probe = mt7988_sgmiisys_1_probe, ++ .priv_auto = sizeof(struct mtk_cg_priv), ++ .ops = &mtk_clk_gate_ops, ++}; ++ ++/* ETHWARP */ ++ ++static const struct mtk_gate_regs ethwarp_cg_regs = { ++ .set_ofs = 0x14, ++ .clr_ofs = 0x14, ++ .sta_ofs = 0x14, ++}; ++ ++#define GATE_ETHWARP(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .parent = _parent, .regs = ðwarp_cg_regs, \ ++ .shift = _shift, \ ++ .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ ++ } ++ ++static const struct mtk_gate ethwarp_mtk_gate[] = { ++ GATE_ETHWARP(CK_ETHWARP_WOCPU2_EN, "ethwarp_wocpu2_en", ++ CK_TOP_NETSYS_WED_MCU, 13), ++ GATE_ETHWARP(CK_ETHWARP_WOCPU1_EN, "ethwarp_wocpu1_en", ++ CK_TOP_NETSYS_WED_MCU, 14), ++ GATE_ETHWARP(CK_ETHWARP_WOCPU0_EN, "ethwarp_wocpu0_en", ++ CK_TOP_NETSYS_WED_MCU, 15), ++}; ++ ++static int mt7988_ethwarp_probe(struct udevice *dev) ++{ ++ return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree, ++ ethwarp_mtk_gate); ++} ++ ++static int mt7988_ethwarp_bind(struct udevice *dev) ++{ ++ int ret = 0; ++ ++ if (CONFIG_IS_ENABLED(RESET_MEDIATEK)) { ++ ret = mediatek_reset_bind(dev, MT7988_ETHWARP_RST_CTRL_OFS, 2); ++ if (ret) ++ debug("Warning: failed to bind reset controller\n"); ++ } ++ ++ return ret; ++} ++ ++static const struct udevice_id mt7988_ethwarp_compat[] = { ++ { ++ .compatible = "mediatek,mt7988-ethwarp", ++ }, ++ {} ++}; ++ ++U_BOOT_DRIVER(mtk_clk_ethwarp) = { ++ .name = "mt7988-clock-ethwarp", ++ .id = UCLASS_CLK, ++ .of_match = mt7988_ethwarp_compat, ++ .probe = mt7988_ethwarp_probe, ++ .bind = mt7988_ethwarp_bind, ++ .priv_auto = sizeof(struct mtk_cg_priv), ++ .ops = &mtk_clk_gate_ops, ++}; +--- /dev/null ++++ b/include/dt-bindings/clock/mt7988-clk.h +@@ -0,0 +1,349 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (C) 2022 MediaTek Inc. All rights reserved. ++ * ++ * Author: Sam Shih ++ */ ++ ++#ifndef _DT_BINDINGS_CLK_MT7988_H ++#define _DT_BINDINGS_CLK_MT7988_H ++ ++/* INFRACFG */ ++/* mtk_fixed_factor */ ++#define CK_INFRA_CK_F26M 0 ++#define CK_INFRA_PWM_O 1 ++#define CK_INFRA_PCIE_OCC_P0 2 ++#define CK_INFRA_PCIE_OCC_P1 3 ++#define CK_INFRA_PCIE_OCC_P2 4 ++#define CK_INFRA_PCIE_OCC_P3 5 ++#define CK_INFRA_133M_HCK 6 ++#define CK_INFRA_133M_PHCK 7 ++#define CK_INFRA_66M_PHCK 8 ++#define CK_INFRA_FAUD_L_O 9 ++#define CK_INFRA_FAUD_AUD_O 10 ++#define CK_INFRA_FAUD_EG2_O 11 ++#define CK_INFRA_I2C_O 12 ++#define CK_INFRA_UART_O0 13 ++#define CK_INFRA_UART_O1 14 ++#define CK_INFRA_UART_O2 15 ++#define CK_INFRA_NFI_O 16 ++#define CK_INFRA_SPINFI_O 17 ++#define CK_INFRA_SPI0_O 18 ++#define CK_INFRA_SPI1_O 19 ++#define CK_INFRA_LB_MUX_FRTC 20 ++#define CK_INFRA_FRTC 21 ++#define CK_INFRA_FMSDC400_O 22 ++#define CK_INFRA_FMSDC2_HCK_OCC 23 ++#define CK_INFRA_PERI_133M 24 ++#define CK_INFRA_USB_O 25 ++#define CK_INFRA_USB_O_P1 26 ++#define CK_INFRA_USB_FRMCNT_O 27 ++#define CK_INFRA_USB_FRMCNT_O_P1 28 ++#define CK_INFRA_USB_XHCI_O 29 ++#define CK_INFRA_USB_XHCI_O_P1 30 ++#define CK_INFRA_USB_PIPE_O 31 ++#define CK_INFRA_USB_PIPE_O_P1 32 ++#define CK_INFRA_USB_UTMI_O 33 ++#define CK_INFRA_USB_UTMI_O_P1 34 ++#define CK_INFRA_PCIE_PIPE_OCC_P0 35 ++#define CK_INFRA_PCIE_PIPE_OCC_P1 36 ++#define CK_INFRA_PCIE_PIPE_OCC_P2 37 ++#define CK_INFRA_PCIE_PIPE_OCC_P3 38 ++#define CK_INFRA_F26M_O0 39 ++#define CK_INFRA_F26M_O1 40 ++#define CK_INFRA_133M_MCK 41 ++#define CK_INFRA_66M_MCK 42 ++#define CK_INFRA_PERI_66M_O 43 ++#define CK_INFRA_USB_SYS_O 44 ++#define CK_INFRA_USB_SYS_O_P1 45 ++ ++/* INFRACFG_AO */ ++#define GATE_OFFSET 65 ++/* mtk_mux */ ++#define CK_INFRA_MUX_UART0_SEL 46 /* Linux CLK ID (0) */ ++#define CK_INFRA_MUX_UART1_SEL 47 /* Linux CLK ID (1) */ ++#define CK_INFRA_MUX_UART2_SEL 48 /* Linux CLK ID (2) */ ++#define CK_INFRA_MUX_SPI0_SEL 49 /* Linux CLK ID (3) */ ++#define CK_INFRA_MUX_SPI1_SEL 50 /* Linux CLK ID (4) */ ++#define CK_INFRA_MUX_SPI2_SEL 51 /* Linux CLK ID (5) */ ++#define CK_INFRA_PWM_SEL 52 /* Linux CLK ID (6) */ ++#define CK_INFRA_PWM_CK1_SEL 53 /* Linux CLK ID (7) */ ++#define CK_INFRA_PWM_CK2_SEL 54 /* Linux CLK ID (8) */ ++#define CK_INFRA_PWM_CK3_SEL 55 /* Linux CLK ID (9) */ ++#define CK_INFRA_PWM_CK4_SEL 56 /* Linux CLK ID (10) */ ++#define CK_INFRA_PWM_CK5_SEL 57 /* Linux CLK ID (11) */ ++#define CK_INFRA_PWM_CK6_SEL 58 /* Linux CLK ID (12) */ ++#define CK_INFRA_PWM_CK7_SEL 59 /* Linux CLK ID (13) */ ++#define CK_INFRA_PWM_CK8_SEL 60 /* Linux CLK ID (14) */ ++#define CK_INFRA_PCIE_GFMUX_TL_O_P0_SEL 61 /* Linux CLK ID (15) */ ++#define CK_INFRA_PCIE_GFMUX_TL_O_P1_SEL 62 /* Linux CLK ID (16) */ ++#define CK_INFRA_PCIE_GFMUX_TL_O_P2_SEL 63 /* Linux CLK ID (17) */ ++#define CK_INFRA_PCIE_GFMUX_TL_O_P3_SEL 64 /* Linux CLK ID (18) */ ++/* mtk_gate */ ++#define CK_INFRA_66M_GPT_BCK (65 - GATE_OFFSET) /* Linux CLK ID (19) */ ++#define CK_INFRA_66M_PWM_HCK (66 - GATE_OFFSET) /* Linux CLK ID (20) */ ++#define CK_INFRA_66M_PWM_BCK (67 - GATE_OFFSET) /* Linux CLK ID (21) */ ++#define CK_INFRA_66M_PWM_CK1 (68 - GATE_OFFSET) /* Linux CLK ID (22) */ ++#define CK_INFRA_66M_PWM_CK2 (69 - GATE_OFFSET) /* Linux CLK ID (23) */ ++#define CK_INFRA_66M_PWM_CK3 (70 - GATE_OFFSET) /* Linux CLK ID (24) */ ++#define CK_INFRA_66M_PWM_CK4 (71 - GATE_OFFSET) /* Linux CLK ID (25) */ ++#define CK_INFRA_66M_PWM_CK5 (72 - GATE_OFFSET) /* Linux CLK ID (26) */ ++#define CK_INFRA_66M_PWM_CK6 (73 - GATE_OFFSET) /* Linux CLK ID (27) */ ++#define CK_INFRA_66M_PWM_CK7 (74 - GATE_OFFSET) /* Linux CLK ID (28) */ ++#define CK_INFRA_66M_PWM_CK8 (75 - GATE_OFFSET) /* Linux CLK ID (29) */ ++#define CK_INFRA_133M_CQDMA_BCK (76 - GATE_OFFSET) /* Linux CLK ID (30) */ ++#define CK_INFRA_66M_AUD_SLV_BCK (77 - GATE_OFFSET) /* Linux CLK ID (31) */ ++#define CK_INFRA_AUD_26M (78 - GATE_OFFSET) /* Linux CLK ID (32) */ ++#define CK_INFRA_AUD_L (79 - GATE_OFFSET) /* Linux CLK ID (33) */ ++#define CK_INFRA_AUD_AUD (80 - GATE_OFFSET) /* Linux CLK ID (34) */ ++#define CK_INFRA_AUD_EG2 (81 - GATE_OFFSET) /* Linux CLK ID (35) */ ++#define CK_INFRA_DRAMC_F26M (82 - GATE_OFFSET) /* Linux CLK ID (36) */ ++#define CK_INFRA_133M_DBG_ACKM (83 - GATE_OFFSET) /* Linux CLK ID (37) */ ++#define CK_INFRA_66M_AP_DMA_BCK (84 - GATE_OFFSET) /* Linux CLK ID (38) */ ++#define CK_INFRA_66M_SEJ_BCK (85 - GATE_OFFSET) /* Linux CLK ID (39) */ ++#define CK_INFRA_PRE_CK_SEJ_F13M (86 - GATE_OFFSET) /* Linux CLK ID (40) */ ++#define CK_INFRA_66M_TRNG (87 - GATE_OFFSET) /* Linux CLK ID (41) */ ++#define CK_INFRA_26M_THERM_SYSTEM (88 - GATE_OFFSET) /* Linux CLK ID (42) */ ++#define CK_INFRA_I2C_BCK (89 - GATE_OFFSET) /* Linux CLK ID (43) */ ++#define CK_INFRA_66M_UART0_PCK (90 - GATE_OFFSET) /* Linux CLK ID (44) */ ++#define CK_INFRA_66M_UART1_PCK (91 - GATE_OFFSET) /* Linux CLK ID (45) */ ++#define CK_INFRA_66M_UART2_PCK (92 - GATE_OFFSET) /* Linux CLK ID (46) */ ++#define CK_INFRA_52M_UART0_CK (93 - GATE_OFFSET) /* Linux CLK ID (47) */ ++#define CK_INFRA_52M_UART1_CK (94 - GATE_OFFSET) /* Linux CLK ID (48) */ ++#define CK_INFRA_52M_UART2_CK (95 - GATE_OFFSET) /* Linux CLK ID (49) */ ++#define CK_INFRA_NFI (96 - GATE_OFFSET) /* Linux CLK ID (50) */ ++#define CK_INFRA_SPINFI (97 - GATE_OFFSET) /* Linux CLK ID (51) */ ++#define CK_INFRA_66M_NFI_HCK (98 - GATE_OFFSET) /* Linux CLK ID (52) */ ++#define CK_INFRA_104M_SPI0 (99 - GATE_OFFSET) /* Linux CLK ID (53) */ ++#define CK_INFRA_104M_SPI1 (100 - GATE_OFFSET) /* Linux CLK ID (54) */ ++#define CK_INFRA_104M_SPI2_BCK (101 - GATE_OFFSET) /* Linux CLK ID (55) */ ++#define CK_INFRA_66M_SPI0_HCK (102 - GATE_OFFSET) /* Linux CLK ID (56) */ ++#define CK_INFRA_66M_SPI1_HCK (103 - GATE_OFFSET) /* Linux CLK ID (57) */ ++#define CK_INFRA_66M_SPI2_HCK (104 - GATE_OFFSET) /* Linux CLK ID (58) */ ++#define CK_INFRA_66M_FLASHIF_AXI (105 - GATE_OFFSET) /* Linux CLK ID (59) */ ++#define CK_INFRA_RTC (106 - GATE_OFFSET) /* Linux CLK ID (60) */ ++#define CK_INFRA_26M_ADC_BCK (107 - GATE_OFFSET) /* Linux CLK ID (61) */ ++#define CK_INFRA_RC_ADC (108 - GATE_OFFSET) /* Linux CLK ID (62) */ ++#define CK_INFRA_MSDC400 (109 - GATE_OFFSET) /* Linux CLK ID (63) */ ++#define CK_INFRA_MSDC2_HCK (110 - GATE_OFFSET) /* Linux CLK ID (64) */ ++#define CK_INFRA_133M_MSDC_0_HCK (111 - GATE_OFFSET) /* Linux CLK ID (65) */ ++#define CK_INFRA_66M_MSDC_0_HCK (112 - GATE_OFFSET) /* Linux CLK ID (66) */ ++#define CK_INFRA_133M_CPUM_BCK (113 - GATE_OFFSET) /* Linux CLK ID (67) */ ++#define CK_INFRA_BIST2FPC (114 - GATE_OFFSET) /* Linux CLK ID (68) */ ++#define CK_INFRA_I2C_X16W_MCK_CK_P1 (115 - GATE_OFFSET) /* Linux CLK ID (69) */ ++#define CK_INFRA_I2C_X16W_PCK_CK_P1 (116 - GATE_OFFSET) /* Linux CLK ID (70) */ ++#define CK_INFRA_133M_USB_HCK (117 - GATE_OFFSET) /* Linux CLK ID (71) */ ++#define CK_INFRA_133M_USB_HCK_CK_P1 (118 - GATE_OFFSET) /* Linux CLK ID (72) */ ++#define CK_INFRA_66M_USB_HCK (119 - GATE_OFFSET) /* Linux CLK ID (73) */ ++#define CK_INFRA_66M_USB_HCK_CK_P1 (120 - GATE_OFFSET) /* Linux CLK ID (74) */ ++#define CK_INFRA_USB_SYS (121 - GATE_OFFSET) /* Linux CLK ID (75) */ ++#define CK_INFRA_USB_SYS_CK_P1 (122 - GATE_OFFSET) /* Linux CLK ID (76) */ ++#define CK_INFRA_USB_REF (123 - GATE_OFFSET) /* Linux CLK ID (77) */ ++#define CK_INFRA_USB_CK_P1 (124 - GATE_OFFSET) /* Linux CLK ID (78) */ ++#define CK_INFRA_USB_FRMCNT (125 - GATE_OFFSET) /* Linux CLK ID (79) */ ++#define CK_INFRA_USB_FRMCNT_CK_P1 (126 - GATE_OFFSET) /* Linux CLK ID (80) */ ++#define CK_INFRA_USB_PIPE (127 - GATE_OFFSET) /* Linux CLK ID (81) */ ++#define CK_INFRA_USB_PIPE_CK_P1 (128 - GATE_OFFSET) /* Linux CLK ID (82) */ ++#define CK_INFRA_USB_UTMI (129 - GATE_OFFSET) /* Linux CLK ID (83) */ ++#define CK_INFRA_USB_UTMI_CK_P1 (130 - GATE_OFFSET) /* Linux CLK ID (84) */ ++#define CK_INFRA_USB_XHCI (131 - GATE_OFFSET) /* Linux CLK ID (85) */ ++#define CK_INFRA_USB_XHCI_CK_P1 (132 - GATE_OFFSET) /* Linux CLK ID (86) */ ++#define CK_INFRA_PCIE_GFMUX_TL_P0 (133 - GATE_OFFSET) /* Linux CLK ID (87) */ ++#define CK_INFRA_PCIE_GFMUX_TL_P1 (134 - GATE_OFFSET) /* Linux CLK ID (88) */ ++#define CK_INFRA_PCIE_GFMUX_TL_P2 (135 - GATE_OFFSET) /* Linux CLK ID (89) */ ++#define CK_INFRA_PCIE_GFMUX_TL_P3 (136 - GATE_OFFSET) /* Linux CLK ID (90) */ ++#define CK_INFRA_PCIE_PIPE_P0 (137 - GATE_OFFSET) /* Linux CLK ID (91) */ ++#define CK_INFRA_PCIE_PIPE_P1 (138 - GATE_OFFSET) /* Linux CLK ID (92) */ ++#define CK_INFRA_PCIE_PIPE_P2 (139 - GATE_OFFSET) /* Linux CLK ID (93) */ ++#define CK_INFRA_PCIE_PIPE_P3 (140 - GATE_OFFSET) /* Linux CLK ID (94) */ ++#define CK_INFRA_133M_PCIE_CK_P0 (141 - GATE_OFFSET) /* Linux CLK ID (95) */ ++#define CK_INFRA_133M_PCIE_CK_P1 (142 - GATE_OFFSET) /* Linux CLK ID (96) */ ++#define CK_INFRA_133M_PCIE_CK_P2 (143 - GATE_OFFSET) /* Linux CLK ID (97) */ ++#define CK_INFRA_133M_PCIE_CK_P3 (144 - GATE_OFFSET) /* Linux CLK ID (98) */ ++#define CK_INFRA_PCIE_PERI_26M_CK_P0 (145 - GATE_OFFSET) /* Linux CLK ID (99) */ ++#define CK_INFRA_PCIE_PERI_26M_CK_P1 \ ++ (146 - GATE_OFFSET) /* Linux CLK ID (100) */ ++#define CK_INFRA_PCIE_PERI_26M_CK_P2 \ ++ (147 - GATE_OFFSET) /* Linux CLK ID (101) */ ++#define CK_INFRA_PCIE_PERI_26M_CK_P3 \ ++ (148 - GATE_OFFSET) /* Linux CLK ID (102) */ ++ ++/* TOPCKGEN */ ++/* mtk_fixed_factor */ ++#define CK_TOP_CB_CKSQ_40M 0 /* Linux CLK ID (74) */ ++#define CK_TOP_CB_M_416M 1 /* Linux CLK ID (75) */ ++#define CK_TOP_CB_M_D2 2 /* Linux CLK ID (76) */ ++#define CK_TOP_M_D3_D2 3 /* Linux CLK ID (77) */ ++#define CK_TOP_CB_M_D4 4 /* Linux CLK ID (78) */ ++#define CK_TOP_CB_M_D8 5 /* Linux CLK ID (79) */ ++#define CK_TOP_M_D8_D2 6 /* Linux CLK ID (80) */ ++#define CK_TOP_CB_MM_720M 7 /* Linux CLK ID (81) */ ++#define CK_TOP_CB_MM_D2 8 /* Linux CLK ID (82) */ ++#define CK_TOP_CB_MM_D3_D5 9 /* Linux CLK ID (83) */ ++#define CK_TOP_CB_MM_D4 10 /* Linux CLK ID (84) */ ++#define CK_TOP_MM_D6_D2 11 /* Linux CLK ID (85) */ ++#define CK_TOP_CB_MM_D8 12 /* Linux CLK ID (86) */ ++#define CK_TOP_CB_APLL2_196M 13 /* Linux CLK ID (87) */ ++#define CK_TOP_CB_APLL2_D4 14 /* Linux CLK ID (88) */ ++#define CK_TOP_CB_NET1_D4 15 /* Linux CLK ID (89) */ ++#define CK_TOP_CB_NET1_D5 16 /* Linux CLK ID (90) */ ++#define CK_TOP_NET1_D5_D2 17 /* Linux CLK ID (91) */ ++#define CK_TOP_NET1_D5_D4 18 /* Linux CLK ID (92) */ ++#define CK_TOP_CB_NET1_D8 19 /* Linux CLK ID (93) */ ++#define CK_TOP_NET1_D8_D2 20 /* Linux CLK ID (94) */ ++#define CK_TOP_NET1_D8_D4 21 /* Linux CLK ID (95) */ ++#define CK_TOP_NET1_D8_D8 22 /* Linux CLK ID (96) */ ++#define CK_TOP_NET1_D8_D16 23 /* Linux CLK ID (97) */ ++#define CK_TOP_CB_NET2_800M 24 /* Linux CLK ID (98) */ ++#define CK_TOP_CB_NET2_D2 25 /* Linux CLK ID (99) */ ++#define CK_TOP_CB_NET2_D4 26 /* Linux CLK ID (100) */ ++#define CK_TOP_NET2_D4_D4 27 /* Linux CLK ID (101) */ ++#define CK_TOP_NET2_D4_D8 28 /* Linux CLK ID (102) */ ++#define CK_TOP_CB_NET2_D6 29 /* Linux CLK ID (103) */ ++#define CK_TOP_CB_NET2_D8 30 /* Linux CLK ID (104) */ ++#define CK_TOP_CB_WEDMCU_208M 31 /* Linux CLK ID (105) */ ++#define CK_TOP_CB_SGM_325M 32 /* Linux CLK ID (106) */ ++#define CK_TOP_CB_NETSYS_850M 33 /* Linux CLK ID (107) */ ++#define CK_TOP_CB_MSDC_400M 34 /* Linux CLK ID (108) */ ++#define CK_TOP_CKSQ_40M_D2 35 /* Linux CLK ID (109) */ ++#define CK_TOP_CB_RTC_32K 36 /* Linux CLK ID (110) */ ++#define CK_TOP_CB_RTC_32P7K 37 /* Linux CLK ID (111) */ ++#define CK_TOP_INFRA_F32K 38 /* Linux CLK ID (112) */ ++#define CK_TOP_CKSQ_SRC 39 /* Linux CLK ID (113) */ ++#define CK_TOP_NETSYS_2X 40 /* Linux CLK ID (114) */ ++#define CK_TOP_NETSYS_GSW 41 /* Linux CLK ID (115) */ ++#define CK_TOP_NETSYS_WED_MCU 42 /* Linux CLK ID (116) */ ++#define CK_TOP_EIP197 43 /* Linux CLK ID (117) */ ++#define CK_TOP_EMMC_250M 44 /* Linux CLK ID (118) */ ++#define CK_TOP_EMMC_400M 45 /* Linux CLK ID (119) */ ++#define CK_TOP_SPI 46 /* Linux CLK ID (120) */ ++#define CK_TOP_SPIM_MST 47 /* Linux CLK ID (121) */ ++#define CK_TOP_NFI1X 48 /* Linux CLK ID (122) */ ++#define CK_TOP_SPINFI_BCK 49 /* Linux CLK ID (123) */ ++#define CK_TOP_I2C_BCK 50 /* Linux CLK ID (124) */ ++#define CK_TOP_USB_SYS 51 /* Linux CLK ID (125) */ ++#define CK_TOP_USB_SYS_P1 52 /* Linux CLK ID (126) */ ++#define CK_TOP_USB_XHCI 53 /* Linux CLK ID (127) */ ++#define CK_TOP_USB_XHCI_P1 54 /* Linux CLK ID (128) */ ++#define CK_TOP_USB_FRMCNT 55 /* Linux CLK ID (129) */ ++#define CK_TOP_USB_FRMCNT_P1 56 /* Linux CLK ID (130) */ ++#define CK_TOP_AUD 57 /* Linux CLK ID (131) */ ++#define CK_TOP_A1SYS 58 /* Linux CLK ID (132) */ ++#define CK_TOP_AUD_L 59 /* Linux CLK ID (133) */ ++#define CK_TOP_A_TUNER 60 /* Linux CLK ID (134) */ ++#define CK_TOP_SYSAXI 61 /* Linux CLK ID (135) */ ++#define CK_TOP_INFRA_F26M 62 /* Linux CLK ID (136) */ ++#define CK_TOP_USB_REF 63 /* Linux CLK ID (137) */ ++#define CK_TOP_USB_CK_P1 64 /* Linux CLK ID (138) */ ++/* mtk_mux */ ++#define CK_TOP_NETSYS_SEL 65 /* Linux CLK ID (0) */ ++#define CK_TOP_NETSYS_500M_SEL 66 /* Linux CLK ID (1) */ ++#define CK_TOP_NETSYS_2X_SEL 67 /* Linux CLK ID (2) */ ++#define CK_TOP_NETSYS_GSW_SEL 68 /* Linux CLK ID (3) */ ++#define CK_TOP_ETH_GMII_SEL 69 /* Linux CLK ID (4) */ ++#define CK_TOP_NETSYS_MCU_SEL 70 /* Linux CLK ID (5) */ ++#define CK_TOP_NETSYS_PAO_2X_SEL 71 /* Linux CLK ID (6) */ ++#define CK_TOP_EIP197_SEL 72 /* Linux CLK ID (7) */ ++#define CK_TOP_AXI_INFRA_SEL 73 /* Linux CLK ID (8) */ ++#define CK_TOP_UART_SEL 74 /* Linux CLK ID (9) */ ++#define CK_TOP_EMMC_250M_SEL 75 /* Linux CLK ID (10) */ ++#define CK_TOP_EMMC_400M_SEL 76 /* Linux CLK ID (11) */ ++#define CK_TOP_SPI_SEL 77 /* Linux CLK ID (12) */ ++#define CK_TOP_SPIM_MST_SEL 78 /* Linux CLK ID (13) */ ++#define CK_TOP_NFI1X_SEL 79 /* Linux CLK ID (14) */ ++#define CK_TOP_SPINFI_SEL 80 /* Linux CLK ID (15) */ ++#define CK_TOP_PWM_SEL 81 /* Linux CLK ID (16) */ ++#define CK_TOP_I2C_SEL 82 /* Linux CLK ID (17) */ ++#define CK_TOP_PCIE_MBIST_250M_SEL 83 /* Linux CLK ID (18) */ ++#define CK_TOP_PEXTP_TL_SEL 84 /* Linux CLK ID (19) */ ++#define CK_TOP_PEXTP_TL_P1_SEL 85 /* Linux CLK ID (20) */ ++#define CK_TOP_PEXTP_TL_P2_SEL 86 /* Linux CLK ID (21) */ ++#define CK_TOP_PEXTP_TL_P3_SEL 87 /* Linux CLK ID (22) */ ++#define CK_TOP_USB_SYS_SEL 88 /* Linux CLK ID (23) */ ++#define CK_TOP_USB_SYS_P1_SEL 89 /* Linux CLK ID (24) */ ++#define CK_TOP_USB_XHCI_SEL 90 /* Linux CLK ID (25) */ ++#define CK_TOP_USB_XHCI_P1_SEL 91 /* Linux CLK ID (26) */ ++#define CK_TOP_USB_FRMCNT_SEL 92 /* Linux CLK ID (27) */ ++#define CK_TOP_USB_FRMCNT_P1_SEL 93 /* Linux CLK ID (28) */ ++#define CK_TOP_AUD_SEL 94 /* Linux CLK ID (29) */ ++#define CK_TOP_A1SYS_SEL 95 /* Linux CLK ID (30) */ ++#define CK_TOP_AUD_L_SEL 96 /* Linux CLK ID (31) */ ++#define CK_TOP_A_TUNER_SEL 97 /* Linux CLK ID (32) */ ++#define CK_TOP_SSPXTP_SEL 98 /* Linux CLK ID (33) */ ++#define CK_TOP_USB_PHY_SEL 99 /* Linux CLK ID (34) */ ++#define CK_TOP_USXGMII_SBUS_0_SEL 100 /* Linux CLK ID (35) */ ++#define CK_TOP_USXGMII_SBUS_1_SEL 101 /* Linux CLK ID (36) */ ++#define CK_TOP_SGM_0_SEL 102 /* Linux CLK ID (37) */ ++#define CK_TOP_SGM_SBUS_0_SEL 103 /* Linux CLK ID (38) */ ++#define CK_TOP_SGM_1_SEL 104 /* Linux CLK ID (39) */ ++#define CK_TOP_SGM_SBUS_1_SEL 105 /* Linux CLK ID (40) */ ++#define CK_TOP_XFI_PHY_0_XTAL_SEL 106 /* Linux CLK ID (41) */ ++#define CK_TOP_XFI_PHY_1_XTAL_SEL 107 /* Linux CLK ID (42) */ ++#define CK_TOP_SYSAXI_SEL 108 /* Linux CLK ID (43) */ ++#define CK_TOP_SYSAPB_SEL 109 /* Linux CLK ID (44) */ ++#define CK_TOP_ETH_REFCK_50M_SEL 110 /* Linux CLK ID (45) */ ++#define CK_TOP_ETH_SYS_200M_SEL 111 /* Linux CLK ID (46) */ ++#define CK_TOP_ETH_SYS_SEL 112 /* Linux CLK ID (47) */ ++#define CK_TOP_ETH_XGMII_SEL 113 /* Linux CLK ID (48) */ ++#define CK_TOP_BUS_TOPS_SEL 114 /* Linux CLK ID (49) */ ++#define CK_TOP_NPU_TOPS_SEL 115 /* Linux CLK ID (50) */ ++#define CK_TOP_DRAMC_SEL 116 /* Linux CLK ID (51) */ ++#define CK_TOP_DRAMC_MD32_SEL 117 /* Linux CLK ID (52) */ ++#define CK_TOP_INFRA_F26M_SEL 118 /* Linux CLK ID (53) */ ++#define CK_TOP_PEXTP_P0_SEL 119 /* Linux CLK ID (54) */ ++#define CK_TOP_PEXTP_P1_SEL 120 /* Linux CLK ID (55) */ ++#define CK_TOP_PEXTP_P2_SEL 121 /* Linux CLK ID (56) */ ++#define CK_TOP_PEXTP_P3_SEL 122 /* Linux CLK ID (57) */ ++#define CK_TOP_DA_XTP_GLB_P0_SEL 123 /* Linux CLK ID (58) */ ++#define CK_TOP_DA_XTP_GLB_P1_SEL 124 /* Linux CLK ID (59) */ ++#define CK_TOP_DA_XTP_GLB_P2_SEL 125 /* Linux CLK ID (60) */ ++#define CK_TOP_DA_XTP_GLB_P3_SEL 126 /* Linux CLK ID (61) */ ++#define CK_TOP_CKM_SEL 127 /* Linux CLK ID (62) */ ++#define CK_TOP_DA_SELM_XTAL_SEL 128 /* Linux CLK ID (63) */ ++#define CK_TOP_PEXTP_SEL 129 /* Linux CLK ID (64) */ ++#define CK_TOP_TOPS_P2_26M_SEL 130 /* Linux CLK ID (65) */ ++#define CK_TOP_MCUSYS_BACKUP_625M_SEL 131 /* Linux CLK ID (66) */ ++#define CK_TOP_NETSYS_SYNC_250M_SEL 132 /* Linux CLK ID (67) */ ++#define CK_TOP_MACSEC_SEL 133 /* Linux CLK ID (68) */ ++#define CK_TOP_NETSYS_TOPS_400M_SEL 134 /* Linux CLK ID (69) */ ++#define CK_TOP_NETSYS_PPEFB_250M_SEL 135 /* Linux CLK ID (70) */ ++#define CK_TOP_NETSYS_WARP_SEL 136 /* Linux CLK ID (71) */ ++#define CK_TOP_ETH_MII_SEL 137 /* Linux CLK ID (72) */ ++#define CK_TOP_CK_NPU_SEL_CM_TOPS_SEL 138 /* Linux CLK ID (73) */ ++ ++/* APMIXEDSYS */ ++/* mtk_pll_data */ ++#define CK_APMIXED_NETSYSPLL 0 ++#define CK_APMIXED_MPLL 1 ++#define CK_APMIXED_MMPLL 2 ++#define CK_APMIXED_APLL2 3 ++#define CK_APMIXED_NET1PLL 4 ++#define CK_APMIXED_NET2PLL 5 ++#define CK_APMIXED_WEDMCUPLL 6 ++#define CK_APMIXED_SGMPLL 7 ++#define CK_APMIXED_ARM_B 8 ++#define CK_APMIXED_CCIPLL2_B 9 ++#define CK_APMIXED_USXGMIIPLL 10 ++#define CK_APMIXED_MSDCPLL 11 ++ ++/* ETHSYS ETH DMA */ ++/* mtk_gate */ ++#define CK_ETHDMA_FE_EN 0 ++ ++/* SGMIISYS_0 */ ++/* mtk_gate */ ++#define CK_SGM0_TX_EN 0 ++#define CK_SGM0_RX_EN 1 ++ ++/* SGMIISYS_1 */ ++/* mtk_gate */ ++#define CK_SGM1_TX_EN 0 ++#define CK_SGM1_RX_EN 1 ++ ++/* ETHWARP */ ++/* mtk_gate */ ++#define CK_ETHWARP_WOCPU2_EN 0 ++#define CK_ETHWARP_WOCPU1_EN 1 ++#define CK_ETHWARP_WOCPU0_EN 2 ++ ++#endif /* _DT_BINDINGS_CLK_MT7988_H */ diff --git a/package/boot/uboot-mediatek/patches/101-11-reset-mediatek-add-reset-definition-for-MediaTek-MT7.patch b/package/boot/uboot-mediatek/patches/101-11-reset-mediatek-add-reset-definition-for-MediaTek-MT7.patch new file mode 100644 index 00000000000000..f14c38363874bf --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-11-reset-mediatek-add-reset-definition-for-MediaTek-MT7.patch @@ -0,0 +1,49 @@ +From b4a308dd31a7c6754be230849a5e430052268b9c Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:33 +0800 +Subject: [PATCH 11/29] reset: mediatek: add reset definition for MediaTek + MT7988 SoC + +This patch adds reset bits for MediaTek MT7988 + +Signed-off-by: Sam Shih +Signed-off-by: Weijie Gao +--- + include/dt-bindings/reset/mt7988-reset.h | 31 ++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + create mode 100644 include/dt-bindings/reset/mt7988-reset.h + +--- /dev/null ++++ b/include/dt-bindings/reset/mt7988-reset.h +@@ -0,0 +1,31 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (C) 2023 MediaTek Inc. ++ */ ++ ++#ifndef _DT_BINDINGS_MTK_RESET_H_ ++#define _DT_BINDINGS_MTK_RESET_H_ ++ ++/* ETHDMA Subsystem resets */ ++#define ETHDMA_FE_RST 6 ++#define ETHDMA_PMTR_RST 8 ++#define ETHDMA_GMAC_RST 23 ++#define ETHDMA_WDMA0_RST 24 ++#define ETHDMA_WDMA1_RST 25 ++#define ETHDMA_WDMA2_RST 26 ++#define ETHDMA_PPE0_RST 29 ++#define ETHDMA_PPE1_RST 30 ++#define ETHDMA_PPE2_RST 31 ++ ++/* ETHWARP Subsystem resets */ ++#define ETHWARP_GSW_RST 9 ++#define ETHWARP_EIP197_RST 10 ++#define ETHWARP_WOCPU0_RST 32 ++#define ETHWARP_WOCPU1_RST 33 ++#define ETHWARP_WOCPU2_RST 34 ++#define ETHWARP_WOX_NET_MUX_RST 35 ++#define ETHWARP_WED0_RST 36 ++#define ETHWARP_WED1_RST 37 ++#define ETHWARP_WED2_RST 38 ++ ++#endif /* _DT_BINDINGS_MTK_RESET_H_ */ diff --git a/package/boot/uboot-mediatek/patches/101-12-pinctrl-mediatek-convert-most-definitions-to-const.patch b/package/boot/uboot-mediatek/patches/101-12-pinctrl-mediatek-convert-most-definitions-to-const.patch new file mode 100644 index 00000000000000..4085f1154199ce --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-12-pinctrl-mediatek-convert-most-definitions-to-const.patch @@ -0,0 +1,2267 @@ +From 30227fcf55ac95ad6778de2fc3e6d1e00cf82566 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:37 +0800 +Subject: [PATCH 12/29] pinctrl: mediatek: convert most definitions to const + +There exists a situation of the mediatek pinctrl driver that may return +wrong pin function value for the pinmux driver: +- All pin function arrays are defined without const +- Some pin function arrays contain all-zero value, e.g.: + static int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, }; +- These arrays will be put into .bss section during compilation +- .bss section has no "a" attribute and does not exist in the final binary + file after objcopy. +- FDT binary blob is appended to the u-boot binary, which occupies the + .bss section. +- During board_f stage, .bss has not been initialized, and contains the + data of FDT, which is not full-zero data. +- pinctrl driver is initialized in board_f stage, and it will get wrong + data if another driver is going to set default pinctrl. + +Since pinmux information and soc data are only meant to be read-only, thus +should be declared as const. This will force all pinctrl data being put +into .rodata section. Since .rodata has "a" attribute, even the all-zero +data will be allocated and filled with correct value in to u-boot binary. + +Signed-off-by: Weijie Gao +--- + drivers/pinctrl/mediatek/pinctrl-mt7622.c | 474 ++++++------- + drivers/pinctrl/mediatek/pinctrl-mt7623.c | 650 +++++++++--------- + drivers/pinctrl/mediatek/pinctrl-mt7629.c | 174 ++--- + drivers/pinctrl/mediatek/pinctrl-mt7981.c | 270 ++++---- + drivers/pinctrl/mediatek/pinctrl-mt7986.c | 145 ++-- + drivers/pinctrl/mediatek/pinctrl-mt8512.c | 24 +- + drivers/pinctrl/mediatek/pinctrl-mt8516.c | 18 +- + drivers/pinctrl/mediatek/pinctrl-mt8518.c | 20 +- + drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 +- + drivers/pinctrl/mediatek/pinctrl-mtk-common.h | 8 +- + 10 files changed, 898 insertions(+), 889 deletions(-) + +--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c +@@ -233,283 +233,285 @@ static const struct mtk_pin_desc mt7622_ + */ + + /* EMMC */ +-static int mt7622_emmc_pins[] = { 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, }; +-static int mt7622_emmc_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; ++static const int mt7622_emmc_pins[] = { ++ 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, }; ++static const int mt7622_emmc_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; + +-static int mt7622_emmc_rst_pins[] = { 37, }; +-static int mt7622_emmc_rst_funcs[] = { 1, }; ++static const int mt7622_emmc_rst_pins[] = { 37, }; ++static const int mt7622_emmc_rst_funcs[] = { 1, }; + + /* LED for EPHY */ +-static int mt7622_ephy_leds_pins[] = { 86, 91, 92, 93, 94, }; +-static int mt7622_ephy_leds_funcs[] = { 0, 0, 0, 0, 0, }; +-static int mt7622_ephy0_led_pins[] = { 86, }; +-static int mt7622_ephy0_led_funcs[] = { 0, }; +-static int mt7622_ephy1_led_pins[] = { 91, }; +-static int mt7622_ephy1_led_funcs[] = { 2, }; +-static int mt7622_ephy2_led_pins[] = { 92, }; +-static int mt7622_ephy2_led_funcs[] = { 2, }; +-static int mt7622_ephy3_led_pins[] = { 93, }; +-static int mt7622_ephy3_led_funcs[] = { 2, }; +-static int mt7622_ephy4_led_pins[] = { 94, }; +-static int mt7622_ephy4_led_funcs[] = { 2, }; ++static const int mt7622_ephy_leds_pins[] = { 86, 91, 92, 93, 94, }; ++static const int mt7622_ephy_leds_funcs[] = { 0, 0, 0, 0, 0, }; ++static const int mt7622_ephy0_led_pins[] = { 86, }; ++static const int mt7622_ephy0_led_funcs[] = { 0, }; ++static const int mt7622_ephy1_led_pins[] = { 91, }; ++static const int mt7622_ephy1_led_funcs[] = { 2, }; ++static const int mt7622_ephy2_led_pins[] = { 92, }; ++static const int mt7622_ephy2_led_funcs[] = { 2, }; ++static const int mt7622_ephy3_led_pins[] = { 93, }; ++static const int mt7622_ephy3_led_funcs[] = { 2, }; ++static const int mt7622_ephy4_led_pins[] = { 94, }; ++static const int mt7622_ephy4_led_funcs[] = { 2, }; + + /* Embedded Switch */ +-static int mt7622_esw_pins[] = { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, +- 62, 63, 64, 65, 66, 67, 68, 69, 70, }; +-static int mt7622_esw_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 0, 0, 0, 0, 0, }; +-static int mt7622_esw_p0_p1_pins[] = { 51, 52, 53, 54, 55, 56, 57, 58, }; +-static int mt7622_esw_p0_p1_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; +-static int mt7622_esw_p2_p3_p4_pins[] = { 59, 60, 61, 62, 63, 64, 65, 66, 67, +- 68, 69, 70, }; +-static int mt7622_esw_p2_p3_p4_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, }; ++static const int mt7622_esw_pins[] = { ++ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, ++ 69, 70, }; ++static const int mt7622_esw_funcs[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; ++static const int mt7622_esw_p0_p1_pins[] = { 51, 52, 53, 54, 55, 56, 57, 58, }; ++static const int mt7622_esw_p0_p1_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; ++static const int mt7622_esw_p2_p3_p4_pins[] = { ++ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, }; ++static const int mt7622_esw_p2_p3_p4_funcs[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + /* RGMII via ESW */ +-static int mt7622_rgmii_via_esw_pins[] = { 59, 60, 61, 62, 63, 64, 65, 66, +- 67, 68, 69, 70, }; +-static int mt7622_rgmii_via_esw_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, }; ++static const int mt7622_rgmii_via_esw_pins[] = { ++ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, }; ++static const int mt7622_rgmii_via_esw_funcs[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + + /* RGMII via GMAC1 */ +-static int mt7622_rgmii_via_gmac1_pins[] = { 59, 60, 61, 62, 63, 64, 65, 66, +- 67, 68, 69, 70, }; +-static int mt7622_rgmii_via_gmac1_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, }; ++static const int mt7622_rgmii_via_gmac1_pins[] = { ++ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, }; ++static const int mt7622_rgmii_via_gmac1_funcs[] = { ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; + + /* RGMII via GMAC2 */ +-static int mt7622_rgmii_via_gmac2_pins[] = { 25, 26, 27, 28, 29, 30, 31, 32, +- 33, 34, 35, 36, }; +-static int mt7622_rgmii_via_gmac2_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, }; ++static const int mt7622_rgmii_via_gmac2_pins[] = { ++ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, }; ++static const int mt7622_rgmii_via_gmac2_funcs[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + + /* I2C */ +-static int mt7622_i2c0_pins[] = { 14, 15, }; +-static int mt7622_i2c0_funcs[] = { 0, 0, }; +-static int mt7622_i2c1_0_pins[] = { 55, 56, }; +-static int mt7622_i2c1_0_funcs[] = { 0, 0, }; +-static int mt7622_i2c1_1_pins[] = { 73, 74, }; +-static int mt7622_i2c1_1_funcs[] = { 3, 3, }; +-static int mt7622_i2c1_2_pins[] = { 87, 88, }; +-static int mt7622_i2c1_2_funcs[] = { 0, 0, }; +-static int mt7622_i2c2_0_pins[] = { 57, 58, }; +-static int mt7622_i2c2_0_funcs[] = { 0, 0, }; +-static int mt7622_i2c2_1_pins[] = { 75, 76, }; +-static int mt7622_i2c2_1_funcs[] = { 3, 3, }; +-static int mt7622_i2c2_2_pins[] = { 89, 90, }; +-static int mt7622_i2c2_2_funcs[] = { 0, 0, }; ++static const int mt7622_i2c0_pins[] = { 14, 15, }; ++static const int mt7622_i2c0_funcs[] = { 0, 0, }; ++static const int mt7622_i2c1_0_pins[] = { 55, 56, }; ++static const int mt7622_i2c1_0_funcs[] = { 0, 0, }; ++static const int mt7622_i2c1_1_pins[] = { 73, 74, }; ++static const int mt7622_i2c1_1_funcs[] = { 3, 3, }; ++static const int mt7622_i2c1_2_pins[] = { 87, 88, }; ++static const int mt7622_i2c1_2_funcs[] = { 0, 0, }; ++static const int mt7622_i2c2_0_pins[] = { 57, 58, }; ++static const int mt7622_i2c2_0_funcs[] = { 0, 0, }; ++static const int mt7622_i2c2_1_pins[] = { 75, 76, }; ++static const int mt7622_i2c2_1_funcs[] = { 3, 3, }; ++static const int mt7622_i2c2_2_pins[] = { 89, 90, }; ++static const int mt7622_i2c2_2_funcs[] = { 0, 0, }; + + /* I2S */ +-static int mt7622_i2s_in_mclk_bclk_ws_pins[] = { 3, 4, 5, }; +-static int mt7622_i2s_in_mclk_bclk_ws_funcs[] = { 3, 3, 0, }; +-static int mt7622_i2s1_in_data_pins[] = { 1, }; +-static int mt7622_i2s1_in_data_funcs[] = { 0, }; +-static int mt7622_i2s2_in_data_pins[] = { 16, }; +-static int mt7622_i2s2_in_data_funcs[] = { 0, }; +-static int mt7622_i2s3_in_data_pins[] = { 17, }; +-static int mt7622_i2s3_in_data_funcs[] = { 0, }; +-static int mt7622_i2s4_in_data_pins[] = { 18, }; +-static int mt7622_i2s4_in_data_funcs[] = { 0, }; +-static int mt7622_i2s_out_mclk_bclk_ws_pins[] = { 3, 4, 5, }; +-static int mt7622_i2s_out_mclk_bclk_ws_funcs[] = { 0, 0, 0, }; +-static int mt7622_i2s1_out_data_pins[] = { 2, }; +-static int mt7622_i2s1_out_data_funcs[] = { 0, }; +-static int mt7622_i2s2_out_data_pins[] = { 19, }; +-static int mt7622_i2s2_out_data_funcs[] = { 0, }; +-static int mt7622_i2s3_out_data_pins[] = { 20, }; +-static int mt7622_i2s3_out_data_funcs[] = { 0, }; +-static int mt7622_i2s4_out_data_pins[] = { 21, }; +-static int mt7622_i2s4_out_data_funcs[] = { 0, }; ++static const int mt7622_i2s_in_mclk_bclk_ws_pins[] = { 3, 4, 5, }; ++static const int mt7622_i2s_in_mclk_bclk_ws_funcs[] = { 3, 3, 0, }; ++static const int mt7622_i2s1_in_data_pins[] = { 1, }; ++static const int mt7622_i2s1_in_data_funcs[] = { 0, }; ++static const int mt7622_i2s2_in_data_pins[] = { 16, }; ++static const int mt7622_i2s2_in_data_funcs[] = { 0, }; ++static const int mt7622_i2s3_in_data_pins[] = { 17, }; ++static const int mt7622_i2s3_in_data_funcs[] = { 0, }; ++static const int mt7622_i2s4_in_data_pins[] = { 18, }; ++static const int mt7622_i2s4_in_data_funcs[] = { 0, }; ++static const int mt7622_i2s_out_mclk_bclk_ws_pins[] = { 3, 4, 5, }; ++static const int mt7622_i2s_out_mclk_bclk_ws_funcs[] = { 0, 0, 0, }; ++static const int mt7622_i2s1_out_data_pins[] = { 2, }; ++static const int mt7622_i2s1_out_data_funcs[] = { 0, }; ++static const int mt7622_i2s2_out_data_pins[] = { 19, }; ++static const int mt7622_i2s2_out_data_funcs[] = { 0, }; ++static const int mt7622_i2s3_out_data_pins[] = { 20, }; ++static const int mt7622_i2s3_out_data_funcs[] = { 0, }; ++static const int mt7622_i2s4_out_data_pins[] = { 21, }; ++static const int mt7622_i2s4_out_data_funcs[] = { 0, }; + + /* IR */ +-static int mt7622_ir_0_tx_pins[] = { 16, }; +-static int mt7622_ir_0_tx_funcs[] = { 4, }; +-static int mt7622_ir_1_tx_pins[] = { 59, }; +-static int mt7622_ir_1_tx_funcs[] = { 5, }; +-static int mt7622_ir_2_tx_pins[] = { 99, }; +-static int mt7622_ir_2_tx_funcs[] = { 3, }; +-static int mt7622_ir_0_rx_pins[] = { 17, }; +-static int mt7622_ir_0_rx_funcs[] = { 4, }; +-static int mt7622_ir_1_rx_pins[] = { 60, }; +-static int mt7622_ir_1_rx_funcs[] = { 5, }; +-static int mt7622_ir_2_rx_pins[] = { 100, }; +-static int mt7622_ir_2_rx_funcs[] = { 3, }; ++static const int mt7622_ir_0_tx_pins[] = { 16, }; ++static const int mt7622_ir_0_tx_funcs[] = { 4, }; ++static const int mt7622_ir_1_tx_pins[] = { 59, }; ++static const int mt7622_ir_1_tx_funcs[] = { 5, }; ++static const int mt7622_ir_2_tx_pins[] = { 99, }; ++static const int mt7622_ir_2_tx_funcs[] = { 3, }; ++static const int mt7622_ir_0_rx_pins[] = { 17, }; ++static const int mt7622_ir_0_rx_funcs[] = { 4, }; ++static const int mt7622_ir_1_rx_pins[] = { 60, }; ++static const int mt7622_ir_1_rx_funcs[] = { 5, }; ++static const int mt7622_ir_2_rx_pins[] = { 100, }; ++static const int mt7622_ir_2_rx_funcs[] = { 3, }; + + /* MDIO */ +-static int mt7622_mdc_mdio_pins[] = { 23, 24, }; +-static int mt7622_mdc_mdio_funcs[] = { 0, 0, }; ++static const int mt7622_mdc_mdio_pins[] = { 23, 24, }; ++static const int mt7622_mdc_mdio_funcs[] = { 0, 0, }; + + /* PCIE */ +-static int mt7622_pcie0_0_waken_pins[] = { 14, }; +-static int mt7622_pcie0_0_waken_funcs[] = { 2, }; +-static int mt7622_pcie0_0_clkreq_pins[] = { 15, }; +-static int mt7622_pcie0_0_clkreq_funcs[] = { 2, }; +-static int mt7622_pcie0_1_waken_pins[] = { 79, }; +-static int mt7622_pcie0_1_waken_funcs[] = { 4, }; +-static int mt7622_pcie0_1_clkreq_pins[] = { 80, }; +-static int mt7622_pcie0_1_clkreq_funcs[] = { 4, }; +-static int mt7622_pcie1_0_waken_pins[] = { 14, }; +-static int mt7622_pcie1_0_waken_funcs[] = { 3, }; +-static int mt7622_pcie1_0_clkreq_pins[] = { 15, }; +-static int mt7622_pcie1_0_clkreq_funcs[] = { 3, }; +- +-static int mt7622_pcie0_pad_perst_pins[] = { 83, }; +-static int mt7622_pcie0_pad_perst_funcs[] = { 0, }; +-static int mt7622_pcie1_pad_perst_pins[] = { 84, }; +-static int mt7622_pcie1_pad_perst_funcs[] = { 0, }; ++static const int mt7622_pcie0_0_waken_pins[] = { 14, }; ++static const int mt7622_pcie0_0_waken_funcs[] = { 2, }; ++static const int mt7622_pcie0_0_clkreq_pins[] = { 15, }; ++static const int mt7622_pcie0_0_clkreq_funcs[] = { 2, }; ++static const int mt7622_pcie0_1_waken_pins[] = { 79, }; ++static const int mt7622_pcie0_1_waken_funcs[] = { 4, }; ++static const int mt7622_pcie0_1_clkreq_pins[] = { 80, }; ++static const int mt7622_pcie0_1_clkreq_funcs[] = { 4, }; ++static const int mt7622_pcie1_0_waken_pins[] = { 14, }; ++static const int mt7622_pcie1_0_waken_funcs[] = { 3, }; ++static const int mt7622_pcie1_0_clkreq_pins[] = { 15, }; ++static const int mt7622_pcie1_0_clkreq_funcs[] = { 3, }; ++ ++static const int mt7622_pcie0_pad_perst_pins[] = { 83, }; ++static const int mt7622_pcie0_pad_perst_funcs[] = { 0, }; ++static const int mt7622_pcie1_pad_perst_pins[] = { 84, }; ++static const int mt7622_pcie1_pad_perst_funcs[] = { 0, }; + + /* PMIC bus */ +-static int mt7622_pmic_bus_pins[] = { 71, 72, }; +-static int mt7622_pmic_bus_funcs[] = { 0, 0, }; ++static const int mt7622_pmic_bus_pins[] = { 71, 72, }; ++static const int mt7622_pmic_bus_funcs[] = { 0, 0, }; + + /* Parallel NAND */ +-static int mt7622_pnand_pins[] = { 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, +- 48, 49, 50, }; +-static int mt7622_pnand_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, }; ++static const int mt7622_pnand_pins[] = { ++ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, }; ++static const int mt7622_pnand_funcs[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + + /* PWM */ +-static int mt7622_pwm_ch1_0_pins[] = { 51, }; +-static int mt7622_pwm_ch1_0_funcs[] = { 3, }; +-static int mt7622_pwm_ch1_1_pins[] = { 73, }; +-static int mt7622_pwm_ch1_1_funcs[] = { 4, }; +-static int mt7622_pwm_ch1_2_pins[] = { 95, }; +-static int mt7622_pwm_ch1_2_funcs[] = { 0, }; +-static int mt7622_pwm_ch2_0_pins[] = { 52, }; +-static int mt7622_pwm_ch2_0_funcs[] = { 3, }; +-static int mt7622_pwm_ch2_1_pins[] = { 74, }; +-static int mt7622_pwm_ch2_1_funcs[] = { 4, }; +-static int mt7622_pwm_ch2_2_pins[] = { 96, }; +-static int mt7622_pwm_ch2_2_funcs[] = { 0, }; +-static int mt7622_pwm_ch3_0_pins[] = { 53, }; +-static int mt7622_pwm_ch3_0_funcs[] = { 3, }; +-static int mt7622_pwm_ch3_1_pins[] = { 75, }; +-static int mt7622_pwm_ch3_1_funcs[] = { 4, }; +-static int mt7622_pwm_ch3_2_pins[] = { 97, }; +-static int mt7622_pwm_ch3_2_funcs[] = { 0, }; +-static int mt7622_pwm_ch4_0_pins[] = { 54, }; +-static int mt7622_pwm_ch4_0_funcs[] = { 3, }; +-static int mt7622_pwm_ch4_1_pins[] = { 67, }; +-static int mt7622_pwm_ch4_1_funcs[] = { 3, }; +-static int mt7622_pwm_ch4_2_pins[] = { 76, }; +-static int mt7622_pwm_ch4_2_funcs[] = { 4, }; +-static int mt7622_pwm_ch4_3_pins[] = { 98, }; +-static int mt7622_pwm_ch4_3_funcs[] = { 0, }; +-static int mt7622_pwm_ch5_0_pins[] = { 68, }; +-static int mt7622_pwm_ch5_0_funcs[] = { 3, }; +-static int mt7622_pwm_ch5_1_pins[] = { 77, }; +-static int mt7622_pwm_ch5_1_funcs[] = { 4, }; +-static int mt7622_pwm_ch5_2_pins[] = { 99, }; +-static int mt7622_pwm_ch5_2_funcs[] = { 0, }; +-static int mt7622_pwm_ch6_0_pins[] = { 69, }; +-static int mt7622_pwm_ch6_0_funcs[] = { 3, }; +-static int mt7622_pwm_ch6_1_pins[] = { 78, }; +-static int mt7622_pwm_ch6_1_funcs[] = { 4, }; +-static int mt7622_pwm_ch6_2_pins[] = { 81, }; +-static int mt7622_pwm_ch6_2_funcs[] = { 4, }; +-static int mt7622_pwm_ch6_3_pins[] = { 100, }; +-static int mt7622_pwm_ch6_3_funcs[] = { 0, }; +-static int mt7622_pwm_ch7_0_pins[] = { 70, }; +-static int mt7622_pwm_ch7_0_funcs[] = { 3, }; +-static int mt7622_pwm_ch7_1_pins[] = { 82, }; +-static int mt7622_pwm_ch7_1_funcs[] = { 4, }; +-static int mt7622_pwm_ch7_2_pins[] = { 101, }; +-static int mt7622_pwm_ch7_2_funcs[] = { 0, }; ++static const int mt7622_pwm_ch1_0_pins[] = { 51, }; ++static const int mt7622_pwm_ch1_0_funcs[] = { 3, }; ++static const int mt7622_pwm_ch1_1_pins[] = { 73, }; ++static const int mt7622_pwm_ch1_1_funcs[] = { 4, }; ++static const int mt7622_pwm_ch1_2_pins[] = { 95, }; ++static const int mt7622_pwm_ch1_2_funcs[] = { 0, }; ++static const int mt7622_pwm_ch2_0_pins[] = { 52, }; ++static const int mt7622_pwm_ch2_0_funcs[] = { 3, }; ++static const int mt7622_pwm_ch2_1_pins[] = { 74, }; ++static const int mt7622_pwm_ch2_1_funcs[] = { 4, }; ++static const int mt7622_pwm_ch2_2_pins[] = { 96, }; ++static const int mt7622_pwm_ch2_2_funcs[] = { 0, }; ++static const int mt7622_pwm_ch3_0_pins[] = { 53, }; ++static const int mt7622_pwm_ch3_0_funcs[] = { 3, }; ++static const int mt7622_pwm_ch3_1_pins[] = { 75, }; ++static const int mt7622_pwm_ch3_1_funcs[] = { 4, }; ++static const int mt7622_pwm_ch3_2_pins[] = { 97, }; ++static const int mt7622_pwm_ch3_2_funcs[] = { 0, }; ++static const int mt7622_pwm_ch4_0_pins[] = { 54, }; ++static const int mt7622_pwm_ch4_0_funcs[] = { 3, }; ++static const int mt7622_pwm_ch4_1_pins[] = { 67, }; ++static const int mt7622_pwm_ch4_1_funcs[] = { 3, }; ++static const int mt7622_pwm_ch4_2_pins[] = { 76, }; ++static const int mt7622_pwm_ch4_2_funcs[] = { 4, }; ++static const int mt7622_pwm_ch4_3_pins[] = { 98, }; ++static const int mt7622_pwm_ch4_3_funcs[] = { 0, }; ++static const int mt7622_pwm_ch5_0_pins[] = { 68, }; ++static const int mt7622_pwm_ch5_0_funcs[] = { 3, }; ++static const int mt7622_pwm_ch5_1_pins[] = { 77, }; ++static const int mt7622_pwm_ch5_1_funcs[] = { 4, }; ++static const int mt7622_pwm_ch5_2_pins[] = { 99, }; ++static const int mt7622_pwm_ch5_2_funcs[] = { 0, }; ++static const int mt7622_pwm_ch6_0_pins[] = { 69, }; ++static const int mt7622_pwm_ch6_0_funcs[] = { 3, }; ++static const int mt7622_pwm_ch6_1_pins[] = { 78, }; ++static const int mt7622_pwm_ch6_1_funcs[] = { 4, }; ++static const int mt7622_pwm_ch6_2_pins[] = { 81, }; ++static const int mt7622_pwm_ch6_2_funcs[] = { 4, }; ++static const int mt7622_pwm_ch6_3_pins[] = { 100, }; ++static const int mt7622_pwm_ch6_3_funcs[] = { 0, }; ++static const int mt7622_pwm_ch7_0_pins[] = { 70, }; ++static const int mt7622_pwm_ch7_0_funcs[] = { 3, }; ++static const int mt7622_pwm_ch7_1_pins[] = { 82, }; ++static const int mt7622_pwm_ch7_1_funcs[] = { 4, }; ++static const int mt7622_pwm_ch7_2_pins[] = { 101, }; ++static const int mt7622_pwm_ch7_2_funcs[] = { 0, }; + + /* SD */ +-static int mt7622_sd_0_pins[] = { 16, 17, 18, 19, 20, 21, }; +-static int mt7622_sd_0_funcs[] = { 2, 2, 2, 2, 2, 2, }; +-static int mt7622_sd_1_pins[] = { 25, 26, 27, 28, 29, 30, }; +-static int mt7622_sd_1_funcs[] = { 2, 2, 2, 2, 2, 2, }; ++static const int mt7622_sd_0_pins[] = { 16, 17, 18, 19, 20, 21, }; ++static const int mt7622_sd_0_funcs[] = { 2, 2, 2, 2, 2, 2, }; ++static const int mt7622_sd_1_pins[] = { 25, 26, 27, 28, 29, 30, }; ++static const int mt7622_sd_1_funcs[] = { 2, 2, 2, 2, 2, 2, }; + + /* Serial NAND */ +-static int mt7622_snfi_pins[] = { 8, 9, 10, 11, 12, 13, }; +-static int mt7622_snfi_funcs[] = { 2, 2, 2, 2, 2, 2, }; ++static const int mt7622_snfi_pins[] = { 8, 9, 10, 11, 12, 13, }; ++static const int mt7622_snfi_funcs[] = { 2, 2, 2, 2, 2, 2, }; + + /* SPI NOR */ +-static int mt7622_spi_pins[] = { 8, 9, 10, 11, 12, 13 }; +-static int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, }; ++static const int mt7622_spi_pins[] = { 8, 9, 10, 11, 12, 13 }; ++static const int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, }; + + /* SPIC */ +-static int mt7622_spic0_0_pins[] = { 63, 64, 65, 66, }; +-static int mt7622_spic0_0_funcs[] = { 4, 4, 4, 4, }; +-static int mt7622_spic0_1_pins[] = { 79, 80, 81, 82, }; +-static int mt7622_spic0_1_funcs[] = { 3, 3, 3, 3, }; +-static int mt7622_spic1_0_pins[] = { 67, 68, 69, 70, }; +-static int mt7622_spic1_0_funcs[] = { 4, 4, 4, 4, }; +-static int mt7622_spic1_1_pins[] = { 73, 74, 75, 76, }; +-static int mt7622_spic1_1_funcs[] = { 0, 0, 0, 0, }; +-static int mt7622_spic2_0_pins[] = { 10, 11, 12, 13, }; +-static int mt7622_spic2_0_funcs[] = { 0, 0, 0, 0, }; +-static int mt7622_spic2_0_wp_hold_pins[] = { 8, 9, }; +-static int mt7622_spic2_0_wp_hold_funcs[] = { 0, 0, }; ++static const int mt7622_spic0_0_pins[] = { 63, 64, 65, 66, }; ++static const int mt7622_spic0_0_funcs[] = { 4, 4, 4, 4, }; ++static const int mt7622_spic0_1_pins[] = { 79, 80, 81, 82, }; ++static const int mt7622_spic0_1_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7622_spic1_0_pins[] = { 67, 68, 69, 70, }; ++static const int mt7622_spic1_0_funcs[] = { 4, 4, 4, 4, }; ++static const int mt7622_spic1_1_pins[] = { 73, 74, 75, 76, }; ++static const int mt7622_spic1_1_funcs[] = { 0, 0, 0, 0, }; ++static const int mt7622_spic2_0_pins[] = { 10, 11, 12, 13, }; ++static const int mt7622_spic2_0_funcs[] = { 0, 0, 0, 0, }; ++static const int mt7622_spic2_0_wp_hold_pins[] = { 8, 9, }; ++static const int mt7622_spic2_0_wp_hold_funcs[] = { 0, 0, }; + + /* TDM */ +-static int mt7622_tdm_0_out_mclk_bclk_ws_pins[] = { 8, 9, 10, }; +-static int mt7622_tdm_0_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; +-static int mt7622_tdm_0_in_mclk_bclk_ws_pins[] = { 11, 12, 13, }; +-static int mt7622_tdm_0_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; +-static int mt7622_tdm_0_out_data_pins[] = { 20, }; +-static int mt7622_tdm_0_out_data_funcs[] = { 3, }; +-static int mt7622_tdm_0_in_data_pins[] = { 21, }; +-static int mt7622_tdm_0_in_data_funcs[] = { 3, }; +-static int mt7622_tdm_1_out_mclk_bclk_ws_pins[] = { 57, 58, 59, }; +-static int mt7622_tdm_1_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; +-static int mt7622_tdm_1_in_mclk_bclk_ws_pins[] = { 60, 61, 62, }; +-static int mt7622_tdm_1_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; +-static int mt7622_tdm_1_out_data_pins[] = { 55, }; +-static int mt7622_tdm_1_out_data_funcs[] = { 3, }; +-static int mt7622_tdm_1_in_data_pins[] = { 56, }; +-static int mt7622_tdm_1_in_data_funcs[] = { 3, }; ++static const int mt7622_tdm_0_out_mclk_bclk_ws_pins[] = { 8, 9, 10, }; ++static const int mt7622_tdm_0_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; ++static const int mt7622_tdm_0_in_mclk_bclk_ws_pins[] = { 11, 12, 13, }; ++static const int mt7622_tdm_0_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; ++static const int mt7622_tdm_0_out_data_pins[] = { 20, }; ++static const int mt7622_tdm_0_out_data_funcs[] = { 3, }; ++static const int mt7622_tdm_0_in_data_pins[] = { 21, }; ++static const int mt7622_tdm_0_in_data_funcs[] = { 3, }; ++static const int mt7622_tdm_1_out_mclk_bclk_ws_pins[] = { 57, 58, 59, }; ++static const int mt7622_tdm_1_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; ++static const int mt7622_tdm_1_in_mclk_bclk_ws_pins[] = { 60, 61, 62, }; ++static const int mt7622_tdm_1_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; ++static const int mt7622_tdm_1_out_data_pins[] = { 55, }; ++static const int mt7622_tdm_1_out_data_funcs[] = { 3, }; ++static const int mt7622_tdm_1_in_data_pins[] = { 56, }; ++static const int mt7622_tdm_1_in_data_funcs[] = { 3, }; + + /* UART */ +-static int mt7622_uart0_0_tx_rx_pins[] = { 6, 7, }; +-static int mt7622_uart0_0_tx_rx_funcs[] = { 0, 0, }; +-static int mt7622_uart1_0_tx_rx_pins[] = { 55, 56, }; +-static int mt7622_uart1_0_tx_rx_funcs[] = { 2, 2, }; +-static int mt7622_uart1_0_rts_cts_pins[] = { 57, 58, }; +-static int mt7622_uart1_0_rts_cts_funcs[] = { 2, 2, }; +-static int mt7622_uart1_1_tx_rx_pins[] = { 73, 74, }; +-static int mt7622_uart1_1_tx_rx_funcs[] = { 2, 2, }; +-static int mt7622_uart1_1_rts_cts_pins[] = { 75, 76, }; +-static int mt7622_uart1_1_rts_cts_funcs[] = { 2, 2, }; +-static int mt7622_uart2_0_tx_rx_pins[] = { 3, 4, }; +-static int mt7622_uart2_0_tx_rx_funcs[] = { 2, 2, }; +-static int mt7622_uart2_0_rts_cts_pins[] = { 1, 2, }; +-static int mt7622_uart2_0_rts_cts_funcs[] = { 2, 2, }; +-static int mt7622_uart2_1_tx_rx_pins[] = { 51, 52, }; +-static int mt7622_uart2_1_tx_rx_funcs[] = { 0, 0, }; +-static int mt7622_uart2_1_rts_cts_pins[] = { 53, 54, }; +-static int mt7622_uart2_1_rts_cts_funcs[] = { 0, 0, }; +-static int mt7622_uart2_2_tx_rx_pins[] = { 59, 60, }; +-static int mt7622_uart2_2_tx_rx_funcs[] = { 4, 4, }; +-static int mt7622_uart2_2_rts_cts_pins[] = { 61, 62, }; +-static int mt7622_uart2_2_rts_cts_funcs[] = { 4, 4, }; +-static int mt7622_uart2_3_tx_rx_pins[] = { 95, 96, }; +-static int mt7622_uart2_3_tx_rx_funcs[] = { 3, 3, }; +-static int mt7622_uart3_0_tx_rx_pins[] = { 57, 58, }; +-static int mt7622_uart3_0_tx_rx_funcs[] = { 5, 5, }; +-static int mt7622_uart3_1_tx_rx_pins[] = { 81, 82, }; +-static int mt7622_uart3_1_tx_rx_funcs[] = { 0, 0, }; +-static int mt7622_uart3_1_rts_cts_pins[] = { 79, 80, }; +-static int mt7622_uart3_1_rts_cts_funcs[] = { 0, 0, }; +-static int mt7622_uart4_0_tx_rx_pins[] = { 61, 62, }; +-static int mt7622_uart4_0_tx_rx_funcs[] = { 5, 5, }; +-static int mt7622_uart4_1_tx_rx_pins[] = { 91, 92, }; +-static int mt7622_uart4_1_tx_rx_funcs[] = { 0, 0, }; +-static int mt7622_uart4_1_rts_cts_pins[] = { 93, 94 }; +-static int mt7622_uart4_1_rts_cts_funcs[] = { 0, 0, }; +-static int mt7622_uart4_2_tx_rx_pins[] = { 97, 98, }; +-static int mt7622_uart4_2_tx_rx_funcs[] = { 2, 2, }; +-static int mt7622_uart4_2_rts_cts_pins[] = { 95, 96 }; +-static int mt7622_uart4_2_rts_cts_funcs[] = { 2, 2, }; ++static const int mt7622_uart0_0_tx_rx_pins[] = { 6, 7, }; ++static const int mt7622_uart0_0_tx_rx_funcs[] = { 0, 0, }; ++static const int mt7622_uart1_0_tx_rx_pins[] = { 55, 56, }; ++static const int mt7622_uart1_0_tx_rx_funcs[] = { 2, 2, }; ++static const int mt7622_uart1_0_rts_cts_pins[] = { 57, 58, }; ++static const int mt7622_uart1_0_rts_cts_funcs[] = { 2, 2, }; ++static const int mt7622_uart1_1_tx_rx_pins[] = { 73, 74, }; ++static const int mt7622_uart1_1_tx_rx_funcs[] = { 2, 2, }; ++static const int mt7622_uart1_1_rts_cts_pins[] = { 75, 76, }; ++static const int mt7622_uart1_1_rts_cts_funcs[] = { 2, 2, }; ++static const int mt7622_uart2_0_tx_rx_pins[] = { 3, 4, }; ++static const int mt7622_uart2_0_tx_rx_funcs[] = { 2, 2, }; ++static const int mt7622_uart2_0_rts_cts_pins[] = { 1, 2, }; ++static const int mt7622_uart2_0_rts_cts_funcs[] = { 2, 2, }; ++static const int mt7622_uart2_1_tx_rx_pins[] = { 51, 52, }; ++static const int mt7622_uart2_1_tx_rx_funcs[] = { 0, 0, }; ++static const int mt7622_uart2_1_rts_cts_pins[] = { 53, 54, }; ++static const int mt7622_uart2_1_rts_cts_funcs[] = { 0, 0, }; ++static const int mt7622_uart2_2_tx_rx_pins[] = { 59, 60, }; ++static const int mt7622_uart2_2_tx_rx_funcs[] = { 4, 4, }; ++static const int mt7622_uart2_2_rts_cts_pins[] = { 61, 62, }; ++static const int mt7622_uart2_2_rts_cts_funcs[] = { 4, 4, }; ++static const int mt7622_uart2_3_tx_rx_pins[] = { 95, 96, }; ++static const int mt7622_uart2_3_tx_rx_funcs[] = { 3, 3, }; ++static const int mt7622_uart3_0_tx_rx_pins[] = { 57, 58, }; ++static const int mt7622_uart3_0_tx_rx_funcs[] = { 5, 5, }; ++static const int mt7622_uart3_1_tx_rx_pins[] = { 81, 82, }; ++static const int mt7622_uart3_1_tx_rx_funcs[] = { 0, 0, }; ++static const int mt7622_uart3_1_rts_cts_pins[] = { 79, 80, }; ++static const int mt7622_uart3_1_rts_cts_funcs[] = { 0, 0, }; ++static const int mt7622_uart4_0_tx_rx_pins[] = { 61, 62, }; ++static const int mt7622_uart4_0_tx_rx_funcs[] = { 5, 5, }; ++static const int mt7622_uart4_1_tx_rx_pins[] = { 91, 92, }; ++static const int mt7622_uart4_1_tx_rx_funcs[] = { 0, 0, }; ++static const int mt7622_uart4_1_rts_cts_pins[] = { 93, 94 }; ++static const int mt7622_uart4_1_rts_cts_funcs[] = { 0, 0, }; ++static const int mt7622_uart4_2_tx_rx_pins[] = { 97, 98, }; ++static const int mt7622_uart4_2_tx_rx_funcs[] = { 2, 2, }; ++static const int mt7622_uart4_2_rts_cts_pins[] = { 95, 96 }; ++static const int mt7622_uart4_2_rts_cts_funcs[] = { 2, 2, }; + + /* Watchdog */ +-static int mt7622_watchdog_pins[] = { 78, }; +-static int mt7622_watchdog_funcs[] = { 0, }; ++static const int mt7622_watchdog_pins[] = { 78, }; ++static const int mt7622_watchdog_funcs[] = { 0, }; + + /* WLAN LED */ +-static int mt7622_wled_pins[] = { 85, }; +-static int mt7622_wled_funcs[] = { 0, }; ++static const int mt7622_wled_pins[] = { 85, }; ++static const int mt7622_wled_funcs[] = { 0, }; + + static const struct mtk_group_desc mt7622_groups[] = { + PINCTRL_PIN_GROUP("emmc", mt7622_emmc), +@@ -719,7 +721,7 @@ static const struct mtk_function_desc mt + {"watchdog", mt7622_wdt_groups, ARRAY_SIZE(mt7622_wdt_groups)}, + }; + +-static struct mtk_pinctrl_soc mt7622_data = { ++static const struct mtk_pinctrl_soc mt7622_data = { + .name = "mt7622_pinctrl", + .reg_cal = mt7622_reg_cals, + .pins = mt7622_pins, +--- a/drivers/pinctrl/mediatek/pinctrl-mt7623.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt7623.c +@@ -692,377 +692,377 @@ static const struct mtk_pin_desc mt7623_ + */ + + /* AUDIO EXT CLK */ +-static int mt7623_aud_ext_clk0_pins[] = { 208, }; +-static int mt7623_aud_ext_clk0_funcs[] = { 1, }; +-static int mt7623_aud_ext_clk1_pins[] = { 209, }; +-static int mt7623_aud_ext_clk1_funcs[] = { 1, }; ++static const int mt7623_aud_ext_clk0_pins[] = { 208, }; ++static const int mt7623_aud_ext_clk0_funcs[] = { 1, }; ++static const int mt7623_aud_ext_clk1_pins[] = { 209, }; ++static const int mt7623_aud_ext_clk1_funcs[] = { 1, }; + + /* DISP PWM */ +-static int mt7623_disp_pwm_0_pins[] = { 72, }; +-static int mt7623_disp_pwm_0_funcs[] = { 5, }; +-static int mt7623_disp_pwm_1_pins[] = { 203, }; +-static int mt7623_disp_pwm_1_funcs[] = { 2, }; +-static int mt7623_disp_pwm_2_pins[] = { 208, }; +-static int mt7623_disp_pwm_2_funcs[] = { 5, }; ++static const int mt7623_disp_pwm_0_pins[] = { 72, }; ++static const int mt7623_disp_pwm_0_funcs[] = { 5, }; ++static const int mt7623_disp_pwm_1_pins[] = { 203, }; ++static const int mt7623_disp_pwm_1_funcs[] = { 2, }; ++static const int mt7623_disp_pwm_2_pins[] = { 208, }; ++static const int mt7623_disp_pwm_2_funcs[] = { 5, }; + + /* ESW */ +-static int mt7623_esw_int_pins[] = { 273, }; +-static int mt7623_esw_int_funcs[] = { 1, }; +-static int mt7623_esw_rst_pins[] = { 277, }; +-static int mt7623_esw_rst_funcs[] = { 1, }; ++static const int mt7623_esw_int_pins[] = { 273, }; ++static const int mt7623_esw_int_funcs[] = { 1, }; ++static const int mt7623_esw_rst_pins[] = { 277, }; ++static const int mt7623_esw_rst_funcs[] = { 1, }; + + /* EPHY */ +-static int mt7623_ephy_pins[] = { 262, 263, 264, 265, 266, 267, 268, +- 269, 270, 271, 272, 274, }; +-static int mt7623_ephy_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_ephy_pins[] = { 262, 263, 264, 265, 266, 267, 268, ++ 269, 270, 271, 272, 274, }; ++static const int mt7623_ephy_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + + /* EXT_SDIO */ +-static int mt7623_ext_sdio_pins[] = { 236, 237, 238, 239, 240, 241, }; +-static int mt7623_ext_sdio_funcs[] = { 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_ext_sdio_pins[] = { 236, 237, 238, 239, 240, 241, }; ++static const int mt7623_ext_sdio_funcs[] = { 1, 1, 1, 1, 1, 1, }; + + /* HDMI RX */ +-static int mt7623_hdmi_rx_pins[] = { 247, 248, }; +-static int mt7623_hdmi_rx_funcs[] = { 1, 1 }; +-static int mt7623_hdmi_rx_i2c_pins[] = { 244, 245, }; +-static int mt7623_hdmi_rx_i2c_funcs[] = { 1, 1 }; ++static const int mt7623_hdmi_rx_pins[] = { 247, 248, }; ++static const int mt7623_hdmi_rx_funcs[] = { 1, 1 }; ++static const int mt7623_hdmi_rx_i2c_pins[] = { 244, 245, }; ++static const int mt7623_hdmi_rx_i2c_funcs[] = { 1, 1 }; + + /* HDMI TX */ +-static int mt7623_hdmi_cec_pins[] = { 122, }; +-static int mt7623_hdmi_cec_funcs[] = { 1, }; +-static int mt7623_hdmi_htplg_pins[] = { 123, }; +-static int mt7623_hdmi_htplg_funcs[] = { 1, }; +-static int mt7623_hdmi_i2c_pins[] = { 124, 125, }; +-static int mt7623_hdmi_i2c_funcs[] = { 1, 1 }; ++static const int mt7623_hdmi_cec_pins[] = { 122, }; ++static const int mt7623_hdmi_cec_funcs[] = { 1, }; ++static const int mt7623_hdmi_htplg_pins[] = { 123, }; ++static const int mt7623_hdmi_htplg_funcs[] = { 1, }; ++static const int mt7623_hdmi_i2c_pins[] = { 124, 125, }; ++static const int mt7623_hdmi_i2c_funcs[] = { 1, 1 }; + + /* I2C */ +-static int mt7623_i2c0_pins[] = { 75, 76, }; +-static int mt7623_i2c0_funcs[] = { 1, 1, }; +-static int mt7623_i2c1_0_pins[] = { 57, 58, }; +-static int mt7623_i2c1_0_funcs[] = { 1, 1, }; +-static int mt7623_i2c1_1_pins[] = { 242, 243, }; +-static int mt7623_i2c1_1_funcs[] = { 4, 4, }; +-static int mt7623_i2c1_2_pins[] = { 85, 86, }; +-static int mt7623_i2c1_2_funcs[] = { 3, 3, }; +-static int mt7623_i2c1_3_pins[] = { 105, 106, }; +-static int mt7623_i2c1_3_funcs[] = { 3, 3, }; +-static int mt7623_i2c1_4_pins[] = { 124, 125, }; +-static int mt7623_i2c1_4_funcs[] = { 4, 4, }; +-static int mt7623_i2c2_0_pins[] = { 77, 78, }; +-static int mt7623_i2c2_0_funcs[] = { 1, 1, }; +-static int mt7623_i2c2_1_pins[] = { 89, 90, }; +-static int mt7623_i2c2_1_funcs[] = { 3, 3, }; +-static int mt7623_i2c2_2_pins[] = { 109, 110, }; +-static int mt7623_i2c2_2_funcs[] = { 3, 3, }; +-static int mt7623_i2c2_3_pins[] = { 122, 123, }; +-static int mt7623_i2c2_3_funcs[] = { 4, 4, }; ++static const int mt7623_i2c0_pins[] = { 75, 76, }; ++static const int mt7623_i2c0_funcs[] = { 1, 1, }; ++static const int mt7623_i2c1_0_pins[] = { 57, 58, }; ++static const int mt7623_i2c1_0_funcs[] = { 1, 1, }; ++static const int mt7623_i2c1_1_pins[] = { 242, 243, }; ++static const int mt7623_i2c1_1_funcs[] = { 4, 4, }; ++static const int mt7623_i2c1_2_pins[] = { 85, 86, }; ++static const int mt7623_i2c1_2_funcs[] = { 3, 3, }; ++static const int mt7623_i2c1_3_pins[] = { 105, 106, }; ++static const int mt7623_i2c1_3_funcs[] = { 3, 3, }; ++static const int mt7623_i2c1_4_pins[] = { 124, 125, }; ++static const int mt7623_i2c1_4_funcs[] = { 4, 4, }; ++static const int mt7623_i2c2_0_pins[] = { 77, 78, }; ++static const int mt7623_i2c2_0_funcs[] = { 1, 1, }; ++static const int mt7623_i2c2_1_pins[] = { 89, 90, }; ++static const int mt7623_i2c2_1_funcs[] = { 3, 3, }; ++static const int mt7623_i2c2_2_pins[] = { 109, 110, }; ++static const int mt7623_i2c2_2_funcs[] = { 3, 3, }; ++static const int mt7623_i2c2_3_pins[] = { 122, 123, }; ++static const int mt7623_i2c2_3_funcs[] = { 4, 4, }; + + /* I2S */ +-static int mt7623_i2s0_pins[] = { 49, 72, 73, 74, 126, }; +-static int mt7623_i2s0_funcs[] = { 1, 1, 1, 1, 1, }; +-static int mt7623_i2s1_pins[] = { 33, 34, 35, 36, 37, }; +-static int mt7623_i2s1_funcs[] = { 1, 1, 1, 1, 1, }; +-static int mt7623_i2s2_bclk_lrclk_mclk_pins[] = { 50, 52, 188, }; +-static int mt7623_i2s2_bclk_lrclk_mclk_funcs[] = { 1, 1, 1, }; +-static int mt7623_i2s2_data_in_pins[] = { 51, }; +-static int mt7623_i2s2_data_in_funcs[] = { 1, }; +-static int mt7623_i2s2_data_0_pins[] = { 203, }; +-static int mt7623_i2s2_data_0_funcs[] = { 9, }; +-static int mt7623_i2s2_data_1_pins[] = { 38, }; +-static int mt7623_i2s2_data_1_funcs[] = { 4, }; +-static int mt7623_i2s3_bclk_lrclk_mclk_pins[] = { 191, 192, 193, }; +-static int mt7623_i2s3_bclk_lrclk_mclk_funcs[] = { 1, 1, 1, }; +-static int mt7623_i2s3_data_in_pins[] = { 190, }; +-static int mt7623_i2s3_data_in_funcs[] = { 1, }; +-static int mt7623_i2s3_data_0_pins[] = { 204, }; +-static int mt7623_i2s3_data_0_funcs[] = { 9, }; +-static int mt7623_i2s3_data_1_pins[] = { 2, }; +-static int mt7623_i2s3_data_1_funcs[] = { 0, }; +-static int mt7623_i2s4_pins[] = { 194, 195, 196, 197, 198, }; +-static int mt7623_i2s4_funcs[] = { 1, 1, 1, 1, 1, }; +-static int mt7623_i2s5_pins[] = { 16, 17, 30, 31, 32, }; +-static int mt7623_i2s5_funcs[] = { 1, 1, 1, 1, 1, }; ++static const int mt7623_i2s0_pins[] = { 49, 72, 73, 74, 126, }; ++static const int mt7623_i2s0_funcs[] = { 1, 1, 1, 1, 1, }; ++static const int mt7623_i2s1_pins[] = { 33, 34, 35, 36, 37, }; ++static const int mt7623_i2s1_funcs[] = { 1, 1, 1, 1, 1, }; ++static const int mt7623_i2s2_bclk_lrclk_mclk_pins[] = { 50, 52, 188, }; ++static const int mt7623_i2s2_bclk_lrclk_mclk_funcs[] = { 1, 1, 1, }; ++static const int mt7623_i2s2_data_in_pins[] = { 51, }; ++static const int mt7623_i2s2_data_in_funcs[] = { 1, }; ++static const int mt7623_i2s2_data_0_pins[] = { 203, }; ++static const int mt7623_i2s2_data_0_funcs[] = { 9, }; ++static const int mt7623_i2s2_data_1_pins[] = { 38, }; ++static const int mt7623_i2s2_data_1_funcs[] = { 4, }; ++static const int mt7623_i2s3_bclk_lrclk_mclk_pins[] = { 191, 192, 193, }; ++static const int mt7623_i2s3_bclk_lrclk_mclk_funcs[] = { 1, 1, 1, }; ++static const int mt7623_i2s3_data_in_pins[] = { 190, }; ++static const int mt7623_i2s3_data_in_funcs[] = { 1, }; ++static const int mt7623_i2s3_data_0_pins[] = { 204, }; ++static const int mt7623_i2s3_data_0_funcs[] = { 9, }; ++static const int mt7623_i2s3_data_1_pins[] = { 2, }; ++static const int mt7623_i2s3_data_1_funcs[] = { 0, }; ++static const int mt7623_i2s4_pins[] = { 194, 195, 196, 197, 198, }; ++static const int mt7623_i2s4_funcs[] = { 1, 1, 1, 1, 1, }; ++static const int mt7623_i2s5_pins[] = { 16, 17, 30, 31, 32, }; ++static const int mt7623_i2s5_funcs[] = { 1, 1, 1, 1, 1, }; + + /* IR */ +-static int mt7623_ir_pins[] = { 46, }; +-static int mt7623_ir_funcs[] = { 1, }; ++static const int mt7623_ir_pins[] = { 46, }; ++static const int mt7623_ir_funcs[] = { 1, }; + + /* LCD */ +-static int mt7623_mipi_tx_pins[] = { 91, 92, 93, 94, 95, 96, 97, 98, +- 99, 100, }; +-static int mt7623_mipi_tx_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; +-static int mt7623_dsi_te_pins[] = { 84, }; +-static int mt7623_dsi_te_funcs[] = { 1, }; +-static int mt7623_lcm_rst_pins[] = { 83, }; +-static int mt7623_lcm_rst_funcs[] = { 1, }; ++static const int mt7623_mipi_tx_pins[] = { 91, 92, 93, 94, 95, 96, 97, 98, ++ 99, 100, }; ++static const int mt7623_mipi_tx_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_dsi_te_pins[] = { 84, }; ++static const int mt7623_dsi_te_funcs[] = { 1, }; ++static const int mt7623_lcm_rst_pins[] = { 83, }; ++static const int mt7623_lcm_rst_funcs[] = { 1, }; + + /* MDC/MDIO */ +-static int mt7623_mdc_mdio_pins[] = { 275, 276, }; +-static int mt7623_mdc_mdio_funcs[] = { 1, 1, }; ++static const int mt7623_mdc_mdio_pins[] = { 275, 276, }; ++static const int mt7623_mdc_mdio_funcs[] = { 1, 1, }; + + /* MSDC */ +-static int mt7623_msdc0_pins[] = { 111, 112, 113, 114, 115, 116, 117, 118, +- 119, 120, 121, }; +-static int mt7623_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; +-static int mt7623_msdc1_pins[] = { 105, 106, 107, 108, 109, 110, }; +-static int mt7623_msdc1_funcs[] = { 1, 1, 1, 1, 1, 1, }; +-static int mt7623_msdc1_ins_pins[] = { 261, }; +-static int mt7623_msdc1_ins_funcs[] = { 1, }; +-static int mt7623_msdc1_wp_0_pins[] = { 29, }; +-static int mt7623_msdc1_wp_0_funcs[] = { 1, }; +-static int mt7623_msdc1_wp_1_pins[] = { 55, }; +-static int mt7623_msdc1_wp_1_funcs[] = { 3, }; +-static int mt7623_msdc1_wp_2_pins[] = { 209, }; +-static int mt7623_msdc1_wp_2_funcs[] = { 2, }; +-static int mt7623_msdc2_pins[] = { 85, 86, 87, 88, 89, 90, }; +-static int mt7623_msdc2_funcs[] = { 1, 1, 1, 1, 1, 1, }; +-static int mt7623_msdc3_pins[] = { 249, 250, 251, 252, 253, 254, 255, 256, +- 257, 258, 259, 260, }; +-static int mt7623_msdc3_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_msdc0_pins[] = { 111, 112, 113, 114, 115, 116, 117, 118, ++ 119, 120, 121, }; ++static const int mt7623_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_msdc1_pins[] = { 105, 106, 107, 108, 109, 110, }; ++static const int mt7623_msdc1_funcs[] = { 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_msdc1_ins_pins[] = { 261, }; ++static const int mt7623_msdc1_ins_funcs[] = { 1, }; ++static const int mt7623_msdc1_wp_0_pins[] = { 29, }; ++static const int mt7623_msdc1_wp_0_funcs[] = { 1, }; ++static const int mt7623_msdc1_wp_1_pins[] = { 55, }; ++static const int mt7623_msdc1_wp_1_funcs[] = { 3, }; ++static const int mt7623_msdc1_wp_2_pins[] = { 209, }; ++static const int mt7623_msdc1_wp_2_funcs[] = { 2, }; ++static const int mt7623_msdc2_pins[] = { 85, 86, 87, 88, 89, 90, }; ++static const int mt7623_msdc2_funcs[] = { 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_msdc3_pins[] = { 249, 250, 251, 252, 253, 254, 255, 256, ++ 257, 258, 259, 260, }; ++static const int mt7623_msdc3_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + + /* NAND */ +-static int mt7623_nandc_pins[] = { 43, 47, 48, 111, 112, 113, 114, 115, +- 116, 117, 118, 119, 120, 121, }; +-static int mt7623_nandc_funcs[] = { 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, +- 4, 4, }; +-static int mt7623_nandc_ceb0_pins[] = { 45, }; +-static int mt7623_nandc_ceb0_funcs[] = { 1, }; +-static int mt7623_nandc_ceb1_pins[] = { 44, }; +-static int mt7623_nandc_ceb1_funcs[] = { 1, }; ++static const int mt7623_nandc_pins[] = { 43, 47, 48, 111, 112, 113, 114, 115, ++ 116, 117, 118, 119, 120, 121, }; ++static const int mt7623_nandc_funcs[] = { 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, ++ 4, 4, }; ++static const int mt7623_nandc_ceb0_pins[] = { 45, }; ++static const int mt7623_nandc_ceb0_funcs[] = { 1, }; ++static const int mt7623_nandc_ceb1_pins[] = { 44, }; ++static const int mt7623_nandc_ceb1_funcs[] = { 1, }; + + /* RTC */ +-static int mt7623_rtc_pins[] = { 10, }; +-static int mt7623_rtc_funcs[] = { 1, }; ++static const int mt7623_rtc_pins[] = { 10, }; ++static const int mt7623_rtc_funcs[] = { 1, }; + + /* OTG */ +-static int mt7623_otg_iddig0_0_pins[] = { 29, }; +-static int mt7623_otg_iddig0_0_funcs[] = { 1, }; +-static int mt7623_otg_iddig0_1_pins[] = { 44, }; +-static int mt7623_otg_iddig0_1_funcs[] = { 2, }; +-static int mt7623_otg_iddig0_2_pins[] = { 236, }; +-static int mt7623_otg_iddig0_2_funcs[] = { 2, }; +-static int mt7623_otg_iddig1_0_pins[] = { 27, }; +-static int mt7623_otg_iddig1_0_funcs[] = { 2, }; +-static int mt7623_otg_iddig1_1_pins[] = { 47, }; +-static int mt7623_otg_iddig1_1_funcs[] = { 2, }; +-static int mt7623_otg_iddig1_2_pins[] = { 238, }; +-static int mt7623_otg_iddig1_2_funcs[] = { 2, }; +-static int mt7623_otg_drv_vbus0_0_pins[] = { 28, }; +-static int mt7623_otg_drv_vbus0_0_funcs[] = { 1, }; +-static int mt7623_otg_drv_vbus0_1_pins[] = { 45, }; +-static int mt7623_otg_drv_vbus0_1_funcs[] = { 2, }; +-static int mt7623_otg_drv_vbus0_2_pins[] = { 237, }; +-static int mt7623_otg_drv_vbus0_2_funcs[] = { 2, }; +-static int mt7623_otg_drv_vbus1_0_pins[] = { 26, }; +-static int mt7623_otg_drv_vbus1_0_funcs[] = { 2, }; +-static int mt7623_otg_drv_vbus1_1_pins[] = { 48, }; +-static int mt7623_otg_drv_vbus1_1_funcs[] = { 2, }; +-static int mt7623_otg_drv_vbus1_2_pins[] = { 239, }; +-static int mt7623_otg_drv_vbus1_2_funcs[] = { 2, }; ++static const int mt7623_otg_iddig0_0_pins[] = { 29, }; ++static const int mt7623_otg_iddig0_0_funcs[] = { 1, }; ++static const int mt7623_otg_iddig0_1_pins[] = { 44, }; ++static const int mt7623_otg_iddig0_1_funcs[] = { 2, }; ++static const int mt7623_otg_iddig0_2_pins[] = { 236, }; ++static const int mt7623_otg_iddig0_2_funcs[] = { 2, }; ++static const int mt7623_otg_iddig1_0_pins[] = { 27, }; ++static const int mt7623_otg_iddig1_0_funcs[] = { 2, }; ++static const int mt7623_otg_iddig1_1_pins[] = { 47, }; ++static const int mt7623_otg_iddig1_1_funcs[] = { 2, }; ++static const int mt7623_otg_iddig1_2_pins[] = { 238, }; ++static const int mt7623_otg_iddig1_2_funcs[] = { 2, }; ++static const int mt7623_otg_drv_vbus0_0_pins[] = { 28, }; ++static const int mt7623_otg_drv_vbus0_0_funcs[] = { 1, }; ++static const int mt7623_otg_drv_vbus0_1_pins[] = { 45, }; ++static const int mt7623_otg_drv_vbus0_1_funcs[] = { 2, }; ++static const int mt7623_otg_drv_vbus0_2_pins[] = { 237, }; ++static const int mt7623_otg_drv_vbus0_2_funcs[] = { 2, }; ++static const int mt7623_otg_drv_vbus1_0_pins[] = { 26, }; ++static const int mt7623_otg_drv_vbus1_0_funcs[] = { 2, }; ++static const int mt7623_otg_drv_vbus1_1_pins[] = { 48, }; ++static const int mt7623_otg_drv_vbus1_1_funcs[] = { 2, }; ++static const int mt7623_otg_drv_vbus1_2_pins[] = { 239, }; ++static const int mt7623_otg_drv_vbus1_2_funcs[] = { 2, }; + + /* PCIE */ +-static int mt7623_pcie0_0_perst_pins[] = { 208, }; +-static int mt7623_pcie0_0_perst_funcs[] = { 3, }; +-static int mt7623_pcie0_1_perst_pins[] = { 22, }; +-static int mt7623_pcie0_1_perst_funcs[] = { 2, }; +-static int mt7623_pcie1_0_perst_pins[] = { 209, }; +-static int mt7623_pcie1_0_perst_funcs[] = { 3, }; +-static int mt7623_pcie1_1_perst_pins[] = { 23, }; +-static int mt7623_pcie1_1_perst_funcs[] = { 2, }; +-static int mt7623_pcie2_0_perst_pins[] = { 24, }; +-static int mt7623_pcie2_0_perst_funcs[] = { 2, }; +-static int mt7623_pcie2_1_perst_pins[] = { 29, }; +-static int mt7623_pcie2_1_perst_funcs[] = { 6, }; +-static int mt7623_pcie0_0_wake_pins[] = { 28, }; +-static int mt7623_pcie0_0_wake_funcs[] = { 6, }; +-static int mt7623_pcie0_1_wake_pins[] = { 251, }; +-static int mt7623_pcie0_1_wake_funcs[] = { 6, }; +-static int mt7623_pcie1_0_wake_pins[] = { 27, }; +-static int mt7623_pcie1_0_wake_funcs[] = { 6, }; +-static int mt7623_pcie1_1_wake_pins[] = { 253, }; +-static int mt7623_pcie1_1_wake_funcs[] = { 6, }; +-static int mt7623_pcie2_0_wake_pins[] = { 26, }; +-static int mt7623_pcie2_0_wake_funcs[] = { 6, }; +-static int mt7623_pcie2_1_wake_pins[] = { 255, }; +-static int mt7623_pcie2_1_wake_funcs[] = { 6, }; +-static int mt7623_pcie0_clkreq_pins[] = { 250, }; +-static int mt7623_pcie0_clkreq_funcs[] = { 6, }; +-static int mt7623_pcie1_clkreq_pins[] = { 252, }; +-static int mt7623_pcie1_clkreq_funcs[] = { 6, }; +-static int mt7623_pcie2_clkreq_pins[] = { 254, }; +-static int mt7623_pcie2_clkreq_funcs[] = { 6, }; ++static const int mt7623_pcie0_0_perst_pins[] = { 208, }; ++static const int mt7623_pcie0_0_perst_funcs[] = { 3, }; ++static const int mt7623_pcie0_1_perst_pins[] = { 22, }; ++static const int mt7623_pcie0_1_perst_funcs[] = { 2, }; ++static const int mt7623_pcie1_0_perst_pins[] = { 209, }; ++static const int mt7623_pcie1_0_perst_funcs[] = { 3, }; ++static const int mt7623_pcie1_1_perst_pins[] = { 23, }; ++static const int mt7623_pcie1_1_perst_funcs[] = { 2, }; ++static const int mt7623_pcie2_0_perst_pins[] = { 24, }; ++static const int mt7623_pcie2_0_perst_funcs[] = { 2, }; ++static const int mt7623_pcie2_1_perst_pins[] = { 29, }; ++static const int mt7623_pcie2_1_perst_funcs[] = { 6, }; ++static const int mt7623_pcie0_0_wake_pins[] = { 28, }; ++static const int mt7623_pcie0_0_wake_funcs[] = { 6, }; ++static const int mt7623_pcie0_1_wake_pins[] = { 251, }; ++static const int mt7623_pcie0_1_wake_funcs[] = { 6, }; ++static const int mt7623_pcie1_0_wake_pins[] = { 27, }; ++static const int mt7623_pcie1_0_wake_funcs[] = { 6, }; ++static const int mt7623_pcie1_1_wake_pins[] = { 253, }; ++static const int mt7623_pcie1_1_wake_funcs[] = { 6, }; ++static const int mt7623_pcie2_0_wake_pins[] = { 26, }; ++static const int mt7623_pcie2_0_wake_funcs[] = { 6, }; ++static const int mt7623_pcie2_1_wake_pins[] = { 255, }; ++static const int mt7623_pcie2_1_wake_funcs[] = { 6, }; ++static const int mt7623_pcie0_clkreq_pins[] = { 250, }; ++static const int mt7623_pcie0_clkreq_funcs[] = { 6, }; ++static const int mt7623_pcie1_clkreq_pins[] = { 252, }; ++static const int mt7623_pcie1_clkreq_funcs[] = { 6, }; ++static const int mt7623_pcie2_clkreq_pins[] = { 254, }; ++static const int mt7623_pcie2_clkreq_funcs[] = { 6, }; + /* the pcie_*_rev are only used for MT7623 */ +-static int mt7623_pcie0_0_rev_perst_pins[] = { 208, }; +-static int mt7623_pcie0_0_rev_perst_funcs[] = { 11, }; +-static int mt7623_pcie0_1_rev_perst_pins[] = { 22, }; +-static int mt7623_pcie0_1_rev_perst_funcs[] = { 10, }; +-static int mt7623_pcie1_0_rev_perst_pins[] = { 209, }; +-static int mt7623_pcie1_0_rev_perst_funcs[] = { 11, }; +-static int mt7623_pcie1_1_rev_perst_pins[] = { 23, }; +-static int mt7623_pcie1_1_rev_perst_funcs[] = { 10, }; +-static int mt7623_pcie2_0_rev_perst_pins[] = { 24, }; +-static int mt7623_pcie2_0_rev_perst_funcs[] = { 11, }; +-static int mt7623_pcie2_1_rev_perst_pins[] = { 29, }; +-static int mt7623_pcie2_1_rev_perst_funcs[] = { 14, }; ++static const int mt7623_pcie0_0_rev_perst_pins[] = { 208, }; ++static const int mt7623_pcie0_0_rev_perst_funcs[] = { 11, }; ++static const int mt7623_pcie0_1_rev_perst_pins[] = { 22, }; ++static const int mt7623_pcie0_1_rev_perst_funcs[] = { 10, }; ++static const int mt7623_pcie1_0_rev_perst_pins[] = { 209, }; ++static const int mt7623_pcie1_0_rev_perst_funcs[] = { 11, }; ++static const int mt7623_pcie1_1_rev_perst_pins[] = { 23, }; ++static const int mt7623_pcie1_1_rev_perst_funcs[] = { 10, }; ++static const int mt7623_pcie2_0_rev_perst_pins[] = { 24, }; ++static const int mt7623_pcie2_0_rev_perst_funcs[] = { 11, }; ++static const int mt7623_pcie2_1_rev_perst_pins[] = { 29, }; ++static const int mt7623_pcie2_1_rev_perst_funcs[] = { 14, }; + + /* PCM */ +-static int mt7623_pcm_clk_0_pins[] = { 18, }; +-static int mt7623_pcm_clk_0_funcs[] = { 1, }; +-static int mt7623_pcm_clk_1_pins[] = { 17, }; +-static int mt7623_pcm_clk_1_funcs[] = { 3, }; +-static int mt7623_pcm_clk_2_pins[] = { 35, }; +-static int mt7623_pcm_clk_2_funcs[] = { 3, }; +-static int mt7623_pcm_clk_3_pins[] = { 50, }; +-static int mt7623_pcm_clk_3_funcs[] = { 3, }; +-static int mt7623_pcm_clk_4_pins[] = { 74, }; +-static int mt7623_pcm_clk_4_funcs[] = { 3, }; +-static int mt7623_pcm_clk_5_pins[] = { 191, }; +-static int mt7623_pcm_clk_5_funcs[] = { 3, }; +-static int mt7623_pcm_clk_6_pins[] = { 196, }; +-static int mt7623_pcm_clk_6_funcs[] = { 3, }; +-static int mt7623_pcm_sync_0_pins[] = { 19, }; +-static int mt7623_pcm_sync_0_funcs[] = { 1, }; +-static int mt7623_pcm_sync_1_pins[] = { 30, }; +-static int mt7623_pcm_sync_1_funcs[] = { 3, }; +-static int mt7623_pcm_sync_2_pins[] = { 36, }; +-static int mt7623_pcm_sync_2_funcs[] = { 3, }; +-static int mt7623_pcm_sync_3_pins[] = { 52, }; +-static int mt7623_pcm_sync_3_funcs[] = { 31, }; +-static int mt7623_pcm_sync_4_pins[] = { 73, }; +-static int mt7623_pcm_sync_4_funcs[] = { 3, }; +-static int mt7623_pcm_sync_5_pins[] = { 192, }; +-static int mt7623_pcm_sync_5_funcs[] = { 3, }; +-static int mt7623_pcm_sync_6_pins[] = { 197, }; +-static int mt7623_pcm_sync_6_funcs[] = { 3, }; +-static int mt7623_pcm_rx_0_pins[] = { 20, }; +-static int mt7623_pcm_rx_0_funcs[] = { 1, }; +-static int mt7623_pcm_rx_1_pins[] = { 16, }; +-static int mt7623_pcm_rx_1_funcs[] = { 3, }; +-static int mt7623_pcm_rx_2_pins[] = { 34, }; +-static int mt7623_pcm_rx_2_funcs[] = { 3, }; +-static int mt7623_pcm_rx_3_pins[] = { 51, }; +-static int mt7623_pcm_rx_3_funcs[] = { 3, }; +-static int mt7623_pcm_rx_4_pins[] = { 72, }; +-static int mt7623_pcm_rx_4_funcs[] = { 3, }; +-static int mt7623_pcm_rx_5_pins[] = { 190, }; +-static int mt7623_pcm_rx_5_funcs[] = { 3, }; +-static int mt7623_pcm_rx_6_pins[] = { 195, }; +-static int mt7623_pcm_rx_6_funcs[] = { 3, }; +-static int mt7623_pcm_tx_0_pins[] = { 21, }; +-static int mt7623_pcm_tx_0_funcs[] = { 1, }; +-static int mt7623_pcm_tx_1_pins[] = { 32, }; +-static int mt7623_pcm_tx_1_funcs[] = { 3, }; +-static int mt7623_pcm_tx_2_pins[] = { 33, }; +-static int mt7623_pcm_tx_2_funcs[] = { 3, }; +-static int mt7623_pcm_tx_3_pins[] = { 38, }; +-static int mt7623_pcm_tx_3_funcs[] = { 3, }; +-static int mt7623_pcm_tx_4_pins[] = { 49, }; +-static int mt7623_pcm_tx_4_funcs[] = { 3, }; +-static int mt7623_pcm_tx_5_pins[] = { 189, }; +-static int mt7623_pcm_tx_5_funcs[] = { 3, }; +-static int mt7623_pcm_tx_6_pins[] = { 194, }; +-static int mt7623_pcm_tx_6_funcs[] = { 3, }; ++static const int mt7623_pcm_clk_0_pins[] = { 18, }; ++static const int mt7623_pcm_clk_0_funcs[] = { 1, }; ++static const int mt7623_pcm_clk_1_pins[] = { 17, }; ++static const int mt7623_pcm_clk_1_funcs[] = { 3, }; ++static const int mt7623_pcm_clk_2_pins[] = { 35, }; ++static const int mt7623_pcm_clk_2_funcs[] = { 3, }; ++static const int mt7623_pcm_clk_3_pins[] = { 50, }; ++static const int mt7623_pcm_clk_3_funcs[] = { 3, }; ++static const int mt7623_pcm_clk_4_pins[] = { 74, }; ++static const int mt7623_pcm_clk_4_funcs[] = { 3, }; ++static const int mt7623_pcm_clk_5_pins[] = { 191, }; ++static const int mt7623_pcm_clk_5_funcs[] = { 3, }; ++static const int mt7623_pcm_clk_6_pins[] = { 196, }; ++static const int mt7623_pcm_clk_6_funcs[] = { 3, }; ++static const int mt7623_pcm_sync_0_pins[] = { 19, }; ++static const int mt7623_pcm_sync_0_funcs[] = { 1, }; ++static const int mt7623_pcm_sync_1_pins[] = { 30, }; ++static const int mt7623_pcm_sync_1_funcs[] = { 3, }; ++static const int mt7623_pcm_sync_2_pins[] = { 36, }; ++static const int mt7623_pcm_sync_2_funcs[] = { 3, }; ++static const int mt7623_pcm_sync_3_pins[] = { 52, }; ++static const int mt7623_pcm_sync_3_funcs[] = { 31, }; ++static const int mt7623_pcm_sync_4_pins[] = { 73, }; ++static const int mt7623_pcm_sync_4_funcs[] = { 3, }; ++static const int mt7623_pcm_sync_5_pins[] = { 192, }; ++static const int mt7623_pcm_sync_5_funcs[] = { 3, }; ++static const int mt7623_pcm_sync_6_pins[] = { 197, }; ++static const int mt7623_pcm_sync_6_funcs[] = { 3, }; ++static const int mt7623_pcm_rx_0_pins[] = { 20, }; ++static const int mt7623_pcm_rx_0_funcs[] = { 1, }; ++static const int mt7623_pcm_rx_1_pins[] = { 16, }; ++static const int mt7623_pcm_rx_1_funcs[] = { 3, }; ++static const int mt7623_pcm_rx_2_pins[] = { 34, }; ++static const int mt7623_pcm_rx_2_funcs[] = { 3, }; ++static const int mt7623_pcm_rx_3_pins[] = { 51, }; ++static const int mt7623_pcm_rx_3_funcs[] = { 3, }; ++static const int mt7623_pcm_rx_4_pins[] = { 72, }; ++static const int mt7623_pcm_rx_4_funcs[] = { 3, }; ++static const int mt7623_pcm_rx_5_pins[] = { 190, }; ++static const int mt7623_pcm_rx_5_funcs[] = { 3, }; ++static const int mt7623_pcm_rx_6_pins[] = { 195, }; ++static const int mt7623_pcm_rx_6_funcs[] = { 3, }; ++static const int mt7623_pcm_tx_0_pins[] = { 21, }; ++static const int mt7623_pcm_tx_0_funcs[] = { 1, }; ++static const int mt7623_pcm_tx_1_pins[] = { 32, }; ++static const int mt7623_pcm_tx_1_funcs[] = { 3, }; ++static const int mt7623_pcm_tx_2_pins[] = { 33, }; ++static const int mt7623_pcm_tx_2_funcs[] = { 3, }; ++static const int mt7623_pcm_tx_3_pins[] = { 38, }; ++static const int mt7623_pcm_tx_3_funcs[] = { 3, }; ++static const int mt7623_pcm_tx_4_pins[] = { 49, }; ++static const int mt7623_pcm_tx_4_funcs[] = { 3, }; ++static const int mt7623_pcm_tx_5_pins[] = { 189, }; ++static const int mt7623_pcm_tx_5_funcs[] = { 3, }; ++static const int mt7623_pcm_tx_6_pins[] = { 194, }; ++static const int mt7623_pcm_tx_6_funcs[] = { 3, }; + + /* PWM */ +-static int mt7623_pwm_ch1_0_pins[] = { 203, }; +-static int mt7623_pwm_ch1_0_funcs[] = { 1, }; +-static int mt7623_pwm_ch1_1_pins[] = { 208, }; +-static int mt7623_pwm_ch1_1_funcs[] = { 2, }; +-static int mt7623_pwm_ch1_2_pins[] = { 72, }; +-static int mt7623_pwm_ch1_2_funcs[] = { 4, }; +-static int mt7623_pwm_ch1_3_pins[] = { 88, }; +-static int mt7623_pwm_ch1_3_funcs[] = { 3, }; +-static int mt7623_pwm_ch1_4_pins[] = { 108, }; +-static int mt7623_pwm_ch1_4_funcs[] = { 3, }; +-static int mt7623_pwm_ch2_0_pins[] = { 204, }; +-static int mt7623_pwm_ch2_0_funcs[] = { 1, }; +-static int mt7623_pwm_ch2_1_pins[] = { 53, }; +-static int mt7623_pwm_ch2_1_funcs[] = { 5, }; +-static int mt7623_pwm_ch2_2_pins[] = { 88, }; +-static int mt7623_pwm_ch2_2_funcs[] = { 6, }; +-static int mt7623_pwm_ch2_3_pins[] = { 108, }; +-static int mt7623_pwm_ch2_3_funcs[] = { 6, }; +-static int mt7623_pwm_ch2_4_pins[] = { 209, }; +-static int mt7623_pwm_ch2_4_funcs[] = { 5, }; +-static int mt7623_pwm_ch3_0_pins[] = { 205, }; +-static int mt7623_pwm_ch3_0_funcs[] = { 1, }; +-static int mt7623_pwm_ch3_1_pins[] = { 55, }; +-static int mt7623_pwm_ch3_1_funcs[] = { 5, }; +-static int mt7623_pwm_ch3_2_pins[] = { 89, }; +-static int mt7623_pwm_ch3_2_funcs[] = { 6, }; +-static int mt7623_pwm_ch3_3_pins[] = { 109, }; +-static int mt7623_pwm_ch3_3_funcs[] = { 6, }; +-static int mt7623_pwm_ch4_0_pins[] = { 206, }; +-static int mt7623_pwm_ch4_0_funcs[] = { 1, }; +-static int mt7623_pwm_ch4_1_pins[] = { 90, }; +-static int mt7623_pwm_ch4_1_funcs[] = { 6, }; +-static int mt7623_pwm_ch4_2_pins[] = { 110, }; +-static int mt7623_pwm_ch4_2_funcs[] = { 6, }; +-static int mt7623_pwm_ch4_3_pins[] = { 124, }; +-static int mt7623_pwm_ch4_3_funcs[] = { 5, }; +-static int mt7623_pwm_ch5_0_pins[] = { 207, }; +-static int mt7623_pwm_ch5_0_funcs[] = { 1, }; +-static int mt7623_pwm_ch5_1_pins[] = { 125, }; +-static int mt7623_pwm_ch5_1_funcs[] = { 5, }; ++static const int mt7623_pwm_ch1_0_pins[] = { 203, }; ++static const int mt7623_pwm_ch1_0_funcs[] = { 1, }; ++static const int mt7623_pwm_ch1_1_pins[] = { 208, }; ++static const int mt7623_pwm_ch1_1_funcs[] = { 2, }; ++static const int mt7623_pwm_ch1_2_pins[] = { 72, }; ++static const int mt7623_pwm_ch1_2_funcs[] = { 4, }; ++static const int mt7623_pwm_ch1_3_pins[] = { 88, }; ++static const int mt7623_pwm_ch1_3_funcs[] = { 3, }; ++static const int mt7623_pwm_ch1_4_pins[] = { 108, }; ++static const int mt7623_pwm_ch1_4_funcs[] = { 3, }; ++static const int mt7623_pwm_ch2_0_pins[] = { 204, }; ++static const int mt7623_pwm_ch2_0_funcs[] = { 1, }; ++static const int mt7623_pwm_ch2_1_pins[] = { 53, }; ++static const int mt7623_pwm_ch2_1_funcs[] = { 5, }; ++static const int mt7623_pwm_ch2_2_pins[] = { 88, }; ++static const int mt7623_pwm_ch2_2_funcs[] = { 6, }; ++static const int mt7623_pwm_ch2_3_pins[] = { 108, }; ++static const int mt7623_pwm_ch2_3_funcs[] = { 6, }; ++static const int mt7623_pwm_ch2_4_pins[] = { 209, }; ++static const int mt7623_pwm_ch2_4_funcs[] = { 5, }; ++static const int mt7623_pwm_ch3_0_pins[] = { 205, }; ++static const int mt7623_pwm_ch3_0_funcs[] = { 1, }; ++static const int mt7623_pwm_ch3_1_pins[] = { 55, }; ++static const int mt7623_pwm_ch3_1_funcs[] = { 5, }; ++static const int mt7623_pwm_ch3_2_pins[] = { 89, }; ++static const int mt7623_pwm_ch3_2_funcs[] = { 6, }; ++static const int mt7623_pwm_ch3_3_pins[] = { 109, }; ++static const int mt7623_pwm_ch3_3_funcs[] = { 6, }; ++static const int mt7623_pwm_ch4_0_pins[] = { 206, }; ++static const int mt7623_pwm_ch4_0_funcs[] = { 1, }; ++static const int mt7623_pwm_ch4_1_pins[] = { 90, }; ++static const int mt7623_pwm_ch4_1_funcs[] = { 6, }; ++static const int mt7623_pwm_ch4_2_pins[] = { 110, }; ++static const int mt7623_pwm_ch4_2_funcs[] = { 6, }; ++static const int mt7623_pwm_ch4_3_pins[] = { 124, }; ++static const int mt7623_pwm_ch4_3_funcs[] = { 5, }; ++static const int mt7623_pwm_ch5_0_pins[] = { 207, }; ++static const int mt7623_pwm_ch5_0_funcs[] = { 1, }; ++static const int mt7623_pwm_ch5_1_pins[] = { 125, }; ++static const int mt7623_pwm_ch5_1_funcs[] = { 5, }; + + /* PWRAP */ +-static int mt7623_pwrap_pins[] = { 0, 1, 2, 3, 4, 5, 6, }; +-static int mt7623_pwrap_funcs[] = { 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7623_pwrap_pins[] = { 0, 1, 2, 3, 4, 5, 6, }; ++static const int mt7623_pwrap_funcs[] = { 1, 1, 1, 1, 1, 1, 1, }; + + /* SPDIF */ +-static int mt7623_spdif_in0_0_pins[] = { 56, }; +-static int mt7623_spdif_in0_0_funcs[] = { 3, }; +-static int mt7623_spdif_in0_1_pins[] = { 201, }; +-static int mt7623_spdif_in0_1_funcs[] = { 1, }; +-static int mt7623_spdif_in1_0_pins[] = { 54, }; +-static int mt7623_spdif_in1_0_funcs[] = { 3, }; +-static int mt7623_spdif_in1_1_pins[] = { 202, }; +-static int mt7623_spdif_in1_1_funcs[] = { 1, }; +-static int mt7623_spdif_out_pins[] = { 202, }; +-static int mt7623_spdif_out_funcs[] = { 1, }; ++static const int mt7623_spdif_in0_0_pins[] = { 56, }; ++static const int mt7623_spdif_in0_0_funcs[] = { 3, }; ++static const int mt7623_spdif_in0_1_pins[] = { 201, }; ++static const int mt7623_spdif_in0_1_funcs[] = { 1, }; ++static const int mt7623_spdif_in1_0_pins[] = { 54, }; ++static const int mt7623_spdif_in1_0_funcs[] = { 3, }; ++static const int mt7623_spdif_in1_1_pins[] = { 202, }; ++static const int mt7623_spdif_in1_1_funcs[] = { 1, }; ++static const int mt7623_spdif_out_pins[] = { 202, }; ++static const int mt7623_spdif_out_funcs[] = { 1, }; + + /* SPI */ +-static int mt7623_spi0_pins[] = { 53, 54, 55, 56, }; +-static int mt7623_spi0_funcs[] = { 1, 1, 1, 1, }; +-static int mt7623_spi1_pins[] = { 7, 199, 8, 9, }; +-static int mt7623_spi1_funcs[] = { 1, 1, 1, 1, }; +-static int mt7623_spi2_pins[] = { 101, 104, 102, 103, }; +-static int mt7623_spi2_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7623_spi0_pins[] = { 53, 54, 55, 56, }; ++static const int mt7623_spi0_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7623_spi1_pins[] = { 7, 199, 8, 9, }; ++static const int mt7623_spi1_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7623_spi2_pins[] = { 101, 104, 102, 103, }; ++static const int mt7623_spi2_funcs[] = { 1, 1, 1, 1, }; + + /* UART */ +-static int mt7623_uart0_0_txd_rxd_pins[] = { 79, 80, }; +-static int mt7623_uart0_0_txd_rxd_funcs[] = { 1, 1, }; +-static int mt7623_uart0_1_txd_rxd_pins[] = { 87, 88, }; +-static int mt7623_uart0_1_txd_rxd_funcs[] = { 5, 5, }; +-static int mt7623_uart0_2_txd_rxd_pins[] = { 107, 108, }; +-static int mt7623_uart0_2_txd_rxd_funcs[] = { 5, 5, }; +-static int mt7623_uart0_3_txd_rxd_pins[] = { 123, 122, }; +-static int mt7623_uart0_3_txd_rxd_funcs[] = { 5, 5, }; +-static int mt7623_uart0_rts_cts_pins[] = { 22, 23, }; +-static int mt7623_uart0_rts_cts_funcs[] = { 1, 1, }; +-static int mt7623_uart1_0_txd_rxd_pins[] = { 81, 82, }; +-static int mt7623_uart1_0_txd_rxd_funcs[] = { 1, 1, }; +-static int mt7623_uart1_1_txd_rxd_pins[] = { 89, 90, }; +-static int mt7623_uart1_1_txd_rxd_funcs[] = { 5, 5, }; +-static int mt7623_uart1_2_txd_rxd_pins[] = { 109, 110, }; +-static int mt7623_uart1_2_txd_rxd_funcs[] = { 5, 5, }; +-static int mt7623_uart1_rts_cts_pins[] = { 24, 25, }; +-static int mt7623_uart1_rts_cts_funcs[] = { 1, 1, }; +-static int mt7623_uart2_0_txd_rxd_pins[] = { 14, 15, }; +-static int mt7623_uart2_0_txd_rxd_funcs[] = { 1, 1, }; +-static int mt7623_uart2_1_txd_rxd_pins[] = { 200, 201, }; +-static int mt7623_uart2_1_txd_rxd_funcs[] = { 6, 6, }; +-static int mt7623_uart2_rts_cts_pins[] = { 242, 243, }; +-static int mt7623_uart2_rts_cts_funcs[] = { 1, 1, }; +-static int mt7623_uart3_txd_rxd_pins[] = { 242, 243, }; +-static int mt7623_uart3_txd_rxd_funcs[] = { 2, 2, }; +-static int mt7623_uart3_rts_cts_pins[] = { 26, 27, }; +-static int mt7623_uart3_rts_cts_funcs[] = { 1, 1, }; ++static const int mt7623_uart0_0_txd_rxd_pins[] = { 79, 80, }; ++static const int mt7623_uart0_0_txd_rxd_funcs[] = { 1, 1, }; ++static const int mt7623_uart0_1_txd_rxd_pins[] = { 87, 88, }; ++static const int mt7623_uart0_1_txd_rxd_funcs[] = { 5, 5, }; ++static const int mt7623_uart0_2_txd_rxd_pins[] = { 107, 108, }; ++static const int mt7623_uart0_2_txd_rxd_funcs[] = { 5, 5, }; ++static const int mt7623_uart0_3_txd_rxd_pins[] = { 123, 122, }; ++static const int mt7623_uart0_3_txd_rxd_funcs[] = { 5, 5, }; ++static const int mt7623_uart0_rts_cts_pins[] = { 22, 23, }; ++static const int mt7623_uart0_rts_cts_funcs[] = { 1, 1, }; ++static const int mt7623_uart1_0_txd_rxd_pins[] = { 81, 82, }; ++static const int mt7623_uart1_0_txd_rxd_funcs[] = { 1, 1, }; ++static const int mt7623_uart1_1_txd_rxd_pins[] = { 89, 90, }; ++static const int mt7623_uart1_1_txd_rxd_funcs[] = { 5, 5, }; ++static const int mt7623_uart1_2_txd_rxd_pins[] = { 109, 110, }; ++static const int mt7623_uart1_2_txd_rxd_funcs[] = { 5, 5, }; ++static const int mt7623_uart1_rts_cts_pins[] = { 24, 25, }; ++static const int mt7623_uart1_rts_cts_funcs[] = { 1, 1, }; ++static const int mt7623_uart2_0_txd_rxd_pins[] = { 14, 15, }; ++static const int mt7623_uart2_0_txd_rxd_funcs[] = { 1, 1, }; ++static const int mt7623_uart2_1_txd_rxd_pins[] = { 200, 201, }; ++static const int mt7623_uart2_1_txd_rxd_funcs[] = { 6, 6, }; ++static const int mt7623_uart2_rts_cts_pins[] = { 242, 243, }; ++static const int mt7623_uart2_rts_cts_funcs[] = { 1, 1, }; ++static const int mt7623_uart3_txd_rxd_pins[] = { 242, 243, }; ++static const int mt7623_uart3_txd_rxd_funcs[] = { 2, 2, }; ++static const int mt7623_uart3_rts_cts_pins[] = { 26, 27, }; ++static const int mt7623_uart3_rts_cts_funcs[] = { 1, 1, }; + + /* Watchdog */ +-static int mt7623_watchdog_0_pins[] = { 11, }; +-static int mt7623_watchdog_0_funcs[] = { 1, }; +-static int mt7623_watchdog_1_pins[] = { 121, }; +-static int mt7623_watchdog_1_funcs[] = { 5, }; ++static const int mt7623_watchdog_0_pins[] = { 11, }; ++static const int mt7623_watchdog_0_funcs[] = { 1, }; ++static const int mt7623_watchdog_1_pins[] = { 121, }; ++static const int mt7623_watchdog_1_funcs[] = { 5, }; + + static const struct mtk_group_desc mt7623_groups[] = { + PINCTRL_PIN_GROUP("aud_ext_clk0", mt7623_aud_ext_clk0), +@@ -1362,7 +1362,7 @@ static const struct mtk_function_desc mt + {"watchdog", mt7623_wdt_groups, ARRAY_SIZE(mt7623_wdt_groups)}, + }; + +-static struct mtk_pinctrl_soc mt7623_data = { ++static const struct mtk_pinctrl_soc mt7623_data = { + .name = "mt7623_pinctrl", + .reg_cal = mt7623_reg_cals, + .pins = mt7623_pins, +--- a/drivers/pinctrl/mediatek/pinctrl-mt7629.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt7629.c +@@ -180,118 +180,118 @@ static const struct mtk_pin_desc mt7629_ + */ + + /* WF 5G */ +-static int mt7629_wf0_5g_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, }; +-static int mt7629_wf0_5g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7629_wf0_5g_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, }; ++static const int mt7629_wf0_5g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + + /* LED for EPHY */ +-static int mt7629_ephy_leds_pins[] = { 12, 13, 14, 15, 16, 17, 18, }; +-static int mt7629_ephy_leds_funcs[] = { 1, 1, 1, 1, 1, 1, 1, }; +-static int mt7629_ephy_led0_pins[] = { 12, }; +-static int mt7629_ephy_led0_funcs[] = { 1, }; +-static int mt7629_ephy_led1_pins[] = { 13, }; +-static int mt7629_ephy_led1_funcs[] = { 1, }; +-static int mt7629_ephy_led2_pins[] = { 14, }; +-static int mt7629_ephy_led2_funcs[] = { 1, }; +-static int mt7629_ephy_led3_pins[] = { 15, }; +-static int mt7629_ephy_led3_funcs[] = { 1, }; +-static int mt7629_ephy_led4_pins[] = { 16, }; +-static int mt7629_ephy_led4_funcs[] = { 1, }; +-static int mt7629_wf2g_led_pins[] = { 17, }; +-static int mt7629_wf2g_led_funcs[] = { 1, }; +-static int mt7629_wf5g_led_pins[] = { 18, }; +-static int mt7629_wf5g_led_funcs[] = { 1, }; ++static const int mt7629_ephy_leds_pins[] = { 12, 13, 14, 15, 16, 17, 18, }; ++static const int mt7629_ephy_leds_funcs[] = { 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7629_ephy_led0_pins[] = { 12, }; ++static const int mt7629_ephy_led0_funcs[] = { 1, }; ++static const int mt7629_ephy_led1_pins[] = { 13, }; ++static const int mt7629_ephy_led1_funcs[] = { 1, }; ++static const int mt7629_ephy_led2_pins[] = { 14, }; ++static const int mt7629_ephy_led2_funcs[] = { 1, }; ++static const int mt7629_ephy_led3_pins[] = { 15, }; ++static const int mt7629_ephy_led3_funcs[] = { 1, }; ++static const int mt7629_ephy_led4_pins[] = { 16, }; ++static const int mt7629_ephy_led4_funcs[] = { 1, }; ++static const int mt7629_wf2g_led_pins[] = { 17, }; ++static const int mt7629_wf2g_led_funcs[] = { 1, }; ++static const int mt7629_wf5g_led_pins[] = { 18, }; ++static const int mt7629_wf5g_led_funcs[] = { 1, }; + + /* LED for EPHY used as JTAG */ +-static int mt7629_ephy_leds_jtag_pins[] = { 12, 13, 14, 15, 16, }; +-static int mt7629_ephy_leds_jtag_funcs[] = { 7, 7, 7, 7, 7, }; ++static const int mt7629_ephy_leds_jtag_pins[] = { 12, 13, 14, 15, 16, }; ++static const int mt7629_ephy_leds_jtag_funcs[] = { 7, 7, 7, 7, 7, }; + + /* Watchdog */ +-static int mt7629_watchdog_pins[] = { 11, }; +-static int mt7629_watchdog_funcs[] = { 1, }; ++static const int mt7629_watchdog_pins[] = { 11, }; ++static const int mt7629_watchdog_funcs[] = { 1, }; + + /* LED for GPHY */ +-static int mt7629_gphy_leds_0_pins[] = { 21, 22, 23, }; +-static int mt7629_gphy_leds_0_funcs[] = { 2, 2, 2, }; +-static int mt7629_gphy_led1_0_pins[] = { 21, }; +-static int mt7629_gphy_led1_0_funcs[] = { 2, }; +-static int mt7629_gphy_led2_0_pins[] = { 22, }; +-static int mt7629_gphy_led2_0_funcs[] = { 2, }; +-static int mt7629_gphy_led3_0_pins[] = { 23, }; +-static int mt7629_gphy_led3_0_funcs[] = { 2, }; +-static int mt7629_gphy_leds_1_pins[] = { 57, 58, 59, }; +-static int mt7629_gphy_leds_1_funcs[] = { 1, 1, 1, }; +-static int mt7629_gphy_led1_1_pins[] = { 57, }; +-static int mt7629_gphy_led1_1_funcs[] = { 1, }; +-static int mt7629_gphy_led2_1_pins[] = { 58, }; +-static int mt7629_gphy_led2_1_funcs[] = { 1, }; +-static int mt7629_gphy_led3_1_pins[] = { 59, }; +-static int mt7629_gphy_led3_1_funcs[] = { 1, }; ++static const int mt7629_gphy_leds_0_pins[] = { 21, 22, 23, }; ++static const int mt7629_gphy_leds_0_funcs[] = { 2, 2, 2, }; ++static const int mt7629_gphy_led1_0_pins[] = { 21, }; ++static const int mt7629_gphy_led1_0_funcs[] = { 2, }; ++static const int mt7629_gphy_led2_0_pins[] = { 22, }; ++static const int mt7629_gphy_led2_0_funcs[] = { 2, }; ++static const int mt7629_gphy_led3_0_pins[] = { 23, }; ++static const int mt7629_gphy_led3_0_funcs[] = { 2, }; ++static const int mt7629_gphy_leds_1_pins[] = { 57, 58, 59, }; ++static const int mt7629_gphy_leds_1_funcs[] = { 1, 1, 1, }; ++static const int mt7629_gphy_led1_1_pins[] = { 57, }; ++static const int mt7629_gphy_led1_1_funcs[] = { 1, }; ++static const int mt7629_gphy_led2_1_pins[] = { 58, }; ++static const int mt7629_gphy_led2_1_funcs[] = { 1, }; ++static const int mt7629_gphy_led3_1_pins[] = { 59, }; ++static const int mt7629_gphy_led3_1_funcs[] = { 1, }; + + /* I2C */ +-static int mt7629_i2c_0_pins[] = { 19, 20, }; +-static int mt7629_i2c_0_funcs[] = { 1, 1, }; +-static int mt7629_i2c_1_pins[] = { 53, 54, }; +-static int mt7629_i2c_1_funcs[] = { 1, 1, }; ++static const int mt7629_i2c_0_pins[] = { 19, 20, }; ++static const int mt7629_i2c_0_funcs[] = { 1, 1, }; ++static const int mt7629_i2c_1_pins[] = { 53, 54, }; ++static const int mt7629_i2c_1_funcs[] = { 1, 1, }; + + /* SPI */ +-static int mt7629_spi_0_pins[] = { 21, 22, 23, 24, }; +-static int mt7629_spi_0_funcs[] = { 1, 1, 1, 1, }; +-static int mt7629_spi_1_pins[] = { 62, 63, 64, 65, }; +-static int mt7629_spi_1_funcs[] = { 1, 1, 1, 1, }; +-static int mt7629_spi_wp_pins[] = { 66, }; +-static int mt7629_spi_wp_funcs[] = { 1, }; +-static int mt7629_spi_hold_pins[] = { 67, }; +-static int mt7629_spi_hold_funcs[] = { 1, }; ++static const int mt7629_spi_0_pins[] = { 21, 22, 23, 24, }; ++static const int mt7629_spi_0_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7629_spi_1_pins[] = { 62, 63, 64, 65, }; ++static const int mt7629_spi_1_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7629_spi_wp_pins[] = { 66, }; ++static const int mt7629_spi_wp_funcs[] = { 1, }; ++static const int mt7629_spi_hold_pins[] = { 67, }; ++static const int mt7629_spi_hold_funcs[] = { 1, }; + + /* UART */ +-static int mt7629_uart1_0_txd_rxd_pins[] = { 25, 26, }; +-static int mt7629_uart1_0_txd_rxd_funcs[] = { 1, 1, }; +-static int mt7629_uart1_1_txd_rxd_pins[] = { 53, 54, }; +-static int mt7629_uart1_1_txd_rxd_funcs[] = { 2, 2, }; +-static int mt7629_uart2_0_txd_rxd_pins[] = { 29, 30, }; +-static int mt7629_uart2_0_txd_rxd_funcs[] = { 1, 1, }; +-static int mt7629_uart2_1_txd_rxd_pins[] = { 57, 58, }; +-static int mt7629_uart2_1_txd_rxd_funcs[] = { 2, 2, }; +-static int mt7629_uart1_0_cts_rts_pins[] = { 27, 28, }; +-static int mt7629_uart1_0_cts_rts_funcs[] = { 1, 1, }; +-static int mt7629_uart1_1_cts_rts_pins[] = { 55, 56, }; +-static int mt7629_uart1_1_cts_rts_funcs[] = { 2, 2, }; +-static int mt7629_uart2_0_cts_rts_pins[] = { 31, 32, }; +-static int mt7629_uart2_0_cts_rts_funcs[] = { 1, 1, }; +-static int mt7629_uart2_1_cts_rts_pins[] = { 59, 60, }; +-static int mt7629_uart2_1_cts_rts_funcs[] = { 2, 2, }; +-static int mt7629_uart0_txd_rxd_pins[] = { 68, 69, }; +-static int mt7629_uart0_txd_rxd_funcs[] = { 1, 1, }; ++static const int mt7629_uart1_0_txd_rxd_pins[] = { 25, 26, }; ++static const int mt7629_uart1_0_txd_rxd_funcs[] = { 1, 1, }; ++static const int mt7629_uart1_1_txd_rxd_pins[] = { 53, 54, }; ++static const int mt7629_uart1_1_txd_rxd_funcs[] = { 2, 2, }; ++static const int mt7629_uart2_0_txd_rxd_pins[] = { 29, 30, }; ++static const int mt7629_uart2_0_txd_rxd_funcs[] = { 1, 1, }; ++static const int mt7629_uart2_1_txd_rxd_pins[] = { 57, 58, }; ++static const int mt7629_uart2_1_txd_rxd_funcs[] = { 2, 2, }; ++static const int mt7629_uart1_0_cts_rts_pins[] = { 27, 28, }; ++static const int mt7629_uart1_0_cts_rts_funcs[] = { 1, 1, }; ++static const int mt7629_uart1_1_cts_rts_pins[] = { 55, 56, }; ++static const int mt7629_uart1_1_cts_rts_funcs[] = { 2, 2, }; ++static const int mt7629_uart2_0_cts_rts_pins[] = { 31, 32, }; ++static const int mt7629_uart2_0_cts_rts_funcs[] = { 1, 1, }; ++static const int mt7629_uart2_1_cts_rts_pins[] = { 59, 60, }; ++static const int mt7629_uart2_1_cts_rts_funcs[] = { 2, 2, }; ++static const int mt7629_uart0_txd_rxd_pins[] = { 68, 69, }; ++static const int mt7629_uart0_txd_rxd_funcs[] = { 1, 1, }; + + /* MDC/MDIO */ +-static int mt7629_mdc_mdio_pins[] = { 49, 50, }; +-static int mt7629_mdc_mdio_funcs[] = { 1, 1, }; ++static const int mt7629_mdc_mdio_pins[] = { 49, 50, }; ++static const int mt7629_mdc_mdio_funcs[] = { 1, 1, }; + + /* PCIE */ +-static int mt7629_pcie_pereset_pins[] = { 51, }; +-static int mt7629_pcie_pereset_funcs[] = { 1, }; +-static int mt7629_pcie_wake_pins[] = { 55, }; +-static int mt7629_pcie_wake_funcs[] = { 1, }; +-static int mt7629_pcie_clkreq_pins[] = { 56, }; +-static int mt7629_pcie_clkreq_funcs[] = { 1, }; ++static const int mt7629_pcie_pereset_pins[] = { 51, }; ++static const int mt7629_pcie_pereset_funcs[] = { 1, }; ++static const int mt7629_pcie_wake_pins[] = { 55, }; ++static const int mt7629_pcie_wake_funcs[] = { 1, }; ++static const int mt7629_pcie_clkreq_pins[] = { 56, }; ++static const int mt7629_pcie_clkreq_funcs[] = { 1, }; + + /* PWM */ +-static int mt7629_pwm_0_pins[] = { 52, }; +-static int mt7629_pwm_0_funcs[] = { 1, }; +-static int mt7629_pwm_1_pins[] = { 61, }; +-static int mt7629_pwm_1_funcs[] = { 2, }; ++static const int mt7629_pwm_0_pins[] = { 52, }; ++static const int mt7629_pwm_0_funcs[] = { 1, }; ++static const int mt7629_pwm_1_pins[] = { 61, }; ++static const int mt7629_pwm_1_funcs[] = { 2, }; + + /* WF 2G */ +-static int mt7629_wf0_2g_pins[] = { 70, 71, 72, 73, 74, 75, 76, 77, 78, }; +-static int mt7629_wf0_2g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7629_wf0_2g_pins[] = { 70, 71, 72, 73, 74, 75, 76, 77, 78, }; ++static const int mt7629_wf0_2g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, }; + + /* SNFI */ +-static int mt7629_snfi_pins[] = { 62, 63, 64, 65, 66, 67 }; +-static int mt7629_snfi_funcs[] = { 2, 2, 2, 2, 2, 2 }; ++static const int mt7629_snfi_pins[] = { 62, 63, 64, 65, 66, 67 }; ++static const int mt7629_snfi_funcs[] = { 2, 2, 2, 2, 2, 2 }; + + /* SPI NOR */ +-static int mt7629_snor_pins[] = { 62, 63, 64, 65, 66, 67 }; +-static int mt7629_snor_funcs[] = { 1, 1, 1, 1, 1, 1 }; ++static const int mt7629_snor_pins[] = { 62, 63, 64, 65, 66, 67 }; ++static const int mt7629_snor_funcs[] = { 1, 1, 1, 1, 1, 1 }; + + static const struct mtk_group_desc mt7629_groups[] = { + PINCTRL_PIN_GROUP("wf0_5g", mt7629_wf0_5g), +@@ -385,7 +385,7 @@ static const struct mtk_function_desc mt + {"jtag", mt7629_jtag_groups, ARRAY_SIZE(mt7629_jtag_groups)}, + }; + +-static struct mtk_pinctrl_soc mt7629_data = { ++static const struct mtk_pinctrl_soc mt7629_data = { + .name = "mt7629_pinctrl", + .reg_cal = mt7629_reg_cals, + .pins = mt7629_pins, +--- a/drivers/pinctrl/mediatek/pinctrl-mt7981.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt7981.c +@@ -570,242 +570,246 @@ static const struct mtk_pin_desc mt7981_ + }; + + /* WA_AICE */ +-static int mt7981_wa_aice1_pins[] = { 0, 1, }; +-static int mt7981_wa_aice1_funcs[] = { 2, 2, }; ++static const int mt7981_wa_aice1_pins[] = { 0, 1, }; ++static const int mt7981_wa_aice1_funcs[] = { 2, 2, }; + +-static int mt7981_wa_aice2_pins[] = { 0, 1, }; +-static int mt7981_wa_aice2_funcs[] = { 3, 3, }; ++static const int mt7981_wa_aice2_pins[] = { 0, 1, }; ++static const int mt7981_wa_aice2_funcs[] = { 3, 3, }; + +-static int mt7981_wa_aice3_pins[] = { 28, 29, }; +-static int mt7981_wa_aice3_funcs[] = { 3, 3, }; ++static const int mt7981_wa_aice3_pins[] = { 28, 29, }; ++static const int mt7981_wa_aice3_funcs[] = { 3, 3, }; + +-static int mt7981_wm_aice1_pins[] = { 9, 10, }; +-static int mt7981_wm_aice1_funcs[] = { 2, 2, }; ++static const int mt7981_wm_aice1_pins[] = { 9, 10, }; ++static const int mt7981_wm_aice1_funcs[] = { 2, 2, }; + +-static int mt7981_wm_aice2_pins[] = { 30, 31, }; +-static int mt7981_wm_aice2_funcs[] = { 5, 5, }; ++static const int mt7981_wm_aice2_pins[] = { 30, 31, }; ++static const int mt7981_wm_aice2_funcs[] = { 5, 5, }; + + /* WM_UART */ +-static int mt7981_wm_uart_0_pins[] = { 0, 1, }; +-static int mt7981_wm_uart_0_funcs[] = { 5, 5, }; ++static const int mt7981_wm_uart_0_pins[] = { 0, 1, }; ++static const int mt7981_wm_uart_0_funcs[] = { 5, 5, }; + +-static int mt7981_wm_uart_1_pins[] = { 20, 21, }; +-static int mt7981_wm_uart_1_funcs[] = { 4, 4, }; ++static const int mt7981_wm_uart_1_pins[] = { 20, 21, }; ++static const int mt7981_wm_uart_1_funcs[] = { 4, 4, }; + +-static int mt7981_wm_uart_2_pins[] = { 30, 31, }; +-static int mt7981_wm_uart_2_funcs[] = { 3, 3, }; ++static const int mt7981_wm_uart_2_pins[] = { 30, 31, }; ++static const int mt7981_wm_uart_2_funcs[] = { 3, 3, }; + + /* DFD */ +-static int mt7981_dfd_pins[] = { 0, 1, 4, 5, }; +-static int mt7981_dfd_funcs[] = { 5, 5, 6, 6, }; ++static const int mt7981_dfd_pins[] = { 0, 1, 4, 5, }; ++static const int mt7981_dfd_funcs[] = { 5, 5, 6, 6, }; + + /* SYS_WATCHDOG */ +-static int mt7981_watchdog_pins[] = { 2, }; +-static int mt7981_watchdog_funcs[] = { 1, }; ++static const int mt7981_watchdog_pins[] = { 2, }; ++static const int mt7981_watchdog_funcs[] = { 1, }; + +-static int mt7981_watchdog1_pins[] = { 13, }; +-static int mt7981_watchdog1_funcs[] = { 5, }; ++static const int mt7981_watchdog1_pins[] = { 13, }; ++static const int mt7981_watchdog1_funcs[] = { 5, }; + + /* PCIE_PERESET_N */ +-static int mt7981_pcie_pereset_pins[] = { 3, }; +-static int mt7981_pcie_pereset_funcs[] = { 1, }; ++static const int mt7981_pcie_pereset_pins[] = { 3, }; ++static const int mt7981_pcie_pereset_funcs[] = { 1, }; + + /* JTAG */ +-static int mt7981_jtag_pins[] = { 4, 5, 6, 7, 8, }; +-static int mt7981_jtag_funcs[] = { 1, 1, 1, 1, 1, }; ++static const int mt7981_jtag_pins[] = { 4, 5, 6, 7, 8, }; ++static const int mt7981_jtag_funcs[] = { 1, 1, 1, 1, 1, }; + + /* WM_JTAG */ +-static int mt7981_wm_jtag_0_pins[] = { 4, 5, 6, 7, 8, }; +-static int mt7981_wm_jtag_0_funcs[] = { 2, 2, 2, 2, 2, }; ++static const int mt7981_wm_jtag_0_pins[] = { 4, 5, 6, 7, 8, }; ++static const int mt7981_wm_jtag_0_funcs[] = { 2, 2, 2, 2, 2, }; + +-static int mt7981_wm_jtag_1_pins[] = { 20, 21, 22, 23, 24, }; +-static int mt7981_wm_jtag_1_funcs[] = { 5, 5, 5, 5, 5, }; ++static const int mt7981_wm_jtag_1_pins[] = { 20, 21, 22, 23, 24, }; ++static const int mt7981_wm_jtag_1_funcs[] = { 5, 5, 5, 5, 5, }; + + /* WO0_JTAG */ +-static int mt7981_wo0_jtag_0_pins[] = { 9, 10, 11, 12, 13, }; +-static int mt7981_wo0_jtag_0_funcs[] = { 1, 1, 1, 1, 1, }; ++static const int mt7981_wo0_jtag_0_pins[] = { 9, 10, 11, 12, 13, }; ++static const int mt7981_wo0_jtag_0_funcs[] = { 1, 1, 1, 1, 1, }; + +-static int mt7981_wo0_jtag_1_pins[] = { 25, 26, 27, 28, 29, }; +-static int mt7981_wo0_jtag_1_funcs[] = { 5, 5, 5, 5, 5, }; ++static const int mt7981_wo0_jtag_1_pins[] = { 25, 26, 27, 28, 29, }; ++static const int mt7981_wo0_jtag_1_funcs[] = { 5, 5, 5, 5, 5, }; + + /* UART2 */ +-static int mt7981_uart2_0_pins[] = { 4, 5, 6, 7, }; +-static int mt7981_uart2_0_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7981_uart2_0_pins[] = { 4, 5, 6, 7, }; ++static const int mt7981_uart2_0_funcs[] = { 3, 3, 3, 3, }; + + /* GBE_LED0 */ +-static int mt7981_gbe_led0_pins[] = { 8, }; +-static int mt7981_gbe_led0_funcs[] = { 3, }; ++static const int mt7981_gbe_led0_pins[] = { 8, }; ++static const int mt7981_gbe_led0_funcs[] = { 3, }; + + /* PTA_EXT */ +-static int mt7981_pta_ext_0_pins[] = { 4, 5, 6, }; +-static int mt7981_pta_ext_0_funcs[] = { 4, 4, 4, }; ++static const int mt7981_pta_ext_0_pins[] = { 4, 5, 6, }; ++static const int mt7981_pta_ext_0_funcs[] = { 4, 4, 4, }; + +-static int mt7981_pta_ext_1_pins[] = { 22, 23, 24, }; +-static int mt7981_pta_ext_1_funcs[] = { 4, 4, 4, }; ++static const int mt7981_pta_ext_1_pins[] = { 22, 23, 24, }; ++static const int mt7981_pta_ext_1_funcs[] = { 4, 4, 4, }; + + /* PWM2 */ +-static int mt7981_pwm2_pins[] = { 7, }; +-static int mt7981_pwm2_funcs[] = { 4, }; ++static const int mt7981_pwm2_pins[] = { 7, }; ++static const int mt7981_pwm2_funcs[] = { 4, }; + + /* NET_WO0_UART_TXD */ +-static int mt7981_net_wo0_uart_txd_0_pins[] = { 8, }; +-static int mt7981_net_wo0_uart_txd_0_funcs[] = { 4, }; ++static const int mt7981_net_wo0_uart_txd_0_pins[] = { 8, }; ++static const int mt7981_net_wo0_uart_txd_0_funcs[] = { 4, }; + +-static int mt7981_net_wo0_uart_txd_1_pins[] = { 14, }; +-static int mt7981_net_wo0_uart_txd_1_funcs[] = { 3, }; ++static const int mt7981_net_wo0_uart_txd_1_pins[] = { 14, }; ++static const int mt7981_net_wo0_uart_txd_1_funcs[] = { 3, }; + +-static int mt7981_net_wo0_uart_txd_2_pins[] = { 15, }; +-static int mt7981_net_wo0_uart_txd_2_funcs[] = { 4, }; ++static const int mt7981_net_wo0_uart_txd_2_pins[] = { 15, }; ++static const int mt7981_net_wo0_uart_txd_2_funcs[] = { 4, }; + + /* SPI1 */ +-static int mt7981_spi1_0_pins[] = { 4, 5, 6, 7, }; +-static int mt7981_spi1_0_funcs[] = { 5, 5, 5, 5, }; ++static const int mt7981_spi1_0_pins[] = { 4, 5, 6, 7, }; ++static const int mt7981_spi1_0_funcs[] = { 5, 5, 5, 5, }; + + /* I2C */ +-static int mt7981_i2c0_0_pins[] = { 6, 7, }; +-static int mt7981_i2c0_0_funcs[] = { 6, 6, }; ++static const int mt7981_i2c0_0_pins[] = { 6, 7, }; ++static const int mt7981_i2c0_0_funcs[] = { 6, 6, }; + +-static int mt7981_i2c0_1_pins[] = { 30, 31, }; +-static int mt7981_i2c0_1_funcs[] = { 4, 4, }; ++static const int mt7981_i2c0_1_pins[] = { 30, 31, }; ++static const int mt7981_i2c0_1_funcs[] = { 4, 4, }; + +-static int mt7981_i2c0_2_pins[] = { 36, 37, }; +-static int mt7981_i2c0_2_funcs[] = { 2, 2, }; ++static const int mt7981_i2c0_2_pins[] = { 36, 37, }; ++static const int mt7981_i2c0_2_funcs[] = { 2, 2, }; + +-static int mt7981_u2_phy_i2c_pins[] = { 30, 31, }; +-static int mt7981_u2_phy_i2c_funcs[] = { 6, 6, }; ++static const int mt7981_u2_phy_i2c_pins[] = { 30, 31, }; ++static const int mt7981_u2_phy_i2c_funcs[] = { 6, 6, }; + +-static int mt7981_u3_phy_i2c_pins[] = { 32, 33, }; +-static int mt7981_u3_phy_i2c_funcs[] = { 3, 3, }; ++static const int mt7981_u3_phy_i2c_pins[] = { 32, 33, }; ++static const int mt7981_u3_phy_i2c_funcs[] = { 3, 3, }; + +-static int mt7981_sgmii1_phy_i2c_pins[] = { 32, 33, }; +-static int mt7981_sgmii1_phy_i2c_funcs[] = { 2, 2, }; ++static const int mt7981_sgmii1_phy_i2c_pins[] = { 32, 33, }; ++static const int mt7981_sgmii1_phy_i2c_funcs[] = { 2, 2, }; + +-static int mt7981_sgmii0_phy_i2c_pins[] = { 32, 33, }; +-static int mt7981_sgmii0_phy_i2c_funcs[] = { 5, 5, }; ++static const int mt7981_sgmii0_phy_i2c_pins[] = { 32, 33, }; ++static const int mt7981_sgmii0_phy_i2c_funcs[] = { 5, 5, }; + + /* DFD_NTRST */ +-static int mt7981_dfd_ntrst_pins[] = { 8, }; +-static int mt7981_dfd_ntrst_funcs[] = { 6, }; ++static const int mt7981_dfd_ntrst_pins[] = { 8, }; ++static const int mt7981_dfd_ntrst_funcs[] = { 6, }; + + /* PWM0 */ +-static int mt7981_pwm0_0_pins[] = { 13, }; +-static int mt7981_pwm0_0_funcs[] = { 2, }; ++static const int mt7981_pwm0_0_pins[] = { 13, }; ++static const int mt7981_pwm0_0_funcs[] = { 2, }; + +-static int mt7981_pwm0_1_pins[] = { 15, }; +-static int mt7981_pwm0_1_funcs[] = { 1, }; ++static const int mt7981_pwm0_1_pins[] = { 15, }; ++static const int mt7981_pwm0_1_funcs[] = { 1, }; + + /* PWM1 */ +-static int mt7981_pwm1_0_pins[] = { 14, }; +-static int mt7981_pwm1_0_funcs[] = { 2, }; ++static const int mt7981_pwm1_0_pins[] = { 14, }; ++static const int mt7981_pwm1_0_funcs[] = { 2, }; + +-static int mt7981_pwm1_1_pins[] = { 15, }; +-static int mt7981_pwm1_1_funcs[] = { 3, }; ++static const int mt7981_pwm1_1_pins[] = { 15, }; ++static const int mt7981_pwm1_1_funcs[] = { 3, }; + + /* GBE_LED1 */ +-static int mt7981_gbe_led1_pins[] = { 13, }; +-static int mt7981_gbe_led1_funcs[] = { 3, }; ++static const int mt7981_gbe_led1_pins[] = { 13, }; ++static const int mt7981_gbe_led1_funcs[] = { 3, }; + + /* PCM */ +-static int mt7981_pcm_pins[] = { 9, 10, 11, 12, 13, 25 }; +-static int mt7981_pcm_funcs[] = { 4, 4, 4, 4, 4, 4, }; ++static const int mt7981_pcm_pins[] = { 9, 10, 11, 12, 13, 25 }; ++static const int mt7981_pcm_funcs[] = { 4, 4, 4, 4, 4, 4, }; + + /* UDI */ +-static int mt7981_udi_pins[] = { 9, 10, 11, 12, 13, }; +-static int mt7981_udi_funcs[] = { 6, 6, 6, 6, 6, }; ++static const int mt7981_udi_pins[] = { 9, 10, 11, 12, 13, }; ++static const int mt7981_udi_funcs[] = { 6, 6, 6, 6, 6, }; + + /* DRV_VBUS */ +-static int mt7981_drv_vbus_pins[] = { 14, }; +-static int mt7981_drv_vbus_funcs[] = { 1, }; ++static const int mt7981_drv_vbus_pins[] = { 14, }; ++static const int mt7981_drv_vbus_funcs[] = { 1, }; + + /* EMMC */ +-static int mt7981_emmc_45_pins[] = { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, }; +-static int mt7981_emmc_45_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; ++static const int mt7981_emmc_45_pins[] = { ++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, }; ++static const int mt7981_emmc_45_funcs[] = { ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; + + /* SNFI */ +-static int mt7981_snfi_pins[] = { 16, 17, 18, 19, 20, 21, }; +-static int mt7981_snfi_funcs[] = { 3, 3, 3, 3, 3, 3, }; ++static const int mt7981_snfi_pins[] = { 16, 17, 18, 19, 20, 21, }; ++static const int mt7981_snfi_funcs[] = { 3, 3, 3, 3, 3, 3, }; + + /* SPI0 */ +-static int mt7981_spi0_pins[] = { 16, 17, 18, 19, }; +-static int mt7981_spi0_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7981_spi0_pins[] = { 16, 17, 18, 19, }; ++static const int mt7981_spi0_funcs[] = { 1, 1, 1, 1, }; + + /* SPI0 */ +-static int mt7981_spi0_wp_hold_pins[] = { 20, 21, }; +-static int mt7981_spi0_wp_hold_funcs[] = { 1, 1, }; ++static const int mt7981_spi0_wp_hold_pins[] = { 20, 21, }; ++static const int mt7981_spi0_wp_hold_funcs[] = { 1, 1, }; + + /* SPI1 */ +-static int mt7981_spi1_1_pins[] = { 22, 23, 24, 25, }; +-static int mt7981_spi1_1_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7981_spi1_1_pins[] = { 22, 23, 24, 25, }; ++static const int mt7981_spi1_1_funcs[] = { 1, 1, 1, 1, }; + + /* SPI2 */ +-static int mt7981_spi2_pins[] = { 26, 27, 28, 29, }; +-static int mt7981_spi2_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7981_spi2_pins[] = { 26, 27, 28, 29, }; ++static const int mt7981_spi2_funcs[] = { 1, 1, 1, 1, }; + + /* SPI2 */ +-static int mt7981_spi2_wp_hold_pins[] = { 30, 31, }; +-static int mt7981_spi2_wp_hold_funcs[] = { 1, 1, }; ++static const int mt7981_spi2_wp_hold_pins[] = { 30, 31, }; ++static const int mt7981_spi2_wp_hold_funcs[] = { 1, 1, }; + + /* UART1 */ +-static int mt7981_uart1_0_pins[] = { 16, 17, 18, 19, }; +-static int mt7981_uart1_0_funcs[] = { 4, 4, 4, 4, }; ++static const int mt7981_uart1_0_pins[] = { 16, 17, 18, 19, }; ++static const int mt7981_uart1_0_funcs[] = { 4, 4, 4, 4, }; + +-static int mt7981_uart1_1_pins[] = { 26, 27, 28, 29, }; +-static int mt7981_uart1_1_funcs[] = { 2, 2, 2, 2, }; ++static const int mt7981_uart1_1_pins[] = { 26, 27, 28, 29, }; ++static const int mt7981_uart1_1_funcs[] = { 2, 2, 2, 2, }; + + /* UART2 */ +-static int mt7981_uart2_1_pins[] = { 22, 23, 24, 25, }; +-static int mt7981_uart2_1_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7981_uart2_1_pins[] = { 22, 23, 24, 25, }; ++static const int mt7981_uart2_1_funcs[] = { 3, 3, 3, 3, }; + + /* UART0 */ +-static int mt7981_uart0_pins[] = { 32, 33, }; +-static int mt7981_uart0_funcs[] = { 1, 1, }; ++static const int mt7981_uart0_pins[] = { 32, 33, }; ++static const int mt7981_uart0_funcs[] = { 1, 1, }; + + /* PCIE_CLK_REQ */ +-static int mt7981_pcie_clk_pins[] = { 34, }; +-static int mt7981_pcie_clk_funcs[] = { 2, }; ++static const int mt7981_pcie_clk_pins[] = { 34, }; ++static const int mt7981_pcie_clk_funcs[] = { 2, }; + + /* PCIE_WAKE_N */ +-static int mt7981_pcie_wake_pins[] = { 35, }; +-static int mt7981_pcie_wake_funcs[] = { 2, }; ++static const int mt7981_pcie_wake_pins[] = { 35, }; ++static const int mt7981_pcie_wake_funcs[] = { 2, }; + + /* MDC_MDIO */ +-static int mt7981_smi_mdc_mdio_pins[] = { 36, 37, }; +-static int mt7981_smi_mdc_mdio_funcs[] = { 1, 1, }; ++static const int mt7981_smi_mdc_mdio_pins[] = { 36, 37, }; ++static const int mt7981_smi_mdc_mdio_funcs[] = { 1, 1, }; + +-static int mt7981_gbe_ext_mdc_mdio_pins[] = { 36, 37, }; +-static int mt7981_gbe_ext_mdc_mdio_funcs[] = { 3, 3, }; ++static const int mt7981_gbe_ext_mdc_mdio_pins[] = { 36, 37, }; ++static const int mt7981_gbe_ext_mdc_mdio_funcs[] = { 3, 3, }; + + /* WF0_MODE1 */ +-static int mt7981_wf0_mode1_pins[] = { 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, +- 50, 51, 52, 53, 54, 55, 56 }; +-static int mt7981_wf0_mode1_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +- 1, 1, 1, 1 }; ++static const int mt7981_wf0_mode1_pins[] = { ++ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 }; ++static const int mt7981_wf0_mode1_funcs[] = { ++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; + + /* WF0_MODE3 */ +-static int mt7981_wf0_mode3_pins[] = { 45, 46, 47, 48, 49, 51 }; +-static int mt7981_wf0_mode3_funcs[] = { 2, 2, 2, 2, 2, 2 }; ++static const int mt7981_wf0_mode3_pins[] = { 45, 46, 47, 48, 49, 51 }; ++static const int mt7981_wf0_mode3_funcs[] = { 2, 2, 2, 2, 2, 2 }; + + /* WF2G_LED */ +-static int mt7981_wf2g_led0_pins[] = { 30, }; +-static int mt7981_wf2g_led0_funcs[] = { 2, }; ++static const int mt7981_wf2g_led0_pins[] = { 30, }; ++static const int mt7981_wf2g_led0_funcs[] = { 2, }; + +-static int mt7981_wf2g_led1_pins[] = { 34, }; +-static int mt7981_wf2g_led1_funcs[] = { 1, }; ++static const int mt7981_wf2g_led1_pins[] = { 34, }; ++static const int mt7981_wf2g_led1_funcs[] = { 1, }; + + /* WF5G_LED */ +-static int mt7981_wf5g_led0_pins[] = { 31, }; +-static int mt7981_wf5g_led0_funcs[] = { 2, }; ++static const int mt7981_wf5g_led0_pins[] = { 31, }; ++static const int mt7981_wf5g_led0_funcs[] = { 2, }; + +-static int mt7981_wf5g_led1_pins[] = { 35, }; +-static int mt7981_wf5g_led1_funcs[] = { 1, }; ++static const int mt7981_wf5g_led1_pins[] = { 35, }; ++static const int mt7981_wf5g_led1_funcs[] = { 1, }; + + /* MT7531_INT */ +-static int mt7981_mt7531_int_pins[] = { 38, }; +-static int mt7981_mt7531_int_funcs[] = { 1, }; ++static const int mt7981_mt7531_int_pins[] = { 38, }; ++static const int mt7981_mt7531_int_funcs[] = { 1, }; + + /* ANT_SEL */ +-static int mt7981_ant_sel_pins[] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 34, 35 }; +-static int mt7981_ant_sel_funcs[] = { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }; ++static const int mt7981_ant_sel_pins[] = { ++ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 34, 35 }; ++static const int mt7981_ant_sel_funcs[] = { ++ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }; + + static const struct mtk_group_desc mt7981_groups[] = { + /* @GPIO(0,1): WA_AICE(2) */ +@@ -1012,7 +1016,7 @@ static const char *const mt7981_pinctrl_ + "iocfg_lb_base", "iocfg_bl_base", "iocfg_tm_base", "iocfg_tl_base", + }; + +-static struct mtk_pinctrl_soc mt7981_data = { ++static const struct mtk_pinctrl_soc mt7981_data = { + .name = "mt7981_pinctrl", + .reg_cal = mt7981_reg_cals, + .pins = mt7981_pins, +--- a/drivers/pinctrl/mediatek/pinctrl-mt7986.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt7986.c +@@ -554,114 +554,117 @@ static const struct mtk_io_type_desc mt7 + * The hardware probably has multiple combinations of these pinouts. + */ + +-static int mt7986_watchdog_pins[] = { 0, }; +-static int mt7986_watchdog_funcs[] = { 1, }; ++static const int mt7986_watchdog_pins[] = { 0, }; ++static const int mt7986_watchdog_funcs[] = { 1, }; + +-static int mt7986_wifi_led_pins[] = { 1, 2, }; +-static int mt7986_wifi_led_funcs[] = { 1, 1, }; ++static const int mt7986_wifi_led_pins[] = { 1, 2, }; ++static const int mt7986_wifi_led_funcs[] = { 1, 1, }; + +-static int mt7986_i2c_pins[] = { 3, 4, }; +-static int mt7986_i2c_funcs[] = { 1, 1, }; ++static const int mt7986_i2c_pins[] = { 3, 4, }; ++static const int mt7986_i2c_funcs[] = { 1, 1, }; + +-static int mt7986_uart1_0_pins[] = { 7, 8, 9, 10, }; +-static int mt7986_uart1_0_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7986_uart1_0_pins[] = { 7, 8, 9, 10, }; ++static const int mt7986_uart1_0_funcs[] = { 3, 3, 3, 3, }; + +-static int mt7986_spi1_0_pins[] = { 11, 12, 13, 14, }; +-static int mt7986_spi1_0_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7986_spi1_0_pins[] = { 11, 12, 13, 14, }; ++static const int mt7986_spi1_0_funcs[] = { 3, 3, 3, 3, }; + +-static int mt7986_pwm1_1_pins[] = { 20, }; +-static int mt7986_pwm1_1_funcs[] = { 2, }; ++static const int mt7986_pwm1_1_pins[] = { 20, }; ++static const int mt7986_pwm1_1_funcs[] = { 2, }; + +-static int mt7986_pwm0_pins[] = { 21, }; +-static int mt7986_pwm0_funcs[] = { 1, }; ++static const int mt7986_pwm0_pins[] = { 21, }; ++static const int mt7986_pwm0_funcs[] = { 1, }; + +-static int mt7986_pwm1_0_pins[] = { 22, }; +-static int mt7986_pwm1_0_funcs[] = { 1, }; ++static const int mt7986_pwm1_0_pins[] = { 22, }; ++static const int mt7986_pwm1_0_funcs[] = { 1, }; + +-static int mt7986_emmc_45_pins[] = { ++static const int mt7986_emmc_45_pins[] = { + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, }; +-static int mt7986_emmc_45_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; ++static const int mt7986_emmc_45_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; + +-static int mt7986_snfi_pins[] = { 23, 24, 25, 26, 27, 28, }; +-static int mt7986_snfi_funcs[] = { 1, 1, 1, 1, 1, 1, }; ++static const int mt7986_snfi_pins[] = { 23, 24, 25, 26, 27, 28, }; ++static const int mt7986_snfi_funcs[] = { 1, 1, 1, 1, 1, 1, }; + +-static int mt7986_spi1_1_pins[] = { 23, 24, 25, 26, }; +-static int mt7986_spi1_1_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7986_spi1_1_pins[] = { 23, 24, 25, 26, }; ++static const int mt7986_spi1_1_funcs[] = { 3, 3, 3, 3, }; + +-static int mt7986_uart1_1_pins[] = { 23, 24, 25, 26, }; +-static int mt7986_uart1_1_funcs[] = { 4, 4, 4, 4, }; ++static const int mt7986_uart1_1_pins[] = { 23, 24, 25, 26, }; ++static const int mt7986_uart1_1_funcs[] = { 4, 4, 4, 4, }; + +-static int mt7986_spi1_2_pins[] = { 29, 30, 31, 32, }; +-static int mt7986_spi1_2_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7986_spi1_2_pins[] = { 29, 30, 31, 32, }; ++static const int mt7986_spi1_2_funcs[] = { 1, 1, 1, 1, }; + +-static int mt7986_uart1_2_pins[] = { 29, 30, 31, 32, }; +-static int mt7986_uart1_2_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7986_uart1_2_pins[] = { 29, 30, 31, 32, }; ++static const int mt7986_uart1_2_funcs[] = { 3, 3, 3, 3, }; + +-static int mt7986_uart2_0_pins[] = { 29, 30, 31, 32, }; +-static int mt7986_uart2_0_funcs[] = { 4, 4, 4, 4, }; ++static const int mt7986_uart2_0_pins[] = { 29, 30, 31, 32, }; ++static const int mt7986_uart2_0_funcs[] = { 4, 4, 4, 4, }; + +-static int mt7986_spi0_pins[] = { 33, 34, 35, 36, }; +-static int mt7986_spi0_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7986_spi0_pins[] = { 33, 34, 35, 36, }; ++static const int mt7986_spi0_funcs[] = { 1, 1, 1, 1, }; + +-static int mt7986_spi0_wp_hold_pins[] = { 37, 38, }; +-static int mt7986_spi0_wp_hold_funcs[] = { 1, 1, }; ++static const int mt7986_spi0_wp_hold_pins[] = { 37, 38, }; ++static const int mt7986_spi0_wp_hold_funcs[] = { 1, 1, }; + +-static int mt7986_uart2_1_pins[] = { 33, 34, 35, 36, }; +-static int mt7986_uart2_1_funcs[] = { 3, 3, 3, 3, }; ++static const int mt7986_uart2_1_pins[] = { 33, 34, 35, 36, }; ++static const int mt7986_uart2_1_funcs[] = { 3, 3, 3, 3, }; + +-static int mt7986_uart1_3_rx_tx_pins[] = { 35, 36, }; +-static int mt7986_uart1_3_rx_tx_funcs[] = { 2, 2, }; ++static const int mt7986_uart1_3_rx_tx_pins[] = { 35, 36, }; ++static const int mt7986_uart1_3_rx_tx_funcs[] = { 2, 2, }; + +-static int mt7986_uart1_3_cts_rts_pins[] = { 37, 38, }; +-static int mt7986_uart1_3_cts_rts_funcs[] = { 2, 2, }; ++static const int mt7986_uart1_3_cts_rts_pins[] = { 37, 38, }; ++static const int mt7986_uart1_3_cts_rts_funcs[] = { 2, 2, }; + +-static int mt7986_spi1_3_pins[] = { 33, 34, 35, 36, }; +-static int mt7986_spi1_3_funcs[] = { 4, 4, 4, 4, }; ++static const int mt7986_spi1_3_pins[] = { 33, 34, 35, 36, }; ++static const int mt7986_spi1_3_funcs[] = { 4, 4, 4, 4, }; + +-static int mt7986_uart0_pins[] = { 39, 40, }; +-static int mt7986_uart0_funcs[] = { 1, 1, }; ++static const int mt7986_uart0_pins[] = { 39, 40, }; ++static const int mt7986_uart0_funcs[] = { 1, 1, }; + +-static int mt7986_pcie_reset_pins[] = { 41, }; +-static int mt7986_pcie_reset_funcs[] = { 1, }; ++static const int mt7986_pcie_reset_pins[] = { 41, }; ++static const int mt7986_pcie_reset_funcs[] = { 1, }; + +-static int mt7986_uart1_pins[] = { 42, 43, 44, 45, }; +-static int mt7986_uart1_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7986_uart1_pins[] = { 42, 43, 44, 45, }; ++static const int mt7986_uart1_funcs[] = { 1, 1, 1, 1, }; + +-static int mt7986_uart2_pins[] = { 46, 47, 48, 49, }; +-static int mt7986_uart2_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7986_uart2_pins[] = { 46, 47, 48, 49, }; ++static const int mt7986_uart2_funcs[] = { 1, 1, 1, 1, }; + +-static int mt7986_emmc_51_pins[] = { ++static const int mt7986_emmc_51_pins[] = { + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, }; +-static int mt7986_emmc_51_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7986_emmc_51_funcs[] = { ++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + +-static int mt7986_pcm_pins[] = { 62, 63, 64, 65, }; +-static int mt7986_pcm_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7986_pcm_pins[] = { 62, 63, 64, 65, }; ++static const int mt7986_pcm_funcs[] = { 1, 1, 1, 1, }; + +-static int mt7986_i2s_pins[] = { 62, 63, 64, 65, }; +-static int mt7986_i2s_funcs[] = { 1, 1, 1, 1, }; ++static const int mt7986_i2s_pins[] = { 62, 63, 64, 65, }; ++static const int mt7986_i2s_funcs[] = { 1, 1, 1, 1, }; + +-static int mt7986_switch_int_pins[] = { 66, }; +-static int mt7986_switch_int_funcs[] = { 1, }; ++static const int mt7986_switch_int_pins[] = { 66, }; ++static const int mt7986_switch_int_funcs[] = { 1, }; + +-static int mt7986_mdc_mdio_pins[] = { 67, 68, }; +-static int mt7986_mdc_mdio_funcs[] = { 1, 1, }; ++static const int mt7986_mdc_mdio_pins[] = { 67, 68, }; ++static const int mt7986_mdc_mdio_funcs[] = { 1, 1, }; + +-static int mt7986_wf_2g_pins[] = {74, 75, 76, 77, 78, 79, 80, 81, 82, 83, }; +-static int mt7986_wf_2g_funcs[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7986_wf_2g_pins[] = { ++ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, }; ++static const int mt7986_wf_2g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + +-static int mt7986_wf_5g_pins[] = {91, 92, 93, 94, 95, 96, 97, 98, 99, 100, }; +-static int mt7986_wf_5g_funcs[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt7986_wf_5g_pins[] = { ++ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, }; ++static const int mt7986_wf_5g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + +-static int mt7986_wf_dbdc_pins[] = { ++static const int mt7986_wf_dbdc_pins[] = { + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, }; +-static int mt7986_wf_dbdc_funcs[] = { ++static const int mt7986_wf_dbdc_funcs[] = { + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; + +-static int mt7986_pcie_clk_pins[] = { 9, }; +-static int mt7986_pcie_clk_funcs[] = { 1, }; ++static const int mt7986_pcie_clk_pins[] = { 9, }; ++static const int mt7986_pcie_clk_funcs[] = { 1, }; + +-static int mt7986_pcie_wake_pins[] = { 10, }; +-static int mt7986_pcie_wake_funcs[] = { 1, }; ++static const int mt7986_pcie_wake_pins[] = { 10, }; ++static const int mt7986_pcie_wake_funcs[] = { 1, }; + + static const struct mtk_group_desc mt7986_groups[] = { + PINCTRL_PIN_GROUP("watchdog", mt7986_watchdog), +@@ -738,7 +741,7 @@ static const struct mtk_function_desc mt + {"wifi", mt7986_wf_groups, ARRAY_SIZE(mt7986_wf_groups)}, + }; + +-static struct mtk_pinctrl_soc mt7986_data = { ++static const struct mtk_pinctrl_soc mt7986_data = { + .name = "mt7986_pinctrl", + .reg_cal = mt7986_reg_cals, + .pins = mt7986_pins, +--- a/drivers/pinctrl/mediatek/pinctrl-mt8512.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt8512.c +@@ -315,12 +315,12 @@ static const struct mtk_pin_desc mt8512_ + */ + + /* UART */ +-static int mt8512_uart0_0_rxd_txd_pins[] = { 52, 53, }; +-static int mt8512_uart0_0_rxd_txd_funcs[] = { 1, 1, }; +-static int mt8512_uart1_0_rxd_txd_pins[] = { 54, 55, }; +-static int mt8512_uart1_0_rxd_txd_funcs[] = { 1, 1, }; +-static int mt8512_uart2_0_rxd_txd_pins[] = { 28, 29, }; +-static int mt8512_uart2_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8512_uart0_0_rxd_txd_pins[] = { 52, 53, }; ++static const int mt8512_uart0_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8512_uart1_0_rxd_txd_pins[] = { 54, 55, }; ++static const int mt8512_uart1_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8512_uart2_0_rxd_txd_pins[] = { 28, 29, }; ++static const int mt8512_uart2_0_rxd_txd_funcs[] = { 1, 1, }; + + /* Joint those groups owning the same capability in user point of view which + * allows that people tend to use through the device tree. +@@ -330,13 +330,13 @@ static const char *const mt8512_uart_gro + "uart2_0_rxd_txd", }; + + /* SNAND */ +-static int mt8512_snfi_pins[] = { 71, 76, 77, 78, 79, 80, }; +-static int mt8512_snfi_funcs[] = { 3, 3, 3, 3, 3, 3, }; ++static const int mt8512_snfi_pins[] = { 71, 76, 77, 78, 79, 80, }; ++static const int mt8512_snfi_funcs[] = { 3, 3, 3, 3, 3, 3, }; + + /* MMC0 */ +-static int mt8512_msdc0_pins[] = { 76, 77, 78, 79, 80, 81, 82, 83, 84, +- 85, 86, }; +-static int mt8512_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt8512_msdc0_pins[] = { 76, 77, 78, 79, 80, 81, 82, 83, 84, ++ 85, 86, }; ++static const int mt8512_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + + static const struct mtk_group_desc mt8512_groups[] = { + PINCTRL_PIN_GROUP("uart0_0_rxd_txd", mt8512_uart0_0_rxd_txd), +@@ -356,7 +356,7 @@ static const struct mtk_function_desc mt + {"snand", mt8512_msdc_groups, ARRAY_SIZE(mt8512_msdc_groups)}, + }; + +-static struct mtk_pinctrl_soc mt8512_data = { ++static const struct mtk_pinctrl_soc mt8512_data = { + .name = "mt8512_pinctrl", + .reg_cal = mt8512_reg_cals, + .pins = mt8512_pins, +--- a/drivers/pinctrl/mediatek/pinctrl-mt8516.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt8516.c +@@ -326,12 +326,12 @@ static const struct mtk_pin_desc mt8516_ + */ + + /* UART */ +-static int mt8516_uart0_0_rxd_txd_pins[] = { 62, 63, }; +-static int mt8516_uart0_0_rxd_txd_funcs[] = { 1, 1, }; +-static int mt8516_uart1_0_rxd_txd_pins[] = { 64, 65, }; +-static int mt8516_uart1_0_rxd_txd_funcs[] = { 1, 1, }; +-static int mt8516_uart2_0_rxd_txd_pins[] = { 34, 35, }; +-static int mt8516_uart2_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8516_uart0_0_rxd_txd_pins[] = { 62, 63, }; ++static const int mt8516_uart0_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8516_uart1_0_rxd_txd_pins[] = { 64, 65, }; ++static const int mt8516_uart1_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8516_uart2_0_rxd_txd_pins[] = { 34, 35, }; ++static const int mt8516_uart2_0_rxd_txd_funcs[] = { 1, 1, }; + + /* Joint those groups owning the same capability in user point of view which + * allows that people tend to use through the device tree. +@@ -341,9 +341,9 @@ static const char *const mt8516_uart_gro + "uart2_0_rxd_txd", }; + + /* MMC0 */ +-static int mt8516_msdc0_pins[] = { 110, 111, 112, 113, 114, 115, 116, 117, 118, +- 119, 120, }; +-static int mt8516_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt8516_msdc0_pins[] = { 110, 111, 112, 113, 114, 115, 116, 117, ++ 118, 119, 120, }; ++static const int mt8516_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + + static const struct mtk_group_desc mt8516_groups[] = { + PINCTRL_PIN_GROUP("uart0_0_rxd_txd", mt8516_uart0_0_rxd_txd), +--- a/drivers/pinctrl/mediatek/pinctrl-mt8518.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt8518.c +@@ -346,12 +346,12 @@ static const struct mtk_pin_desc mt8518_ + */ + + /* UART */ +-static int mt8518_uart0_0_rxd_txd_pins[] = { 104, 105, }; +-static int mt8518_uart0_0_rxd_txd_funcs[] = { 1, 1, }; +-static int mt8518_uart1_0_rxd_txd_pins[] = { 52, 53, }; +-static int mt8518_uart1_0_rxd_txd_funcs[] = { 1, 1, }; +-static int mt8518_uart2_0_rxd_txd_pins[] = { 106, 107, }; +-static int mt8518_uart2_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8518_uart0_0_rxd_txd_pins[] = { 104, 105, }; ++static const int mt8518_uart0_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8518_uart1_0_rxd_txd_pins[] = { 52, 53, }; ++static const int mt8518_uart1_0_rxd_txd_funcs[] = { 1, 1, }; ++static const int mt8518_uart2_0_rxd_txd_pins[] = { 106, 107, }; ++static const int mt8518_uart2_0_rxd_txd_funcs[] = { 1, 1, }; + + /* Joint those groups owning the same capability in user point of view which + * allows that people tend to use through the device tree. +@@ -361,9 +361,9 @@ static const char *const mt8518_uart_gro + "uart2_0_rxd_txd", }; + + /* MMC0 */ +-static int mt8518_msdc0_pins[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, +- 12, 13, }; +-static int mt8518_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; ++static const int mt8518_msdc0_pins[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, ++ 12, 13, }; ++static const int mt8518_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; + + static const struct mtk_group_desc mt8518_groups[] = { + PINCTRL_PIN_GROUP("uart0_0_rxd_txd", mt8518_uart0_0_rxd_txd), +@@ -380,7 +380,7 @@ static const struct mtk_function_desc mt + {"msdc", mt8518_msdc_groups, ARRAY_SIZE(mt8518_msdc_groups)}, + }; + +-static struct mtk_pinctrl_soc mt8518_data = { ++static const struct mtk_pinctrl_soc mt8518_data = { + .name = "mt8518_pinctrl", + .reg_cal = mt8518_reg_cals, + .pins = mt8518_pins, +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +@@ -314,7 +314,7 @@ static int mtk_pinmux_group_set(struct u + int i; + + for (i = 0; i < grp->num_pins; i++) { +- int *pin_modes = grp->data; ++ const int *pin_modes = grp->data; + + mtk_hw_set_value(dev, grp->pins[i], PINCTRL_PIN_REG_MODE, + pin_modes[i]); +@@ -769,7 +769,7 @@ static int mtk_gpiochip_register(struct + #endif + + int mtk_pinctrl_common_probe(struct udevice *dev, +- struct mtk_pinctrl_soc *soc) ++ const struct mtk_pinctrl_soc *soc) + { + struct mtk_pinctrl_priv *priv = dev_get_priv(dev); + int ret = 0; +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h +@@ -174,9 +174,9 @@ struct mtk_pin_desc { + */ + struct mtk_group_desc { + const char *name; +- int *pins; ++ const int *pins; + int num_pins; +- void *data; ++ const void *data; + }; + + /** +@@ -233,7 +233,7 @@ struct mtk_pinctrl_soc { + */ + struct mtk_pinctrl_priv { + void __iomem *base[MAX_BASE_CALC]; +- struct mtk_pinctrl_soc *soc; ++ const struct mtk_pinctrl_soc *soc; + }; + + extern const struct pinctrl_ops mtk_pinctrl_ops; +@@ -242,7 +242,7 @@ extern const struct pinctrl_ops mtk_pinc + void mtk_rmw(struct udevice *dev, u32 reg, u32 mask, u32 set); + void mtk_i_rmw(struct udevice *dev, u8 i, u32 reg, u32 mask, u32 set); + int mtk_pinctrl_common_probe(struct udevice *dev, +- struct mtk_pinctrl_soc *soc); ++ const struct mtk_pinctrl_soc *soc); + + #if CONFIG_IS_ENABLED(PINCONF) + diff --git a/package/boot/uboot-mediatek/patches/101-13-pinctrl-mediatek-fix-the-return-value-in-driving-con.patch b/package/boot/uboot-mediatek/patches/101-13-pinctrl-mediatek-fix-the-return-value-in-driving-con.patch new file mode 100644 index 00000000000000..d83a89ab37e205 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-13-pinctrl-mediatek-fix-the-return-value-in-driving-con.patch @@ -0,0 +1,37 @@ +From 783c46d29f8b186bd65f3e83f38ad883e8bcec69 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:42 +0800 +Subject: [PATCH 13/29] pinctrl: mediatek: fix the return value in driving + configuration functions + +The original mediatek pinctrl functions for driving configuration +'mtk_pinconf_drive_set_*' do not return -ENOSUPP even if input +parameters are not supported. +This patch fixes the return value in those functions. + +Signed-off-by: Sam Shih +Signed-off-by: Weijie Gao +--- + drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +@@ -513,7 +513,7 @@ int mtk_pinconf_drive_set_v0(struct udev + return err; + } + +- return 0; ++ return err; + } + + int mtk_pinconf_drive_set_v1(struct udevice *dev, u32 pin, u32 arg) +@@ -531,7 +531,7 @@ int mtk_pinconf_drive_set_v1(struct udev + return err; + } + +- return 0; ++ return err; + } + + int mtk_pinconf_drive_set(struct udevice *dev, u32 pin, u32 arg) diff --git a/package/boot/uboot-mediatek/patches/101-14-pinctrl-mediatek-add-pinmux_set-ops-support.patch b/package/boot/uboot-mediatek/patches/101-14-pinctrl-mediatek-add-pinmux_set-ops-support.patch new file mode 100644 index 00000000000000..7cb185ff42c342 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-14-pinctrl-mediatek-add-pinmux_set-ops-support.patch @@ -0,0 +1,43 @@ +From 090351b416e57e0f7b5d1a4c87d4ed9ab4f5c89b Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:46 +0800 +Subject: [PATCH 14/29] pinctrl: mediatek: add pinmux_set ops support + +This patch adds pinmux_set ops for mediatek pinctrl framework + +Signed-off-by: Sam Shih +Signed-off-by: Weijie Gao +--- + drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +@@ -304,6 +304,19 @@ static const char *mtk_get_function_name + return priv->soc->funcs[selector].name; + } + ++static int mtk_pinmux_set(struct udevice *dev, unsigned int pin_selector, ++ unsigned int func_selector) ++{ ++ int err; ++ ++ err = mtk_hw_set_value(dev, pin_selector, PINCTRL_PIN_REG_MODE, ++ func_selector); ++ if (err) ++ return err; ++ ++ return 0; ++} ++ + static int mtk_pinmux_group_set(struct udevice *dev, + unsigned int group_selector, + unsigned int func_selector) +@@ -647,6 +660,7 @@ const struct pinctrl_ops mtk_pinctrl_ops + .get_group_name = mtk_get_group_name, + .get_functions_count = mtk_get_functions_count, + .get_function_name = mtk_get_function_name, ++ .pinmux_set = mtk_pinmux_set, + .pinmux_group_set = mtk_pinmux_group_set, + #if CONFIG_IS_ENABLED(PINCONF) + .pinconf_num_params = ARRAY_SIZE(mtk_conf_params), diff --git a/package/boot/uboot-mediatek/patches/101-15-pinctrl-mediatek-add-pinctrl-driver-for-MT7988-SoC.patch b/package/boot/uboot-mediatek/patches/101-15-pinctrl-mediatek-add-pinctrl-driver-for-MT7988-SoC.patch new file mode 100644 index 00000000000000..cfc7c32ba317e3 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-15-pinctrl-mediatek-add-pinctrl-driver-for-MT7988-SoC.patch @@ -0,0 +1,1315 @@ +From 5e821f4ebd9da4ccf3c8871e402996f6a6eb8d1c Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:50 +0800 +Subject: [PATCH 15/29] pinctrl: mediatek: add pinctrl driver for MT7988 SoC + +This patch adds pinctrl and gpio support for MT7988 SoC + +Signed-off-by: Weijie Gao +--- + drivers/pinctrl/mediatek/Kconfig | 4 + + drivers/pinctrl/mediatek/Makefile | 1 + + drivers/pinctrl/mediatek/pinctrl-mt7988.c | 1274 +++++++++++++++++++++ + 3 files changed, 1279 insertions(+) + create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7988.c + +--- a/drivers/pinctrl/mediatek/Kconfig ++++ b/drivers/pinctrl/mediatek/Kconfig +@@ -24,6 +24,10 @@ config PINCTRL_MT7986 + bool "MT7986 SoC pinctrl driver" + select PINCTRL_MTK + ++config PINCTRL_MT7988 ++ bool "MT7988 SoC pinctrl driver" ++ select PINCTRL_MTK ++ + config PINCTRL_MT8512 + bool "MT8512 SoC pinctrl driver" + select PINCTRL_MTK +--- a/drivers/pinctrl/mediatek/Makefile ++++ b/drivers/pinctrl/mediatek/Makefile +@@ -8,6 +8,7 @@ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl- + obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o + obj-$(CONFIG_PINCTRL_MT7981) += pinctrl-mt7981.o + obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o ++obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o + obj-$(CONFIG_PINCTRL_MT8512) += pinctrl-mt8512.o + obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o + obj-$(CONFIG_PINCTRL_MT8518) += pinctrl-mt8518.o +--- /dev/null ++++ b/drivers/pinctrl/mediatek/pinctrl-mt7988.c +@@ -0,0 +1,1274 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++#include ++#include "pinctrl-mtk-common.h" ++ ++enum MT7988_PINCTRL_REG_PAGE { ++ GPIO_BASE, ++ IOCFG_TR_BASE, ++ IOCFG_BR_BASE, ++ IOCFG_RB_BASE, ++ IOCFG_LB_BASE, ++ IOCFG_TL_BASE, ++}; ++ ++#define MT7988_TYPE0_PIN(_number, _name) \ ++ MTK_TYPED_PIN(_number, _name, DRV_GRP4, IO_TYPE_GRP0) ++ ++#define MT7988_TYPE1_PIN(_number, _name) \ ++ MTK_TYPED_PIN(_number, _name, DRV_GRP4, IO_TYPE_GRP1) ++ ++#define MT7988_TYPE2_PIN(_number, _name) \ ++ MTK_TYPED_PIN(_number, _name, DRV_FIXED, IO_TYPE_GRP2) ++ ++#define PIN_FIELD_GPIO(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \ ++ PIN_FIELD_BASE_CALC(_s_pin, _e_pin, GPIO_BASE, _s_addr, _x_addrs, \ ++ _s_bit, _x_bits, 32, 0) ++ ++#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits) \ ++ PIN_FIELD_BASE_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, \ ++ _s_bit, _x_bits, 32, 0) ++ ++#define PINS_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits) \ ++ PIN_FIELD_BASE_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, \ ++ _s_bit, _x_bits, 32, 1) ++ ++static const struct mtk_pin_field_calc mt7988_pin_mode_range[] = { ++ PIN_FIELD_GPIO(0, 83, 0x300, 0x10, 0, 4), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_dir_range[] = { ++ PIN_FIELD_GPIO(0, 83, 0x0, 0x10, 0, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_di_range[] = { ++ PIN_FIELD_GPIO(0, 83, 0x200, 0x10, 0, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_do_range[] = { ++ PIN_FIELD_GPIO(0, 83, 0x100, 0x10, 0, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_ies_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x30, 0x10, 13, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x30, 0x10, 14, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x30, 0x10, 11, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x30, 0x10, 12, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x30, 0x10, 0, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x30, 0x10, 9, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x30, 0x10, 10, 1), ++ ++ PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x30, 0x10, 8, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x30, 0x10, 6, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x30, 0x10, 5, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x30, 0x10, 3, 1), ++ ++ PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x40, 0x10, 21, 1), ++ PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x40, 0x10, 1, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x40, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(15, 15, IOCFG_TL_BASE, 0x30, 0x10, 7, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_TL_BASE, 0x30, 0x10, 8, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_TL_BASE, 0x30, 0x10, 3, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_TL_BASE, 0x30, 0x10, 4, 1), ++ ++ PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x30, 0x10, 7, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x30, 0x10, 4, 1), ++ ++ PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x50, 0x10, 17, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x50, 0x10, 23, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x50, 0x10, 20, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x50, 0x10, 19, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x50, 0x10, 21, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x50, 0x10, 22, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x50, 0x10, 18, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x50, 0x10, 25, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x50, 0x10, 26, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x50, 0x10, 27, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x50, 0x10, 24, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x50, 0x10, 28, 1), ++ PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x60, 0x10, 0, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x50, 0x10, 31, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x50, 0x10, 29, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x50, 0x10, 30, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x60, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x50, 0x10, 11, 1), ++ PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x50, 0x10, 10, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x50, 0x10, 0, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x50, 0x10, 1, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x50, 0x10, 9, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x50, 0x10, 8, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x50, 0x10, 7, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x50, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x50, 0x10, 5, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x50, 0x10, 4, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x50, 0x10, 3, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x50, 0x10, 2, 1), ++ PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x50, 0x10, 15, 1), ++ PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x50, 0x10, 12, 1), ++ PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x50, 0x10, 13, 1), ++ PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x50, 0x10, 14, 1), ++ PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x50, 0x10, 16, 1), ++ ++ PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x40, 0x10, 14, 1), ++ PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x40, 0x10, 15, 1), ++ PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x40, 0x10, 13, 1), ++ PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x40, 0x10, 5, 1), ++ PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x40, 0x10, 6, 1), ++ PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x40, 0x10, 3, 1), ++ PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x40, 0x10, 7, 1), ++ PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x40, 0x10, 20, 1), ++ PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x40, 0x10, 8, 1), ++ PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x40, 0x10, 9, 1), ++ PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x40, 0x10, 10, 1), ++ PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x40, 0x10, 11, 1), ++ PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x40, 0x10, 12, 1), ++ ++ PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x30, 0x10, 1, 1), ++ PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x30, 0x10, 2, 1), ++ PIN_FIELD_BASE(71, 71, IOCFG_TL_BASE, 0x30, 0x10, 5, 1), ++ PIN_FIELD_BASE(72, 72, IOCFG_TL_BASE, 0x30, 0x10, 6, 1), ++ ++ PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x30, 0x10, 10, 1), ++ PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x30, 0x10, 1, 1), ++ PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x30, 0x10, 11, 1), ++ PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x30, 0x10, 9, 1), ++ PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x30, 0x10, 2, 1), ++ PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x30, 0x10, 0, 1), ++ PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x30, 0x10, 12, 1), ++ ++ PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x40, 0x10, 18, 1), ++ PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x40, 0x10, 19, 1), ++ PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x40, 0x10, 16, 1), ++ PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x40, 0x10, 17, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_smt_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0xc0, 0x10, 13, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0xc0, 0x10, 14, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0xc0, 0x10, 11, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0xc0, 0x10, 12, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0xc0, 0x10, 0, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0xc0, 0x10, 9, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0xc0, 0x10, 10, 1), ++ ++ PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0xb0, 0x10, 8, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0xb0, 0x10, 6, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0xb0, 0x10, 5, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0xb0, 0x10, 3, 1), ++ ++ PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0xe0, 0x10, 0, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0xe0, 0x10, 21, 1), ++ PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0xe0, 0x10, 1, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0xe0, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(15, 15, IOCFG_TL_BASE, 0xc0, 0x10, 7, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_TL_BASE, 0xc0, 0x10, 8, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_TL_BASE, 0xc0, 0x10, 3, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_TL_BASE, 0xc0, 0x10, 4, 1), ++ ++ PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0xb0, 0x10, 7, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0xb0, 0x10, 4, 1), ++ ++ PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x140, 0x10, 17, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x140, 0x10, 23, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x140, 0x10, 20, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x140, 0x10, 19, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x140, 0x10, 21, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x140, 0x10, 22, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x140, 0x10, 18, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x140, 0x10, 25, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x140, 0x10, 26, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x140, 0x10, 27, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x140, 0x10, 24, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x140, 0x10, 28, 1), ++ PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x150, 0x10, 0, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x140, 0x10, 31, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x140, 0x10, 29, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x140, 0x10, 30, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x150, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x140, 0x10, 11, 1), ++ PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x140, 0x10, 10, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x140, 0x10, 0, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x140, 0x10, 1, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x140, 0x10, 9, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x140, 0x10, 8, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x140, 0x10, 7, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x140, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x140, 0x10, 5, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x140, 0x10, 4, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x140, 0x10, 3, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x140, 0x10, 2, 1), ++ PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x140, 0x10, 15, 1), ++ PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x140, 0x10, 12, 1), ++ PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x140, 0x10, 13, 1), ++ PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x140, 0x10, 14, 1), ++ PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x140, 0x10, 16, 1), ++ ++ PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0xe0, 0x10, 14, 1), ++ PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0xe0, 0x10, 15, 1), ++ PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0xe0, 0x10, 13, 1), ++ PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0xe0, 0x10, 4, 1), ++ PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0xe0, 0x10, 5, 1), ++ PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0xe0, 0x10, 6, 1), ++ PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0xe0, 0x10, 3, 1), ++ PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0xe0, 0x10, 7, 1), ++ PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0xe0, 0x10, 20, 1), ++ PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0xe0, 0x10, 8, 1), ++ PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0xe0, 0x10, 9, 1), ++ PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0xe0, 0x10, 10, 1), ++ PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0xe0, 0x10, 11, 1), ++ PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0xe0, 0x10, 12, 1), ++ ++ PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0xc0, 0x10, 1, 1), ++ PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0xc0, 0x10, 2, 1), ++ PIN_FIELD_BASE(71, 71, IOCFG_TL_BASE, 0xc0, 0x10, 5, 1), ++ PIN_FIELD_BASE(72, 72, IOCFG_TL_BASE, 0xc0, 0x10, 6, 1), ++ ++ PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0xb0, 0x10, 10, 1), ++ PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0xb0, 0x10, 1, 1), ++ PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0xb0, 0x10, 11, 1), ++ PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0xb0, 0x10, 9, 1), ++ PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0xb0, 0x10, 2, 1), ++ PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0xb0, 0x10, 0, 1), ++ PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0xb0, 0x10, 12, 1), ++ ++ PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0xe0, 0x10, 18, 1), ++ PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0xe0, 0x10, 19, 1), ++ PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0xe0, 0x10, 16, 1), ++ PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0xe0, 0x10, 17, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_pu_range[] = { ++ PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x60, 0x10, 5, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x60, 0x10, 4, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x60, 0x10, 3, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x60, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x70, 0x10, 0, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x70, 0x10, 1, 1), ++ PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x70, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x60, 0x10, 7, 1), ++ PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x60, 0x10, 6, 1), ++ PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x60, 0x10, 1, 1), ++ PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x60, 0x10, 0, 1), ++ PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x60, 0x10, 8, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_pd_range[] = { ++ PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x40, 0x10, 5, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x40, 0x10, 3, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x40, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x50, 0x10, 0, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x50, 0x10, 1, 1), ++ ++ PIN_FIELD_BASE(15, 15, IOCFG_TL_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_TL_BASE, 0x40, 0x10, 5, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_TL_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_TL_BASE, 0x40, 0x10, 1, 1), ++ ++ PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x50, 0x10, 2, 1), ++ PIN_FIELD_BASE(71, 71, IOCFG_TL_BASE, 0x40, 0x10, 2, 1), ++ PIN_FIELD_BASE(72, 72, IOCFG_TL_BASE, 0x40, 0x10, 3, 1), ++ ++ PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x40, 0x10, 7, 1), ++ PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x40, 0x10, 6, 1), ++ PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x40, 0x10, 1, 1), ++ PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x40, 0x10, 8, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_drv_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x00, 0x10, 21, 3), ++ PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x00, 0x10, 24, 3), ++ PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x00, 0x10, 15, 3), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x00, 0x10, 18, 3), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x00, 0x10, 0, 3), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x00, 0x10, 9, 3), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x00, 0x10, 12, 3), ++ ++ PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x00, 0x10, 24, 3), ++ PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x00, 0x10, 28, 3), ++ PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x00, 0x10, 15, 3), ++ PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x00, 0x10, 9, 3), ++ ++ PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x00, 0x10, 0, 3), ++ PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x20, 0x10, 3, 3), ++ PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x00, 0x10, 3, 3), ++ PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x00, 0x10, 6, 3), ++ ++ PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x00, 0x10, 21, 3), ++ PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x00, 0x10, 12, 3), ++ ++ PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x10, 0x10, 21, 3), ++ PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x20, 0x10, 9, 3), ++ PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x20, 0x10, 0, 3), ++ PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x10, 0x10, 27, 3), ++ PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x20, 0x10, 3, 3), ++ PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x20, 0x10, 6, 3), ++ PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x10, 0x10, 24, 3), ++ PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x20, 0x10, 15, 3), ++ PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x20, 0x10, 18, 3), ++ PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x20, 0x10, 21, 3), ++ PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x20, 0x10, 12, 3), ++ PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x20, 0x10, 24, 3), ++ PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x30, 0x10, 6, 3), ++ PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x30, 0x10, 3, 3), ++ PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x20, 0x10, 27, 3), ++ PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x30, 0x10, 0, 3), ++ PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x30, 0x10, 9, 3), ++ PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x10, 0x10, 3, 3), ++ PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x10, 0x10, 0, 3), ++ PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x00, 0x10, 0, 3), ++ PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x00, 0x10, 3, 3), ++ PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x00, 0x10, 27, 3), ++ PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x00, 0x10, 24, 3), ++ PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x00, 0x10, 21, 3), ++ PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x00, 0x10, 18, 3), ++ PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x00, 0x10, 15, 3), ++ PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x00, 0x10, 12, 3), ++ PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x00, 0x10, 9, 3), ++ PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x00, 0x10, 6, 3), ++ PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x10, 0x10, 15, 3), ++ PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x10, 0x10, 6, 3), ++ PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x10, 0x10, 9, 3), ++ PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x10, 0x10, 12, 3), ++ PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x10, 0x10, 18, 3), ++ ++ PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x10, 0x10, 12, 3), ++ PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x10, 0x10, 15, 3), ++ PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x10, 0x10, 9, 3), ++ PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x00, 0x10, 12, 3), ++ PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x00, 0x10, 15, 3), ++ PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x00, 0x10, 18, 3), ++ PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x00, 0x10, 9, 3), ++ PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x00, 0x10, 21, 3), ++ PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x20, 0x10, 0, 3), ++ PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x00, 0x10, 24, 3), ++ PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x00, 0x10, 27, 3), ++ PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x10, 0x10, 0, 3), ++ PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x10, 0x10, 3, 3), ++ PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x10, 0x10, 6, 3), ++ ++ PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x00, 0x10, 3, 3), ++ PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x00, 0x10, 6, 3), ++ ++ PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x10, 0x10, 0, 3), ++ PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x00, 0x10, 3, 3), ++ PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x10, 0x10, 3, 3), ++ PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x00, 0x10, 27, 3), ++ PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x00, 0x10, 6, 3), ++ PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x00, 0x10, 0, 3), ++ PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x10, 0x10, 6, 3), ++ ++ PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x10, 0x10, 24, 3), ++ PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x10, 0x10, 27, 3), ++ PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x10, 0x10, 18, 3), ++ PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x10, 0x10, 21, 3), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_pupd_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x50, 0x10, 7, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x50, 0x10, 8, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x50, 0x10, 5, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x50, 0x10, 6, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x50, 0x10, 0, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x50, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x50, 0x10, 4, 1), ++ ++ PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x60, 0x10, 0, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x60, 0x10, 18, 1), ++ ++ PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x50, 0x10, 2, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x50, 0x10, 1, 1), ++ ++ PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x70, 0x10, 17, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x70, 0x10, 23, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x70, 0x10, 20, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x70, 0x10, 19, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x70, 0x10, 21, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x70, 0x10, 22, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x70, 0x10, 18, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x70, 0x10, 25, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x70, 0x10, 26, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x70, 0x10, 27, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x70, 0x10, 24, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x70, 0x10, 28, 1), ++ PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x80, 0x10, 0, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x70, 0x10, 31, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x70, 0x10, 29, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x70, 0x10, 30, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x80, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x70, 0x10, 11, 1), ++ PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x70, 0x10, 10, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x70, 0x10, 0, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x70, 0x10, 1, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x70, 0x10, 9, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x70, 0x10, 8, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x70, 0x10, 7, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x70, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x70, 0x10, 5, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x70, 0x10, 4, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x70, 0x10, 3, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x70, 0x10, 2, 1), ++ PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x70, 0x10, 15, 1), ++ PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x70, 0x10, 12, 1), ++ PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x70, 0x10, 13, 1), ++ PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x70, 0x10, 14, 1), ++ PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x70, 0x10, 16, 1), ++ ++ PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x60, 0x10, 12, 1), ++ PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x60, 0x10, 13, 1), ++ PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x60, 0x10, 11, 1), ++ PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x60, 0x10, 2, 1), ++ PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x60, 0x10, 3, 1), ++ PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x60, 0x10, 4, 1), ++ PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x60, 0x10, 1, 1), ++ PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x60, 0x10, 5, 1), ++ PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x60, 0x10, 6, 1), ++ PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x60, 0x10, 7, 1), ++ PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x60, 0x10, 8, 1), ++ PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x60, 0x10, 9, 1), ++ PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x60, 0x10, 10, 1), ++ ++ PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x50, 0x10, 1, 1), ++ PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x50, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x50, 0x10, 3, 1), ++ PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x50, 0x10, 0, 1), ++ ++ PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x60, 0x10, 16, 1), ++ PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x60, 0x10, 17, 1), ++ PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x60, 0x10, 14, 1), ++ PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x60, 0x10, 15, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_r0_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x60, 0x10, 7, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x60, 0x10, 8, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x60, 0x10, 5, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x60, 0x10, 6, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x60, 0x10, 0, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x60, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x60, 0x10, 4, 1), ++ ++ PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x80, 0x10, 0, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x80, 0x10, 18, 1), ++ ++ PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x70, 0x10, 2, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x70, 0x10, 1, 1), ++ ++ PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x90, 0x10, 17, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x90, 0x10, 23, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x90, 0x10, 20, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x90, 0x10, 19, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x90, 0x10, 21, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x90, 0x10, 22, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x90, 0x10, 18, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x90, 0x10, 25, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x90, 0x10, 26, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x90, 0x10, 27, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x90, 0x10, 24, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x90, 0x10, 28, 1), ++ PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0xa0, 0x10, 0, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x90, 0x10, 31, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x90, 0x10, 29, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x90, 0x10, 30, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0xa0, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x90, 0x10, 11, 1), ++ PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x90, 0x10, 10, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x90, 0x10, 0, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x90, 0x10, 1, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x90, 0x10, 9, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x90, 0x10, 8, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x90, 0x10, 7, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x90, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x90, 0x10, 5, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x90, 0x10, 4, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x90, 0x10, 3, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x90, 0x10, 2, 1), ++ PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x90, 0x10, 15, 1), ++ PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x90, 0x10, 12, 1), ++ PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x90, 0x10, 13, 1), ++ PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x90, 0x10, 14, 1), ++ PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x90, 0x10, 16, 1), ++ ++ PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x80, 0x10, 12, 1), ++ PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x80, 0x10, 13, 1), ++ PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x80, 0x10, 11, 1), ++ PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x80, 0x10, 2, 1), ++ PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x80, 0x10, 3, 1), ++ PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x80, 0x10, 4, 1), ++ PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x80, 0x10, 1, 1), ++ PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x80, 0x10, 5, 1), ++ PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x80, 0x10, 6, 1), ++ PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x80, 0x10, 7, 1), ++ PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x80, 0x10, 8, 1), ++ PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x80, 0x10, 9, 1), ++ PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x80, 0x10, 10, 1), ++ ++ PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x60, 0x10, 1, 1), ++ PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x60, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x70, 0x10, 3, 1), ++ PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x70, 0x10, 0, 1), ++ ++ PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x80, 0x10, 16, 1), ++ PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x80, 0x10, 17, 1), ++ PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x80, 0x10, 14, 1), ++ PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x80, 0x10, 15, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7988_pin_r1_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x70, 0x10, 7, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x70, 0x10, 8, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x70, 0x10, 5, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x70, 0x10, 6, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x70, 0x10, 0, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x70, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x70, 0x10, 4, 1), ++ ++ PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x90, 0x10, 0, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x90, 0x10, 18, 1), ++ ++ PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x80, 0x10, 2, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x80, 0x10, 1, 1), ++ ++ PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0xb0, 0x10, 17, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0xb0, 0x10, 23, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0xb0, 0x10, 20, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0xb0, 0x10, 19, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0xb0, 0x10, 21, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0xb0, 0x10, 22, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0xb0, 0x10, 18, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0xb0, 0x10, 25, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0xb0, 0x10, 26, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0xb0, 0x10, 27, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0xb0, 0x10, 24, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0xb0, 0x10, 28, 1), ++ PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0xc0, 0x10, 0, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0xb0, 0x10, 31, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0xb0, 0x10, 29, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0xb0, 0x10, 30, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0xc0, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0xb0, 0x10, 11, 1), ++ PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0xb0, 0x10, 10, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0xb0, 0x10, 0, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0xb0, 0x10, 1, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0xb0, 0x10, 9, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0xb0, 0x10, 8, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0xb0, 0x10, 7, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0xb0, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0xb0, 0x10, 5, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0xb0, 0x10, 4, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0xb0, 0x10, 3, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0xb0, 0x10, 2, 1), ++ PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0xb0, 0x10, 15, 1), ++ PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0xb0, 0x10, 12, 1), ++ PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0xb0, 0x10, 13, 1), ++ PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0xb0, 0x10, 14, 1), ++ PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0xb0, 0x10, 16, 1), ++ ++ PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x90, 0x10, 12, 1), ++ PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x90, 0x10, 13, 1), ++ PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x90, 0x10, 11, 1), ++ PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x90, 0x10, 2, 1), ++ PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x90, 0x10, 3, 1), ++ PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x90, 0x10, 4, 1), ++ PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x90, 0x10, 1, 1), ++ PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x90, 0x10, 5, 1), ++ PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x90, 0x10, 6, 1), ++ PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x90, 0x10, 7, 1), ++ PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x90, 0x10, 8, 1), ++ PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x90, 0x10, 9, 1), ++ PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x90, 0x10, 10, 1), ++ ++ PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x70, 0x10, 1, 1), ++ PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x70, 0x10, 2, 1), ++ ++ PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x80, 0x10, 3, 1), ++ PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x80, 0x10, 0, 1), ++ ++ PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x90, 0x10, 16, 1), ++ PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x90, 0x10, 17, 1), ++ PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x90, 0x10, 14, 1), ++ PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x90, 0x10, 15, 1), ++}; ++ ++static const struct mtk_pin_reg_calc mt7988_reg_cals[] = { ++ [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7988_pin_mode_range), ++ [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7988_pin_dir_range), ++ [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7988_pin_di_range), ++ [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7988_pin_do_range), ++ [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7988_pin_smt_range), ++ [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt7988_pin_ies_range), ++ [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt7988_pin_pu_range), ++ [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt7988_pin_pd_range), ++ [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7988_pin_drv_range), ++ [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt7988_pin_pupd_range), ++ [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt7988_pin_r0_range), ++ [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt7988_pin_r1_range), ++}; ++ ++static const struct mtk_pin_desc mt7988_pins[] = { ++ MT7988_TYPE0_PIN(0, "UART2_RXD"), ++ MT7988_TYPE0_PIN(1, "UART2_TXD"), ++ MT7988_TYPE0_PIN(2, "UART2_CTS"), ++ MT7988_TYPE0_PIN(3, "UART2_RTS"), ++ MT7988_TYPE0_PIN(4, "GPIO_A"), ++ MT7988_TYPE0_PIN(5, "SMI_0_MDC"), ++ MT7988_TYPE0_PIN(6, "SMI_0_MDIO"), ++ MT7988_TYPE1_PIN(7, "PCIE30_2L_0_WAKE_N"), ++ MT7988_TYPE1_PIN(8, "PCIE30_2L_0_CLKREQ_N"), ++ MT7988_TYPE1_PIN(9, "PCIE30_1L_1_WAKE_N"), ++ MT7988_TYPE1_PIN(10, "PCIE30_1L_1_CLKREQ_N"), ++ MT7988_TYPE0_PIN(11, "GPIO_P"), ++ MT7988_TYPE0_PIN(12, "WATCHDOG"), ++ MT7988_TYPE1_PIN(13, "GPIO_RESET"), ++ MT7988_TYPE1_PIN(14, "GPIO_WPS"), ++ MT7988_TYPE2_PIN(15, "PMIC_I2C_SCL"), ++ MT7988_TYPE2_PIN(16, "PMIC_I2C_SDA"), ++ MT7988_TYPE2_PIN(17, "I2C_1_SCL"), ++ MT7988_TYPE2_PIN(18, "I2C_1_SDA"), ++ MT7988_TYPE0_PIN(19, "PCIE30_2L_0_PRESET_N"), ++ MT7988_TYPE0_PIN(20, "PCIE30_1L_1_PRESET_N"), ++ MT7988_TYPE0_PIN(21, "PWMD1"), ++ MT7988_TYPE0_PIN(22, "SPI0_WP"), ++ MT7988_TYPE0_PIN(23, "SPI0_HOLD"), ++ MT7988_TYPE0_PIN(24, "SPI0_CSB"), ++ MT7988_TYPE0_PIN(25, "SPI0_MISO"), ++ MT7988_TYPE0_PIN(26, "SPI0_MOSI"), ++ MT7988_TYPE0_PIN(27, "SPI0_CLK"), ++ MT7988_TYPE0_PIN(28, "SPI1_CSB"), ++ MT7988_TYPE0_PIN(29, "SPI1_MISO"), ++ MT7988_TYPE0_PIN(30, "SPI1_MOSI"), ++ MT7988_TYPE0_PIN(31, "SPI1_CLK"), ++ MT7988_TYPE0_PIN(32, "SPI2_CLK"), ++ MT7988_TYPE0_PIN(33, "SPI2_MOSI"), ++ MT7988_TYPE0_PIN(34, "SPI2_MISO"), ++ MT7988_TYPE0_PIN(35, "SPI2_CSB"), ++ MT7988_TYPE0_PIN(36, "SPI2_HOLD"), ++ MT7988_TYPE0_PIN(37, "SPI2_WP"), ++ MT7988_TYPE0_PIN(38, "EMMC_RSTB"), ++ MT7988_TYPE0_PIN(39, "EMMC_DSL"), ++ MT7988_TYPE0_PIN(40, "EMMC_CK"), ++ MT7988_TYPE0_PIN(41, "EMMC_CMD"), ++ MT7988_TYPE0_PIN(42, "EMMC_DATA_7"), ++ MT7988_TYPE0_PIN(43, "EMMC_DATA_6"), ++ MT7988_TYPE0_PIN(44, "EMMC_DATA_5"), ++ MT7988_TYPE0_PIN(45, "EMMC_DATA_4"), ++ MT7988_TYPE0_PIN(46, "EMMC_DATA_3"), ++ MT7988_TYPE0_PIN(47, "EMMC_DATA_2"), ++ MT7988_TYPE0_PIN(48, "EMMC_DATA_1"), ++ MT7988_TYPE0_PIN(49, "EMMC_DATA_0"), ++ MT7988_TYPE0_PIN(50, "PCM_FS_I2S_LRCK"), ++ MT7988_TYPE0_PIN(51, "PCM_CLK_I2S_BCLK"), ++ MT7988_TYPE0_PIN(52, "PCM_DRX_I2S_DIN"), ++ MT7988_TYPE0_PIN(53, "PCM_DTX_I2S_DOUT"), ++ MT7988_TYPE0_PIN(54, "PCM_MCK_I2S_MCLK"), ++ MT7988_TYPE0_PIN(55, "UART0_RXD"), ++ MT7988_TYPE0_PIN(56, "UART0_TXD"), ++ MT7988_TYPE0_PIN(57, "PWMD0"), ++ MT7988_TYPE0_PIN(58, "JTAG_JTDI"), ++ MT7988_TYPE0_PIN(59, "JTAG_JTDO"), ++ MT7988_TYPE0_PIN(60, "JTAG_JTMS"), ++ MT7988_TYPE0_PIN(61, "JTAG_JTCLK"), ++ MT7988_TYPE0_PIN(62, "JTAG_JTRST_N"), ++ MT7988_TYPE1_PIN(63, "USB_DRV_VBUS_P1"), ++ MT7988_TYPE0_PIN(64, "LED_A"), ++ MT7988_TYPE0_PIN(65, "LED_B"), ++ MT7988_TYPE0_PIN(66, "LED_C"), ++ MT7988_TYPE0_PIN(67, "LED_D"), ++ MT7988_TYPE0_PIN(68, "LED_E"), ++ MT7988_TYPE0_PIN(69, "GPIO_B"), ++ MT7988_TYPE0_PIN(70, "GPIO_C"), ++ MT7988_TYPE2_PIN(71, "I2C_2_SCL"), ++ MT7988_TYPE2_PIN(72, "I2C_2_SDA"), ++ MT7988_TYPE0_PIN(73, "PCIE30_2L_1_PRESET_N"), ++ MT7988_TYPE0_PIN(74, "PCIE30_1L_0_PRESET_N"), ++ MT7988_TYPE1_PIN(75, "PCIE30_2L_1_WAKE_N"), ++ MT7988_TYPE1_PIN(76, "PCIE30_2L_1_CLKREQ_N"), ++ MT7988_TYPE1_PIN(77, "PCIE30_1L_0_WAKE_N"), ++ MT7988_TYPE1_PIN(78, "PCIE30_1L_0_CLKREQ_N"), ++ MT7988_TYPE1_PIN(79, "USB_DRV_VBUS_P0"), ++ MT7988_TYPE0_PIN(80, "UART1_RXD"), ++ MT7988_TYPE0_PIN(81, "UART1_TXD"), ++ MT7988_TYPE0_PIN(82, "UART1_CTS"), ++ MT7988_TYPE0_PIN(83, "UART1_RTS"), ++}; ++ ++/* jtag */ ++static const int mt7988_tops_jtag0_0_pins[] = { 0, 1, 2, 3, 4 }; ++static const int mt7988_tops_jtag0_0_funcs[] = { 2, 2, 2, 2, 2 }; ++ ++static const int mt7988_wo0_jtag_pins[] = { 50, 51, 52, 53, 54 }; ++static const int mt7988_wo0_jtag_funcs[] = { 3, 3, 3, 3, 3 }; ++ ++static const int mt7988_wo1_jtag_pins[] = { 50, 51, 52, 53, 54 }; ++static const int mt7988_wo1_jtag_funcs[] = { 4, 4, 4, 4, 4 }; ++ ++static const int mt7988_wo2_jtag_pins[] = { 50, 51, 52, 53, 54 }; ++static const int mt7988_wo2_jtag_funcs[] = { 5, 5, 5, 5, 5 }; ++ ++static const int mt7988_jtag_pins[] = { 58, 59, 60, 61, 62 }; ++static const int mt7988_jtag_funcs[] = { 1, 1, 1, 1, 1 }; ++ ++static const int mt7988_tops_jtag0_1_pins[] = { 58, 59, 60, 61, 62 }; ++static const int mt7988_tops_jtag0_1_funcs[] = { 4, 4, 4, 4, 4 }; ++ ++/* int_usxgmii */ ++static const int mt7988_int_usxgmii_pins[] = { 2, 3 }; ++static const int mt7988_int_usxgmii_funcs[] = { 3, 3 }; ++ ++/* pwm */ ++static const int mt7988_pwm0_pins[] = { 57 }; ++static const int mt7988_pwm0_funcs[] = { 1 }; ++ ++static const int mt7988_pwm1_pins[] = { 21 }; ++static const int mt7988_pwm1_funcs[] = { 1 }; ++ ++static const int mt7988_pwm2_pins[] = { 80 }; ++static const int mt7988_pwm2_funcs[] = { 2 }; ++ ++static const int mt7988_pwm3_pins[] = { 81 }; ++static const int mt7988_pwm3_funcs[] = { 2 }; ++ ++static const int mt7988_pwm4_pins[] = { 82 }; ++static const int mt7988_pwm4_funcs[] = { 2 }; ++ ++static const int mt7988_pwm5_pins[] = { 83 }; ++static const int mt7988_pwm5_funcs[] = { 2 }; ++ ++static const int mt7988_pwm6_pins[] = { 69 }; ++static const int mt7988_pwm6_funcs[] = { 3 }; ++ ++static const int mt7988_pwm7_pins[] = { 70 }; ++static const int mt7988_pwm7_funcs[] = { 3 }; ++ ++/* dfd */ ++static const int mt7988_dfd_pins[] = { 0, 1, 2, 3, 4 }; ++static const int mt7988_dfd_funcs[] = { 4, 4, 4, 4, 4 }; ++ ++/* i2c */ ++static const int mt7988_xfi_phy0_i2c0_pins[] = { 0, 1 }; ++static const int mt7988_xfi_phy0_i2c0_funcs[] = { 5, 5 }; ++ ++static const int mt7988_xfi_phy1_i2c0_pins[] = { 0, 1 }; ++static const int mt7988_xfi_phy1_i2c0_funcs[] = { 6, 6 }; ++ ++static const int mt7988_xfi_phy_pll_i2c0_pins[] = { 3, 4 }; ++static const int mt7988_xfi_phy_pll_i2c0_funcs[] = { 5, 5 }; ++ ++static const int mt7988_xfi_phy_pll_i2c1_pins[] = { 3, 4 }; ++static const int mt7988_xfi_phy_pll_i2c1_funcs[] = { 6, 6 }; ++ ++static const int mt7988_i2c0_0_pins[] = { 5, 6 }; ++static const int mt7988_i2c0_0_funcs[] = { 2, 2 }; ++ ++static const int mt7988_i2c1_sfp_pins[] = { 5, 6 }; ++static const int mt7988_i2c1_sfp_funcs[] = { 4, 4 }; ++ ++static const int mt7988_xfi_pextp_phy0_i2c_pins[] = { 5, 6 }; ++static const int mt7988_xfi_pextp_phy0_i2c_funcs[] = { 5, 5 }; ++ ++static const int mt7988_xfi_pextp_phy1_i2c_pins[] = { 5, 6 }; ++static const int mt7988_xfi_pextp_phy1_i2c_funcs[] = { 6, 6 }; ++ ++static const int mt7988_i2c0_1_pins[] = { 15, 16 }; ++static const int mt7988_i2c0_1_funcs[] = { 1, 1 }; ++ ++static const int mt7988_u30_phy_i2c0_pins[] = { 15, 16 }; ++static const int mt7988_u30_phy_i2c0_funcs[] = { 2, 2 }; ++ ++static const int mt7988_u32_phy_i2c0_pins[] = { 15, 16 }; ++static const int mt7988_u32_phy_i2c0_funcs[] = { 3, 3 }; ++ ++static const int mt7988_xfi_phy0_i2c1_pins[] = { 15, 16 }; ++static const int mt7988_xfi_phy0_i2c1_funcs[] = { 5, 5 }; ++ ++static const int mt7988_xfi_phy1_i2c1_pins[] = { 15, 16 }; ++static const int mt7988_xfi_phy1_i2c1_funcs[] = { 6, 6 }; ++ ++static const int mt7988_xfi_phy_pll_i2c2_pins[] = { 15, 16 }; ++static const int mt7988_xfi_phy_pll_i2c2_funcs[] = { 7, 7 }; ++ ++static const int mt7988_i2c1_0_pins[] = { 17, 18 }; ++static const int mt7988_i2c1_0_funcs[] = { 1, 1 }; ++ ++static const int mt7988_u30_phy_i2c1_pins[] = { 17, 18 }; ++static const int mt7988_u30_phy_i2c1_funcs[] = { 2, 2 }; ++ ++static const int mt7988_u32_phy_i2c1_pins[] = { 17, 18 }; ++static const int mt7988_u32_phy_i2c1_funcs[] = { 3, 3 }; ++ ++static const int mt7988_xfi_phy_pll_i2c3_pins[] = { 17, 18 }; ++static const int mt7988_xfi_phy_pll_i2c3_funcs[] = { 4, 4 }; ++ ++static const int mt7988_sgmii0_i2c_pins[] = { 17, 18 }; ++static const int mt7988_sgmii0_i2c_funcs[] = { 5, 5 }; ++ ++static const int mt7988_sgmii1_i2c_pins[] = { 17, 18 }; ++static const int mt7988_sgmii1_i2c_funcs[] = { 6, 6 }; ++ ++static const int mt7988_i2c1_2_pins[] = { 69, 70 }; ++static const int mt7988_i2c1_2_funcs[] = { 2, 2 }; ++ ++static const int mt7988_i2c2_0_pins[] = { 69, 70 }; ++static const int mt7988_i2c2_0_funcs[] = { 4, 4 }; ++ ++static const int mt7988_i2c2_1_pins[] = { 71, 72 }; ++static const int mt7988_i2c2_1_funcs[] = { 1, 1 }; ++ ++/* eth */ ++static const int mt7988_mdc_mdio0_pins[] = { 5, 6 }; ++static const int mt7988_mdc_mdio0_funcs[] = { 1, 1 }; ++ ++static const int mt7988_2p5g_ext_mdio_pins[] = { 28, 29 }; ++static const int mt7988_2p5g_ext_mdio_funcs[] = { 6, 6 }; ++ ++static const int mt7988_gbe_ext_mdio_pins[] = { 30, 31 }; ++static const int mt7988_gbe_ext_mdio_funcs[] = { 6, 6 }; ++ ++static const int mt7988_mdc_mdio1_pins[] = { 69, 70 }; ++static const int mt7988_mdc_mdio1_funcs[] = { 1, 1 }; ++ ++/* pcie */ ++static const int mt7988_pcie_wake_n0_0_pins[] = { 7 }; ++static const int mt7988_pcie_wake_n0_0_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_clk_req_n0_0_pins[] = { 8 }; ++static const int mt7988_pcie_clk_req_n0_0_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_wake_n3_0_pins[] = { 9 }; ++static const int mt7988_pcie_wake_n3_0_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_clk_req_n3_pins[] = { 10 }; ++static const int mt7988_pcie_clk_req_n3_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_clk_req_n0_1_pins[] = { 10 }; ++static const int mt7988_pcie_clk_req_n0_1_funcs[] = { 2 }; ++ ++static const int mt7988_pcie_p0_phy_i2c_pins[] = { 7, 8 }; ++static const int mt7988_pcie_p0_phy_i2c_funcs[] = { 3, 3 }; ++ ++static const int mt7988_pcie_p1_phy_i2c_pins[] = { 7, 8 }; ++static const int mt7988_pcie_p1_phy_i2c_funcs[] = { 4, 4 }; ++ ++static const int mt7988_pcie_p3_phy_i2c_pins[] = { 9, 10 }; ++static const int mt7988_pcie_p3_phy_i2c_funcs[] = { 4, 4 }; ++ ++static const int mt7988_pcie_p2_phy_i2c_pins[] = { 7, 8 }; ++static const int mt7988_pcie_p2_phy_i2c_funcs[] = { 5, 5 }; ++ ++static const int mt7988_ckm_phy_i2c_pins[] = { 9, 10 }; ++static const int mt7988_ckm_phy_i2c_funcs[] = { 5, 5 }; ++ ++static const int mt7988_pcie_wake_n0_1_pins[] = { 13 }; ++static const int mt7988_pcie_wake_n0_1_funcs[] = { 2 }; ++ ++static const int mt7988_pcie_wake_n3_1_pins[] = { 14 }; ++static const int mt7988_pcie_wake_n3_1_funcs[] = { 2 }; ++ ++static const int mt7988_pcie_2l_0_pereset_pins[] = { 19 }; ++static const int mt7988_pcie_2l_0_pereset_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_1l_1_pereset_pins[] = { 20 }; ++static const int mt7988_pcie_1l_1_pereset_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_clk_req_n2_1_pins[] = { 63 }; ++static const int mt7988_pcie_clk_req_n2_1_funcs[] = { 2 }; ++ ++static const int mt7988_pcie_2l_1_pereset_pins[] = { 73 }; ++static const int mt7988_pcie_2l_1_pereset_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_1l_0_pereset_pins[] = { 74 }; ++static const int mt7988_pcie_1l_0_pereset_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_wake_n1_0_pins[] = { 75 }; ++static const int mt7988_pcie_wake_n1_0_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_clk_req_n1_pins[] = { 76 }; ++static const int mt7988_pcie_clk_req_n1_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_wake_n2_0_pins[] = { 77 }; ++static const int mt7988_pcie_wake_n2_0_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_clk_req_n2_0_pins[] = { 78 }; ++static const int mt7988_pcie_clk_req_n2_0_funcs[] = { 1 }; ++ ++static const int mt7988_pcie_wake_n2_1_pins[] = { 79 }; ++static const int mt7988_pcie_wake_n2_1_funcs[] = { 2 }; ++ ++/* pmic */ ++static const int mt7988_pmic_pins[] = { 11 }; ++static const int mt7988_pmic_funcs[] = { 1 }; ++ ++/* watchdog */ ++static const int mt7988_watchdog_pins[] = { 12 }; ++static const int mt7988_watchdog_funcs[] = { 1 }; ++ ++/* spi */ ++static const int mt7988_spi0_wp_hold_pins[] = { 22, 23 }; ++static const int mt7988_spi0_wp_hold_funcs[] = { 1, 1 }; ++ ++static const int mt7988_spi0_pins[] = { 24, 25, 26, 27 }; ++static const int mt7988_spi0_funcs[] = { 1, 1, 1, 1 }; ++ ++static const int mt7988_spi1_pins[] = { 28, 29, 30, 31 }; ++static const int mt7988_spi1_funcs[] = { 1, 1, 1, 1 }; ++ ++static const int mt7988_spi2_pins[] = { 32, 33, 34, 35 }; ++static const int mt7988_spi2_funcs[] = { 1, 1, 1, 1 }; ++ ++static const int mt7988_spi2_wp_hold_pins[] = { 36, 37 }; ++static const int mt7988_spi2_wp_hold_funcs[] = { 1, 1 }; ++ ++/* flash */ ++static const int mt7988_snfi_pins[] = { 22, 23, 24, 25, 26, 27 }; ++static const int mt7988_snfi_funcs[] = { 2, 2, 2, 2, 2, 2 }; ++ ++static const int mt7988_emmc_45_pins[] = { ++ 21, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37 }; ++static const int mt7988_emmc_45_funcs[] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }; ++ ++static const int mt7988_emmc_51_pins[] = { ++ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 }; ++static const int mt7988_emmc_51_funcs[] = { ++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; ++ ++/* uart */ ++static const int mt7988_uart2_pins[] = { 0, 1, 2, 3 }; ++static const int mt7988_uart2_funcs[] = { 1, 1, 1, 1 }; ++ ++static const int mt7988_tops_uart0_0_pins[] = { 22, 23 }; ++static const int mt7988_tops_uart0_0_funcs[] = { 3, 3 }; ++ ++static const int mt7988_uart2_0_pins[] = { 28, 29, 30, 31 }; ++static const int mt7988_uart2_0_funcs[] = { 2, 2, 2, 2 }; ++ ++static const int mt7988_uart1_0_pins[] = { 32, 33, 34, 35 }; ++static const int mt7988_uart1_0_funcs[] = { 2, 2, 2, 2 }; ++ ++static const int mt7988_uart2_1_pins[] = { 32, 33, 34, 35 }; ++static const int mt7988_uart2_1_funcs[] = { 3, 3, 3, 3 }; ++ ++static const int mt7988_net_wo0_uart_txd_0_pins[] = { 28 }; ++static const int mt7988_net_wo0_uart_txd_0_funcs[] = { 3 }; ++ ++static const int mt7988_net_wo1_uart_txd_0_pins[] = { 29 }; ++static const int mt7988_net_wo1_uart_txd_0_funcs[] = { 3 }; ++ ++static const int mt7988_net_wo2_uart_txd_0_pins[] = { 30 }; ++static const int mt7988_net_wo2_uart_txd_0_funcs[] = { 3 }; ++ ++static const int mt7988_tops_uart1_0_pins[] = { 28, 29 }; ++static const int mt7988_tops_uart1_0_funcs[] = { 4, 4 }; ++ ++static const int mt7988_tops_uart0_1_pins[] = { 30, 31 }; ++static const int mt7988_tops_uart0_1_funcs[] = { 4, 4 }; ++ ++static const int mt7988_tops_uart1_1_pins[] = { 36, 37 }; ++static const int mt7988_tops_uart1_1_funcs[] = { 3, 3 }; ++ ++static const int mt7988_uart0_pins[] = { 55, 56 }; ++static const int mt7988_uart0_funcs[] = { 1, 1 }; ++ ++static const int mt7988_tops_uart0_2_pins[] = { 55, 56 }; ++static const int mt7988_tops_uart0_2_funcs[] = { 2, 2 }; ++ ++static const int mt7988_uart2_2_pins[] = { 50, 51, 52, 53 }; ++static const int mt7988_uart2_2_funcs[] = { 2, 2, 2, 2 }; ++ ++static const int mt7988_uart1_1_pins[] = { 58, 59, 60, 61 }; ++static const int mt7988_uart1_1_funcs[] = { 2, 2, 2, 2 }; ++ ++static const int mt7988_uart2_3_pins[] = { 58, 59, 60, 61 }; ++static const int mt7988_uart2_3_funcs[] = { 3, 3, 3, 3 }; ++ ++static const int mt7988_uart1_2_pins[] = { 80, 81, 82, 83 }; ++static const int mt7988_uart1_2_funcs[] = { 1, 1, 1, 1 }; ++ ++static const int mt7988_tops_uart1_2_pins[] = { 80, 81 }; ++static const int mt7988_tops_uart1_2_funcs[] = { 4, 4, }; ++ ++static const int mt7988_net_wo0_uart_txd_1_pins[] = { 80 }; ++static const int mt7988_net_wo0_uart_txd_1_funcs[] = { 3 }; ++ ++static const int mt7988_net_wo1_uart_txd_1_pins[] = { 81 }; ++static const int mt7988_net_wo1_uart_txd_1_funcs[] = { 3 }; ++ ++static const int mt7988_net_wo2_uart_txd_1_pins[] = { 82 }; ++static const int mt7988_net_wo2_uart_txd_1_funcs[] = { 3 }; ++ ++/* udi */ ++static const int mt7988_udi_pins[] = { 32, 33, 34, 35, 36 }; ++static const int mt7988_udi_funcs[] = { 4, 4, 4, 4, 4 }; ++ ++/* pcm */ ++static const int mt7988_pcm_pins[] = { 50, 51, 52, 53, 54 }; ++static const int mt7988_pcm_funcs[] = { 1, 1, 1, 1, 1 }; ++ ++/* led */ ++static const int mt7988_gbe_led1_pins[] = { 58, 59, 60, 61 }; ++static const int mt7988_gbe_led1_funcs[] = { 6, 6, 6, 6 }; ++ ++static const int mt7988_2p5gbe_led1_pins[] = { 62 }; ++static const int mt7988_2p5gbe_led1_funcs[] = { 6 }; ++ ++static const int mt7988_gbe_led0_pins[] = { 64, 65, 66, 67 }; ++static const int mt7988_gbe_led0_funcs[] = { 1, 1, 1, 1 }; ++ ++static const int mt7988_2p5gbe_led0_pins[] = { 68 }; ++static const int mt7988_2p5gbe_led0_funcs[] = { 1 }; ++ ++/* usb */ ++static const int mt7988_drv_vbus_p1_pins[] = { 63 }; ++static const int mt7988_drv_vbus_p1_funcs[] = { 1 }; ++ ++static const int mt7988_drv_vbus_pins[] = { 79 }; ++static const int mt7988_drv_vbus_funcs[] = { 1 }; ++ ++static const struct mtk_group_desc mt7988_groups[] = { ++ PINCTRL_PIN_GROUP("uart2", mt7988_uart2), ++ PINCTRL_PIN_GROUP("tops_jtag0_0", mt7988_tops_jtag0_0), ++ PINCTRL_PIN_GROUP("int_usxgmii", mt7988_int_usxgmii), ++ PINCTRL_PIN_GROUP("dfd", mt7988_dfd), ++ PINCTRL_PIN_GROUP("xfi_phy0_i2c0", mt7988_xfi_phy0_i2c0), ++ PINCTRL_PIN_GROUP("xfi_phy1_i2c0", mt7988_xfi_phy1_i2c0), ++ PINCTRL_PIN_GROUP("xfi_phy_pll_i2c0", mt7988_xfi_phy_pll_i2c0), ++ PINCTRL_PIN_GROUP("xfi_phy_pll_i2c1", mt7988_xfi_phy_pll_i2c1), ++ PINCTRL_PIN_GROUP("i2c0_0", mt7988_i2c0_0), ++ PINCTRL_PIN_GROUP("i2c1_sfp", mt7988_i2c1_sfp), ++ PINCTRL_PIN_GROUP("xfi_pextp_phy0_i2c", mt7988_xfi_pextp_phy0_i2c), ++ PINCTRL_PIN_GROUP("xfi_pextp_phy1_i2c", mt7988_xfi_pextp_phy1_i2c), ++ PINCTRL_PIN_GROUP("mdc_mdio0", mt7988_mdc_mdio0), ++ PINCTRL_PIN_GROUP("pcie_wake_n0_0", mt7988_pcie_wake_n0_0), ++ PINCTRL_PIN_GROUP("pcie_clk_req_n0_0", mt7988_pcie_clk_req_n0_0), ++ PINCTRL_PIN_GROUP("pcie_wake_n3_0", mt7988_pcie_wake_n3_0), ++ PINCTRL_PIN_GROUP("pcie_clk_req_n3", mt7988_pcie_clk_req_n3), ++ PINCTRL_PIN_GROUP("pcie_clk_req_n0_1", mt7988_pcie_clk_req_n0_1), ++ PINCTRL_PIN_GROUP("pcie_p0_phy_i2c", mt7988_pcie_p0_phy_i2c), ++ PINCTRL_PIN_GROUP("pcie_p1_phy_i2c", mt7988_pcie_p1_phy_i2c), ++ PINCTRL_PIN_GROUP("pcie_p2_phy_i2c", mt7988_pcie_p2_phy_i2c), ++ PINCTRL_PIN_GROUP("pcie_p3_phy_i2c", mt7988_pcie_p3_phy_i2c), ++ PINCTRL_PIN_GROUP("ckm_phy_i2c", mt7988_ckm_phy_i2c), ++ PINCTRL_PIN_GROUP("pcie_pmic", mt7988_pmic), ++ PINCTRL_PIN_GROUP("watchdog", mt7988_watchdog), ++ PINCTRL_PIN_GROUP("pcie_wake_n0_1", mt7988_pcie_wake_n0_1), ++ PINCTRL_PIN_GROUP("pcie_wake_n3_1", mt7988_pcie_wake_n3_1), ++ PINCTRL_PIN_GROUP("i2c0_1", mt7988_i2c0_1), ++ PINCTRL_PIN_GROUP("u30_phy_i2c0", mt7988_u30_phy_i2c0), ++ PINCTRL_PIN_GROUP("u32_phy_i2c0", mt7988_u32_phy_i2c0), ++ PINCTRL_PIN_GROUP("xfi_phy0_i2c1", mt7988_xfi_phy0_i2c1), ++ PINCTRL_PIN_GROUP("xfi_phy1_i2c1", mt7988_xfi_phy1_i2c1), ++ PINCTRL_PIN_GROUP("xfi_phy_pll_i2c2", mt7988_xfi_phy_pll_i2c2), ++ PINCTRL_PIN_GROUP("i2c1_0", mt7988_i2c1_0), ++ PINCTRL_PIN_GROUP("u30_phy_i2c1", mt7988_u30_phy_i2c1), ++ PINCTRL_PIN_GROUP("u32_phy_i2c1", mt7988_u32_phy_i2c1), ++ PINCTRL_PIN_GROUP("xfi_phy_pll_i2c3", mt7988_xfi_phy_pll_i2c3), ++ PINCTRL_PIN_GROUP("sgmii0_i2c", mt7988_sgmii0_i2c), ++ PINCTRL_PIN_GROUP("sgmii1_i2c", mt7988_sgmii1_i2c), ++ PINCTRL_PIN_GROUP("pcie_2l_0_pereset", mt7988_pcie_2l_0_pereset), ++ PINCTRL_PIN_GROUP("pcie_1l_1_pereset", mt7988_pcie_1l_1_pereset), ++ PINCTRL_PIN_GROUP("pwm1", mt7988_pwm1), ++ PINCTRL_PIN_GROUP("spi0_wp_hold", mt7988_spi0_wp_hold), ++ PINCTRL_PIN_GROUP("spi0", mt7988_spi0), ++ PINCTRL_PIN_GROUP("spi1", mt7988_spi1), ++ PINCTRL_PIN_GROUP("spi2", mt7988_spi2), ++ PINCTRL_PIN_GROUP("spi2_wp_hold", mt7988_spi2_wp_hold), ++ PINCTRL_PIN_GROUP("snfi", mt7988_snfi), ++ PINCTRL_PIN_GROUP("tops_uart0_0", mt7988_tops_uart0_0), ++ PINCTRL_PIN_GROUP("uart2_0", mt7988_uart2_0), ++ PINCTRL_PIN_GROUP("uart1_0", mt7988_uart1_0), ++ PINCTRL_PIN_GROUP("uart2_1", mt7988_uart2_1), ++ PINCTRL_PIN_GROUP("net_wo0_uart_txd_0", mt7988_net_wo0_uart_txd_0), ++ PINCTRL_PIN_GROUP("net_wo1_uart_txd_0", mt7988_net_wo1_uart_txd_0), ++ PINCTRL_PIN_GROUP("net_wo2_uart_txd_0", mt7988_net_wo2_uart_txd_0), ++ PINCTRL_PIN_GROUP("tops_uart0_0", mt7988_tops_uart1_0), ++ PINCTRL_PIN_GROUP("tops_uart0_1", mt7988_tops_uart0_1), ++ PINCTRL_PIN_GROUP("tops_uart1_1", mt7988_tops_uart1_1), ++ PINCTRL_PIN_GROUP("udi", mt7988_udi), ++ PINCTRL_PIN_GROUP("emmc_45", mt7988_emmc_45), ++ PINCTRL_PIN_GROUP("emmc_51", mt7988_emmc_51), ++ PINCTRL_PIN_GROUP("2p5g_ext_mdio", mt7988_2p5g_ext_mdio), ++ PINCTRL_PIN_GROUP("gbe_ext_mdio", mt7988_gbe_ext_mdio), ++ PINCTRL_PIN_GROUP("pcm", mt7988_pcm), ++ PINCTRL_PIN_GROUP("uart0", mt7988_uart0), ++ PINCTRL_PIN_GROUP("tops_uart0_2", mt7988_tops_uart0_2), ++ PINCTRL_PIN_GROUP("uart2_2", mt7988_uart2_2), ++ PINCTRL_PIN_GROUP("wo0_jtag", mt7988_wo0_jtag), ++ PINCTRL_PIN_GROUP("wo1_jtag", mt7988_wo1_jtag), ++ PINCTRL_PIN_GROUP("wo2_jtag", mt7988_wo2_jtag), ++ PINCTRL_PIN_GROUP("pwm0", mt7988_pwm0), ++ PINCTRL_PIN_GROUP("jtag", mt7988_jtag), ++ PINCTRL_PIN_GROUP("tops_jtag0_1", mt7988_tops_jtag0_1), ++ PINCTRL_PIN_GROUP("uart2_3", mt7988_uart2_3), ++ PINCTRL_PIN_GROUP("uart1_1", mt7988_uart1_1), ++ PINCTRL_PIN_GROUP("gbe_led1", mt7988_gbe_led1), ++ PINCTRL_PIN_GROUP("2p5gbe_led1", mt7988_2p5gbe_led1), ++ PINCTRL_PIN_GROUP("gbe_led0", mt7988_gbe_led0), ++ PINCTRL_PIN_GROUP("2p5gbe_led0", mt7988_2p5gbe_led0), ++ PINCTRL_PIN_GROUP("drv_vbus_p1", mt7988_drv_vbus_p1), ++ PINCTRL_PIN_GROUP("pcie_clk_req_n2_1", mt7988_pcie_clk_req_n2_1), ++ PINCTRL_PIN_GROUP("mdc_mdio1", mt7988_mdc_mdio1), ++ PINCTRL_PIN_GROUP("i2c1_2", mt7988_i2c1_2), ++ PINCTRL_PIN_GROUP("pwm6", mt7988_pwm6), ++ PINCTRL_PIN_GROUP("pwm7", mt7988_pwm7), ++ PINCTRL_PIN_GROUP("i2c2_0", mt7988_i2c2_0), ++ PINCTRL_PIN_GROUP("i2c2_1", mt7988_i2c2_1), ++ PINCTRL_PIN_GROUP("pcie_2l_1_pereset", mt7988_pcie_2l_1_pereset), ++ PINCTRL_PIN_GROUP("pcie_1l_0_pereset", mt7988_pcie_1l_0_pereset), ++ PINCTRL_PIN_GROUP("pcie_wake_n1_0", mt7988_pcie_wake_n1_0), ++ PINCTRL_PIN_GROUP("pcie_clk_req_n1", mt7988_pcie_clk_req_n1), ++ PINCTRL_PIN_GROUP("pcie_wake_n2_0", mt7988_pcie_wake_n2_0), ++ PINCTRL_PIN_GROUP("pcie_clk_req_n2_0", mt7988_pcie_clk_req_n2_0), ++ PINCTRL_PIN_GROUP("drv_vbus", mt7988_drv_vbus), ++ PINCTRL_PIN_GROUP("pcie_wake_n2_1", mt7988_pcie_wake_n2_1), ++ PINCTRL_PIN_GROUP("uart1_2", mt7988_uart1_2), ++ PINCTRL_PIN_GROUP("pwm2", mt7988_pwm2), ++ PINCTRL_PIN_GROUP("pwm3", mt7988_pwm3), ++ PINCTRL_PIN_GROUP("pwm4", mt7988_pwm4), ++ PINCTRL_PIN_GROUP("pwm5", mt7988_pwm5), ++ PINCTRL_PIN_GROUP("net_wo0_uart_txd_0", mt7988_net_wo0_uart_txd_0), ++ PINCTRL_PIN_GROUP("net_wo1_uart_txd_0", mt7988_net_wo1_uart_txd_0), ++ PINCTRL_PIN_GROUP("net_wo2_uart_txd_0", mt7988_net_wo2_uart_txd_0), ++ PINCTRL_PIN_GROUP("tops_uart1_2", mt7988_tops_uart1_2), ++ PINCTRL_PIN_GROUP("net_wo0_uart_txd_1", mt7988_net_wo0_uart_txd_1), ++ PINCTRL_PIN_GROUP("net_wo1_uart_txd_1", mt7988_net_wo1_uart_txd_1), ++ PINCTRL_PIN_GROUP("net_wo2_uart_txd_1", mt7988_net_wo2_uart_txd_1), ++}; ++ ++static const struct mtk_io_type_desc mt7988_io_type_desc[] = { ++ [IO_TYPE_GRP0] = { ++ .name = "18OD33", ++ .bias_set = mtk_pinconf_bias_set_pupd_r1_r0, ++ .drive_set = mtk_pinconf_drive_set_v1, ++ .input_enable = mtk_pinconf_input_enable_v1, ++ }, ++ [IO_TYPE_GRP1] = { ++ .name = "18A01", ++ .bias_set = mtk_pinconf_bias_set_pu_pd, ++ .drive_set = mtk_pinconf_drive_set_v1, ++ .input_enable = mtk_pinconf_input_enable_v1, ++ }, ++ [IO_TYPE_GRP2] = { ++ .name = "I2C", ++ .input_enable = mtk_pinconf_input_enable_v1, ++ }, ++}; ++ ++/* Joint those groups owning the same capability in user point of view which ++ * allows that people tend to use through the device tree. ++ */ ++static const char *const mt7988_jtag_groups[] = { "tops_jtag0_0", "wo0_jtag", ++ "wo1_jtag", "wo2_jtag", "jtag", "tops_jtag0_1", }; ++static const char *const mt7988_int_usxgmii_groups[] = { "int_usxgmii", }; ++static const char *const mt7988_pwm_groups[] = { "pwm0", "pwm1", "pwm2", "pwm3", ++ "pwm4", "pwm5", "pwm6", "pwm7" }; ++static const char *const mt7988_dfd_groups[] = { "dfd", }; ++static const char *const mt7988_i2c_groups[] = { "xfi_phy0_i2c0", ++ "xfi_phy1_i2c0", "xfi_phy_pll_i2c0", "xfi_phy_pll_i2c1", "i2c0_0", ++ "i2c1_sfp", "xfi_pextp_phy0_i2c", "xfi_pextp_phy1_i2c", "i2c0_1", ++ "u30_phy_i2c0", "u32_phy_i2c0", "xfi_phy0_i2c1", "xfi_phy1_i2c1", ++ "xfi_phy_pll_i2c2", "i2c1_0", "u30_phy_i2c1", "u32_phy_i2c1", ++ "xfi_phy_pll_i2c3", "sgmii0_i2c", "sgmii1_i2c", "i2c1_2", "i2c2_0", ++ "i2c2_1", }; ++static const char *const mt7988_ethernet_groups[] = { "mdc_mdio0", ++ "2p5g_ext_mdio", "gbe_ext_mdio", "mdc_mdio1", }; ++static const char *const mt7988_pcie_groups[] = { "pcie_wake_n0_0", ++ "pcie_clk_req_n0_0", "pcie_wake_n3_0", "pcie_clk_req_n3", ++ "pcie_p0_phy_i2c", "pcie_p1_phy_i2c", "pcie_p3_phy_i2", ++ "pcie_p2_phy_i2c", "ckm_phy_i2c", "pcie_wake_n0_1", "pcie_wake_n3_1", ++ "pcie_2l_0_pereset", "pcie_1l_1_pereset", "pcie_clk_req_n2_1", ++ "pcie_2l_1_perese", "pcie_1l_0_pereset", "pcie_wake_n1_0", ++ "cie_clk_req_n1", "pcie_wake_n2_0", "pcie_wake_n2_1", }; ++static const char *const mt7988_pmic_groups[] = { "pmic", }; ++static const char *const mt7988_wdt_groups[] = { "watchdog", }; ++static const char *const mt7988_spi_groups[] = { "spi0", "spi0_wp_hold", ++ "spi1", "spi2", "spi2_wp_hold", }; ++static const char *const mt7988_flash_groups[] = { "emmc_45", "snfi", ++ "emmc_51" }; ++static const char *const mt7988_uart_groups[] = { "uart2", "tops_uart0_0", ++ "uart2_0", "uart1_0", "uart2_1", ++ "net_wo0_uart_txd_0", "net_wo1_uart_txd_0", "net_wo2_uart_txd_0", ++ "tops_uart1_0", "ops_uart0_1", "ops_uart1_1", ++ "uart0", "tops_uart0_2", "uart1_1", ++ "uart2_3", "uart1_2", "tops_uart1_2", ++ "net_wo0_uart_txd_1", "net_wo1_uart_txd_1", "net_wo2_uart_txd_1", }; ++static const char *const mt7988_udi_groups[] = { "udi", }; ++static const char *const mt7988_pcm_groups[] = { "pcm", }; ++static const char *const mt7988_led_groups[] = { "gbe_led1", "2p5gbe_led1", ++ "gbe_led0", "2p5gbe_led0", "wf5g_led0", "wf5g_led1", }; ++static const char *const mt7988_usb_groups[] = { "drv_vbus", "drv_vbus_p1", }; ++ ++static const struct mtk_function_desc mt7988_functions[] = { ++ {"jtag", mt7988_jtag_groups, ARRAY_SIZE(mt7988_jtag_groups)}, ++ {"int_usxgmii", mt7988_int_usxgmii_groups, ++ ARRAY_SIZE(mt7988_int_usxgmii_groups)}, ++ {"pwm", mt7988_pwm_groups, ARRAY_SIZE(mt7988_pwm_groups)}, ++ {"dfd", mt7988_dfd_groups, ARRAY_SIZE(mt7988_dfd_groups)}, ++ {"i2c", mt7988_i2c_groups, ARRAY_SIZE(mt7988_i2c_groups)}, ++ {"eth", mt7988_ethernet_groups, ARRAY_SIZE(mt7988_ethernet_groups)}, ++ {"pcie", mt7988_pcie_groups, ARRAY_SIZE(mt7988_pcie_groups)}, ++ {"pmic", mt7988_pmic_groups, ARRAY_SIZE(mt7988_pmic_groups)}, ++ {"watchdog", mt7988_wdt_groups, ARRAY_SIZE(mt7988_wdt_groups)}, ++ {"spi", mt7988_spi_groups, ARRAY_SIZE(mt7988_spi_groups)}, ++ {"flash", mt7988_flash_groups, ARRAY_SIZE(mt7988_flash_groups)}, ++ {"uart", mt7988_uart_groups, ARRAY_SIZE(mt7988_uart_groups)}, ++ {"udi", mt7988_udi_groups, ARRAY_SIZE(mt7988_udi_groups)}, ++ {"pcm", mt7988_pcm_groups, ARRAY_SIZE(mt7988_pcm_groups)}, ++ {"usb", mt7988_usb_groups, ARRAY_SIZE(mt7988_usb_groups)}, ++ {"led", mt7988_led_groups, ARRAY_SIZE(mt7988_led_groups)}, ++}; ++ ++static const char *const mt7988_pinctrl_register_base_names[] = { ++ "gpio_base", "iocfg_tr_base", "iocfg_br_base", "iocfg_rb_base", ++ "iocfg_lb_base", "iocfg_tl_base", ++}; ++ ++static const struct mtk_pinctrl_soc mt7988_data = { ++ .name = "mt7988_pinctrl", ++ .reg_cal = mt7988_reg_cals, ++ .pins = mt7988_pins, ++ .npins = ARRAY_SIZE(mt7988_pins), ++ .grps = mt7988_groups, ++ .ngrps = ARRAY_SIZE(mt7988_groups), ++ .funcs = mt7988_functions, ++ .nfuncs = ARRAY_SIZE(mt7988_functions), ++ .io_type = mt7988_io_type_desc, ++ .ntype = ARRAY_SIZE(mt7988_io_type_desc), ++ .gpio_mode = 0, ++ .base_names = mt7988_pinctrl_register_base_names, ++ .nbase_names = ARRAY_SIZE(mt7988_pinctrl_register_base_names), ++ .base_calc = 1, ++}; ++ ++static int mtk_pinctrl_mt7988_probe(struct udevice *dev) ++{ ++ return mtk_pinctrl_common_probe(dev, &mt7988_data); ++} ++ ++static const struct udevice_id mt7988_pctrl_match[] = { ++ {.compatible = "mediatek,mt7988-pinctrl"}, ++ { /* sentinel */ } ++}; ++ ++U_BOOT_DRIVER(mt7988_pinctrl) = { ++ .name = "mt7988_pinctrl", ++ .id = UCLASS_PINCTRL, ++ .of_match = mt7988_pctrl_match, ++ .ops = &mtk_pinctrl_ops, ++ .probe = mtk_pinctrl_mt7988_probe, ++ .priv_auto = sizeof(struct mtk_pinctrl_priv), ++}; diff --git a/package/boot/uboot-mediatek/patches/101-16-net-mediatek-connect-switch-to-PSE-only-when-startin.patch b/package/boot/uboot-mediatek/patches/101-16-net-mediatek-connect-switch-to-PSE-only-when-startin.patch new file mode 100644 index 00000000000000..e3e6212742b6f5 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-16-net-mediatek-connect-switch-to-PSE-only-when-startin.patch @@ -0,0 +1,138 @@ +From a0405999ebecf21ed9f76f1dc9420682cd3feba0 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:54 +0800 +Subject: [PATCH 16/29] net: mediatek: connect switch to PSE only when starting + eth is requested + +So far the switch is initialized in probe stage and is connected to PSE +unconditionally. This will cause all packets being flooded to PSE and may +cause PSE hang before entering linux. + +This patch changes the connection between switch and PSE: +- Still initialize switch in probe stage, but disconnect it with PSE +- Connect switch with PSE on eth start +- Disconnect on eth stop + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 44 ++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 41 insertions(+), 3 deletions(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -123,8 +123,10 @@ struct mtk_eth_priv { + + enum mtk_switch sw; + int (*switch_init)(struct mtk_eth_priv *priv); ++ void (*switch_mac_control)(struct mtk_eth_priv *priv, bool enable); + u32 mt753x_smi_addr; + u32 mt753x_phy_base; ++ u32 mt753x_pmcr; + + struct gpio_desc rst_gpio; + int mcm; +@@ -613,6 +615,16 @@ static int mt7530_pad_clk_setup(struct m + return 0; + } + ++static void mt7530_mac_control(struct mtk_eth_priv *priv, bool enable) ++{ ++ u32 pmcr = FORCE_MODE; ++ ++ if (enable) ++ pmcr = priv->mt753x_pmcr; ++ ++ mt753x_reg_write(priv, PMCR_REG(6), pmcr); ++} ++ + static int mt7530_setup(struct mtk_eth_priv *priv) + { + u16 phy_addr, phy_val; +@@ -663,11 +675,14 @@ static int mt7530_setup(struct mtk_eth_p + FORCE_DPX | FORCE_LINK; + + /* MT7530 Port6: Forced 1000M/FD, FC disabled */ +- mt753x_reg_write(priv, PMCR_REG(6), val); ++ priv->mt753x_pmcr = val; + + /* MT7530 Port5: Forced link down */ + mt753x_reg_write(priv, PMCR_REG(5), FORCE_MODE); + ++ /* Keep MAC link down before starting eth */ ++ mt753x_reg_write(priv, PMCR_REG(6), FORCE_MODE); ++ + /* MT7530 Port6: Set to RGMII */ + mt753x_reg_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_M, P6_INTF_MODE_RGMII); + +@@ -823,6 +838,17 @@ static void mt7531_phy_setting(struct mt + } + } + ++static void mt7531_mac_control(struct mtk_eth_priv *priv, bool enable) ++{ ++ u32 pmcr = FORCE_MODE_LNK; ++ ++ if (enable) ++ pmcr = priv->mt753x_pmcr; ++ ++ mt753x_reg_write(priv, PMCR_REG(5), pmcr); ++ mt753x_reg_write(priv, PMCR_REG(6), pmcr); ++} ++ + static int mt7531_setup(struct mtk_eth_priv *priv) + { + u16 phy_addr, phy_val; +@@ -882,8 +908,11 @@ static int mt7531_setup(struct mtk_eth_p + (SPEED_1000M << FORCE_SPD_S) | FORCE_DPX | + FORCE_LINK; + +- mt753x_reg_write(priv, PMCR_REG(5), pmcr); +- mt753x_reg_write(priv, PMCR_REG(6), pmcr); ++ priv->mt753x_pmcr = pmcr; ++ ++ /* Keep MAC link down before starting eth */ ++ mt753x_reg_write(priv, PMCR_REG(5), FORCE_MODE_LNK); ++ mt753x_reg_write(priv, PMCR_REG(6), FORCE_MODE_LNK); + + /* Turn on PHYs */ + for (i = 0; i < MT753X_NUM_PHYS; i++) { +@@ -1227,6 +1256,9 @@ static int mtk_eth_start(struct udevice + + mtk_eth_fifo_init(priv); + ++ if (priv->switch_mac_control) ++ priv->switch_mac_control(priv, true); ++ + /* Start PHY */ + if (priv->sw == SW_NONE) { + ret = mtk_phy_start(priv); +@@ -1245,6 +1277,9 @@ static void mtk_eth_stop(struct udevice + { + struct mtk_eth_priv *priv = dev_get_priv(dev); + ++ if (priv->switch_mac_control) ++ priv->switch_mac_control(priv, false); ++ + mtk_pdma_rmw(priv, PDMA_GLO_CFG_REG, + TX_WB_DDONE | RX_DMA_EN | TX_DMA_EN, 0); + udelay(500); +@@ -1484,16 +1519,19 @@ static int mtk_eth_of_to_plat(struct ude + /* check for switch first, otherwise phy will be used */ + priv->sw = SW_NONE; + priv->switch_init = NULL; ++ priv->switch_mac_control = NULL; + str = dev_read_string(dev, "mediatek,switch"); + + if (str) { + if (!strcmp(str, "mt7530")) { + priv->sw = SW_MT7530; + priv->switch_init = mt7530_setup; ++ priv->switch_mac_control = mt7530_mac_control; + priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR; + } else if (!strcmp(str, "mt7531")) { + priv->sw = SW_MT7531; + priv->switch_init = mt7531_setup; ++ priv->switch_mac_control = mt7531_mac_control; + priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR; + } else { + printf("error: unsupported switch\n"); diff --git a/package/boot/uboot-mediatek/patches/101-17-net-mediatek-optimize-the-switch-reset-delay-wait-ti.patch b/package/boot/uboot-mediatek/patches/101-17-net-mediatek-optimize-the-switch-reset-delay-wait-ti.patch new file mode 100644 index 00000000000000..c8823ac545ce4a --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-17-net-mediatek-optimize-the-switch-reset-delay-wait-ti.patch @@ -0,0 +1,56 @@ +From d9a52701f6677889cc3332ab7a888f35cd69cc76 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:16:59 +0800 +Subject: [PATCH 17/29] net: mediatek: optimize the switch reset delay wait + time + +Not all switches requires 1 second delay after deasserting reset. +MT7531 requires only maximum 200ms. + +This patch defines dedicated reset wait time for each switch chip, and will +significantly improve the boot time for boards using MT7531. + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -127,6 +127,7 @@ struct mtk_eth_priv { + u32 mt753x_smi_addr; + u32 mt753x_phy_base; + u32 mt753x_pmcr; ++ u32 mt753x_reset_wait_time; + + struct gpio_desc rst_gpio; + int mcm; +@@ -943,12 +944,12 @@ int mt753x_switch_init(struct mtk_eth_pr + reset_assert(&priv->rst_mcm); + udelay(1000); + reset_deassert(&priv->rst_mcm); +- mdelay(1000); ++ mdelay(priv->mt753x_reset_wait_time); + } else if (dm_gpio_is_valid(&priv->rst_gpio)) { + dm_gpio_set_value(&priv->rst_gpio, 0); + udelay(1000); + dm_gpio_set_value(&priv->rst_gpio, 1); +- mdelay(1000); ++ mdelay(priv->mt753x_reset_wait_time); + } + + ret = priv->switch_init(priv); +@@ -1528,11 +1529,13 @@ static int mtk_eth_of_to_plat(struct ude + priv->switch_init = mt7530_setup; + priv->switch_mac_control = mt7530_mac_control; + priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR; ++ priv->mt753x_reset_wait_time = 1000; + } else if (!strcmp(str, "mt7531")) { + priv->sw = SW_MT7531; + priv->switch_init = mt7531_setup; + priv->switch_mac_control = mt7531_mac_control; + priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR; ++ priv->mt753x_reset_wait_time = 200; + } else { + printf("error: unsupported switch\n"); + return -EINVAL; diff --git a/package/boot/uboot-mediatek/patches/101-18-net-mediatek-fix-direct-MDIO-clause-45-access-via-So.patch b/package/boot/uboot-mediatek/patches/101-18-net-mediatek-fix-direct-MDIO-clause-45-access-via-So.patch new file mode 100644 index 00000000000000..5214e842c82656 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-18-net-mediatek-fix-direct-MDIO-clause-45-access-via-So.patch @@ -0,0 +1,34 @@ +From c44f6ac1a31961b0d4faf982ee42167de5ac1672 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:03 +0800 +Subject: [PATCH 18/29] net: mediatek: fix direct MDIO clause 45 access via SoC + +The original direct MDIO clause 45 access via SoC is missing the +data output. This patch adds it back to ensure MDIO clause 45 can +work properly for external PHYs. + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -198,7 +198,7 @@ static int mtk_mii_rw(struct mtk_eth_pri + (((u32)phy << MDIO_PHY_ADDR_S) & MDIO_PHY_ADDR_M) | + (((u32)reg << MDIO_REG_ADDR_S) & MDIO_REG_ADDR_M); + +- if (cmd == MDIO_CMD_WRITE) ++ if (cmd == MDIO_CMD_WRITE || cmd == MDIO_CMD_ADDR) + val |= data & MDIO_RW_DATA_M; + + mtk_gmac_write(priv, GMAC_PIAC_REG, val | PHY_ACS_ST); +@@ -210,7 +210,7 @@ static int mtk_mii_rw(struct mtk_eth_pri + return ret; + } + +- if (cmd == MDIO_CMD_READ) { ++ if (cmd == MDIO_CMD_READ || cmd == MDIO_CMD_READ_C45) { + val = mtk_gmac_read(priv, GMAC_PIAC_REG); + return val & MDIO_RW_DATA_M; + } diff --git a/package/boot/uboot-mediatek/patches/101-19-net-mediatek-add-missing-static-qualifier.patch b/package/boot/uboot-mediatek/patches/101-19-net-mediatek-add-missing-static-qualifier.patch new file mode 100644 index 00000000000000..9350ca04dc26c8 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-19-net-mediatek-add-missing-static-qualifier.patch @@ -0,0 +1,36 @@ +From 9d35558bedfb82860c63cc11d3426afcbd82cb5c Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:07 +0800 +Subject: [PATCH 19/29] net: mediatek: add missing static qualifier + +mt7531_mmd_ind_read and mt753x_switch_init are defined without static. +Since they're not used outside this file, we should add them back. + +Signed-off-by: Weijie Gao + +fixup to add static qualifier +--- + drivers/net/mtk_eth.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -436,7 +436,8 @@ static int mt7531_mii_ind_write(struct m + MDIO_ST_C22); + } + +-int mt7531_mmd_ind_read(struct mtk_eth_priv *priv, u8 addr, u8 devad, u16 reg) ++static int mt7531_mmd_ind_read(struct mtk_eth_priv *priv, u8 addr, u8 devad, ++ u16 reg) + { + u8 phy_addr; + int ret; +@@ -934,7 +935,7 @@ static int mt7531_setup(struct mtk_eth_p + return 0; + } + +-int mt753x_switch_init(struct mtk_eth_priv *priv) ++static int mt753x_switch_init(struct mtk_eth_priv *priv) + { + int ret; + int i; diff --git a/package/boot/uboot-mediatek/patches/101-20-net-mediatek-add-support-for-SGMII-1Gbps-auto-negoti.patch b/package/boot/uboot-mediatek/patches/101-20-net-mediatek-add-support-for-SGMII-1Gbps-auto-negoti.patch new file mode 100644 index 00000000000000..45acbc36ac1bac --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-20-net-mediatek-add-support-for-SGMII-1Gbps-auto-negoti.patch @@ -0,0 +1,149 @@ +From 8e59c3cc700a6efb8db574f3c8e18b6181b4a07d Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:13 +0800 +Subject: [PATCH 20/29] net: mediatek: add support for SGMII 1Gbps + auto-negotiation mode + +Existing SGMII support of mtk-eth is actually a MediaTek-specific +2.5Gbps high-speed SGMII (HSGMII) which does not support +auto-negotiation mode. + +This patch adds SGMII 1Gbps auto-negotiation mode and rename the +existing HSGMII to 2500basex. + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 46 +++++++++++++++++++++++++++++++++++++------ + drivers/net/mtk_eth.h | 2 ++ + 2 files changed, 42 insertions(+), 6 deletions(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -893,7 +893,7 @@ static int mt7531_setup(struct mtk_eth_p + if (!port5_sgmii) + mt7531_port_rgmii_init(priv, 5); + break; +- case PHY_INTERFACE_MODE_SGMII: ++ case PHY_INTERFACE_MODE_2500BASEX: + mt7531_port_sgmii_init(priv, 6); + if (port5_sgmii) + mt7531_port_sgmii_init(priv, 5); +@@ -986,6 +986,7 @@ static void mtk_phy_link_adjust(struct m + (MAC_RX_PKT_LEN_1536 << MAC_RX_PKT_LEN_S) | + MAC_MODE | FORCE_MODE | + MAC_TX_EN | MAC_RX_EN | ++ DEL_RXFIFO_CLR | + BKOFF_EN | BACKPR_EN; + + switch (priv->phydev->speed) { +@@ -996,6 +997,7 @@ static void mtk_phy_link_adjust(struct m + mcr |= (SPEED_100M << FORCE_SPD_S); + break; + case SPEED_1000: ++ case SPEED_2500: + mcr |= (SPEED_1000M << FORCE_SPD_S); + break; + }; +@@ -1048,7 +1050,8 @@ static int mtk_phy_start(struct mtk_eth_ + return 0; + } + +- mtk_phy_link_adjust(priv); ++ if (!priv->force_mode) ++ mtk_phy_link_adjust(priv); + + debug("Speed: %d, %s duplex%s\n", phydev->speed, + (phydev->duplex) ? "full" : "half", +@@ -1076,7 +1079,31 @@ static int mtk_phy_probe(struct udevice + return 0; + } + +-static void mtk_sgmii_init(struct mtk_eth_priv *priv) ++static void mtk_sgmii_an_init(struct mtk_eth_priv *priv) ++{ ++ /* Set SGMII GEN1 speed(1G) */ ++ clrsetbits_le32(priv->sgmii_base + priv->soc->ana_rgc3, ++ SGMSYS_SPEED_2500, 0); ++ ++ /* Enable SGMII AN */ ++ setbits_le32(priv->sgmii_base + SGMSYS_PCS_CONTROL_1, ++ SGMII_AN_ENABLE); ++ ++ /* SGMII AN mode setting */ ++ writel(SGMII_AN_MODE, priv->sgmii_base + SGMSYS_SGMII_MODE); ++ ++ /* SGMII PN SWAP setting */ ++ if (priv->pn_swap) { ++ setbits_le32(priv->sgmii_base + SGMSYS_QPHY_WRAP_CTRL, ++ SGMII_PN_SWAP_TX_RX); ++ } ++ ++ /* Release PHYA power down state */ ++ clrsetbits_le32(priv->sgmii_base + SGMSYS_QPHY_PWR_STATE_CTRL, ++ SGMII_PHYA_PWD, 0); ++} ++ ++static void mtk_sgmii_force_init(struct mtk_eth_priv *priv) + { + /* Set SGMII GEN2 speed(2.5G) */ + setbits_le32(priv->sgmii_base + priv->soc->ana_rgc3, +@@ -1111,10 +1138,14 @@ static void mtk_mac_init(struct mtk_eth_ + ge_mode = GE_MODE_RGMII; + break; + case PHY_INTERFACE_MODE_SGMII: ++ case PHY_INTERFACE_MODE_2500BASEX: + ge_mode = GE_MODE_RGMII; + mtk_ethsys_rmw(priv, ETHSYS_SYSCFG0_REG, SYSCFG0_SGMII_SEL_M, + SYSCFG0_SGMII_SEL(priv->gmac_id)); +- mtk_sgmii_init(priv); ++ if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII) ++ mtk_sgmii_an_init(priv); ++ else ++ mtk_sgmii_force_init(priv); + break; + case PHY_INTERFACE_MODE_MII: + case PHY_INTERFACE_MODE_GMII: +@@ -1148,6 +1179,7 @@ static void mtk_mac_init(struct mtk_eth_ + mcr |= SPEED_100M << FORCE_SPD_S; + break; + case SPEED_1000: ++ case SPEED_2500: + mcr |= SPEED_1000M << FORCE_SPD_S; + break; + } +@@ -1490,13 +1522,15 @@ static int mtk_eth_of_to_plat(struct ude + priv->duplex = ofnode_read_bool(subnode, "full-duplex"); + + if (priv->speed != SPEED_10 && priv->speed != SPEED_100 && +- priv->speed != SPEED_1000) { ++ priv->speed != SPEED_1000 && priv->speed != SPEED_2500 && ++ priv->speed != SPEED_10000) { + printf("error: no valid speed set in fixed-link\n"); + return -EINVAL; + } + } + +- if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII) { ++ if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII || ++ priv->phy_interface == PHY_INTERFACE_MODE_2500BASEX) { + /* get corresponding sgmii phandle */ + ret = dev_read_phandle_with_args(dev, "mediatek,sgmiisys", + NULL, 0, 0, &args); +--- a/drivers/net/mtk_eth.h ++++ b/drivers/net/mtk_eth.h +@@ -69,6 +69,7 @@ enum mkt_eth_capabilities { + #define SGMII_AN_RESTART BIT(9) + + #define SGMSYS_SGMII_MODE 0x20 ++#define SGMII_AN_MODE 0x31120103 + #define SGMII_FORCE_MODE 0x31120019 + + #define SGMSYS_QPHY_PWR_STATE_CTRL 0xe8 +@@ -168,6 +169,7 @@ enum mkt_eth_capabilities { + #define FORCE_MODE BIT(15) + #define MAC_TX_EN BIT(14) + #define MAC_RX_EN BIT(13) ++#define DEL_RXFIFO_CLR BIT(12) + #define BKOFF_EN BIT(9) + #define BACKPR_EN BIT(8) + #define FORCE_RX_FC BIT(5) diff --git a/package/boot/uboot-mediatek/patches/101-21-arm-dts-medaitek-convert-gmac-link-mode-to-2500base-.patch b/package/boot/uboot-mediatek/patches/101-21-arm-dts-medaitek-convert-gmac-link-mode-to-2500base-.patch new file mode 100644 index 00000000000000..27612fd9e4e87c --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-21-arm-dts-medaitek-convert-gmac-link-mode-to-2500base-.patch @@ -0,0 +1,214 @@ +From 64ef7e977767e3b1305fb94a5169d8b7d3b19b6c Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:18 +0800 +Subject: [PATCH 21/29] arm: dts: mediatek: convert gmac link mode to + 2500base-x + +Now that individual 2.5Gbps SGMII support has been added to +mtk-eth, all boards that use 2.5Gbps link with mt7531 must be +converted to use "2500base-x" instead of "sgmii". + +Signed-off-by: Weijie Gao +[also convert BPi-R3] +Signed-off-by: Daniel Golle +--- + arch/arm/dts/mt7622-bananapi-bpi-r64.dts | 4 ++-- + arch/arm/dts/mt7622-rfb.dts | 4 ++-- + arch/arm/dts/mt7629-rfb.dts | 4 ++-- + arch/arm/dts/mt7981-emmc-rfb.dts | 4 ++-- + arch/arm/dts/mt7981-rfb.dts | 4 ++-- + arch/arm/dts/mt7981-sd-rfb.dts | 4 ++-- + arch/arm/dts/mt7986a-bpi-r3-sd.dts | 4 ++-- + arch/arm/dts/mt7986a-rfb.dts | 4 ++-- + arch/arm/dts/mt7986a-sd-rfb.dts | 4 ++-- + arch/arm/dts/mt7986b-rfb.dts | 4 ++-- + arch/arm/dts/mt7986b-sd-rfb.dts | 4 ++-- + 11 files changed, 22 insertions(+), 22 deletions(-) + +--- a/arch/arm/dts/mt7622-bananapi-bpi-r64.dts ++++ b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts +@@ -224,12 +224,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7622-rfb.dts ++++ b/arch/arm/dts/mt7622-rfb.dts +@@ -240,12 +240,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7629-rfb.dts ++++ b/arch/arm/dts/mt7629-rfb.dts +@@ -25,12 +25,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7981-emmc-rfb.dts ++++ b/arch/arm/dts/mt7981-emmc-rfb.dts +@@ -46,12 +46,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7981-rfb.dts ++++ b/arch/arm/dts/mt7981-rfb.dts +@@ -37,12 +37,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7981-sd-rfb.dts ++++ b/arch/arm/dts/mt7981-sd-rfb.dts +@@ -46,12 +46,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7986a-bpi-r3-sd.dts ++++ b/arch/arm/dts/mt7986a-bpi-r3-sd.dts +@@ -76,12 +76,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7986a-rfb.dts ++++ b/arch/arm/dts/mt7986a-rfb.dts +@@ -55,12 +55,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7986a-sd-rfb.dts ++++ b/arch/arm/dts/mt7986a-sd-rfb.dts +@@ -47,12 +47,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7986b-rfb.dts ++++ b/arch/arm/dts/mt7986b-rfb.dts +@@ -46,12 +46,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; +--- a/arch/arm/dts/mt7986b-sd-rfb.dts ++++ b/arch/arm/dts/mt7986b-sd-rfb.dts +@@ -47,12 +47,12 @@ + ð { + status = "okay"; + mediatek,gmac-id = <0>; +- phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + + fixed-link { +- speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + }; diff --git a/package/boot/uboot-mediatek/patches/101-22-net-mediatek-add-support-for-GMAC-USB3-PHY-mux-mode-.patch b/package/boot/uboot-mediatek/patches/101-22-net-mediatek-add-support-for-GMAC-USB3-PHY-mux-mode-.patch new file mode 100644 index 00000000000000..c7e49ff304ddc2 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-22-net-mediatek-add-support-for-GMAC-USB3-PHY-mux-mode-.patch @@ -0,0 +1,138 @@ +From 542d455466bdf32e1bb70230ebcdefd8ed09643b Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:22 +0800 +Subject: [PATCH 22/29] net: mediatek: add support for GMAC/USB3 PHY mux mode + for MT7981 + +MT7981 has its GMAC2 PHY shared with USB3. To enable GMAC2, mux +register must be set to connect the SGMII phy to GMAC2. + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 33 ++++++++++++++++++++++++++++++++- + drivers/net/mtk_eth.h | 16 ++++++++++++++++ + 2 files changed, 48 insertions(+), 1 deletion(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -103,6 +103,8 @@ struct mtk_eth_priv { + + struct regmap *ethsys_regmap; + ++ struct regmap *infra_regmap; ++ + struct mii_dev *mdio_bus; + int (*mii_read)(struct mtk_eth_priv *priv, u8 phy, u8 reg); + int (*mii_write)(struct mtk_eth_priv *priv, u8 phy, u8 reg, u16 val); +@@ -186,6 +188,17 @@ static void mtk_ethsys_rmw(struct mtk_et + regmap_write(priv->ethsys_regmap, reg, val); + } + ++static void mtk_infra_rmw(struct mtk_eth_priv *priv, u32 reg, u32 clr, ++ u32 set) ++{ ++ uint val; ++ ++ regmap_read(priv->infra_regmap, reg, &val); ++ val &= ~clr; ++ val |= set; ++ regmap_write(priv->infra_regmap, reg, val); ++} ++ + /* Direct MDIO clause 22/45 access via SoC */ + static int mtk_mii_rw(struct mtk_eth_priv *priv, u8 phy, u8 reg, u16 data, + u32 cmd, u32 st) +@@ -1139,6 +1152,11 @@ static void mtk_mac_init(struct mtk_eth_ + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_2500BASEX: ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_GMAC2_U3_QPHY)) { ++ mtk_infra_rmw(priv, USB_PHY_SWITCH_REG, QPHY_SEL_MASK, ++ SGMII_QPHY_SEL); ++ } ++ + ge_mode = GE_MODE_RGMII; + mtk_ethsys_rmw(priv, ETHSYS_SYSCFG0_REG, SYSCFG0_SGMII_SEL_M, + SYSCFG0_SGMII_SEL(priv->gmac_id)); +@@ -1497,6 +1515,19 @@ static int mtk_eth_of_to_plat(struct ude + if (IS_ERR(priv->ethsys_regmap)) + return PTR_ERR(priv->ethsys_regmap); + ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_INFRA)) { ++ /* get corresponding infracfg phandle */ ++ ret = dev_read_phandle_with_args(dev, "mediatek,infracfg", ++ NULL, 0, 0, &args); ++ ++ if (ret) ++ return ret; ++ ++ priv->infra_regmap = syscon_node_to_regmap(args.node); ++ if (IS_ERR(priv->infra_regmap)) ++ return PTR_ERR(priv->infra_regmap); ++ } ++ + /* Reset controllers */ + ret = reset_get_by_name(dev, "fe", &priv->rst_fe); + if (ret) { +@@ -1614,7 +1645,7 @@ static const struct mtk_soc_data mt7986_ + }; + + static const struct mtk_soc_data mt7981_data = { +- .caps = MT7986_CAPS, ++ .caps = MT7981_CAPS, + .ana_rgc3 = 0x128, + .pdma_base = PDMA_V2_BASE, + .txd_size = sizeof(struct mtk_tx_dma_v2), +--- a/drivers/net/mtk_eth.h ++++ b/drivers/net/mtk_eth.h +@@ -15,27 +15,38 @@ + enum mkt_eth_capabilities { + MTK_TRGMII_BIT, + MTK_TRGMII_MT7621_CLK_BIT, ++ MTK_U3_COPHY_V2_BIT, ++ MTK_INFRA_BIT, + MTK_NETSYS_V2_BIT, + + /* PATH BITS */ + MTK_ETH_PATH_GMAC1_TRGMII_BIT, ++ MTK_ETH_PATH_GMAC2_SGMII_BIT, + }; + + #define MTK_TRGMII BIT(MTK_TRGMII_BIT) + #define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT) ++#define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) ++#define MTK_INFRA BIT(MTK_INFRA_BIT) + #define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) + + /* Supported path present on SoCs */ + #define MTK_ETH_PATH_GMAC1_TRGMII BIT(MTK_ETH_PATH_GMAC1_TRGMII_BIT) + ++#define MTK_ETH_PATH_GMAC2_SGMII BIT(MTK_ETH_PATH_GMAC2_SGMII_BIT) ++ + #define MTK_GMAC1_TRGMII (MTK_ETH_PATH_GMAC1_TRGMII | MTK_TRGMII) + ++#define MTK_GMAC2_U3_QPHY (MTK_ETH_PATH_GMAC2_SGMII | MTK_U3_COPHY_V2 | MTK_INFRA) ++ + #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x)) + + #define MT7621_CAPS (MTK_GMAC1_TRGMII | MTK_TRGMII_MT7621_CLK) + + #define MT7623_CAPS (MTK_GMAC1_TRGMII) + ++#define MT7981_CAPS (MTK_GMAC2_U3_QPHY | MTK_NETSYS_V2) ++ + #define MT7986_CAPS (MTK_NETSYS_V2) + + /* Frame Engine Register Bases */ +@@ -56,6 +67,11 @@ enum mkt_eth_capabilities { + #define ETHSYS_CLKCFG0_REG 0x2c + #define ETHSYS_TRGMII_CLK_SEL362_5 BIT(11) + ++/* Top misc registers */ ++#define USB_PHY_SWITCH_REG 0x218 ++#define QPHY_SEL_MASK 0x3 ++#define SGMII_QPHY_SEL 0x2 ++ + /* SYSCFG0_GE_MODE: GE Modes */ + #define GE_MODE_RGMII 0 + #define GE_MODE_MII 1 diff --git a/package/boot/uboot-mediatek/patches/101-23-arm-dts-mediatek-add-infracfg-registers-to-support-G.patch b/package/boot/uboot-mediatek/patches/101-23-arm-dts-mediatek-add-infracfg-registers-to-support-G.patch new file mode 100644 index 00000000000000..63c25304a06cdc --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-23-arm-dts-mediatek-add-infracfg-registers-to-support-G.patch @@ -0,0 +1,36 @@ +From 64dab5fc8405005a78bdf1e0035d8b754cdf0c7e Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:27 +0800 +Subject: [PATCH 23/29] arm: dts: mediatek: add infracfg registers to support + GMAC/USB3 Co-PHY + +This patch adds infracfg to eth node to support enabling GMAC2. + +Signed-off-by: Weijie Gao +--- + arch/arm/dts/mt7981.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/arch/arm/dts/mt7981.dtsi ++++ b/arch/arm/dts/mt7981.dtsi +@@ -266,6 +266,7 @@ + reset-names = "fe"; + mediatek,ethsys = <ðsys>; + mediatek,sgmiisys = <&sgmiisys0>; ++ mediatek,infracfg = <&topmisc>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; +@@ -284,6 +285,12 @@ + #clock-cells = <1>; + }; + ++ topmisc: topmisc@11d10000 { ++ compatible = "mediatek,mt7981-topmisc", "syscon"; ++ reg = <0x11d10000 0x10000>; ++ #clock-cells = <1>; ++ }; ++ + spi0: spi@1100a000 { + compatible = "mediatek,ipm-spi"; + reg = <0x1100a000 0x100>; diff --git a/package/boot/uboot-mediatek/patches/101-24-net-mediatek-add-USXGMII-support.patch b/package/boot/uboot-mediatek/patches/101-24-net-mediatek-add-USXGMII-support.patch new file mode 100644 index 00000000000000..67288c749e4435 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-24-net-mediatek-add-USXGMII-support.patch @@ -0,0 +1,341 @@ +From d62b483092035bc86d1db83ea4ac29bfa7bba77d Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:31 +0800 +Subject: [PATCH 24/29] net: mediatek: add USXGMII support + +This patch adds support for USXGMII of SoC. + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 230 +++++++++++++++++++++++++++++++++++++++++- + drivers/net/mtk_eth.h | 24 +++++ + 2 files changed, 251 insertions(+), 3 deletions(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -105,6 +105,11 @@ struct mtk_eth_priv { + + struct regmap *infra_regmap; + ++ struct regmap *usxgmii_regmap; ++ struct regmap *xfi_pextp_regmap; ++ struct regmap *xfi_pll_regmap; ++ struct regmap *toprgu_regmap; ++ + struct mii_dev *mdio_bus; + int (*mii_read)(struct mtk_eth_priv *priv, u8 phy, u8 reg); + int (*mii_write)(struct mtk_eth_priv *priv, u8 phy, u8 reg, u16 val); +@@ -989,6 +994,42 @@ static int mt753x_switch_init(struct mtk + return 0; + } + ++static void mtk_xphy_link_adjust(struct mtk_eth_priv *priv) ++{ ++ u16 lcl_adv = 0, rmt_adv = 0; ++ u8 flowctrl; ++ u32 mcr; ++ ++ mcr = mtk_gmac_read(priv, XGMAC_PORT_MCR(priv->gmac_id)); ++ mcr &= ~(XGMAC_FORCE_TX_FC | XGMAC_FORCE_RX_FC); ++ ++ if (priv->phydev->duplex) { ++ if (priv->phydev->pause) ++ rmt_adv = LPA_PAUSE_CAP; ++ if (priv->phydev->asym_pause) ++ rmt_adv |= LPA_PAUSE_ASYM; ++ ++ if (priv->phydev->advertising & ADVERTISED_Pause) ++ lcl_adv |= ADVERTISE_PAUSE_CAP; ++ if (priv->phydev->advertising & ADVERTISED_Asym_Pause) ++ lcl_adv |= ADVERTISE_PAUSE_ASYM; ++ ++ flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv); ++ ++ if (flowctrl & FLOW_CTRL_TX) ++ mcr |= XGMAC_FORCE_TX_FC; ++ if (flowctrl & FLOW_CTRL_RX) ++ mcr |= XGMAC_FORCE_RX_FC; ++ ++ debug("rx pause %s, tx pause %s\n", ++ flowctrl & FLOW_CTRL_RX ? "enabled" : "disabled", ++ flowctrl & FLOW_CTRL_TX ? "enabled" : "disabled"); ++ } ++ ++ mcr &= ~(XGMAC_TRX_DISABLE); ++ mtk_gmac_write(priv, XGMAC_PORT_MCR(priv->gmac_id), mcr); ++} ++ + static void mtk_phy_link_adjust(struct mtk_eth_priv *priv) + { + u16 lcl_adv = 0, rmt_adv = 0; +@@ -1063,8 +1104,12 @@ static int mtk_phy_start(struct mtk_eth_ + return 0; + } + +- if (!priv->force_mode) +- mtk_phy_link_adjust(priv); ++ if (!priv->force_mode) { ++ if (priv->phy_interface == PHY_INTERFACE_MODE_USXGMII) ++ mtk_xphy_link_adjust(priv); ++ else ++ mtk_phy_link_adjust(priv); ++ } + + debug("Speed: %d, %s duplex%s\n", phydev->speed, + (phydev->duplex) ? "full" : "half", +@@ -1140,6 +1185,112 @@ static void mtk_sgmii_force_init(struct + SGMII_PHYA_PWD, 0); + } + ++static void mtk_xfi_pll_enable(struct mtk_eth_priv *priv) ++{ ++ u32 val = 0; ++ ++ /* Add software workaround for USXGMII PLL TCL issue */ ++ regmap_write(priv->xfi_pll_regmap, XFI_PLL_ANA_GLB8, ++ RG_XFI_PLL_ANA_SWWA); ++ ++ regmap_read(priv->xfi_pll_regmap, XFI_PLL_DIG_GLB8, &val); ++ val |= RG_XFI_PLL_EN; ++ regmap_write(priv->xfi_pll_regmap, XFI_PLL_DIG_GLB8, val); ++} ++ ++static void mtk_usxgmii_reset(struct mtk_eth_priv *priv) ++{ ++ switch (priv->gmac_id) { ++ case 1: ++ regmap_write(priv->toprgu_regmap, 0xFC, 0x0000A004); ++ regmap_write(priv->toprgu_regmap, 0x18, 0x88F0A004); ++ regmap_write(priv->toprgu_regmap, 0xFC, 0x00000000); ++ regmap_write(priv->toprgu_regmap, 0x18, 0x88F00000); ++ regmap_write(priv->toprgu_regmap, 0x18, 0x00F00000); ++ break; ++ case 2: ++ regmap_write(priv->toprgu_regmap, 0xFC, 0x00005002); ++ regmap_write(priv->toprgu_regmap, 0x18, 0x88F05002); ++ regmap_write(priv->toprgu_regmap, 0xFC, 0x00000000); ++ regmap_write(priv->toprgu_regmap, 0x18, 0x88F00000); ++ regmap_write(priv->toprgu_regmap, 0x18, 0x00F00000); ++ break; ++ } ++ ++ mdelay(10); ++} ++ ++static void mtk_usxgmii_setup_phya_an_10000(struct mtk_eth_priv *priv) ++{ ++ regmap_write(priv->usxgmii_regmap, 0x810, 0x000FFE6D); ++ regmap_write(priv->usxgmii_regmap, 0x818, 0x07B1EC7B); ++ regmap_write(priv->usxgmii_regmap, 0x80C, 0x30000000); ++ ndelay(1020); ++ regmap_write(priv->usxgmii_regmap, 0x80C, 0x10000000); ++ ndelay(1020); ++ regmap_write(priv->usxgmii_regmap, 0x80C, 0x00000000); ++ ++ regmap_write(priv->xfi_pextp_regmap, 0x9024, 0x00C9071C); ++ regmap_write(priv->xfi_pextp_regmap, 0x2020, 0xAA8585AA); ++ regmap_write(priv->xfi_pextp_regmap, 0x2030, 0x0C020707); ++ regmap_write(priv->xfi_pextp_regmap, 0x2034, 0x0E050F0F); ++ regmap_write(priv->xfi_pextp_regmap, 0x2040, 0x00140032); ++ regmap_write(priv->xfi_pextp_regmap, 0x50F0, 0x00C014AA); ++ regmap_write(priv->xfi_pextp_regmap, 0x50E0, 0x3777C12B); ++ regmap_write(priv->xfi_pextp_regmap, 0x506C, 0x005F9CFF); ++ regmap_write(priv->xfi_pextp_regmap, 0x5070, 0x9D9DFAFA); ++ regmap_write(priv->xfi_pextp_regmap, 0x5074, 0x27273F3F); ++ regmap_write(priv->xfi_pextp_regmap, 0x5078, 0xA7883C68); ++ regmap_write(priv->xfi_pextp_regmap, 0x507C, 0x11661166); ++ regmap_write(priv->xfi_pextp_regmap, 0x5080, 0x0E000AAF); ++ regmap_write(priv->xfi_pextp_regmap, 0x5084, 0x08080D0D); ++ regmap_write(priv->xfi_pextp_regmap, 0x5088, 0x02030909); ++ regmap_write(priv->xfi_pextp_regmap, 0x50E4, 0x0C0C0000); ++ regmap_write(priv->xfi_pextp_regmap, 0x50E8, 0x04040000); ++ regmap_write(priv->xfi_pextp_regmap, 0x50EC, 0x0F0F0C06); ++ regmap_write(priv->xfi_pextp_regmap, 0x50A8, 0x506E8C8C); ++ regmap_write(priv->xfi_pextp_regmap, 0x6004, 0x18190000); ++ regmap_write(priv->xfi_pextp_regmap, 0x00F8, 0x01423342); ++ regmap_write(priv->xfi_pextp_regmap, 0x00F4, 0x80201F20); ++ regmap_write(priv->xfi_pextp_regmap, 0x0030, 0x00050C00); ++ regmap_write(priv->xfi_pextp_regmap, 0x0070, 0x02002800); ++ ndelay(1020); ++ regmap_write(priv->xfi_pextp_regmap, 0x30B0, 0x00000020); ++ regmap_write(priv->xfi_pextp_regmap, 0x3028, 0x00008A01); ++ regmap_write(priv->xfi_pextp_regmap, 0x302C, 0x0000A884); ++ regmap_write(priv->xfi_pextp_regmap, 0x3024, 0x00083002); ++ regmap_write(priv->xfi_pextp_regmap, 0x3010, 0x00022220); ++ regmap_write(priv->xfi_pextp_regmap, 0x5064, 0x0F020A01); ++ regmap_write(priv->xfi_pextp_regmap, 0x50B4, 0x06100600); ++ regmap_write(priv->xfi_pextp_regmap, 0x3048, 0x40704000); ++ regmap_write(priv->xfi_pextp_regmap, 0x3050, 0xA8000000); ++ regmap_write(priv->xfi_pextp_regmap, 0x3054, 0x000000AA); ++ regmap_write(priv->xfi_pextp_regmap, 0x306C, 0x00000F00); ++ regmap_write(priv->xfi_pextp_regmap, 0xA060, 0x00040000); ++ regmap_write(priv->xfi_pextp_regmap, 0x90D0, 0x00000001); ++ regmap_write(priv->xfi_pextp_regmap, 0x0070, 0x0200E800); ++ udelay(150); ++ regmap_write(priv->xfi_pextp_regmap, 0x0070, 0x0200C111); ++ ndelay(1020); ++ regmap_write(priv->xfi_pextp_regmap, 0x0070, 0x0200C101); ++ udelay(15); ++ regmap_write(priv->xfi_pextp_regmap, 0x0070, 0x0202C111); ++ ndelay(1020); ++ regmap_write(priv->xfi_pextp_regmap, 0x0070, 0x0202C101); ++ udelay(100); ++ regmap_write(priv->xfi_pextp_regmap, 0x30B0, 0x00000030); ++ regmap_write(priv->xfi_pextp_regmap, 0x00F4, 0x80201F00); ++ regmap_write(priv->xfi_pextp_regmap, 0x3040, 0x30000000); ++ udelay(400); ++} ++ ++static void mtk_usxgmii_an_init(struct mtk_eth_priv *priv) ++{ ++ mtk_xfi_pll_enable(priv); ++ mtk_usxgmii_reset(priv); ++ mtk_usxgmii_setup_phya_an_10000(priv); ++} ++ + static void mtk_mac_init(struct mtk_eth_priv *priv) + { + int i, ge_mode = 0; +@@ -1222,6 +1373,36 @@ static void mtk_mac_init(struct mtk_eth_ + } + } + ++static void mtk_xmac_init(struct mtk_eth_priv *priv) ++{ ++ u32 sts; ++ ++ switch (priv->phy_interface) { ++ case PHY_INTERFACE_MODE_USXGMII: ++ mtk_usxgmii_an_init(priv); ++ break; ++ default: ++ break; ++ } ++ ++ /* Set GMAC to the correct mode */ ++ mtk_ethsys_rmw(priv, ETHSYS_SYSCFG0_REG, ++ SYSCFG0_GE_MODE_M << SYSCFG0_GE_MODE_S(priv->gmac_id), ++ 0); ++ ++ if (priv->gmac_id == 1) { ++ mtk_infra_rmw(priv, TOPMISC_NETSYS_PCS_MUX, ++ NETSYS_PCS_MUX_MASK, MUX_G2_USXGMII_SEL); ++ } else if (priv->gmac_id == 2) { ++ sts = mtk_gmac_read(priv, XGMAC_STS(priv->gmac_id)); ++ sts |= XGMAC_FORCE_LINK; ++ mtk_gmac_write(priv, XGMAC_STS(priv->gmac_id), sts); ++ } ++ ++ /* Force GMAC link down */ ++ mtk_gmac_write(priv, GMAC_PORT_MCR(priv->gmac_id), FORCE_MODE); ++} ++ + static void mtk_eth_fifo_init(struct mtk_eth_priv *priv) + { + char *pkt_base = priv->pkt_pool; +@@ -1463,7 +1644,10 @@ static int mtk_eth_probe(struct udevice + ARCH_DMA_MINALIGN); + + /* Set MAC mode */ +- mtk_mac_init(priv); ++ if (priv->phy_interface == PHY_INTERFACE_MODE_USXGMII) ++ mtk_xmac_init(priv); ++ else ++ mtk_mac_init(priv); + + /* Probe phy if switch is not specified */ + if (priv->sw == SW_NONE) +@@ -1581,6 +1765,46 @@ static int mtk_eth_of_to_plat(struct ude + } + + priv->pn_swap = ofnode_read_bool(args.node, "pn_swap"); ++ } else if (priv->phy_interface == PHY_INTERFACE_MODE_USXGMII) { ++ /* get corresponding usxgmii phandle */ ++ ret = dev_read_phandle_with_args(dev, "mediatek,usxgmiisys", ++ NULL, 0, 0, &args); ++ if (ret) ++ return ret; ++ ++ priv->usxgmii_regmap = syscon_node_to_regmap(args.node); ++ if (IS_ERR(priv->usxgmii_regmap)) ++ return PTR_ERR(priv->usxgmii_regmap); ++ ++ /* get corresponding xfi_pextp phandle */ ++ ret = dev_read_phandle_with_args(dev, "mediatek,xfi_pextp", ++ NULL, 0, 0, &args); ++ if (ret) ++ return ret; ++ ++ priv->xfi_pextp_regmap = syscon_node_to_regmap(args.node); ++ if (IS_ERR(priv->xfi_pextp_regmap)) ++ return PTR_ERR(priv->xfi_pextp_regmap); ++ ++ /* get corresponding xfi_pll phandle */ ++ ret = dev_read_phandle_with_args(dev, "mediatek,xfi_pll", ++ NULL, 0, 0, &args); ++ if (ret) ++ return ret; ++ ++ priv->xfi_pll_regmap = syscon_node_to_regmap(args.node); ++ if (IS_ERR(priv->xfi_pll_regmap)) ++ return PTR_ERR(priv->xfi_pll_regmap); ++ ++ /* get corresponding toprgu phandle */ ++ ret = dev_read_phandle_with_args(dev, "mediatek,toprgu", ++ NULL, 0, 0, &args); ++ if (ret) ++ return ret; ++ ++ priv->toprgu_regmap = syscon_node_to_regmap(args.node); ++ if (IS_ERR(priv->toprgu_regmap)) ++ return PTR_ERR(priv->toprgu_regmap); + } + + /* check for switch first, otherwise phy will be used */ +--- a/drivers/net/mtk_eth.h ++++ b/drivers/net/mtk_eth.h +@@ -68,6 +68,11 @@ enum mkt_eth_capabilities { + #define ETHSYS_TRGMII_CLK_SEL362_5 BIT(11) + + /* Top misc registers */ ++#define TOPMISC_NETSYS_PCS_MUX 0x84 ++#define NETSYS_PCS_MUX_MASK GENMASK(1, 0) ++#define MUX_G2_USXGMII_SEL BIT(1) ++#define MUX_HSGMII1_G1_SEL BIT(0) ++ + #define USB_PHY_SWITCH_REG 0x218 + #define QPHY_SEL_MASK 0x3 + #define SGMII_QPHY_SEL 0x2 +@@ -98,6 +103,15 @@ enum mkt_eth_capabilities { + #define SGMSYS_GEN2_SPEED_V2 0x128 + #define SGMSYS_SPEED_2500 BIT(2) + ++/* USXGMII subsystem config registers */ ++/* Register to control USXGMII XFI PLL digital */ ++#define XFI_PLL_DIG_GLB8 0x08 ++#define RG_XFI_PLL_EN BIT(31) ++ ++/* Register to control USXGMII XFI PLL analog */ ++#define XFI_PLL_ANA_GLB8 0x108 ++#define RG_XFI_PLL_ANA_SWWA 0x02283248 ++ + /* Frame Engine Registers */ + #define FE_GLO_MISC_REG 0x124 + #define PDMA_VER_V2 BIT(4) +@@ -221,6 +235,16 @@ enum mkt_eth_capabilities { + #define TD_DM_DRVP_S 0 + #define TD_DM_DRVP_M 0x0f + ++/* XGMAC Status Registers */ ++#define XGMAC_STS(x) (((x) == 2) ? 0x001C : 0x000C) ++#define XGMAC_FORCE_LINK BIT(15) ++ ++/* XGMAC Registers */ ++#define XGMAC_PORT_MCR(x) (0x2000 + (((x) - 1) * 0x1000)) ++#define XGMAC_TRX_DISABLE 0xf ++#define XGMAC_FORCE_TX_FC BIT(5) ++#define XGMAC_FORCE_RX_FC BIT(4) ++ + /* MT7530 Registers */ + + #define PCR_REG(p) (0x2004 + (p) * 0x100) diff --git a/package/boot/uboot-mediatek/patches/101-25-net-mediatek-add-support-for-NETSYS-v3.patch b/package/boot/uboot-mediatek/patches/101-25-net-mediatek-add-support-for-NETSYS-v3.patch new file mode 100644 index 00000000000000..691b59faed8ec4 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-25-net-mediatek-add-support-for-NETSYS-v3.patch @@ -0,0 +1,221 @@ +From 7d201749cc49a58fb5e791d1e099ec3e3489e16d Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:37 +0800 +Subject: [PATCH 25/29] net: mediatek: add support for NETSYS v3 + +This patch adds support for NETSYS v3 hardware. +Comparing to NETSYS v2, NETSYS v3 has three GMACs. + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 49 ++++++++++++++++++++++++++++++++----------- + drivers/net/mtk_eth.h | 7 +++++++ + 2 files changed, 44 insertions(+), 12 deletions(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -76,6 +76,7 @@ enum mtk_switch { + * @caps Flags shown the extra capability for the SoC + * @ana_rgc3: The offset for register ANA_RGC3 related to + * sgmiisys syscon ++ * @gdma_count: Number of GDMAs + * @pdma_base: Register base of PDMA block + * @txd_size: Tx DMA descriptor size. + * @rxd_size: Rx DMA descriptor size. +@@ -83,6 +84,7 @@ enum mtk_switch { + struct mtk_soc_data { + u32 caps; + u32 ana_rgc3; ++ u32 gdma_count; + u32 pdma_base; + u32 txd_size; + u32 rxd_size; +@@ -159,7 +161,9 @@ static void mtk_gdma_write(struct mtk_et + { + u32 gdma_base; + +- if (no == 1) ++ if (no == 2) ++ gdma_base = GDMA3_BASE; ++ else if (no == 1) + gdma_base = GDMA2_BASE; + else + gdma_base = GDMA1_BASE; +@@ -1429,7 +1433,10 @@ static void mtk_eth_fifo_init(struct mtk + txd->txd1 = virt_to_phys(pkt_base); + txd->txd2 = PDMA_TXD2_DDONE | PDMA_TXD2_LS0; + +- if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) ++ txd->txd5 = PDMA_V2_TXD5_FPORT_SET(priv->gmac_id == 2 ? ++ 15 : priv->gmac_id + 1); ++ else if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2)) + txd->txd5 = PDMA_V2_TXD5_FPORT_SET(priv->gmac_id + 1); + else + txd->txd4 = PDMA_V1_TXD4_FPORT_SET(priv->gmac_id + 1); +@@ -1442,7 +1449,8 @@ static void mtk_eth_fifo_init(struct mtk + + rxd->rxd1 = virt_to_phys(pkt_base); + +- if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2) || ++ MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) + rxd->rxd2 = PDMA_V2_RXD2_PLEN0_SET(PKTSIZE_ALIGN); + else + rxd->rxd2 = PDMA_V1_RXD2_PLEN0_SET(PKTSIZE_ALIGN); +@@ -1466,7 +1474,7 @@ static void mtk_eth_fifo_init(struct mtk + static int mtk_eth_start(struct udevice *dev) + { + struct mtk_eth_priv *priv = dev_get_priv(dev); +- int ret; ++ int i, ret; + + /* Reset FE */ + reset_assert(&priv->rst_fe); +@@ -1474,16 +1482,24 @@ static int mtk_eth_start(struct udevice + reset_deassert(&priv->rst_fe); + mdelay(10); + +- if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2) || ++ MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) + setbits_le32(priv->fe_base + FE_GLO_MISC_REG, PDMA_VER_V2); + + /* Packets forward to PDMA */ + mtk_gdma_write(priv, priv->gmac_id, GDMA_IG_CTRL_REG, GDMA_FWD_TO_CPU); + +- if (priv->gmac_id == 0) +- mtk_gdma_write(priv, 1, GDMA_IG_CTRL_REG, GDMA_FWD_DISCARD); +- else +- mtk_gdma_write(priv, 0, GDMA_IG_CTRL_REG, GDMA_FWD_DISCARD); ++ for (i = 0; i < priv->soc->gdma_count; i++) { ++ if (i == priv->gmac_id) ++ continue; ++ ++ mtk_gdma_write(priv, i, GDMA_IG_CTRL_REG, GDMA_FWD_DISCARD); ++ } ++ ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) { ++ mtk_gdma_write(priv, priv->gmac_id, GDMA_EG_CTRL_REG, ++ GDMA_CPU_BRIDGE_EN); ++ } + + udelay(500); + +@@ -1557,7 +1573,8 @@ static int mtk_eth_send(struct udevice * + flush_dcache_range((ulong)pkt_base, (ulong)pkt_base + + roundup(length, ARCH_DMA_MINALIGN)); + +- if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2) || ++ MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) + txd->txd2 = PDMA_TXD2_LS0 | PDMA_V2_TXD2_SDL0_SET(length); + else + txd->txd2 = PDMA_TXD2_LS0 | PDMA_V1_TXD2_SDL0_SET(length); +@@ -1583,7 +1600,8 @@ static int mtk_eth_recv(struct udevice * + return -EAGAIN; + } + +- if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2) || ++ MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) + length = PDMA_V2_RXD2_PLEN0_GET(rxd->rxd2); + else + length = PDMA_V1_RXD2_PLEN0_GET(rxd->rxd2); +@@ -1606,7 +1624,8 @@ static int mtk_eth_free_pkt(struct udevi + + rxd = priv->rx_ring_noc + idx * priv->soc->rxd_size; + +- if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2)) ++ if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V2) || ++ MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) + rxd->rxd2 = PDMA_V2_RXD2_PLEN0_SET(PKTSIZE_ALIGN); + else + rxd->rxd2 = PDMA_V1_RXD2_PLEN0_SET(PKTSIZE_ALIGN); +@@ -1863,6 +1882,7 @@ static int mtk_eth_of_to_plat(struct ude + static const struct mtk_soc_data mt7986_data = { + .caps = MT7986_CAPS, + .ana_rgc3 = 0x128, ++ .gdma_count = 2, + .pdma_base = PDMA_V2_BASE, + .txd_size = sizeof(struct mtk_tx_dma_v2), + .rxd_size = sizeof(struct mtk_rx_dma_v2), +@@ -1871,6 +1891,7 @@ static const struct mtk_soc_data mt7986_ + static const struct mtk_soc_data mt7981_data = { + .caps = MT7981_CAPS, + .ana_rgc3 = 0x128, ++ .gdma_count = 2, + .pdma_base = PDMA_V2_BASE, + .txd_size = sizeof(struct mtk_tx_dma_v2), + .rxd_size = sizeof(struct mtk_rx_dma_v2), +@@ -1878,6 +1899,7 @@ static const struct mtk_soc_data mt7981_ + + static const struct mtk_soc_data mt7629_data = { + .ana_rgc3 = 0x128, ++ .gdma_count = 2, + .pdma_base = PDMA_V1_BASE, + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -1885,6 +1907,7 @@ static const struct mtk_soc_data mt7629_ + + static const struct mtk_soc_data mt7623_data = { + .caps = MT7623_CAPS, ++ .gdma_count = 2, + .pdma_base = PDMA_V1_BASE, + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -1892,6 +1915,7 @@ static const struct mtk_soc_data mt7623_ + + static const struct mtk_soc_data mt7622_data = { + .ana_rgc3 = 0x2028, ++ .gdma_count = 2, + .pdma_base = PDMA_V1_BASE, + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -1899,6 +1923,7 @@ static const struct mtk_soc_data mt7622_ + + static const struct mtk_soc_data mt7621_data = { + .caps = MT7621_CAPS, ++ .gdma_count = 2, + .pdma_base = PDMA_V1_BASE, + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +--- a/drivers/net/mtk_eth.h ++++ b/drivers/net/mtk_eth.h +@@ -18,6 +18,7 @@ enum mkt_eth_capabilities { + MTK_U3_COPHY_V2_BIT, + MTK_INFRA_BIT, + MTK_NETSYS_V2_BIT, ++ MTK_NETSYS_V3_BIT, + + /* PATH BITS */ + MTK_ETH_PATH_GMAC1_TRGMII_BIT, +@@ -29,6 +30,7 @@ enum mkt_eth_capabilities { + #define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) + #define MTK_INFRA BIT(MTK_INFRA_BIT) + #define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) ++#define MTK_NETSYS_V3 BIT(MTK_NETSYS_V3_BIT) + + /* Supported path present on SoCs */ + #define MTK_ETH_PATH_GMAC1_TRGMII BIT(MTK_ETH_PATH_GMAC1_TRGMII_BIT) +@@ -52,8 +54,10 @@ enum mkt_eth_capabilities { + /* Frame Engine Register Bases */ + #define PDMA_V1_BASE 0x0800 + #define PDMA_V2_BASE 0x6000 ++#define PDMA_V3_BASE 0x6800 + #define GDMA1_BASE 0x0500 + #define GDMA2_BASE 0x1500 ++#define GDMA3_BASE 0x0540 + #define GMAC_BASE 0x10000 + + /* Ethernet subsystem registers */ +@@ -153,6 +157,9 @@ enum mkt_eth_capabilities { + #define UN_DP_S 0 + #define UN_DP_M 0x0f + ++#define GDMA_EG_CTRL_REG 0x004 ++#define GDMA_CPU_BRIDGE_EN BIT(31) ++ + #define GDMA_MAC_LSB_REG 0x008 + + #define GDMA_MAC_MSB_REG 0x00c diff --git a/package/boot/uboot-mediatek/patches/101-26-net-mediatek-add-support-for-MediaTek-MT7988-SoC.patch b/package/boot/uboot-mediatek/patches/101-26-net-mediatek-add-support-for-MediaTek-MT7988-SoC.patch new file mode 100644 index 00000000000000..29e86490521502 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-26-net-mediatek-add-support-for-MediaTek-MT7988-SoC.patch @@ -0,0 +1,327 @@ +From 59dba9d87c9caf04a5d797af46699055a53870f4 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:41 +0800 +Subject: [PATCH 26/29] net: mediatek: add support for MediaTek MT7988 SoC + +This patch adds support for MediaTek MT7988. + +MT7988 features MediaTek NETSYS v3, including three GMACs, and two +of them supports 10Gbps USXGMII. + +MT7988 embeds a MT7531 switch (not MCM) which supports accessing +internal registers through MMIO instead of MDIO. + +Signed-off-by: Weijie Gao +--- + drivers/net/mtk_eth.c | 158 +++++++++++++++++++++++++++++++++++++++++- + drivers/net/mtk_eth.h | 20 ++++++ + 2 files changed, 177 insertions(+), 1 deletion(-) + +--- a/drivers/net/mtk_eth.c ++++ b/drivers/net/mtk_eth.c +@@ -54,6 +54,16 @@ + (DP_PDMA << MC_DP_S) | \ + (DP_PDMA << UN_DP_S)) + ++#define GDMA_BRIDGE_TO_CPU \ ++ (0xC0000000 | \ ++ GDM_ICS_EN | \ ++ GDM_TCS_EN | \ ++ GDM_UCS_EN | \ ++ (DP_PDMA << MYMAC_DP_S) | \ ++ (DP_PDMA << BC_DP_S) | \ ++ (DP_PDMA << MC_DP_S) | \ ++ (DP_PDMA << UN_DP_S)) ++ + #define GDMA_FWD_DISCARD \ + (0x20000000 | \ + GDM_ICS_EN | \ +@@ -68,7 +78,8 @@ + enum mtk_switch { + SW_NONE, + SW_MT7530, +- SW_MT7531 ++ SW_MT7531, ++ SW_MT7988, + }; + + /* struct mtk_soc_data - This is the structure holding all differences +@@ -102,6 +113,7 @@ struct mtk_eth_priv { + void __iomem *fe_base; + void __iomem *gmac_base; + void __iomem *sgmii_base; ++ void __iomem *gsw_base; + + struct regmap *ethsys_regmap; + +@@ -171,6 +183,11 @@ static void mtk_gdma_write(struct mtk_et + writel(val, priv->fe_base + gdma_base + reg); + } + ++static void mtk_fe_rmw(struct mtk_eth_priv *priv, u32 reg, u32 clr, u32 set) ++{ ++ clrsetbits_le32(priv->fe_base + reg, clr, set); ++} ++ + static u32 mtk_gmac_read(struct mtk_eth_priv *priv, u32 reg) + { + return readl(priv->gmac_base + reg); +@@ -208,6 +225,16 @@ static void mtk_infra_rmw(struct mtk_eth + regmap_write(priv->infra_regmap, reg, val); + } + ++static u32 mtk_gsw_read(struct mtk_eth_priv *priv, u32 reg) ++{ ++ return readl(priv->gsw_base + reg); ++} ++ ++static void mtk_gsw_write(struct mtk_eth_priv *priv, u32 reg, u32 val) ++{ ++ writel(val, priv->gsw_base + reg); ++} ++ + /* Direct MDIO clause 22/45 access via SoC */ + static int mtk_mii_rw(struct mtk_eth_priv *priv, u8 phy, u8 reg, u16 data, + u32 cmd, u32 st) +@@ -342,6 +369,11 @@ static int mt753x_reg_read(struct mtk_et + { + int ret, low_word, high_word; + ++ if (priv->sw == SW_MT7988) { ++ *data = mtk_gsw_read(priv, reg); ++ return 0; ++ } ++ + /* Write page address */ + ret = mtk_mii_write(priv, priv->mt753x_smi_addr, 0x1f, reg >> 6); + if (ret) +@@ -367,6 +399,11 @@ static int mt753x_reg_write(struct mtk_e + { + int ret; + ++ if (priv->sw == SW_MT7988) { ++ mtk_gsw_write(priv, reg, data); ++ return 0; ++ } ++ + /* Write page address */ + ret = mtk_mii_write(priv, priv->mt753x_smi_addr, 0x1f, reg >> 6); + if (ret) +@@ -537,6 +574,7 @@ static int mtk_mdio_register(struct udev + priv->mmd_write = mtk_mmd_ind_write; + break; + case SW_MT7531: ++ case SW_MT7988: + priv->mii_read = mt7531_mii_ind_read; + priv->mii_write = mt7531_mii_ind_write; + priv->mmd_read = mt7531_mmd_ind_read; +@@ -957,6 +995,103 @@ static int mt7531_setup(struct mtk_eth_p + return 0; + } + ++static void mt7988_phy_setting(struct mtk_eth_priv *priv) ++{ ++ u16 val; ++ u32 i; ++ ++ for (i = 0; i < MT753X_NUM_PHYS; i++) { ++ /* Enable HW auto downshift */ ++ priv->mii_write(priv, i, 0x1f, 0x1); ++ val = priv->mii_read(priv, i, PHY_EXT_REG_14); ++ val |= PHY_EN_DOWN_SHFIT; ++ priv->mii_write(priv, i, PHY_EXT_REG_14, val); ++ ++ /* PHY link down power saving enable */ ++ val = priv->mii_read(priv, i, PHY_EXT_REG_17); ++ val |= PHY_LINKDOWN_POWER_SAVING_EN; ++ priv->mii_write(priv, i, PHY_EXT_REG_17, val); ++ } ++} ++ ++static void mt7988_mac_control(struct mtk_eth_priv *priv, bool enable) ++{ ++ u32 pmcr = FORCE_MODE_LNK; ++ ++ if (enable) ++ pmcr = priv->mt753x_pmcr; ++ ++ mt753x_reg_write(priv, PMCR_REG(6), pmcr); ++} ++ ++static int mt7988_setup(struct mtk_eth_priv *priv) ++{ ++ u16 phy_addr, phy_val; ++ u32 pmcr; ++ int i; ++ ++ priv->gsw_base = regmap_get_range(priv->ethsys_regmap, 0) + GSW_BASE; ++ ++ priv->mt753x_phy_base = (priv->mt753x_smi_addr + 1) & ++ MT753X_SMI_ADDR_MASK; ++ ++ /* Turn off PHYs */ ++ for (i = 0; i < MT753X_NUM_PHYS; i++) { ++ phy_addr = MT753X_PHY_ADDR(priv->mt753x_phy_base, i); ++ phy_val = priv->mii_read(priv, phy_addr, MII_BMCR); ++ phy_val |= BMCR_PDOWN; ++ priv->mii_write(priv, phy_addr, MII_BMCR, phy_val); ++ } ++ ++ switch (priv->phy_interface) { ++ case PHY_INTERFACE_MODE_USXGMII: ++ /* Use CPU bridge instead of actual USXGMII path */ ++ ++ /* Set GDM1 no drop */ ++ mtk_fe_rmw(priv, PSE_NO_DROP_CFG_REG, 0, PSE_NO_DROP_GDM1); ++ ++ /* Enable GDM1 to GSW CPU bridge */ ++ mtk_gmac_rmw(priv, GMAC_MAC_MISC_REG, 0, BIT(0)); ++ ++ /* XGMAC force link up */ ++ mtk_gmac_rmw(priv, GMAC_XGMAC_STS_REG, 0, P1_XGMAC_FORCE_LINK); ++ ++ /* Setup GSW CPU bridge IPG */ ++ mtk_gmac_rmw(priv, GMAC_GSW_CFG_REG, GSWTX_IPG_M | GSWRX_IPG_M, ++ (0xB << GSWTX_IPG_S) | (0xB << GSWRX_IPG_S)); ++ break; ++ default: ++ printf("Error: MT7988 GSW does not support %s interface\n", ++ phy_string_for_interface(priv->phy_interface)); ++ break; ++ } ++ ++ pmcr = MT7988_FORCE_MODE | ++ (IPG_96BIT_WITH_SHORT_IPG << IPG_CFG_S) | ++ MAC_MODE | MAC_TX_EN | MAC_RX_EN | ++ BKOFF_EN | BACKPR_EN | ++ FORCE_RX_FC | FORCE_TX_FC | ++ (SPEED_1000M << FORCE_SPD_S) | FORCE_DPX | ++ FORCE_LINK; ++ ++ priv->mt753x_pmcr = pmcr; ++ ++ /* Keep MAC link down before starting eth */ ++ mt753x_reg_write(priv, PMCR_REG(6), FORCE_MODE_LNK); ++ ++ /* Turn on PHYs */ ++ for (i = 0; i < MT753X_NUM_PHYS; i++) { ++ phy_addr = MT753X_PHY_ADDR(priv->mt753x_phy_base, i); ++ phy_val = priv->mii_read(priv, phy_addr, MII_BMCR); ++ phy_val &= ~BMCR_PDOWN; ++ priv->mii_write(priv, phy_addr, MII_BMCR, phy_val); ++ } ++ ++ mt7988_phy_setting(priv); ++ ++ return 0; ++} ++ + static int mt753x_switch_init(struct mtk_eth_priv *priv) + { + int ret; +@@ -1497,6 +1632,11 @@ static int mtk_eth_start(struct udevice + } + + if (MTK_HAS_CAPS(priv->soc->caps, MTK_NETSYS_V3)) { ++ if (priv->sw == SW_MT7988 && priv->gmac_id == 0) { ++ mtk_gdma_write(priv, priv->gmac_id, GDMA_IG_CTRL_REG, ++ GDMA_BRIDGE_TO_CPU); ++ } ++ + mtk_gdma_write(priv, priv->gmac_id, GDMA_EG_CTRL_REG, + GDMA_CPU_BRIDGE_EN); + } +@@ -1845,6 +1985,12 @@ static int mtk_eth_of_to_plat(struct ude + priv->switch_mac_control = mt7531_mac_control; + priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR; + priv->mt753x_reset_wait_time = 200; ++ } else if (!strcmp(str, "mt7988")) { ++ priv->sw = SW_MT7988; ++ priv->switch_init = mt7988_setup; ++ priv->switch_mac_control = mt7988_mac_control; ++ priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR; ++ priv->mt753x_reset_wait_time = 50; + } else { + printf("error: unsupported switch\n"); + return -EINVAL; +@@ -1879,6 +2025,15 @@ static int mtk_eth_of_to_plat(struct ude + return 0; + } + ++static const struct mtk_soc_data mt7988_data = { ++ .caps = MT7988_CAPS, ++ .ana_rgc3 = 0x128, ++ .gdma_count = 3, ++ .pdma_base = PDMA_V3_BASE, ++ .txd_size = sizeof(struct mtk_tx_dma_v2), ++ .rxd_size = sizeof(struct mtk_rx_dma_v2), ++}; ++ + static const struct mtk_soc_data mt7986_data = { + .caps = MT7986_CAPS, + .ana_rgc3 = 0x128, +@@ -1930,6 +2085,7 @@ static const struct mtk_soc_data mt7621_ + }; + + static const struct udevice_id mtk_eth_ids[] = { ++ { .compatible = "mediatek,mt7988-eth", .data = (ulong)&mt7988_data }, + { .compatible = "mediatek,mt7986-eth", .data = (ulong)&mt7986_data }, + { .compatible = "mediatek,mt7981-eth", .data = (ulong)&mt7981_data }, + { .compatible = "mediatek,mt7629-eth", .data = (ulong)&mt7629_data }, +--- a/drivers/net/mtk_eth.h ++++ b/drivers/net/mtk_eth.h +@@ -51,6 +51,8 @@ enum mkt_eth_capabilities { + + #define MT7986_CAPS (MTK_NETSYS_V2) + ++#define MT7988_CAPS (MTK_NETSYS_V3 | MTK_INFRA) ++ + /* Frame Engine Register Bases */ + #define PDMA_V1_BASE 0x0800 + #define PDMA_V2_BASE 0x6000 +@@ -59,6 +61,7 @@ enum mkt_eth_capabilities { + #define GDMA2_BASE 0x1500 + #define GDMA3_BASE 0x0540 + #define GMAC_BASE 0x10000 ++#define GSW_BASE 0x20000 + + /* Ethernet subsystem registers */ + +@@ -117,6 +120,9 @@ enum mkt_eth_capabilities { + #define RG_XFI_PLL_ANA_SWWA 0x02283248 + + /* Frame Engine Registers */ ++#define PSE_NO_DROP_CFG_REG 0x108 ++#define PSE_NO_DROP_GDM1 BIT(1) ++ + #define FE_GLO_MISC_REG 0x124 + #define PDMA_VER_V2 BIT(4) + +@@ -187,6 +193,17 @@ enum mkt_eth_capabilities { + #define MDIO_RW_DATA_S 0 + #define MDIO_RW_DATA_M 0xffff + ++#define GMAC_XGMAC_STS_REG 0x000c ++#define P1_XGMAC_FORCE_LINK BIT(15) ++ ++#define GMAC_MAC_MISC_REG 0x0010 ++ ++#define GMAC_GSW_CFG_REG 0x0080 ++#define GSWTX_IPG_M 0xF0000 ++#define GSWTX_IPG_S 16 ++#define GSWRX_IPG_M 0xF ++#define GSWRX_IPG_S 0 ++ + /* MDIO_CMD: MDIO commands */ + #define MDIO_CMD_ADDR 0 + #define MDIO_CMD_WRITE 1 +@@ -285,6 +302,9 @@ enum mkt_eth_capabilities { + FORCE_MODE_TX_FC | FORCE_MODE_RX_FC | \ + FORCE_MODE_DPX | FORCE_MODE_SPD | \ + FORCE_MODE_LNK ++#define MT7988_FORCE_MODE FORCE_MODE_TX_FC | FORCE_MODE_RX_FC | \ ++ FORCE_MODE_DPX | FORCE_MODE_SPD | \ ++ FORCE_MODE_LNK + + /* MT7531 SGMII Registers */ + #define MT7531_SGMII_REG_BASE 0x5000 diff --git a/package/boot/uboot-mediatek/patches/101-27-tools-mtk_image-use-uint32_t-for-ghf-header-magic-an.patch b/package/boot/uboot-mediatek/patches/101-27-tools-mtk_image-use-uint32_t-for-ghf-header-magic-an.patch new file mode 100644 index 00000000000000..07620f77b31400 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-27-tools-mtk_image-use-uint32_t-for-ghf-header-magic-an.patch @@ -0,0 +1,55 @@ +From 757b997f1f5a958e6fec3d5aee1ff5cdf5766711 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:45 +0800 +Subject: [PATCH 27/29] tools: mtk_image: use uint32_t for ghf header magic and + version + +This patch converts magic and version fields of ghf common header +to one field with the type of uint32_t to make this header flexible +for futher updates. + +Signed-off-by: Weijie Gao +--- + tools/mtk_image.c | 10 ++++++---- + tools/mtk_image.h | 6 +++--- + 2 files changed, 9 insertions(+), 7 deletions(-) + +--- a/tools/mtk_image.c ++++ b/tools/mtk_image.c +@@ -542,11 +542,13 @@ static void put_brom_layout_header(struc + hdr->type = cpu_to_le32(type); + } + +-static void put_ghf_common_header(struct gfh_common_header *gfh, int size, +- int type, int ver) ++static void put_ghf_common_header(struct gfh_common_header *gfh, uint16_t size, ++ uint16_t type, uint8_t ver) + { +- memcpy(gfh->magic, GFH_HEADER_MAGIC, sizeof(gfh->magic)); +- gfh->version = ver; ++ uint32_t magic_version = GFH_HEADER_MAGIC | ++ (uint32_t)ver << GFH_HEADER_VERSION_SHIFT; ++ ++ gfh->magic_version = cpu_to_le32(magic_version); + gfh->size = cpu_to_le16(size); + gfh->type = cpu_to_le16(type); + } +--- a/tools/mtk_image.h ++++ b/tools/mtk_image.h +@@ -63,13 +63,13 @@ struct gen_device_header { + + /* BootROM header definitions */ + struct gfh_common_header { +- uint8_t magic[3]; +- uint8_t version; ++ uint32_t magic_version; + uint16_t size; + uint16_t type; + }; + +-#define GFH_HEADER_MAGIC "MMM" ++#define GFH_HEADER_MAGIC 0x4D4D4D ++#define GFH_HEADER_VERSION_SHIFT 24 + + #define GFH_TYPE_FILE_INFO 0 + #define GFH_TYPE_BL_INFO 1 diff --git a/package/boot/uboot-mediatek/patches/101-28-arm-mediatek-add-support-for-MediaTek-MT7988-SoC.patch b/package/boot/uboot-mediatek/patches/101-28-arm-mediatek-add-support-for-MediaTek-MT7988-SoC.patch new file mode 100644 index 00000000000000..f54a028b4262b8 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-28-arm-mediatek-add-support-for-MediaTek-MT7988-SoC.patch @@ -0,0 +1,606 @@ +From 884430dadcc2c5d0a2b248795001955a9fa5a1a9 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:49 +0800 +Subject: [PATCH 28/29] arm: mediatek: add support for MediaTek MT7988 SoC + +This patch adds basic support for MediaTek MT7988 SoC. +This includes files that will initialize the SoC after boot and +its device tree. + +Signed-off-by: Weijie Gao +--- + arch/arm/dts/mt7988-u-boot.dtsi | 25 ++ + arch/arm/dts/mt7988.dtsi | 391 ++++++++++++++++++ + arch/arm/mach-mediatek/Kconfig | 13 +- + arch/arm/mach-mediatek/Makefile | 1 + + arch/arm/mach-mediatek/mt7988/Makefile | 4 + + arch/arm/mach-mediatek/mt7988/init.c | 63 +++ + arch/arm/mach-mediatek/mt7988/lowlevel_init.S | 30 ++ + 7 files changed, 526 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/dts/mt7988-u-boot.dtsi + create mode 100644 arch/arm/dts/mt7988.dtsi + create mode 100644 arch/arm/mach-mediatek/mt7988/Makefile + create mode 100644 arch/arm/mach-mediatek/mt7988/init.c + create mode 100644 arch/arm/mach-mediatek/mt7988/lowlevel_init.S + +--- /dev/null ++++ b/arch/arm/dts/mt7988-u-boot.dtsi +@@ -0,0 +1,25 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++&system_clk { ++ bootph-all; ++}; ++ ++&spi_clk { ++ bootph-all; ++}; ++ ++&uart0 { ++ bootph-all; ++}; ++ ++&uart1 { ++ bootph-all; ++}; ++ ++&uart2 { ++ bootph-all; ++}; +--- /dev/null ++++ b/arch/arm/dts/mt7988.dtsi +@@ -0,0 +1,391 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++/ { ++ compatible = "mediatek,mt7988-rfb"; ++ interrupt-parent = <&gic>; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ++ cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a73"; ++ reg = <0x0>; ++ mediatek,hwver = <&hwver>; ++ }; ++ ++ cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a73"; ++ reg = <0x1>; ++ mediatek,hwver = <&hwver>; ++ }; ++ ++ cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a73"; ++ reg = <0x2>; ++ mediatek,hwver = <&hwver>; ++ }; ++ ++ cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a73"; ++ reg = <0x3>; ++ mediatek,hwver = <&hwver>; ++ }; ++ }; ++ ++ system_clk: dummy40m { ++ compatible = "fixed-clock"; ++ clock-frequency = <40000000>; ++ #clock-cells = <0>; ++ }; ++ ++ spi_clk: dummy208m { ++ compatible = "fixed-clock"; ++ clock-frequency = <208000000>; ++ #clock-cells = <0>; ++ }; ++ ++ hwver: hwver { ++ compatible = "mediatek,hwver", "syscon"; ++ reg = <0 0x8000000 0 0x1000>; ++ }; ++ ++ timer { ++ compatible = "arm,armv8-timer"; ++ interrupt-parent = <&gic>; ++ clock-frequency = <13000000>; ++ interrupts = , ++ , ++ , ++ ; ++ }; ++ ++ watchdog: watchdog@1001c000 { ++ compatible = "mediatek,mt7622-wdt", ++ "mediatek,mt6589-wdt", ++ "syscon"; ++ reg = <0 0x1001c000 0 0x1000>; ++ interrupts = ; ++ #reset-cells = <1>; ++ }; ++ ++ gic: interrupt-controller@c000000 { ++ compatible = "arm,gic-v3"; ++ #interrupt-cells = <3>; ++ interrupt-parent = <&gic>; ++ interrupt-controller; ++ reg = <0 0x0c000000 0 0x40000>, /* GICD */ ++ <0 0x0c080000 0 0x200000>; /* GICR */ ++ interrupts = ; ++ }; ++ ++ infracfg_ao_cgs: infracfg_ao_cgs@10001000 { ++ compatible = "mediatek,mt7988-infracfg_ao_cgs", "syscon"; ++ reg = <0 0x10001000 0 0x1000>; ++ clock-parent = <&infracfg_ao>; ++ #clock-cells = <1>; ++ }; ++ ++ apmixedsys: apmixedsys@1001e000 { ++ compatible = "mediatek,mt7988-fixed-plls", "syscon"; ++ reg = <0 0x1001e000 0 0x1000>; ++ #clock-cells = <1>; ++ }; ++ ++ topckgen: topckgen@1001b000 { ++ compatible = "mediatek,mt7988-topckgen", "syscon"; ++ reg = <0 0x1001b000 0 0x1000>; ++ clock-parent = <&apmixedsys>; ++ #clock-cells = <1>; ++ }; ++ ++ pinctrl: pinctrl@1001f000 { ++ compatible = "mediatek,mt7988-pinctrl"; ++ reg = <0 0x1001f000 0 0x1000>, ++ <0 0x11c10000 0 0x1000>, ++ <0 0x11d00000 0 0x1000>, ++ <0 0x11d20000 0 0x1000>, ++ <0 0x11e00000 0 0x1000>, ++ <0 0x11f00000 0 0x1000>, ++ <0 0x1000b000 0 0x1000>; ++ reg-names = "gpio_base", "iocfg_tr_base", "iocfg_br_base", ++ "iocfg_rb_base", "iocfg_lb_base", "iocfg_tl_base", ++ "eint"; ++ gpio: gpio-controller { ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; ++ }; ++ ++ sgmiisys0: syscon@10060000 { ++ compatible = "mediatek,mt7988-sgmiisys_0", "syscon"; ++ reg = <0 0x10060000 0 0x1000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ sgmiisys1: syscon@10070000 { ++ compatible = "mediatek,mt7988-sgmiisys_1", "syscon"; ++ reg = <0 0x10070000 0 0x1000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ usxgmiisys0: syscon@10080000 { ++ compatible = "mediatek,mt7988-usxgmiisys_0", "syscon"; ++ reg = <0 0x10080000 0 0x1000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ usxgmiisys1: syscon@10081000 { ++ compatible = "mediatek,mt7988-usxgmiisys_1", "syscon"; ++ reg = <0 0x10081000 0 0x1000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ xfi_pextp0: syscon@11f20000 { ++ compatible = "mediatek,mt7988-xfi_pextp_0", "syscon"; ++ reg = <0 0x11f20000 0 0x10000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ xfi_pextp1: syscon@11f30000 { ++ compatible = "mediatek,mt7988-xfi_pextp_1", "syscon"; ++ reg = <0 0x11f30000 0 0x10000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ xfi_pll: syscon@11f40000 { ++ compatible = "mediatek,mt7988-xfi_pll", "syscon"; ++ reg = <0 0x11f40000 0 0x1000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ topmisc: topmisc@11d10000 { ++ compatible = "mediatek,mt7988-topmisc", "syscon", ++ "mediatek,mt7988-power-controller"; ++ reg = <0 0x11d10000 0 0x10000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ infracfg_ao: infracfg@10001000 { ++ compatible = "mediatek,mt7988-infracfg", "syscon"; ++ reg = <0 0x10001000 0 0x1000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ }; ++ ++ uart0: serial@11000000 { ++ compatible = "mediatek,hsuart"; ++ reg = <0 0x11000000 0 0x100>; ++ interrupts = ; ++ clocks = <&infracfg_ao_cgs CK_INFRA_52M_UART0_CK>; ++ assigned-clocks = <&topckgen CK_TOP_UART_SEL>, ++ <&infracfg_ao CK_INFRA_MUX_UART0_SEL>; ++ assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>, ++ <&infracfg_ao CK_INFRA_UART_O0>; ++ status = "disabled"; ++ }; ++ ++ uart1: serial@11000100 { ++ compatible = "mediatek,hsuart"; ++ reg = <0 0x11000100 0 0x100>; ++ interrupts = ; ++ clocks = <&infracfg_ao_cgs CK_INFRA_52M_UART1_CK>; ++ assigned-clocks = <&topckgen CK_TOP_UART_SEL>, ++ <&infracfg_ao CK_INFRA_MUX_UART1_SEL>; ++ assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>, ++ <&infracfg_ao CK_INFRA_UART_O1>; ++ status = "disabled"; ++ }; ++ ++ uart2: serial@11000200 { ++ compatible = "mediatek,hsuart"; ++ reg = <0 0x11000200 0 0x100>; ++ interrupts = ; ++ clocks = <&infracfg_ao_cgs CK_INFRA_52M_UART2_CK>; ++ assigned-clocks = <&topckgen CK_TOP_UART_SEL>, ++ <&infracfg_ao CK_INFRA_MUX_UART2_SEL>; ++ assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>, ++ <&infracfg_ao CK_INFRA_UART_O2>; ++ status = "disabled"; ++ }; ++ ++ i2c0: i2c@11003000 { ++ compatible = "mediatek,mt7988-i2c", ++ "mediatek,mt7981-i2c"; ++ reg = <0 0x11003000 0 0x1000>, ++ <0 0x10217080 0 0x80>; ++ interrupts = ; ++ clock-div = <1>; ++ clocks = <&infracfg_ao CK_INFRA_I2C_BCK>, ++ <&infracfg_ao CK_INFRA_66M_AP_DMA_BCK>; ++ clock-names = "main", "dma"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c1: i2c@11004000 { ++ compatible = "mediatek,mt7988-i2c", ++ "mediatek,mt7981-i2c"; ++ reg = <0 0x11004000 0 0x1000>, ++ <0 0x10217100 0 0x80>; ++ interrupts = ; ++ clock-div = <1>; ++ clocks = <&infracfg_ao CK_INFRA_I2C_BCK>, ++ <&infracfg_ao CK_INFRA_66M_AP_DMA_BCK>; ++ clock-names = "main", "dma"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c2: i2c@11005000 { ++ compatible = "mediatek,mt7988-i2c", ++ "mediatek,mt7981-i2c"; ++ reg = <0 0x11005000 0 0x1000>, ++ <0 0x10217180 0 0x80>; ++ interrupts = ; ++ clock-div = <1>; ++ clocks = <&infracfg_ao CK_INFRA_I2C_BCK>, ++ <&infracfg_ao CK_INFRA_66M_AP_DMA_BCK>; ++ clock-names = "main", "dma"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ pwm: pwm@10048000 { ++ compatible = "mediatek,mt7988-pwm"; ++ reg = <0 0x10048000 0 0x1000>; ++ #pwm-cells = <2>; ++ clocks = <&infracfg_ao CK_INFRA_66M_PWM_BCK>, ++ <&infracfg_ao CK_INFRA_66M_PWM_HCK>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK1>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK2>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK3>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK4>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK5>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK6>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK7>, ++ <&infracfg_ao CK_INFRA_66M_PWM_CK8>; ++ clock-names = "top", "main", "pwm1", "pwm2", "pwm3", ++ "pwm4","pwm5","pwm6","pwm7","pwm8"; ++ status = "disabled"; ++ }; ++ ++ snand: snand@11001000 { ++ compatible = "mediatek,mt7988-snand", ++ "mediatek,mt7986-snand"; ++ reg = <0 0x11001000 0 0x1000>, ++ <0 0x11002000 0 0x1000>; ++ reg-names = "nfi", "ecc"; ++ interrupts = ; ++ clocks = <&infracfg_ao CK_INFRA_SPINFI>, ++ <&infracfg_ao CK_INFRA_NFI>, ++ <&infracfg_ao CK_INFRA_66M_NFI_HCK>; ++ clock-names = "pad_clk", "nfi_clk", "nfi_hclk"; ++ assigned-clocks = <&topckgen CK_TOP_SPINFI_SEL>, ++ <&topckgen CK_TOP_NFI1X_SEL>; ++ assigned-clock-parents = <&topckgen CK_TOP_CB_M_D8>, ++ <&topckgen CK_TOP_CB_M_D8>; ++ status = "disabled"; ++ }; ++ ++ spi0: spi@1100a000 { ++ compatible = "mediatek,ipm-spi"; ++ reg = <0 0x11007000 0 0x100>; ++ clocks = <&spi_clk>, ++ <&spi_clk>; ++ clock-names = "sel-clk", "spi-clk"; ++ interrupts = ; ++ status = "disabled"; ++ }; ++ ++ spi1: spi@1100b000 { ++ compatible = "mediatek,ipm-spi"; ++ reg = <0 0x11008000 0 0x100>; ++ interrupts = ; ++ status = "disabled"; ++ }; ++ ++ spi2: spi@11009000 { ++ compatible = "mediatek,ipm-spi"; ++ reg = <0 0x11009000 0 0x100>; ++ clocks = <&spi_clk>, ++ <&spi_clk>; ++ clock-names = "sel-clk", "spi-clk"; ++ interrupts = ; ++ status = "disabled"; ++ }; ++ ++ mmc0: mmc@11230000 { ++ compatible = "mediatek,mt7988-mmc", ++ "mediatek,mt7986-mmc"; ++ reg = <0 0x11230000 0 0x1000>; ++ interrupts = ; ++ clocks = <&infracfg_ao_cgs CK_INFRA_MSDC400>, ++ <&infracfg_ao_cgs CK_INFRA_MSDC2_HCK>, ++ <&infracfg_ao_cgs CK_INFRA_133M_MSDC_0_HCK>, ++ <&infracfg_ao_cgs CK_INFRA_66M_MSDC_0_HCK>; ++ clock-names = "source", "hclk", "source_cg", "axi_cg"; ++ status = "disabled"; ++ }; ++ ++ ethdma: syscon@15000000 { ++ compatible = "mediatek,mt7988-ethdma", "syscon"; ++ reg = <0 0x15000000 0 0x20000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ }; ++ ++ ethwarp: syscon@15031000 { ++ compatible = "mediatek,mt7988-ethwarp", "syscon"; ++ reg = <0 0x15031000 0 0x1000>; ++ clock-parent = <&topckgen>; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ }; ++ ++ eth: ethernet@15100000 { ++ compatible = "mediatek,mt7988-eth", "syscon"; ++ reg = <0 0x15100000 0 0x20000>; ++ mediatek,ethsys = <ðdma>; ++ mediatek,sgmiisys = <&sgmiisys0>; ++ mediatek,usxgmiisys = <&usxgmiisys0>; ++ mediatek,xfi_pextp = <&xfi_pextp0>; ++ mediatek,xfi_pll = <&xfi_pll>; ++ mediatek,infracfg = <&topmisc>; ++ mediatek,toprgu = <&watchdog>; ++ resets = <ðdma ETHDMA_FE_RST>, <ðwarp ETHWARP_GSW_RST>; ++ reset-names = "fe", "mcm"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ mediatek,mcm; ++ status = "disabled"; ++ }; ++}; +--- a/arch/arm/mach-mediatek/Kconfig ++++ b/arch/arm/mach-mediatek/Kconfig +@@ -58,6 +58,15 @@ config TARGET_MT7986 + including UART, SPI, SPI flash, USB3.0, MMC, NAND, SNFI, PWM, PCIe, + Gigabit Ethernet, I2C, built-in 4x4 Wi-Fi, and PCIe. + ++config TARGET_MT7988 ++ bool "MediaTek MT7988 SoC" ++ select ARM64 ++ select CPU ++ help ++ The MediaTek MT7988 is a ARM64-based SoC with a quad-core Cortex-A73. ++ including UART, SPI, SPI flash, USB3.0, MMC, NAND, SNFI, PWM, PCIe, ++ 10 Gigabit Ethernet , I2C, and PCIe. ++ + config TARGET_MT8183 + bool "MediaTek MT8183 SoC" + select ARM64 +@@ -104,6 +113,7 @@ config SYS_BOARD + default "mt7629" if TARGET_MT7629 + default "mt7981" if TARGET_MT7981 + default "mt7986" if TARGET_MT7986 ++ default "mt7988" if TARGET_MT7988 + default "mt8183" if TARGET_MT8183 + default "mt8512" if TARGET_MT8512 + default "mt8516" if TARGET_MT8516 +@@ -121,6 +131,7 @@ config SYS_CONFIG_NAME + default "mt7629" if TARGET_MT7629 + default "mt7981" if TARGET_MT7981 + default "mt7986" if TARGET_MT7986 ++ default "mt7988" if TARGET_MT7988 + default "mt8183" if TARGET_MT8183 + default "mt8512" if TARGET_MT8512 + default "mt8516" if TARGET_MT8516 +@@ -135,7 +146,7 @@ config MTK_BROM_HEADER_INFO + string + default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7622 + default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 +- default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986 ++ default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986 || TARGET_MT7988 + default "lk=1" if TARGET_MT7623 + + source "board/mediatek/mt7629/Kconfig" +--- a/arch/arm/mach-mediatek/Makefile ++++ b/arch/arm/mach-mediatek/Makefile +@@ -9,6 +9,7 @@ obj-$(CONFIG_TARGET_MT7623) += mt7623/ + obj-$(CONFIG_TARGET_MT7629) += mt7629/ + obj-$(CONFIG_TARGET_MT7981) += mt7981/ + obj-$(CONFIG_TARGET_MT7986) += mt7986/ ++obj-$(CONFIG_TARGET_MT7988) += mt7988/ + obj-$(CONFIG_TARGET_MT8183) += mt8183/ + obj-$(CONFIG_TARGET_MT8516) += mt8516/ + obj-$(CONFIG_TARGET_MT8518) += mt8518/ +--- /dev/null ++++ b/arch/arm/mach-mediatek/mt7988/Makefile +@@ -0,0 +1,4 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++obj-y += init.o ++obj-y += lowlevel_init.o +--- /dev/null ++++ b/arch/arm/mach-mediatek/mt7988/init.c +@@ -0,0 +1,63 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++#define SZ_8G _AC(0x200000000, ULL) ++ ++int dram_init(void) ++{ ++ int ret; ++ ++ ret = fdtdec_setup_mem_size_base(); ++ if (ret) ++ return ret; ++ ++ gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_8G); ++ ++ return 0; ++} ++ ++int dram_init_banksize(void) ++{ ++ gd->bd->bi_dram[0].start = gd->ram_base; ++ gd->bd->bi_dram[0].size = gd->ram_size; ++ ++ return 0; ++} ++ ++void reset_cpu(ulong addr) ++{ ++ psci_system_reset(); ++} ++ ++static struct mm_region mt7988_mem_map[] = { ++ { ++ /* DDR */ ++ .virt = 0x40000000UL, ++ .phys = 0x40000000UL, ++ .size = 0x200000000ULL, ++ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, ++ }, { ++ .virt = 0x00000000UL, ++ .phys = 0x00000000UL, ++ .size = 0x40000000UL, ++ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | ++ PTE_BLOCK_NON_SHARE | ++ PTE_BLOCK_PXN | PTE_BLOCK_UXN ++ }, { ++ 0, ++ } ++}; ++ ++struct mm_region *mem_map = mt7988_mem_map; +--- /dev/null ++++ b/arch/arm/mach-mediatek/mt7988/lowlevel_init.S +@@ -0,0 +1,30 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (C) 2020 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/* ++ * Switch from AArch64 EL2 to AArch32 EL2 ++ * @param inputs: ++ * x0: argument, zero ++ * x1: machine nr ++ * x2: fdt address ++ * x3: input argument ++ * x4: kernel entry point ++ * @param outputs for secure firmware: ++ * x0: function id ++ * x1: kernel entry point ++ * x2: machine nr ++ * x3: fdt address ++*/ ++ ++.global armv8_el2_to_aarch32 ++armv8_el2_to_aarch32: ++ mov x3, x2 ++ mov x2, x1 ++ mov x1, x4 ++ mov x4, #0 ++ ldr x0, =0x82000200 ++ SMC #0 ++ ret diff --git a/package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch b/package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch new file mode 100644 index 00000000000000..e2a7309e7e1d6f --- /dev/null +++ b/package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch @@ -0,0 +1,575 @@ +From fd7d9124ffa6761f27747daeea599e0ab874c1fa Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Wed, 19 Jul 2023 17:17:54 +0800 +Subject: [PATCH 29/29] board: mediatek: add MT7988 reference boards + +This patch adds general board files based on MT7988 SoCs. + +MT7988 uses one mmc controller for booting from both SD and eMMC, +and the pins of mmc controller booting from SD are also shared with +one of spi controllers. +So two configs are need for these boot types: + +1. mt7988_rfb_defconfig - SPI-NOR, SPI-NAND and eMMC +2. mt7988_sd_rfb_defconfig - SPI-NAND and SD + +Signed-off-by: Weijie Gao +--- + arch/arm/dts/Makefile | 2 + + arch/arm/dts/mt7988-rfb.dts | 182 +++++++++++++++++++++++++++++ + arch/arm/dts/mt7988-sd-rfb.dts | 134 +++++++++++++++++++++ + board/mediatek/mt7988/MAINTAINERS | 7 ++ + board/mediatek/mt7988/Makefile | 3 + + board/mediatek/mt7988/mt7988_rfb.c | 10 ++ + configs/mt7988_rfb_defconfig | 83 +++++++++++++ + configs/mt7988_sd_rfb_defconfig | 71 +++++++++++ + include/configs/mt7988.h | 14 +++ + 9 files changed, 506 insertions(+) + create mode 100644 arch/arm/dts/mt7988-rfb.dts + create mode 100644 arch/arm/dts/mt7988-sd-rfb.dts + create mode 100644 board/mediatek/mt7988/MAINTAINERS + create mode 100644 board/mediatek/mt7988/Makefile + create mode 100644 board/mediatek/mt7988/mt7988_rfb.c + create mode 100644 configs/mt7988_rfb_defconfig + create mode 100644 configs/mt7988_sd_rfb_defconfig + create mode 100644 include/configs/mt7988.h + +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -1319,6 +1319,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + mt7986b-sd-rfb.dtb \ + mt7986a-emmc-rfb.dtb \ + mt7986b-emmc-rfb.dtb \ ++ mt7988-rfb.dtb \ ++ mt7988-sd-rfb.dtb \ + mt8183-pumpkin.dtb \ + mt8512-bm1-emmc.dtb \ + mt8516-pumpkin.dtb \ +--- /dev/null ++++ b/arch/arm/dts/mt7988-rfb.dts +@@ -0,0 +1,182 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7988.dtsi" ++#include ++ ++/ { ++ model = "mt7988-rfb"; ++ compatible = "mediatek,mt7988-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0 0x40000000 0 0x10000000>; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_1p8v: regulator-1p8v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-1.8V"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "usxgmii"; ++ mediatek,switch = "mt7988"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ pause; ++ }; ++}; ++ ++&pinctrl { ++ i2c1_pins: i2c1-pins { ++ mux { ++ function = "i2c"; ++ groups = "i2c1_0"; ++ }; ++ }; ++ ++ pwm_pins: pwm-pins { ++ mux { ++ function = "pwm"; ++ groups = "pwm0", "pwm1", "pwm2", "pwm3", "pwm4", ++ "pwm5", "pwm6", "pwm7"; ++ }; ++ }; ++ ++ spi0_pins: spi0-pins { ++ mux { ++ function = "spi"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ }; ++ ++ spi2_pins: spi2-pins { ++ mux { ++ function = "spi"; ++ groups = "spi2", "spi2_wp_hold"; ++ }; ++ }; ++ ++ mmc0_pins_default: mmc0default { ++ mux { ++ function = "flash"; ++ groups = "emmc_51"; ++ }; ++ ++ conf-cmd-dat { ++ pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", ++ "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", ++ "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; ++ input-enable; ++ }; ++ ++ conf-clk { ++ pins = "EMMC_CK"; ++ }; ++ ++ conf-dsl { ++ pins = "EMMC_DSL"; ++ }; ++ ++ conf-rst { ++ pins = "EMMC_RSTB"; ++ }; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ }; ++}; ++ ++&spi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nor@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ }; ++}; ++ ++&mmc0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc0_pins_default>; ++ max-frequency = <52000000>; ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ cap-mmc-hw-reset; ++ vmmc-supply = <®_3p3v>; ++ vqmmc-supply = <®_1p8v>; ++ non-removable; ++ status = "okay"; ++}; +--- /dev/null ++++ b/arch/arm/dts/mt7988-sd-rfb.dts +@@ -0,0 +1,134 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7988.dtsi" ++#include ++ ++/ { ++ model = "mt7988-rfb"; ++ compatible = "mediatek,mt7988-rfb", "mediatek,mt7988-sd-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0 0x40000000 0 0x10000000>; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "usxgmii"; ++ mediatek,switch = "mt7988"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ pause; ++ }; ++}; ++ ++&pinctrl { ++ i2c1_pins: i2c1-pins { ++ mux { ++ function = "i2c"; ++ groups = "i2c1_0"; ++ }; ++ }; ++ ++ pwm_pins: pwm-pins { ++ mux { ++ function = "pwm"; ++ groups = "pwm0", "pwm1", "pwm2", "pwm3", "pwm4", ++ "pwm5", "pwm6", "pwm7"; ++ }; ++ }; ++ ++ spi0_pins: spi0-pins { ++ mux { ++ function = "spi"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ }; ++ ++ mmc1_pins_default: mmc1default { ++ mux { ++ function = "flash"; ++ groups = "emmc_45"; ++ }; ++ ++ conf-cmd-dat { ++ pins = "SPI2_CSB", "SPI2_MISO", "SPI2_MOSI", ++ "SPI2_CLK", "SPI2_HOLD"; ++ input-enable; ++ }; ++ ++ conf-clk { ++ pins = "SPI2_WP"; ++ }; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ }; ++}; ++ ++&mmc0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc1_pins_default>; ++ max-frequency = <52000000>; ++ bus-width = <4>; ++ cap-sd-highspeed; ++ vmmc-supply = <®_3p3v>; ++ vqmmc-supply = <®_3p3v>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/board/mediatek/mt7988/MAINTAINERS +@@ -0,0 +1,7 @@ ++MT7988 ++M: Sam Shih ++S: Maintained ++F: board/mediatek/mt7988 ++F: include/configs/mt7988.h ++F: configs/mt7988_rfb_defconfig ++F: configs/mt7988_sd_rfb_defconfig +--- /dev/null ++++ b/board/mediatek/mt7988/Makefile +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++obj-y += mt7988_rfb.o +--- /dev/null ++++ b/board/mediatek/mt7988/mt7988_rfb.c +@@ -0,0 +1,10 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++int board_init(void) ++{ ++ return 0; ++} +--- /dev/null ++++ b/configs/mt7988_rfb_defconfig +@@ -0,0 +1,83 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7988-rfb" ++CONFIG_SYS_PROMPT="MT7988> " ++CONFIG_TARGET_MT7988=y ++CONFIG_DEBUG_UART_BASE=0x11000000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART=y ++# CONFIG_AUTOBOOT is not set ++CONFIG_DEFAULT_FDT_FILE="mt7988-rfb" ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++# CONFIG_BOOTM_NETBSD is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_CMD_ELF is not set ++CONFIG_CMD_CLK=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_SMC=y ++CONFIG_DOS_PARTITION=y ++CONFIG_EFI_PARTITION=y ++CONFIG_PARTITION_TYPE_GUID=y ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_NETMASK=y ++CONFIG_NETMASK="255.255.255.0" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.2" ++CONFIG_PROT_TCP=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_MMC_HS200_SUPPORT=y ++CONFIG_MMC_MTK=y ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_SPI_FLASH_SFDP_SUPPORT=y ++CONFIG_SPI_FLASH_EON=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_ISSI=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_SPI_FLASH_STMICRO=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XMC=y ++CONFIG_SPI_FLASH_XTX=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7988=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_LZO=y ++CONFIG_HEXDUMP=y ++# CONFIG_EFI_LOADER is not set +--- /dev/null ++++ b/configs/mt7988_sd_rfb_defconfig +@@ -0,0 +1,71 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7988-sd-rfb" ++CONFIG_SYS_PROMPT="MT7988> " ++CONFIG_TARGET_MT7988=y ++CONFIG_DEBUG_UART_BASE=0x11000000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART=y ++# CONFIG_AUTOBOOT is not set ++CONFIG_DEFAULT_FDT_FILE="mt7988-sd-rfb" ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++# CONFIG_BOOTM_NETBSD is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_CMD_ELF is not set ++CONFIG_CMD_CLK=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_SMC=y ++CONFIG_DOS_PARTITION=y ++CONFIG_EFI_PARTITION=y ++CONFIG_PARTITION_TYPE_GUID=y ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_NETMASK=y ++CONFIG_NETMASK="255.255.255.0" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.2" ++CONFIG_PROT_TCP=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_MMC_HS200_SUPPORT=y ++CONFIG_MMC_MTK=y ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7988=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_LZO=y ++CONFIG_HEXDUMP=y ++# CONFIG_EFI_LOADER is not set +--- /dev/null ++++ b/include/configs/mt7988.h +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Configuration for MediaTek MT7988 SoC ++ * ++ * Copyright (C) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++#ifndef __MT7988_H ++#define __MT7988_H ++ ++#define CFG_MAX_MEM_MAPPED 0xC0000000 ++ ++#endif diff --git a/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch index 1862a9344ad631..65990156c22211 100644 --- a/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch +++ b/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch @@ -17,7 +17,7 @@ #include #include -@@ -25,7 +32,22 @@ int board_init(void) +@@ -24,7 +31,22 @@ int board_init(void) int board_late_init(void) { @@ -43,7 +43,7 @@ } --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig -@@ -140,4 +140,11 @@ config MTK_BROM_HEADER_INFO +@@ -151,4 +151,11 @@ config MTK_BROM_HEADER_INFO source "board/mediatek/mt7629/Kconfig" diff --git a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch index bc9b3f400108c7..363509efc1b344 100644 --- a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch +++ b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch @@ -323,12 +323,12 @@ +ð { + status = "okay"; + mediatek,gmac-id = <0>; -+ phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>; + + fixed-link { -+ speed = <1000>; ++ speed = <2500>; + full-duplex; + }; +}; diff --git a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch index 7d37b1adc6b582..b495f48d6685f9 100644 --- a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch +++ b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch @@ -320,11 +320,11 @@ + pinctrl-0 = <ð_pins>; + + mediatek,gmac-id = <0>; -+ phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + phy-handle = <&gphy>; + + fixed-link { -+ speed = <1000>; ++ speed = <2500>; + full-duplex; + }; + diff --git a/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch b/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch index 4e876fe20fd89f..b1c25ba7915b72 100644 --- a/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch +++ b/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch @@ -634,12 +634,12 @@ +ð { + status = "okay"; + mediatek,gmac-id = <0>; -+ phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + + fixed-link { -+ speed = <1000>; ++ speed = <2500>; + full-duplex; + }; +}; diff --git a/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch b/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch index 2be7e18c6ec94d..aaaeaa4f8ae069 100644 --- a/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch +++ b/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch @@ -246,12 +246,12 @@ +ð { + status = "okay"; + mediatek,gmac-id = <0>; -+ phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; + + fixed-link { -+ speed = <1000>; ++ speed = <2500>; + full-duplex; + }; +}; diff --git a/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch b/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch index e7d1ce764cbb77..57181c73c0e1a0 100644 --- a/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch +++ b/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch @@ -246,12 +246,12 @@ +ð { + status = "okay"; + mediatek,gmac-id = <0>; -+ phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; + + fixed-link { -+ speed = <1000>; ++ speed = <2500>; + full-duplex; + }; +}; From 0415aba6a937c71fa3071f2c385dc66ff3f074aa Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 31 Jul 2023 17:46:22 +0100 Subject: [PATCH 0324/1171] uboot-mediatek: add missing 'memory' nodes to downstream boards Among the patches adding support for MT7988 also came the switch to use fdtdec_setup_mem_size_base() and no longer rely on CFG_SYS_SDRAM_BASE. Take care of our downstream boards which did not have a 'memory' node in their device trees. Fixes: 572ea68070 ("uboot-mediatek: add patches for MT7988 and builds for RFB") Signed-off-by: Daniel Golle --- .../uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch | 7 ++++++- .../patches/431-add-xiaomi_redmi-ax6000.patch | 7 ++++++- .../uboot-mediatek/patches/432-add-tplink-xdr608x.patch | 7 ++++++- .../boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch | 7 ++++++- .../patches/434-add-xiaomi_mi-router-wr30u.patch | 7 ++++++- .../patches/435-add-h3c_magic-nx30-pro.patch | 7 ++++++- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch index b495f48d6685f9..4bde0617653194 100644 --- a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch +++ b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch @@ -150,7 +150,7 @@ +CONFIG_SERVERIP="192.168.1.254" --- /dev/null +++ b/arch/arm/dts/mt7622-ubnt-unifi-6-lr.dts -@@ -0,0 +1,188 @@ +@@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 MediaTek Inc. @@ -173,6 +173,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ + aliases { + spi0 = &snor; + }; diff --git a/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch b/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch index 88e426366ba21d..070456b2ee8862 100644 --- a/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch +++ b/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch @@ -182,7 +182,7 @@ +CONFIG_SERVERIP="192.168.1.254" --- /dev/null +++ b/arch/arm/dts/mt7986a-xiaomi_redmi-ax6000.dts -@@ -0,0 +1,156 @@ +@@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2021 MediaTek Inc. @@ -205,6 +205,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ + keys { + compatible = "gpio-keys"; + factory { diff --git a/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch b/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch index b1c25ba7915b72..365f280947ddf5 100644 --- a/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch +++ b/package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch @@ -555,7 +555,7 @@ +CONFIG_SERVERIP="192.168.1.254" --- /dev/null +++ b/arch/arm/dts/mt7986a-tplink-tl-xdr608x.dts -@@ -0,0 +1,191 @@ +@@ -0,0 +1,196 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2021 MediaTek Inc. @@ -578,6 +578,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ + keys { + compatible = "gpio-keys"; + diff --git a/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch b/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch index aaaeaa4f8ae069..4f98c95893b227 100644 --- a/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch +++ b/package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch @@ -178,7 +178,7 @@ +CONFIG_SERVERIP="192.168.1.254" --- /dev/null +++ b/arch/arm/dts/mt7981_qihoo-360t7.dts -@@ -0,0 +1,180 @@ +@@ -0,0 +1,185 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2022 MediaTek Inc. @@ -201,6 +201,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + keys { + compatible = "gpio-keys"; + diff --git a/package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch b/package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch index 6be64e54216709..2bd1afe7a8f380 100644 --- a/package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch +++ b/package/boot/uboot-mediatek/patches/434-add-xiaomi_mi-router-wr30u.patch @@ -178,7 +178,7 @@ +CONFIG_SERVERIP="192.168.1.254" --- /dev/null +++ b/arch/arm/dts/mt7981_xiaomi_mi-router-wr30u.dts -@@ -0,0 +1,216 @@ +@@ -0,0 +1,221 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2022 MediaTek Inc. @@ -206,6 +206,11 @@ + system_led = "yellow:system"; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + gpio-keys { + compatible = "gpio-keys"; + diff --git a/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch b/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch index 57181c73c0e1a0..d5a149b903b394 100644 --- a/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch +++ b/package/boot/uboot-mediatek/patches/435-add-h3c_magic-nx30-pro.patch @@ -178,7 +178,7 @@ +CONFIG_SERVERIP="192.168.1.254" --- /dev/null +++ b/arch/arm/dts/mt7981_h3c_magic-nx30-pro.dts -@@ -0,0 +1,200 @@ +@@ -0,0 +1,205 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2022 MediaTek Inc. @@ -201,6 +201,11 @@ + tick-timer = &timer0; + }; + ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ + keys { + compatible = "gpio-keys"; + From d25b543aa5d3dd7fbddaf8edf5334d6461ba69e2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 31 Jul 2023 19:47:54 +0100 Subject: [PATCH 0325/1171] uboot-mediatek: fix build for MT7629 Add patch to fix build failure caused by a missing header which had previously been implicitely included. Fixes: 6ddb5f5a65 ("uboot-mediatek: update to version 2023.07.02") Signed-off-by: Daniel Golle --- ...include-linux-sizes.h-for-SZ_-macros.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/102-ram-mediatek-include-linux-sizes.h-for-SZ_-macros.patch diff --git a/package/boot/uboot-mediatek/patches/102-ram-mediatek-include-linux-sizes.h-for-SZ_-macros.patch b/package/boot/uboot-mediatek/patches/102-ram-mediatek-include-linux-sizes.h-for-SZ_-macros.patch new file mode 100644 index 00000000000000..3cfc6849563092 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/102-ram-mediatek-include-linux-sizes.h-for-SZ_-macros.patch @@ -0,0 +1,47 @@ +From 4bd66fd5b69eda41b4320fd6f8db50a7b7fa7bf7 Mon Sep 17 00:00:00 2001 +Message-ID: <4bd66fd5b69eda41b4320fd6f8db50a7b7fa7bf7.1690828424.git.daniel@makrotopia.org> +From: Daniel Golle +Date: Mon, 31 Jul 2023 19:25:04 +0100 +Subject: [PATCH] ram: mediatek: include for SZ_* macros +To: Ryder Lee , + Weijie Gao , + Chunfeng Yun , + GSS_MTK_Uboot_upstream , + u-boot@lists.denx.de + +Something between U-Boot 2023.04 and 2023.07.02 resulted in no longer +implicitely including in the DDR3 RAM driver for the +MT7929 SoC. The result is a build failure: +drivers/ram/mediatek/ddr3-mt7629.c: In function 'mtk_ddr3_get_info': +drivers/ram/mediatek/ddr3-mt7629.c:734:30: error: 'SZ_128M' undeclared (first use in this function) + 734 | info->size = SZ_128M; + | ^~~~~~~ +drivers/ram/mediatek/ddr3-mt7629.c:734:30: note: each undeclared identifier is reported only once for each function it appears in +drivers/ram/mediatek/ddr3-mt7629.c:737:30: error: 'SZ_256M' undeclared (first use in this function) + 737 | info->size = SZ_256M; + | ^~~~~~~ +drivers/ram/mediatek/ddr3-mt7629.c:740:30: error: 'SZ_512M' undeclared (first use in this function) + 740 | info->size = SZ_512M; + | ^~~~~~~ +drivers/ram/mediatek/ddr3-mt7629.c:743:30: error: 'SZ_1G' undeclared (first use in this function) + 743 | info->size = SZ_1G; + | ^~~~~ + +Include so SZ_* is defined. + +Reported-by: Tianling Shen +Signed-off-by: Daniel Golle +--- + drivers/ram/mediatek/ddr3-mt7629.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/ram/mediatek/ddr3-mt7629.c ++++ b/drivers/ram/mediatek/ddr3-mt7629.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + /* EMI */ + #define EMI_CONA 0x000 From e723cb6131df7a1447ed8ff275e8d8ac899a7535 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 1 Aug 2023 18:04:24 +0100 Subject: [PATCH 0326/1171] kernel: netdevices: add driver for Marvell 10G Ethernet PHYs Package kernel module for Marvell 10G Ethernet PHYs found also in many 10G/1G/100M/10M RJ-45 SFP+ modules. Signed-off-by: Daniel Golle (cherry picked from commit 2a5c7bf6213cc12d4ae6b7bce5d777b3518a89c1) --- package/kernel/linux/modules/netdevices.mk | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 9a47e974fd00a0..b8f2466cb48f7c 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -307,6 +307,24 @@ endef $(eval $(call KernelPackage,phy-marvell)) +define KernelPackage/phy-marvell-10g + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell 10 Gigabit Ethernet PHY driver + KCONFIG:=CONFIG_MARVELL_10G_PHY + DEPENDS:=+kmod-libphy + FILES:=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko + AUTOLOAD:=$(call AutoLoad,18,marvell10g) +endef + +define KernelPackage/phy-marvell/description + Supports Marvell 10 Gigabit Ethernet PHYs: + * 88E2110 + * 88E2111 + * 88x3310 + * 88x3340 +endef + +$(eval $(call KernelPackage,phy-marvell-10g)) define KernelPackage/phy-realtek SUBMENU:=$(NETWORK_DEVICES_MENU) From 34cd47174291f432cf56b40ee28cf415cb7ecdf2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 31 Jul 2023 18:05:22 +0100 Subject: [PATCH 0327/1171] mediatek: filogic: enable driver for MediaTek XS-PHY Enable driver for MediaTek SuperSpeedPlus XS-PHY transceiver for the USB3.1 GEN2 controllers found in the MT7988 SoC. Signed-off-by: Daniel Golle (cherry picked from commit dc4aafb30939316a163c2eaede6811d871cace2f) --- target/linux/mediatek/filogic/config-5.15 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 4cae8c50ac7427..2ffc466b7c3344 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -306,7 +306,7 @@ CONFIG_PHYLINK=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_MTK_TPHY=y # CONFIG_PHY_MTK_UFS is not set -# CONFIG_PHY_MTK_XSPHY is not set +CONFIG_PHY_MTK_XSPHY=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_MT2712 is not set # CONFIG_PINCTRL_MT6765 is not set From 830bb57f6acca09628ad439381ef38839c0f997e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 1 Aug 2023 00:04:56 +0100 Subject: [PATCH 0328/1171] mediatek: filogic: sync pinctrl-mt7988 with MediaTek SDK Update pinctrl driver for the MT7988 with driver from mtk-openwrt-feeds. Signed-off-by: Daniel Golle (cherry picked from commit 36d0aa9c2db0f74614b04a152fb092bcc74afb8e) --- .../drivers/pinctrl/mediatek/pinctrl-mt7988.c | 415 +++++++++++++----- 1 file changed, 300 insertions(+), 115 deletions(-) diff --git a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c index 80a7e19f7a2d0d..49c0be1bba0cf2 100644 --- a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c +++ b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c @@ -46,37 +46,53 @@ static const struct mtk_pin_field_calc mt7988_pin_do_range[] = { }; static const struct mtk_pin_field_calc mt7988_pin_ies_range[] = { - PIN_FIELD_BASE(0, 1, 5, 0x30, 0x10, 13, 1), - PIN_FIELD_BASE(2, 3, 5, 0x30, 0x10, 11, 1), + PIN_FIELD_BASE(0, 0, 5, 0x30, 0x10, 13, 1), + PIN_FIELD_BASE(1, 1, 5, 0x30, 0x10, 14, 1), + PIN_FIELD_BASE(2, 2, 5, 0x30, 0x10, 11, 1), + PIN_FIELD_BASE(3, 3, 5, 0x30, 0x10, 12, 1), PIN_FIELD_BASE(4, 4, 5, 0x30, 0x10, 0, 1), - PIN_FIELD_BASE(5, 6, 5, 0x30, 0x10, 9, 1), + PIN_FIELD_BASE(5, 5, 5, 0x30, 0x10, 9, 1), + PIN_FIELD_BASE(6, 6, 5, 0x30, 0x10, 10, 1), + PIN_FIELD_BASE(7, 7, 4, 0x30, 0x10, 8, 1), PIN_FIELD_BASE(8, 8, 4, 0x30, 0x10, 6, 1), PIN_FIELD_BASE(9, 9, 4, 0x30, 0x10, 5, 1), PIN_FIELD_BASE(10, 10, 4, 0x30, 0x10, 3, 1), + PIN_FIELD_BASE(11, 11, 1, 0x40, 0x10, 0, 1), PIN_FIELD_BASE(12, 12, 1, 0x40, 0x10, 21, 1), - PIN_FIELD_BASE(13, 14, 1, 0x40, 0x10, 1, 1), - PIN_FIELD_BASE(15, 16, 5, 0x30, 0x10, 7, 1), - PIN_FIELD_BASE(17, 18, 5, 0x30, 0x10, 3, 1), + PIN_FIELD_BASE(13, 13, 1, 0x40, 0x10, 1, 1), + PIN_FIELD_BASE(14, 14, 1, 0x40, 0x10, 2, 1), + + PIN_FIELD_BASE(15, 15, 5, 0x30, 0x10, 7, 1), + PIN_FIELD_BASE(16, 16, 5, 0x30, 0x10, 8, 1), + PIN_FIELD_BASE(17, 17, 5, 0x30, 0x10, 3, 1), + PIN_FIELD_BASE(18, 18, 5, 0x30, 0x10, 4, 1), + PIN_FIELD_BASE(19, 19, 4, 0x30, 0x10, 7, 1), PIN_FIELD_BASE(20, 20, 4, 0x30, 0x10, 4, 1), + PIN_FIELD_BASE(21, 21, 3, 0x50, 0x10, 17, 1), PIN_FIELD_BASE(22, 22, 3, 0x50, 0x10, 23, 1), PIN_FIELD_BASE(23, 23, 3, 0x50, 0x10, 20, 1), PIN_FIELD_BASE(24, 24, 3, 0x50, 0x10, 19, 1), - PIN_FIELD_BASE(25, 26, 3, 0x50, 0x10, 21, 1), + PIN_FIELD_BASE(25, 25, 3, 0x50, 0x10, 21, 1), + PIN_FIELD_BASE(26, 26, 3, 0x50, 0x10, 22, 1), PIN_FIELD_BASE(27, 27, 3, 0x50, 0x10, 18, 1), - PIN_FIELD_BASE(28, 30, 3, 0x50, 0x10, 25, 1), + PIN_FIELD_BASE(28, 28, 3, 0x50, 0x10, 25, 1), + PIN_FIELD_BASE(29, 29, 3, 0x50, 0x10, 26, 1), + PIN_FIELD_BASE(30, 30, 3, 0x50, 0x10, 27, 1), PIN_FIELD_BASE(31, 31, 3, 0x50, 0x10, 24, 1), PIN_FIELD_BASE(32, 32, 3, 0x50, 0x10, 28, 1), PIN_FIELD_BASE(33, 33, 3, 0x60, 0x10, 0, 1), PIN_FIELD_BASE(34, 34, 3, 0x50, 0x10, 31, 1), - PIN_FIELD_BASE(35, 36, 3, 0x50, 0x10, 29, 1), + PIN_FIELD_BASE(35, 35, 3, 0x50, 0x10, 29, 1), + PIN_FIELD_BASE(36, 36, 3, 0x50, 0x10, 30, 1), PIN_FIELD_BASE(37, 37, 3, 0x60, 0x10, 1, 1), PIN_FIELD_BASE(38, 38, 3, 0x50, 0x10, 11, 1), PIN_FIELD_BASE(39, 39, 3, 0x50, 0x10, 10, 1), - PIN_FIELD_BASE(40, 41, 3, 0x50, 0x10, 0, 1), + PIN_FIELD_BASE(40, 40, 3, 0x50, 0x10, 0, 1), + PIN_FIELD_BASE(41, 41, 3, 0x50, 0x10, 1, 1), PIN_FIELD_BASE(42, 42, 3, 0x50, 0x10, 9, 1), PIN_FIELD_BASE(43, 43, 3, 0x50, 0x10, 8, 1), PIN_FIELD_BASE(44, 44, 3, 0x50, 0x10, 7, 1), @@ -86,17 +102,31 @@ static const struct mtk_pin_field_calc mt7988_pin_ies_range[] = { PIN_FIELD_BASE(48, 48, 3, 0x50, 0x10, 3, 1), PIN_FIELD_BASE(49, 49, 3, 0x50, 0x10, 2, 1), PIN_FIELD_BASE(50, 50, 3, 0x50, 0x10, 15, 1), - PIN_FIELD_BASE(51, 53, 3, 0x50, 0x10, 12, 1), + PIN_FIELD_BASE(51, 51, 3, 0x50, 0x10, 12, 1), + PIN_FIELD_BASE(52, 52, 3, 0x50, 0x10, 13, 1), + PIN_FIELD_BASE(53, 53, 3, 0x50, 0x10, 14, 1), PIN_FIELD_BASE(54, 54, 3, 0x50, 0x10, 16, 1), - PIN_FIELD_BASE(55, 56, 1, 0x40, 0x10, 14, 1), + + PIN_FIELD_BASE(55, 55, 1, 0x40, 0x10, 14, 1), + PIN_FIELD_BASE(56, 56, 1, 0x40, 0x10, 15, 1), PIN_FIELD_BASE(57, 57, 1, 0x40, 0x10, 13, 1), - PIN_FIELD_BASE(58, 60, 1, 0x40, 0x10, 4, 1), + PIN_FIELD_BASE(58, 58, 1, 0x40, 0x10, 4, 1), + PIN_FIELD_BASE(59, 59, 1, 0x40, 0x10, 5, 1), + PIN_FIELD_BASE(60, 60, 1, 0x40, 0x10, 6, 1), PIN_FIELD_BASE(61, 61, 1, 0x40, 0x10, 3, 1), PIN_FIELD_BASE(62, 62, 1, 0x40, 0x10, 7, 1), PIN_FIELD_BASE(63, 63, 1, 0x40, 0x10, 20, 1), - PIN_FIELD_BASE(64, 68, 1, 0x40, 0x10, 8, 1), - PIN_FIELD_BASE(69, 70, 5, 0x30, 0x10, 1, 1), - PIN_FIELD_BASE(71, 72, 5, 0x30, 0x10, 5, 1), + PIN_FIELD_BASE(64, 64, 1, 0x40, 0x10, 8, 1), + PIN_FIELD_BASE(65, 65, 1, 0x40, 0x10, 9, 1), + PIN_FIELD_BASE(66, 66, 1, 0x40, 0x10, 10, 1), + PIN_FIELD_BASE(67, 67, 1, 0x40, 0x10, 11, 1), + PIN_FIELD_BASE(68, 68, 1, 0x40, 0x10, 12, 1), + + PIN_FIELD_BASE(69, 69, 5, 0x30, 0x10, 1, 1), + PIN_FIELD_BASE(70, 70, 5, 0x30, 0x10, 2, 1), + PIN_FIELD_BASE(71, 71, 5, 0x30, 0x10, 5, 1), + PIN_FIELD_BASE(72, 72, 5, 0x30, 0x10, 6, 1), + PIN_FIELD_BASE(73, 73, 4, 0x30, 0x10, 10, 1), PIN_FIELD_BASE(74, 74, 4, 0x30, 0x10, 1, 1), PIN_FIELD_BASE(75, 75, 4, 0x30, 0x10, 11, 1), @@ -104,42 +134,61 @@ static const struct mtk_pin_field_calc mt7988_pin_ies_range[] = { PIN_FIELD_BASE(77, 77, 4, 0x30, 0x10, 2, 1), PIN_FIELD_BASE(78, 78, 4, 0x30, 0x10, 0, 1), PIN_FIELD_BASE(79, 79, 4, 0x30, 0x10, 12, 1), - PIN_FIELD_BASE(80, 81, 1, 0x40, 0x10, 18, 1), - PIN_FIELD_BASE(82, 83, 1, 0x40, 0x10, 16, 1), + + PIN_FIELD_BASE(80, 80, 1, 0x40, 0x10, 18, 1), + PIN_FIELD_BASE(81, 81, 1, 0x40, 0x10, 19, 1), + PIN_FIELD_BASE(82, 82, 1, 0x40, 0x10, 16, 1), + PIN_FIELD_BASE(83, 83, 1, 0x40, 0x10, 17, 1), }; static const struct mtk_pin_field_calc mt7988_pin_smt_range[] = { - PIN_FIELD_BASE(0, 1, 5, 0xc0, 0x10, 13, 1), - PIN_FIELD_BASE(2, 3, 5, 0xc0, 0x10, 11, 1), + PIN_FIELD_BASE(0, 0, 5, 0xc0, 0x10, 13, 1), + PIN_FIELD_BASE(1, 1, 5, 0xc0, 0x10, 14, 1), + PIN_FIELD_BASE(2, 2, 5, 0xc0, 0x10, 11, 1), + PIN_FIELD_BASE(3, 3, 5, 0xc0, 0x10, 12, 1), PIN_FIELD_BASE(4, 4, 5, 0xc0, 0x10, 0, 1), - PIN_FIELD_BASE(5, 6, 5, 0xc0, 0x10, 9, 1), + PIN_FIELD_BASE(5, 5, 5, 0xc0, 0x10, 9, 1), + PIN_FIELD_BASE(6, 6, 5, 0xc0, 0x10, 10, 1), + PIN_FIELD_BASE(7, 7, 4, 0xb0, 0x10, 8, 1), PIN_FIELD_BASE(8, 8, 4, 0xb0, 0x10, 6, 1), PIN_FIELD_BASE(9, 9, 4, 0xb0, 0x10, 5, 1), PIN_FIELD_BASE(10, 10, 4, 0xb0, 0x10, 3, 1), + PIN_FIELD_BASE(11, 11, 1, 0xe0, 0x10, 0, 1), PIN_FIELD_BASE(12, 12, 1, 0xe0, 0x10, 21, 1), - PIN_FIELD_BASE(13, 14, 1, 0xe0, 0x10, 1, 1), - PIN_FIELD_BASE(15, 16, 5, 0xc0, 0x10, 7, 1), - PIN_FIELD_BASE(17, 18, 5, 0xc0, 0x10, 3, 1), + PIN_FIELD_BASE(13, 13, 1, 0xe0, 0x10, 1, 1), + PIN_FIELD_BASE(14, 14, 1, 0xe0, 0x10, 2, 1), + + PIN_FIELD_BASE(15, 15, 5, 0xc0, 0x10, 7, 1), + PIN_FIELD_BASE(16, 16, 5, 0xc0, 0x10, 8, 1), + PIN_FIELD_BASE(17, 17, 5, 0xc0, 0x10, 3, 1), + PIN_FIELD_BASE(18, 18, 5, 0xc0, 0x10, 4, 1), + PIN_FIELD_BASE(19, 19, 4, 0xb0, 0x10, 7, 1), PIN_FIELD_BASE(20, 20, 4, 0xb0, 0x10, 4, 1), + PIN_FIELD_BASE(21, 21, 3, 0x140, 0x10, 17, 1), PIN_FIELD_BASE(22, 22, 3, 0x140, 0x10, 23, 1), PIN_FIELD_BASE(23, 23, 3, 0x140, 0x10, 20, 1), PIN_FIELD_BASE(24, 24, 3, 0x140, 0x10, 19, 1), - PIN_FIELD_BASE(25, 26, 3, 0x140, 0x10, 21, 1), + PIN_FIELD_BASE(25, 25, 3, 0x140, 0x10, 21, 1), + PIN_FIELD_BASE(26, 26, 3, 0x140, 0x10, 22, 1), PIN_FIELD_BASE(27, 27, 3, 0x140, 0x10, 18, 1), - PIN_FIELD_BASE(28, 30, 3, 0x140, 0x10, 25, 1), + PIN_FIELD_BASE(28, 28, 3, 0x140, 0x10, 25, 1), + PIN_FIELD_BASE(29, 29, 3, 0x140, 0x10, 26, 1), + PIN_FIELD_BASE(30, 30, 3, 0x140, 0x10, 27, 1), PIN_FIELD_BASE(31, 31, 3, 0x140, 0x10, 24, 1), PIN_FIELD_BASE(32, 32, 3, 0x140, 0x10, 28, 1), PIN_FIELD_BASE(33, 33, 3, 0x150, 0x10, 0, 1), PIN_FIELD_BASE(34, 34, 3, 0x140, 0x10, 31, 1), - PIN_FIELD_BASE(35, 36, 3, 0x140, 0x10, 29, 1), + PIN_FIELD_BASE(35, 35, 3, 0x140, 0x10, 29, 1), + PIN_FIELD_BASE(36, 36, 3, 0x140, 0x10, 30, 1), PIN_FIELD_BASE(37, 37, 3, 0x150, 0x10, 1, 1), PIN_FIELD_BASE(38, 38, 3, 0x140, 0x10, 11, 1), PIN_FIELD_BASE(39, 39, 3, 0x140, 0x10, 10, 1), - PIN_FIELD_BASE(40, 41, 3, 0x140, 0x10, 0, 1), + PIN_FIELD_BASE(40, 40, 3, 0x140, 0x10, 0, 1), + PIN_FIELD_BASE(41, 41, 3, 0x140, 0x10, 1, 1), PIN_FIELD_BASE(42, 42, 3, 0x140, 0x10, 9, 1), PIN_FIELD_BASE(43, 43, 3, 0x140, 0x10, 8, 1), PIN_FIELD_BASE(44, 44, 3, 0x140, 0x10, 7, 1), @@ -149,17 +198,31 @@ static const struct mtk_pin_field_calc mt7988_pin_smt_range[] = { PIN_FIELD_BASE(48, 48, 3, 0x140, 0x10, 3, 1), PIN_FIELD_BASE(49, 49, 3, 0x140, 0x10, 2, 1), PIN_FIELD_BASE(50, 50, 3, 0x140, 0x10, 15, 1), - PIN_FIELD_BASE(51, 53, 3, 0x140, 0x10, 12, 1), + PIN_FIELD_BASE(51, 51, 3, 0x140, 0x10, 12, 1), + PIN_FIELD_BASE(52, 52, 3, 0x140, 0x10, 13, 1), + PIN_FIELD_BASE(53, 53, 3, 0x140, 0x10, 14, 1), PIN_FIELD_BASE(54, 54, 3, 0x140, 0x10, 16, 1), - PIN_FIELD_BASE(55, 56, 1, 0xe0, 0x10, 14, 1), + + PIN_FIELD_BASE(55, 55, 1, 0xe0, 0x10, 14, 1), + PIN_FIELD_BASE(56, 56, 1, 0xe0, 0x10, 15, 1), PIN_FIELD_BASE(57, 57, 1, 0xe0, 0x10, 13, 1), - PIN_FIELD_BASE(58, 60, 1, 0xe0, 0x10, 4, 1), + PIN_FIELD_BASE(58, 58, 1, 0xe0, 0x10, 4, 1), + PIN_FIELD_BASE(59, 59, 1, 0xe0, 0x10, 5, 1), + PIN_FIELD_BASE(60, 60, 1, 0xe0, 0x10, 6, 1), PIN_FIELD_BASE(61, 61, 1, 0xe0, 0x10, 3, 1), PIN_FIELD_BASE(62, 62, 1, 0xe0, 0x10, 7, 1), PIN_FIELD_BASE(63, 63, 1, 0xe0, 0x10, 20, 1), - PIN_FIELD_BASE(64, 68, 1, 0xe0, 0x10, 8, 1), - PIN_FIELD_BASE(69, 70, 5, 0xc0, 0x10, 1, 1), - PIN_FIELD_BASE(71, 72, 5, 0xc0, 0x10, 5, 1), + PIN_FIELD_BASE(64, 64, 1, 0xe0, 0x10, 8, 1), + PIN_FIELD_BASE(65, 65, 1, 0xe0, 0x10, 9, 1), + PIN_FIELD_BASE(66, 66, 1, 0xe0, 0x10, 10, 1), + PIN_FIELD_BASE(67, 67, 1, 0xe0, 0x10, 11, 1), + PIN_FIELD_BASE(68, 68, 1, 0xe0, 0x10, 12, 1), + + PIN_FIELD_BASE(69, 69, 5, 0xc0, 0x10, 1, 1), + PIN_FIELD_BASE(70, 70, 5, 0xc0, 0x10, 2, 1), + PIN_FIELD_BASE(71, 71, 5, 0xc0, 0x10, 5, 1), + PIN_FIELD_BASE(72, 72, 5, 0xc0, 0x10, 6, 1), + PIN_FIELD_BASE(73, 73, 4, 0xb0, 0x10, 10, 1), PIN_FIELD_BASE(74, 74, 4, 0xb0, 0x10, 1, 1), PIN_FIELD_BASE(75, 75, 4, 0xb0, 0x10, 11, 1), @@ -167,8 +230,11 @@ static const struct mtk_pin_field_calc mt7988_pin_smt_range[] = { PIN_FIELD_BASE(77, 77, 4, 0xb0, 0x10, 2, 1), PIN_FIELD_BASE(78, 78, 4, 0xb0, 0x10, 0, 1), PIN_FIELD_BASE(79, 79, 4, 0xb0, 0x10, 12, 1), - PIN_FIELD_BASE(80, 81, 1, 0xe0, 0x10, 18, 1), - PIN_FIELD_BASE(82, 83, 1, 0xe0, 0x10, 16, 1), + + PIN_FIELD_BASE(80, 80, 1, 0xe0, 0x10, 18, 1), + PIN_FIELD_BASE(81, 81, 1, 0xe0, 0x10, 19, 1), + PIN_FIELD_BASE(82, 82, 1, 0xe0, 0x10, 16, 1), + PIN_FIELD_BASE(83, 83, 1, 0xe0, 0x10, 17, 1), }; static const struct mtk_pin_field_calc mt7988_pin_pu_range[] = { @@ -176,8 +242,11 @@ static const struct mtk_pin_field_calc mt7988_pin_pu_range[] = { PIN_FIELD_BASE(8, 8, 4, 0x60, 0x10, 4, 1), PIN_FIELD_BASE(9, 9, 4, 0x60, 0x10, 3, 1), PIN_FIELD_BASE(10, 10, 4, 0x60, 0x10, 2, 1), - PIN_FIELD_BASE(13, 14, 1, 0x70, 0x10, 0, 1), + + PIN_FIELD_BASE(13, 13, 1, 0x70, 0x10, 0, 1), + PIN_FIELD_BASE(14, 14, 1, 0x70, 0x10, 1, 1), PIN_FIELD_BASE(63, 63, 1, 0x70, 0x10, 2, 1), + PIN_FIELD_BASE(75, 75, 4, 0x60, 0x10, 7, 1), PIN_FIELD_BASE(76, 76, 4, 0x60, 0x10, 6, 1), PIN_FIELD_BASE(77, 77, 4, 0x60, 0x10, 1, 1), @@ -190,11 +259,19 @@ static const struct mtk_pin_field_calc mt7988_pin_pd_range[] = { PIN_FIELD_BASE(8, 8, 4, 0x40, 0x10, 4, 1), PIN_FIELD_BASE(9, 9, 4, 0x40, 0x10, 3, 1), PIN_FIELD_BASE(10, 10, 4, 0x40, 0x10, 2, 1), - PIN_FIELD_BASE(13, 14, 1, 0x50, 0x10, 0, 1), - PIN_FIELD_BASE(15, 16, 5, 0x40, 0x10, 4, 1), - PIN_FIELD_BASE(17, 18, 5, 0x40, 0x10, 0, 1), + + PIN_FIELD_BASE(13, 13, 1, 0x50, 0x10, 0, 1), + PIN_FIELD_BASE(14, 14, 1, 0x50, 0x10, 1, 1), + + PIN_FIELD_BASE(15, 15, 5, 0x40, 0x10, 4, 1), + PIN_FIELD_BASE(16, 16, 5, 0x40, 0x10, 5, 1), + PIN_FIELD_BASE(17, 17, 5, 0x40, 0x10, 0, 1), + PIN_FIELD_BASE(18, 18, 5, 0x40, 0x10, 1, 1), + PIN_FIELD_BASE(63, 63, 1, 0x50, 0x10, 2, 1), - PIN_FIELD_BASE(71, 72, 5, 0x40, 0x10, 2, 1), + PIN_FIELD_BASE(71, 71, 5, 0x40, 0x10, 2, 1), + PIN_FIELD_BASE(72, 72, 5, 0x40, 0x10, 3, 1), + PIN_FIELD_BASE(75, 75, 4, 0x40, 0x10, 7, 1), PIN_FIELD_BASE(76, 76, 4, 0x40, 0x10, 6, 1), PIN_FIELD_BASE(77, 77, 4, 0x40, 0x10, 1, 1), @@ -203,26 +280,37 @@ static const struct mtk_pin_field_calc mt7988_pin_pd_range[] = { }; static const struct mtk_pin_field_calc mt7988_pin_drv_range[] = { - PIN_FIELD_BASE(0, 1, 5, 0x00, 0x10, 21, 3), - PIN_FIELD_BASE(2, 3, 5, 0x00, 0x10, 15, 3), + PIN_FIELD_BASE(0, 0, 5, 0x00, 0x10, 21, 3), + PIN_FIELD_BASE(1, 1, 5, 0x00, 0x10, 24, 3), + PIN_FIELD_BASE(2, 2, 5, 0x00, 0x10, 15, 3), + PIN_FIELD_BASE(3, 3, 5, 0x00, 0x10, 18, 3), PIN_FIELD_BASE(4, 4, 5, 0x00, 0x10, 0, 3), - PIN_FIELD_BASE(5, 6, 5, 0x00, 0x10, 9, 3), + PIN_FIELD_BASE(5, 5, 5, 0x00, 0x10, 9, 3), + PIN_FIELD_BASE(6, 6, 5, 0x00, 0x10, 12, 3), + PIN_FIELD_BASE(7, 7, 4, 0x00, 0x10, 24, 3), PIN_FIELD_BASE(8, 8, 4, 0x00, 0x10, 28, 3), PIN_FIELD_BASE(9, 9, 4, 0x00, 0x10, 15, 3), PIN_FIELD_BASE(10, 10, 4, 0x00, 0x10, 9, 3), + PIN_FIELD_BASE(11, 11, 1, 0x00, 0x10, 0, 3), PIN_FIELD_BASE(12, 12, 1, 0x20, 0x10, 3, 3), - PIN_FIELD_BASE(13, 14, 1, 0x00, 0x10, 3, 3), + PIN_FIELD_BASE(13, 13, 1, 0x00, 0x10, 3, 3), + PIN_FIELD_BASE(14, 14, 1, 0x00, 0x10, 6, 3), + PIN_FIELD_BASE(19, 19, 4, 0x00, 0x10, 21, 3), PIN_FIELD_BASE(20, 20, 4, 0x00, 0x10, 12, 3), + PIN_FIELD_BASE(21, 21, 3, 0x10, 0x10, 21, 3), PIN_FIELD_BASE(22, 22, 3, 0x20, 0x10, 9, 3), PIN_FIELD_BASE(23, 23, 3, 0x20, 0x10, 0, 3), PIN_FIELD_BASE(24, 24, 3, 0x10, 0x10, 27, 3), - PIN_FIELD_BASE(25, 26, 3, 0x20, 0x10, 3, 3), + PIN_FIELD_BASE(25, 25, 3, 0x20, 0x10, 3, 3), + PIN_FIELD_BASE(26, 26, 3, 0x20, 0x10, 6, 3), PIN_FIELD_BASE(27, 27, 3, 0x10, 0x10, 24, 3), - PIN_FIELD_BASE(28, 30, 3, 0x20, 0x10, 15, 3), + PIN_FIELD_BASE(28, 28, 3, 0x20, 0x10, 15, 3), + PIN_FIELD_BASE(29, 29, 3, 0x20, 0x10, 18, 3), + PIN_FIELD_BASE(30, 30, 3, 0x20, 0x10, 21, 3), PIN_FIELD_BASE(31, 31, 3, 0x20, 0x10, 12, 3), PIN_FIELD_BASE(32, 32, 3, 0x20, 0x10, 24, 3), PIN_FIELD_BASE(33, 33, 3, 0x30, 0x10, 6, 3), @@ -232,7 +320,8 @@ static const struct mtk_pin_field_calc mt7988_pin_drv_range[] = { PIN_FIELD_BASE(37, 37, 3, 0x30, 0x10, 9, 3), PIN_FIELD_BASE(38, 38, 3, 0x10, 0x10, 3, 3), PIN_FIELD_BASE(39, 39, 3, 0x10, 0x10, 0, 3), - PIN_FIELD_BASE(40, 41, 3, 0x00, 0x10, 0, 3), + PIN_FIELD_BASE(40, 40, 3, 0x00, 0x10, 0, 3), + PIN_FIELD_BASE(41, 41, 3, 0x00, 0x10, 3, 3), PIN_FIELD_BASE(42, 42, 3, 0x00, 0x10, 27, 3), PIN_FIELD_BASE(43, 43, 3, 0x00, 0x10, 24, 3), PIN_FIELD_BASE(44, 44, 3, 0x00, 0x10, 21, 3), @@ -242,17 +331,29 @@ static const struct mtk_pin_field_calc mt7988_pin_drv_range[] = { PIN_FIELD_BASE(48, 48, 3, 0x00, 0x10, 9, 3), PIN_FIELD_BASE(49, 49, 3, 0x00, 0x10, 6, 3), PIN_FIELD_BASE(50, 50, 3, 0x10, 0x10, 15, 3), - PIN_FIELD_BASE(51, 53, 3, 0x10, 0x10, 6, 3), + PIN_FIELD_BASE(51, 51, 3, 0x10, 0x10, 6, 3), + PIN_FIELD_BASE(52, 52, 3, 0x10, 0x10, 9, 3), + PIN_FIELD_BASE(53, 53, 3, 0x10, 0x10, 12, 3), PIN_FIELD_BASE(54, 54, 3, 0x10, 0x10, 18, 3), - PIN_FIELD_BASE(55, 56, 1, 0x10, 0x10, 12, 3), + + PIN_FIELD_BASE(55, 55, 1, 0x10, 0x10, 12, 3), + PIN_FIELD_BASE(56, 56, 1, 0x10, 0x10, 15, 3), PIN_FIELD_BASE(57, 57, 1, 0x10, 0x10, 9, 3), - PIN_FIELD_BASE(58, 60, 1, 0x00, 0x10, 12, 3), + PIN_FIELD_BASE(58, 58, 1, 0x00, 0x10, 12, 3), + PIN_FIELD_BASE(59, 59, 1, 0x00, 0x10, 15, 3), + PIN_FIELD_BASE(60, 60, 1, 0x00, 0x10, 18, 3), PIN_FIELD_BASE(61, 61, 1, 0x00, 0x10, 9, 3), PIN_FIELD_BASE(62, 62, 1, 0x00, 0x10, 21, 3), PIN_FIELD_BASE(63, 63, 1, 0x20, 0x10, 0, 3), - PIN_FIELD_BASE(64, 65, 1, 0x00, 0x10, 24, 3), - PIN_FIELD_BASE(66, 68, 1, 0x10, 0x10, 0, 3), - PIN_FIELD_BASE(69, 70, 5, 0x00, 0x10, 3, 3), + PIN_FIELD_BASE(64, 64, 1, 0x00, 0x10, 24, 3), + PIN_FIELD_BASE(65, 65, 1, 0x00, 0x10, 27, 3), + PIN_FIELD_BASE(66, 66, 1, 0x10, 0x10, 0, 3), + PIN_FIELD_BASE(67, 67, 1, 0x10, 0x10, 3, 3), + PIN_FIELD_BASE(68, 68, 1, 0x10, 0x10, 6, 3), + + PIN_FIELD_BASE(69, 69, 5, 0x00, 0x10, 3, 3), + PIN_FIELD_BASE(70, 70, 5, 0x00, 0x10, 6, 3), + PIN_FIELD_BASE(73, 73, 4, 0x10, 0x10, 0, 3), PIN_FIELD_BASE(74, 74, 4, 0x00, 0x10, 3, 3), PIN_FIELD_BASE(75, 75, 4, 0x10, 0x10, 3, 3), @@ -260,35 +361,49 @@ static const struct mtk_pin_field_calc mt7988_pin_drv_range[] = { PIN_FIELD_BASE(77, 77, 4, 0x00, 0x10, 6, 3), PIN_FIELD_BASE(78, 78, 4, 0x00, 0x10, 0, 3), PIN_FIELD_BASE(79, 79, 4, 0x10, 0x10, 6, 3), - PIN_FIELD_BASE(80, 81, 1, 0x10, 0x10, 24, 3), - PIN_FIELD_BASE(82, 83, 1, 0x10, 0x10, 18, 3), + + PIN_FIELD_BASE(80, 80, 1, 0x10, 0x10, 24, 3), + PIN_FIELD_BASE(81, 81, 1, 0x10, 0x10, 27, 3), + PIN_FIELD_BASE(82, 82, 1, 0x10, 0x10, 18, 3), + PIN_FIELD_BASE(83, 83, 1, 0x10, 0x10, 21, 3), }; static const struct mtk_pin_field_calc mt7988_pin_pupd_range[] = { - PIN_FIELD_BASE(0, 1, 5, 0x50, 0x10, 7, 1), - PIN_FIELD_BASE(2, 3, 5, 0x50, 0x10, 5, 1), + PIN_FIELD_BASE(0, 0, 5, 0x50, 0x10, 7, 1), + PIN_FIELD_BASE(1, 1, 5, 0x50, 0x10, 8, 1), + PIN_FIELD_BASE(2, 2, 5, 0x50, 0x10, 5, 1), + PIN_FIELD_BASE(3, 3, 5, 0x50, 0x10, 6, 1), PIN_FIELD_BASE(4, 4, 5, 0x50, 0x10, 0, 1), - PIN_FIELD_BASE(5, 6, 5, 0x50, 0x10, 3, 1), + PIN_FIELD_BASE(5, 5, 5, 0x50, 0x10, 3, 1), + PIN_FIELD_BASE(6, 6, 5, 0x50, 0x10, 4, 1), + PIN_FIELD_BASE(11, 11, 1, 0x60, 0x10, 0, 1), PIN_FIELD_BASE(12, 12, 1, 0x60, 0x10, 18, 1), + PIN_FIELD_BASE(19, 19, 4, 0x50, 0x10, 2, 1), PIN_FIELD_BASE(20, 20, 4, 0x50, 0x10, 1, 1), + PIN_FIELD_BASE(21, 21, 3, 0x70, 0x10, 17, 1), PIN_FIELD_BASE(22, 22, 3, 0x70, 0x10, 23, 1), PIN_FIELD_BASE(23, 23, 3, 0x70, 0x10, 20, 1), PIN_FIELD_BASE(24, 24, 3, 0x70, 0x10, 19, 1), - PIN_FIELD_BASE(25, 26, 3, 0x70, 0x10, 21, 1), + PIN_FIELD_BASE(25, 25, 3, 0x70, 0x10, 21, 1), + PIN_FIELD_BASE(26, 26, 3, 0x70, 0x10, 22, 1), PIN_FIELD_BASE(27, 27, 3, 0x70, 0x10, 18, 1), - PIN_FIELD_BASE(28, 30, 3, 0x70, 0x10, 25, 1), + PIN_FIELD_BASE(28, 28, 3, 0x70, 0x10, 25, 1), + PIN_FIELD_BASE(29, 29, 3, 0x70, 0x10, 26, 1), + PIN_FIELD_BASE(30, 30, 3, 0x70, 0x10, 27, 1), PIN_FIELD_BASE(31, 31, 3, 0x70, 0x10, 24, 1), PIN_FIELD_BASE(32, 32, 3, 0x70, 0x10, 28, 1), PIN_FIELD_BASE(33, 33, 3, 0x80, 0x10, 0, 1), PIN_FIELD_BASE(34, 34, 3, 0x70, 0x10, 31, 1), - PIN_FIELD_BASE(35, 36, 3, 0x70, 0x10, 29, 1), + PIN_FIELD_BASE(35, 35, 3, 0x70, 0x10, 29, 1), + PIN_FIELD_BASE(36, 36, 3, 0x70, 0x10, 30, 1), PIN_FIELD_BASE(37, 37, 3, 0x80, 0x10, 1, 1), PIN_FIELD_BASE(38, 38, 3, 0x70, 0x10, 11, 1), PIN_FIELD_BASE(39, 39, 3, 0x70, 0x10, 10, 1), - PIN_FIELD_BASE(40, 41, 3, 0x70, 0x10, 0, 1), + PIN_FIELD_BASE(40, 40, 3, 0x70, 0x10, 0, 1), + PIN_FIELD_BASE(41, 41, 3, 0x70, 0x10, 1, 1), PIN_FIELD_BASE(42, 42, 3, 0x70, 0x10, 9, 1), PIN_FIELD_BASE(43, 43, 3, 0x70, 0x10, 8, 1), PIN_FIELD_BASE(44, 44, 3, 0x70, 0x10, 7, 1), @@ -298,46 +413,73 @@ static const struct mtk_pin_field_calc mt7988_pin_pupd_range[] = { PIN_FIELD_BASE(48, 48, 3, 0x70, 0x10, 3, 1), PIN_FIELD_BASE(49, 49, 3, 0x70, 0x10, 2, 1), PIN_FIELD_BASE(50, 50, 3, 0x70, 0x10, 15, 1), - PIN_FIELD_BASE(51, 53, 3, 0x70, 0x10, 12, 1), + PIN_FIELD_BASE(51, 51, 3, 0x70, 0x10, 12, 1), + PIN_FIELD_BASE(52, 52, 3, 0x70, 0x10, 13, 1), + PIN_FIELD_BASE(53, 53, 3, 0x70, 0x10, 14, 1), PIN_FIELD_BASE(54, 54, 3, 0x70, 0x10, 16, 1), - PIN_FIELD_BASE(55, 56, 1, 0x60, 0x10, 12, 1), + + PIN_FIELD_BASE(55, 55, 1, 0x60, 0x10, 12, 1), + PIN_FIELD_BASE(56, 56, 1, 0x60, 0x10, 13, 1), PIN_FIELD_BASE(57, 57, 1, 0x60, 0x10, 11, 1), - PIN_FIELD_BASE(58, 60, 1, 0x60, 0x10, 2, 1), + PIN_FIELD_BASE(58, 58, 1, 0x60, 0x10, 2, 1), + PIN_FIELD_BASE(59, 59, 1, 0x60, 0x10, 3, 1), + PIN_FIELD_BASE(60, 60, 1, 0x60, 0x10, 4, 1), PIN_FIELD_BASE(61, 61, 1, 0x60, 0x10, 1, 1), PIN_FIELD_BASE(62, 62, 1, 0x60, 0x10, 5, 1), - PIN_FIELD_BASE(64, 68, 1, 0x60, 0x10, 6, 1), - PIN_FIELD_BASE(69, 70, 5, 0x50, 0x10, 1, 1), + PIN_FIELD_BASE(64, 64, 1, 0x60, 0x10, 6, 1), + PIN_FIELD_BASE(65, 65, 1, 0x60, 0x10, 7, 1), + PIN_FIELD_BASE(66, 66, 1, 0x60, 0x10, 8, 1), + PIN_FIELD_BASE(67, 67, 1, 0x60, 0x10, 9, 1), + PIN_FIELD_BASE(68, 68, 1, 0x60, 0x10, 10, 1), + + PIN_FIELD_BASE(69, 69, 5, 0x50, 0x10, 1, 1), + PIN_FIELD_BASE(70, 70, 5, 0x50, 0x10, 2, 1), + PIN_FIELD_BASE(73, 73, 4, 0x50, 0x10, 3, 1), PIN_FIELD_BASE(74, 74, 4, 0x50, 0x10, 0, 1), - PIN_FIELD_BASE(80, 81, 1, 0x60, 0x10, 16, 1), - PIN_FIELD_BASE(82, 83, 1, 0x60, 0x10, 14, 1), + + PIN_FIELD_BASE(80, 80, 1, 0x60, 0x10, 16, 1), + PIN_FIELD_BASE(81, 81, 1, 0x60, 0x10, 17, 1), + PIN_FIELD_BASE(82, 82, 1, 0x60, 0x10, 14, 1), + PIN_FIELD_BASE(83, 83, 1, 0x60, 0x10, 15, 1), }; static const struct mtk_pin_field_calc mt7988_pin_r0_range[] = { - PIN_FIELD_BASE(0, 1, 5, 0x60, 0x10, 7, 1), - PIN_FIELD_BASE(2, 3, 5, 0x60, 0x10, 5, 1), + PIN_FIELD_BASE(0, 0, 5, 0x60, 0x10, 7, 1), + PIN_FIELD_BASE(1, 1, 5, 0x60, 0x10, 8, 1), + PIN_FIELD_BASE(2, 2, 5, 0x60, 0x10, 5, 1), + PIN_FIELD_BASE(3, 3, 5, 0x60, 0x10, 6, 1), PIN_FIELD_BASE(4, 4, 5, 0x60, 0x10, 0, 1), - PIN_FIELD_BASE(5, 6, 5, 0x60, 0x10, 3, 1), + PIN_FIELD_BASE(5, 5, 5, 0x60, 0x10, 3, 1), + PIN_FIELD_BASE(6, 6, 5, 0x60, 0x10, 4, 1), + PIN_FIELD_BASE(11, 11, 1, 0x80, 0x10, 0, 1), PIN_FIELD_BASE(12, 12, 1, 0x80, 0x10, 18, 1), + PIN_FIELD_BASE(19, 19, 4, 0x70, 0x10, 2, 1), PIN_FIELD_BASE(20, 20, 4, 0x70, 0x10, 1, 1), + PIN_FIELD_BASE(21, 21, 3, 0x90, 0x10, 17, 1), PIN_FIELD_BASE(22, 22, 3, 0x90, 0x10, 23, 1), PIN_FIELD_BASE(23, 23, 3, 0x90, 0x10, 20, 1), PIN_FIELD_BASE(24, 24, 3, 0x90, 0x10, 19, 1), - PIN_FIELD_BASE(25, 26, 3, 0x90, 0x10, 21, 1), + PIN_FIELD_BASE(25, 25, 3, 0x90, 0x10, 21, 1), + PIN_FIELD_BASE(26, 26, 3, 0x90, 0x10, 22, 1), PIN_FIELD_BASE(27, 27, 3, 0x90, 0x10, 18, 1), - PIN_FIELD_BASE(28, 30, 3, 0x90, 0x10, 25, 1), + PIN_FIELD_BASE(28, 28, 3, 0x90, 0x10, 25, 1), + PIN_FIELD_BASE(29, 29, 3, 0x90, 0x10, 26, 1), + PIN_FIELD_BASE(30, 30, 3, 0x90, 0x10, 27, 1), PIN_FIELD_BASE(31, 31, 3, 0x90, 0x10, 24, 1), PIN_FIELD_BASE(32, 32, 3, 0x90, 0x10, 28, 1), PIN_FIELD_BASE(33, 33, 3, 0xa0, 0x10, 0, 1), PIN_FIELD_BASE(34, 34, 3, 0x90, 0x10, 31, 1), - PIN_FIELD_BASE(35, 36, 3, 0x90, 0x10, 29, 1), + PIN_FIELD_BASE(35, 35, 3, 0x90, 0x10, 29, 1), + PIN_FIELD_BASE(36, 36, 3, 0x90, 0x10, 30, 1), PIN_FIELD_BASE(37, 37, 3, 0xa0, 0x10, 1, 1), PIN_FIELD_BASE(38, 38, 3, 0x90, 0x10, 11, 1), PIN_FIELD_BASE(39, 39, 3, 0x90, 0x10, 10, 1), - PIN_FIELD_BASE(40, 41, 3, 0x90, 0x10, 0, 1), + PIN_FIELD_BASE(40, 40, 3, 0x90, 0x10, 0, 1), + PIN_FIELD_BASE(41, 41, 3, 0x90, 0x10, 1, 1), PIN_FIELD_BASE(42, 42, 3, 0x90, 0x10, 9, 1), PIN_FIELD_BASE(43, 43, 3, 0x90, 0x10, 8, 1), PIN_FIELD_BASE(44, 44, 3, 0x90, 0x10, 7, 1), @@ -347,46 +489,73 @@ static const struct mtk_pin_field_calc mt7988_pin_r0_range[] = { PIN_FIELD_BASE(48, 48, 3, 0x90, 0x10, 3, 1), PIN_FIELD_BASE(49, 49, 3, 0x90, 0x10, 2, 1), PIN_FIELD_BASE(50, 50, 3, 0x90, 0x10, 15, 1), - PIN_FIELD_BASE(51, 53, 3, 0x90, 0x10, 12, 1), + PIN_FIELD_BASE(51, 51, 3, 0x90, 0x10, 12, 1), + PIN_FIELD_BASE(52, 52, 3, 0x90, 0x10, 13, 1), + PIN_FIELD_BASE(53, 53, 3, 0x90, 0x10, 14, 1), PIN_FIELD_BASE(54, 54, 3, 0x90, 0x10, 16, 1), - PIN_FIELD_BASE(55, 56, 1, 0x80, 0x10, 12, 1), + + PIN_FIELD_BASE(55, 55, 1, 0x80, 0x10, 12, 1), + PIN_FIELD_BASE(56, 56, 1, 0x80, 0x10, 13, 1), PIN_FIELD_BASE(57, 57, 1, 0x80, 0x10, 11, 1), - PIN_FIELD_BASE(58, 60, 1, 0x80, 0x10, 2, 1), + PIN_FIELD_BASE(58, 58, 1, 0x80, 0x10, 2, 1), + PIN_FIELD_BASE(59, 59, 1, 0x80, 0x10, 3, 1), + PIN_FIELD_BASE(60, 60, 1, 0x80, 0x10, 4, 1), PIN_FIELD_BASE(61, 61, 1, 0x80, 0x10, 1, 1), PIN_FIELD_BASE(62, 62, 1, 0x80, 0x10, 5, 1), - PIN_FIELD_BASE(64, 68, 1, 0x80, 0x10, 6, 1), - PIN_FIELD_BASE(69, 70, 5, 0x60, 0x10, 1, 1), + PIN_FIELD_BASE(64, 64, 1, 0x80, 0x10, 6, 1), + PIN_FIELD_BASE(65, 65, 1, 0x80, 0x10, 7, 1), + PIN_FIELD_BASE(66, 66, 1, 0x80, 0x10, 8, 1), + PIN_FIELD_BASE(67, 67, 1, 0x80, 0x10, 9, 1), + PIN_FIELD_BASE(68, 68, 1, 0x80, 0x10, 10, 1), + + PIN_FIELD_BASE(69, 69, 5, 0x60, 0x10, 1, 1), + PIN_FIELD_BASE(70, 70, 5, 0x60, 0x10, 2, 1), + PIN_FIELD_BASE(73, 73, 4, 0x70, 0x10, 3, 1), PIN_FIELD_BASE(74, 74, 4, 0x70, 0x10, 0, 1), - PIN_FIELD_BASE(80, 81, 1, 0x80, 0x10, 16, 1), - PIN_FIELD_BASE(82, 83, 1, 0x80, 0x10, 14, 1), + + PIN_FIELD_BASE(80, 80, 1, 0x80, 0x10, 16, 1), + PIN_FIELD_BASE(81, 81, 1, 0x80, 0x10, 17, 1), + PIN_FIELD_BASE(82, 82, 1, 0x80, 0x10, 14, 1), + PIN_FIELD_BASE(83, 83, 1, 0x80, 0x10, 15, 1), }; static const struct mtk_pin_field_calc mt7988_pin_r1_range[] = { - PIN_FIELD_BASE(0, 1, 5, 0x70, 0x10, 7, 1), - PIN_FIELD_BASE(2, 3, 5, 0x70, 0x10, 5, 1), + PIN_FIELD_BASE(0, 0, 5, 0x70, 0x10, 7, 1), + PIN_FIELD_BASE(1, 1, 5, 0x70, 0x10, 8, 1), + PIN_FIELD_BASE(2, 2, 5, 0x70, 0x10, 5, 1), + PIN_FIELD_BASE(3, 3, 5, 0x70, 0x10, 6, 1), PIN_FIELD_BASE(4, 4, 5, 0x70, 0x10, 0, 1), - PIN_FIELD_BASE(5, 6, 5, 0x70, 0x10, 3, 1), + PIN_FIELD_BASE(5, 5, 5, 0x70, 0x10, 3, 1), + PIN_FIELD_BASE(6, 6, 5, 0x70, 0x10, 4, 1), + PIN_FIELD_BASE(11, 11, 1, 0x90, 0x10, 0, 1), PIN_FIELD_BASE(12, 12, 1, 0x90, 0x10, 18, 1), + PIN_FIELD_BASE(19, 19, 4, 0x80, 0x10, 2, 1), PIN_FIELD_BASE(20, 20, 4, 0x80, 0x10, 1, 1), + PIN_FIELD_BASE(21, 21, 3, 0xb0, 0x10, 17, 1), PIN_FIELD_BASE(22, 22, 3, 0xb0, 0x10, 23, 1), PIN_FIELD_BASE(23, 23, 3, 0xb0, 0x10, 20, 1), PIN_FIELD_BASE(24, 24, 3, 0xb0, 0x10, 19, 1), - PIN_FIELD_BASE(25, 26, 3, 0xb0, 0x10, 21, 1), + PIN_FIELD_BASE(25, 25, 3, 0xb0, 0x10, 21, 1), + PIN_FIELD_BASE(26, 26, 3, 0xb0, 0x10, 22, 1), PIN_FIELD_BASE(27, 27, 3, 0xb0, 0x10, 18, 1), - PIN_FIELD_BASE(28, 30, 3, 0xb0, 0x10, 25, 1), + PIN_FIELD_BASE(28, 28, 3, 0xb0, 0x10, 25, 1), + PIN_FIELD_BASE(29, 29, 3, 0xb0, 0x10, 26, 1), + PIN_FIELD_BASE(30, 30, 3, 0xb0, 0x10, 27, 1), PIN_FIELD_BASE(31, 31, 3, 0xb0, 0x10, 24, 1), PIN_FIELD_BASE(32, 32, 3, 0xb0, 0x10, 28, 1), PIN_FIELD_BASE(33, 33, 3, 0xc0, 0x10, 0, 1), PIN_FIELD_BASE(34, 34, 3, 0xb0, 0x10, 31, 1), - PIN_FIELD_BASE(35, 36, 3, 0xb0, 0x10, 29, 1), + PIN_FIELD_BASE(35, 35, 3, 0xb0, 0x10, 29, 1), + PIN_FIELD_BASE(36, 36, 3, 0xb0, 0x10, 30, 1), PIN_FIELD_BASE(37, 37, 3, 0xc0, 0x10, 1, 1), PIN_FIELD_BASE(38, 38, 3, 0xb0, 0x10, 11, 1), PIN_FIELD_BASE(39, 39, 3, 0xb0, 0x10, 10, 1), - PIN_FIELD_BASE(40, 41, 3, 0xb0, 0x10, 0, 1), + PIN_FIELD_BASE(40, 40, 3, 0xb0, 0x10, 0, 1), + PIN_FIELD_BASE(41, 41, 3, 0xb0, 0x10, 1, 1), PIN_FIELD_BASE(42, 42, 3, 0xb0, 0x10, 9, 1), PIN_FIELD_BASE(43, 43, 3, 0xb0, 0x10, 8, 1), PIN_FIELD_BASE(44, 44, 3, 0xb0, 0x10, 7, 1), @@ -396,19 +565,35 @@ static const struct mtk_pin_field_calc mt7988_pin_r1_range[] = { PIN_FIELD_BASE(48, 48, 3, 0xb0, 0x10, 3, 1), PIN_FIELD_BASE(49, 49, 3, 0xb0, 0x10, 2, 1), PIN_FIELD_BASE(50, 50, 3, 0xb0, 0x10, 15, 1), - PIN_FIELD_BASE(51, 53, 3, 0xb0, 0x10, 12, 1), + PIN_FIELD_BASE(51, 51, 3, 0xb0, 0x10, 12, 1), + PIN_FIELD_BASE(52, 52, 3, 0xb0, 0x10, 13, 1), + PIN_FIELD_BASE(53, 53, 3, 0xb0, 0x10, 14, 1), PIN_FIELD_BASE(54, 54, 3, 0xb0, 0x10, 16, 1), - PIN_FIELD_BASE(55, 56, 1, 0x90, 0x10, 12, 1), + + PIN_FIELD_BASE(55, 55, 1, 0x90, 0x10, 12, 1), + PIN_FIELD_BASE(56, 56, 1, 0x90, 0x10, 13, 1), PIN_FIELD_BASE(57, 57, 1, 0x90, 0x10, 11, 1), - PIN_FIELD_BASE(58, 60, 1, 0x90, 0x10, 2, 1), + PIN_FIELD_BASE(58, 58, 1, 0x90, 0x10, 2, 1), + PIN_FIELD_BASE(59, 59, 1, 0x90, 0x10, 3, 1), + PIN_FIELD_BASE(60, 60, 1, 0x90, 0x10, 4, 1), PIN_FIELD_BASE(61, 61, 1, 0x90, 0x10, 1, 1), PIN_FIELD_BASE(62, 62, 1, 0x90, 0x10, 5, 1), - PIN_FIELD_BASE(64, 68, 1, 0x90, 0x10, 6, 1), - PIN_FIELD_BASE(69, 70, 5, 0x70, 0x10, 1, 1), + PIN_FIELD_BASE(64, 64, 1, 0x90, 0x10, 6, 1), + PIN_FIELD_BASE(65, 65, 1, 0x90, 0x10, 7, 1), + PIN_FIELD_BASE(66, 66, 1, 0x90, 0x10, 8, 1), + PIN_FIELD_BASE(67, 67, 1, 0x90, 0x10, 9, 1), + PIN_FIELD_BASE(68, 68, 1, 0x90, 0x10, 10, 1), + + PIN_FIELD_BASE(69, 69, 5, 0x70, 0x10, 1, 1), + PIN_FIELD_BASE(70, 70, 5, 0x70, 0x10, 2, 1), + PIN_FIELD_BASE(73, 73, 4, 0x80, 0x10, 3, 1), PIN_FIELD_BASE(74, 74, 4, 0x80, 0x10, 0, 1), - PIN_FIELD_BASE(80, 81, 1, 0x90, 0x10, 16, 1), - PIN_FIELD_BASE(82, 83, 1, 0x90, 0x10, 14, 1), + + PIN_FIELD_BASE(80, 80, 1, 0x90, 0x10, 16, 1), + PIN_FIELD_BASE(81, 81, 1, 0x90, 0x10, 17, 1), + PIN_FIELD_BASE(82, 82, 1, 0x90, 0x10, 14, 1), + PIN_FIELD_BASE(83, 83, 1, 0x90, 0x10, 15, 1), }; static const struct mtk_pin_reg_calc mt7988_reg_cals[] = { @@ -1096,20 +1281,20 @@ static const struct group_desc mt7988_groups[] = { /* Joint those groups owning the same capability in user point of view which * allows that people tend to use through the device tree. */ -static const char *mt7988_jtag_groups[] = { +static const char * const mt7988_jtag_groups[] = { "tops_jtag0_0", "wo0_jtag", "wo1_jtag", "wo2_jtag", "jtag", "tops_jtag0_1", }; -static const char *mt7988_int_usxgmii_groups[] = { +static const char * const mt7988_int_usxgmii_groups[] = { "int_usxgmii", }; -static const char *mt7988_pwm_groups[] = { +static const char * const mt7988_pwm_groups[] = { "pwm0", "pwm1", "pwm2", "pwm3", "pwm4", "pwm5", "pwm6", "pwm7" }; -static const char *mt7988_dfd_groups[] = { +static const char * const mt7988_dfd_groups[] = { "dfd", }; -static const char *mt7988_i2c_groups[] = { +static const char * const mt7988_i2c_groups[] = { "xfi_phy0_i2c0", "xfi_phy1_i2c0", "xfi_phy_pll_i2c0", @@ -1134,13 +1319,13 @@ static const char *mt7988_i2c_groups[] = { "i2c2_0", "i2c2_1", }; -static const char *mt7988_ethernet_groups[] = { +static const char * const mt7988_ethernet_groups[] = { "mdc_mdio0", "2p5g_ext_mdio", "gbe_ext_mdio", "mdc_mdio1", }; -static const char *mt7988_pcie_groups[] = { +static const char * const mt7988_pcie_groups[] = { "pcie_wake_n0_0", "pcie_clk_req_n0_0", "pcie_wake_n3_0", "pcie_clk_req_n3", "pcie_p0_phy_i2c", "pcie_p1_phy_i2c", "pcie_p3_phy_i2c", "pcie_p2_phy_i2c", "ckm_phy_i2c", @@ -1150,18 +1335,18 @@ static const char *mt7988_pcie_groups[] = { "pcie_wake_n2_0", "pcie_clk_req_n2_0", "pcie_wake_n2_1", "pcie_clk_req_n0_1" }; -static const char *mt7988_pmic_groups[] = { +static const char * const mt7988_pmic_groups[] = { "pmic", }; -static const char *mt7988_wdt_groups[] = { +static const char * const mt7988_wdt_groups[] = { "watchdog", }; -static const char *mt7988_spi_groups[] = { +static const char * const mt7988_spi_groups[] = { "spi0", "spi0_wp_hold", "spi1", "spi2", "spi2_wp_hold", }; -static const char *mt7988_flash_groups[] = { "emmc_45", "sdcard", "snfi", +static const char * const mt7988_flash_groups[] = { "emmc_45", "sdcard", "snfi", "emmc_51" }; -static const char *mt7988_uart_groups[] = { +static const char * const mt7988_uart_groups[] = { "uart2", "tops_uart0_0", "uart2_0", @@ -1183,18 +1368,18 @@ static const char *mt7988_uart_groups[] = { "net_wo1_uart_txd_1", "net_wo2_uart_txd_1", }; -static const char *mt7988_udi_groups[] = { +static const char * const mt7988_udi_groups[] = { "udi", }; -static const char *mt7988_audio_groups[] = { +static const char * const mt7988_audio_groups[] = { "i2s", "pcm", }; -static const char *mt7988_led_groups[] = { +static const char * const mt7988_led_groups[] = { "gbe0_led1", "gbe1_led1", "gbe2_led1", "gbe3_led1", "2p5gbe_led1", "gbe0_led0", "gbe1_led0", "gbe2_led0", "gbe3_led0", "2p5gbe_led0", "wf5g_led0", "wf5g_led1", }; -static const char *mt7988_usb_groups[] = { +static const char * const mt7988_usb_groups[] = { "drv_vbus", "drv_vbus_p1", }; @@ -1226,7 +1411,7 @@ static const struct mtk_eint_hw mt7988_eint_hw = { .db_cnt = 16, }; -static const char *mt7988_pinctrl_register_base_names[] = { +static const char * const mt7988_pinctrl_register_base_names[] = { "gpio_base", "iocfg_tr_base", "iocfg_br_base", "iocfg_rb_base", "iocfg_lb_base", "iocfg_tl_base", }; From c072069fa74c6566c9c42fbc240bfb19e4c9ba7c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 1 Aug 2023 00:08:56 +0100 Subject: [PATCH 0329/1171] mediatek: filogic: update MT7988 device tree * move ethernet to mt7988a.dtsi * move switch definition to mt7988a.dtsi * add PHY LEDs Signed-off-by: Daniel Golle (cherry picked from commit 64b99802a61a477ed23fc1f3426fb19d1bc0c6f3) --- .../mediatek/mt7988a-dsa-10g-spim-nand.dts | 241 +++++-------- .../arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 319 +++++++++++++++++- 2 files changed, 394 insertions(+), 166 deletions(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts index e204dc4f166a42..27ef19c46dd203 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts @@ -7,6 +7,7 @@ /dts-v1/; #include "mt7988a-rfb-spim-nand.dtsi" #include +#include / { model = "MediaTek MT7988A DSA 10G SPIM-NAND RFB"; @@ -29,173 +30,105 @@ pinctrl-0 = <&mdio0_pins>; pinctrl-names = "default"; status = "okay"; +}; - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "internal"; +&gmac0 { + status = "okay"; +}; - fixed-link { - speed = <10000>; - full-duplex; - pause; - }; +&gmac1 { + status = "okay"; + phy-mode = "internal"; + phy-connection-type = "internal"; + phy = <&int_2p5g_phy>; +}; + +&gmac2 { + status = "okay"; + phy-mode = "usxgmii"; + phy-connection-type = "usxgmii"; + phy = <&phy8>; +}; + +&mdio_bus { + /* external Aquantia AQR113C */ + phy0: ethernet-phy@0 { + reg = <0>; + compatible = "ethernet-phy-ieee802.3-c45"; + reset-gpios = <&pio 72 1>; + reset-assert-us = <100000>; + reset-deassert-us = <221000>; }; - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - phy-mode = "internal"; - phy-connection-type = "internal"; - phy = <&phy15>; + /* external Aquantia AQR113C */ + phy8: ethernet-phy@8 { + reg = <8>; + compatible = "ethernet-phy-ieee802.3-c45"; + reset-gpios = <&pio 71 1>; + reset-assert-us = <100000>; + reset-deassert-us = <221000>; }; - gmac2: mac@2 { - compatible = "mediatek,eth-mac"; - reg = <2>; - phy-mode = "10gbase-kr"; - phy-connection-type = "10gbase-kr"; - phy = <&phy8>; + /* external Maxlinear GPY211C */ + phy5: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; }; - mdio0: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - - /* external Aquantia AQR113C */ - phy0: ethernet-phy@0 { - reg = <0>; - compatible = "ethernet-phy-ieee802.3-c45"; - reset-gpios = <&pio 72 1>; - reset-assert-us = <100000>; - reset-deassert-us = <221000>; - }; - - /* external Aquantia AQR113C */ - phy8: ethernet-phy@8 { - reg = <8>; - compatible = "ethernet-phy-ieee802.3-c45"; - reset-gpios = <&pio 71 1>; - reset-assert-us = <100000>; - reset-deassert-us = <221000>; - }; - - /* external Maxlinear GPY211C */ - phy5: ethernet-phy@5 { - reg = <5>; - compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "2500base-x"; - }; - - /* external Maxlinear GPY211C */ - phy13: ethernet-phy@13 { - reg = <13>; - compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "2500base-x"; - }; - - /* internal 2.5G PHY */ - phy15: ethernet-phy@15 { - reg = <15>; - pinctrl-names = "i2p5gbe-led"; - pinctrl-0 = <&i2p5gbe_led0_pins>; - compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "internal"; - }; + /* external Maxlinear GPY211C */ + phy13: ethernet-phy@13 { + reg = <13>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; }; }; +&int_2p5g_phy { + pinctrl-names = "i2p5gbe-led"; + pinctrl-0 = <&i2p5gbe_led0_pins>; +}; + &switch { status = "okay"; +}; - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - label = "lan0"; - phy-mode = "internal"; - phy-handle = <&gsw_phy0>; - }; - - port@1 { - reg = <1>; - label = "lan1"; - phy-mode = "internal"; - phy-handle = <&gsw_phy1>; - }; - - port@2 { - reg = <2>; - label = "lan2"; - phy-mode = "internal"; - phy-handle = <&gsw_phy2>; - }; - - port@3 { - reg = <3>; - label = "lan3"; - phy-mode = "internal"; - phy-handle = <&gsw_phy3>; - }; - - port@6 { - reg = <6>; - ethernet = <&gmac0>; - phy-mode = "internal"; - - fixed-link { - speed = <10000>; - full-duplex; - pause; - }; - }; - }; +&gsw_phy0 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe0_led0_pins>; +}; - mdio { - #address-cells = <1>; - #size-cells = <0>; - mediatek,pio = <&pio>; - - gsw_phy0: ethernet-phy@0 { - compatible = "ethernet-phy-id03a2.9481"; - reg = <0>; - phy-mode = "internal"; - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe0_led0_pins>; - nvmem-cells = <&phy_calibration_p0>; - nvmem-cell-names = "phy-cal-data"; - }; - - gsw_phy1: ethernet-phy@1 { - compatible = "ethernet-phy-id03a2.9481"; - reg = <1>; - phy-mode = "internal"; - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe1_led0_pins>; - nvmem-cells = <&phy_calibration_p1>; - nvmem-cell-names = "phy-cal-data"; - }; - - gsw_phy2: ethernet-phy@2 { - compatible = "ethernet-phy-id03a2.9481"; - reg = <2>; - phy-mode = "internal"; - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe2_led0_pins>; - nvmem-cells = <&phy_calibration_p2>; - nvmem-cell-names = "phy-cal-data"; - }; - - gsw_phy3: ethernet-phy@3 { - compatible = "ethernet-phy-id03a2.9481"; - reg = <3>; - phy-mode = "internal"; - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe3_led0_pins>; - nvmem-cells = <&phy_calibration_p3>; - nvmem-cell-names = "phy-cal-data"; - }; - }; +&gsw_phy0_led0 { + status = "okay"; + color = ; +}; + +&gsw_phy1 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe1_led0_pins>; +}; + +&gsw_phy1_led0 { + status = "okay"; + color = ; +}; + +&gsw_phy2 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe2_led0_pins>; +}; + +&gsw_phy2_led0 { + status = "okay"; + color = ; +}; + +&gsw_phy3 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe3_led0_pins>; +}; + +&gsw_phy3_led0 { + status = "okay"; + color = ; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi index 94aa8251bd0f78..462218c65d47ed 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi @@ -4,12 +4,13 @@ * Author: Sam.Shih */ -#include +#include #include +#include +#include #include -#include -#include #include +#include #include / { @@ -144,9 +145,9 @@ #size-cells = <2>; ranges; - /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ + /* 320 KiB reserved for ARM Trusted Firmware (BL31 and BL32) */ secmon_reserved: secmon@43000000 { - reg = <0 0x43000000 0 0x30000>; + reg = <0 0x43000000 0 0x50000>; no-map; }; }; @@ -228,7 +229,7 @@ "iocfg_lb_base", "iocfg_tl_base", "eint"; gpio-controller; #gpio-cells = <2>; - gpio-ranges = <&pio 0 0 83>; + gpio-ranges = <&pio 0 0 84>; interrupt-controller; interrupts = ; interrupt-parent = <&gic>; @@ -260,47 +261,131 @@ }; }; - i2c2_pins: i2c2-pins-g0 { + i2c1_sfp_pins: i2c1-sfp-pins-g0 { + mux { + function = "i2c"; + groups = "i2c1_sfp"; + }; + }; + + i2c2_pins: i2c2-pins { + mux { + function = "i2c"; + groups = "i2c2"; + }; + }; + + i2c2_0_pins: i2c2-pins-g0 { + mux { + function = "i2c"; + groups = "i2c2_0"; + }; + }; + + i2c2_1_pins: i2c2-pins-g1 { mux { function = "i2c"; groups = "i2c2_1"; }; }; - gbe0_led0_pins: gbe0-pins { + gbe0_led0_pins: gbe0-led0-pins { mux { function = "led"; groups = "gbe0_led0"; }; }; - gbe1_led0_pins: gbe1-pins { + gbe1_led0_pins: gbe1-led0-pins { mux { function = "led"; groups = "gbe1_led0"; }; }; - gbe2_led0_pins: gbe2-pins { + gbe2_led0_pins: gbe2-led0-pins { mux { function = "led"; groups = "gbe2_led0"; }; }; - gbe3_led0_pins: gbe3-pins { + gbe3_led0_pins: gbe3-led0-pins { mux { function = "led"; groups = "gbe3_led0"; }; }; - i2p5gbe_led0_pins: 2p5gbe-pins { + gbe0_led1_pins: gbe0-led1-pins { + mux { + function = "led"; + groups = "gbe0_led1"; + }; + }; + + gbe1_led1_pins: gbe1-led1-pins { + mux { + function = "led"; + groups = "gbe1_led1"; + }; + }; + + gbe2_led1_pins: gbe2-led1-pins { + mux { + function = "led"; + groups = "gbe2_led1"; + }; + }; + + gbe3_led1_pins: gbe3-led1-pins { + mux { + function = "led"; + groups = "gbe3_led1"; + }; + }; + + i2p5gbe_led0_pins: 2p5gbe-led0-pins { mux { function = "led"; groups = "2p5gbe_led0"; }; }; + + i2p5gbe_led1_pins: 2p5gbe-led1-pins { + mux { + function = "led"; + groups = "2p5gbe_led1"; + }; + }; + + mmc0_pins_emmc_45: mmc0-pins-emmc-45 { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_emmc_51: mmc0-pins-emmc-51 { + mux { + function = "flash"; + groups = "emmc_51"; + }; + }; + + mmc0_pins_sdcard: mmc0-pins-sdcard { + mux { + function = "flash"; + groups = "sdcard"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0"; + }; + }; }; sgmiisys0: syscon@10060000 { @@ -380,6 +465,8 @@ <&infracfg CLK_INFRA_MUX_UART0_SEL>; assigned-clock-parents = <&topckgen CLK_TOP_XTAL>, <&topckgen CLK_TOP_UART_SEL>; + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; status = "disabled"; }; @@ -645,6 +732,29 @@ status = "disabled"; }; + mmc0: mmc@11230000 { + compatible = "mediatek,mt7986-mmc", + "mediatek,mt7981-mmc"; + reg = <0 0x11230000 0 0x1000>, + <0 0x11D60000 0 0x1000>; + interrupts = ; + clocks = <&infracfg CLK_INFRA_MSDC400>, + <&infracfg CLK_INFRA_MSDC2_HCK>, + <&infracfg CLK_INFRA_66M_MSDC_0_HCK>, + <&infracfg CLK_INFRA_133M_MSDC_0_HCK>; + assigned-clocks = <&topckgen CLK_TOP_EMMC_250M_SEL>, + <&topckgen CLK_TOP_EMMC_400M_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_NET1PLL_D5_D2>, + <&apmixedsys CLK_APMIXED_MSDCPLL>; + clock-names = "source", + "hclk", + "axi_cg", + "ahb_cg"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + tphy: tphy@11c50000 { compatible = "mediatek,mt7988", "mediatek,generic-tphy-v2"; @@ -747,6 +857,157 @@ interrupt-parent = <&gic>; interrupts = ; resets = <ðrst 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan0"; + phy-mode = "internal"; + phy-handle = <&gsw_phy0>; + }; + + port@1 { + reg = <1>; + label = "lan1"; + phy-mode = "internal"; + phy-handle = <&gsw_phy1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-mode = "internal"; + phy-handle = <&gsw_phy2>; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&gsw_phy3>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "internal"; + + fixed-link { + speed = <10000>; + full-duplex; + pause; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + mediatek,pio = <&pio>; + + gsw_phy0: ethernet-phy@0 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <0>; + phy-mode = "internal"; + nvmem-cells = <&phy_calibration_p0>; + nvmem-cell-names = "phy-cal-data"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + gsw_phy0_led0: gsw-phy0-led0@0 { + reg = <0>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + + gsw_phy0_led1: gsw-phy0-led1@1 { + reg = <1>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + }; + }; + + gsw_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <1>; + phy-mode = "internal"; + nvmem-cells = <&phy_calibration_p1>; + nvmem-cell-names = "phy-cal-data"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + gsw_phy1_led0: gsw-phy1-led0@0 { + reg = <0>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + + gsw_phy1_led1: gsw-phy1-led1@1 { + reg = <1>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + }; + }; + + gsw_phy2: ethernet-phy@2 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <2>; + phy-mode = "internal"; + nvmem-cells = <&phy_calibration_p2>; + nvmem-cell-names = "phy-cal-data"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + gsw_phy2_led0: gsw-phy2-led0@0 { + reg = <0>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + + gsw_phy2_led1: gsw-phy2-led1@1 { + reg = <1>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + }; + }; + + gsw_phy3: ethernet-phy@3 { + compatible = "ethernet-phy-id03a2.9481"; + reg = <3>; + phy-mode = "internal"; + nvmem-cells = <&phy_calibration_p3>; + nvmem-cell-names = "phy-cal-data"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + gsw_phy3_led0: gsw-phy3-led0@0 { + reg = <0>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + + gsw_phy3_led1: gsw-phy3-led1@1 { + reg = <1>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + }; + }; + }; }; ethwarp: syscon@15031000 { @@ -843,6 +1104,40 @@ #address-cells = <1>; #size-cells = <0>; status = "disabled"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "internal"; + + fixed-link { + speed = <10000>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + }; + + gmac2: mac@2 { + compatible = "mediatek,eth-mac"; + reg = <2>; + }; + + mdio_bus: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + /* internal 2.5G PHY */ + int_2p5g_phy: ethernet-phy@15 { + reg = <15>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "internal"; + }; + }; }; }; }; From ad2fa6bc9c65eb1834afabaa2245dc941fa0ddb5 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 3 Aug 2023 23:30:25 +0100 Subject: [PATCH 0330/1171] mediatek: filogic: restore non-const type in pinctrl-mt7988 driver When building with Linux 5.15 the 'const' type results in warnings. Restore the original non-const type in those cases. Fixes: 36d0aa9c2d ("mediatek: filogic: sync pinctrl-mt7988 with MediaTek SDK") Signed-off-by: Daniel Golle (cherry picked from commit 1eb67cb0704a61f49d9be9f88aecbce1d881f8c9) --- .../drivers/pinctrl/mediatek/pinctrl-mt7988.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c index 49c0be1bba0cf2..659c83e997df61 100644 --- a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c +++ b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7988.c @@ -1281,20 +1281,20 @@ static const struct group_desc mt7988_groups[] = { /* Joint those groups owning the same capability in user point of view which * allows that people tend to use through the device tree. */ -static const char * const mt7988_jtag_groups[] = { +static const char *mt7988_jtag_groups[] = { "tops_jtag0_0", "wo0_jtag", "wo1_jtag", "wo2_jtag", "jtag", "tops_jtag0_1", }; -static const char * const mt7988_int_usxgmii_groups[] = { +static const char *mt7988_int_usxgmii_groups[] = { "int_usxgmii", }; -static const char * const mt7988_pwm_groups[] = { +static const char *mt7988_pwm_groups[] = { "pwm0", "pwm1", "pwm2", "pwm3", "pwm4", "pwm5", "pwm6", "pwm7" }; -static const char * const mt7988_dfd_groups[] = { +static const char *mt7988_dfd_groups[] = { "dfd", }; -static const char * const mt7988_i2c_groups[] = { +static const char *mt7988_i2c_groups[] = { "xfi_phy0_i2c0", "xfi_phy1_i2c0", "xfi_phy_pll_i2c0", @@ -1319,13 +1319,13 @@ static const char * const mt7988_i2c_groups[] = { "i2c2_0", "i2c2_1", }; -static const char * const mt7988_ethernet_groups[] = { +static const char *mt7988_ethernet_groups[] = { "mdc_mdio0", "2p5g_ext_mdio", "gbe_ext_mdio", "mdc_mdio1", }; -static const char * const mt7988_pcie_groups[] = { +static const char *mt7988_pcie_groups[] = { "pcie_wake_n0_0", "pcie_clk_req_n0_0", "pcie_wake_n3_0", "pcie_clk_req_n3", "pcie_p0_phy_i2c", "pcie_p1_phy_i2c", "pcie_p3_phy_i2c", "pcie_p2_phy_i2c", "ckm_phy_i2c", @@ -1335,18 +1335,18 @@ static const char * const mt7988_pcie_groups[] = { "pcie_wake_n2_0", "pcie_clk_req_n2_0", "pcie_wake_n2_1", "pcie_clk_req_n0_1" }; -static const char * const mt7988_pmic_groups[] = { +static const char *mt7988_pmic_groups[] = { "pmic", }; -static const char * const mt7988_wdt_groups[] = { +static const char *mt7988_wdt_groups[] = { "watchdog", }; -static const char * const mt7988_spi_groups[] = { +static const char *mt7988_spi_groups[] = { "spi0", "spi0_wp_hold", "spi1", "spi2", "spi2_wp_hold", }; -static const char * const mt7988_flash_groups[] = { "emmc_45", "sdcard", "snfi", +static const char *mt7988_flash_groups[] = { "emmc_45", "sdcard", "snfi", "emmc_51" }; -static const char * const mt7988_uart_groups[] = { +static const char *mt7988_uart_groups[] = { "uart2", "tops_uart0_0", "uart2_0", @@ -1368,18 +1368,18 @@ static const char * const mt7988_uart_groups[] = { "net_wo1_uart_txd_1", "net_wo2_uart_txd_1", }; -static const char * const mt7988_udi_groups[] = { +static const char *mt7988_udi_groups[] = { "udi", }; -static const char * const mt7988_audio_groups[] = { +static const char *mt7988_audio_groups[] = { "i2s", "pcm", }; -static const char * const mt7988_led_groups[] = { +static const char *mt7988_led_groups[] = { "gbe0_led1", "gbe1_led1", "gbe2_led1", "gbe3_led1", "2p5gbe_led1", "gbe0_led0", "gbe1_led0", "gbe2_led0", "gbe3_led0", "2p5gbe_led0", "wf5g_led0", "wf5g_led1", }; -static const char * const mt7988_usb_groups[] = { +static const char *mt7988_usb_groups[] = { "drv_vbus", "drv_vbus_p1", }; @@ -1411,7 +1411,7 @@ static const struct mtk_eint_hw mt7988_eint_hw = { .db_cnt = 16, }; -static const char * const mt7988_pinctrl_register_base_names[] = { +static const char *mt7988_pinctrl_register_base_names[] = { "gpio_base", "iocfg_tr_base", "iocfg_br_base", "iocfg_rb_base", "iocfg_lb_base", "iocfg_tl_base", }; From 4ebba8a05d09cc3cdefce585ed51ccec3c6b1206 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Fri, 7 Jul 2023 13:51:49 +0200 Subject: [PATCH 0331/1171] realtek: add support for HPE 1920-8g-poe+ Hardware information: --------------------- - RTL8380 SoC - 8 Gigabit RJ45 PoE ports (built-in RTL8218B) - 2 SFP ports (built-in SerDes) - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog - PoE chips: Nuvoton M0516LDE + BCM59121 Known issues: --------------------- - PoE LEDs are uncontrolled. (Manual taken from f2f09bc00280) Booting initramfs image: ------------------------ - Prepare a FTP or TFTP server serving the OpenWrt initramfs image and connect the server to a switch port. - Connect to the console port of the device and enter the extended boot menu by typing Ctrl+B when prompted. - Choose the menu option "<3> Enter Ethernet SubMenu". - Set network parameters via the option "<5> Modify Ethernet Parameter". Enter the FTP/TFTP filename as "Load File Name" ("Target File Name" can be left blank, it is not required for booting from RAM). Note that the configuration is saved on flash, so it only needs to be done once. - Select "<1> Download Application Program To SDRAM And Run". Initial installation: --------------------- - Boot an initramfs image as described above, then use sysupgrade to install OpenWrt permanently. After initial installation, the bootloader needs to be configured to load the correct image file - Enter the extended boot menu again and choose "<4> File Control", then select "<2> Set Application File type". - Enter the number of the file "openwrt-kernel.bin" (should be 1), and use the option "<1> +Main" to select it as boot image. - Choose "<0> Exit To Main Menu" and then "<1> Boot System". NOTE: The bootloader on these devices can only boot from the VFS filesystem which normally spans most of the flash. With OpenWrt, only the first part of the firmware partition contains a valid filesystem, the rest is used for rootfs. As the bootloader does not know about this, you must not do any file operations in the bootloader, as this may corrupt the OpenWrt installation (selecting the boot image is an exception, as it only stores a flag in the bootloader data, but doesn't write to the filesystem). Example PoE config file (/etc/config/poe): --------------------- config global option budget '180' config port option enable '1' option id '1' option name 'lan8' option poe_plus '1' option priority '2' config port option enable '1' option id '2' option name 'lan7' option poe_plus '1' option priority '2' config port option enable '1' option id '3' option name 'lan6' option poe_plus '1' option priority '2' config port option enable '1' option id '4' option name 'lan5' option poe_plus '1' option priority '2' config port option enable '1' option id '5' option name 'lan4' option poe_plus '1' option priority '2' config port option enable '1' option id '6' option name 'lan3' option poe_plus '1' option priority '2' config port option enable '1' option id '7' option name 'lan2' option poe_plus '1' option priority '2' config port option enable '1' option id '8' option name 'lan1' option poe_plus '1' option priority '2' Signed-off-by: Pawel Dembicki (cherry picked from commit b370753fc409eb2220af7caed9ffd66beed2d041) --- .../realtek/base-files/etc/board.d/02_network | 5 + .../base-files/etc/board.d/03_gpio_switches | 16 +++ .../dts-5.15/rtl8380_hpe_1920-8g-poe.dts | 12 ++ .../realtek/dts-5.15/rtl8380_hpe_1920-8g.dts | 109 +---------------- .../realtek/dts-5.15/rtl8380_hpe_1920-8g.dtsi | 112 ++++++++++++++++++ target/linux/realtek/image/rtl838x.mk | 8 ++ 6 files changed, 154 insertions(+), 108 deletions(-) create mode 100644 target/linux/realtek/base-files/etc/board.d/03_gpio_switches create mode 100644 target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe.dts create mode 100644 target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dtsi diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 1dea2ad5a68e2f..90b45abf94baed 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -21,6 +21,7 @@ board=$(board_name) board_config_update lan_list=$(ls -1 -v -d /sys/class/net/lan* | xargs -n1 basename | xargs) +lan_list_rev=$(ls -1 -v -d -r /sys/class/net/lan* | xargs -n1 basename | xargs) ucidef_set_bridge_device switch ucidef_set_interface_lan "$lan_list" @@ -30,6 +31,7 @@ lan_mac_end="" label_mac="" case $board in hpe,1920-8g|\ +hpe,1920-8g-poe|\ hpe,1920-16g|\ hpe,1920-24g) label_mac=$(mtd_get_mac_binary factory 0x68) @@ -65,6 +67,9 @@ done [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac case $board in +hpe,1920-8g-poe) + ucidef_set_poe 180 "$lan_list_rev" "lan9 lan10" + ;; netgear,gs110tpp-v1) ucidef_set_poe 130 "$lan_list" "lan9 lan10" ;; diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches new file mode 100644 index 00000000000000..abfcb8e5924014 --- /dev/null +++ b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches @@ -0,0 +1,16 @@ + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +hpe,1920-8g-poe) + ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe.dts b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe.dts new file mode 100644 index 00000000000000..3b00c31411917e --- /dev/null +++ b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8380_hpe_1920-8g.dtsi" + +/ { + compatible = "hpe,1920-8g-poe", "realtek,rtl838x-soc"; + model = "HPE 1920-8G-PoE+ (JG922A)"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dts b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dts index 6ddb2d8dcc6026..ac95a00c018bda 100644 --- a/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dts +++ b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dts @@ -1,115 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "rtl838x.dtsi" -#include "rtl838x_hpe_1920.dtsi" +#include "rtl8380_hpe_1920-8g.dtsi" / { compatible = "hpe,1920-8g", "realtek,rtl838x-soc"; model = "HPE 1920-8G (JG920A)"; - - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - }; - - i2c0: i2c-gpio-0 { - compatible = "i2c-gpio"; - sda-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - scl-gpios = <&gpio1 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - i2c-gpio,delay-us = <2>; - #address-cells = <1>; - #size-cells = <0>; - }; - - sfp0: sfp-0 { - compatible = "sff,sfp"; - i2c-bus = <&i2c0>; - los-gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>; - mod-def0-gpio = <&gpio1 25 GPIO_ACTIVE_LOW>; - // tx-fault and tx-disable unconnected - }; - - i2c1: i2c-gpio-1 { - compatible = "i2c-gpio"; - sda-gpios = <&gpio1 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - scl-gpios = <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - i2c-gpio,delay-us = <2>; - #address-cells = <1>; - #size-cells = <0>; - }; - - sfp1: sfp-1 { - compatible = "sff,sfp"; - i2c-bus = <&i2c1>; - los-gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>; - mod-def0-gpio = <&gpio1 21 GPIO_ACTIVE_LOW>; - // tx-fault and tx-disable unconnected - }; -}; - -ðernet0 { - mdio: mdio-bus { - compatible = "realtek,rtl838x-mdio"; - regmap = <ðernet0>; - #address-cells = <1>; - #size-cells = <0>; - - INTERNAL_PHY(8) - INTERNAL_PHY(9) - INTERNAL_PHY(10) - INTERNAL_PHY(11) - INTERNAL_PHY(12) - INTERNAL_PHY(13) - INTERNAL_PHY(14) - INTERNAL_PHY(15) - - INTERNAL_PHY(24) - INTERNAL_PHY(26) - }; -}; - -&switch0 { - ports { - #address-cells = <1>; - #size-cells = <0>; - - SWITCH_PORT(8, 1, internal) - SWITCH_PORT(9, 2, internal) - SWITCH_PORT(10, 3, internal) - SWITCH_PORT(11, 4, internal) - SWITCH_PORT(12, 5, internal) - SWITCH_PORT(13, 6, internal) - SWITCH_PORT(14, 7, internal) - SWITCH_PORT(15, 8, internal) - - port@24 { - reg = <24>; - label = "lan9"; - phy-handle = <&phy24>; - phy-mode = "1000base-x"; - managed = "in-band-status"; - sfp = <&sfp0>; - }; - - port@26 { - reg = <26>; - label = "lan10"; - phy-handle = <&phy26>; - phy-mode = "1000base-x"; - managed = "in-band-status"; - sfp = <&sfp1>; - }; - - port@28 { - ethernet = <ðernet0>; - reg = <28>; - phy-mode = "internal"; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - }; }; diff --git a/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dtsi b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dtsi new file mode 100644 index 00000000000000..58f2c1f6c97ee9 --- /dev/null +++ b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g.dtsi @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl838x.dtsi" +#include "rtl838x_hpe_1920.dtsi" + +/ { + gpio1: rtl8231-gpio { + compatible = "realtek,rtl8231-gpio"; + #gpio-cells = <2>; + gpio-controller; + indirect-access-bus-id = <0>; + }; + + i2c0: i2c-gpio-0 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp0: sfp-0 { + compatible = "sff,sfp"; + i2c-bus = <&i2c0>; + los-gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 25 GPIO_ACTIVE_LOW>; + // tx-fault and tx-disable unconnected + }; + + i2c1: i2c-gpio-1 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp1: sfp-1 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 21 GPIO_ACTIVE_LOW>; + // tx-fault and tx-disable unconnected + }; +}; + +ðernet0 { + mdio: mdio-bus { + compatible = "realtek,rtl838x-mdio"; + regmap = <ðernet0>; + #address-cells = <1>; + #size-cells = <0>; + + INTERNAL_PHY(8) + INTERNAL_PHY(9) + INTERNAL_PHY(10) + INTERNAL_PHY(11) + INTERNAL_PHY(12) + INTERNAL_PHY(13) + INTERNAL_PHY(14) + INTERNAL_PHY(15) + + INTERNAL_PHY(24) + INTERNAL_PHY(26) + }; +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + SWITCH_PORT(8, 1, internal) + SWITCH_PORT(9, 2, internal) + SWITCH_PORT(10, 3, internal) + SWITCH_PORT(11, 4, internal) + SWITCH_PORT(12, 5, internal) + SWITCH_PORT(13, 6, internal) + SWITCH_PORT(14, 7, internal) + SWITCH_PORT(15, 8, internal) + + port@24 { + reg = <24>; + label = "lan9"; + phy-handle = <&phy24>; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp0>; + }; + + port@26 { + reg = <26>; + label = "lan10"; + phy-handle = <&phy26>; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp1>; + }; + + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 7c7bc8a0e5ea50..73930f4d6f41a4 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -99,6 +99,14 @@ define Device/hpe_1920-8g endef TARGET_DEVICES += hpe_1920-8g +define Device/hpe_1920-8g-poe + $(Device/hpe_1920) + SOC := rtl8380 + DEVICE_MODEL := 1920-8G-PoE+ (JG922A) + H3C_DEVICE_ID := 0x00010025 +endef +TARGET_DEVICES += hpe_1920-8g-poe + define Device/hpe_1920-16g $(Device/hpe_1920) SOC := rtl8382 From e0d5621d281120811d427152fec01257096a84b2 Mon Sep 17 00:00:00 2001 From: Christophe Sokol Date: Sun, 16 Jul 2023 08:01:17 +0000 Subject: [PATCH 0332/1171] openssl: opt-out of lto usage This fixes building with USE_LTO enabled: aarch64-openwrt-linux-musl-gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -Os -pipe -mcpu=cortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/build_dir/target-aarch64_cortex-a53_musl/openssl-3.0.9=openssl-3.0.9 -ffunction-sections -fdata-sections -flto=auto -fno-fat-lto-objects -Wformat -Werror=format-security -DPIC -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fPIC -Os -pipe -mcpu=cortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/build_dir/target-aarch64_cortex-a53_musl/openssl-3.0.9=openssl-3.0.9 -ffunction-sections -fdata-sections -flto=auto -fno-fat-lto-objects -Wformat -Werror=format-security -fPIC -fstack-protector-strong -fPIC -fuse-ld=bfd -flto=auto -fuse-linker-plugin -fPIC -specs=/include/hardened-ld-pie.specs -znow -zrelro -L. -Wl,-z,defs -Wl,-znodelete -shared -Wl,-Bsymbolic -Wl,-z,now -Wl,-z,relro -L/staging_dir/toolchain-aarch64_cortex-a53_gcc-13.1.0_musl/usr/lib -L/staging_dir/toolchain-aarch64_cortex-a53_gcc-13.1.0_musl/lib -Wl,--gc-sections \ -o providers/legacy.so -Wl,--version-script=providers/legacy.ld \ providers/legacy-dso-legacyprov.o \ providers/liblegacy.a providers/libcommon.a -lcrypto -ldl -pthread ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o: in function `legacy_get_params': :(.text.legacy_get_params+0xd4): undefined reference to `ossl_prov_is_running' ld.bfd: :(.text.legacy_get_params+0xd8): undefined reference to `ossl_prov_is_running' ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o: in function `legacy_teardown': :(.text.legacy_teardown+0x4): undefined reference to `ossl_prov_ctx_get0_libctx' ld.bfd: :(.text.legacy_teardown+0x8): undefined reference to `ossl_prov_ctx_get0_libctx' ld.bfd: :(.text.legacy_teardown+0x34): undefined reference to `ossl_prov_ctx_free' ld.bfd: :(.text.legacy_teardown+0x38): undefined reference to `ossl_prov_ctx_free' ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o: in function `OSSL_provider_init': :(.text.OSSL_provider_init+0x14): undefined reference to `ossl_prov_ctx_new' ld.bfd: :(.text.OSSL_provider_init+0x18): undefined reference to `ossl_prov_ctx_new' ld.bfd: :(.text.OSSL_provider_init+0x84): undefined reference to `ossl_prov_ctx_set0_libctx' ld.bfd: :(.text.OSSL_provider_init+0x88): undefined reference to `ossl_prov_ctx_set0_libctx' ld.bfd: :(.text.OSSL_provider_init+0x98): undefined reference to `ossl_prov_ctx_set0_handle' ld.bfd: :(.text.OSSL_provider_init+0x9c): undefined reference to `ossl_prov_ctx_set0_handle' ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o:(.data.rel.ro.legacy_kdfs+0x10): undefined reference to `ossl_kdf_pbkdf1_functions' ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o:(.data.rel.ro.legacy_ciphers+0x10): undefined reference to `ossl_cast5128ecb_functions' ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o:(.data.rel.ro.legacy_ciphers+0x30): undefined reference to `ossl_cast5128cbc_functions' [...] ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o:(.data.rel.ro.legacy_digests+0x10): undefined reference to `ossl_md4_functions' ld.bfd: /tmp/ccdWw6Lo.ltrans0.ltrans.o:(.data.rel.ro.legacy_digests+0x30): undefined reference to `ossl_ripemd160_functions' collect2: error: ld returned 1 exit status Signed-off-by: Christophe Sokol (cherry picked from commit 906616d20183bb7be4eb71812ef5e76cb3af56a0) --- package/libs/openssl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 0d09114f06e307..13e5952b372fc6 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_VERSION:=3.0.9 -PKG_RELEASE:=2 -PKG_BUILD_FLAGS:=no-mips16 gc-sections +PKG_RELEASE:=3 +PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_BUILD_PARALLEL:=1 From 11b0c43671af619f9acd129b44d52625ff5d1f42 Mon Sep 17 00:00:00 2001 From: Ivan Pavlov Date: Fri, 4 Aug 2023 15:28:12 +0300 Subject: [PATCH 0333/1171] openssl: update to 3.0.10 Changes between 3.0.9 and 3.0.10 [1 Aug 2023] * Fix excessive time spent checking DH q parameter value ([CVE-2023-3817]) * Fix DH_check() excessive time with over sized modulus ([CVE-2023-3446]) * Do not ignore empty associated data entries with AES-SIV ([CVE-2023-2975]) Signed-off-by: Ivan Pavlov (cherry picked from commit 92602f823a5f29fee41209ccef53ddddb2e89222) --- package/libs/openssl/Makefile | 6 +++--- .../libs/openssl/patches/100-Configure-afalg-support.patch | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 13e5952b372fc6..7bee249676fc23 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl -PKG_VERSION:=3.0.9 -PKG_RELEASE:=3 +PKG_VERSION:=3.0.10 +PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_BUILD_PARALLEL:=1 @@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=eb1ab04781474360f77c318ab89d8c5a03abc38e63d65a603cabbf1b00a1dc90 +PKG_HASH:=1761d4f5b13a1028b9b6f3d4b8e17feb0cedc9370f6afe61d7193d2cdce83323 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/openssl/patches/100-Configure-afalg-support.patch b/package/libs/openssl/patches/100-Configure-afalg-support.patch index e9cd7bf9c1afa6..307e23b80924da 100644 --- a/package/libs/openssl/patches/100-Configure-afalg-support.patch +++ b/package/libs/openssl/patches/100-Configure-afalg-support.patch @@ -10,7 +10,7 @@ Signed-off-by: Eneas U de Queiroz --- a/Configure +++ b/Configure -@@ -1677,7 +1677,9 @@ $config{CFLAGS} = [ map { $_ eq '--ossl- +@@ -1674,7 +1674,9 @@ $config{CFLAGS} = [ map { $_ eq '--ossl- unless ($disabled{afalgeng}) { $config{afalgeng}=""; From 795a5dd4529d7030fd141b9644a1752b863c2fd4 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 3 Aug 2023 13:53:47 -0400 Subject: [PATCH 0334/1171] kernel: bump 5.15 to 5.15.124 Changelog: https://lore.kernel.org/stable/2023080341-curliness-salary-4158@gregkh/ 1. Needed to make a change to to package/kernel/linux/modules/netsupport.mk due to upstream moving vxlan to its own directory[1]. @john-tho suggested using the the 6.1 xvlan FILES to circumvent. 2. All patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.124&id=77396fa9096abdbfbb87d63e73ad44d5621cf103 Signed-off-by: John Audia [Refreshed on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens (cherry picked from commit 81c1172c3626157ff9a146430cd14e32c9c80a5a) --- include/kernel-5.15 | 4 ++-- package/kernel/linux/modules/netsupport.mk | 3 ++- .../patches-5.15/910-unaligned_access_hacks.patch | 4 ++-- ...dia-i2c-Add-driver-for-Sony-IMX477-sensor.patch | 2 +- ...on-devicetree-Add-documentation-for-imx37.patch | 2 +- ...rkaround-for-bogus-SET_DEQ_PENDING-endpoi.patch | 2 +- ...-media-i2c-Add-IMX519-CMOS-sensor-binding.patch | 2 +- ...-xhci-quirks-add-link-TRB-quirk-for-VL805.patch | 14 +++++++++----- ...or-out-TRBS_PER_SEGMENT-define-in-runtime.patch | 4 ++-- ...0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch | 4 ++-- ...d-a-quirk-for-Superspeed-bulk-OUT-transfe.patch | 10 +++++----- ...hci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch | 6 +++--- ...m-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch | 2 +- ...net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch | 2 +- ...dsa-mt7530-introduce-separate-MDIO-driver.patch | 2 +- ...530-introduce-driver-for-MT7988-built-in-.patch | 2 +- ...ver-for-Motorcomm-yt8521-gigabit-ethernet.patch | 2 +- ...em-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch | 2 +- ...6.0-0001-nvmem-microchip-otpc-add-support.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 2 +- ...irqchip-bcm-6345-l1-request-memory-region.patch | 4 ++-- .../701-staging-add-fsl_ppfe-driver.patch | 2 +- ...-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch | 2 +- ...-i2c-move-drivers-from-strlcpy-to-strscpy.patch | 2 +- ...-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch | 2 +- ...-watchdog-add-realtek-otto-watchdog-timer.patch | 2 +- 26 files changed, 46 insertions(+), 41 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 3052c783a955f8..35c6240132b900 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .123 -LINUX_KERNEL_HASH-5.15.123 = 2de69544a12e6a059163c58fc901c13bcf22e8cac39c66b56f8fbb633399bf93 +LINUX_VERSION-5.15 = .124 +LINUX_KERNEL_HASH-5.15.124 = 00036a0260ad012aa832a8698a4afcf23b2410091527738ce48ce3fcc23f22ed diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 7f1905311fc94f..1d5950d237e9d8 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -92,7 +92,8 @@ define KernelPackage/vxlan +kmod-udptunnel4 \ +IPV6:kmod-udptunnel6 KCONFIG:=CONFIG_VXLAN - FILES:=$(LINUX_DIR)/drivers/net/vxlan.ko + FILES:= \ + $(LINUX_DIR)/drivers/net/vxlan/vxlan.ko AUTOLOAD:=$(call AutoLoad,13,vxlan) endef diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index f542c32d45d3f2..1971b9cd010185 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -654,7 +654,7 @@ SVN-Revision: 35130 return false; return true; -@@ -750,13 +754,13 @@ static inline void ipv6_addr_set_v4mappe +@@ -746,13 +750,13 @@ static inline void ipv6_addr_set_v4mappe */ static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) { @@ -670,7 +670,7 @@ SVN-Revision: 35130 if (xb) return i * 32 + 31 - __fls(ntohl(xb)); } -@@ -950,17 +954,18 @@ static inline u32 ip6_multipath_hash_fie +@@ -946,17 +950,18 @@ static inline u32 ip6_multipath_hash_fie static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, __be32 flowlabel) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch index 289b7d8a933c4d..18273c07784c11 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch @@ -25,7 +25,7 @@ Signed-off-by: Naushir Patuck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17534,6 +17534,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -17535,6 +17535,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch index c93b69c0aa3042..3fc2ef4042d176 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17548,6 +17548,7 @@ M: Raspberry Pi Kernel Maintenance --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -697,9 +697,9 @@ deq_found: +@@ -674,9 +674,9 @@ deq_found: } if ((ep->ep_state & SET_DEQ_PENDING)) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0520-dt-bindings-media-i2c-Add-IMX519-CMOS-sensor-binding.patch b/target/linux/bcm27xx/patches-5.15/950-0520-dt-bindings-media-i2c-Add-IMX519-CMOS-sensor-binding.patch index 4d7ab14b843767..273285bef56a77 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0520-dt-bindings-media-i2c-Add-IMX519-CMOS-sensor-binding.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0520-dt-bindings-media-i2c-Add-IMX519-CMOS-sensor-binding.patch @@ -132,7 +132,7 @@ Signed-off-by: Lee Jackson +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17552,6 +17552,14 @@ F: Documentation/devicetree/bindings/med +@@ -17553,6 +17553,14 @@ F: Documentation/devicetree/bindings/med F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index a0ec8f8b2b4448..78b01e9ba5ce5c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -22,17 +22,21 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -297,6 +297,7 @@ static void xhci_pci_quirks(struct devic - if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { +@@ -294,8 +294,10 @@ static void xhci_pci_quirks(struct devic + pdev->device == 0x3432) + xhci->quirks |= XHCI_BROKEN_STREAMS; + +- if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) ++ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { xhci->quirks |= XHCI_LPM_SUPPORT; - xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; + xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; - } ++ } if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -687,6 +687,15 @@ static int xhci_move_dequeue_past_td(str +@@ -664,6 +664,15 @@ static int xhci_move_dequeue_past_td(str } while (!cycle_found || !td_last_trb_found); deq_found: diff --git a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch index 4cb33c75297889..792f3bdf0fe76d 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch @@ -205,7 +205,7 @@ Signed-off-by: Jonathan Bell xhci_err(xhci, "Tried to move enqueue past ring segment\n"); return; } -@@ -3189,7 +3192,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd +@@ -3166,7 +3169,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd * that clears the EHB. */ while (xhci_handle_event(xhci) > 0) { @@ -214,7 +214,7 @@ Signed-off-by: Jonathan Bell continue; xhci_update_erst_dequeue(xhci, event_ring_deq); event_ring_deq = xhci->event_ring->dequeue; -@@ -3331,7 +3334,8 @@ static int prepare_ring(struct xhci_hcd +@@ -3308,7 +3311,8 @@ static int prepare_ring(struct xhci_hcd } } diff --git a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch index 5c7a71b42b99a3..4e23eaf93670bf 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch @@ -53,9 +53,9 @@ Signed-off-by: Jonathan Bell cycle_state, type, max_packet, flags); --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -298,6 +298,7 @@ static void xhci_pci_quirks(struct devic +@@ -297,6 +297,7 @@ static void xhci_pci_quirks(struct devic + if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { xhci->quirks |= XHCI_LPM_SUPPORT; - xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; + xhci->quirks |= XHCI_VLI_TRB_CACHE_BUG; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch index 67a965eff3a056..e47ab8dac41cc5 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch @@ -26,8 +26,8 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -299,6 +299,7 @@ static void xhci_pci_quirks(struct devic - xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; +@@ -298,6 +298,7 @@ static void xhci_pci_quirks(struct devic + xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; xhci->quirks |= XHCI_VLI_TRB_CACHE_BUG; + xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG; @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3644,14 +3644,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3621,14 +3621,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -54,7 +54,7 @@ Signed-off-by: Jonathan Bell full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ if (urb->num_sgs && !(urb->transfer_flags & URB_DMA_MAP_SINGLE)) { -@@ -3688,6 +3689,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3665,6 +3666,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * start_cycle = ring->cycle_state; send_addr = addr; @@ -72,7 +72,7 @@ Signed-off-by: Jonathan Bell /* Queue the TRBs, even if they are zero-length */ for (enqd_len = 0; first_trb || enqd_len < full_len; enqd_len += trb_buff_len) { -@@ -3700,6 +3712,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3677,6 +3689,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; diff --git a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch index 526fa29bcc63a2..79b3d196d3b8b9 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch @@ -13,7 +13,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3644,7 +3644,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3621,7 +3621,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell u32 field, length_field, remainder, maxpacket; u64 addr, send_addr; -@@ -3690,14 +3690,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3667,14 +3667,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * send_addr = addr; if (xhci->quirks & XHCI_VLI_SS_BULK_OUT_BUG && @@ -40,7 +40,7 @@ Signed-off-by: Jonathan Bell } /* Queue the TRBs, even if they are zero-length */ -@@ -3712,7 +3707,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3689,7 +3684,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; diff --git a/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch index dfae5566d9fd03..1a6c372de25c6c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0795-drm-tiny-Add-MIPI-DBI-compatible-SPI-driver.patch @@ -63,7 +63,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20220227124713.39766-6-noral --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -5973,6 +5973,14 @@ T: git git://anongit.freedesktop.org/drm +@@ -5974,6 +5974,14 @@ T: git git://anongit.freedesktop.org/drm F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt F: drivers/gpu/drm/tiny/mi0283qt.c diff --git a/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch b/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch index 3668a821ef758f..1cae648358f8ef 100644 --- a/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch +++ b/target/linux/generic/backport-5.15/707-v6.3-net-pcs-add-driver-for-MediaTek-SGMII-PCS.patch @@ -32,7 +32,7 @@ Signed-off-by: Jakub Kicinski --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11782,6 +11782,14 @@ L: netdev@vger.kernel.org +@@ -11783,6 +11783,14 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/mediatek/ diff --git a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch index c0e29fa00fbf0e..2cebac1f8c6471 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0011-net-dsa-mt7530-introduce-separate-MDIO-driver.patch @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11894,6 +11894,7 @@ M: Landen Chao L: netdev@vger.kernel.org S: Maintained diff --git a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch index 89dc30c7dffb7c..889a13e0149bb4 100644 --- a/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch +++ b/target/linux/generic/backport-5.15/790-v6.4-0013-net-dsa-mt7530-introduce-driver-for-MT7988-built-in-.patch @@ -28,7 +28,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11892,9 +11892,11 @@ MEDIATEK SWITCH DRIVER +@@ -11893,9 +11893,11 @@ MEDIATEK SWITCH DRIVER M: Sean Wang M: Landen Chao M: DENG Qingfang diff --git a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch index eb51b410b54441..7eb097f86d0212 100644 --- a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch +++ b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch @@ -21,7 +21,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -12693,6 +12693,7 @@ F: include/uapi/linux/meye.h +@@ -12694,6 +12694,7 @@ F: include/uapi/linux/meye.h MOTORCOMM PHY DRIVER M: Peter Geis diff --git a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch index 6ad9257d60e4e1..79fd479054ed93 100644 --- a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch +++ b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17958,6 +17958,11 @@ L: netdev@vger.kernel.org +@@ -17959,6 +17959,11 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/dlink/sundance.c diff --git a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch index f7ea61626c5069..24beeda0d2254e 100644 --- a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch +++ b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch @@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -12357,6 +12357,14 @@ S: Supported +@@ -12358,6 +12358,14 @@ S: Supported F: Documentation/devicetree/bindings/mtd/atmel-nand.txt F: drivers/mtd/nand/raw/atmel/* diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index a44a5b6d89c8ca..4f1966db165054 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1177,6 +1179,11 @@ static const struct usb_device_id option +@@ -1179,6 +1181,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/pending-5.15/351-irqchip-bcm-6345-l1-request-memory-region.patch b/target/linux/generic/pending-5.15/351-irqchip-bcm-6345-l1-request-memory-region.patch index 9fad4f62c61696..91654cc294c31f 100644 --- a/target/linux/generic/pending-5.15/351-irqchip-bcm-6345-l1-request-memory-region.patch +++ b/target/linux/generic/pending-5.15/351-irqchip-bcm-6345-l1-request-memory-region.patch @@ -91,7 +91,7 @@ Acked-by: Florian Fainelli --- a/drivers/irqchip/irq-bcm6345-l1.c +++ b/drivers/irqchip/irq-bcm6345-l1.c -@@ -261,6 +261,9 @@ static int __init bcm6345_l1_init_one(st +@@ -257,6 +257,9 @@ static int __init bcm6345_l1_init_one(st if (!cpu->map_base) return -ENOMEM; @@ -101,7 +101,7 @@ Acked-by: Florian Fainelli for (i = 0; i < n_words; i++) { cpu->enable_cache[i] = 0; __raw_writel(0, cpu->map_base + reg_enable(intc, i)); -@@ -339,8 +342,7 @@ static int __init bcm6345_l1_of_init(str +@@ -335,8 +338,7 @@ static int __init bcm6345_l1_of_init(str for_each_cpu(idx, &intc->cpumask) { struct bcm6345_l1_cpu *cpu = intc->cpus[idx]; diff --git a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch index e8a69153500f8b..445d050a7842d1 100644 --- a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch +++ b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch @@ -854,7 +854,7 @@ Signed-off-by: Pawel Dembicki +}; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -7519,6 +7519,14 @@ F: drivers/ptp/ptp_qoriq.c +@@ -7520,6 +7520,14 @@ F: drivers/ptp/ptp_qoriq.c F: drivers/ptp/ptp_qoriq_debugfs.c F: include/linux/fsl/ptp_qoriq.h diff --git a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch index 85e6b03a59eacb..1d8b509678e187 100644 --- a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch +++ b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11790,6 +11790,15 @@ S: Maintained +@@ -11791,6 +11791,15 @@ S: Maintained F: drivers/net/pcs/pcs-mtk-lynxi.c F: include/linux/pcs/pcs-mtk-lynxi.h diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index 44d3753b142d25..79444e071e8443 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -257,7 +257,7 @@ Signed-off-by: Wolfram Sang --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c -@@ -738,7 +738,7 @@ static int iic_probe(struct platform_dev +@@ -736,7 +736,7 @@ static int iic_probe(struct platform_dev adap = &dev->adap; adap->dev.parent = &ofdev->dev; adap->dev.of_node = of_node_get(np); diff --git a/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch b/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch index 242a6c1e00abba..0b6891343d2106 100644 --- a/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch +++ b/target/linux/mvebu/patches-5.15/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch @@ -16,7 +16,7 @@ Cc: Robert Marko --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -9056,6 +9056,22 @@ F: include/net/nl802154.h +@@ -9057,6 +9057,22 @@ F: include/net/nl802154.h F: net/ieee802154/ F: net/mac802154/ diff --git a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch index dfe7ab28d73b9e..60db030647d94f 100644 --- a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch +++ b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch @@ -32,7 +32,7 @@ Signed-off-by: Guenter Roeck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -15895,6 +15895,13 @@ S: Maintained +@@ -15896,6 +15896,13 @@ S: Maintained F: include/sound/rt*.h F: sound/soc/codecs/rt* From ec0ff928d929f076cdfb4ab1be96d2cf24c1d29b Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 8 Aug 2023 19:57:20 -0400 Subject: [PATCH 0335/1171] kernel: bump 5.15 to 5.15.125 1. Add new symbols to generic config 2. Bump kernel Changelog: https://lore.kernel.org/stable/2023080818-groin-gradient-a031@gregkh/ All patches automatically rebased. Signed-off-by: John Audia [Refreshed on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens (cherry picked from commit daed3322d347cae5fa538907b5f1fa5d5cfc08c6) --- include/kernel-5.15 | 4 ++-- .../airoha/patches-5.15/0001-add-airoha-platform.patch | 2 +- .../patches-5.15/221-armsr-armv7-disable-gc_sections.patch | 2 +- target/linux/ath25/patches-5.15/107-ar5312_gpio.patch | 2 +- .../patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch | 2 +- .../322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch | 2 +- .../patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch | 2 +- .../bmips/patches-5.15/600-mips-bmips-add-pci-support.patch | 2 +- ....1-02-mm-x86-add-CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG.patch | 4 ++-- ...-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch | 2 +- .../050-v5.16-05-mips-bpf-Enable-eBPF-JITs.patch | 4 ++-- target/linux/generic/hack-5.15/220-arm-gc_sections.patch | 2 +- .../generic/pending-5.15/300-mips_expose_boot_raw.patch | 4 ++-- target/linux/generic/pending-5.15/920-mangle_bootargs.patch | 4 ++-- .../0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch | 2 +- .../0067-generic-Mangle-bootloader-s-kernel-arguments.patch | 6 +++--- .../ipq806x/patches-5.15/900-arm-add-cmdline-override.patch | 2 +- target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch | 2 +- .../patches-5.15/901-arm-add-cmdline-override.patch | 2 +- .../300-mvebu-Mangle-bootloader-s-kernel-arguments.patch | 6 +++--- .../octeon/patches-5.15/100-mips_image_cmdline_hack.patch | 2 +- .../996-generic-Mangle-bootloader-s-kernel-arguments.patch | 6 +++--- .../314-MIPS-add-bootargs-override-property.patch | 4 ++-- .../patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch | 4 ++-- .../patches-5.15/300-mips-add-rtl838x-platform.patch | 2 +- ...-um-increase-default-virtual-physical-memory-to-64.patch | 2 +- target/linux/x86/config-5.15 | 2 ++ 27 files changed, 41 insertions(+), 39 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 35c6240132b900..43e03fac8d10ed 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .124 -LINUX_KERNEL_HASH-5.15.124 = 00036a0260ad012aa832a8698a4afcf23b2410091527738ce48ce3fcc23f22ed +LINUX_VERSION-5.15 = .125 +LINUX_KERNEL_HASH-5.15.125 = 150f3846b76cd23a6135f49cef71372bade5a06e851cb4f8558df8b862d8fec7 diff --git a/target/linux/airoha/patches-5.15/0001-add-airoha-platform.patch b/target/linux/airoha/patches-5.15/0001-add-airoha-platform.patch index bb1104206e2a6d..5b356ea23e0aa6 100644 --- a/target/linux/airoha/patches-5.15/0001-add-airoha-platform.patch +++ b/target/linux/airoha/patches-5.15/0001-add-airoha-platform.patch @@ -1,6 +1,6 @@ --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -571,6 +571,18 @@ config ARCH_VIRT +@@ -572,6 +572,18 @@ config ARCH_VIRT select HAVE_ARM_ARCH_TIMER select ARCH_SUPPORTS_BIG_ENDIAN diff --git a/target/linux/armsr/patches-5.15/221-armsr-armv7-disable-gc_sections.patch b/target/linux/armsr/patches-5.15/221-armsr-armv7-disable-gc_sections.patch index ac90a6698d253a..fb5357f765f349 100644 --- a/target/linux/armsr/patches-5.15/221-armsr-armv7-disable-gc_sections.patch +++ b/target/linux/armsr/patches-5.15/221-armsr-armv7-disable-gc_sections.patch @@ -13,7 +13,7 @@ Signed-off-by: Mathew McBride --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -117,7 +117,6 @@ config ARM +@@ -118,7 +118,6 @@ config ARM select HAVE_UID16 select HAVE_VIRT_CPU_ACCOUNTING_GEN select IRQ_FORCED_THREADING diff --git a/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch b/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch index e6e1290d35a4b8..70d139621aab66 100644 --- a/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch +++ b/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch @@ -202,7 +202,7 @@ +subsys_initcall(ar5312_gpio_init); --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -231,6 +231,7 @@ config ATH25 +@@ -232,6 +232,7 @@ config ATH25 select CEVT_R4K select CSRC_R4K select DMA_NONCOHERENT diff --git a/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch b/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch index 9d014434ecb339..5eb23ba6c658f9 100644 --- a/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch +++ b/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch @@ -15,7 +15,7 @@ Signed-off-by: John Crispin --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -257,6 +257,8 @@ config ATH79 +@@ -258,6 +258,8 @@ config ATH79 select SYS_SUPPORTS_BIG_ENDIAN select SYS_SUPPORTS_MIPS16 select SYS_SUPPORTS_ZBOOT_UART_PROM diff --git a/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch b/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch index aff3f4a1a0e4b0..c6a8cf1e36661a 100644 --- a/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch +++ b/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonas Gorski --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -332,6 +332,9 @@ config BCM63XX +@@ -333,6 +333,9 @@ config BCM63XX select SYNC_R4K select DMA_NONCOHERENT select IRQ_MIPS_CPU diff --git a/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch b/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch index eb3f1c1d5cecb7..79d4f98e0a746c 100644 --- a/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch +++ b/target/linux/bmips/patches-5.15/202-mips-bmips-tweak-Kconfig-options.patch @@ -13,7 +13,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -275,25 +275,20 @@ config BMIPS_GENERIC +@@ -276,25 +276,20 @@ config BMIPS_GENERIC select SYNC_R4K select COMMON_CLK select BCM6345_L1_IRQ diff --git a/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch b/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch index e2ca75a3930e71..2f19d1e4894c05 100644 --- a/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch +++ b/target/linux/bmips/patches-5.15/600-mips-bmips-add-pci-support.patch @@ -14,7 +14,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -275,6 +275,7 @@ config BMIPS_GENERIC +@@ -276,6 +276,7 @@ config BMIPS_GENERIC select SYNC_R4K select COMMON_CLK select BCM6345_L1_IRQ diff --git a/target/linux/generic/backport-5.15/020-v6.1-02-mm-x86-add-CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG.patch b/target/linux/generic/backport-5.15/020-v6.1-02-mm-x86-add-CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG.patch index 9e0430ea2aacee..27c85a333b3eea 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-02-mm-x86-add-CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-02-mm-x86-add-CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG.patch @@ -73,7 +73,7 @@ Signed-off-by: Andrew Morton --- a/arch/Kconfig +++ b/arch/Kconfig -@@ -1295,6 +1295,14 @@ config ARCH_HAS_ELFCORE_COMPAT +@@ -1298,6 +1298,14 @@ config ARCH_HAS_ELFCORE_COMPAT config ARCH_HAS_PARANOID_L1D_FLUSH bool @@ -90,7 +90,7 @@ Signed-off-by: Andrew Morton source "scripts/gcc-plugins/Kconfig" --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig -@@ -84,6 +84,7 @@ config X86 +@@ -85,6 +85,7 @@ config X86 select ARCH_HAS_PMEM_API if X86_64 select ARCH_HAS_PTE_DEVMAP if X86_64 select ARCH_HAS_PTE_SPECIAL diff --git a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch index dad21dccb58eb6..e6ce94e3d4fcac 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch @@ -398,7 +398,7 @@ Signed-off-by: Andrew Morton mmdrop(mm); } -@@ -2622,6 +2624,13 @@ pid_t kernel_clone(struct kernel_clone_a +@@ -2617,6 +2619,13 @@ pid_t kernel_clone(struct kernel_clone_a get_task_struct(p); } diff --git a/target/linux/generic/backport-5.15/050-v5.16-05-mips-bpf-Enable-eBPF-JITs.patch b/target/linux/generic/backport-5.15/050-v5.16-05-mips-bpf-Enable-eBPF-JITs.patch index 14763c1211ea5e..24e4e9052b39eb 100644 --- a/target/linux/generic/backport-5.15/050-v5.16-05-mips-bpf-Enable-eBPF-JITs.patch +++ b/target/linux/generic/backport-5.15/050-v5.16-05-mips-bpf-Enable-eBPF-JITs.patch @@ -24,7 +24,7 @@ Signed-off-by: Johan Almbladh L: bpf@vger.kernel.org --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -57,7 +57,6 @@ config MIPS +@@ -58,7 +58,6 @@ config MIPS select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES select HAVE_ASM_MODVERSIONS @@ -32,7 +32,7 @@ Signed-off-by: Johan Almbladh select HAVE_CONTEXT_TRACKING select HAVE_TIF_NOHZ select HAVE_C_RECORDMCOUNT -@@ -65,7 +64,10 @@ config MIPS +@@ -66,7 +65,10 @@ config MIPS select HAVE_DEBUG_STACKOVERFLOW select HAVE_DMA_CONTIGUOUS select HAVE_DYNAMIC_FTRACE diff --git a/target/linux/generic/hack-5.15/220-arm-gc_sections.patch b/target/linux/generic/hack-5.15/220-arm-gc_sections.patch index 0aa3eb840cd6cc..dd6507c9178b29 100644 --- a/target/linux/generic/hack-5.15/220-arm-gc_sections.patch +++ b/target/linux/generic/hack-5.15/220-arm-gc_sections.patch @@ -12,7 +12,7 @@ Signed-off-by: Gabor Juhos --- --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -117,6 +117,7 @@ config ARM +@@ -118,6 +118,7 @@ config ARM select HAVE_UID16 select HAVE_VIRT_CPU_ACCOUNTING_GEN select IRQ_FORCED_THREADING diff --git a/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch index 436c2cc767cffe..0fcd415966ef90 100644 --- a/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch +++ b/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch @@ -9,7 +9,7 @@ Acked-by: Rob Landley --- --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1101,9 +1101,6 @@ config FW_ARC +@@ -1102,9 +1102,6 @@ config FW_ARC config ARCH_MAY_HAVE_PC_FDC bool @@ -19,7 +19,7 @@ Acked-by: Rob Landley config CEVT_BCM1480 bool -@@ -3183,6 +3180,18 @@ choice +@@ -3184,6 +3181,18 @@ choice bool "Extend builtin kernel arguments with bootloader arguments" endchoice diff --git a/target/linux/generic/pending-5.15/920-mangle_bootargs.patch b/target/linux/generic/pending-5.15/920-mangle_bootargs.patch index 5f0a106ae4e9d8..7e1f26d243f027 100644 --- a/target/linux/generic/pending-5.15/920-mangle_bootargs.patch +++ b/target/linux/generic/pending-5.15/920-mangle_bootargs.patch @@ -31,7 +31,7 @@ Signed-off-by: Imre Kaloz help --- a/init/main.c +++ b/init/main.c -@@ -616,6 +616,29 @@ static inline void setup_nr_cpu_ids(void +@@ -614,6 +614,29 @@ static inline void setup_nr_cpu_ids(void static inline void smp_prepare_cpus(unsigned int maxcpus) { } #endif @@ -61,7 +61,7 @@ Signed-off-by: Imre Kaloz /* * We need to store the untouched command line for future reference. * We also need to store the touched command line since the parameter -@@ -956,6 +979,7 @@ asmlinkage __visible void __init __no_sa +@@ -953,6 +976,7 @@ asmlinkage __visible void __init __no_sa pr_notice("%s", linux_banner); early_security_init(); setup_arch(&command_line); diff --git a/target/linux/ipq806x/patches-5.15/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch b/target/linux/ipq806x/patches-5.15/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch index 1860cef800344e..780f37713eec82 100644 --- a/target/linux/ipq806x/patches-5.15/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch +++ b/target/linux/ipq806x/patches-5.15/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch @@ -33,7 +33,7 @@ Signed-off-by: Mathieu Olivari --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -317,7 +317,7 @@ config ARCH_MULTIPLATFORM +@@ -318,7 +318,7 @@ config ARCH_MULTIPLATFORM select ARCH_SELECT_MEMORY_MODEL select ARM_HAS_SG_CHAIN select ARM_PATCH_PHYS_VIRT diff --git a/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch index df5d4811a8852a..536a9dad205f23 100644 --- a/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch @@ -22,7 +22,7 @@ Signed-off-by: Adrian Panella --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -1727,6 +1727,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN +@@ -1728,6 +1728,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN The command-line arguments provided by the boot loader will be appended to the the device tree bootargs property. @@ -248,7 +248,7 @@ Signed-off-by: Adrian Panella } --- a/init/main.c +++ b/init/main.c -@@ -114,6 +114,10 @@ +@@ -112,6 +112,10 @@ #include @@ -259,7 +259,7 @@ Signed-off-by: Adrian Panella static int kernel_init(void *); extern void init_IRQ(void); -@@ -993,6 +997,18 @@ asmlinkage __visible void __init __no_sa +@@ -990,6 +994,18 @@ asmlinkage __visible void __init __no_sa pr_notice("Kernel command line: %s\n", saved_command_line); /* parameters may set static keys */ jump_label_init(); diff --git a/target/linux/ipq806x/patches-5.15/900-arm-add-cmdline-override.patch b/target/linux/ipq806x/patches-5.15/900-arm-add-cmdline-override.patch index 23cec10f445ab4..2c18c7d15b828c 100644 --- a/target/linux/ipq806x/patches-5.15/900-arm-add-cmdline-override.patch +++ b/target/linux/ipq806x/patches-5.15/900-arm-add-cmdline-override.patch @@ -1,6 +1,6 @@ --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -1740,6 +1740,14 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_MANGL +@@ -1741,6 +1741,14 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_MANGL endchoice diff --git a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch index 6776d35ecec37a..25410e1fb7104f 100644 --- a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch +++ b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch @@ -15,7 +15,7 @@ Signed-off-by: Stefan Koch --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -2430,6 +2430,12 @@ config MIPS_VPE_LOADER +@@ -2431,6 +2431,12 @@ config MIPS_VPE_LOADER Includes a loader for loading an elf relocatable object onto another VPE and running it. diff --git a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch index 636452bebb8587..a22a1124e9d6e2 100644 --- a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch @@ -1,6 +1,6 @@ --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -1729,6 +1729,14 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN +@@ -1730,6 +1730,14 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN endchoice diff --git a/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch index 9069de16146981..d064b801ecfa7c 100644 --- a/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch @@ -28,7 +28,7 @@ Signed-off-by: Michael Gray --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -1727,6 +1727,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN +@@ -1728,6 +1728,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN The command-line arguments provided by the boot loader will be appended to the the device tree bootargs property. @@ -247,7 +247,7 @@ Signed-off-by: Michael Gray } --- a/init/main.c +++ b/init/main.c -@@ -114,6 +114,10 @@ +@@ -112,6 +112,10 @@ #include @@ -258,7 +258,7 @@ Signed-off-by: Michael Gray static int kernel_init(void *); extern void init_IRQ(void); -@@ -991,6 +995,18 @@ asmlinkage __visible void __init __no_sa +@@ -988,6 +992,18 @@ asmlinkage __visible void __init __no_sa page_alloc_init(); pr_notice("Kernel command line: %s\n", saved_command_line); diff --git a/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch b/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch index 4b225277f9deb8..785fc1273c3faf 100644 --- a/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch +++ b/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1181,6 +1181,10 @@ config MIPS_MSC +@@ -1182,6 +1182,10 @@ config MIPS_MSC config SYNC_R4K bool diff --git a/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch index c64c193e7ee2dd..1e04b9daf58fe9 100644 --- a/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch @@ -22,7 +22,7 @@ Signed-off-by: Adrian Panella --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -1727,6 +1727,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN +@@ -1728,6 +1728,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN The command-line arguments provided by the boot loader will be appended to the the device tree bootargs property. @@ -228,7 +228,7 @@ Signed-off-by: Adrian Panella } --- a/init/main.c +++ b/init/main.c -@@ -114,6 +114,10 @@ +@@ -112,6 +112,10 @@ #include @@ -239,7 +239,7 @@ Signed-off-by: Adrian Panella static int kernel_init(void *); extern void init_IRQ(void); -@@ -991,6 +995,18 @@ asmlinkage __visible void __init __no_sa +@@ -988,6 +992,18 @@ asmlinkage __visible void __init __no_sa page_alloc_init(); pr_notice("Kernel command line: %s\n", saved_command_line); diff --git a/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch b/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch index ef45aac61bda92..e7dca7af886e8c 100644 --- a/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch +++ b/target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch @@ -17,7 +17,7 @@ Signed-off-by: David Bauer --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c -@@ -545,8 +545,28 @@ static int __init bootcmdline_scan_chose +@@ -547,8 +547,28 @@ static int __init bootcmdline_scan_chose #endif /* CONFIG_OF_EARLY_FLATTREE */ @@ -46,7 +46,7 @@ Signed-off-by: David Bauer bool dt_bootargs = false; /* -@@ -560,6 +580,14 @@ static void __init bootcmdline_init(void +@@ -562,6 +582,14 @@ static void __init bootcmdline_init(void } /* diff --git a/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch b/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch index d49429f7a3b862..4f9eec72714db9 100644 --- a/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch +++ b/target/linux/ramips/patches-5.15/315-owrt-hack-fix-mt7688-cache-issue.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c -@@ -687,7 +687,6 @@ static void __init arch_mem_init(char ** +@@ -689,7 +689,6 @@ static void __init arch_mem_init(char ** mips_reserve_vmcore(); mips_parse_crashkernel(); @@ -18,7 +18,7 @@ Signed-off-by: John Crispin /* * In order to reduce the possibility of kernel panic when failed to -@@ -804,6 +803,7 @@ void __init setup_arch(char **cmdline_p) +@@ -806,6 +805,7 @@ void __init setup_arch(char **cmdline_p) cpu_cache_init(); paging_init(); diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index f853ef4feef752..ed121a7ce72f48 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1054,8 +1054,58 @@ config NLM_XLP_BOARD +@@ -1055,8 +1055,58 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. diff --git a/target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch b/target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch index 3a67a7dbd07015..f19e38d510b74b 100644 --- a/target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch +++ b/target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch @@ -29,7 +29,7 @@ Signed-off-by: Christian Lamparter --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c -@@ -130,7 +130,7 @@ static int have_root __initdata; +@@ -131,7 +131,7 @@ static int have_root __initdata; static int have_console __initdata; /* Set in uml_mem_setup and modified in linux_main */ diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15 index aebe4f08c4a389..cf94f3bbff23be 100644 --- a/target/linux/x86/config-5.15 +++ b/target/linux/x86/config-5.15 @@ -66,6 +66,7 @@ CONFIG_CPU_SUP_INTEL=y CONFIG_CPU_SUP_TRANSMETA_32=y CONFIG_CPU_SUP_UMC_32=y CONFIG_CPU_SUP_ZHAOXIN=y +CONFIG_CPU_SRSO=y CONFIG_CPU_UNRET_ENTRY=y CONFIG_CRASH_CORE=y CONFIG_CRC16=y @@ -116,6 +117,7 @@ CONFIG_FUSION=y CONFIG_FUSION_MAX_SGE=128 CONFIG_FUSION_SPI=y CONFIG_FW_LOADER_PAGED_BUF=y +# CONFIG_GDS_FORCE_MITIGATION is not set CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y From 6984adde657dacdd48aae8a8c1445077486e0761 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 25 Jun 2023 21:46:45 +0200 Subject: [PATCH 0336/1171] procd: update to latest git HEAD 122a5e3 Revert "sysupgrade: print errno on failure" 2db8365 system: add RISC-V CPU info Signed-off-by: Hauke Mehrtens (cherry picked from commit 359638098742d7573ff422f6dc7125c89086072b) --- 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 2d51b51ad72dad..9e829a21591ef1 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_MIRROR_HASH:=75a92c01ef85f41dc7e0b77ac35f464fbe45942af02ca6847516c4ebf574c4a4 -PKG_SOURCE_DATE:=2023-01-16 -PKG_SOURCE_VERSION:=190f13a75e67e0bdb662188da79b8be31e0aae01 +PKG_MIRROR_HASH:=a7e42525ae65eb1342e593a714e88bc59e46467cbb5a7fd7d7aca4a9815b7c0d +PKG_SOURCE_DATE:=2023-06-25 +PKG_SOURCE_VERSION:=2db836553e8fc318143b38dbc6e12b8625cf5c33 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From a88795aeac3cfbc7f803a3ffec5e05e171ff1d65 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 1 Jul 2023 12:08:51 +0200 Subject: [PATCH 0337/1171] iwinfo: update to latest git HEAD d1f07cf devices: add device id for Atheros AR9287 and AR9380 65ea345 nl80211: constify a few arrays ca79f64 lib: report byte counters as 64 bit values This contains an ABI change, increase the ABI version too. Signed-off-by: Hauke Mehrtens (cherry picked from commit a226153067766db6d733aa3e330742c9da40c4f6) --- package/network/utils/iwinfo/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index fcb89ff42b3248..e5add395ff90b8 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,13 +11,13 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2023-05-17 -PKG_SOURCE_VERSION:=c9f5c3f7b50d146f18be1458ab5591defc0af6da -PKG_MIRROR_HASH:=0d9263cbbe79d62966398af66b3b3ce7b58991da6b266f8f4ec2ec4be3d4ad97 +PKG_SOURCE_DATE:=2023-07-01 +PKG_SOURCE_VERSION:=ca79f64154b107f192ec3c1ba631816cb8b07922 +PKG_MIRROR_HASH:=5eddf584a1c3ed5637162d6bfc573ed1ce3691fcb38bdd55bf9f1e11e82ccc46 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 -IWINFO_ABI_VERSION:=20230121 +IWINFO_ABI_VERSION:=20230701 include $(INCLUDE_DIR)/package.mk From b52b6c5b1a8c74c944373f930324322647067485 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 25 Jun 2023 20:09:38 +0200 Subject: [PATCH 0338/1171] rpcd: update to latest git HEAD 31c3907 file: strengthen exec access control Signed-off-by: Hauke Mehrtens (cherry picked from commit 9d8d65322ce7d82ee20cc6dcca07506e7405c5f5) --- package/system/rpcd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 6221da8c8effc7..b0e351b25dce6e 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_MIRROR_HASH:=d636b6e08a69578d615b2a294d6ca2c7ef73791de2a8314f1afb741655d8a143 -PKG_SOURCE_DATE:=2023-03-14 -PKG_SOURCE_VERSION:=d97883005ffb5be251872c3e4abe04f71732f9bd +PKG_MIRROR_HASH:=9c29ee1b4379f835420986fdef3d9510cdd5fc1fd5f4662ecc185913a1f0ec17 +PKG_SOURCE_DATE:=2023-06-25 +PKG_SOURCE_VERSION:=31c390727b83c9efd768c7aa258813e6084b46a3 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 2650ae4bb9cce7849effa3e6c0a0c152410d7d89 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 1 Jul 2023 12:14:07 +0200 Subject: [PATCH 0339/1171] rpcd: update to latest git HEAD c07ab2f iwinfo: update byte counter to 64bit Signed-off-by: Hauke Mehrtens (cherry picked from commit 2486841c1bc7c3267e409b510e142e04cc5f0a5b) --- package/system/rpcd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index b0e351b25dce6e..977932f9d1cf22 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_MIRROR_HASH:=9c29ee1b4379f835420986fdef3d9510cdd5fc1fd5f4662ecc185913a1f0ec17 -PKG_SOURCE_DATE:=2023-06-25 -PKG_SOURCE_VERSION:=31c390727b83c9efd768c7aa258813e6084b46a3 +PKG_MIRROR_HASH:=76467ff072b50190f93d071b7792ade7c717674397a2547e995a8f819a48954e +PKG_SOURCE_DATE:=2023-07-01 +PKG_SOURCE_VERSION:=c07ab2f91061ad64209e9aaa1fb1b77061a1af25 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 4a3c66a401e8175da405265251e76d3850521741 Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Fri, 7 Jul 2023 13:29:45 +0200 Subject: [PATCH 0340/1171] e2fsprogs: do not symlink tune2fs to findfs commit c0611b45a998 ("e2fsprogs: symlink e2fsck to fsck.ext{2, 3, 4}, and tune2fs to findfs") introduced a symlink from tune2fs to findfs. This only works when the included private libblkid library is used, but commit 5b1660a5387b ("utils/e2fsprogs: Update to 1.43.6") disabled the usage of this private lib and enabled the shared lib support. Removing this symlink makes it possible to install tune2fs and findfs package. Signed-off-by: Martin Schiller (cherry picked from commit 0b80c5725fd70bfd23701cd49fa9f252f6835506) --- package/utils/e2fsprogs/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index 42c297152941e3..2657077a16be29 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -267,7 +267,6 @@ endef define Package/tune2fs/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tune2fs $(1)/usr/sbin/ - $(LN) tune2fs $(1)/usr/sbin/findfs endef define Package/resize2fs/install From a5b03a34c346880e30f1d1554ae9d345c8dd828c Mon Sep 17 00:00:00 2001 From: Adam Bailey Date: Mon, 3 Jul 2023 20:16:14 -0500 Subject: [PATCH 0341/1171] lua: fix integer overflow in LNUM patch Safely detect integer overflow in try_addint() and try_subint(). Old code relied on undefined behavior, and recent versions of GCC on x86 optimized away the if-statements. This caused integer overflow in Lua code instead of falling back to floating-point numbers. Signed-off-by: Adam Bailey (cherry picked from commit 3a2e7c30d3e6a187ba1df740cdb24c8ad84dfe48) --- .../010-lua-5.1.3-lnum-full-260308.patch | 16 ++++++++-------- .../patches/010-lua-5.1.3-lnum-full-260308.patch | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package/utils/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch b/package/utils/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch index 4530edd18126db..fd398c28d1188c 100644 --- a/package/utils/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch +++ b/package/utils/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch @@ -1600,18 +1600,18 @@ + * (and doing them). + */ +int try_addint( lua_Integer *r, lua_Integer ib, lua_Integer ic ) { -+ lua_Integer v= ib+ic; /* may overflow */ -+ if (ib>0 && ic>0) { if (v < 0) return 0; /*overflow, use floats*/ } -+ else if (ib<0 && ic<0) { if (v >= 0) return 0; } -+ *r= v; ++ /* Signed int overflow is undefined behavior, so catch it without causing it. */ ++ if (ic>0) { if (ib > LUA_INTEGER_MAX - ic) return 0; /*overflow, use floats*/ } ++ else { if (ib < LUA_INTEGER_MIN - ic) return 0; } ++ *r = ib + ic; + return 1; +} + +int try_subint( lua_Integer *r, lua_Integer ib, lua_Integer ic ) { -+ lua_Integer v= ib-ic; /* may overflow */ -+ if (ib>=0 && ic<0) { if (v < 0) return 0; /*overflow, use floats*/ } -+ else if (ib<0 && ic>0) { if (v >= 0) return 0; } -+ *r= v; ++ /* Signed int overflow is undefined behavior, so catch it without causing it. */ ++ if (ic>0) { if (ib < LUA_INTEGER_MIN + ic) return 0; /*overflow, use floats*/ } ++ else { if (ib > LUA_INTEGER_MAX + ic) return 0; } ++ *r = ib - ic; + return 1; +} + diff --git a/package/utils/lua/patches/010-lua-5.1.3-lnum-full-260308.patch b/package/utils/lua/patches/010-lua-5.1.3-lnum-full-260308.patch index ac0722c7073265..58cc894e1c8ee8 100644 --- a/package/utils/lua/patches/010-lua-5.1.3-lnum-full-260308.patch +++ b/package/utils/lua/patches/010-lua-5.1.3-lnum-full-260308.patch @@ -1589,18 +1589,18 @@ + * (and doing them). + */ +int try_addint( lua_Integer *r, lua_Integer ib, lua_Integer ic ) { -+ lua_Integer v= ib+ic; /* may overflow */ -+ if (ib>0 && ic>0) { if (v < 0) return 0; /*overflow, use floats*/ } -+ else if (ib<0 && ic<0) { if (v >= 0) return 0; } -+ *r= v; ++ /* Signed int overflow is undefined behavior, so catch it without causing it. */ ++ if (ic>0) { if (ib > LUA_INTEGER_MAX - ic) return 0; /*overflow, use floats*/ } ++ else { if (ib < LUA_INTEGER_MIN - ic) return 0; } ++ *r = ib + ic; + return 1; +} + +int try_subint( lua_Integer *r, lua_Integer ib, lua_Integer ic ) { -+ lua_Integer v= ib-ic; /* may overflow */ -+ if (ib>=0 && ic<0) { if (v < 0) return 0; /*overflow, use floats*/ } -+ else if (ib<0 && ic>0) { if (v >= 0) return 0; } -+ *r= v; ++ /* Signed int overflow is undefined behavior, so catch it without causing it. */ ++ if (ic>0) { if (ib < LUA_INTEGER_MIN + ic) return 0; /*overflow, use floats*/ } ++ else { if (ib > LUA_INTEGER_MAX + ic) return 0; } ++ *r = ib - ic; + return 1; +} + From e99745659539e28102abd7421d418ec2dd7e3bc2 Mon Sep 17 00:00:00 2001 From: Oskari Rauta Date: Tue, 11 Jul 2023 21:06:30 +0300 Subject: [PATCH 0342/1171] util-linux: enable colrm util as package colrm is already built, package just isn't generated. colrm can be used to remove columns from file/stdin. Use cases vary, personally I needed it because I build openwrt natively - and wolfssl configure script wants either colrm, or cut but busybox's cut isn't accepted. Built: x86_64, latest git Tested: x86_64, latest git Signed-off-by: Oskari Rauta (cherry picked from commit e21b4c9636d5dc07b303aa568cbf31b76f244397) --- package/utils/util-linux/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 704d4f11ec4eaa..90724eb3f62475 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -174,6 +174,17 @@ define Package/cfdisk/description cfdisk is a curses-based program for partitioning any hard disk drive endef +define Package/colrm +$(call Package/util-linux/Default) + TITLE:=colrm removes selected columns from a file + DEPENDS:= +endef + +define Package/colrm/description + colrm removes selected columns from a file. Input is taken from + standard input. Output is sent to standard output. +endef + define Package/dmesg $(call Package/util-linux/Default) TITLE:=print or control the kernel ring buffer @@ -699,6 +710,11 @@ define Package/cfdisk/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/cfdisk $(1)/usr/sbin/ endef +define Package/colrm/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/colrm $(1)/usr/bin/ +endef + define Package/dmesg/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dmesg $(1)/usr/bin/ @@ -898,6 +914,7 @@ $(eval $(call BuildPackage,blkid)) $(eval $(call BuildPackage,blockdev)) $(eval $(call BuildPackage,cal)) $(eval $(call BuildPackage,cfdisk)) +$(eval $(call BuildPackage,colrm)) $(eval $(call BuildPackage,dmesg)) $(eval $(call BuildPackage,eject)) $(eval $(call BuildPackage,fdisk)) From 26093cbc888c530481a4ac506608c819a889b32b Mon Sep 17 00:00:00 2001 From: Matthias Van Parys Date: Tue, 11 Jul 2023 10:47:53 +0200 Subject: [PATCH 0343/1171] fortify-headers: add __extension__ mark to strings.h Add the __extension__ mark before #include_next in strings.h to avoid a compiler error when -pedantic is enabled. This has been done for all other headers in the past. Signed-off-by: Matthias Van Parys (cherry picked from commit 2425d6df121082a8643459ac7996334779792a59) --- ...002-strings.h-add-__extension__-mark.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 toolchain/fortify-headers/patches/002-strings.h-add-__extension__-mark.patch diff --git a/toolchain/fortify-headers/patches/002-strings.h-add-__extension__-mark.patch b/toolchain/fortify-headers/patches/002-strings.h-add-__extension__-mark.patch new file mode 100644 index 00000000000000..001e578e60d783 --- /dev/null +++ b/toolchain/fortify-headers/patches/002-strings.h-add-__extension__-mark.patch @@ -0,0 +1,29 @@ +From 9ee4b9bd8df55ebbd5f6426fda4a36e1958b64c5 Mon Sep 17 00:00:00 2001 +From: Matthias Van Parys +Date: Mon, 10 Jul 2023 14:31:05 +0200 +Subject: [PATCH] strings.h: Add __extension__ mark to include_next to silence + -pedantic + +Add __extension__ before #include-next in strings.h as was done for all other header files in commits +7fd984fcb532be01f68cddc194c09a7ca10c1ea6 and a9ffac8596b094da8563aa5dd5d81c946670afe +--- + include/strings.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/include/strings.h b/include/strings.h +index a16e1ad..d1902db 100644 +--- a/include/strings.h ++++ b/include/strings.h +@@ -16,6 +16,9 @@ + #ifndef _FORTIFY_STRINGS_H + #define _FORTIFY_STRINGS_H + ++#ifndef __cplusplus ++__extension__ ++#endif + #include_next + + #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +-- +2.34.1 + From 1a33e4b9520153de44ca3dfb9b1e9819f18cac65 Mon Sep 17 00:00:00 2001 From: Javier Marcet Date: Sun, 9 Jul 2023 17:55:48 +0200 Subject: [PATCH 0344/1171] perf: opt-out of lto usage This fixes building with USE_LTO enabled: mold: error: undefined symbol: __memset >>> referenced by >>> ./tmp/ccsgR7G6.ltrans10.ltrans.o mold: error: undefined symbol: memset_orig >>> referenced by >>> ./tmp/ccsgR7G6.ltrans10.ltrans.o mold: error: undefined symbol: perf_regs_load >>> referenced by >>> ./tmp/ccsgR7G6.ltrans15.ltrans.o:(test_dwarf_unwind__thread) mold: error: undefined symbol: memset_erms >>> referenced by >>> ./tmp/ccsgR7G6.ltrans10.ltrans.o mold: error: undefined symbol: memcpy_orig >>> referenced by >>> ./tmp/ccsgR7G6.ltrans10.ltrans.o mold: error: undefined symbol: memcpy_erms >>> referenced by >>> ./tmp/ccsgR7G6.ltrans10.ltrans.o mold: error: undefined symbol: __memcpy >>> referenced by >>> ./tmp/ccsgR7G6.ltrans10.ltrans.o collect2: error: ld returned 1 exit status make[5]: *** [Makefile.perf:670: ../openwrt/linux/tools/perf-target-x86_64_musl/perf] Error 1 make[4]: *** [Makefile.perf:238: sub-make] Error 2 make[3]: *** [Makefile:70: all] Error 2 make[2]: *** [Makefile:84: ./build_dir/target-x86_64_musl/linux-x86_64/linux-5.15.120/tools/perf-target-x86_64_musl/.built] Error 2 make[2]: Leaving directory './package/devel/perf' time: package/devel/perf/compile#55.88#6.78#12.89 ERROR: package/devel/perf failed to build. Signed-off-by: Javier Marcet (cherry picked from commit 5ed185bfbd9719ef3b114fa6faeb343ac87b2490) --- package/devel/perf/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index c0b2046bd60365..f9573c4150feb7 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -10,9 +10,9 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=perf PKG_VERSION:=$(LINUX_VERSION) -PKG_RELEASE:=4 +PKG_RELEASE:=5 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 no-lto PKG_BUILD_PARALLEL:=1 PKG_MAINTAINER:=Felix Fietkau PKG_FLAGS:=nonshared From ac34f6469ecf07cdeb32f65788192262fd8e0100 Mon Sep 17 00:00:00 2001 From: Felix Baumann Date: Tue, 4 Jul 2023 01:35:43 +0200 Subject: [PATCH 0345/1171] ath79: move ubnt-xm 64M RAM boards back to generic return ubnt_rocket-m and ubnt_powerbridge-m back to ath79-generic They have enough RAM-ressources to not be considered as tiny. This reverts the commit f4415f7635164ec07ddc22f56df93555804b5767 partially Signed-off-by: Felix Baumann (cherry picked from commit 9e86a96af5ecea6e73fa463d6cfa4408e2b49d35) --- .../generic/base-files/etc/board.d/01_leds | 4 +++- .../generic/base-files/etc/board.d/02_network | 4 ++++ .../etc/hotplug.d/firmware/10-ath9k-eeprom | 4 ++++ target/linux/ath79/image/generic-ubnt.mk | 18 ++++++++++++++++++ target/linux/ath79/image/tiny-ubnt.mk | 18 ------------------ .../ath79/tiny/base-files/etc/board.d/01_leds | 4 +--- .../tiny/base-files/etc/board.d/02_network | 8 ++------ .../etc/hotplug.d/firmware/10-ath9k-eeprom | 4 +--- 8 files changed, 33 insertions(+), 31 deletions(-) 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 2ee4ed2544d97d..b5cc4abf65e832 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -485,7 +485,9 @@ ubnt,bullet-m-xw|\ ubnt,nanostation-loco-m-xw|\ ubnt,nanostation-m-xw|\ ubnt,powerbeam-m2-xw|\ -ubnt,powerbeam-m5-xw) +ubnt,powerbeam-m5-xw|\ +ubnt,powerbridge-m|\ +ubnt,rocket-m) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "red:link1" "wlan0" "1" "100" ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "orange:link2" "wlan0" "26" "100" 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 4f535f8a648e6c..0d7396a04dca98 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -110,7 +110,9 @@ ath79_setup_interfaces() ubnt,powerbeam-5ac-gen2|\ ubnt,powerbeam-m2-xw|\ ubnt,powerbeam-m5-xw|\ + ubnt,powerbridge-m|\ ubnt,rocket-5ac-lite|\ + ubnt,rocket-m|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ @@ -785,6 +787,8 @@ ath79_setup_macs() wan_mac=$(mtd_get_mac_text mac 0x18) label_mac=$wan_mac ;; + ubnt,powerbridge-m|\ + ubnt,rocket-m|\ ubnt,unifi) label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index c46573ece5448e..f4c2b26d68f8b2 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -109,6 +109,10 @@ case "$FIRMWARE" in tplink,tl-wr842n-v1) caldata_extract "art" 0x1000 0x3e0 ;; + ubnt,powerbridge-m|\ + ubnt,rocket-m) + caldata_extract "art" 0x1000 0x1000 + ;; wd,mynet-n600|\ wd,mynet-n750) caldata_extract "art" 0x5000 0x440 diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 0f70649d031503..fa4daa3aaafd28 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -158,6 +158,15 @@ define Device/ubnt_powerbeam-m5-xw endef TARGET_DEVICES += ubnt_powerbeam-m5-xw +define Device/ubnt_powerbridge-m + $(Device/ubnt-xm) + SOC := ar7241 + DEVICE_MODEL := PowerBridge M + DEVICE_PACKAGES += rssileds + SUPPORTED_DEVICES += bullet-m +endef +TARGET_DEVICES += ubnt_powerbridge-m + define Device/ubnt_rocket-5ac-lite $(Device/ubnt-xc) SOC := qca9558 @@ -167,6 +176,15 @@ define Device/ubnt_rocket-5ac-lite endef TARGET_DEVICES += ubnt_rocket-5ac-lite +define Device/ubnt_rocket-m + $(Device/ubnt-xm) + SOC := ar7241 + DEVICE_MODEL := Rocket M + DEVICE_PACKAGES += rssileds + SUPPORTED_DEVICES += rocket-m +endef +TARGET_DEVICES += ubnt_rocket-m + define Device/ubnt_routerstation_common DEVICE_PACKAGES := -kmod-ath9k -wpad-basic-mbedtls -uboot-envtools kmod-usb-ohci \ kmod-usb2 fconfig diff --git a/target/linux/ath79/image/tiny-ubnt.mk b/target/linux/ath79/image/tiny-ubnt.mk index 07333714418f2a..77940ed875ab74 100644 --- a/target/linux/ath79/image/tiny-ubnt.mk +++ b/target/linux/ath79/image/tiny-ubnt.mk @@ -70,21 +70,3 @@ define Device/ubnt_nanostation-loco-m DEFAULT := n endef TARGET_DEVICES += ubnt_nanostation-loco-m - -define Device/ubnt_powerbridge-m - $(Device/ubnt-xm) - SOC := ar7241 - DEVICE_MODEL := PowerBridge M - DEVICE_PACKAGES += rssileds - SUPPORTED_DEVICES += bullet-m -endef -TARGET_DEVICES += ubnt_powerbridge-m - -define Device/ubnt_rocket-m - $(Device/ubnt-xm) - SOC := ar7241 - DEVICE_MODEL := Rocket M - DEVICE_PACKAGES += rssileds - SUPPORTED_DEVICES += rocket-m -endef -TARGET_DEVICES += ubnt_rocket-m diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/01_leds b/target/linux/ath79/tiny/base-files/etc/board.d/01_leds index 92c4499580fbea..07e48ec49f3800 100644 --- a/target/linux/ath79/tiny/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/tiny/base-files/etc/board.d/01_leds @@ -116,9 +116,7 @@ ubnt,bullet-m-ar7241|\ ubnt,nanobridge-m|\ ubnt,nanostation-loco-m|\ ubnt,nanostation-m|\ -ubnt,picostation-m|\ -ubnt,powerbridge-m|\ -ubnt,rocket-m) +ubnt,picostation-m) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "red:link1" "wlan0" "1" "100" ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "orange:link2" "wlan0" "26" "100" diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/02_network b/target/linux/ath79/tiny/base-files/etc/board.d/02_network index 4f6e2918a45c33..836d119867fb98 100644 --- a/target/linux/ath79/tiny/base-files/etc/board.d/02_network +++ b/target/linux/ath79/tiny/base-files/etc/board.d/02_network @@ -54,9 +54,7 @@ ath79_setup_interfaces() ubnt,bullet-m-ar7241|\ ubnt,nanobridge-m|\ ubnt,picostation-m|\ - ubnt,nanostation-loco-m|\ - ubnt,powerbridge-m|\ - ubnt,rocket-m) + ubnt,nanostation-loco-m) ucidef_set_interface_lan "eth0" ;; engenius,enh202-v1) @@ -135,9 +133,7 @@ ath79_setup_macs() ubnt,nanobridge-m|\ ubnt,nanostation-loco-m|\ ubnt,nanostation-m|\ - ubnt,picostation-m|\ - ubnt,powerbridge-m|\ - ubnt,rocket-m) + ubnt,picostation-m) label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; tplink,tl-wr941-v2|\ diff --git a/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 792c503ab7dd81..d424b9fe2ca80c 100644 --- a/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -43,9 +43,7 @@ case "$FIRMWARE" in ubnt,nanobridge-m|\ ubnt,nanostation-loco-m|\ ubnt,nanostation-m|\ - ubnt,picostation-m|\ - ubnt,powerbridge-m|\ - ubnt,rocket-m) + ubnt,picostation-m) caldata_extract "art" 0x1000 0x1000 ;; pqi,air-pen) From 40f9514e8068fbc149a9616b66ff7b996a718a68 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 23 Jul 2023 22:23:40 +0200 Subject: [PATCH 0346/1171] kernel: Autoload nvme at preinit time This way is possible to mount nvme extroots. Signed-off-by: Luca Barbato (cherry picked from commit 0fe9a8ca94830270820f7a1eb457f5d5d587125d) --- package/kernel/linux/modules/block.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index bdf84e8ae29b23..4ee3f78f3809a2 100644 --- a/package/kernel/linux/modules/block.mk +++ b/package/kernel/linux/modules/block.mk @@ -505,7 +505,7 @@ define KernelPackage/nvme FILES:= \ $(LINUX_DIR)/drivers/nvme/host/nvme-core.ko \ $(LINUX_DIR)/drivers/nvme/host/nvme.ko - AUTOLOAD:=$(call AutoLoad,30,nvme-core nvme) + AUTOLOAD:=$(call AutoLoad,30,nvme-core nvme,1) endef define KernelPackage/nvme/description From 320cfa7b5e3c951332afcf38015999ee980dce73 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Thu, 27 Jul 2023 10:51:33 -0500 Subject: [PATCH 0347/1171] kernel: netsupport: Add kmod-sched-skbprio Add support for the SKBPRIO queuing discipline. This is subtly different than prio as it also drops packets from the lower priority flows. Signed-off-by: Alexandru Gagniuc (cherry picked from commit 8fba9afda5f514afa48a216514b3f0b0fb22afac) --- package/kernel/linux/modules/netsupport.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 1d5950d237e9d8..97556e459db899 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -971,6 +971,18 @@ endef $(eval $(call KernelPackage,sched-red)) +define KernelPackage/sched-skbprio + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=SKB priority queue scheduler (SKBPRIO) + DEPENDS:=+kmod-sched-core + KCONFIG:= CONFIG_NET_SCH_SKBPRIO + FILES:= $(LINUX_DIR)/net/sched/sch_skbprio.ko + AUTOLOAD:=$(call AutoProbe,sch_skbprio) +endef + +$(eval $(call KernelPackage,sched-skbprio)) + + define KernelPackage/bpf-test SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Test Berkeley Packet Filter functionality From 57bf52c6e2eb27c491a9b645f426fc1e4d697b7d Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Fri, 7 Jul 2023 21:13:35 +0200 Subject: [PATCH 0348/1171] mvebu: mcbin-singleshot: enable hearbeat LED by default This has been a part of modified upstream patch but got lost on major kernel bump to 5.15, so bring it back. Signed-off-by: Tomasz Maciej Nowak [Add patch for kernel 6.1 too] Signed-off-by: Hauke Mehrtens (cherry picked from commit 5e6bab661a1028d583338c5823f6a3b9d6444ce0) --- ...vell-enable-heartbeat-LED-by-default.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch diff --git a/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch b/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch new file mode 100644 index 00000000000000..7221e04de1ddc7 --- /dev/null +++ b/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch @@ -0,0 +1,22 @@ +From: Tomasz Maciej Nowak +Date: Fri, 7 Jul 2023 19:06:05 +0200 +Subject: [PATCH] arm64: dts: marvell: enable heartbeat LED by default + +Some boards could be placed in an enclosure, so enable LED18 by default, +since that'll be the only visible indicator that the board is operating. + +Signed-off-by: Tomasz Maciej Nowak +--- + arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts ++++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts +@@ -25,6 +25,7 @@ + function = LED_FUNCTION_HEARTBEAT; + color = ; + linux,default-trigger = "heartbeat"; ++ default-state = "on"; + }; + }; + }; From 09040592a3486f99d5bdc05ff38574625e2f938e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 10 Aug 2023 20:59:11 +0200 Subject: [PATCH 0349/1171] uci: update to git HEAD 3cda251 file: Fix uci -m import command 5781664 remove internal usage of redundant uci_ptr.last Signed-off-by: Hauke Mehrtens (cherry picked from commit d1427863bae1603eb3b8b385024f7ca11297503d) --- package/system/uci/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 30152607613899..ffbbce577c8701 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE=2023-03-05 -PKG_SOURCE_VERSION:=04d0c46cfe30f557da0c603516636830cab4a08a -PKG_MIRROR_HASH:=5402091db0645d19a60c3ec51850062138af8fb9eda6764091819637d84f1036 +PKG_SOURCE_DATE=2023-08-10 +PKG_SOURCE_VERSION:=5781664d5087ccc4b5ab58505883231212dbedbc +PKG_MIRROR_HASH:=2d60a8543fa00cfc75df6417354b004abf58f672c91bf0a3bffe3ea1dbf84a4b PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= From 58d838d81d1207cafa041c29226633c9e578dc9e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 10 Aug 2023 18:03:43 +0200 Subject: [PATCH 0350/1171] mbedtls: Update to version 2.28.4 This only fixes minor problems. Changelog: https://github.com/Mbed-TLS/mbedtls/releases/tag/v2.28.4 Signed-off-by: Hauke Mehrtens (cherry picked from commit d773fe5411cd4fdd8e107cfe338ed731001a1ade) --- package/libs/mbedtls/Makefile | 4 ++-- .../mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index a6a7ac39e91be3..4c3cb965c55e21 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=2.28.3 +PKG_VERSION:=2.28.4 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=bdf7c5bbdc338da3edad89b2885d4f8668f9a6fffeba6ec17a60333e36dade6f +PKG_HASH:=578c4dcd15bbff3f5cd56aa07cd4f850fc733634e3d5947be4f7157d5bfd81ac PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=gpl-2.0.txt diff --git a/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch b/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch index c9802eac191f4c..02632cdb4ba1d8 100644 --- a/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch +++ b/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch @@ -33,7 +33,7 @@ Signed-off-by: Glenn Strauss #include #else #include -@@ -2995,6 +2999,61 @@ find_parent: +@@ -3001,6 +3005,61 @@ find_parent: } } @@ -95,7 +95,7 @@ Signed-off-by: Glenn Strauss /* * Check for CN match */ -@@ -3015,24 +3074,51 @@ static int x509_crt_check_cn(const mbedt +@@ -3021,24 +3080,51 @@ static int x509_crt_check_cn(const mbedt return -1; } @@ -158,7 +158,7 @@ Signed-off-by: Glenn Strauss } /* -@@ -3043,31 +3129,23 @@ static void x509_crt_verify_name(const m +@@ -3049,31 +3135,23 @@ static void x509_crt_verify_name(const m uint32_t *flags) { const mbedtls_x509_name *name; From fa3a56a57bc17ab1279e0fb6b70242db561db2cd Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 10 Aug 2023 17:50:38 +0200 Subject: [PATCH 0351/1171] linux-firmware: update to 20230804 7be2766 (tag: 20230804) Merge branch 'rb3-update' of https://github.com/lumag/linux-firmware 66c1db8 Merge https://github.com/pkshih/linux-firmware 5046942 Mellanox: Add new mlxsw_spectrum firmware xx.2012.1012 5c7b67f linux-firmware: Add URL for latest FW binaries for NXP BT chipsets 29f185d rtw89: 8851b: update firmware to v0.29.41.1 742bf57 qcom: sdm845: add RB3 sensors DSP firmware 253cc17 amdgpu: Update DMCUB for DCN314 & Yellow Carp 07f05b0 Merge branch 'dmc-adlp_2.20-mtl_2.13' of git://anongit.freedesktop.org/drm/drm-firmware 5a251ed Merge branch 'for-upstream' of https://github.com/CirrusLogic/linux-firmware 6c8ce49 ice: add LAG-supporting DDP package fd6e13c i915: Update MTL DMC to v2.13 41e615c i915: Update ADLP DMC to v2.20 c8424cf cirrus: Add CS35L41 firmware for Dell Oasis Models b6ea35f copy-firmware: Fix linking directories when using compression 0a51959 copy-firmware: Fix test: unexpected operator b602d43 qcom: sc8280xp: LENOVO: remove directory sym link e0bad5e qcom: sc8280xp: LENOVO: Remove execute bits 59fbffa amdgpu: update VCN 4.0.0 firmware 22fb12f amdgpu: add initial SMU 13.0.10 firmware b3f512f amdgpu: add initial SDMA 6.0.3 firmware b1a7d76 amdgpu: add initial PSP 13.0.10 firmware d6d655a amdgpu: add initial GC 11.0.3 firmware c782458 Merge branch 'v2.0.21961' of https://github.com/yunfei-mtk/linux_fw_10bit ca9086f Merge branch 'dg2_mtl_guc_70.8' of git://anongit.freedesktop.org/drm/drm-firmware 0bc3126 linux-firmware: Update AMD fam17h cpu microcode b250b32 linux-firmware: Update AMD cpu microcode 9dfcace amdgpu: update green sardine VCN firmware b519832 amdgpu: update renoir VCN firmware 5f569aa amdgpu: update raven VCN firmware 868bb36 amdgpu: update raven2 VCN firmware 6fa9a17 amdgpu: update Picasso VCN firmware cd52460 amdgpu: update DMCUB to v0.0.175.0 for various AMDGPU ASICs 4ef7581 Updated NXP SR150 UWB firmware 2514504 Merge branch 'for-upstream' of https://github.com/CirrusLogic/linux-firmware 45f5ebf wfx: update to firmware 3.16.1 f41d890 mediatek: Update mt8195 SCP firmware to support 10bit mode 6f3a37f i915: update DG2 GuC to v70.8.0 0ee23bd i915: update to GuC 70.8.0 and HuC 8.5.1 for MTL 1a76e8b cirrus: Add CS35L41 firmware for ASUS ROG 2023 Models d3f6606 Partially revert "amdgpu: DMCUB updates for DCN 3.1.4 and 3.1.5" 8917650 linux-firmware: update firmware for mediatek bluetooth chip (MT7922) 7d9af09 linux-firmware: update firmware for MT7922 WiFi device 0bab5df Merge tag 'iwlwifi-fw-2023-06-29' of http://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/linux-firmware 3ec3817 linux-firmware: Update firmware file for Intel Bluetooth AX203 7db3ef9 linux-firmware: Update firmware file for Intel Bluetooth AX203 5684048 linux-firmware: Update firmware file for Intel Bluetooth AX211 3f7a24e linux-firmware: Update firmware file for Intel Bluetooth AX211 eb2c745 linux-firmware: Update firmware file for Intel Bluetooth AX210 4a3ff0a linux-firmware: Update firmware file for Intel Bluetooth AX200 1d1bad4 linux-firmware: Update firmware file for Intel Bluetooth AX201 db39dff Fix qcom ASoC tglp WHENCE entry a687f89 Merge branch 'sc8280xp-audio-fw' of git://git.kernel.org/pub/scm/linux/kernel/git/srini/linux-firmware 9e0343c check_whence: Check link targets are valid b255f5b iwlwifi: add new FWs from core80-39 release fa5d30b iwlwifi: update cc/Qu/QuZ firmwares for core80-39 release f9a35b3 qcom: Add Audio firmware for SC8280XP X13s Signed-off-by: Hauke Mehrtens (cherry picked from commit bfbb5ccf7a55ed2cc574405f7f83da5e48811401) --- package/firmware/linux-firmware/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index 680f8fb104c815..ef6cd075de4548 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware -PKG_VERSION:=20230625 +PKG_VERSION:=20230804 PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=87597111c0d4b71b31e53cb85a92c386921b84c825a402db8c82e0e86015500d +PKG_HASH:=88d46c543847ee3b03404d4941d91c92974690ee1f6fdcbee9cef3e5f97db688 PKG_MAINTAINER:=Felix Fietkau From 9d10944de77085d324e411af5439f1397bd1163d Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 11 Aug 2023 11:38:29 +0200 Subject: [PATCH 0352/1171] firmware: intel-microcode: update to 20230808 Debian changelog: intel-microcode (3.20230808.1) unstable; urgency=high * New upstream microcode datafile 20230808 (closes: #1043305) Mitigations for "Downfall" INTEL-SA-00828 (CVE-2022-40982), INTEL-SA-00836 (CVE-2023-23908) and INTEL-SA-00837 (CVE-2022-41804) * Updated microcodes: sig 0x00050653, pf_mask 0x97, 2023-03-23, rev 0x1000181, size 36864 sig 0x00050654, pf_mask 0xb7, 2023-03-06, rev 0x2007006, size 44032 sig 0x00050656, pf_mask 0xbf, 2023-03-17, rev 0x4003604, size 38912 sig 0x00050657, pf_mask 0xbf, 2023-03-17, rev 0x5003604, size 38912 sig 0x0005065b, pf_mask 0xbf, 2023-03-21, rev 0x7002703, size 30720 sig 0x000606a6, pf_mask 0x87, 2023-03-30, rev 0xd0003a5, size 297984 sig 0x000706e5, pf_mask 0x80, 2023-02-26, rev 0x00bc, size 113664 sig 0x000806c1, pf_mask 0x80, 2023-02-27, rev 0x00ac, size 111616 sig 0x000806c2, pf_mask 0xc2, 2023-02-27, rev 0x002c, size 98304 sig 0x000806d1, pf_mask 0xc2, 2023-02-27, rev 0x0046, size 103424 sig 0x000806e9, pf_mask 0xc0, 2023-02-22, rev 0x00f4, size 106496 sig 0x000806e9, pf_mask 0x10, 2023-02-23, rev 0x00f4, size 105472 sig 0x000806ea, pf_mask 0xc0, 2023-02-23, rev 0x00f4, size 105472 sig 0x000806eb, pf_mask 0xd0, 2023-02-23, rev 0x00f4, size 106496 sig 0x000806ec, pf_mask 0x94, 2023-02-26, rev 0x00f8, size 106496 sig 0x000806f8, pf_mask 0x87, 2023-05-09, rev 0x2b0004b1, size 572416 sig 0x000806f7, pf_mask 0x87, 2023-05-09, rev 0x2b0004b1 sig 0x000806f6, pf_mask 0x87, 2023-05-09, rev 0x2b0004b1 sig 0x000806f5, pf_mask 0x87, 2023-05-09, rev 0x2b0004b1 sig 0x000806f4, pf_mask 0x87, 2023-05-09, rev 0x2b0004b1 sig 0x000806f8, pf_mask 0x10, 2023-05-15, rev 0x2c000271, size 605184 sig 0x000806f6, pf_mask 0x10, 2023-05-15, rev 0x2c000271 sig 0x000806f5, pf_mask 0x10, 2023-05-15, rev 0x2c000271 sig 0x000806f4, pf_mask 0x10, 2023-05-15, rev 0x2c000271 sig 0x00090672, pf_mask 0x07, 2023-04-18, rev 0x002e, size 220160 sig 0x00090675, pf_mask 0x07, 2023-04-18, rev 0x002e sig 0x000b06f2, pf_mask 0x07, 2023-04-18, rev 0x002e sig 0x000b06f5, pf_mask 0x07, 2023-04-18, rev 0x002e sig 0x000906a3, pf_mask 0x80, 2023-04-18, rev 0x042c, size 219136 sig 0x000906a4, pf_mask 0x80, 2023-04-18, rev 0x042c sig 0x000906e9, pf_mask 0x2a, 2023-02-23, rev 0x00f4, size 108544 sig 0x000906ea, pf_mask 0x22, 2023-02-23, rev 0x00f4, size 104448 sig 0x000906eb, pf_mask 0x02, 2023-02-23, rev 0x00f4, size 106496 sig 0x000906ec, pf_mask 0x22, 2023-02-23, rev 0x00f4, size 105472 sig 0x000906ed, pf_mask 0x22, 2023-02-27, rev 0x00fa, size 106496 sig 0x000a0652, pf_mask 0x20, 2023-02-23, rev 0x00f8, size 97280 sig 0x000a0653, pf_mask 0x22, 2023-02-23, rev 0x00f8, size 97280 sig 0x000a0655, pf_mask 0x22, 2023-02-23, rev 0x00f8, size 97280 sig 0x000a0660, pf_mask 0x80, 2023-02-23, rev 0x00f8, size 97280 sig 0x000a0661, pf_mask 0x80, 2023-02-23, rev 0x00f8, size 96256 sig 0x000a0671, pf_mask 0x02, 2023-02-26, rev 0x0059, size 104448 sig 0x000b0671, pf_mask 0x32, 2023-06-06, rev 0x0119, size 210944 sig 0x000b06a2, pf_mask 0xe0, 2023-06-06, rev 0x4119, size 216064 sig 0x000b06a3, pf_mask 0xe0, 2023-06-06, rev 0x4119 sig 0x000b06e0, pf_mask 0x11, 2023-04-12, rev 0x0011, size 136192 * source: update symlinks to reflect id of the latest release, 20230808 intel-microcode (3.20230512.1) unstable; urgency=medium Signed-off-by: Hauke Mehrtens (cherry picked from commit ced285487144e1138e3d2b986b3e070a9b4fd412) --- package/firmware/intel-microcode/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index 4c234ddc846574..5102bf81eae8fc 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=intel-microcode -PKG_VERSION:=20230512 +PKG_VERSION:=20230808 PKG_RELEASE:=1 PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/non-free-firmware/i/intel-microcode/ -PKG_HASH:=e6717a42d7b6e92280565fbb180cd0d11bc5d14874ef06ff1bed2b7a11d17c67 +PKG_HASH:=29e77c275b3f60a691832c0844f70effbd94a4594d04af21e0c2e6e0c1ac1894 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 PKG_BUILD_DEPENDS:=iucode-tool/host From f241408f1843915500fd14e4bfaa7c08a5ff1039 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 31 Jul 2023 12:41:13 +0200 Subject: [PATCH 0353/1171] arm-trusted-firmware-tools: fix build on macOS/Darwin Resolve conflicts with the uuid type from darwin system headers Signed-off-by: Felix Fietkau (cherry picked from commit 16c37ba9136ff431c7e3c97cc27e4ea166b8020a) --- .../patches/002-darwin_compile.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 package/boot/arm-trusted-firmware-tools/patches/002-darwin_compile.patch diff --git a/package/boot/arm-trusted-firmware-tools/patches/002-darwin_compile.patch b/package/boot/arm-trusted-firmware-tools/patches/002-darwin_compile.patch new file mode 100644 index 00000000000000..6bc8192f442590 --- /dev/null +++ b/package/boot/arm-trusted-firmware-tools/patches/002-darwin_compile.patch @@ -0,0 +1,21 @@ +--- a/tools/fiptool/fiptool.c ++++ b/tools/fiptool/fiptool.c +@@ -3,7 +3,7 @@ + * + * SPDX-License-Identifier: BSD-3-Clause + */ +- ++#define _DARWIN_C_SOURCE + #ifndef _MSC_VER + #include + #endif +@@ -18,6 +18,9 @@ + #include + #include + #include ++#include ++ ++#define uuid_t fiptool_uuid_t + + #include "fiptool.h" + #include "tbbr_config.h" From 452e4f064f139066ffc00732d7a01859a559a26c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 4 Aug 2023 14:07:43 +0100 Subject: [PATCH 0354/1171] mediatek: filogic: mt7988: mark RTC clock as critical A dependency of the MT7988 MMC host controller on the SoC's RTC clock being running has been discovered. Mark RTC clock as critical to fix MMC host on MT7988. Signed-off-by: Daniel Golle (cherry picked from commit 0454691960e16bb93ed01f89352cbb375008aaf5) --- .../drivers/clk/mediatek/clk-mt7988-infracfg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c index 77e25383b6e3c1..bce8d563756794 100644 --- a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c @@ -190,6 +190,13 @@ static const struct mtk_gate_regs infra3_cg_regs = { #define GATE_INFRA3(_id, _name, _parent, _shift) \ GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_CRITICAL(_id, _name, _parent, _regs, _shift) { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = _regs, .shift = _shift, \ + .flags = CLK_IS_CRITICAL, \ + .ops = &mtk_clk_gate_ops_setclr, \ + } + static const struct mtk_gate infra_clks[] = { /* INFRA0 */ GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P0, @@ -271,7 +278,7 @@ static const struct mtk_gate infra_clks[] = { "sysaxi_sel", 17), GATE_INFRA2(CLK_INFRA_66M_FLASHIF_AXI, "infra_hf_66m_flashif_axi", "sysaxi_sel", 18), - GATE_INFRA2(CLK_INFRA_RTC, "infra_f_frtc", "top_rtc_32k", 19), + GATE_CRITICAL(CLK_INFRA_RTC, "infra_f_frtc", "top_rtc_32k", &infra2_cg_regs, 19), GATE_INFRA2(CLK_INFRA_26M_ADC_BCK, "infra_f_26m_adc_bck", "csw_infra_f26m_sel", 20), GATE_INFRA2(CLK_INFRA_RC_ADC, "infra_f_frc_adc", "infra_f_26m_adc_bck", From dd00bcb43ec5097ac354bc5eebeb72634164b1db Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 9 Aug 2023 12:21:41 +0100 Subject: [PATCH 0355/1171] uboot-mediatek: bpi-r3: prepare for larger FIT structures Instead of reading only a single 4kiB page, read the first 128kiB to determine the size of an uImage.FIT using 'imsz' or 'imszb'. This will be needed once we add more Device Tree Overlays, which may happen for the BPi-R3 mini. Signed-off-by: Daniel Golle (cherry picked from commit 3c2f7bb555c2cd5c4be8aed11b9d31b48cc0bcf8) --- package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch index 98010a330477bc..146a93f4f3763b 100644 --- a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch +++ b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch @@ -840,7 +840,7 @@ +boot_tftp_recovery=run boot_update_conf ; tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi +boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size -+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 ++mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 +part_default=production +part_recovery=recovery +reset_factory=eraseenv && reset @@ -931,8 +931,8 @@ +boot_write_fip=mtd erase fip && mtd write fip $loadaddr +boot_write_preloader=mtd erase bl2 && mtd write bl2 $loadaddr +reset_factory=mtd erase u-boot-env -+nor_read_production=mtd read fit $loadaddr 0x0 0x1000 && imsz $loadaddr image_size && mtd read fit $loadaddr 0x0 $image_size -+nor_read_recovery=mtd read recovery $loadaddr 0x0 0x1000 && imsz $loadaddr image_size && mtd read recovery $loadaddr 0x0 $image_size ++nor_read_production=mtd read fit $loadaddr 0x0 0x20000 && imsz $loadaddr image_size && mtd read fit $loadaddr 0x0 $image_size ++nor_read_recovery=mtd read recovery $loadaddr 0x0 0x20000 && imsz $loadaddr image_size && mtd read recovery $loadaddr 0x0 $image_size +nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x10000 ; setexpr tmp1 0x$image_size % 0x10000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb $image_eb * 0x10000 +nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase fit && mtd write fit $loadaddr 0x0 $image_eb +nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0x900000 && mtd erase recovery 0x0 0x$image_eb && mtd write recovery $loadaddr 0x0 $image_eb @@ -1067,7 +1067,7 @@ +boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf +boot_update_conf=if nand info ; then setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nand ; else setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nor ; fi +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size -+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 ++mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 +part_default=production +part_recovery=recovery +reset_factory=eraseenv && reset From 79d669d1b7282e2647225936fd5697bba58b55f6 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 11 Aug 2023 14:16:08 +0100 Subject: [PATCH 0356/1171] armsr: remove redundant phy-marvell-10g module the Marvell 10G PHY driver is no way specific to ARM SystemReady systems, it frequently occurs on SFP+ copper modules and is useful on many targets. Hence it been added to package/kernel/linux/modules/netdevices and we can remove the now redundant target-specific module. Signed-off-by: Daniel Golle (cherry picked from commit c524a76f4c09a4e3fa4572612d336b4ef7ff2fb8) --- target/linux/armsr/modules.mk | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk index 86acc8c4c796ce..8b026093ee66f9 100644 --- a/target/linux/armsr/modules.mk +++ b/target/linux/armsr/modules.mk @@ -151,17 +151,6 @@ endef $(eval $(call KernelPackage,marvell-mdio)) -define KernelPackage/phy-marvell-10g - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell Alaska 10G PHY driver - DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy - KCONFIG:=CONFIG_MARVELL_10G_PHY - FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko - AUTOLOAD=$(call AutoLoad,35,marvell10g) -endef - -$(eval $(call KernelPackage,phy-marvell-10g)) - define KernelPackage/mvneta SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell Armada 370/38x/XP/37xx network driver From 0ecf7a37918a881b2a9d3ac16e6e9a558117d60b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 13 Aug 2023 14:57:10 +0100 Subject: [PATCH 0357/1171] generic: 5.15: rename patches to match correct version Rename two patches which were only accepted in Linux 6.2, but were marked as if they were accepted in Linux 6.1. Signed-off-by: Daniel Golle (cherry picked from commit 42e14d3ed870e56c29bff84ce686839d9bab2034) --- ...tch => 890-v6.2-mtd-spinand-winbond-fix-flash-detection.patch} | 0 ...02KV.patch => 891-v6.2-mtd-spinand-winbond-add-W25N02KV.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/generic/backport-5.15/{890-v6.1-mtd-spinand-winbond-fix-flash-detection.patch => 890-v6.2-mtd-spinand-winbond-fix-flash-detection.patch} (100%) rename target/linux/generic/backport-5.15/{891-v6.1-mtd-spinand-winbond-add-W25N02KV.patch => 891-v6.2-mtd-spinand-winbond-add-W25N02KV.patch} (100%) diff --git a/target/linux/generic/backport-5.15/890-v6.1-mtd-spinand-winbond-fix-flash-detection.patch b/target/linux/generic/backport-5.15/890-v6.2-mtd-spinand-winbond-fix-flash-detection.patch similarity index 100% rename from target/linux/generic/backport-5.15/890-v6.1-mtd-spinand-winbond-fix-flash-detection.patch rename to target/linux/generic/backport-5.15/890-v6.2-mtd-spinand-winbond-fix-flash-detection.patch diff --git a/target/linux/generic/backport-5.15/891-v6.1-mtd-spinand-winbond-add-W25N02KV.patch b/target/linux/generic/backport-5.15/891-v6.2-mtd-spinand-winbond-add-W25N02KV.patch similarity index 100% rename from target/linux/generic/backport-5.15/891-v6.1-mtd-spinand-winbond-add-W25N02KV.patch rename to target/linux/generic/backport-5.15/891-v6.2-mtd-spinand-winbond-add-W25N02KV.patch From b59d02becc8714fa629cbccb3933db15d9ee110b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 13 Aug 2023 14:52:44 +0100 Subject: [PATCH 0358/1171] generic: backport fix for Winbond SPI NAND Avoid using stack allocated memory for DMA operations. Fixes: 156c00dedc ("generic: backport Winbond W25N02KV SPI-NAND support") Signed-off-by: Daniel Golle (cherry picked from commit e6f8b699189139f09c3685332310ff870610de5e) --- ...d-spinand-winbond-Fix-ecc_get_status.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 target/linux/generic/backport-5.15/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch diff --git a/target/linux/generic/backport-5.15/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch b/target/linux/generic/backport-5.15/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch new file mode 100644 index 00000000000000..2f408f5a30090d --- /dev/null +++ b/target/linux/generic/backport-5.15/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch @@ -0,0 +1,49 @@ +From f5a05060670a4d8d6523afc7963eb559c2e3615f Mon Sep 17 00:00:00 2001 +From: Olivier Maignial +Date: Fri, 23 Jun 2023 17:33:37 +0200 +Subject: [PATCH] mtd: spinand: winbond: Fix ecc_get_status + +Reading ECC status is failing. + +w25n02kv_ecc_get_status() is using on-stack buffer for +SPINAND_GET_FEATURE_OP() output. It is not suitable for +DMA needs of spi-mem. + +Fix this by using the spi-mem operations dedicated buffer +spinand->scratchbuf. + +See +spinand->scratchbuf: +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mtd/spinand.h?h=v6.3#n418 +spi_mem_check_op(): +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-mem.c?h=v6.3#n199 + +Fixes: 6154c7a58348 ("mtd: spinand: winbond: add Winbond W25N02KV flash support") +Cc: stable@vger.kernel.org +Signed-off-by: Olivier Maignial +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/DB4P250MB1032EDB9E36B764A33769039FE23A@DB4P250MB1032.EURP250.PROD.OUTLOOK.COM +--- + drivers/mtd/nand/spi/winbond.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -108,7 +108,7 @@ static int w25n02kv_ecc_get_status(struc + { + struct nand_device *nand = spinand_to_nand(spinand); + u8 mbf = 0; +- struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, &mbf); ++ struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf); + + switch (status & STATUS_ECC_MASK) { + case STATUS_ECC_NO_BITFLIPS: +@@ -126,7 +126,7 @@ static int w25n02kv_ecc_get_status(struc + if (spi_mem_exec_op(spinand->spimem, &op)) + return nanddev_get_ecc_conf(nand)->strength; + +- mbf >>= 4; ++ mbf = *(spinand->scratchbuf) >> 4; + + if (WARN_ON(mbf > nanddev_get_ecc_conf(nand)->strength || !mbf)) + return nanddev_get_ecc_conf(nand)->strength; From 482c57afea5d4a6917394d3d55cde07f8bf45203 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 14 Jul 2023 10:01:30 +0200 Subject: [PATCH 0359/1171] hostapd: add fix for dealing with VHT 160 MHz via ext nss bw Signed-off-by: Felix Fietkau (cherry picked from commit adfeda849198b33ffa7a7ef233ae8a4df22bbc2d) --- ...tapd-update-cfs0-and-cfs1-for-160MHz.patch | 141 ++++++++++++++++++ .../services/hostapd/patches/300-noscan.patch | 6 +- ...tapd-config-support-random-BSS-color.patch | 2 +- .../hostapd/patches/700-wifi-reload.patch | 4 +- .../hostapd/patches/710-vlan_no_bridge.patch | 2 +- .../patches/711-wds_bridge_force.patch | 2 +- .../patches/720-iface_max_num_sta.patch | 2 +- .../hostapd/patches/730-ft_iface.patch | 2 +- .../hostapd/patches/740-snoop_iface.patch | 2 +- ...750-qos_map_set_without_interworking.patch | 6 +- .../hostapd/patches/760-dynamic_own_ip.patch | 2 +- 11 files changed, 156 insertions(+), 15 deletions(-) create mode 100644 package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch diff --git a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch new file mode 100644 index 00000000000000..710a3c851e119e --- /dev/null +++ b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch @@ -0,0 +1,141 @@ +From d4c4ef302f98fd6bce173b8636e7e350d8b44981 Mon Sep 17 00:00:00 2001 +From: P Praneesh +Date: Fri, 19 Mar 2021 12:17:27 +0530 +Subject: [PATCH] hostapd: update cfs0 and cfs1 for 160MHz + +As per standard Draft P802.11ax_D8.0,( Table 26-9—Setting +of the VHT Channel Width and VHT NSS at an HE STA +transmitting the OM Control subfield ), center frequency of +160MHz should be published in HT information subset 2 of +HT information when EXT NSS BW field is enabled. + +If the supported number of NSS in 160MHz is at least max NSS +support, then center_freq_seg0 indicates the center frequency of 80MHz and +center_freq_seg1 indicates the center frequency of 160MHz. + +If the supported number of NSS in 160MHz is less than max NSS +support, then center_freq_seg0 indicates the center frequency of 80MHz and +center_freq_seg1 is 0. The center frequency of 160MHz is published in HT +operation information element instead. + +Signed-off-by: P Praneesh +--- + hostapd/config_file.c | 2 ++ + src/ap/ieee802_11_ht.c | 7 +++++++ + src/ap/ieee802_11_vht.c | 16 ++++++++++++++++ + src/common/hw_features_common.c | 1 + + src/common/ieee802_11_defs.h | 1 + + 5 files changed, 27 insertions(+) + +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -1153,6 +1153,8 @@ static int hostapd_config_vht_capab(stru + conf->vht_capab |= VHT_CAP_RX_ANTENNA_PATTERN; + if (os_strstr(capab, "[TX-ANTENNA-PATTERN]")) + conf->vht_capab |= VHT_CAP_TX_ANTENNA_PATTERN; ++ if (os_strstr(capab, "[EXT-NSS-BW-SUPP]")) ++ conf->vht_capab |= VHT_CAP_EXTENDED_NSS_BW_SUPPORT; + return 0; + } + #endif /* CONFIG_IEEE80211AC */ +--- a/src/ap/ieee802_11_ht.c ++++ b/src/ap/ieee802_11_ht.c +@@ -82,7 +82,9 @@ u8 * hostapd_eid_ht_capabilities(struct + u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) + { + struct ieee80211_ht_operation *oper; ++ le32 vht_capabilities_info; + u8 *pos = eid; ++ u8 chwidth; + + if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n || + is_6ghz_op_class(hapd->iconf->op_class)) +@@ -103,6 +105,13 @@ u8 * hostapd_eid_ht_operation(struct hos + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; + ++ vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); ++ chwidth = hostapd_get_oper_chwidth(hapd->iconf); ++ if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT ++ && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) { ++ oper->operation_mode = host_to_le16(hapd->iconf->vht_oper_centr_freq_seg0_idx << 5); ++ } ++ + pos += sizeof(*oper); + + return pos; +--- a/src/ap/ieee802_11_vht.c ++++ b/src/ap/ieee802_11_vht.c +@@ -25,6 +25,7 @@ u8 * hostapd_eid_vht_capabilities(struct + struct ieee80211_vht_capabilities *cap; + struct hostapd_hw_modes *mode = hapd->iface->current_mode; + u8 *pos = eid; ++ u8 chwidth; + + if (!mode || is_6ghz_op_class(hapd->iconf->op_class)) + return eid; +@@ -62,6 +63,17 @@ u8 * hostapd_eid_vht_capabilities(struct + host_to_le32(nsts << VHT_CAP_BEAMFORMEE_STS_OFFSET); + } + ++ chwidth = hostapd_get_oper_chwidth(hapd->iconf); ++ if (((host_to_le32(mode->vht_capab)) & VHT_CAP_EXTENDED_NSS_BW_SUPPORT) ++ && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) { ++ cap->vht_capabilities_info |= VHT_CAP_EXTENDED_NSS_BW_SUPPORT; ++ cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)); ++ cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)); ++ cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_MASK)); ++ } else { ++ cap->vht_capabilities_info &= ~VHT_CAP_EXTENDED_NSS_BW_SUPPORT_MASK; ++ } ++ + /* Supported MCS set comes from hw */ + os_memcpy(&cap->vht_supported_mcs_set, mode->vht_mcs_set, 8); + +@@ -74,6 +86,7 @@ u8 * hostapd_eid_vht_capabilities(struct + u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid) + { + struct ieee80211_vht_operation *oper; ++ le32 vht_capabilities_info; + u8 *pos = eid; + enum oper_chan_width oper_chwidth = + hostapd_get_oper_chwidth(hapd->iconf); +@@ -106,6 +119,7 @@ u8 * hostapd_eid_vht_operation(struct ho + oper->vht_op_info_chan_center_freq_seg1_idx = seg1; + + oper->vht_op_info_chwidth = oper_chwidth; ++ vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); + if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ) { + /* + * Convert 160 MHz channel width to new style as interop +@@ -119,6 +133,9 @@ u8 * hostapd_eid_vht_operation(struct ho + oper->vht_op_info_chan_center_freq_seg0_idx -= 8; + else + oper->vht_op_info_chan_center_freq_seg0_idx += 8; ++ ++ if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT) ++ oper->vht_op_info_chan_center_freq_seg1_idx = 0; + } else if (oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ) { + /* + * Convert 80+80 MHz channel width to new style as interop +--- a/src/common/hw_features_common.c ++++ b/src/common/hw_features_common.c +@@ -808,6 +808,7 @@ int ieee80211ac_cap_check(u32 hw, u32 co + VHT_CAP_CHECK(VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB); + VHT_CAP_CHECK(VHT_CAP_RX_ANTENNA_PATTERN); + VHT_CAP_CHECK(VHT_CAP_TX_ANTENNA_PATTERN); ++ VHT_CAP_CHECK(VHT_CAP_EXTENDED_NSS_BW_SUPPORT); + + #undef VHT_CAP_CHECK + #undef VHT_CAP_CHECK_MAX +--- a/src/common/ieee802_11_defs.h ++++ b/src/common/ieee802_11_defs.h +@@ -1348,6 +1348,8 @@ struct ieee80211_ampe_ie { + #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27)) + #define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28)) + #define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29)) ++#define VHT_CAP_EXTENDED_NSS_BW_SUPPORT ((u32) BIT(30)) ++#define VHT_CAP_EXTENDED_NSS_BW_SUPPORT_MASK ((u32) BIT(30) | BIT(31)) + + #define VHT_OPMODE_CHANNEL_WIDTH_MASK ((u8) BIT(0) | BIT(1)) + #define VHT_OPMODE_CHANNEL_RxNSS_MASK ((u8) BIT(4) | BIT(5) | \ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index c6f9eba9d53863..1ea89043e89605 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3446,6 +3446,10 @@ static int hostapd_config_fill(struct ho +@@ -3448,6 +3448,10 @@ static int hostapd_config_fill(struct ho if (bss->ocv && !bss->ieee80211w) bss->ieee80211w = 1; #endif /* CONFIG_OCV */ @@ -36,7 +36,7 @@ hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -230,6 +230,9 @@ void hostapd_2040_coex_action(struct hos +@@ -239,6 +239,9 @@ void hostapd_2040_coex_action(struct hos return; } @@ -46,7 +46,7 @@ if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) { wpa_printf(MSG_DEBUG, "Ignore too short 20/40 BSS Coexistence Management frame"); -@@ -390,6 +393,9 @@ void ht40_intolerant_add(struct hostapd_ +@@ -399,6 +402,9 @@ void ht40_intolerant_add(struct hostapd_ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; diff --git a/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch b/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch index ada77853feea33..7d3d94648e1930 100644 --- a/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch +++ b/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch @@ -13,7 +13,7 @@ Signed-off-by: David Bauer --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3498,6 +3498,8 @@ static int hostapd_config_fill(struct ho +@@ -3500,6 +3500,8 @@ static int hostapd_config_fill(struct ho } else if (os_strcmp(buf, "he_bss_color") == 0) { conf->he_op.he_bss_color = atoi(pos) & 0x3f; conf->he_op.he_bss_color_disabled = 0; diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index e0da149c443d9e..0c7627645f6983 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2418,6 +2418,8 @@ static int hostapd_config_fill(struct ho +@@ -2420,6 +2420,8 @@ static int hostapd_config_fill(struct ho bss->isolate = atoi(pos); } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { bss->ap_max_inactivity = atoi(pos); @@ -9,7 +9,7 @@ } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { bss->skip_inactivity_poll = atoi(pos); } else if (os_strcmp(buf, "config_id") == 0) { -@@ -3128,6 +3130,8 @@ static int hostapd_config_fill(struct ho +@@ -3130,6 +3132,8 @@ static int hostapd_config_fill(struct ho } } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { conf->acs_exclude_dfs = atoi(pos); diff --git a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch index f625f4bda4b46b..61f33acb6e8e9f 100644 --- a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch +++ b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch @@ -30,7 +30,7 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3353,6 +3353,8 @@ static int hostapd_config_fill(struct ho +@@ -3355,6 +3355,8 @@ static int hostapd_config_fill(struct ho #ifndef CONFIG_NO_VLAN } else if (os_strcmp(buf, "dynamic_vlan") == 0) { bss->ssid.dynamic_vlan = atoi(pos); diff --git a/package/network/services/hostapd/patches/711-wds_bridge_force.patch b/package/network/services/hostapd/patches/711-wds_bridge_force.patch index e04ae625384546..c0f2c31c4482a0 100644 --- a/package/network/services/hostapd/patches/711-wds_bridge_force.patch +++ b/package/network/services/hostapd/patches/711-wds_bridge_force.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2316,6 +2316,8 @@ static int hostapd_config_fill(struct ho +@@ -2318,6 +2318,8 @@ static int hostapd_config_fill(struct ho sizeof(conf->bss[0]->iface)); } else if (os_strcmp(buf, "bridge") == 0) { os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch index bf7e8e7617541d..0bb00f9555476e 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2848,6 +2848,14 @@ static int hostapd_config_fill(struct ho +@@ -2850,6 +2850,14 @@ static int hostapd_config_fill(struct ho line, bss->max_num_sta, MAX_STA_COUNT); return 1; } diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index 0795ed15a1402b..563fe5b5fbbd1b 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3007,6 +3007,8 @@ static int hostapd_config_fill(struct ho +@@ -3009,6 +3009,8 @@ static int hostapd_config_fill(struct ho wpa_printf(MSG_INFO, "Line %d: Obsolete peerkey parameter ignored", line); #ifdef CONFIG_IEEE80211R_AP diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index a116644736530a..6b6cc0fad79934 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -55,7 +55,7 @@ "x_snoop: Failed to initialize L2 packet processing %s", --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2320,6 +2320,8 @@ static int hostapd_config_fill(struct ho +@@ -2322,6 +2322,8 @@ static int hostapd_config_fill(struct ho os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); } else if (os_strcmp(buf, "bridge_hairpin") == 0) { bss->bridge_hairpin = atoi(pos); diff --git a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch index e06e36c37d1988..124f5ea6bae525 100644 --- a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch +++ b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -1602,6 +1602,8 @@ static int parse_anqp_elem(struct hostap +@@ -1604,6 +1604,8 @@ static int parse_anqp_elem(struct hostap return 0; } @@ -9,7 +9,7 @@ static int parse_qos_map_set(struct hostapd_bss_config *bss, char *buf, int line) -@@ -1643,8 +1645,6 @@ static int parse_qos_map_set(struct host +@@ -1645,8 +1647,6 @@ static int parse_qos_map_set(struct host return 0; } @@ -18,7 +18,7 @@ #ifdef CONFIG_HS20 static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf, -@@ -4064,10 +4064,10 @@ static int hostapd_config_fill(struct ho +@@ -4066,10 +4066,10 @@ static int hostapd_config_fill(struct ho bss->gas_frag_limit = val; } else if (os_strcmp(buf, "gas_comeback_delay") == 0) { bss->gas_comeback_delay = atoi(pos); diff --git a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch index 2c705a68cf0acf..946b4533bf241a 100644 --- a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch +++ b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch @@ -98,7 +98,7 @@ hapd->conf->own_ip_addr.af == AF_INET && --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2688,6 +2688,8 @@ static int hostapd_config_fill(struct ho +@@ -2690,6 +2690,8 @@ static int hostapd_config_fill(struct ho } else if (os_strcmp(buf, "iapp_interface") == 0) { wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used"); #endif /* CONFIG_IAPP */ From a23aa1c55ae22d1f015b4ab9e2336aeba6f0c5b3 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 11 Aug 2023 14:48:41 -0400 Subject: [PATCH 0360/1171] kernel: bump 5.15 to 5.15.126 1. Disable unneeded errata Kconfig symbols 2. Update kernel Changelog: https://lore.kernel.org/stable/2023081111-unlocking-synopsis-d7d5@gregkh/ All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 64782497dbdf124d9f7979ae1aa48f20c9b9dec8) --- include/kernel-5.15 | 4 ++-- .../700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- target/linux/generic/config-5.15 | 4 ++++ target/linux/generic/hack-5.15/901-debloat_sock_diag.patch | 2 +- target/linux/generic/hack-5.15/902-debloat_proc.patch | 2 +- .../mediatek/patches-5.15/901-arm-add-cmdline-override.patch | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 43e03fac8d10ed..7687c40aa8cf59 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .125 -LINUX_KERNEL_HASH-5.15.125 = 150f3846b76cd23a6135f49cef71372bade5a06e851cb4f8558df8b862d8fec7 +LINUX_VERSION-5.15 = .126 +LINUX_KERNEL_HASH-5.15.126 = adf4aab9840f89ee151b837defbe16e9f388e8eef20df7ee94bf63be33b3ed6f diff --git a/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index af1c9bcefd595b..ba09c562aebae6 100644 --- a/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1538,10 +1538,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1542,10 +1542,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index e78b4a47d70cf5..b5baa8717e4aab 100644 --- a/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1552,6 +1552,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1556,6 +1556,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 637b845ac4fdfd..5cac839f593c70 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -330,6 +330,10 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 # CONFIG_ARM64_ERRATUM_1530923 is not set # CONFIG_ARM64_ERRATUM_1542419 is not set # CONFIG_ARM64_ERRATUM_1742098 is not set +# CONFIG_ARM64_ERRATUM_2253138 is not set +# CONFIG_ARM64_ERRATUM_2224489 is not set +# CONFIG_ARM64_ERRATUM_2054223 is not set +# CONFIG_ARM64_ERRATUM_2067961 is not set # CONFIG_ARM64_ERRATUM_2441007 is not set # CONFIG_ARM64_ERRATUM_2441009 is not set # CONFIG_ARM64_ERRATUM_819472 is not set diff --git a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch index ac502bdd16d666..ac53bd02812bf6 100644 --- a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch @@ -77,7 +77,7 @@ Signed-off-by: Felix Fietkau INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *, u32)); INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *, -@@ -1983,9 +1997,11 @@ static void __sk_free(struct sock *sk) +@@ -1986,9 +2000,11 @@ static void __sk_free(struct sock *sk) if (likely(sk->sk_net_refcnt)) sock_inuse_add(sock_net(sk), -1); diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index b1c1c8171c122c..8039d4161a2505 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3877,6 +3877,8 @@ static __net_initdata struct pernet_oper +@@ -3880,6 +3880,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { diff --git a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch index a22a1124e9d6e2..5ded06ff63f617 100644 --- a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch @@ -37,7 +37,7 @@ * managed to set the command line, unless CONFIG_CMDLINE_FORCE --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig -@@ -1983,6 +1983,14 @@ config CMDLINE_FORCE +@@ -2057,6 +2057,14 @@ config CMDLINE_FORCE endchoice From f147569ff1a15ebe3ae8b64278ce835b7205a5b2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 12 Aug 2023 15:14:22 +0200 Subject: [PATCH 0361/1171] patchelf: Revert "tools/patchelf: update to 0.18.0" This reverts commit ec6bcda8e49815efeee845da50defc85ae068b79. patchelf 0.18.0 requires GCC 8, it does not compile using GCC 7 any more. Downgrade to patchelf 0.17.2 which still supports GCC 7. Downgrade patchelf to 0.17.2 only in the OpenWrt 23.05 branch and require GCC 8 in the master branch. Ubuntu 18.04 uses GCC 7 by default. Fixes: #13102 Signed-off-by: Hauke Mehrtens --- tools/patchelf/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/patchelf/Makefile b/tools/patchelf/Makefile index bbda3a9e40a48e..3ddd611cd8462c 100644 --- a/tools/patchelf/Makefile +++ b/tools/patchelf/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=patchelf -PKG_VERSION:=0.18.0 +PKG_VERSION:=0.17.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/NixOS/patchelf/releases/download/$(PKG_VERSION) -PKG_HASH:=1952b2a782ba576279c211ee942e341748fdb44997f704dd53def46cd055470b +PKG_HASH:=bae2ea376072e422c196218dd9bdef0548ccc08da4de9f36b4672df84ea2d8e2 HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf From 1aeb247fc826d9a58f3a8842b18dcb9a24558ba1 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 13 Aug 2023 22:32:20 +0200 Subject: [PATCH 0362/1171] linux-firmware: Update Intel AX200 and AX210 firmware This updates the Intel iwlwifi firmware for AX200 and AX210 from version 66 to version 72. Version 72 is the latest version supported by iwlwifi from kernel 6.1. Signed-off-by: Hauke Mehrtens Reviewed-by: Robert Marko (cherry picked from commit 00ce1c05877ac38f5ff00c1c2ce3468d5168f76c) --- package/firmware/linux-firmware/intel.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 23b58358b4eb7f..cb7b7f4ae42303 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -173,14 +173,14 @@ $(eval $(call BuildPackage,iwlwifi-firmware-iwl9260)) Package/iwlwifi-firmware-ax200 = $(call Package/firmware-default,Intel AX200 firmware) define Package/iwlwifi-firmware-ax200/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-cc-a0-66.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-cc-a0-72.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-ax200)) Package/iwlwifi-firmware-ax210 = $(call Package/firmware-default,Intel AX210 firmware) define Package/iwlwifi-firmware-ax210/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0-66.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0-72.ucode $(1)/lib/firmware $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0.pnvm $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-ax210)) From 73aa78c4a0c319a0a66096d08358fa41008db0de Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 14 Aug 2023 13:47:49 +0200 Subject: [PATCH 0363/1171] ipq40xx: commonize Meraki recipe MR33 and MR74 share pretty much everything in the image recipe, so lets extract a common recipe to avoid duplication. Signed-off-by: Robert Marko (cherry picked from commit 9e9dc1890c6f58d858208136ecfa435445dfca09) --- target/linux/ipq40xx/image/generic.mk | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index a9dd2aa0912f6a..55e143e0dd8f4d 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -756,26 +756,25 @@ define Device/luma_wrtq-329acn endef TARGET_DEVICES += luma_wrtq-329acn -define Device/meraki_mr33 +define Device/meraki_common $(call Device/FitImage) DEVICE_VENDOR := Cisco Meraki - DEVICE_MODEL := MR33 SOC := qcom-ipq4029 BLOCKSIZE := 128k PAGESIZE := 2048 DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct +endef + +define Device/meraki_mr33 + $(call Device/meraki_common) + DEVICE_MODEL := MR33 DEFAULT := n endef TARGET_DEVICES += meraki_mr33 define Device/meraki_mr74 - $(call Device/FitImage) - DEVICE_VENDOR := Cisco Meraki + $(call Device/meraki_common) DEVICE_MODEL := MR74 - SOC := qcom-ipq4029 - BLOCKSIZE := 128k - PAGESIZE := 2048 - DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct DEVICE_DTS_CONFIG := config@3 DEFAULT := n endef From 5cecf9aec8a9a899472b801cc43126b5d875b9ee Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 14 Aug 2023 13:48:37 +0200 Subject: [PATCH 0364/1171] ipq40xx: meraki: remove swconfig in DEVICE_PACKAGES ipq40xx was converted to DSA and swconfig is not being included at all in the default packages so there is no need to drop it from device packages. Signed-off-by: Robert Marko (cherry picked from commit bb4a25860f593790aaedc1b31dde33fbc519e7bf) --- target/linux/ipq40xx/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 55e143e0dd8f4d..78fa22c2345a09 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -762,7 +762,7 @@ define Device/meraki_common SOC := qcom-ipq4029 BLOCKSIZE := 128k PAGESIZE := 2048 - DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct + DEVICE_PACKAGES := ath10k-firmware-qca9887-ct endef define Device/meraki_mr33 From 4956ff40c50f375ba72c6d834f913962afbb6c9e Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 14 Aug 2023 13:50:47 +0200 Subject: [PATCH 0365/1171] ipq40xx: meraki: define DTB load address It seems that the Meraki bootloader does not respect the kernel ARM booting specification[1] that requires that address where DTB is located needs to be 64-bit aligned and often places the DTB on a non 64-bit aligned address and then kernel fails to find the DTB magic and fails to boot. Even worse, there is no prints until early printk is enabled and then its visible that kernel is trying to find the ATAG-s as DTB was not found or is invalid. Unifi 6 devices had the same issue and it can be solved by passing the load adress as part of the FIT image. It seems that the vendor was aware of the issue and is always relocating the DTB to 0x89000000, so lets just do the same. Now that booting is reliable, reenable default images for the Meraki MR33 and MR74 devices. Reviewed-by: Lech Perczak lech.perczak@gmail.com Signed-off-by: Robert Marko (cherry picked from commit f1c80445bd7e3b2f7fc3e4c8136402b30834d4e9) --- target/linux/ipq40xx/image/generic.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 78fa22c2345a09..907558302c70dd 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -762,13 +762,13 @@ define Device/meraki_common SOC := qcom-ipq4029 BLOCKSIZE := 128k PAGESIZE := 2048 + DEVICE_DTS_LOADADDR := 0x89000000 DEVICE_PACKAGES := ath10k-firmware-qca9887-ct endef define Device/meraki_mr33 $(call Device/meraki_common) DEVICE_MODEL := MR33 - DEFAULT := n endef TARGET_DEVICES += meraki_mr33 @@ -776,7 +776,6 @@ define Device/meraki_mr74 $(call Device/meraki_common) DEVICE_MODEL := MR74 DEVICE_DTS_CONFIG := config@3 - DEFAULT := n endef TARGET_DEVICES += meraki_mr74 From 5569b92cb345bf11b7a3e3792d2c50588433c3ba Mon Sep 17 00:00:00 2001 From: Ivan Pavlov Date: Wed, 2 Aug 2023 08:23:02 +0300 Subject: [PATCH 0366/1171] ramips: improve Xiaomi mi-mini indications Sets status indications led color on Xiaomi mi-mini router as other Xiaomi routers Signed-off-by: Ivan Pavlov (cherry picked from commit 54e5e396c59948224dfb8ccf7aa8afe11462f647) --- target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts index 1dd3f2eb471afd..95868c9be99f49 100644 --- a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts +++ b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts @@ -8,8 +8,8 @@ model = "Xiaomi MiWiFi Mini"; aliases { - led-boot = &led_blue; - led-failsafe = &led_blue; + led-boot = &led_yellow; + led-failsafe = &led_red; led-running = &led_blue; led-upgrade = &led_blue; label-mac-device = ðernet; @@ -25,15 +25,14 @@ led_blue: blue { label = "blue:status"; gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; - default-state = "on"; }; - yellow { + led_yellow: yellow { label = "yellow:status"; gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; }; - red { + led_red: red { label = "red:status"; gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; }; From 4e066f1f0bfe6d733c904b406e269764b204e4b8 Mon Sep 17 00:00:00 2001 From: Ivan Pavlov Date: Wed, 2 Aug 2023 08:53:23 +0300 Subject: [PATCH 0367/1171] uboot-envtools: add u-boot env config for Xiaomi mi-mini Add u-boot env config for Xiaomi mi-mini for using fw_printenv and fw_setenv on this board Signed-off-by: Ivan Pavlov (cherry picked from commit a87bc138cfccd8de06afaad81f7ba838a87fe4f8) --- package/boot/uboot-envtools/files/ramips | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 5fb5c45a51bc21..0abb5f6549504b 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -103,6 +103,10 @@ snr,cpe-w4n-mt) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x1000" ;; +xiaomi,miwifi-mini) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" + ubootenv_add_uci_sys_config "/dev/mtd9" "0x0" "0x4000" "0x10000" + ;; xiaomi,mi-router-3g-v2|\ xiaomi,mi-router-4a-gigabit|\ xiaomi,miwifi-3c) From f28a2a50946d67d2bab8e96abc29169b0241ff93 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 13 Aug 2023 22:50:19 +0200 Subject: [PATCH 0368/1171] x86: Activate CONFIG_PCIEASPM This activates PCI Express ASPM control in Linux. Without this option it is completely controlled by the BIOS, now Linux will take over and apply some workarounds if needed. Fixes: #13248 Signed-off-by: Hauke Mehrtens (cherry picked from commit ff71035751bf440401b4bbc32e0b61ba11178234) --- target/linux/x86/64/config-5.15 | 5 +++++ target/linux/x86/generic/config-5.15 | 5 +++++ target/linux/x86/legacy/config-5.15 | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index d1ada5c2f5e93a..c3beedab8b9326 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -356,6 +356,11 @@ CONFIG_PATA_VIA=y CONFIG_PCC=y # CONFIG_PCENGINES_APU2 is not set CONFIG_PCIEAER=y +CONFIG_PCIEASPM=y +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_PERFORMANCE is not set +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PME=y CONFIG_PCI_HYPERV=y diff --git a/target/linux/x86/generic/config-5.15 b/target/linux/x86/generic/config-5.15 index 5fda82dd296d10..96f5b0718bb085 100644 --- a/target/linux/x86/generic/config-5.15 +++ b/target/linux/x86/generic/config-5.15 @@ -309,6 +309,11 @@ CONFIG_PATA_TIMINGS=y CONFIG_PATA_VIA=y # CONFIG_PCENGINES_APU2 is not set CONFIG_PCIEAER=y +CONFIG_PCIEASPM=y +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_PERFORMANCE is not set +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PME=y CONFIG_PCI_MMCONFIG=y diff --git a/target/linux/x86/legacy/config-5.15 b/target/linux/x86/legacy/config-5.15 index a75ce40ab46624..de5cd4488f31da 100644 --- a/target/linux/x86/legacy/config-5.15 +++ b/target/linux/x86/legacy/config-5.15 @@ -185,6 +185,11 @@ CONFIG_PATA_SIS=y CONFIG_PATA_TIMINGS=y CONFIG_PATA_VIA=y CONFIG_PCIEAER=y +CONFIG_PCIEASPM=y +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_PERFORMANCE is not set +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set CONFIG_PCIEPORTBUS=y CONFIG_PCI_MMCONFIG=y # CONFIG_PCWATCHDOG is not set From dd30399caefbb5418653f693e9af871741b4d03d Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 13 Aug 2023 23:02:03 +0200 Subject: [PATCH 0369/1171] x86: Add virtualization time sync support This compiles the CONFIG_PTP_1588_CLOCK support into the kernel binary and activates the drivers for KVM and VMware which allow syncing the host time with the VM when OpenWrt is running in a VM. With this change the CONFIG_HYPERV_UTILS driver is now build into the kernel, because it depends on the PTP framework being compiled in. CONFIG_HYPERV_UTILS was build as a module, but not packages before. Fixes: #13277 Signed-off-by: Hauke Mehrtens (cherry picked from commit 54d470ed0ecaff9e8084c013ddbc95e8afc3ab42) --- target/linux/x86/64/config-5.15 | 5 +++++ target/linux/x86/generic/config-5.15 | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index c3beedab8b9326..5aa160c55d856c 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -328,6 +328,7 @@ CONFIG_ND_CLAIM=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_FAILOVER=y CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_PTP_CLASSIFY=y # CONFIG_NITRO_ENCLAVES is not set CONFIG_NR_CPUS=512 CONFIG_NR_CPUS_DEFAULT=64 @@ -395,7 +396,11 @@ CONFIG_PM_SLEEP_SMP=y CONFIG_PNP=y CONFIG_PNPACPI=y CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_PPS=y CONFIG_PROC_EVENTS=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_KVM=y +CONFIG_PTP_1588_CLOCK_VMW=y CONFIG_PVH=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y diff --git a/target/linux/x86/generic/config-5.15 b/target/linux/x86/generic/config-5.15 index 96f5b0718bb085..4312c527c8bd1e 100644 --- a/target/linux/x86/generic/config-5.15 +++ b/target/linux/x86/generic/config-5.15 @@ -286,6 +286,7 @@ CONFIG_ND_CLAIM=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_FAILOVER=y CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_PTP_CLASSIFY=y CONFIG_NO_HZ=y CONFIG_NR_CPUS=4 CONFIG_NR_CPUS_DEFAULT=8 @@ -347,8 +348,12 @@ CONFIG_PNP=y CONFIG_PNPACPI=y # CONFIG_PNPBIOS is not set CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_PPS=y CONFIG_PREEMPT_NOTIFIERS=y CONFIG_PROC_EVENTS=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_KVM=y +CONFIG_PTP_1588_CLOCK_VMW=y CONFIG_PVH=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y From c57275df675e2a585bff1c59f71291bc32f1e103 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 14 Aug 2023 23:33:49 +0200 Subject: [PATCH 0370/1171] scripts: qemustart: Fix x86/legacy bootup The ide-drive option was renamed to ide-hd in qemu 6.0. With this change qemu is starting again on Debian 12. Signed-off-by: Hauke Mehrtens (cherry picked from commit 497012ab4eb1f37cbbbff9a766d2fecdb43dd0db) --- scripts/qemustart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemustart b/scripts/qemustart index f6a46551294fc3..6c4c9be4cb0a89 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -309,12 +309,12 @@ start_qemu_x86() { # To use AHCI interface # # -device ich9-ahci,id=ahci \ - # -device ide-drive,drive=drv0,bus=ahci.0 \ + # -device ide-hd,drive=drv0,bus=ahci.0 \ # -drive "file=$rootfs,format=raw,id=drv0,if=none" \ # # [1] https://dev.openwrt.org/ticket/17947 "$qemu_exe" -machine "$mach" -nographic \ - -device ide-drive,drive=drv0 \ + -device ide-hd,drive=drv0 \ -drive "file=$rootfs,format=raw,id=drv0,if=none" \ "${o_qemu_extra[@]}" ;; From 097d6890ba78b2395add2b2d5d0d6ea54fef91fa Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 16 Aug 2023 15:15:17 -0400 Subject: [PATCH 0371/1171] kernel: bump 5.15 to 5.15.127 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.127 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 973c5d4a1d5d732f46b577384f39da2336a80fb1) --- include/kernel-5.15 | 4 ++-- ...x-add-support-for-qca-8327-internal-phy.patch | 4 ++-- ...803x-add-support-for-qca-8327-A-variant.patch | 4 ++-- ...x-add-resume-suspend-function-to-qca83x.patch | 6 +++--- ...x-fix-spacing-and-improve-name-for-83xx.patch | 2 +- ...t-phy-at803x-fix-resume-for-QCA8327-phy.patch | 6 +++--- ...803x-add-DAC-amplitude-fix-for-8327-phy.patch | 6 +++--- ...-NULL-pointer-dereference-on-AR9331-PHY.patch | 2 +- .../pending-5.15/630-packet_socket_type.patch | 16 ++++++++-------- ..._flow_offload-handle-netdevice-events-f.patch | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 7687c40aa8cf59..c1c1e791f71873 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .126 -LINUX_KERNEL_HASH-5.15.126 = adf4aab9840f89ee151b837defbe16e9f388e8eef20df7ee94bf63be33b3ed6f +LINUX_VERSION-5.15 = .127 +LINUX_KERNEL_HASH-5.15.127 = add0a575341b263a06e93599fc220a5dd34cb4ca5b9d05097a5db2a061928f26 diff --git a/target/linux/generic/backport-5.15/742-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch b/target/linux/generic/backport-5.15/742-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch index 8f000ba918798b..03171d72cc7882 100644 --- a/target/linux/generic/backport-5.15/742-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch +++ b/target/linux/generic/backport-5.15/742-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -1412,6 +1412,19 @@ static struct phy_driver at803x_driver[] +@@ -1410,6 +1410,19 @@ static struct phy_driver at803x_driver[] .get_sset_count = at803x_get_sset_count, .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller }, }; module_phy_driver(at803x_driver); -@@ -1422,6 +1435,8 @@ static struct mdio_device_id __maybe_unu +@@ -1420,6 +1433,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_EXACT(ATH8032_PHY_ID) }, { PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) }, { PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) }, diff --git a/target/linux/generic/backport-5.15/745-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch b/target/linux/generic/backport-5.15/745-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch index 99d91dfa765693..7e4e9462e85ad7 100644 --- a/target/linux/generic/backport-5.15/745-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch +++ b/target/linux/generic/backport-5.15/745-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #define QCA8337_PHY_ID 0x004dd036 #define QCA8K_PHY_ID_MASK 0xffffffff -@@ -1413,10 +1414,23 @@ static struct phy_driver at803x_driver[] +@@ -1411,10 +1412,23 @@ static struct phy_driver at803x_driver[] .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, }, { @@ -53,7 +53,7 @@ Signed-off-by: David S. Miller /* PHY_GBIT_FEATURES */ .probe = at803x_probe, .flags = PHY_IS_INTERNAL, -@@ -1436,7 +1450,8 @@ static struct mdio_device_id __maybe_unu +@@ -1434,7 +1448,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) }, { PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) }, { PHY_ID_MATCH_EXACT(QCA8337_PHY_ID) }, diff --git a/target/linux/generic/backport-5.15/745-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch b/target/linux/generic/backport-5.15/745-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch index cd83fac83c8144..89aca23194dfa2 100644 --- a/target/linux/generic/backport-5.15/745-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch +++ b/target/linux/generic/backport-5.15/745-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch @@ -16,7 +16,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -1413,6 +1413,8 @@ static struct phy_driver at803x_driver[] +@@ -1411,6 +1411,8 @@ static struct phy_driver at803x_driver[] .get_sset_count = at803x_get_sset_count, .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller }, { /* QCA8327-A from switch QCA8327-AL1A */ .phy_id = QCA8327_A_PHY_ID, -@@ -1426,6 +1428,8 @@ static struct phy_driver at803x_driver[] +@@ -1424,6 +1426,8 @@ static struct phy_driver at803x_driver[] .get_sset_count = at803x_get_sset_count, .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, @@ -34,7 +34,7 @@ Signed-off-by: David S. Miller }, { /* QCA8327-B from switch QCA8327-BL1A */ .phy_id = QCA8327_B_PHY_ID, -@@ -1439,6 +1443,8 @@ static struct phy_driver at803x_driver[] +@@ -1437,6 +1441,8 @@ static struct phy_driver at803x_driver[] .get_sset_count = at803x_get_sset_count, .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, diff --git a/target/linux/generic/backport-5.15/745-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch b/target/linux/generic/backport-5.15/745-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch index 586d8953b2ba17..920bef24fd68bb 100644 --- a/target/linux/generic/backport-5.15/745-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch +++ b/target/linux/generic/backport-5.15/745-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch @@ -15,7 +15,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -1402,47 +1402,47 @@ static struct phy_driver at803x_driver[] +@@ -1400,47 +1400,47 @@ static struct phy_driver at803x_driver[] .config_aneg = at803x_config_aneg, }, { /* QCA8337 */ diff --git a/target/linux/generic/backport-5.15/746-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch b/target/linux/generic/backport-5.15/746-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch index 09797ae83bcc10..1029420ea9b3e7 100644 --- a/target/linux/generic/backport-5.15/746-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch +++ b/target/linux/generic/backport-5.15/746-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller static struct phy_driver at803x_driver[] = { { /* Qualcomm Atheros AR8035 */ -@@ -1413,8 +1470,8 @@ static struct phy_driver at803x_driver[] +@@ -1411,8 +1468,8 @@ static struct phy_driver at803x_driver[] .get_sset_count = at803x_get_sset_count, .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, @@ -107,7 +107,7 @@ Signed-off-by: David S. Miller }, { /* QCA8327-A from switch QCA8327-AL1A */ .phy_id = QCA8327_A_PHY_ID, -@@ -1428,8 +1485,8 @@ static struct phy_driver at803x_driver[] +@@ -1426,8 +1483,8 @@ static struct phy_driver at803x_driver[] .get_sset_count = at803x_get_sset_count, .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, @@ -118,7 +118,7 @@ Signed-off-by: David S. Miller }, { /* QCA8327-B from switch QCA8327-BL1A */ .phy_id = QCA8327_B_PHY_ID, -@@ -1443,8 +1500,8 @@ static struct phy_driver at803x_driver[] +@@ -1441,8 +1498,8 @@ static struct phy_driver at803x_driver[] .get_sset_count = at803x_get_sset_count, .get_strings = at803x_get_strings, .get_stats = at803x_get_stats, diff --git a/target/linux/generic/backport-5.15/746-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch b/target/linux/generic/backport-5.15/746-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch index c504c37c84f8ba..5813619c5c4a90 100644 --- a/target/linux/generic/backport-5.15/746-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch +++ b/target/linux/generic/backport-5.15/746-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller static int qca83xx_resume(struct phy_device *phydev) { int ret, val; -@@ -1463,6 +1493,7 @@ static struct phy_driver at803x_driver[] +@@ -1461,6 +1491,7 @@ static struct phy_driver at803x_driver[] .phy_id_mask = QCA8K_PHY_ID_MASK, .name = "Qualcomm Atheros 8337 internal PHY", /* PHY_GBIT_FEATURES */ @@ -73,7 +73,7 @@ Signed-off-by: David S. Miller .probe = at803x_probe, .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, -@@ -1478,6 +1509,7 @@ static struct phy_driver at803x_driver[] +@@ -1476,6 +1507,7 @@ static struct phy_driver at803x_driver[] .phy_id_mask = QCA8K_PHY_ID_MASK, .name = "Qualcomm Atheros 8327-A internal PHY", /* PHY_GBIT_FEATURES */ @@ -81,7 +81,7 @@ Signed-off-by: David S. Miller .probe = at803x_probe, .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, -@@ -1493,6 +1525,7 @@ static struct phy_driver at803x_driver[] +@@ -1491,6 +1523,7 @@ static struct phy_driver at803x_driver[] .phy_id_mask = QCA8K_PHY_ID_MASK, .name = "Qualcomm Atheros 8327-B internal PHY", /* PHY_GBIT_FEATURES */ diff --git a/target/linux/generic/backport-5.15/778-v5.18-03-net-phy-at803x-fix-NULL-pointer-dereference-on-AR9331-PHY.patch b/target/linux/generic/backport-5.15/778-v5.18-03-net-phy-at803x-fix-NULL-pointer-dereference-on-AR9331-PHY.patch index de8951db10cf10..53d6325c4942e4 100644 --- a/target/linux/generic/backport-5.15/778-v5.18-03-net-phy-at803x-fix-NULL-pointer-dereference-on-AR9331-PHY.patch +++ b/target/linux/generic/backport-5.15/778-v5.18-03-net-phy-at803x-fix-NULL-pointer-dereference-on-AR9331-PHY.patch @@ -45,7 +45,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -1594,6 +1594,8 @@ static struct phy_driver at803x_driver[] +@@ -1592,6 +1592,8 @@ static struct phy_driver at803x_driver[] /* ATHEROS AR9331 */ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID), .name = "Qualcomm Atheros AR9331 built-in PHY", diff --git a/target/linux/generic/pending-5.15/630-packet_socket_type.patch b/target/linux/generic/pending-5.15/630-packet_socket_type.patch index ee13ce2a5c8d77..c36e9e9fbbedab 100644 --- a/target/linux/generic/pending-5.15/630-packet_socket_type.patch +++ b/target/linux/generic/pending-5.15/630-packet_socket_type.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #define PACKET_FANOUT_LB 1 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c -@@ -1826,6 +1826,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1830,6 +1830,7 @@ static int packet_rcv_spkt(struct sk_buf { struct sock *sk; struct sockaddr_pkt *spkt; @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau /* * When we registered the protocol we saved the socket in the data -@@ -1833,6 +1834,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1837,6 +1838,7 @@ static int packet_rcv_spkt(struct sk_buf */ sk = pt->af_packet_priv; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau /* * Yank back the headers [hope the device set this -@@ -1845,7 +1847,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1849,7 +1851,7 @@ static int packet_rcv_spkt(struct sk_buf * so that this procedure is noop. */ @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau goto out; if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -2091,12 +2093,12 @@ static int packet_rcv(struct sk_buff *sk +@@ -2095,12 +2097,12 @@ static int packet_rcv(struct sk_buff *sk unsigned int snaplen, res; bool is_drop_n_account = false; @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -2222,12 +2224,12 @@ static int tpacket_rcv(struct sk_buff *s +@@ -2226,12 +2228,12 @@ static int tpacket_rcv(struct sk_buff *s BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3342,6 +3344,7 @@ static int packet_create(struct net *net +@@ -3346,6 +3348,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3979,6 +3982,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3983,6 +3986,16 @@ packet_setsockopt(struct socket *sock, i WRITE_ONCE(po->xmit, val ? packet_direct_xmit : dev_queue_xmit); return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4035,6 +4048,13 @@ static int packet_getsockopt(struct sock +@@ -4039,6 +4052,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-5.15/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch b/target/linux/generic/pending-5.15/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch index 488c6a8d92c7dd..606e0535137a28 100644 --- a/target/linux/generic/pending-5.15/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch +++ b/target/linux/generic/pending-5.15/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch @@ -55,7 +55,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nft_flow_offload.c +++ b/net/netfilter/nft_flow_offload.c -@@ -444,47 +444,14 @@ static struct nft_expr_type nft_flow_off +@@ -446,47 +446,14 @@ static struct nft_expr_type nft_flow_off .owner = THIS_MODULE, }; From 6eb6a75b8d78ae70b3c9f2de70a38352c5de3714 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 23 May 2023 15:43:14 +0800 Subject: [PATCH 0372/1171] kernel: modules: add xdp-sockets-diag support Support for PF_XDP sockets monitoring interface used by the ss tool. Signed-off-by: Tianling Shen (cherry picked from commit 06e64f9b364abe15c27bf0a7225fcac740819668) --- config/Config-kernel.in | 6 ++++++ package/kernel/linux/modules/netsupport.mk | 16 ++++++++++++++++ .../hack-5.15/901-debloat_sock_diag.patch | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 32524f5aedf1bf..fbcd008f2fb05b 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1097,6 +1097,12 @@ config KERNEL_NET_L3_MASTER_DEV This module provides glue between core networking code and device drivers to support L3 master devices like VRF. +config KERNEL_XDP_SOCKETS + bool "XDP sockets support" + help + XDP sockets allows a channel between XDP programs and + userspace applications. + config KERNEL_WIRELESS_EXT def_bool n diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 97556e459db899..27268ee04398f5 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -1443,6 +1443,22 @@ endef $(eval $(call KernelPackage,inet-diag)) +define KernelPackage/xdp-sockets-diag + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=PF_XDP sockets monitoring interface support for ss utility + DEPENDS:=@KERNEL_XDP_SOCKETS + KCONFIG:=CONFIG_XDP_SOCKETS_DIAG + FILES:=$(LINUX_DIR)/net/xdp/xsk_diag.ko + AUTOLOAD:=$(call AutoLoad,31,xsk_diag) +endef + +define KernelPackage/xdp-sockets-diag/description + Support for PF_XDP sockets monitoring interface used by the ss tool +endef + +$(eval $(call KernelPackage,xdp-sockets-diag)) + + define KernelPackage/wireguard SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=WireGuard secure network tunnel diff --git a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch index ac53bd02812bf6..5c1ce01a2ce93d 100644 --- a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch @@ -160,3 +160,13 @@ Signed-off-by: Felix Fietkau default n help Support for UNIX socket monitoring interface used by the ss tool. +--- a/net/xdp/Kconfig ++++ b/net/xdp/Kconfig +@@ -10,6 +10,7 @@ config XDP_SOCKETS + config XDP_SOCKETS_DIAG + tristate "XDP sockets: monitoring interface" + depends on XDP_SOCKETS ++ select SOCK_DIAG + default n + help + Support for PF_XDP sockets monitoring interface used by the ss tool. From e306e46a8d334ea829df176468f7262f36427dc4 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 7 Jun 2023 01:04:03 +0000 Subject: [PATCH 0373/1171] armsr: armv8: sync Arm64 erratum options with kernel defconfig To reduce differences with the Linux arm64 defconfig, sync the enabled erratum items with defconfig. There are still some options not selected due to CONFIG_KVM or other options not enabled in OpenWrt by default. Signed-off-by: Mathew McBride (23.05/5.15 version of commit 5c4239ac3f189352698de706599bc32a6e457532) --- target/linux/armsr/armv8/config-5.15 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index 6b8b735059a94f..a6ec43e3f10d43 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -24,14 +24,30 @@ CONFIG_ARM64_4K_PAGES=y CONFIG_ARM64_CNP=y CONFIG_ARM64_CRYPTO=y CONFIG_ARM64_EPAN=y +CONFIG_ARM64_ERRATUM_1024718=y CONFIG_ARM64_ERRATUM_1165522=y CONFIG_ARM64_ERRATUM_1286807=y +CONFIG_ARM64_ERRATUM_1319367=y +CONFIG_ARM64_ERRATUM_1418040=y +CONFIG_ARM64_ERRATUM_1463225=y +CONFIG_ARM64_ERRATUM_1508412=y +CONFIG_ARM64_ERRATUM_1530923=y +CONFIG_ARM64_ERRATUM_1542419=y +CONFIG_ARM64_ERRATUM_1742098=y +CONFIG_ARM64_ERRATUM_2051678=y +CONFIG_ARM64_ERRATUM_2054223=y +CONFIG_ARM64_ERRATUM_2067961=y +CONFIG_ARM64_ERRATUM_2077057=y +CONFIG_ARM64_ERRATUM_2441009=y +CONFIG_ARM64_ERRATUM_2457168=y +CONFIG_ARM64_ERRATUM_2658417=y CONFIG_ARM64_ERRATUM_819472=y CONFIG_ARM64_ERRATUM_824069=y CONFIG_ARM64_ERRATUM_826319=y CONFIG_ARM64_ERRATUM_827319=y CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_843419=y +CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y CONFIG_ARM64_PAGE_SHIFT=12 @@ -47,6 +63,7 @@ CONFIG_ARM64_VA_BITS_48=y CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y +CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE=y # CONFIG_ARMADA_37XX_RWTM_MBOX is not set CONFIG_ARMADA_37XX_WATCHDOG=y CONFIG_ARMADA_THERMAL=y @@ -68,6 +85,11 @@ CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y # CONFIG_AXI_DMAC is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BLK_PM=y +CONFIG_CAVIUM_ERRATUM_22375=y +CONFIG_CAVIUM_ERRATUM_23144=y +CONFIG_CAVIUM_ERRATUM_23154=y +CONFIG_CAVIUM_ERRATUM_27456=y +CONFIG_CAVIUM_ERRATUM_30115=y CONFIG_CAVIUM_TX2_ERRATUM_219=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y CONFIG_CLK_IMX8MM=y @@ -191,6 +213,7 @@ CONFIG_GPIO_ZYNQ=y CONFIG_HDMI=y CONFIG_HI3660_MBOX=y CONFIG_HI6220_MBOX=y +CONFIG_HISILICON_ERRATUM_161600802=y CONFIG_HISILICON_LPC=y CONFIG_HISI_PMU=y CONFIG_HISI_THERMAL=y @@ -369,6 +392,10 @@ CONFIG_POWER_RESET=y CONFIG_POWER_RESET_HISI=y CONFIG_POWER_RESET_VEXPRESS=y CONFIG_POWER_SUPPLY=y +CONFIG_QCOM_FALKOR_ERRATUM_1003=y +CONFIG_QCOM_FALKOR_ERRATUM_1009=y +CONFIG_QCOM_FALKOR_ERRATUM_E1041=y +CONFIG_QCOM_QDF2400_ERRATUM_0065=y CONFIG_QORIQ_THERMAL=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y @@ -413,6 +440,7 @@ CONFIG_SERIAL_SAMSUNG_CONSOLE=y # CONFIG_SND_SUN8I_CODEC is not set # CONFIG_SND_SUN8I_CODEC_ANALOG is not set # CONFIG_SNI_NETSEC is not set +CONFIG_SOCIONEXT_SYNQUACER_PREITS=y CONFIG_SOC_IMX8M=y CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y From 2c69d3e69252c6adac139be8f153c0eb6fc5625f Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 15 Aug 2023 03:47:23 +0000 Subject: [PATCH 0374/1171] kernel: default ARM_PMU on for armsr/armv8 CONFIG_ARM_PMU (Arm Performance Monitor Unit) is a requirement to use KVM (virtualization) from Linux 5.11+, as the virtualised guest has virtualized PMU access. Signed-off-by: Mathew McBride (cherry picked from commit 76d4a7c84a97a5555b1962ddb9fc694b7e1f6ba8) --- config/Config-kernel.in | 1 + 1 file changed, 1 insertion(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index fbcd008f2fb05b..c1bc7984f76f48 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -47,6 +47,7 @@ config KERNEL_MIPS_FP_SUPPORT config KERNEL_ARM_PMU bool + default y if TARGET_armsr_armv8 depends on (arm || aarch64) config KERNEL_X86_VSYSCALL_EMULATION From 88e7fe874124c7c6daf99b7716205cd91fbe6bc3 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 20 Jun 2023 01:23:17 +0000 Subject: [PATCH 0375/1171] armsr: armv8: enable KVM host x86/64 enables support for KVM so I can't see a reason why not on armsr/armv8 as well. Arm CPU errata workaround items related to virtualization are also enabled by this change. Signed-off-by: Mathew McBride (23.05/5.15 version of commit e505873e65f72b5e89c136dbb61d992a2219b6eb) --- target/linux/armsr/armv8/config-5.15 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index a6ec43e3f10d43..61641e1d3f4d61 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -1,4 +1,5 @@ CONFIG_64BIT=y +CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y CONFIG_ARCH_HISI=y CONFIG_ARCH_INTEL_SOCFPGA=y CONFIG_ARCH_LAYERSCAPE=y @@ -38,6 +39,7 @@ CONFIG_ARM64_ERRATUM_2051678=y CONFIG_ARM64_ERRATUM_2054223=y CONFIG_ARM64_ERRATUM_2067961=y CONFIG_ARM64_ERRATUM_2077057=y +CONFIG_ARM64_ERRATUM_2441007=y CONFIG_ARM64_ERRATUM_2441009=y CONFIG_ARM64_ERRATUM_2457168=y CONFIG_ARM64_ERRATUM_2658417=y @@ -46,6 +48,7 @@ CONFIG_ARM64_ERRATUM_824069=y CONFIG_ARM64_ERRATUM_826319=y CONFIG_ARM64_ERRATUM_827319=y CONFIG_ARM64_ERRATUM_832075=y +CONFIG_ARM64_ERRATUM_834220=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_HW_AFDBM=y @@ -260,6 +263,7 @@ CONFIG_IOMMU_SUPPORT=y # CONFIG_K3_DMA is not set CONFIG_KCMP=y # CONFIG_KEYBOARD_SUN4I_LRADC is not set +CONFIG_KVM=y CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_PLATFORM is not set # CONFIG_MAILBOX_TEST is not set @@ -306,6 +310,7 @@ CONFIG_NO_HZ=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=64 +# CONFIG_NVHE_EL2_DEBUG is not set CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y # CONFIG_NVMEM_IMX_IIM is not set CONFIG_NVMEM_IMX_OCOTP=y @@ -518,6 +523,7 @@ CONFIG_VIDEOMODE_HELPERS=y # CONFIG_VIDEO_SUN6I_CSI is not set CONFIG_VIRTIO_DMA_SHARED_BUFFER=y # CONFIG_VIRTIO_IOMMU is not set +CONFIG_VIRTUALIZATION=y CONFIG_VMAP_STACK=y CONFIG_WDAT_WDT=y # CONFIG_XILINX_AMS is not set From f517d8a518e7d4a31ffe4a99fe12289ef149852c Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 20 Jun 2023 01:31:12 +0000 Subject: [PATCH 0376/1171] armsr: armv8: sync CPU features, EFI, CMA and scheduler options with Linux defconfig To bring the armsr/armv8 kernel configuration closer to the Linux arm64 defconfig, synchronize options related to CPU features (especially more recent Armv8.X variants), scheduler, EFI vars, CMA and scheduler options. Signed-off-by: Mathew McBride (23.05/5.15 version commit 22e0c7be47ca55b7366dc569926724271d51cb77) --- target/linux/armsr/armv8/config-5.15 | 45 +++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index 61641e1d3f4d61..0f0c634f1fbd73 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -1,4 +1,5 @@ CONFIG_64BIT=y +CONFIG_ACPI_HMAT=y CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y CONFIG_ARCH_HISI=y CONFIG_ARCH_INTEL_SOCFPGA=y @@ -22,8 +23,11 @@ CONFIG_ARCH_WANTS_NO_INSTR=y CONFIG_ARCH_ZYNQMP=y CONFIG_ARM64=y CONFIG_ARM64_4K_PAGES=y +CONFIG_ARM64_AMU_EXTN=y +CONFIG_ARM64_BTI=y CONFIG_ARM64_CNP=y CONFIG_ARM64_CRYPTO=y +CONFIG_ARM64_E0PD=y CONFIG_ARM64_EPAN=y CONFIG_ARM64_ERRATUM_1024718=y CONFIG_ARM64_ERRATUM_1165522=y @@ -53,14 +57,17 @@ CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y +CONFIG_ARM64_MTE=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 CONFIG_ARM64_PA_BITS_48=y CONFIG_ARM64_PTR_AUTH=y CONFIG_ARM64_PTR_AUTH_KERNEL=y +CONFIG_ARM64_RAS_EXTN=y CONFIG_ARM64_SVE=y CONFIG_ARM64_TAGGED_ADDR_ABI=y +CONFIG_ARM64_TLB_RANGE=y CONFIG_ARM64_VA_BITS=48 CONFIG_ARM64_VA_BITS_48=y CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y @@ -73,7 +80,12 @@ CONFIG_ARMADA_THERMAL=y CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y # CONFIG_ARM_DMC620_PMU is not set # CONFIG_ARM_MHU_V2 is not set +CONFIG_ARM_PSCI_CPUIDLE=y +CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y CONFIG_ARM_SBSA_WATCHDOG=y +CONFIG_ARM_SCPI_POWER_DOMAIN=y +CONFIG_ARM_SCPI_PROTOCOL=y +CONFIG_ARM_SMCCC_SOC_ID=y CONFIG_ARM_SMC_WATCHDOG=y CONFIG_ARM_SMMU=y # CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT is not set @@ -116,6 +128,17 @@ CONFIG_CLK_SUNXI_CLOCKS=y # CONFIG_CLK_SUNXI_PRCM_SUN8I is not set # CONFIG_CLK_SUNXI_PRCM_SUN9I is not set CONFIG_CLK_VEXPRESS_OSC=y +CONFIG_CMA=y +CONFIG_CMA_ALIGNMENT=8 +CONFIG_CMA_AREAS=19 +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_SIZE_MBYTES=32 +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SYSFS is not set # CONFIG_COMMON_CLK_FSL_FLEXSPI is not set # CONFIG_COMMON_CLK_FSL_SAI is not set CONFIG_COMMON_CLK_HI3516CV300=y @@ -164,6 +187,8 @@ CONFIG_CRYPTO_SHA256_ARM64=y CONFIG_CRYPTO_SHA2_ARM64_CE=y CONFIG_CRYPTO_SHA512_ARM64=y CONFIG_CRYPTO_SIMD=y +# CONFIG_DEV_DAX_HMEM is not set +CONFIG_DMA_CMA=y CONFIG_DMA_DIRECT_REMAP=y CONFIG_DMA_SHARED_BUFFER=y CONFIG_DMA_SUN6I=y @@ -184,6 +209,11 @@ CONFIG_DRM_VRAM_HELPER=y # CONFIG_DWMAC_SUN8I is not set # CONFIG_DWMAC_SUNXI is not set CONFIG_DW_WATCHDOG=y +CONFIG_EFI_CAPSULE_LOADER=y +CONFIG_EFI_CUSTOM_SSDT_OVERLAYS=y +CONFIG_EFI_SOFT_RESERVE=y +CONFIG_EFI_VARS_PSTORE=y +# CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE is not set CONFIG_ENA_ETHERNET=y CONFIG_FB=y CONFIG_FB_ARMCLCD=y @@ -263,6 +293,7 @@ CONFIG_IOMMU_SUPPORT=y # CONFIG_K3_DMA is not set CONFIG_KCMP=y # CONFIG_KEYBOARD_SUN4I_LRADC is not set +CONFIG_KSM=y CONFIG_KVM=y CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_PLATFORM is not set @@ -306,10 +337,14 @@ CONFIG_MODULES_USE_ELF_RELA=y CONFIG_MXS_DMA=y CONFIG_NEED_SG_DMA_LENGTH=y # CONFIG_NET_VENDOR_ALLWINNER is not set +CONFIG_NODES_SHIFT=4 CONFIG_NO_HZ=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=64 +CONFIG_NR_CPUS=256 +CONFIG_NUMA=y +CONFIG_NUMA_BALANCING=y +CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y # CONFIG_NVHE_EL2_DEBUG is not set CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y # CONFIG_NVMEM_IMX_IIM is not set @@ -429,6 +464,10 @@ CONFIG_RTC_I2C_AND_SPI=y CONFIG_SATA_AHCI=y CONFIG_SATA_AHCI_PLATFORM=y CONFIG_SATA_HOST=y +# CONFIG_SCHED_CORE is not set +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y +# CONFIG_SENSORS_ARM_SCPI is not set # CONFIG_SERIAL_8250_EXAR is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_IMX=y @@ -486,6 +525,10 @@ CONFIG_SYNC_FILE=y CONFIG_SYSCTL_EXCEPTION_TRACE=y # CONFIG_TCG_TIS_SYNQUACER is not set CONFIG_THREAD_INFO_IN_TASK=y +# CONFIG_THUNDERX2_PMU is not set +CONFIG_TRANSPARENT_HUGEPAGE=y +CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y +# CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set # CONFIG_TURRIS_MOX_RWTM is not set CONFIG_TYPEC=y # CONFIG_TYPEC_DP_ALTMODE is not set From 14f7254a6a43ad448fa43d1b4d73b114ee4c37ee Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 14 Aug 2023 06:31:14 +0000 Subject: [PATCH 0377/1171] armsr: enable ACPI_BUTTON A review of the generated OpenWrt kernel .config vs the Linux arm64 defconfig showed that this option was not being enabled, as it is disabled in OpenWrt's generic config. ACPI_BUTTON is needed to report and respond to power button events, so it should be enabled. Signed-off-by: Mathew McBride (23.05/5.15 version of commit c4c60e4b192180288aab577e166091c2d4c470af) --- target/linux/armsr/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/armsr/config-5.15 b/target/linux/armsr/config-5.15 index 530a4d5bd761e7..a9273e64894285 100644 --- a/target/linux/armsr/config-5.15 +++ b/target/linux/armsr/config-5.15 @@ -12,6 +12,7 @@ CONFIG_ACPI_APEI_MEMORY_FAILURE=y CONFIG_ACPI_APEI_PCIEAER=y CONFIG_ACPI_BATTERY=y # CONFIG_ACPI_BGRT is not set +CONFIG_ACPI_BUTTON=y CONFIG_ACPI_CCA_REQUIRED=y CONFIG_ACPI_CONTAINER=y CONFIG_ACPI_CPPC_CPUFREQ=y From cb0534d2ed4e980df7db643b7de9f24bdc3b614c Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 20 Jun 2023 01:53:23 +0000 Subject: [PATCH 0378/1171] armsr: armv8: enable CONFIG_ARCH_RENESAS Renesas markets several embedded Arm64 SoCs in the RZ series (RZ/G, RZ/V), so should be enabled in a general purpose target. Automotive (R-Car) SoC's are not enabled by this change. Signed-off-by: Mathew McBride (23.05/5.15 version of commit 1ff4f4df230166994c660ad77479f248223ce45b) --- target/linux/armsr/armv8/config-5.15 | 67 ++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index 0f0c634f1fbd73..6642fb86b73164 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -12,6 +12,27 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 CONFIG_ARCH_MVEBU=y CONFIG_ARCH_MXC=y CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_ARCH_R8A774A1=y +CONFIG_ARCH_R8A774B1=y +CONFIG_ARCH_R8A774C0=y +CONFIG_ARCH_R8A774E1=y +# CONFIG_ARCH_R8A77950 is not set +# CONFIG_ARCH_R8A77951 is not set +# CONFIG_ARCH_R8A77960 is not set +# CONFIG_ARCH_R8A77961 is not set +# CONFIG_ARCH_R8A77965 is not set +# CONFIG_ARCH_R8A77970 is not set +# CONFIG_ARCH_R8A77980 is not set +# CONFIG_ARCH_R8A77990 is not set +# CONFIG_ARCH_R8A77995 is not set +# CONFIG_ARCH_R8A779A0 is not set +# CONFIG_ARCH_R8A779F0 is not set +# CONFIG_ARCH_R8A779G0 is not set +CONFIG_ARCH_R9A07G043=y +CONFIG_ARCH_R9A07G044=y +CONFIG_ARCH_R9A07G054=y +CONFIG_ARCH_R9A09G011=y +CONFIG_ARCH_RENESAS=y CONFIG_ARCH_ROCKCHIP=y CONFIG_ARCH_STACKWALK=y CONFIG_ARCH_SUNXI=y @@ -116,6 +137,8 @@ CONFIG_CLK_INTEL_SOCFPGA64=y CONFIG_CLK_LS1028A_PLLDIG=y CONFIG_CLK_PX30=y CONFIG_CLK_QORIQ=y +CONFIG_CLK_RCAR_USB2_CLOCK_SEL=y +CONFIG_CLK_RENESAS=y CONFIG_CLK_RK3308=y CONFIG_CLK_RK3328=y CONFIG_CLK_RK3368=y @@ -202,6 +225,7 @@ CONFIG_DRM_PANEL=y CONFIG_DRM_PANEL_BRIDGE=y CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y CONFIG_DRM_QXL=y +# CONFIG_DRM_RCAR_DU is not set CONFIG_DRM_TTM=y CONFIG_DRM_TTM_HELPER=y CONFIG_DRM_VIRTIO_GPU=y @@ -223,6 +247,7 @@ CONFIG_FB_CFB_IMAGEBLIT=y CONFIG_FB_CMDLINE=y CONFIG_FB_MODE_HELPERS=y # CONFIG_FB_MX3 is not set +# CONFIG_FB_SH_MOBILE_LCDC is not set # CONFIG_FB_XILINX is not set CONFIG_FRAME_POINTER=y # CONFIG_FSL_DPAA is not set @@ -261,6 +286,8 @@ CONFIG_I2C_BOARDINFO=y # CONFIG_I2C_HIX5HD2 is not set CONFIG_I2C_IMX=y CONFIG_I2C_IMX_LPI2C=y +CONFIG_I2C_RIIC=y +# CONFIG_I2C_RZV2M is not set CONFIG_I2C_SYNQUACER=y CONFIG_I2C_THUNDERX=y # CONFIG_I2C_XLP9XX is not set @@ -290,6 +317,7 @@ CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y # CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set # CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set CONFIG_IOMMU_SUPPORT=y +# CONFIG_IPMMU_VMSA is not set # CONFIG_K3_DMA is not set CONFIG_KCMP=y # CONFIG_KEYBOARD_SUN4I_LRADC is not set @@ -330,6 +358,10 @@ CONFIG_MMC_SDHCI_ESDHC_IMX=y CONFIG_MMC_SDHCI_OF_ESDHC=y CONFIG_MMC_SDHCI_PCI=y CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHI=y +CONFIG_MMC_SDHI_INTERNAL_DMAC=y +# CONFIG_MMC_SDHI_SYS_DMAC is not set +# CONFIG_MMC_SH_MMCIF is not set CONFIG_MMC_SUNXI=y CONFIG_MODULES_USE_ELF_RELA=y # CONFIG_MV_XOR is not set @@ -361,6 +393,8 @@ CONFIG_PCC=y CONFIG_PCIE_HISI_STB=y CONFIG_PCIE_LAYERSCAPE=y CONFIG_PCIE_MOBIVEIL_PLAT=y +# CONFIG_PCIE_RCAR_EP is not set +CONFIG_PCIE_RCAR_HOST=y CONFIG_PCIE_ROCKCHIP=y # CONFIG_PCIE_ROCKCHIP_DW_HOST is not set CONFIG_PCIE_ROCKCHIP_HOST=y @@ -369,6 +403,7 @@ CONFIG_PCIE_XILINX_NWL=y CONFIG_PCI_AARDVARK=y CONFIG_PCI_IMX6=y CONFIG_PCI_LAYERSCAPE=y +# CONFIG_PCI_RCAR_GEN2 is not set CONFIG_PHY_FSL_IMX8MQ_USB=y CONFIG_PHY_HI3660_USB=y CONFIG_PHY_HI3670_USB=y @@ -379,6 +414,10 @@ CONFIG_PHY_MVEBU_A3700_COMPHY=y CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_PHY_MVEBU_A38X_COMPHY=y CONFIG_PHY_MVEBU_CP110_COMPHY=y +# CONFIG_PHY_RCAR_GEN2 is not set +CONFIG_PHY_RCAR_GEN3_PCIE=y +CONFIG_PHY_RCAR_GEN3_USB2=y +CONFIG_PHY_RCAR_GEN3_USB3=y # CONFIG_PHY_ROCKCHIP_DP is not set # CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set CONFIG_PHY_ROCKCHIP_EMMC=y @@ -439,6 +478,10 @@ CONFIG_QCOM_QDF2400_ERRATUM_0065=y CONFIG_QORIQ_THERMAL=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y +# CONFIG_RAVB is not set +CONFIG_RCAR_DMAC=y +# CONFIG_RCAR_GEN3_THERMAL is not set +# CONFIG_RCAR_THERMAL is not set CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y CONFIG_REGULATOR=y @@ -447,7 +490,14 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_HI655X=y CONFIG_REGULATOR_PFUZE100=y # CONFIG_REGULATOR_VEXPRESS is not set +CONFIG_RENESAS_OSTM=y +# CONFIG_RENESAS_RZAWDT is not set +# CONFIG_RENESAS_RZG2LWDT is not set +# CONFIG_RENESAS_RZN1WDT is not set +CONFIG_RENESAS_USB_DMAC=y +# CONFIG_RENESAS_WDT is not set CONFIG_RESET_IMX7=y +CONFIG_RESET_RZG2L_USBPHY_CTRL=y CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_ROCKCHIP_IOMMU=y # CONFIG_ROCKCHIP_MBOX is not set @@ -460,7 +510,11 @@ CONFIG_RODATA_FULL_DEFAULT_ENABLED=y CONFIG_RTC_DRV_MV=y # CONFIG_RTC_DRV_MXC is not set # CONFIG_RTC_DRV_MXC_V2 is not set +# CONFIG_RTC_DRV_SH is not set CONFIG_RTC_I2C_AND_SPI=y +# CONFIG_RZG2L_ADC is not set +# CONFIG_RZG2L_THERMAL is not set +CONFIG_RZ_DMAC=y CONFIG_SATA_AHCI=y CONFIG_SATA_AHCI_PLATFORM=y CONFIG_SATA_HOST=y @@ -478,6 +532,9 @@ CONFIG_SERIAL_MVEBU_UART=y CONFIG_SERIAL_SAMSUNG=y CONFIG_SERIAL_SAMSUNG_CONSOLE=y # CONFIG_SMC91X is not set +# CONFIG_SND_SOC_RCAR is not set +# CONFIG_SND_SOC_RZ is not set +# CONFIG_SND_SOC_SH4_FSI is not set # CONFIG_SND_SUN4I_I2S is not set # CONFIG_SND_SUN50I_CODEC_ANALOG is not set # CONFIG_SND_SUN50I_DMIC is not set @@ -498,6 +555,9 @@ CONFIG_SPI_ARMADA_3700=y # CONFIG_SPI_HISI_SFC_V3XX is not set # CONFIG_SPI_IMX is not set # CONFIG_SPI_ROCKCHIP_SFC is not set +# CONFIG_SPI_RSPI is not set +# CONFIG_SPI_SH_HSPI is not set +# CONFIG_SPI_SH_MSIOF is not set # CONFIG_SPI_SUN4I is not set # CONFIG_SPI_SUN6I is not set # CONFIG_SPI_SYNQUACER is not set @@ -555,13 +615,20 @@ CONFIG_USB_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3_XILINX=y CONFIG_USB_EHCI_FSL=y # CONFIG_USB_EHCI_HCD_ORION is not set +# CONFIG_USB_EMXX is not set CONFIG_USB_MXS_PHY=y +CONFIG_USB_RENESAS_USB3=y +CONFIG_USB_RENESAS_USBHS=y +CONFIG_USB_RENESAS_USBHS_HCD=y +CONFIG_USB_RENESAS_USBHS_UDC=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_HISTB=y CONFIG_USB_XHCI_MVEBU=y CONFIG_USB_XHCI_PLATFORM=y CONFIG_VEXPRESS_CONFIG=y CONFIG_VIDEOMODE_HELPERS=y +# CONFIG_VIDEO_RCAR_CSI2 is not set +# CONFIG_VIDEO_RCAR_VIN is not set # CONFIG_VIDEO_SUN4I_CSI is not set # CONFIG_VIDEO_SUN6I_CSI is not set CONFIG_VIRTIO_DMA_SHARED_BUFFER=y From 24b35fdce9b5f2878f40801c742173a0aa3b01a9 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 20 Jun 2023 03:30:51 +0000 Subject: [PATCH 0379/1171] armsr: armv8: enable Broadcom arch'es This is part of an effort to reduce differences between the OpenWrt armsr/armv8 config and Linux arm64 defconfig. This enables CONFIG_ARCH_BCM and downstream CONFIG_ARCH_BCM2835 (= BCM2711 like Raspberry Pi 4) and CONFIG_ARCH_BCM_IPROC (Broadcom iProc packet processors). The broadband specific SoC's (ARCH_BCMBCA) are left out as it is assumed these will not be doing EFI boot. Signed-off-by: Mathew McBride (23.5/5.15 version of commit df23eed17925b8cadccec53a784a12468a8a2e85) --- target/linux/armsr/armv8/config-5.15 | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index 6642fb86b73164..48ab3763bd6d15 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -1,6 +1,11 @@ CONFIG_64BIT=y CONFIG_ACPI_HMAT=y CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y +CONFIG_ARCH_BCM=y +CONFIG_ARCH_BCM2835=y +# CONFIG_ARCH_BCMBCA is not set +CONFIG_ARCH_BCM_IPROC=y +CONFIG_ARCH_BRCMSTB=y CONFIG_ARCH_HISI=y CONFIG_ARCH_INTEL_SOCFPGA=y CONFIG_ARCH_LAYERSCAPE=y @@ -120,7 +125,24 @@ CONFIG_ATOMIC64_SELFTEST=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y # CONFIG_AXI_DMAC is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BCM2711_THERMAL is not set +CONFIG_BCM2835_MBOX=y +CONFIG_BCM2835_POWER=y +# CONFIG_BCM2835_THERMAL is not set +# CONFIG_BCM2835_VCHIQ is not set +CONFIG_BCM2835_WDT=y +# CONFIG_BCMGENET is not set +# CONFIG_BCM_CYGNUS_PHY is not set +# CONFIG_BCM_FLEXRM_MBOX is not set +# CONFIG_BCM_NS_THERMAL is not set +# CONFIG_BCM_PDC_MBOX is not set +# CONFIG_BCM_SR_THERMAL is not set +CONFIG_BCM_VIDEOCORE=y +# CONFIG_BGMAC_PLATFORM is not set CONFIG_BLK_PM=y +# CONFIG_BRCMSTB_PM is not set +# CONFIG_BRCMSTB_THERMAL is not set +CONFIG_BRCM_USB_PINMAP=y CONFIG_CAVIUM_ERRATUM_22375=y CONFIG_CAVIUM_ERRATUM_23144=y CONFIG_CAVIUM_ERRATUM_23154=y @@ -128,6 +150,10 @@ CONFIG_CAVIUM_ERRATUM_27456=y CONFIG_CAVIUM_ERRATUM_30115=y CONFIG_CAVIUM_TX2_ERRATUM_219=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_CLK_BCM2711_DVP=y +CONFIG_CLK_BCM2835=y +CONFIG_CLK_BCM_NS2=y +CONFIG_CLK_BCM_SR=y CONFIG_CLK_IMX8MM=y CONFIG_CLK_IMX8MN=y CONFIG_CLK_IMX8MP=y @@ -137,6 +163,7 @@ CONFIG_CLK_INTEL_SOCFPGA64=y CONFIG_CLK_LS1028A_PLLDIG=y CONFIG_CLK_PX30=y CONFIG_CLK_QORIQ=y +CONFIG_CLK_RASPBERRYPI=y CONFIG_CLK_RCAR_USB2_CLOCK_SEL=y CONFIG_CLK_RENESAS=y CONFIG_CLK_RK3308=y @@ -194,6 +221,7 @@ CONFIG_CRYPTO_CHACHA20=y CONFIG_CRYPTO_CHACHA20_NEON=y CONFIG_CRYPTO_CRYPTD=y # CONFIG_CRYPTO_DEV_ALLWINNER is not set +# CONFIG_CRYPTO_DEV_BCM_SPU is not set # CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM is not set # CONFIG_CRYPTO_DEV_HISI_HPRE is not set # CONFIG_CRYPTO_DEV_HISI_SEC2 is not set @@ -211,6 +239,7 @@ CONFIG_CRYPTO_SHA2_ARM64_CE=y CONFIG_CRYPTO_SHA512_ARM64=y CONFIG_CRYPTO_SIMD=y # CONFIG_DEV_DAX_HMEM is not set +CONFIG_DMA_BCM2835=y CONFIG_DMA_CMA=y CONFIG_DMA_DIRECT_REMAP=y CONFIG_DMA_SHARED_BUFFER=y @@ -228,6 +257,7 @@ CONFIG_DRM_QXL=y # CONFIG_DRM_RCAR_DU is not set CONFIG_DRM_TTM=y CONFIG_DRM_TTM_HELPER=y +# CONFIG_DRM_V3D is not set CONFIG_DRM_VIRTIO_GPU=y CONFIG_DRM_VRAM_HELPER=y # CONFIG_DWMAC_SUN8I is not set @@ -260,10 +290,13 @@ CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_CSUM=y CONFIG_GENERIC_FIND_FIRST_BIT=y # CONFIG_GIANFAR is not set +CONFIG_GPIO_BCM_XGS_IPROC=y +CONFIG_GPIO_BRCMSTB=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y CONFIG_GPIO_MPC8XXX=y CONFIG_GPIO_MXC=y +CONFIG_GPIO_RASPBERRYPI_EXP=y CONFIG_GPIO_ROCKCHIP=y CONFIG_GPIO_THUNDERX=y CONFIG_GPIO_XLP=y @@ -282,6 +315,7 @@ CONFIG_HW_RANDOM_VIRTIO=y CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_ALTERA=y +# CONFIG_I2C_BCM2835 is not set CONFIG_I2C_BOARDINFO=y # CONFIG_I2C_HIX5HD2 is not set CONFIG_I2C_IMX=y @@ -326,6 +360,8 @@ CONFIG_KVM=y CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_PLATFORM is not set # CONFIG_MAILBOX_TEST is not set +CONFIG_MDIO_BCM_IPROC=y +CONFIG_MDIO_BUS_MUX_BCM_IPROC=y CONFIG_MDIO_SUN4I=y # CONFIG_MFD_ALTERA_A10SR is not set CONFIG_MFD_ALTERA_SYSMGR=y @@ -339,6 +375,7 @@ CONFIG_MFD_SYSCON=y CONFIG_MFD_VEXPRESS_SYSREG=y CONFIG_MMC=y CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_BCM2835=y CONFIG_MMC_BLOCK=y CONFIG_MMC_CAVIUM_THUNDERX=y CONFIG_MMC_DW=y @@ -355,6 +392,7 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ACPI=y CONFIG_MMC_SDHCI_CADENCE=y CONFIG_MMC_SDHCI_ESDHC_IMX=y +CONFIG_MMC_SDHCI_IPROC=y CONFIG_MMC_SDHCI_OF_ESDHC=y CONFIG_MMC_SDHCI_PCI=y CONFIG_MMC_SDHCI_PLTFM=y @@ -390,7 +428,10 @@ CONFIG_NVMEM_ROCKCHIP_EFUSE=y # CONFIG_NVMEM_SUNXI_SID is not set # CONFIG_NVMEM_ZYNQMP is not set CONFIG_PCC=y +CONFIG_PCIE_BRCMSTB=y CONFIG_PCIE_HISI_STB=y +CONFIG_PCIE_IPROC_MSI=y +CONFIG_PCIE_IPROC_PLATFORM=y CONFIG_PCIE_LAYERSCAPE=y CONFIG_PCIE_MOBIVEIL_PLAT=y # CONFIG_PCIE_RCAR_EP is not set @@ -404,6 +445,10 @@ CONFIG_PCI_AARDVARK=y CONFIG_PCI_IMX6=y CONFIG_PCI_LAYERSCAPE=y # CONFIG_PCI_RCAR_GEN2 is not set +CONFIG_PHY_BCM_SR_PCIE=y +CONFIG_PHY_BCM_SR_USB=y +CONFIG_PHY_BRCM_SATA=y +CONFIG_PHY_BRCM_USB=y CONFIG_PHY_FSL_IMX8MQ_USB=y CONFIG_PHY_HI3660_USB=y CONFIG_PHY_HI3670_USB=y @@ -414,6 +459,8 @@ CONFIG_PHY_MVEBU_A3700_COMPHY=y CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_PHY_MVEBU_A38X_COMPHY=y CONFIG_PHY_MVEBU_CP110_COMPHY=y +CONFIG_PHY_NS2_PCIE=y +CONFIG_PHY_NS2_USB_DRD=y # CONFIG_PHY_RCAR_GEN2 is not set CONFIG_PHY_RCAR_GEN3_PCIE=y CONFIG_PHY_RCAR_GEN3_USB2=y @@ -438,6 +485,8 @@ CONFIG_PINCTRL_IMX8MN=y CONFIG_PINCTRL_IMX8MP=y CONFIG_PINCTRL_IMX8MQ=y CONFIG_PINCTRL_IMX8ULP=y +CONFIG_PINCTRL_IPROC_GPIO=y +CONFIG_PINCTRL_NS2_MUX=y CONFIG_PINCTRL_ROCKCHIP=y CONFIG_PINCTRL_SUN4I_A10=y CONFIG_PINCTRL_SUN50I_A100=y @@ -471,6 +520,8 @@ CONFIG_POWER_RESET=y CONFIG_POWER_RESET_HISI=y CONFIG_POWER_RESET_VEXPRESS=y CONFIG_POWER_SUPPLY=y +# CONFIG_PTP_1588_CLOCK_DTE is not set +# CONFIG_PWM_BCM2835 is not set CONFIG_QCOM_FALKOR_ERRATUM_1003=y CONFIG_QCOM_FALKOR_ERRATUM_1009=y CONFIG_QCOM_FALKOR_ERRATUM_E1041=y @@ -478,6 +529,8 @@ CONFIG_QCOM_QDF2400_ERRATUM_0065=y CONFIG_QORIQ_THERMAL=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y +CONFIG_RASPBERRYPI_FIRMWARE=y +CONFIG_RASPBERRYPI_POWER=y # CONFIG_RAVB is not set CONFIG_RCAR_DMAC=y # CONFIG_RCAR_GEN3_THERMAL is not set @@ -496,7 +549,9 @@ CONFIG_RENESAS_OSTM=y # CONFIG_RENESAS_RZN1WDT is not set CONFIG_RENESAS_USB_DMAC=y # CONFIG_RENESAS_WDT is not set +# CONFIG_RESET_BRCMSTB is not set CONFIG_RESET_IMX7=y +# CONFIG_RESET_RASPBERRYPI is not set CONFIG_RESET_RZG2L_USBPHY_CTRL=y CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_ROCKCHIP_IOMMU=y @@ -505,6 +560,7 @@ CONFIG_ROCKCHIP_PM_DOMAINS=y # CONFIG_ROCKCHIP_SARADC is not set # CONFIG_ROCKCHIP_THERMAL is not set CONFIG_RODATA_FULL_DEFAULT_ENABLED=y +# CONFIG_RTC_DRV_BRCMSTB is not set # CONFIG_RTC_DRV_FSL_FTM_ALARM is not set # CONFIG_RTC_DRV_IMXDI is not set CONFIG_RTC_DRV_MV=y @@ -522,6 +578,8 @@ CONFIG_SATA_HOST=y CONFIG_SCHED_MC=y CONFIG_SCHED_SMT=y # CONFIG_SENSORS_ARM_SCPI is not set +CONFIG_SERIAL_8250_BCM2835AUX=y +CONFIG_SERIAL_8250_BCM7271=y # CONFIG_SERIAL_8250_EXAR is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_IMX=y @@ -548,6 +606,7 @@ CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPI_ARMADA_3700=y +# CONFIG_SPI_BCM2835 is not set # CONFIG_SPI_FSL_LPSPI is not set # CONFIG_SPI_FSL_QUADSPI is not set # CONFIG_SPI_HISI_KUNPENG is not set @@ -602,6 +661,7 @@ CONFIG_TYPEC_TCPCI=y CONFIG_TYPEC_TCPM=y # CONFIG_TYPEC_TPS6598X is not set CONFIG_UNMAP_KERNEL_AT_EL0=y +# CONFIG_USB_BRCMSTB is not set CONFIG_USB_CHIPIDEA=y CONFIG_USB_CHIPIDEA_HOST=y CONFIG_USB_CHIPIDEA_IMX=y From daf99a12e18f29b5b2f60ef2cdbd9ac4528acafd Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Thu, 10 Aug 2023 02:05:43 +0000 Subject: [PATCH 0380/1171] armsr: armv8: synchronize PCIE related options with arm64 defconfig This turns on various PCI related options which are enabled in the Linux kernel arch/arm64/configs/defconfig but not yet in the OpenWrt config. Signed-off-by: Mathew McBride (23.05/5.15 version of commit 15d3536c9deb2927c9a39350c6fa2e59f859df2a) --- target/linux/armsr/armv8/config-5.15 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index 48ab3763bd6d15..2ebc77cf8f5e44 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -1,4 +1,5 @@ CONFIG_64BIT=y +CONFIG_ACPI_APEI=y CONFIG_ACPI_HMAT=y CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y CONFIG_ARCH_BCM=y @@ -308,6 +309,12 @@ CONFIG_HISILICON_ERRATUM_161600802=y CONFIG_HISILICON_LPC=y CONFIG_HISI_PMU=y CONFIG_HISI_THERMAL=y +CONFIG_HOTPLUG_PCI=y +CONFIG_HOTPLUG_PCI_ACPI=y +# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set +# CONFIG_HOTPLUG_PCI_CPCI is not set +# CONFIG_HOTPLUG_PCI_PCIE is not set +# CONFIG_HOTPLUG_PCI_SHPC is not set CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y # CONFIG_HW_RANDOM_HISI is not set @@ -428,6 +435,14 @@ CONFIG_NVMEM_ROCKCHIP_EFUSE=y # CONFIG_NVMEM_SUNXI_SID is not set # CONFIG_NVMEM_ZYNQMP is not set CONFIG_PCC=y +CONFIG_PCIEAER=y +CONFIG_PCIEASPM=y +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_PERFORMANCE is not set +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set +CONFIG_PCIEPORTBUS=y +CONFIG_PCIE_ARMADA_8K=y CONFIG_PCIE_BRCMSTB=y CONFIG_PCIE_HISI_STB=y CONFIG_PCIE_IPROC_MSI=y @@ -442,8 +457,13 @@ CONFIG_PCIE_ROCKCHIP_HOST=y CONFIG_PCIE_XILINX_CPM=y CONFIG_PCIE_XILINX_NWL=y CONFIG_PCI_AARDVARK=y +CONFIG_PCI_HISI=y +CONFIG_PCI_HOST_THUNDER_ECAM=y +CONFIG_PCI_HOST_THUNDER_PEM=y CONFIG_PCI_IMX6=y +CONFIG_PCI_IOV=y CONFIG_PCI_LAYERSCAPE=y +CONFIG_PCI_PASID=y # CONFIG_PCI_RCAR_GEN2 is not set CONFIG_PHY_BCM_SR_PCIE=y CONFIG_PHY_BCM_SR_USB=y From dfb159c04b3011ca1b6059430e7790fb0e2b2bc4 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Thu, 10 Aug 2023 04:01:20 +0000 Subject: [PATCH 0381/1171] armsr: armv8: enable AHCI/SATA controllers for mvebu,qoriq,juno When comparing the generated OpenWrt .config to the Linux arm64 defconfig, I noticed these SATA controllers were not included. As they may be used as a boot drive, they should be built into the kernel. CONFIG_SATA_MVEBU is for Marvell platforms. CONFIG_SATA_QORIQ is for NXP Layerscape. CONFIG_SATA_SIL24 is for Arm's Juno development board, see Linux kernel commit d7c38ff1cd86 ("arm64: defconfig: Add Juno SATA controller"). Signed-off-by: Mathew McBride (23.05/5.15 version of commit 9cb173e9f18da2530c3570479567d8130b05e5f8) --- target/linux/armsr/armv8/config-5.15 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/armsr/armv8/config-5.15 b/target/linux/armsr/armv8/config-5.15 index 2ebc77cf8f5e44..20389f5f88874f 100644 --- a/target/linux/armsr/armv8/config-5.15 +++ b/target/linux/armsr/armv8/config-5.15 @@ -1,6 +1,8 @@ CONFIG_64BIT=y CONFIG_ACPI_APEI=y CONFIG_ACPI_HMAT=y +CONFIG_AHCI_MVEBU=y +CONFIG_AHCI_QORIQ=y CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y CONFIG_ARCH_BCM=y CONFIG_ARCH_BCM2835=y @@ -594,6 +596,7 @@ CONFIG_RZ_DMAC=y CONFIG_SATA_AHCI=y CONFIG_SATA_AHCI_PLATFORM=y CONFIG_SATA_HOST=y +CONFIG_SATA_SIL24=y # CONFIG_SCHED_CORE is not set CONFIG_SCHED_MC=y CONFIG_SCHED_SMT=y From 80d1eb4c2a4b57fb24fbb3119c40fa6f7a0f156d Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 23 Jun 2023 05:46:41 +0000 Subject: [PATCH 0382/1171] armsr: armv8: add Broadcom GENET and MDIO modules These are used by common Broadcom SoC's like the BCM2711 (RPi4) and iProc network processor. Tested on the RPi4B using the Raspberry Pi UEFI+ACPI firmware[1]. Signed-off-by: Mathew McBride [1] - https://github.com/pftf/RPi4 (cherry picked from commit 27ca83c6270a4cc6922cdae82bb5c01e4e2d1d22) --- target/linux/armsr/modules.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk index 8b026093ee66f9..6e3450bf886574 100644 --- a/target/linux/armsr/modules.mk +++ b/target/linux/armsr/modules.mk @@ -13,6 +13,28 @@ endef $(eval $(call KernelPackage,acpi-mdio)) +define KernelPackage/bcmgenet + SUBMENU=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armsr_armv8) +kmod-mdio-bcm-unimac + TITLE:=Broadcom GENET internal MAC (Raspberry Pi 4) + KCONFIG:=CONFIG_BCMGENET + FILES=$(LINUX_DIR)/drivers/net/ethernet/broadcom/genet/genet.ko + AUTOLOAD=$(call AutoLoad,30,genet) +endef + +$(eval $(call KernelPackage,bcmgenet)) + +define KernelPackage/mdio-bcm-unimac + SUBMENU=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armsr_armv8) +kmod-of-mdio + TITLE:=Broadcom UniMAC MDIO bus controller + KCONFIG:=CONFIG_MDIO_BCM_UNIMAC + FILES=$(LINUX_DIR)/drivers/net/mdio/mdio-bcm-unimac.ko + AUTOLOAD=$(call AutoLoad,30,mdio-bcm-unimac) +endef + +$(eval $(call KernelPackage,mdio-bcm-unimac)) + define KernelPackage/fsl-pcs-lynx SUBMENU=$(NETWORK_DEVICES_MENU) DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-phylink From 3477c79c6bb4aa23cdaaf426666265d2b773d709 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 7 Aug 2023 05:06:43 +0000 Subject: [PATCH 0383/1171] armsr: armv8: add bcmgenet (Raspberry Pi 4 GENET) to profile kmod-bcmgenet is needed for Ethernet support on the Raspberry Pi 4. Signed-off-by: Mathew McBride (cherry picked from commit 911ee97774d2542300916f0e2763aa54c2a4dff1) --- target/linux/armsr/image/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/armsr/image/Makefile b/target/linux/armsr/image/Makefile index e4ba7988ec131b..9c33fd898ddada 100644 --- a/target/linux/armsr/image/Makefile +++ b/target/linux/armsr/image/Makefile @@ -111,7 +111,8 @@ define Device/generic kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ kmod-dwmac-rockchip kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom \ - kmod-phy-marvell kmod-phy-marvell-10g kmod-atlantic + kmod-phy-marvell kmod-phy-marvell-10g kmod-atlantic \ + kmod-bcmgenet endef TARGET_DEVICES += generic From 2a46bd9a01cf19fc4b0cc8f95c38e95cb608c92d Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 9 Aug 2023 06:36:39 +0000 Subject: [PATCH 0384/1171] armsr: add Marvell (Cavium) ThunderX2 network driver The initial armv8 module incorrectly labelled the Thunder(v1) as supporting the ThunderX2, when they have different drivers. Add kmod-octeon-tx2 to support the newer devices. Signed-off-by: Mathew McBride (cherry picked from commit 7c5bdff9c472a3f008ac15cc1ccb81cd23b20e1f) --- target/linux/armsr/image/Makefile | 2 +- target/linux/armsr/modules.mk | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/target/linux/armsr/image/Makefile b/target/linux/armsr/image/Makefile index 9c33fd898ddada..2548f403306a8d 100644 --- a/target/linux/armsr/image/Makefile +++ b/target/linux/armsr/image/Makefile @@ -112,7 +112,7 @@ define Device/generic kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ kmod-dwmac-rockchip kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom \ kmod-phy-marvell kmod-phy-marvell-10g kmod-atlantic \ - kmod-bcmgenet + kmod-bcmgenet kmod-octeontx2-net endef TARGET_DEVICES += generic diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk index 6e3450bf886574..96f03470fb021f 100644 --- a/target/linux/armsr/modules.mk +++ b/target/linux/armsr/modules.mk @@ -268,8 +268,8 @@ $(eval $(call KernelPackage,dwmac-rockchip)) define KernelPackage/thunderx-net SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell (Cavium) ThunderX/2 network drivers - DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink + TITLE:=Marvell (Cavium) Thunder network drivers + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-of-mdio KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \ CONFIG_THUNDER_NIC_PF \ CONFIG_THUNDER_NIC_VF \ @@ -284,6 +284,24 @@ endef $(eval $(call KernelPackage,thunderx-net)) +define KernelPackage/octeontx2-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell (Cavium) ThunderX2 network drivers + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-of-mdio +kmod-macsec \ + +kmod-ptp + KCONFIG:=CONFIG_OCTEONTX2_MBOX \ + CONFIG_OCTEONTX2_AF \ + CONFIG_OCTEONTX2_PF \ + CONFIG_OCTEONTX2_VF \ + CONFIG_NDC_DIS_DYNAMIC_CACHING=n + FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/af/rvu_mbox.ko \ + $(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/af/rvu_af.ko \ + $(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/rvu_nicpf.ko \ + $(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/rvu_nicvf.ko + AUTOLOAD=$(call AutoLoad,40,rvu_af rvu_mbox rvu_nicpf rvu_nicvf) +endef +$(eval $(call KernelPackage,octeontx2-net)) + define KernelPackage/wdt-sp805 SUBMENU:=$(OTHER_MENU) TITLE:=ARM SP805 Watchdog From 3c316f3e24458eb00c25fc610444186b21c8cf65 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 9 Aug 2023 07:20:07 +0000 Subject: [PATCH 0385/1171] armsr: armv8: package and select MDIO driver for Thunder SoC's This MDIO driver was already being built, but not installed due to being selected by the ThunderX Ethernet driver. Signed-off-by: Mathew McBride (cherry picked from commit 0018b335313ec7d866bf9e22273b620759e29598) --- target/linux/armsr/modules.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk index 96f03470fb021f..c594017ec076bb 100644 --- a/target/linux/armsr/modules.mk +++ b/target/linux/armsr/modules.mk @@ -266,10 +266,22 @@ endef $(eval $(call KernelPackage,dwmac-rockchip)) +define KernelPackage/mdio-thunder + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell (Cavium) Thunder MDIO controller + DEPENDS:=@(TARGET_armsr_armv8) +kmod-of-mdio + KCONFIG:=CONFIG_MDIO_THUNDER + FILES=$(LINUX_DIR)/drivers/net/mdio/mdio-cavium.ko \ + $(LINUX_DIR)/drivers/net/mdio/mdio-thunder.ko + AUTOLOAD=$(call AutoLoad,30,mdio-cavium mdio-thunder) +endef + +$(eval $(call KernelPackage,mdio-thunder)) + define KernelPackage/thunderx-net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell (Cavium) Thunder network drivers - DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-of-mdio + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-mdio-thunder KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \ CONFIG_THUNDER_NIC_PF \ CONFIG_THUNDER_NIC_VF \ From cebed31c1f632f7fbab142574ea1fb9065917fdb Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 14 Aug 2023 06:13:28 +0000 Subject: [PATCH 0386/1171] armsr: armv8: fix invalid symbol value for FSL_ENETC_QOS The kernel FSL_ENETC_QOS option is only a compile time option, it does not result in a separate module being built. Set it to 'y' to resolve a warning from the kernel compile: .config:2654:warning: symbol value 'm' invalid for FSL_ENETC_QOS Signed-off-by: Mathew McBride Fixes: c3151b6f045 ("armvirt: 64: add support for other SystemReady-compatible vendors") (cherry picked from commit 7770d08e2bd28c9c0dc0b3dc0aaf74074ad5772a) --- target/linux/armsr/modules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk index c594017ec076bb..9c7fe0c04ffc9c 100644 --- a/target/linux/armsr/modules.mk +++ b/target/linux/armsr/modules.mk @@ -100,7 +100,7 @@ define KernelPackage/fsl-enetc-net KCONFIG:= \ CONFIG_FSL_ENETC \ CONFIG_FSL_ENETC_VF \ - CONFIG_FSL_ENETC_QOS + CONFIG_FSL_ENETC_QOS=y FILES:= \ $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc.ko \ $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko \ From a506859f60d2a7d5756987602a550d920f17da4d Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Wed, 16 Aug 2023 06:43:18 +0000 Subject: [PATCH 0387/1171] armsr: add kmod-sfp to default device profile This brings the 23.05 branch into parity with the main. kmod-sfp was in the main branch profile but not the 23.05 version. Signed-off-by: Mathew McBride --- target/linux/armsr/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/armsr/image/Makefile b/target/linux/armsr/image/Makefile index 2548f403306a8d..1df9657385dc62 100644 --- a/target/linux/armsr/image/Makefile +++ b/target/linux/armsr/image/Makefile @@ -111,7 +111,7 @@ define Device/generic kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ kmod-dwmac-rockchip kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom \ - kmod-phy-marvell kmod-phy-marvell-10g kmod-atlantic \ + kmod-phy-marvell kmod-phy-marvell-10g kmod-sfp kmod-atlantic \ kmod-bcmgenet kmod-octeontx2-net endef TARGET_DEVICES += generic From 5deed175a5a3fb7a550eae60f5bfdc15180def6c Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 4 Aug 2023 10:03:10 +0300 Subject: [PATCH 0388/1171] hostapd: revert upstream commit to fix #13156 Commit e978072baaca ("Do prune_association only after the STA is authorized") causes issues when an STA roams from one interface to another interface on the same PHY. The mt7915 driver is not able to handle this properly. While the commits fixes a DoS, there are other devices and drivers with the same limitation, so revert to the orginal behavior for now, until we have a better solution in place. Fixes: #13156 Signed-off-by: Stijn Tintel (cherry picked from commit 324673914d42f5fb9b70cc73e955117828b99f3b) --- .../patches/991-Fix-OpenWrt-13156.patch | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch diff --git a/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch new file mode 100644 index 00000000000000..99d800858f55aa --- /dev/null +++ b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch @@ -0,0 +1,63 @@ +From 26cd9bafc1d25e602952ee86cd2a5b8c3a995490 Mon Sep 17 00:00:00 2001 +From: Stijn Tintel +Date: Fri, 28 Jul 2023 16:27:47 +0300 +Subject: [PATCH] Revert "Do prune_association only after the STA is + authorized" + +Commit e978072baaca ("Do prune_association only after the STA is +authorized") causes issues when an STA roams from one interface to +another interface on the same PHY. The mt7915 driver is not able to +handle this properly. While the commits fixes a DoS, there are other +devices and drivers with the same limitation, so revert to the orginal +behavior for now, until we have a better solution in place. + +Ref: https://github.com/openwrt/openwrt/issues/13156 +Signed-off-by: Stijn Tintel +--- + src/ap/hostapd.c | 14 +++++++++++--- + src/ap/sta_info.c | 3 --- + 2 files changed, 11 insertions(+), 6 deletions(-) + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -3615,6 +3615,8 @@ int hostapd_remove_iface(struct hapd_int + void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + int reassoc) + { ++ int mld_assoc_link_id = -1; ++ + if (hapd->tkip_countermeasures) { + hostapd_drv_sta_deauth(hapd, sta->addr, + WLAN_REASON_MICHAEL_MIC_FAILURE); +@@ -3622,10 +3624,16 @@ void hostapd_new_assoc_sta(struct hostap + } + + #ifdef CONFIG_IEEE80211BE +- if (hapd->conf->mld_ap && sta->mld_info.mld_sta && +- sta->mld_assoc_link_id != hapd->mld_link_id) +- return; ++ if (hapd->conf->mld_ap && sta->mld_info.mld_sta) { ++ if (sta->mld_assoc_link_id == hapd->mld_link_id) { ++ mld_assoc_link_id = sta->mld_assoc_link_id; ++ } else { ++ return; ++ } ++ } + #endif /* CONFIG_IEEE80211BE */ ++ if (mld_assoc_link_id != -2) ++ hostapd_prune_associations(hapd, sta->addr, mld_assoc_link_id); + + ap_sta_clear_disconnect_timeouts(hapd, sta); + sta->post_csa_sa_query = 0; +--- a/src/ap/sta_info.c ++++ b/src/ap/sta_info.c +@@ -1318,9 +1318,6 @@ void ap_sta_set_authorized(struct hostap + mld_assoc_link_id = -2; + } + #endif /* CONFIG_IEEE80211BE */ +- if (mld_assoc_link_id != -2) +- hostapd_prune_associations(hapd, sta->addr, +- mld_assoc_link_id); + sta->flags |= WLAN_STA_AUTHORIZED; + } else { + sta->flags &= ~WLAN_STA_AUTHORIZED; From 94cd25cb69805ec9b3ecd5a86ab39196c51e5a2e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 20 Aug 2023 21:50:15 +0200 Subject: [PATCH 0389/1171] OpenWrt v23.05.0-rc3: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..360f3fc3c7367b 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^f84124d247f043d3801ae3cd94095e52284e8736 +src-git luci https://git.openwrt.org/project/luci.git^ef54edad4bc24c207450094b33d6b2ddd83c277c +src-git routing https://git.openwrt.org/feed/routing.git^b844d67864d6486dc8f68054970c5195ec7c45a8 +src-git telephony https://git.openwrt.org/feed/telephony.git^f7fbaea4c7bfe9203b037ad616553c9e5ed12405 diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..c21472727109d4 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc3) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23389-5deed175a5) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc3) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..ea560ec312b2e5 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.0-rc3" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..75b65271833adb --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23389-5deed175a5 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..b4b444e03aa5d4 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1692453666 From b055769a487de4f95b8c8ab9f9a1a024d7b76cb2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 20 Aug 2023 21:50:26 +0200 Subject: [PATCH 0390/1171] OpenWrt v23.05.0-rc3: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index 360f3fc3c7367b..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^f84124d247f043d3801ae3cd94095e52284e8736 -src-git luci https://git.openwrt.org/project/luci.git^ef54edad4bc24c207450094b33d6b2ddd83c277c -src-git routing https://git.openwrt.org/feed/routing.git^b844d67864d6486dc8f68054970c5195ec7c45a8 -src-git telephony https://git.openwrt.org/feed/telephony.git^f7fbaea4c7bfe9203b037ad616553c9e5ed12405 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index c21472727109d4..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc3) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23389-5deed175a5) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc3) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index ea560ec312b2e5..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.0-rc3" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index 75b65271833adb..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23389-5deed175a5 diff --git a/version.date b/version.date deleted file mode 100644 index b4b444e03aa5d4..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1692453666 From e658eee81387c16d7e1de13e0eb0678014139ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Mon, 10 Jul 2023 11:55:30 +0200 Subject: [PATCH 0391/1171] ipq4019: add support for ZTE MF287 Pro aka DreiNeo Pro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ZTE MF287 Pro is a LTE router used (exclusively?) by the network operator "3". It is very similar to the MF287+, but the hardware layout and partition layout have changed quite a bit. Specifications ============== SoC: IPQ4018 RAM: 256MiB Flash: 8MiB SPI-NOR + 128MiB SPI-NAND LAN: 4x GBit LAN LTE: ZTE Cat12 WiFi: 802.11a/b/g/n/ac SoC-integrated USB: 1x 2.0 MAC addresses ============= LAN: from config + 2 WiFi 1: from config WiFi 2: from config + 1 Installation ============ Option 1 - TFTP --------------- TFTP installation using UART is preferred. Disassemble the device and connect serial. Put the initramfs image as openwrt.bin to your TFTP server and configure a static IP of 192.168.1.100. Load the initramfs image by typing: setenv serverip 192.168.1.100 setenv ipaddr 192.168.1.1 tftpboot 0x82000000 openwrt.bin bootm 0x82000000 From this intiramfs boot you can take a backup of the currently installed partitions as no vendor firmware is available for download: ubiattach -m17 cat /dev/ubi0_0 > /tmp/ubi0_0 cat /dev/ubi0_1 > /tmp/ubi0_1 Copy the files /tmp/ubi0_0 and /tmp/ubi0_1 somewhere save. Once booted, transfer the sysupgrade image and run sysupgrade. You might have to delete the stock volumes first: ubirmvol /dev/ubi0 -N ubi_rootfs ubirmvol /dev/ubi0 -N kernel Option 2 - From stock firmware ------------------------------ The installation from stock requires an exploit first. The exploit consists of a backup file that forces the firmware to download telnetd via TFTP from 192.168.0.22 and run it. Once exploited, you can connect via telnet and login as admin:admin. The exploit will be available at the device wiki page. Once inside the stock firmware, you can transfer the -factory.bin file to /tmp by using "scp" from the stock frmware or "tftp". ZTE has blocked writing to the NAND. Fortunately, it's easy to allow write access - you need to read from one file in /proc. Once done, you need to erase the UBI partition and flash OpenWrt. Before performing the operation, make sure that mtd13 is the partition labelled "rootfs" by calling "cat /proc/mtd". Complete commands: cd /tmp tftp -g -r factory.bin 192.168.0.22 cat /proc/driver/sensor_id flash_erase /dev/mtd17 0 0 dd if=/tmp/factory.bin of=/dev/mtdblock17 bs=131072 Afterwards, reboot your device and you should have a working OpenWrt installation. Restore Stock ============= Option 1 - via UART ------------------- Boot an OpenWrt initramfs image via TFTP as for the initial installation. Transfer the two backed-up files to your box to /tmp. Then, run the following commands - replace $kernel_length and $rootfs_size by the size of ubi0_0 and ubi0_1 in bytes. ubiattach -m 17 ubirmvol /dev/ubi0 -N kernel ubirmvol /dev/ubi0 -N rootfs ubirmvol /dev/ubi0 -N rootfs_data ubimkvol /dev/ubi0 -N kernel -s $kernel_length ubimkvol /dev/ubi0 -N ubi_rootfs -s $rootfs_size ubiupdatevol /dev/ubi0_0 /tmp/ubi0_0 ubiupdatevol /dev/ubi0_1 /tmp/ubi0_1 Option 2 - from within OpenWrt ------------------------------ This option requires to flash an initramfs version first so that access to the flash is possible. This can be achieved by sysupgrading to the recovery.bin version and rebooting. Once rebooted, you are again in a default OpenWrt installation, but no partition is mounted. Follow the commands from Option 1 to flash back to stock. LTE Modem ========= The LTE modem is similar to other ZTE devices and controls some more LEDs and battery management. Configuring the connection using uqmi works properly, the modem provides three serial ports and a QMI CDC ethernet interface. Other Notes =========== Contrary to the stock firmware, the USB port on the back can be used. There is one GPIO Switch "Power button blocker" which, if enabled, does not trigger a reset of the SoC if the modem reboots. If disabled, the SoC is rebooted along with the modem. The modem can be rebooted via the exported GPIO "modem-reset" in /sys/class/gpio. Signed-off-by: Andreas Böhler (cherry picked from commit edfe91372adfdaf5ee4e294fb0f5860a16adc551) --- .../ipq40xx/base-files/etc/board.d/02_network | 3 +- .../base-files/etc/board.d/03_gpio_switches | 1 + .../base-files/lib/upgrade/platform.sh | 2 + .../arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi | 183 ++++++++++++ .../arm/boot/dts/qcom-ipq4018-mf287plus.dts | 180 +----------- .../arm/boot/dts/qcom-ipq4018-mf287pro.dts | 265 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 21 +- 7 files changed, 476 insertions(+), 179 deletions(-) create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index c297566dd85de0..77dc892d078874 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -108,7 +108,8 @@ ipq40xx_setup_interfaces() zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; - zte,mf287plus) + zte,mf287plus|\ + zte,mf287pro) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "wan" device "/dev/cdc-wdm0" protocol "qmi" ;; diff --git a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches index f76fe9402df322..2035d84993b7df 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches @@ -36,6 +36,7 @@ wallys,dr40x9) ucidef_add_gpio_switch "sim_card_select" "SIM card select" "423" "0" ;; zte,mf286d|\ +zte,mf287pro|\ zte,mf289f) ucidef_add_gpio_switch "power_btn_block" "Power button blocker" "421" "0" ;; diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 8807f844e59aa3..83aac330ca2dde 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -28,6 +28,7 @@ EOF zte,mf18a |\ zte,mf286d |\ zte,mf287plus |\ + zte,mf287pro |\ zte,mf289f) CI_UBIPART="rootfs" local mtdnum="$( find_mtd_index $CI_UBIPART )" @@ -211,6 +212,7 @@ platform_do_upgrade() { zte,mf18a |\ zte,mf286d |\ zte,mf287plus |\ + zte,mf287pro |\ zte,mf289f) CI_UBIPART="rootfs" nand_do_upgrade "$1" diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi new file mode 100644 index 00000000000000..3cbe2eaa382068 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi @@ -0,0 +1,183 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// Copyright (c) 2022, Pawel Dembicki . +// Copyright (c) 2022, Giammarco Marzano . +// Copyright (c) 2023, Andreas Böhler + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + /* + * bootargs forced by u-boot bootipq command: + * 'ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs rootwait' + */ + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led-0 { + label = "blue:power"; + function = LED_FUNCTION_POWER; + color = ; + }; + }; + + keys { + compatible = "gpio-keys"; + + key_reset: key-reset { + label = "reset"; + linux,code = ; + }; + + key_wps: key-wps { + label = "wps"; + linux,code = ; + }; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + status = "okay"; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + }; +}; + +&mdio { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&blsp_dma { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&gmac { + status = "okay"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_mac_0>; + mac-address-increment = <2>; +}; + +&switch { + status = "okay"; +}; + +&swport2 { + status = "okay"; + + label = "lan1"; +}; + +&swport3 { + status = "okay"; + + label = "lan2"; +}; + +&swport4 { + status = "okay"; + + label = "lan3"; +}; + +&swport5 { + status = "okay"; + + label = "lan4"; +}; + +&qpic_bam { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_1000>, <&macaddr_mac_0>; + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; + +&wifi1 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_5000>, <&macaddr_mac_0>; + mac-address-increment = <1>; + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts index 6c285f4b8adaa4..db8c8c9ad02a9f 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts @@ -3,31 +3,12 @@ // Copyright (c) 2022, Giammarco Marzano . // Copyright (c) 2023, Andreas Böhler -#include "qcom-ipq4019.dtsi" -#include -#include -#include -#include +#include "qcom-ipq4018-mf287.dtsi" / { model = "ZTE MF287Plus"; compatible = "zte,mf287plus"; - aliases { - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; - }; - - chosen { - /* - * bootargs forced by u-boot bootipq command: - * 'ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs rootwait' - */ - bootargs-append = " root=/dev/ubiblock0_1"; - }; - /* * This node is used to restart modem module to avoid anomalous * behaviours on initial communication. @@ -36,85 +17,18 @@ compatible = "gpio-restart"; gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; }; - - leds { - compatible = "gpio-leds"; - - led_status: led-0 { - label = "blue:power"; - function = LED_FUNCTION_POWER; - color = ; - gpios = <&tlmm 0 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - key-reset { - label = "reset"; - linux,code = ; - gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; - }; - - key-wps { - label = "wps"; - linux,code = ; - gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; - }; - }; - - soc { - rng@22000 { - status = "okay"; - }; - - tcsr@1949000 { - compatible = "qcom,tcsr"; - reg = <0x1949000 0x100>; - qcom,wifi_glb_cfg = ; - }; - - tcsr@194b000 { - /* select hostmode */ - compatible = "qcom,tcsr"; - reg = <0x194b000 0x100>; - qcom,usb-hsphy-mode-select = ; - status = "okay"; - }; - - ess_tcsr@1953000 { - compatible = "qcom,tcsr"; - reg = <0x1953000 0x1000>; - qcom,ess-interface-select = ; - }; - - tcsr@1957000 { - compatible = "qcom,tcsr"; - reg = <0x1957000 0x100>; - qcom,wifi_noc_memtype_m0_m2 = ; - }; - }; }; -&mdio { - status = "okay"; +&key_reset { + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; }; -&watchdog { - status = "okay"; +&key_wps { + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; }; -&blsp_dma { - status = "okay"; -}; - -&usb2 { - status = "okay"; -}; - -&usb3 { - status = "okay"; +&led_status { + gpios = <&tlmm 0 GPIO_ACTIVE_LOW>; }; &blsp1_spi1 { @@ -276,59 +190,6 @@ }; }; -&blsp1_uart1 { - pinctrl-0 = <&serial_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&gmac { - status = "okay"; - nvmem-cell-names = "mac-address"; - nvmem-cells = <&macaddr_mac_0>; - mac-address-increment = <2>; -}; - -&switch { - status = "okay"; -}; - -&swport2 { - status = "okay"; - - label = "lan1"; -}; - -&swport3 { - status = "okay"; - - label = "lan2"; -}; - -&swport4 { - status = "okay"; - - label = "lan3"; -}; - -&swport5 { - status = "okay"; - - label = "lan4"; -}; - -&qpic_bam { - status = "okay"; -}; - &tlmm { serial_pins: serial_pinmux { mux { @@ -355,30 +216,3 @@ }; }; }; - -&usb2_hs_phy { - status = "okay"; -}; - -&usb3_ss_phy { - status = "okay"; -}; - -&usb3_hs_phy { - status = "okay"; -}; - -&wifi0 { - status = "okay"; - nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_1000>, <&macaddr_mac_0>; - qcom,ath10k-calibration-variant = "zte,mf287plus"; -}; - -&wifi1 { - status = "okay"; - nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_5000>, <&macaddr_mac_0>; - mac-address-increment = <1>; - qcom,ath10k-calibration-variant = "zte,mf287plus"; -}; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts new file mode 100644 index 00000000000000..dda0f74449b7c6 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts @@ -0,0 +1,265 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// Copyright (c) 2022, Pawel Dembicki . +// Copyright (c) 2022, Giammarco Marzano . +// Copyright (c) 2023, Andreas Böhler + +#include "qcom-ipq4018-mf287.dtsi" + +/ { + model = "ZTE MF287Pro"; + compatible = "zte,mf287pro"; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + modem { + gpio-export,name = "modem-reset"; + gpio-export,output = <0>; + gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>; + }; + }; + + regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "USB_VBUS"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + gpio = <&tlmm 25 GPIO_ACTIVE_LOW>; + }; +}; + +&key_reset { + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; +}; + +&key_wps { + gpios = <&tlmm 68 GPIO_ACTIVE_LOW>; +}; + +&led_status { + gpios = <&tlmm 35 GPIO_ACTIVE_LOW>; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; + reset-delay-us = <2000>; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>, + <&tlmm 54 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "0:QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "0:CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "0:APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = <0xf0000 0xc0000>; + read-only; + }; + + partition@1b0000 { + label = "0:reserved1"; + reg = <0x1b0000 0x50000>; + read-only; + }; + }; + }; + + spi-nand@1 { /* flash@1 ? */ + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = <0x0 0xa0000>; + read-only; + }; + + partition@a0000 { + label = "ART"; + reg = <0xa0000 0x80000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + + partition@120000 { + label = "mac"; + reg = <0x120000 0x80000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mac_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + partition@1a0000 { + label = "reserved2"; + reg = <0x1a0000 0xc0000>; + }; + + partition@260000 { + label = "cfg-param"; + reg = <0x260000 0x400000>; + read-only; + }; + + partition@660000 { + label = "log"; + reg = <0x660000 0x400000>; + }; + + partition@a60000 { + label = "oops"; + reg = <0xa60000 0xa0000>; + }; + + partition@b00000 { + label = "reserved3"; + reg = <0xb00000 0x500000>; + }; + + partition@1000000 { + label = "web"; + reg = <0x1000000 0x800000>; + }; + + partition@1800000 { + label = "rootfs"; + reg = <0x1800000 0x1d00000>; + }; + + partition@3500000 { + label = "data"; + reg = <0x3500000 0x1900000>; + }; + + partition@4e00000 { + label = "fota"; + reg = <0x4e00000 0x3200000>; + }; + }; + }; +}; + +&tlmm { + i2c_0_pins: i2c_0_pinmux { + mux { + pins = "gpio20", "gpio21"; + function = "blsp_i2c0"; + bias-disable; + }; + }; + + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + serial_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio12", "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio12", "gpio54"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 907558302c70dd..7f4806b63d5040 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1162,12 +1162,8 @@ define Device/zte_mf286d endef TARGET_DEVICES += zte_mf286d -define Device/zte_mf287plus +define Device/zte_mf287_common $(call Device/zte_mf28x_common) - DEVICE_DTS_CONFIG := config@ap.dk01.1-c2 - DEVICE_MODEL := MF287Plus - DEVICE_ALT0_VENDOR := ZTE - DEVICE_ALT0_MODEL := MF287 DEVICE_PACKAGES += ipq-wifi-zte_mf287plus SOC := qcom-ipq4018 # The recovery image is used to return back to stock (an initramfs-based image @@ -1178,8 +1174,23 @@ define Device/zte_mf287plus IMAGE/factory.bin := append-ubi IMAGE/recovery.bin := append-squashfs4-fakeroot | sysupgrade-tar kernel=$$$$(BIN_DIR)/openwrt-$$(BOARD)$$(if $$(SUBTARGET),-$$(SUBTARGET))-$$(DEVICE_NAME)-initramfs-zImage.itb rootfs=$$$$@ | append-metadata endef + +define Device/zte_mf287plus + $(call Device/zte_mf287_common) + DEVICE_DTS_CONFIG := config@ap.dk01.1-c2 + DEVICE_MODEL := MF287Plus + DEVICE_ALT0_VENDOR := ZTE + DEVICE_ALT0_MODEL := MF287 +endef TARGET_DEVICES += zte_mf287plus +define Device/zte_mf287pro + $(call Device/zte_mf287_common) + DEVICE_DTS_CONFIG := config@ap.dk04.1-c1 + DEVICE_MODEL := MF287Pro +endef +TARGET_DEVICES += zte_mf287pro + define Device/zte_mf289f $(call Device/zte_mf28x_common) DEVICE_MODEL := MF289F From 9ed01992f3e486405c6ed1c25b7f775ec691b165 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 17 Aug 2023 17:55:26 +0200 Subject: [PATCH 0392/1171] mediatek: add missing packages for Acer Predator W6 Add missing packages for creating the overlay filesystem. Signed-off-by: David Bauer (cherry picked from commit c35ff41ccc31f2ecaea7406830de04bd77940d48) --- target/linux/mediatek/image/filogic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index e008c23c0afcae..b00c9f68971881 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -104,7 +104,7 @@ define Device/acer_predator-w6 DEVICE_DTS := mt7986a-acer-predator-w6 DEVICE_DTS_DIR := ../dts DEVICE_DTS_LOADADDR := 0x47000000 - DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware kmod-mt7916-firmware mt7986-wo-firmware + DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware kmod-mt7916-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs IMAGES := sysupgrade.bin KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_INITRAMFS := kernel-bin | lzma | \ From 99d9519bacb5e7013271358e0d5358c196507040 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 8 Aug 2023 01:04:16 +0200 Subject: [PATCH 0393/1171] mediatek: enable NWA50AX Pro eth LEDs Enable the ethernet LED's on the ZyXEL NWA50AX Pro to show link-state as well as activity. Both LED's are configured pulsing. AMBER | 10/100 GREEN | 1000 A+G | 2500 Signed-off-by: David Bauer (cherry picked from commit 4c0fdad7eabe7a5b81a7a1bd7f38dcadbe4f471a) --- target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts index 75dd84c9d7e564..0898525ab65b31 100644 --- a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts @@ -83,6 +83,9 @@ phy0: ethernet-phy@5 { reg = <5>; compatible = "ethernet-phy-ieee802.3-c45"; + + /* LED0: Amber ; LED1: nc ; LED2: nc ; LED3: Green */ + mxl,led-config = <0x3b0 0x0 0x0 0x3c0>; }; }; From 16aecc12c23235a38e7e09d45b2ceea6fd54a147 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 30 Jun 2023 11:52:37 +0200 Subject: [PATCH 0394/1171] mediatek: filogic: wax220: support factory image Enable building a factory image which can be flashed through the OEM firmware's web interface. It seems that the web interface requires a minimum file size of 10MiB, otherwise it will not accept the image. The update image is a regular sysupgrade tarball packed in a Netgear encrypted image. The Netgear encrypted image is the same as used in WAX202 or WAX206, including the encryption keys and IV. This adds a script which creates the rootfs_data volume on first startup. This is required since the OEM firmware's sysupgrade scripts do not create such a paritition. Note that any script ordered after 70_initramfs_test will not get executed on initramfs. Hence this new script 75_rootfs_prepare won't create the rootfs_data volume when using the recovery initramfs. Also, this deletes the kernel_backup and rootfs_backup volumes in case we have to create the rootfs_data volumes. This makes sure that OpenWrt is the actual backup firmware instead of the stock firmware. References in WAX220 GPL source: https://www.downloads.netgear.com/files/GPL/WAX220-V1.0.2.8-gpl-src.tar.gz * package/base-files/files/lib/upgrade/nand.sh:186 Creation of rootfs_data is disabled * Uboot-upstream/board/mediatek/common/ubi_helper.c Automatic creation of UBI backup volumes Signed-off-by: Stefan Agner (cherry picked from commit fa9d977f979461628161085dcd0e9dd8b9e2c66b) --- .../base-files/lib/preinit/75_rootfs_prepare | 35 +++++++++++++++++++ target/linux/mediatek/image/filogic.mk | 16 +++++---- 2 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/75_rootfs_prepare diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/75_rootfs_prepare b/target/linux/mediatek/filogic/base-files/lib/preinit/75_rootfs_prepare new file mode 100644 index 00000000000000..0a32073e0b0203 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/75_rootfs_prepare @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause + +rootfs_create() { + local blocks + + blocks=$(cat /sys/class/ubi/ubi0/avail_eraseblocks) + [ -z "$blocks" ] && { + echo "Failed to read amount of available erase blocks" >&2 + return + } + + # Delete after getting available blocks: Make sure enough space is + # left to recreate these volumes. + ubirmvol /dev/ubi0 -N kernel_backup + ubirmvol /dev/ubi0 -N rootfs_backup + + # Use 90% of remaining flash size for "rootfs_data" + ubimkvol /dev/ubi0 -n 20 -N rootfs_data --lebs $((blocks / 100 * 90)) + mknod -m 0600 /dev/ubi0_20 c 250 21 +} + +rootfs_prepare() { + case $(board_name) in + netgear,wax220) + if ! ubinfo /dev/ubi0 -N rootfs_data &>/dev/null; then + echo "Creating \"rootfs_data\" UBI volume" + rootfs_create + fi + ;; + *) + ;; + esac +} + +boot_hook_add preinit_main rootfs_prepare diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index b00c9f68971881..f61efca05ef1c9 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -225,18 +225,20 @@ endef TARGET_DEVICES += h3c_magic-nx30-pro define Device/netgear_wax220 - DEVICE_VENDOR := Netgear + DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WAX220 DEVICE_DTS := mt7986b-netgear-wax220 DEVICE_DTS_DIR := ../dts + NETGEAR_ENC_MODEL := WAX220 + NETGEAR_ENC_REGION := US DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware - IMAGES := sysupgrade.bin - KERNEL_IN_UBI := 1 - KERNEL := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + IMAGE_SIZE := 32768k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGES += factory.img + # Padding to 10M seems to be required by OEM web interface + IMAGE/factory.img := sysupgrade-tar | \ + pad-to 10M | check-size | netgear-encrypted-factory endef TARGET_DEVICES += netgear_wax220 From f445c382637111c212131e3f14708d27f6bc60ca Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 30 Jun 2023 12:34:38 +0200 Subject: [PATCH 0395/1171] mediatek: filogic: wax220: cleanup device tree Fix compatible string to match what is supported upstream, fix alignment and order MTD partitions according to offset. Signed-off-by: Stefan Agner (cherry picked from commit 4af06aaf33c9256a5d3e960fa5f6bddab2674c5a) --- .../uboot-envtools/files/mediatek_filogic | 2 +- .../mediatek/dts/mt7986b-netgear-wax220.dts | 97 +++++++++---------- 2 files changed, 47 insertions(+), 52 deletions(-) diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 4fb1af82183eee..f13beed526d1da 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -45,7 +45,7 @@ mercusys,mr90x-v1) ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" ;; netgear,wax220) - ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x20000" "0x20000" + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ diff --git a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts index ac2a4b08246eca..09fdf677869e77 100644 --- a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts +++ b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts @@ -8,10 +8,8 @@ #include "mt7986b.dtsi" / { - #address-cells = <0x2>; - #size-cells = <0x2>; model = "Netgear WAX220"; - compatible = "netgear,wax220", "mediatek,mt7986b-spim-snand-rfb"; + compatible = "netgear,wax220", "mediatek,mt7986b"; aliases { serial0 = &uart0; @@ -106,8 +104,6 @@ }; &mdio { - #address-cells = <1>; - #size-cells = <0>; phy6: ethernet-phy@6 { reg = <6>; reset-assert-us = <100000>; @@ -120,7 +116,6 @@ }; }; - &pio { spi_flash_pins: spi-flash-pins-33-to-38 { mux { @@ -145,13 +140,13 @@ groups = "wf_2g", "wf_5g"; }; conf { - pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", - "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", - "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", - "WF1_TOP_CLK", "WF1_TOP_DATA"; + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; drive-strength = <4>; }; }; @@ -163,9 +158,9 @@ }; conf { pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA"; + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA"; drive-strength = <4>; }; }; @@ -196,19 +191,15 @@ #size-cells = <0x1>; compatible = "fixed-partitions"; - partition@5fc0000 { - label = "Traffic"; - reg = <0x5fc0000 0x200000>; - }; - - partition@63c0000 { - label = "NTGRcryptD"; - reg = <0x63c0000 0x500000>; + partition@0 { + label = "BL2"; + read-only; + reg = <0x0 0x100000>; }; - partition@580000 { - label = "ubi"; - reg = <0x580000 0x5140000>; + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; }; factory: partition@180000 { @@ -216,19 +207,19 @@ reg = <0x180000 0x200000>; }; - partition@69c0000 { - label = "User_data"; - reg = <0x69c0000 0x640000>; + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; }; - partition@100000 { - label = "u-boot-env"; - reg = <0x100000 0x80000>; + partition@580000 { + label = "ubi"; + reg = <0x580000 0x5140000>; }; - partition@68c0000 { - label = "LOG"; - reg = <0x68c0000 0x100000>; + partition@56c0000 { + label = "RAE"; + reg = <0x56c0000 0x400000>; }; partition@5ac0000 { @@ -236,35 +227,39 @@ reg = <0x5ac0000 0x100000>; }; - partition@0 { - label = "BL2"; - read-only; - reg = <0x0 0x100000>; - }; - partition@5bc0000 { label = "Language"; reg = <0x5bc0000 0x400000>; }; + partition@5fc0000 { + label = "Traffic"; + reg = <0x5fc0000 0x200000>; + }; + partition@61c0000 { label = "Cert"; reg = <0x61c0000 0x100000>; }; - partition@380000 { - label = "FIP"; - reg = <0x380000 0x200000>; + partition@62c0000 { + label = "NTGRcryptK"; + reg = <0x62c0000 0x100000>; }; - partition@56c0000 { - label = "RAE"; - reg = <0x56c0000 0x400000>; + partition@63c0000 { + label = "NTGRcryptD"; + reg = <0x63c0000 0x500000>; }; - partition@62c0000 { - label = "NTGRcryptK"; - reg = <0x62c0000 0x100000>; + partition@68c0000 { + label = "LOG"; + reg = <0x68c0000 0x100000>; + }; + + partition@69c0000 { + label = "User_data"; + reg = <0x69c0000 0x640000>; }; }; }; From 7eda621404627ea244f770b36c20c71ff942e7cf Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 9 Jul 2023 22:10:53 +0800 Subject: [PATCH 0396/1171] ath79: rework Netgear nand devices image recipe In Netgear u-boot GPL code, nand devices uses this formula to locate the rootfs offset. offset = (((128 + KERNEL_SIZE) / BLOCK_SIZE) + 1) * BLOCK_SIZE; Howerver, WNDR4500 source code incorrectly define the nand block size to 64k. In some cases, it causes u-boot can't get the correct rootfs offset, which result in boot failure. This patch workaround it by padding kernel size to (128k * n - 128 - 1). The additional char '\0' is used to ensure the (128 + KERNEL_SIZE) can't be divided by the BLOCK_SIZE. Fixes: https://github.com/openwrt/openwrt/issues/13050 Fixes: 3c1512a25d92 ("ath79: optimize the firmware recipe for Netgear NAND devices") Tested-by: Yousaf Signed-off-by: Shiji Yang (cherry picked from commit 0f9b8aa3f592b22e3f1d5f7d049e92653ba0f884) --- target/linux/ath79/image/nand.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 84a589809f0cda..884a9da756250b 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -285,7 +285,7 @@ define Device/meraki_mr18 endef TARGET_DEVICES += meraki_mr18 -# fake rootfs is mandatory, pad-offset 64 equals (1 * uimage_header) +# fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + '\0') define Device/netgear_ath79_nand DEVICE_VENDOR := NETGEAR DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport @@ -293,8 +293,9 @@ define Device/netgear_ath79_nand BLOCKSIZE := 128k PAGESIZE := 2048 IMAGE_SIZE := 25600k - KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | \ - pad-offset $$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC) + KERNEL := kernel-bin | append-dtb | lzma | \ + pad-offset $$(BLOCKSIZE) 129 | uImage lzma | pad-extra 1 | \ + append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC) IMAGES := sysupgrade.bin factory.img IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ append-ubi | check-size | netgear-dni From d792d20832ee160563ce23b49edd6f149db10a35 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 9 Jul 2023 22:10:54 +0800 Subject: [PATCH 0397/1171] ath79: fix first reboot issue on Netgear WNDR4300 v2 and WNDR4500 v3 From the Netgear u-boot GPL code[1]. Bootloader always unconditionally marks block 768, 1020 - 1023 as bad blocks on each boot. This may lead to conflicts with the OpenWrt nand driver since these blocks may be good blocks. In this case, U-boot will override the oob of these blocks so that break the ubi volume. The system will be damaged after first reboot. To avoid this issue, manually skip these blocks by using "mtd-concat". [1] https://www.downloads.netgear.com/files/GPL/EX7300v2series-V1.0.0.146_gpl_src.tar.bz2.zip Fixes: https://github.com/openwrt/openwrt/issues/8878 Tested-by: Yousaf Signed-off-by: Shiji Yang (cherry picked from commit 12f53724c6575245cf8b2f0dc75d1b9b2e4fe488) --- .../linux/ath79/dts/qca9563_netgear_wndr.dtsi | 32 +++++++++++++++++-- target/linux/ath79/image/nand.mk | 6 ++++ .../base-files/etc/board.d/05_compat-version | 15 +++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 target/linux/ath79/nand/base-files/etc/board.d/05_compat-version diff --git a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi index a51fb1964b0432..799297f4e15ffc 100644 --- a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi +++ b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi @@ -90,6 +90,22 @@ linux,default-trigger = "phy1tpt"; }; }; + + ubi-concat { + compatible = "mtd-concat"; + devices = <&ubiconcat0 &ubiconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x0>; + }; + }; + }; }; &spi { @@ -165,10 +181,20 @@ reg = <0x0 0x400000>; }; - partition@400000 { - label = "ubi"; - reg = <0x400000 0x7c00000>; + ubiconcat0: partition@400000 { + label = "ubiconcat0"; + reg = <0x400000 0x5c00000>; + }; + + ubiconcat1: partition@6020000 { + label = "ubiconcat1"; + reg = <0x6020000 0x1f60000>; }; + /* + * U-boot always unconditionally marks block 768, 1020 - 1023 as + * bad blocks on each boot. To avoid conflicts with the nand + * driver, manually skip them. + */ }; }; }; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 884a9da756250b..e4ee5554512cae 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -373,6 +373,9 @@ TARGET_DEVICES += netgear_wndr4300tn define Device/netgear_wndr4300-v2 SOC := qca9563 + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Partition table has been changed to fix the \ + first reboot issue. Please reflash factory image with nmrp or tftp. DEVICE_MODEL := WNDR4300 DEVICE_VARIANT := v2 UIMAGE_MAGIC := 0x27051956 @@ -384,6 +387,9 @@ TARGET_DEVICES += netgear_wndr4300-v2 define Device/netgear_wndr4500-v3 SOC := qca9563 + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Partition table has been changed to fix the \ + first reboot issue. Please reflash factory image with nmrp or tftp. DEVICE_MODEL := WNDR4500 DEVICE_VARIANT := v3 UIMAGE_MAGIC := 0x27051956 diff --git a/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version new file mode 100644 index 00000000000000..238927aa7b474c --- /dev/null +++ b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version @@ -0,0 +1,15 @@ +. /lib/functions.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + netgear,wndr4300-v2|\ + netgear,wndr4500-v3) + ucidef_set_compat_version "1.1" + ;; +esac + +board_config_flush + +exit 0 From e74a4b509fd970818086d749caf1d8e68a4f4f7b Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 25 Aug 2023 21:38:13 +0200 Subject: [PATCH 0398/1171] mediatek: enable NMBM remapping for NWA50AX Pro UBI Don't skip remapping of the UBI area for the ZyXEL NWA50AX Pro. This is due to the kernel being loaded from the UBI partition by U-Boot. Link: https://github.com/openwrt/openwrt/pull/13335 Signed-off-by: David Bauer (cherry picked from commit 6dc0675e5b9d59a882972b8d478ee9fa8496ae51) --- target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts index 0898525ab65b31..a7626d51a491f8 100644 --- a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts @@ -114,10 +114,6 @@ mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; - mediatek,bmt-remap-range = - <0x0 0x580000>, - <0xef00000 0xef80000>; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; From 104178a990d1bf72fae73deeb26f37346575205b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 26 Jul 2023 13:20:43 +0200 Subject: [PATCH 0399/1171] mt76: update to the latest version bdf7ca5db707 wifi: mt76: mt7921: move common register definition in mt792x_regs.h ae15d5c6b567 wifi: mt76: mt7921: convert acpisar and clc pointers to void 02515b6b90f0 wifi: mt76: mt7921: rename mt7921_vif in mt792x_vif 6ed8a8bdc7b6 wifi: mt76: mt7921: rename mt7921_sta in mt792x_sta 80234e64e7c5 wifi: mt76: mt7921: rename mt7921_phy in mt792x_phy 2485b4222d3d wifi: mt76: mt7921: rename mt7921_dev in mt792x_dev c6fd7cde77e0 wifi: mt76: mt7921: rename mt7921_hif_ops in mt792x_hif_ops 1a1a57b5f8c4 wifi: mt76: mt792x: move shared structure definition in mt792x.h 68508aab4241 wifi: mt76: mt7921: move mt792x_mutex_{acquire/release} in mt792x.h ff306af07e65 wifi: mt76: mt7921: move mt792x_hw_dev in mt792x.h 4b49d659acab wifi: mt76: mt7921: Replace fake flex-arrays with flexible-array members 93f821cce8f5 wifi: mt76: mt792x: introduce mt792x-lib module de7b90721280 wifi: mt76: mt7921: move mac shared code in mt792x-lib module c68ee8a64bef wifi: mt76: mt7921: move dma shared code in mt792x-lib module 8d561811f271 wifi: mt76: mt7921: move debugfs shared code in mt792x-lib module 0034ae289046 wifi: mt76: mt7921: move init shared code in mt792x-lib module 8419c4e793a7 wifi: mt76: mt792x: introduce mt792x_irq_map b7c7fadf228c wifi: mt76: mt792x: move more dma shared code in mt792x_dma 0b1603ce707c wifi: mt76: mt7921: move hif_ops macro in mt792x.h e07540abe87a wifi: mt76: mt7921: move shared runtime-pm code on mt792x-lib 3d65cd7a8dad wifi: mt76: mt7921: move runtime-pm pci code in mt792x-lib 4551f8c838e6 wifi: mt76: mt7921: move acpi_sar code in mt792x-lib module bd84b8ebaff8 wifi: mt76: mt792x: introduce mt792x-usb module 7067ea0f1bab wifi: mt76: mt792x: move mt7921_load_firmware in mt792x-lib module cf752af84c35 wifi: mt76: mt76_connac3: move lmac queue enumeration in mt76_connac3_mac.h 700041dcf773 wifi: mt76: mt792x: move MT7921_PM_TIMEOUT and MT7921_HW_SCAN_TIMEOUT in common code 58b2b90ad89b wifi: mt76: mt7921: move mt7921_dma_init in pci.c 9e4cb87a04cf wifi: mt76: mt7921: move mt7921u_disconnect mt792x-lib c19b62fe6b68 wifi: mt76: testmode: add nla_policy for MT76_TM_ATTR_TX_LENGTH 4904ab2f87cd wifi: mt76: fix return value check in mt76x02_mac_process_rx 1f0fbbee359c wifi: mt76: mt7915: fix tlv length of mt7915_mcu_get_chan_mib_info 24a54ee3a5ec wifi: mt76: mt7915: fix power-limits while chan_switch 80b8bcf0e3ea wifi: mt76: mt7603: rework/fix rx pse hang check a8d9553d8fc4 wifi: mt76: mt7603: improve watchdog reset reliablity c03d84c0d018 wifi: mt76: mt7603: improve stuck beacon handling 85cc58378d25 wifi: mt76: mt7603: add missing register initialization for MT7628 b14c2351ddb8 wifi: mt76: mt7603: disable A-MSDU tx support on MT7628 Signed-off-by: Felix Fietkau (cherry picked from commit 6b3737be323f702d5c1c5533db7d7351603dad0f) --- package/kernel/mt76/Makefile | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 42d0e6a070f2c5..78f01c119fbfda 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-07-26 -PKG_SOURCE_VERSION:=cd3dfe39276905307cc028ac8edf2c06963cda23 -PKG_MIRROR_HASH:=413d2d0faa81d834ba13cb9e503e1e3a61e3e071014da6b525a123e5da053f90 +PKG_SOURCE_DATE:=2023-08-14 +PKG_SOURCE_VERSION:=b14c2351ddb8601c322576d84029e463d456caef +PKG_MIRROR_HASH:=62b5e157ad525424b6857e77ed373e8d39d03af71b057f8b309d8b293d6eac5f PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 @@ -262,18 +262,34 @@ define KernelPackage/mt7921-firmware TITLE:=MediaTek MT7921 firmware endef +define KernelPackage/mt792x-common + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT792x wireless driver common code + HIDDEN:=1 + DEPENDS+=+kmod-mt76-connac +@DRIVER_11AX_SUPPORT + FILES:= $(PKG_BUILD_DIR)/mt792x-lib.ko +endef + +define KernelPackage/mt792x-usb + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT792x wireless driver USB code + HIDDEN:=1 + DEPENDS+=+kmod-mt792x-common +kmod-mt76-usb +@DRIVER_11AX_SUPPORT + FILES:= $(PKG_BUILD_DIR)/mt792x-usb.ko +endef + define KernelPackage/mt7921-common $(KernelPackage/mt76-default) - TITLE:=MediaTek MT7615 wireless driver common code + TITLE:=MediaTek MT7921 wireless driver common code HIDDEN:=1 - DEPENDS+=+kmod-mt76-connac +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT +kmod-hwmon-core + DEPENDS+=+kmod-mt792x-common +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT +kmod-hwmon-core FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921-common.ko endef define KernelPackage/mt7921u $(KernelPackage/mt76-default) TITLE:=MediaTek MT7921U wireless driver - DEPENDS+=+kmod-mt76-usb +kmod-mt7921-common + DEPENDS+=+kmod-mt792x-usb +kmod-mt7921-common FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921u.ko AUTOLOAD:=$(call AutoProbe,mt7921u) endef @@ -384,6 +400,12 @@ ifdef CONFIG_PACKAGE_kmod-mt7915e NOSTDINC_FLAGS += -DCONFIG_MT798X_WMAC endif endif +ifdef CONFIG_PACKAGE_kmod-mt792x-common + PKG_MAKE_FLAGS += CONFIG_MT792x_LIB=m +endif +ifdef CONFIG_PACKAGE_kmod-mt792x-usb + PKG_MAKE_FLAGS += CONFIG_MT792x_USB=m +endif ifdef CONFIG_PACKAGE_kmod-mt7921-common PKG_MAKE_FLAGS += CONFIG_MT7921_COMMON=m endif @@ -566,6 +588,8 @@ $(eval $(call KernelPackage,mt7916-firmware)) $(eval $(call KernelPackage,mt7981-firmware)) $(eval $(call KernelPackage,mt7986-firmware)) $(eval $(call KernelPackage,mt7921-firmware)) +$(eval $(call KernelPackage,mt792x-common)) +$(eval $(call KernelPackage,mt792x-usb)) $(eval $(call KernelPackage,mt7921-common)) $(eval $(call KernelPackage,mt7921u)) $(eval $(call KernelPackage,mt7921s)) From b9c94686f728b954c90c71cdbe4b18b134f1fe1d Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 27 Aug 2023 12:18:45 +0200 Subject: [PATCH 0400/1171] Revert "ath11k-firmware: update to stable WLAN.HK.2.9.0.1-01837" This reverts commit 23953cfa5afa2e8cd9e1c1475d065cb954d8ceb6. 01837 seems to be having multiple issues, one being broken multicast so lets revert to the last version that was better for the stable branch. Signed-off-by: Robert Marko --- package/firmware/ath11k-firmware/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/firmware/ath11k-firmware/Makefile b/package/firmware/ath11k-firmware/Makefile index 7acc233b6fc889..fc7968a95764a4 100644 --- a/package/firmware/ath11k-firmware/Makefile +++ b/package/firmware/ath11k-firmware/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath11k-firmware -PKG_SOURCE_DATE:=2023-07-06 -PKG_SOURCE_VERSION:=69f6b7346b64784188dba791a9cfb614eefa441f -PKG_MIRROR_HASH:=0f0203f755cb6713f6a1f41397dcd0f1a24e5cdbe75258af961343b927ebb3e9 +PKG_SOURCE_DATE:=2023-03-31 +PKG_SOURCE_VERSION:=a039049a9349722fa5c74185452ab04644a0d351 +PKG_MIRROR_HASH:=ed401e3f6e91d70565b3396139193f7e815f410db93700697205ac8ed1b828c5 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -60,14 +60,14 @@ $(eval $(call Download,qcn9074-board)) define Package/ath11k-firmware-ipq8074/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ8074 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/2.9.0.1/WLAN.HK.2.9.0.1-01837-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/testing/2.9.0.1/WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/IPQ8074/ endef define Package/ath11k-firmware-qcn9074/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/QCN9074/hw1.0 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-01837-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/testing/2.9.0.1/WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/ath11k/QCN9074/hw1.0/ $(INSTALL_BIN) \ $(DL_DIR)/$(QCN9074_BOARD_FILE) $(1)/lib/firmware/ath11k/QCN9074/hw1.0/board-2.bin From f493987d13fb4cbd47a8528d691744ade4ff9503 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 19 Jul 2023 08:33:32 +0200 Subject: [PATCH 0401/1171] nettle: update to 3.9.1 Announcement: https://lists.gnu.org/archive/html/info-gnu/2023-06/msg00000.html Signed-off-by: Nick Hainke (cherry picked from commit fabd8915698d9fb21aa80100a51e097505b61225) --- package/libs/nettle/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/nettle/Makefile b/package/libs/nettle/Makefile index 36410920b99314..e8dcb8ba9139b8 100644 --- a/package/libs/nettle/Makefile +++ b/package/libs/nettle/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nettle -PKG_VERSION:=3.9 +PKG_VERSION:=3.9.1 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/nettle -PKG_HASH:=0ee7adf5a7201610bb7fe0acbb7c9b3be83be44904dd35ebbcd965cd896bfeaa +PKG_HASH:=ccfeff981b0ca71bbd6fbcb054f407c60ffb644389a5be80d6716d5b550c6ce3 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING From 736e3b81aacda08a0afe72ae927d7b5d89e29bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 25 Jul 2023 09:51:35 +0200 Subject: [PATCH 0402/1171] urngd: update to the latest master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7aefb47 jitterentropy-rngd: update to the v1.2.0 What's interesting about jitterentropy-rngd v1.2.0 release is that it bumps its copy of jitterentropy-library from v2.2.0 to the v3.0.0. That bump includes a relevant commit 3130cd9 ("replace LSFR with SHA-3 256"). When initializing entropy jent calculates time delta. Time values are obtained using clock_gettime() + CLOCK_REALTIME. There is no guarantee from CLOCK_REALTIME of unique values and slow devices often return duplicated ones. A switch from jent_lfsr_time() to jent_hash_time() resulted in many less cases of zero delta and avoids ECOARSETIME. Long story short: on some system this fixes: [ 6.722725] urngd: jent-rng init failed, err: 2 This is important change for BCM53573 which doesn't include hwrng and seems to have arch_timer running at 36,8 Hz. Signed-off-by: Rafał Miłecki (cherry picked from commit c74b5e09e692839b39c8325b5f8dc5f2a3b3896c) --- package/system/urngd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/urngd/Makefile b/package/system/urngd/Makefile index 8350f7ceb99c1c..818f06b210db1f 100644 --- a/package/system/urngd/Makefile +++ b/package/system/urngd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/urngd.git -PKG_SOURCE_DATE:=2020-01-21 -PKG_SOURCE_VERSION:=c7f7b6b65b82eda4675b42d8cd28d76ea7aebf1a -PKG_MIRROR_HASH:=2d31025b79fe130c579d6c3f4bf4dc12abc43a7319b20a5cdca24ae363ec70f3 +PKG_SOURCE_DATE:=2023-07-25 +PKG_SOURCE_VERSION:=7aefb47be57df0467d97d539f7fe9e23e607a3b4 +PKG_MIRROR_HASH:=427d4228fd65cf4320b8c212e710b86bcbfcdd4239f4e67132b3b471f7437202 PKG_LICENSE:=GPL-2.0 BSD-3-Clause PKG_LICENSE_FILES:= From 56827dac01b624f769ade541b8b2957fa10ffe79 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 1 Sep 2023 12:43:09 +0200 Subject: [PATCH 0403/1171] kernel: allow adding devices without hw offload to a hw flowtable This allows supporting a mix of devices with or without hw offloading support Signed-off-by: Felix Fietkau (cherry picked from commit c5b7be83168644f3cfadc7b0fbe471e1664b1069) --- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch diff --git a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch new file mode 100644 index 00000000000000..ba847d5f8a982e --- /dev/null +++ b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -0,0 +1,29 @@ +From: Felix Fietkau +Date: Thu, 31 Aug 2023 21:48:38 +0200 +Subject: [PATCH] netfilter: nf_tables: ignore -EOPNOTSUPP on flowtable device + offload setup + +On many embedded devices, it is common to configure flowtable offloading for +a mix of different devices, some of which have hardware offload support and +some of which don't. +The current code limits the ability of user space to properly set up such a +configuration by only allowing adding devices with hardware offload support to +a offload-enabled flowtable. +Given that offload-enabled flowtables also imply fallback to pure software +offloading, this limitation makes little sense. +Fix it by not bailing out when the offload setup returns -EOPNOTSUPP + +Signed-off-by: Felix Fietkau +--- + +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -7729,7 +7729,7 @@ static int nft_register_flowtable_net_ho + err = flowtable->data.type->setup(&flowtable->data, + hook->ops.dev, + FLOW_BLOCK_BIND); +- if (err < 0) ++ if (err < 0 && err != -EOPNOTSUPP) + goto err_unregister_net_hooks; + + err = nf_register_net_hook(net, &hook->ops); From 3c1721ae035882cde4552dd9257b6d62031381ad Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 26 Aug 2023 12:56:53 -0400 Subject: [PATCH 0404/1171] kernel: bump 5.15 to 5.15.128 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.128 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit e80a3875172178cdcc02d13826717413cc1534a8) [Refresh on OpenWrt 23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 ++-- .../950-0070-MMC-added-alternative-MMC-driver.patch | 6 +++--- ...d-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch | 4 ++-- ...y-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch | 6 +++--- ...uetooth-btusb-Support-public-address-configuration.patch | 4 ++-- ...uetooth-btusb-Fix-application-of-sizeof-to-pointer.patch | 2 +- .../711-net-dsa-mv88e6xxx-disable-ATU-violation.patch | 2 +- ...sa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index c1c1e791f71873..0f6e5c09d04ff4 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .127 -LINUX_KERNEL_HASH-5.15.127 = add0a575341b263a06e93599fc220a5dd34cb4ca5b9d05097a5db2a061928f26 +LINUX_VERSION-5.15 = .128 +LINUX_KERNEL_HASH-5.15.128 = 0f2eca845183fd76f53b0c867c97f12b9ace2d7e8ee2cdeec7eb2897651b80de diff --git a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch index 182cf1b9980a20..d7368a0ba4eb1f 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch @@ -244,7 +244,7 @@ bcm2835-mmc: uninitialized_var is no more static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, -@@ -2941,6 +2948,8 @@ static int mmc_blk_probe(struct mmc_card +@@ -2942,6 +2949,8 @@ static int mmc_blk_probe(struct mmc_card { struct mmc_blk_data *md; int ret = 0; @@ -253,7 +253,7 @@ bcm2835-mmc: uninitialized_var is no more /* * Check that the card supports the command class(es) we need. -@@ -2948,7 +2957,16 @@ static int mmc_blk_probe(struct mmc_card +@@ -2949,7 +2958,16 @@ static int mmc_blk_probe(struct mmc_card if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; @@ -271,7 +271,7 @@ bcm2835-mmc: uninitialized_var is no more card->complete_wq = alloc_workqueue("mmc_complete", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); -@@ -2963,6 +2981,17 @@ static int mmc_blk_probe(struct mmc_card +@@ -2964,6 +2982,17 @@ static int mmc_blk_probe(struct mmc_card goto out_free; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 82085e6ff56fde..f00f2e7b23f3f4 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch @@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell #define USB_VENDOR_ID_BELKIN 0x050d #define USB_DEVICE_ID_FLIP_KVM 0x3201 -@@ -1317,6 +1320,9 @@ +@@ -1318,6 +1321,9 @@ #define USB_VENDOR_ID_XAT 0x2505 #define USB_DEVICE_ID_XAT_CSR 0x0220 @@ -53,7 +53,7 @@ Signed-off-by: Jonathan Bell { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL }, -@@ -197,6 +198,7 @@ static const struct hid_device_id hid_qu +@@ -198,6 +199,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_GROUP_AUDIO), HID_QUIRK_NOGET }, diff --git a/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch b/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch index 3284d0d29b6670..46397c0ca82c9e 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell return; val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3); -@@ -753,7 +754,7 @@ static struct phy_driver broadcom_driver +@@ -764,7 +765,7 @@ static struct phy_driver broadcom_driver .handle_interrupt = bcm_phy_handle_interrupt, }, { .phy_id = PHY_ID_BCM54210E, @@ -35,7 +35,7 @@ Signed-off-by: Jonathan Bell .name = "Broadcom BCM54210E", /* PHY_GBIT_FEATURES */ .get_sset_count = bcm_phy_get_sset_count, -@@ -764,6 +765,13 @@ static struct phy_driver broadcom_driver +@@ -775,6 +776,13 @@ static struct phy_driver broadcom_driver .config_intr = bcm_phy_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, }, { @@ -49,7 +49,7 @@ Signed-off-by: Jonathan Bell .phy_id = PHY_ID_BCM5461, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM5461", -@@ -962,7 +970,8 @@ module_phy_driver(broadcom_drivers); +@@ -975,7 +983,8 @@ module_phy_driver(broadcom_drivers); static struct mdio_device_id __maybe_unused broadcom_tbl[] = { { PHY_ID_BCM5411, 0xfffffff0 }, { PHY_ID_BCM5421, 0xfffffff0 }, diff --git a/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch b/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch index 98687126487188..b23f9a4b9e2205 100644 --- a/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch +++ b/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch @@ -17,7 +17,7 @@ Signed-off-by: Marcel Holtmann --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -2272,6 +2272,23 @@ struct btmtk_section_map { +@@ -2275,6 +2275,23 @@ struct btmtk_section_map { }; } __packed; @@ -41,7 +41,7 @@ Signed-off-by: Marcel Holtmann static void btusb_mtk_wmt_recv(struct urb *urb) { struct hci_dev *hdev = urb->context; -@@ -3923,6 +3940,7 @@ static int btusb_probe(struct usb_interf +@@ -3926,6 +3943,7 @@ static int btusb_probe(struct usb_interf hdev->shutdown = btusb_mtk_shutdown; hdev->manufacturer = 70; hdev->cmd_timeout = btusb_mtk_cmd_timeout; diff --git a/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch b/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch index cff537a86699ed..6fe61a9defecd6 100644 --- a/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch +++ b/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch @@ -18,7 +18,7 @@ Signed-off-by: Marcel Holtmann --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -2277,7 +2277,7 @@ static int btusb_set_bdaddr_mtk(struct h +@@ -2280,7 +2280,7 @@ static int btusb_set_bdaddr_mtk(struct h struct sk_buff *skb; long ret; diff --git a/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch b/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch index e62f45f3c33c59..f6dacb6e503688 100644 --- a/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch +++ b/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch @@ -9,7 +9,7 @@ Subject: [PATCH] net/dsa/mv88e6xxx: disable ATU violation --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -2985,6 +2985,9 @@ static int mv88e6xxx_setup_port(struct m +@@ -2993,6 +2993,9 @@ static int mv88e6xxx_setup_port(struct m else reg = 1 << port; diff --git a/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch b/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch index 18933de3a03d67..5aa540acf7772d 100644 --- a/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +++ b/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch @@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -6333,6 +6333,7 @@ static int mv88e6xxx_register_switch(str +@@ -6341,6 +6341,7 @@ static int mv88e6xxx_register_switch(str ds->ops = &mv88e6xxx_switch_ops; ds->ageing_time_min = chip->info->age_time_coeff; ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; From 8bf25dba7732ab68a6926a9cf9c422b3d954fb67 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 30 Aug 2023 14:44:05 -0400 Subject: [PATCH 0405/1171] kernel: bump 5.15 to 5.15.129 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.129 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 1db566b6928447ff4c4f86ad1be7e0a6d5a58d16) [Refresh on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 ++-- ...950-0035-cgroup-Disable-cgroup-memory-by-default.patch | 8 ++++---- .../950-0845-clk-Fix-clk_get_parent-documentation.patch | 2 +- .../950-0865-clk-Add-clk_get_rate_range.patch | 2 +- target/linux/bcm47xx/patches-5.15/160-kmap_coherent.patch | 2 +- target/linux/generic/hack-5.15/902-debloat_proc.patch | 2 +- ...10-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 0f6e5c09d04ff4..94c4cb360e4848 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .128 -LINUX_KERNEL_HASH-5.15.128 = 0f2eca845183fd76f53b0c867c97f12b9ace2d7e8ee2cdeec7eb2897651b80de +LINUX_VERSION-5.15 = .129 +LINUX_KERNEL_HASH-5.15.129 = 750ec97ce4f1473e392b367a55eca4ea7a6b1e9e65ca2fb3bbca2eaa64802b66 diff --git a/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch b/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch index f6bf48693d1777..3192ce952d2677 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0035-cgroup-Disable-cgroup-memory-by-default.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c -@@ -5889,6 +5889,9 @@ int __init cgroup_init_early(void) +@@ -5890,6 +5890,9 @@ int __init cgroup_init_early(void) return 0; } @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /** * cgroup_init - cgroup initialization * -@@ -5927,6 +5930,12 @@ int __init cgroup_init(void) +@@ -5928,6 +5931,12 @@ int __init cgroup_init(void) mutex_unlock(&cgroup_mutex); @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6516,6 +6525,10 @@ static int __init cgroup_disable(char *s +@@ -6520,6 +6529,10 @@ static int __init cgroup_disable(char *s strcmp(token, ss->legacy_name)) continue; @@ -51,7 +51,7 @@ Signed-off-by: Phil Elwell static_branch_disable(cgroup_subsys_enabled_key[i]); pr_info("Disabling %s control group subsystem\n", ss->name); -@@ -6534,6 +6547,31 @@ static int __init cgroup_disable(char *s +@@ -6538,6 +6551,31 @@ static int __init cgroup_disable(char *s } __setup("cgroup_disable=", cgroup_disable); diff --git a/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch b/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch index b5339cf4377ca4..aa0f6751c45db5 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0845-clk-Fix-clk_get_parent-documentation.patch @@ -55,7 +55,7 @@ Signed-off-by: Maxime Ripard KUNIT_CASE(clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified), --- a/include/linux/clk.h +++ b/include/linux/clk.h -@@ -829,8 +829,9 @@ int clk_set_parent(struct clk *clk, stru +@@ -837,8 +837,9 @@ int clk_set_parent(struct clk *clk, stru * clk_get_parent - get the parent clock source for this clock * @clk: clock source * diff --git a/target/linux/bcm27xx/patches-5.15/950-0865-clk-Add-clk_get_rate_range.patch b/target/linux/bcm27xx/patches-5.15/950-0865-clk-Add-clk_get_rate_range.patch index b861cb3264296f..febb430a9c94ae 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0865-clk-Add-clk_get_rate_range.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0865-clk-Add-clk_get_rate_range.patch @@ -55,7 +55,7 @@ Signed-off-by: Maxime Ripard * --- a/include/linux/clk.h +++ b/include/linux/clk.h -@@ -799,6 +799,17 @@ bool clk_has_parent(struct clk *clk, str +@@ -807,6 +807,17 @@ bool clk_has_parent(struct clk *clk, str int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max); /** diff --git a/target/linux/bcm47xx/patches-5.15/160-kmap_coherent.patch b/target/linux/bcm47xx/patches-5.15/160-kmap_coherent.patch index aedf6afa246531..c2a0db8ab78a96 100644 --- a/target/linux/bcm47xx/patches-5.15/160-kmap_coherent.patch +++ b/target/linux/bcm47xx/patches-5.15/160-kmap_coherent.patch @@ -8,7 +8,7 @@ This fixes OpenWrt ticket #1485: https://dev.openwrt.org/ticket/1485 --- --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h -@@ -240,6 +240,9 @@ +@@ -257,6 +257,9 @@ #ifndef cpu_has_pindexed_dcache #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX) #endif diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index 8039d4161a2505..7528df483e5279 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -235,7 +235,7 @@ Signed-off-by: Felix Fietkau if (!pe) --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -3964,6 +3964,8 @@ static const struct seq_operations vmall +@@ -3968,6 +3968,8 @@ static const struct seq_operations vmall static int __init proc_vmalloc_init(void) { diff --git a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch index 8e335967eaea57..bbbebefdd5d9e5 100644 --- a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch +++ b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch @@ -161,7 +161,7 @@ Signed-off-by: Felix Fietkau struct rtnl_link { rtnl_doit_func doit; -@@ -4712,7 +4712,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu +@@ -4739,7 +4739,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu brport_nla_put_flag(skb, flags, mask, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD) || brport_nla_put_flag(skb, flags, mask, From e685162a78c07d373bd7b621a716465970680bae Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 2 Sep 2023 08:42:48 -0400 Subject: [PATCH 0406/1171] kernel: bump 5.15 to 5.15.130 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.130 No patches needed a rebased. Update to checksum only. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit e793b4bde535b86aab35512c8791c805444e5aff) --- include/kernel-5.15 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 94c4cb360e4848..74130b28309359 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .129 -LINUX_KERNEL_HASH-5.15.129 = 750ec97ce4f1473e392b367a55eca4ea7a6b1e9e65ca2fb3bbca2eaa64802b66 +LINUX_VERSION-5.15 = .130 +LINUX_KERNEL_HASH-5.15.130 = ab464e4107329ff5262f1c585c40fc29dc68f17687a9a918f3e90faba5303d62 From cf08db988baca64b878f1887d13e2fb79a708d8c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 4 Jun 2023 04:26:59 +0200 Subject: [PATCH 0407/1171] generic: backport initial LEDs hw control support Backport initial LEDs hw control support. Currently this is limited to only rx/tx and link events for the netdev trigger but the API got accepted and the additional modes are working on and will be backported later. Refresh every patch and add the additional config flag for QCA8K new LEDs support. Signed-off-by: Christian Marangi Signed-off-by: Daniel Golle (cherry picked from commit 0a4b309f41062ef40706162ae53b6428982a0685) --- ...ds-Add-the-input-trigger-for-pwr_led.patch | 2 +- ...it_default_state_get-to-the-global-h.patch | 39 ++ ...a8k-move-qca8k_port_to_phy-to-header.patch | 67 +++ ...net-dsa-qca8k-add-LEDs-basic-support.patch | 435 ++++++++++++++++++ ...dsa-qca8k-add-LEDs-blink_set-support.patch | 74 +++ ...bs-for-when-CLASS_LED-NEW_LEDS-are-d.patch | 59 +++ ...5-net-phy-Add-a-binding-for-PHY-LEDs.patch | 191 ++++++++ ...ce-Call-into-the-PHY-driver-to-set-L.patch | 97 ++++ ...ell-Add-software-control-of-the-LEDs.patch | 112 +++++ ...ce-Call-into-the-PHY-driver-to-set-L.patch | 73 +++ ...-phy-marvell-Implement-led_blink_set.patch | 104 +++++ ...Fix-inconsistent-indenting-in-led_bl.patch | 38 ++ ...dev-Drop-NETDEV_LED_MODE_LINKUP-from.patch | 87 ++++ ...dev-Rename-add-namespace-to-netdev-t.patch | 149 ++++++ ...-netdev-Convert-device-attr-to-macro.patch | 82 ++++ ...etdev-Use-mutex-instead-of-spinlocks.patch | 106 +++++ ...01-leds-add-APIs-for-LEDs-hw-control.patch | 74 +++ ...get-attached-device-for-LED-hw-contr.patch | 37 ++ ...ds-leds-class-Document-new-Hardware-.patch | 113 +++++ ...dev-refactor-code-setting-device-nam.patch | 69 +++ ...dev-introduce-check-for-possible-hw-.patch | 54 +++ ...dev-add-basic-check-for-hw-control-s.patch | 42 ++ ...dev-reject-interval-store-for-hw_con.patch | 28 ++ ...etdev-add-support-for-LED-hw-control.patch | 107 +++++ ...er-netdev-validate-configured-netdev.patch | 58 +++ ...dev-init-mode-if-hw-control-already-.patch | 53 +++ ...dev-expose-netdev-trigger-modes-in-l.patch | 54 +++ ...t-dsa-qca8k-implement-hw_control-ops.patch | 200 ++++++++ ...dsa-qca8k-add-op-to-get-ports-netdev.patch | 70 +++ target/linux/generic/config-5.15 | 1 + .../700-swconfig_switch_drivers.patch | 2 +- ...detach-callback-to-struct-phy_driver.patch | 4 +- ...phy-define-PSGMII-PHY-interface-mode.patch | 4 +- ...comm-IPQ4019-built-in-switch-support.patch | 9 +- ...8-net-phy-Add-Qualcom-QCA807x-driver.patch | 2 +- target/linux/ipq806x/config-5.15 | 1 + ...02-phy-Add-2.5G-SGMII-interface-mode.patch | 4 +- .../500-gsw-rtl8367s-mt7622-support.patch | 2 +- ...er-for-MediaTek-SoC-built-in-GE-PHYs.patch | 2 +- ...phy-add-driver-for-MediaTek-2.5G-PHY.patch | 2 +- target/linux/mpc85xx/p1010/config-default | 1 + ...y-simplify-phy_link_change-arguments.patch | 4 +- .../721-NET-no-auto-carrier-off-support.patch | 2 +- ...nclude-linux-add-phy-ops-for-rtl838x.patch | 8 +- ...04-include-linux-add-phy-hsgmii-mode.patch | 4 +- .../patches-5.15/705-add-rtl-phy.patch | 2 +- ...rease-phy-address-number-for-rtl839x.patch | 2 +- ...11-net-phy-add-an-MDIO-SMBus-library.patch | 2 +- ...rt-hardware-assisted-indirect-access.patch | 8 +- 49 files changed, 2708 insertions(+), 32 deletions(-) create mode 100644 target/linux/generic/backport-5.15/814-v6.3-leds-Move-led_init_default_state_get-to-the-global-h.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-01-net-dsa-qca8k-move-qca8k_port_to_phy-to-header.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-02-net-dsa-qca8k-add-LEDs-basic-support.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-03-net-dsa-qca8k-add-LEDs-blink_set-support.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-04-leds-Provide-stubs-for-when-CLASS_LED-NEW_LEDS-are-d.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-07-net-phy-marvell-Add-software-control-of-the-LEDs.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch create mode 100644 target/linux/generic/backport-5.15/815-v6.4-09-net-phy-marvell-Implement-led_blink_set.patch create mode 100644 target/linux/generic/backport-5.15/816-v6.4-net-phy-marvell-Fix-inconsistent-indenting-in-led_bl.patch create mode 100644 target/linux/generic/backport-5.15/817-v6.5-02-leds-trigger-netdev-Drop-NETDEV_LED_MODE_LINKUP-from.patch create mode 100644 target/linux/generic/backport-5.15/817-v6.5-03-leds-trigger-netdev-Rename-add-namespace-to-netdev-t.patch create mode 100644 target/linux/generic/backport-5.15/817-v6.5-04-leds-trigger-netdev-Convert-device-attr-to-macro.patch create mode 100644 target/linux/generic/backport-5.15/817-v6.5-05-leds-trigger-netdev-Use-mutex-instead-of-spinlocks.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-01-leds-add-APIs-for-LEDs-hw-control.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-02-leds-add-API-to-get-attached-device-for-LED-hw-contr.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-03-Documentation-leds-leds-class-Document-new-Hardware-.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-04-leds-trigger-netdev-refactor-code-setting-device-nam.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-05-leds-trigger-netdev-introduce-check-for-possible-hw-.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-07-leds-trigger-netdev-reject-interval-store-for-hw_con.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-08-leds-trigger-netdev-add-support-for-LED-hw-control.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-09-leds-trigger-netdev-validate-configured-netdev.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-10-leds-trigger-netdev-init-mode-if-hw-control-already-.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-11-leds-trigger-netdev-expose-netdev-trigger-modes-in-l.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-12-net-dsa-qca8k-implement-hw_control-ops.patch create mode 100644 target/linux/generic/backport-5.15/818-v6.5-13-net-dsa-qca8k-add-op-to-get-ports-netdev.patch diff --git a/target/linux/bcm27xx/patches-5.15/950-0079-leds-Add-the-input-trigger-for-pwr_led.patch b/target/linux/bcm27xx/patches-5.15/950-0079-leds-Add-the-input-trigger-for-pwr_led.patch index cc1202059cd2a2..f8fec4294b7117 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0079-leds-Add-the-input-trigger-for-pwr_led.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0079-leds-Add-the-input-trigger-for-pwr_led.patch @@ -156,7 +156,7 @@ See: https://github.com/raspberrypi/linux/issues/1064 +MODULE_LICENSE("GPL"); --- a/include/linux/leds.h +++ b/include/linux/leds.h -@@ -85,6 +85,9 @@ struct led_classdev { +@@ -95,6 +95,9 @@ struct led_classdev { #define LED_BRIGHT_HW_CHANGED BIT(21) #define LED_RETAIN_AT_SHUTDOWN BIT(22) #define LED_INIT_DEFAULT_TRIGGER BIT(23) diff --git a/target/linux/generic/backport-5.15/814-v6.3-leds-Move-led_init_default_state_get-to-the-global-h.patch b/target/linux/generic/backport-5.15/814-v6.3-leds-Move-led_init_default_state_get-to-the-global-h.patch new file mode 100644 index 00000000000000..592111fb9545be --- /dev/null +++ b/target/linux/generic/backport-5.15/814-v6.3-leds-Move-led_init_default_state_get-to-the-global-h.patch @@ -0,0 +1,39 @@ +From 156a5bb89ca6f3edd2be0bfd0de15e575442927e Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 3 Jan 2023 15:12:47 +0200 +Subject: [PATCH] leds: Move led_init_default_state_get() to the global header + +There are users inside and outside LED framework that have implemented +a local copy of led_init_default_state_get(). In order to deduplicate +that, as the first step move the declaration from LED header to the +global one. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20230103131256.33894-3-andriy.shevchenko@linux.intel.com +--- + drivers/leds/leds.h | 1 - + include/linux/leds.h | 2 ++ + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/leds/leds.h ++++ b/drivers/leds/leds.h +@@ -27,7 +27,6 @@ ssize_t led_trigger_read(struct file *fi + ssize_t led_trigger_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, char *buf, + loff_t pos, size_t count); +-enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode); + + extern struct rw_semaphore leds_list_lock; + extern struct list_head leds_list; +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -63,6 +63,8 @@ struct led_init_data { + bool devname_mandatory; + }; + ++enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode); ++ + struct led_hw_trigger_type { + int dummy; + }; diff --git a/target/linux/generic/backport-5.15/815-v6.4-01-net-dsa-qca8k-move-qca8k_port_to_phy-to-header.patch b/target/linux/generic/backport-5.15/815-v6.4-01-net-dsa-qca8k-move-qca8k_port_to_phy-to-header.patch new file mode 100644 index 00000000000000..dcdca9044233aa --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-01-net-dsa-qca8k-move-qca8k_port_to_phy-to-header.patch @@ -0,0 +1,67 @@ +From 3e8b4d6277fd19d98c817576954dd6a4ff3caa2b Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 17 Apr 2023 17:17:23 +0200 +Subject: [PATCH 1/9] net: dsa: qca8k: move qca8k_port_to_phy() to header + +Move qca8k_port_to_phy() to qca8k header as it's useful for future +reference in Switch LEDs module since the same logic is applied to get +the right index of the switch port. +Make it inline as it's simple function that just decrease the port. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Reviewed-by: Michal Kubiak +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 15 --------------- + drivers/net/dsa/qca/qca8k.h | 14 ++++++++++++++ + 2 files changed, 14 insertions(+), 15 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -716,21 +716,6 @@ err_clear_skb: + return ret; + } + +-static u32 +-qca8k_port_to_phy(int port) +-{ +- /* From Andrew Lunn: +- * Port 0 has no internal phy. +- * Port 1 has an internal PHY at MDIO address 0. +- * Port 2 has an internal PHY at MDIO address 1. +- * ... +- * Port 5 has an internal PHY at MDIO address 4. +- * Port 6 has no internal PHY. +- */ +- +- return port - 1; +-} +- + static int + qca8k_mdio_busy_wait(struct mii_bus *bus, u32 reg, u32 mask) + { +--- a/drivers/net/dsa/qca/qca8k.h ++++ b/drivers/net/dsa/qca/qca8k.h +@@ -414,6 +414,20 @@ struct qca8k_fdb { + u8 mac[6]; + }; + ++static inline u32 qca8k_port_to_phy(int port) ++{ ++ /* From Andrew Lunn: ++ * Port 0 has no internal phy. ++ * Port 1 has an internal PHY at MDIO address 0. ++ * Port 2 has an internal PHY at MDIO address 1. ++ * ... ++ * Port 5 has an internal PHY at MDIO address 4. ++ * Port 6 has no internal PHY. ++ */ ++ ++ return port - 1; ++} ++ + /* Common setup function */ + extern const struct qca8k_mib_desc ar8327_mib[]; + extern const struct regmap_access_table qca8k_readable_table; diff --git a/target/linux/generic/backport-5.15/815-v6.4-02-net-dsa-qca8k-add-LEDs-basic-support.patch b/target/linux/generic/backport-5.15/815-v6.4-02-net-dsa-qca8k-add-LEDs-basic-support.patch new file mode 100644 index 00000000000000..baf4c2e4ba713a --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-02-net-dsa-qca8k-add-LEDs-basic-support.patch @@ -0,0 +1,435 @@ +From 1e264f9d2918b5737023c44a23ae04def1095210 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 17 Apr 2023 17:17:24 +0200 +Subject: [PATCH 2/9] net: dsa: qca8k: add LEDs basic support + +Add LEDs basic support for qca8k Switch Family by adding basic +brightness_set() support. + +Since these LEDs refelect port status, the default label is set to +":port". DT binding should describe the color and function of the +LEDs using standard LEDs api. +Each LED always have the device name as prefix. The device name is +composed from the mii bus id and the PHY addr resulting in example +names like: +- qca8k-0.0:00:amber:lan +- qca8k-0.0:00:white:lan +- qca8k-0.0:01:amber:lan +- qca8k-0.0:01:white:lan + +These LEDs supports only blocking variant of the brightness_set() +function since they can sleep during access of the switch leds to set +the brightness. + +While at it add to the qca8k header file each mode defined by the Switch +Documentation for future use. + +Signed-off-by: Christian Marangi +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/Kconfig | 8 ++ + drivers/net/dsa/qca/Makefile | 3 + + drivers/net/dsa/qca/qca8k-8xxx.c | 5 + + drivers/net/dsa/qca/qca8k-leds.c | 239 +++++++++++++++++++++++++++++++ + drivers/net/dsa/qca/qca8k.h | 60 ++++++++ + drivers/net/dsa/qca/qca8k_leds.h | 16 +++ + 6 files changed, 331 insertions(+) + create mode 100644 drivers/net/dsa/qca/qca8k-leds.c + create mode 100644 drivers/net/dsa/qca/qca8k_leds.h + +--- a/drivers/net/dsa/qca/Kconfig ++++ b/drivers/net/dsa/qca/Kconfig +@@ -15,3 +15,11 @@ config NET_DSA_QCA8K + help + This enables support for the Qualcomm Atheros QCA8K Ethernet + switch chips. ++ ++config NET_DSA_QCA8K_LEDS_SUPPORT ++ bool "Qualcomm Atheros QCA8K Ethernet switch family LEDs support" ++ depends on NET_DSA_QCA8K ++ depends on LEDS_CLASS ++ help ++ This enabled support for LEDs present on the Qualcomm Atheros ++ QCA8K Ethernet switch chips. +--- a/drivers/net/dsa/qca/Makefile ++++ b/drivers/net/dsa/qca/Makefile +@@ -2,3 +2,6 @@ + obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o + obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o + qca8k-y += qca8k-common.o qca8k-8xxx.o ++ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT ++qca8k-y += qca8k-leds.o ++endif +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -22,6 +22,7 @@ + #include + + #include "qca8k.h" ++#include "qca8k_leds.h" + + static void + qca8k_split_addr(u32 regaddr, u16 *r1, u16 *r2, u16 *page) +@@ -1185,6 +1186,10 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + ++ ret = qca8k_setup_led_ctrl(priv); ++ if (ret) ++ return ret; ++ + /* Make sure MAC06 is disabled */ + ret = regmap_clear_bits(priv->regmap, QCA8K_REG_PORT0_PAD_CTRL, + QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN); +--- /dev/null ++++ b/drivers/net/dsa/qca/qca8k-leds.c +@@ -0,0 +1,239 @@ ++// SPDX-License-Identifier: GPL-2.0 ++#include ++#include ++ ++#include "qca8k.h" ++#include "qca8k_leds.h" ++ ++static int ++qca8k_get_enable_led_reg(int port_num, int led_num, struct qca8k_led_pattern_en *reg_info) ++{ ++ switch (port_num) { ++ case 0: ++ reg_info->reg = QCA8K_LED_CTRL_REG(led_num); ++ reg_info->shift = QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT; ++ break; ++ case 1: ++ case 2: ++ case 3: ++ /* Port 123 are controlled on a different reg */ ++ reg_info->reg = QCA8K_LED_CTRL3_REG; ++ reg_info->shift = QCA8K_LED_PHY123_PATTERN_EN_SHIFT(port_num, led_num); ++ break; ++ case 4: ++ reg_info->reg = QCA8K_LED_CTRL_REG(led_num); ++ reg_info->shift = QCA8K_LED_PHY4_CONTROL_RULE_SHIFT; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int ++qca8k_led_brightness_set(struct qca8k_led *led, ++ enum led_brightness brightness) ++{ ++ struct qca8k_led_pattern_en reg_info; ++ struct qca8k_priv *priv = led->priv; ++ u32 mask, val; ++ ++ qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); ++ ++ val = QCA8K_LED_ALWAYS_OFF; ++ if (brightness) ++ val = QCA8K_LED_ALWAYS_ON; ++ ++ /* HW regs to control brightness is special and port 1-2-3 ++ * are placed in a different reg. ++ * ++ * To control port 0 brightness: ++ * - the 2 bit (15, 14) of: ++ * - QCA8K_LED_CTRL0_REG for led1 ++ * - QCA8K_LED_CTRL1_REG for led2 ++ * - QCA8K_LED_CTRL2_REG for led3 ++ * ++ * To control port 4: ++ * - the 2 bit (31, 30) of: ++ * - QCA8K_LED_CTRL0_REG for led1 ++ * - QCA8K_LED_CTRL1_REG for led2 ++ * - QCA8K_LED_CTRL2_REG for led3 ++ * ++ * To control port 1: ++ * - the 2 bit at (9, 8) of QCA8K_LED_CTRL3_REG are used for led1 ++ * - the 2 bit at (11, 10) of QCA8K_LED_CTRL3_REG are used for led2 ++ * - the 2 bit at (13, 12) of QCA8K_LED_CTRL3_REG are used for led3 ++ * ++ * To control port 2: ++ * - the 2 bit at (15, 14) of QCA8K_LED_CTRL3_REG are used for led1 ++ * - the 2 bit at (17, 16) of QCA8K_LED_CTRL3_REG are used for led2 ++ * - the 2 bit at (19, 18) of QCA8K_LED_CTRL3_REG are used for led3 ++ * ++ * To control port 3: ++ * - the 2 bit at (21, 20) of QCA8K_LED_CTRL3_REG are used for led1 ++ * - the 2 bit at (23, 22) of QCA8K_LED_CTRL3_REG are used for led2 ++ * - the 2 bit at (25, 24) of QCA8K_LED_CTRL3_REG are used for led3 ++ * ++ * To abstract this and have less code, we use the port and led numm ++ * to calculate the shift and the correct reg due to this problem of ++ * not having a 1:1 map of LED with the regs. ++ */ ++ if (led->port_num == 0 || led->port_num == 4) { ++ mask = QCA8K_LED_PATTERN_EN_MASK; ++ val <<= QCA8K_LED_PATTERN_EN_SHIFT; ++ } else { ++ mask = QCA8K_LED_PHY123_PATTERN_EN_MASK; ++ } ++ ++ return regmap_update_bits(priv->regmap, reg_info.reg, ++ mask << reg_info.shift, ++ val << reg_info.shift); ++} ++ ++static int ++qca8k_cled_brightness_set_blocking(struct led_classdev *ldev, ++ enum led_brightness brightness) ++{ ++ struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); ++ ++ return qca8k_led_brightness_set(led, brightness); ++} ++ ++static enum led_brightness ++qca8k_led_brightness_get(struct qca8k_led *led) ++{ ++ struct qca8k_led_pattern_en reg_info; ++ struct qca8k_priv *priv = led->priv; ++ u32 val; ++ int ret; ++ ++ qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); ++ ++ ret = regmap_read(priv->regmap, reg_info.reg, &val); ++ if (ret) ++ return 0; ++ ++ val >>= reg_info.shift; ++ ++ if (led->port_num == 0 || led->port_num == 4) { ++ val &= QCA8K_LED_PATTERN_EN_MASK; ++ val >>= QCA8K_LED_PATTERN_EN_SHIFT; ++ } else { ++ val &= QCA8K_LED_PHY123_PATTERN_EN_MASK; ++ } ++ ++ /* Assume brightness ON only when the LED is set to always ON */ ++ return val == QCA8K_LED_ALWAYS_ON; ++} ++ ++static int ++qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int port_num) ++{ ++ struct fwnode_handle *led = NULL, *leds = NULL; ++ struct led_init_data init_data = { }; ++ struct dsa_switch *ds = priv->ds; ++ enum led_default_state state; ++ struct qca8k_led *port_led; ++ int led_num, led_index; ++ int ret; ++ ++ leds = fwnode_get_named_child_node(port, "leds"); ++ if (!leds) { ++ dev_dbg(priv->dev, "No Leds node specified in device tree for port %d!\n", ++ port_num); ++ return 0; ++ } ++ ++ fwnode_for_each_child_node(leds, led) { ++ /* Reg represent the led number of the port. ++ * Each port can have at most 3 leds attached ++ * Commonly: ++ * 1. is gigabit led ++ * 2. is mbit led ++ * 3. additional status led ++ */ ++ if (fwnode_property_read_u32(led, "reg", &led_num)) ++ continue; ++ ++ if (led_num >= QCA8K_LED_PORT_COUNT) { ++ dev_warn(priv->dev, "Invalid LED reg %d defined for port %d", ++ led_num, port_num); ++ continue; ++ } ++ ++ led_index = QCA8K_LED_PORT_INDEX(port_num, led_num); ++ ++ port_led = &priv->ports_led[led_index]; ++ port_led->port_num = port_num; ++ port_led->led_num = led_num; ++ port_led->priv = priv; ++ ++ state = led_init_default_state_get(led); ++ switch (state) { ++ case LEDS_DEFSTATE_ON: ++ port_led->cdev.brightness = 1; ++ qca8k_led_brightness_set(port_led, 1); ++ break; ++ case LEDS_DEFSTATE_KEEP: ++ port_led->cdev.brightness = ++ qca8k_led_brightness_get(port_led); ++ break; ++ default: ++ port_led->cdev.brightness = 0; ++ qca8k_led_brightness_set(port_led, 0); ++ } ++ ++ port_led->cdev.max_brightness = 1; ++ port_led->cdev.brightness_set_blocking = qca8k_cled_brightness_set_blocking; ++ init_data.default_label = ":port"; ++ init_data.fwnode = led; ++ init_data.devname_mandatory = true; ++ init_data.devicename = kasprintf(GFP_KERNEL, "%s:0%d", ds->slave_mii_bus->id, ++ port_num); ++ if (!init_data.devicename) ++ return -ENOMEM; ++ ++ ret = devm_led_classdev_register_ext(priv->dev, &port_led->cdev, &init_data); ++ if (ret) ++ dev_warn(priv->dev, "Failed to init LED %d for port %d", led_num, port_num); ++ ++ kfree(init_data.devicename); ++ } ++ ++ return 0; ++} ++ ++int ++qca8k_setup_led_ctrl(struct qca8k_priv *priv) ++{ ++ struct fwnode_handle *ports, *port; ++ int port_num; ++ int ret; ++ ++ ports = device_get_named_child_node(priv->dev, "ports"); ++ if (!ports) { ++ dev_info(priv->dev, "No ports node specified in device tree!"); ++ return 0; ++ } ++ ++ fwnode_for_each_child_node(ports, port) { ++ if (fwnode_property_read_u32(port, "reg", &port_num)) ++ continue; ++ ++ /* Skip checking for CPU port 0 and CPU port 6 as not supported */ ++ if (port_num == 0 || port_num == 6) ++ continue; ++ ++ /* Each port can have at most 3 different leds attached. ++ * Switch port starts from 0 to 6, but port 0 and 6 are CPU ++ * port. The port index needs to be decreased by one to identify ++ * the correct port for LED setup. ++ */ ++ ret = qca8k_parse_port_leds(priv, port, qca8k_port_to_phy(port_num)); ++ if (ret) ++ return ret; ++ } ++ ++ return 0; ++} +--- a/drivers/net/dsa/qca/qca8k.h ++++ b/drivers/net/dsa/qca/qca8k.h +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + + #define QCA8K_ETHERNET_MDIO_PRIORITY 7 +@@ -85,6 +86,51 @@ + #define QCA8K_MDIO_MASTER_DATA(x) FIELD_PREP(QCA8K_MDIO_MASTER_DATA_MASK, x) + #define QCA8K_MDIO_MASTER_MAX_PORTS 5 + #define QCA8K_MDIO_MASTER_MAX_REG 32 ++ ++/* LED control register */ ++#define QCA8K_LED_PORT_COUNT 3 ++#define QCA8K_LED_COUNT ((QCA8K_NUM_PORTS - QCA8K_NUM_CPU_PORTS) * QCA8K_LED_PORT_COUNT) ++#define QCA8K_LED_RULE_COUNT 6 ++#define QCA8K_LED_RULE_MAX 11 ++#define QCA8K_LED_PORT_INDEX(_phy, _led) (((_phy) * QCA8K_LED_PORT_COUNT) + (_led)) ++ ++#define QCA8K_LED_PHY123_PATTERN_EN_SHIFT(_phy, _led) ((((_phy) - 1) * 6) + 8 + (2 * (_led))) ++#define QCA8K_LED_PHY123_PATTERN_EN_MASK GENMASK(1, 0) ++ ++#define QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT 0 ++#define QCA8K_LED_PHY4_CONTROL_RULE_SHIFT 16 ++ ++#define QCA8K_LED_CTRL_REG(_i) (0x050 + (_i) * 4) ++#define QCA8K_LED_CTRL0_REG 0x50 ++#define QCA8K_LED_CTRL1_REG 0x54 ++#define QCA8K_LED_CTRL2_REG 0x58 ++#define QCA8K_LED_CTRL3_REG 0x5C ++#define QCA8K_LED_CTRL_SHIFT(_i) (((_i) % 2) * 16) ++#define QCA8K_LED_CTRL_MASK GENMASK(15, 0) ++#define QCA8K_LED_RULE_MASK GENMASK(13, 0) ++#define QCA8K_LED_BLINK_FREQ_MASK GENMASK(1, 0) ++#define QCA8K_LED_BLINK_FREQ_SHITF 0 ++#define QCA8K_LED_BLINK_2HZ 0 ++#define QCA8K_LED_BLINK_4HZ 1 ++#define QCA8K_LED_BLINK_8HZ 2 ++#define QCA8K_LED_BLINK_AUTO 3 ++#define QCA8K_LED_LINKUP_OVER_MASK BIT(2) ++#define QCA8K_LED_TX_BLINK_MASK BIT(4) ++#define QCA8K_LED_RX_BLINK_MASK BIT(5) ++#define QCA8K_LED_COL_BLINK_MASK BIT(7) ++#define QCA8K_LED_LINK_10M_EN_MASK BIT(8) ++#define QCA8K_LED_LINK_100M_EN_MASK BIT(9) ++#define QCA8K_LED_LINK_1000M_EN_MASK BIT(10) ++#define QCA8K_LED_POWER_ON_LIGHT_MASK BIT(11) ++#define QCA8K_LED_HALF_DUPLEX_MASK BIT(12) ++#define QCA8K_LED_FULL_DUPLEX_MASK BIT(13) ++#define QCA8K_LED_PATTERN_EN_MASK GENMASK(15, 14) ++#define QCA8K_LED_PATTERN_EN_SHIFT 14 ++#define QCA8K_LED_ALWAYS_OFF 0 ++#define QCA8K_LED_ALWAYS_BLINK_4HZ 1 ++#define QCA8K_LED_ALWAYS_ON 2 ++#define QCA8K_LED_RULE_CONTROLLED 3 ++ + #define QCA8K_GOL_MAC_ADDR0 0x60 + #define QCA8K_GOL_MAC_ADDR1 0x64 + #define QCA8K_MAX_FRAME_SIZE 0x78 +@@ -377,6 +423,19 @@ struct qca8k_mdio_cache { + u16 page; + }; + ++struct qca8k_led_pattern_en { ++ u32 reg; ++ u8 shift; ++}; ++ ++struct qca8k_led { ++ u8 port_num; ++ u8 led_num; ++ u16 old_rule; ++ struct qca8k_priv *priv; ++ struct led_classdev cdev; ++}; ++ + struct qca8k_priv { + u8 switch_id; + u8 switch_revision; +@@ -399,6 +458,7 @@ struct qca8k_priv { + struct qca8k_mib_eth_data mib_eth_data; + struct qca8k_mdio_cache mdio_cache; + const struct qca8k_match_data *info; ++ struct qca8k_led ports_led[QCA8K_LED_COUNT]; + }; + + struct qca8k_mib_desc { +--- /dev/null ++++ b/drivers/net/dsa/qca/qca8k_leds.h +@@ -0,0 +1,16 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++ ++#ifndef __QCA8K_LEDS_H ++#define __QCA8K_LEDS_H ++ ++/* Leds Support function */ ++#ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT ++int qca8k_setup_led_ctrl(struct qca8k_priv *priv); ++#else ++static inline int qca8k_setup_led_ctrl(struct qca8k_priv *priv) ++{ ++ return 0; ++} ++#endif ++ ++#endif /* __QCA8K_LEDS_H */ diff --git a/target/linux/generic/backport-5.15/815-v6.4-03-net-dsa-qca8k-add-LEDs-blink_set-support.patch b/target/linux/generic/backport-5.15/815-v6.4-03-net-dsa-qca8k-add-LEDs-blink_set-support.patch new file mode 100644 index 00000000000000..231c4156df8e06 --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-03-net-dsa-qca8k-add-LEDs-blink_set-support.patch @@ -0,0 +1,74 @@ +From 91acadcc6e599dfc62717abcdad58a459cfb1684 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 17 Apr 2023 17:17:25 +0200 +Subject: [PATCH 3/9] net: dsa: qca8k: add LEDs blink_set() support + +Add LEDs blink_set() support to qca8k Switch Family. +These LEDs support hw accellerated blinking at a fixed rate +of 4Hz. + +Reject any other value since not supported by the LEDs switch. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Acked-by: Pavel Machek +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-leds.c | 38 ++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +--- a/drivers/net/dsa/qca/qca8k-leds.c ++++ b/drivers/net/dsa/qca/qca8k-leds.c +@@ -128,6 +128,43 @@ qca8k_led_brightness_get(struct qca8k_le + } + + static int ++qca8k_cled_blink_set(struct led_classdev *ldev, ++ unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); ++ u32 mask, val = QCA8K_LED_ALWAYS_BLINK_4HZ; ++ struct qca8k_led_pattern_en reg_info; ++ struct qca8k_priv *priv = led->priv; ++ ++ if (*delay_on == 0 && *delay_off == 0) { ++ *delay_on = 125; ++ *delay_off = 125; ++ } ++ ++ if (*delay_on != 125 || *delay_off != 125) { ++ /* The hardware only supports blinking at 4Hz. Fall back ++ * to software implementation in other cases. ++ */ ++ return -EINVAL; ++ } ++ ++ qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); ++ ++ if (led->port_num == 0 || led->port_num == 4) { ++ mask = QCA8K_LED_PATTERN_EN_MASK; ++ val <<= QCA8K_LED_PATTERN_EN_SHIFT; ++ } else { ++ mask = QCA8K_LED_PHY123_PATTERN_EN_MASK; ++ } ++ ++ regmap_update_bits(priv->regmap, reg_info.reg, mask << reg_info.shift, ++ val << reg_info.shift); ++ ++ return 0; ++} ++ ++static int + qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int port_num) + { + struct fwnode_handle *led = NULL, *leds = NULL; +@@ -186,6 +223,7 @@ qca8k_parse_port_leds(struct qca8k_priv + + port_led->cdev.max_brightness = 1; + port_led->cdev.brightness_set_blocking = qca8k_cled_brightness_set_blocking; ++ port_led->cdev.blink_set = qca8k_cled_blink_set; + init_data.default_label = ":port"; + init_data.fwnode = led; + init_data.devname_mandatory = true; diff --git a/target/linux/generic/backport-5.15/815-v6.4-04-leds-Provide-stubs-for-when-CLASS_LED-NEW_LEDS-are-d.patch b/target/linux/generic/backport-5.15/815-v6.4-04-leds-Provide-stubs-for-when-CLASS_LED-NEW_LEDS-are-d.patch new file mode 100644 index 00000000000000..bc905b4468c1b2 --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-04-leds-Provide-stubs-for-when-CLASS_LED-NEW_LEDS-are-d.patch @@ -0,0 +1,59 @@ +From e5029edd53937a29801ef507cee12e657ff31ea9 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 17 Apr 2023 17:17:26 +0200 +Subject: [PATCH 4/9] leds: Provide stubs for when CLASS_LED & NEW_LEDS are + disabled + +Provide stubs for devm_led_classdev_register_ext() and +led_init_default_state_get() so that LED drivers embedded within other +drivers such as PHYs and Ethernet switches still build when LEDS_CLASS +or NEW_LEDS are disabled. This also helps with Kconfig dependencies, +which are somewhat hairy for phylib and mdio and only get worse when +adding a dependency on LED_CLASS. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + include/linux/leds.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -63,7 +63,15 @@ struct led_init_data { + bool devname_mandatory; + }; + ++#if IS_ENABLED(CONFIG_NEW_LEDS) + enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode); ++#else ++static inline enum led_default_state ++led_init_default_state_get(struct fwnode_handle *fwnode) ++{ ++ return LEDS_DEFSTATE_OFF; ++} ++#endif + + struct led_hw_trigger_type { + int dummy; +@@ -198,9 +206,19 @@ static inline int led_classdev_register( + return led_classdev_register_ext(parent, led_cdev, NULL); + } + ++#if IS_ENABLED(CONFIG_LEDS_CLASS) + int devm_led_classdev_register_ext(struct device *parent, + struct led_classdev *led_cdev, + struct led_init_data *init_data); ++#else ++static inline int ++devm_led_classdev_register_ext(struct device *parent, ++ struct led_classdev *led_cdev, ++ struct led_init_data *init_data) ++{ ++ return 0; ++} ++#endif + + static inline int devm_led_classdev_register(struct device *parent, + struct led_classdev *led_cdev) diff --git a/target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch b/target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch new file mode 100644 index 00000000000000..3e60f91a2a9d4b --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch @@ -0,0 +1,191 @@ +From 01e5b728e9e43ae444e0369695a5f72209906464 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 17 Apr 2023 17:17:27 +0200 +Subject: [PATCH 5/9] net: phy: Add a binding for PHY LEDs + +Define common binding parsing for all PHY drivers with LEDs using +phylib. Parse the DT as part of the phy_probe and add LEDs to the +linux LED class infrastructure. For the moment, provide a dummy +brightness function, which will later be replaced with a call into the +PHY driver. This allows testing since the LED core might otherwise +reject an LED whose brightness cannot be set. + +Add a dependency on LED_CLASS. It either needs to be built in, or not +enabled, since a modular build can result in linker errors. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/phy/Kconfig | 1 + + drivers/net/phy/phy_device.c | 76 ++++++++++++++++++++++++++++++++++++ + include/linux/phy.h | 16 ++++++++ + 3 files changed, 93 insertions(+) + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -18,6 +18,7 @@ menuconfig PHYLIB + depends on NETDEVICES + select MDIO_DEVICE + select MDIO_DEVRES ++ depends on LEDS_CLASS || LEDS_CLASS=n + help + Ethernet controllers are usually attached to PHY + devices. This option provides infrastructure for +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -19,10 +19,12 @@ + #include + #include + #include ++#include + #include + #include + #include + #include ++#include + #include + #include + #include +@@ -641,6 +643,7 @@ struct phy_device *phy_device_create(str + device_initialize(&mdiodev->dev); + + dev->state = PHY_DOWN; ++ INIT_LIST_HEAD(&dev->leds); + + mutex_init(&dev->lock); + INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine); +@@ -2942,6 +2945,74 @@ static bool phy_drv_supports_irq(struct + return phydrv->config_intr && phydrv->handle_interrupt; + } + ++/* Dummy implementation until calls into PHY driver are added */ ++static int phy_led_set_brightness(struct led_classdev *led_cdev, ++ enum led_brightness value) ++{ ++ return 0; ++} ++ ++static int of_phy_led(struct phy_device *phydev, ++ struct device_node *led) ++{ ++ struct device *dev = &phydev->mdio.dev; ++ struct led_init_data init_data = {}; ++ struct led_classdev *cdev; ++ struct phy_led *phyled; ++ int err; ++ ++ phyled = devm_kzalloc(dev, sizeof(*phyled), GFP_KERNEL); ++ if (!phyled) ++ return -ENOMEM; ++ ++ cdev = &phyled->led_cdev; ++ ++ err = of_property_read_u8(led, "reg", &phyled->index); ++ if (err) ++ return err; ++ ++ cdev->brightness_set_blocking = phy_led_set_brightness; ++ cdev->max_brightness = 1; ++ init_data.devicename = dev_name(&phydev->mdio.dev); ++ init_data.fwnode = of_fwnode_handle(led); ++ init_data.devname_mandatory = true; ++ ++ err = devm_led_classdev_register_ext(dev, cdev, &init_data); ++ if (err) ++ return err; ++ ++ list_add(&phyled->list, &phydev->leds); ++ ++ return 0; ++} ++ ++static int of_phy_leds(struct phy_device *phydev) ++{ ++ struct device_node *node = phydev->mdio.dev.of_node; ++ struct device_node *leds, *led; ++ int err; ++ ++ if (!IS_ENABLED(CONFIG_OF_MDIO)) ++ return 0; ++ ++ if (!node) ++ return 0; ++ ++ leds = of_get_child_by_name(node, "leds"); ++ if (!leds) ++ return 0; ++ ++ for_each_available_child_of_node(leds, led) { ++ err = of_phy_led(phydev, led); ++ if (err) { ++ of_node_put(led); ++ return err; ++ } ++ } ++ ++ return 0; ++} ++ + /** + * fwnode_mdio_find_device - Given a fwnode, find the mdio_device + * @fwnode: pointer to the mdio_device's fwnode +@@ -3120,6 +3191,11 @@ static int phy_probe(struct device *dev) + /* Set the state to READY by default */ + phydev->state = PHY_READY; + ++ /* Get the LEDs from the device tree, and instantiate standard ++ * LEDs for them. ++ */ ++ err = of_phy_leds(phydev); ++ + out: + /* Re-assert the reset signal on error */ + if (err) +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -582,6 +583,7 @@ struct macsec_ops; + * @phy_num_led_triggers: Number of triggers in @phy_led_triggers + * @led_link_trigger: LED trigger for link up/down + * @last_triggered: last LED trigger for link speed ++ * @leds: list of PHY LED structures + * @master_slave_set: User requested master/slave configuration + * @master_slave_get: Current master/slave advertisement + * @master_slave_state: Current master/slave configuration +@@ -668,6 +670,7 @@ struct phy_device { + + struct phy_led_trigger *led_link_trigger; + #endif ++ struct list_head leds; + + /* + * Interrupt number for this PHY +@@ -739,6 +742,19 @@ struct phy_tdr_config { + #define PHY_PAIR_ALL -1 + + /** ++ * struct phy_led: An LED driven by the PHY ++ * ++ * @list: List of LEDs ++ * @led_cdev: Standard LED class structure ++ * @index: Number of the LED ++ */ ++struct phy_led { ++ struct list_head list; ++ struct led_classdev led_cdev; ++ u8 index; ++}; ++ ++/** + * struct phy_driver - Driver structure for a particular PHY type + * + * @mdiodrv: Data common to all MDIO devices diff --git a/target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch b/target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch new file mode 100644 index 00000000000000..f990557cc73ddf --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch @@ -0,0 +1,97 @@ +From 684818189b04b095b34964ed4a3ea5249a840eab Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 17 Apr 2023 17:17:28 +0200 +Subject: [PATCH 6/9] net: phy: phy_device: Call into the PHY driver to set LED + brightness + +Linux LEDs can be software controlled via the brightness file in /sys. +LED drivers need to implement a brightness_set function which the core +will call. Implement an intermediary in phy_device, which will call +into the phy driver if it implements the necessary function. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/phy/phy_device.c | 15 ++++++++++++--- + include/linux/phy.h | 13 +++++++++++++ + 2 files changed, 25 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -2945,11 +2945,18 @@ static bool phy_drv_supports_irq(struct + return phydrv->config_intr && phydrv->handle_interrupt; + } + +-/* Dummy implementation until calls into PHY driver are added */ + static int phy_led_set_brightness(struct led_classdev *led_cdev, + enum led_brightness value) + { +- return 0; ++ struct phy_led *phyled = to_phy_led(led_cdev); ++ struct phy_device *phydev = phyled->phydev; ++ int err; ++ ++ mutex_lock(&phydev->lock); ++ err = phydev->drv->led_brightness_set(phydev, phyled->index, value); ++ mutex_unlock(&phydev->lock); ++ ++ return err; + } + + static int of_phy_led(struct phy_device *phydev, +@@ -2966,12 +2973,14 @@ static int of_phy_led(struct phy_device + return -ENOMEM; + + cdev = &phyled->led_cdev; ++ phyled->phydev = phydev; + + err = of_property_read_u8(led, "reg", &phyled->index); + if (err) + return err; + +- cdev->brightness_set_blocking = phy_led_set_brightness; ++ if (phydev->drv->led_brightness_set) ++ cdev->brightness_set_blocking = phy_led_set_brightness; + cdev->max_brightness = 1; + init_data.devicename = dev_name(&phydev->mdio.dev); + init_data.fwnode = of_fwnode_handle(led); +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -745,15 +745,19 @@ struct phy_tdr_config { + * struct phy_led: An LED driven by the PHY + * + * @list: List of LEDs ++ * @phydev: PHY this LED is attached to + * @led_cdev: Standard LED class structure + * @index: Number of the LED + */ + struct phy_led { + struct list_head list; ++ struct phy_device *phydev; + struct led_classdev led_cdev; + u8 index; + }; + ++#define to_phy_led(d) container_of(d, struct phy_led, led_cdev) ++ + /** + * struct phy_driver - Driver structure for a particular PHY type + * +@@ -953,6 +957,15 @@ struct phy_driver { + int (*get_sqi)(struct phy_device *dev); + /** @get_sqi_max: Get the maximum signal quality indication */ + int (*get_sqi_max)(struct phy_device *dev); ++ ++ /** ++ * @led_brightness_set: Set a PHY LED brightness. Index ++ * indicates which of the PHYs led should be set. Value ++ * follows the standard LED class meaning, e.g. LED_OFF, ++ * LED_HALF, LED_FULL. ++ */ ++ int (*led_brightness_set)(struct phy_device *dev, ++ u8 index, enum led_brightness value); + }; + #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ + struct phy_driver, mdiodrv) diff --git a/target/linux/generic/backport-5.15/815-v6.4-07-net-phy-marvell-Add-software-control-of-the-LEDs.patch b/target/linux/generic/backport-5.15/815-v6.4-07-net-phy-marvell-Add-software-control-of-the-LEDs.patch new file mode 100644 index 00000000000000..053288ceca765a --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-07-net-phy-marvell-Add-software-control-of-the-LEDs.patch @@ -0,0 +1,112 @@ +From 2d3960e58ef7c83fe1dbf952f056b9e906cb6df8 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 17 Apr 2023 17:17:29 +0200 +Subject: [PATCH 7/9] net: phy: marvell: Add software control of the LEDs + +Add a brightness function, so the LEDs can be controlled from +software using the standard Linux LED infrastructure. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/phy/marvell.c | 45 ++++++++++++++++++++++++++++++++++----- + 1 file changed, 40 insertions(+), 5 deletions(-) + +--- a/drivers/net/phy/marvell.c ++++ b/drivers/net/phy/marvell.c +@@ -144,11 +144,13 @@ + /* WOL Event Interrupt Enable */ + #define MII_88E1318S_PHY_CSIER_WOL_EIE BIT(7) + +-/* LED Timer Control Register */ +-#define MII_88E1318S_PHY_LED_TCR 0x12 +-#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) +-#define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) +-#define MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW BIT(11) ++#define MII_88E1318S_PHY_LED_FUNC 0x10 ++#define MII_88E1318S_PHY_LED_FUNC_OFF (0x8) ++#define MII_88E1318S_PHY_LED_FUNC_ON (0x9) ++#define MII_88E1318S_PHY_LED_TCR 0x12 ++#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) ++#define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) ++#define MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW BIT(11) + + /* Magic Packet MAC address registers */ + #define MII_88E1318S_PHY_MAGIC_PACKET_WORD2 0x17 +@@ -2793,6 +2795,34 @@ static int marvell_hwmon_probe(struct ph + } + #endif + ++static int m88e1318_led_brightness_set(struct phy_device *phydev, ++ u8 index, enum led_brightness value) ++{ ++ int reg; ++ ++ reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, ++ MII_88E1318S_PHY_LED_FUNC); ++ if (reg < 0) ++ return reg; ++ ++ switch (index) { ++ case 0: ++ case 1: ++ case 2: ++ reg &= ~(0xf << (4 * index)); ++ if (value == LED_OFF) ++ reg |= MII_88E1318S_PHY_LED_FUNC_OFF << (4 * index); ++ else ++ reg |= MII_88E1318S_PHY_LED_FUNC_ON << (4 * index); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, ++ MII_88E1318S_PHY_LED_FUNC, reg); ++} ++ + static int marvell_probe(struct phy_device *phydev) + { + struct marvell_priv *priv; +@@ -3041,6 +3071,7 @@ static struct phy_driver marvell_drivers + .get_sset_count = marvell_get_sset_count, + .get_strings = marvell_get_strings, + .get_stats = marvell_get_stats, ++ .led_brightness_set = m88e1318_led_brightness_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E1145, +@@ -3147,6 +3178,7 @@ static struct phy_driver marvell_drivers + .cable_test_start = marvell_vct7_cable_test_start, + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, ++ .led_brightness_set = m88e1318_led_brightness_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E1540, +@@ -3173,6 +3205,7 @@ static struct phy_driver marvell_drivers + .cable_test_start = marvell_vct7_cable_test_start, + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, ++ .led_brightness_set = m88e1318_led_brightness_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E1545, +@@ -3199,6 +3232,7 @@ static struct phy_driver marvell_drivers + .cable_test_start = marvell_vct7_cable_test_start, + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, ++ .led_brightness_set = m88e1318_led_brightness_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E3016, +@@ -3340,6 +3374,7 @@ static struct phy_driver marvell_drivers + .get_stats = marvell_get_stats, + .get_tunable = m88e1540_get_tunable, + .set_tunable = m88e1540_set_tunable, ++ .led_brightness_set = m88e1318_led_brightness_set, + }, + }; + diff --git a/target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch b/target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch new file mode 100644 index 00000000000000..4814688de454f4 --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch @@ -0,0 +1,73 @@ +From 4e901018432e38eab35d2a352661ce4727795be1 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 17 Apr 2023 17:17:30 +0200 +Subject: [PATCH 8/9] net: phy: phy_device: Call into the PHY driver to set LED + blinking + +Linux LEDs can be requested to perform hardware accelerated +blinking. Pass this to the PHY driver, if it implements the op. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/phy/phy_device.c | 18 ++++++++++++++++++ + include/linux/phy.h | 12 ++++++++++++ + 2 files changed, 30 insertions(+) + +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -2959,6 +2959,22 @@ static int phy_led_set_brightness(struct + return err; + } + ++static int phy_led_blink_set(struct led_classdev *led_cdev, ++ unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct phy_led *phyled = to_phy_led(led_cdev); ++ struct phy_device *phydev = phyled->phydev; ++ int err; ++ ++ mutex_lock(&phydev->lock); ++ err = phydev->drv->led_blink_set(phydev, phyled->index, ++ delay_on, delay_off); ++ mutex_unlock(&phydev->lock); ++ ++ return err; ++} ++ + static int of_phy_led(struct phy_device *phydev, + struct device_node *led) + { +@@ -2981,6 +2997,8 @@ static int of_phy_led(struct phy_device + + if (phydev->drv->led_brightness_set) + cdev->brightness_set_blocking = phy_led_set_brightness; ++ if (phydev->drv->led_blink_set) ++ cdev->blink_set = phy_led_blink_set; + cdev->max_brightness = 1; + init_data.devicename = dev_name(&phydev->mdio.dev); + init_data.fwnode = of_fwnode_handle(led); +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -966,6 +966,18 @@ struct phy_driver { + */ + int (*led_brightness_set)(struct phy_device *dev, + u8 index, enum led_brightness value); ++ ++ /** ++ * @led_blink_set: Set a PHY LED brightness. Index indicates ++ * which of the PHYs led should be configured to blink. Delays ++ * are in milliseconds and if both are zero then a sensible ++ * default should be chosen. The call should adjust the ++ * timings in that case and if it can't match the values ++ * specified exactly. ++ */ ++ int (*led_blink_set)(struct phy_device *dev, u8 index, ++ unsigned long *delay_on, ++ unsigned long *delay_off); + }; + #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ + struct phy_driver, mdiodrv) diff --git a/target/linux/generic/backport-5.15/815-v6.4-09-net-phy-marvell-Implement-led_blink_set.patch b/target/linux/generic/backport-5.15/815-v6.4-09-net-phy-marvell-Implement-led_blink_set.patch new file mode 100644 index 00000000000000..0f258c6b92f95f --- /dev/null +++ b/target/linux/generic/backport-5.15/815-v6.4-09-net-phy-marvell-Implement-led_blink_set.patch @@ -0,0 +1,104 @@ +From ea9e86485decb2ac1750005bd96c166c9b780406 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 17 Apr 2023 17:17:31 +0200 +Subject: [PATCH 9/9] net: phy: marvell: Implement led_blink_set() + +The Marvell PHY can blink the LEDs, simple on/off. All LEDs blink at +the same rate, and the reset default is 84ms per blink, which is +around 12Hz. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/phy/marvell.c | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +--- a/drivers/net/phy/marvell.c ++++ b/drivers/net/phy/marvell.c +@@ -147,6 +147,8 @@ + #define MII_88E1318S_PHY_LED_FUNC 0x10 + #define MII_88E1318S_PHY_LED_FUNC_OFF (0x8) + #define MII_88E1318S_PHY_LED_FUNC_ON (0x9) ++#define MII_88E1318S_PHY_LED_FUNC_HI_Z (0xa) ++#define MII_88E1318S_PHY_LED_FUNC_BLINK (0xb) + #define MII_88E1318S_PHY_LED_TCR 0x12 + #define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) + #define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) +@@ -2823,6 +2825,35 @@ static int m88e1318_led_brightness_set(s + MII_88E1318S_PHY_LED_FUNC, reg); + } + ++static int m88e1318_led_blink_set(struct phy_device *phydev, u8 index, ++ unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ int reg; ++ ++ reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, ++ MII_88E1318S_PHY_LED_FUNC); ++ if (reg < 0) ++ return reg; ++ ++ switch (index) { ++ case 0: ++ case 1: ++ case 2: ++ reg &= ~(0xf << (4 * index)); ++ reg |= MII_88E1318S_PHY_LED_FUNC_BLINK << (4 * index); ++ /* Reset default is 84ms */ ++ *delay_on = 84 / 2; ++ *delay_off = 84 / 2; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, ++ MII_88E1318S_PHY_LED_FUNC, reg); ++} ++ + static int marvell_probe(struct phy_device *phydev) + { + struct marvell_priv *priv; +@@ -3072,6 +3103,7 @@ static struct phy_driver marvell_drivers + .get_strings = marvell_get_strings, + .get_stats = marvell_get_stats, + .led_brightness_set = m88e1318_led_brightness_set, ++ .led_blink_set = m88e1318_led_blink_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E1145, +@@ -3179,6 +3211,7 @@ static struct phy_driver marvell_drivers + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, ++ .led_blink_set = m88e1318_led_blink_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E1540, +@@ -3206,6 +3239,7 @@ static struct phy_driver marvell_drivers + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, ++ .led_blink_set = m88e1318_led_blink_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E1545, +@@ -3233,6 +3267,7 @@ static struct phy_driver marvell_drivers + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, ++ .led_blink_set = m88e1318_led_blink_set, + }, + { + .phy_id = MARVELL_PHY_ID_88E3016, +@@ -3375,6 +3410,7 @@ static struct phy_driver marvell_drivers + .get_tunable = m88e1540_get_tunable, + .set_tunable = m88e1540_set_tunable, + .led_brightness_set = m88e1318_led_brightness_set, ++ .led_blink_set = m88e1318_led_blink_set, + }, + }; + diff --git a/target/linux/generic/backport-5.15/816-v6.4-net-phy-marvell-Fix-inconsistent-indenting-in-led_bl.patch b/target/linux/generic/backport-5.15/816-v6.4-net-phy-marvell-Fix-inconsistent-indenting-in-led_bl.patch new file mode 100644 index 00000000000000..c5b611a125b1ae --- /dev/null +++ b/target/linux/generic/backport-5.15/816-v6.4-net-phy-marvell-Fix-inconsistent-indenting-in-led_bl.patch @@ -0,0 +1,38 @@ +From 4774ad841bef97cc51df90195338c5b2573dd4cb Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 23 Apr 2023 19:28:00 +0200 +Subject: [PATCH] net: phy: marvell: Fix inconsistent indenting in + led_blink_set + +Fix inconsistent indeinting in m88e1318_led_blink_set reported by kernel +test robot, probably done by the presence of an if condition dropped in +later revision of the same code. + +Reported-by: kernel test robot +Link: https://lore.kernel.org/oe-kbuild-all/202304240007.0VEX8QYG-lkp@intel.com/ +Fixes: ea9e86485dec ("net: phy: marvell: Implement led_blink_set()") +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/20230423172800.3470-1-ansuelsmth@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/marvell.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/marvell.c ++++ b/drivers/net/phy/marvell.c +@@ -2841,10 +2841,10 @@ static int m88e1318_led_blink_set(struct + case 1: + case 2: + reg &= ~(0xf << (4 * index)); +- reg |= MII_88E1318S_PHY_LED_FUNC_BLINK << (4 * index); +- /* Reset default is 84ms */ +- *delay_on = 84 / 2; +- *delay_off = 84 / 2; ++ reg |= MII_88E1318S_PHY_LED_FUNC_BLINK << (4 * index); ++ /* Reset default is 84ms */ ++ *delay_on = 84 / 2; ++ *delay_off = 84 / 2; + break; + default: + return -EINVAL; diff --git a/target/linux/generic/backport-5.15/817-v6.5-02-leds-trigger-netdev-Drop-NETDEV_LED_MODE_LINKUP-from.patch b/target/linux/generic/backport-5.15/817-v6.5-02-leds-trigger-netdev-Drop-NETDEV_LED_MODE_LINKUP-from.patch new file mode 100644 index 00000000000000..3170c260580a4e --- /dev/null +++ b/target/linux/generic/backport-5.15/817-v6.5-02-leds-trigger-netdev-Drop-NETDEV_LED_MODE_LINKUP-from.patch @@ -0,0 +1,87 @@ +From e2f24cb1b5daf9a4f6f3ba574c1fa74aab9807a4 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 19 Apr 2023 23:07:40 +0200 +Subject: [PATCH 2/5] leds: trigger: netdev: Drop NETDEV_LED_MODE_LINKUP from + mode + +Putting NETDEV_LED_MODE_LINKUP in the same list of the netdev trigger +modes is wrong as it's used to set the link state of the device and not +to set a blink mode as it's done by NETDEV_LED_LINK, NETDEV_LED_TX and +NETDEV_LED_RX. It's also wrong to put this state in the same bitmap of the +netdev trigger mode and should be external to it. + +Drop NETDEV_LED_MODE_LINKUP from mode list and convert to a simple bool +that will be true or false based on the carrier link. No functional +change intended. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20230419210743.3594-3-ansuelsmth@gmail.com +--- + drivers/leds/trigger/ledtrig-netdev.c | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -50,10 +50,10 @@ struct led_netdev_data { + unsigned int last_activity; + + unsigned long mode; ++ bool carrier_link_up; + #define NETDEV_LED_LINK 0 + #define NETDEV_LED_TX 1 + #define NETDEV_LED_RX 2 +-#define NETDEV_LED_MODE_LINKUP 3 + }; + + enum netdev_led_attr { +@@ -73,9 +73,9 @@ static void set_baseline_state(struct le + if (!led_cdev->blink_brightness) + led_cdev->blink_brightness = led_cdev->max_brightness; + +- if (!test_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode)) ++ if (!trigger_data->carrier_link_up) { + led_set_brightness(led_cdev, LED_OFF); +- else { ++ } else { + if (test_bit(NETDEV_LED_LINK, &trigger_data->mode)) + led_set_brightness(led_cdev, + led_cdev->blink_brightness); +@@ -131,10 +131,9 @@ static ssize_t device_name_store(struct + trigger_data->net_dev = + dev_get_by_name(&init_net, trigger_data->device_name); + +- clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); ++ trigger_data->carrier_link_up = false; + if (trigger_data->net_dev != NULL) +- if (netif_carrier_ok(trigger_data->net_dev)) +- set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); ++ trigger_data->carrier_link_up = netif_carrier_ok(trigger_data->net_dev); + + trigger_data->last_activity = 0; + +@@ -315,11 +314,10 @@ static int netdev_trig_notify(struct not + + spin_lock_bh(&trigger_data->lock); + +- clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); ++ trigger_data->carrier_link_up = false; + switch (evt) { + case NETDEV_CHANGENAME: +- if (netif_carrier_ok(dev)) +- set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); ++ trigger_data->carrier_link_up = netif_carrier_ok(dev); + fallthrough; + case NETDEV_REGISTER: + if (trigger_data->net_dev) +@@ -333,8 +331,7 @@ static int netdev_trig_notify(struct not + break; + case NETDEV_UP: + case NETDEV_CHANGE: +- if (netif_carrier_ok(dev)) +- set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); ++ trigger_data->carrier_link_up = netif_carrier_ok(dev); + break; + } + diff --git a/target/linux/generic/backport-5.15/817-v6.5-03-leds-trigger-netdev-Rename-add-namespace-to-netdev-t.patch b/target/linux/generic/backport-5.15/817-v6.5-03-leds-trigger-netdev-Rename-add-namespace-to-netdev-t.patch new file mode 100644 index 00000000000000..19cc1d7c9edc16 --- /dev/null +++ b/target/linux/generic/backport-5.15/817-v6.5-03-leds-trigger-netdev-Rename-add-namespace-to-netdev-t.patch @@ -0,0 +1,149 @@ +From bdec9cb83936e0ac4cb87fed5b49fad0175f7dec Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 19 Apr 2023 23:07:41 +0200 +Subject: [PATCH 3/5] leds: trigger: netdev: Rename add namespace to netdev + trigger enum modes + +Rename NETDEV trigger enum modes to a more symbolic name and add a +namespace to them. + +Also add __TRIGGER_NETDEV_MAX to identify the max modes of the netdev +trigger. + +This is a cleanup to drop the define and no behaviour change are +intended. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20230419210743.3594-4-ansuelsmth@gmail.com +--- + drivers/leds/trigger/ledtrig-netdev.c | 58 ++++++++++++--------------- + 1 file changed, 25 insertions(+), 33 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -51,15 +51,15 @@ struct led_netdev_data { + + unsigned long mode; + bool carrier_link_up; +-#define NETDEV_LED_LINK 0 +-#define NETDEV_LED_TX 1 +-#define NETDEV_LED_RX 2 + }; + +-enum netdev_led_attr { +- NETDEV_ATTR_LINK, +- NETDEV_ATTR_TX, +- NETDEV_ATTR_RX ++enum led_trigger_netdev_modes { ++ TRIGGER_NETDEV_LINK = 0, ++ TRIGGER_NETDEV_TX, ++ TRIGGER_NETDEV_RX, ++ ++ /* Keep last */ ++ __TRIGGER_NETDEV_MAX, + }; + + static void set_baseline_state(struct led_netdev_data *trigger_data) +@@ -76,7 +76,7 @@ static void set_baseline_state(struct le + if (!trigger_data->carrier_link_up) { + led_set_brightness(led_cdev, LED_OFF); + } else { +- if (test_bit(NETDEV_LED_LINK, &trigger_data->mode)) ++ if (test_bit(TRIGGER_NETDEV_LINK, &trigger_data->mode)) + led_set_brightness(led_cdev, + led_cdev->blink_brightness); + else +@@ -85,8 +85,8 @@ static void set_baseline_state(struct le + /* If we are looking for RX/TX start periodically + * checking stats + */ +- if (test_bit(NETDEV_LED_TX, &trigger_data->mode) || +- test_bit(NETDEV_LED_RX, &trigger_data->mode)) ++ if (test_bit(TRIGGER_NETDEV_TX, &trigger_data->mode) || ++ test_bit(TRIGGER_NETDEV_RX, &trigger_data->mode)) + schedule_delayed_work(&trigger_data->work, 0); + } + } +@@ -146,20 +146,16 @@ static ssize_t device_name_store(struct + static DEVICE_ATTR_RW(device_name); + + static ssize_t netdev_led_attr_show(struct device *dev, char *buf, +- enum netdev_led_attr attr) ++ enum led_trigger_netdev_modes attr) + { + struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev); + int bit; + + switch (attr) { +- case NETDEV_ATTR_LINK: +- bit = NETDEV_LED_LINK; +- break; +- case NETDEV_ATTR_TX: +- bit = NETDEV_LED_TX; +- break; +- case NETDEV_ATTR_RX: +- bit = NETDEV_LED_RX; ++ case TRIGGER_NETDEV_LINK: ++ case TRIGGER_NETDEV_TX: ++ case TRIGGER_NETDEV_RX: ++ bit = attr; + break; + default: + return -EINVAL; +@@ -169,7 +165,7 @@ static ssize_t netdev_led_attr_show(stru + } + + static ssize_t netdev_led_attr_store(struct device *dev, const char *buf, +- size_t size, enum netdev_led_attr attr) ++ size_t size, enum led_trigger_netdev_modes attr) + { + struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev); + unsigned long state; +@@ -181,14 +177,10 @@ static ssize_t netdev_led_attr_store(str + return ret; + + switch (attr) { +- case NETDEV_ATTR_LINK: +- bit = NETDEV_LED_LINK; +- break; +- case NETDEV_ATTR_TX: +- bit = NETDEV_LED_TX; +- break; +- case NETDEV_ATTR_RX: +- bit = NETDEV_LED_RX; ++ case TRIGGER_NETDEV_LINK: ++ case TRIGGER_NETDEV_TX: ++ case TRIGGER_NETDEV_RX: ++ bit = attr; + break; + default: + return -EINVAL; +@@ -360,21 +352,21 @@ static void netdev_trig_work(struct work + } + + /* If we are not looking for RX/TX then return */ +- if (!test_bit(NETDEV_LED_TX, &trigger_data->mode) && +- !test_bit(NETDEV_LED_RX, &trigger_data->mode)) ++ if (!test_bit(TRIGGER_NETDEV_TX, &trigger_data->mode) && ++ !test_bit(TRIGGER_NETDEV_RX, &trigger_data->mode)) + return; + + dev_stats = dev_get_stats(trigger_data->net_dev, &temp); + new_activity = +- (test_bit(NETDEV_LED_TX, &trigger_data->mode) ? ++ (test_bit(TRIGGER_NETDEV_TX, &trigger_data->mode) ? + dev_stats->tx_packets : 0) + +- (test_bit(NETDEV_LED_RX, &trigger_data->mode) ? ++ (test_bit(TRIGGER_NETDEV_RX, &trigger_data->mode) ? + dev_stats->rx_packets : 0); + + if (trigger_data->last_activity != new_activity) { + led_stop_software_blink(trigger_data->led_cdev); + +- invert = test_bit(NETDEV_LED_LINK, &trigger_data->mode); ++ invert = test_bit(TRIGGER_NETDEV_LINK, &trigger_data->mode); + interval = jiffies_to_msecs( + atomic_read(&trigger_data->interval)); + /* base state is ON (link present) */ diff --git a/target/linux/generic/backport-5.15/817-v6.5-04-leds-trigger-netdev-Convert-device-attr-to-macro.patch b/target/linux/generic/backport-5.15/817-v6.5-04-leds-trigger-netdev-Convert-device-attr-to-macro.patch new file mode 100644 index 00000000000000..3b45951f5706ad --- /dev/null +++ b/target/linux/generic/backport-5.15/817-v6.5-04-leds-trigger-netdev-Convert-device-attr-to-macro.patch @@ -0,0 +1,82 @@ +From 164b67d53476a9d114be85c885bd31f783835be4 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 19 Apr 2023 23:07:42 +0200 +Subject: [PATCH 4/5] leds: trigger: netdev: Convert device attr to macro + +Convert link tx and rx device attr to a common macro to reduce common +code and in preparation for additional attr. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20230419210743.3594-5-ansuelsmth@gmail.com +--- + drivers/leds/trigger/ledtrig-netdev.c | 57 ++++++++------------------- + 1 file changed, 16 insertions(+), 41 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -198,47 +198,22 @@ static ssize_t netdev_led_attr_store(str + return size; + } + +-static ssize_t link_show(struct device *dev, +- struct device_attribute *attr, char *buf) +-{ +- return netdev_led_attr_show(dev, buf, NETDEV_ATTR_LINK); +-} +- +-static ssize_t link_store(struct device *dev, +- struct device_attribute *attr, const char *buf, size_t size) +-{ +- return netdev_led_attr_store(dev, buf, size, NETDEV_ATTR_LINK); +-} +- +-static DEVICE_ATTR_RW(link); +- +-static ssize_t tx_show(struct device *dev, +- struct device_attribute *attr, char *buf) +-{ +- return netdev_led_attr_show(dev, buf, NETDEV_ATTR_TX); +-} +- +-static ssize_t tx_store(struct device *dev, +- struct device_attribute *attr, const char *buf, size_t size) +-{ +- return netdev_led_attr_store(dev, buf, size, NETDEV_ATTR_TX); +-} +- +-static DEVICE_ATTR_RW(tx); +- +-static ssize_t rx_show(struct device *dev, +- struct device_attribute *attr, char *buf) +-{ +- return netdev_led_attr_show(dev, buf, NETDEV_ATTR_RX); +-} +- +-static ssize_t rx_store(struct device *dev, +- struct device_attribute *attr, const char *buf, size_t size) +-{ +- return netdev_led_attr_store(dev, buf, size, NETDEV_ATTR_RX); +-} +- +-static DEVICE_ATTR_RW(rx); ++#define DEFINE_NETDEV_TRIGGER(trigger_name, trigger) \ ++ static ssize_t trigger_name##_show(struct device *dev, \ ++ struct device_attribute *attr, char *buf) \ ++ { \ ++ return netdev_led_attr_show(dev, buf, trigger); \ ++ } \ ++ static ssize_t trigger_name##_store(struct device *dev, \ ++ struct device_attribute *attr, const char *buf, size_t size) \ ++ { \ ++ return netdev_led_attr_store(dev, buf, size, trigger); \ ++ } \ ++ static DEVICE_ATTR_RW(trigger_name) ++ ++DEFINE_NETDEV_TRIGGER(link, TRIGGER_NETDEV_LINK); ++DEFINE_NETDEV_TRIGGER(tx, TRIGGER_NETDEV_TX); ++DEFINE_NETDEV_TRIGGER(rx, TRIGGER_NETDEV_RX); + + static ssize_t interval_show(struct device *dev, + struct device_attribute *attr, char *buf) diff --git a/target/linux/generic/backport-5.15/817-v6.5-05-leds-trigger-netdev-Use-mutex-instead-of-spinlocks.patch b/target/linux/generic/backport-5.15/817-v6.5-05-leds-trigger-netdev-Use-mutex-instead-of-spinlocks.patch new file mode 100644 index 00000000000000..180bee96128a5d --- /dev/null +++ b/target/linux/generic/backport-5.15/817-v6.5-05-leds-trigger-netdev-Use-mutex-instead-of-spinlocks.patch @@ -0,0 +1,106 @@ +From d1b9e1391ab2dc80e9db87fe8b2de015c651e4c9 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 19 Apr 2023 23:07:43 +0200 +Subject: [PATCH 5/5] leds: trigger: netdev: Use mutex instead of spinlocks + +Some LEDs may require to sleep while doing some operation like setting +brightness and other cleanup. + +For this reason, using a spinlock will cause a sleep under spinlock +warning. + +It should be safe to convert this to a sleepable lock since: +- sysfs read/write can sleep +- netdev_trig_work is a work queue and can sleep +- netdev _trig_notify can sleep + +The spinlock was used when brightness didn't support sleeping, but this +changed and now it supported with brightness_set_blocking(). + +Convert to mutex lock to permit sleeping using brightness_set_blocking(). + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20230419210743.3594-6-ansuelsmth@gmail.com +--- + drivers/leds/trigger/ledtrig-netdev.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -20,7 +20,7 @@ + #include + #include + #include +-#include ++#include + #include + #include "../leds.h" + +@@ -37,7 +37,7 @@ + */ + + struct led_netdev_data { +- spinlock_t lock; ++ struct mutex lock; + + struct delayed_work work; + struct notifier_block notifier; +@@ -97,9 +97,9 @@ static ssize_t device_name_show(struct d + struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev); + ssize_t len; + +- spin_lock_bh(&trigger_data->lock); ++ mutex_lock(&trigger_data->lock); + len = sprintf(buf, "%s\n", trigger_data->device_name); +- spin_unlock_bh(&trigger_data->lock); ++ mutex_unlock(&trigger_data->lock); + + return len; + } +@@ -115,7 +115,7 @@ static ssize_t device_name_store(struct + + cancel_delayed_work_sync(&trigger_data->work); + +- spin_lock_bh(&trigger_data->lock); ++ mutex_lock(&trigger_data->lock); + + if (trigger_data->net_dev) { + dev_put(trigger_data->net_dev); +@@ -138,7 +138,7 @@ static ssize_t device_name_store(struct + trigger_data->last_activity = 0; + + set_baseline_state(trigger_data); +- spin_unlock_bh(&trigger_data->lock); ++ mutex_unlock(&trigger_data->lock); + + return size; + } +@@ -279,7 +279,7 @@ static int netdev_trig_notify(struct not + + cancel_delayed_work_sync(&trigger_data->work); + +- spin_lock_bh(&trigger_data->lock); ++ mutex_lock(&trigger_data->lock); + + trigger_data->carrier_link_up = false; + switch (evt) { +@@ -304,7 +304,7 @@ static int netdev_trig_notify(struct not + + set_baseline_state(trigger_data); + +- spin_unlock_bh(&trigger_data->lock); ++ mutex_unlock(&trigger_data->lock); + + return NOTIFY_DONE; + } +@@ -365,7 +365,7 @@ static int netdev_trig_activate(struct l + if (!trigger_data) + return -ENOMEM; + +- spin_lock_init(&trigger_data->lock); ++ mutex_init(&trigger_data->lock); + + trigger_data->notifier.notifier_call = netdev_trig_notify; + trigger_data->notifier.priority = 10; diff --git a/target/linux/generic/backport-5.15/818-v6.5-01-leds-add-APIs-for-LEDs-hw-control.patch b/target/linux/generic/backport-5.15/818-v6.5-01-leds-add-APIs-for-LEDs-hw-control.patch new file mode 100644 index 00000000000000..ac186117338ff5 --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-01-leds-add-APIs-for-LEDs-hw-control.patch @@ -0,0 +1,74 @@ +From ed554d3f945179c5b159bddfad7be34b403fe11a Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:31 +0200 +Subject: [PATCH 01/13] leds: add APIs for LEDs hw control + +Add an option to permit LED driver to declare support for a specific +trigger to use hw control and setup the LED to blink based on specific +provided modes. + +Add APIs for LEDs hw control. These functions will be used to activate +hardware control where a LED will use the provided flags, from an +unique defined supported trigger, to setup the LED to be driven by +hardware. + +Add hw_control_is_supported() to ask the LED driver if the requested +mode by the trigger are supported and the LED can be setup to follow +the requested modes. + +Deactivate hardware blink control by setting brightness to LED_OFF via +the brightness_set() callback. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + include/linux/leds.h | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -164,6 +164,43 @@ struct led_classdev { + + /* LEDs that have private triggers have this set */ + struct led_hw_trigger_type *trigger_type; ++ ++ /* Unique trigger name supported by LED set in hw control mode */ ++ const char *hw_control_trigger; ++ /* ++ * Check if the LED driver supports the requested mode provided by the ++ * defined supported trigger to setup the LED to hw control mode. ++ * ++ * Return 0 on success. Return -EOPNOTSUPP when the passed flags are not ++ * supported and software fallback needs to be used. ++ * Return a negative error number on any other case for check fail due ++ * to various reason like device not ready or timeouts. ++ */ ++ int (*hw_control_is_supported)(struct led_classdev *led_cdev, ++ unsigned long flags); ++ /* ++ * Activate hardware control, LED driver will use the provided flags ++ * from the supported trigger and setup the LED to be driven by hardware ++ * following the requested mode from the trigger flags. ++ * Deactivate hardware blink control by setting brightness to LED_OFF via ++ * the brightness_set() callback. ++ * ++ * Return 0 on success, a negative error number on flags apply fail. ++ */ ++ int (*hw_control_set)(struct led_classdev *led_cdev, ++ unsigned long flags); ++ /* ++ * Get from the LED driver the current mode that the LED is set in hw ++ * control mode and put them in flags. ++ * Trigger can use this to get the initial state of a LED already set in ++ * hardware blink control. ++ * ++ * Return 0 on success, a negative error number on failing parsing the ++ * initial mode. Error from this function is NOT FATAL as the device ++ * may be in a not supported initial state by the attached LED trigger. ++ */ ++ int (*hw_control_get)(struct led_classdev *led_cdev, ++ unsigned long *flags); + #endif + + #ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED diff --git a/target/linux/generic/backport-5.15/818-v6.5-02-leds-add-API-to-get-attached-device-for-LED-hw-contr.patch b/target/linux/generic/backport-5.15/818-v6.5-02-leds-add-API-to-get-attached-device-for-LED-hw-contr.patch new file mode 100644 index 00000000000000..1a221727a01d7d --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-02-leds-add-API-to-get-attached-device-for-LED-hw-contr.patch @@ -0,0 +1,37 @@ +From 052c38eb17e866c5b4cd43924e7a5e20167b55c0 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 29 May 2023 18:32:32 +0200 +Subject: [PATCH 02/13] leds: add API to get attached device for LED hw control + +Some specific LED triggers blink the LED based on events from a device +or subsystem. +For example, an LED could be blinked to indicate a network device is +receiving packets, or a disk is reading blocks. To correctly enable and +request the hw control of the LED, the trigger has to check if the +network interface or block device configured via a /sys/class/led file +match the one the LED driver provide for hw control for. + +Provide an API call to get the device which the LED blinks for. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + include/linux/leds.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -201,6 +201,12 @@ struct led_classdev { + */ + int (*hw_control_get)(struct led_classdev *led_cdev, + unsigned long *flags); ++ /* ++ * Get the device this LED blinks in response to. ++ * e.g. for a PHY LED, it is the network device. If the LED is ++ * not yet associated to a device, return NULL. ++ */ ++ struct device *(*hw_control_get_device)(struct led_classdev *led_cdev); + #endif + + #ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED diff --git a/target/linux/generic/backport-5.15/818-v6.5-03-Documentation-leds-leds-class-Document-new-Hardware-.patch b/target/linux/generic/backport-5.15/818-v6.5-03-Documentation-leds-leds-class-Document-new-Hardware-.patch new file mode 100644 index 00000000000000..af9fb7fdc36526 --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-03-Documentation-leds-leds-class-Document-new-Hardware-.patch @@ -0,0 +1,113 @@ +From 8aa2fd7b66980ecd2e45e95af61cf7eafede1211 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:33 +0200 +Subject: [PATCH 03/13] Documentation: leds: leds-class: Document new Hardware + driven LEDs APIs + +Document new Hardware driven LEDs APIs. + +Some LEDs can be programmed to be driven by hardware. This is not +limited to blink but also to turn off or on autonomously. +To support this feature, a LED needs to implement various additional +ops and needs to declare specific support for the supported triggers. + +Add documentation for each required value and API to make hw control +possible and implementable by both LEDs and triggers. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + Documentation/leds/leds-class.rst | 81 +++++++++++++++++++++++++++++++ + 1 file changed, 81 insertions(+) + +--- a/Documentation/leds/leds-class.rst ++++ b/Documentation/leds/leds-class.rst +@@ -169,6 +169,87 @@ Setting the brightness to zero with brig + should completely turn off the LED and cancel the previously programmed + hardware blinking function, if any. + ++Hardware driven LEDs ++==================== ++ ++Some LEDs can be programmed to be driven by hardware. This is not ++limited to blink but also to turn off or on autonomously. ++To support this feature, a LED needs to implement various additional ++ops and needs to declare specific support for the supported triggers. ++ ++With hw control we refer to the LED driven by hardware. ++ ++LED driver must define the following value to support hw control: ++ ++ - hw_control_trigger: ++ unique trigger name supported by the LED in hw control ++ mode. ++ ++LED driver must implement the following API to support hw control: ++ - hw_control_is_supported: ++ check if the flags passed by the supported trigger can ++ be parsed and activate hw control on the LED. ++ ++ Return 0 if the passed flags mask is supported and ++ can be set with hw_control_set(). ++ ++ If the passed flags mask is not supported -EOPNOTSUPP ++ must be returned, the LED trigger will use software ++ fallback in this case. ++ ++ Return a negative error in case of any other error like ++ device not ready or timeouts. ++ ++ - hw_control_set: ++ activate hw control. LED driver will use the provided ++ flags passed from the supported trigger, parse them to ++ a set of mode and setup the LED to be driven by hardware ++ following the requested modes. ++ ++ Set LED_OFF via the brightness_set to deactivate hw control. ++ ++ Return 0 on success, a negative error number on failing to ++ apply flags. ++ ++ - hw_control_get: ++ get active modes from a LED already in hw control, parse ++ them and set in flags the current active flags for the ++ supported trigger. ++ ++ Return 0 on success, a negative error number on failing ++ parsing the initial mode. ++ Error from this function is NOT FATAL as the device may ++ be in a not supported initial state by the attached LED ++ trigger. ++ ++ - hw_control_get_device: ++ return the device associated with the LED driver in ++ hw control. A trigger might use this to match the ++ returned device from this function with a configured ++ device for the trigger as the source for blinking ++ events and correctly enable hw control. ++ (example a netdev trigger configured to blink for a ++ particular dev match the returned dev from get_device ++ to set hw control) ++ ++ Returns a pointer to a struct device or NULL if nothing ++ is currently attached. ++ ++LED driver can activate additional modes by default to workaround the ++impossibility of supporting each different mode on the supported trigger. ++Examples are hardcoding the blink speed to a set interval, enable special ++feature like bypassing blink if some requirements are not met. ++ ++A trigger should first check if the hw control API are supported by the LED ++driver and check if the trigger is supported to verify if hw control is possible, ++use hw_control_is_supported to check if the flags are supported and only at ++the end use hw_control_set to activate hw control. ++ ++A trigger can use hw_control_get to check if a LED is already in hw control ++and init their flags. ++ ++When the LED is in hw control, no software blink is possible and doing so ++will effectively disable hw control. + + Known Issues + ============ diff --git a/target/linux/generic/backport-5.15/818-v6.5-04-leds-trigger-netdev-refactor-code-setting-device-nam.patch b/target/linux/generic/backport-5.15/818-v6.5-04-leds-trigger-netdev-refactor-code-setting-device-nam.patch new file mode 100644 index 00000000000000..3c804c0b412e3c --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-04-leds-trigger-netdev-refactor-code-setting-device-nam.patch @@ -0,0 +1,69 @@ +From 28a6a2ef18ad840a390d519840c303b03040961c Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 29 May 2023 18:32:34 +0200 +Subject: [PATCH 04/13] leds: trigger: netdev: refactor code setting device + name + +Move the code into a helper, ready for it to be called at +other times. No intended behaviour change. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 29 ++++++++++++++++++--------- + 1 file changed, 20 insertions(+), 9 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -104,15 +104,9 @@ static ssize_t device_name_show(struct d + return len; + } + +-static ssize_t device_name_store(struct device *dev, +- struct device_attribute *attr, const char *buf, +- size_t size) ++static int set_device_name(struct led_netdev_data *trigger_data, ++ const char *name, size_t size) + { +- struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev); +- +- if (size >= IFNAMSIZ) +- return -EINVAL; +- + cancel_delayed_work_sync(&trigger_data->work); + + mutex_lock(&trigger_data->lock); +@@ -122,7 +116,7 @@ static ssize_t device_name_store(struct + trigger_data->net_dev = NULL; + } + +- memcpy(trigger_data->device_name, buf, size); ++ memcpy(trigger_data->device_name, name, size); + trigger_data->device_name[size] = 0; + if (size > 0 && trigger_data->device_name[size - 1] == '\n') + trigger_data->device_name[size - 1] = 0; +@@ -140,6 +134,23 @@ static ssize_t device_name_store(struct + set_baseline_state(trigger_data); + mutex_unlock(&trigger_data->lock); + ++ return 0; ++} ++ ++static ssize_t device_name_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, ++ size_t size) ++{ ++ struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev); ++ int ret; ++ ++ if (size >= IFNAMSIZ) ++ return -EINVAL; ++ ++ ret = set_device_name(trigger_data, buf, size); ++ ++ if (ret < 0) ++ return ret; + return size; + } + diff --git a/target/linux/generic/backport-5.15/818-v6.5-05-leds-trigger-netdev-introduce-check-for-possible-hw-.patch b/target/linux/generic/backport-5.15/818-v6.5-05-leds-trigger-netdev-introduce-check-for-possible-hw-.patch new file mode 100644 index 00000000000000..284b519482cfed --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-05-leds-trigger-netdev-introduce-check-for-possible-hw-.patch @@ -0,0 +1,54 @@ +From 4fd1b6d47a7a38e81fdc6f8be2ccd4216b3f93db Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:35 +0200 +Subject: [PATCH 05/13] leds: trigger: netdev: introduce check for possible hw + control + +Introduce function to check if the requested mode can use hw control in +preparation for hw control support. Currently everything is handled in +software so can_hw_control will always return false. + +Add knob with the new value hw_control in trigger_data struct to +set hw control possible. Useful for future implementation to implement +in set_baseline_state() the required function to set the requested mode +using LEDs hw control ops and in other function to reject set if hw +control is currently active. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -51,6 +51,7 @@ struct led_netdev_data { + + unsigned long mode; + bool carrier_link_up; ++ bool hw_control; + }; + + enum led_trigger_netdev_modes { +@@ -91,6 +92,11 @@ static void set_baseline_state(struct le + } + } + ++static bool can_hw_control(struct led_netdev_data *trigger_data) ++{ ++ return false; ++} ++ + static ssize_t device_name_show(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -204,6 +210,8 @@ static ssize_t netdev_led_attr_store(str + else + clear_bit(bit, &trigger_data->mode); + ++ trigger_data->hw_control = can_hw_control(trigger_data); ++ + set_baseline_state(trigger_data); + + return size; diff --git a/target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch b/target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch new file mode 100644 index 00000000000000..09759bc623e9c0 --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch @@ -0,0 +1,42 @@ +From 6352f25f9fadba59d5df2ba7139495759ccc81d5 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:36 +0200 +Subject: [PATCH 06/13] leds: trigger: netdev: add basic check for hw control + support + +Add basic check for hw control support. Check if the required API are +defined and check if the defined trigger supported in hw control for the +LED driver match netdev. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -92,8 +92,22 @@ static void set_baseline_state(struct le + } + } + ++static bool supports_hw_control(struct led_classdev *led_cdev) ++{ ++ if (!led_cdev->hw_control_get || !led_cdev->hw_control_set || ++ !led_cdev->hw_control_is_supported) ++ return false; ++ ++ return !strcmp(led_cdev->hw_control_trigger, led_cdev->trigger->name); ++} ++ + static bool can_hw_control(struct led_netdev_data *trigger_data) + { ++ struct led_classdev *led_cdev = trigger_data->led_cdev; ++ ++ if (!supports_hw_control(led_cdev)) ++ return false; ++ + return false; + } + diff --git a/target/linux/generic/backport-5.15/818-v6.5-07-leds-trigger-netdev-reject-interval-store-for-hw_con.patch b/target/linux/generic/backport-5.15/818-v6.5-07-leds-trigger-netdev-reject-interval-store-for-hw_con.patch new file mode 100644 index 00000000000000..66349068003149 --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-07-leds-trigger-netdev-reject-interval-store-for-hw_con.patch @@ -0,0 +1,28 @@ +From c84c80c7388f887b10dafd70fc55bc6c5fe9fa5a Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:37 +0200 +Subject: [PATCH 07/13] leds: trigger: netdev: reject interval store for + hw_control + +Reject interval store with hw_control enabled. It's are currently not +supported and MUST be set to the default value with hw control enabled. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -265,6 +265,9 @@ static ssize_t interval_store(struct dev + unsigned long value; + int ret; + ++ if (trigger_data->hw_control) ++ return -EINVAL; ++ + ret = kstrtoul(buf, 0, &value); + if (ret) + return ret; diff --git a/target/linux/generic/backport-5.15/818-v6.5-08-leds-trigger-netdev-add-support-for-LED-hw-control.patch b/target/linux/generic/backport-5.15/818-v6.5-08-leds-trigger-netdev-add-support-for-LED-hw-control.patch new file mode 100644 index 00000000000000..52faa4809b2ae0 --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-08-leds-trigger-netdev-add-support-for-LED-hw-control.patch @@ -0,0 +1,107 @@ +From 7c145a34ba6e380616af93262fcab9fc7261d851 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:38 +0200 +Subject: [PATCH 08/13] leds: trigger: netdev: add support for LED hw control + +Add support for LED hw control for the netdev trigger. + +The trigger on calling set_baseline_state to configure a new mode, will +do various check to verify if hw control can be used for the requested +mode in can_hw_control() function. + +It will first check if the LED driver supports hw control for the netdev +trigger, then will use hw_control_is_supported() and finally will call +hw_control_set() to apply the requested mode. + +To use such mode, interval MUST be set to the default value and net_dev +MUST be set. If one of these 2 value are not valid, hw control will +never be used and normal software fallback is used. + +The default interval value is moved to a define to make sure they are +always synced. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 43 +++++++++++++++++++++++++-- + 1 file changed, 41 insertions(+), 2 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -24,6 +24,8 @@ + #include + #include "../leds.h" + ++#define NETDEV_LED_DEFAULT_INTERVAL 50 ++ + /* + * Configurable sysfs attributes: + * +@@ -68,6 +70,13 @@ static void set_baseline_state(struct le + int current_brightness; + struct led_classdev *led_cdev = trigger_data->led_cdev; + ++ /* Already validated, hw control is possible with the requested mode */ ++ if (trigger_data->hw_control) { ++ led_cdev->hw_control_set(led_cdev, trigger_data->mode); ++ ++ return; ++ } ++ + current_brightness = led_cdev->brightness; + if (current_brightness) + led_cdev->blink_brightness = current_brightness; +@@ -103,12 +112,42 @@ static bool supports_hw_control(struct l + + static bool can_hw_control(struct led_netdev_data *trigger_data) + { ++ unsigned long default_interval = msecs_to_jiffies(NETDEV_LED_DEFAULT_INTERVAL); ++ unsigned int interval = atomic_read(&trigger_data->interval); + struct led_classdev *led_cdev = trigger_data->led_cdev; ++ int ret; + + if (!supports_hw_control(led_cdev)) + return false; + +- return false; ++ /* ++ * Interval must be set to the default ++ * value. Any different value is rejected if in hw ++ * control. ++ */ ++ if (interval != default_interval) ++ return false; ++ ++ /* ++ * net_dev must be set with hw control, otherwise no ++ * blinking can be happening and there is nothing to ++ * offloaded. ++ */ ++ if (!trigger_data->net_dev) ++ return false; ++ ++ /* Check if the requested mode is supported */ ++ ret = led_cdev->hw_control_is_supported(led_cdev, trigger_data->mode); ++ /* Fall back to software blinking if not supported */ ++ if (ret == -EOPNOTSUPP) ++ return false; ++ if (ret) { ++ dev_warn(led_cdev->dev, ++ "Current mode check failed with error %d\n", ret); ++ return false; ++ } ++ ++ return true; + } + + static ssize_t device_name_show(struct device *dev, +@@ -413,7 +452,7 @@ static int netdev_trig_activate(struct l + trigger_data->device_name[0] = 0; + + trigger_data->mode = 0; +- atomic_set(&trigger_data->interval, msecs_to_jiffies(50)); ++ atomic_set(&trigger_data->interval, msecs_to_jiffies(NETDEV_LED_DEFAULT_INTERVAL)); + trigger_data->last_activity = 0; + + led_set_trigger_data(led_cdev, trigger_data); diff --git a/target/linux/generic/backport-5.15/818-v6.5-09-leds-trigger-netdev-validate-configured-netdev.patch b/target/linux/generic/backport-5.15/818-v6.5-09-leds-trigger-netdev-validate-configured-netdev.patch new file mode 100644 index 00000000000000..c129ffa4f5944c --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-09-leds-trigger-netdev-validate-configured-netdev.patch @@ -0,0 +1,58 @@ +From 33ec0b53befff2c0a7f3aa19ff08556d60585d6b Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 29 May 2023 18:32:39 +0200 +Subject: [PATCH 09/13] leds: trigger: netdev: validate configured netdev + +The netdev which the LED should blink for is configurable in +/sys/class/led/foo/device_name. Ensure when offloading that the +configured netdev is the same as the netdev the LED is associated +with. If it is not, only perform software blinking. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -110,6 +110,24 @@ static bool supports_hw_control(struct l + return !strcmp(led_cdev->hw_control_trigger, led_cdev->trigger->name); + } + ++/* ++ * Validate the configured netdev is the same as the one associated with ++ * the LED driver in hw control. ++ */ ++static bool validate_net_dev(struct led_classdev *led_cdev, ++ struct net_device *net_dev) ++{ ++ struct device *dev = led_cdev->hw_control_get_device(led_cdev); ++ struct net_device *ndev; ++ ++ if (!dev) ++ return false; ++ ++ ndev = to_net_dev(dev); ++ ++ return ndev == net_dev; ++} ++ + static bool can_hw_control(struct led_netdev_data *trigger_data) + { + unsigned long default_interval = msecs_to_jiffies(NETDEV_LED_DEFAULT_INTERVAL); +@@ -131,9 +149,11 @@ static bool can_hw_control(struct led_ne + /* + * net_dev must be set with hw control, otherwise no + * blinking can be happening and there is nothing to +- * offloaded. ++ * offloaded. Additionally, for hw control to be ++ * valid, the configured netdev must be the same as ++ * netdev associated to the LED. + */ +- if (!trigger_data->net_dev) ++ if (!validate_net_dev(led_cdev, trigger_data->net_dev)) + return false; + + /* Check if the requested mode is supported */ diff --git a/target/linux/generic/backport-5.15/818-v6.5-10-leds-trigger-netdev-init-mode-if-hw-control-already-.patch b/target/linux/generic/backport-5.15/818-v6.5-10-leds-trigger-netdev-init-mode-if-hw-control-already-.patch new file mode 100644 index 00000000000000..e20594c99a3eaa --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-10-leds-trigger-netdev-init-mode-if-hw-control-already-.patch @@ -0,0 +1,53 @@ +From 0316cc5629d15880dd3f097d221c55ca648bcd61 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:40 +0200 +Subject: [PATCH 10/13] leds: trigger: netdev: init mode if hw control already + active + +On netdev trigger activation, hw control may be already active by +default. If this is the case and a device is actually provided by +hw_control_get_device(), init the already active mode and set the +bool to hw_control bool to true to reflect the already set mode in the +trigger_data. + +Co-developed-by: Andrew Lunn +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -454,6 +454,8 @@ static void netdev_trig_work(struct work + static int netdev_trig_activate(struct led_classdev *led_cdev) + { + struct led_netdev_data *trigger_data; ++ unsigned long mode; ++ struct device *dev; + int rc; + + trigger_data = kzalloc(sizeof(struct led_netdev_data), GFP_KERNEL); +@@ -475,6 +477,21 @@ static int netdev_trig_activate(struct l + atomic_set(&trigger_data->interval, msecs_to_jiffies(NETDEV_LED_DEFAULT_INTERVAL)); + trigger_data->last_activity = 0; + ++ /* Check if hw control is active by default on the LED. ++ * Init already enabled mode in hw control. ++ */ ++ if (supports_hw_control(led_cdev) && ++ !led_cdev->hw_control_get(led_cdev, &mode)) { ++ dev = led_cdev->hw_control_get_device(led_cdev); ++ if (dev) { ++ const char *name = dev_name(dev); ++ ++ set_device_name(trigger_data, name, strlen(name)); ++ trigger_data->hw_control = true; ++ trigger_data->mode = mode; ++ } ++ } ++ + led_set_trigger_data(led_cdev, trigger_data); + + rc = register_netdevice_notifier(&trigger_data->notifier); diff --git a/target/linux/generic/backport-5.15/818-v6.5-11-leds-trigger-netdev-expose-netdev-trigger-modes-in-l.patch b/target/linux/generic/backport-5.15/818-v6.5-11-leds-trigger-netdev-expose-netdev-trigger-modes-in-l.patch new file mode 100644 index 00000000000000..70aed850d13b4c --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-11-leds-trigger-netdev-expose-netdev-trigger-modes-in-l.patch @@ -0,0 +1,54 @@ +From 947acacab5ea151291b861cdfbde16ff5cf1b08c Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:41 +0200 +Subject: [PATCH 11/13] leds: trigger: netdev: expose netdev trigger modes in + linux include + +Expose netdev trigger modes to make them accessible by LED driver that +will support netdev trigger for hw control. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/leds/trigger/ledtrig-netdev.c | 9 --------- + include/linux/leds.h | 10 ++++++++++ + 2 files changed, 10 insertions(+), 9 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -56,15 +56,6 @@ struct led_netdev_data { + bool hw_control; + }; + +-enum led_trigger_netdev_modes { +- TRIGGER_NETDEV_LINK = 0, +- TRIGGER_NETDEV_TX, +- TRIGGER_NETDEV_RX, +- +- /* Keep last */ +- __TRIGGER_NETDEV_MAX, +-}; +- + static void set_baseline_state(struct led_netdev_data *trigger_data) + { + int current_brightness; +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -527,6 +527,16 @@ static inline void *led_get_trigger_data + + #endif /* CONFIG_LEDS_TRIGGERS */ + ++/* Trigger specific enum */ ++enum led_trigger_netdev_modes { ++ TRIGGER_NETDEV_LINK = 0, ++ TRIGGER_NETDEV_TX, ++ TRIGGER_NETDEV_RX, ++ ++ /* Keep last */ ++ __TRIGGER_NETDEV_MAX, ++}; ++ + /* Trigger specific functions */ + #ifdef CONFIG_LEDS_TRIGGER_DISK + void ledtrig_disk_activity(bool write); diff --git a/target/linux/generic/backport-5.15/818-v6.5-12-net-dsa-qca8k-implement-hw_control-ops.patch b/target/linux/generic/backport-5.15/818-v6.5-12-net-dsa-qca8k-implement-hw_control-ops.patch new file mode 100644 index 00000000000000..ad76d89b7bf842 --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-12-net-dsa-qca8k-implement-hw_control-ops.patch @@ -0,0 +1,200 @@ +From e0256648c831af13cbfe4a1787327fcec01c2807 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 29 May 2023 18:32:42 +0200 +Subject: [PATCH 12/13] net: dsa: qca8k: implement hw_control ops + +Implement hw_control ops to drive Switch LEDs based on hardware events. + +Netdev trigger is the declared supported trigger for hw control +operation and supports the following mode: +- tx +- rx + +When hw_control_set is called, LEDs are set to follow the requested +mode. +Each LEDs will blink at 4Hz by default. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-leds.c | 154 +++++++++++++++++++++++++++++++ + 1 file changed, 154 insertions(+) + +--- a/drivers/net/dsa/qca/qca8k-leds.c ++++ b/drivers/net/dsa/qca/qca8k-leds.c +@@ -32,6 +32,43 @@ qca8k_get_enable_led_reg(int port_num, i + } + + static int ++qca8k_get_control_led_reg(int port_num, int led_num, struct qca8k_led_pattern_en *reg_info) ++{ ++ reg_info->reg = QCA8K_LED_CTRL_REG(led_num); ++ ++ /* 6 total control rule: ++ * 3 control rules for phy0-3 that applies to all their leds ++ * 3 control rules for phy4 ++ */ ++ if (port_num == 4) ++ reg_info->shift = QCA8K_LED_PHY4_CONTROL_RULE_SHIFT; ++ else ++ reg_info->shift = QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT; ++ ++ return 0; ++} ++ ++static int ++qca8k_parse_netdev(unsigned long rules, u32 *offload_trigger) ++{ ++ /* Parsing specific to netdev trigger */ ++ if (test_bit(TRIGGER_NETDEV_TX, &rules)) ++ *offload_trigger |= QCA8K_LED_TX_BLINK_MASK; ++ if (test_bit(TRIGGER_NETDEV_RX, &rules)) ++ *offload_trigger |= QCA8K_LED_RX_BLINK_MASK; ++ ++ if (rules && !*offload_trigger) ++ return -EOPNOTSUPP; ++ ++ /* Enable some default rule by default to the requested mode: ++ * - Blink at 4Hz by default ++ */ ++ *offload_trigger |= QCA8K_LED_BLINK_4HZ; ++ ++ return 0; ++} ++ ++static int + qca8k_led_brightness_set(struct qca8k_led *led, + enum led_brightness brightness) + { +@@ -165,6 +202,119 @@ qca8k_cled_blink_set(struct led_classdev + } + + static int ++qca8k_cled_trigger_offload(struct led_classdev *ldev, bool enable) ++{ ++ struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); ++ ++ struct qca8k_led_pattern_en reg_info; ++ struct qca8k_priv *priv = led->priv; ++ u32 mask, val = QCA8K_LED_ALWAYS_OFF; ++ ++ qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); ++ ++ if (enable) ++ val = QCA8K_LED_RULE_CONTROLLED; ++ ++ if (led->port_num == 0 || led->port_num == 4) { ++ mask = QCA8K_LED_PATTERN_EN_MASK; ++ val <<= QCA8K_LED_PATTERN_EN_SHIFT; ++ } else { ++ mask = QCA8K_LED_PHY123_PATTERN_EN_MASK; ++ } ++ ++ return regmap_update_bits(priv->regmap, reg_info.reg, mask << reg_info.shift, ++ val << reg_info.shift); ++} ++ ++static bool ++qca8k_cled_hw_control_status(struct led_classdev *ldev) ++{ ++ struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); ++ ++ struct qca8k_led_pattern_en reg_info; ++ struct qca8k_priv *priv = led->priv; ++ u32 val; ++ ++ qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); ++ ++ regmap_read(priv->regmap, reg_info.reg, &val); ++ ++ val >>= reg_info.shift; ++ ++ if (led->port_num == 0 || led->port_num == 4) { ++ val &= QCA8K_LED_PATTERN_EN_MASK; ++ val >>= QCA8K_LED_PATTERN_EN_SHIFT; ++ } else { ++ val &= QCA8K_LED_PHY123_PATTERN_EN_MASK; ++ } ++ ++ return val == QCA8K_LED_RULE_CONTROLLED; ++} ++ ++static int ++qca8k_cled_hw_control_is_supported(struct led_classdev *ldev, unsigned long rules) ++{ ++ u32 offload_trigger = 0; ++ ++ return qca8k_parse_netdev(rules, &offload_trigger); ++} ++ ++static int ++qca8k_cled_hw_control_set(struct led_classdev *ldev, unsigned long rules) ++{ ++ struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); ++ struct qca8k_led_pattern_en reg_info; ++ struct qca8k_priv *priv = led->priv; ++ u32 offload_trigger = 0; ++ int ret; ++ ++ ret = qca8k_parse_netdev(rules, &offload_trigger); ++ if (ret) ++ return ret; ++ ++ ret = qca8k_cled_trigger_offload(ldev, true); ++ if (ret) ++ return ret; ++ ++ qca8k_get_control_led_reg(led->port_num, led->led_num, ®_info); ++ ++ return regmap_update_bits(priv->regmap, reg_info.reg, ++ QCA8K_LED_RULE_MASK << reg_info.shift, ++ offload_trigger << reg_info.shift); ++} ++ ++static int ++qca8k_cled_hw_control_get(struct led_classdev *ldev, unsigned long *rules) ++{ ++ struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); ++ struct qca8k_led_pattern_en reg_info; ++ struct qca8k_priv *priv = led->priv; ++ u32 val; ++ int ret; ++ ++ /* With hw control not active return err */ ++ if (!qca8k_cled_hw_control_status(ldev)) ++ return -EINVAL; ++ ++ qca8k_get_control_led_reg(led->port_num, led->led_num, ®_info); ++ ++ ret = regmap_read(priv->regmap, reg_info.reg, &val); ++ if (ret) ++ return ret; ++ ++ val >>= reg_info.shift; ++ val &= QCA8K_LED_RULE_MASK; ++ ++ /* Parsing specific to netdev trigger */ ++ if (val & QCA8K_LED_TX_BLINK_MASK) ++ set_bit(TRIGGER_NETDEV_TX, rules); ++ if (val & QCA8K_LED_RX_BLINK_MASK) ++ set_bit(TRIGGER_NETDEV_RX, rules); ++ ++ return 0; ++} ++ ++static int + qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int port_num) + { + struct fwnode_handle *led = NULL, *leds = NULL; +@@ -224,6 +374,10 @@ qca8k_parse_port_leds(struct qca8k_priv + port_led->cdev.max_brightness = 1; + port_led->cdev.brightness_set_blocking = qca8k_cled_brightness_set_blocking; + port_led->cdev.blink_set = qca8k_cled_blink_set; ++ port_led->cdev.hw_control_is_supported = qca8k_cled_hw_control_is_supported; ++ port_led->cdev.hw_control_set = qca8k_cled_hw_control_set; ++ port_led->cdev.hw_control_get = qca8k_cled_hw_control_get; ++ port_led->cdev.hw_control_trigger = "netdev"; + init_data.default_label = ":port"; + init_data.fwnode = led; + init_data.devname_mandatory = true; diff --git a/target/linux/generic/backport-5.15/818-v6.5-13-net-dsa-qca8k-add-op-to-get-ports-netdev.patch b/target/linux/generic/backport-5.15/818-v6.5-13-net-dsa-qca8k-add-op-to-get-ports-netdev.patch new file mode 100644 index 00000000000000..feb6b9e1e4e8e4 --- /dev/null +++ b/target/linux/generic/backport-5.15/818-v6.5-13-net-dsa-qca8k-add-op-to-get-ports-netdev.patch @@ -0,0 +1,70 @@ +From 4f53c27f772e27e4cf4e5507d6f4d5980002cb6a Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Mon, 29 May 2023 18:32:43 +0200 +Subject: [PATCH 13/13] net: dsa: qca8k: add op to get ports netdev + +In order that the LED trigger can blink the switch MAC ports LED, it +needs to know the netdev associated to the port. Add the callback to +return the struct device of the netdev. + +Add an helper function qca8k_phy_to_port() to convert the phy back to +dsa_port index, as we reference LED port based on the internal PHY +index and needs to be converted back. + +Signed-off-by: Andrew Lunn +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-leds.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +--- a/drivers/net/dsa/qca/qca8k-leds.c ++++ b/drivers/net/dsa/qca/qca8k-leds.c +@@ -5,6 +5,18 @@ + #include "qca8k.h" + #include "qca8k_leds.h" + ++static u32 qca8k_phy_to_port(int phy) ++{ ++ /* Internal PHY 0 has port at index 1. ++ * Internal PHY 1 has port at index 2. ++ * Internal PHY 2 has port at index 3. ++ * Internal PHY 3 has port at index 4. ++ * Internal PHY 4 has port at index 5. ++ */ ++ ++ return phy + 1; ++} ++ + static int + qca8k_get_enable_led_reg(int port_num, int led_num, struct qca8k_led_pattern_en *reg_info) + { +@@ -314,6 +326,20 @@ qca8k_cled_hw_control_get(struct led_cla + return 0; + } + ++static struct device *qca8k_cled_hw_control_get_device(struct led_classdev *ldev) ++{ ++ struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); ++ struct qca8k_priv *priv = led->priv; ++ struct dsa_port *dp; ++ ++ dp = dsa_to_port(priv->ds, qca8k_phy_to_port(led->port_num)); ++ if (!dp) ++ return NULL; ++ if (dp->slave) ++ return &dp->slave->dev; ++ return NULL; ++} ++ + static int + qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int port_num) + { +@@ -377,6 +403,7 @@ qca8k_parse_port_leds(struct qca8k_priv + port_led->cdev.hw_control_is_supported = qca8k_cled_hw_control_is_supported; + port_led->cdev.hw_control_set = qca8k_cled_hw_control_set; + port_led->cdev.hw_control_get = qca8k_cled_hw_control_get; ++ port_led->cdev.hw_control_get_device = qca8k_cled_hw_control_get_device; + port_led->cdev.hw_control_trigger = "netdev"; + init_data.default_label = ":port"; + init_data.fwnode = led; diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 5cac839f593c70..6f28147ee3a0af 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -4069,6 +4069,7 @@ CONFIG_NET_CORE=y # CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set # CONFIG_NET_DSA_MV88E6XXX_PTP is not set # CONFIG_NET_DSA_QCA8K is not set +# CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT is not set # CONFIG_NET_DSA_REALTEK_SMI is not set # CONFIG_NET_DSA_SJA1105 is not set # CONFIG_NET_DSA_SMSC_LAN9303_I2C is not set diff --git a/target/linux/generic/hack-5.15/700-swconfig_switch_drivers.patch b/target/linux/generic/hack-5.15/700-swconfig_switch_drivers.patch index 48be4400256c8d..9d77efaca6ef99 100644 --- a/target/linux/generic/hack-5.15/700-swconfig_switch_drivers.patch +++ b/target/linux/generic/hack-5.15/700-swconfig_switch_drivers.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -61,6 +61,80 @@ config SFP +@@ -62,6 +62,80 @@ config SFP depends on HWMON || HWMON=n select MDIO_I2C diff --git a/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch index 5baccf73cb8c7d..83587b5c931533 100644 --- a/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ b/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1748,6 +1748,9 @@ void phy_detach(struct phy_device *phyde +@@ -1751,6 +1751,9 @@ void phy_detach(struct phy_device *phyde struct module *ndev_owner = NULL; struct mii_bus *bus; @@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos sysfs_remove_link(&dev->dev.kobj, "phydev"); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -823,6 +823,12 @@ struct phy_driver { +@@ -843,6 +843,12 @@ struct phy_driver { /** @handle_interrupt: Override default interrupt handling */ irqreturn_t (*handle_interrupt)(struct phy_device *phydev); diff --git a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch index faac6fa145a59c..7fbf38a7e34f31 100644 --- a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch +++ b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch @@ -50,7 +50,7 @@ Signed-off-by: Gabor Juhos phylink_set(pl->supported, 10baseT_Full); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -138,6 +138,7 @@ typedef enum { +@@ -139,6 +139,7 @@ typedef enum { PHY_INTERFACE_MODE_XGMII, PHY_INTERFACE_MODE_XLGMII, PHY_INTERFACE_MODE_MOCA, @@ -58,7 +58,7 @@ Signed-off-by: Gabor Juhos PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TRGMII, PHY_INTERFACE_MODE_100BASEX, -@@ -243,6 +244,8 @@ static inline const char *phy_modes(phy_ +@@ -244,6 +245,8 @@ static inline const char *phy_modes(phy_ return "xlgmii"; case PHY_INTERFACE_MODE_MOCA: return "moca"; diff --git a/target/linux/ipq40xx/patches-5.15/705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch b/target/linux/ipq40xx/patches-5.15/705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch index d75b5e514d2837..13b169e576c479 100644 --- a/target/linux/ipq40xx/patches-5.15/705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch +++ b/target/linux/ipq40xx/patches-5.15/705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch @@ -32,10 +32,10 @@ Signed-off-by: Robert Marko --- a/drivers/net/dsa/qca/Kconfig +++ b/drivers/net/dsa/qca/Kconfig -@@ -15,3 +15,13 @@ config NET_DSA_QCA8K +@@ -23,3 +23,13 @@ config NET_DSA_QCA8K_LEDS_SUPPORT help - This enables support for the Qualcomm Atheros QCA8K Ethernet - switch chips. + This enabled support for LEDs present on the Qualcomm Atheros + QCA8K Ethernet switch chips. + +config NET_DSA_QCA8K_IPQ4019 + tristate "Qualcomm Atheros IPQ4019 built-in Ethernet switch support" @@ -48,9 +48,10 @@ Signed-off-by: Robert Marko + --- a/drivers/net/dsa/qca/Makefile +++ b/drivers/net/dsa/qca/Makefile -@@ -1,4 +1,5 @@ +@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o +obj-$(CONFIG_NET_DSA_QCA8K_IPQ4019) += qca8k-ipq4019.o obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o qca8k-y += qca8k-common.o qca8k-8xxx.o + ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT diff --git a/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch b/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch index 87be5980c4aa0e..6a92a103d644ba 100644 --- a/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch +++ b/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch @@ -25,7 +25,7 @@ Signed-off-by: Robert Marko --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -346,6 +346,12 @@ config AT803X_PHY +@@ -347,6 +347,12 @@ config AT803X_PHY Currently supports the AR8030, AR8031, AR8033, AR8035 and internal QCA8337(Internal qca8k PHY) model diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 25d63f8b04cb06..1f456b2ce9f150 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -287,6 +287,7 @@ CONFIG_NEON=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_QCA8K=y +CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT=y CONFIG_NET_DSA_TAG_QCA=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_PTP_CLASSIFY=y diff --git a/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch b/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch index 4a78bfe955a42f..30fc56e618503c 100644 --- a/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch +++ b/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch @@ -34,7 +34,7 @@ Signed-off-by: Bhaskar Upadhaya break; --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -152,6 +152,7 @@ typedef enum { +@@ -153,6 +153,7 @@ typedef enum { PHY_INTERFACE_MODE_USXGMII, /* 10GBASE-KR - with Clause 73 AN */ PHY_INTERFACE_MODE_10GKR, @@ -42,7 +42,7 @@ Signed-off-by: Bhaskar Upadhaya PHY_INTERFACE_MODE_MAX, } phy_interface_t; -@@ -267,6 +268,8 @@ static inline const char *phy_modes(phy_ +@@ -268,6 +269,8 @@ static inline const char *phy_modes(phy_ return "10gbase-kr"; case PHY_INTERFACE_MODE_100BASEX: return "100base-x"; diff --git a/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch b/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch index 262df9d2cfabc1..b8964f4e765756 100644 --- a/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch +++ b/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -366,6 +366,12 @@ config ROCKCHIP_PHY +@@ -367,6 +367,12 @@ config ROCKCHIP_PHY help Currently supports the integrated Ethernet PHY. diff --git a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch index 1d8b509678e187..9da29755825cd1 100644 --- a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch +++ b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch @@ -42,7 +42,7 @@ Signed-off-by: David S. Miller L: linux-i2c@vger.kernel.org --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -292,6 +292,18 @@ config MEDIATEK_GE_PHY +@@ -293,6 +293,18 @@ config MEDIATEK_GE_PHY help Supports the MediaTek Gigabit Ethernet PHYs. diff --git a/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch b/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch index a2a3bab6322d26..7151eb35cc0908 100644 --- a/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch +++ b/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -304,6 +304,13 @@ config MEDIATEK_GE_SOC_PHY +@@ -305,6 +305,13 @@ config MEDIATEK_GE_SOC_PHY present in the SoCs efuse and will dynamically calibrate VCM (common-mode voltage) during startup. diff --git a/target/linux/mpc85xx/p1010/config-default b/target/linux/mpc85xx/p1010/config-default index b6d483cd80ea24..f00fb4d5fdfcb8 100644 --- a/target/linux/mpc85xx/p1010/config-default +++ b/target/linux/mpc85xx/p1010/config-default @@ -17,6 +17,7 @@ CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_QCA8K=y +CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT=y CONFIG_NET_DSA_TAG_QCA=y CONFIG_NET_SWITCHDEV=y CONFIG_PHYLINK=y diff --git a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch index 204756b7515a47..87f319abb56130 100644 --- a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch +++ b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch @@ -71,7 +71,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c break; --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1032,14 +1032,16 @@ struct phy_device *phy_find_first(struct +@@ -1035,14 +1035,16 @@ struct phy_device *phy_find_first(struct } EXPORT_SYMBOL(phy_find_first); @@ -107,7 +107,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c bool tx_pause, rx_pause; --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -703,7 +703,7 @@ struct phy_device { +@@ -706,7 +706,7 @@ struct phy_device { u8 mdix; u8 mdix_ctrl; diff --git a/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch b/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch index d80877b41f85a7..5205a8f9367be4 100644 --- a/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch +++ b/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch @@ -37,7 +37,7 @@ Signed-off-by: John Crispin break; --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -620,6 +620,7 @@ struct phy_device { +@@ -622,6 +622,7 @@ struct phy_device { unsigned downshifted_rate:1; unsigned is_on_sfp_module:1; unsigned mac_managed_pm:1; diff --git a/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch index c4594980a9032d..04a110a2339486 100644 --- a/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch +++ b/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch @@ -21,10 +21,10 @@ Submitted-by: John Crispin --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -943,6 +943,10 @@ struct phy_driver { - int (*get_sqi)(struct phy_device *dev); - /** @get_sqi_max: Get the maximum signal quality indication */ - int (*get_sqi_max)(struct phy_device *dev); +@@ -984,6 +984,10 @@ struct phy_driver { + int (*led_blink_set)(struct phy_device *dev, u8 index, + unsigned long *delay_on, + unsigned long *delay_off); + int (*get_port)(struct phy_device *dev); + int (*set_port)(struct phy_device *dev, int port); + int (*get_eee)(struct phy_device *dev, struct ethtool_eee *e); diff --git a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch index 1dd328b34ef4b6..f9411e47d32477 100644 --- a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch +++ b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch @@ -33,7 +33,7 @@ Submitted-by: Birger Koblitz phylink_set(pl->supported, 10baseT_Full); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -138,6 +138,7 @@ typedef enum { +@@ -139,6 +139,7 @@ typedef enum { PHY_INTERFACE_MODE_XGMII, PHY_INTERFACE_MODE_XLGMII, PHY_INTERFACE_MODE_MOCA, @@ -41,7 +41,7 @@ Submitted-by: Birger Koblitz PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TRGMII, PHY_INTERFACE_MODE_100BASEX, -@@ -243,6 +244,8 @@ static inline const char *phy_modes(phy_ +@@ -244,6 +245,8 @@ static inline const char *phy_modes(phy_ return "xlgmii"; case PHY_INTERFACE_MODE_MOCA: return "moca"; diff --git a/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch b/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch index cb80a72fe25fbe..98c5e714b1946e 100644 --- a/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch +++ b/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch @@ -14,7 +14,7 @@ Submitted-by: Birger Koblitz --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -356,6 +356,12 @@ config REALTEK_PHY +@@ -357,6 +357,12 @@ config REALTEK_PHY help Supports the Realtek 821x PHY. diff --git a/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch b/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch index 3c273dca66db61..56ce80bb20bdb3 100644 --- a/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch +++ b/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -279,7 +279,7 @@ static inline const char *phy_modes(phy_ +@@ -280,7 +280,7 @@ static inline const char *phy_modes(phy_ #define PHY_INIT_TIMEOUT 100000 #define PHY_FORCE_TIMEOUT 10 diff --git a/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch b/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch index 4d851d05bd18c2..767a5d8ec56b02 100644 --- a/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch +++ b/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch @@ -110,7 +110,7 @@ Signed-off-by: Antoine Tenart +MODULE_LICENSE("GPL"); --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -60,6 +60,7 @@ config SFP +@@ -61,6 +61,7 @@ config SFP depends on I2C && PHYLINK depends on HWMON || HWMON=n select MDIO_I2C diff --git a/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch b/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch index b31c5e78acca75..b0a8fadb5f4fbb 100644 --- a/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch +++ b/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch @@ -657,7 +657,7 @@ Signed-off-by: Daniel Golle { --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -80,6 +80,7 @@ extern const int phy_10gbit_features_arr +@@ -81,6 +81,7 @@ extern const int phy_10gbit_features_arr #define PHY_IS_INTERNAL 0x00000001 #define PHY_RST_AFTER_CLK_EN 0x00000002 #define PHY_POLL_CABLE_TEST 0x00000004 @@ -665,7 +665,7 @@ Signed-off-by: Daniel Golle #define MDIO_DEVICE_IS_PHY 0x80000000 /** -@@ -420,6 +421,22 @@ struct mii_bus { +@@ -421,6 +422,22 @@ struct mii_bus { /** @shared: shared state across different PHYs */ struct phy_package_shared *shared[PHY_MAX_ADDR]; @@ -688,7 +688,7 @@ Signed-off-by: Daniel Golle }; #define to_mii_bus(d) container_of(d, struct mii_bus, dev) -@@ -1754,6 +1771,66 @@ static inline int __phy_package_read(str +@@ -1795,6 +1812,66 @@ static inline int __phy_package_read(str return __mdiobus_read(phydev->mdio.bus, shared->addr, regnum); } @@ -755,7 +755,7 @@ Signed-off-by: Daniel Golle static inline int phy_package_write(struct phy_device *phydev, u32 regnum, u16 val) { -@@ -1776,6 +1853,72 @@ static inline int __phy_package_write(st +@@ -1817,6 +1894,72 @@ static inline int __phy_package_write(st return __mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val); } From 88c12d6632fd7ec6de3b0640213d9c7d5dc63a6b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 25 Aug 2023 14:00:09 +0100 Subject: [PATCH 0408/1171] mediatek: re-add dropped properties on BPi-R3 Unfortunately some device tree properties have slipped under the table when switching from our downstream device tree. Bring back 3W power for SFP cages and restore thermal trip points to make sense again. Fixes: 7a0ec001ff ("mediatek: sync MT7986 device trees with upstream") Signed-off-by: Daniel Golle (cherry picked from commit 06a150aed795066ce79a623011884cc0abf290f1) --- .../dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 12 ++++++----- .../arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 20 +++++++++++++++---- ...i-r3-leds-port-names-and-wifi-eeprom.patch | 4 ++-- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts index af4a4309bda4b9..1d3c575b7d4c42 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts @@ -129,6 +129,7 @@ mod-def0-gpios = <&pio 49 GPIO_ACTIVE_LOW>; tx-disable-gpios = <&pio 20 GPIO_ACTIVE_HIGH>; tx-fault-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; }; /* right SFP cage (lan) */ @@ -139,6 +140,7 @@ mod-def0-gpios = <&pio 47 GPIO_ACTIVE_LOW>; tx-disable-gpios = <&pio 15 GPIO_ACTIVE_HIGH>; tx-fault-gpios = <&pio 48 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; }; }; @@ -150,16 +152,16 @@ trip = <&cpu_trip_active_high>; }; - cpu-active-low { + cpu-active-med { /* active: set fan to cooling level 1 */ cooling-device = <&fan 1 1>; - trip = <&cpu_trip_active_low>; + trip = <&cpu_trip_active_med>; }; - cpu-passive { - /* passive: set fan to cooling level 0 */ + cpu-active-low { + /* active: set fan to cooling level 0 */ cooling-device = <&fan 0 0>; - trip = <&cpu_trip_passive>; + trip = <&cpu_trip_active_low>; }; }; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi index 68539ea788dfcc..64f2cf3756a8b8 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi @@ -610,22 +610,34 @@ thermal-sensors = <&thermal 0>; trips { + cpu_trip_crit: crit { + temperature = <125000>; + hysteresis = <2000>; + type = "critical"; + }; + + cpu_trip_hot: hot { + temperature = <120000>; + hysteresis = <2000>; + type = "hot"; + }; + cpu_trip_active_high: active-high { temperature = <115000>; hysteresis = <2000>; type = "active"; }; - cpu_trip_active_low: active-low { + cpu_trip_active_med: active-med { temperature = <85000>; hysteresis = <2000>; type = "active"; }; - cpu_trip_passive: passive { - temperature = <40000>; + cpu_trip_active_low: active-low { + temperature = <60000>; hysteresis = <2000>; - type = "passive"; + type = "active"; }; }; }; diff --git a/target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch b/target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch index 7126da788beaba..336920bafea67a 100644 --- a/target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch +++ b/target/linux/mediatek/patches-5.15/195-dts-mt7986a-bpi-r3-leds-port-names-and-wifi-eeprom.patch @@ -11,7 +11,7 @@ }; chosen { -@@ -417,27 +421,27 @@ +@@ -419,27 +423,27 @@ port@1 { reg = <1>; @@ -44,7 +44,7 @@ phy-mode = "2500base-x"; sfp = <&sfp2>; managed = "in-band-status"; -@@ -488,9 +492,137 @@ +@@ -490,9 +494,137 @@ &wifi { status = "okay"; From 5a9720945fa0c4d5e15df32d63e4c78f90cd2a7e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 26 Aug 2023 22:26:37 +0100 Subject: [PATCH 0409/1171] mediatek: i2c: mt65xx: allow optional pmic clock Using the I2C host controller on the MT7981 SoC requires 4 clocks to be enabled. One of them, the pmic clk, is only enabled in case 'mediatek,have-pmic' is also set which has other consequences which are not desired in this case. Allow defining a pmic clk even in case the 'mediatek,have-pmic' propterty is not present and the bus is not used to connect to a pmic, but may still require to enable the pmic clock. Signed-off-by: Daniel Golle (cherry picked from commit 2544dc34f2a6e5721096ee62efa66d36d45b2dd1) --- ...i2c-mt65xx-allow-optional-pmic-clock.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 target/linux/mediatek/patches-5.15/855-i2c-mt65xx-allow-optional-pmic-clock.patch diff --git a/target/linux/mediatek/patches-5.15/855-i2c-mt65xx-allow-optional-pmic-clock.patch b/target/linux/mediatek/patches-5.15/855-i2c-mt65xx-allow-optional-pmic-clock.patch new file mode 100644 index 00000000000000..69cc155d8d2307 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/855-i2c-mt65xx-allow-optional-pmic-clock.patch @@ -0,0 +1,45 @@ +From 3bf827929a44c17bfb1bf1000b143c02ce26a929 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sat, 26 Aug 2023 21:56:51 +0100 +Subject: [PATCH] i2c: mt65xx: allow optional pmic clock + +Using the I2C host controller on the MT7981 SoC requires 4 clocks to +be enabled. One of them, the pmic clk, is only enabled in case +'mediatek,have-pmic' is also set which has other consequences which +are not desired in this case. + +Allow defining a pmic clk even in case the 'mediatek,have-pmic' propterty +is not present and the bus is not used to connect to a pmic, but may +still require to enable the pmic clock. + +Signed-off-by: Daniel Golle +--- + drivers/i2c/busses/i2c-mt65xx.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -1444,15 +1444,19 @@ static int mtk_i2c_probe(struct platform + if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk)) + return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk); + ++ i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get_optional(&pdev->dev, "pmic"); ++ if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) { ++ dev_err(&pdev->dev, "cannot get pmic clock\n"); ++ return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk); ++ } ++ + if (i2c->have_pmic) { +- i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get(&pdev->dev, "pmic"); +- if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) { ++ if (!i2c->clocks[I2C_MT65XX_CLK_PMIC].clk) { + dev_err(&pdev->dev, "cannot get pmic clock\n"); +- return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk); ++ return -ENODEV; + } + speed_clk = I2C_MT65XX_CLK_PMIC; + } else { +- i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = NULL; + speed_clk = I2C_MT65XX_CLK_MAIN; + } + From ffede121f84d372757ce14582f909dfd54f33b91 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 27 Aug 2023 00:38:38 +0100 Subject: [PATCH 0410/1171] mediatek: filogic: improve pinctrl drivers Set correct pull-type data and add additional uart groups for MT7981. Assign functions to configure pin bias for MT7986. Signed-off-by: Daniel Golle (cherry picked from commit 9f8fde216d994ce47b1eca15de190aa9b8f67b9a) --- .../drivers/pinctrl/mediatek/pinctrl-mt7981.c | 55 ++++++++----------- .../drivers/pinctrl/mediatek/pinctrl-mt7986.c | 8 +++ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7981.c b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7981.c index 18abc57800111a..7c082dd207b491 100644 --- a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7981.c +++ b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7981.c @@ -457,37 +457,15 @@ static const unsigned int mt7981_pull_type[] = { MTK_PULL_PUPD_R1R0_TYPE,/*34*/ MTK_PULL_PUPD_R1R0_TYPE,/*35*/ MTK_PULL_PUPD_R1R0_TYPE,/*36*/ MTK_PULL_PUPD_R1R0_TYPE,/*37*/ MTK_PULL_PUPD_R1R0_TYPE,/*38*/ MTK_PULL_PUPD_R1R0_TYPE,/*39*/ - MTK_PULL_PUPD_R1R0_TYPE,/*40*/ MTK_PULL_PUPD_R1R0_TYPE,/*41*/ - MTK_PULL_PUPD_R1R0_TYPE,/*42*/ MTK_PULL_PUPD_R1R0_TYPE,/*43*/ - MTK_PULL_PUPD_R1R0_TYPE,/*44*/ MTK_PULL_PUPD_R1R0_TYPE,/*45*/ - MTK_PULL_PUPD_R1R0_TYPE,/*46*/ MTK_PULL_PUPD_R1R0_TYPE,/*47*/ - MTK_PULL_PUPD_R1R0_TYPE,/*48*/ MTK_PULL_PUPD_R1R0_TYPE,/*49*/ - MTK_PULL_PUPD_R1R0_TYPE,/*50*/ MTK_PULL_PUPD_R1R0_TYPE,/*51*/ - MTK_PULL_PUPD_R1R0_TYPE,/*52*/ MTK_PULL_PUPD_R1R0_TYPE,/*53*/ - MTK_PULL_PUPD_R1R0_TYPE,/*54*/ MTK_PULL_PUPD_R1R0_TYPE,/*55*/ - MTK_PULL_PUPD_R1R0_TYPE,/*56*/ MTK_PULL_PUPD_R1R0_TYPE,/*57*/ - MTK_PULL_PUPD_R1R0_TYPE,/*58*/ MTK_PULL_PUPD_R1R0_TYPE,/*59*/ - MTK_PULL_PUPD_R1R0_TYPE,/*60*/ MTK_PULL_PUPD_R1R0_TYPE,/*61*/ - MTK_PULL_PUPD_R1R0_TYPE,/*62*/ MTK_PULL_PUPD_R1R0_TYPE,/*63*/ - MTK_PULL_PUPD_R1R0_TYPE,/*64*/ MTK_PULL_PUPD_R1R0_TYPE,/*65*/ - MTK_PULL_PUPD_R1R0_TYPE,/*66*/ MTK_PULL_PUPD_R1R0_TYPE,/*67*/ - MTK_PULL_PUPD_R1R0_TYPE,/*68*/ MTK_PULL_PU_PD_TYPE,/*69*/ - MTK_PULL_PU_PD_TYPE,/*70*/ MTK_PULL_PU_PD_TYPE,/*71*/ - MTK_PULL_PU_PD_TYPE,/*72*/ MTK_PULL_PU_PD_TYPE,/*73*/ - MTK_PULL_PU_PD_TYPE,/*74*/ MTK_PULL_PU_PD_TYPE,/*75*/ - MTK_PULL_PU_PD_TYPE,/*76*/ MTK_PULL_PU_PD_TYPE,/*77*/ - MTK_PULL_PU_PD_TYPE,/*78*/ MTK_PULL_PU_PD_TYPE,/*79*/ - MTK_PULL_PU_PD_TYPE,/*80*/ MTK_PULL_PU_PD_TYPE,/*81*/ - MTK_PULL_PU_PD_TYPE,/*82*/ MTK_PULL_PU_PD_TYPE,/*83*/ - MTK_PULL_PU_PD_TYPE,/*84*/ MTK_PULL_PU_PD_TYPE,/*85*/ - MTK_PULL_PU_PD_TYPE,/*86*/ MTK_PULL_PU_PD_TYPE,/*87*/ - MTK_PULL_PU_PD_TYPE,/*88*/ MTK_PULL_PU_PD_TYPE,/*89*/ - MTK_PULL_PU_PD_TYPE,/*90*/ MTK_PULL_PU_PD_TYPE,/*91*/ - MTK_PULL_PU_PD_TYPE,/*92*/ MTK_PULL_PU_PD_TYPE,/*93*/ - MTK_PULL_PU_PD_TYPE,/*94*/ MTK_PULL_PU_PD_TYPE,/*95*/ - MTK_PULL_PU_PD_TYPE,/*96*/ MTK_PULL_PU_PD_TYPE,/*97*/ - MTK_PULL_PU_PD_TYPE,/*98*/ MTK_PULL_PU_PD_TYPE,/*99*/ - MTK_PULL_PU_PD_TYPE,/*100*/ + MTK_PULL_PU_PD_TYPE,/*40*/ MTK_PULL_PU_PD_TYPE,/*41*/ + MTK_PULL_PU_PD_TYPE,/*42*/ MTK_PULL_PU_PD_TYPE,/*43*/ + MTK_PULL_PU_PD_TYPE,/*44*/ MTK_PULL_PU_PD_TYPE,/*45*/ + MTK_PULL_PU_PD_TYPE,/*46*/ MTK_PULL_PU_PD_TYPE,/*47*/ + MTK_PULL_PU_PD_TYPE,/*48*/ MTK_PULL_PU_PD_TYPE,/*49*/ + MTK_PULL_PU_PD_TYPE,/*50*/ MTK_PULL_PU_PD_TYPE,/*51*/ + MTK_PULL_PU_PD_TYPE,/*52*/ MTK_PULL_PU_PD_TYPE,/*53*/ + MTK_PULL_PU_PD_TYPE,/*54*/ MTK_PULL_PU_PD_TYPE,/*55*/ + MTK_PULL_PU_PD_TYPE,/*56*/ }; static const struct mtk_pin_reg_calc mt7981_reg_cals[] = { @@ -633,6 +611,9 @@ static int mt7981_wo0_jtag_1_funcs[] = { 5, 5, 5, 5, 5, }; static int mt7981_uart2_0_pins[] = { 4, 5, 6, 7, }; static int mt7981_uart2_0_funcs[] = { 3, 3, 3, 3, }; +static int mt7981_uart2_0_tx_rx_pins[] = { 4, 5, }; +static int mt7981_uart2_0_tx_rx_funcs[] = { 3, 3, }; + /* GBE_LED0 */ static int mt7981_gbe_led0_pins[] = { 8, }; static int mt7981_gbe_led0_funcs[] = { 3, }; @@ -753,6 +734,9 @@ static int mt7981_uart1_0_funcs[] = { 4, 4, 4, 4, }; static int mt7981_uart1_1_pins[] = { 26, 27, 28, 29, }; static int mt7981_uart1_1_funcs[] = { 2, 2, 2, 2, }; +static int mt7981_uart1_2_pins[] = { 9, 10, }; +static int mt7981_uart1_2_funcs[] = { 2, 2, }; + /* UART2 */ static int mt7981_uart2_1_pins[] = { 22, 23, 24, 25, }; static int mt7981_uart2_1_funcs[] = { 3, 3, 3, 3, }; @@ -827,6 +811,8 @@ static const struct group_desc mt7981_groups[] = { PINCTRL_PIN_GROUP("wo0_jtag_0", mt7981_wo0_jtag_0), /* @GPIO(4,7) WM_JTAG(3) */ PINCTRL_PIN_GROUP("uart2_0", mt7981_uart2_0), + /* @GPIO(4,5) WM_JTAG(4) */ + PINCTRL_PIN_GROUP("uart2_0_tx_rx", mt7981_uart2_0_tx_rx), /* @GPIO(8) GBE_LED0(3) */ PINCTRL_PIN_GROUP("gbe_led0", mt7981_gbe_led0), /* @GPIO(4,6) PTA_EXT(4) */ @@ -883,6 +869,8 @@ static const struct group_desc mt7981_groups[] = { PINCTRL_PIN_GROUP("uart1_0", mt7981_uart1_0), /* @GPIO(26,29): UART1(2) */ PINCTRL_PIN_GROUP("uart1_1", mt7981_uart1_1), + /* @GPIO(9,10): UART1(2) */ + PINCTRL_PIN_GROUP("uart1_2", mt7981_uart1_2), /* @GPIO(22,25): UART1(3) */ PINCTRL_PIN_GROUP("uart2_1", mt7981_uart2_1), /* @GPIO(22,24) PTA_EXT(4) */ @@ -945,6 +933,7 @@ static const struct group_desc mt7981_groups[] = { static const char *mt7981_wa_aice_groups[] = { "wa_aice1", "wa_aice2", "wm_aice1_1", "wa_aice3", "wm_aice1_2", }; static const char *mt7981_uart_groups[] = { "wm_uart_0", "uart2_0", + "uart1_2", "uart2_0_tx_rx", "net_wo0_uart_txd_0", "net_wo0_uart_txd_1", "net_wo0_uart_txd_2", "uart1_0", "uart1_1", "uart2_1", "wm_aurt_1", "wm_aurt_2", "uart0", }; static const char *mt7981_dfd_groups[] = { "dfd", "dfd_ntrst", }; @@ -1014,6 +1003,10 @@ static struct mtk_pin_soc mt7981_data = { .ies_present = false, .base_names = mt7981_pinctrl_register_base_names, .nbase_names = ARRAY_SIZE(mt7981_pinctrl_register_base_names), + .bias_disable_set = mtk_pinconf_bias_disable_set, + .bias_disable_get = mtk_pinconf_bias_disable_get, + .bias_set = mtk_pinconf_bias_set, + .bias_get = mtk_pinconf_bias_get, .pull_type = mt7981_pull_type, .bias_set_combo = mtk_pinconf_bias_set_combo, .bias_get_combo = mtk_pinconf_bias_get_combo, diff --git a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7986.c b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7986.c index aa0ccd67f4f4ea..acaac9b38aa8a7 100644 --- a/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7986.c +++ b/target/linux/mediatek/files-5.15/drivers/pinctrl/mediatek/pinctrl-mt7986.c @@ -922,6 +922,10 @@ static struct mtk_pin_soc mt7986a_data = { .ies_present = false, .base_names = mt7986_pinctrl_register_base_names, .nbase_names = ARRAY_SIZE(mt7986_pinctrl_register_base_names), + .bias_disable_set = mtk_pinconf_bias_disable_set, + .bias_disable_get = mtk_pinconf_bias_disable_get, + .bias_set = mtk_pinconf_bias_set, + .bias_get = mtk_pinconf_bias_get, .pull_type = mt7986_pull_type, .bias_set_combo = mtk_pinconf_bias_set_combo, .bias_get_combo = mtk_pinconf_bias_get_combo, @@ -944,6 +948,10 @@ static struct mtk_pin_soc mt7986b_data = { .ies_present = false, .base_names = mt7986_pinctrl_register_base_names, .nbase_names = ARRAY_SIZE(mt7986_pinctrl_register_base_names), + .bias_disable_set = mtk_pinconf_bias_disable_set, + .bias_disable_get = mtk_pinconf_bias_disable_get, + .bias_set = mtk_pinconf_bias_set, + .bias_get = mtk_pinconf_bias_get, .pull_type = mt7986_pull_type, .bias_set_combo = mtk_pinconf_bias_set_combo, .bias_get_combo = mtk_pinconf_bias_get_combo, From 87ef3059847d122bd73c7538d5e52470199c5a9f Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 27 Aug 2023 15:57:00 +0100 Subject: [PATCH 0411/1171] mediatek: improve mt7981.dtsi * re-factor WED components to boot fine also on limited loaders * add LEDs of integrated GE PHY Signed-off-by: Daniel Golle (cherry picked from commit 3ef8760e876e09fa91b54a09b2a5003c175829d3) --- .../arch/arm64/boot/dts/mediatek/mt7981.dtsi | 71 ++++++++++++++----- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index 3629a6f6dda70c..05d4b7d91da112 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -191,21 +192,6 @@ reg = <0 0x47dc0000 0 0x240000>; no-map; }; - - wo_ilm0: wo-ilm@151e0000 { - reg = <0 0x151e0000 0 0x8000>; - no-map; - }; - - wo_dlm0: wo-dlm@151e8000 { - reg = <0 0x151e8000 0 0x2000>; - no-map; - }; - - wo_boot: wo-boot@15194000 { - reg = <0 0x15194000 0 0x1000>; - no-map; - }; }; psci { @@ -432,6 +418,20 @@ drive-strength = <4>; }; }; + + gbe_led0_pins: gbe-led0-pins { + mux { + function = "led"; + groups = "gbe_led0"; + }; + }; + + gbe_led1_pins: gbe-led1-pins { + mux { + function = "led"; + groups = "gbe_led1"; + }; + }; }; ethsys: syscon@15000000 { @@ -452,11 +452,12 @@ reg = <0 0x15010000 0 0x1000>; interrupt-parent = <&gic>; interrupts = ; - memory-region = <&wo_emi0>, <&wo_ilm0>, <&wo_dlm0>, - <&wo_data>, <&wo_boot>; - memory-region-names = "wo-emi", "wo-ilm", "wo-dlm", - "wo-data", "wo-boot"; + memory-region = <&wo_emi0>, <&wo_data>; + memory-region-names = "wo-emi", "wo-data"; mediatek,wo-ccif = <&wo_ccif0>; + mediatek,wo-ilm = <&wo_ilm0>; + mediatek,wo-dlm = <&wo_dlm0>; + mediatek,wo-cpuboot = <&wo_cpuboot>; }; eth: ethernet@15100000 { @@ -511,10 +512,42 @@ phy-is-integrated; nvmem-cells = <&phy_calibration>; nvmem-cell-names = "phy-cal-data"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + int_gbe_phy_led0: int-gbe-phy-led0@0 { + reg = <0>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + + int_gbe_phy_led1: int-gbe-phy-led1@1 { + reg = <1>; + function = LED_FUNCTION_LAN; + status = "disabled"; + }; + }; }; }; }; + wo_dlm0: syscon@151e8000 { + compatible = "mediatek,mt7986-wo-dlm", "syscon"; + reg = <0 0x151e8000 0 0x2000>; + }; + + wo_ilm0: syscon@151e0000 { + compatible = "mediatek,mt7986-wo-ilm", "syscon"; + reg = <0 0x151e0000 0 0x8000>; + }; + + wo_cpuboot: syscon@15194000 { + compatible = "mediatek,mt7986-wo-cpuboot", "syscon"; + reg = <0 0x15194000 0 0x1000>; + }; + wo_ccif0: syscon@151a5000 { compatible = "mediatek,mt7986-wo-ccif", "syscon"; reg = <0 0x151a5000 0 0x1000>; From 35d123adfe051fbc539ea89acd355ace4522bfc0 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 25 Aug 2023 03:58:33 +0100 Subject: [PATCH 0412/1171] uboot-mediatek: build fully-featured U-Boot for MT7988 RFB Select many potentially useful options for the MT7988 RFB U-Boot builds. The resulting loader is intended as a development tool and intends to be generic. It does *not* have a default bootcmd set, but allows to boot pretty much everything, including EFI executables. To install this U-Boot build to the eMMC: opkg install mmc-utils partx-utils mmc bootpart enable 1 1 /dev/mmcblk0 echo 0 > /sys/block/mmcblk0boot0/force_ro dd if=*mediatek_mt7988a-rfb-nand-emmc-preloader.bin of=/dev/mmcblk0boot0 dd if=*mediatek_mt7988a-rfb-nand-emmc-gpt.bin of=/dev/mmcblk0 partx -a /dev/mmcblk0 dd if=*mediatek_mt7988a-rfb-nand-emmc-bl31-uboot.fip of=/dev/mmcblk0p3 Signed-off-by: Daniel Golle (cherry picked from commit 1d5778e18d9a6bef26aff3a8594306fc45e9be76) --- package/boot/uboot-mediatek/Makefile | 29 +- ...d-ability-to-select-item-by-shortkey.patch | 11 + ...mediatek-add-MT7988-reference-boards.patch | 4 +- ...figs-add-usefull-stuff-to-mt7988-rfb.patch | 314 ++++++++++++++++++ 4 files changed, 342 insertions(+), 16 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index a5401860c2be3b..a04e629f1227d6 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -324,60 +324,61 @@ endef define U-Boot/mt7988_rfb-spim-nand NAME:=MT7988 Reference Board BUILD_SUBTARGET:=filogic - BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + BUILD_DEVICES:=mediatek_mt7988a-rfb UBOOT_CONFIG:=mt7988_rfb UBOOT_IMAGE:=u-boot.fip BL2_BOOTDEV:=spim-nand BL2_SOC:=mt7988 - BL2_DDRTYPE:=ddr4 - DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-ddr4 + BL2_DDRTYPE:=comb + DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-comb endef define U-Boot/mt7988_rfb-snand NAME:=MT7988 Reference Board BUILD_SUBTARGET:=filogic - BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + BUILD_DEVICES:=mediatek_mt7988a-rfb UBOOT_CONFIG:=mt7988_rfb UBOOT_IMAGE:=u-boot.fip BL2_BOOTDEV:=snand BL2_SOC:=mt7988 - BL2_DDRTYPE:=ddr4 - DEPENDS:=+trusted-firmware-a-mt7988-snand-ddr4 + BL2_DDRTYPE:=comb + DEPENDS:=+trusted-firmware-a-mt7988-snand-comb endef define U-Boot/mt7988_rfb-nor NAME:=MT7988 Reference Board BUILD_SUBTARGET:=filogic - BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + BUILD_DEVICES:=mediatek_mt7988a-rfb UBOOT_CONFIG:=mt7988_rfb UBOOT_IMAGE:=u-boot.fip BL2_BOOTDEV:=nor BL2_SOC:=mt7988 - BL2_DDRTYPE:=ddr4 - DEPENDS:=+trusted-firmware-a-mt7988-nor-ddr4 + BL2_DDRTYPE:=comb + DEPENDS:=+trusted-firmware-a-mt7988-nor-comb + FIP_COMPRESS:=1 endef define U-Boot/mt7988_rfb-emmc NAME:=MT7988 Reference Board BUILD_SUBTARGET:=filogic - BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + BUILD_DEVICES:=mediatek_mt7988a-rfb UBOOT_CONFIG:=mt7988_rfb UBOOT_IMAGE:=u-boot.fip BL2_BOOTDEV:=emmc BL2_SOC:=mt7988 - BL2_DDRTYPE:=ddr4 - DEPENDS:=+trusted-firmware-a-mt7988-emmc-ddr4 + BL2_DDRTYPE:=comb + DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb endef define U-Boot/mt7988_rfb-sd NAME:=MT7988 Reference Board BUILD_SUBTARGET:=filogic - BUILD_DEVICES:=mediatek_mt7988a-rfb-nand + BUILD_DEVICES:=mediatek_mt7988a-rfb UBOOT_CONFIG:=mt7988_sd_rfb UBOOT_IMAGE:=u-boot.fip BL2_BOOTDEV:=sdmmc BL2_SOC:=mt7988 - BL2_DDRTYPE:=ddr4 + BL2_DDRTYPE:=comb DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-ddr4 endef diff --git a/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch b/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch index 6a9ac54dfd8604..315f7f92a3d794 100644 --- a/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch +++ b/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch @@ -310,3 +310,14 @@ Signed-off-by: Weijie Gao switch (key) { case BKEY_PLUS: +--- a/boot/bootflow_menu.c ++++ b/boot/bootflow_menu.c +@@ -231,7 +231,7 @@ int bootflow_menu_run(struct bootstd_pri + + key = 0; + if (ichar) { +- key = bootmenu_conv_key(ichar); ++ key = bootmenu_conv_key(NULL, ichar, NULL); + if (key == BKEY_NONE) + key = ichar; + } diff --git a/package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch b/package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch index e2a7309e7e1d6f..ef41f4d56a0e77 100644 --- a/package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch +++ b/package/boot/uboot-mediatek/patches/101-29-board-mediatek-add-MT7988-reference-boards.patch @@ -411,7 +411,7 @@ Signed-off-by: Weijie Gao +CONFIG_TARGET_MT7988=y +CONFIG_DEBUG_UART_BASE=0x11000000 +CONFIG_DEBUG_UART_CLOCK=40000000 -+CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SYS_LOAD_ADDR=0x50000000 +CONFIG_DEBUG_UART=y +# CONFIG_AUTOBOOT is not set +CONFIG_DEFAULT_FDT_FILE="mt7988-rfb" @@ -497,7 +497,7 @@ Signed-off-by: Weijie Gao +CONFIG_TARGET_MT7988=y +CONFIG_DEBUG_UART_BASE=0x11000000 +CONFIG_DEBUG_UART_CLOCK=40000000 -+CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SYS_LOAD_ADDR=0x50000000 +CONFIG_DEBUG_UART=y +# CONFIG_AUTOBOOT is not set +CONFIG_DEFAULT_FDT_FILE="mt7988-sd-rfb" diff --git a/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch b/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch new file mode 100644 index 00000000000000..c7dcf9a1ba7d98 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch @@ -0,0 +1,314 @@ +--- a/configs/mt7988_sd_rfb_defconfig ++++ b/configs/mt7988_sd_rfb_defconfig +@@ -12,6 +12,24 @@ CONFIG_DEBUG_UART_BASE=0x11000000 + CONFIG_DEBUG_UART_CLOCK=40000000 + CONFIG_SYS_LOAD_ADDR=0x50000000 + CONFIG_DEBUG_UART=y ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_SPI_BOOT=y ++CONFIG_SD_BOOT=y ++CONFIG_NAND_BOOT=y ++CONFIG_BOOTSTD_DEFAULTS=y ++CONFIG_BOOTSTD_FULL=y + # CONFIG_AUTOBOOT is not set + CONFIG_DEFAULT_FDT_FILE="mt7988-sd-rfb" + CONFIG_LOGLEVEL=7 +@@ -22,15 +40,118 @@ CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_PLAN9 is not set + # CONFIG_BOOTM_RTEMS is not set + # CONFIG_BOOTM_VXWORKS is not set +-# CONFIG_CMD_ELF is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_ELF=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y + CONFIG_CMD_CLK=y + CONFIG_CMD_DM=y + CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y + CONFIG_CMD_PWM=y + CONFIG_CMD_MMC=y + CONFIG_CMD_MTD=y + CONFIG_CMD_PING=y ++CONFIG_CMD_SF=y + CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MMC=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_USB=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PCI=y ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++# CONFIG_MTD_RAW_NAND is not set ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL_MT7988=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_USB=y ++CONFIG_USB_HOST=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_ENV_OFFSET_REDUND=0x440000 ++CONFIG_ENV_SIZE=0x40000 ++CONFIG_ENV_SIZE_REDUND=0x40000 + CONFIG_DOS_PARTITION=y + CONFIG_EFI_PARTITION=y + CONFIG_PARTITION_TYPE_GUID=y +@@ -46,6 +167,9 @@ CONFIG_PROT_TCP=y + CONFIG_REGMAP=y + CONFIG_SYSCON=y + CONFIG_CLK=y ++CONFIG_MMC=y ++CONFIG_MMC_DEFAULT_DEV=1 ++CONFIG_MMC_SUPPORTS_TUNING=y + CONFIG_MMC_HS200_SUPPORT=y + CONFIG_MMC_MTK=y + CONFIG_MTD=y +--- a/configs/mt7988_rfb_defconfig ++++ b/configs/mt7988_rfb_defconfig +@@ -12,6 +12,24 @@ CONFIG_DEBUG_UART_BASE=0x11000000 + CONFIG_DEBUG_UART_CLOCK=40000000 + CONFIG_SYS_LOAD_ADDR=0x50000000 + CONFIG_DEBUG_UART=y ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_SPI_BOOT=y ++CONFIG_SD_BOOT=y ++CONFIG_NAND_BOOT=y ++CONFIG_BOOTSTD_DEFAULTS=y ++CONFIG_BOOTSTD_FULL=y + # CONFIG_AUTOBOOT is not set + CONFIG_DEFAULT_FDT_FILE="mt7988-rfb" + CONFIG_LOGLEVEL=7 +@@ -22,15 +40,118 @@ CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_PLAN9 is not set + # CONFIG_BOOTM_RTEMS is not set + # CONFIG_BOOTM_VXWORKS is not set +-# CONFIG_CMD_ELF is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_ELF=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y + CONFIG_CMD_CLK=y + CONFIG_CMD_DM=y + CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y + CONFIG_CMD_PWM=y + CONFIG_CMD_MMC=y + CONFIG_CMD_MTD=y + CONFIG_CMD_PING=y ++CONFIG_CMD_SF=y + CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MMC=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_USB=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PCI=y ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++# CONFIG_MTD_RAW_NAND is not set ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL_MT7988=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_USB=y ++CONFIG_USB_HOST=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_ENV_OFFSET_REDUND=0x440000 ++CONFIG_ENV_SIZE=0x40000 ++CONFIG_ENV_SIZE_REDUND=0x40000 + CONFIG_DOS_PARTITION=y + CONFIG_EFI_PARTITION=y + CONFIG_PARTITION_TYPE_GUID=y +@@ -46,6 +167,9 @@ CONFIG_PROT_TCP=y + CONFIG_REGMAP=y + CONFIG_SYSCON=y + CONFIG_CLK=y ++CONFIG_MMC=y ++CONFIG_MMC_DEFAULT_DEV=1 ++CONFIG_MMC_SUPPORTS_TUNING=y + CONFIG_MMC_HS200_SUPPORT=y + CONFIG_MMC_MTK=y + CONFIG_MTD=y From ed370ec424ca19fe983dc38ab5bc7a9fb1c9ab04 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 25 Aug 2023 04:09:28 +0100 Subject: [PATCH 0413/1171] mediatek: generate bootloader artifacts for mt7988_rfb Switch to OpenWrt uImage.FIT bootmethod and include various bootloader artifacts with the generated binaries. Signed-off-by: Daniel Golle (cherry picked from commit 035a88ae5564ac680c64ed7219b8b66733ac84c6) --- .../mediatek/mt7988a-dsa-10g-spim-nand.dts | 134 ------- .../boot/dts/mediatek/mt7988a-rfb-emmc.dtso | 33 ++ .../dts/mediatek/mt7988a-rfb-eth1-aqr.dtso | 41 +++ .../mediatek/mt7988a-rfb-eth1-i2p5g-phy.dtso | 30 ++ .../dts/mediatek/mt7988a-rfb-eth1-mxl.dtso | 39 +++ .../dts/mediatek/mt7988a-rfb-eth1-sfp.dtso | 47 +++ .../dts/mediatek/mt7988a-rfb-eth2-aqr.dtso | 41 +++ .../dts/mediatek/mt7988a-rfb-eth2-mxl.dtso | 39 +++ .../dts/mediatek/mt7988a-rfb-eth2-sfp.dtso | 47 +++ .../boot/dts/mediatek/mt7988a-rfb-sd.dtso | 31 ++ .../dts/mediatek/mt7988a-rfb-snfi-nand.dtso | 69 ++++ .../dts/mediatek/mt7988a-rfb-spim-nand.dtsi | 70 ---- .../dts/mediatek/mt7988a-rfb-spim-nand.dtso | 64 ++++ .../dts/mediatek/mt7988a-rfb-spim-nor.dtso | 59 ++++ .../{mt7988a-rfb.dtsi => mt7988a-rfb.dts} | 117 ++++--- .../arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 328 +++++++++++++++++- .../filogic/base-files/etc/board.d/02_network | 4 +- target/linux/mediatek/image/filogic.mk | 86 ++++- 18 files changed, 995 insertions(+), 284 deletions(-) delete mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-emmc.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-aqr.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-i2p5g-phy.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-mxl.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-sfp.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-aqr.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-mxl.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-sfp.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-sd.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso delete mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nor.dtso rename target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/{mt7988a-rfb.dtsi => mt7988a-rfb.dts} (68%) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts deleted file mode 100644 index 27ef19c46dd203..00000000000000 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Copyright (C) 2022 MediaTek Inc. - * Author: Sam.Shih - */ - -/dts-v1/; -#include "mt7988a-rfb-spim-nand.dtsi" -#include -#include - -/ { - model = "MediaTek MT7988A DSA 10G SPIM-NAND RFB"; - compatible = "mediatek,mt7988a-dsa-10g-spim-snand", - "mediatek,mt7988a-rfb-snand", - "mediatek,mt7988"; - - chosen { - bootargs = "console=ttyS0,115200n1 loglevel=8 \ - earlycon=uart8250,mmio32,0x11000000 \ - pci=pcie_bus_perf"; - }; - - memory { - reg = <0 0x40000000 0 0x40000000>; - }; -}; - -ð { - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - -&gmac0 { - status = "okay"; -}; - -&gmac1 { - status = "okay"; - phy-mode = "internal"; - phy-connection-type = "internal"; - phy = <&int_2p5g_phy>; -}; - -&gmac2 { - status = "okay"; - phy-mode = "usxgmii"; - phy-connection-type = "usxgmii"; - phy = <&phy8>; -}; - -&mdio_bus { - /* external Aquantia AQR113C */ - phy0: ethernet-phy@0 { - reg = <0>; - compatible = "ethernet-phy-ieee802.3-c45"; - reset-gpios = <&pio 72 1>; - reset-assert-us = <100000>; - reset-deassert-us = <221000>; - }; - - /* external Aquantia AQR113C */ - phy8: ethernet-phy@8 { - reg = <8>; - compatible = "ethernet-phy-ieee802.3-c45"; - reset-gpios = <&pio 71 1>; - reset-assert-us = <100000>; - reset-deassert-us = <221000>; - }; - - /* external Maxlinear GPY211C */ - phy5: ethernet-phy@5 { - reg = <5>; - compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "2500base-x"; - }; - - /* external Maxlinear GPY211C */ - phy13: ethernet-phy@13 { - reg = <13>; - compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "2500base-x"; - }; -}; - -&int_2p5g_phy { - pinctrl-names = "i2p5gbe-led"; - pinctrl-0 = <&i2p5gbe_led0_pins>; -}; - -&switch { - status = "okay"; -}; - -&gsw_phy0 { - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe0_led0_pins>; -}; - -&gsw_phy0_led0 { - status = "okay"; - color = ; -}; - -&gsw_phy1 { - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe1_led0_pins>; -}; - -&gsw_phy1_led0 { - status = "okay"; - color = ; -}; - -&gsw_phy2 { - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe2_led0_pins>; -}; - -&gsw_phy2_led0 { - status = "okay"; - color = ; -}; - -&gsw_phy3 { - pinctrl-names = "gbe-led"; - pinctrl-0 = <&gbe3_led0_pins>; -}; - -&gsw_phy3_led0 { - status = "okay"; - color = ; -}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-emmc.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-emmc.dtso new file mode 100644 index 00000000000000..3f8ac2ae382ba0 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-emmc.dtso @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Author: Frank Wunderlich + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&mmc0>; + __overlay__ { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_emmc_51>; + pinctrl-1 = <&mmc0_pins_emmc_51>; + bus-width = <8>; + max-frequency = <200000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + mmc-hs400-1_8v; + hs400-ds-delay = <0x12814>; + vqmmc-supply = <®_1p8v>; + vmmc-supply = <®_3p3v>; + non-removable; + no-sd; + no-sdio; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-aqr.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-aqr.dtso new file mode 100644 index 00000000000000..d21a61ad19fef3 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-aqr.dtso @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&mdio_bus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + /* external Aquantia AQR113C */ + phy0: ethernet-phy@0 { + reg = <0>; + compatible = "ethernet-phy-ieee802.3-c45"; + reset-gpios = <&pio 72 GPIO_ACTIVE_LOW>; + reset-assert-us = <100000>; + reset-deassert-us = <221000>; + }; + }; + }; + + fragment@1 { + target = <&gmac1>; + __overlay__ { + phy-mode = "usxgmii"; + phy-connection-type = "usxgmii"; + phy = <&phy0>; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-i2p5g-phy.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-i2p5g-phy.dtso new file mode 100644 index 00000000000000..86ab7566dc298e --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-i2p5g-phy.dtso @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&gmac1>; + __overlay__ { + phy-mode = "internal"; + phy-connection-type = "internal"; + phy = <&int_2p5g_phy>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&int_2p5g_phy>; + __overlay__ { + pinctrl-names = "i2p5gbe-led"; + pinctrl-0 = <&i2p5gbe_led0_pins>; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-mxl.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-mxl.dtso new file mode 100644 index 00000000000000..34a23bbd7eb09e --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-mxl.dtso @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&mdio_bus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + /* external Maxlinear GPY211C */ + phy13: ethernet-phy@13 { + reg = <13>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + }; + }; + }; + + fragment@1 { + target = <&gmac1>; + __overlay__ { + phy-mode = "2500base-x"; + phy-connection-type = "2500base-x"; + phy = <&phy13>; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-sfp.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-sfp.dtso new file mode 100644 index 00000000000000..ba40a119cbdfdc --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth1-sfp.dtso @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&i2c2>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&i2c2_0_pins>; + status = "okay"; + }; + }; + + fragment@1 { + target-path = "/"; + __overlay__ { + sfp_esp1: sfp@1 { + compatible = "sff,sfp"; + i2c-bus = <&i2c2>; + mod-def0-gpios = <&pio 82 GPIO_ACTIVE_LOW>; + los-gpios = <&pio 81 GPIO_ACTIVE_HIGH>; + tx-disable-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; + }; + }; + }; + + fragment@2 { + target = <&gmac1>; + __overlay__ { + phy-mode = "10gbase-r"; + managed = "in-band-status"; + sfp = <&sfp_esp1>; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-aqr.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-aqr.dtso new file mode 100644 index 00000000000000..140391fc45a8f4 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-aqr.dtso @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&mdio_bus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + /* external Aquantia AQR113C */ + phy8: ethernet-phy@8 { + reg = <8>; + compatible = "ethernet-phy-ieee802.3-c45"; + reset-gpios = <&pio 71 GPIO_ACTIVE_LOW>; + reset-assert-us = <100000>; + reset-deassert-us = <221000>; + }; + }; + }; + + fragment@1 { + target = <&gmac2>; + __overlay__ { + phy-mode = "usxgmii"; + phy-connection-type = "usxgmii"; + phy = <&phy8>; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-mxl.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-mxl.dtso new file mode 100644 index 00000000000000..19e0b2799fc848 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-mxl.dtso @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&mdio_bus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + /* external Maxlinear GPY211C */ + phy5: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + }; + }; + }; + + fragment@1 { + target = <&gmac2>; + __overlay__ { + phy-mode = "2500base-x"; + phy-connection-type = "2500base-x"; + phy = <&phy5>; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-sfp.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-sfp.dtso new file mode 100644 index 00000000000000..b9aabd2726e2a2 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-eth2-sfp.dtso @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&i2c1>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_sfp_pins>; + status = "okay"; + }; + }; + + fragment@1 { + target-path = "/"; + __overlay__ { + sfp_esp0: sfp@0 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + mod-def0-gpios = <&pio 35 GPIO_ACTIVE_LOW>; + los-gpios = <&pio 33 GPIO_ACTIVE_HIGH>; + tx-disable-gpios = <&pio 29 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; + }; + }; + }; + + fragment@2 { + target = <&gmac2>; + __overlay__ { + phy-mode = "10gbase-r"; + managed = "in-band-status"; + sfp = <&sfp_esp0>; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-sd.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-sd.dtso new file mode 100644 index 00000000000000..04472cc12dc816 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-sd.dtso @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2023 MediaTek Inc. + * Author: Frank Wunderlich + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@1 { + target-path = <&mmc0>; + __overlay__ { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_sdcard>; + pinctrl-1 = <&mmc0_pins_sdcard>; + cd-gpios = <&pio 69 GPIO_ACTIVE_LOW>; + bus-width = <4>; + max-frequency = <52000000>; + cap-sd-highspeed; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_3p3v>; + no-mmc; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso new file mode 100644 index 00000000000000..61801651778516 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&snand>; + __overlay__ { + status = "okay"; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + partition@180000 { + label = "Factory"; + reg = <0x180000 0x0400000>; + }; + + partition@580000 { + label = "FIP"; + reg = <0x580000 0x0200000>; + }; + + partition@780000 { + label = "ubi"; + reg = <0x780000 0x7080000>; + }; + }; + }; + }; + }; + + fragment@1 { + target = <&bch>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi deleted file mode 100644 index e4c05712509ee4..00000000000000 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtsi +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Copyright (C) 2022 MediaTek Inc. - * Author: Sam.Shih - */ - -/dts-v1/; -#include "mt7988a-rfb.dtsi" - -&pio { - spi0_flash_pins: spi0-pins { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - }; -}; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_flash_pins>; - status = "okay"; - - spi_nand: spi_nand@0 { - compatible = "spi-nand"; - reg = <0>; - spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; - }; - -}; - -&spi_nand { - mediatek,nmbm; - mediatek,bmt-max-ratio = <1>; - mediatek,bmt-max-reserved-blocks = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "BL2"; - reg = <0x00000 0x0100000>; - read-only; - }; - - partition@100000 { - label = "u-boot-env"; - reg = <0x0100000 0x0080000>; - }; - - factory: partition@180000 { - label = "Factory"; - reg = <0x180000 0x0400000>; - }; - - partition@580000 { - label = "FIP"; - reg = <0x580000 0x0200000>; - }; - - partition@780000 { - label = "ubi"; - reg = <0x780000 0x7080000>; - }; - }; -}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso new file mode 100644 index 00000000000000..e63436fa556de8 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&spi0>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + partition@180000 { + label = "Factory"; + reg = <0x180000 0x0400000>; + }; + + partition@580000 { + label = "FIP"; + reg = <0x580000 0x0200000>; + }; + + partition@780000 { + label = "ubi"; + reg = <0x780000 0x7080000>; + }; + }; + }; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nor.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nor.dtso new file mode 100644 index 00000000000000..33bd57b3fb63b3 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nor.dtso @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&spi2>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&spi2_flash_pins>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 < + 0x53 0x46 0x5F 0x42 0x4F 0x4F 0x54>; /* SF_BOOT */ + spi-cal-addrlen = <1>; + spi-cal-addr = /bits/ 32 <0x0>; + reg = <0>; + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partition@00000 { + label = "BL2"; + reg = <0x00000 0x0040000>; + }; + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x0010000>; + }; + partition@50000 { + label = "Factory"; + reg = <0x50000 0x0200000>; + }; + partition@250000 { + label = "FIP"; + reg = <0x250000 0x0080000>; + }; + partition@2D0000 { + label = "firmware"; + reg = <0x2D0000 0x1D30000>; + }; + }; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dts similarity index 68% rename from target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dtsi rename to target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dts index 423b3860c6c64e..11dbf98301eb48 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dts @@ -6,8 +6,35 @@ /dts-v1/; #include "mt7988a.dtsi" +#include +#include #include +/ { + model = "MediaTek MT7988A Reference Board"; + compatible = "mediatek,mt7988a-rfb", + "mediatek,mt7988"; + + chosen { + bootargs = "console=ttyS0,115200n1 loglevel=8 \ + earlycon=uart8250,mmio32,0x11000000 \ + pci=pcie_bus_perf"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +ð { + pinctrl-0 = <&mdio0_pins>; + pinctrl-names = "default"; +}; + +&gmac0 { + status = "okay"; +}; + &cpu0 { proc-supply = <&rt5190_buck3>; }; @@ -32,6 +59,50 @@ status = "okay"; }; +&switch { + status = "okay"; +}; + +&gsw_phy0 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe0_led0_pins>; +}; + +&gsw_phy0_led0 { + status = "okay"; + color = ; +}; + +&gsw_phy1 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe1_led0_pins>; +}; + +&gsw_phy1_led0 { + status = "okay"; + color = ; +}; + +&gsw_phy2 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe2_led0_pins>; +}; + +&gsw_phy2_led0 { + status = "okay"; + color = ; +}; + +&gsw_phy3 { + pinctrl-names = "gbe-led"; + pinctrl-0 = <&gbe3_led0_pins>; +}; + +&gsw_phy3_led0 { + status = "okay"; + color = ; +}; + &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; @@ -89,26 +160,18 @@ }; &pcie0 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie0_pins>; status = "okay"; }; &pcie1 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie1_pins>; status = "okay"; }; &pcie2 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie2_pins>; status = "disabled"; }; &pcie3 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie3_pins>; status = "okay"; }; @@ -124,44 +187,6 @@ status = "okay"; }; -&pio { - pcie0_pins: pcie0-pins { - mux { - function = "pcie"; - groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0", - "pcie_wake_n0_0"; - }; - }; - - pcie1_pins: pcie1-pins { - mux { - function = "pcie"; - groups = "pcie_2l_1_pereset", "pcie_clk_req_n1", - "pcie_wake_n1_0"; - }; - }; - - pcie2_pins: pcie2-pins { - mux { - function = "pcie"; - groups = "pcie_1l_0_pereset", "pcie_clk_req_n2_0", - "pcie_wake_n2_0"; - }; - }; - - pcie3_pins: pcie3-pins { - mux { - function = "pcie"; - groups = "pcie_1l_1_pereset", "pcie_clk_req_n3", - "pcie_wake_n3_0"; - }; - }; -}; - -&spi0 { - status = "disabled"; -}; - &uart0 { status = "okay"; }; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi index 462218c65d47ed..7fed1e13843457 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a.dtsi @@ -152,6 +152,65 @@ }; }; + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <1000>; + polling-delay = <1000>; + thermal-sensors = <&lvts 0>; + trips { + cpu_trip_crit: crit { + temperature = <125000>; + hysteresis = <2000>; + type = "critical"; + }; + + cpu_trip_hot: hot { + temperature = <120000>; + hysteresis = <2000>; + type = "hot"; + }; + + cpu_trip_active_high: active-high { + temperature = <115000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_trip_active_med: active-med { + temperature = <85000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_trip_active_low: active-low { + temperature = <40000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + cpu-active-high { + /* active: set fan to cooling level 2 */ + cooling-device = <&fan 3 3>; + trip = <&cpu_trip_active_high>; + }; + + cpu-active-low { + /* active: set fan to cooling level 1 */ + cooling-device = <&fan 2 2>; + trip = <&cpu_trip_active_med>; + }; + + cpu-passive { + /* passive: set fan to cooling level 0 */ + cooling-device = <&fan 1 1>; + trip = <&cpu_trip_active_low>; + }; + }; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupt-parent = <&gic>; @@ -161,6 +220,24 @@ ; }; + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + soc { #address-cells = <2>; #size-cells = <2>; @@ -386,6 +463,80 @@ groups = "uart0"; }; }; + + snfi_pins: snfi-pins { + mux { + function = "flash"; + groups = "snfi"; + }; + }; + + spi0_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0"; + }; + }; + + spi0_flash_pins: spi0-flash-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + + spi1_pins: spi1-pins { + mux { + function = "spi"; + groups = "spi1"; + }; + }; + + spi2_pins: spi2-pins { + mux { + function = "spi"; + groups = "spi2"; + }; + }; + + spi2_flash_pins: spi2-flash-pins { + mux { + function = "spi"; + groups = "spi2", "spi2_wp_hold"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0", + "pcie_wake_n0_0"; + }; + }; + + pcie1_pins: pcie1-pins { + mux { + function = "pcie"; + groups = "pcie_2l_1_pereset", "pcie_clk_req_n1", + "pcie_wake_n1_0"; + }; + }; + + pcie2_pins: pcie2-pins { + mux { + function = "pcie"; + groups = "pcie_1l_0_pereset", "pcie_clk_req_n2_0", + "pcie_wake_n2_0"; + }; + }; + + pcie3_pins: pcie3-pins { + mux { + function = "pcie"; + groups = "pcie_1l_1_pereset", "pcie_clk_req_n3", + "pcie_wake_n3_0"; + }; + }; }; sgmiisys0: syscon@10060000 { @@ -420,24 +571,24 @@ #clock-cells = <1>; }; - xfi_pextp0: xfi_pextp@11f20000 { - compatible = "mediatek,mt7988-xfi_pextp", - "mediatek,mt7988-xfi_pextp_0", + xfi_pextp0: xfi-pextp@11f20000 { + compatible = "mediatek,mt7988-xfi-pextp", + "mediatek,mt7988-xfi-pextp_0", "syscon"; reg = <0 0x11f20000 0 0x10000>; #clock-cells = <1>; }; - xfi_pextp1: xfi_pextp@11f30000 { - compatible = "mediatek,mt7988-xfi_pextp", - "mediatek,mt7988-xfi_pextp_1", + xfi_pextp1: xfi-pextp@11f30000 { + compatible = "mediatek,mt7988-xfi-pextp", + "mediatek,mt7988-xfi-pextp_1", "syscon"; reg = <0 0x11f30000 0 0x10000>; #clock-cells = <1>; }; - xfi_pll: xfi_pll@11f40000 { - compatible = "mediatek,mt7988-xfi_pll", "syscon"; + xfi_pll: xfi-pll@11f40000 { + compatible = "mediatek,mt7988-xfi-pll", "syscon"; reg = <0 0x11f40000 0 0x1000>; #clock-cells = <1>; }; @@ -470,6 +621,35 @@ status = "disabled"; }; + snand: spi@11001000 { + compatible = "mediatek,mt7986-snand"; + reg = <0 0x11001000 0 0x1000>; + interrupts = ; + clocks = <&infracfg CLK_INFRA_SPINFI>, + <&infracfg CLK_INFRA_NFI>; + clock-names = "pad_clk", "nfi_clk"; + assigned-clocks = <&topckgen CLK_TOP_SPINFI_SEL>, + <&topckgen CLK_TOP_NFI1X_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_MPLL_D8>, + <&topckgen CLK_TOP_MPLL_D8>; + nand-ecc-engine = <&bch>; + mediatek,quad-spi; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&snfi_pins>; + status = "disabled"; + }; + + bch: ecc@11002000 { + compatible = "mediatek,mt7686-ecc"; + reg = <0 0x11002000 0 0x1000>; + interrupts = ; + clocks = <&topckgen CLK_TOP_NFI1X_SEL>; + clock-names = "nfiecc_clk"; + status = "disabled"; + }; + i2c0: i2c@11003000 { compatible = "mediatek,mt7988-i2c", "mediatek,mt7981-i2c"; @@ -525,10 +705,118 @@ <&infracfg CLK_INFRA_66M_SPI0_HCK>; clock-names = "parent-clk", "sel-clk", "spi-clk", "spi-hclk"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + spi1: spi@11008000 { + compatible = "mediatek,ipm-spi-single", "mediatek,spi-ipm"; + reg = <0 0x11008000 0 0x100>; + interrupts = ; + clocks = <&topckgen CLK_TOP_MPLL_D2>, + <&topckgen CLK_TOP_SPI_SEL>, + <&infracfg CLK_INFRA_104M_SPI1>, + <&infracfg CLK_INFRA_66M_SPI1_HCK>; + clock-names = "parent-clk", "sel-clk", "spi-clk", + "spi-hclk"; #address-cells = <1>; #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&spi1_pins>; + status = "disabled"; + }; + + spi2: spi@11009000 { + compatible = "mediatek,ipm-spi-quad", "mediatek,spi-ipm"; + reg = <0 0x11009000 0 0x100>; + interrupts = ; + clocks = <&topckgen CLK_TOP_MPLL_D2>, + <&topckgen CLK_TOP_SPI_SEL>, + <&infracfg CLK_INFRA_104M_SPI2_BCK>, + <&infracfg CLK_INFRA_66M_SPI2_HCK>; + clock-names = "parent-clk", "sel-clk", "spi-clk", + "spi-hclk"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + pwm: pwm@10048000 { + compatible = "mediatek,mt7988-pwm"; + reg = <0 0x10048000 0 0x1000>; + #pwm-cells = <2>; + clocks = <&infracfg CLK_INFRA_66M_PWM_BCK>, + <&infracfg CLK_INFRA_66M_PWM_HCK>, + <&infracfg CLK_INFRA_66M_PWM_CK1>, + <&infracfg CLK_INFRA_66M_PWM_CK2>, + <&infracfg CLK_INFRA_66M_PWM_CK3>, + <&infracfg CLK_INFRA_66M_PWM_CK4>, + <&infracfg CLK_INFRA_66M_PWM_CK5>, + <&infracfg CLK_INFRA_66M_PWM_CK6>, + <&infracfg CLK_INFRA_66M_PWM_CK7>, + <&infracfg CLK_INFRA_66M_PWM_CK8>; + clock-names = "top", "main", "pwm1", "pwm2", "pwm3", + "pwm4","pwm5","pwm6","pwm7","pwm8"; + status = "disabled"; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + /* cooling level (0, 1, 2) : (0% duty, 50% duty, 100% duty) */ + cooling-levels = <0 128 255>; + #cooling-cells = <2>; + #thermal-sensor-cells = <1>; + status = "disabled"; + }; + + lvts: lvts@1100a000 { + compatible = "mediatek,mt7988-lvts"; + #thermal-sensor-cells = <1>; + reg = <0 0x1100a000 0 0x1000>; + clocks = <&infracfg CLK_INFRA_26M_THERM_SYSTEM>; + clock-names = "lvts_clk"; + nvmem-cells = <&lvts_calibration>; + nvmem-cell-names = "e_data1"; + }; + + crypto: crypto@15600000 { + compatible = "inside-secure,safexcel-eip197b"; + reg = <0 0x15600000 0 0x180000>; + interrupts = , + , + , + ; + interrupt-names = "ring0", "ring1", "ring2", "ring3"; + status = "okay"; + }; + + afe: audio-controller@11210000 { + compatible = "mediatek,mt79xx-audio"; + reg = <0 0x11210000 0 0x9000>; + interrupts = ; + clocks = <&infracfg CLK_INFRA_66M_AUD_SLV_BCK>, + <&infracfg CLK_INFRA_AUD_26M>, + <&infracfg CLK_INFRA_AUD_L>, + <&infracfg CLK_INFRA_AUD_AUD>, + <&infracfg CLK_INFRA_AUD_EG2>, + <&topckgen CLK_TOP_AUD_SEL>, + <&topckgen CLK_TOP_AUD_I2S_M>; + clock-names = "aud_bus_ck", + "aud_26m_ck", + "aud_l_ck", + "aud_aud_ck", + "aud_eg2_ck", + "aud_sel", + "aud_i2s_m"; + assigned-clocks = <&topckgen CLK_TOP_AUD_SEL>, + <&topckgen CLK_TOP_A1SYS_SEL>, + <&topckgen CLK_TOP_AUD_L_SEL>, + <&topckgen CLK_TOP_A_TUNER_SEL>; + assigned-clock-parents = <&apmixedsys CLK_APMIXED_APLL2>, + <&topckgen CLK_TOP_APLL2_D4>, + <&apmixedsys CLK_APMIXED_APLL2>, + <&topckgen CLK_TOP_APLL2_D4>; status = "disabled"; }; @@ -554,6 +842,8 @@ <&infracfg CLK_INFRA_133M_PCIE_CK_P2>; clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_pins>; status = "disabled"; phys = <&xphyu3port0 PHY_TYPE_PCIE>; @@ -594,6 +884,8 @@ <&infracfg CLK_INFRA_133M_PCIE_CK_P3>; clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie3_pins>; status = "disabled"; #interrupt-cells = <1>; @@ -631,6 +923,8 @@ <&infracfg CLK_INFRA_133M_PCIE_CK_P0>; clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; status = "disabled"; #interrupt-cells = <1>; @@ -668,6 +962,8 @@ <&infracfg CLK_INFRA_133M_PCIE_CK_P1>; clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie1_pins>; status = "disabled"; #interrupt-cells = <1>; @@ -909,7 +1205,7 @@ mediatek,pio = <&pio>; gsw_phy0: ethernet-phy@0 { - compatible = "ethernet-phy-id03a2.9481"; + compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; phy-mode = "internal"; nvmem-cells = <&phy_calibration_p0>; @@ -934,7 +1230,7 @@ }; gsw_phy1: ethernet-phy@1 { - compatible = "ethernet-phy-id03a2.9481"; + compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; phy-mode = "internal"; nvmem-cells = <&phy_calibration_p1>; @@ -959,7 +1255,7 @@ }; gsw_phy2: ethernet-phy@2 { - compatible = "ethernet-phy-id03a2.9481"; + compatible = "ethernet-phy-ieee802.3-c22"; reg = <2>; phy-mode = "internal"; nvmem-cells = <&phy_calibration_p2>; @@ -984,7 +1280,7 @@ }; gsw_phy3: ethernet-phy@3 { - compatible = "ethernet-phy-id03a2.9481"; + compatible = "ethernet-phy-ieee802.3-c22"; reg = <3>; phy-mode = "internal"; nvmem-cells = <&phy_calibration_p3>; @@ -1096,19 +1392,19 @@ mediatek,ethsys = <ðsys>; mediatek,sgmiisys = <&sgmiisys0>, <&sgmiisys1>; mediatek,usxgmiisys = <&usxgmiisys0>, <&usxgmiisys1>; - mediatek,xfi_pextp = <&xfi_pextp0>, <&xfi_pextp1>; - mediatek,xfi_pll = <&xfi_pll>; + mediatek,xfi-pextp = <&xfi_pextp0>, <&xfi_pextp1>; + mediatek,xfi-pll = <&xfi_pll>; mediatek,infracfg = <&topmisc>; mediatek,toprgu = <&watchdog>; #reset-cells = <1>; #address-cells = <1>; #size-cells = <0>; - status = "disabled"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "internal"; + status = "disabled"; fixed-link { speed = <10000>; @@ -1120,11 +1416,13 @@ gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; + status = "disabled"; }; gmac2: mac@2 { compatible = "mediatek,eth-mac"; reg = <2>; + status = "disabled"; }; mdio_bus: mdio-bus { diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 4013c149f1efbc..1ea2ada0984b66 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -36,8 +36,8 @@ mediatek_setup_interfaces() mediatek,mt7986b-rfb) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" eth1 ;; - mediatek,mt7988a-dsa-10g-spim-snand) - ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "eth1 eth2" + mediatek,mt7988a-rfb) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 eth1" eth2" ;; mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index f61efca05ef1c9..846fbcbf2cccac 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -22,7 +22,15 @@ define Build/mt7986-bl31-uboot cat $(STAGING_DIR_IMAGE)/mt7986_$1-u-boot.fip >> $@ endef -define Build/mt7986-gpt +define Build/mt7988-bl2 + cat $(STAGING_DIR_IMAGE)/mt7988-$1-bl2.img >> $@ +endef + +define Build/mt7988-bl31-uboot + cat $(STAGING_DIR_IMAGE)/mt7988_$1-u-boot.fip >> $@ +endef + +define Build/mt798x-gpt cp $@ $@.tmp 2>/dev/null || true ptgen -g -o $@.tmp -a 1 -l 1024 \ $(if $(findstring sdmmc,$1), \ @@ -136,7 +144,7 @@ define Device/bananapi_bpi-r3 ARTIFACT/nor-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-nor ARTIFACT/snand-preloader.bin := mt7986-bl2 spim-nand-ddr4 ARTIFACT/snand-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-snand - ARTIFACT/sdcard.img.gz := mt7986-gpt sdmmc |\ + ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\ pad-to 17k | mt7986-bl2 sdmmc-ddr4 |\ pad-to 6656k | mt7986-bl31-uboot bananapi_bpi-r3-sdmmc |\ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ @@ -148,7 +156,7 @@ define Device/bananapi_bpi-r3 pad-to 50M | mt7986-bl31-uboot bananapi_bpi-r3-nor |\ pad-to 51M | mt7986-bl2 emmc-ddr4 |\ pad-to 52M | mt7986-bl31-uboot bananapi_bpi-r3-emmc |\ - pad-to 56M | mt7986-gpt emmc |\ + pad-to 56M | mt798x-gpt emmc |\ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ ) \ @@ -282,23 +290,67 @@ define Device/mediatek_mt7986b-rfb endef TARGET_DEVICES += mediatek_mt7986b-rfb -define Device/mediatek_mt7988a-rfb-nand +define Device/mediatek_mt7988a-rfb DEVICE_VENDOR := MediaTek - DEVICE_MODEL := MT7988a nand rfb - DEVICE_DTS := mt7988a-dsa-10g-spim-nand + DEVICE_MODEL := MT7988A rfb + DEVICE_DTS := mt7988a-rfb + DEVICE_DTS_OVERLAY:= \ + mt7988a-rfb-emmc \ + mt7988a-rfb-sd \ + mt7988a-rfb-snfi-nand \ + mt7988a-rfb-spim-nand \ + mt7988a-rfb-spim-nor \ + mt7988a-rfb-eth1-aqr \ + mt7988a-rfb-eth1-i2p5g-phy \ + mt7988a-rfb-eth1-mxl \ + mt7988a-rfb-eth1-sfp \ + mt7988a-rfb-eth2-aqr \ + mt7988a-rfb-eth2-mxl \ + mt7988a-rfb-eth2-sfp DEVICE_DTS_DIR := $(DTS_DIR)/ - KERNEL_LOADADDR := 0x48000000 - SUPPORTED_DEVICES := mediatek,mt7988a-rfb - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 - IMAGE_SIZE := 65536k + DEVICE_DTC_FLAGS := --pad 4096 + DEVICE_DTS_LOADADDR := 0x45f00000 + DEVICE_PACKAGES := kmod-sfp + KERNEL_LOADADDR := 0x46000000 + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + KERNEL_INITRAMFS_SUFFIX := .itb KERNEL_IN_UBI := 1 - IMAGES += factory.bin - IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m + IMAGES := sysupgrade.itb + IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata + ARTIFACTS := \ + emmc-gpt.bin emmc-preloader.bin emmc-bl31-uboot.fip \ + nor-preloader.bin nor-bl31-uboot.fip \ + sdcard.img.gz \ + snand-preloader.bin snand-bl31-uboot.fip + ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc + ARTIFACT/emmc-preloader.bin := mt7988-bl2 emmc-comb + ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot rfb-emmc + ARTIFACT/nor-preloader.bin := mt7988-bl2 nor-comb + ARTIFACT/nor-bl31-uboot.fip := mt7988-bl31-uboot rfb-nor + ARTIFACT/snand-preloader.bin := mt7988-bl2 spim-nand-comb + ARTIFACT/snand-bl31-uboot.fip := mt7988-bl31-uboot rfb-snand + ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\ + pad-to 17k | mt7988-bl2 sdmmc-comb |\ + pad-to 6656k | mt7988-bl31-uboot rfb-sd |\ + $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ + pad-to 12M | append-image-stage initramfs.itb | check-size 44m |\ + ) \ + pad-to 44M | mt7988-bl2 spim-nand-comb |\ + pad-to 45M | mt7988-bl31-uboot rfb-snand |\ + pad-to 51M | mt7988-bl2 nor-comb |\ + pad-to 51M | mt7988-bl31-uboot rfb-nor |\ + pad-to 55M | mt7988-bl2 emmc-comb |\ + pad-to 56M | mt7988-bl31-uboot rfb-emmc |\ + pad-to 62M | mt798x-gpt emmc |\ + $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ + pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ + ) \ + gzip endef -TARGET_DEVICES += mediatek_mt7988a-rfb-nand +TARGET_DEVICES += mediatek_mt7988a-rfb define Device/mercusys_mr90x-v1 DEVICE_VENDOR := Mercusys @@ -352,7 +404,7 @@ define Device/tplink_tl-xdr-common KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | append-metadata DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware ARTIFACTS := preloader.bin bl31-uboot.fip ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr3 From c8c18051002c7812bfa33c4572e94a0fd855bbeb Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 28 Aug 2023 00:13:05 +0100 Subject: [PATCH 0414/1171] uboot-mediatek: add builds for UniFi 6 LR v2 and v3 While the v2 is nearly identical to v1, v3 uses a different PHY and needs a different build for Ethernet to work in U-Boot. Signed-off-by: Daniel Golle (cherry picked from commit fff4441135ed9290eb2f947f931b826a60d6c167) --- package/boot/uboot-mediatek/Makefile | 34 +- .../patches/412-add-ubnt-unifi-6-lr.patch | 620 +++++++++++++++++- 2 files changed, 641 insertions(+), 13 deletions(-) diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index a04e629f1227d6..021d444a97a54b 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -124,10 +124,34 @@ define U-Boot/mt7622_bananapi_bpi-r64-snand DEPENDS:=+trusted-firmware-a-mt7622-snand-2ddr endef -define U-Boot/mt7622_ubnt_unifi-6-lr +define U-Boot/mt7622_ubnt_unifi-6-lr-v1 NAME:=Ubiquiti UniFi 6 LR - UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr - BUILD_DEVICES:=ubnt_unifi-6-lr-v1-ubootmod ubnt_unifi-6-lr-v2-ubootmod + UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr-v1 + BUILD_DEVICES:=ubnt_unifi-6-lr-v1-ubootmod + BUILD_SUBTARGET:=mt7622 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=nor + BL2_DDRBLOB:=2 + DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr + FIP_COMPRESS:=1 +endef + +define U-Boot/mt7622_ubnt_unifi-6-lr-v2 + NAME:=Ubiquiti UniFi 6 LR v2 + UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr-v2 + BUILD_DEVICES:=ubnt_unifi-6-lr-v2-ubootmod + BUILD_SUBTARGET:=mt7622 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=nor + BL2_DDRBLOB:=2 + DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr + FIP_COMPRESS:=1 +endef + +define U-Boot/mt7622_ubnt_unifi-6-lr-v3 + NAME:=Ubiquiti UniFi 6 LR v3 + UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr-v3 + BUILD_DEVICES:=ubnt_unifi-6-lr-v3-ubootmod BUILD_SUBTARGET:=mt7622 UBOOT_IMAGE:=u-boot.fip BL2_BOOTDEV:=nor @@ -392,7 +416,9 @@ UBOOT_TARGETS := \ mt7622_bananapi_bpi-r64-snand \ mt7622_linksys_e8450 \ mt7622_rfb1 \ - mt7622_ubnt_unifi-6-lr \ + mt7622_ubnt_unifi-6-lr-v1 \ + mt7622_ubnt_unifi-6-lr-v2 \ + mt7622_ubnt_unifi-6-lr-v3 \ mt7623n_bpir2 \ mt7623a_unielec_u7623 \ mt7628_rfb \ diff --git a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch index 4bde0617653194..aad6c53b9bb929 100644 --- a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch +++ b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch @@ -1,5 +1,5 @@ --- /dev/null -+++ b/configs/mt7622_ubnt_unifi-6-lr_defconfig ++++ b/configs/mt7622_ubnt_unifi-6-lr-v1_defconfig @@ -0,0 +1,147 @@ +CONFIG_ARM=y +CONFIG_POSITION_INDEPENDENT=y @@ -149,6 +149,305 @@ +CONFIG_USE_SERVERIP=y +CONFIG_SERVERIP="192.168.1.254" --- /dev/null ++++ b/configs/mt7622_ubnt_unifi-6-lr-v2_defconfig +@@ -0,0 +1,147 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7622=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_LOAD_ADDR=0x40080000 ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)" ++CONFIG_ENV_IS_IN_MTD=y ++CONFIG_ENV_MTD_NAME="nor0" ++CONFIG_ENV_SIZE_REDUND=0x4000 ++CONFIG_ENV_SIZE=0x4000 ++CONFIG_ENV_OFFSET=0xc0000 ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_RESET_BUTTON_SETTLE_DELAY=400 ++CONFIG_BOOTP_SEND_HOSTNAME=y ++CONFIG_DEFAULT_ENV_FILE="ubnt_unifi-6-lr-v2_env" ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=25000000 ++CONFIG_DEFAULT_DEVICE_TREE="mt7622-ubnt-unifi-6-lr" ++CONFIG_DEBUG_UART=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_DEFAULT_FDT_FILE="mt7622-ubnt-unifi-6-lr" ++CONFIG_SYS_PROMPT="MT7622> " ++# CONFIG_LEGACY_IMAGE_FORMAT is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_EFI is not set ++# CONFIG_EFI_LOADER is not set ++CONFIG_CMD_BOOTMENU=y ++# CONFIG_CMD_BOOTEFI is not set ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++# CONFIG_CMD_ELF is not set ++# CONFIG_CMD_BOOTEFI_BOOTMGR is not set ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_MTD=y ++CONFIG_CMD_MTDPARTS=y ++# CONFIG_CMD_PCI is not set ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++# CONFIG_CMD_UNLZ4 is not set ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_ETH=y ++CONFIG_DM_ETH_PHY=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_MDIO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++# CONFIG_DM_MMC is not set ++CONFIG_DM_SERIAL=y ++CONFIG_DM_SPI=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_HUSH_PARSER=y ++# CONFIG_PARTITION_UUIDS is not set ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++# CONFIG_LED is not set ++# CONFIG_LZ4 is not set ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_PHYLIB_10G=y ++CONFIG_PHY_AQUANTIA=y ++CONFIG_PHY_ADDR_ENABLE=y ++CONFIG_PHY_ADDR=8 ++CONFIG_MEDIATEK_ETH=y ++CONFIG_MTD=y ++# CONFIG_MMC is not set ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_MTK_SNFI_SPI=y ++CONFIG_MTK_SNOR=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_SPI_FLASH=y ++CONFIG_SPI_FLASH_BAR=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_SPI_FLASH_UNLOCK_ALL=y ++CONFIG_SPI_FLASH_EON=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_SPI_FLASH_STMICRO=y ++CONFIG_SPI_FLASH_SST=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XMC=y ++CONFIG_SPI_FLASH_USE_4K_SECTORS=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/configs/mt7622_ubnt_unifi-6-lr-v3_defconfig +@@ -0,0 +1,146 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7622=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_LOAD_ADDR=0x40080000 ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)" ++CONFIG_ENV_IS_IN_MTD=y ++CONFIG_ENV_MTD_NAME="nor0" ++CONFIG_ENV_SIZE_REDUND=0x4000 ++CONFIG_ENV_SIZE=0x4000 ++CONFIG_ENV_OFFSET=0xc0000 ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_RESET_BUTTON_SETTLE_DELAY=400 ++CONFIG_BOOTP_SEND_HOSTNAME=y ++CONFIG_DEFAULT_ENV_FILE="ubnt_unifi-6-lr_env" ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=25000000 ++CONFIG_DEFAULT_DEVICE_TREE="mt7622-ubnt-unifi-6-lr-v3" ++CONFIG_DEBUG_UART=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_DEFAULT_FDT_FILE="mt7622-ubnt-unifi-6-lr-v3" ++CONFIG_SYS_PROMPT="MT7622> " ++# CONFIG_LEGACY_IMAGE_FORMAT is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_EFI is not set ++# CONFIG_EFI_LOADER is not set ++CONFIG_CMD_BOOTMENU=y ++# CONFIG_CMD_BOOTEFI is not set ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++# CONFIG_CMD_ELF is not set ++# CONFIG_CMD_BOOTEFI_BOOTMGR is not set ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_MTD=y ++CONFIG_CMD_MTDPARTS=y ++# CONFIG_CMD_PCI is not set ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++# CONFIG_CMD_UNLZ4 is not set ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_ETH=y ++CONFIG_DM_ETH_PHY=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_MDIO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++# CONFIG_DM_MMC is not set ++CONFIG_DM_SERIAL=y ++CONFIG_DM_SPI=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_HUSH_PARSER=y ++# CONFIG_PARTITION_UUIDS is not set ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++# CONFIG_LED is not set ++# CONFIG_LZ4 is not set ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_PHY_REALTEK=y ++CONFIG_PHY_ADDR_ENABLE=y ++CONFIG_PHY_ADDR=0 ++CONFIG_MEDIATEK_ETH=y ++CONFIG_MTD=y ++# CONFIG_MMC is not set ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_MTK_SNFI_SPI=y ++CONFIG_MTK_SNOR=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_SPI_FLASH=y ++CONFIG_SPI_FLASH_BAR=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_SPI_FLASH_UNLOCK_ALL=y ++CONFIG_SPI_FLASH_EON=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_SPI_FLASH_STMICRO=y ++CONFIG_SPI_FLASH_SST=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XMC=y ++CONFIG_SPI_FLASH_USE_4K_SECTORS=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null +++ b/arch/arm/dts/mt7622-ubnt-unifi-6-lr.dts @@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0 @@ -165,8 +464,204 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; -+ model = "mt7622-ubnt-unifi-6-lr"; -+ compatible = "mediatek,mt7622", "ubnt,unifi-6-lr"; ++ model = "mt7622-ubnt-unifi-6-lr"; ++ compatible = "mediatek,mt7622", "ubnt,unifi-6-lr"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ ++ aliases { ++ spi0 = &snor; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ gpios = <&gpio 62 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ }; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ ++ reg_1p8v: regulator-1p8v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-1.8V"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_5v: regulator-5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++}; ++ ++&pcie { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>; ++ status = "okay"; ++ ++ pcie@0,0 { ++ status = "okay"; ++ }; ++ ++ pcie@1,0 { ++ status = "okay"; ++ }; ++}; ++ ++&pinctrl { ++ eth_pins: eth-pins { ++ mux { ++ function = "eth"; ++ groups = "mdc_mdio", "rgmii_via_gmac2"; ++ }; ++ }; ++ ++ pcie0_pins: pcie0-pins { ++ mux { ++ function = "pcie"; ++ groups = "pcie0_pad_perst", ++ "pcie0_1_waken", ++ "pcie0_1_clkreq"; ++ }; ++ }; ++ ++ pcie1_pins: pcie1-pins { ++ mux { ++ function = "pcie"; ++ groups = "pcie1_pad_perst", ++ "pcie1_0_waken", ++ "pcie1_0_clkreq"; ++ }; ++ }; ++ ++ snfi_pins: snfi-pins { ++ mux { ++ function = "flash"; ++ groups = "snfi"; ++ }; ++ }; ++ ++ snor_pins: snor-pins { ++ mux { ++ function = "flash"; ++ groups = "spi_nor"; ++ }; ++ }; ++ ++ uart0_pins: uart0 { ++ mux { ++ function = "uart"; ++ groups = "uart0_0_tx_rx" ; ++ }; ++ }; ++ ++ watchdog_pins: watchdog-default { ++ mux { ++ function = "watchdog"; ++ groups = "watchdog"; ++ }; ++ }; ++}; ++ ++&snor { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&snor_pins>; ++ status = "okay"; ++ ++ spi-flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-tx-bus-width = <1>; ++ spi-rx-bus-width = <4>; ++ u-boot,dm-pre-reloc; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&watchdog { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&watchdog_pins>; ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <ð_pins>; ++ ++ mediatek,gmac-id = <0>; ++ phy-mode = "2500base-x"; ++ phy-handle = <&gphy>; ++ ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++ ++ mdio-bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ gphy: ethernet-phy@8 { ++ /* Marvell AQRate AQR112W - no driver */ ++ compatible = "ethernet-phy-ieee802.3-c45"; ++ reg = <0x8>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/dts/mt7622-ubnt-unifi-6-lr-v3.dts +@@ -0,0 +1,193 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2019 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include ++#include "mt7622.dtsi" ++#include "mt7622-u-boot.dtsi" ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "mt7622-ubnt-unifi-6-lr-v3"; ++ compatible = "mediatek,mt7622", "ubnt,unifi-6-lr-v3"; + + chosen { + stdout-path = &uart0; @@ -325,7 +820,7 @@ + pinctrl-0 = <ð_pins>; + + mediatek,gmac-id = <0>; -+ phy-mode = "2500base-x"; ++ phy-mode = "sgmii"; + phy-handle = <&gphy>; + + fixed-link { @@ -337,20 +832,21 @@ + #address-cells = <1>; + #size-cells = <0>; + -+ gphy: ethernet-phy@8 { -+ /* Marvell AQRate AQR112W - no driver */ -+ compatible = "ethernet-phy-ieee802.3-c45"; -+ reg = <0x8>; ++ gphy: ethernet-phy@0 { ++ /* RealTek RTL8211FS */ ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <0x0>; + }; + }; +}; --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1306,6 +1306,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1306,6 +1306,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7623a-unielec-u7623-02-emmc.dtb \ mt7622-bananapi-bpi-r64.dtb \ mt7622-linksys-e8450-ubi.dtb \ + mt7622-ubnt-unifi-6-lr.dtb \ ++ mt7622-ubnt-unifi-6-lr-v3.dtb \ mt7623n-bananapi-bpi-r2.dtb \ mt7629-rfb.dtb \ mt7981-rfb.dtb \ @@ -407,6 +903,112 @@ +_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; run _init_env ; run boot_first +_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" +--- /dev/null ++++ b/ubnt_unifi-6-lr-v2_env +@@ -0,0 +1,50 @@ ++ethaddr_factory=mtd read nor0 $loadaddr 0x110000 0x10000 && env readmem -b ethaddr $loadaddr 0x6 ; setenv ethaddr_factory ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x48000000 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi ++bootdelay=0 ++bootfile=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-squashfs-sysupgrade.itb ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to flash.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to flash.=run boot_tftp_write_preloader ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=run nor_read_production && bootm $loadaddr ++boot_recovery=run nor_read_recovery ; bootm $loadaddr ++boot_serial_write_fip=loadx $loadaddr 115200 && run boot_write_fip ++boot_serial_write_preloader=loadx $loadaddr 115200 && run boot_write_preloader ++boot_tftp_forever=while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run nor_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip ++boot_tftp_write_preloader=tftpboot $loadaddr $bootfile_bl2 && run boot_write_preloader ++boot_nor=run boot_production ; run boot_recovery ++boot_write_fip=mtd erase nor0 0x20000 0x80000 && mtd write nor0 $loadaddr 0x20000 0x80000 ++boot_write_preloader=mtd erase nor0 0x0 0x20000 && mtd write nor0 $loadaddr 0x0 0x20000 ++reset_factory=mtd erase nor0 0xc0000 0x10000 && reset ++nor_read_production=mtd read nor0 $loadaddr 0x1000000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x1000000 $image_size ++nor_read_recovery=mtd read nor0 $loadaddr 0x120000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x120000 $image_size ++nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x1000 ; setexpr tmp1 0x$image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb 0x$image_eb * 0x1000 ++nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase nor0 0x1000000 0x$image_eb && mtd write nor0 $loadaddr 0x1000000 $filesize ++nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0xee0000 && mtd erase nor0 0x120000 0x$image_eb && mtd write nor0 $loadaddr 0x120000 $filesize ++_init_env=setenv _init_env ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"--- /dev/null +--- /dev/null ++++ b/ubnt_unifi-6-lr-v3_env +@@ -0,0 +1,50 @@ ++ethaddr_factory=mtd read nor0 $loadaddr 0x110000 0x10000 && env readmem -b ethaddr $loadaddr 0x6 ; setenv ethaddr_factory ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x48000000 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi ++bootdelay=0 ++bootfile=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-squashfs-sysupgrade.itb ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to flash.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to flash.=run boot_tftp_write_preloader ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=run nor_read_production && bootm $loadaddr ++boot_recovery=run nor_read_recovery ; bootm $loadaddr ++boot_serial_write_fip=loadx $loadaddr 115200 && run boot_write_fip ++boot_serial_write_preloader=loadx $loadaddr 115200 && run boot_write_preloader ++boot_tftp_forever=while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run nor_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip ++boot_tftp_write_preloader=tftpboot $loadaddr $bootfile_bl2 && run boot_write_preloader ++boot_nor=run boot_production ; run boot_recovery ++boot_write_fip=mtd erase nor0 0x20000 0x80000 && mtd write nor0 $loadaddr 0x20000 0x80000 ++boot_write_preloader=mtd erase nor0 0x0 0x20000 && mtd write nor0 $loadaddr 0x0 0x20000 ++reset_factory=mtd erase nor0 0xc0000 0x10000 && reset ++nor_read_production=mtd read nor0 $loadaddr 0x1000000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x1000000 $image_size ++nor_read_recovery=mtd read nor0 $loadaddr 0x120000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x120000 $image_size ++nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x1000 ; setexpr tmp1 0x$image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb 0x$image_eb * 0x1000 ++nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase nor0 0x1000000 0x$image_eb && mtd write nor0 $loadaddr 0x1000000 $filesize ++nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0xee0000 && mtd erase nor0 0x120000 0x$image_eb && mtd write nor0 $loadaddr 0x120000 $filesize ++_init_env=setenv _init_env ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- a/common/board_r.c +++ b/common/board_r.c @@ -66,6 +66,7 @@ From 230c09d2034995540aaec920466eb25387173e56 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 28 Aug 2023 00:14:10 +0100 Subject: [PATCH 0415/1171] mediatek: add support for Ubiquiti UniFi 6 LR v3 Some recent models of the Ubiquiti Networks UniFi 6 LR access point come with a RealTek RTL8211FS 1000M/100M/10M PHY instead of the Aquantia AQR112 2500M/1000M/100M/10M PHY used in both v1 and v2. Add build for this variant so we can support Ethernet with the PHY. Signed-off-by: Daniel Golle (cherry picked from commit a0f4eadf6a25fb54c189bde91425673e11125d35) --- .../dts/mt7622-ubnt-unifi-6-lr-v1.dtsi | 25 +++++ .../dts/mt7622-ubnt-unifi-6-lr-v2.dtsi | 26 +++++ .../mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts | 84 +++++++++++++++ .../dts/mt7622-ubnt-unifi-6-lr-v3.dts | 100 ++++++++++++++++++ .../dts/mt7622-ubnt-unifi-6-lr-v3.dtsi | 50 +++++++++ .../mediatek/dts/mt7622-ubnt-unifi-6-lr.dtsi | 25 ----- target/linux/mediatek/image/mt7622.mk | 33 +++++- 7 files changed, 316 insertions(+), 27 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts create mode 100644 target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dts create mode 100644 target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dtsi diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1.dtsi b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1.dtsi index b3299a988fe873..91719865dd7417 100644 --- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1.dtsi +++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1.dtsi @@ -1,5 +1,30 @@ #include "mt7622-ubnt-unifi-6-lr.dtsi" +ð { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + + phy-mode = "2500base-x"; + phy-handle = <&phy0>; + phy-connection-type = "2500base-x"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@8 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x8>; + }; + }; +}; + &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2.dtsi b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2.dtsi index 4d278805d40707..ab3c592925828c 100644 --- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2.dtsi +++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2.dtsi @@ -22,3 +22,29 @@ }; }; }; + +ð { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + + phy-mode = "2500base-x"; + phy-handle = <&phy0>; + phy-connection-type = "2500base-x"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@8 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x8>; + }; + }; +}; + diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts new file mode 100644 index 00000000000000..46faf8da307442 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7622-ubnt-unifi-6-lr-v3.dtsi" + +/ { + model = "Ubiquiti UniFi 6 LR v3 (U-Boot mod)"; + compatible = "ubnt,unifi-6-lr-v3-ubootmod", "mediatek,mt7622"; +}; + +&nor_partitions { + partition@0 { + label = "bl2"; + reg = <0x0 0x20000>; + }; + + partition@20000 { + label = "fip"; + reg = <0x20000 0xa0000>; + }; + + partition@c0000 { + label = "u-boot-env"; + reg = <0xc0000 0x10000>; + }; + + factory: partition@d0000 { + label = "factory"; + reg = <0xd0000 0x40000>; + read-only; + }; + + eeprom: partition@110000 { + label = "eeprom"; + reg = <0x110000 0x10000>; + read-only; + }; + + partition@120000 { + label = "recovery"; + reg = <0x120000 0xee0000>; + }; + + partition@1000000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x1000000 0x3000000>; + }; +}; + +&wmac { + mediatek,mtd-eeprom = <&factory 0x0>; + nvmem-cells = <&macaddr_eeprom_0>; + nvmem-cell-names = "mac-address"; + status = "okay"; +}; + +&slot0 { + wifi@0,0 { + reg = <0x0 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x20000>; + nvmem-cells = <&macaddr_eeprom_6>; + nvmem-cell-names = "mac-address"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_eeprom_0>; + nvmem-cell-names = "mac-address"; +}; + +&eeprom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_eeprom_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_eeprom_6: macaddr@6 { + reg = <0x6 0x6>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dts new file mode 100644 index 00000000000000..34bdaa6254af55 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dts @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7622-ubnt-unifi-6-lr-v3.dtsi" + +/ { + model = "Ubiquiti UniFi 6 LR v3"; + compatible = "ubnt,unifi-6-lr-v3", "mediatek,mt7622"; +}; + +&nor_partitions { + partition@0 { + label = "preloader"; + reg = <0x0 0x40000>; + }; + + partition@40000 { + label = "atf"; + reg = <0x40000 0x20000>; + }; + + partition@60000 { + label = "u-boot"; + reg = <0x60000 0x60000>; + }; + + partition@c0000 { + label = "u-boot-env"; + reg = <0xc0000 0x10000>; + }; + + factory: partition@d0000 { + label = "factory"; + reg = <0xd0000 0x40000>; + read-only; + }; + + eeprom: partition@110000 { + label = "eeprom"; + reg = <0x110000 0x10000>; + read-only; + }; + + partition@120000 { + label = "bs"; + reg = <0x120000 0x10000>; + }; + + partition@130000 { + label = "cfg"; + reg = <0x130000 0x100000>; + read-only; + }; + + partition@230000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x230000 0x1ee0000>; + }; + + partition@2110000 { + label = "kernel1"; + reg = <0x2110000 0x1ee0000>; + }; +}; + +&wmac { + mediatek,mtd-eeprom = <&factory 0x0>; + nvmem-cells = <&macaddr_eeprom_0>; + nvmem-cell-names = "mac-address"; + status = "okay"; +}; + +&slot0 { + wifi@0,0 { + reg = <0x0 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x20000>; + nvmem-cells = <&macaddr_eeprom_6>; + nvmem-cell-names = "mac-address"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_eeprom_0>; + nvmem-cell-names = "mac-address"; +}; + +&eeprom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_eeprom_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_eeprom_6: macaddr@6 { + reg = <0x6 0x6>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dtsi b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dtsi new file mode 100644 index 00000000000000..c581bd7d9058cc --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3.dtsi @@ -0,0 +1,50 @@ +#include "mt7622-ubnt-unifi-6-lr.dtsi" + +/ { + aliases { + led-boot = &led_white; + led-failsafe = &led_white; + led-running = &led_blue; + led-upgrade = &led_blue; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_white: dome_white { + label = "white:dome"; + gpios = <&pio 0x43 GPIO_ACTIVE_LOW>; + }; + + led_blue: dome_blue { + label = "blue:dome"; + gpios = <&pio 0x44 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +ð { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + + phy-mode = "sgmii"; + phy-handle = <&phy0>; + phy-connection-type = "sgmii"; + managed = "in-band-status"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x0>; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dtsi b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dtsi index 4231cc1f79db44..783b0c388e6827 100644 --- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dtsi +++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dtsi @@ -151,31 +151,6 @@ status = "disabled"; }; -ð { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <ð_pins>; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - - phy-mode = "2500base-x"; - phy-handle = <&phy0>; - phy-connection-type = "2500base-x"; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - - phy0: ethernet-phy@8 { - compatible = "ethernet-phy-ieee802.3-c45"; - reg = <0x8>; - }; - }; -}; - &pwrap { pinctrl-names = "default"; pinctrl-0 = <&pmic_bus_pins>; diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 040ef957db9a8d..d40eb54cb7359c 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -307,7 +307,7 @@ define Device/ubnt_unifi-6-lr-v1-ubootmod IMAGE/sysupgrade.itb := append-kernel | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata ARTIFACTS := preloader.bin bl31-uboot.fip ARTIFACT/preloader.bin := bl2 nor-2ddr - ARTIFACT/bl31-uboot.fip := bl31-uboot ubnt_unifi-6-lr + ARTIFACT/bl31-uboot.fip := bl31-uboot ubnt_unifi-6-lr-v1 SUPPORTED_DEVICES += ubnt,unifi-6-lr-ubootmod endef TARGET_DEVICES += ubnt_unifi-6-lr-v1-ubootmod @@ -337,10 +337,39 @@ define Device/ubnt_unifi-6-lr-v2-ubootmod IMAGE/sysupgrade.itb := append-kernel | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata ARTIFACTS := preloader.bin bl31-uboot.fip ARTIFACT/preloader.bin := bl2 nor-2ddr - ARTIFACT/bl31-uboot.fip := bl31-uboot ubnt_unifi-6-lr + ARTIFACT/bl31-uboot.fip := bl31-uboot ubnt_unifi-6-lr-v2 endef TARGET_DEVICES += ubnt_unifi-6-lr-v2-ubootmod +define Device/ubnt_unifi-6-lr-v3 + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi 6 LR + DEVICE_VARIANT := v3 + DEVICE_DTS_CONFIG := config@1 + DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v3 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915-firmware +endef +TARGET_DEVICES += ubnt_unifi-6-lr-v3 + +define Device/ubnt_unifi-6-lr-v3-ubootmod + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi 6 LR + DEVICE_VARIANT := v3 U-Boot mod + DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v3-ubootmod + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915-firmware + KERNEL := kernel-bin | lzma + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGES := sysupgrade.itb + IMAGE/sysupgrade.itb := append-kernel | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := bl2 nor-2ddr + ARTIFACT/bl31-uboot.fip := bl31-uboot ubnt_unifi-6-lr-v3 +endef +TARGET_DEVICES += ubnt_unifi-6-lr-v3-ubootmod + define Device/xiaomi_redmi-router-ax6s DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Redmi Router AX6S From 625d19c1e2d0aebcd69b73062afc76ae9f4456b4 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 26 Aug 2023 02:19:18 +0100 Subject: [PATCH 0416/1171] generic: sync MediaTek Ethernet driver with upstream Import commits from upstream Linux replacing some downstream patches. Move accepted patches from pending-{5.15,6.1} to backport-{5.15,6.1}. Signed-off-by: Daniel Golle (cherry picked from commit f631c7bbb16f1d39d59c4cdf3f7189abab4fd9c6) --- ..._eth_soc-fix-resource-leak-in-error-.patch | 35 + ..._eth_soc-fix-memory-leak-in-error-pa.patch | 107 + ..._eth_soc-align-reset-procedure-to-ve.patch | 4 +- ..._eth_soc-avoid-port_mg-assignment-on.patch | 4 +- ...iatek-ppe-assign-per-port-queues-for.patch | 2 +- ..._eth_soc-compile-out-netsys-v2-code-.patch | 28 - ..._eth_soc-fix-VLAN-rx-hardware-accele.patch | 2 +- ...ii-ensure-the-SGMII-PHY-is-powered-d.patch | 2 +- ...t-mtk_eth_soc-add-support-for-MT7981.patch | 8 +- ..._eth_soc-switch-to-external-PCS-driv.patch | 10 +- ...eth_soc-add-missing-ppe-cache-flush.patch} | 2 +- ..._eth_soc-use-WO-firmware-for-MT7981.patch} | 0 ...eth_soc-fix-NULL-pointer-dereferenc.patch} | 0 ...eth_soc-ppe-add-support-for-flow-ac.patch} | 34 +- ...atek-fix-ppe-flow-accounting-for-v1.patch} | 4 +- ...eth_soc-drop-generic-vlan-rx-offloa.patch} | 0 ..._eth_soc-always-mtk_get_ib1_pkt_type.patch | 31 + ..._ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch | 78 + ..._eth_soc-remove-incorrect-PLL-config.patch | 141 ++ ..._eth_soc-remove-mac_pcs_get_state-an.patch | 81 + ..._eth_soc-add-version-in-mtk_soc_data.patch | 550 +++++ ...t-mtk_eth_soc-increase-MAX_DEVS-to-3.patch | 29 + ...eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch} | 109 +- ...eth_soc-add-NETSYS_V3-version-suppo.patch} | 177 +- ...eth_soc-convert-caps-in-mtk_soc_dat.patch} | 26 +- ..._eth_soc-convert-clock-bitmap-to-u64.patch | 132 ++ ..._eth_soc-add-basic-support-for-MT798.patch | 477 +++++ ..._eth_soc-enable-page_pool-support-fo.patch | 27 + ..._eth_soc-enable-nft-hw-flowtable_off.patch | 135 ++ ..._eth_soc-support-per-flow-accounting.patch | 78 + ..._eth_soc-fix-NULL-pointer-on-hw-rese.patch | 52 + ..._eth_soc-fix-register-definitions-fo.patch | 44 + ...tk_eth_soc-add-reset-bits-for-MT7988.patch | 188 ++ ..._eth_soc-add-support-for-in-SoC-SRAM.patch | 254 +++ ..._eth_soc-support-36-bit-DMA-addressi.patch | 166 ++ ...ble-PCS-polling-over-major-configura.patch | 81 + ...NULL-pl-pcs-dereference-during-phyli.patch | 38 + ...k-add-pcs_enable-pcs_disable-methods.patch | 172 ++ ...t-pcs-lynxi-implement-pcs_disable-op.patch | 44 + .../795-backport-phylink_pcs-helpers.patch | 8 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 6 +- ..._eth_soc-compile-out-netsys-v2-code-.patch | 44 + ..._eth_soc-work-around-issue-with-send.patch | 12 +- ...rnet-mtk_eth_soc-set-NETIF_F_ALL_TSO.patch | 2 +- ..._eth_soc-fix-remaining-throughput-re.patch | 4 +- ..._eth_soc-ppe-fix-L2-offloading-with-.patch | 2 +- ..._eth_soc-add-code-for-offloading-flo.patch | 6 +- ...iatek-mtk_ppe-prefer-newly-added-l2-.patch | 2 +- ..._eth_soc-improve-keeping-track-of-of.patch | 22 +- ...iatek-fix-ppe-flow-accounting-for-L2.patch | 57 +- ..._eth_soc-add-MTK_NETSYS_V1-capabilit.patch | 223 -- ..._eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch | 181 -- ...k_eth_soc-add-support-for-MT7988-SoC.patch | 495 ----- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 1867 ----------------- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 1604 ++++++++++++++ ...phy-define-PSGMII-PHY-interface-mode.patch | 4 +- ...02-phy-Add-2.5G-SGMII-interface-mode.patch | 4 +- ..._eth_soc-implement-Clause-45-MDIO-ac.patch | 4 +- ...tk_wed-move-dlm-a-dedicated-dts-node.patch | 4 +- ...ethernet-mediatek-support-net-labels.patch | 4 +- ...y-simplify-phy_link_change-arguments.patch | 2 +- ...vers-net-phy-eee-support-for-rtl838x.patch | 6 +- ...04-include-linux-add-phy-hsgmii-mode.patch | 4 +- 63 files changed, 4883 insertions(+), 3036 deletions(-) create mode 100644 target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch create mode 100644 target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch delete mode 100644 target/linux/generic/backport-5.15/730-07-v6.3-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch rename target/linux/generic/{pending-5.15/736-05-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch => backport-5.15/733-v6.3-21-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch} (90%) rename target/linux/generic/backport-5.15/{733-v6.4-21-net-mtk_eth_soc-use-WO-firmware-for-MT7981.patch => 733-v6.4-22-net-mtk_eth_soc-use-WO-firmware-for-MT7981.patch} (100%) rename target/linux/generic/backport-5.15/{733-v6.4-22-net-ethernet-mtk_eth_soc-fix-NULL-pointer-dereferenc.patch => 733-v6.4-23-net-ethernet-mtk_eth_soc-fix-NULL-pointer-dereferenc.patch} (100%) rename target/linux/generic/{pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch => backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch} (93%) rename target/linux/generic/{pending-5.15/736-06-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch => backport-5.15/733-v6.4-25-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch} (92%) rename target/linux/generic/{pending-5.15/732-00-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch => backport-5.15/733-v6.4-26-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch} (100%) create mode 100644 target/linux/generic/backport-5.15/733-v6.5-27-net-ethernet-mtk_eth_soc-always-mtk_get_ib1_pkt_type.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-06-net-ethernet-mtk_eth_soc-increase-MAX_DEVS-to-3.patch rename target/linux/generic/{pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch => backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch} (50%) rename target/linux/generic/{pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch => backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch} (63%) rename target/linux/generic/{pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch => backport-5.15/750-v6.5-09-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch} (89%) create mode 100644 target/linux/generic/backport-5.15/750-v6.5-10-net-ethernet-mtk_eth_soc-convert-clock-bitmap-to-u64.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-12-net-ethernet-mtk_eth_soc-enable-page_pool-support-fo.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-15-net-ethernet-mtk_eth_soc-fix-NULL-pointer-on-hw-rese.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-16-net-ethernet-mtk_eth_soc-fix-register-definitions-fo.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch create mode 100644 target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch create mode 100644 target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch create mode 100644 target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch create mode 100644 target/linux/generic/backport-5.15/793-v6.6-net-pcs-lynxi-implement-pcs_disable-op.patch create mode 100644 target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch delete mode 100644 target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch delete mode 100644 target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch delete mode 100644 target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch delete mode 100644 target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch create mode 100644 target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch diff --git a/target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch b/target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch new file mode 100644 index 00000000000000..ae3acfef725b85 --- /dev/null +++ b/target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch @@ -0,0 +1,35 @@ +From 8110437e59616293228cd781c486d8495a61e36a Mon Sep 17 00:00:00 2001 +From: Yan Cangang +Date: Sun, 20 Nov 2022 13:52:58 +0800 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix resource leak in error path + +In mtk_probe(), when mtk_ppe_init() or mtk_eth_offload_init() failed, +mtk_mdio_cleanup() isn't called. Fix it. + +Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE") +Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support") +Signed-off-by: Yan Cangang +Reviewed-by: Leon Romanovsky +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4087,13 +4087,13 @@ static int mtk_probe(struct platform_dev + eth->soc->offload_version, i); + if (!eth->ppe[i]) { + err = -ENOMEM; +- goto err_free_dev; ++ goto err_deinit_mdio; + } + } + + err = mtk_eth_offload_init(eth); + if (err) +- goto err_free_dev; ++ goto err_deinit_mdio; + } + + for (i = 0; i < MTK_MAX_DEVS; i++) { diff --git a/target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch b/target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch new file mode 100644 index 00000000000000..b0f5723f7bf1b6 --- /dev/null +++ b/target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch @@ -0,0 +1,107 @@ +From 603ea5e7ffa73c7fac07d8713d97285990695213 Mon Sep 17 00:00:00 2001 +From: Yan Cangang +Date: Sun, 20 Nov 2022 13:52:59 +0800 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix memory leak in error path + +In mtk_ppe_init(), when dmam_alloc_coherent() or devm_kzalloc() failed, +the rhashtable ppe->l2_flows isn't destroyed. Fix it. + +In mtk_probe(), when mtk_ppe_init() or mtk_eth_offload_init() or +register_netdev() failed, have the same problem. Fix it. + +Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries") +Signed-off-by: Yan Cangang +Reviewed-by: Leon Romanovsky +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 9 +++++---- + drivers/net/ethernet/mediatek/mtk_ppe.c | 19 +++++++++++++++++-- + drivers/net/ethernet/mediatek/mtk_ppe.h | 1 + + 3 files changed, 23 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4087,13 +4087,13 @@ static int mtk_probe(struct platform_dev + eth->soc->offload_version, i); + if (!eth->ppe[i]) { + err = -ENOMEM; +- goto err_deinit_mdio; ++ goto err_deinit_ppe; + } + } + + err = mtk_eth_offload_init(eth); + if (err) +- goto err_deinit_mdio; ++ goto err_deinit_ppe; + } + + for (i = 0; i < MTK_MAX_DEVS; i++) { +@@ -4103,7 +4103,7 @@ static int mtk_probe(struct platform_dev + err = register_netdev(eth->netdev[i]); + if (err) { + dev_err(eth->dev, "error bringing up device\n"); +- goto err_deinit_mdio; ++ goto err_deinit_ppe; + } else + netif_info(eth, probe, eth->netdev[i], + "mediatek frame engine at 0x%08lx, irq %d\n", +@@ -4123,7 +4123,8 @@ static int mtk_probe(struct platform_dev + + return 0; + +-err_deinit_mdio: ++err_deinit_ppe: ++ mtk_ppe_deinit(eth); + mtk_mdio_cleanup(eth); + err_free_dev: + mtk_free_dev(eth); +--- a/drivers/net/ethernet/mediatek/mtk_ppe.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -743,7 +743,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ + MTK_PPE_ENTRIES * soc->foe_entry_size, + &ppe->foe_phys, GFP_KERNEL); + if (!foe) +- return NULL; ++ goto err_free_l2_flows; + + ppe->foe_table = foe; + +@@ -751,11 +751,26 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ + sizeof(*ppe->foe_flow); + ppe->foe_flow = devm_kzalloc(dev, foe_flow_size, GFP_KERNEL); + if (!ppe->foe_flow) +- return NULL; ++ goto err_free_l2_flows; + + mtk_ppe_debugfs_init(ppe, index); + + return ppe; ++ ++err_free_l2_flows: ++ rhashtable_destroy(&ppe->l2_flows); ++ return NULL; ++} ++ ++void mtk_ppe_deinit(struct mtk_eth *eth) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) { ++ if (!eth->ppe[i]) ++ return; ++ rhashtable_destroy(ð->ppe[i]->l2_flows); ++ } + } + + static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe) +--- a/drivers/net/ethernet/mediatek/mtk_ppe.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.h +@@ -304,6 +304,7 @@ struct mtk_ppe { + + struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, + int version, int index); ++void mtk_ppe_deinit(struct mtk_eth *eth); + void mtk_ppe_start(struct mtk_ppe *ppe); + int mtk_ppe_stop(struct mtk_ppe *ppe); + diff --git a/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch b/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch index f87b4c9e5b1fb1..7dde9a54824d2c 100644 --- a/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch +++ b/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch @@ -237,8 +237,8 @@ Signed-off-by: Paolo Abeni { --- a/drivers/net/ethernet/mediatek/mtk_ppe.h +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h -@@ -306,6 +306,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ - int version, int index); +@@ -307,6 +307,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ + void mtk_ppe_deinit(struct mtk_eth *eth); void mtk_ppe_start(struct mtk_ppe *ppe); int mtk_ppe_stop(struct mtk_ppe *ppe); +int mtk_ppe_prepare_reset(struct mtk_ppe *ppe); diff --git a/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch b/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch index 1e1ac560db7691..af987c42e25a95 100644 --- a/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch +++ b/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4421,7 +4421,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4422,7 +4422,7 @@ static const struct mtk_soc_data mt7621_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau .hash_offset = 2, .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { -@@ -4460,7 +4460,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4461,7 +4461,7 @@ static const struct mtk_soc_data mt7623_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, diff --git a/target/linux/generic/backport-5.15/730-06-v6.3-net-ethernet-mediatek-ppe-assign-per-port-queues-for.patch b/target/linux/generic/backport-5.15/730-06-v6.3-net-ethernet-mediatek-ppe-assign-per-port-queues-for.patch index 8935eb673ae56c..e05042c2047d0d 100644 --- a/target/linux/generic/backport-5.15/730-06-v6.3-net-ethernet-mediatek-ppe-assign-per-port-queues-for.patch +++ b/target/linux/generic/backport-5.15/730-06-v6.3-net-ethernet-mediatek-ppe-assign-per-port-queues-for.patch @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau #define MTK_FOE_IB2_DEST_PORT_V2 GENMASK(12, 9) #define MTK_FOE_IB2_MULTICAST_V2 BIT(13) #define MTK_FOE_IB2_WDMA_WINFO_V2 BIT(19) -@@ -351,6 +353,8 @@ int mtk_foe_entry_set_pppoe(struct mtk_e +@@ -352,6 +354,8 @@ int mtk_foe_entry_set_pppoe(struct mtk_e int sid); int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry, int wdma_idx, int txq, int bss, int wcid); diff --git a/target/linux/generic/backport-5.15/730-07-v6.3-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch b/target/linux/generic/backport-5.15/730-07-v6.3-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch deleted file mode 100644 index 44af9128b7501f..00000000000000 --- a/target/linux/generic/backport-5.15/730-07-v6.3-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Felix Fietkau -Date: Thu, 27 Oct 2022 23:39:52 +0200 -Subject: [PATCH] net: ethernet: mtk_eth_soc: compile out netsys v2 code - on mt7621 - -Avoid some branches in the hot path on low-end devices with limited CPU power, -and reduce code size - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -917,7 +917,13 @@ enum mkt_eth_capabilities { - #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ - (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) - --#define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x)) -+#ifdef CONFIG_SOC_MT7621 -+#define MTK_CAP_MASK MTK_NETSYS_V2 -+#else -+#define MTK_CAP_MASK 0 -+#endif -+ -+#define MTK_HAS_CAPS(caps, _x) (((caps) & (_x) & ~(MTK_CAP_MASK)) == (_x)) - - #define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ - MTK_GMAC2_RGMII | MTK_SHARED_INT | \ diff --git a/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch b/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch index 6ebd1abcd0f20b..f9d822ad447bb6 100644 --- a/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch +++ b/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch @@ -181,7 +181,7 @@ Signed-off-by: Felix Fietkau /* CDMP Ingress Control Register */ #define MTK_CDMP_IG_CTRL 0x400 #define MTK_CDMP_STAG_EN BIT(0) -@@ -1166,6 +1172,8 @@ struct mtk_eth { +@@ -1160,6 +1166,8 @@ struct mtk_eth { int ip_align; diff --git a/target/linux/generic/backport-5.15/733-v6.2-12-net-mediatek-sgmii-ensure-the-SGMII-PHY-is-powered-d.patch b/target/linux/generic/backport-5.15/733-v6.2-12-net-mediatek-sgmii-ensure-the-SGMII-PHY-is-powered-d.patch index 8d2991f450013b..598788d99846bf 100644 --- a/target/linux/generic/backport-5.15/733-v6.2-12-net-mediatek-sgmii-ensure-the-SGMII-PHY-is-powered-d.patch +++ b/target/linux/generic/backport-5.15/733-v6.2-12-net-mediatek-sgmii-ensure-the-SGMII-PHY-is-powered-d.patch @@ -34,7 +34,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1070,11 +1070,13 @@ struct mtk_soc_data { +@@ -1064,11 +1064,13 @@ struct mtk_soc_data { * @regmap: The register map pointing at the range used to setup * SGMII modes * @ana_rgc3: The offset refers to register ANA_RGC3 related to regmap diff --git a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch index 36fa94a790533e..1ae4e83363232e 100644 --- a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch @@ -51,7 +51,7 @@ Signed-off-by: Jakub Kicinski mtk_eth_path_name(path), __func__, updated); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4748,6 +4748,26 @@ static const struct mtk_soc_data mt7629_ +@@ -4749,6 +4749,26 @@ static const struct mtk_soc_data mt7629_ }, }; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski static const struct mtk_soc_data mt7986_data = { .reg_map = &mt7986_reg_map, .ana_rgc3 = 0x128, -@@ -4790,6 +4810,7 @@ const struct of_device_id of_mtk_match[] +@@ -4791,6 +4811,7 @@ const struct of_device_id of_mtk_match[] { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, @@ -145,7 +145,7 @@ Signed-off-by: Jakub Kicinski #define MTK_ETH_MUX_GDM1_TO_GMAC1_ESW \ BIT(MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT) -@@ -963,6 +987,11 @@ enum mkt_eth_capabilities { +@@ -957,6 +981,11 @@ enum mkt_eth_capabilities { MTK_MUX_U3_GMAC2_TO_QPHY | \ MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA) @@ -157,7 +157,7 @@ Signed-off-by: Jakub Kicinski #define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) -@@ -1076,12 +1105,14 @@ struct mtk_soc_data { +@@ -1070,12 +1099,14 @@ struct mtk_soc_data { * @ana_rgc3: The offset refers to register ANA_RGC3 related to regmap * @interface: Currently configured interface mode * @pcs: Phylink PCS structure diff --git a/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch b/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch index 2e6a70d7255e16..42a700d5439219 100644 --- a/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch @@ -151,7 +151,7 @@ Signed-off-by: Jakub Kicinski } if (eth->soc->offload_version) { -@@ -4648,6 +4685,8 @@ err_deinit_hw: +@@ -4649,6 +4686,8 @@ err_deinit_hw: mtk_hw_deinit(eth); err_wed_exit: mtk_wed_exit(); @@ -228,7 +228,7 @@ Signed-off-by: Jakub Kicinski /* Infrasys subsystem config registers */ #define INFRA_MISC2 0x70c #define CO_QPHY_SEL BIT(0) -@@ -1105,31 +1046,6 @@ struct mtk_soc_data { +@@ -1099,31 +1040,6 @@ struct mtk_soc_data { /* currently no SoC has more than 2 macs */ #define MTK_MAX_DEVS 2 @@ -260,7 +260,7 @@ Signed-off-by: Jakub Kicinski /* struct mtk_eth - This is the main datasructure for holding the state * of the driver * @dev: The device pointer -@@ -1149,6 +1065,7 @@ struct mtk_sgmii { +@@ -1143,6 +1059,7 @@ struct mtk_sgmii { * MII modes * @infra: The register map pointing at the range used to setup * SGMII and GePHY path @@ -268,7 +268,7 @@ Signed-off-by: Jakub Kicinski * @pctl: The register map pointing at the range used to setup * GMAC port drive/slew values * @dma_refcnt: track how many netdevs are using the DMA engine -@@ -1189,8 +1106,8 @@ struct mtk_eth { +@@ -1183,8 +1100,8 @@ struct mtk_eth { u32 msg_enable; unsigned long sysclk; struct regmap *ethsys; @@ -279,7 +279,7 @@ Signed-off-by: Jakub Kicinski struct regmap *pctl; bool hwlro; refcount_t dma_refcnt; -@@ -1352,10 +1269,6 @@ void mtk_stats_update_mac(struct mtk_mac +@@ -1346,10 +1263,6 @@ void mtk_stats_update_mac(struct mtk_mac void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg); u32 mtk_r32(struct mtk_eth *eth, unsigned reg); diff --git a/target/linux/generic/pending-5.15/736-05-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch b/target/linux/generic/backport-5.15/733-v6.3-21-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch similarity index 90% rename from target/linux/generic/pending-5.15/736-05-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch rename to target/linux/generic/backport-5.15/733-v6.3-21-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch index 30839319c7dcd9..7742b0925bc3c9 100644 --- a/target/linux/generic/pending-5.15/736-05-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-21-net-ethernet-mtk_eth_soc-add-missing-ppe-cache-flush.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c -@@ -523,6 +523,7 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp +@@ -464,6 +464,7 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp hwe->ib1 &= ~MTK_FOE_IB1_STATE; hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID); dma_wmb(); diff --git a/target/linux/generic/backport-5.15/733-v6.4-21-net-mtk_eth_soc-use-WO-firmware-for-MT7981.patch b/target/linux/generic/backport-5.15/733-v6.4-22-net-mtk_eth_soc-use-WO-firmware-for-MT7981.patch similarity index 100% rename from target/linux/generic/backport-5.15/733-v6.4-21-net-mtk_eth_soc-use-WO-firmware-for-MT7981.patch rename to target/linux/generic/backport-5.15/733-v6.4-22-net-mtk_eth_soc-use-WO-firmware-for-MT7981.patch diff --git a/target/linux/generic/backport-5.15/733-v6.4-22-net-ethernet-mtk_eth_soc-fix-NULL-pointer-dereferenc.patch b/target/linux/generic/backport-5.15/733-v6.4-23-net-ethernet-mtk_eth_soc-fix-NULL-pointer-dereferenc.patch similarity index 100% rename from target/linux/generic/backport-5.15/733-v6.4-22-net-ethernet-mtk_eth_soc-fix-NULL-pointer-dereferenc.patch rename to target/linux/generic/backport-5.15/733-v6.4-23-net-ethernet-mtk_eth_soc-fix-NULL-pointer-dereferenc.patch diff --git a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch b/target/linux/generic/backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch similarity index 93% rename from target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch rename to target/linux/generic/backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch index 91ffd65c6cbfe1..51ebcfe8f11901 100644 --- a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch +++ b/target/linux/generic/backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch @@ -63,8 +63,8 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov + if (!eth->ppe[i]) { err = -ENOMEM; - goto err_free_dev; -@@ -4763,6 +4763,7 @@ static const struct mtk_soc_data mt7622_ + goto err_deinit_ppe; +@@ -4762,6 +4762,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -72,7 +72,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4800,6 +4801,7 @@ static const struct mtk_soc_data mt7629_ +@@ -4799,6 +4800,7 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -80,7 +80,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4820,6 +4822,7 @@ static const struct mtk_soc_data mt7981_ +@@ -4819,6 +4821,7 @@ static const struct mtk_soc_data mt7981_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), @@ -88,7 +88,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), -@@ -4840,6 +4843,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4839,6 +4842,7 @@ static const struct mtk_soc_data mt7986_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), @@ -98,7 +98,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .rxd_size = sizeof(struct mtk_rx_dma_v2), --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1014,6 +1014,8 @@ struct mtk_reg_map { +@@ -1008,6 +1008,8 @@ struct mtk_reg_map { * the extra setup for those pins used by GMAC. * @hash_offset Flow table hash offset. * @foe_entry_size Foe table entry size. @@ -107,7 +107,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov * @txd_size Tx DMA descriptor size. * @rxd_size Rx DMA descriptor size. * @rx_irq_done_mask Rx irq done register mask. -@@ -1031,6 +1033,7 @@ struct mtk_soc_data { +@@ -1025,6 +1027,7 @@ struct mtk_soc_data { u8 hash_offset; u16 foe_entry_size; netdev_features_t hw_features; @@ -166,10 +166,10 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov static void mtk_ppe_cache_clear(struct mtk_ppe *ppe) { ppe_set(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_CLEAR); -@@ -464,6 +506,13 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp - hwe->ib1 &= ~MTK_FOE_IB1_STATE; +@@ -465,6 +507,13 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID); dma_wmb(); + mtk_ppe_cache_clear(ppe); + if (ppe->accounting) { + struct mtk_foe_accounting *acct; + @@ -180,7 +180,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov } entry->hash = 0xffff; -@@ -571,6 +620,9 @@ __mtk_foe_entry_commit(struct mtk_ppe *p +@@ -572,6 +621,9 @@ __mtk_foe_entry_commit(struct mtk_ppe *p wmb(); hwe->ib1 = entry->ib1; @@ -190,7 +190,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov dma_wmb(); mtk_ppe_cache_clear(ppe); -@@ -762,11 +814,39 @@ int mtk_ppe_prepare_reset(struct mtk_ppe +@@ -763,11 +815,39 @@ int mtk_ppe_prepare_reset(struct mtk_ppe return mtk_ppe_wait_busy(ppe); } @@ -232,7 +232,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov struct mtk_ppe *ppe; u32 foe_flow_size; void *foe; -@@ -783,7 +863,8 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ +@@ -784,7 +864,8 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ ppe->base = base; ppe->eth = eth; ppe->dev = dev; @@ -242,9 +242,9 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov foe = dmam_alloc_coherent(ppe->dev, MTK_PPE_ENTRIES * soc->foe_entry_size, -@@ -799,6 +880,23 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ +@@ -800,6 +881,23 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ if (!ppe->foe_flow) - return NULL; + goto err_free_l2_flows; + if (accounting) { + mib = dmam_alloc_coherent(ppe->dev, MTK_PPE_ENTRIES * sizeof(*mib), @@ -266,7 +266,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov mtk_ppe_debugfs_init(ppe, index); return ppe; -@@ -913,6 +1011,16 @@ void mtk_ppe_start(struct mtk_ppe *ppe) +@@ -929,6 +1027,16 @@ void mtk_ppe_start(struct mtk_ppe *ppe) ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777); ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f); } @@ -335,10 +335,10 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov -struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, - int version, int index); +struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int index); + void mtk_ppe_deinit(struct mtk_eth *eth); void mtk_ppe_start(struct mtk_ppe *ppe); int mtk_ppe_stop(struct mtk_ppe *ppe); - int mtk_ppe_prepare_reset(struct mtk_ppe *ppe); -@@ -358,5 +376,7 @@ int mtk_foe_entry_commit(struct mtk_ppe +@@ -359,5 +377,7 @@ int mtk_foe_entry_commit(struct mtk_ppe void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry); int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry); int mtk_ppe_debugfs_init(struct mtk_ppe *ppe, int index); diff --git a/target/linux/generic/pending-5.15/736-06-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch b/target/linux/generic/backport-5.15/733-v6.4-25-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch similarity index 92% rename from target/linux/generic/pending-5.15/736-06-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch rename to target/linux/generic/backport-5.15/733-v6.4-25-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch index 3dfa193e7079e2..3a02c3a718f40f 100644 --- a/target/linux/generic/pending-5.15/736-06-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch +++ b/target/linux/generic/backport-5.15/733-v6.4-25-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c -@@ -646,6 +646,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *p +@@ -605,6 +605,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *p struct mtk_eth *eth = ppe->eth; u16 timestamp = mtk_eth_timestamp(eth); struct mtk_foe_entry *hwe; @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2; -@@ -662,8 +663,13 @@ __mtk_foe_entry_commit(struct mtk_ppe *p +@@ -621,8 +622,13 @@ __mtk_foe_entry_commit(struct mtk_ppe *p wmb(); hwe->ib1 = entry->ib1; diff --git a/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch b/target/linux/generic/backport-5.15/733-v6.4-26-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch similarity index 100% rename from target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch rename to target/linux/generic/backport-5.15/733-v6.4-26-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch diff --git a/target/linux/generic/backport-5.15/733-v6.5-27-net-ethernet-mtk_eth_soc-always-mtk_get_ib1_pkt_type.patch b/target/linux/generic/backport-5.15/733-v6.5-27-net-ethernet-mtk_eth_soc-always-mtk_get_ib1_pkt_type.patch new file mode 100644 index 00000000000000..2704faec12b011 --- /dev/null +++ b/target/linux/generic/backport-5.15/733-v6.5-27-net-ethernet-mtk_eth_soc-always-mtk_get_ib1_pkt_type.patch @@ -0,0 +1,31 @@ +From b804f765485109f9644cc05d1e8fc79ca6c6e4aa Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 19 Jul 2023 01:39:36 +0100 +Subject: [PATCH 094/250] net: ethernet: mtk_eth_soc: always + mtk_get_ib1_pkt_type + +entries and bind debugfs files would display wrong data on NETSYS_V2 and +later because instead of using mtk_get_ib1_pkt_type the driver would use +MTK_FOE_IB1_PACKET_TYPE which corresponds to NETSYS_V1(.x) SoCs. +Use mtk_get_ib1_pkt_type so entries and bind records display correctly. + +Fixes: 03a3180e5c09e ("net: ethernet: mtk_eth_soc: introduce flow offloading support for mt7986") +Signed-off-by: Daniel Golle +Acked-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/c0ae03d0182f4d27b874cbdf0059bc972c317f3c.1689727134.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c +@@ -98,7 +98,7 @@ mtk_ppe_debugfs_foe_show(struct seq_file + + acct = mtk_foe_entry_get_mib(ppe, i, NULL); + +- type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1); ++ type = mtk_get_ib1_pkt_type(ppe->eth, entry->ib1); + seq_printf(m, "%05x %s %7s", i, + mtk_foe_entry_state_str(state), + mtk_foe_pkt_type_str(type)); diff --git a/target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch b/target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch new file mode 100644 index 00000000000000..0ba8bb8ec43ac1 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch @@ -0,0 +1,78 @@ +From 5ea0e1312bcfebc06b5f91d1bb82b823d6395125 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Wed, 19 Jul 2023 12:29:49 +0200 +Subject: [PATCH 095/250] net: ethernet: mtk_ppe: add MTK_FOE_ENTRY_V{1,2}_SIZE + macros + +Introduce MTK_FOE_ENTRY_V{1,2}_SIZE macros in order to make more +explicit foe_entry size for different chipset revisions. + +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 10 +++++----- + drivers/net/ethernet/mediatek/mtk_ppe.h | 3 +++ + 2 files changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4711,7 +4711,7 @@ static const struct mtk_soc_data mt7621_ + .required_pctl = false, + .offload_version = 1, + .hash_offset = 2, +- .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, ++ .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4732,7 +4732,7 @@ static const struct mtk_soc_data mt7622_ + .offload_version = 2, + .hash_offset = 2, + .has_accounting = true, +- .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, ++ .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4751,7 +4751,7 @@ static const struct mtk_soc_data mt7623_ + .required_pctl = true, + .offload_version = 1, + .hash_offset = 2, +- .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, ++ .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4789,8 +4789,8 @@ static const struct mtk_soc_data mt7981_ + .required_pctl = false, + .offload_version = 2, + .hash_offset = 4, +- .foe_entry_size = sizeof(struct mtk_foe_entry), + .has_accounting = true, ++ .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma_v2), + .rxd_size = sizeof(struct mtk_rx_dma_v2), +@@ -4810,8 +4810,8 @@ static const struct mtk_soc_data mt7986_ + .required_pctl = false, + .offload_version = 2, + .hash_offset = 4, +- .foe_entry_size = sizeof(struct mtk_foe_entry), + .has_accounting = true, ++ .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma_v2), + .rxd_size = sizeof(struct mtk_rx_dma_v2), +--- a/drivers/net/ethernet/mediatek/mtk_ppe.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.h +@@ -216,6 +216,9 @@ struct mtk_foe_ipv6_6rd { + struct mtk_foe_mac_info l2; + }; + ++#define MTK_FOE_ENTRY_V1_SIZE 80 ++#define MTK_FOE_ENTRY_V2_SIZE 96 ++ + struct mtk_foe_entry { + u32 ib1; + diff --git a/target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch b/target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch new file mode 100644 index 00000000000000..681022078cb8d6 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch @@ -0,0 +1,141 @@ +From 8cfa2576d79f9379d167a8994f0fca935c07a8bc Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Sat, 22 Jul 2023 21:32:49 +0100 +Subject: [PATCH 096/250] net: ethernet: mtk_eth_soc: remove incorrect PLL + configuration + +MT7623 GMAC0 attempts to configure the system clocking according to the +required speed in the .mac_config callback for non-SGMII, non-baseX and +non-TRGMII modes. + +state->speed setting has never been reliable in the .mac_config +callback - there are cases where this is not the link speed, +particularly via ethtool paths, so this has always been unreliable (as +detailed in phylink's documentation.) + +There is the additional issue that mtk_gmac0_rgmii_adjust() will only +be called if state->interface changes, which means it only configures +the system clocking on the very first .mac_config call, which will be +made when the network device is first brought up before any link is +established. + +Essentially, this code is incredibly buggy, and probably never worked. + +Moreover, checking the in-kernel DT files, it seems no platform makes +use of this code path. + +Therefore, let's remove it, and disable interface modes for port 0 that +are not SGMII, 1000base-X, 2500base-X or TRGMII on the MT7623. + +Reviewed-by: Daniel Golle +Tested-by: Daniel Golle +Tested-by: Frank Wunderlich +Signed-off-by: Russell King (Oracle) +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 54 ++++++--------------- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 + + 2 files changed, 17 insertions(+), 38 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -309,7 +309,7 @@ static int mt7621_gmac0_rgmii_adjust(str + } + + static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, +- phy_interface_t interface, int speed) ++ phy_interface_t interface) + { + u32 val; + int ret; +@@ -323,26 +323,7 @@ static void mtk_gmac0_rgmii_adjust(struc + return; + } + +- val = (speed == SPEED_1000) ? +- INTF_MODE_RGMII_1000 : INTF_MODE_RGMII_10_100; +- mtk_w32(eth, val, INTF_MODE); +- +- regmap_update_bits(eth->ethsys, ETHSYS_CLKCFG0, +- ETHSYS_TRGMII_CLK_SEL362_5, +- ETHSYS_TRGMII_CLK_SEL362_5); +- +- val = (speed == SPEED_1000) ? 250000000 : 500000000; +- ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val); +- if (ret) +- dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret); +- +- val = (speed == SPEED_1000) ? +- RCK_CTRL_RGMII_1000 : RCK_CTRL_RGMII_10_100; +- mtk_w32(eth, val, TRGMII_RCK_CTRL); +- +- val = (speed == SPEED_1000) ? +- TCK_CTRL_RGMII_1000 : TCK_CTRL_RGMII_10_100; +- mtk_w32(eth, val, TRGMII_TCK_CTRL); ++ dev_err(eth->dev, "Missing PLL configuration, ethernet may not work\n"); + } + + static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config, +@@ -428,17 +409,8 @@ static void mtk_mac_config(struct phylin + state->interface)) + goto err_phy; + } else { +- /* FIXME: this is incorrect. Not only does it +- * use state->speed (which is not guaranteed +- * to be correct) but it also makes use of it +- * in a code path that will only be reachable +- * when the PHY interface mode changes, not +- * when the speed changes. Consequently, RGMII +- * is probably broken. +- */ + mtk_gmac0_rgmii_adjust(mac->hw, +- state->interface, +- state->speed); ++ state->interface); + + /* mt7623_pad_clk_setup */ + for (i = 0 ; i < NUM_TRGMII_CTRL; i++) +@@ -4286,13 +4258,19 @@ static int mtk_add_mac(struct mtk_eth *e + mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | + MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; + +- __set_bit(PHY_INTERFACE_MODE_MII, +- mac->phylink_config.supported_interfaces); +- __set_bit(PHY_INTERFACE_MODE_GMII, +- mac->phylink_config.supported_interfaces); ++ /* MT7623 gmac0 is now missing its speed-specific PLL configuration ++ * in its .mac_config method (since state->speed is not valid there. ++ * Disable support for MII, GMII and RGMII. ++ */ ++ if (!mac->hw->soc->disable_pll_modes || mac->id != 0) { ++ __set_bit(PHY_INTERFACE_MODE_MII, ++ mac->phylink_config.supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_GMII, ++ mac->phylink_config.supported_interfaces); + +- if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII)) +- phy_interface_set_rgmii(mac->phylink_config.supported_interfaces); ++ if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII)) ++ phy_interface_set_rgmii(mac->phylink_config.supported_interfaces); ++ } + + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII) && !mac->id) + __set_bit(PHY_INTERFACE_MODE_TRGMII, +@@ -4752,6 +4730,7 @@ static const struct mtk_soc_data mt7623_ + .offload_version = 1, + .hash_offset = 2, + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, ++ .disable_pll_modes = true, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -1027,6 +1027,7 @@ struct mtk_soc_data { + u16 foe_entry_size; + netdev_features_t hw_features; + bool has_accounting; ++ bool disable_pll_modes; + struct { + u32 txd_size; + u32 rxd_size; diff --git a/target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch b/target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch new file mode 100644 index 00000000000000..816f98ecc537cc --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch @@ -0,0 +1,81 @@ +From a4c2233b1e4359b6c64b6f9ba98c8718a11fffee Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Sat, 22 Jul 2023 21:32:54 +0100 +Subject: [PATCH 097/250] net: ethernet: mtk_eth_soc: remove mac_pcs_get_state + and modernise + +Remove the .mac_pcs_get_state function, since as far as I can tell is +never called - no DT appears to specify an in-band-status management +nor SFP support for this driver. + +Removal of this, along with the previous patch to remove the incorrect +clocking configuration, means that the driver becomes non-legacy, so +we can remove the "legacy_pre_march2020" status from this driver. + +Reviewed-by: Daniel Golle +Tested-by: Daniel Golle +Tested-by: Frank Wunderlich +Signed-off-by: Russell King (Oracle) +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 35 --------------------- + 1 file changed, 35 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -512,38 +512,6 @@ static int mtk_mac_finish(struct phylink + return 0; + } + +-static void mtk_mac_pcs_get_state(struct phylink_config *config, +- struct phylink_link_state *state) +-{ +- struct mtk_mac *mac = container_of(config, struct mtk_mac, +- phylink_config); +- u32 pmsr = mtk_r32(mac->hw, MTK_MAC_MSR(mac->id)); +- +- state->link = (pmsr & MAC_MSR_LINK); +- state->duplex = (pmsr & MAC_MSR_DPX) >> 1; +- +- switch (pmsr & (MAC_MSR_SPEED_1000 | MAC_MSR_SPEED_100)) { +- case 0: +- state->speed = SPEED_10; +- break; +- case MAC_MSR_SPEED_100: +- state->speed = SPEED_100; +- break; +- case MAC_MSR_SPEED_1000: +- state->speed = SPEED_1000; +- break; +- default: +- state->speed = SPEED_UNKNOWN; +- break; +- } +- +- state->pause &= (MLO_PAUSE_RX | MLO_PAUSE_TX); +- if (pmsr & MAC_MSR_RX_FC) +- state->pause |= MLO_PAUSE_RX; +- if (pmsr & MAC_MSR_TX_FC) +- state->pause |= MLO_PAUSE_TX; +-} +- + static void mtk_mac_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) + { +@@ -666,7 +634,6 @@ static void mtk_mac_link_up(struct phyli + static const struct phylink_mac_ops mtk_phylink_ops = { + .validate = phylink_generic_validate, + .mac_select_pcs = mtk_mac_select_pcs, +- .mac_pcs_get_state = mtk_mac_pcs_get_state, + .mac_config = mtk_mac_config, + .mac_finish = mtk_mac_finish, + .mac_link_down = mtk_mac_link_down, +@@ -4253,8 +4220,6 @@ static int mtk_add_mac(struct mtk_eth *e + + mac->phylink_config.dev = ð->netdev[id]->dev; + mac->phylink_config.type = PHYLINK_NETDEV; +- /* This driver makes use of state->speed in mac_config */ +- mac->phylink_config.legacy_pre_march2020 = true; + mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | + MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; + diff --git a/target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch b/target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch new file mode 100644 index 00000000000000..d836acc4b04503 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch @@ -0,0 +1,550 @@ +From 5d8d05fbf804b4485646d39551ac27452e45afd3 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 25 Jul 2023 01:52:02 +0100 +Subject: [PATCH 099/250] net: ethernet: mtk_eth_soc: add version in + mtk_soc_data + +Introduce version field in mtk_soc_data data structure in order to +make mtk_eth driver easier to maintain for chipset configuration +codebase. Get rid of MTK_NETSYS_V2 bit in chip capabilities. +This is a preliminary patch to introduce support for MT7988 SoC. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/e52fae302ca135436e5cdd26d38d87be2da63055.1690246066.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 55 +++++++++++-------- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 36 +++++++----- + drivers/net/ethernet/mediatek/mtk_ppe.c | 18 +++--- + .../net/ethernet/mediatek/mtk_ppe_offload.c | 2 +- + drivers/net/ethernet/mediatek/mtk_wed.c | 4 +- + 5 files changed, 66 insertions(+), 49 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -537,7 +537,7 @@ static void mtk_set_queue_speed(struct m + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | + MTK_QTX_SCH_LEAKY_BUCKET_SIZE; +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v1(eth)) + val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; + + if (IS_ENABLED(CONFIG_SOC_MT7621)) { +@@ -912,7 +912,7 @@ static bool mtk_rx_get_desc(struct mtk_e + rxd->rxd1 = READ_ONCE(dma_rxd->rxd1); + rxd->rxd3 = READ_ONCE(dma_rxd->rxd3); + rxd->rxd4 = READ_ONCE(dma_rxd->rxd4); +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + rxd->rxd5 = READ_ONCE(dma_rxd->rxd5); + rxd->rxd6 = READ_ONCE(dma_rxd->rxd6); + } +@@ -970,7 +970,7 @@ static int mtk_init_fq_dma(struct mtk_et + + txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); + txd->txd4 = 0; +- if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + txd->txd5 = 0; + txd->txd6 = 0; + txd->txd7 = 0; +@@ -1159,7 +1159,7 @@ static void mtk_tx_set_dma_desc(struct n + struct mtk_mac *mac = netdev_priv(dev); + struct mtk_eth *eth = mac->hw; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + mtk_tx_set_dma_desc_v2(dev, txd, info); + else + mtk_tx_set_dma_desc_v1(dev, txd, info); +@@ -1466,7 +1466,7 @@ static void mtk_update_rx_cpu_idx(struct + + static bool mtk_page_pool_enabled(struct mtk_eth *eth) + { +- return MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2); ++ return eth->soc->version == 2; + } + + static struct page_pool *mtk_create_page_pool(struct mtk_eth *eth, +@@ -1806,7 +1806,7 @@ static int mtk_poll_rx(struct napi_struc + break; + + /* find out which mac the packet come from. values start at 1 */ +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + mac = RX_DMA_GET_SPORT_V2(trxd.rxd5) - 1; + else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && + !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) +@@ -1902,7 +1902,7 @@ static int mtk_poll_rx(struct napi_struc + skb->dev = netdev; + bytes += skb->len; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5); + hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY; + if (hash != MTK_RXD5_FOE_ENTRY) +@@ -1927,8 +1927,8 @@ static int mtk_poll_rx(struct napi_struc + /* When using VLAN untagging in combination with DSA, the + * hardware treats the MTK special tag as a VLAN and untags it. + */ +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) && +- (trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) { ++ if (mtk_is_netsys_v1(eth) && (trxd.rxd2 & RX_DMA_VTAG) && ++ netdev_uses_dsa(netdev)) { + unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0); + + if (port < ARRAY_SIZE(eth->dsa_meta) && +@@ -2232,7 +2232,7 @@ static int mtk_tx_alloc(struct mtk_eth * + txd->txd2 = next_ptr; + txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; + txd->txd4 = 0; +- if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + txd->txd5 = 0; + txd->txd6 = 0; + txd->txd7 = 0; +@@ -2285,14 +2285,14 @@ static int mtk_tx_alloc(struct mtk_eth * + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | + MTK_QTX_SCH_LEAKY_BUCKET_SIZE; +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v1(eth)) + val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; + mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); + ofs += MTK_QTX_OFFSET; + } + val = MTK_QDMA_TX_SCH_MAX_WFQ | (MTK_QDMA_TX_SCH_MAX_WFQ << 16); + mtk_w32(eth, val, soc->reg_map->qdma.tx_sch_rate); +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + mtk_w32(eth, val, soc->reg_map->qdma.tx_sch_rate + 4); + } else { + mtk_w32(eth, ring->phys_pdma, MT7628_TX_BASE_PTR0); +@@ -2419,7 +2419,7 @@ static int mtk_rx_alloc(struct mtk_eth * + + rxd->rxd3 = 0; + rxd->rxd4 = 0; +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + rxd->rxd5 = 0; + rxd->rxd6 = 0; + rxd->rxd7 = 0; +@@ -2967,7 +2967,7 @@ static int mtk_start_dma(struct mtk_eth + MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | + MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + val |= MTK_MUTLI_CNT | MTK_RESV_BUF | + MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | + MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN; +@@ -3111,7 +3111,7 @@ static int mtk_open(struct net_device *d + phylink_start(mac->phylink); + netif_tx_start_all_queues(dev); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return 0; + + if (mtk_uses_dsa(dev) && !eth->prog) { +@@ -3376,7 +3376,7 @@ static void mtk_hw_reset(struct mtk_eth + { + u32 val; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0); + val = RSTCTRL_PPE0_V2; + } else { +@@ -3388,7 +3388,7 @@ static void mtk_hw_reset(struct mtk_eth + + ethsys_reset(eth, RSTCTRL_ETH | RSTCTRL_FE | val); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, + 0x3ffffff); + } +@@ -3414,7 +3414,7 @@ static void mtk_hw_warm_reset(struct mtk + return; + } + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0_V2; + else + rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0; +@@ -3584,7 +3584,7 @@ static int mtk_hw_init(struct mtk_eth *e + else + mtk_hw_reset(eth); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + /* Set FE to PDMAv2 if necessary */ + val = mtk_r32(eth, MTK_FE_GLO_MISC); + mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); +@@ -3621,7 +3621,7 @@ static int mtk_hw_init(struct mtk_eth *e + */ + val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); + mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL); +- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v1(eth)) { + val = mtk_r32(eth, MTK_CDMP_IG_CTRL); + mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); + +@@ -3643,7 +3643,7 @@ static int mtk_hw_init(struct mtk_eth *e + mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); + mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + /* PSE should not drop port8 and port9 packets from WDMA Tx */ + mtk_w32(eth, 0x00000300, PSE_DROP_CFG); + +@@ -4432,7 +4432,7 @@ static int mtk_probe(struct platform_dev + } + } + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + err = -EINVAL; +@@ -4540,9 +4540,8 @@ static int mtk_probe(struct platform_dev + } + + if (eth->soc->offload_version) { +- u32 num_ppe; ++ u32 num_ppe = mtk_is_netsys_v2_or_greater(eth) ? 2 : 1; + +- num_ppe = MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) ? 2 : 1; + num_ppe = min_t(u32, ARRAY_SIZE(eth->ppe), num_ppe); + for (i = 0; i < num_ppe; i++) { + u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; +@@ -4636,6 +4635,7 @@ static const struct mtk_soc_data mt2701_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7623_CLKS_BITMAP, + .required_pctl = true, ++ .version = 1, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4652,6 +4652,7 @@ static const struct mtk_soc_data mt7621_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7621_CLKS_BITMAP, + .required_pctl = false, ++ .version = 1, + .offload_version = 1, + .hash_offset = 2, + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, +@@ -4672,6 +4673,7 @@ static const struct mtk_soc_data mt7622_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7622_CLKS_BITMAP, + .required_pctl = false, ++ .version = 1, + .offload_version = 2, + .hash_offset = 2, + .has_accounting = true, +@@ -4692,6 +4694,7 @@ static const struct mtk_soc_data mt7623_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7623_CLKS_BITMAP, + .required_pctl = true, ++ .version = 1, + .offload_version = 1, + .hash_offset = 2, + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, +@@ -4714,6 +4717,7 @@ static const struct mtk_soc_data mt7629_ + .required_clks = MT7629_CLKS_BITMAP, + .required_pctl = false, + .has_accounting = true, ++ .version = 1, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4731,6 +4735,7 @@ static const struct mtk_soc_data mt7981_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7981_CLKS_BITMAP, + .required_pctl = false, ++ .version = 2, + .offload_version = 2, + .hash_offset = 4, + .has_accounting = true, +@@ -4752,6 +4757,7 @@ static const struct mtk_soc_data mt7986_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7986_CLKS_BITMAP, + .required_pctl = false, ++ .version = 2, + .offload_version = 2, + .hash_offset = 4, + .has_accounting = true, +@@ -4772,6 +4778,7 @@ static const struct mtk_soc_data rt5350_ + .hw_features = MTK_HW_FEATURES_MT7628, + .required_clks = MT7628_CLKS_BITMAP, + .required_pctl = false, ++ .version = 1, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -817,7 +817,6 @@ enum mkt_eth_capabilities { + MTK_SHARED_INT_BIT, + MTK_TRGMII_MT7621_CLK_BIT, + MTK_QDMA_BIT, +- MTK_NETSYS_V2_BIT, + MTK_SOC_MT7628_BIT, + MTK_RSTCTRL_PPE1_BIT, + MTK_U3_COPHY_V2_BIT, +@@ -852,7 +851,6 @@ enum mkt_eth_capabilities { + #define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT) + #define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT) + #define MTK_QDMA BIT(MTK_QDMA_BIT) +-#define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) + #define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) + #define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) + #define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) +@@ -931,11 +929,11 @@ enum mkt_eth_capabilities { + #define MT7981_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \ + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ + MTK_MUX_U3_GMAC2_TO_QPHY | MTK_U3_COPHY_V2 | \ +- MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) ++ MTK_RSTCTRL_PPE1) + + #define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ +- MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) ++ MTK_RSTCTRL_PPE1) + + struct mtk_tx_dma_desc_info { + dma_addr_t addr; +@@ -1006,6 +1004,7 @@ struct mtk_reg_map { + * @required_pctl A bool value to show whether the SoC requires + * the extra setup for those pins used by GMAC. + * @hash_offset Flow table hash offset. ++ * @version SoC version. + * @foe_entry_size Foe table entry size. + * @has_accounting Bool indicating support for accounting of + * offloaded flows. +@@ -1024,6 +1023,7 @@ struct mtk_soc_data { + bool required_pctl; + u8 offload_version; + u8 hash_offset; ++ u8 version; + u16 foe_entry_size; + netdev_features_t hw_features; + bool has_accounting; +@@ -1180,6 +1180,16 @@ struct mtk_mac { + /* the struct describing the SoC. these are declared in the soc_xyz.c files */ + extern const struct of_device_id of_mtk_match[]; + ++static inline bool mtk_is_netsys_v1(struct mtk_eth *eth) ++{ ++ return eth->soc->version == 1; ++} ++ ++static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth) ++{ ++ return eth->soc->version > 1; ++} ++ + static inline struct mtk_foe_entry * + mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash) + { +@@ -1190,7 +1200,7 @@ mtk_foe_get_entry(struct mtk_ppe *ppe, u + + static inline u32 mtk_get_ib1_ts_mask(struct mtk_eth *eth) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return MTK_FOE_IB1_BIND_TIMESTAMP_V2; + + return MTK_FOE_IB1_BIND_TIMESTAMP; +@@ -1198,7 +1208,7 @@ static inline u32 mtk_get_ib1_ts_mask(st + + static inline u32 mtk_get_ib1_ppoe_mask(struct mtk_eth *eth) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return MTK_FOE_IB1_BIND_PPPOE_V2; + + return MTK_FOE_IB1_BIND_PPPOE; +@@ -1206,7 +1216,7 @@ static inline u32 mtk_get_ib1_ppoe_mask( + + static inline u32 mtk_get_ib1_vlan_tag_mask(struct mtk_eth *eth) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return MTK_FOE_IB1_BIND_VLAN_TAG_V2; + + return MTK_FOE_IB1_BIND_VLAN_TAG; +@@ -1214,7 +1224,7 @@ static inline u32 mtk_get_ib1_vlan_tag_m + + static inline u32 mtk_get_ib1_vlan_layer_mask(struct mtk_eth *eth) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return MTK_FOE_IB1_BIND_VLAN_LAYER_V2; + + return MTK_FOE_IB1_BIND_VLAN_LAYER; +@@ -1222,7 +1232,7 @@ static inline u32 mtk_get_ib1_vlan_layer + + static inline u32 mtk_prep_ib1_vlan_layer(struct mtk_eth *eth, u32 val) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER_V2, val); + + return FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER, val); +@@ -1230,7 +1240,7 @@ static inline u32 mtk_prep_ib1_vlan_laye + + static inline u32 mtk_get_ib1_vlan_layer(struct mtk_eth *eth, u32 val) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return FIELD_GET(MTK_FOE_IB1_BIND_VLAN_LAYER_V2, val); + + return FIELD_GET(MTK_FOE_IB1_BIND_VLAN_LAYER, val); +@@ -1238,7 +1248,7 @@ static inline u32 mtk_get_ib1_vlan_layer + + static inline u32 mtk_get_ib1_pkt_type_mask(struct mtk_eth *eth) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return MTK_FOE_IB1_PACKET_TYPE_V2; + + return MTK_FOE_IB1_PACKET_TYPE; +@@ -1246,7 +1256,7 @@ static inline u32 mtk_get_ib1_pkt_type_m + + static inline u32 mtk_get_ib1_pkt_type(struct mtk_eth *eth, u32 val) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return FIELD_GET(MTK_FOE_IB1_PACKET_TYPE_V2, val); + + return FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, val); +@@ -1254,7 +1264,7 @@ static inline u32 mtk_get_ib1_pkt_type(s + + static inline u32 mtk_get_ib2_multicast_mask(struct mtk_eth *eth) + { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + return MTK_FOE_IB2_MULTICAST_V2; + + return MTK_FOE_IB2_MULTICAST; +--- a/drivers/net/ethernet/mediatek/mtk_ppe.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -207,7 +207,7 @@ int mtk_foe_entry_prepare(struct mtk_eth + + memset(entry, 0, sizeof(*entry)); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) | + FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE_V2, type) | + FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) | +@@ -271,7 +271,7 @@ int mtk_foe_entry_set_pse_port(struct mt + u32 *ib2 = mtk_foe_entry_ib2(eth, entry); + u32 val = *ib2; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + val &= ~MTK_FOE_IB2_DEST_PORT_V2; + val |= FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, port); + } else { +@@ -422,7 +422,7 @@ int mtk_foe_entry_set_wdma(struct mtk_et + struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); + u32 *ib2 = mtk_foe_entry_ib2(eth, entry); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + *ib2 &= ~MTK_FOE_IB2_PORT_MG_V2; + *ib2 |= FIELD_PREP(MTK_FOE_IB2_RX_IDX, txq) | + MTK_FOE_IB2_WDMA_WINFO_V2; +@@ -452,7 +452,7 @@ int mtk_foe_entry_set_queue(struct mtk_e + { + u32 *ib2 = mtk_foe_entry_ib2(eth, entry); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + *ib2 &= ~MTK_FOE_IB2_QID_V2; + *ib2 |= FIELD_PREP(MTK_FOE_IB2_QID_V2, queue); + *ib2 |= MTK_FOE_IB2_PSE_QOS_V2; +@@ -607,7 +607,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *p + struct mtk_foe_entry *hwe; + u32 val; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2; + entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP_V2, + timestamp); +@@ -623,7 +623,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *p + hwe->ib1 = entry->ib1; + + if (ppe->accounting) { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + val = MTK_FOE_IB2_MIB_CNT_V2; + else + val = MTK_FOE_IB2_MIB_CNT; +@@ -971,7 +971,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) + MTK_PPE_SCAN_MODE_KEEPALIVE_AGE) | + FIELD_PREP(MTK_PPE_TB_CFG_ENTRY_NUM, + MTK_PPE_ENTRIES_SHIFT); +- if (MTK_HAS_CAPS(ppe->eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(ppe->eth)) + val |= MTK_PPE_TB_CFG_INFO_SEL; + ppe_w32(ppe, MTK_PPE_TB_CFG, val); + +@@ -987,7 +987,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) + MTK_PPE_FLOW_CFG_IP4_NAPT | + MTK_PPE_FLOW_CFG_IP4_DSLITE | + MTK_PPE_FLOW_CFG_IP4_NAT_FRAG; +- if (MTK_HAS_CAPS(ppe->eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(ppe->eth)) + val |= MTK_PPE_MD_TOAP_BYP_CRSN0 | + MTK_PPE_MD_TOAP_BYP_CRSN1 | + MTK_PPE_MD_TOAP_BYP_CRSN2 | +@@ -1029,7 +1029,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) + + ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT, 0); + +- if (MTK_HAS_CAPS(ppe->eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(ppe->eth)) { + ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777); + ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f); + } +--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +@@ -193,7 +193,7 @@ mtk_flow_set_output_device(struct mtk_et + if (mtk_flow_get_wdma_info(dev, dest_mac, &info) == 0) { + mtk_foe_entry_set_wdma(eth, foe, info.wdma_idx, info.queue, + info.bss, info.wcid); +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + switch (info.wdma_idx) { + case 0: + pse_port = 8; +--- a/drivers/net/ethernet/mediatek/mtk_wed.c ++++ b/drivers/net/ethernet/mediatek/mtk_wed.c +@@ -1091,7 +1091,7 @@ mtk_wed_rx_reset(struct mtk_wed_device * + } else { + struct mtk_eth *eth = dev->hw->eth; + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ if (mtk_is_netsys_v2_or_greater(eth)) + wed_set(dev, MTK_WED_RESET_IDX, + MTK_WED_RESET_IDX_RX_V2); + else +@@ -1813,7 +1813,7 @@ void mtk_wed_add_hw(struct device_node * + hw->wdma = wdma; + hw->index = index; + hw->irq = irq; +- hw->version = MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) ? 2 : 1; ++ hw->version = mtk_is_netsys_v1(eth) ? 1 : 2; + + if (hw->version == 1) { + hw->mirror = syscon_regmap_lookup_by_phandle(eth_np, diff --git a/target/linux/generic/backport-5.15/750-v6.5-06-net-ethernet-mtk_eth_soc-increase-MAX_DEVS-to-3.patch b/target/linux/generic/backport-5.15/750-v6.5-06-net-ethernet-mtk_eth_soc-increase-MAX_DEVS-to-3.patch new file mode 100644 index 00000000000000..5a08b9dddf3703 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-06-net-ethernet-mtk_eth_soc-increase-MAX_DEVS-to-3.patch @@ -0,0 +1,29 @@ +From f8fb8dbd158c585be7574faf92db7d614b6722ff Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 25 Jul 2023 01:52:27 +0100 +Subject: [PATCH 100/250] net: ethernet: mtk_eth_soc: increase MAX_DEVS to 3 + +This is a preliminary patch to add MT7988 SoC support since it runs 3 +macs instead of 2. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/3563e5fab367e7d79a7f1296fabaa5c20f202d7a.1690246066.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -1040,8 +1040,8 @@ struct mtk_soc_data { + + #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) + +-/* currently no SoC has more than 2 macs */ +-#define MTK_MAX_DEVS 2 ++/* currently no SoC has more than 3 macs */ ++#define MTK_MAX_DEVS 3 + + /* struct mtk_eth - This is the main datasructure for holding the state + * of the driver diff --git a/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch b/target/linux/generic/backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch similarity index 50% rename from target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch rename to target/linux/generic/backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch index b11915ec104736..58729cec521510 100644 --- a/target/linux/generic/pending-5.15/737-03-net-ethernet-mtk_eth_soc-rely-on-num_devs-and-remove.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch @@ -1,143 +1,176 @@ -From 4e35e80750b33727e606be9e7ce447bde2e0deb7 Mon Sep 17 00:00:00 2001 +From 856be974290f28d7943be2ac5a382c4139486196 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 7 Mar 2023 15:55:35 +0000 -Subject: [PATCH 3/7] net: ethernet: mtk_eth_soc: rely on num_devs and remove - MTK_MAC_COUNT +Date: Tue, 25 Jul 2023 01:52:44 +0100 +Subject: [PATCH 101/250] net: ethernet: mtk_eth_soc: rely on MTK_MAX_DEVS and + remove MTK_MAC_COUNT -Get rid of MTK_MAC_COUNT since it is a duplicated of eth->soc->num_devs. +Get rid of MTK_MAC_COUNT since it is a duplicated of MTK_MAX_DEVS. Signed-off-by: Lorenzo Bianconi Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/1856f4266f2fc80677807b1bad867659e7b00c65.1690246066.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski --- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 30 ++++++++++----------- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 49 ++++++++++++--------- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 - - 2 files changed, 15 insertions(+), 16 deletions(-) + 2 files changed, 27 insertions(+), 23 deletions(-) --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -900,7 +900,7 @@ static void mtk_stats_update(struct mtk_ +@@ -838,7 +838,7 @@ static void mtk_stats_update(struct mtk_ { int i; - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->mac[i] || !eth->mac[i]->hw_stats) continue; if (spin_trylock(ð->mac[i]->hw_stats->stats_lock)) { -@@ -1403,7 +1403,7 @@ static int mtk_queue_stopped(struct mtk_ +@@ -1341,7 +1341,7 @@ static int mtk_queue_stopped(struct mtk_ { int i; - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i]) continue; if (netif_queue_stopped(eth->netdev[i])) -@@ -1417,7 +1417,7 @@ static void mtk_wake_queue(struct mtk_et +@@ -1355,7 +1355,7 @@ static void mtk_wake_queue(struct mtk_et { int i; - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i]) continue; netif_tx_wake_all_queues(eth->netdev[i]); -@@ -1908,7 +1908,7 @@ static int mtk_poll_rx(struct napi_struc +@@ -1812,7 +1812,7 @@ static int mtk_poll_rx(struct napi_struc !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) mac = RX_DMA_GET_SPORT(trxd.rxd4) - 1; - if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT || -+ if (unlikely(mac < 0 || mac >= eth->soc->num_devs || ++ if (unlikely(mac < 0 || mac >= MTK_MAX_DEVS || !eth->netdev[mac])) goto release_desc; -@@ -2937,7 +2937,7 @@ static void mtk_dma_free(struct mtk_eth +@@ -2841,7 +2841,7 @@ static void mtk_dma_free(struct mtk_eth const struct mtk_soc_data *soc = eth->soc; int i; - for (i = 0; i < MTK_MAC_COUNT; i++) -+ for (i = 0; i < soc->num_devs; i++) ++ for (i = 0; i < MTK_MAX_DEVS; i++) if (eth->netdev[i]) netdev_reset_queue(eth->netdev[i]); if (eth->scratch_ring) { -@@ -3091,7 +3091,7 @@ static void mtk_gdm_config(struct mtk_et +@@ -2995,8 +2995,13 @@ static void mtk_gdm_config(struct mtk_et if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) return; - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { - u32 val = mtk_r32(eth, MTK_GDMA_FWD_CFG(i)); +- u32 val = mtk_r32(eth, MTK_GDMA_FWD_CFG(i)); ++ for (i = 0; i < MTK_MAX_DEVS; i++) { ++ u32 val; ++ ++ if (!eth->netdev[i]) ++ continue; ++ ++ val = mtk_r32(eth, MTK_GDMA_FWD_CFG(i)); /* default setup the forward port to send frame to PDMA */ -@@ -3704,7 +3704,7 @@ static int mtk_hw_init(struct mtk_eth *e + val &= ~0xffff; +@@ -3006,7 +3011,7 @@ static void mtk_gdm_config(struct mtk_et + + val |= config; + +- if (eth->netdev[i] && netdev_uses_dsa(eth->netdev[i])) ++ if (netdev_uses_dsa(eth->netdev[i])) + val |= MTK_GDMA_SPECIAL_TAG; + + mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i)); +@@ -3605,15 +3610,15 @@ static int mtk_hw_init(struct mtk_eth *e * up with the more appropriate value when mtk_mac_config call is being * invoked. */ - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { struct net_device *dev = eth->netdev[i]; - mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i)); -@@ -3892,7 +3892,7 @@ static void mtk_pending_work(struct work +- mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i)); +- if (dev) { +- struct mtk_mac *mac = netdev_priv(dev); ++ if (!dev) ++ continue; + +- mtk_set_mcr_max_rx(mac, dev->mtu + MTK_RX_ETH_HLEN); +- } ++ mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i)); ++ mtk_set_mcr_max_rx(netdev_priv(dev), ++ dev->mtu + MTK_RX_ETH_HLEN); + } + + /* Indicates CDM to parse the MTK special tag from CPU +@@ -3793,7 +3798,7 @@ static void mtk_pending_work(struct work mtk_prepare_for_reset(eth); /* stop all devices to make sure that dma is properly shut down */ - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i] || !netif_running(eth->netdev[i])) continue; -@@ -3908,7 +3908,7 @@ static void mtk_pending_work(struct work +@@ -3809,8 +3814,8 @@ static void mtk_pending_work(struct work mtk_hw_init(eth, true); /* restart DMA and enable IRQs */ - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { - if (!test_bit(i, &restart)) +- if (!test_bit(i, &restart)) ++ for (i = 0; i < MTK_MAX_DEVS; i++) { ++ if (!eth->netdev[i] || !test_bit(i, &restart)) continue; -@@ -3936,7 +3936,7 @@ static int mtk_free_dev(struct mtk_eth * + if (mtk_open(eth->netdev[i])) { +@@ -3837,7 +3842,7 @@ static int mtk_free_dev(struct mtk_eth * { int i; - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i]) continue; free_netdev(eth->netdev[i]); -@@ -3955,7 +3955,7 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3856,7 +3861,7 @@ static int mtk_unreg_dev(struct mtk_eth { int i; - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { struct mtk_mac *mac; if (!eth->netdev[i]) continue; -@@ -4259,7 +4259,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4157,7 +4162,7 @@ static int mtk_add_mac(struct mtk_eth *e } id = be32_to_cpup(_id); - if (id >= MTK_MAC_COUNT) { -+ if (id >= eth->soc->num_devs) { ++ if (id >= MTK_MAX_DEVS) { dev_err(eth->dev, "%d is not a valid mac id\n", id); return -EINVAL; } -@@ -4400,7 +4400,7 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -4302,7 +4307,7 @@ void mtk_eth_set_dma_device(struct mtk_e rtnl_lock(); - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { dev = eth->netdev[i]; if (!dev || !(dev->flags & IFF_UP)) -@@ -4727,7 +4727,7 @@ static int mtk_remove(struct platform_de +@@ -4610,7 +4615,7 @@ static int mtk_remove(struct platform_de int i; /* stop all devices to make sure that dma is properly shut down */ - for (i = 0; i < MTK_MAC_COUNT; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { ++ for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i]) continue; mtk_stop(eth->netdev[i]); diff --git a/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch b/target/linux/generic/backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch similarity index 63% rename from target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch rename to target/linux/generic/backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch index 54b3fd024a4447..09f59c291ce92d 100644 --- a/target/linux/generic/pending-5.15/737-04-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V3-capabilit.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch @@ -1,22 +1,24 @@ -From ab817f559d505329d8a413c7d29250f6d87d77a0 Mon Sep 17 00:00:00 2001 +From a41d535855976838d246c079143c948dcf0f7931 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 7 Mar 2023 15:55:47 +0000 -Subject: [PATCH 4/7] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V3 capability - bit +Date: Tue, 25 Jul 2023 01:52:59 +0100 +Subject: [PATCH 102/250] net: ethernet: mtk_eth_soc: add NETSYS_V3 version + support -Introduce MTK_NETSYS_V3 bit in the device capabilities. +Introduce NETSYS_V3 chipset version support. This is a preliminary patch to introduce support for MT7988 SoC. Signed-off-by: Lorenzo Bianconi Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/0db2260910755d76fa48e303b9f9bdf4e5a82340.1690246066.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski --- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 115 ++++++++++++++++---- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 44 +++++++- - 2 files changed, 134 insertions(+), 25 deletions(-) + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 105 ++++++++++++++------ + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 48 +++++++-- + 2 files changed, 116 insertions(+), 37 deletions(-) --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -880,17 +880,32 @@ void mtk_stats_update_mac(struct mtk_mac +@@ -818,17 +818,32 @@ void mtk_stats_update_mac(struct mtk_mac mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x20 + offs); hw_stats->rx_flow_control_packets += mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x24 + offs); @@ -32,7 +34,7 @@ Signed-off-by: Daniel Golle - hw_stats->tx_packets += - mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x38 + offs); + -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { + hw_stats->tx_skip += + mtk_r32(mac->hw, reg_map->gdm1_cnt + 0x50 + offs); + hw_stats->tx_collisions += @@ -60,7 +62,7 @@ Signed-off-by: Daniel Golle } u64_stats_update_end(&hw_stats->syncp); -@@ -1192,7 +1207,10 @@ static void mtk_tx_set_dma_desc_v2(struc +@@ -1130,7 +1145,10 @@ static void mtk_tx_set_dma_desc_v2(struc data |= TX_DMA_LS0; WRITE_ONCE(desc->txd3, data); @@ -72,57 +74,53 @@ Signed-off-by: Daniel Golle data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid); WRITE_ONCE(desc->txd4, data); -@@ -1203,6 +1221,9 @@ static void mtk_tx_set_dma_desc_v2(struc +@@ -1141,6 +1159,8 @@ static void mtk_tx_set_dma_desc_v2(struc /* tx checksum offload */ if (info->csum) data |= TX_DMA_CHKSUM_V2; -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && -+ netdev_uses_dsa(dev)) ++ if (mtk_is_netsys_v3_or_greater(eth) && netdev_uses_dsa(dev)) + data |= TX_DMA_SPTAG_V3; } WRITE_ONCE(desc->txd5, data); -@@ -1268,8 +1289,13 @@ static int mtk_tx_map(struct sk_buff *sk +@@ -1206,8 +1226,7 @@ static int mtk_tx_map(struct sk_buff *sk mtk_tx_set_dma_desc(dev, itxd, &txd_info); itx_buf->flags |= MTK_TX_FLAGS_SINGLE0; - itx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 : - MTK_TX_FLAGS_FPORT1; -+ if (mac->id == MTK_GMAC1_ID) -+ itx_buf->flags |= MTK_TX_FLAGS_FPORT0; -+ else if (mac->id == MTK_GMAC2_ID) -+ itx_buf->flags |= MTK_TX_FLAGS_FPORT1; -+ else -+ itx_buf->flags |= MTK_TX_FLAGS_FPORT2; -+ ++ itx_buf->mac_id = mac->id; setup_tx_buf(eth, itx_buf, itxd_pdma, txd_info.addr, txd_info.size, k++); -@@ -1317,8 +1343,13 @@ static int mtk_tx_map(struct sk_buff *sk +@@ -1255,8 +1274,7 @@ static int mtk_tx_map(struct sk_buff *sk memset(tx_buf, 0, sizeof(*tx_buf)); tx_buf->data = (void *)MTK_DMA_DUMMY_DESC; tx_buf->flags |= MTK_TX_FLAGS_PAGE0; - tx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 : - MTK_TX_FLAGS_FPORT1; -+ -+ if (mac->id == MTK_GMAC1_ID) -+ tx_buf->flags |= MTK_TX_FLAGS_FPORT0; -+ else if (mac->id == MTK_GMAC2_ID) -+ tx_buf->flags |= MTK_TX_FLAGS_FPORT1; -+ else -+ tx_buf->flags |= MTK_TX_FLAGS_FPORT2; ++ tx_buf->mac_id = mac->id; setup_tx_buf(eth, tx_buf, txd_pdma, txd_info.addr, txd_info.size, k++); -@@ -1902,11 +1933,24 @@ static int mtk_poll_rx(struct napi_struc +@@ -1558,7 +1576,7 @@ static int mtk_xdp_frame_map(struct mtk_ + } + mtk_tx_set_dma_desc(dev, txd, txd_info); + +- tx_buf->flags |= !mac->id ? MTK_TX_FLAGS_FPORT0 : MTK_TX_FLAGS_FPORT1; ++ tx_buf->mac_id = mac->id; + tx_buf->type = dma_map ? MTK_TYPE_XDP_NDO : MTK_TYPE_XDP_TX; + tx_buf->data = (void *)MTK_DMA_DUMMY_DESC; + +@@ -1806,11 +1824,24 @@ static int mtk_poll_rx(struct napi_struc break; /* find out which mac the packet come from. values start at 1 */ -- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) +- if (mtk_is_netsys_v2_or_greater(eth)) - mac = RX_DMA_GET_SPORT_V2(trxd.rxd5) - 1; - else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && - !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) { + u32 val = RX_DMA_GET_SPORT_V2(trxd.rxd5); + + switch (val) { @@ -137,29 +135,44 @@ Signed-off-by: Daniel Golle + break; + } + } else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && -+ !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) { ++ !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) { mac = RX_DMA_GET_SPORT(trxd.rxd4) - 1; + } - if (unlikely(mac < 0 || mac >= eth->soc->num_devs || + if (unlikely(mac < 0 || mac >= MTK_MAX_DEVS || !eth->netdev[mac])) -@@ -2135,7 +2179,9 @@ static int mtk_poll_tx_qdma(struct mtk_e +@@ -2030,7 +2061,6 @@ static int mtk_poll_tx_qdma(struct mtk_e + + while ((cpu != dma) && budget) { + u32 next_cpu = desc->txd2; +- int mac = 0; + + desc = mtk_qdma_phys_to_virt(ring, desc->txd2); + if ((desc->txd3 & TX_DMA_OWNER_CPU) == 0) +@@ -2038,15 +2068,13 @@ static int mtk_poll_tx_qdma(struct mtk_e + tx_buf = mtk_desc_to_tx_buf(ring, desc, eth->soc->txrx.txd_size); - if (tx_buf->flags & MTK_TX_FLAGS_FPORT1) +- if (tx_buf->flags & MTK_TX_FLAGS_FPORT1) - mac = 1; -+ mac = MTK_GMAC2_ID; -+ else if (tx_buf->flags & MTK_TX_FLAGS_FPORT2) -+ mac = MTK_GMAC3_ID; - +- if (!tx_buf->data) break; -@@ -3742,7 +3788,26 @@ static int mtk_hw_init(struct mtk_eth *e + + if (tx_buf->data != (void *)MTK_DMA_DUMMY_DESC) { + if (tx_buf->type == MTK_TYPE_SKB) +- mtk_poll_tx_done(eth, state, mac, tx_buf->data); ++ mtk_poll_tx_done(eth, state, tx_buf->mac_id, ++ tx_buf->data); + + budget--; + } +@@ -3648,7 +3676,24 @@ static int mtk_hw_init(struct mtk_eth *e mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { + /* PSE should not drop port1, port8 and port9 packets */ + mtk_w32(eth, 0x00000302, PSE_DROP_CFG); + @@ -168,9 +181,7 @@ Signed-off-by: Daniel Golle + mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES); + + /* Disable GDM1 RX CRC stripping */ -+ val = mtk_r32(eth, MTK_GDMA_FWD_CFG(0)); -+ val &= ~MTK_GDMA_STRP_CRC; -+ mtk_w32(eth, val, MTK_GDMA_FWD_CFG(0)); ++ mtk_m32(eth, MTK_GDMA_STRP_CRC, 0, MTK_GDMA_FWD_CFG(0)); + + /* PSE GDM3 MIB counter has incorrect hw default values, + * so the driver ought to read clear the values beforehand @@ -178,17 +189,17 @@ Signed-off-by: Daniel Golle + */ + for (i = 0; i < 0x80; i += 0x4) + mtk_r32(eth, reg_map->gdm1_cnt + 0x100 + i); -+ } else if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { ++ } else if (!mtk_is_netsys_v1(eth)) { /* PSE should not drop port8 and port9 packets from WDMA Tx */ mtk_w32(eth, 0x00000300, PSE_DROP_CFG); -@@ -4307,7 +4372,11 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4210,7 +4255,11 @@ static int mtk_add_mac(struct mtk_eth *e } spin_lock_init(&mac->hw_stats->stats_lock); u64_stats_init(&mac->hw_stats->syncp); - mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET; + -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) ++ if (mtk_is_netsys_v3_or_greater(eth)) + mac->hw_stats->reg_offset = id * 0x80; + else + mac->hw_stats->reg_offset = id * 0x40; @@ -197,7 +208,7 @@ Signed-off-by: Daniel Golle err = of_get_phy_mode(np, &phy_mode); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -121,6 +121,7 @@ +@@ -122,6 +122,7 @@ #define MTK_GDMA_ICS_EN BIT(22) #define MTK_GDMA_TCS_EN BIT(21) #define MTK_GDMA_UCS_EN BIT(20) @@ -205,7 +216,7 @@ Signed-off-by: Daniel Golle #define MTK_GDMA_TO_PDMA 0x0 #define MTK_GDMA_DROP_ALL 0x7777 -@@ -286,8 +287,6 @@ +@@ -287,8 +288,6 @@ /* QDMA Interrupt grouping registers */ #define MTK_RLS_DONE_INT BIT(0) @@ -214,7 +225,7 @@ Signed-off-by: Daniel Golle /* QDMA TX NUM */ #define QID_BITS_V2(x) (((x) & 0x3f) << 16) #define MTK_QDMA_GMAC2_QID 8 -@@ -300,6 +299,8 @@ +@@ -301,6 +300,8 @@ #define TX_DMA_CHKSUM_V2 (0x7 << 28) #define TX_DMA_TSO_V2 BIT(31) @@ -223,15 +234,20 @@ Signed-off-by: Daniel Golle /* QDMA V2 descriptor txd4 */ #define TX_DMA_FPORT_SHIFT_V2 8 #define TX_DMA_FPORT_MASK_V2 0xf -@@ -636,6 +637,7 @@ enum mtk_tx_flags { +@@ -631,12 +632,6 @@ enum mtk_tx_flags { */ - MTK_TX_FLAGS_FPORT0 = 0x04, - MTK_TX_FLAGS_FPORT1 = 0x08, -+ MTK_TX_FLAGS_FPORT2 = 0x10, + MTK_TX_FLAGS_SINGLE0 = 0x01, + MTK_TX_FLAGS_PAGE0 = 0x02, +- +- /* MTK_TX_FLAGS_FPORTx allows tracking which port the transmitted +- * SKB out instead of looking up through hardware TX descriptor. +- */ +- MTK_TX_FLAGS_FPORT0 = 0x04, +- MTK_TX_FLAGS_FPORT1 = 0x08, }; /* This enum allows us to identify how the clock is defined on the array of the -@@ -721,6 +723,42 @@ enum mtk_dev_state { +@@ -722,6 +717,35 @@ enum mtk_dev_state { MTK_RESETTING }; @@ -263,30 +279,29 @@ Signed-off-by: Daniel Golle + MTK_GMAC3_ID, + MTK_GMAC_ID_MAX +}; -+ -+/* GDM Type */ -+enum mtk_gdm_type { -+ MTK_GDM_TYPE = 0, -+ MTK_XGDM_TYPE, -+ MTK_GDM_TYPE_MAX -+}; + enum mtk_tx_buf_type { MTK_TYPE_SKB, MTK_TYPE_XDP_TX, -@@ -817,6 +855,7 @@ enum mkt_eth_capabilities { - MTK_QDMA_BIT, - MTK_NETSYS_V1_BIT, - MTK_NETSYS_V2_BIT, -+ MTK_NETSYS_V3_BIT, - MTK_SOC_MT7628_BIT, - MTK_RSTCTRL_PPE1_BIT, - MTK_U3_COPHY_V2_BIT, -@@ -853,6 +892,7 @@ enum mkt_eth_capabilities { - #define MTK_QDMA BIT(MTK_QDMA_BIT) - #define MTK_NETSYS_V1 BIT(MTK_NETSYS_V1_BIT) - #define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) -+#define MTK_NETSYS_V3 BIT(MTK_NETSYS_V3_BIT) - #define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) - #define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) - #define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) +@@ -740,7 +764,8 @@ struct mtk_tx_buf { + enum mtk_tx_buf_type type; + void *data; + +- u32 flags; ++ u16 mac_id; ++ u16 flags; + DEFINE_DMA_UNMAP_ADDR(dma_addr0); + DEFINE_DMA_UNMAP_LEN(dma_len0); + DEFINE_DMA_UNMAP_ADDR(dma_addr1); +@@ -1189,6 +1214,11 @@ static inline bool mtk_is_netsys_v2_or_g + return eth->soc->version > 1; + } + ++static inline bool mtk_is_netsys_v3_or_greater(struct mtk_eth *eth) ++{ ++ return eth->soc->version > 2; ++} ++ + static inline struct mtk_foe_entry * + mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash) + { diff --git a/target/linux/generic/pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch b/target/linux/generic/backport-5.15/750-v6.5-09-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch similarity index 89% rename from target/linux/generic/pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch rename to target/linux/generic/backport-5.15/750-v6.5-09-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch index bd26cca305dbd0..0a72eec2fc16b7 100644 --- a/target/linux/generic/pending-5.15/737-05-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-09-net-ethernet-mtk_eth_soc-convert-caps-in-mtk_soc_dat.patch @@ -1,17 +1,19 @@ -From 45b575fd9e6a455090820248bf1b98b1f2c7b6c8 Mon Sep 17 00:00:00 2001 +From db797ae0542220a98658229397da464c383c991c Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 7 Mar 2023 15:56:00 +0000 -Subject: [PATCH 5/7] net: ethernet: mtk_eth_soc: convert caps in mtk_soc_data - struct to u64 +Date: Tue, 25 Jul 2023 01:53:13 +0100 +Subject: [PATCH 103/250] net: ethernet: mtk_eth_soc: convert caps in + mtk_soc_data struct to u64 This is a preliminary patch to introduce support for MT7988 SoC. Signed-off-by: Lorenzo Bianconi Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/9499ac3670b2fc5b444404b84e8a4a169beabbf2.1690246066.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski --- - drivers/net/ethernet/mediatek/mtk_eth_path.c | 22 +++---- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 62 ++++++++++---------- - 2 files changed, 42 insertions(+), 42 deletions(-) + drivers/net/ethernet/mediatek/mtk_eth_path.c | 22 ++++---- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 56 ++++++++++---------- + 2 files changed, 39 insertions(+), 39 deletions(-) --- a/drivers/net/ethernet/mediatek/mtk_eth_path.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c @@ -111,7 +113,7 @@ Signed-off-by: Daniel Golle MTK_ETH_PATH_GMAC2_RGMII; --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -878,44 +878,44 @@ enum mkt_eth_capabilities { +@@ -863,41 +863,41 @@ enum mkt_eth_capabilities { }; /* Supported hardware group on SoCs */ @@ -127,9 +129,6 @@ Signed-off-by: Daniel Golle -#define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT) -#define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT) -#define MTK_QDMA BIT(MTK_QDMA_BIT) --#define MTK_NETSYS_V1 BIT(MTK_NETSYS_V1_BIT) --#define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) --#define MTK_NETSYS_V3 BIT(MTK_NETSYS_V3_BIT) -#define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) -#define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) -#define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT) @@ -145,9 +144,6 @@ Signed-off-by: Daniel Golle +#define MTK_SHARED_INT BIT_ULL(MTK_SHARED_INT_BIT) +#define MTK_TRGMII_MT7621_CLK BIT_ULL(MTK_TRGMII_MT7621_CLK_BIT) +#define MTK_QDMA BIT_ULL(MTK_QDMA_BIT) -+#define MTK_NETSYS_V1 BIT_ULL(MTK_NETSYS_V1_BIT) -+#define MTK_NETSYS_V2 BIT_ULL(MTK_NETSYS_V2_BIT) -+#define MTK_NETSYS_V3 BIT_ULL(MTK_NETSYS_V3_BIT) +#define MTK_SOC_MT7628 BIT_ULL(MTK_SOC_MT7628_BIT) +#define MTK_RSTCTRL_PPE1 BIT_ULL(MTK_RSTCTRL_PPE1_BIT) +#define MTK_U3_COPHY_V2 BIT_ULL(MTK_U3_COPHY_V2_BIT) @@ -186,7 +182,7 @@ Signed-off-by: Daniel Golle #define MTK_GMAC1_RGMII (MTK_ETH_PATH_GMAC1_RGMII | MTK_RGMII) #define MTK_GMAC1_TRGMII (MTK_ETH_PATH_GMAC1_TRGMII | MTK_TRGMII) -@@ -1071,7 +1071,7 @@ struct mtk_reg_map { +@@ -1042,7 +1042,7 @@ struct mtk_reg_map { struct mtk_soc_data { const struct mtk_reg_map *reg_map; u32 ana_rgc3; diff --git a/target/linux/generic/backport-5.15/750-v6.5-10-net-ethernet-mtk_eth_soc-convert-clock-bitmap-to-u64.patch b/target/linux/generic/backport-5.15/750-v6.5-10-net-ethernet-mtk_eth_soc-convert-clock-bitmap-to-u64.patch new file mode 100644 index 00000000000000..4e5b857d48b3df --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-10-net-ethernet-mtk_eth_soc-convert-clock-bitmap-to-u64.patch @@ -0,0 +1,132 @@ +From a1c9f7d1d24e90294f6a6755b137fcf306851e93 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 25 Jul 2023 01:53:28 +0100 +Subject: [PATCH 104/250] net: ethernet: mtk_eth_soc: convert clock bitmap to + u64 + +The to-be-added MT7988 SoC adds many new clocks which need to be +controlled by the Ethernet driver, which will result in their total +number exceeding 32. +Prepare by converting clock bitmaps into 64-bit types. + +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/6960a39bb0078cf84d7642a9558e6a91c6cc9df3.1690246066.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 96 +++++++++++---------- + 1 file changed, 49 insertions(+), 47 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -663,54 +663,56 @@ enum mtk_clks_map { + MTK_CLK_MAX + }; + +-#define MT7623_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ +- BIT(MTK_CLK_GP1) | BIT(MTK_CLK_GP2) | \ +- BIT(MTK_CLK_TRGPLL)) +-#define MT7622_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ +- BIT(MTK_CLK_GP0) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_GP2) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII_CK) | \ +- BIT(MTK_CLK_ETH2PLL)) ++#define MT7623_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP1) | BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_TRGPLL)) ++#define MT7622_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP0) | BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII_CK) | \ ++ BIT_ULL(MTK_CLK_ETH2PLL)) + #define MT7621_CLKS_BITMAP (0) + #define MT7628_CLKS_BITMAP (0) +-#define MT7629_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ +- BIT(MTK_CLK_GP0) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_GP2) | BIT(MTK_CLK_FE) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII2_TX_250M) | \ +- BIT(MTK_CLK_SGMII2_RX_250M) | \ +- BIT(MTK_CLK_SGMII2_CDR_REF) | \ +- BIT(MTK_CLK_SGMII2_CDR_FB) | \ +- BIT(MTK_CLK_SGMII_CK) | \ +- BIT(MTK_CLK_ETH2PLL) | BIT(MTK_CLK_SGMIITOP)) +-#define MT7981_CLKS_BITMAP (BIT(MTK_CLK_FE) | BIT(MTK_CLK_GP2) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_WOCPU0) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII2_TX_250M) | \ +- BIT(MTK_CLK_SGMII2_RX_250M) | \ +- BIT(MTK_CLK_SGMII2_CDR_REF) | \ +- BIT(MTK_CLK_SGMII2_CDR_FB) | \ +- BIT(MTK_CLK_SGMII_CK)) +-#define MT7986_CLKS_BITMAP (BIT(MTK_CLK_FE) | BIT(MTK_CLK_GP2) | BIT(MTK_CLK_GP1) | \ +- BIT(MTK_CLK_WOCPU1) | BIT(MTK_CLK_WOCPU0) | \ +- BIT(MTK_CLK_SGMII_TX_250M) | \ +- BIT(MTK_CLK_SGMII_RX_250M) | \ +- BIT(MTK_CLK_SGMII_CDR_REF) | \ +- BIT(MTK_CLK_SGMII_CDR_FB) | \ +- BIT(MTK_CLK_SGMII2_TX_250M) | \ +- BIT(MTK_CLK_SGMII2_RX_250M) | \ +- BIT(MTK_CLK_SGMII2_CDR_REF) | \ +- BIT(MTK_CLK_SGMII2_CDR_FB)) ++#define MT7629_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP0) | BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_GP2) | BIT_ULL(MTK_CLK_FE) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII_CK) | \ ++ BIT_ULL(MTK_CLK_ETH2PLL) | BIT_ULL(MTK_CLK_SGMIITOP)) ++#define MT7981_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_WOCPU0) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII_CK)) ++#define MT7986_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_GP1) | \ ++ BIT_ULL(MTK_CLK_WOCPU1) | BIT_ULL(MTK_CLK_WOCPU0) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ ++ BIT_ULL(MTK_CLK_SGMII2_CDR_FB)) + + enum mtk_dev_state { + MTK_HW_INIT, +@@ -1043,7 +1045,7 @@ struct mtk_soc_data { + const struct mtk_reg_map *reg_map; + u32 ana_rgc3; + u64 caps; +- u32 required_clks; ++ u64 required_clks; + bool required_pctl; + u8 offload_version; + u8 hash_offset; diff --git a/target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch b/target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch new file mode 100644 index 00000000000000..028c28b1f74c52 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch @@ -0,0 +1,477 @@ +From 94f825a7eadfc8b4c8828efdb7705d9703f9c73e Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 25 Jul 2023 01:57:42 +0100 +Subject: [PATCH 105/250] net: ethernet: mtk_eth_soc: add basic support for + MT7988 SoC + +Introduce support for ethernet chip available in MT7988 SoC to +mtk_eth_soc driver. As a first step support only the first GMAC which +is hard-wired to the internal DSA switch having 4 built-in gigabit +Ethernet PHYs. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/25c8377095b95d186872eeda7aa055da83e8f0ca.1690246605.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_path.c | 14 +- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 201 +++++++++++++++++-- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 86 +++++++- + 3 files changed, 273 insertions(+), 28 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_path.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c +@@ -43,7 +43,7 @@ static const char *mtk_eth_path_name(u64 + static int set_mux_gdm1_to_gmac1_esw(struct mtk_eth *eth, u64 path) + { + bool updated = true; +- u32 val, mask, set; ++ u32 mask, set, reg; + + switch (path) { + case MTK_ETH_PATH_GMAC1_SGMII: +@@ -59,11 +59,13 @@ static int set_mux_gdm1_to_gmac1_esw(str + break; + } + +- if (updated) { +- val = mtk_r32(eth, MTK_MAC_MISC); +- val = (val & mask) | set; +- mtk_w32(eth, val, MTK_MAC_MISC); +- } ++ if (mtk_is_netsys_v3_or_greater(eth)) ++ reg = MTK_MAC_MISC_V3; ++ else ++ reg = MTK_MAC_MISC; ++ ++ if (updated) ++ mtk_m32(eth, mask, set, reg); + + dev_dbg(eth->dev, "path %s in %s updated = %d\n", + mtk_eth_path_name(path), __func__, updated); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -152,6 +152,54 @@ static const struct mtk_reg_map mt7986_r + .pse_oq_sta = 0x01a0, + }; + ++static const struct mtk_reg_map mt7988_reg_map = { ++ .tx_irq_mask = 0x461c, ++ .tx_irq_status = 0x4618, ++ .pdma = { ++ .rx_ptr = 0x6900, ++ .rx_cnt_cfg = 0x6904, ++ .pcrx_ptr = 0x6908, ++ .glo_cfg = 0x6a04, ++ .rst_idx = 0x6a08, ++ .delay_irq = 0x6a0c, ++ .irq_status = 0x6a20, ++ .irq_mask = 0x6a28, ++ .adma_rx_dbg0 = 0x6a38, ++ .int_grp = 0x6a50, ++ }, ++ .qdma = { ++ .qtx_cfg = 0x4400, ++ .qtx_sch = 0x4404, ++ .rx_ptr = 0x4500, ++ .rx_cnt_cfg = 0x4504, ++ .qcrx_ptr = 0x4508, ++ .glo_cfg = 0x4604, ++ .rst_idx = 0x4608, ++ .delay_irq = 0x460c, ++ .fc_th = 0x4610, ++ .int_grp = 0x4620, ++ .hred = 0x4644, ++ .ctx_ptr = 0x4700, ++ .dtx_ptr = 0x4704, ++ .crx_ptr = 0x4710, ++ .drx_ptr = 0x4714, ++ .fq_head = 0x4720, ++ .fq_tail = 0x4724, ++ .fq_count = 0x4728, ++ .fq_blen = 0x472c, ++ .tx_sch_rate = 0x4798, ++ }, ++ .gdm1_cnt = 0x1c00, ++ .gdma_to_ppe0 = 0x3333, ++ .ppe_base = 0x2000, ++ .wdma_base = { ++ [0] = 0x4800, ++ [1] = 0x4c00, ++ }, ++ .pse_iq_sta = 0x0180, ++ .pse_oq_sta = 0x01a0, ++}; ++ + /* strings used by ethtool */ + static const struct mtk_ethtool_stats { + char str[ETH_GSTRING_LEN]; +@@ -179,10 +227,54 @@ static const struct mtk_ethtool_stats { + }; + + static const char * const mtk_clks_source_name[] = { +- "ethif", "sgmiitop", "esw", "gp0", "gp1", "gp2", "fe", "trgpll", +- "sgmii_tx250m", "sgmii_rx250m", "sgmii_cdr_ref", "sgmii_cdr_fb", +- "sgmii2_tx250m", "sgmii2_rx250m", "sgmii2_cdr_ref", "sgmii2_cdr_fb", +- "sgmii_ck", "eth2pll", "wocpu0", "wocpu1", "netsys0", "netsys1" ++ "ethif", ++ "sgmiitop", ++ "esw", ++ "gp0", ++ "gp1", ++ "gp2", ++ "gp3", ++ "xgp1", ++ "xgp2", ++ "xgp3", ++ "crypto", ++ "fe", ++ "trgpll", ++ "sgmii_tx250m", ++ "sgmii_rx250m", ++ "sgmii_cdr_ref", ++ "sgmii_cdr_fb", ++ "sgmii2_tx250m", ++ "sgmii2_rx250m", ++ "sgmii2_cdr_ref", ++ "sgmii2_cdr_fb", ++ "sgmii_ck", ++ "eth2pll", ++ "wocpu0", ++ "wocpu1", ++ "netsys0", ++ "netsys1", ++ "ethwarp_wocpu2", ++ "ethwarp_wocpu1", ++ "ethwarp_wocpu0", ++ "top_usxgmii0_sel", ++ "top_usxgmii1_sel", ++ "top_sgm0_sel", ++ "top_sgm1_sel", ++ "top_xfi_phy0_xtal_sel", ++ "top_xfi_phy1_xtal_sel", ++ "top_eth_gmii_sel", ++ "top_eth_refck_50m_sel", ++ "top_eth_sys_200m_sel", ++ "top_eth_sys_sel", ++ "top_eth_xgmii_sel", ++ "top_eth_mii_sel", ++ "top_netsys_sel", ++ "top_netsys_500m_sel", ++ "top_netsys_pao_2x_sel", ++ "top_netsys_sync_250m_sel", ++ "top_netsys_ppefb_250m_sel", ++ "top_netsys_warp_sel", + }; + + void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) +@@ -195,7 +287,7 @@ u32 mtk_r32(struct mtk_eth *eth, unsigne + return __raw_readl(eth->base + reg); + } + +-static u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned reg) ++u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned int reg) + { + u32 val; + +@@ -326,6 +418,19 @@ static void mtk_gmac0_rgmii_adjust(struc + dev_err(eth->dev, "Missing PLL configuration, ethernet may not work\n"); + } + ++static void mtk_setup_bridge_switch(struct mtk_eth *eth) ++{ ++ /* Force Port1 XGMAC Link Up */ ++ mtk_m32(eth, 0, MTK_XGMAC_FORCE_LINK(MTK_GMAC1_ID), ++ MTK_XGMAC_STS(MTK_GMAC1_ID)); ++ ++ /* Adjust GSW bridge IPG to 11 */ ++ mtk_m32(eth, GSWTX_IPG_MASK | GSWRX_IPG_MASK, ++ (GSW_IPG_11 << GSWTX_IPG_SHIFT) | ++ (GSW_IPG_11 << GSWRX_IPG_SHIFT), ++ MTK_GSW_CFG); ++} ++ + static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config, + phy_interface_t interface) + { +@@ -395,6 +500,8 @@ static void mtk_mac_config(struct phylin + goto init_err; + } + break; ++ case PHY_INTERFACE_MODE_INTERNAL: ++ break; + default: + goto err_phy; + } +@@ -472,6 +579,15 @@ static void mtk_mac_config(struct phylin + return; + } + ++ /* Setup gmac */ ++ if (mtk_is_netsys_v3_or_greater(eth) && ++ mac->interface == PHY_INTERFACE_MODE_INTERNAL) { ++ mtk_w32(mac->hw, MTK_GDMA_XGDM_SEL, MTK_GDMA_EG_CTRL(mac->id)); ++ mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id)); ++ ++ mtk_setup_bridge_switch(eth); ++ } ++ + return; + + err_phy: +@@ -682,11 +798,15 @@ static int mtk_mdio_init(struct mtk_eth + } + divider = min_t(unsigned int, DIV_ROUND_UP(MDC_MAX_FREQ, max_clk), 63); + ++ /* Configure MDC Turbo Mode */ ++ if (mtk_is_netsys_v3_or_greater(eth)) ++ mtk_m32(eth, 0, MISC_MDC_TURBO, MTK_MAC_MISC_V3); ++ + /* Configure MDC Divider */ +- val = mtk_r32(eth, MTK_PPSC); +- val &= ~PPSC_MDC_CFG; +- val |= FIELD_PREP(PPSC_MDC_CFG, divider) | PPSC_MDC_TURBO; +- mtk_w32(eth, val, MTK_PPSC); ++ val = FIELD_PREP(PPSC_MDC_CFG, divider); ++ if (!mtk_is_netsys_v3_or_greater(eth)) ++ val |= PPSC_MDC_TURBO; ++ mtk_m32(eth, PPSC_MDC_CFG, val, MTK_PPSC); + + dev_dbg(eth->dev, "MDC is running on %d Hz\n", MDC_MAX_FREQ / divider); + +@@ -1145,10 +1265,19 @@ static void mtk_tx_set_dma_desc_v2(struc + data |= TX_DMA_LS0; + WRITE_ONCE(desc->txd3, data); + +- if (mac->id == MTK_GMAC3_ID) +- data = PSE_GDM3_PORT; +- else +- data = (mac->id + 1) << TX_DMA_FPORT_SHIFT_V2; /* forward port */ ++ /* set forward port */ ++ switch (mac->id) { ++ case MTK_GMAC1_ID: ++ data = PSE_GDM1_PORT << TX_DMA_FPORT_SHIFT_V2; ++ break; ++ case MTK_GMAC2_ID: ++ data = PSE_GDM2_PORT << TX_DMA_FPORT_SHIFT_V2; ++ break; ++ case MTK_GMAC3_ID: ++ data = PSE_GDM3_PORT << TX_DMA_FPORT_SHIFT_V2; ++ break; ++ } ++ + data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid); + WRITE_ONCE(desc->txd4, data); + +@@ -4304,6 +4433,17 @@ static int mtk_add_mac(struct mtk_eth *e + mac->phylink_config.supported_interfaces); + } + ++ if (mtk_is_netsys_v3_or_greater(mac->hw) && ++ MTK_HAS_CAPS(mac->hw->soc->caps, MTK_ESW_BIT) && ++ id == MTK_GMAC1_ID) { ++ mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | ++ MAC_SYM_PAUSE | ++ MAC_10000FD; ++ phy_interface_zero(mac->phylink_config.supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_INTERNAL, ++ mac->phylink_config.supported_interfaces); ++ } ++ + phylink = phylink_create(&mac->phylink_config, + of_fwnode_handle(mac->of_node), + phy_mode, &mtk_phylink_ops); +@@ -4826,6 +4966,24 @@ static const struct mtk_soc_data mt7986_ + }, + }; + ++static const struct mtk_soc_data mt7988_data = { ++ .reg_map = &mt7988_reg_map, ++ .ana_rgc3 = 0x128, ++ .caps = MT7988_CAPS, ++ .hw_features = MTK_HW_FEATURES, ++ .required_clks = MT7988_CLKS_BITMAP, ++ .required_pctl = false, ++ .version = 3, ++ .txrx = { ++ .txd_size = sizeof(struct mtk_tx_dma_v2), ++ .rxd_size = sizeof(struct mtk_rx_dma_v2), ++ .rx_irq_done_mask = MTK_RX_DONE_INT_V2, ++ .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, ++ .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, ++ .dma_len_offset = 8, ++ }, ++}; ++ + static const struct mtk_soc_data rt5350_data = { + .reg_map = &mt7628_reg_map, + .caps = MT7628_CAPS, +@@ -4844,14 +5002,15 @@ static const struct mtk_soc_data rt5350_ + }; + + const struct of_device_id of_mtk_match[] = { +- { .compatible = "mediatek,mt2701-eth", .data = &mt2701_data}, +- { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data}, +- { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, +- { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, +- { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, +- { .compatible = "mediatek,mt7981-eth", .data = &mt7981_data}, +- { .compatible = "mediatek,mt7986-eth", .data = &mt7986_data}, +- { .compatible = "ralink,rt5350-eth", .data = &rt5350_data}, ++ { .compatible = "mediatek,mt2701-eth", .data = &mt2701_data }, ++ { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data }, ++ { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data }, ++ { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data }, ++ { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data }, ++ { .compatible = "mediatek,mt7981-eth", .data = &mt7981_data }, ++ { .compatible = "mediatek,mt7986-eth", .data = &mt7986_data }, ++ { .compatible = "mediatek,mt7988-eth", .data = &mt7988_data }, ++ { .compatible = "ralink,rt5350-eth", .data = &rt5350_data }, + {}, + }; + MODULE_DEVICE_TABLE(of, of_mtk_match); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -117,7 +117,8 @@ + #define MTK_CDMP_EG_CTRL 0x404 + + /* GDM Exgress Control Register */ +-#define MTK_GDMA_FWD_CFG(x) (0x500 + (x * 0x1000)) ++#define MTK_GDMA_FWD_CFG(x) ({ typeof(x) _x = (x); (_x == MTK_GMAC3_ID) ? \ ++ 0x540 : 0x500 + (_x * 0x1000); }) + #define MTK_GDMA_SPECIAL_TAG BIT(24) + #define MTK_GDMA_ICS_EN BIT(22) + #define MTK_GDMA_TCS_EN BIT(21) +@@ -126,6 +127,11 @@ + #define MTK_GDMA_TO_PDMA 0x0 + #define MTK_GDMA_DROP_ALL 0x7777 + ++/* GDM Egress Control Register */ ++#define MTK_GDMA_EG_CTRL(x) ({ typeof(x) _x = (x); (_x == MTK_GMAC3_ID) ? \ ++ 0x544 : 0x504 + (_x * 0x1000); }) ++#define MTK_GDMA_XGDM_SEL BIT(31) ++ + /* Unicast Filter MAC Address Register - Low */ + #define MTK_GDMA_MAC_ADRL(x) (0x508 + (x * 0x1000)) + +@@ -386,7 +392,26 @@ + #define PHY_IAC_TIMEOUT HZ + + #define MTK_MAC_MISC 0x1000c ++#define MTK_MAC_MISC_V3 0x10010 + #define MTK_MUX_TO_ESW BIT(0) ++#define MISC_MDC_TURBO BIT(4) ++ ++/* XMAC status registers */ ++#define MTK_XGMAC_STS(x) (((x) == MTK_GMAC3_ID) ? 0x1001C : 0x1000C) ++#define MTK_XGMAC_FORCE_LINK(x) (((x) == MTK_GMAC2_ID) ? BIT(31) : BIT(15)) ++#define MTK_USXGMII_PCS_LINK BIT(8) ++#define MTK_XGMAC_RX_FC BIT(5) ++#define MTK_XGMAC_TX_FC BIT(4) ++#define MTK_USXGMII_PCS_MODE GENMASK(3, 1) ++#define MTK_XGMAC_LINK_STS BIT(0) ++ ++/* GSW bridge registers */ ++#define MTK_GSW_CFG (0x10080) ++#define GSWTX_IPG_MASK GENMASK(19, 16) ++#define GSWTX_IPG_SHIFT 16 ++#define GSWRX_IPG_MASK GENMASK(3, 0) ++#define GSWRX_IPG_SHIFT 0 ++#define GSW_IPG_11 11 + + /* Mac control registers */ + #define MTK_MAC_MCR(x) (0x10100 + (x * 0x100)) +@@ -644,6 +669,11 @@ enum mtk_clks_map { + MTK_CLK_GP0, + MTK_CLK_GP1, + MTK_CLK_GP2, ++ MTK_CLK_GP3, ++ MTK_CLK_XGP1, ++ MTK_CLK_XGP2, ++ MTK_CLK_XGP3, ++ MTK_CLK_CRYPTO, + MTK_CLK_FE, + MTK_CLK_TRGPLL, + MTK_CLK_SGMII_TX_250M, +@@ -660,6 +690,27 @@ enum mtk_clks_map { + MTK_CLK_WOCPU1, + MTK_CLK_NETSYS0, + MTK_CLK_NETSYS1, ++ MTK_CLK_ETHWARP_WOCPU2, ++ MTK_CLK_ETHWARP_WOCPU1, ++ MTK_CLK_ETHWARP_WOCPU0, ++ MTK_CLK_TOP_USXGMII_SBUS_0_SEL, ++ MTK_CLK_TOP_USXGMII_SBUS_1_SEL, ++ MTK_CLK_TOP_SGM_0_SEL, ++ MTK_CLK_TOP_SGM_1_SEL, ++ MTK_CLK_TOP_XFI_PHY_0_XTAL_SEL, ++ MTK_CLK_TOP_XFI_PHY_1_XTAL_SEL, ++ MTK_CLK_TOP_ETH_GMII_SEL, ++ MTK_CLK_TOP_ETH_REFCK_50M_SEL, ++ MTK_CLK_TOP_ETH_SYS_200M_SEL, ++ MTK_CLK_TOP_ETH_SYS_SEL, ++ MTK_CLK_TOP_ETH_XGMII_SEL, ++ MTK_CLK_TOP_ETH_MII_SEL, ++ MTK_CLK_TOP_NETSYS_SEL, ++ MTK_CLK_TOP_NETSYS_500M_SEL, ++ MTK_CLK_TOP_NETSYS_PAO_2X_SEL, ++ MTK_CLK_TOP_NETSYS_SYNC_250M_SEL, ++ MTK_CLK_TOP_NETSYS_PPEFB_250M_SEL, ++ MTK_CLK_TOP_NETSYS_WARP_SEL, + MTK_CLK_MAX + }; + +@@ -713,6 +764,36 @@ enum mtk_clks_map { + BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ + BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ + BIT_ULL(MTK_CLK_SGMII2_CDR_FB)) ++#define MT7988_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_ESW) | \ ++ BIT_ULL(MTK_CLK_GP1) | BIT_ULL(MTK_CLK_GP2) | \ ++ BIT_ULL(MTK_CLK_GP3) | BIT_ULL(MTK_CLK_XGP1) | \ ++ BIT_ULL(MTK_CLK_XGP2) | BIT_ULL(MTK_CLK_XGP3) | \ ++ BIT_ULL(MTK_CLK_CRYPTO) | \ ++ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ ++ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ ++ BIT_ULL(MTK_CLK_ETHWARP_WOCPU2) | \ ++ BIT_ULL(MTK_CLK_ETHWARP_WOCPU1) | \ ++ BIT_ULL(MTK_CLK_ETHWARP_WOCPU0) | \ ++ BIT_ULL(MTK_CLK_TOP_USXGMII_SBUS_0_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_USXGMII_SBUS_1_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_SGM_0_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_SGM_1_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_XFI_PHY_0_XTAL_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_XFI_PHY_1_XTAL_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_GMII_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_REFCK_50M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_SYS_200M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_SYS_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_XGMII_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_ETH_MII_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_500M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_PAO_2X_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_SYNC_250M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_PPEFB_250M_SEL) | \ ++ BIT_ULL(MTK_CLK_TOP_NETSYS_WARP_SEL)) + + enum mtk_dev_state { + MTK_HW_INIT, +@@ -961,6 +1042,8 @@ enum mkt_eth_capabilities { + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ + MTK_RSTCTRL_PPE1) + ++#define MT7988_CAPS (MTK_GDM1_ESW | MTK_QDMA | MTK_RSTCTRL_PPE1) ++ + struct mtk_tx_dma_desc_info { + dma_addr_t addr; + u32 size; +@@ -1306,6 +1389,7 @@ void mtk_stats_update_mac(struct mtk_mac + + void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg); + u32 mtk_r32(struct mtk_eth *eth, unsigned reg); ++u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned int reg); + + int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id); + int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id); diff --git a/target/linux/generic/backport-5.15/750-v6.5-12-net-ethernet-mtk_eth_soc-enable-page_pool-support-fo.patch b/target/linux/generic/backport-5.15/750-v6.5-12-net-ethernet-mtk_eth_soc-enable-page_pool-support-fo.patch new file mode 100644 index 00000000000000..0a2bc6ae783c65 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-12-net-ethernet-mtk_eth_soc-enable-page_pool-support-fo.patch @@ -0,0 +1,27 @@ +From 38a7eb76220731eff40602cf433f24880be0a6c2 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Thu, 27 Jul 2023 09:02:26 +0200 +Subject: [PATCH 106/250] net: ethernet: mtk_eth_soc: enable page_pool support + for MT7988 SoC + +In order to recycle pages, enable page_pool allocator for MT7988 SoC. + +Tested-by: Daniel Golle +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/fd4e8693980e47385a543e7b002eec0b88bd09df.1690440675.git.lorenzo@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1613,7 +1613,7 @@ static void mtk_update_rx_cpu_idx(struct + + static bool mtk_page_pool_enabled(struct mtk_eth *eth) + { +- return eth->soc->version == 2; ++ return mtk_is_netsys_v2_or_greater(eth); + } + + static struct page_pool *mtk_create_page_pool(struct mtk_eth *eth, diff --git a/target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch b/target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch new file mode 100644 index 00000000000000..b32670d7a49604 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch @@ -0,0 +1,135 @@ +From 199e7d5a7f03dd377f3a7a458360dbedd71d50ba Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Thu, 27 Jul 2023 09:07:28 +0200 +Subject: [PATCH 107/250] net: ethernet: mtk_eth_soc: enable nft hw + flowtable_offload for MT7988 SoC + +Enable hw Packet Process Engine (PPE) for MT7988 SoC. + +Tested-by: Daniel Golle +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/5e86341b0220a49620dadc02d77970de5ded9efc.1690441576.git.lorenzo@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +++ + drivers/net/ethernet/mediatek/mtk_ppe.c | 19 +++++++++++++++---- + drivers/net/ethernet/mediatek/mtk_ppe.h | 19 ++++++++++++++++++- + 3 files changed, 36 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4974,6 +4974,9 @@ static const struct mtk_soc_data mt7988_ + .required_clks = MT7988_CLKS_BITMAP, + .required_pctl = false, + .version = 3, ++ .offload_version = 2, ++ .hash_offset = 4, ++ .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma_v2), + .rxd_size = sizeof(struct mtk_rx_dma_v2), +--- a/drivers/net/ethernet/mediatek/mtk_ppe.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -422,13 +422,22 @@ int mtk_foe_entry_set_wdma(struct mtk_et + struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); + u32 *ib2 = mtk_foe_entry_ib2(eth, entry); + +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ switch (eth->soc->version) { ++ case 3: ++ *ib2 &= ~MTK_FOE_IB2_PORT_MG_V2; ++ *ib2 |= FIELD_PREP(MTK_FOE_IB2_RX_IDX, txq) | ++ MTK_FOE_IB2_WDMA_WINFO_V2; ++ l2->w3info = FIELD_PREP(MTK_FOE_WINFO_WCID_V3, wcid) | ++ FIELD_PREP(MTK_FOE_WINFO_BSS_V3, bss); ++ break; ++ case 2: + *ib2 &= ~MTK_FOE_IB2_PORT_MG_V2; + *ib2 |= FIELD_PREP(MTK_FOE_IB2_RX_IDX, txq) | + MTK_FOE_IB2_WDMA_WINFO_V2; + l2->winfo = FIELD_PREP(MTK_FOE_WINFO_WCID, wcid) | + FIELD_PREP(MTK_FOE_WINFO_BSS, bss); +- } else { ++ break; ++ default: + *ib2 &= ~MTK_FOE_IB2_PORT_MG; + *ib2 |= MTK_FOE_IB2_WDMA_WINFO; + if (wdma_idx) +@@ -436,6 +445,7 @@ int mtk_foe_entry_set_wdma(struct mtk_et + l2->vlan2 = FIELD_PREP(MTK_FOE_VLAN2_WINFO_BSS, bss) | + FIELD_PREP(MTK_FOE_VLAN2_WINFO_WCID, wcid) | + FIELD_PREP(MTK_FOE_VLAN2_WINFO_RING, txq); ++ break; + } + + return 0; +@@ -956,8 +966,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) + mtk_ppe_init_foe_table(ppe); + ppe_w32(ppe, MTK_PPE_TB_BASE, ppe->foe_phys); + +- val = MTK_PPE_TB_CFG_ENTRY_80B | +- MTK_PPE_TB_CFG_AGE_NON_L4 | ++ val = MTK_PPE_TB_CFG_AGE_NON_L4 | + MTK_PPE_TB_CFG_AGE_UNBIND | + MTK_PPE_TB_CFG_AGE_TCP | + MTK_PPE_TB_CFG_AGE_UDP | +@@ -973,6 +982,8 @@ void mtk_ppe_start(struct mtk_ppe *ppe) + MTK_PPE_ENTRIES_SHIFT); + if (mtk_is_netsys_v2_or_greater(ppe->eth)) + val |= MTK_PPE_TB_CFG_INFO_SEL; ++ if (!mtk_is_netsys_v3_or_greater(ppe->eth)) ++ val |= MTK_PPE_TB_CFG_ENTRY_80B; + ppe_w32(ppe, MTK_PPE_TB_CFG, val); + + ppe_w32(ppe, MTK_PPE_IP_PROTO_CHK, +--- a/drivers/net/ethernet/mediatek/mtk_ppe.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.h +@@ -85,6 +85,17 @@ enum { + #define MTK_FOE_WINFO_BSS GENMASK(5, 0) + #define MTK_FOE_WINFO_WCID GENMASK(15, 6) + ++#define MTK_FOE_WINFO_BSS_V3 GENMASK(23, 16) ++#define MTK_FOE_WINFO_WCID_V3 GENMASK(15, 0) ++ ++#define MTK_FOE_WINFO_PAO_USR_INFO GENMASK(15, 0) ++#define MTK_FOE_WINFO_PAO_TID GENMASK(19, 16) ++#define MTK_FOE_WINFO_PAO_IS_FIXEDRATE BIT(20) ++#define MTK_FOE_WINFO_PAO_IS_PRIOR BIT(21) ++#define MTK_FOE_WINFO_PAO_IS_SP BIT(22) ++#define MTK_FOE_WINFO_PAO_HF BIT(23) ++#define MTK_FOE_WINFO_PAO_AMSDU_EN BIT(24) ++ + enum { + MTK_FOE_STATE_INVALID, + MTK_FOE_STATE_UNBIND, +@@ -106,8 +117,13 @@ struct mtk_foe_mac_info { + u16 pppoe_id; + u16 src_mac_lo; + ++ /* netsys_v2 */ + u16 minfo; + u16 winfo; ++ ++ /* netsys_v3 */ ++ u32 w3info; ++ u32 wpao; + }; + + /* software-only entry type */ +@@ -218,6 +234,7 @@ struct mtk_foe_ipv6_6rd { + + #define MTK_FOE_ENTRY_V1_SIZE 80 + #define MTK_FOE_ENTRY_V2_SIZE 96 ++#define MTK_FOE_ENTRY_V3_SIZE 128 + + struct mtk_foe_entry { + u32 ib1; +@@ -228,7 +245,7 @@ struct mtk_foe_entry { + struct mtk_foe_ipv4_dslite dslite; + struct mtk_foe_ipv6 ipv6; + struct mtk_foe_ipv6_6rd ipv6_6rd; +- u32 data[23]; ++ u32 data[31]; + }; + }; + diff --git a/target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch b/target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch new file mode 100644 index 00000000000000..f314550af64c31 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch @@ -0,0 +1,78 @@ +From 0c024632c1e7ff69914329bfd87bec749b9c0aed Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 2 Aug 2023 04:31:09 +0100 +Subject: [PATCH 108/250] net: ethernet: mtk_eth_soc: support per-flow + accounting on MT7988 + +NETSYS_V3 uses 64 bits for each counters while older SoCs are using +48/40 bits for each counter. +Support reading per-flow byte and package counters on NETSYS_V3. + +Signed-off-by: Daniel Golle +Reviewed-by: Simon Horman +Link: https://lore.kernel.org/r/37a0928fa8c1253b197884c68ce1f54239421ac5.1690946442.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + + drivers/net/ethernet/mediatek/mtk_ppe.c | 21 +++++++++++++------- + drivers/net/ethernet/mediatek/mtk_ppe_regs.h | 2 ++ + 3 files changed, 17 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4976,6 +4976,7 @@ static const struct mtk_soc_data mt7988_ + .version = 3, + .offload_version = 2, + .hash_offset = 4, ++ .has_accounting = true, + .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma_v2), +--- a/drivers/net/ethernet/mediatek/mtk_ppe.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -91,7 +91,6 @@ static int mtk_ppe_mib_wait_busy(struct + + static int mtk_mib_entry_read(struct mtk_ppe *ppe, u16 index, u64 *bytes, u64 *packets) + { +- u32 byte_cnt_low, byte_cnt_high, pkt_cnt_low, pkt_cnt_high; + u32 val, cnt_r0, cnt_r1, cnt_r2; + int ret; + +@@ -106,12 +105,20 @@ static int mtk_mib_entry_read(struct mtk + cnt_r1 = readl(ppe->base + MTK_PPE_MIB_SER_R1); + cnt_r2 = readl(ppe->base + MTK_PPE_MIB_SER_R2); + +- byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); +- byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); +- pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); +- pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); +- *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; +- *packets = (pkt_cnt_high << 16) | pkt_cnt_low; ++ if (mtk_is_netsys_v3_or_greater(ppe->eth)) { ++ /* 64 bit for each counter */ ++ u32 cnt_r3 = readl(ppe->base + MTK_PPE_MIB_SER_R3); ++ *bytes = ((u64)cnt_r1 << 32) | cnt_r0; ++ *packets = ((u64)cnt_r3 << 32) | cnt_r2; ++ } else { ++ /* 48 bit byte counter, 40 bit packet counter */ ++ u32 byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); ++ u32 byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); ++ u32 pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); ++ u32 pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); ++ *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; ++ *packets = (pkt_cnt_high << 16) | pkt_cnt_low; ++ } + + return 0; + } +--- a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h +@@ -163,6 +163,8 @@ enum { + #define MTK_PPE_MIB_SER_R2 0x348 + #define MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH GENMASK(23, 0) + ++#define MTK_PPE_MIB_SER_R3 0x34c ++ + #define MTK_PPE_MIB_CACHE_CTL 0x350 + #define MTK_PPE_MIB_CACHE_CTL_EN BIT(0) + #define MTK_PPE_MIB_CACHE_CTL_FLUSH BIT(2) diff --git a/target/linux/generic/backport-5.15/750-v6.5-15-net-ethernet-mtk_eth_soc-fix-NULL-pointer-on-hw-rese.patch b/target/linux/generic/backport-5.15/750-v6.5-15-net-ethernet-mtk_eth_soc-fix-NULL-pointer-on-hw-rese.patch new file mode 100644 index 00000000000000..6f1639a5720abc --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-15-net-ethernet-mtk_eth_soc-fix-NULL-pointer-on-hw-rese.patch @@ -0,0 +1,52 @@ +From 3b12f42772c26869d60398c1710aa27b27cd945c Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 21 Aug 2023 17:12:44 +0100 +Subject: [PATCH 109/250] net: ethernet: mtk_eth_soc: fix NULL pointer on hw + reset + +When a hardware reset is triggered on devices not initializing WED the +calls to mtk_wed_fe_reset and mtk_wed_fe_reset_complete dereference a +pointer on uninitialized stack memory. +Break out of both functions in case a hw_list entry is 0. + +Fixes: 08a764a7c51b ("net: ethernet: mtk_wed: add reset/reset_complete callbacks") +Signed-off-by: Daniel Golle +Reviewed-by: Simon Horman +Acked-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/5465c1609b464cc7407ae1530c40821dcdf9d3e6.1692634266.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_wed.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_wed.c ++++ b/drivers/net/ethernet/mediatek/mtk_wed.c +@@ -214,9 +214,13 @@ void mtk_wed_fe_reset(void) + + for (i = 0; i < ARRAY_SIZE(hw_list); i++) { + struct mtk_wed_hw *hw = hw_list[i]; +- struct mtk_wed_device *dev = hw->wed_dev; ++ struct mtk_wed_device *dev; + int err; + ++ if (!hw) ++ break; ++ ++ dev = hw->wed_dev; + if (!dev || !dev->wlan.reset) + continue; + +@@ -237,8 +241,12 @@ void mtk_wed_fe_reset_complete(void) + + for (i = 0; i < ARRAY_SIZE(hw_list); i++) { + struct mtk_wed_hw *hw = hw_list[i]; +- struct mtk_wed_device *dev = hw->wed_dev; ++ struct mtk_wed_device *dev; ++ ++ if (!hw) ++ break; + ++ dev = hw->wed_dev; + if (!dev || !dev->wlan.reset_complete) + continue; + diff --git a/target/linux/generic/backport-5.15/750-v6.5-16-net-ethernet-mtk_eth_soc-fix-register-definitions-fo.patch b/target/linux/generic/backport-5.15/750-v6.5-16-net-ethernet-mtk_eth_soc-fix-register-definitions-fo.patch new file mode 100644 index 00000000000000..35977946d369e6 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-16-net-ethernet-mtk_eth_soc-fix-register-definitions-fo.patch @@ -0,0 +1,44 @@ +From 489aea123d74a846ce746bfdb3efe1e7ad512e0d Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 22 Aug 2023 17:31:24 +0100 +Subject: [PATCH 110/250] net: ethernet: mtk_eth_soc: fix register definitions + for MT7988 + +More register macros need to be adjusted for the 3rd GMAC on MT7988. +Account for added bit in SYSCFG0_SGMII_MASK. + +Fixes: 445eb6448ed3 ("net: ethernet: mtk_eth_soc: add basic support for MT7988 SoC") +Signed-off-by: Daniel Golle +Reviewed-by: Simon Horman +Link: https://lore.kernel.org/r/1c8da012e2ca80939906d85f314138c552139f0f.1692721443.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -133,10 +133,12 @@ + #define MTK_GDMA_XGDM_SEL BIT(31) + + /* Unicast Filter MAC Address Register - Low */ +-#define MTK_GDMA_MAC_ADRL(x) (0x508 + (x * 0x1000)) ++#define MTK_GDMA_MAC_ADRL(x) ({ typeof(x) _x = (x); (_x == MTK_GMAC3_ID) ? \ ++ 0x548 : 0x508 + (_x * 0x1000); }) + + /* Unicast Filter MAC Address Register - High */ +-#define MTK_GDMA_MAC_ADRH(x) (0x50C + (x * 0x1000)) ++#define MTK_GDMA_MAC_ADRH(x) ({ typeof(x) _x = (x); (_x == MTK_GMAC3_ID) ? \ ++ 0x54C : 0x50C + (_x * 0x1000); }) + + /* FE global misc reg*/ + #define MTK_FE_GLO_MISC 0x124 +@@ -500,7 +502,7 @@ + #define ETHSYS_SYSCFG0 0x14 + #define SYSCFG0_GE_MASK 0x3 + #define SYSCFG0_GE_MODE(x, y) (x << (12 + (y * 2))) +-#define SYSCFG0_SGMII_MASK GENMASK(9, 8) ++#define SYSCFG0_SGMII_MASK GENMASK(9, 7) + #define SYSCFG0_SGMII_GMAC1 ((2 << 8) & SYSCFG0_SGMII_MASK) + #define SYSCFG0_SGMII_GMAC2 ((3 << 8) & SYSCFG0_SGMII_MASK) + #define SYSCFG0_SGMII_GMAC1_V2 BIT(9) diff --git a/target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch b/target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch new file mode 100644 index 00000000000000..5f6651b7b02cf0 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch @@ -0,0 +1,188 @@ +From 15a84d1c44ae8c1451c265ee60500588a24e8cd6 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 22 Aug 2023 17:32:03 +0100 +Subject: [PATCH 111/250] net: ethernet: mtk_eth_soc: add reset bits for MT7988 + +Add bits needed to reset the frame engine on MT7988. + +Fixes: 445eb6448ed3 ("net: ethernet: mtk_eth_soc: add basic support for MT7988 SoC") +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/89b6c38380e7a3800c1362aa7575600717bc7543.1692721443.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 76 +++++++++++++++------ + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 16 +++-- + 2 files changed, 68 insertions(+), 24 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -3538,19 +3538,34 @@ static void mtk_hw_reset(struct mtk_eth + { + u32 val; + +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ if (mtk_is_netsys_v2_or_greater(eth)) + regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0); ++ ++ if (mtk_is_netsys_v3_or_greater(eth)) { ++ val = RSTCTRL_PPE0_V3; ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) ++ val |= RSTCTRL_PPE1_V3; ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE2)) ++ val |= RSTCTRL_PPE2; ++ ++ val |= RSTCTRL_WDMA0 | RSTCTRL_WDMA1 | RSTCTRL_WDMA2; ++ } else if (mtk_is_netsys_v2_or_greater(eth)) { + val = RSTCTRL_PPE0_V2; ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) ++ val |= RSTCTRL_PPE1; + } else { + val = RSTCTRL_PPE0; + } + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) +- val |= RSTCTRL_PPE1; +- + ethsys_reset(eth, RSTCTRL_ETH | RSTCTRL_FE | val); + +- if (mtk_is_netsys_v2_or_greater(eth)) ++ if (mtk_is_netsys_v3_or_greater(eth)) ++ regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, ++ 0x6f8ff); ++ else if (mtk_is_netsys_v2_or_greater(eth)) + regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, + 0x3ffffff); + } +@@ -3576,13 +3591,21 @@ static void mtk_hw_warm_reset(struct mtk + return; + } + +- if (mtk_is_netsys_v2_or_greater(eth)) ++ if (mtk_is_netsys_v3_or_greater(eth)) { ++ rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0_V3; ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) ++ rst_mask |= RSTCTRL_PPE1_V3; ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE2)) ++ rst_mask |= RSTCTRL_PPE2; ++ ++ rst_mask |= RSTCTRL_WDMA0 | RSTCTRL_WDMA1 | RSTCTRL_WDMA2; ++ } else if (mtk_is_netsys_v2_or_greater(eth)) { + rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0_V2; +- else ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) ++ rst_mask |= RSTCTRL_PPE1; ++ } else { + rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0; +- +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) +- rst_mask |= RSTCTRL_PPE1; ++ } + + regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL, rst_mask, rst_mask); + +@@ -3934,11 +3957,17 @@ static void mtk_prepare_for_reset(struct + u32 val; + int i; + +- /* disabe FE P3 and P4 */ +- val = mtk_r32(eth, MTK_FE_GLO_CFG) | MTK_FE_LINK_DOWN_P3; +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) +- val |= MTK_FE_LINK_DOWN_P4; +- mtk_w32(eth, val, MTK_FE_GLO_CFG); ++ /* set FE PPE ports link down */ ++ for (i = MTK_GMAC1_ID; ++ i <= (mtk_is_netsys_v3_or_greater(eth) ? MTK_GMAC3_ID : MTK_GMAC2_ID); ++ i += 2) { ++ val = mtk_r32(eth, MTK_FE_GLO_CFG(i)) | MTK_FE_LINK_DOWN_P(PSE_PPE0_PORT); ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) ++ val |= MTK_FE_LINK_DOWN_P(PSE_PPE1_PORT); ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE2)) ++ val |= MTK_FE_LINK_DOWN_P(PSE_PPE2_PORT); ++ mtk_w32(eth, val, MTK_FE_GLO_CFG(i)); ++ } + + /* adjust PPE configurations to prepare for reset */ + for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) +@@ -3999,11 +4028,18 @@ static void mtk_pending_work(struct work + } + } + +- /* enabe FE P3 and P4 */ +- val = mtk_r32(eth, MTK_FE_GLO_CFG) & ~MTK_FE_LINK_DOWN_P3; +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) +- val &= ~MTK_FE_LINK_DOWN_P4; +- mtk_w32(eth, val, MTK_FE_GLO_CFG); ++ /* set FE PPE ports link up */ ++ for (i = MTK_GMAC1_ID; ++ i <= (mtk_is_netsys_v3_or_greater(eth) ? MTK_GMAC3_ID : MTK_GMAC2_ID); ++ i += 2) { ++ val = mtk_r32(eth, MTK_FE_GLO_CFG(i)) & ~MTK_FE_LINK_DOWN_P(PSE_PPE0_PORT); ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE1)) ++ val &= ~MTK_FE_LINK_DOWN_P(PSE_PPE1_PORT); ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSTCTRL_PPE2)) ++ val &= ~MTK_FE_LINK_DOWN_P(PSE_PPE2_PORT); ++ ++ mtk_w32(eth, val, MTK_FE_GLO_CFG(i)); ++ } + + clear_bit(MTK_RESETTING, ð->state); + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -76,9 +76,8 @@ + #define MTK_HW_LRO_SDL_REMAIN_ROOM 1522 + + /* Frame Engine Global Configuration */ +-#define MTK_FE_GLO_CFG 0x00 +-#define MTK_FE_LINK_DOWN_P3 BIT(11) +-#define MTK_FE_LINK_DOWN_P4 BIT(12) ++#define MTK_FE_GLO_CFG(x) (((x) == MTK_GMAC3_ID) ? 0x24 : 0x00) ++#define MTK_FE_LINK_DOWN_P(x) BIT(((x) + 8) % 16) + + /* Frame Engine Global Reset Register */ + #define MTK_RST_GL 0x04 +@@ -519,9 +518,15 @@ + /* ethernet reset control register */ + #define ETHSYS_RSTCTRL 0x34 + #define RSTCTRL_FE BIT(6) ++#define RSTCTRL_WDMA0 BIT(24) ++#define RSTCTRL_WDMA1 BIT(25) ++#define RSTCTRL_WDMA2 BIT(26) + #define RSTCTRL_PPE0 BIT(31) + #define RSTCTRL_PPE0_V2 BIT(30) + #define RSTCTRL_PPE1 BIT(31) ++#define RSTCTRL_PPE0_V3 BIT(29) ++#define RSTCTRL_PPE1_V3 BIT(30) ++#define RSTCTRL_PPE2 BIT(31) + #define RSTCTRL_ETH BIT(23) + + /* ethernet reset check idle register */ +@@ -928,6 +933,7 @@ enum mkt_eth_capabilities { + MTK_QDMA_BIT, + MTK_SOC_MT7628_BIT, + MTK_RSTCTRL_PPE1_BIT, ++ MTK_RSTCTRL_PPE2_BIT, + MTK_U3_COPHY_V2_BIT, + + /* MUX BITS*/ +@@ -962,6 +968,7 @@ enum mkt_eth_capabilities { + #define MTK_QDMA BIT_ULL(MTK_QDMA_BIT) + #define MTK_SOC_MT7628 BIT_ULL(MTK_SOC_MT7628_BIT) + #define MTK_RSTCTRL_PPE1 BIT_ULL(MTK_RSTCTRL_PPE1_BIT) ++#define MTK_RSTCTRL_PPE2 BIT_ULL(MTK_RSTCTRL_PPE2_BIT) + #define MTK_U3_COPHY_V2 BIT_ULL(MTK_U3_COPHY_V2_BIT) + + #define MTK_ETH_MUX_GDM1_TO_GMAC1_ESW \ +@@ -1044,7 +1051,8 @@ enum mkt_eth_capabilities { + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ + MTK_RSTCTRL_PPE1) + +-#define MT7988_CAPS (MTK_GDM1_ESW | MTK_QDMA | MTK_RSTCTRL_PPE1) ++#define MT7988_CAPS (MTK_GDM1_ESW | MTK_QDMA | MTK_RSTCTRL_PPE1 | \ ++ MTK_RSTCTRL_PPE2) + + struct mtk_tx_dma_desc_info { + dma_addr_t addr; diff --git a/target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch b/target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch new file mode 100644 index 00000000000000..67ba1a5f0a57cb --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch @@ -0,0 +1,254 @@ +From 25ce45fe40b574e5d7ffa407f7f2db03e7d5a910 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 22 Aug 2023 17:32:54 +0100 +Subject: [PATCH 112/250] net: ethernet: mtk_eth_soc: add support for in-SoC + SRAM + +MT7981, MT7986 and MT7988 come with in-SoC SRAM dedicated for Ethernet +DMA rings. Support using the SRAM without breaking existing device tree +bindings, ie. only new SoC starting from MT7988 will have the SRAM +declared as additional resource in device tree. For MT7981 and MT7986 +an offset on top of the main I/O base is used. + +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/e45e0f230c63ad58869e8fe35b95a2fb8925b625.1692721443.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 88 ++++++++++++++++----- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 12 ++- + 2 files changed, 78 insertions(+), 22 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1075,10 +1075,13 @@ static int mtk_init_fq_dma(struct mtk_et + dma_addr_t dma_addr; + int i; + +- eth->scratch_ring = dma_alloc_coherent(eth->dma_dev, +- cnt * soc->txrx.txd_size, +- ð->phy_scratch_ring, +- GFP_KERNEL); ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM)) ++ eth->scratch_ring = eth->sram_base; ++ else ++ eth->scratch_ring = dma_alloc_coherent(eth->dma_dev, ++ cnt * soc->txrx.txd_size, ++ ð->phy_scratch_ring, ++ GFP_KERNEL); + if (unlikely(!eth->scratch_ring)) + return -ENOMEM; + +@@ -2376,8 +2379,14 @@ static int mtk_tx_alloc(struct mtk_eth * + if (!ring->buf) + goto no_tx_mem; + +- ring->dma = dma_alloc_coherent(eth->dma_dev, ring_size * sz, +- &ring->phys, GFP_KERNEL); ++ if (MTK_HAS_CAPS(soc->caps, MTK_SRAM)) { ++ ring->dma = eth->sram_base + ring_size * sz; ++ ring->phys = eth->phy_scratch_ring + ring_size * (dma_addr_t)sz; ++ } else { ++ ring->dma = dma_alloc_coherent(eth->dma_dev, ring_size * sz, ++ &ring->phys, GFP_KERNEL); ++ } ++ + if (!ring->dma) + goto no_tx_mem; + +@@ -2476,8 +2485,7 @@ static void mtk_tx_clean(struct mtk_eth + kfree(ring->buf); + ring->buf = NULL; + } +- +- if (ring->dma) { ++ if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && ring->dma) { + dma_free_coherent(eth->dma_dev, + ring->dma_size * soc->txrx.txd_size, + ring->dma, ring->phys); +@@ -2496,9 +2504,14 @@ static int mtk_rx_alloc(struct mtk_eth * + { + const struct mtk_reg_map *reg_map = eth->soc->reg_map; + struct mtk_rx_ring *ring; +- int rx_data_len, rx_dma_size; ++ int rx_data_len, rx_dma_size, tx_ring_size; + int i; + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) ++ tx_ring_size = MTK_QDMA_RING_SIZE; ++ else ++ tx_ring_size = MTK_DMA_SIZE; ++ + if (rx_flag == MTK_RX_FLAGS_QDMA) { + if (ring_no) + return -EINVAL; +@@ -2533,9 +2546,20 @@ static int mtk_rx_alloc(struct mtk_eth * + ring->page_pool = pp; + } + +- ring->dma = dma_alloc_coherent(eth->dma_dev, +- rx_dma_size * eth->soc->txrx.rxd_size, +- &ring->phys, GFP_KERNEL); ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM) || ++ rx_flag != MTK_RX_FLAGS_NORMAL) { ++ ring->dma = dma_alloc_coherent(eth->dma_dev, ++ rx_dma_size * eth->soc->txrx.rxd_size, ++ &ring->phys, GFP_KERNEL); ++ } else { ++ struct mtk_tx_ring *tx_ring = ð->tx_ring; ++ ++ ring->dma = tx_ring->dma + tx_ring_size * ++ eth->soc->txrx.txd_size * (ring_no + 1); ++ ring->phys = tx_ring->phys + tx_ring_size * ++ eth->soc->txrx.txd_size * (ring_no + 1); ++ } ++ + if (!ring->dma) + return -ENOMEM; + +@@ -2618,7 +2642,7 @@ static int mtk_rx_alloc(struct mtk_eth * + return 0; + } + +-static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring) ++static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring, bool in_sram) + { + int i; + +@@ -2641,7 +2665,7 @@ static void mtk_rx_clean(struct mtk_eth + ring->data = NULL; + } + +- if (ring->dma) { ++ if (!in_sram && ring->dma) { + dma_free_coherent(eth->dma_dev, + ring->dma_size * eth->soc->txrx.rxd_size, + ring->dma, ring->phys); +@@ -3001,7 +3025,7 @@ static void mtk_dma_free(struct mtk_eth + for (i = 0; i < MTK_MAX_DEVS; i++) + if (eth->netdev[i]) + netdev_reset_queue(eth->netdev[i]); +- if (eth->scratch_ring) { ++ if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && eth->scratch_ring) { + dma_free_coherent(eth->dma_dev, + MTK_QDMA_RING_SIZE * soc->txrx.txd_size, + eth->scratch_ring, eth->phy_scratch_ring); +@@ -3009,13 +3033,13 @@ static void mtk_dma_free(struct mtk_eth + eth->phy_scratch_ring = 0; + } + mtk_tx_clean(eth); +- mtk_rx_clean(eth, ð->rx_ring[0]); +- mtk_rx_clean(eth, ð->rx_ring_qdma); ++ mtk_rx_clean(eth, ð->rx_ring[0], MTK_HAS_CAPS(soc->caps, MTK_SRAM)); ++ mtk_rx_clean(eth, ð->rx_ring_qdma, false); + + if (eth->hwlro) { + mtk_hwlro_rx_uninit(eth); + for (i = 1; i < MTK_MAX_RX_RING_NUM; i++) +- mtk_rx_clean(eth, ð->rx_ring[i]); ++ mtk_rx_clean(eth, ð->rx_ring[i], false); + } + + kfree(eth->scratch_head); +@@ -4585,7 +4609,7 @@ static int mtk_sgmii_init(struct mtk_eth + + static int mtk_probe(struct platform_device *pdev) + { +- struct resource *res = NULL; ++ struct resource *res = NULL, *res_sram; + struct device_node *mac_np; + struct mtk_eth *eth; + int err, i; +@@ -4605,6 +4629,20 @@ static int mtk_probe(struct platform_dev + if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) + eth->ip_align = NET_IP_ALIGN; + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM)) { ++ /* SRAM is actual memory and supports transparent access just like DRAM. ++ * Hence we don't require __iomem being set and don't need to use accessor ++ * functions to read from or write to SRAM. ++ */ ++ if (mtk_is_netsys_v3_or_greater(eth)) { ++ eth->sram_base = (void __force *)devm_platform_ioremap_resource(pdev, 1); ++ if (IS_ERR(eth->sram_base)) ++ return PTR_ERR(eth->sram_base); ++ } else { ++ eth->sram_base = (void __force *)eth->base + MTK_ETH_SRAM_OFFSET; ++ } ++ } ++ + spin_lock_init(ð->page_lock); + spin_lock_init(ð->tx_irq_lock); + spin_lock_init(ð->rx_irq_lock); +@@ -4668,6 +4706,18 @@ static int mtk_probe(struct platform_dev + err = -EINVAL; + goto err_destroy_sgmii; + } ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { ++ res_sram = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ if (!res_sram) { ++ err = -EINVAL; ++ goto err_destroy_sgmii; ++ } ++ eth->phy_scratch_ring = res_sram->start; ++ } else { ++ eth->phy_scratch_ring = res->start + MTK_ETH_SRAM_OFFSET; ++ } ++ } + } + + if (eth->soc->offload_version) { +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -139,6 +139,9 @@ + #define MTK_GDMA_MAC_ADRH(x) ({ typeof(x) _x = (x); (_x == MTK_GMAC3_ID) ? \ + 0x54C : 0x50C + (_x * 0x1000); }) + ++/* Internal SRAM offset */ ++#define MTK_ETH_SRAM_OFFSET 0x40000 ++ + /* FE global misc reg*/ + #define MTK_FE_GLO_MISC 0x124 + +@@ -935,6 +938,7 @@ enum mkt_eth_capabilities { + MTK_RSTCTRL_PPE1_BIT, + MTK_RSTCTRL_PPE2_BIT, + MTK_U3_COPHY_V2_BIT, ++ MTK_SRAM_BIT, + + /* MUX BITS*/ + MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT, +@@ -970,6 +974,7 @@ enum mkt_eth_capabilities { + #define MTK_RSTCTRL_PPE1 BIT_ULL(MTK_RSTCTRL_PPE1_BIT) + #define MTK_RSTCTRL_PPE2 BIT_ULL(MTK_RSTCTRL_PPE2_BIT) + #define MTK_U3_COPHY_V2 BIT_ULL(MTK_U3_COPHY_V2_BIT) ++#define MTK_SRAM BIT_ULL(MTK_SRAM_BIT) + + #define MTK_ETH_MUX_GDM1_TO_GMAC1_ESW \ + BIT_ULL(MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT) +@@ -1045,14 +1050,14 @@ enum mkt_eth_capabilities { + #define MT7981_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \ + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ + MTK_MUX_U3_GMAC2_TO_QPHY | MTK_U3_COPHY_V2 | \ +- MTK_RSTCTRL_PPE1) ++ MTK_RSTCTRL_PPE1 | MTK_SRAM) + + #define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ +- MTK_RSTCTRL_PPE1) ++ MTK_RSTCTRL_PPE1 | MTK_SRAM) + + #define MT7988_CAPS (MTK_GDM1_ESW | MTK_QDMA | MTK_RSTCTRL_PPE1 | \ +- MTK_RSTCTRL_PPE2) ++ MTK_RSTCTRL_PPE2 | MTK_SRAM) + + struct mtk_tx_dma_desc_info { + dma_addr_t addr; +@@ -1212,6 +1217,7 @@ struct mtk_eth { + struct device *dev; + struct device *dma_dev; + void __iomem *base; ++ void *sram_base; + spinlock_t page_lock; + spinlock_t tx_irq_lock; + spinlock_t rx_irq_lock; diff --git a/target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch b/target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch new file mode 100644 index 00000000000000..175db56c37bf8c --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch @@ -0,0 +1,166 @@ +From 0b0d606eb9650fa01dd5621e072aa29a10544399 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 22 Aug 2023 17:33:12 +0100 +Subject: [PATCH 113/250] net: ethernet: mtk_eth_soc: support 36-bit DMA + addressing on MT7988 + +Systems having 4 GiB of RAM and more require DMA addressing beyond the +current 32-bit limit. Starting from MT7988 the hardware now supports +36-bit DMA addressing, let's use that new capability in the driver to +avoid running into swiotlb on systems with 4 GiB of RAM or more. + +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/95b919c98876c9e49761e44662e7c937479eecb8.1692721443.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 30 +++++++++++++++++++-- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 22 +++++++++++++-- + 2 files changed, 48 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1266,6 +1266,10 @@ static void mtk_tx_set_dma_desc_v2(struc + data = TX_DMA_PLEN0(info->size); + if (info->last) + data |= TX_DMA_LS0; ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) ++ data |= TX_DMA_PREP_ADDR64(info->addr); ++ + WRITE_ONCE(desc->txd3, data); + + /* set forward port */ +@@ -1933,6 +1937,7 @@ static int mtk_poll_rx(struct napi_struc + bool xdp_flush = false; + int idx; + struct sk_buff *skb; ++ u64 addr64 = 0; + u8 *data, *new_data; + struct mtk_rx_dma_v2 *rxd, trxd; + int done = 0, bytes = 0; +@@ -2048,7 +2053,10 @@ static int mtk_poll_rx(struct napi_struc + goto release_desc; + } + +- dma_unmap_single(eth->dma_dev, trxd.rxd1, ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) ++ addr64 = RX_DMA_GET_ADDR64(trxd.rxd2); ++ ++ dma_unmap_single(eth->dma_dev, ((u64)trxd.rxd1 | addr64), + ring->buf_size, DMA_FROM_DEVICE); + + skb = build_skb(data, ring->frag_size); +@@ -2114,6 +2122,9 @@ release_desc: + else + rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size); + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) ++ rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr); ++ + ring->calc_idx = idx; + done++; + } +@@ -2598,6 +2609,9 @@ static int mtk_rx_alloc(struct mtk_eth * + else + rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size); + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) ++ rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr); ++ + rxd->rxd3 = 0; + rxd->rxd4 = 0; + if (mtk_is_netsys_v2_or_greater(eth)) { +@@ -2644,6 +2658,7 @@ static int mtk_rx_alloc(struct mtk_eth * + + static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring, bool in_sram) + { ++ u64 addr64 = 0; + int i; + + if (ring->data && ring->dma) { +@@ -2657,7 +2672,10 @@ static void mtk_rx_clean(struct mtk_eth + if (!rxd->rxd1) + continue; + +- dma_unmap_single(eth->dma_dev, rxd->rxd1, ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) ++ addr64 = RX_DMA_GET_ADDR64(rxd->rxd2); ++ ++ dma_unmap_single(eth->dma_dev, ((u64)rxd->rxd1 | addr64), + ring->buf_size, DMA_FROM_DEVICE); + mtk_rx_put_buff(ring, ring->data[i], false); + } +@@ -4643,6 +4661,14 @@ static int mtk_probe(struct platform_dev + } + } + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) { ++ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36)); ++ if (err) { ++ dev_err(&pdev->dev, "Wrong DMA config\n"); ++ return -EINVAL; ++ } ++ } ++ + spin_lock_init(ð->page_lock); + spin_lock_init(ð->tx_irq_lock); + spin_lock_init(ð->rx_irq_lock); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -331,6 +331,14 @@ + #define TX_DMA_PLEN1(x) ((x) & eth->soc->txrx.dma_max_len) + #define TX_DMA_SWC BIT(14) + #define TX_DMA_PQID GENMASK(3, 0) ++#define TX_DMA_ADDR64_MASK GENMASK(3, 0) ++#if IS_ENABLED(CONFIG_64BIT) ++# define TX_DMA_GET_ADDR64(x) (((u64)FIELD_GET(TX_DMA_ADDR64_MASK, (x))) << 32) ++# define TX_DMA_PREP_ADDR64(x) FIELD_PREP(TX_DMA_ADDR64_MASK, ((x) >> 32)) ++#else ++# define TX_DMA_GET_ADDR64(x) (0) ++# define TX_DMA_PREP_ADDR64(x) (0) ++#endif + + /* PDMA on MT7628 */ + #define TX_DMA_DONE BIT(31) +@@ -343,6 +351,14 @@ + #define RX_DMA_PREP_PLEN0(x) (((x) & eth->soc->txrx.dma_max_len) << eth->soc->txrx.dma_len_offset) + #define RX_DMA_GET_PLEN0(x) (((x) >> eth->soc->txrx.dma_len_offset) & eth->soc->txrx.dma_max_len) + #define RX_DMA_VTAG BIT(15) ++#define RX_DMA_ADDR64_MASK GENMASK(3, 0) ++#if IS_ENABLED(CONFIG_64BIT) ++# define RX_DMA_GET_ADDR64(x) (((u64)FIELD_GET(RX_DMA_ADDR64_MASK, (x))) << 32) ++# define RX_DMA_PREP_ADDR64(x) FIELD_PREP(RX_DMA_ADDR64_MASK, ((x) >> 32)) ++#else ++# define RX_DMA_GET_ADDR64(x) (0) ++# define RX_DMA_PREP_ADDR64(x) (0) ++#endif + + /* QDMA descriptor rxd3 */ + #define RX_DMA_VID(x) ((x) & VLAN_VID_MASK) +@@ -939,6 +955,7 @@ enum mkt_eth_capabilities { + MTK_RSTCTRL_PPE2_BIT, + MTK_U3_COPHY_V2_BIT, + MTK_SRAM_BIT, ++ MTK_36BIT_DMA_BIT, + + /* MUX BITS*/ + MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT, +@@ -975,6 +992,7 @@ enum mkt_eth_capabilities { + #define MTK_RSTCTRL_PPE2 BIT_ULL(MTK_RSTCTRL_PPE2_BIT) + #define MTK_U3_COPHY_V2 BIT_ULL(MTK_U3_COPHY_V2_BIT) + #define MTK_SRAM BIT_ULL(MTK_SRAM_BIT) ++#define MTK_36BIT_DMA BIT_ULL(MTK_36BIT_DMA_BIT) + + #define MTK_ETH_MUX_GDM1_TO_GMAC1_ESW \ + BIT_ULL(MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT) +@@ -1056,8 +1074,8 @@ enum mkt_eth_capabilities { + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ + MTK_RSTCTRL_PPE1 | MTK_SRAM) + +-#define MT7988_CAPS (MTK_GDM1_ESW | MTK_QDMA | MTK_RSTCTRL_PPE1 | \ +- MTK_RSTCTRL_PPE2 | MTK_SRAM) ++#define MT7988_CAPS (MTK_36BIT_DMA | MTK_GDM1_ESW | MTK_QDMA | \ ++ MTK_RSTCTRL_PPE1 | MTK_RSTCTRL_PPE2 | MTK_SRAM) + + struct mtk_tx_dma_desc_info { + dma_addr_t addr; diff --git a/target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch b/target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch new file mode 100644 index 00000000000000..cda77e3e2d83ad --- /dev/null +++ b/target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch @@ -0,0 +1,81 @@ +From bfac8c490d605bea03b1f1927582b6f396462164 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 27 Jun 2022 12:44:43 +0100 +Subject: [PATCH] net: phylink: disable PCS polling over major configuration + +While we are performing a major configuration, there is no point having +the PCS polling timer running. Stop it before we begin preparing for +the configuration change, and restart it only once we've successfully +completed the change. + +Reviewed-by: Andrew Lunn +Signed-off-by: Russell King (Oracle) +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/phylink.c | 30 ++++++++++++++++++++---------- + 1 file changed, 20 insertions(+), 10 deletions(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -756,6 +756,18 @@ static void phylink_resolve_flow(struct + } + } + ++static void phylink_pcs_poll_stop(struct phylink *pl) ++{ ++ if (pl->cfg_link_an_mode == MLO_AN_INBAND) ++ del_timer(&pl->link_poll); ++} ++ ++static void phylink_pcs_poll_start(struct phylink *pl) ++{ ++ if (pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) ++ mod_timer(&pl->link_poll, jiffies + HZ); ++} ++ + static void phylink_mac_config(struct phylink *pl, + const struct phylink_link_state *state) + { +@@ -787,6 +799,7 @@ static void phylink_major_config(struct + const struct phylink_link_state *state) + { + struct phylink_pcs *pcs = NULL; ++ bool pcs_changed = false; + int err; + + phylink_dbg(pl, "major config %s\n", phy_modes(state->interface)); +@@ -799,8 +812,12 @@ static void phylink_major_config(struct + pcs); + return; + } ++ ++ pcs_changed = pcs && pl->pcs != pcs; + } + ++ phylink_pcs_poll_stop(pl); ++ + if (pl->mac_ops->mac_prepare) { + err = pl->mac_ops->mac_prepare(pl->config, pl->cur_link_an_mode, + state->interface); +@@ -814,8 +831,10 @@ static void phylink_major_config(struct + /* If we have a new PCS, switch to the new PCS after preparing the MAC + * for the change. + */ +- if (pcs) +- phylink_set_pcs(pl, pcs); ++ if (pcs_changed) { ++ pl->pcs = pcs; ++ pl->pcs_ops = pcs->ops; ++ } + + phylink_mac_config(pl, state); + +@@ -841,6 +860,8 @@ static void phylink_major_config(struct + phylink_err(pl, "mac_finish failed: %pe\n", + ERR_PTR(err)); + } ++ ++ phylink_pcs_poll_start(pl); + } + + /* diff --git a/target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch b/target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch new file mode 100644 index 00000000000000..f1f359bad7ac0d --- /dev/null +++ b/target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch @@ -0,0 +1,38 @@ +From b7d78b46d5e8dc77c656c13885d31e931923b915 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Wed, 29 Jun 2022 22:33:58 +0300 +Subject: [PATCH] net: phylink: fix NULL pl->pcs dereference during + phylink_pcs_poll_start + +The current link mode of the phylink instance may not require an +attached PCS. However, phylink_major_config() unconditionally +dereferences this potentially NULL pointer when restarting the link poll +timer, which will panic the kernel. + +Fix the problem by checking whether a PCS exists in phylink_pcs_poll_start(), +otherwise do nothing. The code prior to the blamed patch also only +looked at pcs->poll within an "if (pcs)" block. + +Fixes: bfac8c490d60 ("net: phylink: disable PCS polling over major configuration") +Signed-off-by: Vladimir Oltean +Reviewed-by: Russell King (Oracle) +Tested-by: Gerhard Engleder +Tested-by: Michael Walle # on kontron-kbox-a-230-ls +Tested-by: Nicolas Ferre # on sam9x60ek +Link: https://lore.kernel.org/r/20220629193358.4007923-1-vladimir.oltean@nxp.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/phylink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -764,7 +764,7 @@ static void phylink_pcs_poll_stop(struct + + static void phylink_pcs_poll_start(struct phylink *pl) + { +- if (pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) ++ if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) + mod_timer(&pl->link_poll, jiffies + HZ); + } + diff --git a/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch b/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch new file mode 100644 index 00000000000000..ceec58466e19bf --- /dev/null +++ b/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch @@ -0,0 +1,172 @@ +From 90ef0a7b0622c62758b2638604927867775479ea Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Thu, 13 Jul 2023 09:42:07 +0100 +Subject: [PATCH] net: phylink: add pcs_enable()/pcs_disable() methods + +Add phylink PCS enable/disable callbacks that will allow us to place +IEEE 802.3 register compliant PCS in power-down mode while not being +used. + +Signed-off-by: Russell King (Oracle) +Signed-off-by: David S. Miller +--- + drivers/net/phy/phylink.c | 48 +++++++++++++++++++++++++++++++-------- + include/linux/phylink.h | 16 +++++++++++++ + 2 files changed, 55 insertions(+), 9 deletions(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -34,6 +34,10 @@ enum { + PHYLINK_DISABLE_STOPPED, + PHYLINK_DISABLE_LINK, + PHYLINK_DISABLE_MAC_WOL, ++ ++ PCS_STATE_DOWN = 0, ++ PCS_STATE_STARTING, ++ PCS_STATE_STARTED, + }; + + /** +@@ -72,6 +76,7 @@ struct phylink { + struct mutex state_mutex; + struct phylink_link_state phy_state; + struct work_struct resolve; ++ unsigned int pcs_state; + + bool mac_link_dropped; + bool using_mac_select_pcs; +@@ -795,6 +800,22 @@ static void phylink_mac_pcs_an_restart(s + } + } + ++static void phylink_pcs_disable(struct phylink_pcs *pcs) ++{ ++ if (pcs && pcs->ops->pcs_disable) ++ pcs->ops->pcs_disable(pcs); ++} ++ ++static int phylink_pcs_enable(struct phylink_pcs *pcs) ++{ ++ int err = 0; ++ ++ if (pcs && pcs->ops->pcs_enable) ++ err = pcs->ops->pcs_enable(pcs); ++ ++ return err; ++} ++ + static void phylink_major_config(struct phylink *pl, bool restart, + const struct phylink_link_state *state) + { +@@ -832,12 +853,16 @@ static void phylink_major_config(struct + * for the change. + */ + if (pcs_changed) { ++ phylink_pcs_disable(pl->pcs); + pl->pcs = pcs; + pl->pcs_ops = pcs->ops; + } + + phylink_mac_config(pl, state); + ++ if (pl->pcs_state == PCS_STATE_STARTING || pcs_changed) ++ phylink_pcs_enable(pl->pcs); ++ + if (pl->pcs_ops) { + err = pl->pcs_ops->pcs_config(pl->pcs, pl->cur_link_an_mode, + state->interface, +@@ -1260,6 +1285,7 @@ struct phylink *phylink_create(struct ph + pl->link_config.speed = SPEED_UNKNOWN; + pl->link_config.duplex = DUPLEX_UNKNOWN; + pl->link_config.an_enabled = true; ++ pl->pcs_state = PCS_STATE_DOWN; + pl->mac_ops = mac_ops; + __set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); + timer_setup(&pl->link_poll, phylink_fixed_poll, 0); +@@ -1651,6 +1677,8 @@ void phylink_start(struct phylink *pl) + if (pl->netdev) + netif_carrier_off(pl->netdev); + ++ pl->pcs_state = PCS_STATE_STARTING; ++ + /* Apply the link configuration to the MAC when starting. This allows + * a fixed-link to start with the correct parameters, and also + * ensures that we set the appropriate advertisement for Serdes links. +@@ -1661,6 +1689,8 @@ void phylink_start(struct phylink *pl) + */ + phylink_mac_initial_config(pl, true); + ++ pl->pcs_state = PCS_STATE_STARTED; ++ + clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); + phylink_run_resolve(pl); + +@@ -1680,16 +1710,9 @@ void phylink_start(struct phylink *pl) + poll = true; + } + +- switch (pl->cfg_link_an_mode) { +- case MLO_AN_FIXED: ++ if (pl->cfg_link_an_mode == MLO_AN_FIXED) + poll |= pl->config->poll_fixed_state; +- break; +- case MLO_AN_INBAND: +- poll |= pl->config->pcs_poll; +- if (pl->pcs) +- poll |= pl->pcs->poll; +- break; +- } ++ + if (poll) + mod_timer(&pl->link_poll, jiffies + HZ); + if (pl->phydev) +@@ -1726,6 +1749,10 @@ void phylink_stop(struct phylink *pl) + } + + phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED); ++ ++ pl->pcs_state = PCS_STATE_DOWN; ++ ++ phylink_pcs_disable(pl->pcs); + } + EXPORT_SYMBOL_GPL(phylink_stop); + +--- a/include/linux/phylink.h ++++ b/include/linux/phylink.h +@@ -419,6 +419,8 @@ struct phylink_pcs { + /** + * struct phylink_pcs_ops - MAC PCS operations structure. + * @pcs_validate: validate the link configuration. ++ * @pcs_enable: enable the PCS. ++ * @pcs_disable: disable the PCS. + * @pcs_get_state: read the current MAC PCS link state from the hardware. + * @pcs_config: configure the MAC PCS for the selected mode and state. + * @pcs_an_restart: restart 802.3z BaseX autonegotiation. +@@ -428,6 +430,8 @@ struct phylink_pcs { + struct phylink_pcs_ops { + int (*pcs_validate)(struct phylink_pcs *pcs, unsigned long *supported, + const struct phylink_link_state *state); ++ int (*pcs_enable)(struct phylink_pcs *pcs); ++ void (*pcs_disable)(struct phylink_pcs *pcs); + void (*pcs_get_state)(struct phylink_pcs *pcs, + struct phylink_link_state *state); + int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode, +@@ -458,6 +462,18 @@ int pcs_validate(struct phylink_pcs *pcs + const struct phylink_link_state *state); + + /** ++ * pcs_enable() - enable the PCS. ++ * @pcs: a pointer to a &struct phylink_pcs. ++ */ ++int pcs_enable(struct phylink_pcs *pcs); ++ ++/** ++ * pcs_disable() - disable the PCS. ++ * @pcs: a pointer to a &struct phylink_pcs. ++ */ ++void pcs_disable(struct phylink_pcs *pcs); ++ ++/** + * pcs_get_state() - Read the current inband link state from the hardware + * @pcs: a pointer to a &struct phylink_pcs. + * @state: a pointer to a &struct phylink_link_state. diff --git a/target/linux/generic/backport-5.15/793-v6.6-net-pcs-lynxi-implement-pcs_disable-op.patch b/target/linux/generic/backport-5.15/793-v6.6-net-pcs-lynxi-implement-pcs_disable-op.patch new file mode 100644 index 00000000000000..eb9b4b7c09ee0d --- /dev/null +++ b/target/linux/generic/backport-5.15/793-v6.6-net-pcs-lynxi-implement-pcs_disable-op.patch @@ -0,0 +1,44 @@ +From e4ccdfb78a47132f2d215658aab8902fc457c4b4 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 18 Aug 2023 04:07:46 +0100 +Subject: [PATCH 082/125] net: pcs: lynxi: implement pcs_disable op + +When switching from 10GBase-R/5GBase-R/USXGMII to one of the interface +modes provided by mtk-pcs-lynxi we need to make sure to always perform +a full configuration of the PHYA. + +Implement pcs_disable op which resets the stored interface mode to +PHY_INTERFACE_MODE_NA to trigger a full reconfiguration once the LynxI +PCS driver had previously been deselected in favor of another PCS +driver such as the to-be-added driver for the USXGMII PCS found in +MT7988. + +Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/f23d1a60d2c9d2fb72e32dcb0eaa5f7e867a3d68.1692327891.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/pcs/pcs-mtk-lynxi.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/net/pcs/pcs-mtk-lynxi.c ++++ b/drivers/net/pcs/pcs-mtk-lynxi.c +@@ -241,11 +241,19 @@ static void mtk_pcs_lynxi_link_up(struct + } + } + ++static void mtk_pcs_lynxi_disable(struct phylink_pcs *pcs) ++{ ++ struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs); ++ ++ mpcs->interface = PHY_INTERFACE_MODE_NA; ++} ++ + static const struct phylink_pcs_ops mtk_pcs_lynxi_ops = { + .pcs_get_state = mtk_pcs_lynxi_get_state, + .pcs_config = mtk_pcs_lynxi_config, + .pcs_an_restart = mtk_pcs_lynxi_restart_an, + .pcs_link_up = mtk_pcs_lynxi_link_up, ++ .pcs_disable = mtk_pcs_lynxi_disable, + }; + + struct phylink_pcs *mtk_pcs_lynxi_create(struct device *dev, diff --git a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch index b1e7065a8b91f9..33c5c271212a3d 100644 --- a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch +++ b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch @@ -17,7 +17,7 @@ Signed-off-by: Daniel Golle --- a/include/linux/phylink.h +++ b/include/linux/phylink.h -@@ -584,10 +584,37 @@ int phylink_speed_up(struct phylink *pl) +@@ -600,10 +600,37 @@ int phylink_speed_up(struct phylink *pl) #define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode) void phylink_set_port_modes(unsigned long *bits); @@ -57,7 +57,7 @@ Signed-off-by: Daniel Golle const unsigned long *advertising); --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -885,7 +885,6 @@ static int phylink_change_inband_advert( +@@ -931,7 +931,6 @@ static int phylink_change_inband_advert( return 0; } @@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle static void phylink_mac_pcs_get_state(struct phylink *pl, struct phylink_link_state *state) { -@@ -2966,6 +2965,52 @@ void phylink_mii_c22_pcs_get_state(struc +@@ -3014,6 +3013,52 @@ void phylink_mii_c22_pcs_get_state(struc EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_get_state); /** @@ -118,7 +118,7 @@ Signed-off-by: Daniel Golle * phylink_mii_c22_pcs_set_advertisement() - configure the clause 37 PCS * advertisement * @pcs: a pointer to a &struct mdio_device. -@@ -3037,6 +3082,46 @@ int phylink_mii_c22_pcs_set_advertisemen +@@ -3085,6 +3130,46 @@ int phylink_mii_c22_pcs_set_advertisemen EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_set_advertisement); /** diff --git a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 2bc78fa05e56cc..9a1c26e7aeb36a 100644 --- a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2992,8 +2992,8 @@ static irqreturn_t mtk_handle_irq_rx(int +@@ -3095,8 +3095,8 @@ static irqreturn_t mtk_handle_irq_rx(int eth->rx_events++; if (likely(napi_schedule_prep(ð->rx_napi))) { @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -3005,8 +3005,8 @@ static irqreturn_t mtk_handle_irq_tx(int +@@ -3108,8 +3108,8 @@ static irqreturn_t mtk_handle_irq_tx(int eth->tx_events++; if (likely(napi_schedule_prep(ð->tx_napi))) { @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -4666,6 +4666,8 @@ static int mtk_probe(struct platform_dev +@@ -4883,6 +4883,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch b/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch new file mode 100644 index 00000000000000..1d84ea9ced5743 --- /dev/null +++ b/target/linux/generic/pending-5.15/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch @@ -0,0 +1,44 @@ +From: Felix Fietkau +Date: Thu, 27 Oct 2022 23:39:52 +0200 +Subject: [PATCH] net: ethernet: mtk_eth_soc: compile out netsys v2 code + on mt7621 + +Avoid some branches in the hot path on low-end devices with limited CPU power, +and reduce code size + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -1323,6 +1323,22 @@ struct mtk_mac { + /* the struct describing the SoC. these are declared in the soc_xyz.c files */ + extern const struct of_device_id of_mtk_match[]; + ++#ifdef CONFIG_SOC_MT7621 ++static inline bool mtk_is_netsys_v1(struct mtk_eth *eth) ++{ ++ return true; ++} ++ ++static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth) ++{ ++ return false; ++} ++ ++static inline bool mtk_is_netsys_v3_or_greater(struct mtk_eth *eth) ++{ ++ return false; ++} ++#else + static inline bool mtk_is_netsys_v1(struct mtk_eth *eth) + { + return eth->soc->version == 1; +@@ -1337,6 +1353,7 @@ static inline bool mtk_is_netsys_v3_or_g + { + return eth->soc->version > 2; + } ++#endif + + static inline struct mtk_foe_entry * + mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash) diff --git a/target/linux/generic/pending-5.15/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch b/target/linux/generic/pending-5.15/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch index fbf0cb5735eb2b..56edb63234539e 100644 --- a/target/linux/generic/pending-5.15/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch +++ b/target/linux/generic/pending-5.15/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -1423,12 +1423,28 @@ static void mtk_wake_queue(struct mtk_et +@@ -1516,12 +1516,28 @@ static void mtk_wake_queue(struct mtk_et } } @@ -45,11 +45,11 @@ Signed-off-by: Felix Fietkau bool gso = false; int tx_num; -@@ -1450,6 +1466,18 @@ static netdev_tx_t mtk_start_xmit(struct +@@ -1543,6 +1559,18 @@ static netdev_tx_t mtk_start_xmit(struct return NETDEV_TX_BUSY; } -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) && ++ if (mtk_is_netsys_v1(eth) && + skb_is_gso(skb) && mtk_skb_has_small_frag(skb)) { + segs = skb_gso_segment(skb, dev->features & ~NETIF_F_ALL_TSO); + if (IS_ERR(segs)) @@ -64,14 +64,14 @@ Signed-off-by: Felix Fietkau /* TSO: fill MSS info in tcp checksum field */ if (skb_is_gso(skb)) { if (skb_cow_head(skb, 0)) { -@@ -1465,8 +1493,14 @@ static netdev_tx_t mtk_start_xmit(struct +@@ -1558,8 +1586,14 @@ static netdev_tx_t mtk_start_xmit(struct } } - if (mtk_tx_map(skb, dev, tx_num, ring, gso) < 0) - goto drop; + skb_list_walk_safe(skb, skb, next) { -+ if ((!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) && ++ if ((mtk_is_netsys_v1(eth) && + mtk_skb_has_small_frag(skb) && skb_linearize(skb)) || + mtk_tx_map(skb, dev, tx_num, ring, gso) < 0) { + stats->tx_dropped++; @@ -83,7 +83,7 @@ Signed-off-by: Felix Fietkau netif_tx_stop_all_queues(dev); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -258,7 +258,7 @@ +@@ -268,7 +268,7 @@ #define MTK_CHK_DDONE_EN BIT(28) #define MTK_DMAD_WR_WDONE BIT(26) #define MTK_WCOMP_EN BIT(24) diff --git a/target/linux/generic/pending-5.15/732-02-net-ethernet-mtk_eth_soc-set-NETIF_F_ALL_TSO.patch b/target/linux/generic/pending-5.15/732-02-net-ethernet-mtk_eth_soc-set-NETIF_F_ALL_TSO.patch index 3c6359ee419a76..11a81dd0bfdc9b 100644 --- a/target/linux/generic/pending-5.15/732-02-net-ethernet-mtk_eth_soc-set-NETIF_F_ALL_TSO.patch +++ b/target/linux/generic/pending-5.15/732-02-net-ethernet-mtk_eth_soc-set-NETIF_F_ALL_TSO.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -48,8 +48,7 @@ +@@ -47,8 +47,7 @@ #define MTK_HW_FEATURES (NETIF_F_IP_CSUM | \ NETIF_F_RXCSUM | \ NETIF_F_HW_VLAN_CTAG_TX | \ diff --git a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch index 0aa9382b6bdd91..452e486e8969e2 100644 --- a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch +++ b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch @@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -667,6 +667,7 @@ static void mtk_mac_link_up(struct phyli +@@ -723,6 +723,7 @@ static void mtk_mac_link_up(struct phyli MAC_MCR_FORCE_RX_FC); /* Configure speed */ @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau switch (speed) { case SPEED_2500: case SPEED_1000: -@@ -3145,6 +3146,9 @@ found: +@@ -3288,6 +3289,9 @@ found: if (dp->index >= MTK_QDMA_NUM_QUEUES) return NOTIFY_DONE; diff --git a/target/linux/generic/pending-5.15/734-net-ethernet-mtk_eth_soc-ppe-fix-L2-offloading-with-.patch b/target/linux/generic/pending-5.15/734-net-ethernet-mtk_eth_soc-ppe-fix-L2-offloading-with-.patch index 9ef65ec16f7bb7..104ce00b7eb1bf 100644 --- a/target/linux/generic/pending-5.15/734-net-ethernet-mtk_eth_soc-ppe-fix-L2-offloading-with-.patch +++ b/target/linux/generic/pending-5.15/734-net-ethernet-mtk_eth_soc-ppe-fix-L2-offloading-with-.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau #include #include "mtk_eth_soc.h" #include "mtk_ppe.h" -@@ -757,7 +758,9 @@ void __mtk_ppe_check_skb(struct mtk_ppe +@@ -781,7 +782,9 @@ void __mtk_ppe_check_skb(struct mtk_ppe skb->dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK) goto out; diff --git a/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch b/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch index 4f765c5c1451c3..d648ba4dc7fb3c 100644 --- a/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch +++ b/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1277,6 +1277,9 @@ int mtk_gmac_rgmii_path_setup(struct mtk +@@ -1448,6 +1448,9 @@ int mtk_gmac_rgmii_path_setup(struct mtk int mtk_eth_offload_init(struct mtk_eth *eth); int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data); @@ -120,7 +120,7 @@ Signed-off-by: Felix Fietkau static void wed_m32(struct mtk_wed_device *dev, u32 reg, u32 mask, u32 val) { -@@ -1752,6 +1759,99 @@ out: +@@ -1760,6 +1767,99 @@ out: mutex_unlock(&hw_lock); } @@ -220,7 +220,7 @@ Signed-off-by: Felix Fietkau void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth, void __iomem *wdma, phys_addr_t wdma_phy, int index) -@@ -1771,6 +1871,7 @@ void mtk_wed_add_hw(struct device_node * +@@ -1779,6 +1879,7 @@ void mtk_wed_add_hw(struct device_node * .irq_set_mask = mtk_wed_irq_set_mask, .detach = mtk_wed_detach, .ppe_check = mtk_wed_ppe_check, diff --git a/target/linux/generic/pending-5.15/736-02-net-ethernet-mediatek-mtk_ppe-prefer-newly-added-l2-.patch b/target/linux/generic/pending-5.15/736-02-net-ethernet-mediatek-mtk_ppe-prefer-newly-added-l2-.patch index 6e17e4dc529f75..e89d4cd97b9f75 100644 --- a/target/linux/generic/pending-5.15/736-02-net-ethernet-mediatek-mtk_ppe-prefer-newly-added-l2-.patch +++ b/target/linux/generic/pending-5.15/736-02-net-ethernet-mediatek-mtk_ppe-prefer-newly-added-l2-.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c -@@ -639,10 +639,20 @@ void mtk_foe_entry_clear(struct mtk_ppe +@@ -663,10 +663,20 @@ void mtk_foe_entry_clear(struct mtk_ppe static int mtk_foe_entry_commit_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) { diff --git a/target/linux/generic/pending-5.15/736-03-net-ethernet-mtk_eth_soc-improve-keeping-track-of-of.patch b/target/linux/generic/pending-5.15/736-03-net-ethernet-mtk_eth_soc-improve-keeping-track-of-of.patch index 29d6e0b09918cc..c8be7a9e2b2953 100644 --- a/target/linux/generic/pending-5.15/736-03-net-ethernet-mtk_eth_soc-improve-keeping-track-of-of.patch +++ b/target/linux/generic/pending-5.15/736-03-net-ethernet-mtk_eth_soc-improve-keeping-track-of-of.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c -@@ -466,42 +466,43 @@ int mtk_foe_entry_set_queue(struct mtk_e +@@ -483,42 +483,43 @@ int mtk_foe_entry_set_queue(struct mtk_e return 0; } @@ -72,7 +72,7 @@ Signed-off-by: Felix Fietkau struct mtk_foe_entry *hwe = mtk_foe_get_entry(ppe, entry->hash); hwe->ib1 &= ~MTK_FOE_IB1_STATE; -@@ -520,7 +521,8 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp +@@ -538,7 +539,8 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp if (entry->type != MTK_FLOW_TYPE_L2_SUBFLOW) return; @@ -82,7 +82,7 @@ Signed-off-by: Felix Fietkau kfree(entry); } -@@ -536,66 +538,55 @@ static int __mtk_foe_entry_idle_time(str +@@ -554,66 +556,55 @@ static int __mtk_foe_entry_idle_time(str return now - timestamp; } @@ -178,7 +178,7 @@ Signed-off-by: Felix Fietkau } static void -@@ -632,7 +623,8 @@ __mtk_foe_entry_commit(struct mtk_ppe *p +@@ -656,7 +647,8 @@ __mtk_foe_entry_commit(struct mtk_ppe *p void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) { spin_lock_bh(&ppe_lock); @@ -188,7 +188,7 @@ Signed-off-by: Felix Fietkau spin_unlock_bh(&ppe_lock); } -@@ -679,8 +671,8 @@ mtk_foe_entry_commit_subflow(struct mtk_ +@@ -703,8 +695,8 @@ mtk_foe_entry_commit_subflow(struct mtk_ { const struct mtk_soc_data *soc = ppe->eth->soc; struct mtk_flow_entry *flow_info; @@ -198,7 +198,7 @@ Signed-off-by: Felix Fietkau u32 ib1_mask = mtk_get_ib1_pkt_type_mask(ppe->eth) | MTK_FOE_IB1_UDP; int type; -@@ -688,30 +680,30 @@ mtk_foe_entry_commit_subflow(struct mtk_ +@@ -712,30 +704,30 @@ mtk_foe_entry_commit_subflow(struct mtk_ if (!flow_info) return; @@ -239,7 +239,7 @@ Signed-off-by: Felix Fietkau } void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash) -@@ -721,9 +713,11 @@ void __mtk_ppe_check_skb(struct mtk_ppe +@@ -745,9 +737,11 @@ void __mtk_ppe_check_skb(struct mtk_ppe struct mtk_foe_entry *hwe = mtk_foe_get_entry(ppe, hash); struct mtk_flow_entry *entry; struct mtk_foe_bridge key = {}; @@ -251,7 +251,7 @@ Signed-off-by: Felix Fietkau u8 *tag; spin_lock_bh(&ppe_lock); -@@ -731,20 +725,14 @@ void __mtk_ppe_check_skb(struct mtk_ppe +@@ -755,20 +749,14 @@ void __mtk_ppe_check_skb(struct mtk_ppe if (FIELD_GET(MTK_FOE_IB1_STATE, hwe->ib1) == MTK_FOE_STATE_BIND) goto out; @@ -278,7 +278,7 @@ Signed-off-by: Felix Fietkau continue; } -@@ -795,9 +783,17 @@ out: +@@ -819,9 +807,17 @@ out: int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) { @@ -300,7 +300,7 @@ Signed-off-by: Felix Fietkau int mtk_ppe_prepare_reset(struct mtk_ppe *ppe) --- a/drivers/net/ethernet/mediatek/mtk_ppe.h +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h -@@ -265,7 +265,12 @@ enum { +@@ -286,7 +286,12 @@ enum { struct mtk_flow_entry { union { @@ -314,7 +314,7 @@ Signed-off-by: Felix Fietkau struct { struct rhash_head l2_node; struct hlist_head l2_flows; -@@ -275,13 +280,7 @@ struct mtk_flow_entry { +@@ -296,13 +301,7 @@ struct mtk_flow_entry { s8 wed_index; u8 ppe_index; u16 hash; diff --git a/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch b/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch index fdc3d520c119fc..7f04fd9fa8648c 100644 --- a/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch +++ b/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch @@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau if (ret) dev_err(ppe->dev, "MIB table busy"); -@@ -90,18 +90,32 @@ static int mtk_ppe_mib_wait_busy(struct +@@ -90,17 +90,31 @@ static int mtk_ppe_mib_wait_busy(struct return ret; } @@ -43,7 +43,6 @@ Signed-off-by: Felix Fietkau + +struct mtk_foe_accounting *mtk_ppe_mib_entry_read(struct mtk_ppe *ppe, u16 index) { - u32 byte_cnt_low, byte_cnt_high, pkt_cnt_low, pkt_cnt_high; u32 val, cnt_r0, cnt_r1, cnt_r2; + struct mtk_foe_accounting *acct; int ret; @@ -62,25 +61,35 @@ Signed-off-by: Felix Fietkau cnt_r0 = readl(ppe->base + MTK_PPE_MIB_SER_R0); cnt_r1 = readl(ppe->base + MTK_PPE_MIB_SER_R1); -@@ -111,10 +125,11 @@ static int mtk_mib_entry_read(struct mtk - byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); - pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); - pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); -- *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; -- *packets = (pkt_cnt_high << 16) | pkt_cnt_low; +@@ -109,19 +123,19 @@ static int mtk_mib_entry_read(struct mtk + if (mtk_is_netsys_v3_or_greater(ppe->eth)) { + /* 64 bit for each counter */ + u32 cnt_r3 = readl(ppe->base + MTK_PPE_MIB_SER_R3); +- *bytes = ((u64)cnt_r1 << 32) | cnt_r0; +- *packets = ((u64)cnt_r3 << 32) | cnt_r2; ++ acct->bytes += ((u64)cnt_r1 << 32) | cnt_r0; ++ acct->packets += ((u64)cnt_r3 << 32) | cnt_r2; + } else { + /* 48 bit byte counter, 40 bit packet counter */ + u32 byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); + u32 byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); + u32 pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); + u32 pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); +- *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; +- *packets = (pkt_cnt_high << 16) | pkt_cnt_low; ++ acct->bytes += ((u64)byte_cnt_high << 32) | byte_cnt_low; ++ acct->packets += (pkt_cnt_high << 16) | pkt_cnt_low; + } - return 0; -+ acct->bytes += ((u64)byte_cnt_high << 32) | byte_cnt_low; -+ acct->packets += (pkt_cnt_high << 16) | pkt_cnt_low; -+ + return acct; } static void mtk_ppe_cache_clear(struct mtk_ppe *ppe) -@@ -508,13 +523,6 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp - hwe->ib1 &= ~MTK_FOE_IB1_STATE; +@@ -526,13 +540,6 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID); dma_wmb(); + mtk_ppe_cache_clear(ppe); - if (ppe->accounting) { - struct mtk_foe_accounting *acct; - @@ -91,7 +100,7 @@ Signed-off-by: Felix Fietkau } entry->hash = 0xffff; -@@ -539,11 +547,14 @@ static int __mtk_foe_entry_idle_time(str +@@ -557,11 +564,14 @@ static int __mtk_foe_entry_idle_time(str } static bool @@ -107,7 +116,7 @@ Signed-off-by: Felix Fietkau int len; if (hash == 0xffff) -@@ -554,18 +565,35 @@ mtk_flow_entry_update(struct mtk_ppe *pp +@@ -572,18 +582,35 @@ mtk_flow_entry_update(struct mtk_ppe *pp memcpy(&foe, hwe, len); if (!mtk_flow_entry_match(ppe->eth, entry, &foe, len) || @@ -146,7 +155,7 @@ Signed-off-by: Felix Fietkau struct mtk_flow_entry *cur; struct hlist_node *tmp; int idle; -@@ -574,7 +602,9 @@ mtk_flow_entry_update_l2(struct mtk_ppe +@@ -592,7 +619,9 @@ mtk_flow_entry_update_l2(struct mtk_ppe hlist_for_each_entry_safe(cur, tmp, &entry->l2_flows, l2_list) { int cur_idle; @@ -157,7 +166,7 @@ Signed-off-by: Felix Fietkau __mtk_foe_entry_clear(ppe, entry, false); continue; } -@@ -589,10 +619,29 @@ mtk_flow_entry_update_l2(struct mtk_ppe +@@ -607,10 +636,29 @@ mtk_flow_entry_update_l2(struct mtk_ppe } } @@ -187,7 +196,7 @@ Signed-off-by: Felix Fietkau struct mtk_eth *eth = ppe->eth; u16 timestamp = mtk_eth_timestamp(eth); struct mtk_foe_entry *hwe; -@@ -617,6 +666,12 @@ __mtk_foe_entry_commit(struct mtk_ppe *p +@@ -641,6 +689,12 @@ __mtk_foe_entry_commit(struct mtk_ppe *p dma_wmb(); @@ -200,7 +209,7 @@ Signed-off-by: Felix Fietkau mtk_ppe_cache_clear(ppe); } -@@ -781,21 +836,6 @@ out: +@@ -805,21 +859,6 @@ out: spin_unlock_bh(&ppe_lock); } @@ -222,7 +231,7 @@ Signed-off-by: Felix Fietkau int mtk_ppe_prepare_reset(struct mtk_ppe *ppe) { if (!ppe) -@@ -823,32 +863,6 @@ int mtk_ppe_prepare_reset(struct mtk_ppe +@@ -847,32 +886,6 @@ int mtk_ppe_prepare_reset(struct mtk_ppe return mtk_ppe_wait_busy(ppe); } @@ -257,7 +266,7 @@ Signed-off-by: Felix Fietkau bool accounting = eth->soc->has_accounting; --- a/drivers/net/ethernet/mediatek/mtk_ppe.h +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h -@@ -283,6 +283,8 @@ struct mtk_flow_entry { +@@ -304,6 +304,8 @@ struct mtk_flow_entry { struct mtk_foe_entry data; struct rhash_head node; unsigned long cookie; @@ -266,7 +275,7 @@ Signed-off-by: Felix Fietkau }; struct mtk_mib_entry { -@@ -325,6 +327,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ +@@ -347,6 +349,7 @@ void mtk_ppe_deinit(struct mtk_eth *eth) void mtk_ppe_start(struct mtk_ppe *ppe); int mtk_ppe_stop(struct mtk_ppe *ppe); int mtk_ppe_prepare_reset(struct mtk_ppe *ppe); @@ -274,7 +283,7 @@ Signed-off-by: Felix Fietkau void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash); -@@ -373,9 +376,8 @@ int mtk_foe_entry_set_queue(struct mtk_e +@@ -395,9 +398,8 @@ int mtk_foe_entry_set_queue(struct mtk_e unsigned int queue); int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry); void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry); @@ -295,7 +304,7 @@ Signed-off-by: Felix Fietkau - acct = mtk_foe_entry_get_mib(ppe, i, NULL); + acct = mtk_ppe_mib_entry_read(ppe, i); - type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1); + type = mtk_get_ib1_pkt_type(ppe->eth, entry->ib1); seq_printf(m, "%05x %s %7s", i, --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c diff --git a/target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch b/target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch deleted file mode 100644 index 621a7b0fcf0839..00000000000000 --- a/target/linux/generic/pending-5.15/737-01-net-ethernet-mtk_eth_soc-add-MTK_NETSYS_V1-capabilit.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 663fa1b7e0cb2c929008482014a70c6625caad75 Mon Sep 17 00:00:00 2001 -From: Lorenzo Bianconi -Date: Tue, 7 Mar 2023 15:55:13 +0000 -Subject: [PATCH 1/7] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V1 capability - bit - -Introduce MTK_NETSYS_V1 bit in the device capabilities for -MT7621/MT7622/MT7623/MT7628/MT7629 SoCs. -Use !MTK_NETSYS_V1 instead of MTK_NETSYS_V2 in the driver codebase. -This is a preliminary patch to introduce support for MT7988 SoC. - -Signed-off-by: Lorenzo Bianconi -Signed-off-by: Daniel Golle ---- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 30 +++++++------- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 45 ++++++++++++--------- - 2 files changed, 41 insertions(+), 34 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -597,7 +597,7 @@ static void mtk_set_queue_speed(struct m - FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | - FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | - MTK_QTX_SCH_LEAKY_BUCKET_SIZE; -- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) - val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; - - if (IS_ENABLED(CONFIG_SOC_MT7621)) { -@@ -974,7 +974,7 @@ static bool mtk_rx_get_desc(struct mtk_e - rxd->rxd1 = READ_ONCE(dma_rxd->rxd1); - rxd->rxd3 = READ_ONCE(dma_rxd->rxd3); - rxd->rxd4 = READ_ONCE(dma_rxd->rxd4); -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { - rxd->rxd5 = READ_ONCE(dma_rxd->rxd5); - rxd->rxd6 = READ_ONCE(dma_rxd->rxd6); - } -@@ -1032,7 +1032,7 @@ static int mtk_init_fq_dma(struct mtk_et - - txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); - txd->txd4 = 0; -- if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { -+ if (!MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V1)) { - txd->txd5 = 0; - txd->txd6 = 0; - txd->txd7 = 0; -@@ -1221,7 +1221,7 @@ static void mtk_tx_set_dma_desc(struct n - struct mtk_mac *mac = netdev_priv(dev); - struct mtk_eth *eth = mac->hw; - -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) - mtk_tx_set_dma_desc_v2(dev, txd, info); - else - mtk_tx_set_dma_desc_v1(dev, txd, info); -@@ -1902,7 +1902,7 @@ static int mtk_poll_rx(struct napi_struc - break; - - /* find out which mac the packet come from. values start at 1 */ -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) - mac = RX_DMA_GET_SPORT_V2(trxd.rxd5) - 1; - else if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && - !(trxd.rxd4 & RX_DMA_SPECIAL_TAG)) -@@ -1998,7 +1998,7 @@ static int mtk_poll_rx(struct napi_struc - skb->dev = netdev; - bytes += skb->len; - -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { - reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5); - hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY; - if (hash != MTK_RXD5_FOE_ENTRY) -@@ -2023,7 +2023,7 @@ static int mtk_poll_rx(struct napi_struc - /* When using VLAN untagging in combination with DSA, the - * hardware treats the MTK special tag as a VLAN and untags it. - */ -- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) && -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1) && - (trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) { - unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0); - -@@ -2328,7 +2328,7 @@ static int mtk_tx_alloc(struct mtk_eth * - txd->txd2 = next_ptr; - txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; - txd->txd4 = 0; -- if (MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V2)) { -+ if (!MTK_HAS_CAPS(soc->caps, MTK_NETSYS_V1)) { - txd->txd5 = 0; - txd->txd6 = 0; - txd->txd7 = 0; -@@ -2381,7 +2381,7 @@ static int mtk_tx_alloc(struct mtk_eth * - FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | - FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | - MTK_QTX_SCH_LEAKY_BUCKET_SIZE; -- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) - val |= MTK_QTX_SCH_LEAKY_BUCKET_EN; - mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); - ofs += MTK_QTX_OFFSET; -@@ -2515,7 +2515,7 @@ static int mtk_rx_alloc(struct mtk_eth * - - rxd->rxd3 = 0; - rxd->rxd4 = 0; -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { - rxd->rxd5 = 0; - rxd->rxd6 = 0; - rxd->rxd7 = 0; -@@ -3063,7 +3063,7 @@ static int mtk_start_dma(struct mtk_eth - MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | - MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE; - -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) - val |= MTK_MUTLI_CNT | MTK_RESV_BUF | - MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | - MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN; -@@ -3475,7 +3475,7 @@ static void mtk_hw_reset(struct mtk_eth - { - u32 val; - -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { - regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0); - val = RSTCTRL_PPE0_V2; - } else { -@@ -3487,7 +3487,7 @@ static void mtk_hw_reset(struct mtk_eth - - ethsys_reset(eth, RSTCTRL_ETH | RSTCTRL_FE | val); - -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) - regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, - 0x3ffffff); - } -@@ -3683,7 +3683,7 @@ static int mtk_hw_init(struct mtk_eth *e - else - mtk_hw_reset(eth); - -- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { - /* Set FE to PDMAv2 if necessary */ - val = mtk_r32(eth, MTK_FE_GLO_MISC); - mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); -@@ -3720,7 +3720,7 @@ static int mtk_hw_init(struct mtk_eth *e - */ - val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); - mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL); -- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1)) { - val = mtk_r32(eth, MTK_CDMP_IG_CTRL); - mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -816,6 +816,7 @@ enum mkt_eth_capabilities { - MTK_SHARED_INT_BIT, - MTK_TRGMII_MT7621_CLK_BIT, - MTK_QDMA_BIT, -+ MTK_NETSYS_V1_BIT, - MTK_NETSYS_V2_BIT, - MTK_SOC_MT7628_BIT, - MTK_RSTCTRL_PPE1_BIT, -@@ -851,6 +852,7 @@ enum mkt_eth_capabilities { - #define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT) - #define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT) - #define MTK_QDMA BIT(MTK_QDMA_BIT) -+#define MTK_NETSYS_V1 BIT(MTK_NETSYS_V1_BIT) - #define MTK_NETSYS_V2 BIT(MTK_NETSYS_V2_BIT) - #define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT) - #define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT) -@@ -913,25 +915,30 @@ enum mkt_eth_capabilities { - - #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x) & ~(MTK_CAP_MASK)) == (_x)) - --#define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ -- MTK_GMAC2_RGMII | MTK_SHARED_INT | \ -- MTK_TRGMII_MT7621_CLK | MTK_QDMA) -- --#define MT7622_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_SGMII | MTK_GMAC2_RGMII | \ -- MTK_GMAC2_SGMII | MTK_GDM1_ESW | \ -- MTK_MUX_GDM1_TO_GMAC1_ESW | \ -- MTK_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | MTK_QDMA) -- --#define MT7623_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | MTK_GMAC2_RGMII | \ -- MTK_QDMA) -- --#define MT7628_CAPS (MTK_SHARED_INT | MTK_SOC_MT7628) -- --#define MT7629_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \ -- MTK_GDM1_ESW | MTK_MUX_GDM1_TO_GMAC1_ESW | \ -- MTK_MUX_GMAC2_GMAC0_TO_GEPHY | \ -- MTK_MUX_U3_GMAC2_TO_QPHY | \ -- MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA) -+#define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ -+ MTK_GMAC2_RGMII | MTK_SHARED_INT | \ -+ MTK_TRGMII_MT7621_CLK | MTK_QDMA | \ -+ MTK_NETSYS_V1) -+ -+#define MT7622_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_SGMII | \ -+ MTK_GMAC2_RGMII | MTK_GMAC2_SGMII | \ -+ MTK_GDM1_ESW | MTK_MUX_GDM1_TO_GMAC1_ESW |\ -+ MTK_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | \ -+ MTK_QDMA | MTK_NETSYS_V1) -+ -+#define MT7623_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ -+ MTK_GMAC2_RGMII | MTK_QDMA | \ -+ MTK_NETSYS_V1) -+ -+#define MT7628_CAPS (MTK_SHARED_INT | MTK_SOC_MT7628 | \ -+ MTK_NETSYS_V1) -+ -+#define MT7629_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ -+ MTK_GMAC2_GEPHY | MTK_GDM1_ESW | \ -+ MTK_MUX_GMAC2_GMAC0_TO_GEPHY | MTK_QDMA | \ -+ MTK_MUX_U3_GMAC2_TO_QPHY | MTK_NETSYS_V1 |\ -+ MTK_MUX_GDM1_TO_GMAC1_ESW | \ -+ MTK_MUX_GMAC12_TO_GEPHY_SGMII) - - #define MT7981_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \ - MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ diff --git a/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch b/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch deleted file mode 100644 index 837a8bf0ad256d..00000000000000 --- a/target/linux/generic/pending-5.15/737-02-net-ethernet-mtk_eth_soc-move-MAX_DEVS-in-mtk_soc_da.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 5af2b2dc4d6ba0ff7696e79f18e5b2bf862194eb Mon Sep 17 00:00:00 2001 -From: Lorenzo Bianconi -Date: Tue, 7 Mar 2023 15:55:24 +0000 -Subject: [PATCH 2/7] net: ethernet: mtk_eth_soc: move MAX_DEVS in mtk_soc_data - -This is a preliminary patch to add MT7988 SoC support since it runs 3 -macs instead of 2. - -Signed-off-by: Lorenzo Bianconi -Signed-off-by: Daniel Golle ---- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 34 +++++++++++++++++++-- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 11 +++---- - 2 files changed, 36 insertions(+), 9 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3972,7 +3972,10 @@ static void mtk_sgmii_destroy(struct mtk - { - int i; - -- for (i = 0; i < MTK_MAX_DEVS; i++) -+ if (!eth->sgmii_pcs) -+ return; -+ -+ for (i = 0; i < eth->soc->num_devs; i++) - mtk_pcs_lynxi_destroy(eth->sgmii_pcs[i]); - } - -@@ -4425,7 +4428,12 @@ static int mtk_sgmii_init(struct mtk_eth - u32 flags; - int i; - -- for (i = 0; i < MTK_MAX_DEVS; i++) { -+ eth->sgmii_pcs = devm_kzalloc(eth->dev, -+ sizeof(*eth->sgmii_pcs) * -+ eth->soc->num_devs, -+ GFP_KERNEL); -+ -+ for (i = 0; i < eth->soc->num_devs; i++) { - np = of_parse_phandle(eth->dev->of_node, "mediatek,sgmiisys", i); - if (!np) - break; -@@ -4470,6 +4478,18 @@ static int mtk_probe(struct platform_dev - if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) - eth->ip_align = NET_IP_ALIGN; - -+ eth->netdev = devm_kzalloc(eth->dev, -+ sizeof(*eth->netdev) * eth->soc->num_devs, -+ GFP_KERNEL); -+ if (!eth->netdev) -+ return -ENOMEM; -+ -+ eth->mac = devm_kzalloc(eth->dev, -+ sizeof(*eth->mac) * eth->soc->num_devs, -+ GFP_KERNEL); -+ if (!eth->mac) -+ return -ENOMEM; -+ - spin_lock_init(ð->page_lock); - spin_lock_init(ð->tx_irq_lock); - spin_lock_init(ð->rx_irq_lock); -@@ -4655,7 +4675,7 @@ static int mtk_probe(struct platform_dev - goto err_free_dev; - } - -- for (i = 0; i < MTK_MAX_DEVS; i++) { -+ for (i = 0; i < eth->soc->num_devs; i++) { - if (!eth->netdev[i]) - continue; - -@@ -4732,6 +4752,7 @@ static const struct mtk_soc_data mt2701_ - .hw_features = MTK_HW_FEATURES, - .required_clks = MT7623_CLKS_BITMAP, - .required_pctl = true, -+ .num_devs = 2, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4750,6 +4771,7 @@ static const struct mtk_soc_data mt7621_ - .required_pctl = false, - .offload_version = 1, - .hash_offset = 2, -+ .num_devs = 2, - .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), -@@ -4771,6 +4793,7 @@ static const struct mtk_soc_data mt7622_ - .offload_version = 2, - .hash_offset = 2, - .has_accounting = true, -+ .num_devs = 2, - .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), -@@ -4790,6 +4813,7 @@ static const struct mtk_soc_data mt7623_ - .required_pctl = true, - .offload_version = 1, - .hash_offset = 2, -+ .num_devs = 2, - .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), -@@ -4809,6 +4833,7 @@ static const struct mtk_soc_data mt7629_ - .required_clks = MT7629_CLKS_BITMAP, - .required_pctl = false, - .has_accounting = true, -+ .num_devs = 2, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4830,6 +4855,7 @@ static const struct mtk_soc_data mt7981_ - .hash_offset = 4, - .foe_entry_size = sizeof(struct mtk_foe_entry), - .has_accounting = true, -+ .num_devs = 2, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma_v2), - .rxd_size = sizeof(struct mtk_rx_dma_v2), -@@ -4849,6 +4875,7 @@ static const struct mtk_soc_data mt7986_ - .required_pctl = false, - .offload_version = 2, - .hash_offset = 4, -+ .num_devs = 2, - .foe_entry_size = sizeof(struct mtk_foe_entry), - .has_accounting = true, - .txrx = { -@@ -4867,6 +4894,7 @@ static const struct mtk_soc_data rt5350_ - .hw_features = MTK_HW_FEATURES_MT7628, - .required_clks = MT7628_CLKS_BITMAP, - .required_pctl = false, -+ .num_devs = 2, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1018,6 +1018,7 @@ struct mtk_reg_map { - * @required_pctl A bool value to show whether the SoC requires - * the extra setup for those pins used by GMAC. - * @hash_offset Flow table hash offset. -+ * @num_devs SoC number of macs. - * @foe_entry_size Foe table entry size. - * @has_accounting Bool indicating support for accounting of - * offloaded flows. -@@ -1036,6 +1037,7 @@ struct mtk_soc_data { - bool required_pctl; - u8 offload_version; - u8 hash_offset; -+ u8 num_devs; - u16 foe_entry_size; - netdev_features_t hw_features; - bool has_accounting; -@@ -1051,9 +1053,6 @@ struct mtk_soc_data { - - #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) - --/* currently no SoC has more than 2 macs */ --#define MTK_MAX_DEVS 2 -- - /* struct mtk_eth - This is the main datasructure for holding the state - * of the driver - * @dev: The device pointer -@@ -1108,14 +1107,14 @@ struct mtk_eth { - spinlock_t tx_irq_lock; - spinlock_t rx_irq_lock; - struct net_device dummy_dev; -- struct net_device *netdev[MTK_MAX_DEVS]; -- struct mtk_mac *mac[MTK_MAX_DEVS]; -+ struct net_device **netdev; -+ struct mtk_mac **mac; - int irq[3]; - u32 msg_enable; - unsigned long sysclk; - struct regmap *ethsys; - struct regmap *infra; -- struct phylink_pcs *sgmii_pcs[MTK_MAX_DEVS]; -+ struct phylink_pcs **sgmii_pcs; - struct regmap *pctl; - bool hwlro; - refcount_t dma_refcnt; diff --git a/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch b/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch deleted file mode 100644 index e8402c0974c434..00000000000000 --- a/target/linux/generic/pending-5.15/737-06-net-ethernet-mtk_eth_soc-add-support-for-MT7988-SoC.patch +++ /dev/null @@ -1,495 +0,0 @@ -From 661bacf4363ca68939c15e20056b5f72fbd034e7 Mon Sep 17 00:00:00 2001 -From: Lorenzo Bianconi -Date: Sat, 25 Feb 2023 00:08:24 +0100 -Subject: [PATCH 6/7] net: ethernet: mtk_eth_soc: add support for MT7988 SoC - -Introduce support for ethernet chip available in MT7988 SoC to -mtk_eth_soc driver. ---- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 153 ++++++++++++++-- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 193 ++++++++++++++------ - 2 files changed, 279 insertions(+), 67 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -152,6 +152,54 @@ static const struct mtk_reg_map mt7986_r - .pse_oq_sta = 0x01a0, - }; - -+static const struct mtk_reg_map mt7988_reg_map = { -+ .tx_irq_mask = 0x461c, -+ .tx_irq_status = 0x4618, -+ .pdma = { -+ .rx_ptr = 0x6900, -+ .rx_cnt_cfg = 0x6904, -+ .pcrx_ptr = 0x6908, -+ .glo_cfg = 0x6a04, -+ .rst_idx = 0x6a08, -+ .delay_irq = 0x6a0c, -+ .irq_status = 0x6a20, -+ .irq_mask = 0x6a28, -+ .adma_rx_dbg0 = 0x6a38, -+ .int_grp = 0x6a50, -+ }, -+ .qdma = { -+ .qtx_cfg = 0x4400, -+ .qtx_sch = 0x4404, -+ .rx_ptr = 0x4500, -+ .rx_cnt_cfg = 0x4504, -+ .qcrx_ptr = 0x4508, -+ .glo_cfg = 0x4604, -+ .rst_idx = 0x4608, -+ .delay_irq = 0x460c, -+ .fc_th = 0x4610, -+ .int_grp = 0x4620, -+ .hred = 0x4644, -+ .ctx_ptr = 0x4700, -+ .dtx_ptr = 0x4704, -+ .crx_ptr = 0x4710, -+ .drx_ptr = 0x4714, -+ .fq_head = 0x4720, -+ .fq_tail = 0x4724, -+ .fq_count = 0x4728, -+ .fq_blen = 0x472c, -+ .tx_sch_rate = 0x4798, -+ }, -+ .gdm1_cnt = 0x1c00, -+ .gdma_to_ppe0 = 0x3333, -+ .ppe_base = 0x2200, -+ .wdma_base = { -+ [0] = 0x4800, -+ [1] = 0x4c00, -+ }, -+ .pse_iq_sta = 0x0180, -+ .pse_oq_sta = 0x01a0, -+}; -+ - /* strings used by ethtool */ - static const struct mtk_ethtool_stats { - char str[ETH_GSTRING_LEN]; -@@ -179,10 +227,54 @@ static const struct mtk_ethtool_stats { - }; - - static const char * const mtk_clks_source_name[] = { -- "ethif", "sgmiitop", "esw", "gp0", "gp1", "gp2", "fe", "trgpll", -- "sgmii_tx250m", "sgmii_rx250m", "sgmii_cdr_ref", "sgmii_cdr_fb", -- "sgmii2_tx250m", "sgmii2_rx250m", "sgmii2_cdr_ref", "sgmii2_cdr_fb", -- "sgmii_ck", "eth2pll", "wocpu0", "wocpu1", "netsys0", "netsys1" -+ "ethif", -+ "sgmiitop", -+ "esw", -+ "gp0", -+ "gp1", -+ "gp2", -+ "gp3", -+ "xgp1", -+ "xgp2", -+ "xgp3", -+ "crypto", -+ "fe", -+ "trgpll", -+ "sgmii_tx250m", -+ "sgmii_rx250m", -+ "sgmii_cdr_ref", -+ "sgmii_cdr_fb", -+ "sgmii2_tx250m", -+ "sgmii2_rx250m", -+ "sgmii2_cdr_ref", -+ "sgmii2_cdr_fb", -+ "sgmii_ck", -+ "eth2pll", -+ "wocpu0", -+ "wocpu1", -+ "netsys0", -+ "netsys1", -+ "ethwarp_wocpu2", -+ "ethwarp_wocpu1", -+ "ethwarp_wocpu0", -+ "top_usxgmii0_sel", -+ "top_usxgmii1_sel", -+ "top_sgm0_sel", -+ "top_sgm1_sel", -+ "top_xfi_phy0_xtal_sel", -+ "top_xfi_phy1_xtal_sel", -+ "top_eth_gmii_sel", -+ "top_eth_refck_50m_sel", -+ "top_eth_sys_200m_sel", -+ "top_eth_sys_sel", -+ "top_eth_xgmii_sel", -+ "top_eth_mii_sel", -+ "top_netsys_sel", -+ "top_netsys_500m_sel", -+ "top_netsys_pao_2x_sel", -+ "top_netsys_sync_250m_sel", -+ "top_netsys_ppefb_250m_sel", -+ "top_netsys_warp_sel", - }; - - void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) -@@ -1207,10 +1299,19 @@ static void mtk_tx_set_dma_desc_v2(struc - data |= TX_DMA_LS0; - WRITE_ONCE(desc->txd3, data); - -- if (mac->id == MTK_GMAC3_ID) -- data = PSE_GDM3_PORT; -- else -- data = (mac->id + 1) << TX_DMA_FPORT_SHIFT_V2; /* forward port */ -+ /* set forward port */ -+ switch (mac->id) { -+ case MTK_GMAC1_ID: -+ data = PSE_GDM1_PORT << TX_DMA_FPORT_SHIFT_V2; -+ break; -+ case MTK_GMAC2_ID: -+ data = PSE_GDM2_PORT << TX_DMA_FPORT_SHIFT_V2; -+ break; -+ case MTK_GMAC3_ID: -+ data = PSE_GDM3_PORT << TX_DMA_FPORT_SHIFT_V2; -+ break; -+ } -+ - data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid); - WRITE_ONCE(desc->txd4, data); - -@@ -4957,6 +5058,25 @@ static const struct mtk_soc_data mt7986_ - }, - }; - -+static const struct mtk_soc_data mt7988_data = { -+ .reg_map = &mt7988_reg_map, -+ .ana_rgc3 = 0x128, -+ .caps = MT7988_CAPS, -+ .hw_features = MTK_HW_FEATURES, -+ .required_clks = MT7988_CLKS_BITMAP, -+ .required_pctl = false, -+ .num_devs = 3, -+ .txrx = { -+ .txd_size = sizeof(struct mtk_tx_dma_v2), -+ .rxd_size = sizeof(struct mtk_rx_dma_v2), -+ .rx_irq_done_mask = MTK_RX_DONE_INT_V2, -+ .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, -+ .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, -+ .dma_len_offset = 8, -+ }, -+}; -+ -+ - static const struct mtk_soc_data rt5350_data = { - .reg_map = &mt7628_reg_map, - .caps = MT7628_CAPS, -@@ -4975,14 +5095,15 @@ static const struct mtk_soc_data rt5350_ - }; - - const struct of_device_id of_mtk_match[] = { -- { .compatible = "mediatek,mt2701-eth", .data = &mt2701_data}, -- { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data}, -- { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, -- { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, -- { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, -- { .compatible = "mediatek,mt7981-eth", .data = &mt7981_data}, -- { .compatible = "mediatek,mt7986-eth", .data = &mt7986_data}, -- { .compatible = "ralink,rt5350-eth", .data = &rt5350_data}, -+ { .compatible = "mediatek,mt2701-eth", .data = &mt2701_data }, -+ { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data }, -+ { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data }, -+ { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data }, -+ { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data }, -+ { .compatible = "mediatek,mt7981-eth", .data = &mt7981_data }, -+ { .compatible = "mediatek,mt7986-eth", .data = &mt7986_data }, -+ { .compatible = "mediatek,mt7988-eth", .data = &mt7988_data }, -+ { .compatible = "ralink,rt5350-eth", .data = &rt5350_data }, - {}, - }; - MODULE_DEVICE_TABLE(of, of_mtk_match); ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -116,7 +116,8 @@ - #define MTK_CDMP_EG_CTRL 0x404 - - /* GDM Exgress Control Register */ --#define MTK_GDMA_FWD_CFG(x) (0x500 + (x * 0x1000)) -+#define MTK_GDMA_FWD_CFG(x) ((x == MTK_GMAC3_ID) ? \ -+ 0x540 : 0x500 + (x * 0x1000)) - #define MTK_GDMA_SPECIAL_TAG BIT(24) - #define MTK_GDMA_ICS_EN BIT(22) - #define MTK_GDMA_TCS_EN BIT(21) -@@ -650,6 +651,11 @@ enum mtk_clks_map { - MTK_CLK_GP0, - MTK_CLK_GP1, - MTK_CLK_GP2, -+ MTK_CLK_GP3, -+ MTK_CLK_XGP1, -+ MTK_CLK_XGP2, -+ MTK_CLK_XGP3, -+ MTK_CLK_CRYPTO, - MTK_CLK_FE, - MTK_CLK_TRGPLL, - MTK_CLK_SGMII_TX_250M, -@@ -666,57 +672,108 @@ enum mtk_clks_map { - MTK_CLK_WOCPU1, - MTK_CLK_NETSYS0, - MTK_CLK_NETSYS1, -+ MTK_CLK_ETHWARP_WOCPU2, -+ MTK_CLK_ETHWARP_WOCPU1, -+ MTK_CLK_ETHWARP_WOCPU0, -+ MTK_CLK_TOP_USXGMII_SBUS_0_SEL, -+ MTK_CLK_TOP_USXGMII_SBUS_1_SEL, -+ MTK_CLK_TOP_SGM_0_SEL, -+ MTK_CLK_TOP_SGM_1_SEL, -+ MTK_CLK_TOP_XFI_PHY_0_XTAL_SEL, -+ MTK_CLK_TOP_XFI_PHY_1_XTAL_SEL, -+ MTK_CLK_TOP_ETH_GMII_SEL, -+ MTK_CLK_TOP_ETH_REFCK_50M_SEL, -+ MTK_CLK_TOP_ETH_SYS_200M_SEL, -+ MTK_CLK_TOP_ETH_SYS_SEL, -+ MTK_CLK_TOP_ETH_XGMII_SEL, -+ MTK_CLK_TOP_ETH_MII_SEL, -+ MTK_CLK_TOP_NETSYS_SEL, -+ MTK_CLK_TOP_NETSYS_500M_SEL, -+ MTK_CLK_TOP_NETSYS_PAO_2X_SEL, -+ MTK_CLK_TOP_NETSYS_SYNC_250M_SEL, -+ MTK_CLK_TOP_NETSYS_PPEFB_250M_SEL, -+ MTK_CLK_TOP_NETSYS_WARP_SEL, - MTK_CLK_MAX - }; - --#define MT7623_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ -- BIT(MTK_CLK_GP1) | BIT(MTK_CLK_GP2) | \ -- BIT(MTK_CLK_TRGPLL)) --#define MT7622_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ -- BIT(MTK_CLK_GP0) | BIT(MTK_CLK_GP1) | \ -- BIT(MTK_CLK_GP2) | \ -- BIT(MTK_CLK_SGMII_TX_250M) | \ -- BIT(MTK_CLK_SGMII_RX_250M) | \ -- BIT(MTK_CLK_SGMII_CDR_REF) | \ -- BIT(MTK_CLK_SGMII_CDR_FB) | \ -- BIT(MTK_CLK_SGMII_CK) | \ -- BIT(MTK_CLK_ETH2PLL)) -+#define MT7623_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ -+ BIT_ULL(MTK_CLK_GP1) | BIT_ULL(MTK_CLK_GP2) | \ -+ BIT_ULL(MTK_CLK_TRGPLL)) -+#define MT7622_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ -+ BIT_ULL(MTK_CLK_GP0) | BIT_ULL(MTK_CLK_GP1) | \ -+ BIT_ULL(MTK_CLK_GP2) | \ -+ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ -+ BIT_ULL(MTK_CLK_SGMII_CK) | \ -+ BIT_ULL(MTK_CLK_ETH2PLL)) - #define MT7621_CLKS_BITMAP (0) - #define MT7628_CLKS_BITMAP (0) --#define MT7629_CLKS_BITMAP (BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) | \ -- BIT(MTK_CLK_GP0) | BIT(MTK_CLK_GP1) | \ -- BIT(MTK_CLK_GP2) | BIT(MTK_CLK_FE) | \ -- BIT(MTK_CLK_SGMII_TX_250M) | \ -- BIT(MTK_CLK_SGMII_RX_250M) | \ -- BIT(MTK_CLK_SGMII_CDR_REF) | \ -- BIT(MTK_CLK_SGMII_CDR_FB) | \ -- BIT(MTK_CLK_SGMII2_TX_250M) | \ -- BIT(MTK_CLK_SGMII2_RX_250M) | \ -- BIT(MTK_CLK_SGMII2_CDR_REF) | \ -- BIT(MTK_CLK_SGMII2_CDR_FB) | \ -- BIT(MTK_CLK_SGMII_CK) | \ -- BIT(MTK_CLK_ETH2PLL) | BIT(MTK_CLK_SGMIITOP)) --#define MT7981_CLKS_BITMAP (BIT(MTK_CLK_FE) | BIT(MTK_CLK_GP2) | BIT(MTK_CLK_GP1) | \ -- BIT(MTK_CLK_WOCPU0) | \ -- BIT(MTK_CLK_SGMII_TX_250M) | \ -- BIT(MTK_CLK_SGMII_RX_250M) | \ -- BIT(MTK_CLK_SGMII_CDR_REF) | \ -- BIT(MTK_CLK_SGMII_CDR_FB) | \ -- BIT(MTK_CLK_SGMII2_TX_250M) | \ -- BIT(MTK_CLK_SGMII2_RX_250M) | \ -- BIT(MTK_CLK_SGMII2_CDR_REF) | \ -- BIT(MTK_CLK_SGMII2_CDR_FB) | \ -- BIT(MTK_CLK_SGMII_CK)) --#define MT7986_CLKS_BITMAP (BIT(MTK_CLK_FE) | BIT(MTK_CLK_GP2) | BIT(MTK_CLK_GP1) | \ -- BIT(MTK_CLK_WOCPU1) | BIT(MTK_CLK_WOCPU0) | \ -- BIT(MTK_CLK_SGMII_TX_250M) | \ -- BIT(MTK_CLK_SGMII_RX_250M) | \ -- BIT(MTK_CLK_SGMII_CDR_REF) | \ -- BIT(MTK_CLK_SGMII_CDR_FB) | \ -- BIT(MTK_CLK_SGMII2_TX_250M) | \ -- BIT(MTK_CLK_SGMII2_RX_250M) | \ -- BIT(MTK_CLK_SGMII2_CDR_REF) | \ -- BIT(MTK_CLK_SGMII2_CDR_FB)) -+#define MT7629_CLKS_BITMAP (BIT_ULL(MTK_CLK_ETHIF) | BIT_ULL(MTK_CLK_ESW) | \ -+ BIT_ULL(MTK_CLK_GP0) | BIT_ULL(MTK_CLK_GP1) | \ -+ BIT_ULL(MTK_CLK_GP2) | BIT_ULL(MTK_CLK_FE) | \ -+ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ -+ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ -+ BIT_ULL(MTK_CLK_SGMII2_CDR_FB) | \ -+ BIT_ULL(MTK_CLK_SGMII_CK) | \ -+ BIT_ULL(MTK_CLK_ETH2PLL) | BIT_ULL(MTK_CLK_SGMIITOP)) -+#define MT7981_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_GP2) | BIT_ULL(MTK_CLK_GP1) | \ -+ BIT_ULL(MTK_CLK_WOCPU0) | \ -+ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ -+ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ -+ BIT_ULL(MTK_CLK_SGMII2_CDR_FB) | \ -+ BIT_ULL(MTK_CLK_SGMII_CK)) -+#define MT7986_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_GP2) | BIT_ULL(MTK_CLK_GP1) | \ -+ BIT_ULL(MTK_CLK_WOCPU1) | BIT_ULL(MTK_CLK_WOCPU0) | \ -+ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_REF) | \ -+ BIT_ULL(MTK_CLK_SGMII_CDR_FB) | \ -+ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_CDR_REF) | \ -+ BIT_ULL(MTK_CLK_SGMII2_CDR_FB)) -+#define MT7988_CLKS_BITMAP (BIT_ULL(MTK_CLK_FE) | BIT_ULL(MTK_CLK_ESW) | \ -+ BIT_ULL(MTK_CLK_GP1) | BIT_ULL(MTK_CLK_GP2) | \ -+ BIT_ULL(MTK_CLK_GP3) | BIT_ULL(MTK_CLK_XGP1) | \ -+ BIT_ULL(MTK_CLK_XGP2) | BIT_ULL(MTK_CLK_XGP3) | \ -+ BIT_ULL(MTK_CLK_CRYPTO) | \ -+ BIT_ULL(MTK_CLK_SGMII_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII_RX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_TX_250M) | \ -+ BIT_ULL(MTK_CLK_SGMII2_RX_250M) | \ -+ BIT_ULL(MTK_CLK_ETHWARP_WOCPU2) | \ -+ BIT_ULL(MTK_CLK_ETHWARP_WOCPU1) | \ -+ BIT_ULL(MTK_CLK_ETHWARP_WOCPU0) | \ -+ BIT_ULL(MTK_CLK_TOP_USXGMII_SBUS_0_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_USXGMII_SBUS_1_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_SGM_0_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_SGM_1_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_XFI_PHY_0_XTAL_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_XFI_PHY_1_XTAL_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_ETH_GMII_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_ETH_REFCK_50M_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_ETH_SYS_200M_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_ETH_SYS_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_ETH_XGMII_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_ETH_MII_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_NETSYS_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_NETSYS_500M_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_NETSYS_PAO_2X_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_NETSYS_SYNC_250M_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_NETSYS_PPEFB_250M_SEL) | \ -+ BIT_ULL(MTK_CLK_TOP_NETSYS_WARP_SEL)) - - enum mtk_dev_state { - MTK_HW_INIT, -@@ -844,6 +901,7 @@ enum mkt_eth_capabilities { - MTK_RGMII_BIT = 0, - MTK_TRGMII_BIT, - MTK_SGMII_BIT, -+ MTK_USXGMII_BIT, - MTK_ESW_BIT, - MTK_GEPHY_BIT, - MTK_MUX_BIT, -@@ -866,6 +924,8 @@ enum mkt_eth_capabilities { - MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT, - MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT, - MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT, -+ MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT, -+ MTK_ETH_MUX_GMAC123_TO_USXGMII_BIT, - - /* PATH BITS */ - MTK_ETH_PATH_GMAC1_RGMII_BIT, -@@ -874,13 +934,18 @@ enum mkt_eth_capabilities { - MTK_ETH_PATH_GMAC2_RGMII_BIT, - MTK_ETH_PATH_GMAC2_SGMII_BIT, - MTK_ETH_PATH_GMAC2_GEPHY_BIT, -+ MTK_ETH_PATH_GMAC3_SGMII_BIT, - MTK_ETH_PATH_GDM1_ESW_BIT, -+ MTK_ETH_PATH_GMAC1_USXGMII_BIT, -+ MTK_ETH_PATH_GMAC2_USXGMII_BIT, -+ MTK_ETH_PATH_GMAC3_USXGMII_BIT, - }; - - /* Supported hardware group on SoCs */ - #define MTK_RGMII BIT_ULL(MTK_RGMII_BIT) - #define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT) - #define MTK_SGMII BIT_ULL(MTK_SGMII_BIT) -+#define MTK_USXGMII BIT_ULL(MTK_USXGMII_BIT) - #define MTK_ESW BIT_ULL(MTK_ESW_BIT) - #define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT) - #define MTK_MUX BIT_ULL(MTK_MUX_BIT) -@@ -907,6 +972,10 @@ enum mkt_eth_capabilities { - BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) - #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \ - BIT_ULL(MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT) -+#define MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII \ -+ BIT_ULL(MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT) -+#define MTK_ETH_MUX_GMAC123_TO_USXGMII \ -+ BIT_ULL(MTK_ETH_MUX_GMAC123_TO_USXGMII_BIT) - - /* Supported path present on SoCs */ - #define MTK_ETH_PATH_GMAC1_RGMII BIT_ULL(MTK_ETH_PATH_GMAC1_RGMII_BIT) -@@ -915,7 +984,11 @@ enum mkt_eth_capabilities { - #define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT) - #define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT) - #define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT) -+#define MTK_ETH_PATH_GMAC3_SGMII BIT_ULL(MTK_ETH_PATH_GMAC3_SGMII_BIT) - #define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT) -+#define MTK_ETH_PATH_GMAC1_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC1_USXGMII_BIT) -+#define MTK_ETH_PATH_GMAC2_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC2_USXGMII_BIT) -+#define MTK_ETH_PATH_GMAC3_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC3_USXGMII_BIT) - - #define MTK_GMAC1_RGMII (MTK_ETH_PATH_GMAC1_RGMII | MTK_RGMII) - #define MTK_GMAC1_TRGMII (MTK_ETH_PATH_GMAC1_TRGMII | MTK_TRGMII) -@@ -923,7 +996,11 @@ enum mkt_eth_capabilities { - #define MTK_GMAC2_RGMII (MTK_ETH_PATH_GMAC2_RGMII | MTK_RGMII) - #define MTK_GMAC2_SGMII (MTK_ETH_PATH_GMAC2_SGMII | MTK_SGMII) - #define MTK_GMAC2_GEPHY (MTK_ETH_PATH_GMAC2_GEPHY | MTK_GEPHY) -+#define MTK_GMAC3_SGMII (MTK_ETH_PATH_GMAC3_SGMII | MTK_SGMII) - #define MTK_GDM1_ESW (MTK_ETH_PATH_GDM1_ESW | MTK_ESW) -+#define MTK_GMAC1_USXGMII (MTK_ETH_PATH_GMAC1_USXGMII | MTK_USXGMII) -+#define MTK_GMAC2_USXGMII (MTK_ETH_PATH_GMAC2_USXGMII | MTK_USXGMII) -+#define MTK_GMAC3_USXGMII (MTK_ETH_PATH_GMAC3_USXGMII | MTK_USXGMII) - - /* MUXes present on SoCs */ - /* 0: GDM1 -> GMAC1, 1: GDM1 -> ESW */ -@@ -946,6 +1023,12 @@ enum mkt_eth_capabilities { - #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ - (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) - -+#define MTK_MUX_GMAC123_TO_GEPHY_SGMII \ -+ (MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII | MTK_MUX) -+ -+#define MTK_MUX_GMAC123_TO_USXGMII \ -+ (MTK_ETH_MUX_GMAC123_TO_USXGMII | MTK_MUX | MTK_INFRA) -+ - #ifdef CONFIG_SOC_MT7621 - #define MTK_CAP_MASK MTK_NETSYS_V2 - #else -@@ -984,9 +1067,17 @@ enum mkt_eth_capabilities { - MTK_MUX_U3_GMAC2_TO_QPHY | MTK_U3_COPHY_V2 | \ - MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) - --#define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ -- MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ -- MTK_NETSYS_V2 | MTK_RSTCTRL_PPE1) -+#define MT7986_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ -+ MTK_MUX_GMAC12_TO_GEPHY_SGMII | \ -+ MTK_QDMA | MTK_NETSYS_V2 | \ -+ MTK_RSTCTRL_PPE1) -+ -+#define MT7988_CAPS (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \ -+ MTK_GMAC3_SGMII | MTK_QDMA | \ -+ MTK_MUX_GMAC123_TO_GEPHY_SGMII | \ -+ MTK_NETSYS_V3 | MTK_RSTCTRL_PPE1 | \ -+ MTK_GMAC1_USXGMII | MTK_GMAC2_USXGMII | \ -+ MTK_GMAC3_USXGMII | MTK_MUX_GMAC123_TO_USXGMII) - - struct mtk_tx_dma_desc_info { - dma_addr_t addr; -@@ -1072,7 +1163,7 @@ struct mtk_soc_data { - const struct mtk_reg_map *reg_map; - u32 ana_rgc3; - u64 caps; -- u32 required_clks; -+ u64 required_clks; - bool required_pctl; - u8 offload_version; - u8 hash_offset; diff --git a/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch deleted file mode 100644 index 4518bcb510a5a4..00000000000000 --- a/target/linux/generic/pending-5.15/737-07-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ /dev/null @@ -1,1867 +0,0 @@ -From 3d833ad2cfc1ab503d9aae2967b7f10811bb3c9c Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Wed, 1 Mar 2023 11:56:04 +0000 -Subject: [PATCH 7/7] net: ethernet: mtk_eth_soc: add paths and SerDes modes - for MT7988 - -MT7988 comes with a built-in 2.5G PHY as well as -USXGMII/10GBase-KR/5GBase-KR compatible SerDes lanes for external PHYs. -Add support for configuring the MAC and SerDes parts for the new paths. - -Signed-off-by: Daniel Golle ---- - drivers/net/ethernet/mediatek/Kconfig | 7 + - drivers/net/ethernet/mediatek/Makefile | 1 + - drivers/net/ethernet/mediatek/mtk_eth_path.c | 154 +++- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 270 +++++- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 194 ++++- - drivers/net/ethernet/mediatek/mtk_usxgmii.c | 835 +++++++++++++++++++ - 6 files changed, 1428 insertions(+), 33 deletions(-) - create mode 100644 drivers/net/ethernet/mediatek/mtk_usxgmii.c - ---- a/drivers/net/ethernet/mediatek/Kconfig -+++ b/drivers/net/ethernet/mediatek/Kconfig -@@ -24,6 +24,13 @@ config NET_MEDIATEK_SOC - This driver supports the gigabit ethernet MACs in the - MediaTek SoC family. - -+config NET_MEDIATEK_SOC_USXGMII -+ bool "Support USXGMII SerDes on MT7988" -+ depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST -+ def_bool NET_MEDIATEK_SOC != n -+ help -+ Include support for 10G SerDes which can be found on MT7988. -+ - config NET_MEDIATEK_STAR_EMAC - tristate "MediaTek STAR Ethernet MAC support" - select PHYLIB ---- a/drivers/net/ethernet/mediatek/Makefile -+++ b/drivers/net/ethernet/mediatek/Makefile -@@ -5,6 +5,7 @@ - - obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o - mtk_eth-y := mtk_eth_soc.o mtk_eth_path.o mtk_ppe.o mtk_ppe_debugfs.o mtk_ppe_offload.o -+mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_USXGMII) += mtk_usxgmii.o - mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed.o mtk_wed_mcu.o mtk_wed_wo.o - ifdef CONFIG_DEBUG_FS - mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_debugfs.o ---- a/drivers/net/ethernet/mediatek/mtk_eth_path.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c -@@ -31,10 +31,20 @@ static const char *mtk_eth_path_name(u64 - return "gmac2_rgmii"; - case MTK_ETH_PATH_GMAC2_SGMII: - return "gmac2_sgmii"; -+ case MTK_ETH_PATH_GMAC2_2P5GPHY: -+ return "gmac2_2p5gphy"; - case MTK_ETH_PATH_GMAC2_GEPHY: - return "gmac2_gephy"; -+ case MTK_ETH_PATH_GMAC3_SGMII: -+ return "gmac3_sgmii"; - case MTK_ETH_PATH_GDM1_ESW: - return "gdm1_esw"; -+ case MTK_ETH_PATH_GMAC1_USXGMII: -+ return "gmac1_usxgmii"; -+ case MTK_ETH_PATH_GMAC2_USXGMII: -+ return "gmac2_usxgmii"; -+ case MTK_ETH_PATH_GMAC3_USXGMII: -+ return "gmac3_usxgmii"; - default: - return "unknown path"; - } -@@ -42,8 +52,8 @@ static const char *mtk_eth_path_name(u64 - - static int set_mux_gdm1_to_gmac1_esw(struct mtk_eth *eth, u64 path) - { -+ u32 val, mask, set, reg; - bool updated = true; -- u32 val, mask, set; - - switch (path) { - case MTK_ETH_PATH_GMAC1_SGMII: -@@ -59,10 +69,15 @@ static int set_mux_gdm1_to_gmac1_esw(str - break; - } - -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) -+ reg = MTK_MAC_MISC_V3; -+ else -+ reg = MTK_MAC_MISC; -+ - if (updated) { -- val = mtk_r32(eth, MTK_MAC_MISC); -+ val = mtk_r32(eth, reg); - val = (val & mask) | set; -- mtk_w32(eth, val, MTK_MAC_MISC); -+ mtk_w32(eth, val, reg); - } - - dev_dbg(eth->dev, "path %s in %s updated = %d\n", -@@ -125,6 +140,31 @@ static int set_mux_u3_gmac2_to_qphy(stru - return 0; - } - -+static int set_mux_gmac2_to_2p5gphy(struct mtk_eth *eth, u64 path) -+{ -+ unsigned int val = 0; -+ bool updated = true; -+ int mac_id = 0; -+ -+ regmap_read(eth->ethsys, ETHSYS_SYSCFG0, &val); -+ -+ switch (path) { -+ case MTK_ETH_PATH_GMAC2_2P5GPHY: -+ val &= ~(u32)SYSCFG0_SGMII_GMAC2_V2; -+ mac_id = MTK_GMAC2_ID; -+ break; -+ default: -+ updated = false; -+ break; -+ }; -+ -+ if (updated) -+ regmap_update_bits(eth->ethsys, ETHSYS_SYSCFG0, -+ SYSCFG0_SGMII_MASK, val); -+ -+ return 0; -+} -+ - static int set_mux_gmac1_gmac2_to_sgmii_rgmii(struct mtk_eth *eth, u64 path) - { - unsigned int val = 0; -@@ -163,7 +203,61 @@ static int set_mux_gmac1_gmac2_to_sgmii_ - return 0; - } - --static int set_mux_gmac12_to_gephy_sgmii(struct mtk_eth *eth, u64 path) -+static int set_mux_gmac123_to_usxgmii(struct mtk_eth *eth, u64 path) -+{ -+ unsigned int val = 0; -+ bool updated = true; -+ int mac_id = 0; -+ -+ dev_dbg(eth->dev, "path %s in %s updated = %d\n", -+ mtk_eth_path_name(path), __func__, updated); -+ -+ /* Disable SYSCFG1 SGMII */ -+ regmap_read(eth->ethsys, ETHSYS_SYSCFG0, &val); -+ -+ switch (path) { -+ case MTK_ETH_PATH_GMAC1_USXGMII: -+ val &= ~(u32)SYSCFG0_SGMII_GMAC1_V2; -+ mac_id = MTK_GMAC1_ID; -+ break; -+ case MTK_ETH_PATH_GMAC2_USXGMII: -+ val &= ~(u32)SYSCFG0_SGMII_GMAC2_V2; -+ mac_id = MTK_GMAC2_ID; -+ break; -+ case MTK_ETH_PATH_GMAC3_USXGMII: -+ val &= ~(u32)SYSCFG0_SGMII_GMAC3_V2; -+ mac_id = MTK_GMAC3_ID; -+ break; -+ default: -+ updated = false; -+ }; -+ -+ if (updated) { -+ regmap_update_bits(eth->ethsys, ETHSYS_SYSCFG0, -+ SYSCFG0_SGMII_MASK, val); -+ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && -+ mac_id == MTK_GMAC2_ID) { -+ regmap_update_bits(eth->infra, -+ TOP_MISC_NETSYS_PCS_MUX, -+ NETSYS_PCS_MUX_MASK, -+ MUX_G2_USXGMII_SEL); -+ } -+ } -+ -+ /* Enable XGDM Path */ -+ val = mtk_r32(eth, MTK_GDMA_EG_CTRL(mac_id)); -+ val |= MTK_GDMA_XGDM_SEL; -+ mtk_w32(eth, val, MTK_GDMA_EG_CTRL(mac_id)); -+ -+ dev_dbg(eth->dev, "path %s in %s updated = %d\n", -+ mtk_eth_path_name(path), __func__, updated); -+ -+ -+ return 0; -+} -+ -+static int set_mux_gmac123_to_gephy_sgmii(struct mtk_eth *eth, u64 path) - { - unsigned int val = 0; - bool updated = true; -@@ -180,6 +274,9 @@ static int set_mux_gmac12_to_gephy_sgmii - case MTK_ETH_PATH_GMAC2_SGMII: - val |= SYSCFG0_SGMII_GMAC2_V2; - break; -+ case MTK_ETH_PATH_GMAC3_SGMII: -+ val |= SYSCFG0_SGMII_GMAC3_V2; -+ break; - default: - updated = false; - } -@@ -208,13 +305,25 @@ static const struct mtk_eth_muxc mtk_eth - .cap_bit = MTK_ETH_MUX_U3_GMAC2_TO_QPHY, - .set_path = set_mux_u3_gmac2_to_qphy, - }, { -+ .name = "mux_gmac2_to_2p5gphy", -+ .cap_bit = MTK_ETH_MUX_GMAC2_TO_2P5GPHY, -+ .set_path = set_mux_gmac2_to_2p5gphy, -+ }, { - .name = "mux_gmac1_gmac2_to_sgmii_rgmii", - .cap_bit = MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII, - .set_path = set_mux_gmac1_gmac2_to_sgmii_rgmii, - }, { - .name = "mux_gmac12_to_gephy_sgmii", - .cap_bit = MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII, -- .set_path = set_mux_gmac12_to_gephy_sgmii, -+ .set_path = set_mux_gmac123_to_gephy_sgmii, -+ }, { -+ .name = "mux_gmac123_to_gephy_sgmii", -+ .cap_bit = MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII, -+ .set_path = set_mux_gmac123_to_gephy_sgmii, -+ }, { -+ .name = "mux_gmac123_to_usxgmii", -+ .cap_bit = MTK_ETH_MUX_GMAC123_TO_USXGMII, -+ .set_path = set_mux_gmac123_to_usxgmii, - }, - }; - -@@ -243,16 +352,46 @@ static int mtk_eth_mux_setup(struct mtk_ - } - } - -+ dev_dbg(eth->dev, "leaving mux_setup %s\n", -+ mtk_eth_path_name(path)); -+ - out: - return err; - } - -+int mtk_gmac_usxgmii_path_setup(struct mtk_eth *eth, int mac_id) -+{ -+ u64 path; -+ -+ path = (mac_id == MTK_GMAC1_ID) ? MTK_ETH_PATH_GMAC1_USXGMII : -+ (mac_id == MTK_GMAC2_ID) ? MTK_ETH_PATH_GMAC2_USXGMII : -+ MTK_ETH_PATH_GMAC3_USXGMII; -+ -+ /* Setup proper MUXes along the path */ -+ return mtk_eth_mux_setup(eth, path); -+} -+ - int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id) - { - u64 path; - -- path = (mac_id == 0) ? MTK_ETH_PATH_GMAC1_SGMII : -- MTK_ETH_PATH_GMAC2_SGMII; -+ path = (mac_id == MTK_GMAC1_ID) ? MTK_ETH_PATH_GMAC1_SGMII : -+ (mac_id == MTK_GMAC2_ID) ? MTK_ETH_PATH_GMAC2_SGMII : -+ MTK_ETH_PATH_GMAC3_SGMII; -+ -+ /* Setup proper MUXes along the path */ -+ return mtk_eth_mux_setup(eth, path); -+} -+ -+int mtk_gmac_2p5gphy_path_setup(struct mtk_eth *eth, int mac_id) -+{ -+ u64 path = 0; -+ -+ if (mac_id == MTK_GMAC2_ID) -+ path = MTK_ETH_PATH_GMAC2_2P5GPHY; -+ -+ if (!path) -+ return -EINVAL; - - /* Setup proper MUXes along the path */ - return mtk_eth_mux_setup(eth, path); -@@ -282,4 +421,3 @@ int mtk_gmac_rgmii_path_setup(struct mtk - /* Setup proper MUXes along the path */ - return mtk_eth_mux_setup(eth, path); - } -- ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -437,6 +437,23 @@ static void mtk_gmac0_rgmii_adjust(struc - mtk_w32(eth, val, TRGMII_TCK_CTRL); - } - -+static void mtk_setup_bridge_switch(struct mtk_eth *eth) -+{ -+ int val; -+ -+ /* Force Port1 XGMAC Link Up */ -+ val = mtk_r32(eth, MTK_XGMAC_STS(MTK_GMAC1_ID)); -+ mtk_w32(eth, val | MTK_XGMAC_FORCE_LINK(MTK_GMAC1_ID), -+ MTK_XGMAC_STS(MTK_GMAC1_ID)); -+ -+ /* Adjust GSW bridge IPG to 11*/ -+ val = mtk_r32(eth, MTK_GSW_CFG); -+ val &= ~(GSWTX_IPG_MASK | GSWRX_IPG_MASK); -+ val |= (GSW_IPG_11 << GSWTX_IPG_SHIFT) | -+ (GSW_IPG_11 << GSWRX_IPG_SHIFT); -+ mtk_w32(eth, val, MTK_GSW_CFG); -+} -+ - static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config, - phy_interface_t interface) - { -@@ -451,6 +468,12 @@ static struct phylink_pcs *mtk_mac_selec - 0 : mac->id; - - return eth->sgmii_pcs[sid]; -+ } else if ((interface == PHY_INTERFACE_MODE_USXGMII || -+ interface == PHY_INTERFACE_MODE_10GKR || -+ interface == PHY_INTERFACE_MODE_5GBASER) && -+ MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && -+ mac->id != MTK_GMAC1_ID) { -+ return mtk_usxgmii_select_pcs(eth, mac->id); - } - - return NULL; -@@ -462,7 +485,7 @@ static void mtk_mac_config(struct phylin - struct mtk_mac *mac = container_of(config, struct mtk_mac, - phylink_config); - struct mtk_eth *eth = mac->hw; -- int val, ge_mode, err = 0; -+ int val, ge_mode, force_link, err = 0; - u32 i; - - /* MT76x8 has no hardware settings between for the MAC */ -@@ -506,6 +529,23 @@ static void mtk_mac_config(struct phylin - goto init_err; - } - break; -+ case PHY_INTERFACE_MODE_USXGMII: -+ case PHY_INTERFACE_MODE_10GKR: -+ case PHY_INTERFACE_MODE_5GBASER: -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) { -+ err = mtk_gmac_usxgmii_path_setup(eth, mac->id); -+ if (err) -+ goto init_err; -+ } -+ break; -+ case PHY_INTERFACE_MODE_INTERNAL: -+ if (mac->id == MTK_GMAC2_ID && -+ MTK_HAS_CAPS(eth->soc->caps, MTK_2P5GPHY)) { -+ err = mtk_gmac_2p5gphy_path_setup(eth, mac->id); -+ if (err) -+ goto init_err; -+ } -+ break; - default: - goto err_phy; - } -@@ -584,14 +624,78 @@ static void mtk_mac_config(struct phylin - SYSCFG0_SGMII_MASK, - ~(u32)SYSCFG0_SGMII_MASK); - -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { -+ mtk_xfi_pll_enable(eth); -+ mtk_sgmii_reset(eth, mac->id); -+ if (phylink_autoneg_inband(mode)) -+ mtk_sgmii_setup_phya_gen1(eth, mac->id); -+ else -+ mtk_sgmii_setup_phya_gen2(eth, mac->id); -+ } - /* Save the syscfg0 value for mac_finish */ - mac->syscfg0 = val; -- } else if (phylink_autoneg_inband(mode)) { -+ } else if (state->interface != PHY_INTERFACE_MODE_USXGMII && -+ state->interface != PHY_INTERFACE_MODE_10GKR && -+ state->interface != PHY_INTERFACE_MODE_5GBASER && -+ phylink_autoneg_inband(mode)) { - dev_err(eth->dev, -- "In-band mode not supported in non SGMII mode!\n"); -+ "In-band mode not supported in non-SerDes modes!\n"); - return; - } - -+ /* Setup gmac */ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && -+ (mtk_interface_mode_is_xgmii(state->interface) || -+ mac->interface == PHY_INTERFACE_MODE_INTERNAL)) { -+ mtk_w32(mac->hw, MTK_GDMA_XGDM_SEL, MTK_GDMA_EG_CTRL(mac->id)); -+ mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id)); -+ -+ switch (mac->id) { -+ case MTK_GMAC1_ID: -+ mtk_setup_bridge_switch(eth); -+ break; -+ case MTK_GMAC2_ID: -+ force_link = (mac->interface == -+ PHY_INTERFACE_MODE_INTERNAL) ? -+ MTK_XGMAC_FORCE_LINK(mac->id) : 0; -+ val = mtk_r32(eth, MTK_XGMAC_STS(mac->id)); -+ mtk_w32(eth, val | force_link, -+ MTK_XGMAC_STS(mac->id)); -+ break; -+ case MTK_GMAC3_ID: -+ val = mtk_r32(eth, MTK_XGMAC_STS(mac->id)); -+ mtk_w32(eth, val | MTK_XGMAC_FORCE_LINK(mac->id), -+ MTK_XGMAC_STS(mac->id)); -+ break; -+ } -+ } else { -+ val = mtk_r32(eth, MTK_GDMA_EG_CTRL(mac->id)); -+ mtk_w32(eth, val & ~MTK_GDMA_XGDM_SEL, -+ MTK_GDMA_EG_CTRL(mac->id)); -+ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { -+ switch (mac->id) { -+ case MTK_GMAC2_ID: -+ case MTK_GMAC3_ID: -+ val = mtk_r32(eth, MTK_XGMAC_STS(mac->id)); -+ mtk_w32(eth, -+ val & ~MTK_XGMAC_FORCE_LINK(mac->id), -+ MTK_XGMAC_STS(mac->id)); -+ break; -+ } -+ } -+ -+/* -+ if (mac->type != mac_type) { -+ if (atomic_read(&reset_pending) == 0) { -+ atomic_inc(&force); -+ schedule_work(ð->pending_work); -+ atomic_inc(&reset_pending); -+ } else -+ atomic_dec(&reset_pending); -+ } -+*/ -+ } - return; - - err_phy: -@@ -632,11 +736,40 @@ static int mtk_mac_finish(struct phylink - return 0; - } - --static void mtk_mac_pcs_get_state(struct phylink_config *config, -+static void mtk_xgdm_pcs_get_state(struct mtk_mac *mac, -+ struct phylink_link_state *state) -+{ -+ u32 sts = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id)); -+ -+ if (mac->id == MTK_GMAC2_ID) -+ sts = sts >> 16; -+ -+ state->link = FIELD_GET(MTK_USXGMII_PCS_LINK, sts); -+ if (!state->link) -+ return; -+ -+ state->duplex = DUPLEX_FULL; -+ state->interface = mac->interface; -+ -+ switch (FIELD_GET(MTK_USXGMII_PCS_MODE, sts)) { -+ case 0: -+ state->speed = SPEED_10000; -+ break; -+ case 1: -+ state->speed = SPEED_5000; -+ break; -+ case 2: -+ state->speed = SPEED_2500; -+ break; -+ case 3: -+ state->speed = SPEED_1000; -+ break; -+ } -+} -+ -+static void mtk_gdm_pcs_get_state(struct mtk_mac *mac, - struct phylink_link_state *state) - { -- struct mtk_mac *mac = container_of(config, struct mtk_mac, -- phylink_config); - u32 pmsr = mtk_r32(mac->hw, MTK_MAC_MSR(mac->id)); - - state->link = (pmsr & MAC_MSR_LINK); -@@ -664,15 +797,35 @@ static void mtk_mac_pcs_get_state(struct - state->pause |= MLO_PAUSE_TX; - } - -+static void mtk_mac_pcs_get_state(struct phylink_config *config, -+ struct phylink_link_state *state) -+{ -+ struct mtk_mac *mac = container_of(config, struct mtk_mac, -+ phylink_config); -+ -+ if (mtk_interface_mode_is_xgmii(state->interface)) -+ mtk_xgdm_pcs_get_state(mac, state); -+ else -+ mtk_gdm_pcs_get_state(mac, state); -+} -+ - static void mtk_mac_link_down(struct phylink_config *config, unsigned int mode, - phy_interface_t interface) - { - struct mtk_mac *mac = container_of(config, struct mtk_mac, - phylink_config); -- u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); -+ u32 mcr; - -- mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN); -- mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); -+ if (!mtk_interface_mode_is_xgmii(interface)) { -+ mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); -+ mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN); -+ mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); -+ } else if (mac->id != MTK_GMAC1_ID) { -+ mcr = mtk_r32(mac->hw, MTK_XMAC_MCR(mac->id)); -+ mcr &= 0xfffffff0; -+ mcr |= XMAC_MCR_TRX_DISABLE; -+ mtk_w32(mac->hw, mcr, MTK_XMAC_MCR(mac->id)); -+ } - } - - static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx, -@@ -744,13 +897,11 @@ static void mtk_set_queue_speed(struct m - mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); - } - --static void mtk_mac_link_up(struct phylink_config *config, -- struct phy_device *phy, -- unsigned int mode, phy_interface_t interface, -- int speed, int duplex, bool tx_pause, bool rx_pause) -+static void mtk_gdm_mac_link_up(struct mtk_mac *mac, -+ struct phy_device *phy, -+ unsigned int mode, phy_interface_t interface, -+ int speed, int duplex, bool tx_pause, bool rx_pause) - { -- struct mtk_mac *mac = container_of(config, struct mtk_mac, -- phylink_config); - u32 mcr; - - mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); -@@ -784,6 +935,47 @@ static void mtk_mac_link_up(struct phyli - mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); - } - -+static void mtk_xgdm_mac_link_up(struct mtk_mac *mac, -+ struct phy_device *phy, -+ unsigned int mode, phy_interface_t interface, -+ int speed, int duplex, bool tx_pause, bool rx_pause) -+{ -+ u32 mcr; -+ -+ if (mac->id == MTK_GMAC1_ID) -+ return; -+ -+ mcr = mtk_r32(mac->hw, MTK_XMAC_MCR(mac->id)); -+ -+ mcr &= ~(XMAC_MCR_FORCE_TX_FC | XMAC_MCR_FORCE_RX_FC); -+ /* Configure pause modes - -+ * phylink will avoid these for half duplex -+ */ -+ if (tx_pause) -+ mcr |= XMAC_MCR_FORCE_TX_FC; -+ if (rx_pause) -+ mcr |= XMAC_MCR_FORCE_RX_FC; -+ -+ mcr &= ~(XMAC_MCR_TRX_DISABLE); -+ mtk_w32(mac->hw, mcr, MTK_XMAC_MCR(mac->id)); -+} -+ -+static void mtk_mac_link_up(struct phylink_config *config, -+ struct phy_device *phy, -+ unsigned int mode, phy_interface_t interface, -+ int speed, int duplex, bool tx_pause, bool rx_pause) -+{ -+ struct mtk_mac *mac = container_of(config, struct mtk_mac, -+ phylink_config); -+ -+ if (mtk_interface_mode_is_xgmii(interface)) -+ mtk_xgdm_mac_link_up(mac, phy, mode, interface, speed, duplex, -+ tx_pause, rx_pause); -+ else -+ mtk_gdm_mac_link_up(mac, phy, mode, interface, speed, duplex, -+ tx_pause, rx_pause); -+} -+ - static const struct phylink_mac_ops mtk_phylink_ops = { - .validate = phylink_generic_validate, - .mac_select_pcs = mtk_mac_select_pcs, -@@ -836,10 +1028,21 @@ static int mtk_mdio_init(struct mtk_eth - } - divider = min_t(unsigned int, DIV_ROUND_UP(MDC_MAX_FREQ, max_clk), 63); - -+ /* Configure MDC Turbo Mode */ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { -+ val = mtk_r32(eth, MTK_MAC_MISC_V3); -+ val |= MISC_MDC_TURBO; -+ mtk_w32(eth, val, MTK_MAC_MISC_V3); -+ } else { -+ val = mtk_r32(eth, MTK_PPSC); -+ val |= PPSC_MDC_TURBO; -+ mtk_w32(eth, val, MTK_PPSC); -+ } -+ - /* Configure MDC Divider */ - val = mtk_r32(eth, MTK_PPSC); - val &= ~PPSC_MDC_CFG; -- val |= FIELD_PREP(PPSC_MDC_CFG, divider) | PPSC_MDC_TURBO; -+ val |= FIELD_PREP(PPSC_MDC_CFG, divider); - mtk_w32(eth, val, MTK_PPSC); - - dev_dbg(eth->dev, "MDC is running on %d Hz\n", MDC_MAX_FREQ / divider); -@@ -4415,8 +4618,8 @@ static int mtk_add_mac(struct mtk_eth *e - const __be32 *_id = of_get_property(np, "reg", NULL); - phy_interface_t phy_mode; - struct phylink *phylink; -- struct mtk_mac *mac; - int id, err; -+ struct mtk_mac *mac; - int txqs = 1; - - if (!_id) { -@@ -4518,6 +4721,32 @@ static int mtk_add_mac(struct mtk_eth *e - mac->phylink_config.supported_interfaces); - } - -+ if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_USXGMII)) { -+ if (id == MTK_GMAC1_ID) { -+ mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | -+ MAC_SYM_PAUSE | -+ MAC_10000FD; -+ phy_interface_zero( -+ mac->phylink_config.supported_interfaces); -+ __set_bit(PHY_INTERFACE_MODE_INTERNAL, -+ mac->phylink_config.supported_interfaces); -+ } else { -+ mac->phylink_config.mac_capabilities |= MAC_5000FD | MAC_10000FD; -+ __set_bit(PHY_INTERFACE_MODE_5GBASER, -+ mac->phylink_config.supported_interfaces); -+ __set_bit(PHY_INTERFACE_MODE_10GKR, -+ mac->phylink_config.supported_interfaces); -+ __set_bit(PHY_INTERFACE_MODE_USXGMII, -+ mac->phylink_config.supported_interfaces); -+ } -+ } -+ -+ if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_2P5GPHY)) { -+ if (id == MTK_GMAC2_ID) -+ __set_bit(PHY_INTERFACE_MODE_INTERNAL, -+ mac->phylink_config.supported_interfaces); -+ } -+ - phylink = phylink_create(&mac->phylink_config, - of_fwnode_handle(mac->of_node), - phy_mode, &mtk_phylink_ops); -@@ -4705,6 +4934,13 @@ static int mtk_probe(struct platform_dev - - if (err) - return err; -+ } -+ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) { -+ err = mtk_usxgmii_init(eth); -+ -+ if (err) -+ return err; - } - - if (eth->soc->required_pctl) { ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -126,6 +126,11 @@ - #define MTK_GDMA_TO_PDMA 0x0 - #define MTK_GDMA_DROP_ALL 0x7777 - -+/* GDM Egress Control Register */ -+#define MTK_GDMA_EG_CTRL(x) ((x == MTK_GMAC3_ID) ? \ -+ 0x544 : 0x504 + (x * 0x1000)) -+#define MTK_GDMA_XGDM_SEL BIT(31) -+ - /* Unicast Filter MAC Address Register - Low */ - #define MTK_GDMA_MAC_ADRL(x) (0x508 + (x * 0x1000)) - -@@ -386,7 +391,26 @@ - #define PHY_IAC_TIMEOUT HZ - - #define MTK_MAC_MISC 0x1000c -+#define MTK_MAC_MISC_V3 0x10010 - #define MTK_MUX_TO_ESW BIT(0) -+#define MISC_MDC_TURBO BIT(4) -+ -+/* XMAC status registers */ -+#define MTK_XGMAC_STS(x) ((x == MTK_GMAC3_ID) ? 0x1001C : 0x1000C) -+#define MTK_XGMAC_FORCE_LINK(x) ((x == MTK_GMAC2_ID) ? BIT(31) : BIT(15)) -+#define MTK_USXGMII_PCS_LINK BIT(8) -+#define MTK_XGMAC_RX_FC BIT(5) -+#define MTK_XGMAC_TX_FC BIT(4) -+#define MTK_USXGMII_PCS_MODE GENMASK(3, 1) -+#define MTK_XGMAC_LINK_STS BIT(0) -+ -+/* GSW bridge registers */ -+#define MTK_GSW_CFG (0x10080) -+#define GSWTX_IPG_MASK GENMASK(19, 16) -+#define GSWTX_IPG_SHIFT 16 -+#define GSWRX_IPG_MASK GENMASK(3, 0) -+#define GSWRX_IPG_SHIFT 0 -+#define GSW_IPG_11 11 - - /* Mac control registers */ - #define MTK_MAC_MCR(x) (0x10100 + (x * 0x100)) -@@ -411,6 +435,17 @@ - #define MAC_MCR_FORCE_LINK BIT(0) - #define MAC_MCR_FORCE_LINK_DOWN (MAC_MCR_FORCE_MODE) - -+/* Mac EEE control registers */ -+#define MTK_MAC_EEE(x) (0x10104 + (x * 0x100)) -+#define MAC_EEE_WAKEUP_TIME_1000 GENMASK(31, 24) -+#define MAC_EEE_WAKEUP_TIME_100 GENMASK(23, 16) -+#define MAC_EEE_LPI_TXIDLE_THD GENMASK(15, 8) -+#define MAC_EEE_RESV0 GENMASK(7, 4) -+#define MAC_EEE_CKG_TXILDE BIT(3) -+#define MAC_EEE_CKG_RXLPI BIT(2) -+#define MAC_EEE_TX_DOWN_REQ BIT(1) -+#define MAC_EEE_LPI_MODE BIT(0) -+ - /* Mac status registers */ - #define MTK_MAC_MSR(x) (0x10108 + (x * 0x100)) - #define MAC_MSR_EEE1G BIT(7) -@@ -455,6 +490,12 @@ - #define INTF_MODE_RGMII_1000 (TRGMII_MODE | TRGMII_CENTRAL_ALIGNED) - #define INTF_MODE_RGMII_10_100 0 - -+/* XFI Mac control registers */ -+#define MTK_XMAC_MCR(x) (0x12000 + ((x - 1) * 0x1000)) -+#define XMAC_MCR_TRX_DISABLE 0xf -+#define XMAC_MCR_FORCE_TX_FC BIT(5) -+#define XMAC_MCR_FORCE_RX_FC BIT(4) -+ - /* GPIO port control registers for GMAC 2*/ - #define GPIO_OD33_CTRL8 0x4c0 - #define GPIO_BIAS_CTRL 0xed0 -@@ -480,6 +521,7 @@ - #define SYSCFG0_SGMII_GMAC2 ((3 << 8) & SYSCFG0_SGMII_MASK) - #define SYSCFG0_SGMII_GMAC1_V2 BIT(9) - #define SYSCFG0_SGMII_GMAC2_V2 BIT(8) -+#define SYSCFG0_SGMII_GMAC3_V2 BIT(7) - - - /* ethernet subsystem clock register */ -@@ -506,16 +548,91 @@ - #define ETHSYS_DMA_AG_MAP_QDMA BIT(1) - #define ETHSYS_DMA_AG_MAP_PPE BIT(2) - -+/* USXGMII subsystem config registers */ -+/* Register to control speed */ -+#define RG_PHY_TOP_SPEED_CTRL1 0x80C -+#define USXGMII_RATE_UPDATE_MODE BIT(31) -+#define USXGMII_MAC_CK_GATED BIT(29) -+#define USXGMII_IF_FORCE_EN BIT(28) -+#define USXGMII_RATE_ADAPT_MODE GENMASK(10, 8) -+#define USXGMII_RATE_ADAPT_MODE_X1 0 -+#define USXGMII_RATE_ADAPT_MODE_X2 1 -+#define USXGMII_RATE_ADAPT_MODE_X4 2 -+#define USXGMII_RATE_ADAPT_MODE_X10 3 -+#define USXGMII_RATE_ADAPT_MODE_X100 4 -+#define USXGMII_RATE_ADAPT_MODE_X5 5 -+#define USXGMII_RATE_ADAPT_MODE_X50 6 -+#define USXGMII_XFI_RX_MODE GENMASK(6, 4) -+#define USXGMII_XFI_RX_MODE_10G 0 -+#define USXGMII_XFI_RX_MODE_5G 1 -+#define USXGMII_XFI_TX_MODE GENMASK(2, 0) -+#define USXGMII_XFI_TX_MODE_10G 0 -+#define USXGMII_XFI_TX_MODE_5G 1 -+ -+/* Register to control PCS AN */ -+#define RG_PCS_AN_CTRL0 0x810 -+#define USXGMII_AN_RESTART BIT(31) -+#define USXGMII_AN_SYNC_CNT GENMASK(30, 11) -+#define USXGMII_AN_ENABLE BIT(0) -+ -+#define RG_PCS_AN_CTRL2 0x818 -+#define USXGMII_LINK_TIMER_IDLE_DETECT GENMASK(29, 20) -+#define USXGMII_LINK_TIMER_COMP_ACK_DETECT GENMASK(19, 10) -+#define USXGMII_LINK_TIMER_AN_RESTART GENMASK(9, 0) -+ -+/* Register to read PCS AN status */ -+#define RG_PCS_AN_STS0 0x81c -+#define USXGMII_LPA_SPEED_MASK GENMASK(11, 9) -+#define USXGMII_LPA_SPEED_10 0 -+#define USXGMII_LPA_SPEED_100 1 -+#define USXGMII_LPA_SPEED_1000 2 -+#define USXGMII_LPA_SPEED_10000 3 -+#define USXGMII_LPA_SPEED_2500 4 -+#define USXGMII_LPA_SPEED_5000 5 -+#define USXGMII_LPA_DUPLEX BIT(12) -+#define USXGMII_LPA_LINK BIT(15) -+#define USXGMII_LPA_LATCH BIT(31) -+ -+/* Register to control USXGMII XFI PLL digital */ -+#define XFI_PLL_DIG_GLB8 0x08 -+#define RG_XFI_PLL_EN BIT(31) -+ -+/* Register to control USXGMII XFI PLL analog */ -+#define XFI_PLL_ANA_GLB8 0x108 -+#define RG_XFI_PLL_ANA_SWWA 0x02283248 -+ - /* Infrasys subsystem config registers */ - #define INFRA_MISC2 0x70c - #define CO_QPHY_SEL BIT(0) - #define GEPHY_MAC_SEL BIT(1) - -+/* Toprgu subsystem config registers */ -+#define TOPRGU_SWSYSRST 0x18 -+#define SWSYSRST_UNLOCK_KEY GENMASK(31, 24) -+#define SWSYSRST_XFI_PLL_GRST BIT(16) -+#define SWSYSRST_XFI_PEXPT1_GRST BIT(15) -+#define SWSYSRST_XFI_PEXPT0_GRST BIT(14) -+#define SWSYSRST_XFI1_GRST BIT(13) -+#define SWSYSRST_XFI0_GRST BIT(12) -+#define SWSYSRST_SGMII1_GRST BIT(2) -+#define SWSYSRST_SGMII0_GRST BIT(1) -+#define TOPRGU_SWSYSRST_EN 0xFC -+ - /* Top misc registers */ -+#define TOP_MISC_NETSYS_PCS_MUX 0x84 -+#define NETSYS_PCS_MUX_MASK GENMASK(1, 0) -+#define MUX_G2_USXGMII_SEL BIT(1) -+#define MUX_HSGMII1_G1_SEL BIT(0) -+ - #define USB_PHY_SWITCH_REG 0x218 - #define QPHY_SEL_MASK GENMASK(1, 0) - #define SGMII_QPHY_SEL 0x2 - -+/* MDIO control */ -+#define MII_MMD_ACC_CTL_REG 0x0d -+#define MII_MMD_ADDR_DATA_REG 0x0e -+#define MMD_OP_MODE_DATA BIT(14) -+ - /* MT7628/88 specific stuff */ - #define MT7628_PDMA_OFFSET 0x0800 - #define MT7628_SDM_OFFSET 0x0c00 -@@ -809,13 +926,6 @@ enum mtk_gmac_id { - MTK_GMAC_ID_MAX - }; - --/* GDM Type */ --enum mtk_gdm_type { -- MTK_GDM_TYPE = 0, -- MTK_XGDM_TYPE, -- MTK_GDM_TYPE_MAX --}; -- - enum mtk_tx_buf_type { - MTK_TYPE_SKB, - MTK_TYPE_XDP_TX, -@@ -902,6 +1012,7 @@ enum mkt_eth_capabilities { - MTK_TRGMII_BIT, - MTK_SGMII_BIT, - MTK_USXGMII_BIT, -+ MTK_2P5GPHY_BIT, - MTK_ESW_BIT, - MTK_GEPHY_BIT, - MTK_MUX_BIT, -@@ -922,6 +1033,7 @@ enum mkt_eth_capabilities { - MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT, - MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT, - MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT, -+ MTK_ETH_MUX_GMAC2_TO_2P5GPHY_BIT, - MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT, - MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT, - MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT, -@@ -933,6 +1045,7 @@ enum mkt_eth_capabilities { - MTK_ETH_PATH_GMAC1_SGMII_BIT, - MTK_ETH_PATH_GMAC2_RGMII_BIT, - MTK_ETH_PATH_GMAC2_SGMII_BIT, -+ MTK_ETH_PATH_GMAC2_2P5GPHY_BIT, - MTK_ETH_PATH_GMAC2_GEPHY_BIT, - MTK_ETH_PATH_GMAC3_SGMII_BIT, - MTK_ETH_PATH_GDM1_ESW_BIT, -@@ -946,6 +1059,7 @@ enum mkt_eth_capabilities { - #define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT) - #define MTK_SGMII BIT_ULL(MTK_SGMII_BIT) - #define MTK_USXGMII BIT_ULL(MTK_USXGMII_BIT) -+#define MTK_2P5GPHY BIT_ULL(MTK_2P5GPHY_BIT) - #define MTK_ESW BIT_ULL(MTK_ESW_BIT) - #define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT) - #define MTK_MUX BIT_ULL(MTK_MUX_BIT) -@@ -968,6 +1082,8 @@ enum mkt_eth_capabilities { - BIT_ULL(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT) - #define MTK_ETH_MUX_U3_GMAC2_TO_QPHY \ - BIT_ULL(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT) -+#define MTK_ETH_MUX_GMAC2_TO_2P5GPHY \ -+ BIT_ULL(MTK_ETH_MUX_GMAC2_TO_2P5GPHY_BIT) - #define MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII \ - BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) - #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \ -@@ -983,6 +1099,7 @@ enum mkt_eth_capabilities { - #define MTK_ETH_PATH_GMAC1_SGMII BIT_ULL(MTK_ETH_PATH_GMAC1_SGMII_BIT) - #define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT) - #define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT) -+#define MTK_ETH_PATH_GMAC2_2P5GPHY BIT_ULL(MTK_ETH_PATH_GMAC2_2P5GPHY_BIT) - #define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT) - #define MTK_ETH_PATH_GMAC3_SGMII BIT_ULL(MTK_ETH_PATH_GMAC3_SGMII_BIT) - #define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT) -@@ -996,6 +1113,7 @@ enum mkt_eth_capabilities { - #define MTK_GMAC2_RGMII (MTK_ETH_PATH_GMAC2_RGMII | MTK_RGMII) - #define MTK_GMAC2_SGMII (MTK_ETH_PATH_GMAC2_SGMII | MTK_SGMII) - #define MTK_GMAC2_GEPHY (MTK_ETH_PATH_GMAC2_GEPHY | MTK_GEPHY) -+#define MTK_GMAC2_2P5GPHY (MTK_ETH_PATH_GMAC2_2P5GPHY | MTK_2P5GPHY) - #define MTK_GMAC3_SGMII (MTK_ETH_PATH_GMAC3_SGMII | MTK_SGMII) - #define MTK_GDM1_ESW (MTK_ETH_PATH_GDM1_ESW | MTK_ESW) - #define MTK_GMAC1_USXGMII (MTK_ETH_PATH_GMAC1_USXGMII | MTK_USXGMII) -@@ -1019,6 +1137,10 @@ enum mkt_eth_capabilities { - (MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | MTK_MUX | \ - MTK_SHARED_SGMII) - -+/* 2: GMAC2 -> XGMII */ -+#define MTK_MUX_GMAC2_TO_2P5GPHY \ -+ (MTK_ETH_MUX_GMAC2_TO_2P5GPHY | MTK_MUX | MTK_INFRA) -+ - /* 0: GMACx -> GEPHY, 1: GMACx -> SGMII where x is 1 or 2 */ - #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ - (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) -@@ -1077,7 +1199,8 @@ enum mkt_eth_capabilities { - MTK_MUX_GMAC123_TO_GEPHY_SGMII | \ - MTK_NETSYS_V3 | MTK_RSTCTRL_PPE1 | \ - MTK_GMAC1_USXGMII | MTK_GMAC2_USXGMII | \ -- MTK_GMAC3_USXGMII | MTK_MUX_GMAC123_TO_USXGMII) -+ MTK_GMAC3_USXGMII | MTK_MUX_GMAC123_TO_USXGMII | \ -+ MTK_GMAC2_2P5GPHY | MTK_MUX_GMAC2_TO_2P5GPHY) - - struct mtk_tx_dma_desc_info { - dma_addr_t addr; -@@ -1183,6 +1306,22 @@ struct mtk_soc_data { - - #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) - -+/* struct mtk_usxgmii_pcs - This structure holds each usxgmii regmap and -+ * associated data -+ * @regmap: The register map pointing at the range used to setup -+ * USXGMII modes -+ * @interface: Currently selected interface mode -+ * @id: The element is used to record the index of PCS -+ * @pcs: Phylink PCS structure -+ */ -+struct mtk_usxgmii_pcs { -+ struct mtk_eth *eth; -+ struct regmap *regmap; -+ phy_interface_t interface; -+ u8 id; -+ struct phylink_pcs pcs; -+}; -+ - /* struct mtk_eth - This is the main datasructure for holding the state - * of the driver - * @dev: The device pointer -@@ -1203,6 +1342,11 @@ struct mtk_soc_data { - * @infra: The register map pointing at the range used to setup - * SGMII and GePHY path - * @sgmii_pcs: Pointers to mtk-pcs-lynxi phylink_pcs instances -+ * @usxgmii_pll: The register map pointing at the range used to control -+ * the USXGMII SerDes PLL -+ * @regmap_pextp: The register map pointing at the range used to setup -+ * PHYA -+ * @usxgmii_pcs: Pointer to array of pointers to struct for USXGMII PCS - * @pctl: The register map pointing at the range used to setup - * GMAC port drive/slew values - * @dma_refcnt: track how many netdevs are using the DMA engine -@@ -1244,7 +1388,11 @@ struct mtk_eth { - unsigned long sysclk; - struct regmap *ethsys; - struct regmap *infra; -+ struct regmap *toprgu; - struct phylink_pcs **sgmii_pcs; -+ struct regmap *usxgmii_pll; -+ struct regmap **regmap_pextp; -+ struct mtk_usxgmii_pcs **usxgmii_pcs; - struct regmap *pctl; - bool hwlro; - refcount_t dma_refcnt; -@@ -1400,6 +1548,19 @@ static inline u32 mtk_get_ib2_multicast_ - return MTK_FOE_IB2_MULTICAST; - } - -+static inline bool mtk_interface_mode_is_xgmii(phy_interface_t interface) -+{ -+ switch (interface) { -+ case PHY_INTERFACE_MODE_USXGMII: -+ case PHY_INTERFACE_MODE_10GKR: -+ case PHY_INTERFACE_MODE_5GBASER: -+ return true; -+ break; -+ default: -+ return false; -+ } -+} -+ - /* read the hardware status register */ - void mtk_stats_update_mac(struct mtk_mac *mac); - -@@ -1407,8 +1568,10 @@ void mtk_w32(struct mtk_eth *eth, u32 va - u32 mtk_r32(struct mtk_eth *eth, unsigned reg); - - int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id); -+int mtk_gmac_2p5gphy_path_setup(struct mtk_eth *eth, int mac_id); - int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id); - int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id); -+int mtk_gmac_usxgmii_path_setup(struct mtk_eth *eth, int mac_id); - - int mtk_eth_offload_init(struct mtk_eth *eth); - int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type, -@@ -1418,5 +1581,20 @@ int mtk_flow_offload_cmd(struct mtk_eth - void mtk_flow_offload_cleanup(struct mtk_eth *eth, struct list_head *list); - void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev); - -+#ifdef CONFIG_NET_MEDIATEK_SOC_USXGMII -+struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int id); -+int mtk_usxgmii_init(struct mtk_eth *eth); -+int mtk_xfi_pll_enable(struct mtk_eth *eth); -+void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id); -+void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id); -+void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id); -+#else -+static inline struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int id) { return NULL; } -+static inline int mtk_usxgmii_init(struct mtk_eth *eth) { return 0; } -+static inline int mtk_xfi_pll_enable(struct mtk_eth *eth) { return 0; } -+static inline void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) { } -+static inline void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id) { } -+static inline void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) { } -+#endif /* NET_MEDIATEK_SOC_USXGMII */ - - #endif /* MTK_ETH_H */ ---- /dev/null -+++ b/drivers/net/ethernet/mediatek/mtk_usxgmii.c -@@ -0,0 +1,835 @@ -+/* SPDX-License-Identifier: GPL-2.0 -+ * -+ * Copyright (c) 2022 MediaTek Inc. -+ * Author: Henry Yen -+ * Daniel Golle -+ */ -+ -+#include -+#include -+#include -+#include "mtk_eth_soc.h" -+ -+static struct mtk_usxgmii_pcs *pcs_to_mtk_usxgmii_pcs(struct phylink_pcs *pcs) -+{ -+ return container_of(pcs, struct mtk_usxgmii_pcs, pcs); -+} -+ -+static int mtk_xfi_pextp_init(struct mtk_eth *eth) -+{ -+ struct device *dev = eth->dev; -+ struct device_node *r = dev->of_node; -+ struct device_node *np; -+ int i; -+ -+ eth->regmap_pextp = devm_kcalloc(dev, eth->soc->num_devs, sizeof(eth->regmap_pextp), GFP_KERNEL); -+ if (!eth->regmap_pextp) -+ return -ENOMEM; -+ -+ for (i = 0; i < eth->soc->num_devs; i++) { -+ np = of_parse_phandle(r, "mediatek,xfi_pextp", i); -+ if (!np) -+ break; -+ -+ eth->regmap_pextp[i] = syscon_node_to_regmap(np); -+ if (IS_ERR(eth->regmap_pextp[i])) -+ return PTR_ERR(eth->regmap_pextp[i]); -+ } -+ -+ return 0; -+} -+ -+static int mtk_xfi_pll_init(struct mtk_eth *eth) -+{ -+ struct device_node *r = eth->dev->of_node; -+ struct device_node *np; -+ -+ np = of_parse_phandle(r, "mediatek,xfi_pll", 0); -+ if (!np) -+ return -1; -+ -+ eth->usxgmii_pll = syscon_node_to_regmap(np); -+ if (IS_ERR(eth->usxgmii_pll)) -+ return PTR_ERR(eth->usxgmii_pll); -+ -+ return 0; -+} -+ -+static int mtk_toprgu_init(struct mtk_eth *eth) -+{ -+ struct device_node *r = eth->dev->of_node; -+ struct device_node *np; -+ -+ np = of_parse_phandle(r, "mediatek,toprgu", 0); -+ if (!np) -+ return -1; -+ -+ eth->toprgu = syscon_node_to_regmap(np); -+ if (IS_ERR(eth->toprgu)) -+ return PTR_ERR(eth->toprgu); -+ -+ return 0; -+} -+ -+int mtk_xfi_pll_enable(struct mtk_eth *eth) -+{ -+ u32 val = 0; -+ -+ if (!eth->usxgmii_pll) -+ return -EINVAL; -+ -+ /* Add software workaround for USXGMII PLL TCL issue */ -+ regmap_write(eth->usxgmii_pll, XFI_PLL_ANA_GLB8, RG_XFI_PLL_ANA_SWWA); -+ -+ regmap_read(eth->usxgmii_pll, XFI_PLL_DIG_GLB8, &val); -+ val |= RG_XFI_PLL_EN; -+ regmap_write(eth->usxgmii_pll, XFI_PLL_DIG_GLB8, val); -+ -+ return 0; -+} -+ -+static int mtk_mac2xgmii_id(struct mtk_eth *eth, int mac_id) -+{ -+ int xgmii_id = mac_id; -+ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { -+ switch (mac_id) { -+ case MTK_GMAC1_ID: -+ case MTK_GMAC2_ID: -+ xgmii_id = 1; -+ break; -+ case MTK_GMAC3_ID: -+ xgmii_id = 0; -+ break; -+ default: -+ xgmii_id = -1; -+ } -+ } -+ -+ return xgmii_id; -+} -+ -+static int mtk_xgmii2mac_id(struct mtk_eth *eth, int xgmii_id) -+{ -+ int mac_id = xgmii_id; -+ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { -+ switch (xgmii_id) { -+ case 0: -+ mac_id = 2; -+ break; -+ case 1: -+ mac_id = 1; -+ break; -+ default: -+ mac_id = -1; -+ } -+ } -+ -+ return mac_id; -+} -+ -+ -+static void mtk_usxgmii_setup_phya_usxgmii(struct mtk_usxgmii_pcs *mpcs) -+{ -+ struct regmap *pextp; -+ -+ if (!mpcs->eth) -+ return; -+ -+ pextp = mpcs->eth->regmap_pextp[mpcs->id]; -+ if (!pextp) -+ return; -+ -+ /* Setup operation mode */ -+ regmap_write(pextp, 0x9024, 0x00C9071C); -+ regmap_write(pextp, 0x2020, 0xAA8585AA); -+ regmap_write(pextp, 0x2030, 0x0C020707); -+ regmap_write(pextp, 0x2034, 0x0E050F0F); -+ regmap_write(pextp, 0x2040, 0x00140032); -+ regmap_write(pextp, 0x50F0, 0x00C014AA); -+ regmap_write(pextp, 0x50E0, 0x3777C12B); -+ regmap_write(pextp, 0x506C, 0x005F9CFF); -+ regmap_write(pextp, 0x5070, 0x9D9DFAFA); -+ regmap_write(pextp, 0x5074, 0x27273F3F); -+ regmap_write(pextp, 0x5078, 0xA7883C68); -+ regmap_write(pextp, 0x507C, 0x11661166); -+ regmap_write(pextp, 0x5080, 0x0E000AAF); -+ regmap_write(pextp, 0x5084, 0x08080D0D); -+ regmap_write(pextp, 0x5088, 0x02030909); -+ regmap_write(pextp, 0x50E4, 0x0C0C0000); -+ regmap_write(pextp, 0x50E8, 0x04040000); -+ regmap_write(pextp, 0x50EC, 0x0F0F0C06); -+ regmap_write(pextp, 0x50A8, 0x506E8C8C); -+ regmap_write(pextp, 0x6004, 0x18190000); -+ regmap_write(pextp, 0x00F8, 0x01423342); -+ /* Force SGDT_OUT off and select PCS */ -+ regmap_write(pextp, 0x00F4, 0x80201F20); -+ /* Force GLB_CKDET_OUT */ -+ regmap_write(pextp, 0x0030, 0x00050C00); -+ /* Force AEQ on */ -+ regmap_write(pextp, 0x0070, 0x02002800); -+ ndelay(1020); -+ /* Setup DA default value */ -+ regmap_write(pextp, 0x30B0, 0x00000020); -+ regmap_write(pextp, 0x3028, 0x00008A01); -+ regmap_write(pextp, 0x302C, 0x0000A884); -+ regmap_write(pextp, 0x3024, 0x00083002); -+ regmap_write(pextp, 0x3010, 0x00022220); -+ regmap_write(pextp, 0x5064, 0x0F020A01); -+ regmap_write(pextp, 0x50B4, 0x06100600); -+ regmap_write(pextp, 0x3048, 0x40704000); -+ regmap_write(pextp, 0x3050, 0xA8000000); -+ regmap_write(pextp, 0x3054, 0x000000AA); -+ regmap_write(pextp, 0x306C, 0x00000F00); -+ regmap_write(pextp, 0xA060, 0x00040000); -+ regmap_write(pextp, 0x90D0, 0x00000001); -+ /* Release reset */ -+ regmap_write(pextp, 0x0070, 0x0200E800); -+ udelay(150); -+ /* Switch to P0 */ -+ regmap_write(pextp, 0x0070, 0x0200C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0200C101); -+ udelay(15); -+ /* Switch to Gen3 */ -+ regmap_write(pextp, 0x0070, 0x0202C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0202C101); -+ udelay(100); -+ regmap_write(pextp, 0x30B0, 0x00000030); -+ regmap_write(pextp, 0x00F4, 0x80201F00); -+ regmap_write(pextp, 0x3040, 0x30000000); -+ udelay(400); -+} -+ -+static void mtk_usxgmii_setup_phya_5gbaser(struct mtk_usxgmii_pcs *mpcs) -+{ -+ struct regmap *pextp; -+ -+ if (!mpcs->eth) -+ return; -+ -+ pextp = mpcs->eth->regmap_pextp[mpcs->id]; -+ if (!pextp) -+ return; -+ -+ /* Setup operation mode */ -+ regmap_write(pextp, 0x9024, 0x00D9071C); -+ regmap_write(pextp, 0x2020, 0xAAA5A5AA); -+ regmap_write(pextp, 0x2030, 0x0C020707); -+ regmap_write(pextp, 0x2034, 0x0E050F0F); -+ regmap_write(pextp, 0x2040, 0x00140032); -+ regmap_write(pextp, 0x50F0, 0x00C018AA); -+ regmap_write(pextp, 0x50E0, 0x3777812B); -+ regmap_write(pextp, 0x506C, 0x005C9CFF); -+ regmap_write(pextp, 0x5070, 0x9DFAFAFA); -+ regmap_write(pextp, 0x5074, 0x273F3F3F); -+ regmap_write(pextp, 0x5078, 0xA8883868); -+ regmap_write(pextp, 0x507C, 0x14661466); -+ regmap_write(pextp, 0x5080, 0x0E001ABF); -+ regmap_write(pextp, 0x5084, 0x080B0D0D); -+ regmap_write(pextp, 0x5088, 0x02050909); -+ regmap_write(pextp, 0x50E4, 0x0C000000); -+ regmap_write(pextp, 0x50E8, 0x04000000); -+ regmap_write(pextp, 0x50EC, 0x0F0F0C06); -+ regmap_write(pextp, 0x50A8, 0x50808C8C); -+ regmap_write(pextp, 0x6004, 0x18000000); -+ regmap_write(pextp, 0x00F8, 0x00A132A1); -+ /* Force SGDT_OUT off and select PCS */ -+ regmap_write(pextp, 0x00F4, 0x80201F20); -+ /* Force GLB_CKDET_OUT */ -+ regmap_write(pextp, 0x0030, 0x00050C00); -+ /* Force AEQ on */ -+ regmap_write(pextp, 0x0070, 0x02002800); -+ ndelay(1020); -+ /* Setup DA default value */ -+ regmap_write(pextp, 0x30B0, 0x00000020); -+ regmap_write(pextp, 0x3028, 0x00008A01); -+ regmap_write(pextp, 0x302C, 0x0000A884); -+ regmap_write(pextp, 0x3024, 0x00083002); -+ regmap_write(pextp, 0x3010, 0x00022220); -+ regmap_write(pextp, 0x5064, 0x0F020A01); -+ regmap_write(pextp, 0x50B4, 0x06100600); -+ regmap_write(pextp, 0x3048, 0x40704000); -+ regmap_write(pextp, 0x3050, 0xA8000000); -+ regmap_write(pextp, 0x3054, 0x000000AA); -+ regmap_write(pextp, 0x306C, 0x00000F00); -+ regmap_write(pextp, 0xA060, 0x00040000); -+ regmap_write(pextp, 0x90D0, 0x00000003); -+ /* Release reset */ -+ regmap_write(pextp, 0x0070, 0x0200E800); -+ udelay(150); -+ /* Switch to P0 */ -+ regmap_write(pextp, 0x0070, 0x0200C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0200C101); -+ udelay(15); -+ /* Switch to Gen3 */ -+ regmap_write(pextp, 0x0070, 0x0202C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0202C101); -+ udelay(100); -+ regmap_write(pextp, 0x30B0, 0x00000030); -+ regmap_write(pextp, 0x00F4, 0x80201F00); -+ regmap_write(pextp, 0x3040, 0x30000000); -+ udelay(400); -+} -+ -+static void mtk_usxgmii_setup_phya_10gbaser(struct mtk_usxgmii_pcs *mpcs) -+{ -+ struct regmap *pextp; -+ -+ if (!mpcs->eth) -+ return; -+ -+ pextp = mpcs->eth->regmap_pextp[mpcs->id]; -+ if (!pextp) -+ return; -+ -+ /* Setup operation mode */ -+ regmap_write(pextp, 0x9024, 0x00C9071C); -+ regmap_write(pextp, 0x2020, 0xAA8585AA); -+ regmap_write(pextp, 0x2030, 0x0C020707); -+ regmap_write(pextp, 0x2034, 0x0E050F0F); -+ regmap_write(pextp, 0x2040, 0x00140032); -+ regmap_write(pextp, 0x50F0, 0x00C014AA); -+ regmap_write(pextp, 0x50E0, 0x3777C12B); -+ regmap_write(pextp, 0x506C, 0x005F9CFF); -+ regmap_write(pextp, 0x5070, 0x9D9DFAFA); -+ regmap_write(pextp, 0x5074, 0x27273F3F); -+ regmap_write(pextp, 0x5078, 0xA7883C68); -+ regmap_write(pextp, 0x507C, 0x11661166); -+ regmap_write(pextp, 0x5080, 0x0E000AAF); -+ regmap_write(pextp, 0x5084, 0x08080D0D); -+ regmap_write(pextp, 0x5088, 0x02030909); -+ regmap_write(pextp, 0x50E4, 0x0C0C0000); -+ regmap_write(pextp, 0x50E8, 0x04040000); -+ regmap_write(pextp, 0x50EC, 0x0F0F0C06); -+ regmap_write(pextp, 0x50A8, 0x506E8C8C); -+ regmap_write(pextp, 0x6004, 0x18190000); -+ regmap_write(pextp, 0x00F8, 0x01423342); -+ /* Force SGDT_OUT off and select PCS */ -+ regmap_write(pextp, 0x00F4, 0x80201F20); -+ /* Force GLB_CKDET_OUT */ -+ regmap_write(pextp, 0x0030, 0x00050C00); -+ /* Force AEQ on */ -+ regmap_write(pextp, 0x0070, 0x02002800); -+ ndelay(1020); -+ /* Setup DA default value */ -+ regmap_write(pextp, 0x30B0, 0x00000020); -+ regmap_write(pextp, 0x3028, 0x00008A01); -+ regmap_write(pextp, 0x302C, 0x0000A884); -+ regmap_write(pextp, 0x3024, 0x00083002); -+ regmap_write(pextp, 0x3010, 0x00022220); -+ regmap_write(pextp, 0x5064, 0x0F020A01); -+ regmap_write(pextp, 0x50B4, 0x06100600); -+ regmap_write(pextp, 0x3048, 0x47684100); -+ regmap_write(pextp, 0x3050, 0x00000000); -+ regmap_write(pextp, 0x3054, 0x00000000); -+ regmap_write(pextp, 0x306C, 0x00000F00); -+ if (mpcs->id == 0) -+ regmap_write(pextp, 0xA008, 0x0007B400); -+ -+ regmap_write(pextp, 0xA060, 0x00040000); -+ regmap_write(pextp, 0x90D0, 0x00000001); -+ /* Release reset */ -+ regmap_write(pextp, 0x0070, 0x0200E800); -+ udelay(150); -+ /* Switch to P0 */ -+ regmap_write(pextp, 0x0070, 0x0200C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0200C101); -+ udelay(15); -+ /* Switch to Gen3 */ -+ regmap_write(pextp, 0x0070, 0x0202C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0202C101); -+ udelay(100); -+ regmap_write(pextp, 0x30B0, 0x00000030); -+ regmap_write(pextp, 0x00F4, 0x80201F00); -+ regmap_write(pextp, 0x3040, 0x30000000); -+ udelay(400); -+} -+ -+void mtk_sgmii_setup_phya_gen1(struct mtk_eth *eth, int mac_id) -+{ -+ u32 id = mtk_mac2xgmii_id(eth, mac_id); -+ struct regmap *pextp; -+ -+ if (id >= eth->soc->num_devs) -+ return; -+ -+ pextp = eth->regmap_pextp[id]; -+ if (!pextp) -+ return; -+ -+ /* Setup operation mode */ -+ regmap_write(pextp, 0x9024, 0x00D9071C); -+ regmap_write(pextp, 0x2020, 0xAA8585AA); -+ regmap_write(pextp, 0x2030, 0x0C020207); -+ regmap_write(pextp, 0x2034, 0x0E05050F); -+ regmap_write(pextp, 0x2040, 0x00200032); -+ regmap_write(pextp, 0x50F0, 0x00C014BA); -+ regmap_write(pextp, 0x50E0, 0x3777C12B); -+ regmap_write(pextp, 0x506C, 0x005F9CFF); -+ regmap_write(pextp, 0x5070, 0x9D9DFAFA); -+ regmap_write(pextp, 0x5074, 0x27273F3F); -+ regmap_write(pextp, 0x5078, 0xA7883C68); -+ regmap_write(pextp, 0x507C, 0x11661166); -+ regmap_write(pextp, 0x5080, 0x0E000EAF); -+ regmap_write(pextp, 0x5084, 0x08080E0D); -+ regmap_write(pextp, 0x5088, 0x02030B09); -+ regmap_write(pextp, 0x50E4, 0x0C0C0000); -+ regmap_write(pextp, 0x50E8, 0x04040000); -+ regmap_write(pextp, 0x50EC, 0x0F0F0606); -+ regmap_write(pextp, 0x50A8, 0x506E8C8C); -+ regmap_write(pextp, 0x6004, 0x18190000); -+ regmap_write(pextp, 0x00F8, 0x00FA32FA); -+ /* Force SGDT_OUT off and select PCS */ -+ regmap_write(pextp, 0x00F4, 0x80201F21); -+ /* Force GLB_CKDET_OUT */ -+ regmap_write(pextp, 0x0030, 0x00050C00); -+ /* Force AEQ on */ -+ regmap_write(pextp, 0x0070, 0x02002800); -+ ndelay(1020); -+ /* Setup DA default value */ -+ regmap_write(pextp, 0x30B0, 0x00000020); -+ regmap_write(pextp, 0x3028, 0x00008A01); -+ regmap_write(pextp, 0x302C, 0x0000A884); -+ regmap_write(pextp, 0x3024, 0x00083002); -+ regmap_write(pextp, 0x3010, 0x00011110); -+ regmap_write(pextp, 0x3048, 0x40704000); -+ regmap_write(pextp, 0x3064, 0x0000C000); -+ regmap_write(pextp, 0x3050, 0xA8000000); -+ regmap_write(pextp, 0x3054, 0x000000AA); -+ regmap_write(pextp, 0x306C, 0x20200F00); -+ regmap_write(pextp, 0xA060, 0x00050000); -+ regmap_write(pextp, 0x90D0, 0x00000007); -+ /* Release reset */ -+ regmap_write(pextp, 0x0070, 0x0200E800); -+ udelay(150); -+ /* Switch to P0 */ -+ regmap_write(pextp, 0x0070, 0x0200C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0200C101); -+ udelay(15); -+ /* Switch to Gen2 */ -+ regmap_write(pextp, 0x0070, 0x0201C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0201C101); -+ udelay(100); -+ regmap_write(pextp, 0x30B0, 0x00000030); -+ regmap_write(pextp, 0x00F4, 0x80201F01); -+ regmap_write(pextp, 0x3040, 0x30000000); -+ udelay(400); -+} -+ -+void mtk_sgmii_setup_phya_gen2(struct mtk_eth *eth, int mac_id) -+{ -+ u32 id = mtk_mac2xgmii_id(eth, mac_id); -+ struct regmap *pextp; -+ -+ if (id >= eth->soc->num_devs) -+ return; -+ -+ pextp = eth->regmap_pextp[id]; -+ if (!pextp) -+ return; -+ -+ /* Setup operation mode */ -+ regmap_write(pextp, 0x9024, 0x00D9071C); -+ regmap_write(pextp, 0x2020, 0xAA8585AA); -+ regmap_write(pextp, 0x2030, 0x0C020707); -+ regmap_write(pextp, 0x2034, 0x0E050F0F); -+ regmap_write(pextp, 0x2040, 0x00140032); -+ regmap_write(pextp, 0x50F0, 0x00C014AA); -+ regmap_write(pextp, 0x50E0, 0x3777C12B); -+ regmap_write(pextp, 0x506C, 0x005F9CFF); -+ regmap_write(pextp, 0x5070, 0x9D9DFAFA); -+ regmap_write(pextp, 0x5074, 0x27273F3F); -+ regmap_write(pextp, 0x5078, 0xA7883C68); -+ regmap_write(pextp, 0x507C, 0x11661166); -+ regmap_write(pextp, 0x5080, 0x0E000AAF); -+ regmap_write(pextp, 0x5084, 0x08080D0D); -+ regmap_write(pextp, 0x5088, 0x02030909); -+ regmap_write(pextp, 0x50E4, 0x0C0C0000); -+ regmap_write(pextp, 0x50E8, 0x04040000); -+ regmap_write(pextp, 0x50EC, 0x0F0F0C06); -+ regmap_write(pextp, 0x50A8, 0x506E8C8C); -+ regmap_write(pextp, 0x6004, 0x18190000); -+ regmap_write(pextp, 0x00F8, 0x009C329C); -+ /* Force SGDT_OUT off and select PCS */ -+ regmap_write(pextp, 0x00F4, 0x80201F21); -+ /* Force GLB_CKDET_OUT */ -+ regmap_write(pextp, 0x0030, 0x00050C00); -+ /* Force AEQ on */ -+ regmap_write(pextp, 0x0070, 0x02002800); -+ ndelay(1020); -+ /* Setup DA default value */ -+ regmap_write(pextp, 0x30B0, 0x00000020); -+ regmap_write(pextp, 0x3028, 0x00008A01); -+ regmap_write(pextp, 0x302C, 0x0000A884); -+ regmap_write(pextp, 0x3024, 0x00083002); -+ regmap_write(pextp, 0x3010, 0x00011110); -+ regmap_write(pextp, 0x3048, 0x40704000); -+ regmap_write(pextp, 0x3050, 0xA8000000); -+ regmap_write(pextp, 0x3054, 0x000000AA); -+ regmap_write(pextp, 0x306C, 0x22000F00); -+ regmap_write(pextp, 0xA060, 0x00050000); -+ regmap_write(pextp, 0x90D0, 0x00000005); -+ /* Release reset */ -+ regmap_write(pextp, 0x0070, 0x0200E800); -+ udelay(150); -+ /* Switch to P0 */ -+ regmap_write(pextp, 0x0070, 0x0200C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0200C101); -+ udelay(15); -+ /* Switch to Gen2 */ -+ regmap_write(pextp, 0x0070, 0x0201C111); -+ ndelay(1020); -+ regmap_write(pextp, 0x0070, 0x0201C101); -+ udelay(100); -+ regmap_write(pextp, 0x30B0, 0x00000030); -+ regmap_write(pextp, 0x00F4, 0x80201F01); -+ regmap_write(pextp, 0x3040, 0x30000000); -+ udelay(400); -+} -+ -+static void mtk_usxgmii_reset(struct mtk_eth *eth, int id) -+{ -+ u32 val = 0; -+ -+ if (id >= eth->soc->num_devs || !eth->toprgu) -+ return; -+ -+ switch (id) { -+ case 0: -+ /* Enable software reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val |= SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_XFI0_GRST; -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); -+ -+ /* Assert USXGMII reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); -+ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88) | -+ SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_XFI0_GRST; -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); -+ -+ udelay(100); -+ -+ /* De-assert USXGMII reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); -+ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88); -+ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_XFI0_GRST); -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); -+ -+ /* Disable software reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val &= ~(SWSYSRST_XFI_PEXPT0_GRST | -+ SWSYSRST_XFI0_GRST); -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); -+ break; -+ case 1: -+ /* Enable software reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val |= SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_XFI1_GRST; -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); -+ -+ /* Assert USXGMII reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); -+ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88) | -+ SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_XFI1_GRST; -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); -+ -+ udelay(100); -+ -+ /* De-assert USXGMII reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); -+ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88); -+ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_XFI1_GRST); -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); -+ -+ /* Disable software reset */ -+ regmap_read(eth->toprgu, TOPRGU_SWSYSRST_EN, &val); -+ val &= ~(SWSYSRST_XFI_PEXPT1_GRST | -+ SWSYSRST_XFI1_GRST); -+ regmap_write(eth->toprgu, TOPRGU_SWSYSRST_EN, val); -+ break; -+ } -+ -+ mdelay(10); -+} -+ -+void mtk_sgmii_reset(struct mtk_eth *eth, int mac_id) -+{ -+ u32 xgmii_id = mtk_mac2xgmii_id(eth, mac_id); -+ -+ mtk_usxgmii_reset(eth, xgmii_id); -+} -+ -+ -+static int mtk_usxgmii_pcs_config(struct phylink_pcs *pcs, unsigned int mode, -+ phy_interface_t interface, -+ const unsigned long *advertising, -+ bool permit_pause_to_mac) -+{ -+ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); -+ struct mtk_eth *eth = mpcs->eth; -+ unsigned int an_ctrl = 0, link_timer = 0, xfi_mode = 0, adapt_mode = 0; -+ bool mode_changed = false; -+ -+ if (interface == PHY_INTERFACE_MODE_USXGMII) { -+ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0x1FF) | -+ USXGMII_AN_ENABLE; -+ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x7B) | -+ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x7B) | -+ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x7B); -+ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_10G) | -+ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_10G); -+ } else if (interface == PHY_INTERFACE_MODE_10GKR) { -+ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0x1FF); -+ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x7B) | -+ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x7B) | -+ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x7B); -+ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_10G) | -+ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_10G); -+ adapt_mode = USXGMII_RATE_UPDATE_MODE; -+ } else if (interface == PHY_INTERFACE_MODE_5GBASER) { -+ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0xFF); -+ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x3D) | -+ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x3D) | -+ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x3D); -+ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_5G) | -+ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_5G); -+ adapt_mode = USXGMII_RATE_UPDATE_MODE; -+ } else -+ return -EINVAL; -+ -+ adapt_mode |= FIELD_PREP(USXGMII_RATE_ADAPT_MODE, USXGMII_RATE_ADAPT_MODE_X1); -+ -+ if (mpcs->interface != interface) { -+ mpcs->interface = interface; -+ mode_changed = true; -+ } -+ -+ mtk_xfi_pll_enable(eth); -+ mtk_usxgmii_reset(eth, mpcs->id); -+ -+ /* Setup USXGMII AN ctrl */ -+ regmap_update_bits(mpcs->regmap, RG_PCS_AN_CTRL0, -+ USXGMII_AN_SYNC_CNT | USXGMII_AN_ENABLE, -+ an_ctrl); -+ -+ regmap_update_bits(mpcs->regmap, RG_PCS_AN_CTRL2, -+ USXGMII_LINK_TIMER_IDLE_DETECT | -+ USXGMII_LINK_TIMER_COMP_ACK_DETECT | -+ USXGMII_LINK_TIMER_AN_RESTART, -+ link_timer); -+ -+ /* Gated MAC CK */ -+ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, -+ USXGMII_MAC_CK_GATED, USXGMII_MAC_CK_GATED); -+ -+ /* Enable interface force mode */ -+ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, -+ USXGMII_IF_FORCE_EN, USXGMII_IF_FORCE_EN); -+ -+ /* Setup USXGMII adapt mode */ -+ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, -+ USXGMII_RATE_UPDATE_MODE | USXGMII_RATE_ADAPT_MODE, -+ adapt_mode); -+ -+ /* Setup USXGMII speed */ -+ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, -+ USXGMII_XFI_RX_MODE | USXGMII_XFI_TX_MODE, -+ xfi_mode); -+ -+ udelay(1); -+ -+ /* Un-gated MAC CK */ -+ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, -+ USXGMII_MAC_CK_GATED, 0); -+ -+ udelay(1); -+ -+ /* Disable interface force mode for the AN mode */ -+ if (an_ctrl & USXGMII_AN_ENABLE) -+ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, -+ USXGMII_IF_FORCE_EN, 0); -+ -+ /* Setup USXGMIISYS with the determined property */ -+ if (interface == PHY_INTERFACE_MODE_USXGMII) -+ mtk_usxgmii_setup_phya_usxgmii(mpcs); -+ else if (interface == PHY_INTERFACE_MODE_10GKR) -+ mtk_usxgmii_setup_phya_10gbaser(mpcs); -+ else if (interface == PHY_INTERFACE_MODE_5GBASER) -+ mtk_usxgmii_setup_phya_5gbaser(mpcs); -+ -+ return mode_changed; -+} -+ -+static void mtk_usxgmii_pcs_get_state(struct phylink_pcs *pcs, -+ struct phylink_link_state *state) -+{ -+ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); -+ struct mtk_eth *eth = mpcs->eth; -+ struct mtk_mac *mac = eth->mac[mtk_xgmii2mac_id(eth, mpcs->id)]; -+ u32 val = 0; -+ -+ regmap_read(mpcs->regmap, RG_PCS_AN_CTRL0, &val); -+ if (FIELD_GET(USXGMII_AN_ENABLE, val)) { -+ /* Refresh LPA by inverting LPA_LATCH */ -+ regmap_read(mpcs->regmap, RG_PCS_AN_STS0, &val); -+ regmap_update_bits(mpcs->regmap, RG_PCS_AN_STS0, -+ USXGMII_LPA_LATCH, -+ !(val & USXGMII_LPA_LATCH)); -+ -+ regmap_read(mpcs->regmap, RG_PCS_AN_STS0, &val); -+ -+ state->interface = mpcs->interface; -+ state->link = FIELD_GET(USXGMII_LPA_LINK, val); -+ state->duplex = FIELD_GET(USXGMII_LPA_DUPLEX, val); -+ -+ switch (FIELD_GET(USXGMII_LPA_SPEED_MASK, val)) { -+ case USXGMII_LPA_SPEED_10: -+ state->speed = SPEED_10; -+ break; -+ case USXGMII_LPA_SPEED_100: -+ state->speed = SPEED_100; -+ break; -+ case USXGMII_LPA_SPEED_1000: -+ state->speed = SPEED_1000; -+ break; -+ case USXGMII_LPA_SPEED_2500: -+ state->speed = SPEED_2500; -+ break; -+ case USXGMII_LPA_SPEED_5000: -+ state->speed = SPEED_5000; -+ break; -+ case USXGMII_LPA_SPEED_10000: -+ state->speed = SPEED_10000; -+ break; -+ } -+ } else { -+ val = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id)); -+ -+ if (mac->id == MTK_GMAC2_ID) -+ val = val >> 16; -+ -+ switch (FIELD_GET(MTK_USXGMII_PCS_MODE, val)) { -+ case 0: -+ state->speed = SPEED_10000; -+ break; -+ case 1: -+ state->speed = SPEED_5000; -+ break; -+ case 2: -+ state->speed = SPEED_2500; -+ break; -+ case 3: -+ state->speed = SPEED_1000; -+ break; -+ } -+ -+ state->interface = mpcs->interface; -+ state->link = FIELD_GET(MTK_USXGMII_PCS_LINK, val); -+ state->duplex = DUPLEX_FULL; -+ } -+ -+ if (state->link == 0) -+ mtk_usxgmii_pcs_config(pcs, MLO_AN_INBAND, -+ state->interface, NULL, false); -+} -+ -+static void mtk_usxgmii_pcs_restart_an(struct phylink_pcs *pcs) -+{ -+ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); -+ unsigned int val = 0; -+ -+ if (!mpcs->regmap) -+ return; -+ -+ regmap_read(mpcs->regmap, RG_PCS_AN_CTRL0, &val); -+ val |= USXGMII_AN_RESTART; -+ regmap_write(mpcs->regmap, RG_PCS_AN_CTRL0, val); -+} -+ -+static void mtk_usxgmii_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, -+ phy_interface_t interface, -+ int speed, int duplex) -+{ -+ /* Reconfiguring USXGMII to ensure the quality of the RX signal -+ * after the line side link up. -+ */ -+ mtk_usxgmii_pcs_config(pcs, mode, -+ interface, NULL, false); -+} -+ -+static const struct phylink_pcs_ops mtk_usxgmii_pcs_ops = { -+ .pcs_config = mtk_usxgmii_pcs_config, -+ .pcs_get_state = mtk_usxgmii_pcs_get_state, -+ .pcs_an_restart = mtk_usxgmii_pcs_restart_an, -+ .pcs_link_up = mtk_usxgmii_pcs_link_up, -+}; -+ -+int mtk_usxgmii_init(struct mtk_eth *eth) -+{ -+ struct device_node *r = eth->dev->of_node; -+ struct device *dev = eth->dev; -+ struct device_node *np; -+ int i, ret; -+ -+ eth->usxgmii_pcs = devm_kcalloc(dev, eth->soc->num_devs, sizeof(eth->usxgmii_pcs), GFP_KERNEL); -+ if (!eth->usxgmii_pcs) -+ return -ENOMEM; -+ -+ for (i = 0; i < eth->soc->num_devs; i++) { -+ np = of_parse_phandle(r, "mediatek,usxgmiisys", i); -+ if (!np) -+ break; -+ -+ eth->usxgmii_pcs[i] = devm_kzalloc(dev, sizeof(*eth->usxgmii_pcs), GFP_KERNEL); -+ if (!eth->usxgmii_pcs[i]) -+ return -ENOMEM; -+ -+ eth->usxgmii_pcs[i]->id = i; -+ eth->usxgmii_pcs[i]->eth = eth; -+ eth->usxgmii_pcs[i]->regmap = syscon_node_to_regmap(np); -+ if (IS_ERR(eth->usxgmii_pcs[i]->regmap)) -+ return PTR_ERR(eth->usxgmii_pcs[i]->regmap); -+ -+ eth->usxgmii_pcs[i]->pcs.ops = &mtk_usxgmii_pcs_ops; -+ eth->usxgmii_pcs[i]->pcs.poll = true; -+ eth->usxgmii_pcs[i]->interface = PHY_INTERFACE_MODE_NA; -+ -+ of_node_put(np); -+ } -+ -+ ret = mtk_xfi_pextp_init(eth); -+ if (ret) -+ return ret; -+ -+ ret = mtk_xfi_pll_init(eth); -+ if (ret) -+ return ret; -+ -+ return mtk_toprgu_init(eth); -+} -+ -+struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int mac_id) -+{ -+ u32 xgmii_id = mtk_mac2xgmii_id(eth, mac_id); -+ -+ if (!eth->usxgmii_pcs[xgmii_id]->regmap) -+ return NULL; -+ -+ return ð->usxgmii_pcs[xgmii_id]->pcs; -+} diff --git a/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch new file mode 100644 index 00000000000000..5b7591e22735c4 --- /dev/null +++ b/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -0,0 +1,1604 @@ +From 1e25ca1147579bda8b941be1b9851f5911d44eb0 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 22 Aug 2023 19:04:42 +0100 +Subject: [PATCH 098/125] net: ethernet: mtk_eth_soc: add paths and SerDes + modes for MT7988 + +MT7988 comes with a built-in 2.5G PHY as well as SerDes lanes to +connect external PHYs or transceivers in USXGMII, 10GBase-R, 5GBase-R, +2500Base-X, 1000Base-X and Cisco SGMII interface modes. + +Implement support for configuring for the new paths to SerDes interfaces +and the internal 2.5G PHY. + +Add USXGMII PCS driver for 10GBase-R, 5GBase-R and USXGMII mode, and +setup the new PHYA on MT7988 to access the also still existing old +LynxI PCS for 1000Base-X, 2500Base-X and Cisco SGMII PCS interface +modes. + +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/Kconfig | 16 + + drivers/net/ethernet/mediatek/Makefile | 1 + + drivers/net/ethernet/mediatek/mtk_eth_path.c | 123 +++- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 182 ++++- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 232 ++++++- + drivers/net/ethernet/mediatek/mtk_usxgmii.c | 692 +++++++++++++++++++ + 6 files changed, 1215 insertions(+), 31 deletions(-) + create mode 100644 drivers/net/ethernet/mediatek/mtk_usxgmii.c + +--- a/drivers/net/ethernet/mediatek/Kconfig ++++ b/drivers/net/ethernet/mediatek/Kconfig +@@ -24,6 +24,22 @@ config NET_MEDIATEK_SOC + This driver supports the gigabit ethernet MACs in the + MediaTek SoC family. + ++config NET_MEDIATEK_SOC_USXGMII ++ bool "Support USXGMII SerDes on MT7988" ++ depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST ++ def_bool NET_MEDIATEK_SOC != n ++ help ++ Include support for 10GE SerDes which can be found on MT7988. ++ If this kernel should run on SoCs with 10 GBit/s Ethernet you ++ will need to select this option to use GMAC2 and GMAC3 with ++ external PHYs, SFP(+) cages in 10GBase-R, 5GBase-R or USXGMII ++ interface modes. ++ ++ Note that as the 2500Base-X/1000Base-X/Cisco SGMII SerDes PCS ++ unit (MediaTek LynxI) in MT7988 is connected via the new 10GE ++ SerDes, you will also need to select this option in case you ++ want to use any of those SerDes modes. ++ + config NET_MEDIATEK_STAR_EMAC + tristate "MediaTek STAR Ethernet MAC support" + select PHYLIB +--- a/drivers/net/ethernet/mediatek/Makefile ++++ b/drivers/net/ethernet/mediatek/Makefile +@@ -5,6 +5,7 @@ + + obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o + mtk_eth-y := mtk_eth_soc.o mtk_eth_path.o mtk_ppe.o mtk_ppe_debugfs.o mtk_ppe_offload.o ++mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_USXGMII) += mtk_usxgmii.o + mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed.o mtk_wed_mcu.o mtk_wed_wo.o + ifdef CONFIG_DEBUG_FS + mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_debugfs.o +--- a/drivers/net/ethernet/mediatek/mtk_eth_path.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c +@@ -31,10 +31,20 @@ static const char *mtk_eth_path_name(u64 + return "gmac2_rgmii"; + case MTK_ETH_PATH_GMAC2_SGMII: + return "gmac2_sgmii"; ++ case MTK_ETH_PATH_GMAC2_2P5GPHY: ++ return "gmac2_2p5gphy"; + case MTK_ETH_PATH_GMAC2_GEPHY: + return "gmac2_gephy"; ++ case MTK_ETH_PATH_GMAC3_SGMII: ++ return "gmac3_sgmii"; + case MTK_ETH_PATH_GDM1_ESW: + return "gdm1_esw"; ++ case MTK_ETH_PATH_GMAC1_USXGMII: ++ return "gmac1_usxgmii"; ++ case MTK_ETH_PATH_GMAC2_USXGMII: ++ return "gmac2_usxgmii"; ++ case MTK_ETH_PATH_GMAC3_USXGMII: ++ return "gmac3_usxgmii"; + default: + return "unknown path"; + } +@@ -127,6 +137,27 @@ static int set_mux_u3_gmac2_to_qphy(stru + return 0; + } + ++static int set_mux_gmac2_to_2p5gphy(struct mtk_eth *eth, u64 path) ++{ ++ int ret; ++ ++ if (path == MTK_ETH_PATH_GMAC2_2P5GPHY) { ++ ret = regmap_clear_bits(eth->ethsys, ETHSYS_SYSCFG0, SYSCFG0_SGMII_GMAC2_V2); ++ if (ret) ++ return ret; ++ ++ /* Setup mux to 2p5g PHY */ ++ ret = regmap_clear_bits(eth->infra, TOP_MISC_NETSYS_PCS_MUX, MUX_G2_USXGMII_SEL); ++ if (ret) ++ return ret; ++ ++ dev_dbg(eth->dev, "path %s in %s updated\n", ++ mtk_eth_path_name(path), __func__); ++ } ++ ++ return 0; ++} ++ + static int set_mux_gmac1_gmac2_to_sgmii_rgmii(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0; +@@ -165,7 +196,48 @@ static int set_mux_gmac1_gmac2_to_sgmii_ + return 0; + } + +-static int set_mux_gmac12_to_gephy_sgmii(struct mtk_eth *eth, u64 path) ++static int set_mux_gmac123_to_usxgmii(struct mtk_eth *eth, u64 path) ++{ ++ unsigned int val = 0; ++ bool updated = true; ++ int mac_id = 0; ++ ++ /* Disable SYSCFG1 SGMII */ ++ regmap_read(eth->ethsys, ETHSYS_SYSCFG0, &val); ++ ++ switch (path) { ++ case MTK_ETH_PATH_GMAC1_USXGMII: ++ val &= ~(u32)SYSCFG0_SGMII_GMAC1_V2; ++ mac_id = MTK_GMAC1_ID; ++ break; ++ case MTK_ETH_PATH_GMAC2_USXGMII: ++ val &= ~(u32)SYSCFG0_SGMII_GMAC2_V2; ++ mac_id = MTK_GMAC2_ID; ++ break; ++ case MTK_ETH_PATH_GMAC3_USXGMII: ++ val &= ~(u32)SYSCFG0_SGMII_GMAC3_V2; ++ mac_id = MTK_GMAC3_ID; ++ break; ++ default: ++ updated = false; ++ }; ++ ++ if (updated) { ++ regmap_update_bits(eth->ethsys, ETHSYS_SYSCFG0, ++ SYSCFG0_SGMII_MASK, val); ++ ++ if (mac_id == MTK_GMAC2_ID) ++ regmap_set_bits(eth->infra, TOP_MISC_NETSYS_PCS_MUX, ++ MUX_G2_USXGMII_SEL); ++ } ++ ++ dev_dbg(eth->dev, "path %s in %s updated = %d\n", ++ mtk_eth_path_name(path), __func__, updated); ++ ++ return 0; ++} ++ ++static int set_mux_gmac123_to_gephy_sgmii(struct mtk_eth *eth, u64 path) + { + unsigned int val = 0; + bool updated = true; +@@ -182,6 +254,9 @@ static int set_mux_gmac12_to_gephy_sgmii + case MTK_ETH_PATH_GMAC2_SGMII: + val |= SYSCFG0_SGMII_GMAC2_V2; + break; ++ case MTK_ETH_PATH_GMAC3_SGMII: ++ val |= SYSCFG0_SGMII_GMAC3_V2; ++ break; + default: + updated = false; + } +@@ -210,13 +285,25 @@ static const struct mtk_eth_muxc mtk_eth + .cap_bit = MTK_ETH_MUX_U3_GMAC2_TO_QPHY, + .set_path = set_mux_u3_gmac2_to_qphy, + }, { ++ .name = "mux_gmac2_to_2p5gphy", ++ .cap_bit = MTK_ETH_MUX_GMAC2_TO_2P5GPHY, ++ .set_path = set_mux_gmac2_to_2p5gphy, ++ }, { + .name = "mux_gmac1_gmac2_to_sgmii_rgmii", + .cap_bit = MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII, + .set_path = set_mux_gmac1_gmac2_to_sgmii_rgmii, + }, { + .name = "mux_gmac12_to_gephy_sgmii", + .cap_bit = MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII, +- .set_path = set_mux_gmac12_to_gephy_sgmii, ++ .set_path = set_mux_gmac123_to_gephy_sgmii, ++ }, { ++ .name = "mux_gmac123_to_gephy_sgmii", ++ .cap_bit = MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII, ++ .set_path = set_mux_gmac123_to_gephy_sgmii, ++ }, { ++ .name = "mux_gmac123_to_usxgmii", ++ .cap_bit = MTK_ETH_MUX_GMAC123_TO_USXGMII, ++ .set_path = set_mux_gmac123_to_usxgmii, + }, + }; + +@@ -249,12 +336,39 @@ out: + return err; + } + ++int mtk_gmac_usxgmii_path_setup(struct mtk_eth *eth, int mac_id) ++{ ++ u64 path; ++ ++ path = (mac_id == MTK_GMAC1_ID) ? MTK_ETH_PATH_GMAC1_USXGMII : ++ (mac_id == MTK_GMAC2_ID) ? MTK_ETH_PATH_GMAC2_USXGMII : ++ MTK_ETH_PATH_GMAC3_USXGMII; ++ ++ /* Setup proper MUXes along the path */ ++ return mtk_eth_mux_setup(eth, path); ++} ++ + int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id) + { + u64 path; + +- path = (mac_id == 0) ? MTK_ETH_PATH_GMAC1_SGMII : +- MTK_ETH_PATH_GMAC2_SGMII; ++ path = (mac_id == MTK_GMAC1_ID) ? MTK_ETH_PATH_GMAC1_SGMII : ++ (mac_id == MTK_GMAC2_ID) ? MTK_ETH_PATH_GMAC2_SGMII : ++ MTK_ETH_PATH_GMAC3_SGMII; ++ ++ /* Setup proper MUXes along the path */ ++ return mtk_eth_mux_setup(eth, path); ++} ++ ++int mtk_gmac_2p5gphy_path_setup(struct mtk_eth *eth, int mac_id) ++{ ++ u64 path = 0; ++ ++ if (mac_id == MTK_GMAC2_ID) ++ path = MTK_ETH_PATH_GMAC2_2P5GPHY; ++ ++ if (!path) ++ return -EINVAL; + + /* Setup proper MUXes along the path */ + return mtk_eth_mux_setup(eth, path); +@@ -284,4 +398,3 @@ int mtk_gmac_rgmii_path_setup(struct mtk + /* Setup proper MUXes along the path */ + return mtk_eth_mux_setup(eth, path); + } +- +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -431,6 +431,30 @@ static void mtk_setup_bridge_switch(stru + MTK_GSW_CFG); + } + ++static bool mtk_check_gmac23_idle(struct mtk_mac *mac) ++{ ++ u32 mac_fsm, gdm_fsm; ++ ++ mac_fsm = mtk_r32(mac->hw, MTK_MAC_FSM(mac->id)); ++ ++ switch (mac->id) { ++ case MTK_GMAC2_ID: ++ gdm_fsm = mtk_r32(mac->hw, MTK_FE_GDM2_FSM); ++ break; ++ case MTK_GMAC3_ID: ++ gdm_fsm = mtk_r32(mac->hw, MTK_FE_GDM3_FSM); ++ break; ++ default: ++ return true; ++ }; ++ ++ if ((mac_fsm & 0xFFFF0000) == 0x01010000 && ++ (gdm_fsm & 0xFFFF0000) == 0x00000000) ++ return true; ++ ++ return false; ++} ++ + static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config, + phy_interface_t interface) + { +@@ -439,12 +463,20 @@ static struct phylink_pcs *mtk_mac_selec + struct mtk_eth *eth = mac->hw; + unsigned int sid; + +- if (interface == PHY_INTERFACE_MODE_SGMII || +- phy_interface_mode_is_8023z(interface)) { +- sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ? +- 0 : mac->id; +- +- return eth->sgmii_pcs[sid]; ++ if ((interface == PHY_INTERFACE_MODE_SGMII || ++ phy_interface_mode_is_8023z(interface)) && ++ MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) { ++ sid = mtk_mac2xgmii_id(eth, mac->id); ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) ++ return mtk_sgmii_wrapper_select_pcs(eth, mac->id); ++ else ++ return eth->sgmii_pcs[sid]; ++ } else if ((interface == PHY_INTERFACE_MODE_USXGMII || ++ interface == PHY_INTERFACE_MODE_10GBASER || ++ interface == PHY_INTERFACE_MODE_5GBASER) && ++ MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII) && ++ mac->id != MTK_GMAC1_ID) { ++ return mtk_usxgmii_select_pcs(eth, mac->id); + } + + return NULL; +@@ -500,7 +532,22 @@ static void mtk_mac_config(struct phylin + goto init_err; + } + break; ++ case PHY_INTERFACE_MODE_USXGMII: ++ case PHY_INTERFACE_MODE_10GBASER: ++ case PHY_INTERFACE_MODE_5GBASER: ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) { ++ err = mtk_gmac_usxgmii_path_setup(eth, mac->id); ++ if (err) ++ goto init_err; ++ } ++ break; + case PHY_INTERFACE_MODE_INTERNAL: ++ if (mac->id == MTK_GMAC2_ID && ++ MTK_HAS_CAPS(eth->soc->caps, MTK_2P5GPHY)) { ++ err = mtk_gmac_2p5gphy_path_setup(eth, mac->id); ++ if (err) ++ goto init_err; ++ } + break; + default: + goto err_phy; +@@ -555,8 +602,6 @@ static void mtk_mac_config(struct phylin + val &= ~SYSCFG0_GE_MODE(SYSCFG0_GE_MASK, mac->id); + val |= SYSCFG0_GE_MODE(ge_mode, mac->id); + regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val); +- +- mac->interface = state->interface; + } + + /* SGMII */ +@@ -573,21 +618,40 @@ static void mtk_mac_config(struct phylin + + /* Save the syscfg0 value for mac_finish */ + mac->syscfg0 = val; +- } else if (phylink_autoneg_inband(mode)) { ++ } else if (state->interface != PHY_INTERFACE_MODE_USXGMII && ++ state->interface != PHY_INTERFACE_MODE_10GBASER && ++ state->interface != PHY_INTERFACE_MODE_5GBASER && ++ phylink_autoneg_inband(mode)) { + dev_err(eth->dev, +- "In-band mode not supported in non SGMII mode!\n"); ++ "In-band mode not supported in non-SerDes modes!\n"); + return; + } + + /* Setup gmac */ +- if (mtk_is_netsys_v3_or_greater(eth) && +- mac->interface == PHY_INTERFACE_MODE_INTERNAL) { +- mtk_w32(mac->hw, MTK_GDMA_XGDM_SEL, MTK_GDMA_EG_CTRL(mac->id)); +- mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id)); ++ if (mtk_is_netsys_v3_or_greater(eth)) { ++ if (mtk_interface_mode_is_xgmii(state->interface)) { ++ mtk_w32(mac->hw, MTK_GDMA_XGDM_SEL, MTK_GDMA_EG_CTRL(mac->id)); ++ mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id)); ++ ++ if (mac->id == MTK_GMAC1_ID) ++ mtk_setup_bridge_switch(eth); ++ } else { ++ mtk_w32(eth, 0, MTK_GDMA_EG_CTRL(mac->id)); + +- mtk_setup_bridge_switch(eth); ++ /* FIXME: In current hardware design, we have to reset FE ++ * when swtiching XGDM to GDM. Therefore, here trigger an SER ++ * to let GDM go back to the initial state. ++ */ ++ if ((mtk_interface_mode_is_xgmii(mac->interface) || ++ mac->interface == PHY_INTERFACE_MODE_NA) && ++ !mtk_check_gmac23_idle(mac) && ++ !test_bit(MTK_RESETTING, ð->state)) ++ schedule_work(ð->pending_work); ++ } + } + ++ mac->interface = state->interface; ++ + return; + + err_phy: +@@ -633,10 +697,13 @@ static void mtk_mac_link_down(struct phy + { + struct mtk_mac *mac = container_of(config, struct mtk_mac, + phylink_config); +- u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); + +- mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN); +- mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); ++ if (!mtk_interface_mode_is_xgmii(interface)) { ++ mtk_m32(mac->hw, MAC_MCR_TX_EN | MAC_MCR_RX_EN, 0, MTK_MAC_MCR(mac->id)); ++ mtk_m32(mac->hw, MTK_XGMAC_FORCE_LINK(mac->id), 0, MTK_XGMAC_STS(mac->id)); ++ } else if (mac->id != MTK_GMAC1_ID) { ++ mtk_m32(mac->hw, XMAC_MCR_TRX_DISABLE, XMAC_MCR_TRX_DISABLE, MTK_XMAC_MCR(mac->id)); ++ } + } + + static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx, +@@ -708,13 +775,11 @@ static void mtk_set_queue_speed(struct m + mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); + } + +-static void mtk_mac_link_up(struct phylink_config *config, +- struct phy_device *phy, +- unsigned int mode, phy_interface_t interface, +- int speed, int duplex, bool tx_pause, bool rx_pause) ++static void mtk_gdm_mac_link_up(struct mtk_mac *mac, ++ struct phy_device *phy, ++ unsigned int mode, phy_interface_t interface, ++ int speed, int duplex, bool tx_pause, bool rx_pause) + { +- struct mtk_mac *mac = container_of(config, struct mtk_mac, +- phylink_config); + u32 mcr; + + mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); +@@ -748,6 +813,55 @@ static void mtk_mac_link_up(struct phyli + mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); + } + ++static void mtk_xgdm_mac_link_up(struct mtk_mac *mac, ++ struct phy_device *phy, ++ unsigned int mode, phy_interface_t interface, ++ int speed, int duplex, bool tx_pause, bool rx_pause) ++{ ++ u32 mcr, force_link = 0; ++ ++ if (mac->id == MTK_GMAC1_ID) ++ return; ++ ++ /* Eliminate the interference(before link-up) caused by PHY noise */ ++ mtk_m32(mac->hw, XMAC_LOGIC_RST, 0, MTK_XMAC_LOGIC_RST(mac->id)); ++ mdelay(20); ++ mtk_m32(mac->hw, XMAC_GLB_CNTCLR, XMAC_GLB_CNTCLR, MTK_XMAC_CNT_CTRL(mac->id)); ++ ++ if (mac->interface == PHY_INTERFACE_MODE_INTERNAL || mac->id == MTK_GMAC3_ID) ++ force_link = MTK_XGMAC_FORCE_LINK(mac->id); ++ ++ mtk_m32(mac->hw, MTK_XGMAC_FORCE_LINK(mac->id), force_link, MTK_XGMAC_STS(mac->id)); ++ ++ mcr = mtk_r32(mac->hw, MTK_XMAC_MCR(mac->id)); ++ mcr &= ~(XMAC_MCR_FORCE_TX_FC | XMAC_MCR_FORCE_RX_FC | XMAC_MCR_TRX_DISABLE); ++ /* Configure pause modes - ++ * phylink will avoid these for half duplex ++ */ ++ if (tx_pause) ++ mcr |= XMAC_MCR_FORCE_TX_FC; ++ if (rx_pause) ++ mcr |= XMAC_MCR_FORCE_RX_FC; ++ ++ mtk_w32(mac->hw, mcr, MTK_XMAC_MCR(mac->id)); ++} ++ ++static void mtk_mac_link_up(struct phylink_config *config, ++ struct phy_device *phy, ++ unsigned int mode, phy_interface_t interface, ++ int speed, int duplex, bool tx_pause, bool rx_pause) ++{ ++ struct mtk_mac *mac = container_of(config, struct mtk_mac, ++ phylink_config); ++ ++ if (mtk_interface_mode_is_xgmii(interface)) ++ mtk_xgdm_mac_link_up(mac, phy, mode, interface, speed, duplex, ++ tx_pause, rx_pause); ++ else ++ mtk_gdm_mac_link_up(mac, phy, mode, interface, speed, duplex, ++ tx_pause, rx_pause); ++} ++ + static const struct phylink_mac_ops mtk_phylink_ops = { + .validate = phylink_generic_validate, + .mac_select_pcs = mtk_mac_select_pcs, +@@ -4558,8 +4672,21 @@ static int mtk_add_mac(struct mtk_eth *e + phy_interface_zero(mac->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_INTERNAL, + mac->phylink_config.supported_interfaces); ++ } else if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_USXGMII)) { ++ mac->phylink_config.mac_capabilities |= MAC_5000FD | MAC_10000FD; ++ __set_bit(PHY_INTERFACE_MODE_5GBASER, ++ mac->phylink_config.supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_10GBASER, ++ mac->phylink_config.supported_interfaces); ++ __set_bit(PHY_INTERFACE_MODE_USXGMII, ++ mac->phylink_config.supported_interfaces); + } + ++ if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_2P5GPHY) && ++ id == MTK_GMAC2_ID) ++ __set_bit(PHY_INTERFACE_MODE_INTERNAL, ++ mac->phylink_config.supported_interfaces); ++ + phylink = phylink_create(&mac->phylink_config, + of_fwnode_handle(mac->of_node), + phy_mode, &mtk_phylink_ops); +@@ -4752,6 +4879,13 @@ static int mtk_probe(struct platform_dev + + if (err) + return err; ++ } ++ ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_USXGMII)) { ++ err = mtk_usxgmii_init(eth); ++ ++ if (err) ++ return err; + } + + if (eth->soc->required_pctl) { +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -499,6 +499,21 @@ + #define INTF_MODE_RGMII_1000 (TRGMII_MODE | TRGMII_CENTRAL_ALIGNED) + #define INTF_MODE_RGMII_10_100 0 + ++/* XFI Mac control registers */ ++#define MTK_XMAC_BASE(x) (0x12000 + (((x) - 1) * 0x1000)) ++#define MTK_XMAC_MCR(x) (MTK_XMAC_BASE(x)) ++#define XMAC_MCR_TRX_DISABLE 0xf ++#define XMAC_MCR_FORCE_TX_FC BIT(5) ++#define XMAC_MCR_FORCE_RX_FC BIT(4) ++ ++/* XFI Mac logic reset registers */ ++#define MTK_XMAC_LOGIC_RST(x) (MTK_XMAC_BASE(x) + 0x10) ++#define XMAC_LOGIC_RST BIT(0) ++ ++/* XFI Mac count global control */ ++#define MTK_XMAC_CNT_CTRL(x) (MTK_XMAC_BASE(x) + 0x100) ++#define XMAC_GLB_CNTCLR BIT(0) ++ + /* GPIO port control registers for GMAC 2*/ + #define GPIO_OD33_CTRL8 0x4c0 + #define GPIO_BIAS_CTRL 0xed0 +@@ -524,6 +539,7 @@ + #define SYSCFG0_SGMII_GMAC2 ((3 << 8) & SYSCFG0_SGMII_MASK) + #define SYSCFG0_SGMII_GMAC1_V2 BIT(9) + #define SYSCFG0_SGMII_GMAC2_V2 BIT(8) ++#define SYSCFG0_SGMII_GMAC3_V2 BIT(7) + + + /* ethernet subsystem clock register */ +@@ -556,12 +572,74 @@ + #define ETHSYS_DMA_AG_MAP_QDMA BIT(1) + #define ETHSYS_DMA_AG_MAP_PPE BIT(2) + ++/* USXGMII subsystem config registers */ ++/* Register to control speed */ ++#define RG_PHY_TOP_SPEED_CTRL1 0x80C ++#define USXGMII_RATE_UPDATE_MODE BIT(31) ++#define USXGMII_MAC_CK_GATED BIT(29) ++#define USXGMII_IF_FORCE_EN BIT(28) ++#define USXGMII_RATE_ADAPT_MODE GENMASK(10, 8) ++#define USXGMII_RATE_ADAPT_MODE_X1 0 ++#define USXGMII_RATE_ADAPT_MODE_X2 1 ++#define USXGMII_RATE_ADAPT_MODE_X4 2 ++#define USXGMII_RATE_ADAPT_MODE_X10 3 ++#define USXGMII_RATE_ADAPT_MODE_X100 4 ++#define USXGMII_RATE_ADAPT_MODE_X5 5 ++#define USXGMII_RATE_ADAPT_MODE_X50 6 ++#define USXGMII_XFI_RX_MODE GENMASK(6, 4) ++#define USXGMII_XFI_RX_MODE_10G 0 ++#define USXGMII_XFI_RX_MODE_5G 1 ++#define USXGMII_XFI_TX_MODE GENMASK(2, 0) ++#define USXGMII_XFI_TX_MODE_10G 0 ++#define USXGMII_XFI_TX_MODE_5G 1 ++ ++/* Register to control PCS AN */ ++#define RG_PCS_AN_CTRL0 0x810 ++#define USXGMII_AN_RESTART BIT(31) ++#define USXGMII_AN_SYNC_CNT GENMASK(30, 11) ++#define USXGMII_AN_ENABLE BIT(0) ++ ++#define RG_PCS_AN_CTRL2 0x818 ++#define USXGMII_LINK_TIMER_IDLE_DETECT GENMASK(29, 20) ++#define USXGMII_LINK_TIMER_COMP_ACK_DETECT GENMASK(19, 10) ++#define USXGMII_LINK_TIMER_AN_RESTART GENMASK(9, 0) ++ ++/* Register to read PCS AN status */ ++#define RG_PCS_AN_STS0 0x81c ++#define USXGMII_PCS_AN_WORD GENMASK(15, 0) ++#define USXGMII_LPA_LATCH BIT(31) ++ ++/* Register to control USXGMII XFI PLL digital */ ++#define XFI_PLL_DIG_GLB8 0x08 ++#define RG_XFI_PLL_EN BIT(31) ++ ++/* Register to control USXGMII XFI PLL analog */ ++#define XFI_PLL_ANA_GLB8 0x108 ++#define RG_XFI_PLL_ANA_SWWA 0x02283248 ++ + /* Infrasys subsystem config registers */ + #define INFRA_MISC2 0x70c + #define CO_QPHY_SEL BIT(0) + #define GEPHY_MAC_SEL BIT(1) + ++/* Toprgu subsystem config registers */ ++#define TOPRGU_SWSYSRST 0x18 ++#define SWSYSRST_UNLOCK_KEY GENMASK(31, 24) ++#define SWSYSRST_XFI_PLL_GRST BIT(16) ++#define SWSYSRST_XFI_PEXPT1_GRST BIT(15) ++#define SWSYSRST_XFI_PEXPT0_GRST BIT(14) ++#define SWSYSRST_XFI1_GRST BIT(13) ++#define SWSYSRST_XFI0_GRST BIT(12) ++#define SWSYSRST_SGMII1_GRST BIT(2) ++#define SWSYSRST_SGMII0_GRST BIT(1) ++#define TOPRGU_SWSYSRST_EN 0xFC ++ + /* Top misc registers */ ++#define TOP_MISC_NETSYS_PCS_MUX 0x84 ++#define NETSYS_PCS_MUX_MASK GENMASK(1, 0) ++#define MUX_G2_USXGMII_SEL BIT(1) ++#define MUX_HSGMII1_G1_SEL BIT(0) ++ + #define USB_PHY_SWITCH_REG 0x218 + #define QPHY_SEL_MASK GENMASK(1, 0) + #define SGMII_QPHY_SEL 0x2 +@@ -586,6 +664,8 @@ + #define MT7628_SDM_RBCNT (MT7628_SDM_OFFSET + 0x10c) + #define MT7628_SDM_CS_ERR (MT7628_SDM_OFFSET + 0x110) + ++/* Debug Purpose Register */ ++#define MTK_PSE_FQFC_CFG 0x100 + #define MTK_FE_CDM1_FSM 0x220 + #define MTK_FE_CDM2_FSM 0x224 + #define MTK_FE_CDM3_FSM 0x238 +@@ -594,6 +674,11 @@ + #define MTK_FE_CDM6_FSM 0x328 + #define MTK_FE_GDM1_FSM 0x228 + #define MTK_FE_GDM2_FSM 0x22C ++#define MTK_FE_GDM3_FSM 0x23C ++#define MTK_FE_PSE_FREE 0x240 ++#define MTK_FE_DROP_FQ 0x244 ++#define MTK_FE_DROP_FC 0x248 ++#define MTK_FE_DROP_PPE 0x24C + + #define MTK_MAC_FSM(x) (0x1010C + ((x) * 0x100)) + +@@ -940,6 +1025,8 @@ enum mkt_eth_capabilities { + MTK_RGMII_BIT = 0, + MTK_TRGMII_BIT, + MTK_SGMII_BIT, ++ MTK_USXGMII_BIT, ++ MTK_2P5GPHY_BIT, + MTK_ESW_BIT, + MTK_GEPHY_BIT, + MTK_MUX_BIT, +@@ -960,8 +1047,11 @@ enum mkt_eth_capabilities { + MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT, + MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT, + MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT, ++ MTK_ETH_MUX_GMAC2_TO_2P5GPHY_BIT, + MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT, + MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT, ++ MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT, ++ MTK_ETH_MUX_GMAC123_TO_USXGMII_BIT, + + /* PATH BITS */ + MTK_ETH_PATH_GMAC1_RGMII_BIT, +@@ -969,14 +1059,21 @@ enum mkt_eth_capabilities { + MTK_ETH_PATH_GMAC1_SGMII_BIT, + MTK_ETH_PATH_GMAC2_RGMII_BIT, + MTK_ETH_PATH_GMAC2_SGMII_BIT, ++ MTK_ETH_PATH_GMAC2_2P5GPHY_BIT, + MTK_ETH_PATH_GMAC2_GEPHY_BIT, ++ MTK_ETH_PATH_GMAC3_SGMII_BIT, + MTK_ETH_PATH_GDM1_ESW_BIT, ++ MTK_ETH_PATH_GMAC1_USXGMII_BIT, ++ MTK_ETH_PATH_GMAC2_USXGMII_BIT, ++ MTK_ETH_PATH_GMAC3_USXGMII_BIT, + }; + + /* Supported hardware group on SoCs */ + #define MTK_RGMII BIT_ULL(MTK_RGMII_BIT) + #define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT) + #define MTK_SGMII BIT_ULL(MTK_SGMII_BIT) ++#define MTK_USXGMII BIT_ULL(MTK_USXGMII_BIT) ++#define MTK_2P5GPHY BIT_ULL(MTK_2P5GPHY_BIT) + #define MTK_ESW BIT_ULL(MTK_ESW_BIT) + #define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT) + #define MTK_MUX BIT_ULL(MTK_MUX_BIT) +@@ -999,10 +1096,16 @@ enum mkt_eth_capabilities { + BIT_ULL(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT) + #define MTK_ETH_MUX_U3_GMAC2_TO_QPHY \ + BIT_ULL(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT) ++#define MTK_ETH_MUX_GMAC2_TO_2P5GPHY \ ++ BIT_ULL(MTK_ETH_MUX_GMAC2_TO_2P5GPHY_BIT) + #define MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII \ + BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT) + #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \ + BIT_ULL(MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT) ++#define MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII \ ++ BIT_ULL(MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII_BIT) ++#define MTK_ETH_MUX_GMAC123_TO_USXGMII \ ++ BIT_ULL(MTK_ETH_MUX_GMAC123_TO_USXGMII_BIT) + + /* Supported path present on SoCs */ + #define MTK_ETH_PATH_GMAC1_RGMII BIT_ULL(MTK_ETH_PATH_GMAC1_RGMII_BIT) +@@ -1010,8 +1113,13 @@ enum mkt_eth_capabilities { + #define MTK_ETH_PATH_GMAC1_SGMII BIT_ULL(MTK_ETH_PATH_GMAC1_SGMII_BIT) + #define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT) + #define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT) ++#define MTK_ETH_PATH_GMAC2_2P5GPHY BIT_ULL(MTK_ETH_PATH_GMAC2_2P5GPHY_BIT) + #define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT) ++#define MTK_ETH_PATH_GMAC3_SGMII BIT_ULL(MTK_ETH_PATH_GMAC3_SGMII_BIT) + #define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT) ++#define MTK_ETH_PATH_GMAC1_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC1_USXGMII_BIT) ++#define MTK_ETH_PATH_GMAC2_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC2_USXGMII_BIT) ++#define MTK_ETH_PATH_GMAC3_USXGMII BIT_ULL(MTK_ETH_PATH_GMAC3_USXGMII_BIT) + + #define MTK_GMAC1_RGMII (MTK_ETH_PATH_GMAC1_RGMII | MTK_RGMII) + #define MTK_GMAC1_TRGMII (MTK_ETH_PATH_GMAC1_TRGMII | MTK_TRGMII) +@@ -1019,7 +1127,12 @@ enum mkt_eth_capabilities { + #define MTK_GMAC2_RGMII (MTK_ETH_PATH_GMAC2_RGMII | MTK_RGMII) + #define MTK_GMAC2_SGMII (MTK_ETH_PATH_GMAC2_SGMII | MTK_SGMII) + #define MTK_GMAC2_GEPHY (MTK_ETH_PATH_GMAC2_GEPHY | MTK_GEPHY) ++#define MTK_GMAC2_2P5GPHY (MTK_ETH_PATH_GMAC2_2P5GPHY | MTK_2P5GPHY) ++#define MTK_GMAC3_SGMII (MTK_ETH_PATH_GMAC3_SGMII | MTK_SGMII) + #define MTK_GDM1_ESW (MTK_ETH_PATH_GDM1_ESW | MTK_ESW) ++#define MTK_GMAC1_USXGMII (MTK_ETH_PATH_GMAC1_USXGMII | MTK_USXGMII) ++#define MTK_GMAC2_USXGMII (MTK_ETH_PATH_GMAC2_USXGMII | MTK_USXGMII) ++#define MTK_GMAC3_USXGMII (MTK_ETH_PATH_GMAC3_USXGMII | MTK_USXGMII) + + /* MUXes present on SoCs */ + /* 0: GDM1 -> GMAC1, 1: GDM1 -> ESW */ +@@ -1038,10 +1151,20 @@ enum mkt_eth_capabilities { + (MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | MTK_MUX | \ + MTK_SHARED_SGMII) + ++/* 2: GMAC2 -> XGMII */ ++#define MTK_MUX_GMAC2_TO_2P5GPHY \ ++ (MTK_ETH_MUX_GMAC2_TO_2P5GPHY | MTK_MUX | MTK_INFRA) ++ + /* 0: GMACx -> GEPHY, 1: GMACx -> SGMII where x is 1 or 2 */ + #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ + (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) + ++#define MTK_MUX_GMAC123_TO_GEPHY_SGMII \ ++ (MTK_ETH_MUX_GMAC123_TO_GEPHY_SGMII | MTK_MUX) ++ ++#define MTK_MUX_GMAC123_TO_USXGMII \ ++ (MTK_ETH_MUX_GMAC123_TO_USXGMII | MTK_MUX | MTK_INFRA) ++ + #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x)) + + #define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ +@@ -1073,8 +1196,12 @@ enum mkt_eth_capabilities { + MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ + MTK_RSTCTRL_PPE1 | MTK_SRAM) + +-#define MT7988_CAPS (MTK_36BIT_DMA | MTK_GDM1_ESW | MTK_QDMA | \ +- MTK_RSTCTRL_PPE1 | MTK_RSTCTRL_PPE2 | MTK_SRAM) ++#define MT7988_CAPS (MTK_36BIT_DMA | MTK_GDM1_ESW | MTK_GMAC1_SGMII | \ ++ MTK_GMAC2_2P5GPHY | MTK_GMAC2_SGMII | MTK_GMAC2_USXGMII | \ ++ MTK_GMAC3_SGMII | MTK_GMAC3_USXGMII | \ ++ MTK_MUX_GMAC123_TO_GEPHY_SGMII | \ ++ MTK_MUX_GMAC123_TO_USXGMII | MTK_MUX_GMAC2_TO_2P5GPHY | \ ++ MTK_QDMA | MTK_RSTCTRL_PPE1 | MTK_RSTCTRL_PPE2 | MTK_SRAM) + + struct mtk_tx_dma_desc_info { + dma_addr_t addr; +@@ -1184,6 +1311,24 @@ struct mtk_soc_data { + /* currently no SoC has more than 3 macs */ + #define MTK_MAX_DEVS 3 + ++/* struct mtk_usxgmii_pcs - This structure holds each usxgmii regmap and ++ * associated data ++ * @regmap: The register map pointing at the range used to setup ++ * USXGMII modes ++ * @interface: Currently selected interface mode ++ * @id: The element is used to record the index of PCS ++ * @pcs: Phylink PCS structure ++ */ ++struct mtk_usxgmii_pcs { ++ struct mtk_eth *eth; ++ struct regmap *regmap; ++ struct phylink_pcs *wrapped_sgmii_pcs; ++ phy_interface_t interface; ++ u8 id; ++ unsigned int mode; ++ struct phylink_pcs pcs; ++}; ++ + /* struct mtk_eth - This is the main datasructure for holding the state + * of the driver + * @dev: The device pointer +@@ -1204,6 +1349,12 @@ struct mtk_soc_data { + * @infra: The register map pointing at the range used to setup + * SGMII and GePHY path + * @sgmii_pcs: Pointers to mtk-pcs-lynxi phylink_pcs instances ++ * @sgmii_wrapped_pcs: Pointers to NETSYSv3 wrapper PCS instances ++ * @usxgmii_pll: The register map pointing at the range used to control ++ * the USXGMII SerDes PLL ++ * @regmap_pextp: The register map pointing at the range used to setup ++ * PHYA ++ * @usxgmii_pcs: Pointer to array of pointers to struct for USXGMII PCS + * @pctl: The register map pointing at the range used to setup + * GMAC port drive/slew values + * @dma_refcnt: track how many netdevs are using the DMA engine +@@ -1247,6 +1398,10 @@ struct mtk_eth { + struct regmap *ethsys; + struct regmap *infra; + struct phylink_pcs *sgmii_pcs[MTK_MAX_DEVS]; ++ struct regmap *toprgu; ++ struct regmap *usxgmii_pll; ++ struct regmap *regmap_pextp[MTK_MAX_DEVS]; ++ struct mtk_usxgmii_pcs *usxgmii_pcs[MTK_MAX_DEVS]; + struct regmap *pctl; + bool hwlro; + refcount_t dma_refcnt; +@@ -1434,6 +1589,19 @@ static inline u32 mtk_get_ib2_multicast_ + return MTK_FOE_IB2_MULTICAST; + } + ++static inline bool mtk_interface_mode_is_xgmii(phy_interface_t interface) ++{ ++ switch (interface) { ++ case PHY_INTERFACE_MODE_INTERNAL: ++ case PHY_INTERFACE_MODE_USXGMII: ++ case PHY_INTERFACE_MODE_10GBASER: ++ case PHY_INTERFACE_MODE_5GBASER: ++ return true; ++ default: ++ return false; ++ } ++} ++ + /* read the hardware status register */ + void mtk_stats_update_mac(struct mtk_mac *mac); + +@@ -1442,8 +1610,10 @@ u32 mtk_r32(struct mtk_eth *eth, unsigne + u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned int reg); + + int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id); ++int mtk_gmac_2p5gphy_path_setup(struct mtk_eth *eth, int mac_id); + int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id); + int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id); ++int mtk_gmac_usxgmii_path_setup(struct mtk_eth *eth, int mac_id); + + int mtk_eth_offload_init(struct mtk_eth *eth); + int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type, +@@ -1453,5 +1623,63 @@ int mtk_flow_offload_cmd(struct mtk_eth + void mtk_flow_offload_cleanup(struct mtk_eth *eth, struct list_head *list); + void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev); + ++static inline int mtk_mac2xgmii_id(struct mtk_eth *eth, int mac_id) ++{ ++ int xgmii_id = mac_id; ++ ++ if (mtk_is_netsys_v3_or_greater(eth)) { ++ switch (mac_id) { ++ case MTK_GMAC1_ID: ++ case MTK_GMAC2_ID: ++ xgmii_id = 1; ++ break; ++ case MTK_GMAC3_ID: ++ xgmii_id = 0; ++ break; ++ default: ++ xgmii_id = -1; ++ } ++ } ++ ++ return MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII) ? 0 : xgmii_id; ++} ++ ++static inline int mtk_xgmii2mac_id(struct mtk_eth *eth, int xgmii_id) ++{ ++ int mac_id = xgmii_id; ++ ++ if (mtk_is_netsys_v3_or_greater(eth)) { ++ switch (xgmii_id) { ++ case 0: ++ mac_id = 2; ++ break; ++ case 1: ++ mac_id = 1; ++ break; ++ default: ++ mac_id = -1; ++ } ++ } ++ ++ return mac_id; ++} ++ ++#ifdef CONFIG_NET_MEDIATEK_SOC_USXGMII ++struct phylink_pcs *mtk_sgmii_wrapper_select_pcs(struct mtk_eth *eth, int id); ++struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int id); ++int mtk_usxgmii_init(struct mtk_eth *eth); ++#else ++static inline struct phylink_pcs *mtk_sgmii_wrapper_select_pcs(struct mtk_eth *eth, int id) ++{ ++ return NULL; ++} ++ ++static inline struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int id) ++{ ++ return NULL; ++} ++ ++static inline int mtk_usxgmii_init(struct mtk_eth *eth) { return 0; } ++#endif /* NET_MEDIATEK_SOC_USXGMII */ + + #endif /* MTK_ETH_H */ +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_usxgmii.c +@@ -0,0 +1,690 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2023 MediaTek Inc. ++ * Author: Henry Yen ++ * Daniel Golle ++ */ ++ ++#include ++#include ++#include ++#include "mtk_eth_soc.h" ++ ++static struct mtk_usxgmii_pcs *pcs_to_mtk_usxgmii_pcs(struct phylink_pcs *pcs) ++{ ++ return container_of(pcs, struct mtk_usxgmii_pcs, pcs); ++} ++ ++static int mtk_xfi_pextp_init(struct mtk_eth *eth) ++{ ++ struct device *dev = eth->dev; ++ struct device_node *r = dev->of_node; ++ struct device_node *np; ++ int i; ++ ++ for (i = 0; i < MTK_MAX_DEVS; i++) { ++ np = of_parse_phandle(r, "mediatek,xfi-pextp", i); ++ if (!np) ++ break; ++ ++ eth->regmap_pextp[i] = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->regmap_pextp[i])) ++ return PTR_ERR(eth->regmap_pextp[i]); ++ } ++ ++ return 0; ++} ++ ++static int mtk_xfi_pll_init(struct mtk_eth *eth) ++{ ++ struct device_node *r = eth->dev->of_node; ++ struct device_node *np; ++ ++ np = of_parse_phandle(r, "mediatek,xfi-pll", 0); ++ if (!np) ++ return -1; ++ ++ eth->usxgmii_pll = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->usxgmii_pll)) ++ return PTR_ERR(eth->usxgmii_pll); ++ ++ return 0; ++} ++ ++static int mtk_toprgu_init(struct mtk_eth *eth) ++{ ++ struct device_node *r = eth->dev->of_node; ++ struct device_node *np; ++ ++ np = of_parse_phandle(r, "mediatek,toprgu", 0); ++ if (!np) ++ return -1; ++ ++ eth->toprgu = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->toprgu)) ++ return PTR_ERR(eth->toprgu); ++ ++ return 0; ++} ++ ++static int mtk_xfi_pll_enable(struct mtk_eth *eth) ++{ ++ u32 val = 0; ++ ++ if (!eth->usxgmii_pll) ++ return -EINVAL; ++ ++ /* Add software workaround for USXGMII PLL TCL issue */ ++ regmap_write(eth->usxgmii_pll, XFI_PLL_ANA_GLB8, RG_XFI_PLL_ANA_SWWA); ++ ++ regmap_read(eth->usxgmii_pll, XFI_PLL_DIG_GLB8, &val); ++ val |= RG_XFI_PLL_EN; ++ regmap_write(eth->usxgmii_pll, XFI_PLL_DIG_GLB8, val); ++ ++ return 0; ++} ++ ++static void mtk_usxgmii_setup_phya(struct regmap *pextp, phy_interface_t interface, int id) ++{ ++ bool is_10g = (interface == PHY_INTERFACE_MODE_10GBASER || ++ interface == PHY_INTERFACE_MODE_USXGMII); ++ bool is_2p5g = (interface == PHY_INTERFACE_MODE_2500BASEX); ++ bool is_5g = (interface == PHY_INTERFACE_MODE_5GBASER); ++ ++ /* Setup operation mode */ ++ if (is_10g) ++ regmap_write(pextp, 0x9024, 0x00C9071C); ++ else ++ regmap_write(pextp, 0x9024, 0x00D9071C); ++ ++ if (is_5g) ++ regmap_write(pextp, 0x2020, 0xAAA5A5AA); ++ else ++ regmap_write(pextp, 0x2020, 0xAA8585AA); ++ ++ if (is_2p5g || is_5g || is_10g) { ++ regmap_write(pextp, 0x2030, 0x0C020707); ++ regmap_write(pextp, 0x2034, 0x0E050F0F); ++ regmap_write(pextp, 0x2040, 0x00140032); ++ } else { ++ regmap_write(pextp, 0x2030, 0x0C020207); ++ regmap_write(pextp, 0x2034, 0x0E05050F); ++ regmap_write(pextp, 0x2040, 0x00200032); ++ } ++ ++ if (is_2p5g || is_10g) ++ regmap_write(pextp, 0x50F0, 0x00C014AA); ++ else if (is_5g) ++ regmap_write(pextp, 0x50F0, 0x00C018AA); ++ else ++ regmap_write(pextp, 0x50F0, 0x00C014BA); ++ ++ if (is_5g) { ++ regmap_write(pextp, 0x50E0, 0x3777812B); ++ regmap_write(pextp, 0x506C, 0x005C9CFF); ++ regmap_write(pextp, 0x5070, 0x9DFAFAFA); ++ regmap_write(pextp, 0x5074, 0x273F3F3F); ++ regmap_write(pextp, 0x5078, 0xA8883868); ++ regmap_write(pextp, 0x507C, 0x14661466); ++ } else { ++ regmap_write(pextp, 0x50E0, 0x3777C12B); ++ regmap_write(pextp, 0x506C, 0x005F9CFF); ++ regmap_write(pextp, 0x5070, 0x9D9DFAFA); ++ regmap_write(pextp, 0x5074, 0x27273F3F); ++ regmap_write(pextp, 0x5078, 0xA7883C68); ++ regmap_write(pextp, 0x507C, 0x11661166); ++ } ++ ++ if (is_2p5g || is_10g) { ++ regmap_write(pextp, 0x5080, 0x0E000AAF); ++ regmap_write(pextp, 0x5084, 0x08080D0D); ++ regmap_write(pextp, 0x5088, 0x02030909); ++ } else if (is_5g) { ++ regmap_write(pextp, 0x5080, 0x0E001ABF); ++ regmap_write(pextp, 0x5084, 0x080B0D0D); ++ regmap_write(pextp, 0x5088, 0x02050909); ++ } else { ++ regmap_write(pextp, 0x5080, 0x0E000EAF); ++ regmap_write(pextp, 0x5084, 0x08080E0D); ++ regmap_write(pextp, 0x5088, 0x02030B09); ++ } ++ ++ if (is_5g) { ++ regmap_write(pextp, 0x50E4, 0x0C000000); ++ regmap_write(pextp, 0x50E8, 0x04000000); ++ } else { ++ regmap_write(pextp, 0x50E4, 0x0C0C0000); ++ regmap_write(pextp, 0x50E8, 0x04040000); ++ } ++ ++ if (is_2p5g || mtk_interface_mode_is_xgmii(interface)) ++ regmap_write(pextp, 0x50EC, 0x0F0F0C06); ++ else ++ regmap_write(pextp, 0x50EC, 0x0F0F0606); ++ ++ if (is_5g) { ++ regmap_write(pextp, 0x50A8, 0x50808C8C); ++ regmap_write(pextp, 0x6004, 0x18000000); ++ } else { ++ regmap_write(pextp, 0x50A8, 0x506E8C8C); ++ regmap_write(pextp, 0x6004, 0x18190000); ++ } ++ ++ if (is_10g) ++ regmap_write(pextp, 0x00F8, 0x01423342); ++ else if (is_5g) ++ regmap_write(pextp, 0x00F8, 0x00A132A1); ++ else if (is_2p5g) ++ regmap_write(pextp, 0x00F8, 0x009C329C); ++ else ++ regmap_write(pextp, 0x00F8, 0x00FA32FA); ++ ++ /* Force SGDT_OUT off and select PCS */ ++ if (mtk_interface_mode_is_xgmii(interface)) ++ regmap_write(pextp, 0x00F4, 0x80201F20); ++ else ++ regmap_write(pextp, 0x00F4, 0x80201F21); ++ ++ /* Force GLB_CKDET_OUT */ ++ regmap_write(pextp, 0x0030, 0x00050C00); ++ ++ /* Force AEQ on */ ++ regmap_write(pextp, 0x0070, 0x02002800); ++ ndelay(1020); ++ ++ /* Setup DA default value */ ++ regmap_write(pextp, 0x30B0, 0x00000020); ++ regmap_write(pextp, 0x3028, 0x00008A01); ++ regmap_write(pextp, 0x302C, 0x0000A884); ++ regmap_write(pextp, 0x3024, 0x00083002); ++ if (mtk_interface_mode_is_xgmii(interface)) { ++ regmap_write(pextp, 0x3010, 0x00022220); ++ regmap_write(pextp, 0x5064, 0x0F020A01); ++ regmap_write(pextp, 0x50B4, 0x06100600); ++ if (interface == PHY_INTERFACE_MODE_USXGMII) ++ regmap_write(pextp, 0x3048, 0x40704000); ++ else ++ regmap_write(pextp, 0x3048, 0x47684100); ++ } else { ++ regmap_write(pextp, 0x3010, 0x00011110); ++ regmap_write(pextp, 0x3048, 0x40704000); ++ } ++ ++ if (!mtk_interface_mode_is_xgmii(interface) && !is_2p5g) ++ regmap_write(pextp, 0x3064, 0x0000C000); ++ ++ if (interface == PHY_INTERFACE_MODE_USXGMII) { ++ regmap_write(pextp, 0x3050, 0xA8000000); ++ regmap_write(pextp, 0x3054, 0x000000AA); ++ } else if (mtk_interface_mode_is_xgmii(interface)) { ++ regmap_write(pextp, 0x3050, 0x00000000); ++ regmap_write(pextp, 0x3054, 0x00000000); ++ } else { ++ regmap_write(pextp, 0x3050, 0xA8000000); ++ regmap_write(pextp, 0x3054, 0x000000AA); ++ } ++ ++ if (mtk_interface_mode_is_xgmii(interface)) ++ regmap_write(pextp, 0x306C, 0x00000F00); ++ else if (is_2p5g) ++ regmap_write(pextp, 0x306C, 0x22000F00); ++ else ++ regmap_write(pextp, 0x306C, 0x20200F00); ++ ++ if (interface == PHY_INTERFACE_MODE_10GBASER && id == 0) ++ regmap_write(pextp, 0xA008, 0x0007B400); ++ ++ if (mtk_interface_mode_is_xgmii(interface)) ++ regmap_write(pextp, 0xA060, 0x00040000); ++ else ++ regmap_write(pextp, 0xA060, 0x00050000); ++ ++ if (is_10g) ++ regmap_write(pextp, 0x90D0, 0x00000001); ++ else if (is_5g) ++ regmap_write(pextp, 0x90D0, 0x00000003); ++ else if (is_2p5g) ++ regmap_write(pextp, 0x90D0, 0x00000005); ++ else ++ regmap_write(pextp, 0x90D0, 0x00000007); ++ ++ /* Release reset */ ++ regmap_write(pextp, 0x0070, 0x0200E800); ++ usleep_range(150, 500); ++ ++ /* Switch to P0 */ ++ regmap_write(pextp, 0x0070, 0x0200C111); ++ ndelay(1020); ++ regmap_write(pextp, 0x0070, 0x0200C101); ++ usleep_range(15, 50); ++ ++ if (mtk_interface_mode_is_xgmii(interface)) { ++ /* Switch to Gen3 */ ++ regmap_write(pextp, 0x0070, 0x0202C111); ++ } else { ++ /* Switch to Gen2 */ ++ regmap_write(pextp, 0x0070, 0x0201C111); ++ } ++ ndelay(1020); ++ if (mtk_interface_mode_is_xgmii(interface)) ++ regmap_write(pextp, 0x0070, 0x0202C101); ++ else ++ regmap_write(pextp, 0x0070, 0x0201C101); ++ usleep_range(100, 500); ++ regmap_write(pextp, 0x30B0, 0x00000030); ++ if (mtk_interface_mode_is_xgmii(interface)) ++ regmap_write(pextp, 0x00F4, 0x80201F00); ++ else ++ regmap_write(pextp, 0x00F4, 0x80201F01); ++ ++ regmap_write(pextp, 0x3040, 0x30000000); ++ usleep_range(400, 1000); ++} ++ ++static void mtk_usxgmii_reset(struct mtk_eth *eth, int id) ++{ ++ u32 toggle, val; ++ ++ if (id >= MTK_MAX_DEVS || !eth->toprgu) ++ return; ++ ++ switch (id) { ++ case 0: ++ toggle = SWSYSRST_XFI_PEXPT0_GRST | SWSYSRST_XFI0_GRST | ++ SWSYSRST_SGMII0_GRST; ++ break; ++ case 1: ++ toggle = SWSYSRST_XFI_PEXPT1_GRST | SWSYSRST_XFI1_GRST | ++ SWSYSRST_SGMII1_GRST; ++ break; ++ default: ++ return; ++ } ++ ++ /* Enable software reset */ ++ regmap_set_bits(eth->toprgu, TOPRGU_SWSYSRST_EN, toggle); ++ ++ /* Assert USXGMII reset */ ++ regmap_set_bits(eth->toprgu, TOPRGU_SWSYSRST, ++ FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88) | toggle); ++ ++ usleep_range(100, 500); ++ ++ /* De-assert USXGMII reset */ ++ regmap_read(eth->toprgu, TOPRGU_SWSYSRST, &val); ++ val |= FIELD_PREP(SWSYSRST_UNLOCK_KEY, 0x88); ++ val &= ~toggle; ++ regmap_write(eth->toprgu, TOPRGU_SWSYSRST, val); ++ ++ /* Disable software reset */ ++ regmap_clear_bits(eth->toprgu, TOPRGU_SWSYSRST_EN, toggle); ++ ++ mdelay(10); ++} ++ ++/* As the USXGMII PHYA is shared with the 1000Base-X/2500Base-X/Cisco SGMII unit ++ * the psc-mtk-lynxi instance needs to be wrapped, so that calls to .pcs_config ++ * also trigger an initial reset and subsequent configuration of the PHYA. ++ */ ++struct mtk_sgmii_wrapper_pcs { ++ struct mtk_eth *eth; ++ struct phylink_pcs *wrapped_pcs; ++ u8 id; ++ struct phylink_pcs pcs; ++}; ++ ++static int mtk_sgmii_wrapped_pcs_config(struct phylink_pcs *pcs, ++ unsigned int mode, ++ phy_interface_t interface, ++ const unsigned long *advertising, ++ bool permit_pause_to_mac) ++{ ++ struct mtk_sgmii_wrapper_pcs *wp = container_of(pcs, struct mtk_sgmii_wrapper_pcs, pcs); ++ bool full_reconf; ++ int ret; ++ ++ full_reconf = interface != wp->eth->usxgmii_pcs[wp->id]->interface; ++ if (full_reconf) { ++ mtk_xfi_pll_enable(wp->eth); ++ mtk_usxgmii_reset(wp->eth, wp->id); ++ } ++ ++ ret = wp->wrapped_pcs->ops->pcs_config(wp->wrapped_pcs, mode, interface, ++ advertising, permit_pause_to_mac); ++ ++ if (full_reconf) ++ mtk_usxgmii_setup_phya(wp->eth->regmap_pextp[wp->id], interface, wp->id); ++ ++ wp->eth->usxgmii_pcs[wp->id]->interface = interface; ++ ++ return ret; ++} ++ ++static void mtk_sgmii_wrapped_pcs_get_state(struct phylink_pcs *pcs, ++ struct phylink_link_state *state) ++{ ++ struct mtk_sgmii_wrapper_pcs *wp = container_of(pcs, struct mtk_sgmii_wrapper_pcs, pcs); ++ ++ return wp->wrapped_pcs->ops->pcs_get_state(wp->wrapped_pcs, state); ++} ++ ++static void mtk_sgmii_wrapped_pcs_an_restart(struct phylink_pcs *pcs) ++{ ++ struct mtk_sgmii_wrapper_pcs *wp = container_of(pcs, struct mtk_sgmii_wrapper_pcs, pcs); ++ ++ wp->wrapped_pcs->ops->pcs_an_restart(wp->wrapped_pcs); ++} ++ ++static void mtk_sgmii_wrapped_pcs_link_up(struct phylink_pcs *pcs, ++ unsigned int mode, ++ phy_interface_t interface, int speed, ++ int duplex) ++{ ++ struct mtk_sgmii_wrapper_pcs *wp = container_of(pcs, struct mtk_sgmii_wrapper_pcs, pcs); ++ ++ wp->wrapped_pcs->ops->pcs_link_up(wp->wrapped_pcs, mode, interface, speed, duplex); ++} ++ ++static void mtk_sgmii_wrapped_pcs_disable(struct phylink_pcs *pcs) ++{ ++ struct mtk_sgmii_wrapper_pcs *wp = container_of(pcs, struct mtk_sgmii_wrapper_pcs, pcs); ++ ++ wp->wrapped_pcs->ops->pcs_disable(wp->wrapped_pcs); ++ ++ wp->eth->usxgmii_pcs[wp->id]->interface = PHY_INTERFACE_MODE_NA; ++} ++ ++static const struct phylink_pcs_ops mtk_sgmii_wrapped_pcs_ops = { ++ .pcs_get_state = mtk_sgmii_wrapped_pcs_get_state, ++ .pcs_config = mtk_sgmii_wrapped_pcs_config, ++ .pcs_an_restart = mtk_sgmii_wrapped_pcs_an_restart, ++ .pcs_link_up = mtk_sgmii_wrapped_pcs_link_up, ++ .pcs_disable = mtk_sgmii_wrapped_pcs_disable, ++}; ++ ++static int mtk_sgmii_wrapper_init(struct mtk_eth *eth) ++{ ++ struct mtk_sgmii_wrapper_pcs *wp; ++ int i; ++ ++ for (i = 0; i < MTK_MAX_DEVS; i++) { ++ if (!eth->sgmii_pcs[i]) ++ continue; ++ ++ if (!eth->usxgmii_pcs[i]) ++ continue; ++ ++ /* Make sure all PCS ops are supported by wrapped PCS */ ++ if (!eth->sgmii_pcs[i]->ops->pcs_get_state || ++ !eth->sgmii_pcs[i]->ops->pcs_config || ++ !eth->sgmii_pcs[i]->ops->pcs_an_restart || ++ !eth->sgmii_pcs[i]->ops->pcs_link_up || ++ !eth->sgmii_pcs[i]->ops->pcs_disable) ++ return -EOPNOTSUPP; ++ ++ wp = devm_kzalloc(eth->dev, sizeof(*wp), GFP_KERNEL); ++ if (!wp) ++ return -ENOMEM; ++ ++ wp->wrapped_pcs = eth->sgmii_pcs[i]; ++ wp->id = i; ++ wp->pcs.poll = true; ++ wp->pcs.ops = &mtk_sgmii_wrapped_pcs_ops; ++ wp->eth = eth; ++ ++ eth->usxgmii_pcs[i]->wrapped_sgmii_pcs = &wp->pcs; ++ } ++ ++ return 0; ++} ++ ++struct phylink_pcs *mtk_sgmii_wrapper_select_pcs(struct mtk_eth *eth, int mac_id) ++{ ++ u32 xgmii_id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (!eth->usxgmii_pcs[xgmii_id]) ++ return NULL; ++ ++ return eth->usxgmii_pcs[xgmii_id]->wrapped_sgmii_pcs; ++} ++ ++static int mtk_usxgmii_pcs_config(struct phylink_pcs *pcs, unsigned int mode, ++ phy_interface_t interface, ++ const unsigned long *advertising, ++ bool permit_pause_to_mac) ++{ ++ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); ++ struct mtk_eth *eth = mpcs->eth; ++ struct regmap *pextp = eth->regmap_pextp[mpcs->id]; ++ unsigned int an_ctrl = 0, link_timer = 0, xfi_mode = 0, adapt_mode = 0; ++ bool mode_changed = false; ++ ++ if (!pextp) ++ return -ENODEV; ++ ++ if (interface == PHY_INTERFACE_MODE_USXGMII) { ++ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0x1FF) | USXGMII_AN_ENABLE; ++ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x7B); ++ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_10G) | ++ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_10G); ++ } else if (interface == PHY_INTERFACE_MODE_10GBASER) { ++ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0x1FF); ++ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x7B) | ++ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x7B); ++ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_10G) | ++ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_10G); ++ adapt_mode = USXGMII_RATE_UPDATE_MODE; ++ } else if (interface == PHY_INTERFACE_MODE_5GBASER) { ++ an_ctrl = FIELD_PREP(USXGMII_AN_SYNC_CNT, 0xFF); ++ link_timer = FIELD_PREP(USXGMII_LINK_TIMER_IDLE_DETECT, 0x3D) | ++ FIELD_PREP(USXGMII_LINK_TIMER_COMP_ACK_DETECT, 0x3D) | ++ FIELD_PREP(USXGMII_LINK_TIMER_AN_RESTART, 0x3D); ++ xfi_mode = FIELD_PREP(USXGMII_XFI_RX_MODE, USXGMII_XFI_RX_MODE_5G) | ++ FIELD_PREP(USXGMII_XFI_TX_MODE, USXGMII_XFI_TX_MODE_5G); ++ adapt_mode = USXGMII_RATE_UPDATE_MODE; ++ } else { ++ return -EINVAL; ++ } ++ ++ adapt_mode |= FIELD_PREP(USXGMII_RATE_ADAPT_MODE, USXGMII_RATE_ADAPT_MODE_X1); ++ ++ if (mpcs->interface != interface) { ++ mpcs->interface = interface; ++ mode_changed = true; ++ } ++ ++ mtk_xfi_pll_enable(eth); ++ mtk_usxgmii_reset(eth, mpcs->id); ++ ++ /* Setup USXGMII AN ctrl */ ++ regmap_update_bits(mpcs->regmap, RG_PCS_AN_CTRL0, ++ USXGMII_AN_SYNC_CNT | USXGMII_AN_ENABLE, ++ an_ctrl); ++ ++ regmap_update_bits(mpcs->regmap, RG_PCS_AN_CTRL2, ++ USXGMII_LINK_TIMER_IDLE_DETECT | ++ USXGMII_LINK_TIMER_COMP_ACK_DETECT | ++ USXGMII_LINK_TIMER_AN_RESTART, ++ link_timer); ++ ++ mpcs->mode = mode; ++ ++ /* Gated MAC CK */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_MAC_CK_GATED, USXGMII_MAC_CK_GATED); ++ ++ /* Enable interface force mode */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_IF_FORCE_EN, USXGMII_IF_FORCE_EN); ++ ++ /* Setup USXGMII adapt mode */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_RATE_UPDATE_MODE | USXGMII_RATE_ADAPT_MODE, ++ adapt_mode); ++ ++ /* Setup USXGMII speed */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_XFI_RX_MODE | USXGMII_XFI_TX_MODE, ++ xfi_mode); ++ ++ usleep_range(1, 10); ++ ++ /* Un-gated MAC CK */ ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_MAC_CK_GATED, 0); ++ ++ usleep_range(1, 10); ++ ++ /* Disable interface force mode for the AN mode */ ++ if (an_ctrl & USXGMII_AN_ENABLE) ++ regmap_update_bits(mpcs->regmap, RG_PHY_TOP_SPEED_CTRL1, ++ USXGMII_IF_FORCE_EN, 0); ++ ++ /* Setup USXGMIISYS with the determined property */ ++ mtk_usxgmii_setup_phya(pextp, interface, mpcs->id); ++ ++ return mode_changed; ++} ++ ++static void mtk_usxgmii_pcs_get_state(struct phylink_pcs *pcs, ++ struct phylink_link_state *state) ++{ ++ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); ++ struct mtk_eth *eth = mpcs->eth; ++ struct mtk_mac *mac = eth->mac[mtk_xgmii2mac_id(eth, mpcs->id)]; ++ u32 val = 0; ++ ++ regmap_read(mpcs->regmap, RG_PCS_AN_CTRL0, &val); ++ if (FIELD_GET(USXGMII_AN_ENABLE, val)) { ++ /* Refresh LPA by inverting LPA_LATCH */ ++ regmap_read(mpcs->regmap, RG_PCS_AN_STS0, &val); ++ regmap_update_bits(mpcs->regmap, RG_PCS_AN_STS0, ++ USXGMII_LPA_LATCH, ++ !(val & USXGMII_LPA_LATCH)); ++ ++ regmap_read(mpcs->regmap, RG_PCS_AN_STS0, &val); ++ ++ phylink_decode_usxgmii_word(state, FIELD_GET(USXGMII_PCS_AN_WORD, ++ val)); ++ ++ state->interface = mpcs->interface; ++ } else { ++ val = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id)); ++ ++ if (mac->id == MTK_GMAC2_ID) ++ val >>= 16; ++ ++ switch (FIELD_GET(MTK_USXGMII_PCS_MODE, val)) { ++ case 0: ++ state->speed = SPEED_10000; ++ break; ++ case 1: ++ state->speed = SPEED_5000; ++ break; ++ case 2: ++ state->speed = SPEED_2500; ++ break; ++ case 3: ++ state->speed = SPEED_1000; ++ break; ++ } ++ ++ state->interface = mpcs->interface; ++ state->link = FIELD_GET(MTK_USXGMII_PCS_LINK, val); ++ state->duplex = DUPLEX_FULL; ++ } ++ ++ /* Continuously repeat re-configuration sequence until link comes up */ ++ if (state->link == 0) ++ mtk_usxgmii_pcs_config(pcs, mpcs->mode, ++ state->interface, NULL, false); ++} ++ ++static void mtk_usxgmii_pcs_restart_an(struct phylink_pcs *pcs) ++{ ++ struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs); ++ unsigned int val = 0; ++ ++ if (!mpcs->regmap) ++ return; ++ ++ regmap_read(mpcs->regmap, RG_PCS_AN_CTRL0, &val); ++ val |= USXGMII_AN_RESTART; ++ regmap_write(mpcs->regmap, RG_PCS_AN_CTRL0, val); ++} ++ ++static void mtk_usxgmii_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, ++ phy_interface_t interface, ++ int speed, int duplex) ++{ ++ /* Reconfiguring USXGMII to ensure the quality of the RX signal ++ * after the line side link up. ++ */ ++ mtk_usxgmii_pcs_config(pcs, mode, ++ interface, NULL, false); ++} ++ ++static const struct phylink_pcs_ops mtk_usxgmii_pcs_ops = { ++ .pcs_config = mtk_usxgmii_pcs_config, ++ .pcs_get_state = mtk_usxgmii_pcs_get_state, ++ .pcs_an_restart = mtk_usxgmii_pcs_restart_an, ++ .pcs_link_up = mtk_usxgmii_pcs_link_up, ++}; ++ ++int mtk_usxgmii_init(struct mtk_eth *eth) ++{ ++ struct device_node *r = eth->dev->of_node; ++ struct device *dev = eth->dev; ++ struct device_node *np; ++ int i, ret; ++ ++ for (i = 0; i < MTK_MAX_DEVS; i++) { ++ np = of_parse_phandle(r, "mediatek,usxgmiisys", i); ++ if (!np) ++ break; ++ ++ eth->usxgmii_pcs[i] = devm_kzalloc(dev, sizeof(*eth->usxgmii_pcs[i]), GFP_KERNEL); ++ if (!eth->usxgmii_pcs[i]) ++ return -ENOMEM; ++ ++ eth->usxgmii_pcs[i]->id = i; ++ eth->usxgmii_pcs[i]->eth = eth; ++ eth->usxgmii_pcs[i]->regmap = syscon_node_to_regmap(np); ++ if (IS_ERR(eth->usxgmii_pcs[i]->regmap)) ++ return PTR_ERR(eth->usxgmii_pcs[i]->regmap); ++ ++ eth->usxgmii_pcs[i]->pcs.ops = &mtk_usxgmii_pcs_ops; ++ eth->usxgmii_pcs[i]->pcs.poll = true; ++ eth->usxgmii_pcs[i]->interface = PHY_INTERFACE_MODE_NA; ++ eth->usxgmii_pcs[i]->mode = -1; ++ ++ of_node_put(np); ++ } ++ ++ ret = mtk_xfi_pextp_init(eth); ++ if (ret) ++ return ret; ++ ++ ret = mtk_xfi_pll_init(eth); ++ if (ret) ++ return ret; ++ ++ ret = mtk_toprgu_init(eth); ++ if (ret) ++ return ret; ++ ++ return mtk_sgmii_wrapper_init(eth); ++} ++ ++struct phylink_pcs *mtk_usxgmii_select_pcs(struct mtk_eth *eth, int mac_id) ++{ ++ u32 xgmii_id = mtk_mac2xgmii_id(eth, mac_id); ++ ++ if (!eth->usxgmii_pcs[xgmii_id]->regmap) ++ return NULL; ++ ++ return ð->usxgmii_pcs[xgmii_id]->pcs; ++} diff --git a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch index 7fbf38a7e34f31..ed5b7b60fb9add 100644 --- a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch +++ b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos - rev-mii --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -366,6 +366,7 @@ void phylink_get_linkmodes(unsigned long +@@ -371,6 +371,7 @@ void phylink_get_linkmodes(unsigned long case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII: @@ -40,7 +40,7 @@ Signed-off-by: Gabor Juhos case PHY_INTERFACE_MODE_QSGMII: case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_GMII: -@@ -629,6 +630,7 @@ static int phylink_parse_mode(struct phy +@@ -634,6 +635,7 @@ static int phylink_parse_mode(struct phy switch (pl->link_config.interface) { case PHY_INTERFACE_MODE_SGMII: diff --git a/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch b/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch index 30fc56e618503c..46c304032db33b 100644 --- a/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch +++ b/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch @@ -13,7 +13,7 @@ Signed-off-by: Bhaskar Upadhaya --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -393,6 +393,7 @@ void phylink_get_linkmodes(unsigned long +@@ -398,6 +398,7 @@ void phylink_get_linkmodes(unsigned long caps |= MAC_1000FD; break; @@ -21,7 +21,7 @@ Signed-off-by: Bhaskar Upadhaya case PHY_INTERFACE_MODE_2500BASEX: caps |= MAC_2500FD; break; -@@ -646,6 +647,10 @@ static int phylink_parse_mode(struct phy +@@ -651,6 +652,10 @@ static int phylink_parse_mode(struct phy phylink_set(pl->supported, 2500baseX_Full); break; diff --git a/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch b/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch index 84718d300b5df7..4c144a7b1ca9e9 100644 --- a/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch +++ b/target/linux/mediatek/patches-5.15/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch @@ -103,7 +103,7 @@ Signed-off-by: David S. Miller ret = mtk_mdio_busy_wait(eth); if (ret < 0) -@@ -1013,6 +1056,7 @@ static int mtk_mdio_init(struct mtk_eth +@@ -898,6 +941,7 @@ static int mtk_mdio_init(struct mtk_eth eth->mii_bus->name = "mdio"; eth->mii_bus->read = mtk_mdio_read; eth->mii_bus->write = mtk_mdio_write; @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -382,9 +382,12 @@ +@@ -402,9 +402,12 @@ #define PHY_IAC_ADDR_MASK GENMASK(24, 20) #define PHY_IAC_ADDR(x) FIELD_PREP(PHY_IAC_ADDR_MASK, (x)) #define PHY_IAC_CMD_MASK GENMASK(19, 18) diff --git a/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch b/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch index a455005504cead..eed97b476944fb 100644 --- a/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch +++ b/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch @@ -22,7 +22,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c -@@ -813,6 +813,24 @@ mtk_wed_rro_alloc(struct mtk_wed_device +@@ -821,6 +821,24 @@ mtk_wed_rro_alloc(struct mtk_wed_device struct device_node *np; int index; @@ -47,7 +47,7 @@ Signed-off-by: Lorenzo Bianconi index = of_property_match_string(dev->hw->node, "memory-region-names", "wo-dlm"); if (index < 0) -@@ -829,6 +847,7 @@ mtk_wed_rro_alloc(struct mtk_wed_device +@@ -837,6 +855,7 @@ mtk_wed_rro_alloc(struct mtk_wed_device return -ENODEV; dev->rro.miod_phys = rmem->base; diff --git a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch index fce5fc856f49bc..c458237f3902e8 100644 --- a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4615,6 +4615,7 @@ static const struct net_device_ops mtk_n +@@ -4553,6 +4553,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -4784,6 +4785,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4724,6 +4725,9 @@ static int mtk_add_mac(struct mtk_eth *e register_netdevice_notifier(&mac->device_notifier); } diff --git a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch index 87f319abb56130..b8461b0030ce16 100644 --- a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch +++ b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch @@ -95,7 +95,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c phydev->mii_ts->link_state(phydev->mii_ts, phydev); --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1322,7 +1322,8 @@ void phylink_destroy(struct phylink *pl) +@@ -1369,7 +1369,8 @@ void phylink_destroy(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_destroy); diff --git a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch index 591f0cea13a3f1..183c9dda2fdae1 100644 --- a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch +++ b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1942,6 +1942,11 @@ int phylink_ethtool_ksettings_set(struct +@@ -1990,6 +1990,11 @@ int phylink_ethtool_ksettings_set(struct * the presence of a PHY, this should not be changed as that * should be determined from the media side advertisement. */ @@ -33,7 +33,7 @@ Submitted-by: John Crispin return phy_ethtool_ksettings_set(pl->phydev, kset); } -@@ -2245,8 +2250,11 @@ int phylink_ethtool_get_eee(struct phyli +@@ -2293,8 +2298,11 @@ int phylink_ethtool_get_eee(struct phyli ASSERT_RTNL(); @@ -46,7 +46,7 @@ Submitted-by: John Crispin return ret; } -@@ -2263,8 +2271,11 @@ int phylink_ethtool_set_eee(struct phyli +@@ -2311,8 +2319,11 @@ int phylink_ethtool_set_eee(struct phyli ASSERT_RTNL(); diff --git a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch index f9411e47d32477..2048e22f2e5aba 100644 --- a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch +++ b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch @@ -15,7 +15,7 @@ Submitted-by: Birger Koblitz --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -403,6 +403,7 @@ void phylink_get_linkmodes(unsigned long +@@ -408,6 +408,7 @@ void phylink_get_linkmodes(unsigned long case PHY_INTERFACE_MODE_XGMII: case PHY_INTERFACE_MODE_RXAUI: @@ -23,7 +23,7 @@ Submitted-by: Birger Koblitz case PHY_INTERFACE_MODE_XAUI: case PHY_INTERFACE_MODE_10GBASER: case PHY_INTERFACE_MODE_10GKR: -@@ -657,6 +658,7 @@ static int phylink_parse_mode(struct phy +@@ -662,6 +663,7 @@ static int phylink_parse_mode(struct phy fallthrough; case PHY_INTERFACE_MODE_USXGMII: case PHY_INTERFACE_MODE_10GKR: From 3967c26974069fdc6ee216c8aeb9bc81cca4352b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 28 Aug 2023 21:54:02 +0100 Subject: [PATCH 0417/1171] mediatek: filogic: remove stray quote When adapting the network configuration for MT7988 RFB a stray quote was left in a script. Remove it to fix generating the default network configuration. Signed-off-by: Daniel Golle (cherry picked from commit 8f5986355cdc5df921ef8232f559ca7bfb18f1ed) --- target/linux/mediatek/filogic/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 1ea2ada0984b66..e5872e7fe4db8e 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -37,7 +37,7 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" eth1 ;; mediatek,mt7988a-rfb) - ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 eth1" eth2" + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 eth1" eth2 ;; mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 From d052d409a0689574b798cb6544ec6c7edd88d38f Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 28 Aug 2023 23:41:43 +0100 Subject: [PATCH 0418/1171] uboot-mediatek: fix dependency on TF-A for MT7988 RFB (sdmmc) The U-Boot build for the MT7988 reference board booting from SD card wrongly depended on the 'ddr4' variant of the ARM TrustedFirmware-A build even though the 'comb' variant is used. Fix that dependency. Fixes: 572ea68070 ("uboot-mediatek: add patches for MT7988 and builds for RFB") Signed-off-by: Daniel Golle (cherry picked from commit 78e3adcaf993cd1a58821a69efccfca8d380f754) --- package/boot/uboot-mediatek/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 021d444a97a54b..66de3921852851 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -403,7 +403,7 @@ define U-Boot/mt7988_rfb-sd BL2_BOOTDEV:=sdmmc BL2_SOC:=mt7988 BL2_DDRTYPE:=comb - DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-ddr4 + DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-comb endef UBOOT_TARGETS := \ From a2ffbc8d1604bf0e71962c76ec4e7feec5fda102 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 28 Aug 2023 23:44:52 +0100 Subject: [PATCH 0419/1171] arm-trusted-firmware-mediatek: enable built-in 2.5G PHY on MT7988 Always enable built-in 2.5G PHY on MT7988 for now, so that it can be used. In future it would be nice to be able to switch power and MDIO access via address 0 at run-time in Linux, both, to be able to use external PHYs at address 0 and to reduce power consumption on systems not using the built-in 2.5G PHY. Signed-off-by: Daniel Golle (cherry picked from commit 33046d2a471ed687404a617c356b9cdf5652c2d6) --- .../patches/001-mt7988-enable-2p5g-phy.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/boot/arm-trusted-firmware-mediatek/patches/001-mt7988-enable-2p5g-phy.patch diff --git a/package/boot/arm-trusted-firmware-mediatek/patches/001-mt7988-enable-2p5g-phy.patch b/package/boot/arm-trusted-firmware-mediatek/patches/001-mt7988-enable-2p5g-phy.patch new file mode 100644 index 00000000000000..d377bd8433c27c --- /dev/null +++ b/package/boot/arm-trusted-firmware-mediatek/patches/001-mt7988-enable-2p5g-phy.patch @@ -0,0 +1,11 @@ +--- a/plat/mediatek/mt7988/bl2/bl2_plat_init.c ++++ b/plat/mediatek/mt7988/bl2/bl2_plat_init.c +@@ -90,6 +90,8 @@ static void mtk_i2p5g_phy_init(void) + * clear bit 22 to use external MDIO. + */ + mmio_setbits_32(GBE_TOP_REG, I2P5G_MDIO); ++ /* Internal 2.5Gphy power on sequence */ ++ eth_2p5g_phy_mtcmos_ctrl(true); + } + + static void mt7988_i2c_init(void) From b2d264dc683e862c66da9b4e6e0359a4b4dccc98 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 31 Aug 2023 19:20:49 +0100 Subject: [PATCH 0420/1171] mediatek: mt7622: set DEVICE_DTC_ADDR for BPi-R64 Relocating the device tree is required for being apply to apply device tree overylay at boot. Fixes: 34bb33094a ("mediatek: use updated device tree overlay mechanism for BPi-R64") Signed-off-by: Daniel Golle (cherry picked from commit a8cbee8e2d11dd139c1dea1f7289bdf28b1e2b52) --- target/linux/mediatek/image/mt7622.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index d40eb54cb7359c..53f5bd9d14ba9d 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -71,6 +71,7 @@ define Device/bananapi_bpi-r64 DEVICE_DTS_OVERLAY := mt7622-bananapi-bpi-r64-pcie1 mt7622-bananapi-bpi-r64-sata DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 e2fsprogs mkf2fs f2fsck DEVICE_DTC_FLAGS := --pad 4096 + DEVICE_DTS_LOADADDR := 0x43f00000 ARTIFACTS := emmc-preloader.bin emmc-bl31-uboot.fip sdcard.img.gz snand-preloader.bin snand-bl31-uboot.fip IMAGES := sysupgrade.itb KERNEL_INITRAMFS_SUFFIX := -recovery.itb From 4f1a7e88970d8a38071632c245a18f3959428c13 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 29 Jul 2023 21:24:09 +0800 Subject: [PATCH 0421/1171] mac80211: rework MT7620 PA/LNA RF calibration This patch makes some improvements to the MT7620 RF calibration. 1. Move MT7620 PA/LNA calibration code to dedicated functions. 2. Restore RF and BBP registers before R-Calibration. 3. Do Rx DCOC calibration again before RXIQ calibration. 4. Use SoC specific AGC initial LNA value. 5. Correct MAC_RX_EN mask in rt2800_r_calibration()[1]. [1] This change may fix the "BBP/RF register access failed" error: ieee80211 phy0: rt2800_wait_bbp_rf_ready: Error - BBP/RF register access failed, aborting Signed-off-by: Shiji Yang (cherry picked from commit 2824fa6963cf245b7e0b04aa96bcbe5013524b85) --- ...-rework-MT7620-PA-LNA-RF-calibration.patch | 434 ++++++++++++++++++ 1 file changed, 434 insertions(+) create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch new file mode 100644 index 00000000000000..7fdad639766064 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch @@ -0,0 +1,434 @@ +From: Shiji Yang +Date: Tue, 25 Jul 2023 20:05:06 +0800 +Subject: [PATCH] wifi: rt2x00: rework MT7620 PA/LNA RF calibration + +1. Move MT7620 PA/LNA calibration code to dedicated functions. + Calibration stage 1 is executed before configuring channels and + stage 2 is executed after configuring channels. +2. For external PA/LNA devices, restore RF and BBP registers before + R-Calibration. +3. Do Rx DCOC calibration again before RXIQ calibration. +4. Correct MAC_SYS_CTRL register RX mask to 0x08 in R-Calibration + function. For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN + and Bit[3] controls MAC_RX_EN (Bit index starts from 0). +5. Move the channel configuration code from rt2800_vco_calibration() + to the rt2800_config_channel(). +6. Use MT7620 SOC specific AGC initial LNA value instead of the + RT5592's value. +7. Adjust the register operation sequence according to the vendor + driver code. This may not be useful, but it can make things + clearer when developers try to review it. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 318 +++++++++++------- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 6 + + 2 files changed, 194 insertions(+), 130 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -62,6 +62,9 @@ MODULE_PARM_DESC(watchdog, "Enable watch + rt2800_regbusy_read((__dev), H2M_MAILBOX_CSR, \ + H2M_MAILBOX_CSR_OWNER, (__reg)) + ++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev); ++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev); ++ + static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev) + { + /* check for rt2872 on SoC */ +@@ -3881,14 +3884,6 @@ static void rt2800_config_channel_rf7620 + rfcsr |= tx_agc_fc; + rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr); + } +- +- if (conf_is_ht40(conf)) { +- rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10); +- rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f); +- } else { +- rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a); +- rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40); +- } + } + + static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, +@@ -4151,6 +4146,9 @@ static void rt2800_config_channel(struct + rt2800_txpower_to_dev(rt2x00dev, rf->channel, + info->default_power3); + ++ if (rt2x00_rt(rt2x00dev, RT6352)) ++ rt6352_init_palna_stage1(rt2x00dev); ++ + switch (rt2x00dev->chip.rt) { + case RT3883: + rt3883_bbp_adjust(rt2x00dev, rf); +@@ -4457,89 +4455,65 @@ static void rt2800_config_channel(struct + usleep_range(1000, 1500); + } + +- if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) { ++ if (rt2x00_rt(rt2x00dev, RT5592)) { + reg = 0x10; +- if (!conf_is_ht40(conf)) { +- if (rt2x00_rt(rt2x00dev, RT6352) && +- rt2x00_has_cap_external_lna_bg(rt2x00dev)) { +- reg |= 0x5; +- } else { +- reg |= 0xa; +- } +- } ++ if (!conf_is_ht40(conf)) ++ reg |= 0xa; + rt2800_bbp_write(rt2x00dev, 195, 141); + rt2800_bbp_write(rt2x00dev, 196, reg); + +- /* AGC init. +- * Despite the vendor driver using different values here for +- * RT6352 chip, we use 0x1c for now. This may have to be changed +- * once TSSI got implemented. +- */ + reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain; + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); +- +- if (rt2x00_rt(rt2x00dev, RT5592)) +- rt2800_iq_calibrate(rt2x00dev, rf->channel); ++ ++ rt2800_iq_calibrate(rt2x00dev, rf->channel); + } + + if (rt2x00_rt(rt2x00dev, RT6352)) { +- if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, +- &rt2x00dev->cap_flags)) { +- reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); +- reg |= 0x00000101; +- rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); +- +- reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); +- reg |= 0x00000101; +- rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); +- +- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); +- rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); ++ /* BBP for GLRT BW */ ++ if (conf_is_ht40(conf)) { ++ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10); ++ rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f); ++ } else { ++ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a); ++ rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40); + +- rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, +- 0x36303636); +- rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, +- 0x6C6C6B6C); +- rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, +- 0x6C6C6B6C); ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) ++ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x15); + } + +- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { +- reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); +- reg |= 0x00000101; +- rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); +- +- reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); +- reg |= 0x00000101; +- rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); +- +- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); +- rt2800_bbp_write(rt2x00dev, 75, 0x68); +- rt2800_bbp_write(rt2x00dev, 76, 0x4C); +- rt2800_bbp_write(rt2x00dev, 79, 0x1C); +- rt2800_bbp_write(rt2x00dev, 80, 0x0C); +- rt2800_bbp_write(rt2x00dev, 82, 0xB6); +- /* bank 0 RF reg 42 and glrt BBP reg 141 will be set in +- * config channel function in dependence of channel and +- * HT20/HT40 so don't touch it +- */ ++ if (rt2x00dev->default_ant.rx_chain_num == 1) { ++ rt2800_bbp_write(rt2x00dev, 91, 0x07); ++ rt2800_bbp_write(rt2x00dev, 95, 0x1A); ++ rt2800_bbp_write(rt2x00dev, 195, 128); ++ rt2800_bbp_write(rt2x00dev, 196, 0xA0); ++ rt2800_bbp_write(rt2x00dev, 195, 170); ++ rt2800_bbp_write(rt2x00dev, 196, 0x12); ++ rt2800_bbp_write(rt2x00dev, 195, 171); ++ rt2800_bbp_write(rt2x00dev, 196, 0x10); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 91, 0x06); ++ rt2800_bbp_write(rt2x00dev, 95, 0x9A); ++ rt2800_bbp_write(rt2x00dev, 195, 128); ++ rt2800_bbp_write(rt2x00dev, 196, 0xE0); ++ rt2800_bbp_write(rt2x00dev, 195, 170); ++ rt2800_bbp_write(rt2x00dev, 196, 0x30); ++ rt2800_bbp_write(rt2x00dev, 195, 171); ++ rt2800_bbp_write(rt2x00dev, 196, 0x30); + } ++ ++ /* AGC init */ ++ reg = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0; ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); ++ ++ /* On 11A, We should delay and wait RF/BBP to be stable ++ * and the appropriate time should be 1000 micro seconds ++ * 2005/06/05 - On 11G, we also need this delay time. ++ * Otherwise it's difficult to pass the WHQL. ++ */ ++ usleep_range(1000, 1500); ++ ++ rt6352_init_palna_stage2(rt2x00dev); + } + + bbp = rt2800_bbp_read(rt2x00dev, 4); +@@ -5649,43 +5623,6 @@ void rt2800_vco_calibration(struct rt2x0 + } + } + rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); +- +- if (rt2x00_rt(rt2x00dev, RT6352)) { +- if (rt2x00dev->default_ant.rx_chain_num == 1) { +- rt2800_bbp_write(rt2x00dev, 91, 0x07); +- rt2800_bbp_write(rt2x00dev, 95, 0x1A); +- rt2800_bbp_write(rt2x00dev, 195, 128); +- rt2800_bbp_write(rt2x00dev, 196, 0xA0); +- rt2800_bbp_write(rt2x00dev, 195, 170); +- rt2800_bbp_write(rt2x00dev, 196, 0x12); +- rt2800_bbp_write(rt2x00dev, 195, 171); +- rt2800_bbp_write(rt2x00dev, 196, 0x10); +- } else { +- rt2800_bbp_write(rt2x00dev, 91, 0x06); +- rt2800_bbp_write(rt2x00dev, 95, 0x9A); +- rt2800_bbp_write(rt2x00dev, 195, 128); +- rt2800_bbp_write(rt2x00dev, 196, 0xE0); +- rt2800_bbp_write(rt2x00dev, 195, 170); +- rt2800_bbp_write(rt2x00dev, 196, 0x30); +- rt2800_bbp_write(rt2x00dev, 195, 171); +- rt2800_bbp_write(rt2x00dev, 196, 0x30); +- } +- +- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { +- rt2800_bbp_write(rt2x00dev, 75, 0x68); +- rt2800_bbp_write(rt2x00dev, 76, 0x4C); +- rt2800_bbp_write(rt2x00dev, 79, 0x1C); +- rt2800_bbp_write(rt2x00dev, 80, 0x0C); +- rt2800_bbp_write(rt2x00dev, 82, 0xB6); +- } +- +- /* On 11A, We should delay and wait RF/BBP to be stable +- * and the appropriate time should be 1000 micro seconds +- * 2005/06/05 - On 11G, we also need this delay time. +- * Otherwise it's difficult to pass the WHQL. +- */ +- usleep_range(1000, 1500); +- } + } + EXPORT_SYMBOL_GPL(rt2800_vco_calibration); + +@@ -8650,7 +8587,7 @@ static void rt2800_r_calibration(struct + rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); + + maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); +- maccfg &= (~0x04); ++ maccfg &= (~0x08); + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); + + if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) +@@ -10688,30 +10625,151 @@ static void rt2800_init_rfcsr_6352(struc + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + } ++} + +- rt6352_enable_pa_pin(rt2x00dev, 0); +- rt2800_r_calibration(rt2x00dev); +- rt2800_rf_self_txdc_cal(rt2x00dev); +- rt2800_rxdcoc_calibration(rt2x00dev); +- rt2800_bw_filter_calibration(rt2x00dev, true); +- rt2800_bw_filter_calibration(rt2x00dev, false); +- rt2800_loft_iq_calibration(rt2x00dev); +- rt2800_rxiq_calibration(rt2x00dev); +- rt6352_enable_pa_pin(rt2x00dev, 1); ++static void rt6352_init_ext_palna(struct rt2x00_dev *rt2x00dev) ++{ ++ u32 reg; ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); ++ reg |= 0x00000101; ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); ++ ++ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); ++ reg |= 0x00000101; ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); ++ } + +- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); + rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_bbp_write(rt2x00dev, 75, 0x68); + rt2800_bbp_write(rt2x00dev, 76, 0x4C); + rt2800_bbp_write(rt2x00dev, 79, 0x1C); + rt2800_bbp_write(rt2x00dev, 80, 0x0C); + rt2800_bbp_write(rt2x00dev, 82, 0xB6); +- /* bank 0 RF reg 42 and glrt BBP reg 141 will be set in config +- * channel function in dependence of channel and HT20/HT40, +- * so don't touch them here. +- */ ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636); ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C6B6C); ++ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C6B6C); ++ } ++} ++ ++static void rt6352_restore_rf_bbp(struct rt2x00_dev *rt2x00dev) ++{ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02); ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_pa(rt2x00dev)) ++ { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2800_bbp_write(rt2x00dev, 75, 0x60); ++ rt2800_bbp_write(rt2x00dev, 76, 0x44); ++ rt2800_bbp_write(rt2x00dev, 79, 0x1C); ++ rt2800_bbp_write(rt2x00dev, 80, 0x0C); ++ rt2800_bbp_write(rt2x00dev, 82, 0xB6); ++ } ++ ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 ++ && rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363A); ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C); ++ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C); ++ } ++} ++ ++/* MT7620 PA/LNA initialization before switching channels */ ++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev) ++{ ++ if (rt2x00_has_cap_external_pa(rt2x00dev) || ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt6352_enable_pa_pin(rt2x00dev, 0); ++ rt6352_restore_rf_bbp(rt2x00dev); ++ } ++ ++ rt2800_r_calibration(rt2x00dev); ++} ++ ++/* MT7620 PA/LNA initialization after switching channels */ ++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev) ++{ ++ rt2800_rf_self_txdc_cal(rt2x00dev); ++ rt2800_rxdcoc_calibration(rt2x00dev); ++ rt2800_bw_filter_calibration(rt2x00dev, true); ++ rt2800_bw_filter_calibration(rt2x00dev, false); ++ rt2800_loft_iq_calibration(rt2x00dev); ++ ++ /* missing DPD Calibration for devices using internal PA */ ++ ++ rt2800_rxdcoc_calibration(rt2x00dev); ++ rt2800_rxiq_calibration(rt2x00dev); ++ ++ if(rt2x00_has_cap_external_pa(rt2x00dev) || ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt6352_enable_pa_pin(rt2x00dev, 1); ++ rt6352_init_ext_palna(rt2x00dev); + } + } + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -1277,6 +1277,12 @@ rt2x00_has_cap_external_lna_bg(struct rt + } + + static inline bool ++rt2x00_has_cap_external_pa(struct rt2x00_dev *rt2x00dev) ++{ ++ return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_EXTERNAL_PA_TX0); ++} ++ ++static inline bool + rt2x00_has_cap_double_antenna(struct rt2x00_dev *rt2x00dev) + { + return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_DOUBLE_ANTENNA); From 9df91263204b8a9a4c506fd75e06b83236fdc56e Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 29 Jul 2023 21:24:10 +0800 Subject: [PATCH 0422/1171] ramips: pinctrl: support requesting different functions for same group MT7620 wireless radio needs change the pin group function between "gpio" and "pa" during the calibration process. However, ralink pinctrl driver doesn't support requesting different functions for the same group. This patch enables pinctrl consumers to perform such operations. Signed-off-by: Shiji Yang (cherry picked from commit b4ea49ad442d2884d0b86009f404f125635c4153) --- ...upport-requesting-different-function.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch diff --git a/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch new file mode 100644 index 00000000000000..047808f1e6904d --- /dev/null +++ b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch @@ -0,0 +1,45 @@ +From: Shiji Yang +Date: Wed, 26 Jul 2023 01:32:55 +0800 +Subject: [PATCH] pinctrl: mtmips: support requesting different functions for + same group + +Sometimes pinctrl consumers may request different functions for the +same pin group in different situations. This patch can help to reset +the group function flag when requesting a different function. + +Signed-off-by: Shiji Yang +--- + drivers/pinctrl/ralink/pinctrl-ralink.c | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +--- a/drivers/pinctrl/ralink/pinctrl-ralink.c ++++ b/drivers/pinctrl/ralink/pinctrl-ralink.c +@@ -123,11 +123,24 @@ static int ralink_pmx_group_enable(struc + int i; + int shift; + +- /* dont allow double use */ ++ /* ++ * for the same pin group, if request a different function, ++ * then clear the group function flag and continue, else exit. ++ */ + if (p->groups[group].enabled) { +- dev_err(p->dev, "%s is already enabled\n", +- p->groups[group].name); +- return 0; ++ for (i = 0; i < p->groups[group].func_count; i++) { ++ if (p->groups[group].func[i].enabled == 1) { ++ if (!strcmp(p->func[func]->name, ++ p->groups[group].func[i].name)) ++ return 0; ++ p->groups[group].func[i].enabled = 0; ++ break; ++ } ++ } ++ ++ /* exit if request the "gpio" function again */ ++ if (i == p->groups[group].func_count && func == 0) ++ return 0; + } + + p->groups[group].enabled = 1; From cdc8470aecd03e6994714af092f030f209951de4 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 22 Aug 2023 19:16:22 +0100 Subject: [PATCH 0423/1171] mac80211: fix MT7620 Wi-Fi channel scanning function During the channel scanning process, the driver will continuously switch channels. It seems that the full RF calibration step in rt2800_config_channel() caused the channel scanning function to timeout. To fix it, move the RF calibration to rt2800_enable_radio() so that it is only executed once. This commit also includes some coding format adjustments to follow the Linux recommended style. Fixes: 2824fa6963cf ("mac80211: rework MT7620 PA/LNA RF calibration") Signed-off-by: Shiji Yang (cherry picked from commit ce6ad123e76311d2a882054b4ea532d1bfb643c8) --- ...-rework-MT7620-PA-LNA-RF-calibration.patch | 93 +++++++------------ 1 file changed, 36 insertions(+), 57 deletions(-) diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch index 7fdad639766064..5f6f5140d9e900 100644 --- a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch @@ -3,8 +3,6 @@ Date: Tue, 25 Jul 2023 20:05:06 +0800 Subject: [PATCH] wifi: rt2x00: rework MT7620 PA/LNA RF calibration 1. Move MT7620 PA/LNA calibration code to dedicated functions. - Calibration stage 1 is executed before configuring channels and - stage 2 is executed after configuring channels. 2. For external PA/LNA devices, restore RF and BBP registers before R-Calibration. 3. Do Rx DCOC calibration again before RXIQ calibration. @@ -21,23 +19,13 @@ Subject: [PATCH] wifi: rt2x00: rework MT7620 PA/LNA RF calibration Signed-off-by: Shiji Yang --- - .../net/wireless/ralink/rt2x00/rt2800lib.c | 318 +++++++++++------- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 306 ++++++++++-------- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 6 + - 2 files changed, 194 insertions(+), 130 deletions(-) + 2 files changed, 182 insertions(+), 130 deletions(-) --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -62,6 +62,9 @@ MODULE_PARM_DESC(watchdog, "Enable watch - rt2800_regbusy_read((__dev), H2M_MAILBOX_CSR, \ - H2M_MAILBOX_CSR_OWNER, (__reg)) - -+static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev); -+static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev); -+ - static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev) - { - /* check for rt2872 on SoC */ -@@ -3881,14 +3884,6 @@ static void rt2800_config_channel_rf7620 +@@ -3881,14 +3881,6 @@ static void rt2800_config_channel_rf7620 rfcsr |= tx_agc_fc; rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr); } @@ -52,17 +40,7 @@ Signed-off-by: Shiji Yang } static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, -@@ -4151,6 +4146,9 @@ static void rt2800_config_channel(struct - rt2800_txpower_to_dev(rt2x00dev, rf->channel, - info->default_power3); - -+ if (rt2x00_rt(rt2x00dev, RT6352)) -+ rt6352_init_palna_stage1(rt2x00dev); -+ - switch (rt2x00dev->chip.rt) { - case RT3883: - rt3883_bbp_adjust(rt2x00dev, rf); -@@ -4457,89 +4455,65 @@ static void rt2800_config_channel(struct +@@ -4457,89 +4449,63 @@ static void rt2800_config_channel(struct usleep_range(1000, 1500); } @@ -193,12 +171,10 @@ Signed-off-by: Shiji Yang + * Otherwise it's difficult to pass the WHQL. + */ + usleep_range(1000, 1500); -+ -+ rt6352_init_palna_stage2(rt2x00dev); } bbp = rt2800_bbp_read(rt2x00dev, 4); -@@ -5649,43 +5623,6 @@ void rt2800_vco_calibration(struct rt2x0 +@@ -5649,43 +5615,6 @@ void rt2800_vco_calibration(struct rt2x0 } } rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); @@ -242,7 +218,7 @@ Signed-off-by: Shiji Yang } EXPORT_SYMBOL_GPL(rt2800_vco_calibration); -@@ -8650,7 +8587,7 @@ static void rt2800_r_calibration(struct +@@ -8650,7 +8579,7 @@ static void rt2800_r_calibration(struct rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); @@ -251,7 +227,7 @@ Signed-off-by: Shiji Yang rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) -@@ -10688,30 +10625,151 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10688,30 +10617,143 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); } @@ -266,7 +242,7 @@ Signed-off-by: Shiji Yang - rt2800_loft_iq_calibration(rt2x00dev); - rt2800_rxiq_calibration(rt2x00dev); - rt6352_enable_pa_pin(rt2x00dev, 1); -+static void rt6352_init_ext_palna(struct rt2x00_dev *rt2x00dev) ++static void rt2800_init_palna_rt6352(struct rt2x00_dev *rt2x00dev) +{ + u32 reg; + @@ -282,14 +258,14 @@ Signed-off-by: Shiji Yang - if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); + } + + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2x00_has_cap_external_pa(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); + rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); + rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); @@ -308,12 +284,11 @@ Signed-off-by: Shiji Yang + } + + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2x00_has_cap_external_pa(rt2x00dev)) + rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); -+ } + + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_bbp_write(rt2x00dev, 75, 0x68); rt2800_bbp_write(rt2x00dev, 76, 0x4C); rt2800_bbp_write(rt2x00dev, 79, 0x1C); @@ -326,14 +301,14 @@ Signed-off-by: Shiji Yang + } + + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2x00_has_cap_external_pa(rt2x00dev)) { + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636); + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C6B6C); + rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C6B6C); + } +} + -+static void rt6352_restore_rf_bbp(struct rt2x00_dev *rt2x00dev) ++static void rt2800_restore_rf_bbp_rt6352(struct rt2x00_dev *rt2x00dev) +{ + if (rt2x00_has_cap_external_pa(rt2x00dev)) { + rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0); @@ -341,15 +316,14 @@ Signed-off-by: Shiji Yang + } + + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); + rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02); + } + + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) -+ { ++ rt2x00_has_cap_external_pa(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); + rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3); + rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5); @@ -368,7 +342,7 @@ Signed-off-by: Shiji Yang + } + + if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_bbp_write(rt2x00dev, 75, 0x60); + rt2800_bbp_write(rt2x00dev, 76, 0x44); + rt2800_bbp_write(rt2x00dev, 79, 0x1C); @@ -376,29 +350,23 @@ Signed-off-by: Shiji Yang + rt2800_bbp_write(rt2x00dev, 82, 0xB6); + } + -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 -+ && rt2x00_has_cap_external_pa(rt2x00dev)) { ++ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && ++ rt2x00_has_cap_external_pa(rt2x00dev)) { + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363A); + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C); + rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C); + } +} + -+/* MT7620 PA/LNA initialization before switching channels */ -+static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev) ++static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) +{ + if (rt2x00_has_cap_external_pa(rt2x00dev) || -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt6352_enable_pa_pin(rt2x00dev, 0); -+ rt6352_restore_rf_bbp(rt2x00dev); ++ rt2800_restore_rf_bbp_rt6352(rt2x00dev); + } + + rt2800_r_calibration(rt2x00dev); -+} -+ -+/* MT7620 PA/LNA initialization after switching channels */ -+static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev) -+{ + rt2800_rf_self_txdc_cal(rt2x00dev); + rt2800_rxdcoc_calibration(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); @@ -410,13 +378,24 @@ Signed-off-by: Shiji Yang + rt2800_rxdcoc_calibration(rt2x00dev); + rt2800_rxiq_calibration(rt2x00dev); + -+ if(rt2x00_has_cap_external_pa(rt2x00dev) || -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ if (rt2x00_has_cap_external_pa(rt2x00dev) || ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt6352_enable_pa_pin(rt2x00dev, 1); -+ rt6352_init_ext_palna(rt2x00dev); ++ rt2800_init_palna_rt6352(rt2x00dev); } } +@@ -10804,6 +10846,10 @@ int rt2800_enable_radio(struct rt2x00_de + rt2800_init_bbp(rt2x00dev); + rt2800_init_rfcsr(rt2x00dev); + ++ /* Do calibration and init PA/LNA for RT6352 */ ++ if (rt2x00_rt(rt2x00dev, RT6352)) ++ rt2800_calibration_rt6352(rt2x00dev); ++ + if (rt2x00_is_usb(rt2x00dev) && + (rt2x00_rt(rt2x00dev, RT3070) || + rt2x00_rt(rt2x00dev, RT3071) || --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h @@ -1277,6 +1277,12 @@ rt2x00_has_cap_external_lna_bg(struct rt From 0cb2ff5d08702c81f91cfe20dba8f0bdb005cb95 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 2 Sep 2023 00:54:40 +0100 Subject: [PATCH 0424/1171] uboot-mediatek: sync mtk-snand driver with SDK Sync SPI-NAND/ECC controller driver for MT7622, MT7981, MT7986 and MT7988: * Platform data for MT7981 was actually missing and is now added. * Add support for Winbond W25N01KV 1Gbit chip. Signed-off-by: Daniel Golle (cherry picked from commit 9725524235b30b436f6430d70cd809abf1b48a91) --- ...support-for-MediaTek-SPI-NAND-flash-.patch | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch b/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch index 311c051344017d..05138d984e5bbe 100644 --- a/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch +++ b/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch @@ -17,14 +17,14 @@ Signed-off-by: Weijie Gao drivers/mtd/mtk-snand/Kconfig | 21 + drivers/mtd/mtk-snand/Makefile | 11 + drivers/mtd/mtk-snand/mtk-snand-def.h | 271 ++++ - drivers/mtd/mtk-snand/mtk-snand-ecc.c | 395 +++++ - drivers/mtd/mtk-snand/mtk-snand-ids.c | 511 +++++++ + drivers/mtd/mtk-snand/mtk-snand-ecc.c | 411 ++++++ + drivers/mtd/mtk-snand/mtk-snand-ids.c | 515 +++++++ drivers/mtd/mtk-snand/mtk-snand-mtd.c | 535 +++++++ drivers/mtd/mtk-snand/mtk-snand-os.c | 39 + drivers/mtd/mtk-snand/mtk-snand-os.h | 120 ++ drivers/mtd/mtk-snand/mtk-snand.c | 1933 +++++++++++++++++++++++++ drivers/mtd/mtk-snand/mtk-snand.h | 77 + - 12 files changed, 3917 insertions(+) + 12 files changed, 3937 insertions(+) create mode 100644 drivers/mtd/mtk-snand/Kconfig create mode 100644 drivers/mtd/mtk-snand/Makefile create mode 100644 drivers/mtd/mtk-snand/mtk-snand-def.h @@ -369,7 +369,7 @@ Signed-off-by: Weijie Gao +#endif /* _MTK_SNAND_DEF_H_ */ --- /dev/null +++ b/drivers/mtd/mtk-snand/mtk-snand-ecc.c -@@ -0,0 +1,395 @@ +@@ -0,0 +1,411 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Copyright (C) 2020 MediaTek Inc. All Rights Reserved. @@ -418,6 +418,10 @@ Signed-off-by: Weijie Gao + +static const uint8_t mt7622_ecc_caps[] = { 4, 6, 8, 10, 12 }; + ++static const uint8_t mt7981_ecc_caps[] = { ++ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 ++}; ++ +static const uint8_t mt7986_ecc_caps[] = { + 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 +}; @@ -426,6 +430,10 @@ Signed-off-by: Weijie Gao + [ECC_DECDONE] = 0x11c, +}; + ++static const uint32_t mt7981_ecc_regs[] = { ++ [ECC_DECDONE] = 0x124, ++}; ++ +static const uint32_t mt7986_ecc_regs[] = { + [ECC_DECDONE] = 0x124, +}; @@ -447,6 +455,14 @@ Signed-off-by: Weijie Gao + .errnum_bits = 5, + .errnum_shift = 5, + }, ++ [SNAND_SOC_MT7981] = { ++ .ecc_caps = mt7981_ecc_caps, ++ .num_ecc_cap = ARRAY_SIZE(mt7981_ecc_caps), ++ .regs = mt7981_ecc_regs, ++ .mode_shift = 5, ++ .errnum_bits = 5, ++ .errnum_shift = 8, ++ }, + [SNAND_SOC_MT7986] = { + .ecc_caps = mt7986_ecc_caps, + .num_ecc_cap = ARRAY_SIZE(mt7986_ecc_caps), @@ -767,7 +783,7 @@ Signed-off-by: Weijie Gao +} --- /dev/null +++ b/drivers/mtd/mtk-snand/mtk-snand-ids.c -@@ -0,0 +1,511 @@ +@@ -0,0 +1,515 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Copyright (C) 2020 MediaTek Inc. All Rights Reserved. @@ -860,6 +876,10 @@ Signed-off-by: Weijie Gao + &snand_cap_read_from_cache_quad, + &snand_cap_program_load_x4, + mtk_snand_winbond_select_die), ++ SNAND_INFO("W25N01KV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xae, 0x21), ++ SNAND_MEMORG_1G_2K_64, ++ &snand_cap_read_from_cache_quad, ++ &snand_cap_program_load_x4), + SNAND_INFO("W25N02KV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x22), + SNAND_MEMORG_2G_2K_128, + &snand_cap_read_from_cache_quad, @@ -903,7 +923,7 @@ Signed-off-by: Weijie Gao + &snand_cap_program_load_x4), + SNAND_INFO("GD5F2GQ5UExxG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0x52), + SNAND_MEMORG_2G_2K_128, -+ &snand_cap_read_from_cache_quad_q2d, ++ &snand_cap_read_from_cache_quad_a8d, + &snand_cap_program_load_x4), + SNAND_INFO("GD5F4GQ4UCxIG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0xb4), + SNAND_MEMORG_4G_4K_256, From a7449e5e9532d4ba3022ae88a05bfd44021e2543 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 10 Sep 2023 23:39:33 +0100 Subject: [PATCH 0425/1171] arm-trusted-firmware-mediatek: fix hang on reboot on MT7622 With recent updates of TF-A the previously already fixed bug slipped back into the source tree. Again, reorder bl2 init for MT7622 and initialize WDT only after DRAM init has completed to avoid the notorious hang. Signed-off-by: Daniel Golle (cherry picked from commit 948ad2ec7a21645bac4d523c8f31d1cc3e2eac71) --- .../arm-trusted-firmware-mediatek/Makefile | 2 +- ...mt7622-move-wdt-init-after-dram-init.patch | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 853049cfb0e1ee..718ebf99e09498 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=arm-trusted-firmware-mediatek -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git diff --git a/package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch b/package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch new file mode 100644 index 00000000000000..4a4d252bebecb4 --- /dev/null +++ b/package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch @@ -0,0 +1,28 @@ +From 9e8cb08bc64530e7511b86a131cfad1ae0199586 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 10 Sep 2023 23:35:47 +0100 +Subject: [PATCH] mt7622: move wdt init after dram init + +resolves hang on reboot +--- + plat/mediatek/mt7622/bl2/bl2_plat_init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/plat/mediatek/mt7622/bl2/bl2_plat_init.c ++++ b/plat/mediatek/mt7622/bl2/bl2_plat_init.c +@@ -40,7 +40,6 @@ bool plat_is_my_cpu_primary(void) + const struct initcall bl2_initcalls[] = { + INITCALL(plat_mt_cpuxgpt_init), + INITCALL(generic_delay_timer_init), +- INITCALL(mtk_wdt_init), + INITCALL(mtk_print_cpu), + INITCALL(mtk_pin_init), + #ifndef IMAGE_BL2PL +@@ -49,6 +48,7 @@ const struct initcall bl2_initcalls[] = + INITCALL(mtk_pwrap_init), + INITCALL(mtk_pmic_init), + INITCALL(mtk_mem_init), ++ INITCALL(mtk_wdt_init), + + INITCALL(NULL) + }; From 3cc223243b848b87a4c82b219f24cdb17ee9a771 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 28 Jul 2023 11:41:14 +0200 Subject: [PATCH 0426/1171] ramips: add support for ALFA Network AX1800RM ALFA Network AX1800RM (FCC ID: 2AB877621) is a dual-band Wi-Fi 6 (AX1800) router, based on MediaTek MT7621A + MT79x5D platform. Specifications: - SOC: MT7621A (880 MHz) - DRAM: DDR3 256 MiB (Nanya NT5CC128M16JR-EK) - Flash: 16 MiB SPI NOR (EN25QH128A-104HIP) - Ethernet: 4x 10/100/1000 Mbps (SOC's built-in switch) - Wi-Fi: 2x2:2 2.4/5 GHz (MT7905DAN + MT7975DN) (MT7905DAN doesn't support background DFS scan/BT) - LED: 6x green, 1x green/red - Buttons: 2x (reset, WPS) - Antenna: 4x external, non-detachable omnidirectional - UART: 1x 4-pin (2.54 mm pitch, J4, not populated) - Power: 12 V DC/1 A (DC jack) MAC addresses: LAN: 00:c0:ca:xx:xx:4e (factory 0x4, +2) WAN: 00:c0:ca:xx:xx:4f (factory 0x4, +3) 2.4 GHz: 00:c0:ca:xx:xx:4c (factory 0x4, device's label) 5 GHz: 00:c0:ca:xx:xx:4c (factory 0xa) Flash instructions for web-based U-Boot recovery: 1. Power the device with WPS button pressed and wait around 10 seconds. 2. Setup static IP 192.168.1.2/24 on your PC. 3. Go to 192.168.1.1 in browser and upload 'recovery' image. The device runs LEDE 17.01 (kernel 4.4.x) based firmware with 'failsafe' mode available which allows alternative upgrade method: 1. Run device in 'failsafe' mode and change password for default user. 2. SSH to the device, transfer 'sysupgrade' image and perform upgrade in forced mode, without preserving settings: 'sysupgrade -n -F ...'. Other notes: If you own early version of this device, the vendor firmware might refuse OpenWrt image because of missing custom header. In that case, ask vendor's customer support for stock firmware without custom header support/requirement. Signed-off-by: Piotr Dymacz (backported from commit f1aaa267f0ea18ffe5840f3ce46a48be123d2f62) --- .../dts/mt7621_alfa-network_ax1800rm.dts | 208 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 12 + .../mt7621/base-files/etc/board.d/01_leds | 6 + .../mt7621/base-files/etc/board.d/02_network | 58 ++--- 4 files changed, 256 insertions(+), 28 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts diff --git a/target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts b/target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts new file mode 100644 index 00000000000000..ecf8fe34ef8d6a --- /dev/null +++ b/target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "alfa-network,ax1800rm", "mediatek,mt7621-soc"; + model = "ALFA Network AX1800RM"; + + aliases { + label-mac-device = &wifi0; + led-boot = &led_power; + led-failsafe = &led_wan_red; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + lan1 { + label = "green:lan1"; + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + lan2 { + label = "green:lan2"; + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + lan3 { + label = "green:lan3"; + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_power: power { + label = "green:power"; + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + wan_green { + label = "green:wan"; + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_wan_red: wan_red { + label = "red:wan"; + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + 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>; + }; + + partition@40000 { + label = "boot-config"; + reg = <0x40000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + + partition@60000 { + label = "permanent_config"; + reg = <0x60000 0x80000>; + read-only; + }; + + partition@e0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0xe0000 0xf20000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi0: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + + mediatek,mtd-eeprom = <&factory 0x0>; + mediatek,disable-radar-background; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <2>; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <3>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "uart3", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index fa4c83dbe18db3..2675c7d08ba806 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -178,6 +178,18 @@ define Device/afoundry_ew1200 endef TARGET_DEVICES += afoundry_ew1200 +define Device/alfa-network_ax1800rm + $(Device/dsa-migration) + IMAGE_SIZE := 15488k + DEVICE_VENDOR := ALFA Network + DEVICE_MODEL := AX1800RM + DEVICE_PACKAGES := kmod-mt7915-firmware + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGES += recovery.bin + IMAGE/recovery.bin := append-kernel | append-rootfs | pad-rootfs | check-size +endef +TARGET_DEVICES += alfa-network_ax1800rm + define Device/alfa-network_quad-e4g $(Device/dsa-migration) IMAGE_SIZE := 16064k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 1f91905bd84ee0..3ceac604342cc2 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -7,6 +7,12 @@ board=$(board_name) board_config_update case $board in +alfa-network,ax1800rm) + ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" + ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" + ucidef_set_led_netdev "lan3" "lan3" "green:lan3" "lan3" + ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" + ;; asus,rp-ac87) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_rssimon "wlan1" "200000" "1" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 6057c171922e98..11a7c9465a333e 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -8,6 +8,26 @@ ramips_setup_interfaces() local board="$1" case $board in + alfa-network,ax1800rm|\ + ampedwireless,ally-r1900k|\ + asus,rt-ax53u|\ + gehua,ghl-r-001|\ + h3c,tx1800-plus|\ + h3c,tx1801-plus|\ + h3c,tx1806|\ + haier,har-20s2u1|\ + hiwifi,hc5962|\ + netgear,wax202|\ + sim,simax1800t|\ + xiaomi,mi-router-3-pro|\ + xiaomi,mi-router-ac2100|\ + xiaomi,mi-router-cr6606|\ + xiaomi,mi-router-cr6608|\ + xiaomi,mi-router-cr6609|\ + xiaomi,redmi-router-ac2100|\ + zyxel,wsm20) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ;; arcadyan,we420223-99) ucidef_set_interface_lan "swp0 swp1" ;; @@ -37,25 +57,6 @@ ramips_setup_interfaces() zyxel,nwa55axe) ucidef_set_interface_lan "lan" ;; - ampedwireless,ally-r1900k|\ - asus,rt-ax53u|\ - gehua,ghl-r-001|\ - h3c,tx1800-plus|\ - h3c,tx1801-plus|\ - h3c,tx1806|\ - haier,har-20s2u1|\ - hiwifi,hc5962|\ - netgear,wax202|\ - sim,simax1800t|\ - xiaomi,mi-router-3-pro|\ - xiaomi,mi-router-ac2100|\ - xiaomi,mi-router-cr6606|\ - xiaomi,mi-router-cr6608|\ - xiaomi,mi-router-cr6609|\ - xiaomi,redmi-router-ac2100|\ - zyxel,wsm20) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" - ;; asiarf,ap7621-001|\ humax,e10|\ wavlink,ws-wn572hp3-4g|\ @@ -157,6 +158,16 @@ ramips_setup_macs() local label_mac="" case $board in + alfa-network,ax1800rm|\ + jcg,y2|\ + wavlink,wl-wn531a6|\ + wavlink,wl-wn533a8|\ + winstars,ws-wn583a6|\ + zbtlink,zbt-we1326|\ + zbtlink,zbt-wg3526-16m|\ + zbtlink,zbt-wg3526-32m) + label_mac=$(mtd_get_mac_binary factory 0x4) + ;; ampedwireless,ally-00x19k) lan_mac=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address) label_mac=$lan_mac @@ -222,15 +233,6 @@ ramips_setup_macs() lan_mac=$(mtd_get_mac_ascii config ethaddr) wan_mac=$(macaddr_add "$lan_mac" 1) ;; - jcg,y2|\ - wavlink,wl-wn531a6|\ - wavlink,wl-wn533a8|\ - winstars,ws-wn583a6|\ - zbtlink,zbt-we1326|\ - zbtlink,zbt-wg3526-16m|\ - zbtlink,zbt-wg3526-32m) - label_mac=$(mtd_get_mac_binary factory 0x4) - ;; linksys,e5600|\ linksys,ea6350-v4|\ linksys,ea7300-v1|\ From 0165daf569f166501b53e0b34ca64d1ad817252a Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 28 Jul 2023 12:21:49 +0200 Subject: [PATCH 0427/1171] uboot-envtools: ramips: add support for ALFA Network AX1800RM Signed-off-by: Piotr Dymacz (backported from commit 69f12c2f23c6d32a5fdda2385b4156c9b8bfae22) --- package/boot/uboot-envtools/files/ramips | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 0abb5f6549504b..8c7ce71c49f5dd 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,15 +24,16 @@ sitecom,wlr-4100-v1-002|\ zyxel,keenetic-lite-iii-a) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" ;; -arcadyan,we420223-99) - ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x1000" "0x1000" - ;; +alfa-network,ax1800rm|\ allnet,all0256n-4m|\ allnet,all0256n-8m|\ allnet,all5002|\ yuncore,ax820) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; +arcadyan,we420223-99) + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x1000" "0x1000" + ;; ampedwireless,ally-00x19k|\ ampedwireless,ally-r1900k) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" "4" From 6577b550df89766d10375aacc87c56a4658c3776 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Fri, 8 Sep 2023 19:47:01 +0300 Subject: [PATCH 0428/1171] base-files: sysupgrade: Add 2 sec sleep into process KILL loop Add 2 seconds sleep after each forcibly killed/tried-to-kill process in the final process termination loop in sysupgrade stage2. This is needed especially for qualcommax/ipq807x, where ath11k wireless driver may have a long 10-20 seconds delay after termination before actually getting killed. This often breaks sysupgrade. The current KILL loop in kill_remaining does all 10 kill attempts consecutively without any delay, as evidenced here in a failing sysupgrade. It does not allow any time for the process to finalize its internal termination. Sat Sep 2 19:05:56 EEST 2023 upgrade: Sending TERM to remaining processes ... Sat Sep 2 19:05:56 EEST 2023 upgrade: Sending signal TERM to hostapd (2122) Sat Sep 2 19:05:56 EEST 2023 upgrade: Sending signal TERM to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending KILL to remaining processes ... Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2122) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Failed to kill all processes. sysupgrade aborted with return code: 256 The change in this commit adds a 2 seconds delay after each kill attempt in order to allow some processes to more gracefully handle their internal termination. The result is like this: Sun Sep 3 11:15:10 EEST 2023 upgrade: Sending TERM to remaining processes ... Sun Sep 3 11:15:10 EEST 2023 upgrade: Sending signal TERM to hostapd (2309) Sun Sep 3 11:15:10 EEST 2023 upgrade: Sending signal TERM to hostapd (2324) Sun Sep 3 11:15:14 EEST 2023 upgrade: Sending KILL to remaining processes ... Sun Sep 3 11:15:14 EEST 2023 upgrade: Sending signal KILL to hostapd (2309) [ 699.827521] br-lan: port 7(hn5wpa2r) entered disabled state [ 699.908673] device hn5wpa2r left promiscuous mode [ 699.908721] br-lan: port 7(hn5wpa2r) entered disabled state [ 701.038029] br-lan: port 6(hn5wpa3) entered disabled state Sun Sep 3 11:15:16 EEST 2023 upgrade: Sending signal KILL to hostapd (2324) [ 702.058256] br-lan: port 5(hn2wlan) entered disabled state [ 709.250063] stage2 (8237): drop_caches: 3 Sun Sep 3 11:15:25 EEST 2023 upgrade: Switching to ramdisk... The delay introduced here only kicks in if there is some process that does not get terminated by the first TERM call. Then there is at least one 2 sec wait after the first KILL loop round. This commit is related to discussion in PRs #12235 and #12632 Signed-off-by: Hannu Nyman Reviewed-by: Robert Marko (cherry picked from commit 47d56ae5463f1965750d3f75390c96d69f969145) --- package/base-files/files/lib/upgrade/stage2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index f4db88d31ea18f..5ce0b3549cf68d 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -121,7 +121,7 @@ kill_remaining() { # [ [ ] ] v "Sending signal $sig to $name ($pid)" kill -$sig $pid 2>/dev/null - [ $loop -eq 1 ] && run=true + [ $loop -eq 1 ] && sleep 2 && run=true done let loop_limit-- From 6c60bbbc94b8f086fcb831214fa319ac8117767d Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Sat, 9 Sep 2023 12:44:42 +0200 Subject: [PATCH 0429/1171] x86: geode: fix hwrng register accesses When the membase and pci_dev pointer were moved to a new struct in priv, the actual membase users were left untouched, and they started reading out arbitrary memory behind the struct instead of registers. This unfortunately turned the RNG into a constant number generator, depending on the content of what was at that offset. To fix this, update geode_rng_data_{read,present}() to also get the membase via amd_geode_priv, and properly read from the right addresses again. Closes #13417. Reported-by: Timur I. Davletshin Tested-by: Timur I. Davletshin Suggested-by: Jo-Philipp Wich Signed-off-by: Jonas Gorski (cherry picked from commit 09d13cd8d87cc50fde67bbe81c6cca4b799b2724) --- ...-hwrng-geode-fix-accessing-registers.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch diff --git a/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch b/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch new file mode 100644 index 00000000000000..4c8015013bc8a5 --- /dev/null +++ b/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch @@ -0,0 +1,47 @@ +From 859bd2e0c0052967536f3f902716f204d5a978b1 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Fri, 8 Sep 2023 22:48:33 +0200 +Subject: [PATCH] hwrng: geode: fix accessing registers + +When the membase and pci_dev pointer were moved to a new struct in priv, +the actual membase users were left untouched, and they started reading +out arbitrary memory behind the struct instead of registers. This +unfortunately turned the RNG into a constant number generator, depending +on the content of what was at that offset. + +To fix this, update geode_rng_data_{read,present}() to also get the +membase via amd_geode_priv, and properly read from the right addresses +again. + +Fixes: 9f6ec8dc574e ("hwrng: geode - Fix PCI device refcount leak") +Reported-by: Timur I. Davletshin +Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217882 +Tested-by: Timur I. Davletshin +Suggested-by: Jo-Philipp Wich +Signed-off-by: Jonas Gorski +--- + drivers/char/hw_random/geode-rng.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/char/hw_random/geode-rng.c ++++ b/drivers/char/hw_random/geode-rng.c +@@ -58,7 +58,8 @@ struct amd_geode_priv { + + static int geode_rng_data_read(struct hwrng *rng, u32 *data) + { +- void __iomem *mem = (void __iomem *)rng->priv; ++ struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; ++ void __iomem *mem = priv->membase; + + *data = readl(mem + GEODE_RNG_DATA_REG); + +@@ -67,7 +68,8 @@ static int geode_rng_data_read(struct hw + + static int geode_rng_data_present(struct hwrng *rng, int wait) + { +- void __iomem *mem = (void __iomem *)rng->priv; ++ struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; ++ void __iomem *mem = priv->membase; + int data, i; + + for (i = 0; i < 20; i++) { From 10aee60361ce6bd547f7c2f0d1aaea76ae1cc9dc Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Sun, 10 Sep 2023 14:10:50 -0700 Subject: [PATCH 0430/1171] ipq806x: Correct OnHub sysupgrade config logic There's a typo in here: board_name is a function, not a variable. This issue was pointed out on the OpenWrt forum. Closes: #13409 Reviewed-by: Robert Marko Signed-off-by: Brian Norris (cherry picked from commit 7b78a19e6a16f5c05bfc6d7925b9981048c508d7) --- target/linux/ipq806x/base-files/lib/upgrade/platform.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index 5ec4f513bd33db..e292e231c89280 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -81,7 +81,7 @@ platform_do_upgrade() { } platform_copy_config() { - case "${board_name}" in + case "$(board_name)" in asus,onhub |\ tplink,onhub) emmc_copy_config From 68972704914915c47e9032588322322c6cc3e0aa Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 2 Sep 2023 23:06:20 +0900 Subject: [PATCH 0431/1171] mvebu: add reset delays of PHYs for Fortinet FortiGate 50E Add reset-(de)assert-us to ethernet PHYs on Fortinet FortiGate 50E to solve instability after HW resetting of PHYs. (ex.: restarting "network" service, etc...) Fixes: #13391 Fixes: 102dc5a62506 ("mvebu: add support for Fortinet FortiGate 50E") Signed-off-by: INAGAKI Hiroshi (cherry picked from commit 5c65224d8f5787f6bdfaec9547637f1f2f46354f) --- .../files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts index 61d2da1755ceef..dba215de3efabd 100644 --- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts @@ -297,6 +297,8 @@ interrupt-parent = <&gpio0>; interrupts = <20 IRQ_TYPE_LEVEL_LOW>; reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; /* * LINK/ACT (Green): LED[0], Active Low * SPEED 100M (Amber): LED[1], Active High @@ -313,6 +315,8 @@ interrupt-parent = <&gpio1>; interrupts = <9 IRQ_TYPE_LEVEL_LOW>; reset-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; /* * LINK/ACT (Green): LED[0], Active Low * SPEED 100M (Amber): LED[1], Active High From 5edeb1ee0c9484da0a0c07080f4bda4c33ab72bf Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Mon, 21 Aug 2023 06:10:35 +0000 Subject: [PATCH 0432/1171] kernel: add vhost-net module vhost-net is used to accelerate traffic to virtualisation guests that use the virtio-net network card in QEMU. Generally it is invoked by specifying "vhost=on" to a QEMU -netdev device: qemu-system-aarch64 -nographic -M virt -cpu host \ --enable-kvm -bios u-boot.bin -smp 1 -m 2048 \ -drive file=openwrt-armsr-armv8.img,format=raw,index=0,media=disk \ -device "virtio-net,netdev=landev,disable-legacy=off,disable-modern=off" \ -netdev "tap,id=landev,helper=/usr/lib/qemu-bridge-helper --br=br-lan,vhost=on" Signed-off-by: Mathew McBride (cherry picked from commit d188db8aed74547f98b905254d4f57baf225f1d6) --- package/kernel/linux/modules/virt.mk | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/package/kernel/linux/modules/virt.mk b/package/kernel/linux/modules/virt.mk index 90226b480638c2..1d9caa9bc8f4d6 100644 --- a/package/kernel/linux/modules/virt.mk +++ b/package/kernel/linux/modules/virt.mk @@ -117,3 +117,27 @@ define KernelPackage/vfio-pci/description endef $(eval $(call KernelPackage,vfio-pci)) + + +define KernelPackage/vhost + SUBMENU:=Virtualization + TITLE:=Host kernel accelerator for virtio (base) + KCONFIG:=CONFIG_VHOST + FILES:=$(LINUX_DIR)/drivers/vhost/vhost.ko \ + $(LINUX_DIR)/drivers/vhost/vhost_iotlb.ko + AUTOLOAD:=$(call AutoProbe,vhost vhost_iotlb) +endef + +$(eval $(call KernelPackage,vhost)) + + +define KernelPackage/vhost-net + SUBMENU:=Virtualization + TITLE:=Host kernel accelerator for virtio-net + DEPENDS:=+kmod-tun +kmod-vhost + KCONFIG:=CONFIG_VHOST_NET + FILES:=$(LINUX_DIR)/drivers/vhost/vhost_net.ko + AUTOLOAD:=$(call AutoProbe,vhost_net) +endef + +$(eval $(call KernelPackage,vhost-net)) From c90005c58a90337454a4a1796f5f1d7065c45a7b Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 22 Aug 2023 04:49:32 +0000 Subject: [PATCH 0433/1171] x86: remove built-in vhost-net driver This is now available as a kmod package (kmod-vhost-net). Signed-off-by: Mathew McBride (cherry picked from commit 8b1cc1582ad9c9b12d52870e0c7f9cb828aa0fbf) --- target/linux/x86/generic/config-5.15 | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/linux/x86/generic/config-5.15 b/target/linux/x86/generic/config-5.15 index 4312c527c8bd1e..4b513f64ad68bd 100644 --- a/target/linux/x86/generic/config-5.15 +++ b/target/linux/x86/generic/config-5.15 @@ -400,9 +400,6 @@ CONFIG_TREE_SRCU=y CONFIG_UCS2_STRING=y CONFIG_USB_STORAGE=y CONFIG_USER_RETURN_NOTIFIER=y -CONFIG_VHOST=y -CONFIG_VHOST_IOTLB=y -CONFIG_VHOST_NET=y CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y From c79854e9fc8bb3e20c0f22116bbe76ff353a9322 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 25 Aug 2023 06:00:40 +0000 Subject: [PATCH 0434/1171] kernel: vfio: remove unneeded enable_unsafe_noiommu_mode parameter The vfio module only exposes the enable_unsafe_noiommu_mode parameter if CONFIG_VFIO_NOIOMMU is enabled. When it isn't, the module will complain about an unknown parameter: vfio: unknown parameter 'enable_unsafe_noiommu_mode' ignored As CONFIG_VFIO_NOIOMMU is disabled by the module package, we can remove the module loading parameter. Signed-off-by: Mathew McBride (cherry picked from commit 7ad8612a23add071608815e3c78a477c4fbad0d3) --- package/kernel/linux/modules/virt.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/kernel/linux/modules/virt.mk b/package/kernel/linux/modules/virt.mk index 1d9caa9bc8f4d6..6d255cb1766346 100644 --- a/package/kernel/linux/modules/virt.mk +++ b/package/kernel/linux/modules/virt.mk @@ -82,8 +82,6 @@ define KernelPackage/vfio CONFIG_VFIO \ CONFIG_VFIO_NOIOMMU=n \ CONFIG_VFIO_MDEV=n - MODPARAMS.vfio:=\ - enable_unsafe_noiommu_mode=n FILES:= \ $(LINUX_DIR)/drivers/vfio/vfio.ko \ $(LINUX_DIR)/drivers/vfio/vfio_virqfd.ko \ From 3c8825e5f8ec46368f36f6c92506860a7bb9bc6b Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Sun, 6 Aug 2023 21:19:44 +0000 Subject: [PATCH 0435/1171] kernel: enable vfio and vfio-pci for armsr-armv8 Arm platforms with the right hardware blocks (such as GICv3.0+ interrupt controller and SMMU/IOMMU) are able to use vfio-pci to pass through PCI devices to a VM. Signed-off-by: Mathew McBride (cherry picked from commit 9ac01aac0a820f2c48b2ab26628a8c90fb005f20) --- package/kernel/linux/modules/virt.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/virt.mk b/package/kernel/linux/modules/virt.mk index 6d255cb1766346..f45cb176147fc8 100644 --- a/package/kernel/linux/modules/virt.mk +++ b/package/kernel/linux/modules/virt.mk @@ -77,7 +77,7 @@ $(eval $(call KernelPackage,kvm-amd)) define KernelPackage/vfio SUBMENU:=Virtualization TITLE:=VFIO Non-Privileged userspace driver framework - DEPENDS:=@TARGET_x86_64 + DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 KCONFIG:= \ CONFIG_VFIO \ CONFIG_VFIO_NOIOMMU=n \ @@ -99,7 +99,7 @@ $(eval $(call KernelPackage,vfio)) define KernelPackage/vfio-pci SUBMENU:=Virtualization TITLE:=Generic VFIO support for any PCI device - DEPENDS:=@TARGET_x86_64 @PCI_SUPPORT +kmod-vfio +kmod-irqbypass + DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 @PCI_SUPPORT +kmod-vfio +kmod-irqbypass KCONFIG:= \ CONFIG_VFIO_PCI \ CONFIG_VFIO_PCI_IGD=n From d536f398eb2c1409005bbfa6a74d92ca145eb0b3 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Fri, 15 Sep 2023 23:21:36 +0000 Subject: [PATCH 0436/1171] kernel: ensure VFIO related suboptions are disabled These suboptions (PLATFORM, FSL_MC and MLX5_VFIO_PCI) may be prompted for when VFIO is enabled, regardless of architecture. These are not related to the main vfio use case (passthrough of PCIe devices) Signed-off-by: Mathew McBride (5.15 version of abc536f54797386156383da7269ee0d4ccc84073) --- target/linux/generic/config-5.15 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 6f28147ee3a0af..214a1e6ecd83c0 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -3599,6 +3599,7 @@ CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY=y # CONFIG_MLX4_EN is not set # CONFIG_MLX5_CORE is not set # CONFIG_MLX5_SF is not set +# CONFIG_MLX5_VFIO_PCI is not set # CONFIG_MLX90614 is not set # CONFIG_MLX90632 is not set # CONFIG_MLXFW is not set @@ -7204,6 +7205,8 @@ CONFIG_VDSO=y # CONFIG_VF610_DAC is not set # CONFIG_VFAT_FS is not set # CONFIG_VFIO is not set +# CONFIG_VFIO_FSL_MC is not set +# CONFIG_VFIO_PLATFORM is not set # CONFIG_VGASTATE is not set # CONFIG_VGA_ARB is not set # CONFIG_VGA_CONSOLE is not set From c3be8324273dbd3f034fb3fe5b9d5ad7081b2d1f Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 31 Aug 2023 21:10:23 +0200 Subject: [PATCH 0437/1171] ath79: fix packetloss on some WLR-7100 On some WLR-7100 routers, significant packet loss was observed. This is fixed by configuring a delay on the GMAC0 RXD and RXDV lines. The values used in this commit are copied from the values used by the stock firmare (based on register dumping). Out of four test routers, the problem was consistently observed on two. It is unclear what the relevant difference is exactly (the two working routers were v1 001 with AR1022 and v1 002 with AR9342, the two broken routers were both v1 002 with AR1022). All PCB routing also seems identical, so maybe there is some stray capacitance on some of these that adds just enough delay or so... With this change, the packet loss disappears on the broken routers, without introducing new packet loss on the previously working routers. Note that the PHY *also* has delays enabled (through `qca,ar8327-initvals`) on both RX and TX lines, but apparently that is not enough, or it is not effective (registers have been verified to be written). For detailed discussion of this issue and debug history, see https://forum.openwrt.org/t/sitecom-wlr-7100-development-progress/79641 Signed-off-by: Matthijs Kooijman (cherry picked from commit d2ce3a61aa1cbc53988eb640cbab48e20fbfb1aa) --- target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts index d008dd5ec86e08..e2ccef105d6fb6 100644 --- a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts +++ b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts @@ -65,6 +65,8 @@ gmac-config { device = <&gmac>; rgmii-gmac0 = <1>; + rxdv-delay = <3>; + rxd-delay = <3>; }; }; From 2dc284a79a0dd5f8a8e4d9422dd12319320ad6db Mon Sep 17 00:00:00 2001 From: Max Qian Date: Thu, 14 Sep 2023 21:54:30 -0700 Subject: [PATCH 0438/1171] ramips: RT1800: fix invalid octal number error This commit removes the padded zeros in the date formatting. The padded zeros from the date command causes the numbers to be interpreted as an octal number by printf. Months, days, and years with the number 08 or 09 raise an error in printf as an "invalid octal number" and get interpreted as a zero. Signed-off-by: Max Qian (cherry picked from commit 794349a28a7b9036b54e13487a96120609db924e) --- target/linux/ramips/image/mt7621.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2675c7d08ba806..962d7ef44017d1 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -88,7 +88,7 @@ define Build/belkin-header ( \ type_fw_date=$$(printf "01%02x%02x%02x" \ - $$(date -d "@$(SOURCE_DATE_EPOCH)" "+%y %m %d")); \ + $$(date -d "@$(SOURCE_DATE_EPOCH)" "+%-y %-m %-d")); \ hw_fw_ver=$$(printf "%02x%02x%02x%02x" \ $(hw_ver) $$(echo $(fw_ver) | cut -d. -f-3 | tr . ' ')); \ fw_len_crc=$$(gzip -c $@ | tail -c 8 | od -An -tx8 | tr -d ' \n'); \ From 385a50f02df4068118e94a742ab7b24c4b8f882b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Tue, 12 Sep 2023 19:57:55 +0200 Subject: [PATCH 0439/1171] ipq40xx: fix image building for ZTE MF287 series MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the ZTE MF287 series, a special recovery image is built. The Makefile worked fine on snapshot, but created corrupt images on the 23.05 images. By using the appropriate variable, this should be fixed. Signed-off-by: Andreas Böhler (cherry picked from commit a9cc3708e0c3c4869711a9ba4b9c1437ed250721) --- target/linux/ipq40xx/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 7f4806b63d5040..08cbd63b3c88d7 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1172,7 +1172,7 @@ define Device/zte_mf287_common # exploit for the web interface IMAGES += factory.bin recovery.bin IMAGE/factory.bin := append-ubi - IMAGE/recovery.bin := append-squashfs4-fakeroot | sysupgrade-tar kernel=$$$$(BIN_DIR)/openwrt-$$(BOARD)$$(if $$(SUBTARGET),-$$(SUBTARGET))-$$(DEVICE_NAME)-initramfs-zImage.itb rootfs=$$$$@ | append-metadata + IMAGE/recovery.bin := append-squashfs4-fakeroot | sysupgrade-tar kernel=$$$$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) rootfs=$$$$@ | append-metadata endef define Device/zte_mf287plus From 7e55f20c1f31f78ed22719b129743bbc243a3feb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 4 Sep 2023 15:28:59 +0200 Subject: [PATCH 0440/1171] kernel: backport support for renaming netdevs while up Will be used in upcoming hostapd changes Signed-off-by: Felix Fietkau (cherry picked from commit 77c45ddd86b0dff7765e30f7846cbdef34fa93ce) --- ...ive-renaming-when-an-interface-is-up.patch | 136 ++++++++++++++++++ .../721-net-add-packet-mangeling.patch | 14 +- ...T-skip-GRO-for-foreign-MAC-addresses.patch | 12 +- ...ional-threading-for-backlog-processi.patch | 20 +-- 4 files changed, 159 insertions(+), 23 deletions(-) create mode 100644 target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch diff --git a/target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch b/target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch new file mode 100644 index 00000000000000..bd58db2e7787e1 --- /dev/null +++ b/target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch @@ -0,0 +1,136 @@ +From: Andy Ren +Date: Mon, 7 Nov 2022 09:42:42 -0800 +Subject: [PATCH] net/core: Allow live renaming when an interface is up + +Allow a network interface to be renamed when the interface +is up. + +As described in the netconsole documentation [1], when netconsole is +used as a built-in, it will bring up the specified interface as soon as +possible. As a result, user space will not be able to rename the +interface since the kernel disallows renaming of interfaces that are +administratively up unless the 'IFF_LIVE_RENAME_OK' private flag was set +by the kernel. + +The original solution [2] to this problem was to add a new parameter to +the netconsole configuration parameters that allows renaming of +the interface used by netconsole while it is administratively up. +However, during the discussion that followed, it became apparent that we +have no reason to keep the current restriction and instead we should +allow user space to rename interfaces regardless of their administrative +state: + +1. The restriction was put in place over 20 years ago when renaming was +only possible via IOCTL and before rtnetlink started notifying user +space about such changes like it does today. + +2. The 'IFF_LIVE_RENAME_OK' flag was added over 3 years ago in version +5.2 and no regressions were reported. + +3. In-kernel listeners to 'NETDEV_CHANGENAME' do not seem to care about +the administrative state of interface. + +Therefore, allow user space to rename running interfaces by removing the +restriction and the associated 'IFF_LIVE_RENAME_OK' flag. Help in +possible triage by emitting a message to the kernel log that an +interface was renamed while UP. + +[1] https://www.kernel.org/doc/Documentation/networking/netconsole.rst +[2] https://lore.kernel.org/netdev/20221102002420.2613004-1-andy.ren@getcruise.com/ + +Signed-off-by: Andy Ren +Reviewed-by: Ido Schimmel +Reviewed-by: David Ahern +Signed-off-by: David S. Miller +--- + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1642,7 +1642,6 @@ struct net_device_ops { + * @IFF_FAILOVER: device is a failover master device + * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device + * @IFF_L3MDEV_RX_HANDLER: only invoke the rx handler of L3 master device +- * @IFF_LIVE_RENAME_OK: rename is allowed while device is up and running + * @IFF_TX_SKB_NO_LINEAR: device/driver is capable of xmitting frames with + * skb_headlen(skb) == 0 (data starts from frag0) + */ +@@ -1677,7 +1676,7 @@ enum netdev_priv_flags { + IFF_FAILOVER = 1<<27, + IFF_FAILOVER_SLAVE = 1<<28, + IFF_L3MDEV_RX_HANDLER = 1<<29, +- IFF_LIVE_RENAME_OK = 1<<30, ++ /* was IFF_LIVE_RENAME_OK */ + IFF_TX_SKB_NO_LINEAR = BIT_ULL(31), + }; + +@@ -1711,7 +1710,6 @@ enum netdev_priv_flags { + #define IFF_FAILOVER IFF_FAILOVER + #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE + #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER +-#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK + #define IFF_TX_SKB_NO_LINEAR IFF_TX_SKB_NO_LINEAR + + /* Specifies the type of the struct net_device::ml_priv pointer */ +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -1222,22 +1222,6 @@ int dev_change_name(struct net_device *d + + net = dev_net(dev); + +- /* Some auto-enslaved devices e.g. failover slaves are +- * special, as userspace might rename the device after +- * the interface had been brought up and running since +- * the point kernel initiated auto-enslavement. Allow +- * live name change even when these slave devices are +- * up and running. +- * +- * Typically, users of these auto-enslaving devices +- * don't actually care about slave name change, as +- * they are supposed to operate on master interface +- * directly. +- */ +- if (dev->flags & IFF_UP && +- likely(!(dev->priv_flags & IFF_LIVE_RENAME_OK))) +- return -EBUSY; +- + down_write(&devnet_rename_sem); + + if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { +@@ -1254,7 +1238,8 @@ int dev_change_name(struct net_device *d + } + + if (oldname[0] && !strchr(oldname, '%')) +- netdev_info(dev, "renamed from %s\n", oldname); ++ netdev_info(dev, "renamed from %s%s\n", oldname, ++ dev->flags & IFF_UP ? " (while UP)" : ""); + + old_assign_type = dev->name_assign_type; + dev->name_assign_type = NET_NAME_RENAMED; +--- a/net/core/failover.c ++++ b/net/core/failover.c +@@ -80,14 +80,14 @@ static int failover_slave_register(struc + goto err_upper_link; + } + +- slave_dev->priv_flags |= (IFF_FAILOVER_SLAVE | IFF_LIVE_RENAME_OK); ++ slave_dev->priv_flags |= IFF_FAILOVER_SLAVE; + + if (fops && fops->slave_register && + !fops->slave_register(slave_dev, failover_dev)) + return NOTIFY_OK; + + netdev_upper_dev_unlink(slave_dev, failover_dev); +- slave_dev->priv_flags &= ~(IFF_FAILOVER_SLAVE | IFF_LIVE_RENAME_OK); ++ slave_dev->priv_flags &= ~IFF_FAILOVER_SLAVE; + err_upper_link: + netdev_rx_handler_unregister(slave_dev); + done: +@@ -121,7 +121,7 @@ int failover_slave_unregister(struct net + + netdev_rx_handler_unregister(slave_dev); + netdev_upper_dev_unlink(slave_dev, failover_dev); +- slave_dev->priv_flags &= ~(IFF_FAILOVER_SLAVE | IFF_LIVE_RENAME_OK); ++ slave_dev->priv_flags &= ~IFF_FAILOVER_SLAVE; + + if (fops && fops->slave_unregister && + !fops->slave_unregister(slave_dev, failover_dev)) diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index 69771cef398d90..fcaed01cad194d 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -1682,6 +1682,10 @@ enum netdev_priv_flags { +@@ -1681,6 +1681,10 @@ enum netdev_priv_flags { IFF_TX_SKB_NO_LINEAR = BIT_ULL(31), }; @@ -30,15 +30,15 @@ Signed-off-by: Felix Fietkau #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN #define IFF_EBRIDGE IFF_EBRIDGE #define IFF_BONDING IFF_BONDING -@@ -1714,6 +1718,7 @@ enum netdev_priv_flags { +@@ -1712,6 +1716,7 @@ enum netdev_priv_flags { + #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER - #define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK #define IFF_TX_SKB_NO_LINEAR IFF_TX_SKB_NO_LINEAR +#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN /* Specifies the type of the struct net_device::ml_priv pointer */ enum netdev_ml_priv_type { -@@ -2014,6 +2019,7 @@ struct net_device { +@@ -2012,6 +2017,7 @@ struct net_device { /* Read-mostly cache-line for fast-path access */ unsigned int flags; unsigned int priv_flags; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau const struct net_device_ops *netdev_ops; int ifindex; unsigned short gflags; -@@ -2074,6 +2080,11 @@ struct net_device { +@@ -2072,6 +2078,11 @@ struct net_device { const struct tlsdev_ops *tlsdev_ops; #endif @@ -58,7 +58,7 @@ Signed-off-by: Felix Fietkau const struct header_ops *header_ops; unsigned char operstate; -@@ -2145,6 +2156,10 @@ struct net_device { +@@ -2143,6 +2154,10 @@ struct net_device { struct mctp_dev __rcu *mctp_ptr; #endif @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3592,6 +3592,11 @@ static int xmit_one(struct sk_buff *skb, +@@ -3577,6 +3577,11 @@ static int xmit_one(struct sk_buff *skb, if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index f01348d349df73..71b3aac846967f 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -2100,6 +2100,8 @@ struct net_device { +@@ -2098,6 +2098,8 @@ struct net_device { struct netdev_hw_addr_list mc; struct netdev_hw_addr_list dev_addrs; @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau __u8 inner_protocol_type:1; --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6069,6 +6069,9 @@ static enum gro_result dev_gro_receive(s +@@ -6054,6 +6054,9 @@ static enum gro_result dev_gro_receive(s int same_flow; int grow; @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -8083,6 +8086,48 @@ static void __netdev_adjacent_dev_unlink +@@ -8068,6 +8071,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info, -@@ -8134,6 +8179,7 @@ static int __netdev_upper_dev_link(struc +@@ -8119,6 +8164,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -8230,6 +8276,7 @@ static void __netdev_upper_dev_unlink(st +@@ -8215,6 +8261,7 @@ static void __netdev_upper_dev_unlink(st __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); -@@ -9049,6 +9096,7 @@ int dev_set_mac_address(struct net_devic +@@ -9034,6 +9081,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch index 1ccdea6d993e14..8a65cbe021f7a0 100644 --- a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch +++ b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau /** * napi_disable - prevent NAPI from scheduling -@@ -3364,6 +3365,7 @@ struct softnet_data { +@@ -3362,6 +3363,7 @@ struct softnet_data { unsigned int processed; unsigned int time_squeeze; unsigned int received_rps; @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #endif --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4578,7 +4578,7 @@ static int rps_ipi_queued(struct softnet +@@ -4563,7 +4563,7 @@ static int rps_ipi_queued(struct softnet #ifdef CONFIG_RPS struct softnet_data *mysd = this_cpu_ptr(&softnet_data); @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5759,6 +5759,8 @@ static DEFINE_PER_CPU(struct work_struct +@@ -5744,6 +5744,8 @@ static DEFINE_PER_CPU(struct work_struct /* Network device is going away, flush any packets still pending */ static void flush_backlog(struct work_struct *work) { @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau struct sk_buff *skb, *tmp; struct softnet_data *sd; -@@ -5774,9 +5776,18 @@ static void flush_backlog(struct work_st +@@ -5759,9 +5761,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->process_queue); -@@ -5784,7 +5795,18 @@ static void flush_backlog(struct work_st +@@ -5769,7 +5780,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau } static bool flush_required(int cpu) -@@ -6467,6 +6489,7 @@ static int process_backlog(struct napi_s +@@ -6452,6 +6474,7 @@ static int process_backlog(struct napi_s local_irq_disable(); rps_lock(sd); @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6476,7 +6499,8 @@ static int process_backlog(struct napi_s +@@ -6461,7 +6484,8 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6893,6 +6917,57 @@ int dev_set_threaded(struct net_device * +@@ -6878,6 +6902,57 @@ int dev_set_threaded(struct net_device * } EXPORT_SYMBOL(dev_set_threaded); @@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -11369,6 +11444,9 @@ static int dev_cpu_dead(unsigned int old +@@ -11354,6 +11429,9 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; oldsd->rps_ipi_list = NULL; -@@ -11708,6 +11786,7 @@ static int __init net_dev_init(void) +@@ -11693,6 +11771,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif From 9af2ad5111628d22bea6ad1a3dd6f5981927ef09 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Jun 2023 15:05:27 +0200 Subject: [PATCH 0441/1171] ucode: update to the latest version 9986b839595d ci: unbreak failing builds by using fixed gh-actions-openwrt-ci-sdk 77c961e20eda ci: fix broken imx6-generic SDK build 86107a647cb0 ci: cancel concurrent builds ed543d8bf481 ci: update the workflows 11d5f8840002 Merge pull request #151 from ynezz/ynezz/unbreak-ci b934ce815ff2 program: fix memory leak in read_sourceinfo b0baf043e64c Merge pull request #152 from Ansuel/fix-memory-leak 740e2501fdca main: add user specified library search paths before default path 15f1a669e8e2 struct: remove state->len 29edb011caf1 ubus: add support for strings containing null bytes 2b4346bfdc67 vm: clear vm->alloc_refs in uc_gc_common b213bd120d55 Merge pull request #150 from nbd168/misc-improvements 66520ebe27ae vm: immediately release arguments on calls with invalid spreads 07cc72a77e3b README.md: fix debian dependencies d048ea88fe71 compiler: fix memory leak in uc_compiler_compile_import on early exit 7b7e22dcdf02 Merge pull request #155 from luizluca/luizluca-patch-1 d656d150905e types: implement ucv_object_sort() d72eebeb168b lib: support object ordering in `uc_sort()` ed1f0133c870 nl80211: add constants for iftypes 3ffb046c59a6 Merge pull request #156 from nbd168/nl80211-iftypes c7d84aae0969 Merge pull request #153 from jow-/lib-sort-object-support Signed-off-by: Felix Fietkau (cherry picked from commit 9419a50242f81b73bae2b1105c0e370385682ad1) --- package/utils/ucode/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index e768acbae91fd5..e2fe4c8bad40da 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2023-04-03 -PKG_SOURCE_VERSION:=5163867269fc04fa01ec5e9f8df3384c933339f2 -PKG_MIRROR_HASH:=e82922ff59d6f899d9434bf79f2e6e4add0b7b0466355755fc83d4b5a0aeebfb +PKG_SOURCE_DATE:=2023-06-06 +PKG_SOURCE_VERSION:=c7d84aae09691a99ae3db427c0b2463732ef84f4 +PKG_MIRROR_HASH:=38826ae70d886d1d7ada3fc6591ac807169aa28107f60f7f2e617520083525fb PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 263583dc1e569fae3f8e99d73f2fd72376421b17 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 10 Aug 2023 18:11:09 +0200 Subject: [PATCH 0442/1171] ubus: update to the latest version f787c97b3489 libubus: add missing uloop_fd_delete call in ubus_shutdown Signed-off-by: Felix Fietkau (cherry picked from commit fdadfb633f8906478974aefbbc84fee1bf508e2f) --- package/system/ubus/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 5a951ac2495907..82c4dc601a235a 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2022-06-15 -PKG_SOURCE_VERSION:=9913aa61de739e3efe067a2d186021c20bcd65e2 -PKG_MIRROR_HASH:=f6702e68d7c60388c11f40ca5ca8e932d0bf423325db5bee2c79404782bbcb52 +PKG_SOURCE_DATE:=2023-06-05 +PKG_SOURCE_VERSION:=f787c97b34894a38b15599886cacbca01271684f +PKG_MIRROR_HASH:=f4e898eb9207f069652f1767835f6aa9f015df2282d51e50ab57a0c3736f36e3 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 9720b094aef89802327683f25824820581fed0b9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 29 Aug 2023 14:32:42 +0200 Subject: [PATCH 0443/1171] hostapd: backport from master, including ucode based reload support This significantly improves config reload behavior and also fixes some corner cases related to running AP + mesh interfaces at the same time. Signed-off-by: Felix Fietkau --- .../files/lib/netifd/wireless/mac80211.sh | 627 ++++++-------- package/network/services/hostapd/Config.in | 5 - package/network/services/hostapd/Makefile | 80 +- .../network/services/hostapd/files/common.uc | 318 +++++++ .../network/services/hostapd/files/hostapd.sh | 38 +- .../network/services/hostapd/files/hostapd.uc | 809 ++++++++++++++++++ .../services/hostapd/files/radius.clients | 1 + .../services/hostapd/files/radius.config | 9 + .../services/hostapd/files/radius.init | 42 + .../services/hostapd/files/radius.users | 14 + .../network/services/hostapd/files/wdev.uc | 207 +++++ .../hostapd/files/wpa_supplicant-basic.config | 2 +- .../hostapd/files/wpa_supplicant-full.config | 2 +- .../hostapd/files/wpa_supplicant-mini.config | 2 +- .../hostapd/files/wpa_supplicant-p2p.config | 2 +- .../services/hostapd/files/wpa_supplicant.uc | 330 +++++++ .../services/hostapd/files/wpad_acl.json | 6 + ...erministic-channel-on-channel-switch.patch | 6 +- ...ix-sta-add-after-previous-connection.patch | 4 +- ...ewrite-neigh-code-to-not-depend-on-l.patch | 6 +- ...ssing-authentication-frames-in-block.patch | 2 +- .../hostapd/patches/100-daemonize_fix.patch | 97 --- ...efile-make-run-tests-with-CONFIG_TLS.patch | 14 +- ...tapd-update-cfs0-and-cfs1-for-160MHz.patch | 4 +- ...ix-setting-QoS-map-on-secondary-BSSs.patch | 20 + ...pdate-drv-ifindex-on-removing-the-fi.patch | 18 + ...0211_put_freq_params-call-outside-of.patch | 34 + .../hostapd/patches/200-multicall.patch | 22 +- .../services/hostapd/patches/300-noscan.patch | 4 +- .../patches/310-rescan_immediately.patch | 2 +- .../patches/340-reload_freq_change.patch | 80 -- .../patches/360-ctrl_iface_reload.patch | 106 --- .../hostapd/patches/370-ap_sta_support.patch | 392 --------- .../patches/380-disable_ctrl_iface_mib.patch | 14 +- .../patches/390-wpa_ie_cap_workaround.patch | 4 +- .../patches/420-indicate-features.patch | 12 +- .../hostapd/patches/432-missing-typedef.patch | 10 - .../hostapd/patches/450-scan_wait.patch | 73 -- ...dd-new-config-params-to-be-used-with.patch | 2 +- .../patches/463-add-mcast_rate-to-11s.patch | 4 +- .../patches/464-fix-mesh-obss-check.patch | 2 +- .../patches/500-lto-jobserver-support.patch | 2 +- .../hostapd/patches/600-ubus_support.patch | 233 +++-- .../hostapd/patches/601-ucode_support.patch | 543 ++++++++++++ .../hostapd/patches/700-wifi-reload.patch | 194 ----- .../patches/701-reload_config_inline.patch | 33 + .../hostapd/patches/710-vlan_no_bridge.patch | 2 +- .../patches/720-iface_max_num_sta.patch | 15 +- .../hostapd/patches/730-ft_iface.patch | 2 +- .../hostapd/patches/740-snoop_iface.patch | 85 +- ...750-qos_map_set_without_interworking.patch | 6 +- .../hostapd/patches/760-dynamic_own_ip.patch | 2 +- .../hostapd/patches/761-shared_das_port.patch | 2 +- .../hostapd/patches/770-radius_server.patch | 154 ++++ ..._AP-functions-dependant-on-CONFIG_AP.patch | 4 +- .../patches/991-Fix-OpenWrt-13156.patch | 4 +- .../services/hostapd/src/hostapd/radius.c | 715 ++++++++++++++++ .../services/hostapd/src/src/ap/ubus.c | 215 ++--- .../services/hostapd/src/src/ap/ucode.c | 808 +++++++++++++++++ .../services/hostapd/src/src/ap/ucode.h | 54 ++ .../services/hostapd/src/src/utils/ucode.c | 335 ++++++++ .../services/hostapd/src/src/utils/ucode.h | 29 + .../hostapd/src/wpa_supplicant/ubus.c | 162 +--- .../hostapd/src/wpa_supplicant/ubus.h | 11 - .../hostapd/src/wpa_supplicant/ucode.c | 281 ++++++ .../hostapd/src/wpa_supplicant/ucode.h | 49 ++ 66 files changed, 5512 insertions(+), 1854 deletions(-) create mode 100644 package/network/services/hostapd/files/common.uc create mode 100644 package/network/services/hostapd/files/hostapd.uc create mode 100644 package/network/services/hostapd/files/radius.clients create mode 100644 package/network/services/hostapd/files/radius.config create mode 100644 package/network/services/hostapd/files/radius.init create mode 100644 package/network/services/hostapd/files/radius.users create mode 100644 package/network/services/hostapd/files/wdev.uc create mode 100644 package/network/services/hostapd/files/wpa_supplicant.uc delete mode 100644 package/network/services/hostapd/patches/100-daemonize_fix.patch create mode 100644 package/network/services/hostapd/patches/180-driver_nl80211-fix-setting-QoS-map-on-secondary-BSSs.patch create mode 100644 package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch create mode 100644 package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch delete mode 100644 package/network/services/hostapd/patches/340-reload_freq_change.patch delete mode 100644 package/network/services/hostapd/patches/360-ctrl_iface_reload.patch delete mode 100644 package/network/services/hostapd/patches/370-ap_sta_support.patch delete mode 100644 package/network/services/hostapd/patches/432-missing-typedef.patch delete mode 100644 package/network/services/hostapd/patches/450-scan_wait.patch create mode 100644 package/network/services/hostapd/patches/601-ucode_support.patch delete mode 100644 package/network/services/hostapd/patches/700-wifi-reload.patch create mode 100644 package/network/services/hostapd/patches/701-reload_config_inline.patch create mode 100644 package/network/services/hostapd/patches/770-radius_server.patch create mode 100644 package/network/services/hostapd/src/hostapd/radius.c create mode 100644 package/network/services/hostapd/src/src/ap/ucode.c create mode 100644 package/network/services/hostapd/src/src/ap/ucode.h create mode 100644 package/network/services/hostapd/src/src/utils/ucode.c create mode 100644 package/network/services/hostapd/src/src/utils/ucode.h create mode 100644 package/network/services/hostapd/src/wpa_supplicant/ucode.c create mode 100644 package/network/services/hostapd/src/wpa_supplicant/ucode.h diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 5aaba9af26c608..860609305f4539 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -15,12 +15,9 @@ MP_CONFIG_INT="mesh_retry_timeout mesh_confirm_timeout mesh_holding_timeout mesh MP_CONFIG_BOOL="mesh_auto_open_plinks mesh_fwding" MP_CONFIG_STRING="mesh_power_mode" -NEWAPLIST= -OLDAPLIST= -NEWSPLIST= -OLDSPLIST= -NEWUMLIST= -OLDUMLIST= +wdev_tool() { + ucode /usr/share/hostap/wdev.uc "$@" +} drv_mac80211_init_device_config() { hostapd_common_add_device_config @@ -29,7 +26,8 @@ drv_mac80211_init_device_config() { config_add_string tx_burst config_add_string distance config_add_int beacon_int chanbw frag rts - config_add_int rxantenna txantenna antenna_gain txpower min_tx_power + config_add_int rxantenna txantenna txpower min_tx_power + config_add_int num_global_macaddr multiple_bssid config_add_boolean noscan ht_coex acs_exclude_dfs background_radar config_add_array ht_capab config_add_array channels @@ -490,12 +488,12 @@ ${channel:+channel=$channel} ${channel_list:+chanlist=$channel_list} ${hostapd_noscan:+noscan=1} ${tx_burst:+tx_queue_data2_burst=$tx_burst} +${multiple_bssid:+mbssid=$multiple_bssid} +#num_global_macaddr=$num_global_macaddr $base_cfg EOF json_select .. - radio_md5sum=$(md5sum $hostapd_conf_file | cut -d" " -f1) - echo "radio_config_id=${radio_md5sum}" >> $hostapd_conf_file } mac80211_hostapd_setup_bss() { @@ -522,6 +520,7 @@ mac80211_hostapd_setup_bss() { cat >> /var/run/hostapd-$phy.conf </dev/null 2>&1 - rc="$?" - - [ "$rc" = 233 ] && { - # Device might have just been deleted, give the kernel some time to finish cleaning it up - sleep 1 - - iw phy "$phy" interface add "$ifname" type "$type" $wdsflag >/dev/null 2>&1 - rc="$?" - } - - [ "$rc" = 233 ] && { - # Keep matching pre-existing interface - [ -d "/sys/class/ieee80211/${phy}/device/net/${ifname}" ] && \ - case "$(iw dev $ifname info | grep "^\ttype" | cut -d' ' -f2- 2>/dev/null)" in - "AP") - [ "$type" = "__ap" ] && rc=0 - ;; - "IBSS") - [ "$type" = "adhoc" ] && rc=0 - ;; - "managed") - [ "$type" = "managed" ] && rc=0 - ;; - "mesh point") - [ "$type" = "mp" ] && rc=0 - ;; - "monitor") - [ "$type" = "monitor" ] && rc=0 - ;; - esac - } - - [ "$rc" = 233 ] && { - iw dev "$ifname" del >/dev/null 2>&1 - [ "$?" = 0 ] && { - sleep 1 - - iw phy "$phy" interface add "$ifname" type "$type" $wdsflag >/dev/null 2>&1 - rc="$?" - } - } - - [ "$rc" != 0 ] && { - # Device might not support virtual interfaces, so the interface never got deleted in the first place. - # Check if the interface already exists, and avoid failing in this case. - [ -d "/sys/class/ieee80211/${phy}/device/net/${ifname}" ] && rc=0 - } - - [ "$rc" != 0 ] && { - # Device doesn't support virtual interfaces and may have existing interface other than ifname. - oldifname="$(basename "/sys/class/ieee80211/${phy}/device/net"/* 2>/dev/null)" - [ "$oldifname" ] && ip link set "$oldifname" name "$ifname" 1>/dev/null 2>&1 - rc="$?" - } - - [ "$rc" != 0 ] && echo "Failed to create interface $ifname" - return $rc -} - mac80211_set_ifname() { local phy="$1" local prefix="$2" @@ -752,21 +643,23 @@ mac80211_prepare_vif() { mac80211_set_ifname "$phy" "$prefix" } + append active_ifnames "$ifname" set_default wds 0 set_default powersave 0 + json_add_string _ifname "$ifname" - json_select .. - + default_macaddr= if [ -z "$macaddr" ]; then macaddr="$(mac80211_generate_mac $phy)" macidx="$(($macidx + 1))" + default_macaddr=1 elif [ "$macaddr" = 'random' ]; then macaddr="$(macaddr_random)" fi + json_add_string _macaddr "$macaddr" + json_add_string _default_macaddr "$default_macaddr" + json_select .. - json_add_object data - json_add_string ifname "$ifname" - json_close_object [ "$mode" == "ap" ] && { [ -z "$wpa_psk_file" ] && hostapd_set_psk "$ifname" @@ -777,9 +670,6 @@ mac80211_prepare_vif() { # It is far easier to delete and create the desired interface case "$mode" in - adhoc) - mac80211_iw_interface_add "$phy" "$ifname" adhoc || return - ;; ap) # Hostapd will handle recreating the interface and # subsequent virtual APs belonging to the same PHY @@ -791,114 +681,16 @@ mac80211_prepare_vif() { mac80211_hostapd_setup_bss "$phy" "$ifname" "$macaddr" "$type" || return - NEWAPLIST="${NEWAPLIST}$ifname " [ -n "$hostapd_ctrl" ] || { ap_ifname="${ifname}" hostapd_ctrl="${hostapd_ctrl:-/var/run/hostapd/$ifname}" } ;; - mesh) - mac80211_iw_interface_add "$phy" "$ifname" mp || return - ;; - monitor) - mac80211_iw_interface_add "$phy" "$ifname" monitor || return - ;; - sta) - local wdsflag= - [ "$enable" = 0 ] || staidx="$(($staidx + 1))" - [ "$wds" -gt 0 ] && wdsflag="4addr on" - mac80211_iw_interface_add "$phy" "$ifname" managed "$wdsflag" || return - if [ "$wds" -gt 0 ]; then - iw "$ifname" set 4addr on - else - iw "$ifname" set 4addr off - fi - [ "$powersave" -gt 0 ] && powersave="on" || powersave="off" - iw "$ifname" set power_save "$powersave" - ;; - esac - - case "$mode" in - monitor|mesh) - [ "$auto_channel" -gt 0 ] || iw dev "$ifname" set channel "$channel" $iw_htmode - ;; esac - if [ "$mode" != "ap" ]; then - # ALL ap functionality will be passed to hostapd - # All interfaces must have unique mac addresses - # which can either be explicitly set in the device - # section, or automatically generated - ip link set dev "$ifname" address "$macaddr" - fi - json_select .. } -mac80211_setup_supplicant() { - local enable=$1 - local add_sp=0 - local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})" - - [ "$enable" = 0 ] && { - ubus call wpa_supplicant.${phy} config_remove "{\"iface\":\"$ifname\"}" - ip link set dev "$ifname" down - iw dev "$ifname" del - return 0 - } - - wpa_supplicant_prepare_interface "$ifname" nl80211 || { - iw dev "$ifname" del - return 1 - } - if [ "$mode" = "sta" ]; then - wpa_supplicant_add_network "$ifname" - else - wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan" - fi - - NEWSPLIST="${NEWSPLIST}$ifname " - - if [ "${NEWAPLIST%% *}" != "${OLDAPLIST%% *}" ]; then - [ "$spobj" ] && ubus call wpa_supplicant config_remove "{\"iface\":\"$ifname\"}" - add_sp=1 - fi - [ -z "$spobj" ] && add_sp=1 - - NEW_MD5_SP=$(test -e "${_config}" && md5sum ${_config}) - OLD_MD5_SP=$(uci -q -P /var/state get wireless._${phy}.md5_${ifname}) - if [ "$add_sp" = "1" ]; then - wpa_supplicant_run "$ifname" "$hostapd_ctrl" - else - [ "${NEW_MD5_SP}" == "${OLD_MD5_SP}" ] || ubus call $spobj reload - fi - uci -q -P /var/state set wireless._${phy}.md5_${ifname}="${NEW_MD5_SP}" - return 0 -} - -mac80211_setup_supplicant_noctl() { - local enable=$1 - local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})" - wpa_supplicant_prepare_interface "$ifname" nl80211 || { - iw dev "$ifname" del - return 1 - } - - wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan" - - NEWSPLIST="${NEWSPLIST}$ifname " - [ "$enable" = 0 ] && { - ubus call wpa_supplicant config_remove "{\"iface\":\"$ifname\"}" - ip link set dev "$ifname" down - return 0 - } - if [ -z "$spobj" ]; then - wpa_supplicant_run "$ifname" - else - ubus call $spobj reload - fi -} - mac80211_prepare_iw_htmode() { case "$htmode" in VHT20|HT20|HE20) iw_htmode=HT20;; @@ -936,6 +728,13 @@ mac80211_prepare_iw_htmode() { esac } +mac80211_add_mesh_params() { + for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do + eval "mp_val=\"\$$var\"" + [ -n "$mp_val" ] && json_add_string "$var" "$mp_val" + done +} + mac80211_setup_adhoc() { local enable=$1 json_get_vars bssid ssid key mcast_rate @@ -977,82 +776,215 @@ mac80211_setup_adhoc() { mcval= [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" - iw dev "$ifname" set type ibss - iw dev "$ifname" ibss join "$ssid" $freq $iw_htmode fixed-freq $bssid \ - beacon-interval $beacon_int \ - ${brstr:+basic-rates $brstr} \ - ${mcval:+mcast-rate $mcval} \ - ${keyspec:+keys $keyspec} + local prev + json_set_namespace wdev_uc prev + + json_add_object "$ifname" + json_add_string mode adhoc + [ -n "$default_macaddr" ] || json_add_string macaddr "$macaddr" + json_add_string ssid "$ssid" + json_add_string freq "$freq" + json_add_string htmode "$iw_htmode" + [ -n "$bssid" ] && json_add_string bssid "$bssid" + json_add_int beacon-interval "$beacon_int" + [ -n "$brstr" ] && json_add_string basic-rates "$brstr" + [ -n "$mcval" ] && json_add_string mcast-rate "$mcval" + [ -n "$keyspec" ] && json_add_string keys "$keyspec" + json_close_object + + json_set_namespace "$prev" } mac80211_setup_mesh() { - local enable=$1 json_get_vars ssid mesh_id mcast_rate - NEWUMLIST="${NEWUMLIST}$ifname " - - [ "$enable" = 0 ] && { - ip link set dev "$ifname" down - return 0 - } - mcval= [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" [ -n "$mesh_id" ] && ssid="$mesh_id" - iw dev "$ifname" mesh join "$ssid" freq $freq $iw_htmode \ - ${mcval:+mcast-rate $mcval} \ - beacon-interval $beacon_int + local prev + json_set_namespace wdev_uc prev + + json_add_object "$ifname" + json_add_string mode mesh + [ -n "$default_macaddr" ] || json_add_string macaddr "$macaddr" + json_add_string ssid "$ssid" + json_add_string freq "$freq" + json_add_string htmode "$iw_htmode" + [ -n "$mcval" ] && json_add_string mcast-rate "$mcval" + json_add_int beacon-interval "$beacon_int" + mac80211_add_mesh_params + + json_close_object + + json_set_namespace "$prev" } -mac80211_setup_vif() { +mac80211_setup_monitor() { + local prev + json_set_namespace wdev_uc prev + + json_add_object "$ifname" + json_add_string mode monitor + [ -n "$freq" ] && json_add_string freq "$freq" + json_add_string htmode "$iw_htmode" + json_close_object + + json_set_namespace "$prev" +} + +mac80211_set_vif_txpower() { local name="$1" - local failed - local action=up - json_select data - json_get_vars ifname + json_select config + json_get_var ifname _ifname + json_get_vars vif_txpower json_select .. - json_select config - json_get_vars mode - json_get_var vif_txpower - json_get_var vif_enable enable 1 - - [ "$vif_enable" = 1 ] || action=down - if [ "$mode" != "ap" ] || [ "$ifname" = "$ap_ifname" ]; then - ip link set dev "$ifname" "$action" || { - wireless_setup_vif_failed IFUP_ERROR - json_select .. - return - } - [ -z "$vif_txpower" ] || iw dev "$ifname" set txpower fixed "${vif_txpower%%.*}00" + [ -z "$vif_txpower" ] || iw dev "$ifname" set txpower fixed "${vif_txpower%%.*}00" +} + +wpa_supplicant_init_config() { + json_set_namespace wpa_supp prev + + json_init + json_add_array config + + json_set_namespace "$prev" +} + +wpa_supplicant_add_interface() { + local ifname="$1" + local mode="$2" + local prev + + _wpa_supplicant_common "$ifname" + + json_set_namespace wpa_supp prev + + json_add_object + json_add_string ctrl "$_rpath" + json_add_string iface "$ifname" + json_add_string mode "$mode" + json_add_string config "$_config" + [ -n "$default_macaddr" ] || json_add_string macaddr "$macaddr" + [ -n "$network_bridge" ] && json_add_string bridge "$network_bridge" + [ -n "$wds" ] && json_add_boolean 4addr "$wds" + json_add_boolean powersave "$powersave" + [ "$mode" = "mesh" ] && mac80211_add_mesh_params + json_close_object + + json_set_namespace "$prev" + + wpa_supp_init=1 +} + +wpa_supplicant_set_config() { + local phy="$1" + local prev + + json_set_namespace wpa_supp prev + json_close_array + json_add_string phy "$phy" + json_add_boolean defer 1 + local data="$(json_dump)" + + json_cleanup + json_set_namespace "$prev" + + ubus -S -t 0 wait_for wpa_supplicant || { + [ -n "$wpa_supp_init" ] || return 0 + + ubus wait_for wpa_supplicant + } + + local supplicant_res="$(ubus call wpa_supplicant config_set "$data")" + ret="$?" + [ "$ret" != 0 -o -z "$supplicant_res" ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED + + wireless_add_process "$(jsonfilter -s "$supplicant_res" -l 1 -e @.pid)" "/usr/sbin/wpa_supplicant" 1 1 + +} + +hostapd_set_config() { + [ -n "$hostapd_ctrl" ] || { + ubus call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null + return 0; + } + + ubus wait_for hostapd + local hostapd_res="$(ubus call hostapd config_set "{ \"phy\": \"$phy\", \"config\":\"${hostapd_conf_file}\", \"prev_config\": \"${hostapd_conf_file}.prev\"}")" + ret="$?" + [ "$ret" != 0 -o -z "$hostapd_res" ] && { + wireless_setup_failed HOSTAPD_START_FAILED + return + } + wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1 +} + + +wpa_supplicant_start() { + local phy="$1" + + [ -n "$wpa_supp_init" ] || return 0 + + ubus call wpa_supplicant config_set '{ "phy": "'"$phy"'" }' > /dev/null +} + +mac80211_setup_supplicant() { + local enable=$1 + local add_sp=0 + + wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1 + + if [ "$mode" = "sta" ]; then + wpa_supplicant_add_network "$ifname" + else + wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan" fi + wpa_supplicant_add_interface "$ifname" "$mode" + + return 0 +} + +mac80211_setup_vif() { + local name="$1" + local failed + + json_select config + json_get_var ifname _ifname + json_get_var macaddr _macaddr + json_get_var default_macaddr _default_macaddr + json_get_vars mode wds powersave + + set_default powersave 0 + set_default wds 0 + case "$mode" in mesh) + json_get_vars $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING wireless_vif_parse_encryption [ -z "$htmode" ] && htmode="NOHT"; - if wpa_supplicant -vmesh || [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then - mac80211_setup_supplicant $vif_enable || failed=1 + if wpa_supplicant -vmesh; then + mac80211_setup_supplicant || failed=1 else - mac80211_setup_mesh $vif_enable + mac80211_setup_mesh fi - for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do - json_get_var mp_val "$var" - [ -n "$mp_val" ] && iw dev "$ifname" set mesh_param "$var" "$mp_val" - done ;; adhoc) wireless_vif_parse_encryption if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then - mac80211_setup_supplicant_noctl $vif_enable || failed=1 + mac80211_setup_supplicant || failed=1 else - mac80211_setup_adhoc $vif_enable + mac80211_setup_adhoc fi ;; sta) - mac80211_setup_supplicant $vif_enable || failed=1 + mac80211_setup_supplicant || failed=1 + ;; + monitor) + mac80211_setup_monitor ;; esac @@ -1085,7 +1017,6 @@ band_match && $3 == "MHz" && $4 == channel { ' } - chan_is_dfs() { local phy="$1" local chan="$2" @@ -1093,27 +1024,6 @@ chan_is_dfs() { return $! } -mac80211_vap_cleanup() { - local service="$1" - local vaps="$2" - - for wdev in $vaps; do - [ "$service" != "none" ] && ubus call ${service} config_remove "{\"iface\":\"$wdev\"}" - ip link set dev "$wdev" down 2>/dev/null - iw dev "$wdev" del - done -} - -mac80211_interface_cleanup() { - local phy="$1" - local primary_ap=$(uci -q -P /var/state get wireless._${phy}.aplist) - primary_ap=${primary_ap%% *} - - mac80211_vap_cleanup hostapd "${primary_ap}" - mac80211_vap_cleanup wpa_supplicant "$(uci -q -P /var/state get wireless._${phy}.splist)" - mac80211_vap_cleanup none "$(uci -q -P /var/state get wireless._${phy}.umlist)" -} - mac80211_set_noscan() { hostapd_noscan=1 } @@ -1122,49 +1032,44 @@ drv_mac80211_cleanup() { hostapd_common_cleanup } +mac80211_reset_config() { + local phy="$1" + + hostapd_conf_file="/var/run/hostapd-$phy.conf" + ubus call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"$hostapd_conf_file"'" }' > /dev/null + ubus call wpa_supplicant config_set '{ "phy": "'"$phy"'", "config": [] }' > /dev/null + wdev_tool "$phy" set_config '{}' +} + drv_mac80211_setup() { json_select config json_get_vars \ phy macaddr path \ country chanbw distance \ - txpower antenna_gain \ + txpower \ rxantenna txantenna \ - frag rts beacon_int:100 htmode + frag rts beacon_int:100 htmode \ + num_global_macaddr:1 multiple_bssid json_get_values basic_rate_list basic_rate json_get_values scan_list scan_list json_select .. + json_select data && { + json_get_var prev_rxantenna rxantenna + json_get_var prev_txantenna txantenna + json_select .. + } + find_phy || { echo "Could not find PHY for device '$1'" wireless_set_retry 0 return 1 } - wireless_set_data phy="$phy" - [ -z "$(uci -q -P /var/state show wireless._${phy})" ] && uci -q -P /var/state set wireless._${phy}=phy - - OLDAPLIST=$(uci -q -P /var/state get wireless._${phy}.aplist) - OLDSPLIST=$(uci -q -P /var/state get wireless._${phy}.splist) - OLDUMLIST=$(uci -q -P /var/state get wireless._${phy}.umlist) - local wdev local cwdev local found - for wdev in $(list_phy_interfaces "$phy"); do - found=0 - for cwdev in $OLDAPLIST $OLDSPLIST $OLDUMLIST; do - if [ "$wdev" = "$cwdev" ]; then - found=1 - break - fi - done - if [ "$found" = "0" ]; then - ip link set dev "$wdev" down - iw dev "$wdev" del - fi - done - # convert channel to frequency [ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel" "$band")" @@ -1177,7 +1082,6 @@ drv_mac80211_setup() { hostapd_conf_file="/var/run/hostapd-$phy.conf" - no_ap=1 macidx=0 staidx=0 @@ -1190,13 +1094,14 @@ drv_mac80211_setup() { set_default rxantenna 0xffffffff set_default txantenna 0xffffffff set_default distance 0 - set_default antenna_gain 0 [ "$txantenna" = "all" ] && txantenna=0xffffffff [ "$rxantenna" = "all" ] && rxantenna=0xffffffff + [ "$rxantenna" = "$prev_rxantenna" -a "$txantenna" = "$prev_txantenna" ] || mac80211_reset_config "$phy" + wireless_set_data phy="$phy" txantenna="$txantenna" rxantenna="$rxantenna" + iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1 - iw phy "$phy" set antenna_gain $antenna_gain >/dev/null 2>&1 iw phy "$phy" set distance "$distance" >/dev/null 2>&1 if [ -n "$txpower" ]; then @@ -1212,78 +1117,36 @@ drv_mac80211_setup() { hostapd_ctrl= ap_ifname= hostapd_noscan= + wpa_supp_init= for_each_interface "ap" mac80211_check_ap - rm -f "$hostapd_conf_file" + [ -f "$hostapd_conf_file" ] && mv "$hostapd_conf_file" "$hostapd_conf_file.prev" for_each_interface "sta adhoc mesh" mac80211_set_noscan [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" - mac80211_prepare_iw_htmode - for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif - NEWAPLIST= - for_each_interface "ap" mac80211_prepare_vif - NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file}) - OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5) - if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then - mac80211_vap_cleanup hostapd "${OLDAPLIST}" - fi - [ -n "${NEWAPLIST}" ] && mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap - local add_ap=0 - local primary_ap=${NEWAPLIST%% *} - [ -n "$hostapd_ctrl" ] && { - local no_reload=1 - if [ -n "$(ubus list | grep hostapd.$primary_ap)" ]; then - no_reload=0 - [ "${NEW_MD5}" = "${OLD_MD5}" ] || { - ubus call hostapd.$primary_ap reload - no_reload=$? - if [ "$no_reload" != "0" ]; then - mac80211_vap_cleanup hostapd "${OLDAPLIST}" - mac80211_vap_cleanup wpa_supplicant "$(uci -q -P /var/state get wireless._${phy}.splist)" - mac80211_vap_cleanup none "$(uci -q -P /var/state get wireless._${phy}.umlist)" - sleep 2 - mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap - for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif - fi - } - fi - if [ "$no_reload" != "0" ]; then - add_ap=1 - ubus wait_for hostapd - local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")" - ret="$?" - [ "$ret" != 0 -o -z "$hostapd_res" ] && { - wireless_setup_failed HOSTAPD_START_FAILED - return - } - wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1 - fi - } - uci -q -P /var/state set wireless._${phy}.aplist="${NEWAPLIST}" - uci -q -P /var/state set wireless._${phy}.md5="${NEW_MD5}" + local prev + json_set_namespace wdev_uc prev + json_init + json_set_namespace "$prev" + + wpa_supplicant_init_config - [ "${add_ap}" = 1 ] && sleep 1 - for_each_interface "ap" mac80211_setup_vif + mac80211_prepare_iw_htmode + active_ifnames= + for_each_interface "ap sta adhoc mesh monitor" mac80211_prepare_vif + for_each_interface "ap sta adhoc mesh monitor" mac80211_setup_vif - NEWSPLIST= - NEWUMLIST= + [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy" + [ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy" - for_each_interface "sta adhoc mesh monitor" mac80211_setup_vif + [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy" - uci -q -P /var/state set wireless._${phy}.splist="${NEWSPLIST}" - uci -q -P /var/state set wireless._${phy}.umlist="${NEWUMLIST}" + json_set_namespace wdev_uc prev + wdev_tool "$phy" set_config "$(json_dump)" $active_ifnames + json_set_namespace "$prev" - local foundvap - local dropvap="" - for oldvap in $OLDSPLIST; do - foundvap=0 - for newvap in $NEWSPLIST; do - [ "$oldvap" = "$newvap" ] && foundvap=1 - done - [ "$foundvap" = "0" ] && dropvap="$dropvap $oldvap" - done - [ -n "$dropvap" ] && mac80211_vap_cleanup wpa_supplicant "$dropvap" + for_each_interface "ap sta adhoc mesh monitor" mac80211_set_vif_txpower wireless_set_up } @@ -1314,8 +1177,12 @@ drv_mac80211_teardown() { return 1 } - mac80211_interface_cleanup "$phy" - uci -q -P /var/state revert wireless._${phy} + mac80211_reset_config "$phy" + + for wdev in $(list_phy_interfaces "$phy"); do + ip link set dev "$wdev" down + iw dev "$wdev" del + done } add_driver mac80211 diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index 8f28eb2bd4f4ce..87ad7e093e7da0 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -73,11 +73,6 @@ config WPA_WOLFSSL select WOLFSSL_HAS_SESSION_TICKET select WOLFSSL_HAS_WPAS -config DRIVER_WEXT_SUPPORT - bool - select KERNEL_WIRELESS_EXT - default n - config DRIVER_11AC_SUPPORT bool default n diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 287a70c80e31c2..7b94709e204a68 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=1.2 +PKG_RELEASE:=3 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-06-22 -PKG_SOURCE_VERSION:=599d00be9de2846c6ea18c1487d8329522ade22b -PKG_MIRROR_HASH:=828810c558ea181e45ed0c8b940f5c41e55775e2979a15aed8cf0ab17dd7723c +PKG_SOURCE_DATE:=2023-09-08 +PKG_SOURCE_VERSION:=e5ccbfc69ecf297590341ae8b461edba9d8e964c +PKG_MIRROR_HASH:=fcc6550f46c7f8bbdbf71e63f8f699b9a0878565ad1b90a17855f5ec21283b8f PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -21,13 +21,10 @@ PKG_BUILD_PARALLEL:=1 PKG_ASLR_PIE_REGULAR:=1 PKG_CONFIG_DEPENDS:= \ - CONFIG_PACKAGE_kmod-ath9k \ - CONFIG_PACKAGE_kmod-cfg80211 \ CONFIG_PACKAGE_hostapd \ CONFIG_PACKAGE_hostapd-basic \ CONFIG_PACKAGE_hostapd-mini \ CONFIG_WPA_RFKILL_SUPPORT \ - CONFIG_DRIVER_WEXT_SUPPORT \ CONFIG_DRIVER_11AC_SUPPORT \ CONFIG_DRIVER_11AX_SUPPORT \ CONFIG_WPA_ENABLE_WEP @@ -82,13 +79,14 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),) HOSTAPD_IEEE80211AX:=y endif +CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json + DRIVER_MAKEOPTS= \ - CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \ - CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \ + CONFIG_ACS=y CONFIG_DRIVER_NL80211=y \ CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \ - CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \ - CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT) + CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT) \ + CONFIG_UCODE=y ifeq ($(SSL_VARIANT),openssl) DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y @@ -141,7 +139,7 @@ ifneq ($(LOCAL_TYPE),hostapd) endif endif -DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +DRV_DEPENDS:=+libnl-tiny define Package/hostapd/Default @@ -150,7 +148,7 @@ define Package/hostapd/Default SUBMENU:=WirelessAPD TITLE:=IEEE 802.1x Authenticator URL:=http://hostap.epitest.fi/ - DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus + DEPENDS:=$(DRV_DEPENDS) +hostapd-common $(CORE_DEPENDS) EXTRA_DEPENDS:=hostapd-common (=$(PKG_VERSION)-$(PKG_RELEASE)) USERID:=network=101:network=101 PROVIDES:=hostapd @@ -255,7 +253,7 @@ define Package/wpad/Default CATEGORY:=Network SUBMENU:=WirelessAPD TITLE:=IEEE 802.1x Auth/Supplicant - DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus + DEPENDS:=$(DRV_DEPENDS) +hostapd-common $(CORE_DEPENDS) EXTRA_DEPENDS:=hostapd-common (=$(PKG_VERSION)-$(PKG_RELEASE)) USERID:=network=101:network=101 URL:=http://hostap.epitest.fi/ @@ -358,7 +356,7 @@ endef define Package/wpad-mesh $(call Package/wpad/Default,$(1)) - DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) + DEPENDS+=@(!TARGET_uml||BROKEN) PROVIDES+=wpa-supplicant-mesh wpad-mesh endef @@ -400,7 +398,7 @@ define Package/wpa-supplicant/Default SUBMENU:=WirelessAPD TITLE:=WPA Supplicant URL:=http://hostap.epitest.fi/wpa_supplicant/ - DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus + DEPENDS:=$(DRV_DEPENDS) +hostapd-common $(CORE_DEPENDS) EXTRA_DEPENDS:=hostapd-common (=$(PKG_VERSION)-$(PKG_RELEASE)) USERID:=network=101:network=101 PROVIDES:=wpa-supplicant @@ -442,13 +440,12 @@ endef define Package/wpa-supplicant-p2p $(call Package/wpa-supplicant/Default,$(1)) TITLE+= (Wi-Fi P2P support) - DEPENDS+=@PACKAGE_kmod-cfg80211 VARIANT:=supplicant-p2p-internal endef define Package/wpa-supplicant-mesh/Default $(call Package/wpa-supplicant/Default,$(1)) - DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) + DEPENDS+=@(!TARGET_uml||BROKEN) PROVIDES+=wpa-supplicant-mesh endef @@ -522,7 +519,7 @@ define Package/eapol-test/Default SECTION:=net SUBMENU:=WirelessAPD CATEGORY:=Network - DEPENDS:=$(DRV_DEPENDS) +libubus + DEPENDS:=$(DRV_DEPENDS) $(CORE_DEPENDS) endef define Package/eapol-test @@ -587,11 +584,7 @@ TARGET_CPPFLAGS := \ -D_GNU_SOURCE \ $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY)) -TARGET_LDFLAGS += -lubox -lubus - -ifdef CONFIG_PACKAGE_kmod-cfg80211 - TARGET_LDFLAGS += -lm -lnl-tiny -endif +TARGET_LDFLAGS += -lubox -lubus -lblobmsg_json -lucode -lm -lnl-tiny ifdef CONFIG_WPA_ENABLE_WEP DRIVER_MAKEOPTS += CONFIG_WEP=y @@ -676,22 +669,55 @@ define Build/Compile $(Build/Compile/$(BUILD_VARIANT)) endef +define Install/hostapd/full + $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/etc/radius + ln -sf hostapd $(1)/usr/sbin/hostapd-radius + $(INSTALL_BIN) ./files/radius.init $(1)/etc/init.d/radius + $(INSTALL_DATA) ./files/radius.config $(1)/etc/config/radius + $(INSTALL_DATA) ./files/radius.clients $(1)/etc/radius/clients + $(INSTALL_DATA) ./files/radius.users $(1)/etc/radius/users +endef + +define Package/hostapd-full/conffiles +/etc/config/radius +/etc/radius +endef + +ifeq ($(CONFIG_VARIANT),full) +Package/wpad-mesh-openssl/conffiles = $(Package/hostapd-full/conffiles) +Package/wpad-mesh-wolfssl/conffiles = $(Package/hostapd-full/conffiles) +Package/wpad-mesh-mbedtls/conffiles = $(Package/hostapd-full/conffiles) +Package/wpad/conffiles = $(Package/hostapd-full/conffiles) +Package/wpad-openssl/conffiles = $(Package/hostapd-full/conffiles) +Package/wpad-wolfssl/conffiles = $(Package/hostapd-full/conffiles) +Package/wpad-mbedtls/conffiles = $(Package/hostapd-full/conffiles) +Package/hostapd/conffiles = $(Package/hostapd-full/conffiles) +Package/hostapd-openssl/conffiles = $(Package/hostapd-full/conffiles) +Package/hostapd-wolfssl/conffiles = $(Package/hostapd-full/conffiles) +Package/hostapd-mbedtls/conffiles = $(Package/hostapd-full/conffiles) +endif + define Install/hostapd - $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/hostap + $(INSTALL_DATA) ./files/hostapd.uc $(1)/usr/share/hostap/ + $(if $(findstring full,$(CONFIG_VARIANT)),$(Install/hostapd/full)) endef define Install/supplicant - $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/hostap + $(INSTALL_DATA) ./files/wpa_supplicant.uc $(1)/usr/share/hostap/ endef define Package/hostapd-common/install - $(INSTALL_DIR) $(1)/etc/capabilities $(1)/etc/rc.button $(1)/etc/hotplug.d/ieee80211 $(1)/etc/init.d $(1)/lib/netifd $(1)/usr/share/acl.d + $(INSTALL_DIR) $(1)/etc/capabilities $(1)/etc/rc.button $(1)/etc/hotplug.d/ieee80211 $(1)/etc/init.d $(1)/lib/netifd $(1)/usr/share/acl.d $(1)/usr/share/hostap $(INSTALL_BIN) ./files/dhcp-get-server.sh $(1)/lib/netifd/dhcp-get-server.sh $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh $(INSTALL_BIN) ./files/wpad.init $(1)/etc/init.d/wpad $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps $(INSTALL_DATA) ./files/wpad_acl.json $(1)/usr/share/acl.d $(INSTALL_DATA) ./files/wpad.json $(1)/etc/capabilities + $(INSTALL_DATA) ./files/common.uc $(1)/usr/share/hostap/ + $(INSTALL_DATA) ./files/wdev.uc $(1)/usr/share/hostap/ endef define Package/hostapd/install diff --git a/package/network/services/hostapd/files/common.uc b/package/network/services/hostapd/files/common.uc new file mode 100644 index 00000000000000..ccffe3eb436219 --- /dev/null +++ b/package/network/services/hostapd/files/common.uc @@ -0,0 +1,318 @@ +import * as nl80211 from "nl80211"; +import * as rtnl from "rtnl"; +import { readfile, glob, basename, readlink } from "fs"; + +const iftypes = { + ap: nl80211.const.NL80211_IFTYPE_AP, + mesh: nl80211.const.NL80211_IFTYPE_MESH_POINT, + sta: nl80211.const.NL80211_IFTYPE_STATION, + adhoc: nl80211.const.NL80211_IFTYPE_ADHOC, + monitor: nl80211.const.NL80211_IFTYPE_MONITOR, +}; + +function wdev_remove(name) +{ + nl80211.request(nl80211.const.NL80211_CMD_DEL_INTERFACE, 0, { dev: name }); +} + +function __phy_is_fullmac(phyidx) +{ + let data = nl80211.request(nl80211.const.NL80211_CMD_GET_WIPHY, 0, { wiphy: phyidx }); + + return !data.software_iftypes.ap_vlan; +} + +function phy_is_fullmac(phy) +{ + let phyidx = int(trim(readfile(`/sys/class/ieee80211/${phy}/index`))); + + return __phy_is_fullmac(phyidx); +} + +function find_reusable_wdev(phyidx) +{ + if (!__phy_is_fullmac(phyidx)) + return null; + + let data = nl80211.request( + nl80211.const.NL80211_CMD_GET_INTERFACE, + nl80211.const.NLM_F_DUMP, + { wiphy: phyidx }); + for (let res in data) + if (trim(readfile(`/sys/class/net/${res.ifname}/operstate`)) == "down") + return res.ifname; + return null; +} + +function wdev_create(phy, name, data) +{ + let phyidx = int(readfile(`/sys/class/ieee80211/${phy}/index`)); + + wdev_remove(name); + + if (!iftypes[data.mode]) + return `Invalid mode: ${data.mode}`; + + let req = { + wiphy: phyidx, + ifname: name, + iftype: iftypes[data.mode], + }; + + if (data["4addr"]) + req["4addr"] = data["4addr"]; + if (data.macaddr) + req.mac = data.macaddr; + + nl80211.error(); + + let reuse_ifname = find_reusable_wdev(phyidx); + if (reuse_ifname && + (reuse_ifname == name || + rtnl.request(rtnl.const.RTM_SETLINK, 0, { dev: reuse_ifname, ifname: name}) != false)) + nl80211.request( + nl80211.const.NL80211_CMD_SET_INTERFACE, 0, { + wiphy: phyidx, + dev: name, + iftype: iftypes[data.mode], + }); + else + nl80211.request( + nl80211.const.NL80211_CMD_NEW_INTERFACE, + nl80211.const.NLM_F_CREATE, + req); + + let error = nl80211.error(); + if (error) + return error; + + if (data.powersave != null) { + nl80211.request(nl80211.const.NL80211_CMD_SET_POWER_SAVE, 0, + { dev: name, ps_state: data.powersave ? 1 : 0}); + } + + return null; +} + +function phy_sysfs_file(phy, name) +{ + return trim(readfile(`/sys/class/ieee80211/${phy}/${name}`)); +} + +function macaddr_split(str) +{ + return map(split(str, ":"), (val) => hex(val)); +} + +function macaddr_join(addr) +{ + return join(":", map(addr, (val) => sprintf("%02x", val))); +} + +function wdev_macaddr(wdev) +{ + return trim(readfile(`/sys/class/net/${wdev}/address`)); +} + +const phy_proto = { + macaddr_init: function(used, options) { + this.macaddr_options = options ?? {}; + this.macaddr_list = {}; + + if (type(used) == "object") + for (let addr in used) + this.macaddr_list[addr] = used[addr]; + else + for (let addr in used) + this.macaddr_list[addr] = -1; + + this.for_each_wdev((wdev) => { + let macaddr = wdev_macaddr(wdev); + this.macaddr_list[macaddr] ??= -1; + }); + + return this.macaddr_list; + }, + + macaddr_generate: function(data) { + let phy = this.name; + let idx = int(data.id ?? 0); + let mbssid = int(data.mbssid ?? 0) > 0; + let num_global = int(data.num_global ?? 1); + let use_global = !mbssid && idx < num_global; + + let base_addr = phy_sysfs_file(phy, "macaddress"); + if (!base_addr) + return null; + + if (!idx && !mbssid) + return base_addr; + + let base_mask = phy_sysfs_file(phy, "address_mask"); + if (!base_mask) + return null; + + if (base_mask == "00:00:00:00:00:00" && idx >= num_global) { + let addrs = split(phy_sysfs_file(phy, "addresses"), "\n"); + + if (idx < length(addrs)) + return addrs[idx]; + + base_mask = "ff:ff:ff:ff:ff:ff"; + } + + let addr = macaddr_split(base_addr); + let mask = macaddr_split(base_mask); + let type; + + if (mbssid) + type = "b5"; + else if (use_global) + type = "add"; + else if (mask[0] > 0) + type = "b1"; + else if (mask[5] < 0xff) + type = "b5"; + else + type = "add"; + + switch (type) { + case "b1": + if (!(addr[0] & 2)) + idx--; + addr[0] |= 2; + addr[0] ^= idx << 2; + break; + case "b5": + if (mbssid) + addr[0] |= 2; + addr[5] ^= idx; + break; + default: + for (let i = 5; i > 0; i--) { + addr[i] += idx; + if (addr[i] < 256) + break; + addr[i] %= 256; + } + break; + } + + return macaddr_join(addr); + }, + + macaddr_next: function(val) { + let data = this.macaddr_options ?? {}; + let list = this.macaddr_list; + + for (let i = 0; i < 32; i++) { + data.id = i; + + let mac = this.macaddr_generate(data); + if (!mac) + return null; + + if (list[mac] != null) + continue; + + list[mac] = val != null ? val : -1; + return mac; + } + }, + + for_each_wdev: function(cb) { + let wdevs = glob(`/sys/class/ieee80211/${this.name}/device/net/*`); + wdevs = map(wdevs, (arg) => basename(arg)); + for (let wdev in wdevs) { + if (basename(readlink(`/sys/class/net/${wdev}/phy80211`)) != this.name) + continue; + + cb(wdev); + } + } +}; + +function phy_open(phy) +{ + let phyidx = readfile(`/sys/class/ieee80211/${phy}/index`); + if (!phyidx) + return null; + + return proto({ + name: phy, + idx: int(phyidx) + }, phy_proto); +} + +const vlist_proto = { + update: function(values, arg) { + let data = this.data; + let cb = this.cb; + let seq = { }; + let new_data = {}; + let old_data = {}; + + this.data = new_data; + + if (type(values) == "object") { + for (let key in values) { + old_data[key] = data[key]; + new_data[key] = values[key]; + delete data[key]; + } + } else { + for (let val in values) { + let cur_key = val[0]; + let cur_obj = val[1]; + + old_data[cur_key] = data[cur_key]; + new_data[cur_key] = val[1]; + delete data[cur_key]; + } + } + + for (let key in data) { + cb(null, data[key], arg); + delete data[key]; + } + for (let key in new_data) + cb(new_data[key], old_data[key], arg); + } +}; + +function is_equal(val1, val2) { + let t1 = type(val1); + + if (t1 != type(val2)) + return false; + + if (t1 == "array") { + if (length(val1) != length(val2)) + return false; + + for (let i = 0; i < length(val1); i++) + if (!is_equal(val1[i], val2[i])) + return false; + + return true; + } else if (t1 == "object") { + for (let key in val1) + if (!is_equal(val1[key], val2[key])) + return false; + for (let key in val2) + if (val1[key] == null) + return false; + return true; + } else { + return val1 == val2; + } +} + +function vlist_new(cb) { + return proto({ + cb: cb, + data: {} + }, vlist_proto); +} + +export { wdev_remove, wdev_create, is_equal, vlist_new, phy_is_fullmac, phy_open }; diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 28bd210623b4d7..c6ae6fb98b0b4b 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -121,6 +121,7 @@ hostapd_common_add_device_config() { config_add_array hostapd_options config_add_int airtime_mode + config_add_int mbssid hostapd_add_log_config } @@ -133,7 +134,8 @@ hostapd_prepare_device_config() { json_get_vars country country3 country_ie beacon_int:100 doth require_mode legacy_rates \ acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ - rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc + rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \ + mbssid:0 hostapd_set_log_options base_cfg @@ -234,6 +236,7 @@ hostapd_prepare_device_config() { [ -n "$rts_threshold" ] && append base_cfg "rts_threshold=$rts_threshold" "$N" [ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" [ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" + [ "$mbssid" -gt 0 ] && [ "$mbssid" -le 2 ] && append base_cfg "mbssid=$mbssid" "$N" json_get_values opts hostapd_options for val in $opts; do @@ -625,8 +628,7 @@ hostapd_set_bss_options() { [ -n "$wpa_strict_rekey" ] && append bss_conf "wpa_strict_rekey=$wpa_strict_rekey" "$N" } - set_default nasid "${macaddr//\:}" - append bss_conf "nas_identifier=$nasid" "$N" + [ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N" [ -n "$acct_interval" ] && \ append bss_conf "radius_acct_interim_interval=$acct_interval" "$N" @@ -864,8 +866,9 @@ hostapd_set_bss_options() { [ "$bss_transition" -eq "1" ] && append bss_conf "bss_transition=1" "$N" [ "$mbo" -eq 1 ] && append bss_conf "mbo=1" "$N" - json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report + json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report rnr set_default ieee80211k 0 + set_default rnr 0 if [ "$ieee80211k" -eq "1" ]; then set_default rrm_neighbor_report 1 set_default rrm_beacon_report 1 @@ -876,6 +879,7 @@ hostapd_set_bss_options() { [ "$rrm_neighbor_report" -eq "1" ] && append bss_conf "rrm_neighbor_report=1" "$N" [ "$rrm_beacon_report" -eq "1" ] && append bss_conf "rrm_beacon_report=1" "$N" + [ "$rnr" -eq "1" ] && append bss_conf "rnr=1" "$N" json_get_vars ftm_responder stationary_ap lci civic set_default ftm_responder 0 @@ -1156,9 +1160,6 @@ hostapd_set_bss_options() { append bss_conf "$val" "$N" done - bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)" - append bss_conf "config_id=$bss_md5sum" "$N" - append "$var" "$bss_conf" "$N" return 0 } @@ -1588,29 +1589,6 @@ EOF return 0 } -wpa_supplicant_run() { - local ifname="$1" - local hostapd_ctrl="$2" - - _wpa_supplicant_common "$ifname" - - ubus wait_for wpa_supplicant - local supplicant_res="$(ubus call wpa_supplicant config_add "{ \ - \"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \ - \"iface\": \"$ifname\", \"config\": \"$_config\" \ - ${network_bridge:+, \"bridge\": \"$network_bridge\"} \ - ${hostapd_ctrl:+, \"hostapd_ctrl\": \"$hostapd_ctrl\"} \ - }")" - - ret="$?" - - [ "$ret" != 0 -o -z "$supplicant_res" ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED - - wireless_add_process "$(jsonfilter -s "$supplicant_res" -l 1 -e @.pid)" "/usr/sbin/wpa_supplicant" 1 1 - - return $ret -} - hostapd_common_cleanup() { killall meshd-nl80211 } diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc new file mode 100644 index 00000000000000..ebf732bea51e2c --- /dev/null +++ b/package/network/services/hostapd/files/hostapd.uc @@ -0,0 +1,809 @@ +let libubus = require("ubus"); +import { open, readfile } from "fs"; +import { wdev_create, wdev_remove, is_equal, vlist_new, phy_is_fullmac, phy_open } from "common"; + +let ubus = libubus.connect(); + +hostapd.data.config = {}; + +hostapd.data.file_fields = { + vlan_file: true, + wpa_psk_file: true, + accept_mac_file: true, + deny_mac_file: true, + eap_user_file: true, + ca_cert: true, + server_cert: true, + server_cert2: true, + private_key: true, + private_key2: true, + dh_file: true, + eap_sim_db: true, +}; + +function iface_remove(cfg) +{ + if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname) + return; + + hostapd.remove_iface(cfg.bss[0].ifname); + for (let bss in cfg.bss) + wdev_remove(bss.ifname); +} + +function iface_gen_config(phy, config, start_disabled) +{ + let str = `data: +${join("\n", config.radio.data)} +channel=${config.radio.channel} +`; + + for (let i = 0; i < length(config.bss); i++) { + let bss = config.bss[i]; + let type = i > 0 ? "bss" : "interface"; + let nasid = bss.nasid ?? replace(bss.bssid, ":", ""); + + str += ` +${type}=${bss.ifname} +bssid=${bss.bssid} +${join("\n", bss.data)} +nas_identifier=${nasid} +`; + if (start_disabled) + str += ` +start_disabled=1 +`; + } + + return str; +} + +function iface_freq_info(iface, config, params) +{ + let freq = params.frequency; + if (!freq) + return null; + + let sec_offset = params.sec_chan_offset; + if (sec_offset != -1 && sec_offset != 1) + sec_offset = 0; + + let width = 0; + for (let line in config.radio.data) { + if (!sec_offset && match(line, /^ht_capab=.*HT40/)) { + sec_offset = null; // auto-detect + continue; + } + + let val = match(line, /^(vht_oper_chwidth|he_oper_chwidth)=(\d+)/); + if (!val) + continue; + + val = int(val[2]); + if (val > width) + width = val; + } + + if (freq < 4000) + width = 0; + + return hostapd.freq_info(freq, sec_offset, width); +} + +function iface_add(phy, config, phy_status) +{ + let config_inline = iface_gen_config(phy, config, !!phy_status); + + let bss = config.bss[0]; + let ret = hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`); + if (ret < 0) + return false; + + if (!phy_status) + return true; + + let iface = hostapd.interfaces[bss.ifname]; + if (!iface) + return false; + + let freq_info = iface_freq_info(iface, config, phy_status); + + return iface.start(freq_info) >= 0; +} + +function iface_config_macaddr_list(config) +{ + let macaddr_list = {}; + for (let i = 0; i < length(config.bss); i++) { + let bss = config.bss[i]; + if (!bss.default_macaddr) + macaddr_list[bss.bssid] = i; + } + + return macaddr_list; +} + +function iface_restart(phydev, config, old_config) +{ + let phy = phydev.name; + + iface_remove(old_config); + iface_remove(config); + + if (!config.bss || !config.bss[0]) { + hostapd.printf(`No bss for phy ${phy}`); + return; + } + + phydev.macaddr_init(iface_config_macaddr_list(config)); + for (let i = 0; i < length(config.bss); i++) { + let bss = config.bss[i]; + if (bss.default_macaddr) + bss.bssid = phydev.macaddr_next(); + } + + let bss = config.bss[0]; + let err = wdev_create(phy, bss.ifname, { mode: "ap" }); + if (err) + hostapd.printf(`Failed to create ${bss.ifname} on phy ${phy}: ${err}`); + + let ubus = hostapd.data.ubus; + let phy_status = ubus.call("wpa_supplicant", "phy_status", { phy: phy }); + if (phy_status && phy_status.state == "COMPLETED") { + if (iface_add(phy, config, phy_status)) + return; + + hostapd.printf(`Failed to bring up phy ${phy} ifname=${bss.ifname} with supplicant provided frequency`); + } + + ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: true }); + if (!iface_add(phy, config)) + hostapd.printf(`hostapd.add_iface failed for phy ${phy} ifname=${bss.ifname}`); + ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: false }); +} + +function array_to_obj(arr, key, start) +{ + let obj = {}; + + start ??= 0; + for (let i = start; i < length(arr); i++) { + let cur = arr[i]; + obj[cur[key]] = cur; + } + + return obj; +} + +function find_array_idx(arr, key, val) +{ + for (let i = 0; i < length(arr); i++) + if (arr[i][key] == val) + return i; + + return -1; +} + +function bss_reload_psk(bss, config, old_config) +{ + if (is_equal(old_config.hash.wpa_psk_file, config.hash.wpa_psk_file)) + return; + + old_config.hash.wpa_psk_file = config.hash.wpa_psk_file; + if (!is_equal(old_config, config)) + return; + + let ret = bss.ctrl("RELOAD_WPA_PSK"); + ret ??= "failed"; + + hostapd.printf(`Reload WPA PSK file for bss ${config.ifname}: ${ret}`); +} + +function remove_file_fields(config) +{ + return filter(config, (line) => !hostapd.data.file_fields[split(line, "=")[0]]); +} + +function bss_remove_file_fields(config) +{ + let new_cfg = {}; + + for (let key in config) + new_cfg[key] = config[key]; + new_cfg.data = remove_file_fields(new_cfg.data); + new_cfg.hash = {}; + for (let key in config.hash) + new_cfg.hash[key] = config.hash[key]; + delete new_cfg.hash.wpa_psk_file; + delete new_cfg.hash.vlan_file; + + return new_cfg; +} + +function bss_config_hash(config) +{ + return hostapd.sha1(remove_file_fields(config) + ""); +} + +function bss_find_existing(config, prev_config, prev_hash) +{ + let hash = bss_config_hash(config.data); + + for (let i = 0; i < length(prev_config.bss); i++) { + if (!prev_hash[i] || hash != prev_hash[i]) + continue; + + prev_hash[i] = null; + return i; + } + + return -1; +} + +function get_config_bss(config, idx) +{ + if (!config.bss[idx]) { + hostapd.printf(`Invalid bss index ${idx}`); + return null; + } + + let ifname = config.bss[idx].ifname; + if (!ifname) + hostapd.printf(`Could not find bss ${config.bss[idx].ifname}`); + + return hostapd.bss[ifname]; +} + +function iface_reload_config(phydev, config, old_config) +{ + let phy = phydev.name; + + if (!old_config || !is_equal(old_config.radio, config.radio)) + return false; + + if (is_equal(old_config.bss, config.bss)) + return true; + + if (!old_config.bss || !old_config.bss[0]) + return false; + + let iface_name = old_config.bss[0].ifname; + let iface = hostapd.interfaces[iface_name]; + if (!iface) { + hostapd.printf(`Could not find previous interface ${iface_name}`); + return false; + } + + let first_bss = hostapd.bss[iface_name]; + if (!first_bss) { + hostapd.printf(`Could not find bss of previous interface ${iface_name}`); + return false; + } + + let macaddr_list = iface_config_macaddr_list(config); + let bss_list = []; + let bss_list_cfg = []; + let prev_bss_hash = []; + + for (let bss in old_config.bss) { + let hash = bss_config_hash(bss.data); + push(prev_bss_hash, bss_config_hash(bss.data)); + } + + // Step 1: find (possibly renamed) interfaces with the same config + // and store them in the new order (with gaps) + for (let i = 0; i < length(config.bss); i++) { + let prev; + + // For fullmac devices, the first interface needs to be preserved, + // since it's treated as the master + if (!i && phy_is_fullmac(phy)) { + prev = 0; + prev_bss_hash[0] = null; + } else { + prev = bss_find_existing(config.bss[i], old_config, prev_bss_hash); + } + if (prev < 0) + continue; + + let cur_config = config.bss[i]; + let prev_config = old_config.bss[prev]; + + let prev_bss = get_config_bss(old_config, prev); + if (!prev_bss) + return false; + + // try to preserve MAC address of this BSS by reassigning another + // BSS if necessary + if (cur_config.default_macaddr && + !macaddr_list[prev_config.bssid]) { + macaddr_list[prev_config.bssid] = i; + cur_config.bssid = prev_config.bssid; + } + + bss_list[i] = prev_bss; + bss_list_cfg[i] = old_config.bss[prev]; + } + + if (config.mbssid && !bss_list_cfg[0]) { + hostapd.printf("First BSS changed with MBSSID enabled"); + return false; + } + + // Step 2: if none were found, rename and preserve the first one + if (length(bss_list) == 0) { + // can't change the bssid of the first bss + if (config.bss[0].bssid != old_config.bss[0].bssid) { + if (!config.bss[0].default_macaddr) { + hostapd.printf(`BSSID of first interface changed: ${lc(old_config.bss[0].bssid)} -> ${lc(config.bss[0].bssid)}`); + return false; + } + + config.bss[0].bssid = old_config.bss[0].bssid; + } + + let prev_bss = get_config_bss(old_config, 0); + if (!prev_bss) + return false; + + macaddr_list[config.bss[0].bssid] = 0; + bss_list[0] = prev_bss; + bss_list_cfg[0] = old_config.bss[0]; + prev_bss_hash[0] = null; + } + + // Step 3: delete all unused old interfaces + for (let i = 0; i < length(prev_bss_hash); i++) { + if (!prev_bss_hash[i]) + continue; + + let prev_bss = get_config_bss(old_config, i); + if (!prev_bss) + return false; + + let ifname = old_config.bss[i].ifname; + hostapd.printf(`Remove bss '${ifname}' on phy '${phy}'`); + prev_bss.delete(); + wdev_remove(ifname); + } + + // Step 4: rename preserved interfaces, use temporary name on duplicates + let rename_list = []; + for (let i = 0; i < length(bss_list); i++) { + if (!bss_list[i]) + continue; + + let old_ifname = bss_list_cfg[i].ifname; + let new_ifname = config.bss[i].ifname; + if (old_ifname == new_ifname) + continue; + + if (hostapd.bss[new_ifname]) { + new_ifname = "tmp_" + substr(hostapd.sha1(new_ifname), 0, 8); + push(rename_list, i); + } + + hostapd.printf(`Rename bss ${old_ifname} to ${new_ifname}`); + if (!bss_list[i].rename(new_ifname)) { + hostapd.printf(`Failed to rename bss ${old_ifname} to ${new_ifname}`); + return false; + } + + bss_list_cfg[i].ifname = new_ifname; + } + + // Step 5: rename interfaces with temporary names + for (let i in rename_list) { + let new_ifname = config.bss[i].ifname; + if (!bss_list[i].rename(new_ifname)) { + hostapd.printf(`Failed to rename bss to ${new_ifname}`); + return false; + } + bss_list_cfg[i].ifname = new_ifname; + } + + // Step 6: assign BSSID for newly created interfaces + let macaddr_data = { + num_global: config.num_global_macaddr ?? 1, + mbssid: config.mbssid ?? 0, + }; + macaddr_list = phydev.macaddr_init(macaddr_list, macaddr_data); + for (let i = 0; i < length(config.bss); i++) { + if (bss_list[i]) + continue; + let bsscfg = config.bss[i]; + + let mac_idx = macaddr_list[bsscfg.bssid]; + if (mac_idx < 0) + macaddr_list[bsscfg.bssid] = i; + if (mac_idx == i) + continue; + + // statically assigned bssid of the new interface is in conflict + // with the bssid of a reused interface. reassign the reused interface + if (!bsscfg.default_macaddr) { + // can't update bssid of the first BSS, need to restart + if (!mac_idx < 0) + return false; + + bsscfg = config.bss[mac_idx]; + } + + let addr = phydev.macaddr_next(i); + if (!addr) { + hostapd.printf(`Failed to generate mac address for phy ${phy}`); + return false; + } + bsscfg.bssid = addr; + } + + let config_inline = iface_gen_config(phy, config); + + // Step 7: fill in the gaps with new interfaces + for (let i = 0; i < length(config.bss); i++) { + let ifname = config.bss[i].ifname; + let bss = bss_list[i]; + + if (bss) + continue; + + hostapd.printf(`Add bss ${ifname} on phy ${phy}`); + bss_list[i] = iface.add_bss(config_inline, i); + if (!bss_list[i]) { + hostapd.printf(`Failed to add new bss ${ifname} on phy ${phy}`); + return false; + } + } + + // Step 8: update interface bss order + if (!iface.set_bss_order(bss_list)) { + hostapd.printf(`Failed to update BSS order on phy '${phy}'`); + return false; + } + + // Step 9: update config + for (let i = 0; i < length(config.bss); i++) { + if (!bss_list_cfg[i]) + continue; + + let ifname = config.bss[i].ifname; + let bss = bss_list[i]; + + if (is_equal(config.bss[i], bss_list_cfg[i])) + continue; + + if (is_equal(bss_remove_file_fields(config.bss[i]), + bss_remove_file_fields(bss_list_cfg[i]))) { + hostapd.printf(`Update config data files for bss ${ifname}`); + if (bss.set_config(config_inline, i, true) < 0) { + hostapd.printf(`Could not update config data files for bss ${ifname}`); + return false; + } else { + bss.ctrl("RELOAD_WPA_PSK"); + continue; + } + } + + bss_reload_psk(bss, config.bss[i], bss_list_cfg[i]); + if (is_equal(config.bss[i], bss_list_cfg[i])) + continue; + + hostapd.printf(`Reload config for bss '${config.bss[0].ifname}' on phy '${phy}'`); + if (bss.set_config(config_inline, i) < 0) { + hostapd.printf(`Failed to set config for bss ${ifname}`); + return false; + } + } + + return true; +} + +function iface_update_supplicant_macaddr(phy, config) +{ + let macaddr_list = []; + for (let i = 0; i < length(config.bss); i++) + push(macaddr_list, config.bss[i].bssid); + ubus.call("wpa_supplicant", "phy_set_macaddr_list", { phy: phy, macaddr: macaddr_list }); +} + +function iface_set_config(phy, config) +{ + let old_config = hostapd.data.config[phy]; + + hostapd.data.config[phy] = config; + + if (!config) + return iface_remove(old_config); + + let phydev = phy_open(phy); + if (!phydev) { + hostapd.printf(`Failed to open phy ${phy}`); + return false; + } + + try { + let ret = iface_reload_config(phydev, config, old_config); + if (ret) { + iface_update_supplicant_macaddr(phy, config); + hostapd.printf(`Reloaded settings for phy ${phy}`); + return 0; + } + } catch (e) { + hostapd.printf(`Error reloading config: ${e}\n${e.stacktrace[0].context}`); + } + + hostapd.printf(`Restart interface for phy ${phy}`); + let ret = iface_restart(phydev, config, old_config); + iface_update_supplicant_macaddr(phy, config); + + return ret; +} + +function config_add_bss(config, name) +{ + let bss = { + ifname: name, + data: [], + hash: {} + }; + + push(config.bss, bss); + + return bss; +} + +function iface_load_config(filename) +{ + let f = open(filename, "r"); + if (!f) + return null; + + let config = { + radio: { + data: [] + }, + bss: [], + orig_file: filename, + }; + + let bss; + let line; + while ((line = trim(f.read("line"))) != null) { + let val = split(line, "=", 2); + if (!val[0]) + continue; + + if (val[0] == "interface") { + bss = config_add_bss(config, val[1]); + break; + } + + if (val[0] == "channel") { + config.radio.channel = val[1]; + continue; + } + + if (val[0] == "#num_global_macaddr" || + val[0] == "mbssid") + config[val[0]] = int(val[1]); + + push(config.radio.data, line); + } + + while ((line = trim(f.read("line"))) != null) { + if (line == "#default_macaddr") + bss.default_macaddr = true; + + let val = split(line, "=", 2); + if (!val[0]) + continue; + + if (val[0] == "bssid") { + bss.bssid = lc(val[1]); + continue; + } + + if (val[0] == "nas_identifier") + bss.nasid = val[1]; + + if (val[0] == "bss") { + bss = config_add_bss(config, val[1]); + continue; + } + + if (hostapd.data.file_fields[val[0]]) + bss.hash[val[0]] = hostapd.sha1(readfile(val[1])); + + push(bss.data, line); + } + f.close(); + + return config; +} + +function ex_wrap(func) { + return (req) => { + try { + let ret = func(req); + return ret; + } catch(e) { + hostapd.printf(`Exception in ubus function: ${e}\n${e.stacktrace[0].context}`); + } + return libubus.STATUS_UNKNOWN_ERROR; + }; +} + +let main_obj = { + reload: { + args: { + phy: "", + }, + call: ex_wrap(function(req) { + let phy_list = req.args.phy ? [ req.args.phy ] : keys(hostapd.data.config); + for (let phy_name in phy_list) { + let phy = hostapd.data.config[phy_name]; + let config = iface_load_config(phy.orig_file); + iface_set_config(phy_name, config); + } + + return 0; + }) + }, + apsta_state: { + args: { + phy: "", + up: true, + frequency: 0, + sec_chan_offset: 0, + csa: true, + csa_count: 0, + }, + call: ex_wrap(function(req) { + if (req.args.up == null || !req.args.phy) + return libubus.STATUS_INVALID_ARGUMENT; + + let phy = req.args.phy; + let config = hostapd.data.config[phy]; + if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname) + return 0; + + let iface = hostapd.interfaces[config.bss[0].ifname]; + if (!iface) + return 0; + + if (!req.args.up) { + iface.stop(); + return 0; + } + + if (!req.args.frequency) + return libubus.STATUS_INVALID_ARGUMENT; + + let freq_info = iface_freq_info(iface, config, req.args); + if (!freq_info) + return libubus.STATUS_UNKNOWN_ERROR; + + let ret; + if (req.args.csa) { + freq_info.csa_count = req.args.csa_count ?? 10; + ret = iface.switch_channel(freq_info); + } else { + ret = iface.start(freq_info); + } + if (!ret) + return libubus.STATUS_UNKNOWN_ERROR; + + return 0; + }) + }, + config_get_macaddr_list: { + args: { + phy: "" + }, + call: ex_wrap(function(req) { + let phy = req.args.phy; + if (!phy) + return libubus.STATUS_INVALID_ARGUMENT; + + let ret = { + macaddr: [], + }; + + let config = hostapd.data.config[phy]; + if (!config) + return ret; + + ret.macaddr = map(config.bss, (bss) => bss.bssid); + return ret; + }) + }, + config_set: { + args: { + phy: "", + config: "", + prev_config: "", + }, + call: ex_wrap(function(req) { + let phy = req.args.phy; + let file = req.args.config; + let prev_file = req.args.prev_config; + + if (!phy) + return libubus.STATUS_INVALID_ARGUMENT; + + if (prev_file && !hostapd.data.config[phy]) { + let config = iface_load_config(prev_file); + if (config) + config.radio.data = []; + hostapd.data.config[phy] = config; + } + + let config = iface_load_config(file); + + hostapd.printf(`Set new config for phy ${phy}: ${file}`); + iface_set_config(phy, config); + + return { + pid: hostapd.getpid() + }; + }) + }, + config_add: { + args: { + iface: "", + config: "", + }, + call: ex_wrap(function(req) { + if (!req.args.iface || !req.args.config) + return libubus.STATUS_INVALID_ARGUMENT; + + if (hostapd.add_iface(`bss_config=${req.args.iface}:${req.args.config}`) < 0) + return libubus.STATUS_INVALID_ARGUMENT; + + return { + pid: hostapd.getpid() + }; + }) + }, + config_remove: { + args: { + iface: "" + }, + call: ex_wrap(function(req) { + if (!req.args.iface) + return libubus.STATUS_INVALID_ARGUMENT; + + hostapd.remove_iface(req.args.iface); + return 0; + }) + }, +}; + +hostapd.data.ubus = ubus; +hostapd.data.obj = ubus.publish("hostapd", main_obj); + +function bss_event(type, name, data) { + let ubus = hostapd.data.ubus; + + data ??= {}; + data.name = name; + hostapd.data.obj.notify(`bss.${type}`, data, null, null, null, -1); + ubus.call("service", "event", { type: `hostapd.${name}.${type}`, data: {} }); +} + +return { + shutdown: function() { + for (let phy in hostapd.data.config) + iface_set_config(phy, null); + hostapd.ubus.disconnect(); + }, + bss_add: function(name, obj) { + bss_event("add", name); + }, + bss_reload: function(name, obj, reconf) { + bss_event("reload", name, { reconf: reconf != 0 }); + }, + bss_remove: function(name, obj) { + bss_event("remove", name); + } +}; diff --git a/package/network/services/hostapd/files/radius.clients b/package/network/services/hostapd/files/radius.clients new file mode 100644 index 00000000000000..3175dcfd04af11 --- /dev/null +++ b/package/network/services/hostapd/files/radius.clients @@ -0,0 +1 @@ +0.0.0.0/0 radius diff --git a/package/network/services/hostapd/files/radius.config b/package/network/services/hostapd/files/radius.config new file mode 100644 index 00000000000000..ad8730748bb5ba --- /dev/null +++ b/package/network/services/hostapd/files/radius.config @@ -0,0 +1,9 @@ +config radius + option disabled '1' + option ca_cert '/etc/radius/ca.pem' + option cert '/etc/radius/cert.pem' + option key '/etc/radius/key.pem' + option users '/etc/radius/users' + option clients '/etc/radius/clients' + option auth_port '1812' + option acct_port '1813' diff --git a/package/network/services/hostapd/files/radius.init b/package/network/services/hostapd/files/radius.init new file mode 100644 index 00000000000000..4c562c2473877e --- /dev/null +++ b/package/network/services/hostapd/files/radius.init @@ -0,0 +1,42 @@ +#!/bin/sh /etc/rc.common + +START=30 + +USE_PROCD=1 +NAME=radius + +radius_start() { + local cfg="$1" + + config_get_bool disabled "$cfg" disabled 0 + + [ "$disabled" -gt 0 ] && return + + config_get ca "$cfg" ca_cert + config_get key "$cfg" key + config_get cert "$cfg" cert + config_get users "$cfg" users + config_get clients "$cfg" clients + config_get auth_port "$cfg" auth_port 1812 + config_get acct_port "$cfg" acct_port 1813 + config_get identity "$cfg" identity "$(cat /proc/sys/kernel/hostname)" + + procd_open_instance $cfg + procd_set_param command /usr/sbin/hostapd-radius \ + -C "$ca" \ + -c "$cert" -k "$key" \ + -s "$clients" -u "$users" \ + -p "$auth_port" -P "$acct_port" \ + -i "$identity" + procd_close_instance +} + +start_service() { + config_load radius + config_foreach radius_start radius +} + +service_triggers() +{ + procd_add_reload_trigger "radius" +} diff --git a/package/network/services/hostapd/files/radius.users b/package/network/services/hostapd/files/radius.users new file mode 100644 index 00000000000000..03e2fc8fae7d97 --- /dev/null +++ b/package/network/services/hostapd/files/radius.users @@ -0,0 +1,14 @@ +{ + "phase1": { + "wildcard": [ + { + "name": "*", + "methods": [ "PEAP" ] + } + ] + }, + "phase2": { + "users": { + } + } +} diff --git a/package/network/services/hostapd/files/wdev.uc b/package/network/services/hostapd/files/wdev.uc new file mode 100644 index 00000000000000..8a031b40b9ee2d --- /dev/null +++ b/package/network/services/hostapd/files/wdev.uc @@ -0,0 +1,207 @@ +#!/usr/bin/env ucode +'use strict'; +import { vlist_new, is_equal, wdev_create, wdev_remove, phy_open } from "/usr/share/hostap/common.uc"; +import { readfile, writefile, basename, readlink, glob } from "fs"; +let libubus = require("ubus"); + +let keep_devices = {}; +let phy = shift(ARGV); +let command = shift(ARGV); +let phydev; + +const mesh_params = [ + "mesh_retry_timeout", "mesh_confirm_timeout", "mesh_holding_timeout", "mesh_max_peer_links", + "mesh_max_retries", "mesh_ttl", "mesh_element_ttl", "mesh_hwmp_max_preq_retries", + "mesh_path_refresh_time", "mesh_min_discovery_timeout", "mesh_hwmp_active_path_timeout", + "mesh_hwmp_preq_min_interval", "mesh_hwmp_net_diameter_traversal_time", "mesh_hwmp_rootmode", + "mesh_hwmp_rann_interval", "mesh_gate_announcements", "mesh_sync_offset_max_neighor", + "mesh_rssi_threshold", "mesh_hwmp_active_path_to_root_timeout", "mesh_hwmp_root_interval", + "mesh_hwmp_confirmation_interval", "mesh_awake_window", "mesh_plink_timeout", + "mesh_auto_open_plinks", "mesh_fwding", "mesh_power_mode" +]; + +function iface_stop(wdev) +{ + if (keep_devices[wdev.ifname]) + return; + + wdev_remove(wdev.ifname); +} + +function iface_start(wdev) +{ + let ifname = wdev.ifname; + + if (readfile(`/sys/class/net/${ifname}/ifindex`)) { + system([ "ip", "link", "set", "dev", ifname, "down" ]); + wdev_remove(ifname); + } + let wdev_config = {}; + for (let key in wdev) + wdev_config[key] = wdev[key]; + if (!wdev_config.macaddr && wdev.mode != "monitor") + wdev_config.macaddr = phydev.macaddr_next(); + wdev_create(phy, ifname, wdev); + system([ "ip", "link", "set", "dev", ifname, "up" ]); + if (wdev.freq) + system(`iw dev ${ifname} set freq ${wdev.freq} ${wdev.htmode}`); + if (wdev.mode == "adhoc") { + let cmd = ["iw", "dev", ifname, "ibss", "join", wdev.ssid, wdev.freq, wdev.htmode, "fixed-freq" ]; + if (wdev.bssid) + push(cmd, wdev.bssid); + for (let key in [ "beacon-interval", "basic-rates", "mcast-rate", "keys" ]) + if (wdev[key]) + push(cmd, key, wdev[key]); + system(cmd); + } else if (wdev.mode == "mesh") { + let cmd = [ "iw", "dev", ifname, "mesh", "join", wdev.ssid, "freq", wdev.freq, wdev.htmode ]; + for (let key in [ "mcast-rate", "beacon-interval" ]) + if (wdev[key]) + push(cmd, key, wdev[key]); + system(cmd); + + cmd = ["iw", "dev", ifname, "set", "mesh_param" ]; + let len = length(cmd); + + for (let param in mesh_params) + if (wdev[param]) + push(cmd, param, wdev[param]); + + if (len == length(cmd)) + return; + + system(cmd); + } + +} + +function iface_cb(new_if, old_if) +{ + if (old_if && new_if && is_equal(old_if, new_if)) + return; + + if (old_if) + iface_stop(old_if); + if (new_if) + iface_start(new_if); +} + +function drop_inactive(config) +{ + for (let key in config) { + if (!readfile(`/sys/class/net/${key}/ifindex`)) + delete config[key]; + } +} + +function add_ifname(config) +{ + for (let key in config) + config[key].ifname = key; +} + +function delete_ifname(config) +{ + for (let key in config) + delete config[key].ifname; +} + +function add_existing(phy, config) +{ + let wdevs = glob(`/sys/class/ieee80211/${phy}/device/net/*`); + wdevs = map(wdevs, (arg) => basename(arg)); + for (let wdev in wdevs) { + if (config[wdev]) + continue; + + if (basename(readlink(`/sys/class/net/${wdev}/phy80211`)) != phy) + continue; + + if (trim(readfile(`/sys/class/net/${wdev}/operstate`)) == "down") + config[wdev] = {}; + } +} + +function usage() +{ + warn(`Usage: ${basename(sourcepath())} [] + +Commands: + set_config [ - get phy MAC address for vif index +`); + exit(1); +} + +const commands = { + set_config: function(args) { + let statefile = `/var/run/wdev-${phy}.json`; + + let new_config = shift(args); + for (let dev in ARGV) + keep_devices[dev] = true; + + if (!new_config) + usage(); + + new_config = json(new_config); + if (!new_config) { + warn("Invalid configuration\n"); + exit(1); + } + + let old_config = readfile(statefile); + if (old_config) + old_config = json(old_config); + + let config = vlist_new(iface_cb); + if (type(old_config) == "object") + config.data = old_config; + + add_existing(phy, config.data); + add_ifname(config.data); + drop_inactive(config.data); + + let ubus = libubus.connect(); + let data = ubus.call("hostapd", "config_get_macaddr_list", { phy: phy }); + let macaddr_list = []; + if (type(data) == "object" && data.macaddr) + macaddr_list = data.macaddr; + ubus.disconnect(); + phydev.macaddr_init(macaddr_list); + + add_ifname(new_config); + config.update(new_config); + + drop_inactive(config.data); + delete_ifname(config.data); + writefile(statefile, sprintf("%J", config.data)); + }, + get_macaddr: function(args) { + let data = {}; + + for (let arg in args) { + arg = split(arg, "=", 2); + data[arg[0]] = arg[1]; + } + + let macaddr = phydev.macaddr_generate(data); + if (!macaddr) { + warn(`Could not get MAC address for phy ${phy}\n`); + exit(1); + } + + print(macaddr + "\n"); + }, +}; + +if (!phy || !command | !commands[command]) + usage(); + +phydev = phy_open(phy); +if (!phydev) { + warn(`PHY ${phy} does not exist\n`); + exit(1); +} + +commands[command](ARGV); diff --git a/package/network/services/hostapd/files/wpa_supplicant-basic.config b/package/network/services/hostapd/files/wpa_supplicant-basic.config index 6abd8e2331aa13..944b4d92876002 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-basic.config +++ b/package/network/services/hostapd/files/wpa_supplicant-basic.config @@ -26,7 +26,7 @@ # replacement for WEXT and its use allows wpa_supplicant to properly control # the driver to improve existing functionality like roaming and to support new # functionality. -CONFIG_DRIVER_WEXT=y +#CONFIG_DRIVER_WEXT=y # Driver interface for Linux drivers using the nl80211 kernel interface CONFIG_DRIVER_NL80211=y diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config index d24fbbb01f1723..b39dabca0696b5 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-full.config +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config @@ -26,7 +26,7 @@ # replacement for WEXT and its use allows wpa_supplicant to properly control # the driver to improve existing functionality like roaming and to support new # functionality. -CONFIG_DRIVER_WEXT=y +#CONFIG_DRIVER_WEXT=y # Driver interface for Linux drivers using the nl80211 kernel interface CONFIG_DRIVER_NL80211=y diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config index 9eb1111e523e59..2a3f8fb69de337 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config @@ -26,7 +26,7 @@ # replacement for WEXT and its use allows wpa_supplicant to properly control # the driver to improve existing functionality like roaming and to support new # functionality. -CONFIG_DRIVER_WEXT=y +#CONFIG_DRIVER_WEXT=y # Driver interface for Linux drivers using the nl80211 kernel interface CONFIG_DRIVER_NL80211=y diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config index 0dcc88e6486dff..7f5140622cc15a 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config @@ -26,7 +26,7 @@ # replacement for WEXT and its use allows wpa_supplicant to properly control # the driver to improve existing functionality like roaming and to support new # functionality. -CONFIG_DRIVER_WEXT=y +#CONFIG_DRIVER_WEXT=y # Driver interface for Linux drivers using the nl80211 kernel interface CONFIG_DRIVER_NL80211=y diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc new file mode 100644 index 00000000000000..cb5f41b1af3ac0 --- /dev/null +++ b/package/network/services/hostapd/files/wpa_supplicant.uc @@ -0,0 +1,330 @@ +let libubus = require("ubus"); +import { open, readfile } from "fs"; +import { wdev_create, wdev_remove, is_equal, vlist_new, phy_open } from "common"; + +let ubus = libubus.connect(); + +wpas.data.config = {}; +wpas.data.iface_phy = {}; +wpas.data.macaddr_list = {}; + +function iface_stop(iface) +{ + let ifname = iface.config.iface; + + if (!iface.running) + return; + + delete wpas.data.iface_phy[ifname]; + wpas.remove_iface(ifname); + wdev_remove(ifname); + iface.running = false; +} + +function iface_start(phydev, iface, macaddr_list) +{ + let phy = phydev.name; + + if (iface.running) + return; + + let ifname = iface.config.iface; + let wdev_config = {}; + for (let field in iface.config) + wdev_config[field] = iface.config[field]; + if (!wdev_config.macaddr) + wdev_config.macaddr = phydev.macaddr_next(); + + wpas.data.iface_phy[ifname] = phy; + wdev_remove(ifname); + let ret = wdev_create(phy, ifname, wdev_config); + if (ret) + wpas.printf(`Failed to create device ${ifname}: ${ret}`); + wpas.add_iface(iface.config); + iface.running = true; +} + +function iface_cb(new_if, old_if) +{ + if (old_if && new_if && is_equal(old_if.config, new_if.config)) { + new_if.running = old_if.running; + return; + } + + if (new_if && old_if) + wpas.printf(`Update configuration for interface ${old_if.config.iface}`); + else if (old_if) + wpas.printf(`Remove interface ${old_if.config.iface}`); + + if (old_if) + iface_stop(old_if); +} + +function prepare_config(config) +{ + config.config_data = readfile(config.config); + + return { config: config }; +} + +function set_config(phy_name, config_list) +{ + let phy = wpas.data.config[phy_name]; + + if (!phy) { + phy = vlist_new(iface_cb, false); + wpas.data.config[phy_name] = phy; + } + + let values = []; + for (let config in config_list) + push(values, [ config.iface, prepare_config(config) ]); + + phy.update(values); +} + +function start_pending(phy_name) +{ + let phy = wpas.data.config[phy_name]; + let ubus = wpas.data.ubus; + + if (!phy || !phy.data) + return; + + let phydev = phy_open(phy_name); + if (!phydev) { + wpas.printf(`Could not open phy ${phy_name}`); + return; + } + + let macaddr_list = wpas.data.macaddr_list[phy_name]; + phydev.macaddr_init(macaddr_list); + + for (let ifname in phy.data) + iface_start(phydev, phy.data[ifname]); +} + +let main_obj = { + phy_set_state: { + args: { + phy: "", + stop: true, + }, + call: function(req) { + if (!req.args.phy || req.args.stop == null) + return libubus.STATUS_INVALID_ARGUMENT; + + let phy = wpas.data.config[req.args.phy]; + if (!phy) + return libubus.STATUS_NOT_FOUND; + + try { + if (req.args.stop) { + for (let ifname in phy.data) + iface_stop(phy.data[ifname]); + } else { + start_pending(req.args.phy); + } + } catch (e) { + wpas.printf(`Error chaging state: ${e}\n${e.stacktrace[0].context}`); + return libubus.STATUS_INVALID_ARGUMENT; + } + return 0; + } + }, + phy_set_macaddr_list: { + args: { + phy: "", + macaddr: [], + }, + call: function(req) { + let phy = req.args.phy; + if (!phy) + return libubus.STATUS_INVALID_ARGUMENT; + + wpas.data.macaddr_list[phy] = req.args.macaddr; + return 0; + } + }, + phy_status: { + args: { + phy: "" + }, + call: function(req) { + if (!req.args.phy) + return libubus.STATUS_INVALID_ARGUMENT; + + let phy = wpas.data.config[req.args.phy]; + if (!phy) + return libubus.STATUS_NOT_FOUND; + + for (let ifname in phy.data) { + try { + let iface = wpas.interfaces[ifname]; + if (!iface) + continue; + + let status = iface.status(); + if (!status) + continue; + + if (status.state == "INTERFACE_DISABLED") + continue; + + status.ifname = ifname; + return status; + } catch (e) { + continue; + } + } + + return libubus.STATUS_NOT_FOUND; + } + }, + config_set: { + args: { + phy: "", + config: [], + defer: true, + }, + call: function(req) { + if (!req.args.phy) + return libubus.STATUS_INVALID_ARGUMENT; + + wpas.printf(`Set new config for phy ${req.args.phy}`); + try { + if (req.args.config) + set_config(req.args.phy, req.args.config); + + if (!req.args.defer) + start_pending(req.args.phy); + } catch (e) { + wpas.printf(`Error loading config: ${e}\n${e.stacktrace[0].context}`); + return libubus.STATUS_INVALID_ARGUMENT; + } + + return { + pid: wpas.getpid() + }; + } + }, + config_add: { + args: { + driver: "", + iface: "", + bridge: "", + hostapd_ctrl: "", + ctrl: "", + config: "", + }, + call: function(req) { + if (!req.args.iface || !req.args.config) + return libubus.STATUS_INVALID_ARGUMENT; + + if (wpas.add_iface(req.args) < 0) + return libubus.STATUS_INVALID_ARGUMENT; + + return { + pid: wpas.getpid() + }; + } + }, + config_remove: { + args: { + iface: "" + }, + call: function(req) { + if (!req.args.iface) + return libubus.STATUS_INVALID_ARGUMENT; + + wpas.remove_iface(req.args.iface); + return 0; + } + }, +}; + +wpas.data.ubus = ubus; +wpas.data.obj = ubus.publish("wpa_supplicant", main_obj); + +function iface_event(type, name, data) { + let ubus = wpas.data.ubus; + + data ??= {}; + data.name = name; + wpas.data.obj.notify(`iface.${type}`, data, null, null, null, -1); + ubus.call("service", "event", { type: `wpa_supplicant.${name}.${type}`, data: {} }); +} + +function iface_hostapd_notify(phy, ifname, iface, state) +{ + let ubus = wpas.data.ubus; + let status = iface.status(); + let msg = { phy: phy }; + + switch (state) { + case "DISCONNECTED": + case "AUTHENTICATING": + case "SCANNING": + msg.up = false; + break; + case "INTERFACE_DISABLED": + case "INACTIVE": + msg.up = true; + break; + case "COMPLETED": + msg.up = true; + msg.frequency = status.frequency; + msg.sec_chan_offset = status.sec_chan_offset; + break; + default: + return; + } + + ubus.call("hostapd", "apsta_state", msg); +} + +function iface_channel_switch(phy, ifname, iface, info) +{ + let msg = { + phy: phy, + up: true, + csa: true, + csa_count: info.csa_count ? info.csa_count - 1 : 0, + frequency: info.frequency, + sec_chan_offset: info.sec_chan_offset, + }; + ubus.call("hostapd", "apsta_state", msg); +} + +return { + shutdown: function() { + for (let phy in wpas.data.config) + set_config(phy, []); + wpas.ubus.disconnect(); + }, + iface_add: function(name, obj) { + iface_event("add", name); + }, + iface_remove: function(name, obj) { + iface_event("remove", name); + }, + state: function(ifname, iface, state) { + let phy = wpas.data.iface_phy[ifname]; + if (!phy) { + wpas.printf(`no PHY for ifname ${ifname}`); + return; + } + + iface_hostapd_notify(phy, ifname, iface, state); + }, + event: function(ifname, iface, ev, info) { + let phy = wpas.data.iface_phy[ifname]; + if (!phy) { + wpas.printf(`no PHY for ifname ${ifname}`); + return; + } + + if (ev == "CH_SWITCH_STARTED") + iface_channel_switch(phy, ifname, iface, info); + } +}; diff --git a/package/network/services/hostapd/files/wpad_acl.json b/package/network/services/hostapd/files/wpad_acl.json index c77ccd8ea0c0bb..d00fd945ba5824 100644 --- a/package/network/services/hostapd/files/wpad_acl.json +++ b/package/network/services/hostapd/files/wpad_acl.json @@ -3,6 +3,12 @@ "access": { "service": { "methods": [ "event" ] + }, + "wpa_supplicant": { + "methods": [ "phy_set_state", "phy_set_macaddr_list", "phy_status" ] + }, + "hostapd": { + "methods": [ "apsta_state" ] } }, "publish": [ "hostapd", "hostapd.*", "wpa_supplicant", "wpa_supplicant.*" ], diff --git a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch index 9b11f0e8031033..07b7a5971d3e00 100644 --- a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch +++ b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch @@ -29,7 +29,7 @@ Signed-off-by: Markus Theil enum dfs_channel_type { -@@ -521,9 +522,14 @@ dfs_get_valid_channel(struct hostapd_ifa +@@ -526,9 +527,14 @@ dfs_get_valid_channel(struct hostapd_ifa int num_available_chandefs; int chan_idx, chan_idx2; int sec_chan_idx_80p80 = -1; @@ -44,7 +44,7 @@ Signed-off-by: Markus Theil wpa_printf(MSG_DEBUG, "DFS: Selecting random channel"); *secondary_channel = 0; *oper_centr_freq_seg0_idx = 0; -@@ -543,8 +549,20 @@ dfs_get_valid_channel(struct hostapd_ifa +@@ -548,8 +554,20 @@ dfs_get_valid_channel(struct hostapd_ifa if (num_available_chandefs == 0) return NULL; @@ -68,7 +68,7 @@ Signed-off-by: Markus Theil if (!chan) { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -10977,6 +10977,10 @@ static int nl80211_switch_channel(void * +@@ -11017,6 +11017,10 @@ static int nl80211_switch_channel(void * if (ret) goto error; diff --git a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch index 4ee43b5186a5d2..edf599e3e282f3 100644 --- a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch +++ b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch @@ -1,6 +1,6 @@ --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4601,6 +4601,13 @@ static int add_associated_sta(struct hos +@@ -4621,6 +4621,13 @@ static int add_associated_sta(struct hos * drivers to accept the STA parameter configuration. Since this is * after a new FT-over-DS exchange, a new TK has been derived, so key * reinstallation is not a concern for this case. @@ -14,7 +14,7 @@ */ wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)", -@@ -4614,7 +4621,8 @@ static int add_associated_sta(struct hos +@@ -4634,7 +4641,8 @@ static int add_associated_sta(struct hos (!(sta->flags & WLAN_STA_AUTHORIZED) || (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) || (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) && diff --git a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch b/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch index 19248e80d8c975..ef2bb408fb28d9 100644 --- a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch +++ b/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch @@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { wpa_printf(MSG_DEBUG, -@@ -11843,13 +11840,14 @@ static int wpa_driver_br_add_ip_neigh(vo +@@ -11883,13 +11880,14 @@ static int wpa_driver_br_add_ip_neigh(vo const u8 *ipaddr, int prefixlen, const u8 *addr) { @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau int res; if (!ipaddr || prefixlen == 0 || !addr) -@@ -11868,85 +11866,66 @@ static int wpa_driver_br_add_ip_neigh(vo +@@ -11908,85 +11906,66 @@ static int wpa_driver_br_add_ip_neigh(vo } if (version == 4) { @@ -220,7 +220,7 @@ Signed-off-by: Felix Fietkau addrsize = 16; } else { return -EINVAL; -@@ -11964,41 +11943,30 @@ static int wpa_driver_br_delete_ip_neigh +@@ -12004,41 +11983,30 @@ static int wpa_driver_br_delete_ip_neigh return -1; } diff --git a/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch b/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch index f98d3806dc1689..b7bf9e351e08b5 100644 --- a/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch +++ b/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -3012,15 +3012,6 @@ static void handle_auth(struct hostapd_d +@@ -3020,15 +3020,6 @@ static void handle_auth(struct hostapd_d seq_ctrl); return; } diff --git a/package/network/services/hostapd/patches/100-daemonize_fix.patch b/package/network/services/hostapd/patches/100-daemonize_fix.patch deleted file mode 100644 index 687bd4082dd4a7..00000000000000 --- a/package/network/services/hostapd/patches/100-daemonize_fix.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- a/src/utils/os_unix.c -+++ b/src/utils/os_unix.c -@@ -10,6 +10,7 @@ - - #include - #include -+#include - - #ifdef ANDROID - #include -@@ -188,59 +189,46 @@ int os_gmtime(os_time_t t, struct os_tm - return 0; - } - -- --#ifdef __APPLE__ --#include --static int os_daemon(int nochdir, int noclose) -+int os_daemonize(const char *pid_file) - { -- int devnull; -+ int pid = 0, i, devnull; - -- if (chdir("/") < 0) -- return -1; -+#if defined(__uClinux__) || defined(__sun__) -+ return -1; -+#else /* defined(__uClinux__) || defined(__sun__) */ - -- devnull = open("/dev/null", O_RDWR); -- if (devnull < 0) -+#ifndef __APPLE__ -+ pid = fork(); -+ if (pid < 0) - return -1; -+#endif - -- if (dup2(devnull, STDIN_FILENO) < 0) { -- close(devnull); -- return -1; -+ if (pid > 0) { -+ if (pid_file) { -+ FILE *f = fopen(pid_file, "w"); -+ if (f) { -+ fprintf(f, "%u\n", pid); -+ fclose(f); -+ } -+ } -+ _exit(0); - } - -- if (dup2(devnull, STDOUT_FILENO) < 0) { -- close(devnull); -+ if (setsid() < 0) - return -1; -- } - -- if (dup2(devnull, STDERR_FILENO) < 0) { -- close(devnull); -+ if (chdir("/") < 0) - return -1; -- } -- -- return 0; --} --#else /* __APPLE__ */ --#define os_daemon daemon --#endif /* __APPLE__ */ - -- --int os_daemonize(const char *pid_file) --{ --#if defined(__uClinux__) || defined(__sun__) -- return -1; --#else /* defined(__uClinux__) || defined(__sun__) */ -- if (os_daemon(0, 0)) { -- perror("daemon"); -+ devnull = open("/dev/null", O_RDWR); -+ if (devnull < 0) - return -1; -- } - -- if (pid_file) { -- FILE *f = fopen(pid_file, "w"); -- if (f) { -- fprintf(f, "%u\n", getpid()); -- fclose(f); -- } -- } -+ for (i = 0; i <= STDERR_FILENO; i++) -+ dup2(devnull, i); -+ -+ if (devnull > 2) -+ close(devnull); - - return -0; - #endif /* defined(__uClinux__) || defined(__sun__) */ diff --git a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch index 148c268f9ca1e6..e967cff427e177 100644 --- a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch +++ b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch @@ -903,7 +903,7 @@ Signed-off-by: Glenn Strauss for exp, flags in tests: hapd.disable() hapd.set("tls_flags", flags) -@@ -7115,6 +7173,7 @@ def test_ap_wpa2_eap_assoc_rsn(dev, apde +@@ -7138,6 +7196,7 @@ def test_ap_wpa2_eap_assoc_rsn(dev, apde def test_eap_tls_ext_cert_check(dev, apdev): """EAP-TLS and external server certification validation""" # With internal server certificate chain validation @@ -911,7 +911,7 @@ Signed-off-by: Glenn Strauss id = dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TLS", identity="tls user", ca_cert="auth_serv/ca.pem", -@@ -7127,6 +7186,7 @@ def test_eap_tls_ext_cert_check(dev, apd +@@ -7150,6 +7209,7 @@ def test_eap_tls_ext_cert_check(dev, apd def test_eap_ttls_ext_cert_check(dev, apdev): """EAP-TTLS and external server certification validation""" # Without internal server certificate chain validation @@ -919,7 +919,7 @@ Signed-off-by: Glenn Strauss id = dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TTLS", identity="pap user", anonymous_identity="ttls", password="password", phase2="auth=PAP", -@@ -7137,6 +7197,7 @@ def test_eap_ttls_ext_cert_check(dev, ap +@@ -7160,6 +7220,7 @@ def test_eap_ttls_ext_cert_check(dev, ap def test_eap_peap_ext_cert_check(dev, apdev): """EAP-PEAP and external server certification validation""" # With internal server certificate chain validation @@ -927,7 +927,7 @@ Signed-off-by: Glenn Strauss id = dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PEAP", identity="user", anonymous_identity="peap", ca_cert="auth_serv/ca.pem", -@@ -7147,6 +7208,7 @@ def test_eap_peap_ext_cert_check(dev, ap +@@ -7170,6 +7231,7 @@ def test_eap_peap_ext_cert_check(dev, ap def test_eap_fast_ext_cert_check(dev, apdev): """EAP-FAST and external server certification validation""" @@ -935,7 +935,7 @@ Signed-off-by: Glenn Strauss check_eap_capa(dev[0], "FAST") # With internal server certificate chain validation dev[0].request("SET blob fast_pac_auth_ext ") -@@ -7161,10 +7223,6 @@ def test_eap_fast_ext_cert_check(dev, ap +@@ -7184,10 +7246,6 @@ def test_eap_fast_ext_cert_check(dev, ap run_ext_cert_check(dev, apdev, id) def run_ext_cert_check(dev, apdev, net_id): @@ -948,7 +948,7 @@ Signed-off-by: Glenn Strauss --- a/tests/hwsim/test_ap_ft.py +++ b/tests/hwsim/test_ap_ft.py -@@ -2471,11 +2471,11 @@ def test_ap_ft_ap_oom5(dev, apdev): +@@ -2474,11 +2474,11 @@ def test_ap_ft_ap_oom5(dev, apdev): # This will fail to roam dev[0].roam(bssid1, check_bssid=False) @@ -1138,7 +1138,7 @@ Signed-off-by: Glenn Strauss heavy_groups = [14, 15, 16] suitable_groups = [15, 16, 17, 18, 19, 20, 21] groups = [str(g) for g in sae_groups] -@@ -2188,6 +2193,8 @@ def run_sae_pwe_group(dev, apdev, group) +@@ -2193,6 +2198,8 @@ def run_sae_pwe_group(dev, apdev, group) logger.info("Add Brainpool EC groups since OpenSSL is new enough") elif tls.startswith("wolfSSL"): logger.info("Make sure Brainpool EC groups were enabled when compiling wolfSSL") diff --git a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch index 710a3c851e119e..b0151b071f6aab 100644 --- a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch +++ b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch @@ -120,7 +120,7 @@ Signed-off-by: P Praneesh * Convert 80+80 MHz channel width to new style as interop --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c -@@ -808,6 +808,7 @@ int ieee80211ac_cap_check(u32 hw, u32 co +@@ -811,6 +811,7 @@ int ieee80211ac_cap_check(u32 hw, u32 co VHT_CAP_CHECK(VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB); VHT_CAP_CHECK(VHT_CAP_RX_ANTENNA_PATTERN); VHT_CAP_CHECK(VHT_CAP_TX_ANTENNA_PATTERN); @@ -130,7 +130,7 @@ Signed-off-by: P Praneesh #undef VHT_CAP_CHECK_MAX --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h -@@ -1348,6 +1348,8 @@ struct ieee80211_ampe_ie { +@@ -1349,6 +1349,8 @@ struct ieee80211_ampe_ie { #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27)) #define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28)) #define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29)) diff --git a/package/network/services/hostapd/patches/180-driver_nl80211-fix-setting-QoS-map-on-secondary-BSSs.patch b/package/network/services/hostapd/patches/180-driver_nl80211-fix-setting-QoS-map-on-secondary-BSSs.patch new file mode 100644 index 00000000000000..4929c581ce2bde --- /dev/null +++ b/package/network/services/hostapd/patches/180-driver_nl80211-fix-setting-QoS-map-on-secondary-BSSs.patch @@ -0,0 +1,20 @@ +From: Felix Fietkau +Date: Thu, 14 Sep 2023 10:53:50 +0200 +Subject: [PATCH] driver_nl80211: fix setting QoS map on secondary BSSs + +The setting is per-BSS, not per PHY + +Signed-off-by: Felix Fietkau +--- + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -11341,7 +11341,7 @@ static int nl80211_set_qos_map(void *pri + wpa_hexdump(MSG_DEBUG, "nl80211: Setting QoS Map", + qos_map_set, qos_map_set_len); + +- if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_QOS_MAP)) || ++ if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_SET_QOS_MAP)) || + nla_put(msg, NL80211_ATTR_QOS_MAP, qos_map_set_len, qos_map_set)) { + nlmsg_free(msg); + return -ENOBUFS; diff --git a/package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch b/package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch new file mode 100644 index 00000000000000..adfb21fb471a49 --- /dev/null +++ b/package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch @@ -0,0 +1,18 @@ +From: Felix Fietkau +Date: Thu, 14 Sep 2023 11:28:03 +0200 +Subject: [PATCH] driver_nl80211: update drv->ifindex on removing the first + BSS + +Signed-off-by: Felix Fietkau +--- + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -8867,6 +8867,7 @@ static int wpa_driver_nl80211_if_remove( + if (drv->first_bss->next) { + drv->first_bss = drv->first_bss->next; + drv->ctx = drv->first_bss->ctx; ++ drv->ifindex = drv->first_bss->ifindex; + os_free(bss); + } else { + wpa_printf(MSG_DEBUG, "nl80211: No second BSS to reassign context to"); diff --git a/package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch b/package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch new file mode 100644 index 00000000000000..395c645954247c --- /dev/null +++ b/package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch @@ -0,0 +1,34 @@ +From: Felix Fietkau +Date: Mon, 18 Sep 2023 16:47:41 +0200 +Subject: [PATCH] nl80211: move nl80211_put_freq_params call outside of + 802.11ax #ifdef + +The relevance of this call is not specific to 802.11ax, so it should be done +even with CONFIG_IEEE80211AX disabled. + +Fixes: b3921db426ea ("nl80211: Add frequency info in start AP command") +Signed-off-by: Felix Fietkau +--- + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -5226,6 +5226,9 @@ static int wpa_driver_nl80211_set_ap(voi + nla_nest_end(msg, ftm); + } + ++ if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0) ++ goto fail; ++ + #ifdef CONFIG_IEEE80211AX + if (params->he_spr_ctrl) { + struct nlattr *spr; +@@ -5260,9 +5263,6 @@ static int wpa_driver_nl80211_set_ap(voi + nla_nest_end(msg, spr); + } + +- if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0) +- goto fail; +- + if (params->freq && params->freq->he_enabled) { + struct nlattr *bss_color; + diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index f7e797a9c800ec..e3ed00f2ded2a4 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6651,8 +6651,8 @@ union wpa_event_data { +@@ -6667,8 +6667,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -6664,7 +6664,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6680,7 +6680,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -178,7 +178,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1994,8 +1994,8 @@ err: +@@ -2184,8 +2184,8 @@ err: #endif /* CONFIG_OWE */ @@ -189,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -2271,7 +2271,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2489,7 +2489,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -5345,8 +5345,8 @@ static void wpas_link_reconfig(struct wp +@@ -5353,8 +5353,8 @@ static void wpas_link_reconfig(struct wp } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -6264,7 +6264,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6272,7 +6272,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7435,7 +7435,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -7462,7 +7462,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -7470,6 +7469,11 @@ static int wpa_supplicant_match_existing +@@ -7497,6 +7496,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -7726,6 +7730,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -7753,6 +7757,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ @@ -284,7 +284,7 @@ wpa_debug_open_file(params->wpa_debug_file_path); --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -685,6 +685,11 @@ fail: +@@ -698,6 +698,11 @@ fail: return -1; } @@ -296,7 +296,7 @@ #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -778,6 +783,8 @@ int main(int argc, char *argv[]) +@@ -791,6 +796,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 1ea89043e89605..3b5f4325de0c96 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1072,6 +1072,8 @@ struct hostapd_config { +@@ -1075,6 +1075,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; @@ -24,7 +24,7 @@ int no_pri_sec_switch; --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c -@@ -517,7 +517,8 @@ static int ieee80211n_check_40mhz(struct +@@ -546,7 +546,8 @@ static int ieee80211n_check_40mhz(struct int ret; /* Check that HT40 is used and PRI / SEC switch is allowed */ diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index a47546d38fc2f9..e12b2059b3e38c 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5740,7 +5740,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -5767,7 +5767,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch deleted file mode 100644 index ae6cd81ea4d801..00000000000000 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -143,6 +143,29 @@ static void hostapd_reload_bss(struct ho - #endif /* CONFIG_NO_RADIUS */ - - ssid = &hapd->conf->ssid; -+ -+ hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq, -+ hapd->iconf->channel, -+ hapd->iconf->enable_edmg, -+ hapd->iconf->edmg_channel, -+ hapd->iconf->ieee80211n, -+ hapd->iconf->ieee80211ac, -+ hapd->iconf->ieee80211ax, -+ hapd->iconf->ieee80211be, -+ hapd->iconf->secondary_channel, -+ hostapd_get_oper_chwidth(hapd->iconf), -+ hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf), -+ hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf)); -+ -+ if (hapd->iface->current_mode) { -+ if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) { -+ wpa_printf(MSG_ERROR, "Failed to prepare rates table."); -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_WARNING, -+ "Failed to prepare rates table."); -+ } -+ } -+ - if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && - ssid->wpa_passphrase_set && ssid->wpa_passphrase) { - /* -@@ -251,6 +274,7 @@ int hostapd_reload_config(struct hostapd - struct hostapd_data *hapd = iface->bss[0]; - struct hostapd_config *newconf, *oldconf; - size_t j; -+ int i; - - if (iface->config_fname == NULL) { - /* Only in-memory config in use - assume it has been updated */ -@@ -301,6 +325,17 @@ int hostapd_reload_config(struct hostapd - } - iface->conf = newconf; - -+ for (i = 0; i < iface->num_hw_features; i++) { -+ struct hostapd_hw_modes *mode = &iface->hw_features[i]; -+ if (mode->mode == iface->conf->hw_mode) { -+ iface->current_mode = mode; -+ break; -+ } -+ } -+ -+ if (iface->conf->channel) -+ iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel); -+ - for (j = 0; j < iface->num_bss; j++) { - hapd = iface->bss[j]; - if (!hapd->conf->config_id || !newconf->bss[j]->config_id || -@@ -308,21 +343,6 @@ int hostapd_reload_config(struct hostapd - newconf->bss[j]->config_id) != 0) - hostapd_clear_old_bss(hapd); - hapd->iconf = newconf; -- hapd->iconf->channel = oldconf->channel; -- hapd->iconf->acs = oldconf->acs; -- hapd->iconf->secondary_channel = oldconf->secondary_channel; -- hapd->iconf->ieee80211n = oldconf->ieee80211n; -- hapd->iconf->ieee80211ac = oldconf->ieee80211ac; -- hapd->iconf->ht_capab = oldconf->ht_capab; -- hapd->iconf->vht_capab = oldconf->vht_capab; -- hostapd_set_oper_chwidth(hapd->iconf, -- hostapd_get_oper_chwidth(oldconf)); -- hostapd_set_oper_centr_freq_seg0_idx( -- hapd->iconf, -- hostapd_get_oper_centr_freq_seg0_idx(oldconf)); -- hostapd_set_oper_centr_freq_seg1_idx( -- hapd->iconf, -- hostapd_get_oper_centr_freq_seg1_idx(oldconf)); - hapd->conf = newconf->bss[j]; - hostapd_reload_bss(hapd); - } diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch deleted file mode 100644 index 4d85ea11f906b8..00000000000000 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -68,6 +68,7 @@ - #include "fst/fst_ctrl_iface.h" - #include "config_file.h" - #include "ctrl_iface.h" -+#include "config_file.h" - - - #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256 -@@ -83,6 +84,7 @@ static void hostapd_ctrl_iface_send(stru - enum wpa_msg_type type, - const char *buf, size_t len); - -+static char *reload_opts = NULL; - - static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, - struct sockaddr_storage *from, -@@ -134,6 +136,61 @@ static int hostapd_ctrl_iface_new_sta(st - return 0; - } - -+static char *get_option(char *opt, char *str) -+{ -+ int len = strlen(str); -+ -+ if (!strncmp(opt, str, len)) -+ return opt + len; -+ else -+ return NULL; -+} -+ -+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname) -+{ -+ struct hostapd_config *conf; -+ char *opt, *val; -+ -+ conf = hostapd_config_read(fname); -+ if (!conf) -+ return NULL; -+ -+ for (opt = strtok(reload_opts, " "); -+ opt; -+ opt = strtok(NULL, " ")) { -+ -+ if ((val = get_option(opt, "channel="))) -+ conf->channel = atoi(val); -+ else if ((val = get_option(opt, "ht_capab="))) -+ conf->ht_capab = atoi(val); -+ else if ((val = get_option(opt, "ht_capab_mask="))) -+ conf->ht_capab &= atoi(val); -+ else if ((val = get_option(opt, "sec_chan="))) -+ conf->secondary_channel = atoi(val); -+ else if ((val = get_option(opt, "hw_mode="))) -+ conf->hw_mode = atoi(val); -+ else if ((val = get_option(opt, "ieee80211n="))) -+ conf->ieee80211n = atoi(val); -+ else -+ break; -+ } -+ -+ return conf; -+} -+ -+static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt) -+{ -+ struct hostapd_config * (*config_read_cb)(const char *config_fname); -+ struct hostapd_iface *iface = hapd->iface; -+ -+ config_read_cb = iface->interfaces->config_read_cb; -+ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; -+ reload_opts = txt; -+ -+ hostapd_reload_config(iface); -+ -+ iface->interfaces->config_read_cb = config_read_cb; -+} - - #ifdef NEED_AP_MLME - static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, -@@ -3564,6 +3621,8 @@ static int hostapd_ctrl_iface_receive_pr - } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { - reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, - reply_size); -+ } else if (os_strncmp(buf, "UPDATE ", 7) == 0) { -+ hostapd_ctrl_iface_update(hapd, buf + 7); - } else if (os_strcmp(buf, "ERP_FLUSH") == 0) { - ieee802_1x_erp_flush(hapd); - #ifdef RADIUS_SERVER ---- a/src/ap/ctrl_iface_ap.c -+++ b/src/ap/ctrl_iface_ap.c -@@ -1023,7 +1023,13 @@ int hostapd_parse_csa_settings(const cha - - int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) - { -- return hostapd_drv_stop_ap(hapd); -+ struct hostapd_iface *iface = hapd->iface; -+ int i; -+ -+ for (i = 0; i < iface->num_bss; i++) -+ hostapd_drv_stop_ap(iface->bss[i]); -+ -+ return 0; - } - - diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch deleted file mode 100644 index 3baad2a52e5008..00000000000000 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ /dev/null @@ -1,392 +0,0 @@ ---- a/wpa_supplicant/Makefile -+++ b/wpa_supplicant/Makefile -@@ -126,6 +126,8 @@ OBJS_c += ../src/utils/common.o - OBJS_c += ../src/common/cli.o - OBJS += wmm_ac.o - -+OBJS += ../src/common/wpa_ctrl.o -+ - ifndef CONFIG_OS - ifdef CONFIG_NATIVE_WINDOWS - CONFIG_OS=win32 ---- a/wpa_supplicant/bss.c -+++ b/wpa_supplicant/bss.c -@@ -11,6 +11,7 @@ - #include "utils/common.h" - #include "utils/eloop.h" - #include "common/ieee802_11_defs.h" -+#include "common/ieee802_11_common.h" - #include "drivers/driver.h" - #include "eap_peer/eap.h" - #include "wpa_supplicant_i.h" -@@ -283,6 +284,10 @@ void calculate_update_time(const struct - static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, - struct os_reltime *fetch_time) - { -+ struct ieee80211_ht_capabilities *capab; -+ struct ieee80211_ht_operation *oper; -+ struct ieee802_11_elems elems; -+ - dst->flags = src->flags; - os_memcpy(dst->bssid, src->bssid, ETH_ALEN); - dst->freq = src->freq; -@@ -296,6 +301,15 @@ static void wpa_bss_copy_res(struct wpa_ - dst->est_throughput = src->est_throughput; - dst->snr = src->snr; - -+ memset(&elems, 0, sizeof(elems)); -+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0); -+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities; -+ oper = (struct ieee80211_ht_operation *) elems.ht_operation; -+ if (capab) -+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info); -+ if (oper) -+ dst->ht_param = oper->ht_param; -+ - calculate_update_time(fetch_time, src->age, &dst->last_update); - } - ---- a/wpa_supplicant/bss.h -+++ b/wpa_supplicant/bss.h -@@ -94,6 +94,10 @@ struct wpa_bss { - u8 ssid[SSID_MAX_LEN]; - /** Length of SSID */ - size_t ssid_len; -+ /** HT capabilities */ -+ u16 ht_capab; -+ /* Five octets of HT Operation Information */ -+ u8 ht_param; - /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */ - int freq; - /** Beacon interval in TUs (host byte order) */ ---- a/wpa_supplicant/main.c -+++ b/wpa_supplicant/main.c -@@ -35,7 +35,7 @@ static void usage(void) - "vW] [-P] " - "[-g] \\\n" - " [-G] \\\n" -- " -i -c [-C] [-D] " -+ " -i -c [-C] [-D] [-H] " - "[-p] \\\n" - " [-b] [-e]" - #ifdef CONFIG_DEBUG_FILE -@@ -75,6 +75,7 @@ static void usage(void) - " -g = global ctrl_interface\n" - " -G = global ctrl_interface group\n" - " -h = show this help text\n" -+ " -H = connect to a hostapd instance to manage state changes\n" - " -i = interface name\n" - " -I = additional configuration file\n" - " -K = include keys (passwords, etc.) in debug output\n" -@@ -202,7 +203,7 @@ int main(int argc, char *argv[]) - - for (;;) { - c = getopt(argc, argv, -- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW"); -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW"); - if (c < 0) - break; - switch (c) { -@@ -249,6 +250,9 @@ int main(int argc, char *argv[]) - usage(); - exitcode = 0; - goto out; -+ case 'H': -+ iface->hostapd_ctrl = optarg; -+ break; - case 'i': - iface->ifname = optarg; - break; ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -131,6 +131,54 @@ static void wpas_update_fils_connect_par - static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s); - #endif /* CONFIG_OWE */ - -+static int hostapd_stop(struct wpa_supplicant *wpa_s) -+{ -+ const char *cmd = "STOP_AP"; -+ char buf[256]; -+ size_t len = sizeof(buf); -+ -+ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) { -+ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n"); -+ return -1; -+ } -+ return 0; -+} -+ -+static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) -+{ -+ char *cmd = NULL; -+ char buf[256]; -+ size_t len = sizeof(buf); -+ enum hostapd_hw_mode hw_mode; -+ u8 channel; -+ int sec_chan = 0; -+ int ret; -+ -+ if (!bss) -+ return -1; -+ -+ if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) { -+ int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK; -+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) -+ sec_chan = 1; -+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) -+ sec_chan = -1; -+ } -+ -+ hw_mode = ieee80211_freq_to_chan(bss->freq, &channel); -+ if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d", -+ channel, sec_chan, hw_mode) < 0) -+ return -1; -+ -+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); -+ free(cmd); -+ -+ if (ret < 0) { -+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); -+ return -1; -+ } -+ return 0; -+} - - #ifdef CONFIG_WEP - /* Configure default/group WEP keys for static WEP */ -@@ -1026,6 +1074,8 @@ void wpa_supplicant_set_state(struct wpa - - sme_sched_obss_scan(wpa_s, 1); - -+ if (wpa_s->hostapd) -+ hostapd_reload(wpa_s, wpa_s->current_bss); - #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) - if (!fils_hlp_sent && ssid && ssid->eap.erp) - update_fils_connect_params = true; -@@ -1036,6 +1086,8 @@ void wpa_supplicant_set_state(struct wpa - #endif /* CONFIG_OWE */ - } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || - state == WPA_ASSOCIATED) { -+ if (wpa_s->hostapd) -+ hostapd_stop(wpa_s); - wpa_s->new_connection = 1; - wpa_drv_set_operstate(wpa_s, 0); - #ifndef IEEE8021X_EAPOL -@@ -2537,6 +2589,8 @@ void wpa_supplicant_associate(struct wpa - return; - } - wpa_s->current_bss = bss; -+ if (wpa_s->hostapd) -+ hostapd_reload(wpa_s, wpa_s->current_bss); - #else /* CONFIG_MESH */ - wpa_msg(wpa_s, MSG_ERROR, - "mesh mode support not included in the build"); -@@ -7037,6 +7091,16 @@ static int wpa_supplicant_init_iface(str - sizeof(wpa_s->bridge_ifname)); - } - -+ if (iface->hostapd_ctrl) { -+ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl); -+ if (!wpa_s->hostapd) { -+ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n"); -+ return -1; -+ } -+ if (hostapd_stop(wpa_s) < 0) -+ return -1; -+ } -+ - /* RSNA Supplicant Key Management - INITIALIZE */ - eapol_sm_notify_portEnabled(wpa_s->eapol, false); - eapol_sm_notify_portValid(wpa_s->eapol, false); -@@ -7379,6 +7443,11 @@ static void wpa_supplicant_deinit_iface( - if (terminate) - wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); - -+ if (wpa_s->hostapd) { -+ wpa_ctrl_close(wpa_s->hostapd); -+ wpa_s->hostapd = NULL; -+ } -+ - wpa_supplicant_ctrl_iface_deinit(wpa_s, wpa_s->ctrl_iface); - wpa_s->ctrl_iface = NULL; - ---- a/wpa_supplicant/wpa_supplicant_i.h -+++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -106,6 +106,11 @@ struct wpa_interface { - const char *ifname; - - /** -+ * hostapd_ctrl - path to hostapd control socket for notification -+ */ -+ const char *hostapd_ctrl; -+ -+ /** - * bridge_ifname - Optional bridge interface name - * - * If the driver interface (ifname) is included in a Linux bridge -@@ -665,6 +670,8 @@ struct wpa_supplicant { - #endif /* CONFIG_CTRL_IFACE_BINDER */ - char bridge_ifname[16]; - -+ struct wpa_ctrl *hostapd; -+ - char *confname; - char *confanother; - ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -2751,6 +2751,12 @@ static int hostapd_ctrl_iface_chan_switc - return 0; - } - -+ if (os_strstr(pos, " auto-ht")) { -+ settings.freq_params.ht_enabled = iface->conf->ieee80211n; -+ settings.freq_params.vht_enabled = iface->conf->ieee80211ac; -+ settings.freq_params.he_enabled = iface->conf->ieee80211ax; -+ } -+ - for (i = 0; i < iface->num_bss; i++) { - - /* Save CHAN_SWITCH VHT, HE, and EHT config */ ---- a/src/ap/beacon.c -+++ b/src/ap/beacon.c -@@ -2108,11 +2108,6 @@ static int __ieee802_11_set_beacon(struc - return -1; - } - -- if (hapd->csa_in_progress) { -- wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period"); -- return -1; -- } -- - hapd->beacon_set_done = 1; - - if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) ---- a/wpa_supplicant/events.c -+++ b/wpa_supplicant/events.c -@@ -5345,6 +5345,60 @@ static void wpas_link_reconfig(struct wp - } - - -+static void -+supplicant_ch_switch_started(struct wpa_supplicant *wpa_s, -+ union wpa_event_data *data) -+{ -+ char buf[256]; -+ size_t len = sizeof(buf); -+ char *cmd = NULL; -+ int width = 20; -+ int ret; -+ -+ if (!wpa_s->hostapd) -+ return; -+ -+ wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_CHANNEL_SWITCH -+ "count=%d freq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d", -+ data->ch_switch.count, -+ data->ch_switch.freq, -+ data->ch_switch.ht_enabled, -+ data->ch_switch.ch_offset, -+ channel_width_to_string(data->ch_switch.ch_width), -+ data->ch_switch.cf1, -+ data->ch_switch.cf2); -+ -+ switch (data->ch_switch.ch_width) { -+ case CHAN_WIDTH_20_NOHT: -+ case CHAN_WIDTH_20: -+ width = 20; -+ break; -+ case CHAN_WIDTH_40: -+ width = 40; -+ break; -+ case CHAN_WIDTH_80: -+ width = 80; -+ break; -+ case CHAN_WIDTH_160: -+ case CHAN_WIDTH_80P80: -+ width = 160; -+ break; -+ } -+ -+ asprintf(&cmd, "CHAN_SWITCH %d %d sec_channel_offset=%d center_freq1=%d center_freq2=%d, bandwidth=%d auto-ht\n", -+ data->ch_switch.count - 1, -+ data->ch_switch.freq, -+ data->ch_switch.ch_offset, -+ data->ch_switch.cf1, -+ data->ch_switch.cf2, -+ width); -+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); -+ free(cmd); -+ -+ if (ret < 0) -+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); -+} -+ - void supplicant_event(void *ctx, enum wpa_event_type event, - union wpa_event_data *data) - { -@@ -5697,8 +5751,10 @@ void supplicant_event(void *ctx, enum wp - channel_width_to_string(data->ch_switch.ch_width), - data->ch_switch.cf1, - data->ch_switch.cf2); -- if (event == EVENT_CH_SWITCH_STARTED) -+ if (event == EVENT_CH_SWITCH_STARTED) { -+ supplicant_ch_switch_started(wpa_s, data); - break; -+ } - - wpa_s->assoc_freq = data->ch_switch.freq; - wpa_s->current_ssid->frequency = data->ch_switch.freq; ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -6421,6 +6421,7 @@ union wpa_event_data { - - /** - * struct ch_switch -+ * @count: Count until channel switch activates - * @freq: Frequency of new channel in MHz - * @ht_enabled: Whether this is an HT channel - * @ch_offset: Secondary channel offset -@@ -6431,6 +6432,7 @@ union wpa_event_data { - * @punct_bitmap: Puncturing bitmap - */ - struct ch_switch { -+ int count; - int freq; - int ht_enabled; - int ch_offset; ---- a/src/drivers/driver_nl80211_event.c -+++ b/src/drivers/driver_nl80211_event.c -@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct - struct nlattr *bw, struct nlattr *cf1, - struct nlattr *cf2, - struct nlattr *punct_bitmap, -+ struct nlattr *count, - int finished) - { - struct i802_bss *bss; -@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct - data.ch_switch.cf1 = nla_get_u32(cf1); - if (cf2) - data.ch_switch.cf2 = nla_get_u32(cf2); -+ if (count) -+ data.ch_switch.count = nla_get_u32(count); - - if (finished) - bss->flink->freq = data.ch_switch.freq; -@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct - tb[NL80211_ATTR_CENTER_FREQ1], - tb[NL80211_ATTR_CENTER_FREQ2], - tb[NL80211_ATTR_PUNCT_BITMAP], -+ tb[NL80211_ATTR_CH_SWITCH_COUNT], - 0); - break; - case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct - tb[NL80211_ATTR_CENTER_FREQ1], - tb[NL80211_ATTR_CENTER_FREQ2], - tb[NL80211_ATTR_PUNCT_BITMAP], -+ NULL, - 1); - break; - case NL80211_CMD_DISCONNECT: diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 456599db09217b..f7720fce2fac84 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3377,6 +3377,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3314,6 +3314,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3418,6 +3419,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3355,6 +3356,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -985,6 +985,9 @@ ifdef CONFIG_FILS +@@ -983,6 +983,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -11964,6 +11964,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12087,6 +12087,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -11976,6 +11977,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12099,6 +12100,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -12464,6 +12466,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12587,6 +12589,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "STA ", 4) == 0) { -@@ -12472,12 +12475,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12595,12 +12598,15 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, reply_size); diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch index 40c39ff29c7e12..4592c341277ed4 100644 --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch @@ -1,6 +1,6 @@ --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -2719,6 +2719,31 @@ u32 wpa_akm_to_suite(int akm) +@@ -2841,6 +2841,31 @@ u32 wpa_akm_to_suite(int akm) } @@ -32,7 +32,7 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -2726,8 +2751,19 @@ int wpa_compare_rsn_ie(int ft_initial_as +@@ -2848,8 +2873,19 @@ int wpa_compare_rsn_ie(int ft_initial_as if (ie1 == NULL || ie2 == NULL) return -1; diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch index 786b83d3151d64..07df8e5a9afd1c 100644 --- a/package/network/services/hostapd/patches/420-indicate-features.patch +++ b/package/network/services/hostapd/patches/420-indicate-features.patch @@ -9,7 +9,7 @@ struct hapd_global { void **drv_priv; -@@ -786,7 +786,7 @@ int main(int argc, char *argv[]) +@@ -799,7 +799,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -18,7 +18,7 @@ if (c < 0) break; switch (c) { -@@ -823,6 +823,8 @@ int main(int argc, char *argv[]) +@@ -836,6 +836,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': @@ -37,16 +37,16 @@ #include "crypto/crypto.h" #include "fst/fst.h" #include "wpa_supplicant_i.h" -@@ -203,7 +204,7 @@ int main(int argc, char *argv[]) +@@ -202,7 +203,7 @@ int main(int argc, char *argv[]) for (;;) { c = getopt(argc, argv, -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW"); -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W"); +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW"); ++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W"); if (c < 0) break; switch (c) { -@@ -306,8 +307,12 @@ int main(int argc, char *argv[]) +@@ -302,8 +303,12 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ case 'v': diff --git a/package/network/services/hostapd/patches/432-missing-typedef.patch b/package/network/services/hostapd/patches/432-missing-typedef.patch deleted file mode 100644 index 7a100f1a0d25e4..00000000000000 --- a/package/network/services/hostapd/patches/432-missing-typedef.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/drivers/linux_wext.h -+++ b/src/drivers/linux_wext.h -@@ -26,6 +26,7 @@ typedef int32_t __s32; - typedef uint16_t __u16; - typedef int16_t __s16; - typedef uint8_t __u8; -+typedef int8_t __s8; - #ifndef __user - #define __user - #endif /* __user */ diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch deleted file mode 100644 index 45886896ee9b30..00000000000000 --- a/package/network/services/hostapd/patches/450-scan_wait.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -39,6 +39,8 @@ struct hapd_global { - }; - - static struct hapd_global global; -+static int daemonize = 0; -+static char *pid_file = NULL; - - - #ifndef CONFIG_NO_HOSTAPD_LOGGER -@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx, - } - #endif /* CONFIG_NO_HOSTAPD_LOGGER */ - -+static void hostapd_setup_complete_cb(void *ctx) -+{ -+ if (daemonize && os_daemonize(pid_file)) { -+ perror("daemon"); -+ return; -+ } -+ daemonize = 0; -+} - - /** - * hostapd_driver_init - Preparate driver interface -@@ -217,6 +227,8 @@ static int hostapd_driver_init(struct ho - } - #endif /* CONFIG_IEEE80211BE */ - -+ hapd->setup_complete_cb = hostapd_setup_complete_cb; -+ - /* Initialize the driver interface */ - if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) - b = NULL; -@@ -497,8 +509,6 @@ static void hostapd_global_deinit(const - #endif /* CONFIG_NATIVE_WINDOWS */ - - eap_server_unregister_methods(); -- -- os_daemonize_terminate(pid_file); - } - - -@@ -524,18 +534,6 @@ static int hostapd_global_run(struct hap - } - #endif /* EAP_SERVER_TNC */ - -- if (daemonize) { -- if (os_daemonize(pid_file)) { -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno)); -- return -1; -- } -- if (eloop_sock_requeue()) { -- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s", -- strerror(errno)); -- return -1; -- } -- } -- - eloop_run(); - - return 0; -@@ -739,8 +737,7 @@ int main(int argc, char *argv[]) - struct hapd_interfaces interfaces; - int ret = 1; - size_t i, j; -- int c, debug = 0, daemonize = 0; -- char *pid_file = NULL; -+ int c, debug = 0; - const char *log_file = NULL; - const char *entropy_file = NULL; - char **bss_config = NULL, **tmp_bss; diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index 4c728681393cd7..c6fe54efed0220 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4203,6 +4203,12 @@ static void wpas_start_assoc_cb(struct w +@@ -4175,6 +4175,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index be9e0507d6daf3..daa36c2f35cbb9 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -11626,6 +11626,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -11667,6 +11667,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -11687,6 +11699,7 @@ static int nl80211_join_mesh(struct i802 +@@ -11728,6 +11740,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index c7e8cf25ce8fd9..4d7d85f4ab8ea5 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3094,6 +3094,10 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3040,6 +3040,10 @@ void ibss_mesh_setup_freq(struct wpa_sup freq->freq = ssid->frequency; diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch index 046da42ab8b912..67312c5004a753 100644 --- a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch @@ -20,7 +20,7 @@ NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -2039,31 +2039,31 @@ wpa_supplicant_multi.a: .config $(BCHECK +@@ -2037,31 +2037,31 @@ wpa_supplicant_multi.a: .config $(BCHECK @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index f3936342a5f118..bc80ef0e813ae1 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -1,11 +1,12 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -166,6 +166,11 @@ OBJS += ../src/common/hw_features_common +@@ -166,6 +166,12 @@ OBJS += ../src/common/hw_features_common OBJS += ../src/eapol_auth/eapol_auth_sm.o +ifdef CONFIG_UBUS +CFLAGS += -DUBUS_SUPPORT ++OBJS += ../src/utils/uloop.o +OBJS += ../src/ap/ubus.o +LIBS += -lubox -lubus +endif @@ -22,15 +23,6 @@ #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -92,7 +93,7 @@ struct hapd_interfaces { - #ifdef CONFIG_CTRL_IFACE_UDP - unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN]; - #endif /* CONFIG_CTRL_IFACE_UDP */ -- -+ struct ubus_object ubus; - }; - - enum hostapd_chan_status { @@ -184,6 +185,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; @@ -49,7 +41,7 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -455,6 +455,7 @@ void hostapd_free_hapd_data(struct hosta +@@ -435,6 +435,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -57,7 +49,7 @@ accounting_deinit(hapd); hostapd_deinit_wpa(hapd); vlan_deinit(hapd); -@@ -1207,6 +1208,8 @@ static int hostapd_start_beacon(struct h +@@ -1187,6 +1188,8 @@ static int hostapd_start_beacon(struct h if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -66,7 +58,7 @@ return 0; } -@@ -2295,6 +2298,7 @@ static int hostapd_setup_interface_compl +@@ -2275,6 +2278,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -74,7 +66,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2514,6 +2518,7 @@ dfs_offload: +@@ -2494,6 +2498,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -82,7 +74,7 @@ if (iface->is_no_ir) { hostapd_set_state(iface, HAPD_IFACE_NO_IR); -@@ -3004,6 +3009,7 @@ void hostapd_interface_deinit_free(struc +@@ -2984,6 +2989,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -92,7 +84,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2778,7 +2778,7 @@ static void handle_auth(struct hostapd_d +@@ -2786,7 +2786,7 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -101,7 +93,7 @@ u16 fc; const u8 *challenge = NULL; u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; -@@ -2787,6 +2787,11 @@ static void handle_auth(struct hostapd_d +@@ -2795,6 +2795,11 @@ static void handle_auth(struct hostapd_d struct radius_sta rad_info; const u8 *dst, *sa, *bssid; bool mld_sta = false; @@ -113,7 +105,7 @@ if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -2978,6 +2983,13 @@ static void handle_auth(struct hostapd_d +@@ -2986,6 +2991,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -127,7 +119,7 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -5141,7 +5153,7 @@ static void handle_assoc(struct hostapd_ +@@ -5161,7 +5173,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; const u8 *pos; @@ -136,7 +128,7 @@ struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -5354,6 +5366,11 @@ static void handle_assoc(struct hostapd_ +@@ -5374,6 +5386,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -148,7 +140,7 @@ /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -5452,6 +5469,13 @@ static void handle_assoc(struct hostapd_ +@@ -5472,6 +5489,13 @@ static void handle_assoc(struct hostapd_ } #endif /* CONFIG_FILS */ @@ -162,7 +154,7 @@ fail: /* -@@ -5733,6 +5757,7 @@ static void handle_disassoc(struct hosta +@@ -5753,6 +5777,7 @@ static void handle_disassoc(struct hosta (unsigned long) len); return; } @@ -170,7 +162,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (!sta) { -@@ -5764,6 +5789,8 @@ static void handle_deauth(struct hostapd +@@ -5784,6 +5809,8 @@ static void handle_deauth(struct hostapd /* Clear the PTKSA cache entries for PASN */ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); @@ -209,7 +201,7 @@ --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -145,6 +145,10 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -260,6 +260,10 @@ int hostapd_notif_assoc(struct hostapd_d u16 reason = WLAN_REASON_UNSPECIFIED; int status = WLAN_STATUS_SUCCESS; const u8 *p2p_dev_addr = NULL; @@ -220,7 +212,7 @@ if (addr == NULL) { /* -@@ -237,6 +241,12 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -396,6 +400,12 @@ int hostapd_notif_assoc(struct hostapd_d goto fail; } @@ -330,20 +322,21 @@ --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -194,6 +194,12 @@ ifdef CONFIG_EAPOL_TEST +@@ -192,6 +192,13 @@ ifdef CONFIG_EAPOL_TEST CFLAGS += -Werror -DEAPOL_TEST endif +ifdef CONFIG_UBUS +CFLAGS += -DUBUS_SUPPORT +OBJS += ubus.o ++OBJS += ../src/utils/uloop.o +LIBS += -lubox -lubus +endif + ifdef CONFIG_CODE_COVERAGE CFLAGS += -O0 -fprofile-arcs -ftest-coverage LIBS += -lgcov -@@ -989,6 +995,9 @@ ifdef CONFIG_CTRL_IFACE_MIB +@@ -987,6 +994,9 @@ ifdef CONFIG_CTRL_IFACE_MIB CFLAGS += -DCONFIG_CTRL_IFACE_MIB endif OBJS += ../src/ap/ctrl_iface_ap.o @@ -355,7 +348,7 @@ CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7635,6 +7635,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7593,6 +7593,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -364,7 +357,7 @@ return wpa_s; } -@@ -7661,6 +7663,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -7619,6 +7621,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -373,7 +366,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -8007,8 +8011,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -7965,8 +7969,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -396,7 +389,7 @@ extern const char *const wpa_supplicant_version; extern const char *const wpa_supplicant_license; -@@ -324,6 +325,8 @@ struct wpa_global { +@@ -319,6 +320,8 @@ struct wpa_global { #endif /* CONFIG_WIFI_DISPLAY */ struct psk_list_entry *add_psk; /* From group formation */ @@ -405,7 +398,7 @@ }; -@@ -655,6 +658,7 @@ struct wpa_supplicant { +@@ -685,6 +688,7 @@ struct wpa_supplicant { unsigned char own_addr[ETH_ALEN]; unsigned char perm_addr[ETH_ALEN]; char ifname[100]; @@ -432,36 +425,18 @@ if (wpa_s->conf->wps_cred_processing == 1) return 0; ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -991,6 +991,7 @@ int main(int argc, char *argv[]) - } - - hostapd_global_ctrl_iface_init(&interfaces); -+ hostapd_ubus_add(&interfaces); - - if (hostapd_global_run(&interfaces, daemonize, pid_file)) { - wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -1000,6 +1001,7 @@ int main(int argc, char *argv[]) - ret = 0; - - out: -+ hostapd_ubus_free(&interfaces); - hostapd_global_ctrl_iface_deinit(&interfaces); - /* Deinitialize all interfaces */ - for (i = 0; i < interfaces.count; i++) { --- a/wpa_supplicant/main.c +++ b/wpa_supplicant/main.c -@@ -204,7 +204,7 @@ int main(int argc, char *argv[]) +@@ -203,7 +203,7 @@ int main(int argc, char *argv[]) for (;;) { c = getopt(argc, argv, -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W"); -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:nNo:O:p:P:qsTtuv::W"); +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W"); ++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:nNo:O:p:P:qsTtuv::W"); if (c < 0) break; switch (c) { -@@ -272,6 +272,9 @@ int main(int argc, char *argv[]) +@@ -268,6 +268,9 @@ int main(int argc, char *argv[]) params.conf_p2p_dev = optarg; break; #endif /* CONFIG_P2P */ @@ -533,7 +508,7 @@ --- a/src/ap/dfs.c +++ b/src/ap/dfs.c -@@ -1211,6 +1211,8 @@ int hostapd_dfs_pre_cac_expired(struct h +@@ -1216,6 +1216,8 @@ int hostapd_dfs_pre_cac_expired(struct h "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", freq, ht_enabled, chan_offset, chan_width, cf1, cf2); @@ -623,3 +598,151 @@ wpa_hexdump(MSG_DEBUG, "WNM: BSS Transition Candidate List Entries", pos, end - pos); } +--- a/src/utils/eloop.c ++++ b/src/utils/eloop.c +@@ -77,6 +77,9 @@ struct eloop_sock_table { + struct eloop_data { + int max_sock; + ++ eloop_timeout_poll_handler timeout_poll_cb; ++ eloop_poll_handler poll_cb; ++ + size_t count; /* sum of all table counts */ + #ifdef CONFIG_ELOOP_POLL + size_t max_pollfd_map; /* number of pollfds_map currently allocated */ +@@ -1121,6 +1124,12 @@ void eloop_run(void) + os_reltime_sub(&timeout->time, &now, &tv); + else + tv.sec = tv.usec = 0; ++ } ++ ++ if (eloop.timeout_poll_cb && eloop.timeout_poll_cb(&tv, !!timeout)) ++ timeout = (void *)1; ++ ++ if (timeout) { + #if defined(CONFIG_ELOOP_POLL) || defined(CONFIG_ELOOP_EPOLL) + timeout_ms = tv.sec * 1000 + tv.usec / 1000; + #endif /* defined(CONFIG_ELOOP_POLL) || defined(CONFIG_ELOOP_EPOLL) */ +@@ -1190,7 +1199,8 @@ void eloop_run(void) + eloop.exceptions.changed = 0; + + eloop_process_pending_signals(); +- ++ if (eloop.poll_cb) ++ eloop.poll_cb(); + + /* check if some registered timeouts have occurred */ + timeout = dl_list_first(&eloop.timeout, struct eloop_timeout, +@@ -1252,6 +1262,14 @@ out: + return; + } + ++int eloop_register_cb(eloop_poll_handler poll_cb, ++ eloop_timeout_poll_handler timeout_cb) ++{ ++ eloop.poll_cb = poll_cb; ++ eloop.timeout_poll_cb = timeout_cb; ++ ++ return 0; ++} + + void eloop_terminate(void) + { +--- a/src/utils/eloop.h ++++ b/src/utils/eloop.h +@@ -65,6 +65,9 @@ typedef void (*eloop_timeout_handler)(vo + */ + typedef void (*eloop_signal_handler)(int sig, void *signal_ctx); + ++typedef bool (*eloop_timeout_poll_handler)(struct os_reltime *tv, bool tv_set); ++typedef void (*eloop_poll_handler)(void); ++ + /** + * eloop_init() - Initialize global event loop data + * Returns: 0 on success, -1 on failure +@@ -73,6 +76,9 @@ typedef void (*eloop_signal_handler)(int + */ + int eloop_init(void); + ++int eloop_register_cb(eloop_poll_handler poll_cb, ++ eloop_timeout_poll_handler timeout_cb); ++ + /** + * eloop_register_read_sock - Register handler for read events + * @sock: File descriptor number for the socket +@@ -320,6 +326,8 @@ int eloop_register_signal_reconfig(eloop + */ + int eloop_sock_requeue(void); + ++void eloop_add_uloop(void); ++ + /** + * eloop_run - Start the event loop + * +--- /dev/null ++++ b/src/utils/uloop.c +@@ -0,0 +1,64 @@ ++#include ++#include "includes.h" ++#include "common.h" ++#include "eloop.h" ++ ++static void eloop_uloop_event_cb(int sock, void *eloop_ctx, void *sock_ctx) ++{ ++} ++ ++static void eloop_uloop_fd_cb(struct uloop_fd *fd, unsigned int events) ++{ ++ unsigned int changed = events ^ fd->flags; ++ ++ if (changed & ULOOP_READ) { ++ if (events & ULOOP_READ) ++ eloop_register_sock(fd->fd, EVENT_TYPE_READ, eloop_uloop_event_cb, fd, fd); ++ else ++ eloop_unregister_sock(fd->fd, EVENT_TYPE_READ); ++ } ++ ++ if (changed & ULOOP_WRITE) { ++ if (events & ULOOP_WRITE) ++ eloop_register_sock(fd->fd, EVENT_TYPE_WRITE, eloop_uloop_event_cb, fd, fd); ++ else ++ eloop_unregister_sock(fd->fd, EVENT_TYPE_WRITE); ++ } ++} ++ ++static bool uloop_timeout_poll_handler(struct os_reltime *tv, bool tv_set) ++{ ++ struct os_reltime tv_uloop; ++ int timeout_ms = uloop_get_next_timeout(); ++ ++ if (timeout_ms < 0) ++ return false; ++ ++ tv_uloop.sec = timeout_ms / 1000; ++ tv_uloop.usec = (timeout_ms % 1000) * 1000; ++ ++ if (!tv_set || os_reltime_before(&tv_uloop, tv)) { ++ *tv = tv_uloop; ++ return true; ++ } ++ ++ return false; ++} ++ ++static void uloop_poll_handler(void) ++{ ++ uloop_run_timeout(0); ++} ++ ++void eloop_add_uloop(void) ++{ ++ static bool init_done = false; ++ ++ if (!init_done) { ++ uloop_init(); ++ uloop_fd_set_cb = eloop_uloop_fd_cb; ++ init_done = true; ++ } ++ ++ eloop_register_cb(uloop_poll_handler, uloop_timeout_poll_handler); ++} diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch new file mode 100644 index 00000000000000..c8bbfd43d83370 --- /dev/null +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -0,0 +1,543 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -168,9 +168,21 @@ OBJS += ../src/eapol_auth/eapol_auth_sm. + + ifdef CONFIG_UBUS + CFLAGS += -DUBUS_SUPPORT +-OBJS += ../src/utils/uloop.o + OBJS += ../src/ap/ubus.o +-LIBS += -lubox -lubus ++LIBS += -lubus ++NEED_ULOOP:=y ++endif ++ ++ifdef CONFIG_UCODE ++CFLAGS += -DUCODE_SUPPORT ++OBJS += ../src/utils/ucode.o ++OBJS += ../src/ap/ucode.o ++NEED_ULOOP:=y ++endif ++ ++ifdef NEED_ULOOP ++OBJS += ../src/utils/uloop.o ++LIBS += -lubox + endif + + ifdef CONFIG_CODE_COVERAGE +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -1007,6 +1007,7 @@ int main(int argc, char *argv[]) + } + + hostapd_global_ctrl_iface_init(&interfaces); ++ hostapd_ucode_init(&interfaces); + + if (hostapd_global_run(&interfaces, daemonize, pid_file)) { + wpa_printf(MSG_ERROR, "Failed to start eloop"); +@@ -1016,6 +1017,7 @@ int main(int argc, char *argv[]) + ret = 0; + + out: ++ hostapd_ucode_free(); + hostapd_global_ctrl_iface_deinit(&interfaces); + /* Deinitialize all interfaces */ + for (i = 0; i < interfaces.count; i++) { +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -19,6 +19,7 @@ + #include "ap_config.h" + #include "drivers/driver.h" + #include "ubus.h" ++#include "ucode.h" + + #define OCE_STA_CFON_ENABLED(hapd) \ + ((hapd->conf->oce & OCE_STA_CFON) && \ +@@ -51,6 +52,10 @@ struct hapd_interfaces { + struct hostapd_config * (*config_read_cb)(const char *config_fname); + int (*ctrl_iface_init)(struct hostapd_data *hapd); + void (*ctrl_iface_deinit)(struct hostapd_data *hapd); ++ int (*ctrl_iface_recv)(struct hostapd_data *hapd, ++ char *buf, char *reply, int reply_size, ++ struct sockaddr_storage *from, ++ socklen_t fromlen); + int (*for_each_interface)(struct hapd_interfaces *interfaces, + int (*cb)(struct hostapd_iface *iface, + void *ctx), void *ctx); +@@ -186,6 +191,7 @@ struct hostapd_data { + struct hostapd_config *iconf; + struct hostapd_bss_config *conf; + struct hostapd_ubus_bss ubus; ++ struct hostapd_ucode_bss ucode; + int interface_added; /* virtual interface added for this BSS */ + unsigned int started:1; + unsigned int disabled:1; +@@ -506,6 +512,7 @@ struct hostapd_sta_info { + */ + struct hostapd_iface { + struct hapd_interfaces *interfaces; ++ struct hostapd_ucode_iface ucode; + void *owner; + char *config_fname; + struct hostapd_config *conf; +@@ -706,6 +713,8 @@ struct hostapd_iface * hostapd_init(stru + struct hostapd_iface * + hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, + const char *config_fname, int debug); ++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon); ++void hostapd_bss_deinit(struct hostapd_data *hapd); + void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + int reassoc); + void hostapd_interface_deinit_free(struct hostapd_iface *iface); +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -252,6 +252,8 @@ int hostapd_reload_config(struct hostapd + struct hostapd_config *newconf, *oldconf; + size_t j; + ++ hostapd_ucode_reload_bss(hapd); ++ + if (iface->config_fname == NULL) { + /* Only in-memory config in use - assume it has been updated */ + hostapd_clear_old(iface); +@@ -435,6 +437,7 @@ void hostapd_free_hapd_data(struct hosta + hapd->beacon_set_done = 0; + + wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); ++ hostapd_ucode_free_bss(hapd); + hostapd_ubus_free_bss(hapd); + accounting_deinit(hapd); + hostapd_deinit_wpa(hapd); +@@ -599,6 +602,7 @@ void hostapd_cleanup_iface_partial(struc + static void hostapd_cleanup_iface(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); ++ hostapd_ucode_free_iface(iface); + eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); + eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, + NULL); +@@ -1189,6 +1193,7 @@ static int hostapd_start_beacon(struct h + hapd->driver->set_operstate(hapd->drv_priv, 1); + + hostapd_ubus_add_bss(hapd); ++ hostapd_ucode_add_bss(hapd); + + return 0; + } +@@ -1211,8 +1216,7 @@ static int hostapd_start_beacon(struct h + * initialized. Most of the modules that are initialized here will be + * deinitialized in hostapd_cleanup(). + */ +-static int hostapd_setup_bss(struct hostapd_data *hapd, int first, +- bool start_beacon) ++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon) + { + struct hostapd_bss_config *conf = hapd->conf; + u8 ssid[SSID_MAX_LEN + 1]; +@@ -2698,7 +2702,7 @@ hostapd_alloc_bss_data(struct hostapd_if + } + + +-static void hostapd_bss_deinit(struct hostapd_data *hapd) ++void hostapd_bss_deinit(struct hostapd_data *hapd) + { + if (!hapd) + return; +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -195,8 +195,20 @@ endif + ifdef CONFIG_UBUS + CFLAGS += -DUBUS_SUPPORT + OBJS += ubus.o ++LIBS += -lubus ++NEED_ULOOP:=y ++endif ++ ++ifdef CONFIG_UCODE ++CFLAGS += -DUCODE_SUPPORT ++OBJS += ../src/utils/ucode.o ++OBJS += ucode.o ++NEED_ULOOP:=y ++endif ++ ++ifdef NEED_ULOOP + OBJS += ../src/utils/uloop.o +-LIBS += -lubox -lubus ++LIBS += -lubox + endif + + ifdef CONFIG_CODE_COVERAGE +@@ -997,6 +1009,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o + ifdef CONFIG_UBUS + OBJS += ../src/ap/ubus.o + endif ++ifdef CONFIG_UCODE ++OBJS += ../src/ap/ucode.o ++endif + endif + + CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -1044,6 +1044,7 @@ void wpa_supplicant_set_state(struct wpa + sme_sched_obss_scan(wpa_s, 0); + } + wpa_s->wpa_state = state; ++ wpas_ucode_update_state(wpa_s); + + #ifdef CONFIG_BGSCAN + if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid) +@@ -7594,6 +7595,7 @@ struct wpa_supplicant * wpa_supplicant_a + #endif /* CONFIG_P2P */ + + wpas_ubus_add_bss(wpa_s); ++ wpas_ucode_add_bss(wpa_s); + + return wpa_s; + } +@@ -7621,6 +7623,7 @@ int wpa_supplicant_remove_iface(struct w + struct wpa_supplicant *parent = wpa_s->parent; + #endif /* CONFIG_MESH */ + ++ wpas_ucode_free_bss(wpa_s); + wpas_ubus_free_bss(wpa_s); + + /* Remove interface from the global list of interfaces */ +@@ -7931,6 +7934,7 @@ struct wpa_global * wpa_supplicant_init( + + eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0, + wpas_periodic, global, NULL); ++ wpas_ucode_init(global); + + return global; + } +@@ -7969,12 +7973,8 @@ int wpa_supplicant_run(struct wpa_global + eloop_register_signal_terminate(wpa_supplicant_terminate, global); + eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); + +- wpas_ubus_add(global); +- + eloop_run(); + +- wpas_ubus_free(global); +- + return 0; + } + +@@ -8007,6 +8007,8 @@ void wpa_supplicant_deinit(struct wpa_gl + + wpas_notify_supplicant_deinitialized(global); + ++ wpas_ucode_free(); ++ + eap_peer_unregister_methods(); + #ifdef CONFIG_AP + eap_server_unregister_methods(); +--- a/wpa_supplicant/wpa_supplicant_i.h ++++ b/wpa_supplicant/wpa_supplicant_i.h +@@ -22,6 +22,7 @@ + #include "wmm_ac.h" + #include "pasn/pasn_common.h" + #include "ubus.h" ++#include "ucode.h" + + extern const char *const wpa_supplicant_version; + extern const char *const wpa_supplicant_license; +@@ -689,6 +690,7 @@ struct wpa_supplicant { + unsigned char perm_addr[ETH_ALEN]; + char ifname[100]; + struct wpas_ubus_bss ubus; ++ struct wpas_ucode_bss ucode; + #ifdef CONFIG_MATCH_IFACE + int matched; + #endif /* CONFIG_MATCH_IFACE */ +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -4856,6 +4856,7 @@ try_again: + return -1; + } + ++ interface->ctrl_iface_recv = hostapd_ctrl_iface_receive_process; + wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); + + return 0; +@@ -4957,6 +4958,7 @@ fail: + os_free(fname); + + interface->global_ctrl_sock = s; ++ interface->ctrl_iface_recv = hostapd_ctrl_iface_receive_process; + eloop_register_read_sock(s, hostapd_global_ctrl_iface_receive, + interface, NULL); + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -3787,6 +3787,25 @@ struct wpa_driver_ops { + const char *ifname); + + /** ++ * if_rename - Rename a virtual interface ++ * @priv: Private driver interface data ++ * @type: Interface type ++ * @ifname: Interface name of the virtual interface to be renamed ++ * (NULL when renaming the AP BSS interface) ++ * @new_name: New interface name of the virtual interface ++ * Returns: 0 on success, -1 on failure ++ */ ++ int (*if_rename)(void *priv, enum wpa_driver_if_type type, ++ const char *ifname, const char *new_name); ++ ++ /** ++ * set_first_bss - Make a virtual interface the first (primary) bss ++ * @priv: Private driver interface data ++ * Returns: 0 on success, -1 on failure ++ */ ++ int (*set_first_bss)(void *priv); ++ ++ /** + * set_sta_vlan - Bind a station into a specific interface (AP only) + * @priv: Private driver interface data + * @ifname: Interface (main or virtual BSS or VLAN) +@@ -6440,6 +6459,7 @@ union wpa_event_data { + + /** + * struct ch_switch ++ * @count: Count until channel switch activates + * @freq: Frequency of new channel in MHz + * @ht_enabled: Whether this is an HT channel + * @ch_offset: Secondary channel offset +@@ -6450,6 +6470,7 @@ union wpa_event_data { + * @punct_bitmap: Puncturing bitmap + */ + struct ch_switch { ++ int count; + int freq; + int ht_enabled; + int ch_offset; +--- a/src/drivers/driver_nl80211_event.c ++++ b/src/drivers/driver_nl80211_event.c +@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct + struct nlattr *bw, struct nlattr *cf1, + struct nlattr *cf2, + struct nlattr *punct_bitmap, ++ struct nlattr *count, + int finished) + { + struct i802_bss *bss; +@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct + data.ch_switch.cf1 = nla_get_u32(cf1); + if (cf2) + data.ch_switch.cf2 = nla_get_u32(cf2); ++ if (count) ++ data.ch_switch.count = nla_get_u32(count); + + if (finished) + bss->flink->freq = data.ch_switch.freq; +@@ -3912,6 +3915,7 @@ static void do_process_drv_event(struct + tb[NL80211_ATTR_CENTER_FREQ1], + tb[NL80211_ATTR_CENTER_FREQ2], + tb[NL80211_ATTR_PUNCT_BITMAP], ++ tb[NL80211_ATTR_CH_SWITCH_COUNT], + 0); + break; + case NL80211_CMD_CH_SWITCH_NOTIFY: +@@ -3924,6 +3928,7 @@ static void do_process_drv_event(struct + tb[NL80211_ATTR_CENTER_FREQ1], + tb[NL80211_ATTR_CENTER_FREQ2], + tb[NL80211_ATTR_PUNCT_BITMAP], ++ NULL, + 1); + break; + case NL80211_CMD_DISCONNECT: +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -5389,6 +5389,7 @@ void supplicant_event(void *ctx, enum wp + event_to_string(event), event); + #endif /* CONFIG_NO_STDOUT_DEBUG */ + ++ wpas_ucode_event(wpa_s, event, data); + switch (event) { + case EVENT_AUTH: + #ifdef CONFIG_FST +--- a/src/ap/ap_drv_ops.h ++++ b/src/ap/ap_drv_ops.h +@@ -393,6 +393,23 @@ static inline int hostapd_drv_stop_ap(st + return hapd->driver->stop_ap(hapd->drv_priv); + } + ++static inline int hostapd_drv_if_rename(struct hostapd_data *hapd, ++ enum wpa_driver_if_type type, ++ const char *ifname, ++ const char *new_name) ++{ ++ if (!hapd->driver || !hapd->driver->if_rename || !hapd->drv_priv) ++ return -1; ++ return hapd->driver->if_rename(hapd->drv_priv, type, ifname, new_name); ++} ++ ++static inline int hostapd_drv_set_first_bss(struct hostapd_data *hapd) ++{ ++ if (!hapd->driver || !hapd->driver->set_first_bss || !hapd->drv_priv) ++ return 0; ++ return hapd->driver->set_first_bss(hapd->drv_priv); ++} ++ + static inline int hostapd_drv_channel_info(struct hostapd_data *hapd, + struct wpa_channel_info *ci) + { +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -1333,7 +1333,7 @@ static void wpa_driver_nl80211_event_rtm + } + wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", + namebuf, ifname); +- if (os_strcmp(drv->first_bss->ifname, ifname) != 0) { ++ if (drv->first_bss->ifindex != ifi->ifi_index) { + wpa_printf(MSG_DEBUG, + "nl80211: Not the main interface (%s) - do not indicate interface down", + drv->first_bss->ifname); +@@ -1369,7 +1369,7 @@ static void wpa_driver_nl80211_event_rtm + } + wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", + namebuf, ifname); +- if (os_strcmp(drv->first_bss->ifname, ifname) != 0) { ++ if (drv->first_bss->ifindex != ifi->ifi_index) { + wpa_printf(MSG_DEBUG, + "nl80211: Not the main interface (%s) - do not indicate interface up", + drv->first_bss->ifname); +@@ -8432,6 +8432,7 @@ static void *i802_init(struct hostapd_da + char master_ifname[IFNAMSIZ]; + int ifindex, br_ifindex = 0; + int br_added = 0; ++ int err; + + bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, + params->global_priv, 1, +@@ -8491,21 +8492,17 @@ static void *i802_init(struct hostapd_da + (params->num_bridge == 0 || !params->bridge[0])) + add_ifidx(drv, br_ifindex, drv->ifindex); + +- if (bss->added_if_into_bridge || bss->already_in_bridge) { +- int err; +- +- drv->rtnl_sk = nl_socket_alloc(); +- if (drv->rtnl_sk == NULL) { +- wpa_printf(MSG_ERROR, "nl80211: Failed to allocate nl_sock"); +- goto failed; +- } ++ drv->rtnl_sk = nl_socket_alloc(); ++ if (drv->rtnl_sk == NULL) { ++ wpa_printf(MSG_ERROR, "nl80211: Failed to allocate nl_sock"); ++ goto failed; ++ } + +- err = nl_connect(drv->rtnl_sk, NETLINK_ROUTE); +- if (err) { +- wpa_printf(MSG_ERROR, "nl80211: Failed to connect nl_sock to NETLINK_ROUTE: %s", +- nl_geterror(err)); +- goto failed; +- } ++ err = nl_connect(drv->rtnl_sk, NETLINK_ROUTE); ++ if (err) { ++ wpa_printf(MSG_ERROR, "nl80211: Failed to connect nl_sock to NETLINK_ROUTE: %s", ++ nl_geterror(err)); ++ goto failed; + } + + if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { +@@ -8875,6 +8872,50 @@ static int wpa_driver_nl80211_if_remove( + return 0; + } + ++static int wpa_driver_nl80211_if_rename(struct i802_bss *bss, ++ enum wpa_driver_if_type type, ++ const char *ifname, const char *new_name) ++{ ++ struct wpa_driver_nl80211_data *drv = bss->drv; ++ struct ifinfomsg ifi = { ++ .ifi_family = AF_UNSPEC, ++ .ifi_index = bss->ifindex, ++ }; ++ struct nl_msg *msg; ++ int res = -ENOMEM; ++ ++ if (ifname) ++ ifi.ifi_index = if_nametoindex(ifname); ++ ++ msg = nlmsg_alloc_simple(RTM_SETLINK, 0); ++ if (!msg) ++ return res; ++ ++ if (nlmsg_append(msg, &ifi, sizeof(ifi), NLMSG_ALIGNTO) < 0) ++ goto out; ++ ++ if (nla_put_string(msg, IFLA_IFNAME, new_name)) ++ goto out; ++ ++ res = nl_send_auto_complete(drv->rtnl_sk, msg); ++ if (res < 0) ++ goto out; ++ ++ res = nl_wait_for_ack(drv->rtnl_sk); ++ if (res) { ++ wpa_printf(MSG_INFO, ++ "nl80211: Renaming device %s to %s failed: %s", ++ ifname ? ifname : bss->ifname, new_name, nl_geterror(res)); ++ goto out; ++ } ++ ++ if (type == WPA_IF_AP_BSS && !ifname) ++ os_strlcpy(bss->ifname, new_name, sizeof(bss->ifname)); ++ ++out: ++ nlmsg_free(msg); ++ return res; ++} + + static int cookie_handler(struct nl_msg *msg, void *arg) + { +@@ -10513,6 +10554,37 @@ static int driver_nl80211_if_remove(void + } + + ++static int driver_nl80211_if_rename(void *priv, enum wpa_driver_if_type type, ++ const char *ifname, const char *new_name) ++{ ++ struct i802_bss *bss = priv; ++ return wpa_driver_nl80211_if_rename(bss, type, ifname, new_name); ++} ++ ++ ++static int driver_nl80211_set_first_bss(void *priv) ++{ ++ struct i802_bss *bss = priv, *tbss; ++ struct wpa_driver_nl80211_data *drv = bss->drv; ++ ++ if (drv->first_bss == bss) ++ return 0; ++ ++ for (tbss = drv->first_bss; tbss; tbss = tbss->next) { ++ if (tbss->next != bss) ++ continue; ++ ++ tbss->next = bss->next; ++ bss->next = drv->first_bss; ++ drv->first_bss = bss; ++ drv->ctx = bss->ctx; ++ return 0; ++ } ++ ++ return -1; ++} ++ ++ + static int driver_nl80211_send_mlme(void *priv, const u8 *data, + size_t data_len, int noack, + unsigned int freq, +@@ -13697,6 +13769,8 @@ const struct wpa_driver_ops wpa_driver_n + .set_acl = wpa_driver_nl80211_set_acl, + .if_add = wpa_driver_nl80211_if_add, + .if_remove = driver_nl80211_if_remove, ++ .if_rename = driver_nl80211_if_rename, ++ .set_first_bss = driver_nl80211_set_first_bss, + .send_mlme = driver_nl80211_send_mlme, + .get_hw_feature_data = nl80211_get_hw_feature_data, + .sta_add = wpa_driver_nl80211_sta_add, diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch deleted file mode 100644 index 0c7627645f6983..00000000000000 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ /dev/null @@ -1,194 +0,0 @@ ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -2420,6 +2420,8 @@ static int hostapd_config_fill(struct ho - bss->isolate = atoi(pos); - } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { - bss->ap_max_inactivity = atoi(pos); -+ } else if (os_strcmp(buf, "config_id") == 0) { -+ bss->config_id = os_strdup(pos); - } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { - bss->skip_inactivity_poll = atoi(pos); - } else if (os_strcmp(buf, "config_id") == 0) { -@@ -3130,6 +3132,8 @@ static int hostapd_config_fill(struct ho - } - } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { - conf->acs_exclude_dfs = atoi(pos); -+ } else if (os_strcmp(buf, "radio_config_id") == 0) { -+ conf->config_id = os_strdup(pos); - } else if (os_strcmp(buf, "op_class") == 0) { - conf->op_class = atoi(pos); - } else if (os_strcmp(buf, "channel") == 0) { ---- a/src/ap/ap_config.c -+++ b/src/ap/ap_config.c -@@ -998,6 +998,7 @@ void hostapd_config_free(struct hostapd_ - - for (i = 0; i < conf->num_bss; i++) - hostapd_config_free_bss(conf->bss[i]); -+ os_free(conf->config_id); - os_free(conf->bss); - os_free(conf->supported_rates); - os_free(conf->basic_rates); ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -998,6 +998,7 @@ struct eht_phy_capabilities_info { - struct hostapd_config { - struct hostapd_bss_config **bss, *last_bss; - size_t num_bss; -+ char *config_id; - - u16 beacon_int; - int rts_threshold; ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -255,6 +255,10 @@ static int hostapd_iface_conf_changed(st - { - size_t i; - -+ if (newconf->config_id != oldconf->config_id) -+ if (strcmp(newconf->config_id, oldconf->config_id)) -+ return 1; -+ - if (newconf->num_bss != oldconf->num_bss) - return 1; - -@@ -268,7 +272,7 @@ static int hostapd_iface_conf_changed(st - } - - --int hostapd_reload_config(struct hostapd_iface *iface) -+int hostapd_reload_config(struct hostapd_iface *iface, int reconf) - { - struct hapd_interfaces *interfaces = iface->interfaces; - struct hostapd_data *hapd = iface->bss[0]; -@@ -296,6 +300,9 @@ int hostapd_reload_config(struct hostapd - char *fname; - int res; - -+ if (reconf) -+ return -1; -+ - hostapd_clear_old(iface); - - wpa_printf(MSG_DEBUG, -@@ -322,6 +329,24 @@ int hostapd_reload_config(struct hostapd - wpa_printf(MSG_ERROR, - "Failed to enable interface on config reload"); - return res; -+ } else { -+ for (j = 0; j < iface->num_bss; j++) { -+ hapd = iface->bss[j]; -+ if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) { -+ hostapd_flush_old_stations(iface->bss[j], -+ WLAN_REASON_PREV_AUTH_NOT_VALID); -+#ifdef CONFIG_WEP -+ hostapd_broadcast_wep_clear(iface->bss[j]); -+#endif -+ -+#ifndef CONFIG_NO_RADIUS -+ /* TODO: update dynamic data based on changed configuration -+ * items (e.g., open/close sockets, etc.) */ -+ radius_client_flush(iface->bss[j]->radius, 0); -+#endif /* CONFIG_NO_RADIUS */ -+ wpa_printf(MSG_INFO, "bss %zu changed", j); -+ } -+ } - } - iface->conf = newconf; - -@@ -338,6 +363,12 @@ int hostapd_reload_config(struct hostapd - - for (j = 0; j < iface->num_bss; j++) { - hapd = iface->bss[j]; -+ if (hapd->config_id) { -+ os_free(hapd->config_id); -+ hapd->config_id = NULL; -+ } -+ if (newconf->bss[j]->config_id) -+ hapd->config_id = strdup(newconf->bss[j]->config_id); - if (!hapd->conf->config_id || !newconf->bss[j]->config_id || - os_strcmp(hapd->conf->config_id, - newconf->bss[j]->config_id) != 0) -@@ -2700,6 +2731,10 @@ hostapd_alloc_bss_data(struct hostapd_if - hapd->iconf = conf; - hapd->conf = bss; - hapd->iface = hapd_iface; -+ if (bss && bss->config_id) -+ hapd->config_id = strdup(bss->config_id); -+ else -+ hapd->config_id = NULL; - if (conf) - hapd->driver = conf->driver; - hapd->ctrl_sock = -1; ---- a/src/ap/hostapd.h -+++ b/src/ap/hostapd.h -@@ -47,7 +47,7 @@ struct mesh_conf; - struct hostapd_iface; - - struct hapd_interfaces { -- int (*reload_config)(struct hostapd_iface *iface); -+ int (*reload_config)(struct hostapd_iface *iface, int reconf); - struct hostapd_config * (*config_read_cb)(const char *config_fname); - int (*ctrl_iface_init)(struct hostapd_data *hapd); - void (*ctrl_iface_deinit)(struct hostapd_data *hapd); -@@ -186,6 +186,7 @@ struct hostapd_data { - struct hostapd_config *iconf; - struct hostapd_bss_config *conf; - struct hostapd_ubus_bss ubus; -+ char *config_id; - int interface_added; /* virtual interface added for this BSS */ - unsigned int started:1; - unsigned int disabled:1; -@@ -689,7 +690,7 @@ struct hostapd_iface { - int hostapd_for_each_interface(struct hapd_interfaces *interfaces, - int (*cb)(struct hostapd_iface *iface, - void *ctx), void *ctx); --int hostapd_reload_config(struct hostapd_iface *iface); -+int hostapd_reload_config(struct hostapd_iface *iface, int reconf); - void hostapd_reconfig_encryption(struct hostapd_data *hapd); - struct hostapd_data * - hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -5322,6 +5322,9 @@ static int wpa_driver_nl80211_set_ap(voi - if (ret) { - wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", - ret, strerror(-ret)); -+ if (!bss->flink->beacon_set) -+ ret = 0; -+ bss->flink->beacon_set = 0; - } else { - link->beacon_set = 1; - nl80211_set_bss(bss, params->cts_protect, params->preamble, ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -187,7 +187,7 @@ static int hostapd_ctrl_iface_update(str - iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; - reload_opts = txt; - -- hostapd_reload_config(iface); -+ hostapd_reload_config(iface, 0); - - iface->interfaces->config_read_cb = config_read_cb; - } ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -410,7 +410,7 @@ static void handle_term(int sig, void *s - - static int handle_reload_iface(struct hostapd_iface *iface, void *ctx) - { -- if (hostapd_reload_config(iface) < 0) { -+ if (hostapd_reload_config(iface, 0) < 0) { - wpa_printf(MSG_WARNING, "Failed to read new configuration " - "file - continuing with old."); - } ---- a/src/ap/wps_hostapd.c -+++ b/src/ap/wps_hostapd.c -@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo - - wpa_printf(MSG_DEBUG, "WPS: Reload configuration data"); - if (iface->interfaces == NULL || -- iface->interfaces->reload_config(iface) < 0) { -+ iface->interfaces->reload_config(iface, 1) < 0) { - wpa_printf(MSG_WARNING, "WPS: Failed to reload the updated " - "configuration"); - } diff --git a/package/network/services/hostapd/patches/701-reload_config_inline.patch b/package/network/services/hostapd/patches/701-reload_config_inline.patch new file mode 100644 index 00000000000000..3c62bf670f5bc5 --- /dev/null +++ b/package/network/services/hostapd/patches/701-reload_config_inline.patch @@ -0,0 +1,33 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -4816,7 +4816,12 @@ struct hostapd_config * hostapd_config_r + int errors = 0; + size_t i; + +- f = fopen(fname, "r"); ++ if (!strncmp(fname, "data:", 5)) { ++ f = fmemopen((void *)(fname + 5), strlen(fname + 5), "r"); ++ fname = ""; ++ } else { ++ f = fopen(fname, "r"); ++ } + if (f == NULL) { + wpa_printf(MSG_ERROR, "Could not open configuration file '%s' " + "for reading.", fname); +--- a/wpa_supplicant/config_file.c ++++ b/wpa_supplicant/config_file.c +@@ -326,8 +326,13 @@ struct wpa_config * wpa_config_read(cons + while (cred_tail && cred_tail->next) + cred_tail = cred_tail->next; + ++ if (!strncmp(name, "data:", 5)) { ++ f = fmemopen((void *)(name + 5), strlen(name + 5), "r"); ++ name = ""; ++ } else { ++ f = fopen(name, "r"); ++ } + wpa_printf(MSG_DEBUG, "Reading configuration file '%s'", name); +- f = fopen(name, "r"); + if (f == NULL) { + wpa_printf(MSG_ERROR, "Failed to open config file '%s', " + "error: %s", name, strerror(errno)); diff --git a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch index 61f33acb6e8e9f..63d1b8a3b83533 100644 --- a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch +++ b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch @@ -30,7 +30,7 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3355,6 +3355,8 @@ static int hostapd_config_fill(struct ho +@@ -3351,6 +3351,8 @@ static int hostapd_config_fill(struct ho #ifndef CONFIG_NO_VLAN } else if (os_strcmp(buf, "dynamic_vlan") == 0) { bss->ssid.dynamic_vlan = atoi(pos); diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch index 0bb00f9555476e..089c1ddc2461ba 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2850,6 +2850,14 @@ static int hostapd_config_fill(struct ho +@@ -2848,6 +2848,14 @@ static int hostapd_config_fill(struct ho line, bss->max_num_sta, MAX_STA_COUNT); return 1; } @@ -17,7 +17,7 @@ } else if (os_strcmp(buf, "extended_key_id") == 0) { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -734,6 +734,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -742,6 +742,7 @@ void hostapd_cleanup_cs_params(struct ho void hostapd_periodic_iface(struct hostapd_iface *iface); int hostapd_owe_trans_get_info(struct hostapd_data *hapd); void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); @@ -27,10 +27,10 @@ void hostapd_cleanup_cca_params(struct hostapd_data *hapd); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -272,6 +272,30 @@ static int hostapd_iface_conf_changed(st +@@ -244,6 +244,29 @@ static int hostapd_iface_conf_changed(st + return 0; } - +static inline int hostapd_iface_num_sta(struct hostapd_iface *iface) +{ + int num_sta = 0; @@ -54,10 +54,9 @@ + + return 0; +} -+ - int hostapd_reload_config(struct hostapd_iface *iface, int reconf) + + int hostapd_reload_config(struct hostapd_iface *iface) { - struct hapd_interfaces *interfaces = iface->interfaces; --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1252,7 +1252,7 @@ void handle_probe_req(struct hostapd_dat @@ -71,7 +70,7 @@ " since no room for additional STA", --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1037,6 +1037,8 @@ struct hostapd_config { +@@ -1039,6 +1039,8 @@ struct hostapd_config { unsigned int track_sta_max_num; unsigned int track_sta_max_age; diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index 563fe5b5fbbd1b..0795ed15a1402b 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3009,6 +3009,8 @@ static int hostapd_config_fill(struct ho +@@ -3007,6 +3007,8 @@ static int hostapd_config_fill(struct ho wpa_printf(MSG_INFO, "Line %d: Obsolete peerkey parameter ignored", line); #ifdef CONFIG_IEEE80211R_AP diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index 6b6cc0fad79934..ce64513a421b42 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -10,7 +10,7 @@ int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/x_snoop.c +++ b/src/ap/x_snoop.c -@@ -33,14 +33,16 @@ int x_snoop_init(struct hostapd_data *ha +@@ -33,28 +33,31 @@ int x_snoop_init(struct hostapd_data *ha hapd->x_snoop_initialized = true; @@ -29,13 +29,20 @@ wpa_printf(MSG_DEBUG, "x_snoop: Failed to enable proxyarp on the bridge port"); return -1; -@@ -54,7 +56,8 @@ int x_snoop_init(struct hostapd_data *ha + } + + if (hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, +- 1)) { ++ conf->snoop_iface[0] ? conf->snoop_iface : NULL, 1)) { + wpa_printf(MSG_DEBUG, + "x_snoop: Failed to enable accepting gratuitous ARP on the bridge"); + return -1; } #ifdef CONFIG_IPV6 - if (hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) { + if (!conf->snoop_iface[0] && -+ hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) { ++ hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, NULL, 1)) { wpa_printf(MSG_DEBUG, "x_snoop: Failed to enable multicast snooping on the bridge"); return -1; @@ -44,15 +51,29 @@ struct hostapd_bss_config *conf = hapd->conf; struct l2_packet_data *l2; + const char *ifname = conf->bridge; - -- l2 = l2_packet_init(conf->bridge, NULL, ETH_P_ALL, handler, hapd, 1); ++ + if (conf->snoop_iface[0]) + ifname = conf->snoop_iface; -+ + +- l2 = l2_packet_init(conf->bridge, NULL, ETH_P_ALL, handler, hapd, 1); + l2 = l2_packet_init(ifname, NULL, ETH_P_ALL, handler, hapd, 1); if (l2 == NULL) { wpa_printf(MSG_DEBUG, "x_snoop: Failed to initialize L2 packet processing %s", +@@ -127,9 +134,12 @@ void x_snoop_mcast_to_ucast_convert_send + + void x_snoop_deinit(struct hostapd_data *hapd) + { ++ struct hostapd_bss_config *conf = hapd->conf; ++ + if (!hapd->x_snoop_initialized) + return; +- hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, 0); ++ hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, ++ conf->snoop_iface[0] ? conf->snoop_iface : NULL, 0); + hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 0); + hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, 0); + hapd->x_snoop_initialized = false; --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2322,6 +2322,8 @@ static int hostapd_config_fill(struct ho @@ -64,3 +85,55 @@ } else if (os_strcmp(buf, "vlan_bridge") == 0) { os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge)); } else if (os_strcmp(buf, "wds_bridge") == 0) { +--- a/src/ap/ap_drv_ops.h ++++ b/src/ap/ap_drv_ops.h +@@ -366,12 +366,12 @@ static inline int hostapd_drv_br_port_se + + static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd, + enum drv_br_net_param param, +- unsigned int val) ++ const char *ifname, unsigned int val) + { + if (hapd->driver == NULL || hapd->drv_priv == NULL || + hapd->driver->br_set_net_param == NULL) + return -1; +- return hapd->driver->br_set_net_param(hapd->drv_priv, param, val); ++ return hapd->driver->br_set_net_param(hapd->drv_priv, param, ifname, val); + } + + static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd, +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -4209,7 +4209,7 @@ struct wpa_driver_ops { + * Returns: 0 on success, negative (<0) on failure + */ + int (*br_set_net_param)(void *priv, enum drv_br_net_param param, +- unsigned int val); ++ const char *ifname, unsigned int val); + + /** + * get_wowlan - Get wake-on-wireless status +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -12168,7 +12168,7 @@ static const char * drv_br_net_param_str + + + static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param, +- unsigned int val) ++ const char *ifname, unsigned int val) + { + struct i802_bss *bss = priv; + char path[128]; +@@ -12194,8 +12194,11 @@ static int wpa_driver_br_set_net_param(v + return -EINVAL; + } + ++ if (!ifname) ++ ifname = bss->brname; ++ + os_snprintf(path, sizeof(path), "/proc/sys/net/ipv%d/conf/%s/%s", +- ip_version, bss->brname, param_txt); ++ ip_version, ifname, param_txt); + + set_val: + if (linux_write_system_file(path, val)) diff --git a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch index 124f5ea6bae525..97c32df7044646 100644 --- a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch +++ b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch @@ -18,7 +18,7 @@ #ifdef CONFIG_HS20 static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf, -@@ -4066,10 +4066,10 @@ static int hostapd_config_fill(struct ho +@@ -4062,10 +4062,10 @@ static int hostapd_config_fill(struct ho bss->gas_frag_limit = val; } else if (os_strcmp(buf, "gas_comeback_delay") == 0) { bss->gas_comeback_delay = atoi(pos); @@ -32,7 +32,7 @@ os_free(bss->dump_msk_file); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1534,6 +1534,7 @@ static int hostapd_setup_bss(struct host +@@ -1486,6 +1486,7 @@ int hostapd_setup_bss(struct hostapd_dat wpa_printf(MSG_ERROR, "GAS server initialization failed"); return -1; } @@ -40,7 +40,7 @@ if (conf->qos_map_set_len && hostapd_drv_set_qos_map(hapd, conf->qos_map_set, -@@ -1541,7 +1542,6 @@ static int hostapd_setup_bss(struct host +@@ -1493,7 +1494,6 @@ int hostapd_setup_bss(struct hostapd_dat wpa_printf(MSG_ERROR, "Failed to initialize QoS Map"); return -1; } diff --git a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch index 946b4533bf241a..2c705a68cf0acf 100644 --- a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch +++ b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch @@ -98,7 +98,7 @@ hapd->conf->own_ip_addr.af == AF_INET && --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2690,6 +2690,8 @@ static int hostapd_config_fill(struct ho +@@ -2688,6 +2688,8 @@ static int hostapd_config_fill(struct ho } else if (os_strcmp(buf, "iapp_interface") == 0) { wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used"); #endif /* CONFIG_IAPP */ diff --git a/package/network/services/hostapd/patches/761-shared_das_port.patch b/package/network/services/hostapd/patches/761-shared_das_port.patch index dad7afddf13b66..cbb2a1be3c4718 100644 --- a/package/network/services/hostapd/patches/761-shared_das_port.patch +++ b/package/network/services/hostapd/patches/761-shared_das_port.patch @@ -10,7 +10,7 @@ unsigned int time_window; --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1471,6 +1471,7 @@ static int hostapd_setup_bss(struct host +@@ -1423,6 +1423,7 @@ int hostapd_setup_bss(struct hostapd_dat os_memset(&das_conf, 0, sizeof(das_conf)); das_conf.port = conf->radius_das_port; diff --git a/package/network/services/hostapd/patches/770-radius_server.patch b/package/network/services/hostapd/patches/770-radius_server.patch new file mode 100644 index 00000000000000..8837a26257b3d9 --- /dev/null +++ b/package/network/services/hostapd/patches/770-radius_server.patch @@ -0,0 +1,154 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -63,6 +63,10 @@ endif + OBJS += main.o + OBJS += config_file.o + ++ifdef CONFIG_RADIUS_SERVER ++OBJS += radius.o ++endif ++ + OBJS += ../src/ap/hostapd.o + OBJS += ../src/ap/wpa_auth_glue.o + OBJS += ../src/ap/drv_callbacks.o +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -40,6 +40,7 @@ struct hapd_global { + + static struct hapd_global global; + ++extern int radius_main(int argc, char **argv); + + #ifndef CONFIG_NO_HOSTAPD_LOGGER + static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, +@@ -771,6 +772,11 @@ int main(int argc, char *argv[]) + if (os_program_init()) + return -1; + ++#ifdef RADIUS_SERVER ++ if (strstr(argv[0], "radius")) ++ return radius_main(argc, argv); ++#endif ++ + os_memset(&interfaces, 0, sizeof(interfaces)); + interfaces.reload_config = hostapd_reload_config; + interfaces.config_read_cb = hostapd_config_read; +--- a/src/radius/radius_server.c ++++ b/src/radius/radius_server.c +@@ -63,6 +63,12 @@ struct radius_server_counters { + u32 unknown_acct_types; + }; + ++struct radius_accept_attr { ++ u8 type; ++ u16 len; ++ void *data; ++}; ++ + /** + * struct radius_session - Internal RADIUS server data for a session + */ +@@ -90,7 +96,7 @@ struct radius_session { + unsigned int macacl:1; + unsigned int t_c_filtering:1; + +- struct hostapd_radius_attr *accept_attr; ++ struct radius_accept_attr *accept_attr; + + u32 t_c_timestamp; /* Last read T&C timestamp from user DB */ + }; +@@ -394,6 +400,7 @@ static void radius_server_session_free(s + radius_msg_free(sess->last_reply); + os_free(sess->username); + os_free(sess->nas_ip); ++ os_free(sess->accept_attr); + os_free(sess); + data->num_sess--; + } +@@ -554,6 +561,36 @@ radius_server_erp_find_key(struct radius + } + #endif /* CONFIG_ERP */ + ++static struct radius_accept_attr * ++radius_server_copy_attr(const struct hostapd_radius_attr *data) ++{ ++ const struct hostapd_radius_attr *attr; ++ struct radius_accept_attr *attr_new; ++ size_t data_size = 0; ++ void *data_buf; ++ int n_attr = 1; ++ ++ for (attr = data; attr; attr = attr->next) { ++ n_attr++; ++ data_size += wpabuf_len(attr->val); ++ } ++ ++ attr_new = os_zalloc(n_attr * sizeof(*attr) + data_size); ++ if (!attr_new) ++ return NULL; ++ ++ data_buf = &attr_new[n_attr]; ++ for (n_attr = 0, attr = data; attr; attr = attr->next) { ++ struct radius_accept_attr *cur = &attr_new[n_attr++]; ++ ++ cur->type = attr->type; ++ cur->len = wpabuf_len(attr->val); ++ cur->data = memcpy(data_buf, wpabuf_head(attr->val), cur->len); ++ data_buf += cur->len; ++ } ++ ++ return attr_new; ++} + + static struct radius_session * + radius_server_get_new_session(struct radius_server_data *data, +@@ -607,7 +644,7 @@ radius_server_get_new_session(struct rad + eap_user_free(tmp); + return NULL; + } +- sess->accept_attr = tmp->accept_attr; ++ sess->accept_attr = radius_server_copy_attr(tmp->accept_attr); + sess->macacl = tmp->macacl; + eap_user_free(tmp); + +@@ -1118,11 +1155,10 @@ radius_server_encapsulate_eap(struct rad + } + + if (code == RADIUS_CODE_ACCESS_ACCEPT) { +- struct hostapd_radius_attr *attr; +- for (attr = sess->accept_attr; attr; attr = attr->next) { +- if (!radius_msg_add_attr(msg, attr->type, +- wpabuf_head(attr->val), +- wpabuf_len(attr->val))) { ++ struct radius_accept_attr *attr; ++ for (attr = sess->accept_attr; attr->data; attr++) { ++ if (!radius_msg_add_attr(msg, attr->type, attr->data, ++ attr->len)) { + wpa_printf(MSG_ERROR, "Could not add RADIUS attribute"); + radius_msg_free(msg); + return NULL; +@@ -1211,11 +1247,10 @@ radius_server_macacl(struct radius_serve + } + + if (code == RADIUS_CODE_ACCESS_ACCEPT) { +- struct hostapd_radius_attr *attr; +- for (attr = sess->accept_attr; attr; attr = attr->next) { +- if (!radius_msg_add_attr(msg, attr->type, +- wpabuf_head(attr->val), +- wpabuf_len(attr->val))) { ++ struct radius_accept_attr *attr; ++ for (attr = sess->accept_attr; attr->data; attr++) { ++ if (!radius_msg_add_attr(msg, attr->type, attr->data, ++ attr->len)) { + wpa_printf(MSG_ERROR, "Could not add RADIUS attribute"); + radius_msg_free(msg); + return NULL; +@@ -2512,7 +2547,7 @@ static int radius_server_get_eap_user(vo + ret = data->get_eap_user(data->conf_ctx, identity, identity_len, + phase2, user); + if (ret == 0 && user) { +- sess->accept_attr = user->accept_attr; ++ sess->accept_attr = radius_server_copy_attr(user->accept_attr); + sess->remediation = user->remediation; + sess->macacl = user->macacl; + sess->t_c_timestamp = user->t_c_timestamp; diff --git a/package/network/services/hostapd/patches/990-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch b/package/network/services/hostapd/patches/990-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch index 51690def09c708..5809a3b7e8170f 100644 --- a/package/network/services/hostapd/patches/990-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch +++ b/package/network/services/hostapd/patches/990-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch @@ -13,7 +13,7 @@ Signed-off-by: David Bauer --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -12640,7 +12640,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12763,7 +12763,7 @@ char * wpa_supplicant_ctrl_iface_process if (wpas_ctrl_iface_coloc_intf_report(wpa_s, buf + 18)) reply_len = -1; #endif /* CONFIG_WNM */ @@ -22,7 +22,7 @@ Signed-off-by: David Bauer } else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) { if (ap_ctrl_iface_disassoc_imminent(wpa_s, buf + 18)) reply_len = -1; -@@ -12650,7 +12650,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12773,7 +12773,7 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) { if (ap_ctrl_iface_bss_tm_req(wpa_s, buf + 11)) reply_len = -1; diff --git a/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch index 99d800858f55aa..3f10fb1eef7602 100644 --- a/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch +++ b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch @@ -20,7 +20,7 @@ Signed-off-by: Stijn Tintel --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -3615,6 +3615,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -3563,6 +3563,8 @@ int hostapd_remove_iface(struct hapd_int void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { @@ -29,7 +29,7 @@ Signed-off-by: Stijn Tintel if (hapd->tkip_countermeasures) { hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_MICHAEL_MIC_FAILURE); -@@ -3622,10 +3624,16 @@ void hostapd_new_assoc_sta(struct hostap +@@ -3570,10 +3572,16 @@ void hostapd_new_assoc_sta(struct hostap } #ifdef CONFIG_IEEE80211BE diff --git a/package/network/services/hostapd/src/hostapd/radius.c b/package/network/services/hostapd/src/hostapd/radius.c new file mode 100644 index 00000000000000..362a22c276e38f --- /dev/null +++ b/package/network/services/hostapd/src/hostapd/radius.c @@ -0,0 +1,715 @@ +#include "utils/includes.h" +#include "utils/common.h" +#include "utils/eloop.h" +#include "crypto/crypto.h" +#include "crypto/tls.h" + +#include "ap/ap_config.h" +#include "eap_server/eap.h" +#include "radius/radius.h" +#include "radius/radius_server.h" +#include "eap_register.h" + +#include +#include +#include +#include +#include + +#include +#include + +#define VENDOR_ID_WISPR 14122 +#define VENDOR_ATTR_SIZE 6 + +struct radius_parse_attr_data { + unsigned int vendor; + u8 type; + int size; + char format; + const char *data; +}; + +struct radius_parse_attr_state { + struct hostapd_radius_attr *prev; + struct hostapd_radius_attr *attr; + struct wpabuf *buf; + void *attrdata; +}; + +struct radius_user_state { + struct avl_node node; + struct eap_user data; +}; + +struct radius_user_data { + struct kvlist users; + struct avl_tree user_state; + struct blob_attr *wildcard; +}; + +struct radius_state { + struct radius_server_data *radius; + struct eap_config eap; + + struct radius_user_data phase1, phase2; + const char *user_file; + time_t user_file_ts; + + int n_attrs; + struct hostapd_radius_attr *attrs; +}; + +struct radius_config { + struct tls_connection_params tls; + struct radius_server_conf radius; +}; + +enum { + USER_ATTR_PASSWORD, + USER_ATTR_HASH, + USER_ATTR_SALT, + USER_ATTR_METHODS, + USER_ATTR_RADIUS, + USER_ATTR_VLAN, + USER_ATTR_MAX_RATE_UP, + USER_ATTR_MAX_RATE_DOWN, + __USER_ATTR_MAX +}; + +static void radius_tls_event(void *ctx, enum tls_event ev, + union tls_event_data *data) +{ + switch (ev) { + case TLS_CERT_CHAIN_SUCCESS: + wpa_printf(MSG_DEBUG, "radius: remote certificate verification success"); + break; + case TLS_CERT_CHAIN_FAILURE: + wpa_printf(MSG_INFO, "radius: certificate chain failure: reason=%d depth=%d subject='%s' err='%s'", + data->cert_fail.reason, + data->cert_fail.depth, + data->cert_fail.subject, + data->cert_fail.reason_txt); + break; + case TLS_PEER_CERTIFICATE: + wpa_printf(MSG_DEBUG, "radius: peer certificate: depth=%d serial_num=%s subject=%s", + data->peer_cert.depth, + data->peer_cert.serial_num ? data->peer_cert.serial_num : "N/A", + data->peer_cert.subject); + break; + case TLS_ALERT: + if (data->alert.is_local) + wpa_printf(MSG_DEBUG, "radius: local TLS alert: %s", + data->alert.description); + else + wpa_printf(MSG_DEBUG, "radius: remote TLS alert: %s", + data->alert.description); + break; + case TLS_UNSAFE_RENEGOTIATION_DISABLED: + /* Not applicable to TLS server */ + break; + } +} + +static void radius_userdata_init(struct radius_user_data *u) +{ + kvlist_init(&u->users, kvlist_blob_len); + avl_init(&u->user_state, avl_strcmp, false, NULL); +} + +static void radius_userdata_free(struct radius_user_data *u) +{ + struct radius_user_state *s, *tmp; + + kvlist_free(&u->users); + free(u->wildcard); + u->wildcard = NULL; + avl_remove_all_elements(&u->user_state, s, node, tmp) + free(s); +} + +static void +radius_userdata_load(struct radius_user_data *u, struct blob_attr *data) +{ + enum { + USERSTATE_USERS, + USERSTATE_WILDCARD, + __USERSTATE_MAX, + }; + static const struct blobmsg_policy policy[__USERSTATE_MAX] = { + [USERSTATE_USERS] = { "users", BLOBMSG_TYPE_TABLE }, + [USERSTATE_WILDCARD] = { "wildcard", BLOBMSG_TYPE_ARRAY }, + }; + struct blob_attr *tb[__USERSTATE_MAX], *cur; + int rem; + + if (!data) + return; + + blobmsg_parse(policy, __USERSTATE_MAX, tb, blobmsg_data(data), blobmsg_len(data)); + + blobmsg_for_each_attr(cur, tb[USERSTATE_USERS], rem) + kvlist_set(&u->users, blobmsg_name(cur), cur); + + if (tb[USERSTATE_WILDCARD]) + u->wildcard = blob_memdup(tb[USERSTATE_WILDCARD]); +} + +static void +load_userfile(struct radius_state *s) +{ + enum { + USERDATA_PHASE1, + USERDATA_PHASE2, + __USERDATA_MAX + }; + static const struct blobmsg_policy policy[__USERDATA_MAX] = { + [USERDATA_PHASE1] = { "phase1", BLOBMSG_TYPE_TABLE }, + [USERDATA_PHASE2] = { "phase2", BLOBMSG_TYPE_TABLE }, + }; + struct blob_attr *tb[__USERDATA_MAX], *cur; + static struct blob_buf b; + struct stat st; + int rem; + + if (stat(s->user_file, &st)) + return; + + if (s->user_file_ts == st.st_mtime) + return; + + s->user_file_ts = st.st_mtime; + radius_userdata_free(&s->phase1); + radius_userdata_free(&s->phase2); + + blob_buf_init(&b, 0); + blobmsg_add_json_from_file(&b, s->user_file); + blobmsg_parse(policy, __USERDATA_MAX, tb, blob_data(b.head), blob_len(b.head)); + radius_userdata_load(&s->phase1, tb[USERDATA_PHASE1]); + radius_userdata_load(&s->phase2, tb[USERDATA_PHASE2]); + + blob_buf_free(&b); +} + +static struct blob_attr * +radius_user_get(struct radius_user_data *s, const char *name) +{ + struct blob_attr *cur; + int rem; + + cur = kvlist_get(&s->users, name); + if (cur) + return cur; + + blobmsg_for_each_attr(cur, s->wildcard, rem) { + static const struct blobmsg_policy policy = { + "name", BLOBMSG_TYPE_STRING + }; + struct blob_attr *pattern; + + if (blobmsg_type(cur) != BLOBMSG_TYPE_TABLE) + continue; + + blobmsg_parse(&policy, 1, &pattern, blobmsg_data(cur), blobmsg_len(cur)); + if (!name) + continue; + + if (!fnmatch(blobmsg_get_string(pattern), name, 0)) + return cur; + } + + return NULL; +} + +static struct radius_parse_attr_data * +radius_parse_attr(struct blob_attr *attr) +{ + static const struct blobmsg_policy policy[4] = { + { .type = BLOBMSG_TYPE_INT32 }, + { .type = BLOBMSG_TYPE_INT32 }, + { .type = BLOBMSG_TYPE_STRING }, + { .type = BLOBMSG_TYPE_STRING }, + }; + static struct radius_parse_attr_data data; + struct blob_attr *tb[4]; + const char *format; + + blobmsg_parse_array(policy, ARRAY_SIZE(policy), tb, blobmsg_data(attr), blobmsg_len(attr)); + + if (!tb[0] || !tb[1] || !tb[2] || !tb[3]) + return NULL; + + format = blobmsg_get_string(tb[2]); + if (strlen(format) != 1) + return NULL; + + data.vendor = blobmsg_get_u32(tb[0]); + data.type = blobmsg_get_u32(tb[1]); + data.format = format[0]; + data.data = blobmsg_get_string(tb[3]); + data.size = strlen(data.data); + + switch (data.format) { + case 's': + break; + case 'x': + if (data.size & 1) + return NULL; + data.size /= 2; + break; + case 'd': + data.size = 4; + break; + default: + return NULL; + } + + return &data; +} + +static void +radius_count_attrs(struct blob_attr **tb, int *n_attr, size_t *attr_size) +{ + struct blob_attr *data = tb[USER_ATTR_RADIUS]; + struct blob_attr *cur; + int rem; + + blobmsg_for_each_attr(cur, data, rem) { + struct radius_parse_attr_data *data; + size_t prev = *attr_size; + + data = radius_parse_attr(cur); + if (!data) + continue; + + *attr_size += data->size; + if (data->vendor) + *attr_size += VENDOR_ATTR_SIZE; + + (*n_attr)++; + } + + *n_attr += !!tb[USER_ATTR_VLAN] * 3 + + !!tb[USER_ATTR_MAX_RATE_UP] + + !!tb[USER_ATTR_MAX_RATE_DOWN]; + *attr_size += !!tb[USER_ATTR_VLAN] * (4 + 4 + 5) + + !!tb[USER_ATTR_MAX_RATE_UP] * (4 + VENDOR_ATTR_SIZE) + + !!tb[USER_ATTR_MAX_RATE_DOWN] * (4 + VENDOR_ATTR_SIZE); +} + +static void * +radius_add_attr(struct radius_parse_attr_state *state, + u32 vendor, u8 type, u8 len) +{ + struct hostapd_radius_attr *attr; + struct wpabuf *buf; + void *val; + + val = state->attrdata; + + buf = state->buf++; + buf->buf = val; + + attr = state->attr++; + attr->val = buf; + attr->type = type; + + if (state->prev) + state->prev->next = attr; + state->prev = attr; + + if (vendor) { + u8 *vendor_hdr = val + 4; + + WPA_PUT_BE32(val, vendor); + vendor_hdr[0] = type; + vendor_hdr[1] = len + 2; + + len += VENDOR_ATTR_SIZE; + val += VENDOR_ATTR_SIZE; + attr->type = RADIUS_ATTR_VENDOR_SPECIFIC; + } + + buf->size = buf->used = len; + state->attrdata += len; + + return val; +} + +static void +radius_parse_attrs(struct blob_attr **tb, struct radius_parse_attr_state *state) +{ + struct blob_attr *data = tb[USER_ATTR_RADIUS]; + struct hostapd_radius_attr *prev = NULL; + struct blob_attr *cur; + int len, rem; + void *val; + + if ((cur = tb[USER_ATTR_VLAN]) != NULL && blobmsg_get_u32(cur) < 4096) { + char buf[5]; + + val = radius_add_attr(state, 0, RADIUS_ATTR_TUNNEL_TYPE, 4); + WPA_PUT_BE32(val, RADIUS_TUNNEL_TYPE_VLAN); + + val = radius_add_attr(state, 0, RADIUS_ATTR_TUNNEL_MEDIUM_TYPE, 4); + WPA_PUT_BE32(val, RADIUS_TUNNEL_MEDIUM_TYPE_802); + + len = snprintf(buf, sizeof(buf), "%d", blobmsg_get_u32(cur)); + val = radius_add_attr(state, 0, RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID, len); + memcpy(val, buf, len); + } + + if ((cur = tb[USER_ATTR_MAX_RATE_UP]) != NULL) { + val = radius_add_attr(state, VENDOR_ID_WISPR, 7, 4); + WPA_PUT_BE32(val, blobmsg_get_u32(cur)); + } + + if ((cur = tb[USER_ATTR_MAX_RATE_DOWN]) != NULL) { + val = radius_add_attr(state, VENDOR_ID_WISPR, 8, 4); + WPA_PUT_BE32(val, blobmsg_get_u32(cur)); + } + + blobmsg_for_each_attr(cur, data, rem) { + struct radius_parse_attr_data *data; + void *val; + int size; + + data = radius_parse_attr(cur); + if (!data) + continue; + + val = radius_add_attr(state, data->vendor, data->type, data->size); + switch (data->format) { + case 's': + memcpy(val, data->data, data->size); + break; + case 'x': + hexstr2bin(data->data, val, data->size); + break; + case 'd': + WPA_PUT_BE32(val, atoi(data->data)); + break; + } + } +} + +static void +radius_user_parse_methods(struct eap_user *eap, struct blob_attr *data) +{ + struct blob_attr *cur; + int rem, n = 0; + + if (!data) + return; + + blobmsg_for_each_attr(cur, data, rem) { + const char *method; + + if (blobmsg_type(cur) != BLOBMSG_TYPE_STRING) + continue; + + if (n == EAP_MAX_METHODS) + break; + + method = blobmsg_get_string(cur); + eap->methods[n].method = eap_server_get_type(method, &eap->methods[n].vendor); + if (eap->methods[n].vendor == EAP_VENDOR_IETF && + eap->methods[n].method == EAP_TYPE_NONE) { + if (!strcmp(method, "TTLS-PAP")) { + eap->ttls_auth |= EAP_TTLS_AUTH_PAP; + continue; + } + if (!strcmp(method, "TTLS-CHAP")) { + eap->ttls_auth |= EAP_TTLS_AUTH_CHAP; + continue; + } + if (!strcmp(method, "TTLS-MSCHAP")) { + eap->ttls_auth |= EAP_TTLS_AUTH_MSCHAP; + continue; + } + if (!strcmp(method, "TTLS-MSCHAPV2")) { + eap->ttls_auth |= EAP_TTLS_AUTH_MSCHAPV2; + continue; + } + } + n++; + } +} + +static struct eap_user * +radius_user_get_state(struct radius_user_data *u, struct blob_attr *data, + const char *id) +{ + static const struct blobmsg_policy policy[__USER_ATTR_MAX] = { + [USER_ATTR_PASSWORD] = { "password", BLOBMSG_TYPE_STRING }, + [USER_ATTR_HASH] = { "hash", BLOBMSG_TYPE_STRING }, + [USER_ATTR_SALT] = { "salt", BLOBMSG_TYPE_STRING }, + [USER_ATTR_METHODS] = { "methods", BLOBMSG_TYPE_ARRAY }, + [USER_ATTR_RADIUS] = { "radius", BLOBMSG_TYPE_ARRAY }, + [USER_ATTR_VLAN] = { "vlan-id", BLOBMSG_TYPE_INT32 }, + [USER_ATTR_MAX_RATE_UP] = { "max-rate-up", BLOBMSG_TYPE_INT32 }, + [USER_ATTR_MAX_RATE_DOWN] = { "max-rate-down", BLOBMSG_TYPE_INT32 }, + }; + struct blob_attr *tb[__USER_ATTR_MAX], *cur; + char *password_buf, *salt_buf, *name_buf; + struct radius_parse_attr_state astate = {}; + struct hostapd_radius_attr *attr; + struct radius_user_state *state; + int pw_len = 0, salt_len = 0; + struct eap_user *eap; + struct wpabuf *val; + size_t attrsize = 0; + void *attrdata; + int n_attr = 0; + + state = avl_find_element(&u->user_state, id, state, node); + if (state) + return &state->data; + + blobmsg_parse(policy, __USER_ATTR_MAX, tb, blobmsg_data(data), blobmsg_len(data)); + + if ((cur = tb[USER_ATTR_SALT]) != NULL) + salt_len = strlen(blobmsg_get_string(cur)) / 2; + if ((cur = tb[USER_ATTR_HASH]) != NULL) + pw_len = strlen(blobmsg_get_string(cur)) / 2; + else if ((cur = tb[USER_ATTR_PASSWORD]) != NULL) + pw_len = blobmsg_len(cur) - 1; + radius_count_attrs(tb, &n_attr, &attrsize); + + state = calloc_a(sizeof(*state), &name_buf, strlen(id) + 1, + &password_buf, pw_len, + &salt_buf, salt_len, + &astate.attr, n_attr * sizeof(*astate.attr), + &astate.buf, n_attr * sizeof(*astate.buf), + &astate.attrdata, attrsize); + eap = &state->data; + eap->salt = salt_len ? salt_buf : NULL; + eap->salt_len = salt_len; + eap->password = pw_len ? password_buf : NULL; + eap->password_len = pw_len; + eap->force_version = -1; + + if ((cur = tb[USER_ATTR_SALT]) != NULL) + hexstr2bin(blobmsg_get_string(cur), salt_buf, salt_len); + if ((cur = tb[USER_ATTR_PASSWORD]) != NULL) + memcpy(password_buf, blobmsg_get_string(cur), pw_len); + else if ((cur = tb[USER_ATTR_HASH]) != NULL) { + hexstr2bin(blobmsg_get_string(cur), password_buf, pw_len); + eap->password_hash = 1; + } + radius_user_parse_methods(eap, tb[USER_ATTR_METHODS]); + + if (n_attr > 0) { + cur = tb[USER_ATTR_RADIUS]; + eap->accept_attr = astate.attr; + radius_parse_attrs(tb, &astate); + } + + state->node.key = strcpy(name_buf, id); + avl_insert(&u->user_state, &state->node); + + return &state->data; + +free: + free(state); + return NULL; +} + +static int radius_get_eap_user(void *ctx, const u8 *identity, + size_t identity_len, int phase2, + struct eap_user *user) +{ + struct radius_state *s = ctx; + struct radius_user_data *u = phase2 ? &s->phase2 : &s->phase1; + struct blob_attr *entry; + struct eap_user *data; + char *id; + + if (identity_len > 512) + return -1; + + load_userfile(s); + + id = alloca(identity_len + 1); + memcpy(id, identity, identity_len); + id[identity_len] = 0; + + entry = radius_user_get(u, id); + if (!entry) + return -1; + + if (!user) + return 0; + + data = radius_user_get_state(u, entry, id); + if (!data) + return -1; + + *user = *data; + if (user->password_len > 0) + user->password = os_memdup(user->password, user->password_len); + if (user->salt_len > 0) + user->salt = os_memdup(user->salt, user->salt_len); + user->phase2 = phase2; + + return 0; +} + +static int radius_setup(struct radius_state *s, struct radius_config *c) +{ + struct eap_config *eap = &s->eap; + struct tls_config conf = { + .event_cb = radius_tls_event, + .tls_flags = TLS_CONN_DISABLE_TLSv1_3, + .cb_ctx = s, + }; + + eap->eap_server = 1; + eap->max_auth_rounds = 100; + eap->max_auth_rounds_short = 50; + eap->ssl_ctx = tls_init(&conf); + if (!eap->ssl_ctx) { + wpa_printf(MSG_INFO, "TLS init failed\n"); + return 1; + } + + if (tls_global_set_params(eap->ssl_ctx, &c->tls)) { + wpa_printf(MSG_INFO, "failed to set TLS parameters\n"); + return 1; + } + + c->radius.eap_cfg = eap; + c->radius.conf_ctx = s; + c->radius.get_eap_user = radius_get_eap_user; + s->radius = radius_server_init(&c->radius); + if (!s->radius) { + wpa_printf(MSG_INFO, "failed to initialize radius server\n"); + return 1; + } + + return 0; +} + +static int radius_init(struct radius_state *s) +{ + memset(s, 0, sizeof(*s)); + radius_userdata_init(&s->phase1); + radius_userdata_init(&s->phase2); +} + +static void radius_deinit(struct radius_state *s) +{ + if (s->radius) + radius_server_deinit(s->radius); + + if (s->eap.ssl_ctx) + tls_deinit(s->eap.ssl_ctx); + + radius_userdata_free(&s->phase1); + radius_userdata_free(&s->phase2); +} + +static int usage(const char *progname) +{ + fprintf(stderr, "Usage: %s \n", + progname); +} + +int radius_main(int argc, char **argv) +{ + static struct radius_state state = {}; + static struct radius_config config = {}; + const char *progname = argv[0]; + int ret = 0; + int ch; + + wpa_debug_setup_stdout(); + wpa_debug_level = 0; + + if (eloop_init()) { + wpa_printf(MSG_ERROR, "Failed to initialize event loop"); + return 1; + } + + eap_server_register_methods(); + radius_init(&state); + + while ((ch = getopt(argc, argv, "6C:c:d:i:k:K:p:P:s:u:")) != -1) { + switch (ch) { + case '6': + config.radius.ipv6 = 1; + break; + case 'C': + config.tls.ca_cert = optarg; + break; + case 'c': + if (config.tls.client_cert2) + return usage(progname); + + if (config.tls.client_cert) + config.tls.client_cert2 = optarg; + else + config.tls.client_cert = optarg; + break; + case 'd': + config.tls.dh_file = optarg; + break; + case 'i': + state.eap.server_id = optarg; + state.eap.server_id_len = strlen(optarg); + break; + case 'k': + if (config.tls.private_key2) + return usage(progname); + + if (config.tls.private_key) + config.tls.private_key2 = optarg; + else + config.tls.private_key = optarg; + break; + case 'K': + if (config.tls.private_key_passwd2) + return usage(progname); + + if (config.tls.private_key_passwd) + config.tls.private_key_passwd2 = optarg; + else + config.tls.private_key_passwd = optarg; + break; + case 'p': + config.radius.auth_port = atoi(optarg); + break; + case 'P': + config.radius.acct_port = atoi(optarg); + break; + case 's': + config.radius.client_file = optarg; + break; + case 'u': + state.user_file = optarg; + break; + default: + return usage(progname); + } + } + + if (!config.tls.client_cert || !config.tls.private_key || + !config.radius.client_file || !state.eap.server_id || + !state.user_file) { + wpa_printf(MSG_INFO, "missing options\n"); + goto out; + } + + ret = radius_setup(&state, &config); + if (ret) + goto out; + + load_userfile(&state); + eloop_run(); + +out: + radius_deinit(&state); + os_program_deinit(); + + return ret; +} diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index ddd86447eb1371..6ff2257c329b57 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -29,11 +29,6 @@ static struct ubus_context *ctx; static struct blob_buf b; static int ctx_ref; -static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj) -{ - return container_of(obj, struct hapd_interfaces, ubus); -} - static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj) { return container_of(obj, struct hostapd_data, ubus.obj); @@ -44,12 +39,6 @@ struct ubus_banned_client { u8 addr[ETH_ALEN]; }; -static void ubus_receive(int sock, void *eloop_ctx, void *sock_ctx) -{ - struct ubus_context *ctx = eloop_ctx; - ubus_handle_event(ctx); -} - static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) { if (ubus_reconnect(ctx, NULL)) { @@ -57,12 +46,12 @@ static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) return; } - eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL); + ubus_add_uloop(ctx); } static void hostapd_ubus_connection_lost(struct ubus_context *ctx) { - eloop_unregister_read_sock(ctx->sock.fd); + uloop_fd_delete(&ctx->sock); eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); } @@ -71,12 +60,14 @@ static bool hostapd_ubus_init(void) if (ctx) return true; + eloop_add_uloop(); ctx = ubus_connect(NULL); if (!ctx) return false; ctx->connection_lost = hostapd_ubus_connection_lost; - eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL); + ubus_add_uloop(ctx); + return true; } @@ -94,7 +85,7 @@ static void hostapd_ubus_ref_dec(void) if (ctx_ref) return; - eloop_unregister_read_sock(ctx->sock.fd); + uloop_fd_delete(&ctx->sock); ubus_free(ctx); ctx = NULL; } @@ -127,38 +118,6 @@ static void hostapd_notify_ubus(struct ubus_object *obj, char *bssname, char *ev free(event_type); } -static void hostapd_send_procd_event(char *bssname, char *event) -{ - char *name, *s; - uint32_t id; - void *v; - - if (!ctx || ubus_lookup_id(ctx, "service", &id)) - return; - - if (asprintf(&name, "hostapd.%s.%s", bssname, event) < 0) - return; - - blob_buf_init(&b, 0); - - s = blobmsg_alloc_string_buffer(&b, "type", strlen(name) + 1); - sprintf(s, "%s", name); - blobmsg_add_string_buffer(&b); - - v = blobmsg_open_table(&b, "data"); - blobmsg_close_table(&b, v); - - ubus_invoke(ctx, id, "event", b.head, NULL, NULL, 1000); - - free(name); -} - -static void hostapd_send_shared_event(struct ubus_object *obj, char *bssname, char *event) -{ - hostapd_send_procd_event(bssname, event); - hostapd_notify_ubus(obj, bssname, event); -} - static void hostapd_bss_del_ban(void *eloop_data, void *user_ctx) { @@ -203,10 +162,8 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *msg) { struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - int ret = hostapd_reload_config(hapd->iface, 1); - hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "reload"); - return ret; + return hostapd_reload_config(hapd->iface); } @@ -687,68 +644,6 @@ enum { __CONFIG_MAX }; -static const struct blobmsg_policy config_add_policy[__CONFIG_MAX] = { - [CONFIG_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, - [CONFIG_FILE] = { "config", BLOBMSG_TYPE_STRING }, -}; - -static int -hostapd_config_add(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__CONFIG_MAX]; - struct hapd_interfaces *interfaces = get_hapd_interfaces_from_object(obj); - char buf[128]; - - blobmsg_parse(config_add_policy, __CONFIG_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[CONFIG_FILE] || !tb[CONFIG_IFACE]) - return UBUS_STATUS_INVALID_ARGUMENT; - - snprintf(buf, sizeof(buf), "bss_config=%s:%s", - blobmsg_get_string(tb[CONFIG_IFACE]), - blobmsg_get_string(tb[CONFIG_FILE])); - - if (hostapd_add_iface(interfaces, buf)) - return UBUS_STATUS_INVALID_ARGUMENT; - - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "pid", getpid()); - ubus_send_reply(ctx, req, b.head); - - return UBUS_STATUS_OK; -} - -enum { - CONFIG_REM_IFACE, - __CONFIG_REM_MAX -}; - -static const struct blobmsg_policy config_remove_policy[__CONFIG_REM_MAX] = { - [CONFIG_REM_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, -}; - -static int -hostapd_config_remove(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__CONFIG_REM_MAX]; - struct hapd_interfaces *interfaces = get_hapd_interfaces_from_object(obj); - char buf[128]; - - blobmsg_parse(config_remove_policy, __CONFIG_REM_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[CONFIG_REM_IFACE]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (hostapd_remove_iface(interfaces, blobmsg_get_string(tb[CONFIG_REM_IFACE]))) - return UBUS_STATUS_INVALID_ARGUMENT; - - return UBUS_STATUS_OK; -} - enum { CSA_FREQ, CSA_BCN_COUNT, @@ -1669,10 +1564,61 @@ hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj, } #endif +#ifdef CONFIG_TAXONOMY +static const struct blobmsg_policy addr_policy[] = { + { "address", BLOBMSG_TYPE_STRING } +}; + +static bool +hostapd_add_b64_data(const char *name, const struct wpabuf *buf) +{ + char *str; + + if (!buf) + return false; + + str = blobmsg_alloc_string_buffer(&b, name, B64_ENCODE_LEN(wpabuf_len(buf))); + b64_encode(wpabuf_head(buf), wpabuf_len(buf), str, B64_ENCODE_LEN(wpabuf_len(buf))); + blobmsg_add_string_buffer(&b); + + return true; +} + +static int +hostapd_bss_get_sta_ies(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); + struct blob_attr *tb; + struct sta_info *sta; + u8 addr[ETH_ALEN]; + + blobmsg_parse(addr_policy, 1, &tb, blobmsg_data(msg), blobmsg_len(msg)); + + if (!tb || hwaddr_aton(blobmsg_data(tb), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + sta = ap_get_sta(hapd, addr); + if (!sta || (!sta->probe_ie_taxonomy && !sta->assoc_ie_taxonomy)) + return UBUS_STATUS_NOT_FOUND; + + blob_buf_init(&b, 0); + hostapd_add_b64_data("probe_ie", sta->probe_ie_taxonomy); + hostapd_add_b64_data("assoc_ie", sta->assoc_ie_taxonomy); + ubus_send_reply(ctx, req, b.head); + + return 0; +} +#endif + static const struct ubus_method bss_methods[] = { UBUS_METHOD_NOARG("reload", hostapd_bss_reload), UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), +#ifdef CONFIG_TAXONOMY + UBUS_METHOD("get_sta_ies", hostapd_bss_get_sta_ies, addr_policy), +#endif UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), #ifdef CONFIG_AIRTIME_POLICY @@ -1734,8 +1680,6 @@ void hostapd_ubus_add_bss(struct hostapd_data *hapd) obj->n_methods = bss_object_type.n_methods; ret = ubus_add_object(ctx, obj); hostapd_ubus_ref_inc(); - - hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "add"); } void hostapd_ubus_free_bss(struct hostapd_data *hapd) @@ -1751,8 +1695,6 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd) if (!ctx) return; - hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "remove"); - if (obj->id) { ubus_remove_object(ctx, obj); hostapd_ubus_ref_dec(); @@ -1798,47 +1740,6 @@ void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vl hostapd_ubus_vlan_action(hapd, vlan, "vlan_remove"); } -static const struct ubus_method daemon_methods[] = { - UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), - UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), -}; - -static struct ubus_object_type daemon_object_type = - UBUS_OBJECT_TYPE("hostapd", daemon_methods); - -void hostapd_ubus_add(struct hapd_interfaces *interfaces) -{ - struct ubus_object *obj = &interfaces->ubus; - int ret; - - if (!hostapd_ubus_init()) - return; - - obj->name = strdup("hostapd"); - - obj->type = &daemon_object_type; - obj->methods = daemon_object_type.methods; - obj->n_methods = daemon_object_type.n_methods; - ret = ubus_add_object(ctx, obj); - hostapd_ubus_ref_inc(); -} - -void hostapd_ubus_free(struct hapd_interfaces *interfaces) -{ - struct ubus_object *obj = &interfaces->ubus; - char *name = (char *) obj->name; - - if (!ctx) - return; - - if (obj->id) { - ubus_remove_object(ctx, obj); - hostapd_ubus_ref_dec(); - } - - free(name); -} - struct ubus_event_req { struct ubus_notify_request nreq; int resp; diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c new file mode 100644 index 00000000000000..e79f2420c07a0a --- /dev/null +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -0,0 +1,808 @@ +#include + +#include "utils/includes.h" +#include "utils/common.h" +#include "utils/ucode.h" +#include "hostapd.h" +#include "beacon.h" +#include "hw_features.h" +#include "ap_drv_ops.h" +#include "dfs.h" +#include "acs.h" +#include + +static uc_resource_type_t *global_type, *bss_type, *iface_type; +static struct hapd_interfaces *interfaces; +static uc_value_t *global, *bss_registry, *iface_registry; +static uc_vm_t *vm; + +static uc_value_t * +hostapd_ucode_bss_get_uval(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (hapd->ucode.idx) + return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx); + + val = uc_resource_new(bss_type, hapd); + hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val); + + return val; +} + +static uc_value_t * +hostapd_ucode_iface_get_uval(struct hostapd_iface *hapd) +{ + uc_value_t *val; + + if (hapd->ucode.idx) + return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx); + + val = uc_resource_new(iface_type, hapd); + hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val); + + return val; +} + +static void +hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss) +{ + uc_value_t *list; + int i; + + list = ucv_array_new(vm); + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + uc_value_t *val = hostapd_ucode_bss_get_uval(hapd); + + ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface))); + ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); + } + ucv_object_add(if_bss, iface->phy, ucv_get(list)); +} + +static void +hostapd_ucode_update_interfaces(void) +{ + uc_value_t *ifs = ucv_object_new(vm); + uc_value_t *if_bss = ucv_array_new(vm); + uc_value_t *bss = ucv_object_new(vm); + int i; + + for (i = 0; i < interfaces->count; i++) { + struct hostapd_iface *iface = interfaces->iface[i]; + + ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface))); + hostapd_ucode_update_bss_list(iface, if_bss, bss); + } + + ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); + ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss)); + ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss)); + ucv_gc(vm); +} + +static uc_value_t * +uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *iface = uc_fn_arg(0); + int ret; + + if (ucv_type(iface) != UC_STRING) + return ucv_int64_new(-1); + + ret = hostapd_add_iface(interfaces, ucv_string_get(iface)); + hostapd_ucode_update_interfaces(); + + return ucv_int64_new(ret); +} + +static uc_value_t * +uc_hostapd_remove_iface(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *iface = uc_fn_arg(0); + + if (ucv_type(iface) != UC_STRING) + return NULL; + + hostapd_remove_iface(interfaces, ucv_string_get(iface)); + hostapd_ucode_update_interfaces(); + + return NULL; +} + +static struct hostapd_vlan * +bss_conf_find_vlan(struct hostapd_bss_config *bss, int id) +{ + struct hostapd_vlan *vlan; + + for (vlan = bss->vlan; vlan; vlan = vlan->next) + if (vlan->vlan_id == id) + return vlan; + + return NULL; +} + +static int +bss_conf_rename_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan, + const char *ifname) +{ + if (!strcmp(ifname, vlan->ifname)) + return 0; + + hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, vlan->ifname, ifname); + os_strlcpy(vlan->ifname, ifname, sizeof(vlan->ifname)); + + return 0; +} + +static int +bss_reload_vlans(struct hostapd_data *hapd, struct hostapd_bss_config *bss) +{ + struct hostapd_bss_config *old_bss = hapd->conf; + struct hostapd_vlan *vlan, *vlan_new, *wildcard; + char ifname[IFNAMSIZ + 1], vlan_ifname[IFNAMSIZ + 1], *pos; + int ret; + + vlan = bss_conf_find_vlan(old_bss, VLAN_ID_WILDCARD); + wildcard = bss_conf_find_vlan(bss, VLAN_ID_WILDCARD); + if (!!vlan != !!wildcard) + return -1; + + if (vlan && wildcard && strcmp(vlan->ifname, wildcard->ifname) != 0) + strcpy(vlan->ifname, wildcard->ifname); + else + wildcard = NULL; + + for (vlan = bss->vlan; vlan; vlan = vlan->next) { + if (vlan->vlan_id == VLAN_ID_WILDCARD || + vlan->dynamic_vlan > 0) + continue; + + if (!bss_conf_find_vlan(old_bss, vlan->vlan_id)) + return -1; + } + + for (vlan = old_bss->vlan; vlan; vlan = vlan->next) { + if (vlan->vlan_id == VLAN_ID_WILDCARD) + continue; + + if (vlan->dynamic_vlan == 0) { + vlan_new = bss_conf_find_vlan(bss, vlan->vlan_id); + if (!vlan_new) + return -1; + + if (bss_conf_rename_vlan(hapd, vlan, vlan_new->ifname)) + return -1; + + continue; + } + + if (!wildcard) + continue; + + os_strlcpy(ifname, wildcard->ifname, sizeof(ifname)); + pos = os_strchr(ifname, '#'); + if (!pos) + return -1; + + *pos++ = '\0'; + ret = os_snprintf(vlan_ifname, sizeof(vlan_ifname), "%s%d%s", + ifname, vlan->vlan_id, pos); + if (os_snprintf_error(sizeof(vlan_ifname), ret)) + return -1; + + if (bss_conf_rename_vlan(hapd, vlan, vlan_ifname)) + return -1; + } + + return 0; +} + +static uc_value_t * +uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + struct hostapd_bss_config *old_bss; + struct hostapd_iface *iface; + struct hostapd_config *conf; + uc_value_t *file = uc_fn_arg(0); + uc_value_t *index = uc_fn_arg(1); + uc_value_t *files_only = uc_fn_arg(2); + unsigned int i, idx = 0; + int ret = -1; + + if (!hapd || ucv_type(file) != UC_STRING) + goto out; + + if (ucv_type(index) == UC_INTEGER) + idx = ucv_int64_get(index); + + iface = hapd->iface; + conf = interfaces->config_read_cb(ucv_string_get(file)); + if (!conf) + goto out; + + if (idx > conf->num_bss || !conf->bss[idx]) + goto free; + + if (ucv_boolean_get(files_only)) { + struct hostapd_bss_config *bss = conf->bss[idx]; + struct hostapd_bss_config *old_bss = hapd->conf; + +#define swap_field(name) \ + do { \ + void *ptr = old_bss->name; \ + old_bss->name = bss->name; \ + bss->name = ptr; \ + } while (0) + + swap_field(ssid.wpa_psk_file); + ret = bss_reload_vlans(hapd, bss); + goto done; + } + + hostapd_bss_deinit_no_free(hapd); + hostapd_drv_stop_ap(hapd); + hostapd_free_hapd_data(hapd); + + old_bss = hapd->conf; + for (i = 0; i < iface->conf->num_bss; i++) + if (iface->conf->bss[i] == hapd->conf) + iface->conf->bss[i] = conf->bss[idx]; + hapd->conf = conf->bss[idx]; + conf->bss[idx] = old_bss; + + hostapd_setup_bss(hapd, hapd == iface->bss[0], true); + hostapd_ucode_update_interfaces(); + +done: + ret = 0; +free: + hostapd_config_free(conf); +out: + return ucv_int64_new(ret); +} + +static void +hostapd_remove_iface_bss_conf(struct hostapd_config *iconf, + struct hostapd_bss_config *conf) +{ + int i; + + for (i = 0; i < iconf->num_bss; i++) + if (iconf->bss[i] == conf) + break; + + if (i == iconf->num_bss) + return; + + for (i++; i < iconf->num_bss; i++) + iconf->bss[i - 1] = iconf->bss[i]; + iconf->num_bss--; +} + + +static uc_value_t * +uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + struct hostapd_iface *iface; + int i, idx; + + if (!hapd) + return NULL; + + iface = hapd->iface; + if (iface->num_bss == 1) { + wpa_printf(MSG_ERROR, "trying to delete last bss of an iface: %s\n", hapd->conf->iface); + return NULL; + } + + for (idx = 0; idx < iface->num_bss; idx++) + if (iface->bss[idx] == hapd) + break; + + if (idx == iface->num_bss) + return NULL; + + for (i = idx + 1; i < iface->num_bss; i++) + iface->bss[i - 1] = iface->bss[i]; + + iface->num_bss--; + + iface->bss[0]->interface_added = 0; + hostapd_drv_set_first_bss(iface->bss[0]); + hapd->interface_added = 1; + + hostapd_drv_stop_ap(hapd); + hostapd_bss_deinit(hapd); + hostapd_remove_iface_bss_conf(iface->conf, hapd->conf); + hostapd_config_free_bss(hapd->conf); + os_free(hapd); + + hostapd_ucode_update_interfaces(); + ucv_gc(vm); + + return NULL; +} + +static uc_value_t * +uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + struct hostapd_bss_config *bss; + struct hostapd_config *conf; + struct hostapd_data *hapd; + uc_value_t *file = uc_fn_arg(0); + uc_value_t *index = uc_fn_arg(1); + unsigned int idx = 0; + uc_value_t *ret = NULL; + + if (!iface || ucv_type(file) != UC_STRING) + goto out; + + if (ucv_type(index) == UC_INTEGER) + idx = ucv_int64_get(index); + + conf = interfaces->config_read_cb(ucv_string_get(file)); + if (!conf || idx > conf->num_bss || !conf->bss[idx]) + goto out; + + bss = conf->bss[idx]; + hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); + if (!hapd) + goto out; + + hapd->driver = iface->bss[0]->driver; + hapd->drv_priv = iface->bss[0]->drv_priv; + if (interfaces->ctrl_iface_init && + interfaces->ctrl_iface_init(hapd) < 0) + goto free_hapd; + + if (iface->state == HAPD_IFACE_ENABLED && + hostapd_setup_bss(hapd, -1, true)) + goto deinit_ctrl; + + iface->bss = os_realloc_array(iface->bss, iface->num_bss + 1, + sizeof(*iface->bss)); + iface->bss[iface->num_bss++] = hapd; + + iface->conf->bss = os_realloc_array(iface->conf->bss, + iface->conf->num_bss + 1, + sizeof(*iface->conf->bss)); + iface->conf->bss[iface->conf->num_bss] = bss; + conf->bss[idx] = NULL; + ret = hostapd_ucode_bss_get_uval(hapd); + hostapd_ucode_update_interfaces(); + goto out; + +deinit_ctrl: + if (interfaces->ctrl_iface_deinit) + interfaces->ctrl_iface_deinit(hapd); +free_hapd: + hostapd_free_hapd_data(hapd); + os_free(hapd); +out: + hostapd_config_free(conf); + return ret; +} + +static uc_value_t * +uc_hostapd_iface_set_bss_order(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *bss_list = uc_fn_arg(0); + struct hostapd_data **new_bss; + struct hostapd_bss_config **new_conf; + + if (!iface) + return NULL; + + if (ucv_type(bss_list) != UC_ARRAY || + ucv_array_length(bss_list) != iface->num_bss) + return NULL; + + new_bss = calloc(iface->num_bss, sizeof(*new_bss)); + new_conf = calloc(iface->num_bss, sizeof(*new_conf)); + for (size_t i = 0; i < iface->num_bss; i++) { + struct hostapd_data *bss; + + bss = ucv_resource_data(ucv_array_get(bss_list, i), "hostapd.bss"); + if (bss->iface != iface) + goto free; + + for (size_t k = 0; k < i; k++) + if (new_bss[k] == bss) + goto free; + + new_bss[i] = bss; + new_conf[i] = bss->conf; + } + + new_bss[0]->interface_added = 0; + for (size_t i = 1; i < iface->num_bss; i++) + new_bss[i]->interface_added = 1; + + free(iface->bss); + iface->bss = new_bss; + + free(iface->conf->bss); + iface->conf->bss = new_conf; + iface->conf->num_bss = iface->num_bss; + hostapd_drv_set_first_bss(iface->bss[0]); + + return ucv_boolean_new(true); + +free: + free(new_bss); + free(new_conf); + return NULL; +} + +static uc_value_t * +uc_hostapd_bss_ctrl(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + uc_value_t *arg = uc_fn_arg(0); + struct sockaddr_storage from = {}; + static char reply[4096]; + int reply_len; + + if (!hapd || !interfaces->ctrl_iface_recv || + ucv_type(arg) != UC_STRING) + return NULL; + + reply_len = interfaces->ctrl_iface_recv(hapd, ucv_string_get(arg), + reply, sizeof(reply), + &from, sizeof(from)); + if (reply_len < 0) + return NULL; + + if (reply_len && reply[reply_len - 1] == '\n') + reply_len--; + + return ucv_string_new_length(reply, reply_len); +} + +static uc_value_t * +uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + int i; + + switch (iface->state) { + case HAPD_IFACE_ENABLED: + case HAPD_IFACE_DISABLED: + break; +#ifdef CONFIG_ACS + case HAPD_IFACE_ACS: + acs_cleanup(iface); + iface->scan_cb = NULL; + /* fallthrough */ +#endif + default: + hostapd_disable_iface(iface); + break; + } + + if (iface->state != HAPD_IFACE_ENABLED) + hostapd_disable_iface(iface); + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + + hostapd_drv_stop_ap(hapd); + hapd->beacon_set_done = 0; + } + + return NULL; +} + +static uc_value_t * +uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + bool changed = false; + uint64_t intval; + int i; + + if (!iface) + return NULL; + + if (!info) { + iface->freq = 0; + goto out; + } + + if (ucv_type(info) != UC_OBJECT) + return NULL; + +#define UPDATE_VAL(field, name) \ + if ((intval = ucv_int64_get(ucv_object_get(info, name, NULL))) && \ + !errno && intval != conf->field) do { \ + conf->field = intval; \ + changed = true; \ + } while(0) + + conf = iface->conf; + UPDATE_VAL(op_class, "op_class"); + UPDATE_VAL(hw_mode, "hw_mode"); + UPDATE_VAL(channel, "channel"); + UPDATE_VAL(secondary_channel, "sec_channel"); + if (!changed && + (iface->bss[0]->beacon_set_done || + iface->state == HAPD_IFACE_DFS)) + return ucv_boolean_new(true); + + intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL)); + if (!errno) + hostapd_set_oper_centr_freq_seg0_idx(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL)); + if (!errno) + hostapd_set_oper_centr_freq_seg1_idx(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (!errno) + hostapd_set_oper_chwidth(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL)); + if (!errno) + iface->freq = intval; + else + iface->freq = 0; + conf->acs = 0; + +out: + switch (iface->state) { + case HAPD_IFACE_DISABLED: + break; + case HAPD_IFACE_ENABLED: + if (!hostapd_is_dfs_required(iface) || + hostapd_is_dfs_chan_available(iface)) + break; + wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface"); + /* fallthrough */ + default: + hostapd_disable_iface(iface); + break; + } + + if (conf->channel && !iface->freq) + iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel); + + if (iface->state != HAPD_IFACE_ENABLED) { + hostapd_enable_iface(iface); + return ucv_boolean_new(true); + } + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + int ret; + + hapd->conf->start_disabled = 0; + hostapd_set_freq(hapd, conf->hw_mode, iface->freq, + conf->channel, + conf->enable_edmg, + conf->edmg_channel, + conf->ieee80211n, + conf->ieee80211ac, + conf->ieee80211ax, + conf->ieee80211be, + conf->secondary_channel, + hostapd_get_oper_chwidth(conf), + hostapd_get_oper_centr_freq_seg0_idx(conf), + hostapd_get_oper_centr_freq_seg1_idx(conf)); + + ieee802_11_set_beacon(hapd); + } + + return ucv_boolean_new(true); +} + +static uc_value_t * +uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + struct csa_settings csa = {}; + uint64_t intval; + int i, ret = 0; + + if (!iface || ucv_type(info) != UC_OBJECT) + return NULL; + + conf = iface->conf; + if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno) + csa.cs_count = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno) + csa.freq_params.sec_channel_offset = intval; + + csa.freq_params.ht_enabled = conf->ieee80211n; + csa.freq_params.vht_enabled = conf->ieee80211ac; + csa.freq_params.he_enabled = conf->ieee80211ax; +#ifdef CONFIG_IEEE80211BE + csa.freq_params.eht_enabled = conf->ieee80211be; +#endif + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (errno) + intval = hostapd_get_oper_chwidth(conf); + if (intval) + csa.freq_params.bandwidth = 40 << intval; + else + csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20; + + if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno) + csa.freq_params.freq = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno) + csa.freq_params.center_freq1 = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno) + csa.freq_params.center_freq2 = intval; + + for (i = 0; i < iface->num_bss; i++) + ret = hostapd_switch_channel(iface->bss[i], &csa); + + return ucv_boolean_new(!ret); +} + +static uc_value_t * +uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + uc_value_t *ifname_arg = uc_fn_arg(0); + char prev_ifname[IFNAMSIZ + 1]; + struct sta_info *sta; + const char *ifname; + int ret; + + if (!hapd || ucv_type(ifname_arg) != UC_STRING) + return NULL; + + os_strlcpy(prev_ifname, hapd->conf->iface, sizeof(prev_ifname)); + ifname = ucv_string_get(ifname_arg); + + hostapd_ubus_free_bss(hapd); + if (interfaces->ctrl_iface_deinit) + interfaces->ctrl_iface_deinit(hapd); + + ret = hostapd_drv_if_rename(hapd, WPA_IF_AP_BSS, NULL, ifname); + if (ret) + goto out; + + for (sta = hapd->sta_list; sta; sta = sta->next) { + char cur_name[IFNAMSIZ + 1], new_name[IFNAMSIZ + 1]; + + if (!(sta->flags & WLAN_STA_WDS) || sta->pending_wds_enable) + continue; + + snprintf(cur_name, sizeof(cur_name), "%s.sta%d", prev_ifname, sta->aid); + snprintf(new_name, sizeof(new_name), "%s.sta%d", ifname, sta->aid); + hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, cur_name, new_name); + } + + if (!strncmp(hapd->conf->ssid.vlan, hapd->conf->iface, sizeof(hapd->conf->ssid.vlan))) + os_strlcpy(hapd->conf->ssid.vlan, ifname, sizeof(hapd->conf->ssid.vlan)); + os_strlcpy(hapd->conf->iface, ifname, sizeof(hapd->conf->iface)); + hostapd_ubus_add_bss(hapd); + + hostapd_ucode_update_interfaces(); +out: + if (interfaces->ctrl_iface_init) + interfaces->ctrl_iface_init(hapd); + + return ret ? NULL : ucv_boolean_new(true); +} + + +int hostapd_ucode_init(struct hapd_interfaces *ifaces) +{ + static const uc_function_list_t global_fns[] = { + { "printf", uc_wpa_printf }, + { "getpid", uc_wpa_getpid }, + { "sha1", uc_wpa_sha1 }, + { "freq_info", uc_wpa_freq_info }, + { "add_iface", uc_hostapd_add_iface }, + { "remove_iface", uc_hostapd_remove_iface }, + }; + static const uc_function_list_t bss_fns[] = { + { "ctrl", uc_hostapd_bss_ctrl }, + { "set_config", uc_hostapd_bss_set_config }, + { "rename", uc_hostapd_bss_rename }, + { "delete", uc_hostapd_bss_delete }, + }; + static const uc_function_list_t iface_fns[] = { + { "set_bss_order", uc_hostapd_iface_set_bss_order }, + { "add_bss", uc_hostapd_iface_add_bss }, + { "stop", uc_hostapd_iface_stop }, + { "start", uc_hostapd_iface_start }, + { "switch_channel", uc_hostapd_iface_switch_channel }, + }; + uc_value_t *data, *proto; + + interfaces = ifaces; + vm = wpa_ucode_create_vm(); + + global_type = uc_type_declare(vm, "hostapd.global", global_fns, NULL); + bss_type = uc_type_declare(vm, "hostapd.bss", bss_fns, NULL); + iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL); + + bss_registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "hostap.bss_registry", bss_registry); + + iface_registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry); + + global = wpa_ucode_global_init("hostapd", global_type); + + if (wpa_ucode_run(HOSTAPD_UC_PATH "hostapd.uc")) + goto free_vm; + ucv_gc(vm); + + return 0; + +free_vm: + wpa_ucode_free_vm(); + return -1; +} + +void hostapd_ucode_free(void) +{ + if (wpa_ucode_call_prepare("shutdown") == 0) + ucv_put(wpa_ucode_call(0)); + wpa_ucode_free_vm(); +} + +void hostapd_ucode_free_iface(struct hostapd_iface *iface) +{ + wpa_ucode_registry_remove(iface_registry, iface->ucode.idx); +} + +void hostapd_ucode_add_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (wpa_ucode_call_prepare("bss_add")) + return; + + val = hostapd_ucode_bss_get_uval(hapd); + uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void hostapd_ucode_reload_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (wpa_ucode_call_prepare("bss_reload")) + return; + + val = hostapd_ucode_bss_get_uval(hapd); + uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void hostapd_ucode_free_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + val = wpa_ucode_registry_remove(bss_registry, hapd->ucode.idx); + if (!val) + return; + + hapd->ucode.idx = 0; + if (wpa_ucode_call_prepare("bss_remove")) + return; + + uc_value_push(ucv_string_new(hapd->conf->iface)); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} diff --git a/package/network/services/hostapd/src/src/ap/ucode.h b/package/network/services/hostapd/src/src/ap/ucode.h new file mode 100644 index 00000000000000..d00b787169d104 --- /dev/null +++ b/package/network/services/hostapd/src/src/ap/ucode.h @@ -0,0 +1,54 @@ +#ifndef __HOSTAPD_AP_UCODE_H +#define __HOSTAPD_AP_UCODE_H + +#include "utils/ucode.h" + +struct hostapd_data; + +struct hostapd_ucode_bss { +#ifdef UCODE_SUPPORT + int idx; +#endif +}; + +struct hostapd_ucode_iface { +#ifdef UCODE_SUPPORT + int idx; +#endif +}; + +#ifdef UCODE_SUPPORT + +int hostapd_ucode_init(struct hapd_interfaces *ifaces); + +void hostapd_ucode_free(void); +void hostapd_ucode_free_iface(struct hostapd_iface *iface); +void hostapd_ucode_add_bss(struct hostapd_data *hapd); +void hostapd_ucode_free_bss(struct hostapd_data *hapd); +void hostapd_ucode_reload_bss(struct hostapd_data *hapd); + +#else + +static inline int hostapd_ucode_init(struct hapd_interfaces *ifaces) +{ + return -EINVAL; +} +static inline void hostapd_ucode_free(void) +{ +} +static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface) +{ +} +static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd) +{ +} +static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd) +{ +} +static inline void hostapd_ucode_free_bss(struct hostapd_data *hapd) +{ +} + +#endif + +#endif diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c new file mode 100644 index 00000000000000..2beeb9a7ff6b6a --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ucode.c @@ -0,0 +1,335 @@ +#include +#include "ucode.h" +#include "utils/eloop.h" +#include "crypto/crypto.h" +#include "crypto/sha1.h" +#include "common/ieee802_11_common.h" +#include +#include + +static uc_value_t *registry; +static uc_vm_t vm; +static struct uloop_timeout gc_timer; + +static void uc_gc_timer(struct uloop_timeout *timeout) +{ + ucv_gc(&vm); +} + +uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *level = uc_fn_arg(0); + uc_value_t *ret, **args; + uc_cfn_ptr_t _sprintf; + int l = MSG_INFO; + int i, start = 0; + + _sprintf = uc_stdlib_function("sprintf"); + if (!sprintf) + return NULL; + + if (ucv_type(level) == UC_INTEGER) { + l = ucv_int64_get(level); + start++; + } + + if (nargs <= start) + return NULL; + + ret = _sprintf(vm, nargs - start); + if (ucv_type(ret) != UC_STRING) + return NULL; + + wpa_printf(l, "%s", ucv_string_get(ret)); + ucv_put(ret); + + return NULL; +} + +uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *freq = uc_fn_arg(0); + uc_value_t *sec = uc_fn_arg(1); + int width = ucv_uint64_get(uc_fn_arg(2)); + int freq_val, center_idx, center_ofs; + enum oper_chan_width chanwidth; + enum hostapd_hw_mode hw_mode; + u8 op_class, channel, tmp_channel; + const char *modestr; + int sec_channel = 0; + uc_value_t *ret; + + if (ucv_type(freq) != UC_INTEGER) + return NULL; + + freq_val = ucv_int64_get(freq); + if (ucv_type(sec) == UC_INTEGER) + sec_channel = ucv_int64_get(sec); + else if (sec) + return NULL; + else if (freq_val > 4000) + sec_channel = (freq_val / 20) & 1 ? 1 : -1; + else + sec_channel = freq_val < 2442 ? 1 : -1; + + if (sec_channel != -1 && sec_channel != 1 && sec_channel != 0) + return NULL; + + switch (width) { + case 0: + chanwidth = CONF_OPER_CHWIDTH_USE_HT; + break; + case 1: + chanwidth = CONF_OPER_CHWIDTH_80MHZ; + break; + case 2: + chanwidth = CONF_OPER_CHWIDTH_160MHZ; + break; + default: + return NULL; + } + + hw_mode = ieee80211_freq_to_channel_ext(freq_val, sec_channel, + chanwidth, &op_class, &channel); + switch (hw_mode) { + case HOSTAPD_MODE_IEEE80211B: + modestr = "b"; + break; + case HOSTAPD_MODE_IEEE80211G: + modestr = "g"; + break; + case HOSTAPD_MODE_IEEE80211A: + modestr = "a"; + break; + case HOSTAPD_MODE_IEEE80211AD: + modestr = "ad"; + break; + default: + return NULL; + } + + ret = ucv_object_new(vm); + ucv_object_add(ret, "op_class", ucv_int64_new(op_class)); + ucv_object_add(ret, "channel", ucv_int64_new(channel)); + ucv_object_add(ret, "hw_mode", ucv_int64_new(hw_mode)); + ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr))); + ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel)); + ucv_object_add(ret, "frequency", ucv_int64_new(freq_val)); + + if (!sec_channel) + return ret; + + if (freq_val >= 5900) + center_ofs = 0; + else if (freq_val >= 5745) + center_ofs = 20; + else + center_ofs = 35; + tmp_channel = channel - center_ofs; + tmp_channel &= ~((8 << width) - 1); + center_idx = tmp_channel + center_ofs + (4 << width) - 1; + + if (freq_val < 3000) + ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(0)); + else + ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(center_idx)); + center_idx = (center_idx - channel) * 5 + freq_val; + ucv_object_add(ret, "center_freq1", ucv_int64_new(center_idx)); + +out: + return ret; +} + +uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs) +{ + return ucv_int64_new(getpid()); +} + +uc_value_t *uc_wpa_sha1(uc_vm_t *vm, size_t nargs) +{ + u8 hash[SHA1_MAC_LEN]; + char hash_hex[2 * ARRAY_SIZE(hash) + 1]; + uc_value_t *val; + size_t *lens; + const u8 **args; + int i; + + if (!nargs) + return NULL; + + args = alloca(nargs * sizeof(*args)); + lens = alloca(nargs * sizeof(*lens)); + for (i = 0; i < nargs; i++) { + val = uc_fn_arg(i); + if (ucv_type(val) != UC_STRING) + return NULL; + + args[i] = ucv_string_get(val); + lens[i] = ucv_string_length(val); + } + + if (sha1_vector(nargs, args, lens, hash)) + return NULL; + + for (i = 0; i < ARRAY_SIZE(hash); i++) + sprintf(hash_hex + 2 * i, "%02x", hash[i]); + + return ucv_string_new_length(hash_hex, 2 * ARRAY_SIZE(hash)); +} + +uc_vm_t *wpa_ucode_create_vm(void) +{ + static uc_parse_config_t config = { + .strict_declarations = true, + .lstrip_blocks = true, + .trim_blocks = true, + .raw_mode = true + }; + + uc_search_path_init(&config.module_search_path); + uc_search_path_add(&config.module_search_path, HOSTAPD_UC_PATH "*.so"); + uc_search_path_add(&config.module_search_path, HOSTAPD_UC_PATH "*.uc"); + + uc_vm_init(&vm, &config); + + uc_stdlib_load(uc_vm_scope_get(&vm)); + eloop_add_uloop(); + gc_timer.cb = uc_gc_timer; + + return &vm; +} + +int wpa_ucode_run(const char *script) +{ + uc_source_t *source; + uc_program_t *prog; + uc_value_t *ops; + char *err; + int ret; + + source = uc_source_new_file(script); + if (!source) + return -1; + + prog = uc_compile(vm.config, source, &err); + uc_source_put(source); + if (!prog) { + wpa_printf(MSG_ERROR, "Error loading ucode: %s\n", err); + return -1; + } + + ret = uc_vm_execute(&vm, prog, &ops); + uc_program_put(prog); + if (ret || !ops) + return -1; + + registry = ucv_array_new(&vm); + uc_vm_registry_set(&vm, "hostap.registry", registry); + ucv_array_set(registry, 0, ucv_get(ops)); + + return 0; +} + +int wpa_ucode_call_prepare(const char *fname) +{ + uc_value_t *obj, *func; + + if (!registry) + return -1; + + obj = ucv_array_get(registry, 0); + if (!obj) + return -1; + + func = ucv_object_get(obj, fname, NULL); + if (!ucv_is_callable(func)) + return -1; + + uc_vm_stack_push(&vm, ucv_get(obj)); + uc_vm_stack_push(&vm, ucv_get(func)); + + return 0; +} + +uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_type) +{ + uc_value_t *global = uc_resource_new(global_type, NULL); + uc_value_t *proto; + + uc_vm_registry_set(&vm, "hostap.global", global); + proto = ucv_prototype_get(global); + ucv_object_add(proto, "data", ucv_get(ucv_object_new(&vm))); + +#define ADD_CONST(x) ucv_object_add(proto, #x, ucv_int64_new(x)) + ADD_CONST(MSG_EXCESSIVE); + ADD_CONST(MSG_MSGDUMP); + ADD_CONST(MSG_DEBUG); + ADD_CONST(MSG_INFO); + ADD_CONST(MSG_WARNING); + ADD_CONST(MSG_ERROR); +#undef ADD_CONST + + ucv_object_add(uc_vm_scope_get(&vm), name, ucv_get(global)); + + return global; +} + +int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val) +{ + uc_value_t *data; + int i = 0; + + while (ucv_array_get(reg, i)) + i++; + + ucv_array_set(reg, i, ucv_get(val)); + + return i + 1; +} + +uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx) +{ + if (!idx) + return NULL; + + return ucv_array_get(reg, idx - 1); +} + +uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx) +{ + uc_value_t *val = wpa_ucode_registry_get(reg, idx); + void **dataptr; + + if (!val) + return NULL; + + ucv_array_set(reg, idx - 1, NULL); + dataptr = ucv_resource_dataptr(val, NULL); + if (dataptr) + *dataptr = NULL; + + return val; +} + + +uc_value_t *wpa_ucode_call(size_t nargs) +{ + if (uc_vm_call(&vm, true, nargs) != EXCEPTION_NONE) + return NULL; + + if (!gc_timer.pending) + uloop_timeout_set(&gc_timer, 10); + + return uc_vm_stack_pop(&vm); +} + +void wpa_ucode_free_vm(void) +{ + if (!vm.config) + return; + + uc_search_path_free(&vm.config->module_search_path); + uc_vm_free(&vm); + registry = NULL; + vm = (uc_vm_t){}; +} diff --git a/package/network/services/hostapd/src/src/utils/ucode.h b/package/network/services/hostapd/src/src/utils/ucode.h new file mode 100644 index 00000000000000..2c1886976ee5a2 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ucode.h @@ -0,0 +1,29 @@ +#ifndef __HOSTAPD_UTILS_UCODE_H +#define __HOSTAPD_UTILS_UCODE_H + +#include "utils/includes.h" +#include "utils/common.h" +#include +#include + +#define HOSTAPD_UC_PATH "/usr/share/hostap/" + +extern uc_value_t *uc_registry; +uc_vm_t *wpa_ucode_create_vm(void); +int wpa_ucode_run(const char *script); +int wpa_ucode_call_prepare(const char *fname); +uc_value_t *wpa_ucode_call(size_t nargs); +void wpa_ucode_free_vm(void); + +uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_type); + +int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val); +uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx); +uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx); + +uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs); +uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs); +uc_value_t *uc_wpa_sha1(uc_vm_t *vm, size_t nargs); +uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs); + +#endif diff --git a/package/network/services/hostapd/src/wpa_supplicant/ubus.c b/package/network/services/hostapd/src/wpa_supplicant/ubus.c index 16a68c5073171e..1c477f0c0cb2e8 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ubus.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ubus.c @@ -30,12 +30,6 @@ static inline struct wpa_supplicant *get_wpas_from_object(struct ubus_object *ob return container_of(obj, struct wpa_supplicant, ubus.obj); } -static void ubus_receive(int sock, void *eloop_ctx, void *sock_ctx) -{ - struct ubus_context *ctx = eloop_ctx; - ubus_handle_event(ctx); -} - static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) { if (ubus_reconnect(ctx, NULL)) { @@ -43,12 +37,12 @@ static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) return; } - eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL); + ubus_add_uloop(ctx); } static void wpas_ubus_connection_lost(struct ubus_context *ctx) { - eloop_unregister_read_sock(ctx->sock.fd); + uloop_fd_delete(&ctx->sock); eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); } @@ -57,12 +51,14 @@ static bool wpas_ubus_init(void) if (ctx) return true; + eloop_add_uloop(); ctx = ubus_connect(NULL); if (!ctx) return false; ctx->connection_lost = wpas_ubus_connection_lost; - eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL); + ubus_add_uloop(ctx); + return true; } @@ -80,7 +76,7 @@ static void wpas_ubus_ref_dec(void) if (ctx_ref) return; - eloop_unregister_read_sock(ctx->sock.fd); + uloop_fd_delete(&ctx->sock); ubus_free(ctx); ctx = NULL; } @@ -211,152 +207,6 @@ void wpas_ubus_free_bss(struct wpa_supplicant *wpa_s) free(name); } -enum { - WPAS_CONFIG_DRIVER, - WPAS_CONFIG_IFACE, - WPAS_CONFIG_BRIDGE, - WPAS_CONFIG_HOSTAPD_CTRL, - WPAS_CONFIG_CTRL, - WPAS_CONFIG_FILE, - __WPAS_CONFIG_MAX -}; - -static const struct blobmsg_policy wpas_config_add_policy[__WPAS_CONFIG_MAX] = { - [WPAS_CONFIG_DRIVER] = { "driver", BLOBMSG_TYPE_STRING }, - [WPAS_CONFIG_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, - [WPAS_CONFIG_BRIDGE] = { "bridge", BLOBMSG_TYPE_STRING }, - [WPAS_CONFIG_HOSTAPD_CTRL] = { "hostapd_ctrl", BLOBMSG_TYPE_STRING }, - [WPAS_CONFIG_CTRL] = { "ctrl", BLOBMSG_TYPE_STRING }, - [WPAS_CONFIG_FILE] = { "config", BLOBMSG_TYPE_STRING }, -}; - -static int -wpas_config_add(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__WPAS_CONFIG_MAX]; - struct wpa_global *global = get_wpa_global_from_object(obj); - struct wpa_interface *iface; - - blobmsg_parse(wpas_config_add_policy, __WPAS_CONFIG_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[WPAS_CONFIG_FILE] || !tb[WPAS_CONFIG_IFACE] || !tb[WPAS_CONFIG_DRIVER]) - return UBUS_STATUS_INVALID_ARGUMENT; - - iface = os_zalloc(sizeof(struct wpa_interface)); - if (iface == NULL) - return UBUS_STATUS_UNKNOWN_ERROR; - - iface->driver = blobmsg_get_string(tb[WPAS_CONFIG_DRIVER]); - iface->ifname = blobmsg_get_string(tb[WPAS_CONFIG_IFACE]); - iface->confname = blobmsg_get_string(tb[WPAS_CONFIG_FILE]); - - if (tb[WPAS_CONFIG_BRIDGE]) - iface->bridge_ifname = blobmsg_get_string(tb[WPAS_CONFIG_BRIDGE]); - - if (tb[WPAS_CONFIG_CTRL]) - iface->ctrl_interface = blobmsg_get_string(tb[WPAS_CONFIG_CTRL]); - - if (tb[WPAS_CONFIG_HOSTAPD_CTRL]) - iface->hostapd_ctrl = blobmsg_get_string(tb[WPAS_CONFIG_HOSTAPD_CTRL]); - - if (!wpa_supplicant_add_iface(global, iface, NULL)) - return UBUS_STATUS_INVALID_ARGUMENT; - - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "pid", getpid()); - ubus_send_reply(ctx, req, b.head); - - return UBUS_STATUS_OK; -} - -enum { - WPAS_CONFIG_REM_IFACE, - __WPAS_CONFIG_REM_MAX -}; - -static const struct blobmsg_policy wpas_config_remove_policy[__WPAS_CONFIG_REM_MAX] = { - [WPAS_CONFIG_REM_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, -}; - -static int -wpas_config_remove(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__WPAS_CONFIG_REM_MAX]; - struct wpa_global *global = get_wpa_global_from_object(obj); - struct wpa_supplicant *wpa_s = NULL; - unsigned int found = 0; - - blobmsg_parse(wpas_config_remove_policy, __WPAS_CONFIG_REM_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[WPAS_CONFIG_REM_IFACE]) - return UBUS_STATUS_INVALID_ARGUMENT; - - /* find wpa_s object for to-be-removed interface */ - for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { - if (!strncmp(wpa_s->ifname, - blobmsg_get_string(tb[WPAS_CONFIG_REM_IFACE]), - sizeof(wpa_s->ifname))) - { - found = 1; - break; - } - } - - if (!found) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (wpa_supplicant_remove_iface(global, wpa_s, 0)) - return UBUS_STATUS_INVALID_ARGUMENT; - - return UBUS_STATUS_OK; -} - -static const struct ubus_method wpas_daemon_methods[] = { - UBUS_METHOD("config_add", wpas_config_add, wpas_config_add_policy), - UBUS_METHOD("config_remove", wpas_config_remove, wpas_config_remove_policy), -}; - -static struct ubus_object_type wpas_daemon_object_type = - UBUS_OBJECT_TYPE("wpa_supplicant", wpas_daemon_methods); - -void wpas_ubus_add(struct wpa_global *global) -{ - struct ubus_object *obj = &global->ubus_global; - int ret; - - if (!wpas_ubus_init()) - return; - - obj->name = strdup("wpa_supplicant"); - - obj->type = &wpas_daemon_object_type; - obj->methods = wpas_daemon_object_type.methods; - obj->n_methods = wpas_daemon_object_type.n_methods; - ret = ubus_add_object(ctx, obj); - wpas_ubus_ref_inc(); -} - -void wpas_ubus_free(struct wpa_global *global) -{ - struct ubus_object *obj = &global->ubus_global; - char *name = (char *) obj->name; - - if (!ctx) - return; - - if (obj->id) { - ubus_remove_object(ctx, obj); - wpas_ubus_ref_dec(); - } - - free(name); -} - - #ifdef CONFIG_WPS void wpas_ubus_notify(struct wpa_supplicant *wpa_s, const struct wps_credential *cred) { diff --git a/package/network/services/hostapd/src/wpa_supplicant/ubus.h b/package/network/services/hostapd/src/wpa_supplicant/ubus.h index bf92b98c0135ef..f6681cb26d016d 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ubus.h +++ b/package/network/services/hostapd/src/wpa_supplicant/ubus.h @@ -24,9 +24,6 @@ struct wpas_ubus_bss { void wpas_ubus_add_bss(struct wpa_supplicant *wpa_s); void wpas_ubus_free_bss(struct wpa_supplicant *wpa_s); -void wpas_ubus_add(struct wpa_global *global); -void wpas_ubus_free(struct wpa_global *global); - #ifdef CONFIG_WPS void wpas_ubus_notify(struct wpa_supplicant *wpa_s, const struct wps_credential *cred); #endif @@ -34,14 +31,6 @@ void wpas_ubus_notify(struct wpa_supplicant *wpa_s, const struct wps_credential #else struct wpas_ubus_bss {}; -static inline void wpas_ubus_add_iface(struct wpa_supplicant *wpa_s) -{ -} - -static inline void wpas_ubus_free_iface(struct wpa_supplicant *wpa_s) -{ -} - static inline void wpas_ubus_add_bss(struct wpa_supplicant *wpa_s) { } diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c new file mode 100644 index 00000000000000..55d22584ff4d4d --- /dev/null +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -0,0 +1,281 @@ +#include "utils/includes.h" +#include "utils/common.h" +#include "utils/ucode.h" +#include "drivers/driver.h" +#include "ap/hostapd.h" +#include "wpa_supplicant_i.h" +#include "wps_supplicant.h" +#include "bss.h" +#include "ucode.h" + +static struct wpa_global *wpa_global; +static uc_resource_type_t *global_type, *iface_type; +static uc_value_t *global, *iface_registry; +static uc_vm_t *vm; + +static uc_value_t * +wpas_ucode_iface_get_uval(struct wpa_supplicant *wpa_s) +{ + uc_value_t *val; + + if (wpa_s->ucode.idx) + return wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx); + + val = uc_resource_new(iface_type, wpa_s); + wpa_s->ucode.idx = wpa_ucode_registry_add(iface_registry, val); + + return val; +} + +static void +wpas_ucode_update_interfaces(void) +{ + uc_value_t *ifs = ucv_object_new(vm); + struct wpa_supplicant *wpa_s; + int i; + + for (wpa_s = wpa_global->ifaces; wpa_s; wpa_s = wpa_s->next) + ucv_object_add(ifs, wpa_s->ifname, ucv_get(wpas_ucode_iface_get_uval(wpa_s))); + + ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); + ucv_gc(vm); +} + +void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s) +{ + uc_value_t *val; + + if (wpa_ucode_call_prepare("iface_add")) + return; + + uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_get(wpas_ucode_iface_get_uval(wpa_s))); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s) +{ + uc_value_t *val; + + val = wpa_ucode_registry_remove(iface_registry, wpa_s->ucode.idx); + if (!val) + return; + + wpa_s->ucode.idx = 0; + if (wpa_ucode_call_prepare("iface_remove")) + return; + + uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void wpas_ucode_update_state(struct wpa_supplicant *wpa_s) +{ + const char *state; + uc_value_t *val; + + val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx); + if (!val) + return; + + if (wpa_ucode_call_prepare("state")) + return; + + state = wpa_supplicant_state_txt(wpa_s->wpa_state); + uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_get(val)); + uc_value_push(ucv_get(ucv_string_new(state))); + ucv_put(wpa_ucode_call(3)); + ucv_gc(vm); +} + +void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data) +{ + const char *state; + uc_value_t *val; + + if (event != EVENT_CH_SWITCH_STARTED) + return; + + val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx); + if (!val) + return; + + if (wpa_ucode_call_prepare("event")) + return; + + uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_get(val)); + uc_value_push(ucv_get(ucv_string_new(event_to_string(event)))); + val = ucv_object_new(vm); + uc_value_push(ucv_get(val)); + + if (event == EVENT_CH_SWITCH_STARTED) { + ucv_object_add(val, "csa_count", ucv_int64_new(data->ch_switch.count)); + ucv_object_add(val, "frequency", ucv_int64_new(data->ch_switch.freq)); + ucv_object_add(val, "sec_chan_offset", ucv_int64_new(data->ch_switch.ch_offset)); + ucv_object_add(val, "center_freq1", ucv_int64_new(data->ch_switch.cf1)); + ucv_object_add(val, "center_freq2", ucv_int64_new(data->ch_switch.cf2)); + } + + ucv_put(wpa_ucode_call(4)); + ucv_gc(vm); +} + +static const char *obj_stringval(uc_value_t *obj, const char *name) +{ + uc_value_t *val = ucv_object_get(obj, name, NULL); + + return ucv_string_get(val); +} + +static uc_value_t * +uc_wpas_add_iface(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *info = uc_fn_arg(0); + uc_value_t *ifname = ucv_object_get(info, "iface", NULL); + uc_value_t *bridge = ucv_object_get(info, "bridge", NULL); + uc_value_t *config = ucv_object_get(info, "config", NULL); + uc_value_t *ctrl = ucv_object_get(info, "ctrl", NULL); + struct wpa_interface iface; + int ret = -1; + + if (ucv_type(info) != UC_OBJECT) + goto out; + + iface = (struct wpa_interface){ + .driver = "nl80211", + .ifname = ucv_string_get(ifname), + .bridge_ifname = ucv_string_get(bridge), + .confname = ucv_string_get(config), + .ctrl_interface = ucv_string_get(ctrl), + }; + + if (!iface.ifname || !iface.confname) + goto out; + + ret = wpa_supplicant_add_iface(wpa_global, &iface, 0) ? 0 : -1; + wpas_ucode_update_interfaces(); + +out: + return ucv_int64_new(ret); +} + +static uc_value_t * +uc_wpas_remove_iface(uc_vm_t *vm, size_t nargs) +{ + struct wpa_supplicant *wpa_s = NULL; + uc_value_t *ifname_arg = uc_fn_arg(0); + const char *ifname = ucv_string_get(ifname_arg); + int ret = -1; + + if (!ifname) + goto out; + + for (wpa_s = wpa_global->ifaces; wpa_s; wpa_s = wpa_s->next) + if (!strcmp(wpa_s->ifname, ifname)) + break; + + if (!wpa_s) + goto out; + + ret = wpa_supplicant_remove_iface(wpa_global, wpa_s, 0); + wpas_ucode_update_interfaces(); + +out: + return ucv_int64_new(ret); +} + +static uc_value_t * +uc_wpas_iface_status(uc_vm_t *vm, size_t nargs) +{ + struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface"); + struct wpa_bss *bss; + uc_value_t *ret, *val; + + if (!wpa_s) + return NULL; + + ret = ucv_object_new(vm); + + val = ucv_string_new(wpa_supplicant_state_txt(wpa_s->wpa_state)); + ucv_object_add(ret, "state", ucv_get(val)); + + bss = wpa_s->current_bss; + if (bss) { + int sec_chan = 0; + const u8 *ie; + + ie = wpa_bss_get_ie(bss, WLAN_EID_HT_OPERATION); + if (ie && ie[1] >= 2) { + const struct ieee80211_ht_operation *ht_oper; + int sec; + + ht_oper = (const void *) (ie + 2); + sec = ht_oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK; + if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) + sec_chan = 1; + else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) + sec_chan = -1; + } + + ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(sec_chan)); + ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq)); + } + +#ifdef CONFIG_MESH + if (wpa_s->ifmsh) { + struct hostapd_iface *ifmsh = wpa_s->ifmsh; + + ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(ifmsh->conf->secondary_channel)); + ucv_object_add(ret, "frequency", ucv_int64_new(ifmsh->freq)); + } +#endif + + return ret; +} + +int wpas_ucode_init(struct wpa_global *gl) +{ + static const uc_function_list_t global_fns[] = { + { "printf", uc_wpa_printf }, + { "getpid", uc_wpa_getpid }, + { "add_iface", uc_wpas_add_iface }, + { "remove_iface", uc_wpas_remove_iface }, + }; + static const uc_function_list_t iface_fns[] = { + { "status", uc_wpas_iface_status }, + }; + uc_value_t *data, *proto; + + wpa_global = gl; + vm = wpa_ucode_create_vm(); + + global_type = uc_type_declare(vm, "wpas.global", global_fns, NULL); + iface_type = uc_type_declare(vm, "wpas.iface", iface_fns, NULL); + + iface_registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "wpas.iface_registry", iface_registry); + + global = wpa_ucode_global_init("wpas", global_type); + + if (wpa_ucode_run(HOSTAPD_UC_PATH "wpa_supplicant.uc")) + goto free_vm; + + ucv_gc(vm); + return 0; + +free_vm: + wpa_ucode_free_vm(); + return -1; +} + +void wpas_ucode_free(void) +{ + if (wpa_ucode_call_prepare("shutdown") == 0) + ucv_put(wpa_ucode_call(0)); + wpa_ucode_free_vm(); +} diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.h b/package/network/services/hostapd/src/wpa_supplicant/ucode.h new file mode 100644 index 00000000000000..a429a0ed87bdcc --- /dev/null +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.h @@ -0,0 +1,49 @@ +#ifndef __WPAS_UCODE_H +#define __WPAS_UCODE_H + +#include "utils/ucode.h" + +struct wpa_global; +union wpa_event_data; +struct wpa_supplicant; + +struct wpas_ucode_bss { +#ifdef UCODE_SUPPORT + unsigned int idx; +#endif +}; + +#ifdef UCODE_SUPPORT +int wpas_ucode_init(struct wpa_global *gl); +void wpas_ucode_free(void); +void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s); +void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s); +void wpas_ucode_update_state(struct wpa_supplicant *wpa_s); +void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data); +#else +static inline int wpas_ucode_init(struct wpa_global *gl) +{ + return -EINVAL; +} +static inline void wpas_ucode_free(void) +{ +} +static inline void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s) +{ +} + +static inline void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s) +{ +} + +static inline void wpas_ucode_update_state(struct wpa_supplicant *wpa_s) +{ +} + +static inline void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data) +{ +} + +#endif + +#endif From a701e6e1c28fcca0a73ccc0b05e3b4418a9b1b9d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 22 Jun 2023 15:58:30 +0200 Subject: [PATCH 0444/1171] netifd: update to the latest version 077e05f2b129 vlan/vlandev: pass through extra vlan information passed via hotplug 40fad91eb5be wireless: add network_vlan config attribute 1571e18e4a69 bridge: add support for configuring extra tagged vlans on member devices b719f189f243 bridge: make hotplug-added vlans default to tagged edf3aced9f9a bridge: add support for adding vlan ranges via hotplug 493e1589bc8b bridge: fix coverity false positive report 03a619947717 bridge: add support for configuring extra vlans for the bridge itself 4bea6d21a9ab wireless: fix changing reconf/serialize options in configuration 255b4d5c472e wireless: fix handling config reload with reconf=1 1ab992a74b43 wireless: fix another reconf issue e94f7a81a039 bridge: fix config reload on 32 bit systems 8c2758b4fbbb wireless: add support for replacing data blobs at runtime 0ff22a6a68ce wireless: enable dynamic reconfiguration by default 4711f74479e2 netifd: fix disabling radio via config if reconf is being used Signed-off-by: Felix Fietkau (cherry picked from commit 09fd59938b673ca10d4b3c46d32f18164bcdb21a) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 31fd0838a49309..ceedded96c916f 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-06-04 -PKG_SOURCE_VERSION:=ec9dba72124597b7224bbfe75960386dc320f4bd -PKG_MIRROR_HASH:=baee39a3882a2b03fc83a3a6a8963c340fa8d884c7a8c9e80e7d2dddc50e24bd +PKG_SOURCE_DATE:=2023-08-17 +PKG_SOURCE_VERSION:=4711f74479e213ef86f8792b408b117d40148eb2 +PKG_MIRROR_HASH:=91c8aa8e890b0616c1ad1860618951ee73655c4e53cc31999dcbb8d00b8b456d PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 98d0ee9dbf7a578093b5e97363e5a07dd28ea99a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 31 Aug 2023 11:16:04 +0200 Subject: [PATCH 0445/1171] hostapd: fix FILS key mgmt type for WPA3 Enterprise 192 bit Use the SHA384 variant to account for longer keys with more security Signed-off-by: Felix Fietkau (cherry picked from commit f0d1349b52983400e7526f3ab57dc6a0f2cc771a) --- package/network/services/hostapd/files/hostapd.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index c6ae6fb98b0b4b..36aa6273b6ab7f 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -77,6 +77,10 @@ hostapd_append_wpa_key_mgmt() { [ "$fils" -gt 0 ] && { case "$auth_type" in + eap-192) + append wpa_key_mgmt FILS-SHA384 + [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt FT-FILS-SHA384 + ;; eap*) append wpa_key_mgmt FILS-SHA256 [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt FT-FILS-SHA256 From 6798f156f910b227abf21b683ab3723663a9de02 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 31 Aug 2023 11:16:42 +0200 Subject: [PATCH 0446/1171] hostapd: support eap-eap2 and eap2 auth_type values WPA3 Enterprise-transitional requires optional MFP support and SHA1+SHA256 WPA3 Enterprise-only requires SHA1 support disabled and mandatory MFP. Signed-off-by: Felix Fietkau (cherry picked from commit b63df6ce5d0639e6106967fd445c96518da52afb) --- .../network/services/hostapd/files/hostapd.sh | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 36aa6273b6ab7f..830752cd87c28c 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -52,12 +52,20 @@ hostapd_append_wpa_key_mgmt() { ;; eap-eap192) append wpa_key_mgmt "WPA-EAP-SUITE-B-192" - append wpa_key_mgmt "WPA-EAP" + append wpa_key_mgmt "WPA-EAP-SHA256" [ "${ieee80211r:-0}" -gt 0 ] && { append wpa_key_mgmt "FT-EAP-SHA384" append wpa_key_mgmt "FT-EAP" } - [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256" + ;; + eap-eap2) + append wpa_key_mgmt "WPA-EAP" + append wpa_key_mgmt "WPA-EAP-SHA256" + [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" + ;; + eap2) + [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" + append wpa_key_mgmt "WPA-EAP-SHA256" ;; sae) append wpa_key_mgmt "SAE" @@ -642,12 +650,12 @@ hostapd_set_bss_options() { [ -n "$ocv" ] && append bss_conf "ocv=$ocv" "$N" case "$auth_type" in - sae|owe|eap192|eap-eap192) + sae|owe|eap2|eap192|eap-eap192) set_default ieee80211w 2 set_default sae_require_mfp 1 set_default sae_pwe 2 ;; - psk-sae) + psk-sae|eap-eap2) set_default ieee80211w 1 set_default sae_require_mfp 1 set_default sae_pwe 2 @@ -698,7 +706,7 @@ hostapd_set_bss_options() { vlan_possible=1 wps_possible=1 ;; - eap|eap192|eap-eap192) + eap|eap2|eap-eap2|eap192|eap-eap192) json_get_vars \ auth_server auth_secret auth_port \ dae_client dae_secret dae_port \ @@ -1305,7 +1313,7 @@ wpa_supplicant_add_network() { default_disabled case "$auth_type" in - sae|owe|eap192|eap-eap192) + sae|owe|eap2|eap192|eap-eap192) set_default ieee80211w 2 ;; psk-sae) @@ -1388,7 +1396,7 @@ wpa_supplicant_add_network() { fi append network_data "$passphrase" "$N$T" ;; - eap|eap192|eap-eap192) + eap|eap2|eap192|eap-eap192) hostapd_append_wpa_key_mgmt key_mgmt="$wpa_key_mgmt" From 6e09f88d29171f2ddd74cb5e70653dbe58f10af6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 31 Aug 2023 13:02:00 +0200 Subject: [PATCH 0447/1171] netifd: update to the latest version db3934d2f740 scripts/netifd-wireless.sh: properly fix WPA3 Enterprise support Support the following values for the different WPA3 Enterprise modes: - wpa3-mixed: WPA3 Enterprise transitional mode This supports EAP with both SHA1 and SHA-256, with optional MFP - wpa3: WPA3 Enterprise only mode This supports only SHA256 with mandatory MFP - wpa3-192: WPA3 Enterprise with mandatory 192 bit support This uses only GCMP-256 ciphers Disable 192 bit support and GCMP-256 ciphers for the regular "wpa3" mode. It seems that even leaving in optional 192 bit support breaks auth on some clients, including iOS devices. Signed-off-by: Felix Fietkau (cherry picked from commit 8c03dc962f8e10f9fef0877a0f8d8235f619ef7d) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index ceedded96c916f..978e44e309b8c0 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-08-17 -PKG_SOURCE_VERSION:=4711f74479e213ef86f8792b408b117d40148eb2 -PKG_MIRROR_HASH:=91c8aa8e890b0616c1ad1860618951ee73655c4e53cc31999dcbb8d00b8b456d +PKG_SOURCE_DATE:=2023-08-31 +PKG_SOURCE_VERSION:=db3934d2f740bdfe8537933741f71b439a109422 +PKG_MIRROR_HASH:=3fade75e70e7d0f926515f5bdac46bcd196a595ae024c16fc3c5aad65bb07777 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 90d59617515de828b1c7d03ecdb4c00e15944047 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 31 Aug 2023 13:04:19 +0200 Subject: [PATCH 0448/1171] hostapd: remove eap-eap192 auth type value It is no longer used Signed-off-by: Felix Fietkau (cherry picked from commit b0501d380f65ae9f82173b35b820c9c6adb92493) --- .../network/services/hostapd/files/hostapd.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 830752cd87c28c..271c1f7becd270 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -50,14 +50,6 @@ hostapd_append_wpa_key_mgmt() { append wpa_key_mgmt "WPA-EAP-SUITE-B-192" [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP-SHA384" ;; - eap-eap192) - append wpa_key_mgmt "WPA-EAP-SUITE-B-192" - append wpa_key_mgmt "WPA-EAP-SHA256" - [ "${ieee80211r:-0}" -gt 0 ] && { - append wpa_key_mgmt "FT-EAP-SHA384" - append wpa_key_mgmt "FT-EAP" - } - ;; eap-eap2) append wpa_key_mgmt "WPA-EAP" append wpa_key_mgmt "WPA-EAP-SHA256" @@ -650,7 +642,7 @@ hostapd_set_bss_options() { [ -n "$ocv" ] && append bss_conf "ocv=$ocv" "$N" case "$auth_type" in - sae|owe|eap2|eap192|eap-eap192) + sae|owe|eap2|eap192) set_default ieee80211w 2 set_default sae_require_mfp 1 set_default sae_pwe 2 @@ -706,7 +698,7 @@ hostapd_set_bss_options() { vlan_possible=1 wps_possible=1 ;; - eap|eap2|eap-eap2|eap192|eap-eap192) + eap|eap2|eap-eap2|eap192) json_get_vars \ auth_server auth_secret auth_port \ dae_client dae_secret dae_port \ @@ -1313,7 +1305,7 @@ wpa_supplicant_add_network() { default_disabled case "$auth_type" in - sae|owe|eap2|eap192|eap-eap192) + sae|owe|eap2|eap192) set_default ieee80211w 2 ;; psk-sae) @@ -1396,7 +1388,7 @@ wpa_supplicant_add_network() { fi append network_data "$passphrase" "$N$T" ;; - eap|eap2|eap192|eap-eap192) + eap|eap2|eap192) hostapd_append_wpa_key_mgmt key_mgmt="$wpa_key_mgmt" From 5e3f86a1014dd19bcf1937a876f333ecf8cc0a83 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 31 Aug 2023 13:12:23 +0200 Subject: [PATCH 0449/1171] hostapd: select libopenssl-legacy for openssl variants Without it, a lot of authentication modes fail without obvious error messages Signed-off-by: Felix Fietkau (cherry picked from commit 560965d5826626e3be8c1f1db194db43cc7002cf) --- package/network/services/hostapd/Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 7b94709e204a68..5537500313e9dc 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -80,6 +80,7 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),) endif CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json +OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl +PACKAGE_$(1):libopenssl-legacy DRIVER_MAKEOPTS= \ CONFIG_ACS=y CONFIG_DRIVER_NL80211=y \ @@ -171,7 +172,7 @@ define Package/hostapd-openssl $(call Package/hostapd/Default,$(1)) TITLE+= (OpenSSL full) VARIANT:=full-openssl - DEPENDS+=+PACKAGE_hostapd-openssl:libopenssl + DEPENDS+=$(OPENSSL_DEPENDS) endef Package/hostapd-openssl/description = $(Package/hostapd/description) @@ -278,7 +279,7 @@ define Package/wpad-openssl $(call Package/wpad/Default,$(1)) TITLE+= (OpenSSL full) VARIANT:=wpad-full-openssl - DEPENDS+=+PACKAGE_wpad-openssl:libopenssl + DEPENDS+=$(OPENSSL_DEPENDS) endef Package/wpad-openssl/description = $(Package/wpad/description) @@ -315,7 +316,7 @@ define Package/wpad-basic-openssl $(call Package/wpad/Default,$(1)) TITLE+= (OpenSSL, 11r, 11w) VARIANT:=wpad-basic-openssl - DEPENDS+=+PACKAGE_wpad-basic-openssl:libopenssl + DEPENDS+=$(OPENSSL_DEPENDS) endef define Package/wpad-basic-openssl/description @@ -367,7 +368,7 @@ endef define Package/wpad-mesh-openssl $(call Package/wpad-mesh,$(1)) TITLE+= (OpenSSL, 11s, SAE) - DEPENDS+=+PACKAGE_wpad-mesh-openssl:libopenssl + DEPENDS+=$(OPENSSL_DEPENDS) VARIANT:=wpad-mesh-openssl endef @@ -416,7 +417,7 @@ define Package/wpa-supplicant-openssl $(call Package/wpa-supplicant/Default,$(1)) TITLE+= (OpenSSL full) VARIANT:=supplicant-full-openssl - DEPENDS+=+PACKAGE_wpa-supplicant-openssl:libopenssl + DEPENDS+=$(OPENSSL_DEPENDS) endef define Package/wpa-supplicant-wolfssl @@ -453,7 +454,7 @@ define Package/wpa-supplicant-mesh-openssl $(call Package/wpa-supplicant-mesh/Default,$(1)) TITLE+= (OpenSSL, 11s, SAE) VARIANT:=supplicant-mesh-openssl - DEPENDS+=+PACKAGE_wpa-supplicant-mesh-openssl:libopenssl + DEPENDS+=$(OPENSSL_DEPENDS) endef define Package/wpa-supplicant-mesh-wolfssl @@ -533,7 +534,7 @@ define Package/eapol-test-openssl TITLE+= (OpenSSL full) VARIANT:=supplicant-full-openssl CONFLICTS:=$(filter-out eapol-test-openssl ,$(EAPOL_TEST_PROVIDERS)) - DEPENDS+=+PACKAGE_eapol-test-openssl:libopenssl + DEPENDS+=$(OPENSSL_DEPENDS) PROVIDES:=eapol-test endef From 0d1859c258ea0e05fc60af74d9d4e15becd44a10 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 18 Sep 2023 13:05:30 +0200 Subject: [PATCH 0450/1171] netifd: update to the latest version f429bd94f99e system-linux: switch to new ETHTOOL_xLINKSETTINGS API 1a07f1dff32b make_ethtool_modes_h.sh: apply anti-bashism 3d425f16d6a6 wireless: rework and fix vlan/station config reload handling 88a3a9e2be07 wireless: clean up prev_config handling afcd3825dad9 wireless: dynamically enable/disable virtual interfaces base on network interface autostart Signed-off-by: Felix Fietkau (cherry picked from commit a33f1d35155cf9579065ed76bd17e991d165170e) --- package/network/config/netifd/Makefile | 6 ++-- package/network/config/netifd/files/sbin/ifup | 33 ------------------- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 978e44e309b8c0..bb88bf726dd962 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-08-31 -PKG_SOURCE_VERSION:=db3934d2f740bdfe8537933741f71b439a109422 -PKG_MIRROR_HASH:=3fade75e70e7d0f926515f5bdac46bcd196a595ae024c16fc3c5aad65bb07777 +PKG_SOURCE_DATE:=2023-09-15.1 +PKG_SOURCE_VERSION:=afcd3825dad9b6a6712fbf6ed8e4434819a34009 +PKG_MIRROR_HASH:=d389db5dec7140fc12f69e8d679b9242c72d27b35c789b12adc6ebdf16913a85 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/config/netifd/files/sbin/ifup b/package/network/config/netifd/files/sbin/ifup index 15be535bbfc9ee..fbf2fd80c7ea7d 100755 --- a/package/network/config/netifd/files/sbin/ifup +++ b/package/network/config/netifd/files/sbin/ifup @@ -1,7 +1,6 @@ #!/bin/sh ifup_all= -setup_wifi= if_call() { local interface="$1" @@ -14,7 +13,6 @@ case "$0" in *ifdown) modes=down;; *ifup) modes="down up" - setup_wifi=1 ;; *) echo "Invalid command: $0";; esac @@ -25,10 +23,6 @@ while :; do ifup_all=1 shift ;; - -w) - setup_wifi= - shift - ;; *) break ;; @@ -40,7 +34,6 @@ if [ -n "$ifup_all" ]; then for interface in $(ubus -S list 'network.interface.*'); do if_call "${interface##network.interface.}" done - [ -n "$setup_wifi" ] && /sbin/wifi up exit else ubus -S list "network.interface.$1" > /dev/null || { @@ -49,29 +42,3 @@ else } if_call "$1" fi - -if [ -n "$setup_wifi" ] && grep -sq config /etc/config/wireless; then - . /lib/functions.sh - - find_related_radios() { - local wdev wnet - config_get wdev "$1" device - config_get wnet "$1" network - - if [ -n "$wdev" ]; then - for wnet in $wnet; do - if [ "$wnet" = "$network" ]; then - append radio_devs "$wdev" "$N" - fi - done - fi - } - - network="$1" - config_load wireless - config_foreach find_related_radios wifi-iface - - for dev in $(echo "$radio_devs" | sort -u); do - /sbin/wifi up "$dev" - done -fi From 8b385a45a65cb4721e6bb2fbb24ce080417e331f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 14 Sep 2023 13:28:14 +0200 Subject: [PATCH 0451/1171] mac80211: fix AP reconfiguration on DFS channels in non-ETSI regdomain Allow grace period for DFS available after shutting down beacons on the channel Signed-off-by: Felix Fietkau (cherry picked from commit 16889141d99d3ec1410f3b4dc22de4022dbe9057) --- ...race-period-for-DFS-available-after-.patch | 149 ++++++++++++++++++ .../500-mac80211_configure_antenna_gain.patch | 4 +- 2 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 package/kernel/mac80211/patches/subsys/340-cfg80211-allow-grace-period-for-DFS-available-after-.patch diff --git a/package/kernel/mac80211/patches/subsys/340-cfg80211-allow-grace-period-for-DFS-available-after-.patch b/package/kernel/mac80211/patches/subsys/340-cfg80211-allow-grace-period-for-DFS-available-after-.patch new file mode 100644 index 00000000000000..ad2e2e24c9fb3d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/340-cfg80211-allow-grace-period-for-DFS-available-after-.patch @@ -0,0 +1,149 @@ +From: Felix Fietkau +Date: Thu, 14 Sep 2023 13:17:16 +0200 +Subject: [PATCH] cfg80211: allow grace period for DFS available after beacon + shutdown + +Fixes reconfiguring an AP on a DFS channel in non-ETSI regdomain + +Fixes: b35a51c7dd25 ("cfg80211: Make pre-CAC results valid only for ETSI domain") +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -175,6 +175,8 @@ enum ieee80211_channel_flags { + * @dfs_state: current state of this channel. Only relevant if radar is required + * on this channel. + * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. ++ * @dfs_state_last_available: timestamp (jiffies) of the last time when the ++ * channel was available. + * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. + */ + struct ieee80211_channel { +@@ -191,6 +193,7 @@ struct ieee80211_channel { + int orig_mag, orig_mpwr; + enum nl80211_dfs_state dfs_state; + unsigned long dfs_state_entered; ++ unsigned long dfs_state_last_available; + unsigned int dfs_cac_ms; + }; + +--- a/net/wireless/ap.c ++++ b/net/wireless/ap.c +@@ -30,6 +30,9 @@ static int ___cfg80211_stop_ap(struct cf + if (!wdev->links[link_id].ap.beacon_interval) + return -ENOENT; + ++ cfg80211_update_last_available(wdev->wiphy, ++ &wdev->links[link_id].ap.chandef); ++ + err = rdev_stop_ap(rdev, dev, link_id); + if (!err) { + wdev->conn_owner_nlportid = 0; +@@ -41,9 +44,6 @@ static int ___cfg80211_stop_ap(struct cf + if (notify) + nl80211_send_ap_stopped(wdev); + +- /* Should we apply the grace period during beaconing interface +- * shutdown also? +- */ + cfg80211_sched_dfs_chan_update(rdev); + } + +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -461,6 +461,8 @@ static void cfg80211_set_chans_dfs_state + + c->dfs_state = dfs_state; + c->dfs_state_entered = jiffies; ++ if (dfs_state == NL80211_DFS_AVAILABLE) ++ c->dfs_state_last_available = jiffies; + } + } + +@@ -873,6 +875,49 @@ static bool cfg80211_get_chans_dfs_avail + return true; + } + ++static void ++__cfg80211_update_last_available(struct wiphy *wiphy, ++ u32 center_freq, ++ u32 bandwidth) ++{ ++ struct ieee80211_channel *c; ++ u32 freq, start_freq, end_freq; ++ ++ start_freq = cfg80211_get_start_freq(center_freq, bandwidth); ++ end_freq = cfg80211_get_end_freq(center_freq, bandwidth); ++ ++ /* ++ * Check entire range of channels for the bandwidth. ++ * If any channel in between is disabled or has not ++ * had gone through CAC return false ++ */ ++ for (freq = start_freq; freq <= end_freq; freq += MHZ_TO_KHZ(20)) { ++ c = ieee80211_get_channel_khz(wiphy, freq); ++ if (!c) ++ return; ++ ++ c->dfs_state_last_available = jiffies; ++ } ++} ++ ++void cfg80211_update_last_available(struct wiphy *wiphy, ++ const struct cfg80211_chan_def *chandef) ++{ ++ int width; ++ ++ width = cfg80211_chandef_get_width(chandef); ++ if (width < 0) ++ return; ++ ++ __cfg80211_update_last_available(wiphy, MHZ_TO_KHZ(chandef->center_freq1), ++ width); ++ if (chandef->width != NL80211_CHAN_WIDTH_80P80) ++ return; ++ ++ __cfg80211_update_last_available(wiphy, MHZ_TO_KHZ(chandef->center_freq2), ++ width); ++} ++ + static bool cfg80211_chandef_dfs_available(struct wiphy *wiphy, + const struct cfg80211_chan_def *chandef) + { +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -477,6 +477,8 @@ void cfg80211_set_dfs_state(struct wiphy + enum nl80211_dfs_state dfs_state); + + void cfg80211_dfs_channels_update_work(struct work_struct *work); ++void cfg80211_update_last_available(struct wiphy *wiphy, ++ const struct cfg80211_chan_def *chandef); + + unsigned int + cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -891,6 +891,8 @@ void cfg80211_dfs_channels_update_work(s + if (c->dfs_state == NL80211_DFS_UNAVAILABLE) { + time_dfs_update = IEEE80211_DFS_MIN_NOP_TIME_MS; + radar_event = NL80211_RADAR_NOP_FINISHED; ++ timeout = c->dfs_state_entered + ++ msecs_to_jiffies(time_dfs_update); + } else { + if (regulatory_pre_cac_allowed(wiphy) || + cfg80211_any_wiphy_oper_chan(wiphy, c)) +@@ -898,11 +900,10 @@ void cfg80211_dfs_channels_update_work(s + + time_dfs_update = REG_PRE_CAC_EXPIRY_GRACE_MS; + radar_event = NL80211_RADAR_PRE_CAC_EXPIRED; ++ timeout = c->dfs_state_last_available + ++ msecs_to_jiffies(time_dfs_update); + } + +- timeout = c->dfs_state_entered + +- msecs_to_jiffies(time_dfs_update); +- + if (time_after_eq(jiffies, timeout)) { + c->dfs_state = NL80211_DFS_USABLE; + c->dfs_state_entered = jiffies; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 4a3984fb424510..58a590682a3502 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -4081,6 +4081,7 @@ struct mgmt_frame_regs { +@@ -4084,6 +4084,7 @@ struct mgmt_frame_regs { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state -@@ -4431,6 +4432,7 @@ struct cfg80211_ops { +@@ -4434,6 +4435,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); From 09b9d732ec76a0cf0c80223f1c0b991139dd4e82 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 19 Sep 2023 11:02:54 +0200 Subject: [PATCH 0452/1171] hostapd: use phy name for hostapd interfaces instead of first-bss ifname Improves reliability in error handling Signed-off-by: Felix Fietkau (cherry picked from commit a511480368a03f754aa6ce7887633247a07ea166) --- .../network/services/hostapd/files/hostapd.uc | 16 +++++++++------- .../hostapd/patches/601-ucode_support.patch | 10 ++++++++++ .../hostapd/patches/991-Fix-OpenWrt-13156.patch | 4 ++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index ebf732bea51e2c..5cddb9c268bb69 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -26,7 +26,6 @@ function iface_remove(cfg) if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname) return; - hostapd.remove_iface(cfg.bss[0].ifname); for (let bss in cfg.bss) wdev_remove(bss.ifname); } @@ -95,14 +94,14 @@ function iface_add(phy, config, phy_status) let config_inline = iface_gen_config(phy, config, !!phy_status); let bss = config.bss[0]; - let ret = hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`); + let ret = hostapd.add_iface(`bss_config=${phy}:${config_inline}`); if (ret < 0) return false; if (!phy_status) return true; - let iface = hostapd.interfaces[bss.ifname]; + let iface = hostapd.interfaces[phy]; if (!iface) return false; @@ -127,6 +126,7 @@ function iface_restart(phydev, config, old_config) { let phy = phydev.name; + hostapd.remove_iface(phy); iface_remove(old_config); iface_remove(config); @@ -267,13 +267,13 @@ function iface_reload_config(phydev, config, old_config) if (!old_config.bss || !old_config.bss[0]) return false; - let iface_name = old_config.bss[0].ifname; - let iface = hostapd.interfaces[iface_name]; + let iface = hostapd.interfaces[phy]; if (!iface) { hostapd.printf(`Could not find previous interface ${iface_name}`); return false; } + let iface_name = old_config.bss[0].ifname; let first_bss = hostapd.bss[iface_name]; if (!first_bss) { hostapd.printf(`Could not find bss of previous interface ${iface_name}`); @@ -512,8 +512,10 @@ function iface_set_config(phy, config) hostapd.data.config[phy] = config; - if (!config) + if (!config) { + hostapd.remove_iface(phy); return iface_remove(old_config); + } let phydev = phy_open(phy); if (!phydev) { @@ -667,7 +669,7 @@ let main_obj = { if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname) return 0; - let iface = hostapd.interfaces[config.bss[0].ifname]; + let iface = hostapd.interfaces[phy]; if (!iface) return 0; diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index c8bbfd43d83370..858dc52a9882b7 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -142,6 +142,16 @@ { if (!hapd) return; +@@ -3491,7 +3495,8 @@ int hostapd_remove_iface(struct hapd_int + hapd_iface = interfaces->iface[i]; + if (hapd_iface == NULL) + return -1; +- if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { ++ if (!os_strcmp(hapd_iface->phy, buf) || ++ !os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { + wpa_printf(MSG_INFO, "Remove interface '%s'", buf); + hapd_iface->driver_ap_teardown = + !!(hapd_iface->drv_flags & --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -195,8 +195,20 @@ endif diff --git a/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch index 3f10fb1eef7602..097d62abc0116d 100644 --- a/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch +++ b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch @@ -20,7 +20,7 @@ Signed-off-by: Stijn Tintel --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -3563,6 +3563,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -3564,6 +3564,8 @@ int hostapd_remove_iface(struct hapd_int void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { @@ -29,7 +29,7 @@ Signed-off-by: Stijn Tintel if (hapd->tkip_countermeasures) { hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_MICHAEL_MIC_FAILURE); -@@ -3570,10 +3572,16 @@ void hostapd_new_assoc_sta(struct hostap +@@ -3571,10 +3573,16 @@ void hostapd_new_assoc_sta(struct hostap } #ifdef CONFIG_IEEE80211BE From 829196e1b16bf20062d1d839ad38042290bb016c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 19 Sep 2023 11:46:16 +0200 Subject: [PATCH 0453/1171] netifd: update to the latest version 7a58b995fdbe wireless: update prev_config on SET_DATA notify Signed-off-by: Felix Fietkau (cherry picked from commit f52e008d045302976d2ff40f35e91b84a5678d12) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index bb88bf726dd962..e60e5920983f2f 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-09-15.1 -PKG_SOURCE_VERSION:=afcd3825dad9b6a6712fbf6ed8e4434819a34009 -PKG_MIRROR_HASH:=d389db5dec7140fc12f69e8d679b9242c72d27b35c789b12adc6ebdf16913a85 +PKG_SOURCE_DATE:=2023-09-19 +PKG_SOURCE_VERSION:=7a58b995fdbecd9beed57e4d66d42cb3cf66aee2 +PKG_MIRROR_HASH:=a460a3b912047f8802eb24bb737084a08dad65b2dd520e5f5e7459379d1fcf8c PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 83bf45ea5cacabc2ec7060be6ab5115b871a7c21 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Sun, 20 Aug 2023 21:08:20 +0200 Subject: [PATCH 0454/1171] package: base-files: turn error into warning Some users have their routers configured to supply a DHCP range that includes the local interface address. That worked with dnsmasq because it automatically skips the local address. Re-enable those existing configurations for the release and hint at possible future problems. Signed-off-by: Leon M. Busch-George [ wrap commit description and remove unecessary text ] Signed-off-by: Christian Marangi --- package/base-files/files/bin/ipcalc.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh index 56854b4104105d..6e72617e1b2fba 100755 --- a/package/base-files/files/bin/ipcalc.sh +++ b/package/base-files/files/bin/ipcalc.sh @@ -80,8 +80,7 @@ BEGIN { } if (ipaddr > start && ipaddr < end) { - print "ipaddr inside range" > "/dev/stderr" - exit(1) + print "warning: ipaddr inside range - this might not be supported in future releases of Openwrt" > "/dev/stderr" } print "START="int2ip(start) From 6019945e960d2e09ba71eaeb3e03686d871b53e4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 20 Sep 2023 13:43:14 +0200 Subject: [PATCH 0455/1171] hostapd: fix a crash when disabling an interface during channel list update Signed-off-by: Felix Fietkau (cherry picked from commit e9722aef9e84110331706f74f7de0942c8d657ed) --- ...hannel_list_update_timeout-in-hostap.patch | 28 +++++++++++++++++++ .../hostapd/patches/601-ucode_support.patch | 8 +++--- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch diff --git a/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch b/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch new file mode 100644 index 00000000000000..fe81318385f15a --- /dev/null +++ b/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch @@ -0,0 +1,28 @@ +From: Felix Fietkau +Date: Wed, 20 Sep 2023 13:41:10 +0200 +Subject: [PATCH] hostapd: cancel channel_list_update_timeout in + hostapd_cleanup_iface_partial + +Fixes a crash when disabling an interface during channel list update + +Signed-off-by: Felix Fietkau +--- + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -569,6 +569,7 @@ static void sta_track_deinit(struct host + void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); ++ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); + #ifdef NEED_AP_MLME + hostapd_stop_setup_timers(iface); + #endif /* NEED_AP_MLME */ +@@ -598,7 +599,6 @@ void hostapd_cleanup_iface_partial(struc + static void hostapd_cleanup_iface(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); +- eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); + eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, + NULL); + diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 858dc52a9882b7..285309c0caab23 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -107,14 +107,14 @@ hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); -@@ -599,6 +602,7 @@ void hostapd_cleanup_iface_partial(struc - static void hostapd_cleanup_iface(struct hostapd_iface *iface) +@@ -570,6 +573,7 @@ static void sta_track_deinit(struct host + void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); + hostapd_ucode_free_iface(iface); eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); - eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, - NULL); + #ifdef NEED_AP_MLME + hostapd_stop_setup_timers(iface); @@ -1189,6 +1193,7 @@ static int hostapd_start_beacon(struct h hapd->driver->set_operstate(hapd->drv_priv, 1); From eda1545e6ea64063d7ffa0a80067679e3bef105e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 20 Sep 2023 18:40:17 +0200 Subject: [PATCH 0456/1171] hostapd: add missing NULL pointer check in uc_hostapd_iface_stop Avoid crashing if the interface has already been removed Signed-off-by: Felix Fietkau (cherry picked from commit 4145ff4d8a29c1c7a1569bb06fa4d1fe9808c94f) --- package/network/services/hostapd/src/src/ap/ucode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index e79f2420c07a0a..ac3222b03f80dd 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -471,6 +471,9 @@ uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); int i; + if (!iface) + return NULL; + switch (iface->state) { case HAPD_IFACE_ENABLED: case HAPD_IFACE_DISABLED: From 43e9cded0672a857ec7df278e1de04a5c085e599 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 20 Sep 2023 20:59:35 +0200 Subject: [PATCH 0457/1171] mpc85xx: correct WS-AP3715i eth LED assignment Ethernet LED assignments were incorrectly swapped. Fix the assignment logic so the correct LED is illuminated for the LAN LEDs. Signed-off-by: David Bauer (cherry picked from commit 80374177449ab7fadcf7c9cd9693cc0e92feba8d) --- target/linux/mpc85xx/base-files/etc/board.d/01_leds | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/mpc85xx/base-files/etc/board.d/01_leds b/target/linux/mpc85xx/base-files/etc/board.d/01_leds index d9b4d2d79d32b9..7e1d379efe4d51 100644 --- a/target/linux/mpc85xx/base-files/etc/board.d/01_leds +++ b/target/linux/mpc85xx/base-files/etc/board.d/01_leds @@ -8,7 +8,10 @@ boardname="${board##*,}" board_config_update case $board in -enterasys,ws-ap3715i|\ +enterasys,ws-ap3715i) + ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth0" + ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth1" + ;; extreme-networks,ws-ap3825i) ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth1" ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth0" From fe1028e89c7d112c97037a829d07195c4efaa5b8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 22 Sep 2023 07:58:45 +0200 Subject: [PATCH 0458/1171] hostapd: fix wpa_supplicant bringup with non-nl80211 drivers Needed for wired 802.1x Signed-off-by: Felix Fietkau (cherry picked from commit fd6d7aafb2c3d335a3d192c308ffdace8d292e9f) --- .../services/hostapd/src/wpa_supplicant/ucode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c index 55d22584ff4d4d..6cba73dcd53240 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -136,6 +136,7 @@ static uc_value_t * uc_wpas_add_iface(uc_vm_t *vm, size_t nargs) { uc_value_t *info = uc_fn_arg(0); + uc_value_t *driver = ucv_object_get(info, "driver", NULL); uc_value_t *ifname = ucv_object_get(info, "iface", NULL); uc_value_t *bridge = ucv_object_get(info, "bridge", NULL); uc_value_t *config = ucv_object_get(info, "config", NULL); @@ -154,6 +155,22 @@ uc_wpas_add_iface(uc_vm_t *vm, size_t nargs) .ctrl_interface = ucv_string_get(ctrl), }; + if (driver) { + const char *drvname; + if (ucv_type(driver) != UC_STRING) + goto out; + + iface.driver = NULL; + drvname = ucv_string_get(driver); + for (int i = 0; wpa_drivers[i]; i++) { + if (!strcmp(drvname, wpa_drivers[i]->name)) + iface.driver = wpa_drivers[i]->name; + } + + if (!iface.driver) + goto out; + } + if (!iface.ifname || !iface.confname) goto out; From 2f30dec3cbe56eca9f310922b6b694b3d6d57c5d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 22 Sep 2023 19:59:09 +0200 Subject: [PATCH 0459/1171] hostapd: fix patch rebase after a crash fix The patch refresh accidentally moved the hostapd_ucode_free_iface call to the wrong function Fixes: e9722aef9e84 ("hostapd: fix a crash when disabling an interface during channel list update") Signed-off-by: Felix Fietkau (cherry picked from commit 3a5ad6e3d74da713c0fc7d63b8026a56d16e198b) --- .../services/hostapd/patches/601-ucode_support.patch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 285309c0caab23..de182b985d97b3 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -107,14 +107,14 @@ hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); -@@ -570,6 +573,7 @@ static void sta_track_deinit(struct host - void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) +@@ -600,6 +603,7 @@ void hostapd_cleanup_iface_partial(struc + static void hostapd_cleanup_iface(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); + hostapd_ucode_free_iface(iface); - eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); - #ifdef NEED_AP_MLME - hostapd_stop_setup_timers(iface); + eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, + NULL); + @@ -1189,6 +1193,7 @@ static int hostapd_start_beacon(struct h hapd->driver->set_operstate(hapd->drv_priv, 1); From a684b512e56662ac6b151e5aa44367a7d9171a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Sat, 16 Sep 2023 21:55:01 +0200 Subject: [PATCH 0460/1171] ipq40xx: refactor ZTE MF287 series MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ZTE MF287 requires a different board calibration file for ath10k than the ZTE MF287+. The two devices receive their own DTS, thus the device tree is slightly refactored. Signed-off-by: Andreas Böhler (cherry picked from commit 9c7578d560708c040dc04d0db37ef682db58f6b5) --- package/firmware/ipq-wifi/Makefile | 2 + .../ipq40xx/base-files/etc/board.d/02_network | 1 + .../base-files/lib/upgrade/platform.sh | 1 + .../arch/arm/boot/dts/qcom-ipq4018-mf287.dts | 226 ++++++++++++++++++ ...87.dtsi => qcom-ipq4018-mf287_common.dtsi} | 2 - .../arm/boot/dts/qcom-ipq4018-mf287plus.dts | 10 +- .../arm/boot/dts/qcom-ipq4018-mf287pro.dts | 12 +- target/linux/ipq40xx/image/generic.mk | 13 +- 8 files changed, 260 insertions(+), 7 deletions(-) create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts rename target/linux/ipq40xx/files/arch/arm/boot/dts/{qcom-ipq4018-mf287.dtsi => qcom-ipq4018-mf287_common.dtsi} (96%) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 8936a1dd60a55f..19dd61af7570e7 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -41,6 +41,7 @@ ALLWIFIBOARDS:= \ xiaomi_ax3600 \ xiaomi_ax9000 \ zte_mf289f \ + zte_mf287 \ zte_mf287plus \ zyxel_nbg7815 @@ -129,6 +130,7 @@ $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) $(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F)) +$(eval $(call generate-ipq-wifi-package,zte_mf287,ZTE MF287)) $(eval $(call generate-ipq-wifi-package,zte_mf287plus,ZTE MF287Plus)) $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815)) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 77dc892d078874..5de62f1d7d0f2a 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -108,6 +108,7 @@ ipq40xx_setup_interfaces() zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; + zte,mf287|\ zte,mf287plus|\ zte,mf287pro) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 83aac330ca2dde..97f14b45f90640 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -27,6 +27,7 @@ EOF ;; zte,mf18a |\ zte,mf286d |\ + zte,mf287|\ zte,mf287plus |\ zte,mf287pro |\ zte,mf289f) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts new file mode 100644 index 00000000000000..722f25053d2398 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// Copyright (c) 2022, Pawel Dembicki . +// Copyright (c) 2022, Giammarco Marzano . +// Copyright (c) 2023, Andreas Böhler + +#include "qcom-ipq4018-mf287_common.dtsi" + +/ { + model = "ZTE MF287"; + compatible = "zte,mf287"; + + /* + * This node is used to restart modem module to avoid anomalous + * behaviours on initial communication. + */ + gpio-restart { + compatible = "gpio-restart"; + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; + }; +}; + +&key_reset { + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; +}; + +&key_wps { + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; +}; + +&led_status { + gpios = <&tlmm 0 GPIO_ACTIVE_LOW>; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>, + <&tlmm 59 GPIO_ACTIVE_HIGH>, + <&tlmm 1 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "0:QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "0:CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "0:APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = <0xf0000 0xc0000>; + read-only; + }; + + partition@1b0000 { + label = "0:reserved1"; + reg = <0x1b0000 0x50000>; + read-only; + }; + }; + }; + + spi-nand@1 { /* flash@1 ? */ + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = <0x0 0x140000>; + read-only; + }; + + partition@140000 { + label = "ART"; + reg = <0x140000 0x140000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + + partition@280000 { + label = "mac"; + reg = <0x280000 0x140000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mac_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + partition@3c0000 { + label = "cfg-param"; + reg = <0x3c0000 0x600000>; + read-only; + }; + + partition@9c0000 { + label = "oops"; + reg = <0x9c0000 0x140000>; + }; + + partition@b00000 { + label = "web"; + reg = <0xb00000 0x800000>; + }; + + partition@1300000 { + label = "rootfs"; + reg = <0x1300000 0x2200000>; + }; + + partition@3500000 { + label = "data"; + reg = <0x3500000 0x1900000>; + }; + + partition@4e00000 { + label = "fota"; + reg = <0x4e00000 0x3200000>; + }; + }; + }; + + zigbee@2 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "silabs,em3581"; + reg = <2>; + spi-max-frequency = <12000000>; + }; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio55", "gpio56", "gpio57"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio54", "gpio59", "gpio1"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&wifi0 { + qcom,ath10k-calibration-variant = "zte,mf287"; +}; + +&wifi1{ + qcom,ath10k-calibration-variant = "zte,mf287"; +}; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287_common.dtsi similarity index 96% rename from target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi rename to target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287_common.dtsi index 3cbe2eaa382068..dcb4915ae00a61 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dtsi +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287_common.dtsi @@ -171,7 +171,6 @@ status = "okay"; nvmem-cell-names = "pre-calibration", "mac-address"; nvmem-cells = <&precal_art_1000>, <&macaddr_mac_0>; - qcom,ath10k-calibration-variant = "zte,mf287plus"; }; &wifi1 { @@ -179,5 +178,4 @@ nvmem-cell-names = "pre-calibration", "mac-address"; nvmem-cells = <&precal_art_5000>, <&macaddr_mac_0>; mac-address-increment = <1>; - qcom,ath10k-calibration-variant = "zte,mf287plus"; }; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts index db8c8c9ad02a9f..b5f386fa4bbd9c 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts @@ -3,7 +3,7 @@ // Copyright (c) 2022, Giammarco Marzano . // Copyright (c) 2023, Andreas Böhler -#include "qcom-ipq4018-mf287.dtsi" +#include "qcom-ipq4018-mf287_common.dtsi" / { model = "ZTE MF287Plus"; @@ -216,3 +216,11 @@ }; }; }; + +&wifi0 { + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; + +&wifi1{ + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts index dda0f74449b7c6..0af7b0426b371b 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts @@ -3,7 +3,7 @@ // Copyright (c) 2022, Giammarco Marzano . // Copyright (c) 2023, Andreas Böhler -#include "qcom-ipq4018-mf287.dtsi" +#include "qcom-ipq4018-mf287_common.dtsi" / { model = "ZTE MF287Pro"; @@ -263,3 +263,13 @@ }; }; }; + +/* The MF287Plus and MF287Pro share the same board data file */ +&wifi0 { + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; + +/* The MF287Plus and MF287Pro share the same board data file */ +&wifi1{ + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 08cbd63b3c88d7..99a9b78b780958 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1164,7 +1164,6 @@ TARGET_DEVICES += zte_mf286d define Device/zte_mf287_common $(call Device/zte_mf28x_common) - DEVICE_PACKAGES += ipq-wifi-zte_mf287plus SOC := qcom-ipq4018 # The recovery image is used to return back to stock (an initramfs-based image # that can be flashed to the device via sysupgrade @@ -1177,15 +1176,23 @@ endef define Device/zte_mf287plus $(call Device/zte_mf287_common) + DEVICE_PACKAGES += ipq-wifi-zte_mf287plus DEVICE_DTS_CONFIG := config@ap.dk01.1-c2 DEVICE_MODEL := MF287Plus - DEVICE_ALT0_VENDOR := ZTE - DEVICE_ALT0_MODEL := MF287 endef TARGET_DEVICES += zte_mf287plus +define Device/zte_mf287 + $(call Device/zte_mf287_common) + DEVICE_PACKAGES += ipq-wifi-zte_mf287 + DEVICE_DTS_CONFIG := config@ap.dk01.1-c2 + DEVICE_MODEL := MF287 +endef +TARGET_DEVICES += zte_mf287 + define Device/zte_mf287pro $(call Device/zte_mf287_common) + DEVICE_PACKAGES += ipq-wifi-zte_mf287plus DEVICE_DTS_CONFIG := config@ap.dk04.1-c1 DEVICE_MODEL := MF287Pro endef From 457a12a834ba2a9d5ab6571bf37acbe4184122a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Mon, 18 Sep 2023 12:08:18 +0200 Subject: [PATCH 0461/1171] ipq40xx: ZTE MF287 series: move to gpio-export for modem-reset GPIO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turn the "gpio-restart" node into a "gpio-export" node for all MF287 variants, similar to the MF287 Pro. Unfortunately, there doesn't seem to be a "power button blocker" GPIO for the MF287 and MF287 Plus, so a modem reset always triggers a system reset. Signed-off-by: Andreas Böhler (cherry picked from commit 053f8f92d1395fa5d33b0b8f2fef44a4b926c112) --- .../arch/arm/boot/dts/qcom-ipq4018-mf287.dts | 11 +++-------- .../arm/boot/dts/qcom-ipq4018-mf287_common.dtsi | 10 ++++++++++ .../arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts | 11 +++-------- .../arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts | 15 ++++----------- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts index 722f25053d2398..43e39bdf960017 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287.dts @@ -8,15 +8,10 @@ / { model = "ZTE MF287"; compatible = "zte,mf287"; +}; - /* - * This node is used to restart modem module to avoid anomalous - * behaviours on initial communication. - */ - gpio-restart { - compatible = "gpio-restart"; - gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; - }; +&gpio_modem_reset { + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; }; &key_reset { diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287_common.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287_common.dtsi index dcb4915ae00a61..52272434679cbf 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287_common.dtsi +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287_common.dtsi @@ -35,6 +35,16 @@ }; }; + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + gpio_modem_reset: modem { + gpio-export,name = "modem-reset"; + gpio-export,output = <0>; + }; + }; + keys { compatible = "gpio-keys"; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts index b5f386fa4bbd9c..f09a77ff59f985 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts @@ -8,15 +8,10 @@ / { model = "ZTE MF287Plus"; compatible = "zte,mf287plus"; +}; - /* - * This node is used to restart modem module to avoid anomalous - * behaviours on initial communication. - */ - gpio-restart { - compatible = "gpio-restart"; - gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; - }; +&gpio_modem_reset { + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; }; &key_reset { diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts index 0af7b0426b371b..4fd44989c5eddc 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287pro.dts @@ -9,17 +9,6 @@ model = "ZTE MF287Pro"; compatible = "zte,mf287pro"; - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - modem { - gpio-export,name = "modem-reset"; - gpio-export,output = <0>; - gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>; - }; - }; - regulator-usb-vbus { compatible = "regulator-fixed"; regulator-name = "USB_VBUS"; @@ -31,6 +20,10 @@ }; }; +&gpio_modem_reset { + gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>; +}; + &key_reset { gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; }; From 06ff4dd562e2878e429256a578eac7e08e8ef386 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 20 Sep 2023 19:17:46 +0200 Subject: [PATCH 0462/1171] mvebu: cortexa72: enable USB PHY Since kernel 5.13 this is needed to enable USB ports on all devices in subtarget. Previously TF-A and COMPHY driver might have set up this PHY, but not anymore. Signed-off-by: Tomasz Maciej Nowak Tested-by: Robert Marko (cherry picked from commit eac192843030d16046a0d603284c2b4c89822431) --- target/linux/mvebu/cortexa72/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mvebu/cortexa72/config-5.15 b/target/linux/mvebu/cortexa72/config-5.15 index cb27e0285faae5..978208f1cb5a2a 100644 --- a/target/linux/mvebu/cortexa72/config-5.15 +++ b/target/linux/mvebu/cortexa72/config-5.15 @@ -72,6 +72,7 @@ CONFIG_PCIE_DW_HOST=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_MVEBU_CP110_COMPHY=y +CONFIG_PHY_MVEBU_CP110_UTMI=y CONFIG_PINCTRL_ARMADA_37XX=y CONFIG_PINCTRL_ARMADA_AP806=y CONFIG_PINCTRL_ARMADA_CP110=y From 4c2f44c859b13501c05b595e4f836f7ca7d90ae4 Mon Sep 17 00:00:00 2001 From: Yuu Toriyama Date: Sat, 2 Sep 2023 16:21:09 +0900 Subject: [PATCH 0463/1171] wireless-regdb: update to 2023.09.01 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: 9dc0800 wireless-regdb: Update regulatory rules for Philippines (PH) 111ba89 wireless-regdb: Update regulatory rules for Egypt (EG) from March 2022 guidelines ae1421f wireless-regdb: Update regulatory info for Türkiye (TR) 20e5b73 wireless-regdb: Update regulatory rules for Australia (AU) for June 2023 991b1ef wireless-regdb: update regulatory database based on preceding changes Signed-off-by: Yuu Toriyama (cherry picked from commit 0e13363de6879a1a8b7d4d2739c92122f2df693e) --- package/firmware/wireless-regdb/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/wireless-regdb/Makefile b/package/firmware/wireless-regdb/Makefile index 9ce2a397ff599e..dfff35ff4d7edc 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-regdb -PKG_VERSION:=2023.05.03 +PKG_VERSION:=2023.09.01 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/ -PKG_HASH:=f254d08ab3765aeae2b856222e11a95d44aef519a6663877c71ef68fae4c8c12 +PKG_HASH:=26d4c2a727cc59239b84735aad856b7c7d0b04e30aa5c235c4f7f47f5f053491 PKG_MAINTAINER:=Felix Fietkau From 2d812f0b72bdb2f2d4b70a4a9c91821ac42df489 Mon Sep 17 00:00:00 2001 From: Erik Karlsson Date: Wed, 6 Sep 2023 12:33:17 +0200 Subject: [PATCH 0464/1171] procd: create /dev/fd symlink This is needed for ksh/bash style process substitution such as <(command) and >(command) which was introduced in ash as of busybox version 1.34.0 to work. Signed-off-by: Erik Karlsson (cherry picked from commit fdce970dbb47a6f91b08bdac21a098e77926549f) --- package/system/procd/Makefile | 2 +- package/system/procd/files/hotplug.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 9e829a21591ef1..d0576c12595dee 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=procd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/files/hotplug.json index b930b307a4f3cb..9fecddae6be1f0 100644 --- a/package/system/procd/files/hotplug.json +++ b/package/system/procd/files/hotplug.json @@ -11,6 +11,7 @@ [ "eq", "DEVNAME", "null" ], [ [ "makedev", "/dev/%DEVNAME%", "0666" ], + [ "exec", "/bin/ln", "-s", "/proc/self/fd", "/dev/fd" ], [ "exec", "/bin/ln", "-s", "/proc/self/fd/0", "/dev/stdin" ], [ "exec", "/bin/ln", "-s", "/proc/self/fd/1", "/dev/stdout" ], [ "exec", "/bin/ln", "-s", "/proc/self/fd/2", "/dev/stderr" ], From 912eded06c425822daad654f08a13ee584f961be Mon Sep 17 00:00:00 2001 From: Ivan Pavlov Date: Sat, 23 Sep 2023 18:09:36 +0300 Subject: [PATCH 0465/1171] openssl: update to 3.0.11 Changes between 3.0.10 and 3.0.11 [19 Sep 2023] * Fix POLY1305 MAC implementation corrupting XMM registers on Windows. ([CVE-2023-4807]) Signed-off-by: Ivan Pavlov (cherry picked from commit bfd54529fac075eeb70f2408042e0da03b5ec8cc) --- package/libs/openssl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 7bee249676fc23..459d367372f749 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl -PKG_VERSION:=3.0.10 +PKG_VERSION:=3.0.11 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto @@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=1761d4f5b13a1028b9b6f3d4b8e17feb0cedc9370f6afe61d7193d2cdce83323 +PKG_HASH:=b3425d3bb4a2218d0697eb41f7fc0cdede016ed19ca49d168b78e8d947887f55 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE From 9349302bca44330039e1fd6141837fe507a2cf33 Mon Sep 17 00:00:00 2001 From: Oskari Rauta Date: Sun, 24 Sep 2023 11:29:39 +0300 Subject: [PATCH 0466/1171] ccache: add missing \ -DREDIS_STORAGE_BACKEND=OFF option is ignored due to missing \ Signed-off-by: Oskari Rauta (cherry picked from commit b61ac68b67427ce2eb2c81fa647a21d88ddd2a82) --- tools/ccache/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 33255e92970611..d2142f82a988d9 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -21,7 +21,7 @@ CMAKE_HOST_OPTIONS += \ -DCMAKE_CXX_COMPILER_LAUNCHER="" \ -DCMAKE_SKIP_RPATH=FALSE \ -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \ - -DENABLE_DOCUMENTATION=OFF + -DENABLE_DOCUMENTATION=OFF \ -DREDIS_STORAGE_BACKEND=OFF $(eval $(call HostBuild)) From 39320d4b58b80dea7bef7137d869d79466b25abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Mon, 25 Sep 2023 20:16:22 +0200 Subject: [PATCH 0467/1171] ipq40xx: ZTE MF287 fix sysupgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While refactoring support for the MF287 series, an entry in platform.sh was overlooked - this fixes sysupgrade on this devices. Signed-off-by: Andreas Böhler (cherry picked from commit 964b576fc133019d0379983df597e4eb343cd635) --- target/linux/ipq40xx/base-files/lib/upgrade/platform.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 97f14b45f90640..647ffc5c43d721 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -212,6 +212,7 @@ platform_do_upgrade() { teltonika,rutx50 |\ zte,mf18a |\ zte,mf286d |\ + zte,mf287 |\ zte,mf287plus |\ zte,mf287pro |\ zte,mf289f) From 442f7406a98073cba140a5dedbd09135527f3daa Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 7 Sep 2023 06:55:41 -0400 Subject: [PATCH 0468/1171] kernel: bump 5.15 to 5.15.131 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.131 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 58bb5e147ae50391c29c53890f47e3a5420bbfad) [Refresh on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 ++-- target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch | 2 +- target/linux/generic/hack-5.15/204-module_strip.patch | 4 ++-- .../hack-5.15/780-usb-net-MeigLink_modem_support.patch | 2 +- .../830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 74130b28309359..0423befe74f95f 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .130 -LINUX_KERNEL_HASH-5.15.130 = ab464e4107329ff5262f1c585c40fc29dc68f17687a9a918f3e90faba5303d62 +LINUX_VERSION-5.15 = .131 +LINUX_KERNEL_HASH-5.15.131 = 997c3391f439fb6fe32f1938fe089a046b840a5cde9a2215b6745144f8b24c69 diff --git a/target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch b/target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch index 79a4d1c1a03045..dcfc019f1282d8 100644 --- a/target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch +++ b/target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -95,6 +95,10 @@ config IP17XX_PHY +@@ -96,6 +96,10 @@ config IP17XX_PHY tristate "Driver for IC+ IP17xx switches" select SWCONFIG diff --git a/target/linux/generic/hack-5.15/204-module_strip.patch b/target/linux/generic/hack-5.15/204-module_strip.patch index 31bfe07c78ccd0..e650c1b18471ab 100644 --- a/target/linux/generic/hack-5.15/204-module_strip.patch +++ b/target/linux/generic/hack-5.15/204-module_strip.patch @@ -120,7 +120,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_MODVERSIONS -@@ -3266,9 +3268,11 @@ static int setup_load_info(struct load_i +@@ -3274,9 +3276,11 @@ static int setup_load_info(struct load_i static int check_modinfo(struct module *mod, struct load_info *info, int flags) { @@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau if (flags & MODULE_INIT_IGNORE_VERMAGIC) modmagic = NULL; -@@ -3289,6 +3293,7 @@ static int check_modinfo(struct module * +@@ -3297,6 +3301,7 @@ static int check_modinfo(struct module * mod->name); add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); } diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 4f1966db165054..5c1dbd69d3cdc7 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1179,6 +1181,11 @@ static const struct usb_device_id option +@@ -1180,6 +1182,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch b/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch index 21538859a55713..2896002ed1aaee 100644 --- a/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch +++ b/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch @@ -25,7 +25,7 @@ Signed-off-by: John Crispin --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig -@@ -1092,3 +1092,5 @@ config MMC_OWL +@@ -1093,3 +1093,5 @@ config MMC_OWL config MMC_SDHCI_EXTERNAL_DMA bool From dee4e7b40c5fed70ce4118c529c114fb9210c162 Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 19 Sep 2023 15:04:14 -0400 Subject: [PATCH 0469/1171] kernel: bump 5.15 to 5.15.132 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.132 Removed upstreamed: bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch[1] bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch[2] bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch[3] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.132&id=b35f3ca1877e024887df205ede952863d65dad36 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.132&id=2840d9b9c8750be270fb1153ccd5b983cbb5d592 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.132&id=f086e859ddc252c32f0438edff241859c0f022ce Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit ac422c9788fbb3510b1fddaefc8816bea6601479) [Refresh on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 +- ...or-support-mtd-name-from-device-tree.patch | 4 +- .../910-unaligned_access_hacks.patch | 2 +- .../950-0064-Add-dwc_otg-driver.patch | 4 +- ...69-dmaengine-Add-support-for-BCM2708.patch | 2 +- ...all-the-downstream-rpi-sound-card-dr.patch | 4 +- ...rng-iproc-rng200-Add-BCM2838-support.patch | 6 +-- ...-for-updating-interrupt-endpoint-int.patch | 4 +- ...-interface-in-mode6-for-18-bit-color.patch | 4 +- ...-Add-a-timing-for-the-Raspberry-Pi-7.patch | 4 +- ...nel-simple-add-Geekworm-MZP280-Panel.patch | 4 +- ...roduce-Kunit-Tests-for-the-framework.patch | 2 +- .../960-hwrng-iproc-set-quality-to-1000.patch | 2 +- ...nand-Assign-soc-as-early-as-possible.patch | 4 +- ...-Allow-SoC-to-provide-I-O-operations.patch | 2 +- ...mnand-Avoid-pdev-in-brcmnand_init_cs.patch | 6 +-- ...F-operations-out-of-brcmnand_init_cs.patch | 6 +-- ...and-Allow-working-without-interrupts.patch | 4 +- ...and-Allow-platform-data-instantation.patch | 14 +++--- ...-Describe-on-SoC-BCM53125-rev-4-swit.patch | 2 +- ...-align-gpio-key-node-names-with-dtsc.patch | 2 +- ...-BCM53573-Drop-nonexistent-usb-cells.patch | 2 +- ...CM53573-Add-cells-sizes-to-PCIe-node.patch | 37 ---------------- ...-Use-updated-spi-gpio-binding-proper.patch | 44 ------------------- ...-Extend-RAM-to-full-256MB-for-Linksy.patch | 34 -------------- ...-Fix-Ethernet-info-for-Luxul-devices.patch | 4 +- ...-Disable-second-Ethernet-on-Luxul-de.patch | 4 +- ...lti-gen-LRU-exploit-locality-in-rmap.patch | 8 ++-- ...lti-gen-LRU-support-page-table-walks.patch | 2 +- ...-gen-LRU-per-node-lru_gen_page-lists.patch | 4 +- ...-total-xdp_frame-len-running-ndo_xdp.patch | 4 +- ...-veth-Allow-jumbo-frames-in-xdp-mode.patch | 2 +- ..._eth_soc-add-support-for-coherent-DM.patch | 12 ++--- ..._eth_soc-add-support-for-Wireless-Et.patch | 2 +- ..._eth_soc-allocate-struct-mtk_ppe-sep.patch | 6 +-- ..._eth_soc-rework-hardware-flow-table-.patch | 2 +- ..._eth_soc-use-standard-property-for-c.patch | 2 +- ..._eth_soc-add-txd_size-to-mtk_soc_dat.patch | 16 +++---- ..._eth_soc-add-rxd_size-to-mtk_soc_dat.patch | 12 ++--- ..._eth_soc-introduce-device-register-m.patch | 42 +++++++++--------- ..._eth_soc-introduce-MTK_NETSYS_V2-sup.patch | 30 ++++++------- ..._eth_soc-introduce-support-for-mt798.patch | 4 +- ..._eth_soc-enable-rx-cksum-offload-for.patch | 2 +- ...-users-of-bitmap_foo-to-linkmode_foo.patch | 2 +- ...populate-supported_interfaces-member.patch | 2 +- ...eth_soc-use-phylink_generic_validate.patch | 2 +- ...mark-as-a-legacy_pre_march2020-drive.patch | 2 +- ...remove-a-copy-of-the-NAPI_POLL_WEIGH.patch | 2 +- ...9-mtk_eth_soc-remove-unused-mac-mode.patch | 2 +- ...th_soc-correct-802.3z-duplex-setting.patch | 2 +- ...et-mtk_eth_soc-add-basic-XDP-support.patch | 6 +-- ...net-mtk_eth_soc-add-xmit-XDP-support.patch | 2 +- ..._eth_soc-add-support-for-page_pool_g.patch | 6 +-- ..._eth_soc-move-gdma_to_ppe-and-ppe_ba.patch | 6 +-- ..._eth_soc-move-ppe-table-hash-offset-.patch | 8 ++-- ..._eth_soc-add-the-capability-to-run-m.patch | 10 ++--- ..._eth_soc-move-wdma_base-definitions-.patch | 2 +- ..._eth_soc-add-foe_entry_size-to-mtk_e.patch | 6 +-- ..._eth_wed-add-wed-support-for-mt7986-.patch | 4 +- ..._eth_soc-introduce-flow-offloading-s.patch | 8 ++-- ..._eth_soc-enable-flow-offloading-supp.patch | 2 +- ..._eth_soc-fix-possible-memory-leak-in.patch | 8 ++-- ..._eth_soc-fix-resource-leak-in-error-.patch | 2 +- ..._eth_soc-fix-memory-leak-in-error-pa.patch | 6 +-- ..._eth_soc-do-not-overwrite-mtu-config.patch | 8 ++-- ..._eth_soc-remove-cpu_relax-in-mtk_pen.patch | 4 +- ..._eth_soc-fix-RSTCTRL_PPE-0-1-definit.patch | 2 +- ..._eth_soc-introduce-mtk_hw_reset-util.patch | 4 +- ..._eth_soc-introduce-mtk_hw_warm_reset.patch | 8 ++-- ..._eth_soc-align-reset-procedure-to-ve.patch | 10 ++--- ..._eth_soc-add-dma-checks-to-mtk_hw_re.patch | 8 ++-- ..._wed-add-reset-reset_complete-callba.patch | 4 +- ..._eth_soc-increase-tx-ring-side-for-Q.patch | 2 +- ..._eth_soc-avoid-port_mg-assignment-on.patch | 4 +- ..._eth_soc-implement-multi-queue-suppo.patch | 18 ++++---- ..._eth_soc-fix-VLAN-rx-hardware-accele.patch | 8 ++-- ..._eth_soc-drop-packets-to-WDMA-if-the.patch | 2 +- ..._eth_soc-disable-hardware-DSA-untagg.patch | 4 +- ..._eth_soc-enable-special-tag-when-any.patch | 6 +-- ...t-mtk_eth_soc-add-support-for-MT7981.patch | 4 +- ..._eth_soc-switch-to-external-PCS-driv.patch | 10 ++--- ..._eth_soc-ppe-add-support-for-flow-ac.patch | 10 ++--- ..._eth_soc-drop-generic-vlan-rx-offloa.patch | 10 ++--- ..._ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch | 10 ++--- ..._eth_soc-remove-incorrect-PLL-config.patch | 4 +- ..._eth_soc-remove-mac_pcs_get_state-an.patch | 2 +- ..._eth_soc-add-version-in-mtk_soc_data.patch | 36 +++++++-------- ..._eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch | 22 +++++----- ..._eth_soc-add-NETSYS_V3-version-suppo.patch | 4 +- ..._eth_soc-add-basic-support-for-MT798.patch | 6 +-- ..._eth_soc-enable-nft-hw-flowtable_off.patch | 2 +- ..._eth_soc-support-per-flow-accounting.patch | 2 +- ...tk_eth_soc-add-reset-bits-for-MT7988.patch | 8 ++-- ..._eth_soc-add-support-for-in-SoC-SRAM.patch | 10 ++--- ..._eth_soc-support-36-bit-DMA-addressi.patch | 2 +- .../410-block-fit-partition-parser.patch | 2 +- ...-r8152-add-LED-configuration-from-OF.patch | 8 ++-- .../hack-5.15/901-debloat_sock_diag.patch | 2 +- .../generic/hack-5.15/902-debloat_proc.patch | 8 ++-- ...support-for-minor-aligned-partitions.patch | 8 ++-- .../479-mtd-spi-nor-add-xtx-xt25f128b.patch | 2 +- ...ng-with-source-address-failed-policy.patch | 2 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 6 +-- ..._eth_soc-fix-remaining-throughput-re.patch | 2 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 4 +- ...pool-and-page-referenced-frags-in-GR.patch | 2 +- ...t-devfreq_get_freq_range-symbol-with.patch | 10 ++--- ...work-freq_table-to-be-local-to-devfr.patch | 16 +++---- ...Mute-warning-on-governor-PROBE_DEFER.patch | 2 +- ...nor-Add-calibration-support-for-spi-.patch | 4 +- ...or-support-mtd-name-from-device-tree.patch | 4 +- ...or-Add-support-for-BoHong-bh25q128as.patch | 2 +- ...ethernet-mediatek-support-net-labels.patch | 4 +- .../318-add-rtl83xx-clk-support.patch | 2 +- .../patches-5.15/102-pseudo-random-mac.patch | 2 +- 115 files changed, 331 insertions(+), 446 deletions(-) delete mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch delete mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch delete mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 0423befe74f95f..96feed23e078d4 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .131 -LINUX_KERNEL_HASH-5.15.131 = 997c3391f439fb6fe32f1938fe089a046b840a5cde9a2215b6745144f8b24c69 +LINUX_VERSION-5.15 = .132 +LINUX_KERNEL_HASH-5.15.132 = 4177b5c4d6e749bb8339ac4aa68eb0932ead9490b956a80d9a597089959618ac diff --git a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index 163bafdb2e5b34..7db6346c37e418 100644 --- a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -3107,6 +3107,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3108,6 +3108,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -3161,7 +3162,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3162,7 +3163,12 @@ int spi_nor_scan(struct spi_nor *nor, co if (ret) return ret; diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 1971b9cd010185..53f5b1472d9c5a 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -750,7 +750,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4158,14 +4158,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4157,14 +4157,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch index 46ae256c218509..aabb7415035424 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch @@ -1123,7 +1123,7 @@ Signed-off-by: Jonathan Bell } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5584,7 +5584,7 @@ static void port_event(struct usb_hub *h +@@ -5640,7 +5640,7 @@ static void port_event(struct usb_hub *h port_dev->over_current_count++; port_over_current_notify(port_dev); @@ -1134,7 +1134,7 @@ Signed-off-by: Jonathan Bell USB_PORT_FEAT_C_OVER_CURRENT); --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c -@@ -2140,6 +2140,85 @@ free_interfaces: +@@ -2135,6 +2135,85 @@ free_interfaces: if (cp->string == NULL && !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) cp->string = usb_cache_string(dev, cp->desc.iConfiguration); diff --git a/target/linux/bcm27xx/patches-5.15/950-0069-dmaengine-Add-support-for-BCM2708.patch b/target/linux/bcm27xx/patches-5.15/950-0069-dmaengine-Add-support-for-BCM2708.patch index be7cc3d378a43a..ebfaab4f14b140 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0069-dmaengine-Add-support-for-BCM2708.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0069-dmaengine-Add-support-for-BCM2708.patch @@ -187,7 +187,7 @@ Signed-off-by: Andrei Gherzan select DMA_ENGINE select DMA_VIRTUAL_CHANNELS -@@ -683,6 +683,10 @@ config UNIPHIER_XDMAC +@@ -685,6 +685,10 @@ config UNIPHIER_XDMAC UniPhier platform. This DMA controller can transfer data from memory to memory, memory to peripheral and peripheral to memory. diff --git a/target/linux/bcm27xx/patches-5.15/950-0084-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-5.15/950-0084-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 696719790077a5..61b70c03b803a1 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0084-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0084-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -14186,7 +14186,7 @@ Signed-off-by: Joerg Schambacher config SND_SOC_RT5631 tristate "Realtek ALC5631/RT5631 CODEC" depends on I2C -@@ -1437,6 +1452,9 @@ config SND_SOC_TFA9879 +@@ -1438,6 +1453,9 @@ config SND_SOC_TFA9879 tristate "NXP Semiconductors TFA9879 amplifier" depends on I2C @@ -14196,7 +14196,7 @@ Signed-off-by: Joerg Schambacher config SND_SOC_TFA989X tristate "NXP/Goodix TFA989X (TFA1) amplifiers" depends on I2C -@@ -1943,4 +1961,8 @@ config SND_SOC_LPASS_TX_MACRO +@@ -1944,4 +1962,8 @@ config SND_SOC_LPASS_TX_MACRO select REGMAP_MMIO tristate "Qualcomm TX Macro in LPASS(Low Power Audio SubSystem)" diff --git a/target/linux/bcm27xx/patches-5.15/950-0142-hwrng-iproc-rng200-Add-BCM2838-support.patch b/target/linux/bcm27xx/patches-5.15/950-0142-hwrng-iproc-rng200-Add-BCM2838-support.patch index ff5e62209aec99..42fdc329e057ec 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0142-hwrng-iproc-rng200-Add-BCM2838-support.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0142-hwrng-iproc-rng200-Add-BCM2838-support.patch @@ -130,9 +130,9 @@ Signed-off-by: Phil Elwell static void iproc_rng200_cleanup(struct hwrng *rng) { struct iproc_rng200_dev *priv = to_rng_priv(rng); -@@ -189,11 +255,17 @@ static int iproc_rng200_probe(struct pla - return PTR_ERR(priv->base); - } +@@ -191,11 +257,17 @@ static int iproc_rng200_probe(struct pla + + dev_set_drvdata(dev, priv); - priv->rng.name = "iproc-rng200"; - priv->rng.read = iproc_rng200_read; diff --git a/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch b/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch index 68c2c6d7281dd8..ba414aaca471b3 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch @@ -27,7 +27,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c -@@ -1972,6 +1972,16 @@ reset: +@@ -1976,6 +1976,16 @@ reset: return ret; } @@ -46,7 +46,7 @@ Signed-off-by: Jonathan Bell * have been called previously. Use for set_configuration, set_interface, --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c -@@ -1268,6 +1268,21 @@ static void remove_intf_ep_devs(struct u +@@ -1263,6 +1263,21 @@ static void remove_intf_ep_devs(struct u intf->ep_devs_created = 0; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch b/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch index 5c71f6895a5641..5e358ae39b5c4e 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch @@ -118,7 +118,7 @@ Signed-off-by: Joerg Quinten - MEDIA_BUS_FMT_RGB666_1X24_CPADHI --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -2473,6 +2473,38 @@ static const struct panel_desc innolux_a +@@ -2475,6 +2475,38 @@ static const struct panel_desc innolux_a .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE, }; @@ -157,7 +157,7 @@ Signed-off-by: Joerg Quinten static const struct drm_display_mode innolux_at070tn92_mode = { .clock = 33333, .hdisplay = 800, -@@ -4664,6 +4696,9 @@ static const struct of_device_id platfor +@@ -4666,6 +4698,9 @@ static const struct of_device_id platfor .compatible = "innolux,at043tn24", .data = &innolux_at043tn24, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch b/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch index 69298951446713..ee582fea80eeee 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -3763,6 +3763,31 @@ static const struct panel_desc qishenglo +@@ -3765,6 +3765,31 @@ static const struct panel_desc qishenglo .connector_type = DRM_MODE_CONNECTOR_DPI, }; @@ -47,7 +47,7 @@ Signed-off-by: Dave Stevenson static const struct display_timing rocktech_rk070er9427_timing = { .pixelclock = { 26400000, 33300000, 46800000 }, .hactive = { 800, 800, 800 }, -@@ -4843,6 +4868,9 @@ static const struct of_device_id platfor +@@ -4845,6 +4870,9 @@ static const struct of_device_id platfor .compatible = "qishenglong,gopher2b-lcd", .data = &qishenglong_gopher2b_lcd, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch b/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch index c6267905589eda..f668c4db19c7cb 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch @@ -13,7 +13,7 @@ Acked-by: Maxime Ripard --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -2321,6 +2321,32 @@ static const struct panel_desc friendlya +@@ -2323,6 +2323,32 @@ static const struct panel_desc friendlya }, }; @@ -46,7 +46,7 @@ Acked-by: Maxime Ripard static const struct drm_display_mode giantplus_gpg482739qs5_mode = { .clock = 9000, .hdisplay = 480, -@@ -4706,6 +4732,9 @@ static const struct of_device_id platfor +@@ -4708,6 +4734,9 @@ static const struct of_device_id platfor .compatible = "friendlyarm,hd702e", .data = &friendlyarm_hd702e, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0831-clk-Introduce-Kunit-Tests-for-the-framework.patch b/target/linux/bcm27xx/patches-5.15/950-0831-clk-Introduce-Kunit-Tests-for-the-framework.patch index 29f35f8cec3269..951f8622e1c7ed 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0831-clk-Introduce-Kunit-Tests-for-the-framework.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0831-clk-Introduce-Kunit-Tests-for-the-framework.patch @@ -27,7 +27,7 @@ Signed-off-by: Maxime Ripard +CONFIG_CLK_KUNIT_TEST=y --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig -@@ -427,4 +427,12 @@ source "drivers/clk/x86/Kconfig" +@@ -428,4 +428,12 @@ source "drivers/clk/x86/Kconfig" source "drivers/clk/xilinx/Kconfig" source "drivers/clk/zynqmp/Kconfig" diff --git a/target/linux/bcm27xx/patches-5.15/960-hwrng-iproc-set-quality-to-1000.patch b/target/linux/bcm27xx/patches-5.15/960-hwrng-iproc-set-quality-to-1000.patch index 75bd98f4a1f90a..b8058a73b0e42c 100644 --- a/target/linux/bcm27xx/patches-5.15/960-hwrng-iproc-set-quality-to-1000.patch +++ b/target/linux/bcm27xx/patches-5.15/960-hwrng-iproc-set-quality-to-1000.patch @@ -15,7 +15,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/drivers/char/hw_random/iproc-rng200.c +++ b/drivers/char/hw_random/iproc-rng200.c -@@ -257,6 +257,7 @@ static int iproc_rng200_probe(struct pla +@@ -259,6 +259,7 @@ static int iproc_rng200_probe(struct pla priv->rng.name = pdev->name; priv->rng.cleanup = iproc_rng200_cleanup; diff --git a/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch b/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch index a87d6acd0caf3b..ce14834fa71b63 100644 --- a/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch +++ b/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch @@ -14,7 +14,7 @@ Signed-off-by: Florian Fainelli --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -2998,6 +2998,7 @@ int brcmnand_probe(struct platform_devic +@@ -3033,6 +3033,7 @@ int brcmnand_probe(struct platform_devic dev_set_drvdata(dev, ctrl); ctrl->dev = dev; @@ -22,7 +22,7 @@ Signed-off-by: Florian Fainelli init_completion(&ctrl->done); init_completion(&ctrl->dma_done); -@@ -3138,8 +3139,6 @@ int brcmnand_probe(struct platform_devic +@@ -3173,8 +3174,6 @@ int brcmnand_probe(struct platform_devic * interesting ways */ if (soc) { diff --git a/target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch b/target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch index 8da25358655312..60671658fedf85 100644 --- a/target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch +++ b/target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch @@ -84,7 +84,7 @@ Signed-off-by: Florian Fainelli } static inline void edu_writel(struct brcmnand_controller *ctrl, -@@ -3000,6 +3018,12 @@ int brcmnand_probe(struct platform_devic +@@ -3035,6 +3053,12 @@ int brcmnand_probe(struct platform_devic ctrl->dev = dev; ctrl->soc = soc; diff --git a/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch b/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch index d7eab183d6c616..d514998fd72ace 100644 --- a/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch +++ b/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch @@ -16,7 +16,7 @@ Signed-off-by: Florian Fainelli --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -2771,7 +2771,7 @@ static const struct nand_controller_ops +@@ -2806,7 +2806,7 @@ static const struct nand_controller_ops static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn) { struct brcmnand_controller *ctrl = host->ctrl; @@ -25,7 +25,7 @@ Signed-off-by: Florian Fainelli struct mtd_info *mtd; struct nand_chip *chip; int ret; -@@ -2779,7 +2779,7 @@ static int brcmnand_init_cs(struct brcmn +@@ -2814,7 +2814,7 @@ static int brcmnand_init_cs(struct brcmn ret = of_property_read_u32(dn, "reg", &host->cs); if (ret) { @@ -34,7 +34,7 @@ Signed-off-by: Florian Fainelli return -ENXIO; } -@@ -2788,13 +2788,13 @@ static int brcmnand_init_cs(struct brcmn +@@ -2823,13 +2823,13 @@ static int brcmnand_init_cs(struct brcmn nand_set_flash_node(chip, dn); nand_set_controller_data(chip, host); diff --git a/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch b/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch index e2fa72add1c4af..2e2c05a43244ad 100644 --- a/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch +++ b/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch @@ -17,7 +17,7 @@ Signed-off-by: Florian Fainelli --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -2768,7 +2768,7 @@ static const struct nand_controller_ops +@@ -2803,7 +2803,7 @@ static const struct nand_controller_ops .attach_chip = brcmnand_attach_chip, }; @@ -26,7 +26,7 @@ Signed-off-by: Florian Fainelli { struct brcmnand_controller *ctrl = host->ctrl; struct device *dev = ctrl->dev; -@@ -2777,16 +2777,9 @@ static int brcmnand_init_cs(struct brcmn +@@ -2812,16 +2812,9 @@ static int brcmnand_init_cs(struct brcmn int ret; u16 cfg_offs; @@ -43,7 +43,7 @@ Signed-off-by: Florian Fainelli nand_set_controller_data(chip, host); mtd->name = devm_kasprintf(dev, GFP_KERNEL, "brcmnand.%d", host->cs); -@@ -3193,7 +3186,16 @@ int brcmnand_probe(struct platform_devic +@@ -3228,7 +3221,16 @@ int brcmnand_probe(struct platform_devic host->pdev = pdev; host->ctrl = ctrl; diff --git a/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch b/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch index bdf325d732eb05..0845a7bfa329aa 100644 --- a/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch +++ b/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch @@ -23,7 +23,7 @@ Signed-off-by: Florian Fainelli unsigned int dma_irq; int nand_version; -@@ -1610,7 +1610,7 @@ static bool brcmstb_nand_wait_for_comple +@@ -1642,7 +1642,7 @@ static bool brcmstb_nand_wait_for_comple bool err = false; int sts; @@ -32,7 +32,7 @@ Signed-off-by: Florian Fainelli /* switch to interrupt polling and PIO mode */ disable_ctrl_irqs(ctrl); sts = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, -@@ -3144,33 +3144,29 @@ int brcmnand_probe(struct platform_devic +@@ -3179,33 +3179,29 @@ int brcmnand_probe(struct platform_devic } /* IRQ */ diff --git a/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch b/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch index 31d686b9557b41..bf9b410102a38c 100644 --- a/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch +++ b/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch @@ -23,7 +23,7 @@ Signed-off-by: Florian Fainelli #include #include #include -@@ -2768,7 +2769,8 @@ static const struct nand_controller_ops +@@ -2803,7 +2804,8 @@ static const struct nand_controller_ops .attach_chip = brcmnand_attach_chip, }; @@ -33,7 +33,7 @@ Signed-off-by: Florian Fainelli { struct brcmnand_controller *ctrl = host->ctrl; struct device *dev = ctrl->dev; -@@ -2821,7 +2823,7 @@ static int brcmnand_init_cs(struct brcmn +@@ -2856,7 +2858,7 @@ static int brcmnand_init_cs(struct brcmn if (ret) return ret; @@ -42,7 +42,7 @@ Signed-off-by: Florian Fainelli if (ret) nand_cleanup(chip); -@@ -2990,17 +2992,15 @@ static int brcmnand_edu_setup(struct pla +@@ -3025,17 +3027,15 @@ static int brcmnand_edu_setup(struct pla int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) { @@ -63,7 +63,7 @@ Signed-off-by: Florian Fainelli return -ENODEV; ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); -@@ -3027,7 +3027,7 @@ int brcmnand_probe(struct platform_devic +@@ -3062,7 +3062,7 @@ int brcmnand_probe(struct platform_devic /* NAND register range */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctrl->nand_base = devm_ioremap_resource(dev, res); @@ -72,7 +72,7 @@ Signed-off-by: Florian Fainelli return PTR_ERR(ctrl->nand_base); /* Enable clock before using NAND registers */ -@@ -3171,7 +3171,6 @@ int brcmnand_probe(struct platform_devic +@@ -3206,7 +3206,6 @@ int brcmnand_probe(struct platform_devic for_each_available_child_of_node(dn, child) { if (of_device_is_compatible(child, "brcm,nandcs")) { @@ -80,7 +80,7 @@ Signed-off-by: Florian Fainelli host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); if (!host) { -@@ -3191,7 +3190,7 @@ int brcmnand_probe(struct platform_devic +@@ -3226,7 +3225,7 @@ int brcmnand_probe(struct platform_devic nand_set_flash_node(&host->chip, child); @@ -89,7 +89,7 @@ Signed-off-by: Florian Fainelli if (ret) { devm_kfree(dev, host); continue; /* Try all chip-selects */ -@@ -3201,6 +3200,32 @@ int brcmnand_probe(struct platform_devic +@@ -3236,6 +3235,32 @@ int brcmnand_probe(struct platform_devic } } diff --git a/target/linux/bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch b/target/linux/bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch index 3a5438c228241f..914117cb2cb872 100644 --- a/target/linux/bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch +++ b/target/linux/bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch @@ -17,7 +17,7 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/bcm53573.dtsi +++ b/arch/arm/boot/dts/bcm53573.dtsi -@@ -180,6 +180,24 @@ +@@ -183,6 +183,24 @@ gmac0: ethernet@5000 { reg = <0x5000 0x1000>; diff --git a/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch b/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch index 33d675297e3b65..f929dc3b6067a5 100644 --- a/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch +++ b/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch @@ -213,7 +213,7 @@ Signed-off-by: Florian Fainelli gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; --- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts +++ b/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts -@@ -25,13 +25,13 @@ +@@ -26,13 +26,13 @@ gpio-keys { compatible = "gpio-keys"; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch index 7836d560a16967..e7a1835d47a978 100644 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch @@ -21,7 +21,7 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/bcm53573.dtsi +++ b/arch/arm/boot/dts/bcm53573.dtsi -@@ -156,8 +156,6 @@ +@@ -159,8 +159,6 @@ }; ohci: usb@d000 { diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch deleted file mode 100644 index 86a52aa505724b..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 3392ef368d9b04622fe758b1079b512664b6110a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 7 Jul 2023 13:40:03 +0200 -Subject: [PATCH] ARM: dts: BCM53573: Add cells sizes to PCIe node -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This fixes: -arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#address-cells' is a required property - From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml -arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#size-cells' is a required property - From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml - -Two properties that need to be added later are "device_type" and -"ranges". Adding "device_type" on its own causes a new warning and the -value of "ranges" needs to be determined yet. - -Signed-off-by: Rafał Miłecki -Link: https://lore.kernel.org/r/20230707114004.2740-3-zajec5@gmail.com -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/broadcom/bcm53573.dtsi | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/arch/arm/boot/dts/bcm53573.dtsi -+++ b/arch/arm/boot/dts/bcm53573.dtsi -@@ -127,6 +127,9 @@ - - pcie0: pcie@2000 { - reg = <0x00002000 0x1000>; -+ -+ #address-cells = <3>; -+ #size-cells = <2>; - }; - - usb2: usb2@4000 { diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch deleted file mode 100644 index 28d89949e46440..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 2c0fd6b3d0778ceab40205315ccef74568490f17 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 7 Jul 2023 13:40:04 +0200 -Subject: [PATCH] ARM: dts: BCM53573: Use updated "spi-gpio" binding properties -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Switch away from deprecated properties. - -This fixes: -arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-sck: False schema does not allow [[3, 21, 0]] - From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml -arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-miso: False schema does not allow [[3, 22, 0]] - From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml -arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-mosi: False schema does not allow [[3, 23, 0]] - From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml -arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: 'sck-gpios' is a required property - From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml -arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: Unevaluated properties are not allowed ('gpio-miso', 'gpio-mosi', 'gpio-sck' were unexpected) - From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml - -Signed-off-by: Rafał Miłecki -Link: https://lore.kernel.org/r/20230707114004.2740-4-zajec5@gmail.com -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/broadcom/bcm947189acdbmr.dts | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/arch/arm/boot/dts/bcm947189acdbmr.dts -+++ b/arch/arm/boot/dts/bcm947189acdbmr.dts -@@ -60,9 +60,9 @@ - spi { - compatible = "spi-gpio"; - num-chipselects = <1>; -- gpio-sck = <&chipcommon 21 0>; -- gpio-miso = <&chipcommon 22 0>; -- gpio-mosi = <&chipcommon 23 0>; -+ sck-gpios = <&chipcommon 21 0>; -+ miso-gpios = <&chipcommon 22 0>; -+ mosi-gpios = <&chipcommon 23 0>; - cs-gpios = <&chipcommon 24 0>; - #address-cells = <1>; - #size-cells = <0>; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch deleted file mode 100644 index 6ae8aad3c34f10..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Aleksey Nasibulin -Date: Wed, 12 Jul 2023 03:40:17 +0200 -Subject: [PATCH] ARM: dts: BCM5301X: Extend RAM to full 256MB for Linksys - EA6500 V2 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Linksys ea6500-v2 have 256MB of ram. Currently we only use 128MB. -Expand the definition to use all the available RAM. - -Fixes: 03e96644d7a8 ("ARM: dts: BCM5301X: Add basic DT for Linksys EA6500 V2") -Signed-off-by: Aleksey Nasibulin -Signed-off-by: Christian Marangi -Cc: stable@vger.kernel.org -Acked-by: Rafał Miłecki -Link: https://lore.kernel.org/r/20230712014017.28123-1-ansuelsmth@gmail.com -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/broadcom/bcm4708-linksys-ea6500-v2.dts | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts -+++ b/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts -@@ -19,7 +19,8 @@ - - memory@0 { - device_type = "memory"; -- reg = <0x00000000 0x08000000>; -+ reg = <0x00000000 0x08000000>, -+ <0x88000000 0x08000000>; - }; - - gpio-keys { diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch index 07dd9296b69359..7930c52b162ab1 100644 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0009-ARM-dts-BCM53573-Fix-Ethernet-info-for-Luxul-devices.patch @@ -37,7 +37,7 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts -@@ -45,3 +45,16 @@ +@@ -58,3 +58,16 @@ }; }; }; @@ -56,7 +56,7 @@ Signed-off-by: Florian Fainelli +}; --- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts -@@ -81,3 +81,16 @@ +@@ -94,3 +94,16 @@ }; }; }; diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch index 166f602452a904..e9e347075d7a76 100644 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0015-ARM-dts-BCM53573-Disable-second-Ethernet-on-Luxul-de.patch @@ -19,7 +19,7 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts -@@ -60,3 +60,7 @@ +@@ -73,3 +73,7 @@ }; }; }; @@ -29,7 +29,7 @@ Signed-off-by: Florian Fainelli +}; --- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts -@@ -96,3 +96,7 @@ +@@ -109,3 +109,7 @@ }; }; }; diff --git a/target/linux/generic/backport-5.15/020-v6.1-07-mm-multi-gen-LRU-exploit-locality-in-rmap.patch b/target/linux/generic/backport-5.15/020-v6.1-07-mm-multi-gen-LRU-exploit-locality-in-rmap.patch index 5cd6e03dc60779..40e51b4294a75a 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-07-mm-multi-gen-LRU-exploit-locality-in-rmap.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-07-mm-multi-gen-LRU-exploit-locality-in-rmap.patch @@ -110,7 +110,7 @@ Signed-off-by: Andrew Morton --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h -@@ -442,6 +442,7 @@ static inline struct obj_cgroup *__page_ +@@ -447,6 +447,7 @@ static inline struct obj_cgroup *__page_ * - LRU isolation * - lock_page_memcg() * - exclusive reference @@ -118,7 +118,7 @@ Signed-off-by: Andrew Morton * * For a kmem page a caller should hold an rcu read lock to protect memcg * associated with a kmem page from being released. -@@ -497,6 +498,7 @@ static inline struct mem_cgroup *page_me +@@ -502,6 +503,7 @@ static inline struct mem_cgroup *page_me * - LRU isolation * - lock_page_memcg() * - exclusive reference @@ -126,7 +126,7 @@ Signed-off-by: Andrew Morton * * For a kmem page a caller should hold an rcu read lock to protect memcg * associated with a kmem page from being released. -@@ -953,6 +955,23 @@ void unlock_page_memcg(struct page *page +@@ -958,6 +960,23 @@ void unlock_page_memcg(struct page *page void __mod_memcg_state(struct mem_cgroup *memcg, int idx, int val); @@ -150,7 +150,7 @@ Signed-off-by: Andrew Morton /* idx can be of type enum memcg_stat_item or node_stat_item */ static inline void mod_memcg_state(struct mem_cgroup *memcg, int idx, int val) -@@ -1369,6 +1388,18 @@ static inline void unlock_page_memcg(str +@@ -1374,6 +1393,18 @@ static inline void unlock_page_memcg(str { } diff --git a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch index e6ce94e3d4fcac..c89d3c2542814b 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch @@ -167,7 +167,7 @@ Signed-off-by: Andrew Morton BUG_ON(active_mm != old_mm); --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h -@@ -348,6 +348,11 @@ struct mem_cgroup { +@@ -353,6 +353,11 @@ struct mem_cgroup { struct deferred_split deferred_split_queue; #endif diff --git a/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch b/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch index f54e828de10600..6010e617b863e4 100644 --- a/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch +++ b/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch @@ -69,7 +69,7 @@ Signed-off-by: Andrew Morton --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h -@@ -818,6 +818,11 @@ static inline void obj_cgroup_put(struct +@@ -823,6 +823,11 @@ static inline void obj_cgroup_put(struct percpu_ref_put(&objcg->refcnt); } @@ -81,7 +81,7 @@ Signed-off-by: Andrew Morton static inline void mem_cgroup_put(struct mem_cgroup *memcg) { if (memcg) -@@ -1283,6 +1288,11 @@ struct mem_cgroup *mem_cgroup_from_css(s +@@ -1288,6 +1293,11 @@ struct mem_cgroup *mem_cgroup_from_css(s return NULL; } diff --git a/target/linux/generic/backport-5.15/608-v5.18-net-veth-Account-total-xdp_frame-len-running-ndo_xdp.patch b/target/linux/generic/backport-5.15/608-v5.18-net-veth-Account-total-xdp_frame-len-running-ndo_xdp.patch index 3bdba8728cfade..1ec260a2e6a750 100644 --- a/target/linux/generic/backport-5.15/608-v5.18-net-veth-Account-total-xdp_frame-len-running-ndo_xdp.patch +++ b/target/linux/generic/backport-5.15/608-v5.18-net-veth-Account-total-xdp_frame-len-running-ndo_xdp.patch @@ -22,7 +22,7 @@ Link: https://lore.kernel.org/bpf/54f9fd3bb65d190daf2c0bbae2f852ff16cfbaa0.16469 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c -@@ -501,7 +501,7 @@ static int veth_xdp_xmit(struct net_devi +@@ -503,7 +503,7 @@ static int veth_xdp_xmit(struct net_devi struct xdp_frame *frame = frames[i]; void *ptr = veth_xdp_to_ptr(frame); @@ -31,7 +31,7 @@ Link: https://lore.kernel.org/bpf/54f9fd3bb65d190daf2c0bbae2f852ff16cfbaa0.16469 __ptr_ring_produce(&rq->xdp_ring, ptr))) break; nxmit++; -@@ -862,7 +862,7 @@ static int veth_xdp_rcv(struct veth_rq * +@@ -864,7 +864,7 @@ static int veth_xdp_rcv(struct veth_rq * /* ndo_xdp_xmit */ struct xdp_frame *frame = veth_ptr_to_xdp(ptr); diff --git a/target/linux/generic/backport-5.15/609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch b/target/linux/generic/backport-5.15/609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch index 31b44f117079b2..cab980a6dceef8 100644 --- a/target/linux/generic/backport-5.15/609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch +++ b/target/linux/generic/backport-5.15/609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch @@ -20,7 +20,7 @@ Link: https://lore.kernel.org/bpf/d5dc039c3d4123426e7023a488c449181a7bc57f.16469 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c -@@ -1471,9 +1471,14 @@ static int veth_xdp_set(struct net_devic +@@ -1473,9 +1473,14 @@ static int veth_xdp_set(struct net_devic goto err; } diff --git a/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch index d6de92a487360f..3e7612b0d90c17 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch @@ -196,7 +196,7 @@ Signed-off-by: Felix Fietkau ring->dma_size * sizeof(*ring->dma), ring->dma, ring->phys); -@@ -2162,7 +2163,7 @@ static void mtk_dma_free(struct mtk_eth +@@ -2165,7 +2166,7 @@ static void mtk_dma_free(struct mtk_eth if (eth->netdev[i]) netdev_reset_queue(eth->netdev[i]); if (eth->scratch_ring) { @@ -205,7 +205,7 @@ Signed-off-by: Felix Fietkau MTK_DMA_SIZE * sizeof(struct mtk_tx_dma), eth->scratch_ring, eth->phy_scratch_ring); -@@ -2514,6 +2515,8 @@ static void mtk_dim_tx(struct work_struc +@@ -2517,6 +2518,8 @@ static void mtk_dim_tx(struct work_struc static int mtk_hw_init(struct mtk_eth *eth) { @@ -214,7 +214,7 @@ Signed-off-by: Felix Fietkau int i, val, ret; if (test_and_set_bit(MTK_HW_INIT, ð->state)) -@@ -2526,6 +2529,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2529,6 +2532,10 @@ static int mtk_hw_init(struct mtk_eth *e if (ret) goto err_disable_pm; @@ -225,7 +225,7 @@ Signed-off-by: Felix Fietkau if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { ret = device_reset(eth->dev); if (ret) { -@@ -3072,6 +3079,35 @@ free_netdev: +@@ -3075,6 +3082,35 @@ free_netdev: return err; } @@ -261,7 +261,7 @@ Signed-off-by: Felix Fietkau static int mtk_probe(struct platform_device *pdev) { struct device_node *mac_np; -@@ -3085,6 +3121,7 @@ static int mtk_probe(struct platform_dev +@@ -3088,6 +3124,7 @@ static int mtk_probe(struct platform_dev eth->soc = of_device_get_match_data(&pdev->dev); eth->dev = &pdev->dev; @@ -269,7 +269,7 @@ Signed-off-by: Felix Fietkau eth->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(eth->base)) return PTR_ERR(eth->base); -@@ -3133,6 +3170,16 @@ static int mtk_probe(struct platform_dev +@@ -3136,6 +3173,16 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch b/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch index 06f948823612dd..ba72a796ee3f74 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau static int mtk_msg_level = -1; module_param_named(msg_level, mtk_msg_level, int, 0); -@@ -3202,6 +3203,22 @@ static int mtk_probe(struct platform_dev +@@ -3205,6 +3206,22 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch b/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch index 1951a1d6764f0f..030a3346768afc 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2335,7 +2335,7 @@ static int mtk_open(struct net_device *d +@@ -2338,7 +2338,7 @@ static int mtk_open(struct net_device *d return err; } @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau gdm_config = MTK_GDMA_TO_PPE; mtk_gdm_config(eth, gdm_config); -@@ -2409,7 +2409,7 @@ static int mtk_stop(struct net_device *d +@@ -2412,7 +2412,7 @@ static int mtk_stop(struct net_device *d mtk_dma_free(eth); if (eth->soc->offload_version) @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3294,10 +3294,11 @@ static int mtk_probe(struct platform_dev +@@ -3297,10 +3297,11 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch b/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch index 9213f28b2a0aa4..0bb3f906accfe5 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch @@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX && (trxd.rxd2 & RX_DMA_VTAG)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), -@@ -3294,7 +3300,7 @@ static int mtk_probe(struct platform_dev +@@ -3297,7 +3303,7 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch b/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch index 5a7561798d55d2..fe5b9263df9a58 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller mediatek,hifsys = <&hifsys>; --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3181,7 +3181,7 @@ static int mtk_probe(struct platform_dev +@@ -3184,7 +3184,7 @@ static int mtk_probe(struct platform_dev struct regmap *cci; cci = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, diff --git a/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch b/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch index 5bf44cc772dcaa..cadebbfa7551ec 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller } mtk_w32(eth, eth->phy_scratch_ring, MTK_QDMA_FQ_HEAD); -@@ -2170,6 +2173,7 @@ static int mtk_dma_init(struct mtk_eth * +@@ -2173,6 +2176,7 @@ static int mtk_dma_init(struct mtk_eth * static void mtk_dma_free(struct mtk_eth *eth) { @@ -73,7 +73,7 @@ Signed-off-by: David S. Miller int i; for (i = 0; i < MTK_MAC_COUNT; i++) -@@ -2177,9 +2181,8 @@ static void mtk_dma_free(struct mtk_eth +@@ -2180,9 +2184,8 @@ static void mtk_dma_free(struct mtk_eth netdev_reset_queue(eth->netdev[i]); if (eth->scratch_ring) { dma_free_coherent(eth->dma_dev, @@ -85,7 +85,7 @@ Signed-off-by: David S. Miller eth->scratch_ring = NULL; eth->phy_scratch_ring = 0; } -@@ -3384,6 +3387,9 @@ static const struct mtk_soc_data mt2701_ +@@ -3387,6 +3390,9 @@ static const struct mtk_soc_data mt2701_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, @@ -95,7 +95,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7621_data = { -@@ -3392,6 +3398,9 @@ static const struct mtk_soc_data mt7621_ +@@ -3395,6 +3401,9 @@ static const struct mtk_soc_data mt7621_ .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -105,7 +105,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7622_data = { -@@ -3401,6 +3410,9 @@ static const struct mtk_soc_data mt7622_ +@@ -3404,6 +3413,9 @@ static const struct mtk_soc_data mt7622_ .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -115,7 +115,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7623_data = { -@@ -3409,6 +3421,9 @@ static const struct mtk_soc_data mt7623_ +@@ -3412,6 +3424,9 @@ static const struct mtk_soc_data mt7623_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .offload_version = 2, @@ -125,7 +125,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7629_data = { -@@ -3417,6 +3432,9 @@ static const struct mtk_soc_data mt7629_ +@@ -3420,6 +3435,9 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -135,7 +135,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data rt5350_data = { -@@ -3424,6 +3442,9 @@ static const struct mtk_soc_data rt5350_ +@@ -3427,6 +3445,9 @@ static const struct mtk_soc_data rt5350_ .hw_features = MTK_HW_FEATURES_MT7628, .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch b/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch index 127312baeca240..525882c956b2df 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch @@ -34,7 +34,7 @@ Signed-off-by: David S. Miller ring->dma = NULL; } } -@@ -3399,6 +3398,7 @@ static const struct mtk_soc_data mt2701_ +@@ -3402,6 +3401,7 @@ static const struct mtk_soc_data mt2701_ .required_pctl = true, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -42,7 +42,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3410,6 +3410,7 @@ static const struct mtk_soc_data mt7621_ +@@ -3413,6 +3413,7 @@ static const struct mtk_soc_data mt7621_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -50,7 +50,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3422,6 +3423,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3425,6 +3426,7 @@ static const struct mtk_soc_data mt7622_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3433,6 +3435,7 @@ static const struct mtk_soc_data mt7623_ +@@ -3436,6 +3438,7 @@ static const struct mtk_soc_data mt7623_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -66,7 +66,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3444,6 +3447,7 @@ static const struct mtk_soc_data mt7629_ +@@ -3447,6 +3450,7 @@ static const struct mtk_soc_data mt7629_ .required_pctl = false, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -74,7 +74,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3454,6 +3458,7 @@ static const struct mtk_soc_data rt5350_ +@@ -3457,6 +3461,7 @@ static const struct mtk_soc_data rt5350_ .required_pctl = false, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), diff --git a/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch b/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch index d694578b33e1a9..11941d5c37436c 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch @@ -345,7 +345,7 @@ Signed-off-by: David S. Miller return 0; } -@@ -2126,9 +2185,9 @@ static int mtk_dma_busy_wait(struct mtk_ +@@ -2129,9 +2188,9 @@ static int mtk_dma_busy_wait(struct mtk_ u32 val; if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) @@ -357,7 +357,7 @@ Signed-off-by: David S. Miller ret = readx_poll_timeout_atomic(__raw_readl, eth->base + reg, val, !(val & (MTK_RX_DMA_BUSY | MTK_TX_DMA_BUSY)), -@@ -2186,8 +2245,8 @@ static int mtk_dma_init(struct mtk_eth * +@@ -2189,8 +2248,8 @@ static int mtk_dma_init(struct mtk_eth * * automatically */ mtk_w32(eth, FC_THRES_DROP_MODE | FC_THRES_DROP_EN | @@ -368,7 +368,7 @@ Signed-off-by: David S. Miller } return 0; -@@ -2261,13 +2320,14 @@ static irqreturn_t mtk_handle_irq_tx(int +@@ -2264,13 +2323,14 @@ static irqreturn_t mtk_handle_irq_tx(int static irqreturn_t mtk_handle_irq(int irq, void *_eth) { struct mtk_eth *eth = _eth; @@ -387,7 +387,7 @@ Signed-off-by: David S. Miller mtk_handle_irq_tx(irq, _eth); } -@@ -2291,6 +2351,7 @@ static void mtk_poll_controller(struct n +@@ -2294,6 +2354,7 @@ static void mtk_poll_controller(struct n static int mtk_start_dma(struct mtk_eth *eth) { u32 rx_2b_offset = (NET_IP_ALIGN == 2) ? MTK_RX_2B_OFFSET : 0; @@ -395,7 +395,7 @@ Signed-off-by: David S. Miller int err; err = mtk_dma_init(eth); -@@ -2305,16 +2366,15 @@ static int mtk_start_dma(struct mtk_eth +@@ -2308,16 +2369,15 @@ static int mtk_start_dma(struct mtk_eth MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | MTK_RX_DMA_EN | MTK_RX_2B_OFFSET | MTK_RX_BT_32DWORDS, @@ -415,7 +415,7 @@ Signed-off-by: David S. Miller } return 0; -@@ -2440,8 +2500,8 @@ static int mtk_stop(struct net_device *d +@@ -2443,8 +2503,8 @@ static int mtk_stop(struct net_device *d cancel_work_sync(ð->tx_dim.work); if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) @@ -426,7 +426,7 @@ Signed-off-by: David S. Miller mtk_dma_free(eth); -@@ -2495,6 +2555,7 @@ static void mtk_dim_rx(struct work_struc +@@ -2498,6 +2558,7 @@ static void mtk_dim_rx(struct work_struc { struct dim *dim = container_of(work, struct dim, work); struct mtk_eth *eth = container_of(dim, struct mtk_eth, rx_dim); @@ -434,7 +434,7 @@ Signed-off-by: David S. Miller struct dim_cq_moder cur_profile; u32 val, cur; -@@ -2502,7 +2563,7 @@ static void mtk_dim_rx(struct work_struc +@@ -2505,7 +2566,7 @@ static void mtk_dim_rx(struct work_struc dim->profile_ix); spin_lock_bh(ð->dim_lock); @@ -443,7 +443,7 @@ Signed-off-by: David S. Miller val &= MTK_PDMA_DELAY_TX_MASK; val |= MTK_PDMA_DELAY_RX_EN; -@@ -2512,9 +2573,9 @@ static void mtk_dim_rx(struct work_struc +@@ -2515,9 +2576,9 @@ static void mtk_dim_rx(struct work_struc cur = min_t(u32, cur_profile.pkts, MTK_PDMA_DELAY_PINT_MASK); val |= cur << MTK_PDMA_DELAY_RX_PINT_SHIFT; @@ -455,7 +455,7 @@ Signed-off-by: David S. Miller spin_unlock_bh(ð->dim_lock); -@@ -2525,6 +2586,7 @@ static void mtk_dim_tx(struct work_struc +@@ -2528,6 +2589,7 @@ static void mtk_dim_tx(struct work_struc { struct dim *dim = container_of(work, struct dim, work); struct mtk_eth *eth = container_of(dim, struct mtk_eth, tx_dim); @@ -463,7 +463,7 @@ Signed-off-by: David S. Miller struct dim_cq_moder cur_profile; u32 val, cur; -@@ -2532,7 +2594,7 @@ static void mtk_dim_tx(struct work_struc +@@ -2535,7 +2597,7 @@ static void mtk_dim_tx(struct work_struc dim->profile_ix); spin_lock_bh(ð->dim_lock); @@ -472,7 +472,7 @@ Signed-off-by: David S. Miller val &= MTK_PDMA_DELAY_RX_MASK; val |= MTK_PDMA_DELAY_TX_EN; -@@ -2542,9 +2604,9 @@ static void mtk_dim_tx(struct work_struc +@@ -2545,9 +2607,9 @@ static void mtk_dim_tx(struct work_struc cur = min_t(u32, cur_profile.pkts, MTK_PDMA_DELAY_PINT_MASK); val |= cur << MTK_PDMA_DELAY_TX_PINT_SHIFT; @@ -484,7 +484,7 @@ Signed-off-by: David S. Miller spin_unlock_bh(ð->dim_lock); -@@ -2555,6 +2617,7 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2558,6 +2620,7 @@ static int mtk_hw_init(struct mtk_eth *e { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | ETHSYS_DMA_AG_MAP_PPE; @@ -492,7 +492,7 @@ Signed-off-by: David S. Miller int i, val, ret; if (test_and_set_bit(MTK_HW_INIT, ð->state)) -@@ -2629,10 +2692,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2632,10 +2695,10 @@ static int mtk_hw_init(struct mtk_eth *e mtk_rx_irq_disable(eth, ~0); /* FE int grouping */ @@ -507,7 +507,7 @@ Signed-off-by: David S. Miller mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); return 0; -@@ -3164,14 +3227,6 @@ static int mtk_probe(struct platform_dev +@@ -3167,14 +3230,6 @@ static int mtk_probe(struct platform_dev if (IS_ERR(eth->base)) return PTR_ERR(eth->base); @@ -522,7 +522,7 @@ Signed-off-by: David S. Miller if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { eth->rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA; eth->ip_align = NET_IP_ALIGN; -@@ -3405,6 +3460,7 @@ static int mtk_remove(struct platform_de +@@ -3408,6 +3463,7 @@ static int mtk_remove(struct platform_de } static const struct mtk_soc_data mt2701_data = { @@ -530,7 +530,7 @@ Signed-off-by: David S. Miller .caps = MT7623_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, -@@ -3416,6 +3472,7 @@ static const struct mtk_soc_data mt2701_ +@@ -3419,6 +3475,7 @@ static const struct mtk_soc_data mt2701_ }; static const struct mtk_soc_data mt7621_data = { @@ -538,7 +538,7 @@ Signed-off-by: David S. Miller .caps = MT7621_CAPS, .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, -@@ -3428,6 +3485,7 @@ static const struct mtk_soc_data mt7621_ +@@ -3431,6 +3488,7 @@ static const struct mtk_soc_data mt7621_ }; static const struct mtk_soc_data mt7622_data = { @@ -546,7 +546,7 @@ Signed-off-by: David S. Miller .ana_rgc3 = 0x2028, .caps = MT7622_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, -@@ -3441,6 +3499,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3444,6 +3502,7 @@ static const struct mtk_soc_data mt7622_ }; static const struct mtk_soc_data mt7623_data = { @@ -554,7 +554,7 @@ Signed-off-by: David S. Miller .caps = MT7623_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, -@@ -3453,6 +3512,7 @@ static const struct mtk_soc_data mt7623_ +@@ -3456,6 +3515,7 @@ static const struct mtk_soc_data mt7623_ }; static const struct mtk_soc_data mt7629_data = { @@ -562,7 +562,7 @@ Signed-off-by: David S. Miller .ana_rgc3 = 0x128, .caps = MT7629_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, -@@ -3465,6 +3525,7 @@ static const struct mtk_soc_data mt7629_ +@@ -3468,6 +3528,7 @@ static const struct mtk_soc_data mt7629_ }; static const struct mtk_soc_data rt5350_data = { diff --git a/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch b/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch index 548d62a027143c..91739ddd34162a 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch @@ -403,7 +403,7 @@ Signed-off-by: David S. Miller return 0; } -@@ -2298,7 +2406,7 @@ static irqreturn_t mtk_handle_irq_rx(int +@@ -2301,7 +2409,7 @@ static irqreturn_t mtk_handle_irq_rx(int eth->rx_events++; if (likely(napi_schedule_prep(ð->rx_napi))) { __napi_schedule(ð->rx_napi); @@ -412,7 +412,7 @@ Signed-off-by: David S. Miller } return IRQ_HANDLED; -@@ -2322,8 +2430,10 @@ static irqreturn_t mtk_handle_irq(int ir +@@ -2325,8 +2433,10 @@ static irqreturn_t mtk_handle_irq(int ir struct mtk_eth *eth = _eth; const struct mtk_reg_map *reg_map = eth->soc->reg_map; @@ -425,7 +425,7 @@ Signed-off-by: David S. Miller mtk_handle_irq_rx(irq, _eth); } if (mtk_r32(eth, reg_map->tx_irq_mask) & MTK_TX_DONE_INT) { -@@ -2341,16 +2451,16 @@ static void mtk_poll_controller(struct n +@@ -2344,16 +2454,16 @@ static void mtk_poll_controller(struct n struct mtk_eth *eth = mac->hw; mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); @@ -445,7 +445,7 @@ Signed-off-by: David S. Miller const struct mtk_reg_map *reg_map = eth->soc->reg_map; int err; -@@ -2361,12 +2471,19 @@ static int mtk_start_dma(struct mtk_eth +@@ -2364,12 +2474,19 @@ static int mtk_start_dma(struct mtk_eth } if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) { @@ -471,7 +471,7 @@ Signed-off-by: David S. Miller mtk_w32(eth, MTK_RX_DMA_EN | rx_2b_offset | MTK_RX_BT_32DWORDS | MTK_MULTI_EN, -@@ -2440,7 +2557,7 @@ static int mtk_open(struct net_device *d +@@ -2443,7 +2560,7 @@ static int mtk_open(struct net_device *d napi_enable(ð->tx_napi); napi_enable(ð->rx_napi); mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); @@ -480,7 +480,7 @@ Signed-off-by: David S. Miller refcount_set(ð->dma_refcnt, 1); } else -@@ -2492,7 +2609,7 @@ static int mtk_stop(struct net_device *d +@@ -2495,7 +2612,7 @@ static int mtk_stop(struct net_device *d mtk_gdm_config(eth, MTK_GDMA_DROP_ALL); mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); @@ -489,7 +489,7 @@ Signed-off-by: David S. Miller napi_disable(ð->tx_napi); napi_disable(ð->rx_napi); -@@ -2652,9 +2769,25 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2655,9 +2772,25 @@ static int mtk_hw_init(struct mtk_eth *e return 0; } @@ -518,7 +518,7 @@ Signed-off-by: David S. Miller if (eth->pctl) { /* Set GE2 driving and slew rate */ -@@ -2693,11 +2826,47 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2696,11 +2829,47 @@ static int mtk_hw_init(struct mtk_eth *e /* FE int grouping */ mtk_w32(eth, MTK_TX_DONE_INT, reg_map->pdma.int_grp); @@ -568,7 +568,7 @@ Signed-off-by: David S. Miller return 0; err_disable_pm: -@@ -3227,12 +3396,8 @@ static int mtk_probe(struct platform_dev +@@ -3230,12 +3399,8 @@ static int mtk_probe(struct platform_dev if (IS_ERR(eth->base)) return PTR_ERR(eth->base); @@ -582,7 +582,7 @@ Signed-off-by: David S. Miller spin_lock_init(ð->page_lock); spin_lock_init(ð->tx_irq_lock); -@@ -3468,6 +3633,10 @@ static const struct mtk_soc_data mt2701_ +@@ -3471,6 +3636,10 @@ static const struct mtk_soc_data mt2701_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -593,7 +593,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3481,6 +3650,10 @@ static const struct mtk_soc_data mt7621_ +@@ -3484,6 +3653,10 @@ static const struct mtk_soc_data mt7621_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -604,7 +604,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3495,6 +3668,10 @@ static const struct mtk_soc_data mt7622_ +@@ -3498,6 +3671,10 @@ static const struct mtk_soc_data mt7622_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -615,7 +615,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3508,6 +3685,10 @@ static const struct mtk_soc_data mt7623_ +@@ -3511,6 +3688,10 @@ static const struct mtk_soc_data mt7623_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -626,7 +626,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3521,6 +3702,10 @@ static const struct mtk_soc_data mt7629_ +@@ -3524,6 +3705,10 @@ static const struct mtk_soc_data mt7629_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -637,7 +637,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3533,6 +3718,10 @@ static const struct mtk_soc_data rt5350_ +@@ -3536,6 +3721,10 @@ static const struct mtk_soc_data rt5350_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), diff --git a/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch b/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch index 2df4b265a9b29e..713d24b3c99108 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller }; void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) -@@ -3705,6 +3742,21 @@ static const struct mtk_soc_data mt7629_ +@@ -3708,6 +3745,21 @@ static const struct mtk_soc_data mt7629_ }, }; @@ -87,7 +87,7 @@ Signed-off-by: David S. Miller static const struct mtk_soc_data rt5350_data = { .reg_map = &mt7628_reg_map, .caps = MT7628_CAPS, -@@ -3727,6 +3779,7 @@ const struct of_device_id of_mtk_match[] +@@ -3730,6 +3782,7 @@ const struct of_device_id of_mtk_match[] { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, diff --git a/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch b/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch index 2ad7b5792e9b66..b05faa9c4b7b95 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski skb->ip_summed = CHECKSUM_UNNECESSARY; else skb_checksum_none_assert(skb); -@@ -3752,6 +3758,7 @@ static const struct mtk_soc_data mt7986_ +@@ -3755,6 +3761,7 @@ static const struct mtk_soc_data mt7986_ .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), .rx_irq_done_mask = MTK_RX_DONE_INT_V2, diff --git a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch index 919da4d1ef198f..2f8128b3f30551 100644 --- a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch +++ b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch @@ -726,7 +726,7 @@ Signed-off-by: David S. Miller * to advertise both, only report advertising at 2500BaseX. --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -@@ -6347,15 +6347,14 @@ static void mvpp2_phylink_validate(struc +@@ -6352,15 +6352,14 @@ static void mvpp2_phylink_validate(struc goto empty_set; } diff --git a/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch b/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch index f6279bf13d8b74..b26b15e60d4af3 100644 --- a/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch +++ b/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3348,6 +3348,26 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3351,6 +3351,26 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch b/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch index 84c02992122057..6d52e4e37fec63 100644 --- a/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch +++ b/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch @@ -72,7 +72,7 @@ Signed-off-by: David S. Miller .mac_pcs_get_state = mtk_mac_pcs_get_state, .mac_an_restart = mtk_mac_an_restart, .mac_config = mtk_mac_config, -@@ -3310,6 +3262,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3313,6 +3265,9 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch b/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch index a6fbde5c892067..381c51b81ae3a1 100644 --- a/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch +++ b/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3262,6 +3262,10 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3265,6 +3265,10 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch b/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch index 63f4ef13e12017..887ff565784a05 100644 --- a/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch +++ b/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch @@ -16,7 +16,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3561,9 +3561,9 @@ static int mtk_probe(struct platform_dev +@@ -3564,9 +3564,9 @@ static int mtk_probe(struct platform_dev */ init_dummy_netdev(ð->dummy_dev); netif_napi_add(ð->dummy_dev, ð->tx_napi, mtk_napi_tx, diff --git a/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch b/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch index ff3c422f26e38c..58aa54f4e53c9f 100644 --- a/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch +++ b/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch @@ -15,7 +15,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3257,7 +3257,6 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3260,7 +3260,6 @@ static int mtk_add_mac(struct mtk_eth *e /* mac config is not set */ mac->interface = PHY_INTERFACE_MODE_NA; diff --git a/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch b/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch index e9e3e1f745248c..951c8fea84d85c 100644 --- a/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch +++ b/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch @@ -38,7 +38,7 @@ Signed-off-by: Jakub Kicinski mcr &= ~(MAC_MCR_SPEED_100 | MAC_MCR_SPEED_1000 | MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | MAC_MCR_FORCE_RX_FC); -@@ -3261,9 +3271,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3264,9 +3274,7 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch b/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch index 60e83a16513af7..49b2355ce40848 100644 --- a/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch +++ b/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch @@ -208,7 +208,7 @@ Signed-off-by: David S. Miller struct page_pool *pp; pp = mtk_create_page_pool(eth, &ring->xdp_q, ring_no, -@@ -2710,6 +2785,48 @@ static int mtk_stop(struct net_device *d +@@ -2713,6 +2788,48 @@ static int mtk_stop(struct net_device *d return 0; } @@ -257,7 +257,7 @@ Signed-off-by: David S. Miller static void ethsys_reset(struct mtk_eth *eth, u32 reset_bits) { regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL, -@@ -2988,6 +3105,12 @@ static int mtk_change_mtu(struct net_dev +@@ -2991,6 +3108,12 @@ static int mtk_change_mtu(struct net_dev struct mtk_eth *eth = mac->hw; u32 mcr_cur, mcr_new; @@ -270,7 +270,7 @@ Signed-off-by: David S. Miller if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK; -@@ -3314,6 +3437,7 @@ static const struct net_device_ops mtk_n +@@ -3317,6 +3440,7 @@ static const struct net_device_ops mtk_n .ndo_poll_controller = mtk_poll_controller, #endif .ndo_setup_tc = mtk_eth_setup_tc, diff --git a/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch b/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch index 8c134500117266..f774f9875d9dea 100644 --- a/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch +++ b/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller } mtk_tx_unmap(eth, tx_buf, true); -@@ -3460,6 +3609,7 @@ static const struct net_device_ops mtk_n +@@ -3463,6 +3612,7 @@ static const struct net_device_ops mtk_n #endif .ndo_setup_tc = mtk_eth_setup_tc, .ndo_bpf = mtk_xdp, diff --git a/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch b/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch index 3108d67da49c5e..d3d95a34b80f0d 100644 --- a/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch +++ b/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller MediaTek SoC family. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3471,11 +3471,18 @@ static void mtk_get_strings(struct net_d +@@ -3474,11 +3474,18 @@ static void mtk_get_strings(struct net_d int i; switch (stringset) { @@ -46,7 +46,7 @@ Signed-off-by: David S. Miller break; } } -@@ -3483,13 +3490,35 @@ static void mtk_get_strings(struct net_d +@@ -3486,13 +3493,35 @@ static void mtk_get_strings(struct net_d static int mtk_get_sset_count(struct net_device *dev, int sset) { switch (sset) { @@ -84,7 +84,7 @@ Signed-off-by: David S. Miller static void mtk_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { -@@ -3517,6 +3546,8 @@ static void mtk_get_ethtool_stats(struct +@@ -3520,6 +3549,8 @@ static void mtk_get_ethtool_stats(struct for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) *data_dst++ = *(data_src + mtk_ethtool_stats[i].offset); diff --git a/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch b/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch index dbc338cf351450..66e2778709dd30 100644 --- a/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch +++ b/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch @@ -57,7 +57,7 @@ Signed-off-by: Lorenzo Bianconi }; /* strings used by ethtool */ -@@ -2925,6 +2929,7 @@ static int mtk_open(struct net_device *d +@@ -2928,6 +2932,7 @@ static int mtk_open(struct net_device *d /* we run 2 netdevs on the same dma ring so we only bring it up once */ if (!refcount_read(ð->dma_refcnt)) { @@ -65,7 +65,7 @@ Signed-off-by: Lorenzo Bianconi u32 gdm_config = MTK_GDMA_TO_PDMA; int err; -@@ -2934,15 +2939,15 @@ static int mtk_open(struct net_device *d +@@ -2937,15 +2942,15 @@ static int mtk_open(struct net_device *d return err; } @@ -84,7 +84,7 @@ Signed-off-by: Lorenzo Bianconi refcount_set(ð->dma_refcnt, 1); } else -@@ -4041,7 +4046,9 @@ static int mtk_probe(struct platform_dev +@@ -4044,7 +4049,9 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch b/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch index 7cc0ab225ebeeb..1dfcc862d611c4 100644 --- a/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch +++ b/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch @@ -44,7 +44,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4144,6 +4144,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4147,6 +4147,7 @@ static const struct mtk_soc_data mt7621_ .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -52,7 +52,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4162,6 +4163,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4165,6 +4166,7 @@ static const struct mtk_soc_data mt7622_ .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -60,7 +60,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4179,6 +4181,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4182,6 +4184,7 @@ static const struct mtk_soc_data mt7623_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .offload_version = 2, @@ -68,7 +68,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4212,6 +4215,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4215,6 +4218,7 @@ static const struct mtk_soc_data mt7986_ .caps = MT7986_CAPS, .required_clks = MT7986_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch b/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch index 6b21a82352e9cd..e779d3b344e8f8 100644 --- a/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch +++ b/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch @@ -57,7 +57,7 @@ Signed-off-by: Lorenzo Bianconi if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) { if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -@@ -2930,7 +2930,8 @@ static int mtk_open(struct net_device *d +@@ -2933,7 +2933,8 @@ static int mtk_open(struct net_device *d /* we run 2 netdevs on the same dma ring so we only bring it up once */ if (!refcount_read(ð->dma_refcnt)) { const struct mtk_soc_data *soc = eth->soc; @@ -67,7 +67,7 @@ Signed-off-by: Lorenzo Bianconi int err; err = mtk_start_dma(eth); -@@ -2939,8 +2940,11 @@ static int mtk_open(struct net_device *d +@@ -2942,8 +2943,11 @@ static int mtk_open(struct net_device *d return err; } @@ -81,7 +81,7 @@ Signed-off-by: Lorenzo Bianconi mtk_gdm_config(eth, gdm_config); -@@ -2985,6 +2989,7 @@ static int mtk_stop(struct net_device *d +@@ -2988,6 +2992,7 @@ static int mtk_stop(struct net_device *d { struct mtk_mac *mac = netdev_priv(dev); struct mtk_eth *eth = mac->hw; @@ -89,7 +89,7 @@ Signed-off-by: Lorenzo Bianconi phylink_stop(mac->phylink); -@@ -3012,8 +3017,8 @@ static int mtk_stop(struct net_device *d +@@ -3015,8 +3020,8 @@ static int mtk_stop(struct net_device *d mtk_dma_free(eth); @@ -100,7 +100,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -4046,12 +4051,19 @@ static int mtk_probe(struct platform_dev +@@ -4049,12 +4054,19 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch b/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch index 92de6e7963784e..f93285642d1c59 100644 --- a/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch +++ b/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch @@ -39,7 +39,7 @@ Signed-off-by: Lorenzo Bianconi }; /* strings used by ethtool */ -@@ -3963,16 +3971,12 @@ static int mtk_probe(struct platform_dev +@@ -3966,16 +3974,12 @@ static int mtk_probe(struct platform_dev for (i = 0;; i++) { struct device_node *np = of_parse_phandle(pdev->dev.of_node, "mediatek,wed", i); diff --git a/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch b/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch index fdafba43d81cd4..656a60b15a2ed6 100644 --- a/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch +++ b/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4161,6 +4161,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4164,6 +4164,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -29,7 +29,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4180,6 +4181,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4183,6 +4184,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -37,7 +37,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4198,6 +4200,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4201,6 +4203,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 2, .hash_offset = 2, diff --git a/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch b/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch index f87fc4c451a414..f28997c7b2d5dc 100644 --- a/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch +++ b/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch @@ -26,7 +26,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3888,6 +3888,7 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -3891,6 +3891,7 @@ void mtk_eth_set_dma_device(struct mtk_e static int mtk_probe(struct platform_device *pdev) { @@ -34,7 +34,7 @@ Signed-off-by: Lorenzo Bianconi struct device_node *mac_np; struct mtk_eth *eth; int err, i; -@@ -3968,16 +3969,31 @@ static int mtk_probe(struct platform_dev +@@ -3971,16 +3972,31 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch b/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch index 50ea41240b8b50..f10878da43a856 100644 --- a/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch +++ b/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch @@ -49,7 +49,7 @@ Signed-off-by: Lorenzo Bianconi if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) mtk_ppe_check_skb(eth->ppe[0], skb, hash); -@@ -4177,7 +4178,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4180,7 +4181,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -58,7 +58,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4197,7 +4198,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4200,7 +4201,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -67,7 +67,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4216,7 +4217,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4219,7 +4220,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 2, .hash_offset = 2, @@ -76,7 +76,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4248,9 +4249,11 @@ static const struct mtk_soc_data mt7986_ +@@ -4251,9 +4252,11 @@ static const struct mtk_soc_data mt7986_ .reg_map = &mt7986_reg_map, .ana_rgc3 = 0x128, .caps = MT7986_CAPS, diff --git a/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch b/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch index cd4747672de35a..aba5673b76d875 100644 --- a/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch +++ b/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch @@ -16,7 +16,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4252,6 +4252,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4255,6 +4255,7 @@ static const struct mtk_soc_data mt7986_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7986_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch index 624e0178bf8c17..7ebe8566a041d2 100644 --- a/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch +++ b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4004,19 +4004,23 @@ static int mtk_probe(struct platform_dev +@@ -4007,19 +4007,23 @@ static int mtk_probe(struct platform_dev eth->irq[i] = platform_get_irq(pdev, i); if (eth->irq[i] < 0) { dev_err(&pdev->dev, "no IRQ%d resource found\n", i); @@ -45,7 +45,7 @@ Signed-off-by: David S. Miller } eth->clks[i] = NULL; } -@@ -4027,7 +4031,7 @@ static int mtk_probe(struct platform_dev +@@ -4030,7 +4034,7 @@ static int mtk_probe(struct platform_dev err = mtk_hw_init(eth); if (err) @@ -54,7 +54,7 @@ Signed-off-by: David S. Miller eth->hwlro = MTK_HAS_CAPS(eth->soc->caps, MTK_HWLRO); -@@ -4125,6 +4129,8 @@ err_free_dev: +@@ -4128,6 +4132,8 @@ err_free_dev: mtk_free_dev(eth); err_deinit_hw: mtk_hw_deinit(eth); @@ -63,7 +63,7 @@ Signed-off-by: David S. Miller return err; } -@@ -4144,6 +4150,7 @@ static int mtk_remove(struct platform_de +@@ -4147,6 +4153,7 @@ static int mtk_remove(struct platform_de phylink_disconnect_phy(mac->phylink); } diff --git a/target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch b/target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch index ae3acfef725b85..9c526ecec93ad7 100644 --- a/target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch +++ b/target/linux/generic/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4087,13 +4087,13 @@ static int mtk_probe(struct platform_dev +@@ -4090,13 +4090,13 @@ static int mtk_probe(struct platform_dev eth->soc->offload_version, i); if (!eth->ppe[i]) { err = -ENOMEM; diff --git a/target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch b/target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch index b0f5723f7bf1b6..55c9b35238b735 100644 --- a/target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch +++ b/target/linux/generic/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch @@ -21,7 +21,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4087,13 +4087,13 @@ static int mtk_probe(struct platform_dev +@@ -4090,13 +4090,13 @@ static int mtk_probe(struct platform_dev eth->soc->offload_version, i); if (!eth->ppe[i]) { err = -ENOMEM; @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski } for (i = 0; i < MTK_MAX_DEVS; i++) { -@@ -4103,7 +4103,7 @@ static int mtk_probe(struct platform_dev +@@ -4106,7 +4106,7 @@ static int mtk_probe(struct platform_dev err = register_netdev(eth->netdev[i]); if (err) { dev_err(eth->dev, "error bringing up device\n"); @@ -46,7 +46,7 @@ Signed-off-by: Jakub Kicinski } else netif_info(eth, probe, eth->netdev[i], "mediatek frame engine at 0x%08lx, irq %d\n", -@@ -4123,7 +4123,8 @@ static int mtk_probe(struct platform_dev +@@ -4126,7 +4126,8 @@ static int mtk_probe(struct platform_dev return 0; diff --git a/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch b/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch index 78f5f1859e4fe5..9206be370f818c 100644 --- a/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch +++ b/target/linux/generic/backport-5.15/729-06-v6.1-net-ethernet-mtk_eth_soc-do-not-overwrite-mtu-config.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3176,6 +3176,30 @@ static void mtk_dim_tx(struct work_struc +@@ -3179,6 +3179,30 @@ static void mtk_dim_tx(struct work_struc dim->state = DIM_START_MEASURE; } @@ -45,7 +45,7 @@ Signed-off-by: David S. Miller static int mtk_hw_init(struct mtk_eth *eth) { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | -@@ -3250,8 +3274,16 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3253,8 +3277,16 @@ static int mtk_hw_init(struct mtk_eth *e * up with the more appropriate value when mtk_mac_config call is being * invoked. */ @@ -63,7 +63,7 @@ Signed-off-by: David S. Miller /* Indicates CDM to parse the MTK special tag from CPU * which also is working out for untag packets. -@@ -3350,7 +3382,6 @@ static int mtk_change_mtu(struct net_dev +@@ -3353,7 +3385,6 @@ static int mtk_change_mtu(struct net_dev int length = new_mtu + MTK_RX_ETH_HLEN; struct mtk_mac *mac = netdev_priv(dev); struct mtk_eth *eth = mac->hw; @@ -71,7 +71,7 @@ Signed-off-by: David S. Miller if (rcu_access_pointer(eth->prog) && length > MTK_PP_MAX_BUF_SIZE) { -@@ -3358,23 +3389,7 @@ static int mtk_change_mtu(struct net_dev +@@ -3361,23 +3392,7 @@ static int mtk_change_mtu(struct net_dev return -EINVAL; } diff --git a/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch b/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch index 5b8768899dd160..063415c618195d 100644 --- a/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch +++ b/target/linux/generic/backport-5.15/729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch @@ -12,7 +12,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3420,11 +3420,8 @@ static void mtk_pending_work(struct work +@@ -3423,11 +3423,8 @@ static void mtk_pending_work(struct work rtnl_lock(); dev_dbg(eth->dev, "[%s][%d] reset\n", __func__, __LINE__); @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller /* stop all devices to make sure that dma is properly shut down */ for (i = 0; i < MTK_MAC_COUNT; i++) { if (!eth->netdev[i]) -@@ -3458,7 +3455,7 @@ static void mtk_pending_work(struct work +@@ -3461,7 +3458,7 @@ static void mtk_pending_work(struct work dev_dbg(eth->dev, "[%s][%d] reset done\n", __func__, __LINE__); diff --git a/target/linux/generic/backport-5.15/729-08-v6.2-net-ethernet-mtk_eth_soc-fix-RSTCTRL_PPE-0-1-definit.patch b/target/linux/generic/backport-5.15/729-08-v6.2-net-ethernet-mtk_eth_soc-fix-RSTCTRL_PPE-0-1-definit.patch index 12aa3ebf6a7cef..30be5b392bf6d3 100644 --- a/target/linux/generic/backport-5.15/729-08-v6.2-net-ethernet-mtk_eth_soc-fix-RSTCTRL_PPE-0-1-definit.patch +++ b/target/linux/generic/backport-5.15/729-08-v6.2-net-ethernet-mtk_eth_soc-fix-RSTCTRL_PPE-0-1-definit.patch @@ -13,7 +13,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3239,16 +3239,17 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3242,16 +3242,17 @@ static int mtk_hw_init(struct mtk_eth *e return 0; } diff --git a/target/linux/generic/backport-5.15/729-18-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_reset-util.patch b/target/linux/generic/backport-5.15/729-18-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_reset-util.patch index 45b85c06cb529d..3ab5dba434ecf0 100644 --- a/target/linux/generic/backport-5.15/729-18-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_reset-util.patch +++ b/target/linux/generic/backport-5.15/729-18-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_reset-util.patch @@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3200,6 +3200,27 @@ static void mtk_set_mcr_max_rx(struct mt +@@ -3203,6 +3203,27 @@ static void mtk_set_mcr_max_rx(struct mt mtk_w32(mac->hw, mcr_new, MTK_MAC_MCR(mac->id)); } @@ -44,7 +44,7 @@ Signed-off-by: Paolo Abeni static int mtk_hw_init(struct mtk_eth *eth) { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | -@@ -3239,22 +3260,9 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3242,22 +3263,9 @@ static int mtk_hw_init(struct mtk_eth *e return 0; } diff --git a/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch b/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch index 35004462d25248..deb39477ec73fb 100644 --- a/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch +++ b/target/linux/generic/backport-5.15/729-19-v6.3-net-ethernet-mtk_eth_soc-introduce-mtk_hw_warm_reset.patch @@ -17,7 +17,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3221,7 +3221,54 @@ static void mtk_hw_reset(struct mtk_eth +@@ -3224,7 +3224,54 @@ static void mtk_hw_reset(struct mtk_eth 0x3ffffff); } @@ -73,7 +73,7 @@ Signed-off-by: Paolo Abeni { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | ETHSYS_DMA_AG_MAP_PPE; -@@ -3260,7 +3307,12 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3263,7 +3310,12 @@ static int mtk_hw_init(struct mtk_eth *e return 0; } @@ -87,7 +87,7 @@ Signed-off-by: Paolo Abeni if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { /* Set FE to PDMAv2 if necessary */ -@@ -3448,7 +3500,7 @@ static void mtk_pending_work(struct work +@@ -3451,7 +3503,7 @@ static void mtk_pending_work(struct work if (eth->dev->pins) pinctrl_select_state(eth->dev->pins->p, eth->dev->pins->default_state); @@ -96,7 +96,7 @@ Signed-off-by: Paolo Abeni /* restart DMA and enable IRQs */ for (i = 0; i < MTK_MAC_COUNT; i++) { -@@ -4050,7 +4102,7 @@ static int mtk_probe(struct platform_dev +@@ -4053,7 +4105,7 @@ static int mtk_probe(struct platform_dev eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); INIT_WORK(ð->pending_work, mtk_pending_work); diff --git a/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch b/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch index 7dde9a54824d2c..b3812cccbbdbde 100644 --- a/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch +++ b/target/linux/generic/backport-5.15/729-20-v6.3-net-ethernet-mtk_eth_soc-align-reset-procedure-to-ve.patch @@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2786,14 +2786,29 @@ static void mtk_dma_free(struct mtk_eth +@@ -2789,14 +2789,29 @@ static void mtk_dma_free(struct mtk_eth kfree(eth->scratch_head); } @@ -48,7 +48,7 @@ Signed-off-by: Paolo Abeni schedule_work(ð->pending_work); } -@@ -3275,15 +3290,17 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3278,15 +3293,17 @@ static int mtk_hw_init(struct mtk_eth *e const struct mtk_reg_map *reg_map = eth->soc->reg_map; int i, val, ret; @@ -72,7 +72,7 @@ Signed-off-by: Paolo Abeni if (eth->ethsys) regmap_update_bits(eth->ethsys, ETHSYS_DMA_AG_MAP, dma_mask, -@@ -3409,8 +3426,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3412,8 +3429,10 @@ static int mtk_hw_init(struct mtk_eth *e return 0; err_disable_pm: @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni return ret; } -@@ -3472,30 +3491,53 @@ static int mtk_do_ioctl(struct net_devic +@@ -3475,30 +3494,53 @@ static int mtk_do_ioctl(struct net_devic return -EOPNOTSUPP; } @@ -148,7 +148,7 @@ Signed-off-by: Paolo Abeni if (eth->dev->pins) pinctrl_select_state(eth->dev->pins->p, -@@ -3506,15 +3548,19 @@ static void mtk_pending_work(struct work +@@ -3509,15 +3551,19 @@ static void mtk_pending_work(struct work for (i = 0; i < MTK_MAC_COUNT; i++) { if (!test_bit(i, &restart)) continue; diff --git a/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch b/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch index bc8b9a33274716..633c66f1c2f6c8 100644 --- a/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch +++ b/target/linux/generic/backport-5.15/729-21-v6.3-net-ethernet-mtk_eth_soc-add-dma-checks-to-mtk_hw_re.patch @@ -49,7 +49,7 @@ Signed-off-by: Paolo Abeni }; /* strings used by ethtool */ -@@ -3283,6 +3289,102 @@ static void mtk_hw_warm_reset(struct mtk +@@ -3286,6 +3292,102 @@ static void mtk_hw_warm_reset(struct mtk val, rst_mask); } @@ -152,7 +152,7 @@ Signed-off-by: Paolo Abeni static int mtk_hw_init(struct mtk_eth *eth, bool reset) { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | -@@ -3598,6 +3700,7 @@ static int mtk_cleanup(struct mtk_eth *e +@@ -3601,6 +3703,7 @@ static int mtk_cleanup(struct mtk_eth *e mtk_unreg_dev(eth); mtk_free_dev(eth); cancel_work_sync(ð->pending_work); @@ -160,7 +160,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -4035,6 +4138,7 @@ static int mtk_probe(struct platform_dev +@@ -4038,6 +4141,7 @@ static int mtk_probe(struct platform_dev eth->rx_dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE; INIT_WORK(ð->rx_dim.work, mtk_dim_rx); @@ -168,7 +168,7 @@ Signed-off-by: Paolo Abeni eth->tx_dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE; INIT_WORK(ð->tx_dim.work, mtk_dim_tx); -@@ -4239,6 +4343,8 @@ static int mtk_probe(struct platform_dev +@@ -4242,6 +4346,8 @@ static int mtk_probe(struct platform_dev NAPI_POLL_WEIGHT); platform_set_drvdata(pdev, eth); diff --git a/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch b/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch index ae0e0e959106fa..1f61be0a1fb8a7 100644 --- a/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch +++ b/target/linux/generic/backport-5.15/729-22-v6.3-net-ethernet-mtk_wed-add-reset-reset_complete-callba.patch @@ -14,7 +14,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3629,6 +3629,11 @@ static void mtk_pending_work(struct work +@@ -3632,6 +3632,11 @@ static void mtk_pending_work(struct work set_bit(MTK_RESETTING, ð->state); mtk_prepare_for_reset(eth); @@ -26,7 +26,7 @@ Signed-off-by: Paolo Abeni /* stop all devices to make sure that dma is properly shut down */ for (i = 0; i < MTK_MAC_COUNT; i++) { -@@ -3666,6 +3671,8 @@ static void mtk_pending_work(struct work +@@ -3669,6 +3674,8 @@ static void mtk_pending_work(struct work clear_bit(MTK_RESETTING, ð->state); diff --git a/target/linux/generic/backport-5.15/730-02-v6.3-net-ethernet-mtk_eth_soc-increase-tx-ring-side-for-Q.patch b/target/linux/generic/backport-5.15/730-02-v6.3-net-ethernet-mtk_eth_soc-increase-tx-ring-side-for-Q.patch index b3412df9e0ccef..8b6d9e908f2e1a 100644 --- a/target/linux/generic/backport-5.15/730-02-v6.3-net-ethernet-mtk_eth_soc-increase-tx-ring-side-for-Q.patch +++ b/target/linux/generic/backport-5.15/730-02-v6.3-net-ethernet-mtk_eth_soc-increase-tx-ring-side-for-Q.patch @@ -122,7 +122,7 @@ Signed-off-by: Felix Fietkau ring->dma_pdma, ring->phys_pdma); ring->dma_pdma = NULL; } -@@ -2774,7 +2780,7 @@ static void mtk_dma_free(struct mtk_eth +@@ -2777,7 +2783,7 @@ static void mtk_dma_free(struct mtk_eth netdev_reset_queue(eth->netdev[i]); if (eth->scratch_ring) { dma_free_coherent(eth->dma_dev, diff --git a/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch b/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch index af987c42e25a95..391727b30d3f4d 100644 --- a/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch +++ b/target/linux/generic/backport-5.15/730-03-v6.3-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4422,7 +4422,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4425,7 +4425,7 @@ static const struct mtk_soc_data mt7621_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau .hash_offset = 2, .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { -@@ -4461,7 +4461,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4464,7 +4464,7 @@ static const struct mtk_soc_data mt7623_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, diff --git a/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch b/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch index 2e2299c932fcf0..8e743dd02a374e 100644 --- a/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch +++ b/target/linux/generic/backport-5.15/730-04-v6.3-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch @@ -424,7 +424,7 @@ Signed-off-by: Felix Fietkau } else { mtk_w32(eth, ring->phys_pdma, MT7628_TX_BASE_PTR0); mtk_w32(eth, ring_size, MT7628_TX_MAX_CNT0); -@@ -2904,7 +3020,7 @@ static int mtk_start_dma(struct mtk_eth +@@ -2907,7 +3023,7 @@ static int mtk_start_dma(struct mtk_eth if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) val |= MTK_MUTLI_CNT | MTK_RESV_BUF | MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | @@ -433,7 +433,7 @@ Signed-off-by: Felix Fietkau else val |= MTK_RX_BT_32DWORDS; mtk_w32(eth, val, reg_map->qdma.glo_cfg); -@@ -2950,6 +3066,45 @@ static void mtk_gdm_config(struct mtk_et +@@ -2953,6 +3069,45 @@ static void mtk_gdm_config(struct mtk_et mtk_w32(eth, 0, MTK_RST_GL); } @@ -479,7 +479,7 @@ Signed-off-by: Felix Fietkau static int mtk_open(struct net_device *dev) { struct mtk_mac *mac = netdev_priv(dev); -@@ -2994,7 +3149,8 @@ static int mtk_open(struct net_device *d +@@ -2997,7 +3152,8 @@ static int mtk_open(struct net_device *d refcount_inc(ð->dma_refcnt); phylink_start(mac->phylink); @@ -489,7 +489,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3700,8 +3856,12 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3703,8 +3859,12 @@ static int mtk_unreg_dev(struct mtk_eth int i; for (i = 0; i < MTK_MAC_COUNT; i++) { @@ -502,7 +502,7 @@ Signed-off-by: Felix Fietkau unregister_netdev(eth->netdev[i]); } -@@ -3918,6 +4078,23 @@ static int mtk_set_rxnfc(struct net_devi +@@ -3921,6 +4081,23 @@ static int mtk_set_rxnfc(struct net_devi return ret; } @@ -526,7 +526,7 @@ Signed-off-by: Felix Fietkau static const struct ethtool_ops mtk_ethtool_ops = { .get_link_ksettings = mtk_get_link_ksettings, .set_link_ksettings = mtk_set_link_ksettings, -@@ -3952,6 +4129,7 @@ static const struct net_device_ops mtk_n +@@ -3955,6 +4132,7 @@ static const struct net_device_ops mtk_n .ndo_setup_tc = mtk_eth_setup_tc, .ndo_bpf = mtk_xdp, .ndo_xdp_xmit = mtk_xdp_xmit, @@ -534,7 +534,7 @@ Signed-off-by: Felix Fietkau }; static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) -@@ -3961,6 +4139,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3964,6 +4142,7 @@ static int mtk_add_mac(struct mtk_eth *e struct phylink *phylink; struct mtk_mac *mac; int id, err; @@ -542,7 +542,7 @@ Signed-off-by: Felix Fietkau if (!_id) { dev_err(eth->dev, "missing mac id\n"); -@@ -3978,7 +4157,10 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3981,7 +4160,10 @@ static int mtk_add_mac(struct mtk_eth *e return -EINVAL; } @@ -554,7 +554,7 @@ Signed-off-by: Felix Fietkau if (!eth->netdev[id]) { dev_err(eth->dev, "alloc_etherdev failed\n"); return -ENOMEM; -@@ -4086,6 +4268,11 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4089,6 +4271,11 @@ static int mtk_add_mac(struct mtk_eth *e else eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; diff --git a/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch b/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch index f9d822ad447bb6..3733b7279f91b6 100644 --- a/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch +++ b/target/linux/generic/backport-5.15/730-09-v6.3-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch @@ -52,7 +52,7 @@ Signed-off-by: Felix Fietkau } skb_record_rx_queue(skb, 0); -@@ -2800,15 +2807,30 @@ static netdev_features_t mtk_fix_feature +@@ -2803,15 +2810,30 @@ static netdev_features_t mtk_fix_feature static int mtk_set_features(struct net_device *dev, netdev_features_t features) { @@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau } /* wait for DMA to finish whatever it is doing before we start using it again */ -@@ -3105,11 +3127,45 @@ found: +@@ -3108,11 +3130,45 @@ found: return NOTIFY_DONE; } @@ -135,7 +135,7 @@ Signed-off-by: Felix Fietkau err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { -@@ -3632,6 +3688,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3635,6 +3691,10 @@ static int mtk_hw_init(struct mtk_eth *e */ val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL); @@ -146,7 +146,7 @@ Signed-off-by: Felix Fietkau /* Enable RX VLan Offloading */ mtk_w32(eth, 1, MTK_CDMP_EG_CTRL); -@@ -3848,6 +3908,12 @@ static int mtk_free_dev(struct mtk_eth * +@@ -3851,6 +3911,12 @@ static int mtk_free_dev(struct mtk_eth * free_netdev(eth->netdev[i]); } diff --git a/target/linux/generic/backport-5.15/730-10-v6.3-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch b/target/linux/generic/backport-5.15/730-10-v6.3-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch index 0bf48b07800132..9c2843a6c9c34d 100644 --- a/target/linux/generic/backport-5.15/730-10-v6.3-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch +++ b/target/linux/generic/backport-5.15/730-10-v6.3-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3712,9 +3712,12 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3715,9 +3715,12 @@ static int mtk_hw_init(struct mtk_eth *e mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { diff --git a/target/linux/generic/backport-5.15/730-12-v6.3-net-ethernet-mtk_eth_soc-disable-hardware-DSA-untagg.patch b/target/linux/generic/backport-5.15/730-12-v6.3-net-ethernet-mtk_eth_soc-disable-hardware-DSA-untagg.patch index 08bf608bc1217b..5a4d343a72cf39 100644 --- a/target/linux/generic/backport-5.15/730-12-v6.3-net-ethernet-mtk_eth_soc-disable-hardware-DSA-untagg.patch +++ b/target/linux/generic/backport-5.15/730-12-v6.3-net-ethernet-mtk_eth_soc-disable-hardware-DSA-untagg.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3143,7 +3143,8 @@ static int mtk_open(struct net_device *d +@@ -3146,7 +3146,8 @@ static int mtk_open(struct net_device *d struct mtk_eth *eth = mac->hw; int i, err; @@ -30,7 +30,7 @@ Signed-off-by: Jakub Kicinski for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) { struct metadata_dst *md_dst = eth->dsa_meta[i]; -@@ -3160,7 +3161,8 @@ static int mtk_open(struct net_device *d +@@ -3163,7 +3164,8 @@ static int mtk_open(struct net_device *d } } else { /* Hardware special tag parsing needs to be disabled if at least diff --git a/target/linux/generic/backport-5.15/730-13-v6.3-net-ethernet-mtk_eth_soc-enable-special-tag-when-any.patch b/target/linux/generic/backport-5.15/730-13-v6.3-net-ethernet-mtk_eth_soc-enable-special-tag-when-any.patch index efab99ada006ef..e93e62125d458a 100644 --- a/target/linux/generic/backport-5.15/730-13-v6.3-net-ethernet-mtk_eth_soc-enable-special-tag-when-any.patch +++ b/target/linux/generic/backport-5.15/730-13-v6.3-net-ethernet-mtk_eth_soc-enable-special-tag-when-any.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3078,7 +3078,7 @@ static void mtk_gdm_config(struct mtk_et +@@ -3081,7 +3081,7 @@ static void mtk_gdm_config(struct mtk_et val |= config; @@ -32,7 +32,7 @@ Signed-off-by: David S. Miller val |= MTK_GDMA_SPECIAL_TAG; mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i)); -@@ -3143,8 +3143,7 @@ static int mtk_open(struct net_device *d +@@ -3146,8 +3146,7 @@ static int mtk_open(struct net_device *d struct mtk_eth *eth = mac->hw; int i, err; @@ -42,7 +42,7 @@ Signed-off-by: David S. Miller for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) { struct metadata_dst *md_dst = eth->dsa_meta[i]; -@@ -3161,8 +3160,7 @@ static int mtk_open(struct net_device *d +@@ -3164,8 +3163,7 @@ static int mtk_open(struct net_device *d } } else { /* Hardware special tag parsing needs to be disabled if at least diff --git a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch index 1ae4e83363232e..b59638e772b80c 100644 --- a/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-18-net-ethernet-mtk_eth_soc-add-support-for-MT7981.patch @@ -51,7 +51,7 @@ Signed-off-by: Jakub Kicinski mtk_eth_path_name(path), __func__, updated); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4749,6 +4749,26 @@ static const struct mtk_soc_data mt7629_ +@@ -4752,6 +4752,26 @@ static const struct mtk_soc_data mt7629_ }, }; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski static const struct mtk_soc_data mt7986_data = { .reg_map = &mt7986_reg_map, .ana_rgc3 = 0x128, -@@ -4791,6 +4811,7 @@ const struct of_device_id of_mtk_match[] +@@ -4794,6 +4814,7 @@ const struct of_device_id of_mtk_match[] { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, diff --git a/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch b/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch index 42a700d5439219..c55d6b6428caf1 100644 --- a/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch +++ b/target/linux/generic/backport-5.15/733-v6.3-20-net-ethernet-mtk_eth_soc-switch-to-external-PCS-driv.patch @@ -60,7 +60,7 @@ Signed-off-by: Jakub Kicinski } return NULL; -@@ -3960,8 +3961,17 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3963,8 +3964,17 @@ static int mtk_unreg_dev(struct mtk_eth return 0; } @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski mtk_unreg_dev(eth); mtk_free_dev(eth); cancel_work_sync(ð->pending_work); -@@ -4401,6 +4411,36 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -4404,6 +4414,36 @@ void mtk_eth_set_dma_device(struct mtk_e rtnl_unlock(); } @@ -115,7 +115,7 @@ Signed-off-by: Jakub Kicinski static int mtk_probe(struct platform_device *pdev) { struct resource *res = NULL; -@@ -4464,13 +4504,7 @@ static int mtk_probe(struct platform_dev +@@ -4467,13 +4507,7 @@ static int mtk_probe(struct platform_dev } if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) { @@ -130,7 +130,7 @@ Signed-off-by: Jakub Kicinski if (err) return err; -@@ -4481,14 +4515,17 @@ static int mtk_probe(struct platform_dev +@@ -4484,14 +4518,17 @@ static int mtk_probe(struct platform_dev "mediatek,pctl"); if (IS_ERR(eth->pctl)) { dev_err(&pdev->dev, "no pctl regmap found\n"); @@ -151,7 +151,7 @@ Signed-off-by: Jakub Kicinski } if (eth->soc->offload_version) { -@@ -4649,6 +4686,8 @@ err_deinit_hw: +@@ -4652,6 +4689,8 @@ err_deinit_hw: mtk_hw_deinit(eth); err_wed_exit: mtk_wed_exit(); diff --git a/target/linux/generic/backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch b/target/linux/generic/backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch index 51ebcfe8f11901..1c804f29b67e58 100644 --- a/target/linux/generic/backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch +++ b/target/linux/generic/backport-5.15/733-v6.4-24-net-ethernet-mtk_eth_soc-ppe-add-support-for-flow-ac.patch @@ -53,7 +53,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4635,8 +4635,8 @@ static int mtk_probe(struct platform_dev +@@ -4638,8 +4638,8 @@ static int mtk_probe(struct platform_dev for (i = 0; i < num_ppe; i++) { u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; @@ -64,7 +64,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov if (!eth->ppe[i]) { err = -ENOMEM; goto err_deinit_ppe; -@@ -4762,6 +4762,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4765,6 +4765,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -72,7 +72,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4799,6 +4800,7 @@ static const struct mtk_soc_data mt7629_ +@@ -4802,6 +4803,7 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -80,7 +80,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4819,6 +4821,7 @@ static const struct mtk_soc_data mt7981_ +@@ -4822,6 +4824,7 @@ static const struct mtk_soc_data mt7981_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), @@ -88,7 +88,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), -@@ -4839,6 +4842,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4842,6 +4845,7 @@ static const struct mtk_soc_data mt7986_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), diff --git a/target/linux/generic/backport-5.15/733-v6.4-26-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch b/target/linux/generic/backport-5.15/733-v6.4-26-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch index f6c70e7e6aff02..6126dfeadc2e94 100644 --- a/target/linux/generic/backport-5.15/733-v6.4-26-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch +++ b/target/linux/generic/backport-5.15/733-v6.4-26-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch @@ -70,7 +70,7 @@ Signed-off-by: Felix Fietkau skb_record_rx_queue(skb, 0); napi_gro_receive(napi, skb); -@@ -2831,29 +2814,11 @@ static netdev_features_t mtk_fix_feature +@@ -2834,29 +2817,11 @@ static netdev_features_t mtk_fix_feature static int mtk_set_features(struct net_device *dev, netdev_features_t features) { @@ -100,7 +100,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3167,30 +3132,6 @@ static int mtk_open(struct net_device *d +@@ -3170,30 +3135,6 @@ static int mtk_open(struct net_device *d struct mtk_eth *eth = mac->hw; int i, err; @@ -131,7 +131,7 @@ Signed-off-by: Felix Fietkau err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { netdev_err(dev, "%s: could not attach PHY: %d\n", __func__, -@@ -3231,6 +3172,35 @@ static int mtk_open(struct net_device *d +@@ -3234,6 +3175,35 @@ static int mtk_open(struct net_device *d phylink_start(mac->phylink); netif_tx_start_all_queues(dev); @@ -167,7 +167,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3715,10 +3685,9 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3718,10 +3688,9 @@ static int mtk_hw_init(struct mtk_eth *e if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { val = mtk_r32(eth, MTK_CDMP_IG_CTRL); mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); @@ -180,7 +180,7 @@ Signed-off-by: Felix Fietkau /* set interrupt delays based on current Net DIM sample */ mtk_dim_rx(ð->rx_dim.work); -@@ -4358,7 +4327,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4361,7 +4330,7 @@ static int mtk_add_mac(struct mtk_eth *e eth->netdev[id]->hw_features |= NETIF_F_LRO; eth->netdev[id]->vlan_features = eth->soc->hw_features & diff --git a/target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch b/target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch index 0ba8bb8ec43ac1..ad63dd61963626 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-01-net-ethernet-mtk_ppe-add-MTK_FOE_ENTRY_V-1-2-_SIZE-m.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4711,7 +4711,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4714,7 +4714,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 1, .hash_offset = 2, @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4732,7 +4732,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4735,7 +4735,7 @@ static const struct mtk_soc_data mt7622_ .offload_version = 2, .hash_offset = 2, .has_accounting = true, @@ -35,7 +35,7 @@ Signed-off-by: David S. Miller .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4751,7 +4751,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4754,7 +4754,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 1, .hash_offset = 2, @@ -44,7 +44,7 @@ Signed-off-by: David S. Miller .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4789,8 +4789,8 @@ static const struct mtk_soc_data mt7981_ +@@ -4792,8 +4792,8 @@ static const struct mtk_soc_data mt7981_ .required_pctl = false, .offload_version = 2, .hash_offset = 4, @@ -54,7 +54,7 @@ Signed-off-by: David S. Miller .txrx = { .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), -@@ -4810,8 +4810,8 @@ static const struct mtk_soc_data mt7986_ +@@ -4813,8 +4813,8 @@ static const struct mtk_soc_data mt7986_ .required_pctl = false, .offload_version = 2, .hash_offset = 4, diff --git a/target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch b/target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch index 681022078cb8d6..c502c4c28c4ac4 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-02-net-ethernet-mtk_eth_soc-remove-incorrect-PLL-config.patch @@ -95,7 +95,7 @@ Signed-off-by: Paolo Abeni /* mt7623_pad_clk_setup */ for (i = 0 ; i < NUM_TRGMII_CTRL; i++) -@@ -4286,13 +4258,19 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4289,13 +4261,19 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; @@ -121,7 +121,7 @@ Signed-off-by: Paolo Abeni if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII) && !mac->id) __set_bit(PHY_INTERFACE_MODE_TRGMII, -@@ -4752,6 +4730,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4755,6 +4733,7 @@ static const struct mtk_soc_data mt7623_ .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, diff --git a/target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch b/target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch index 816f98ecc537cc..21ca0b1c08ca78 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-03-net-ethernet-mtk_eth_soc-remove-mac_pcs_get_state-an.patch @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni .mac_config = mtk_mac_config, .mac_finish = mtk_mac_finish, .mac_link_down = mtk_mac_link_down, -@@ -4253,8 +4220,6 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4256,8 +4223,6 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch b/target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch index d836acc4b04503..d1d692002d12a4 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-05-net-ethernet-mtk_eth_soc-add-version-in-mtk_soc_data.patch @@ -132,7 +132,7 @@ Signed-off-by: Jakub Kicinski rxd->rxd5 = 0; rxd->rxd6 = 0; rxd->rxd7 = 0; -@@ -2967,7 +2967,7 @@ static int mtk_start_dma(struct mtk_eth +@@ -2970,7 +2970,7 @@ static int mtk_start_dma(struct mtk_eth MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE; @@ -141,7 +141,7 @@ Signed-off-by: Jakub Kicinski val |= MTK_MUTLI_CNT | MTK_RESV_BUF | MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN; -@@ -3111,7 +3111,7 @@ static int mtk_open(struct net_device *d +@@ -3114,7 +3114,7 @@ static int mtk_open(struct net_device *d phylink_start(mac->phylink); netif_tx_start_all_queues(dev); @@ -150,7 +150,7 @@ Signed-off-by: Jakub Kicinski return 0; if (mtk_uses_dsa(dev) && !eth->prog) { -@@ -3376,7 +3376,7 @@ static void mtk_hw_reset(struct mtk_eth +@@ -3379,7 +3379,7 @@ static void mtk_hw_reset(struct mtk_eth { u32 val; @@ -159,7 +159,7 @@ Signed-off-by: Jakub Kicinski regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0); val = RSTCTRL_PPE0_V2; } else { -@@ -3388,7 +3388,7 @@ static void mtk_hw_reset(struct mtk_eth +@@ -3391,7 +3391,7 @@ static void mtk_hw_reset(struct mtk_eth ethsys_reset(eth, RSTCTRL_ETH | RSTCTRL_FE | val); @@ -168,7 +168,7 @@ Signed-off-by: Jakub Kicinski regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0x3ffffff); } -@@ -3414,7 +3414,7 @@ static void mtk_hw_warm_reset(struct mtk +@@ -3417,7 +3417,7 @@ static void mtk_hw_warm_reset(struct mtk return; } @@ -177,7 +177,7 @@ Signed-off-by: Jakub Kicinski rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0_V2; else rst_mask = RSTCTRL_ETH | RSTCTRL_PPE0; -@@ -3584,7 +3584,7 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3587,7 +3587,7 @@ static int mtk_hw_init(struct mtk_eth *e else mtk_hw_reset(eth); @@ -186,7 +186,7 @@ Signed-off-by: Jakub Kicinski /* Set FE to PDMAv2 if necessary */ val = mtk_r32(eth, MTK_FE_GLO_MISC); mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); -@@ -3621,7 +3621,7 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3624,7 +3624,7 @@ static int mtk_hw_init(struct mtk_eth *e */ val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL); @@ -195,7 +195,7 @@ Signed-off-by: Jakub Kicinski val = mtk_r32(eth, MTK_CDMP_IG_CTRL); mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); -@@ -3643,7 +3643,7 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3646,7 +3646,7 @@ static int mtk_hw_init(struct mtk_eth *e mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); @@ -204,7 +204,7 @@ Signed-off-by: Jakub Kicinski /* PSE should not drop port8 and port9 packets from WDMA Tx */ mtk_w32(eth, 0x00000300, PSE_DROP_CFG); -@@ -4432,7 +4432,7 @@ static int mtk_probe(struct platform_dev +@@ -4435,7 +4435,7 @@ static int mtk_probe(struct platform_dev } } @@ -213,7 +213,7 @@ Signed-off-by: Jakub Kicinski res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { err = -EINVAL; -@@ -4540,9 +4540,8 @@ static int mtk_probe(struct platform_dev +@@ -4543,9 +4543,8 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { @@ -224,7 +224,7 @@ Signed-off-by: Jakub Kicinski num_ppe = min_t(u32, ARRAY_SIZE(eth->ppe), num_ppe); for (i = 0; i < num_ppe; i++) { u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; -@@ -4636,6 +4635,7 @@ static const struct mtk_soc_data mt2701_ +@@ -4639,6 +4638,7 @@ static const struct mtk_soc_data mt2701_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, @@ -232,7 +232,7 @@ Signed-off-by: Jakub Kicinski .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4652,6 +4652,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4655,6 +4655,7 @@ static const struct mtk_soc_data mt7621_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, @@ -240,7 +240,7 @@ Signed-off-by: Jakub Kicinski .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, -@@ -4672,6 +4673,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4675,6 +4676,7 @@ static const struct mtk_soc_data mt7622_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, @@ -248,7 +248,7 @@ Signed-off-by: Jakub Kicinski .offload_version = 2, .hash_offset = 2, .has_accounting = true, -@@ -4692,6 +4694,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4695,6 +4697,7 @@ static const struct mtk_soc_data mt7623_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, @@ -256,7 +256,7 @@ Signed-off-by: Jakub Kicinski .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, -@@ -4714,6 +4717,7 @@ static const struct mtk_soc_data mt7629_ +@@ -4717,6 +4720,7 @@ static const struct mtk_soc_data mt7629_ .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, .has_accounting = true, @@ -264,7 +264,7 @@ Signed-off-by: Jakub Kicinski .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4731,6 +4735,7 @@ static const struct mtk_soc_data mt7981_ +@@ -4734,6 +4738,7 @@ static const struct mtk_soc_data mt7981_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7981_CLKS_BITMAP, .required_pctl = false, @@ -272,7 +272,7 @@ Signed-off-by: Jakub Kicinski .offload_version = 2, .hash_offset = 4, .has_accounting = true, -@@ -4752,6 +4757,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4755,6 +4760,7 @@ static const struct mtk_soc_data mt7986_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7986_CLKS_BITMAP, .required_pctl = false, @@ -280,7 +280,7 @@ Signed-off-by: Jakub Kicinski .offload_version = 2, .hash_offset = 4, .has_accounting = true, -@@ -4772,6 +4778,7 @@ static const struct mtk_soc_data rt5350_ +@@ -4775,6 +4781,7 @@ static const struct mtk_soc_data rt5350_ .hw_features = MTK_HW_FEATURES_MT7628, .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch b/target/linux/generic/backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch index 58729cec521510..281291252b45a5 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-07-net-ethernet-mtk_eth_soc-rely-on-MTK_MAX_DEVS-and-re.patch @@ -53,7 +53,7 @@ Signed-off-by: Jakub Kicinski !eth->netdev[mac])) goto release_desc; -@@ -2841,7 +2841,7 @@ static void mtk_dma_free(struct mtk_eth +@@ -2844,7 +2844,7 @@ static void mtk_dma_free(struct mtk_eth const struct mtk_soc_data *soc = eth->soc; int i; @@ -62,7 +62,7 @@ Signed-off-by: Jakub Kicinski if (eth->netdev[i]) netdev_reset_queue(eth->netdev[i]); if (eth->scratch_ring) { -@@ -2995,8 +2995,13 @@ static void mtk_gdm_config(struct mtk_et +@@ -2998,8 +2998,13 @@ static void mtk_gdm_config(struct mtk_et if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) return; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski /* default setup the forward port to send frame to PDMA */ val &= ~0xffff; -@@ -3006,7 +3011,7 @@ static void mtk_gdm_config(struct mtk_et +@@ -3009,7 +3014,7 @@ static void mtk_gdm_config(struct mtk_et val |= config; @@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski val |= MTK_GDMA_SPECIAL_TAG; mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i)); -@@ -3605,15 +3610,15 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3608,15 +3613,15 @@ static int mtk_hw_init(struct mtk_eth *e * up with the more appropriate value when mtk_mac_config call is being * invoked. */ @@ -109,7 +109,7 @@ Signed-off-by: Jakub Kicinski } /* Indicates CDM to parse the MTK special tag from CPU -@@ -3793,7 +3798,7 @@ static void mtk_pending_work(struct work +@@ -3796,7 +3801,7 @@ static void mtk_pending_work(struct work mtk_prepare_for_reset(eth); /* stop all devices to make sure that dma is properly shut down */ @@ -118,7 +118,7 @@ Signed-off-by: Jakub Kicinski if (!eth->netdev[i] || !netif_running(eth->netdev[i])) continue; -@@ -3809,8 +3814,8 @@ static void mtk_pending_work(struct work +@@ -3812,8 +3817,8 @@ static void mtk_pending_work(struct work mtk_hw_init(eth, true); /* restart DMA and enable IRQs */ @@ -129,7 +129,7 @@ Signed-off-by: Jakub Kicinski continue; if (mtk_open(eth->netdev[i])) { -@@ -3837,7 +3842,7 @@ static int mtk_free_dev(struct mtk_eth * +@@ -3840,7 +3845,7 @@ static int mtk_free_dev(struct mtk_eth * { int i; @@ -138,7 +138,7 @@ Signed-off-by: Jakub Kicinski if (!eth->netdev[i]) continue; free_netdev(eth->netdev[i]); -@@ -3856,7 +3861,7 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3859,7 +3864,7 @@ static int mtk_unreg_dev(struct mtk_eth { int i; @@ -147,7 +147,7 @@ Signed-off-by: Jakub Kicinski struct mtk_mac *mac; if (!eth->netdev[i]) continue; -@@ -4157,7 +4162,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4160,7 +4165,7 @@ static int mtk_add_mac(struct mtk_eth *e } id = be32_to_cpup(_id); @@ -156,7 +156,7 @@ Signed-off-by: Jakub Kicinski dev_err(eth->dev, "%d is not a valid mac id\n", id); return -EINVAL; } -@@ -4302,7 +4307,7 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -4305,7 +4310,7 @@ void mtk_eth_set_dma_device(struct mtk_e rtnl_lock(); @@ -165,7 +165,7 @@ Signed-off-by: Jakub Kicinski dev = eth->netdev[i]; if (!dev || !(dev->flags & IFF_UP)) -@@ -4610,7 +4615,7 @@ static int mtk_remove(struct platform_de +@@ -4613,7 +4618,7 @@ static int mtk_remove(struct platform_de int i; /* stop all devices to make sure that dma is properly shut down */ diff --git a/target/linux/generic/backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch b/target/linux/generic/backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch index 09f59c291ce92d..abfda59339a186 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-08-net-ethernet-mtk_eth_soc-add-NETSYS_V3-version-suppo.patch @@ -167,7 +167,7 @@ Signed-off-by: Jakub Kicinski budget--; } -@@ -3648,7 +3676,24 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3651,7 +3679,24 @@ static int mtk_hw_init(struct mtk_eth *e mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); @@ -193,7 +193,7 @@ Signed-off-by: Jakub Kicinski /* PSE should not drop port8 and port9 packets from WDMA Tx */ mtk_w32(eth, 0x00000300, PSE_DROP_CFG); -@@ -4210,7 +4255,11 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4213,7 +4258,11 @@ static int mtk_add_mac(struct mtk_eth *e } spin_lock_init(&mac->hw_stats->stats_lock); u64_stats_init(&mac->hw_stats->syncp); diff --git a/target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch b/target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch index 028c28b1f74c52..cc08ef133882b5 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-11-net-ethernet-mtk_eth_soc-add-basic-support-for-MT798.patch @@ -263,7 +263,7 @@ Signed-off-by: Jakub Kicinski data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid); WRITE_ONCE(desc->txd4, data); -@@ -4304,6 +4433,17 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4307,6 +4436,17 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.supported_interfaces); } @@ -281,7 +281,7 @@ Signed-off-by: Jakub Kicinski phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4826,6 +4966,24 @@ static const struct mtk_soc_data mt7986_ +@@ -4829,6 +4969,24 @@ static const struct mtk_soc_data mt7986_ }, }; @@ -306,7 +306,7 @@ Signed-off-by: Jakub Kicinski static const struct mtk_soc_data rt5350_data = { .reg_map = &mt7628_reg_map, .caps = MT7628_CAPS, -@@ -4844,14 +5002,15 @@ static const struct mtk_soc_data rt5350_ +@@ -4847,14 +5005,15 @@ static const struct mtk_soc_data rt5350_ }; const struct of_device_id of_mtk_match[] = { diff --git a/target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch b/target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch index b32670d7a49604..ebfb1f0c35c45e 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-13-net-ethernet-mtk_eth_soc-enable-nft-hw-flowtable_off.patch @@ -18,7 +18,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4974,6 +4974,9 @@ static const struct mtk_soc_data mt7988_ +@@ -4977,6 +4977,9 @@ static const struct mtk_soc_data mt7988_ .required_clks = MT7988_CLKS_BITMAP, .required_pctl = false, .version = 3, diff --git a/target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch b/target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch index f314550af64c31..aab3b848a6c7f8 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-14-net-ethernet-mtk_eth_soc-support-per-flow-accounting.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4976,6 +4976,7 @@ static const struct mtk_soc_data mt7988_ +@@ -4979,6 +4979,7 @@ static const struct mtk_soc_data mt7988_ .version = 3, .offload_version = 2, .hash_offset = 4, diff --git a/target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch b/target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch index 5f6651b7b02cf0..2d750abb45ab85 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-17-net-ethernet-mtk_eth_soc-add-reset-bits-for-MT7988.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3538,19 +3538,34 @@ static void mtk_hw_reset(struct mtk_eth +@@ -3541,19 +3541,34 @@ static void mtk_hw_reset(struct mtk_eth { u32 val; @@ -56,7 +56,7 @@ Signed-off-by: Jakub Kicinski regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN, 0x3ffffff); } -@@ -3576,13 +3591,21 @@ static void mtk_hw_warm_reset(struct mtk +@@ -3579,13 +3594,21 @@ static void mtk_hw_warm_reset(struct mtk return; } @@ -83,7 +83,7 @@ Signed-off-by: Jakub Kicinski regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL, rst_mask, rst_mask); -@@ -3934,11 +3957,17 @@ static void mtk_prepare_for_reset(struct +@@ -3937,11 +3960,17 @@ static void mtk_prepare_for_reset(struct u32 val; int i; @@ -106,7 +106,7 @@ Signed-off-by: Jakub Kicinski /* adjust PPE configurations to prepare for reset */ for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) -@@ -3999,11 +4028,18 @@ static void mtk_pending_work(struct work +@@ -4002,11 +4031,18 @@ static void mtk_pending_work(struct work } } diff --git a/target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch b/target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch index 67ba1a5f0a57cb..52bd017300836b 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-18-net-ethernet-mtk_eth_soc-add-support-for-in-SoC-SRAM.patch @@ -123,7 +123,7 @@ Signed-off-by: Jakub Kicinski dma_free_coherent(eth->dma_dev, ring->dma_size * eth->soc->txrx.rxd_size, ring->dma, ring->phys); -@@ -3001,7 +3025,7 @@ static void mtk_dma_free(struct mtk_eth +@@ -3004,7 +3028,7 @@ static void mtk_dma_free(struct mtk_eth for (i = 0; i < MTK_MAX_DEVS; i++) if (eth->netdev[i]) netdev_reset_queue(eth->netdev[i]); @@ -132,7 +132,7 @@ Signed-off-by: Jakub Kicinski dma_free_coherent(eth->dma_dev, MTK_QDMA_RING_SIZE * soc->txrx.txd_size, eth->scratch_ring, eth->phy_scratch_ring); -@@ -3009,13 +3033,13 @@ static void mtk_dma_free(struct mtk_eth +@@ -3012,13 +3036,13 @@ static void mtk_dma_free(struct mtk_eth eth->phy_scratch_ring = 0; } mtk_tx_clean(eth); @@ -149,7 +149,7 @@ Signed-off-by: Jakub Kicinski } kfree(eth->scratch_head); -@@ -4585,7 +4609,7 @@ static int mtk_sgmii_init(struct mtk_eth +@@ -4588,7 +4612,7 @@ static int mtk_sgmii_init(struct mtk_eth static int mtk_probe(struct platform_device *pdev) { @@ -158,7 +158,7 @@ Signed-off-by: Jakub Kicinski struct device_node *mac_np; struct mtk_eth *eth; int err, i; -@@ -4605,6 +4629,20 @@ static int mtk_probe(struct platform_dev +@@ -4608,6 +4632,20 @@ static int mtk_probe(struct platform_dev if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) eth->ip_align = NET_IP_ALIGN; @@ -179,7 +179,7 @@ Signed-off-by: Jakub Kicinski spin_lock_init(ð->page_lock); spin_lock_init(ð->tx_irq_lock); spin_lock_init(ð->rx_irq_lock); -@@ -4668,6 +4706,18 @@ static int mtk_probe(struct platform_dev +@@ -4671,6 +4709,18 @@ static int mtk_probe(struct platform_dev err = -EINVAL; goto err_destroy_sgmii; } diff --git a/target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch b/target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch index 175db56c37bf8c..26c5889545459b 100644 --- a/target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch +++ b/target/linux/generic/backport-5.15/750-v6.5-19-net-ethernet-mtk_eth_soc-support-36-bit-DMA-addressi.patch @@ -90,7 +90,7 @@ Signed-off-by: Jakub Kicinski ring->buf_size, DMA_FROM_DEVICE); mtk_rx_put_buff(ring, ring->data[i], false); } -@@ -4643,6 +4661,14 @@ static int mtk_probe(struct platform_dev +@@ -4646,6 +4664,14 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/hack-5.15/410-block-fit-partition-parser.patch b/target/linux/generic/hack-5.15/410-block-fit-partition-parser.patch index 96c89f41c48f78..13a16b6fa08240 100644 --- a/target/linux/generic/hack-5.15/410-block-fit-partition-parser.patch +++ b/target/linux/generic/hack-5.15/410-block-fit-partition-parser.patch @@ -105,7 +105,7 @@ Subject: [PATCH] kernel: add block fit partition parser /* everything is up and running, commence */ err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL); if (err) -@@ -598,6 +610,11 @@ static bool blk_add_partition(struct gen +@@ -595,6 +607,11 @@ static bool blk_add_partition(struct gen (state->parts[p].flags & ADDPART_FLAG_RAID)) md_autodetect_dev(part->bd_dev); diff --git a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch index f61c078521e2ce..383dfe397ff432 100644 --- a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch +++ b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch @@ -22,7 +22,7 @@ Signed-off-by: David Bauer #include #include #include -@@ -6886,6 +6887,22 @@ static void rtl_tally_reset(struct r8152 +@@ -6889,6 +6890,22 @@ static void rtl_tally_reset(struct r8152 ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data); } @@ -45,7 +45,7 @@ Signed-off-by: David Bauer static void r8152b_init(struct r8152 *tp) { u32 ocp_data; -@@ -6927,6 +6944,8 @@ static void r8152b_init(struct r8152 *tp +@@ -6930,6 +6947,8 @@ static void r8152b_init(struct r8152 *tp ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); @@ -54,7 +54,7 @@ Signed-off-by: David Bauer } static void r8153_init(struct r8152 *tp) -@@ -7067,6 +7086,8 @@ static void r8153_init(struct r8152 *tp) +@@ -7070,6 +7089,8 @@ static void r8153_init(struct r8152 *tp) tp->coalesce = COALESCE_SLOW; break; } @@ -63,7 +63,7 @@ Signed-off-by: David Bauer } static void r8153b_init(struct r8152 *tp) -@@ -7149,6 +7170,8 @@ static void r8153b_init(struct r8152 *tp +@@ -7152,6 +7173,8 @@ static void r8153b_init(struct r8152 *tp rtl_tally_reset(tp); tp->coalesce = 15000; /* 15 us */ diff --git a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch index 5c1ce01a2ce93d..11f4f556e86391 100644 --- a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch @@ -77,7 +77,7 @@ Signed-off-by: Felix Fietkau INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *, u32)); INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *, -@@ -1986,9 +2000,11 @@ static void __sk_free(struct sock *sk) +@@ -1987,9 +2001,11 @@ static void __sk_free(struct sock *sk) if (likely(sk->sk_net_refcnt)) sock_inuse_add(sock_net(sk), -1); diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index 7528df483e5279..58c2026c48e2c8 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -235,7 +235,7 @@ Signed-off-by: Felix Fietkau if (!pe) --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -3968,6 +3968,8 @@ static const struct seq_operations vmall +@@ -3986,6 +3986,8 @@ static const struct seq_operations vmall static int __init proc_vmalloc_init(void) { @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3880,6 +3880,8 @@ static __net_initdata struct pernet_oper +@@ -3881,6 +3881,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { @@ -341,7 +341,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -3024,11 +3024,13 @@ static const struct seq_operations fib_r +@@ -3025,11 +3025,13 @@ static const struct seq_operations fib_r int __net_init fib_proc_init(struct net *net) { @@ -357,7 +357,7 @@ Signed-off-by: Felix Fietkau fib_triestat_seq_show, NULL)) goto out2; -@@ -3039,17 +3041,21 @@ int __net_init fib_proc_init(struct net +@@ -3040,17 +3042,21 @@ int __net_init fib_proc_init(struct net return 0; out3: diff --git a/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch b/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch index d12bc9c3d59b6c..0a12132de36b56 100644 --- a/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch +++ b/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch @@ -193,7 +193,7 @@ Reported-by: Dan Carpenter default y --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -1271,6 +1271,8 @@ static u8 spi_nor_convert_3to4_erase(u8 +@@ -1272,6 +1272,8 @@ static u8 spi_nor_convert_3to4_erase(u8 static bool spi_nor_has_uniform_erase(const struct spi_nor *nor) { @@ -202,7 +202,7 @@ Reported-by: Dan Carpenter return !!nor->params->erase_map.uniform_erase_type; } -@@ -2400,6 +2402,7 @@ static int spi_nor_select_erase(struct s +@@ -2401,6 +2403,7 @@ static int spi_nor_select_erase(struct s { struct spi_nor_erase_map *map = &nor->params->erase_map; const struct spi_nor_erase_type *erase = NULL; @@ -210,7 +210,7 @@ Reported-by: Dan Carpenter struct mtd_info *mtd = &nor->mtd; u32 wanted_size = nor->info->sector_size; int i; -@@ -2432,8 +2435,9 @@ static int spi_nor_select_erase(struct s +@@ -2433,8 +2436,9 @@ static int spi_nor_select_erase(struct s */ for (i = SNOR_ERASE_TYPE_MAX - 1; i >= 0; i--) { if (map->erase_type[i].size) { @@ -222,7 +222,7 @@ Reported-by: Dan Carpenter } } -@@ -2441,6 +2445,9 @@ static int spi_nor_select_erase(struct s +@@ -2442,6 +2446,9 @@ static int spi_nor_select_erase(struct s return -EINVAL; mtd->erasesize = erase->size; diff --git a/target/linux/generic/pending-5.15/479-mtd-spi-nor-add-xtx-xt25f128b.patch b/target/linux/generic/pending-5.15/479-mtd-spi-nor-add-xtx-xt25f128b.patch index 5a064b714bfdcd..3e1958c8a09267 100644 --- a/target/linux/generic/pending-5.15/479-mtd-spi-nor-add-xtx-xt25f128b.patch +++ b/target/linux/generic/pending-5.15/479-mtd-spi-nor-add-xtx-xt25f128b.patch @@ -59,7 +59,7 @@ Signed-off-by: Felix Fietkau +}; --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -1859,6 +1859,7 @@ static const struct spi_nor_manufacturer +@@ -1860,6 +1860,7 @@ static const struct spi_nor_manufacturer &spi_nor_winbond, &spi_nor_xilinx, &spi_nor_xmc, diff --git a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 86bd9664e55552..351d5864a1f8b1 100644 --- a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski static void rt_fibinfo_free(struct rtable __rcu **rtp) --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -2772,6 +2772,7 @@ static const char *const rtn_type_names[ +@@ -2773,6 +2773,7 @@ static const char *const rtn_type_names[ [RTN_THROW] = "THROW", [RTN_NAT] = "NAT", [RTN_XRESOLVE] = "XRESOLVE", diff --git a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 9a1c26e7aeb36a..0580cf1a843c13 100644 --- a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3095,8 +3095,8 @@ static irqreturn_t mtk_handle_irq_rx(int +@@ -3098,8 +3098,8 @@ static irqreturn_t mtk_handle_irq_rx(int eth->rx_events++; if (likely(napi_schedule_prep(ð->rx_napi))) { @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -3108,8 +3108,8 @@ static irqreturn_t mtk_handle_irq_tx(int +@@ -3111,8 +3111,8 @@ static irqreturn_t mtk_handle_irq_tx(int eth->tx_events++; if (likely(napi_schedule_prep(ð->tx_napi))) { @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -4883,6 +4883,8 @@ static int mtk_probe(struct platform_dev +@@ -4886,6 +4886,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch index 452e486e8969e2..2de28b11dd0913 100644 --- a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch +++ b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau switch (speed) { case SPEED_2500: case SPEED_1000: -@@ -3288,6 +3289,9 @@ found: +@@ -3291,6 +3292,9 @@ found: if (dp->index >= MTK_QDMA_NUM_QUEUES) return NOTIFY_DONE; diff --git a/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index 5b7591e22735c4..88d17447706662 100644 --- a/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -478,7 +478,7 @@ Signed-off-by: Daniel Golle static const struct phylink_mac_ops mtk_phylink_ops = { .validate = phylink_generic_validate, .mac_select_pcs = mtk_mac_select_pcs, -@@ -4558,8 +4672,21 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4561,8 +4675,21 @@ static int mtk_add_mac(struct mtk_eth *e phy_interface_zero(mac->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_INTERNAL, mac->phylink_config.supported_interfaces); @@ -500,7 +500,7 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4752,6 +4879,13 @@ static int mtk_probe(struct platform_dev +@@ -4755,6 +4882,13 @@ static int mtk_probe(struct platform_dev if (err) return err; diff --git a/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch index f2bfd14b18de31..2a57a7ef03505a 100644 --- a/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch +++ b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch @@ -17,7 +17,7 @@ Signed-off-by: Alexander Duyck --- a/net/core/skbuff.c +++ b/net/core/skbuff.c -@@ -4352,6 +4352,15 @@ int skb_gro_receive(struct sk_buff *p, s +@@ -4358,6 +4358,15 @@ int skb_gro_receive(struct sk_buff *p, s if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush)) return -E2BIG; diff --git a/target/linux/ipq806x/patches-5.15/111-v5.19-01-PM-devfreq-Export-devfreq_get_freq_range-symbol-with.patch b/target/linux/ipq806x/patches-5.15/111-v5.19-01-PM-devfreq-Export-devfreq_get_freq_range-symbol-with.patch index 6b7a68952eaf7a..12d5191b0bb503 100644 --- a/target/linux/ipq806x/patches-5.15/111-v5.19-01-PM-devfreq-Export-devfreq_get_freq_range-symbol-with.patch +++ b/target/linux/ipq806x/patches-5.15/111-v5.19-01-PM-devfreq-Export-devfreq_get_freq_range-symbol-with.patch @@ -56,7 +56,7 @@ Signed-off-by: Chanwoo Choi if (freq < min_freq) { freq = min_freq; -@@ -784,6 +785,7 @@ struct devfreq *devfreq_add_device(struc +@@ -785,6 +786,7 @@ struct devfreq *devfreq_add_device(struc { struct devfreq *devfreq; struct devfreq_governor *governor; @@ -64,7 +64,7 @@ Signed-off-by: Chanwoo Choi int err = 0; if (!dev || !profile || !governor_name) { -@@ -848,6 +850,8 @@ struct devfreq *devfreq_add_device(struc +@@ -849,6 +851,8 @@ struct devfreq *devfreq_add_device(struc goto err_dev; } @@ -73,7 +73,7 @@ Signed-off-by: Chanwoo Choi devfreq->suspend_freq = dev_pm_opp_get_suspend_opp_freq(dev); devfreq->opp_table = dev_pm_opp_get_opp_table(dev); if (IS_ERR(devfreq->opp_table)) -@@ -1559,7 +1563,7 @@ static ssize_t min_freq_show(struct devi +@@ -1560,7 +1564,7 @@ static ssize_t min_freq_show(struct devi unsigned long min_freq, max_freq; mutex_lock(&df->lock); @@ -82,7 +82,7 @@ Signed-off-by: Chanwoo Choi mutex_unlock(&df->lock); return sprintf(buf, "%lu\n", min_freq); -@@ -1613,7 +1617,7 @@ static ssize_t max_freq_show(struct devi +@@ -1614,7 +1618,7 @@ static ssize_t max_freq_show(struct devi unsigned long min_freq, max_freq; mutex_lock(&df->lock); @@ -91,7 +91,7 @@ Signed-off-by: Chanwoo Choi mutex_unlock(&df->lock); return sprintf(buf, "%lu\n", max_freq); -@@ -1927,7 +1931,7 @@ static int devfreq_summary_show(struct s +@@ -1928,7 +1932,7 @@ static int devfreq_summary_show(struct s mutex_lock(&devfreq->lock); cur_freq = devfreq->previous_freq; diff --git a/target/linux/ipq806x/patches-5.15/113-v5.19-03-PM-devfreq-Rework-freq_table-to-be-local-to-devfr.patch b/target/linux/ipq806x/patches-5.15/113-v5.19-03-PM-devfreq-Rework-freq_table-to-be-local-to-devfr.patch index 210f57bd7e65d7..c076845a00de91 100644 --- a/target/linux/ipq806x/patches-5.15/113-v5.19-03-PM-devfreq-Rework-freq_table-to-be-local-to-devfr.patch +++ b/target/linux/ipq806x/patches-5.15/113-v5.19-03-PM-devfreq-Rework-freq_table-to-be-local-to-devfr.patch @@ -126,7 +126,7 @@ Signed-off-by: Christian 'Ansuel' Marangi devfreq->stats.total_trans++; } -@@ -834,6 +830,9 @@ struct devfreq *devfreq_add_device(struc +@@ -835,6 +831,9 @@ struct devfreq *devfreq_add_device(struc if (err < 0) goto err_dev; mutex_lock(&devfreq->lock); @@ -136,7 +136,7 @@ Signed-off-by: Christian 'Ansuel' Marangi } devfreq->scaling_min_freq = find_available_min_freq(devfreq); -@@ -869,8 +868,8 @@ struct devfreq *devfreq_add_device(struc +@@ -870,8 +869,8 @@ struct devfreq *devfreq_add_device(struc devfreq->stats.trans_table = devm_kzalloc(&devfreq->dev, array3_size(sizeof(unsigned int), @@ -147,7 +147,7 @@ Signed-off-by: Christian 'Ansuel' Marangi GFP_KERNEL); if (!devfreq->stats.trans_table) { mutex_unlock(&devfreq->lock); -@@ -879,7 +878,7 @@ struct devfreq *devfreq_add_device(struc +@@ -880,7 +879,7 @@ struct devfreq *devfreq_add_device(struc } devfreq->stats.time_in_state = devm_kcalloc(&devfreq->dev, @@ -156,7 +156,7 @@ Signed-off-by: Christian 'Ansuel' Marangi sizeof(*devfreq->stats.time_in_state), GFP_KERNEL); if (!devfreq->stats.time_in_state) { -@@ -1637,9 +1636,9 @@ static ssize_t available_frequencies_sho +@@ -1638,9 +1637,9 @@ static ssize_t available_frequencies_sho mutex_lock(&df->lock); @@ -168,7 +168,7 @@ Signed-off-by: Christian 'Ansuel' Marangi mutex_unlock(&df->lock); /* Truncate the trailing space */ -@@ -1662,7 +1661,7 @@ static ssize_t trans_stat_show(struct de +@@ -1663,7 +1662,7 @@ static ssize_t trans_stat_show(struct de if (!df->profile) return -EINVAL; @@ -177,7 +177,7 @@ Signed-off-by: Christian 'Ansuel' Marangi if (max_state == 0) return sprintf(buf, "Not Supported.\n"); -@@ -1679,19 +1678,17 @@ static ssize_t trans_stat_show(struct de +@@ -1680,19 +1679,17 @@ static ssize_t trans_stat_show(struct de len += sprintf(buf + len, " :"); for (i = 0; i < max_state; i++) len += sprintf(buf + len, "%10lu", @@ -202,7 +202,7 @@ Signed-off-by: Christian 'Ansuel' Marangi for (j = 0; j < max_state; j++) len += sprintf(buf + len, "%10u", df->stats.trans_table[(i * max_state) + j]); -@@ -1715,7 +1712,7 @@ static ssize_t trans_stat_store(struct d +@@ -1716,7 +1713,7 @@ static ssize_t trans_stat_store(struct d if (!df->profile) return -EINVAL; @@ -211,7 +211,7 @@ Signed-off-by: Christian 'Ansuel' Marangi return count; err = kstrtoint(buf, 10, &value); -@@ -1723,11 +1720,11 @@ static ssize_t trans_stat_store(struct d +@@ -1724,11 +1721,11 @@ static ssize_t trans_stat_store(struct d return -EINVAL; mutex_lock(&df->lock); diff --git a/target/linux/ipq806x/patches-5.15/113-v5.19-04-PM-devfreq-Mute-warning-on-governor-PROBE_DEFER.patch b/target/linux/ipq806x/patches-5.15/113-v5.19-04-PM-devfreq-Mute-warning-on-governor-PROBE_DEFER.patch index 591340c6f225f0..cfdef8d6c54927 100644 --- a/target/linux/ipq806x/patches-5.15/113-v5.19-04-PM-devfreq-Mute-warning-on-governor-PROBE_DEFER.patch +++ b/target/linux/ipq806x/patches-5.15/113-v5.19-04-PM-devfreq-Mute-warning-on-governor-PROBE_DEFER.patch @@ -14,7 +14,7 @@ Signed-off-by: Christian 'Ansuel' Marangi --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c -@@ -930,8 +930,9 @@ struct devfreq *devfreq_add_device(struc +@@ -931,8 +931,9 @@ struct devfreq *devfreq_add_device(struc err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START, NULL); if (err) { diff --git a/target/linux/mediatek/patches-5.15/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch b/target/linux/mediatek/patches-5.15/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch index 25a7cd38614d26..61712982fb2607 100644 --- a/target/linux/mediatek/patches-5.15/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch +++ b/target/linux/mediatek/patches-5.15/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch @@ -26,7 +26,7 @@ Signed-off-by: SkyLake.Huang --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -3060,6 +3060,18 @@ static void spi_nor_debugfs_init(struct +@@ -3061,6 +3061,18 @@ static void spi_nor_debugfs_init(struct info->id_len, info->id); } @@ -45,7 +45,7 @@ Signed-off-by: SkyLake.Huang static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor, const char *name) { -@@ -3133,6 +3145,9 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3134,6 +3146,9 @@ int spi_nor_scan(struct spi_nor *nor, co if (!nor->bouncebuf) return -ENOMEM; diff --git a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index 163bafdb2e5b34..7db6346c37e418 100644 --- a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -3107,6 +3107,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3108,6 +3108,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -3161,7 +3162,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3162,7 +3163,12 @@ int spi_nor_scan(struct spi_nor *nor, co if (ret) return ret; diff --git a/target/linux/ramips/patches-5.15/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch b/target/linux/ramips/patches-5.15/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch index 4fd05fe64ed74e..4cbb84efc6ca7a 100644 --- a/target/linux/ramips/patches-5.15/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch +++ b/target/linux/ramips/patches-5.15/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch @@ -55,7 +55,7 @@ Signed-off-by: David Bauer +}; --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -1843,6 +1843,7 @@ int spi_nor_sr2_bit7_quad_enable(struct +@@ -1844,6 +1844,7 @@ int spi_nor_sr2_bit7_quad_enable(struct static const struct spi_nor_manufacturer *manufacturers[] = { &spi_nor_atmel, diff --git a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch index c458237f3902e8..044a97ab2bd4da 100644 --- a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4553,6 +4553,7 @@ static const struct net_device_ops mtk_n +@@ -4556,6 +4556,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -4724,6 +4725,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4727,6 +4728,9 @@ static int mtk_add_mac(struct mtk_eth *e register_netdevice_notifier(&mac->device_notifier); } diff --git a/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch b/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch index c63c165cd28449..7d063d4faaa3df 100644 --- a/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch +++ b/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch @@ -13,7 +13,7 @@ Submitted-by: Markus Stockhausen --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig -@@ -405,6 +405,7 @@ source "drivers/clk/mstar/Kconfig" +@@ -406,6 +406,7 @@ source "drivers/clk/mstar/Kconfig" source "drivers/clk/mvebu/Kconfig" source "drivers/clk/pistachio/Kconfig" source "drivers/clk/qcom/Kconfig" diff --git a/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch b/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch index 045d2d0dbd9ae3..6806bb8a8a6294 100644 --- a/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch +++ b/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch @@ -11,7 +11,7 @@ Applies to vanilla kernel 3.9.4. =============================================================================== --- a/arch/um/drivers/Kconfig +++ b/arch/um/drivers/Kconfig -@@ -146,6 +146,20 @@ config UML_NET +@@ -136,6 +136,20 @@ config UML_NET enable at least one of the following transport options to actually make use of UML networking. From 34d8a7f63fe6cb7b760e80f9a01d3614bcfc8115 Mon Sep 17 00:00:00 2001 From: Oskari Lemmela Date: Mon, 21 Aug 2023 08:41:37 +0300 Subject: [PATCH 0470/1171] ipq806x: 5.15: revert upstream commit to fix #11676 Commit d5a05e69ac6e4 ("net: stmmac: Use hrtimer for TX coalescing") causes high CPU usage due to hrtimer raw spin locks. Fixes: #11676 Signed-off-by: Oskari Lemmela [ renumber and rename revert patch ] Signed-off-by: Christian Marangi --- ...stmmac-Use-hrtimer-for-TX-coalescing.patch | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch diff --git a/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch b/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch new file mode 100644 index 00000000000000..11360c92a66e2e --- /dev/null +++ b/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch @@ -0,0 +1,155 @@ +From 0db3e9ac75b107d2158b227426f58df9bb00529f Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Sun, 20 Aug 2023 15:25:09 +0300 +Subject: [PATCH] Revert "net: stmmac: Use hrtimer for TX coalescing" + +This reverts commit d5a05e69ac6e4c431c380ced2b534c91f7bc3280. + +hrtimer uses raw_spin_lock which causes high CPU usage. +ipq806x platform's TCP transmit speed dropped from 950 Mbps to 250 Mbps +due to high ksoftirq. + +Signed-off-by: Oskari Lemmela +--- + drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +-- + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 25 +++++++------------ + 2 files changed, 10 insertions(+), 18 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h +@@ -13,7 +13,6 @@ + #define DRV_MODULE_VERSION "Jan_2016" + + #include +-#include + #include + #include + #include +@@ -59,7 +58,7 @@ struct stmmac_tx_info { + struct stmmac_tx_queue { + u32 tx_count_frames; + int tbs; +- struct hrtimer txtimer; ++ struct timer_list txtimer; + u32 queue_index; + struct stmmac_priv *priv_data; + struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -142,7 +142,7 @@ static void stmmac_init_fs(struct net_de + static void stmmac_exit_fs(struct net_device *dev); + #endif + +-#define STMMAC_COAL_TIMER(x) (ns_to_ktime((x) * NSEC_PER_USEC)) ++#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x)) + + int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled) + { +@@ -2725,9 +2725,7 @@ static int stmmac_tx_clean(struct stmmac + + /* We still have pending packets, let's call for a new scheduling */ + if (tx_q->dirty_tx != tx_q->cur_tx) +- hrtimer_start(&tx_q->txtimer, +- STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), +- HRTIMER_MODE_REL); ++ mod_timer(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer[queue])); + + __netif_tx_unlock_bh(netdev_get_tx_queue(priv->dev, queue)); + +@@ -3019,9 +3017,7 @@ static void stmmac_tx_timer_arm(struct s + { + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; + +- hrtimer_start(&tx_q->txtimer, +- STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), +- HRTIMER_MODE_REL); ++ mod_timer(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer[queue])); + } + + /** +@@ -3030,9 +3026,9 @@ static void stmmac_tx_timer_arm(struct s + * Description: + * This is the timer handler to directly invoke the stmmac_tx_clean. + */ +-static enum hrtimer_restart stmmac_tx_timer(struct hrtimer *t) ++static void stmmac_tx_timer(struct timer_list *t) + { +- struct stmmac_tx_queue *tx_q = container_of(t, struct stmmac_tx_queue, txtimer); ++ struct stmmac_tx_queue *tx_q = from_timer(tx_q, t, txtimer); + struct stmmac_priv *priv = tx_q->priv_data; + struct stmmac_channel *ch; + struct napi_struct *napi; +@@ -3048,8 +3044,6 @@ static enum hrtimer_restart stmmac_tx_ti + spin_unlock_irqrestore(&ch->lock, flags); + __napi_schedule(napi); + } +- +- return HRTIMER_NORESTART; + } + + /** +@@ -3072,8 +3066,7 @@ static void stmmac_init_coalesce(struct + priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES; + priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER; + +- hrtimer_init(&tx_q->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); +- tx_q->txtimer.function = stmmac_tx_timer; ++ timer_setup(&tx_q->txtimer, stmmac_tx_timer, 0); + } + + for (chan = 0; chan < rx_channel_count; chan++) +@@ -3902,7 +3895,7 @@ irq_error: + phylink_stop(priv->phylink); + + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) +- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); ++ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer); + + stmmac_hw_teardown(dev); + init_error: +@@ -3958,7 +3951,7 @@ static int stmmac_release(struct net_dev + stmmac_disable_all_queues(priv); + + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) +- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); ++ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer); + + netif_tx_disable(dev); + +@@ -6655,7 +6648,7 @@ void stmmac_xdp_release(struct net_devic + stmmac_disable_all_queues(priv); + + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) +- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); ++ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer); + + /* Free the IRQ lines */ + stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); +@@ -6750,8 +6743,7 @@ int stmmac_xdp_open(struct net_device *d + stmmac_set_tx_tail_ptr(priv, priv->ioaddr, + tx_q->tx_tail_addr, chan); + +- hrtimer_init(&tx_q->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); +- tx_q->txtimer.function = stmmac_tx_timer; ++ timer_setup(&tx_q->txtimer, stmmac_tx_timer, 0); + } + + /* Enable the MAC Rx/Tx */ +@@ -6774,7 +6766,7 @@ int stmmac_xdp_open(struct net_device *d + + irq_error: + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) +- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); ++ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer); + + stmmac_hw_teardown(dev); + init_error: +@@ -7495,7 +7487,7 @@ int stmmac_suspend(struct device *dev) + stmmac_disable_all_queues(priv); + + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) +- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); ++ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer); + + if (priv->eee_enabled) { + priv->tx_path_in_lpi_mode = false; From f4e4943d1ab6e38e3fcfc611d2665d5077a479b6 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 25 Sep 2023 20:58:04 +0200 Subject: [PATCH 0471/1171] mpc85xx: drop WS-AP3715i label-mac Label MAC detection does not work properly, as MAC address is assigned on preinit. Thus, remove the label-mac definition. Signed-off-by: David Bauer (cherry picked from commit cd14b17cb00cda45819739aa63422a090e3f80e1) --- target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts index d13952acae8565..a8a4118b003cd9 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts @@ -13,7 +13,6 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_red; - label-mac-device = &enet0; }; chosen { From 849f0ea65c8fa99ce01ea87450daf628c2628a01 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 25 Sep 2023 15:36:29 +0200 Subject: [PATCH 0472/1171] hostapd: fix rare crash with AP+STA and ACS enabled Ensure that the iface disable in uc_hostapd_iface_start also clears the ACS state. Signed-off-by: Felix Fietkau (cherry picked from commit f1bb528ae7631c60b95499b7e8a1948c3e6a42f0) --- .../services/hostapd/src/src/ap/ucode.c | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index ac3222b03f80dd..af97091be55e82 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -465,17 +465,10 @@ uc_hostapd_bss_ctrl(uc_vm_t *vm, size_t nargs) return ucv_string_new_length(reply, reply_len); } -static uc_value_t * -uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) +static void +uc_hostapd_disable_iface(struct hostapd_iface *iface) { - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - int i; - - if (!iface) - return NULL; - switch (iface->state) { - case HAPD_IFACE_ENABLED: case HAPD_IFACE_DISABLED: break; #ifdef CONFIG_ACS @@ -488,9 +481,19 @@ uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) hostapd_disable_iface(iface); break; } +} + +static uc_value_t * +uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + int i; + + if (!iface) + return NULL; if (iface->state != HAPD_IFACE_ENABLED) - hostapd_disable_iface(iface); + uc_hostapd_disable_iface(iface); for (i = 0; i < iface->num_bss; i++) { struct hostapd_data *hapd = iface->bss[i]; @@ -561,8 +564,6 @@ uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) out: switch (iface->state) { - case HAPD_IFACE_DISABLED: - break; case HAPD_IFACE_ENABLED: if (!hostapd_is_dfs_required(iface) || hostapd_is_dfs_chan_available(iface)) @@ -570,7 +571,7 @@ uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface"); /* fallthrough */ default: - hostapd_disable_iface(iface); + uc_hostapd_disable_iface(iface); break; } From 782341458c25edc4d4233bf70c950918380a0b97 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 27 Sep 2023 15:03:16 +0200 Subject: [PATCH 0473/1171] hostapd: fix mac address of interfaces created via wdev.uc Use the wdev config with the generated MAC address Signed-off-by: Felix Fietkau (cherry picked from commit 0c43a48735959245f18d79a6e908d3b45cff0a94) --- package/network/services/hostapd/files/wdev.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/files/wdev.uc b/package/network/services/hostapd/files/wdev.uc index 8a031b40b9ee2d..cf438f7715fc67 100644 --- a/package/network/services/hostapd/files/wdev.uc +++ b/package/network/services/hostapd/files/wdev.uc @@ -41,7 +41,7 @@ function iface_start(wdev) wdev_config[key] = wdev[key]; if (!wdev_config.macaddr && wdev.mode != "monitor") wdev_config.macaddr = phydev.macaddr_next(); - wdev_create(phy, ifname, wdev); + wdev_create(phy, ifname, wdev_config); system([ "ip", "link", "set", "dev", ifname, "up" ]); if (wdev.freq) system(`iw dev ${ifname} set freq ${wdev.freq} ${wdev.htmode}`); From 388d2133926d1a85a423c83b8fcffb0e26b5681f Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 18 Sep 2023 22:53:14 +0200 Subject: [PATCH 0474/1171] packages: assign PKG_CPE_ID for all missing packages The PKG_CPE_ID links to NIST CPE version 2.2. Assign PKG_CPE_ID to all remaining package which have a CPE ID. Not every package has CPE id. Related: https://github.com/openwrt/packages/issues/8534 Signed-off-by: Alexander Couzens --- package/firmware/intel-microcode/Makefile | 1 + package/libs/gmp/Makefile | 1 + package/libs/libbpf/Makefile | 1 + package/libs/libbsd/Makefile | 1 + package/libs/libnetfilter-conntrack/Makefile | 1 + package/libs/libpcap/Makefile | 1 + package/network/utils/ebtables/Makefile | 1 + package/network/utils/ipset/Makefile | 1 + package/network/utils/iw/Makefile | 1 + package/utils/adb/Makefile | 1 + package/utils/bsdiff/Makefile | 1 + package/utils/dtc/Makefile | 1 + package/utils/lua/Makefile | 1 + package/utils/lua5.3/Makefile | 1 + 14 files changed, 14 insertions(+) diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index 5102bf81eae8fc..9e87dccc12b29e 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -15,6 +15,7 @@ PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/non-free-firmware/i/intel-microcode/ PKG_HASH:=29e77c275b3f60a691832c0844f70effbd94a4594d04af21e0c2e6e0c1ac1894 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 +PKG_CPE_ID:=cpe:/a:intel:microcode PKG_BUILD_DEPENDS:=iucode-tool/host diff --git a/package/libs/gmp/Makefile b/package/libs/gmp/Makefile index c9f886e7648d88..601e4f804def78 100644 --- a/package/libs/gmp/Makefile +++ b/package/libs/gmp/Makefile @@ -19,6 +19,7 @@ PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 PKG_FIXUP:=autoreconf PKG_LICENSE:=GPL-2.0-or-later +PKG_CPE_ID:=cpe:/a:gmplib:gmp PKG_BUILD_FLAGS:=no-mips16 diff --git a/package/libs/libbpf/Makefile b/package/libs/libbpf/Makefile index 316a56627432e1..a034231138456e 100644 --- a/package/libs/libbpf/Makefile +++ b/package/libs/libbpf/Makefile @@ -18,6 +18,7 @@ PKG_SOURCE_VERSION:=1728e3e4bef0e138ea95ffe62163eb9a6ac6fa32 PKG_ABI_VERSION:=$(firstword $(subst .,$(space),$(PKG_VERSION))) PKG_MAINTAINER:=Tony Ambardar +PKG_CPE_ID:=cpe:/a:libbpf_project:libbpf PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_PARALLEL:=1 diff --git a/package/libs/libbsd/Makefile b/package/libs/libbsd/Makefile index 1872e3ce30f3b5..6a148a985fd9f2 100644 --- a/package/libs/libbsd/Makefile +++ b/package/libs/libbsd/Makefile @@ -10,6 +10,7 @@ PKG_HASH:=9baa186059ebbf25c06308e9f991fda31f7183c0f24931826d83aa6abd8a0261 PKG_LICENSE:=BSD-4-Clause PKG_LICENSE_FILES:=COPYING +PKG_CPE_ID:=cpe:/a:freedesktop:libbsd PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 diff --git a/package/libs/libnetfilter-conntrack/Makefile b/package/libs/libnetfilter-conntrack/Makefile index 50432e9cd8d27e..97197b4a619cd8 100644 --- a/package/libs/libnetfilter-conntrack/Makefile +++ b/package/libs/libnetfilter-conntrack/Makefile @@ -18,6 +18,7 @@ PKG_HASH:=67bd9df49fe34e8b82144f6dfb93b320f384a8ea59727e92ff8d18b5f4b579a8 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING +PKG_CPE_ID:=cpe:/a:netfilter:libnetfilter_conntrack PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index 107c00aa03165d..d7358e32d036c3 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -18,6 +18,7 @@ PKG_HASH:=ed19a0383fad72e3ad435fd239d7cd80d64916b87269550159d20e47160ebe5f PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE +PKG_CPE_ID:=cpe:/a:tcpdump:libpcap PKG_ASLR_PIE_REGULAR:=1 diff --git a/package/network/utils/ebtables/Makefile b/package/network/utils/ebtables/Makefile index 67cc14a76089b6..f35b768b43754d 100644 --- a/package/network/utils/ebtables/Makefile +++ b/package/network/utils/ebtables/Makefile @@ -17,6 +17,7 @@ PKG_SOURCE_VERSION:=48cff25dfea5b37e16ba5dc6601e98ab140f5f99 PKG_MIRROR_HASH:=1327cdc3402e5e3056819e4e9b6f9d4a5bfd401f2c4f58447afb2c3c73fc8aac PKG_LICENSE:=GPL-2.0 +PKG_CPE_ID:=cpe:/a:netfilter:ebtables include $(INCLUDE_DIR)/package.mk diff --git a/package/network/utils/ipset/Makefile b/package/network/utils/ipset/Makefile index 6d48103d0ecf37..b0aac8fe36ee1d 100644 --- a/package/network/utils/ipset/Makefile +++ b/package/network/utils/ipset/Makefile @@ -18,6 +18,7 @@ PKG_HASH:=be49c9ff489dd6610cad6541e743c3384eac96e9f24707da7b3929d8f2ac64d8 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 +PKG_CPE_ID:=cpe:/a:netfilter:ipset PKG_FIXUP:=autoreconf PKG_INSTALL:=1 diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index 746c2c3c129cd3..528f6868b232e8 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -17,6 +17,7 @@ PKG_HASH:=f167bbe947dd53bb9ebc0c1dcef5db6ad73ac1d6084f2c6f9376c5c360cc4d4e PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 +PKG_CPE_ID:=cpe:/a:kernel:iw PKG_BUILD_FLAGS:=gc-sections lto diff --git a/package/utils/adb/Makefile b/package/utils/adb/Makefile index 0482a40da15bfc..c207c333b24dae 100644 --- a/package/utils/adb/Makefile +++ b/package/utils/adb/Makefile @@ -13,6 +13,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) PKG_MAINTAINER:=Henryk Heisig +PKG_CPE_ID:=cpe:/a:google:android_debug_bridge include $(INCLUDE_DIR)/package.mk diff --git a/package/utils/bsdiff/Makefile b/package/utils/bsdiff/Makefile index 09e6f126f627ac..32e59cea9c6965 100644 --- a/package/utils/bsdiff/Makefile +++ b/package/utils/bsdiff/Makefile @@ -18,6 +18,7 @@ PKG_MAINTAINER:=Hauke Mehrtens HOST_BUILD_DEPENDS:=bzip2/host PKG_LICENSE:=BSD-2-Clause +PKG_CPE_ID:=cpe:/a:daemonology:bsdiff include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/utils/dtc/Makefile b/package/utils/dtc/Makefile index 2e20c29cc641ca..dc10e9c5195b17 100644 --- a/package/utils/dtc/Makefile +++ b/package/utils/dtc/Makefile @@ -15,6 +15,7 @@ PKG_SOURCE_URL:=@KERNEL/software/utils/dtc PKG_MAINTAINER:=Yousong Zhou PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=GPL +PKG_CPE_ID:=cpe:/a:dtc_project:dtc PKG_INSTALL:=1 diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index e4d2fd1c500069..9496ffb366be97 100644 --- a/package/utils/lua/Makefile +++ b/package/utils/lua/Makefile @@ -19,6 +19,7 @@ PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYRIGHT +PKG_CPE_ID:=cpe:/a:lua:lua HOST_PATCH_DIR := ./patches-host diff --git a/package/utils/lua5.3/Makefile b/package/utils/lua5.3/Makefile index 9a707fbbab2a07..d43ac59ed4285c 100644 --- a/package/utils/lua5.3/Makefile +++ b/package/utils/lua5.3/Makefile @@ -19,6 +19,7 @@ PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYRIGHT +PKG_CPE_ID:=cpe:/a:lua:lua HOST_PATCH_DIR := ./patches-host From 1b7d48dc5f5592a833b9a6bc0385b309f00038ab Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Tue, 19 Sep 2023 00:10:03 +0200 Subject: [PATCH 0475/1171] tools: assign PKG_CPE_ID The PKG_CPE_ID links to NIST CPE version 2.2. Assign PKG_CPE_ID to all remaining tools which have a CPE ID. Not every tool has CPE id. Related: https://github.com/openwrt/packages/issues/8534 Signed-off-by: Alexander Couzens --- tools/7z/Makefile | 1 + tools/bison/Makefile | 1 + tools/gmp/Makefile | 1 + tools/liblzo/Makefile | 1 + tools/llvm-bpf/Makefile | 1 + tools/lz4/Makefile | 1 + tools/mtd-utils/Makefile | 1 + tools/sed/Makefile | 2 ++ tools/zip/Makefile | 1 + 9 files changed, 10 insertions(+) diff --git a/tools/7z/Makefile b/tools/7z/Makefile index 90362e79779f92..bfb50584876677 100644 --- a/tools/7z/Makefile +++ b/tools/7z/Makefile @@ -7,6 +7,7 @@ PKG_SOURCE_VERSION:=2201 PKG_SOURCE:=$(PKG_NAME)$(PKG_SOURCE_VERSION)-src.tar.xz PKG_SOURCE_URL:=https://7-zip.org/a/ PKG_HASH:=393098730c70042392af808917e765945dc2437dee7aae3cfcc4966eb920fbc5 +PKG_CPE_ID:=cpe:/a:7-zip:7zip # This builds the 7zr variant which supports only 7z, so no non-LGPL code should be included PKG_LICENSE:=LGPL-2.1-or-later diff --git a/tools/bison/Makefile b/tools/bison/Makefile index 30555541e653a3..0aa0969b20bc5e 100644 --- a/tools/bison/Makefile +++ b/tools/bison/Makefile @@ -12,6 +12,7 @@ PKG_VERSION:=3.8.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) PKG_HASH:=9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2 +PKG_CPE_ID:=cpe:/a:gnu:bison HOST_BUILD_PARALLEL:=1 diff --git a/tools/gmp/Makefile b/tools/gmp/Makefile index cfd6e30e04ab03..c48069dd7bc616 100644 --- a/tools/gmp/Makefile +++ b/tools/gmp/Makefile @@ -12,6 +12,7 @@ PKG_VERSION:=6.2.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gmp/ PKG_HASH:=fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2 +PKG_CPE_ID:=cpe:/a:gmplib:gmp HOST_FIXUP:=autoreconf diff --git a/tools/liblzo/Makefile b/tools/liblzo/Makefile index 4ebda0c3336508..9f60109135944e 100644 --- a/tools/liblzo/Makefile +++ b/tools/liblzo/Makefile @@ -17,6 +17,7 @@ PKG_HASH:=c0f892943208266f9b6543b3ae308fab6284c5c90e627931446fb49b4221a072 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING +PKG_CPE_ID:=cpe:/a:lzo_project:lzo CMAKE_BINARY_SUBDIR:=openwrt-build diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile index 71509511e73927..bb3179016c7b5c 100644 --- a/tools/llvm-bpf/Makefile +++ b/tools/llvm-bpf/Makefile @@ -13,6 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION) PKG_HASH:=8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 +PKG_CPE_ID:=cpe:/a:llvm:llvm HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src diff --git a/tools/lz4/Makefile b/tools/lz4/Makefile index 8f12ca93e68329..cf1738a52fe699 100644 --- a/tools/lz4/Makefile +++ b/tools/lz4/Makefile @@ -16,6 +16,7 @@ PKG_HASH:=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b PKG_LICENSE:=BSD-2-Clause PKG_LICENSE_FILES:=LICENSE lib/LICENSE +PKG_CPE_ID:=cpe:/a:lz4_project:lz4 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/meson.mk diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index 14f11acaf55b1a..90108019769b69 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -13,6 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://infraroot.at/pub/mtd/ PKG_HASH:=386e27fd121699b6b729bc2e8e04dda987b31cca6b16e12fb6cc6dcf26449f46 +PKG_CPE_ID:=cpe:/a:mtd-utils_project:mtd-utils PKG_FIXUP:=autoreconf diff --git a/tools/sed/Makefile b/tools/sed/Makefile index 5cc15a3397e23a..49cbc72e6e1db6 100644 --- a/tools/sed/Makefile +++ b/tools/sed/Makefile @@ -12,6 +12,8 @@ PKG_VERSION:=4.9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) PKG_HASH:=6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d24975181 +PKG_CPE_ID:=cpe:/a:gnu:sed + export SED:= HOST_BUILD_PARALLEL:=1 diff --git a/tools/zip/Makefile b/tools/zip/Makefile index 6e83dafb40f610..5ad124d1c39a8f 100644 --- a/tools/zip/Makefile +++ b/tools/zip/Makefile @@ -17,6 +17,7 @@ PKG_HASH:=f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369 PKG_LICENSE:=BSD-4-Clause PKG_LICENSE_FILES:=LICENSE +PKG_CPE_ID:=cpe:/a:zip_project:zip HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)/zip$(PKG_REV) HOST_BUILD_PARALLEL:=1 From 0ba56ae4466e4320d744bb0c959fdae70b7fc941 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Tue, 19 Sep 2023 00:23:40 +0200 Subject: [PATCH 0476/1171] toolchain: assign PKG_CPE_ID The PKG_CPE_ID links to NIST CPE version 2.2. Assign PKG_CPE_ID to all remaining package which have a CPE ID. Not every package has a CPE id. Related: https://github.com/openwrt/packages/issues/8534 Signed-off-by: Alexander Couzens --- toolchain/binutils/Makefile | 1 + toolchain/gcc/common.mk | 1 + toolchain/gdb/Makefile | 1 + toolchain/glibc/common.mk | 1 + toolchain/kernel-headers/Makefile | 1 + toolchain/nasm/Makefile | 1 + 6 files changed, 6 insertions(+) diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index ae7e953eb9222b..18b671960b075d 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -12,6 +12,7 @@ BIN_VERSION:=$(PKG_VERSION) PKG_SOURCE_URL:=@GNU/binutils/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_CPE_ID:=cpe:/a:gnu:binutils TAR_OPTIONS += --exclude='*.rej' diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk index 677fb253818181..31a1492f3a974e 100644 --- a/toolchain/gcc/common.mk +++ b/toolchain/gcc/common.mk @@ -28,6 +28,7 @@ GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_CPE_ID:=cpe:/a:gnu:gcc ifeq ($(PKG_VERSION),11.3.0) PKG_HASH:=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39 diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index 70a4fa59026fc6..474a18e95ff264 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -13,6 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb PKG_HASH:=0e1793bf8f2b54d53f46dea84ccfd446f48f81b297b28c4f7fc017b818d69fed +PKG_CPE_ID:=cpe:/a:gnu:gdb GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION) HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GDB_DIR) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 0d880e04df9863..b80cb2678b8fad 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -16,6 +16,7 @@ PKG_SOURCE_VERSION:=7c32cb7dd88cf100b0b412163896e30aa2ee671a PKG_MIRROR_HASH:=92afa3672e4af0c3ba9d360e9aaac60c094a0aad9334ef78a1fd2ee49f5e1b64 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz +PKG_CPE_ID:=cpe:/a:gnu:glibc HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR) CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT) diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile index eea0ffbde0713c..cd25f8a6def877 100644 --- a/toolchain/kernel-headers/Makefile +++ b/toolchain/kernel-headers/Makefile @@ -17,6 +17,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=linux PKG_VERSION:=$(LINUX_VERSION) PKG_SOURCE:=$(LINUX_SOURCE) +PKG_CPE_ID:=cpe:/o:linux:linux_kernel ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)) diff --git a/toolchain/nasm/Makefile b/toolchain/nasm/Makefile index 64bb5e77511dac..27cd4764196e54 100644 --- a/toolchain/nasm/Makefile +++ b/toolchain/nasm/Makefile @@ -10,6 +10,7 @@ PKG_VERSION:=2.16.01 PKG_SOURCE_URL:=https://www.nasm.us/pub/nasm/releasebuilds/$(PKG_VERSION)/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_HASH:=c77745f4802375efeee2ec5c0ad6b7f037ea9c87c92b149a9637ff099f162558 +PKG_CPE_ID:=cpe:/a:nasm:nasm HOST_BUILD_PARALLEL:=1 From ba9b93d913117f759c63b959871c009bc49ae1fb Mon Sep 17 00:00:00 2001 From: Arne Zachlod Date: Wed, 13 Sep 2023 18:20:03 +0200 Subject: [PATCH 0477/1171] toolchain: musl: add PKG_CPE_ID Vulnerabilities of musl libc are tracked as cpe:/a:musl-libc:musl Signed-off-by: Arne Zachlod --- toolchain/musl/common.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/toolchain/musl/common.mk b/toolchain/musl/common.mk index 0901fe7d6f4d92..94444eaf75d25b 100644 --- a/toolchain/musl/common.mk +++ b/toolchain/musl/common.mk @@ -14,6 +14,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://musl.libc.org/releases/ PKG_HASH:=7a35eae33d5372a7c0da1188de798726f68825513b7ae3ebe97aaaa52114f039 +PKG_CPE_ID:=cpe:/a:musl-libc:musl LIBC_SO_VERSION:=$(PKG_VERSION) PATCH_DIR:=$(PATH_PREFIX)/patches From 679f89ab652c475d9ccda27c4bc3844d454bfa94 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Sep 2023 20:16:21 +0200 Subject: [PATCH 0478/1171] treewide: Add extra CPE identifier This adds some Common Platform Enumerations (CPE) identifiers which I found. Signed-off-by: Hauke Mehrtens --- package/boot/at91bootstrap/Makefile | 1 + package/libs/popt/Makefile | 1 + package/libs/sysfsutils/Makefile | 1 + package/system/iucode-tool/Makefile | 1 + 4 files changed, 4 insertions(+) diff --git a/package/boot/at91bootstrap/Makefile b/package/boot/at91bootstrap/Makefile index efd42ecf5cc02c..f27a3f01dc2fc3 100644 --- a/package/boot/at91bootstrap/Makefile +++ b/package/boot/at91bootstrap/Makefile @@ -13,6 +13,7 @@ PKG_VERSION:=v4.0.3 PKG_MIRROR_HASH:=1ecdc31a13350fcdcaa3f77ed8ad73906f79fc668dbb2f337e1d5dd877bf9882 PKG_SOURCE_VERSION:=1d9e673698d9db4a4f2301559f481274de2e75ae BINARIES_DIR:=build/binaries +PKG_CPE_ID:=cpe:/a:linux4sam:at91bootstrap AT91BOOTSTRAP_V4=y ifdef CONFIG_PACKAGE_at91bootstrap-sama5d4_xplaineddf_uboot_secure diff --git a/package/libs/popt/Makefile b/package/libs/popt/Makefile index ad767b8eede5b4..ba9c82349bb5d7 100644 --- a/package/libs/popt/Makefile +++ b/package/libs/popt/Makefile @@ -15,6 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://ftp.rpm.org/popt/releases/popt-1.x/ PKG_HASH:=c25a4838fc8e4c1c8aacb8bd620edb3084a3d63bf8987fdad3ca2758c63240f9 PKG_LICENSE:=MIT +PKG_CPE_ID:=cpe:/a:popt_project:popt PKG_FIXUP:=autoreconf PKG_REMOVE_FILES:=autogen.sh aclocal.m4 diff --git a/package/libs/sysfsutils/Makefile b/package/libs/sysfsutils/Makefile index ff676308dab5af..b7c9d8cdc14dd8 100644 --- a/package/libs/sysfsutils/Makefile +++ b/package/libs/sysfsutils/Makefile @@ -15,6 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/linux-diag PKG_HASH:=e865de2c1f559fff0d3fc936e660c0efaf7afe662064f2fb97ccad1ec28d208a PKG_MAINTAINER:=Jo-Philipp Wich +PKG_CPE_ID:=cpe:/a:sysfsutils_project:sysfsutils PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:=COPYING cmd/GPL lib/LGPL diff --git a/package/system/iucode-tool/Makefile b/package/system/iucode-tool/Makefile index d7c85b2d42d922..c2ea37a5c5c81b 100644 --- a/package/system/iucode-tool/Makefile +++ b/package/system/iucode-tool/Makefile @@ -14,6 +14,7 @@ PKG_RELEASE:=2 PKG_SOURCE:=iucode-tool_$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://gitlab.com/iucode-tool/releases/raw/latest PKG_HASH:=12b88efa4d0d95af08db05a50b3dcb217c0eb2bfc67b483779e33d498ddb2f95 +PKG_CPE_ID:=cpe:/a:iucode-tool_project:iucode-tool PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone USE_MUSL:argp-standalone HOST_BUILD_DEPENDS:=HOST_OS_MACOS:argp-standalone/host From 186747a169fe70fb53268cc1ef45952bd75fde4e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 27 Sep 2023 16:43:54 +0200 Subject: [PATCH 0479/1171] mpc85xx: add Enterasys WS-AP3715i reset button The reset button was missing from the Enterasys WS-AP3715i DTS. Add the node required for making the reset button work. Signed-off-by: David Bauer (cherry picked from commit 0e8641d3b08bf8b9eac8e3338faf11cc058a5124) --- .../files/arch/powerpc/boot/dts/ws-ap3715i.dts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts index a8a4118b003cd9..af8917ffe1ab4d 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later or MIT #include +#include /include/ "fsl/p1010si-pre.dtsi" @@ -70,6 +71,16 @@ }; }; + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + soc: soc@ffe00000 { ranges = <0x0 0x0 0xffe00000 0x100000>; From 02ed2b0271c5e17584884146649d7fb64a9ac35d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 28 Sep 2023 10:28:43 +0200 Subject: [PATCH 0480/1171] hostapd: fix wpa_supplicant mac address allocation on ap+sta MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the full interface is restarted while bringing up an AP, it can trigger a wpa_supplicant interface start before wpa_supplicant is notified of the allocated mac addresses. Fix this by moving the iface_update_supplicant_macaddr call to just after the point where mac addresses are allocated. Reported-by: Michael-cy Lee (李峻宇) Signed-off-by: Felix Fietkau (cherry picked from commit abceef120d57bf066941882630a76788eb4985a9) --- .../network/services/hostapd/files/hostapd.uc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 5cddb9c268bb69..88f01caa93ebfd 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -122,6 +122,14 @@ function iface_config_macaddr_list(config) return macaddr_list; } +function iface_update_supplicant_macaddr(phy, config) +{ + let macaddr_list = []; + for (let i = 0; i < length(config.bss); i++) + push(macaddr_list, config.bss[i].bssid); + ubus.call("wpa_supplicant", "phy_set_macaddr_list", { phy: phy, macaddr: macaddr_list }); +} + function iface_restart(phydev, config, old_config) { let phy = phydev.name; @@ -142,6 +150,8 @@ function iface_restart(phydev, config, old_config) bss.bssid = phydev.macaddr_next(); } + iface_update_supplicant_macaddr(phy, config); + let bss = config.bss[0]; let err = wdev_create(phy, bss.ifname, { mode: "ap" }); if (err) @@ -498,14 +508,6 @@ function iface_reload_config(phydev, config, old_config) return true; } -function iface_update_supplicant_macaddr(phy, config) -{ - let macaddr_list = []; - for (let i = 0; i < length(config.bss); i++) - push(macaddr_list, config.bss[i].bssid); - ubus.call("wpa_supplicant", "phy_set_macaddr_list", { phy: phy, macaddr: macaddr_list }); -} - function iface_set_config(phy, config) { let old_config = hostapd.data.config[phy]; @@ -536,7 +538,6 @@ function iface_set_config(phy, config) hostapd.printf(`Restart interface for phy ${phy}`); let ret = iface_restart(phydev, config, old_config); - iface_update_supplicant_macaddr(phy, config); return ret; } From 7fe85ce1f2d53384561517bd0c8818d3b2ea43fc Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Fri, 29 Sep 2023 11:12:02 +0200 Subject: [PATCH 0481/1171] hostapd: increase PKG_RELEASE to fix builds Recent hostapd changes just edited the ucode files. It is required to bump the PKG_RELEASE to include the newest changes in the latest builds. Signed-off-by: Nick Hainke (cherry picked from commit 91d2ead3c3bf75b279f861ad5d11b64bf31478f0) --- package/network/services/hostapd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 5537500313e9dc..64048a963a480d 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git From 50690dd5cccf4ecefc75a6eeb71893a2342ea2d7 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 29 Sep 2023 20:28:35 +0200 Subject: [PATCH 0482/1171] OpenWrt v23.05.0-rc4: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..a636e6747d3c35 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^5f3879f714f71fef775b6190a0e597d3aa0e2e80 +src-git luci https://git.openwrt.org/project/luci.git^99559f95b89f71535b340ee94db2edee28f755d4 +src-git routing https://git.openwrt.org/feed/routing.git^2272106e0839ee06957e88e3596489e1b510d3c2 +src-git telephony https://git.openwrt.org/feed/telephony.git^c6b1315c235c1c42282fa04f897a527dabbaff6c diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..138b2faab65e47 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc4) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23482-7fe85ce1f2) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc4) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..fdf857c17f227c 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.0-rc4" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..c30cf4f0d06b4f --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23482-7fe85ce1f2 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..8b6b6b99808be4 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1695979776 From b742216dc86340c06c243caba7e15b83954fd659 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 29 Sep 2023 20:28:43 +0200 Subject: [PATCH 0483/1171] OpenWrt v23.05.0-rc4: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index a636e6747d3c35..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^5f3879f714f71fef775b6190a0e597d3aa0e2e80 -src-git luci https://git.openwrt.org/project/luci.git^99559f95b89f71535b340ee94db2edee28f755d4 -src-git routing https://git.openwrt.org/feed/routing.git^2272106e0839ee06957e88e3596489e1b510d3c2 -src-git telephony https://git.openwrt.org/feed/telephony.git^c6b1315c235c1c42282fa04f897a527dabbaff6c +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index 138b2faab65e47..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0-rc4) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23482-7fe85ce1f2) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc4) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index fdf857c17f227c..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.0-rc4" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index c30cf4f0d06b4f..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23482-7fe85ce1f2 diff --git a/version.date b/version.date deleted file mode 100644 index 8b6b6b99808be4..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1695979776 From e92cf0c46ffe3ac7fca936c18577bfb19eb4ce9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Mon, 18 Sep 2023 11:55:57 +0200 Subject: [PATCH 0484/1171] ramips: fix Mercusys MR70X LAN port assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bug report in the forum found that the MR70X lists four LAN ports in LuCI while it has only three. This adds the device to the network setup file to fix the issue. Identified-by: Forum User "Lexeyko" Signed-off-by: Andreas Böhler --- target/linux/ramips/mt7621/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 11a7c9465a333e..bd1d394892800e 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -17,6 +17,7 @@ ramips_setup_interfaces() h3c,tx1806|\ haier,har-20s2u1|\ hiwifi,hc5962|\ + mercusys,mr70x-v1|\ netgear,wax202|\ sim,simax1800t|\ xiaomi,mi-router-3-pro|\ From 3fff6255422c9223fe91ce68dd227ec6942aa688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=B6rner?= Date: Sun, 24 Sep 2023 20:58:13 +0200 Subject: [PATCH 0485/1171] rtl93xx: fix condition intended to only select internal serdes ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This condition was introduced in commit 51c8f7661244 ("realtek: Improve MAC config handling for all SoCs") to correctly report the speed of the internal serdes ports as 10G, but instead makes all ports read 10G because the or-operator should have been an and-operator. Fixes: #9953 Fixes: 51c8f7661244 ("realtek: Improve MAC config handling for all SoCs") Signed-off-by: Peter Körner [ wrap comment to 72 column and improve commit ref ] Signed-off-by: Christian Marangi (cherry picked from commit 9fb5082e258ac4672dc69636e5eb79f426defac8) --- target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index 5744c70ea3f0fd..6f55f1e892ed81 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -559,7 +559,7 @@ static int rtl93xx_phylink_mac_link_state(struct dsa_switch *ds, int port, } if (priv->family_id == RTL9310_FAMILY_ID - && (port >= 52 || port <= 55)) { /* Internal serdes */ + && (port >= 52 && port <= 55)) { /* Internal serdes */ state->speed = SPEED_10000; state->link = 1; state->duplex = 1; From 07e4352d80d251069488018d90422791e01ee894 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 4 Oct 2023 13:27:55 +0200 Subject: [PATCH 0486/1171] CI: push-containers: fix concurrency group Fix concurrency group for push-containers workflow to handle running on different branches. Signed-off-by: Christian Marangi (cherry picked from commit 4c2eab1c27defd154adcd0c4454248112815ffcc) --- .github/workflows/push-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 28b07244ef6c98..0cfc22b8bea106 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -13,7 +13,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From 2a457dcd7292d9995f8672bc12d70e8a7267021a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 4 Oct 2023 13:28:58 +0200 Subject: [PATCH 0487/1171] CI: push-containers: refresh containers also on modify cmake options Refresh containers also on modify of cmake options in the include file. Signed-off-by: Christian Marangi (cherry picked from commit b40c0b54bde81243974cada51cb9a44736c773b3) --- .github/workflows/push-containers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 0cfc22b8bea106..e74e7c22167833 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -4,6 +4,7 @@ on: push: paths: - 'include/version.mk' + - 'include/cmake.mk' - 'tools/**' - '.github/workflows/build-tools.yml' - '.github/workflows/push-containers.yml' From 130d5056c189454ebeec4fe91bc04da050431238 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 28 Sep 2023 22:55:08 +0200 Subject: [PATCH 0488/1171] generic: add patch for GPON-ONU-34-20BI quirk Backport patch merged upstream adding quirk for SFP GPON-ONU-34-20BI. Signed-off-by: Christian Marangi (cherry picked from commit 86dadeba482e2ed41f1ccc95fc7739d85a5709c0) --- ...uirk-for-Fiberstone-GPON-ONU-34-20BI.patch | 34 +++++++++++++++++++ .../790-SFP-GE-T-ignore-TX_FAULT.patch | 6 ++-- ...sfp-re-probe-modules-on-DEV_UP-event.patch | 2 +- ...12-net-phy-sfp-add-support-for-SMBus.patch | 2 +- 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 target/linux/generic/backport-5.15/798-net-next-net-sfp-add-quirk-for-Fiberstone-GPON-ONU-34-20BI.patch diff --git a/target/linux/generic/backport-5.15/798-net-next-net-sfp-add-quirk-for-Fiberstone-GPON-ONU-34-20BI.patch b/target/linux/generic/backport-5.15/798-net-next-net-sfp-add-quirk-for-Fiberstone-GPON-ONU-34-20BI.patch new file mode 100644 index 00000000000000..d6015a56584143 --- /dev/null +++ b/target/linux/generic/backport-5.15/798-net-next-net-sfp-add-quirk-for-Fiberstone-GPON-ONU-34-20BI.patch @@ -0,0 +1,34 @@ +From d387e34fec407f881fdf165b5d7ec128ebff362f Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 19 Sep 2023 14:47:20 +0200 +Subject: [PATCH] net: sfp: add quirk for Fiberstone GPON-ONU-34-20BI + +Fiberstone GPON-ONU-34-20B can operate at 2500base-X, but report 1.2GBd +NRZ in their EEPROM. + +The module also require the ignore tx fault fixup similar to Huawei MA5671A +as it gets disabled on error messages with serial redirection enabled. + +Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20230919124720.8210-1-ansuelsmth@gmail.com +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/sfp.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -368,6 +368,13 @@ static const struct sfp_quirk sfp_quirks + .modes = sfp_quirk_2500basex, + .fixup = sfp_fixup_long_startup, + }, { ++ // Fiberstore GPON-ONU-34-20BI can operate at 2500base-X, but report 1.2GBd ++ // NRZ in their EEPROM ++ .vendor = "FS", ++ .part = "GPON-ONU-34-20BI", ++ .modes = sfp_quirk_2500basex, ++ .fixup = sfp_fixup_ignore_tx_fault, ++ }, { + .vendor = "HALNy", + .part = "HL-GSFP", + .fixup = sfp_fixup_halny_gsfp, diff --git a/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch b/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch index 10af22e52e050d..e7372b31d1ea0c 100644 --- a/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch +++ b/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch @@ -26,7 +26,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -383,6 +383,11 @@ static const struct sfp_quirk sfp_quirks +@@ -390,6 +390,11 @@ static const struct sfp_quirk sfp_quirks .modes = sfp_quirk_2500basex, .fixup = sfp_fixup_ignore_tx_fault, }, { @@ -38,7 +38,7 @@ Signed-off-by: Daniel Golle // Lantech 8330-262D-E can operate at 2500base-X, but // incorrectly report 2500MBd NRZ in their EEPROM .vendor = "Lantech", -@@ -2312,7 +2317,8 @@ static void sfp_sm_main(struct sfp *sfp, +@@ -2319,7 +2324,8 @@ static void sfp_sm_main(struct sfp *sfp, * or t_start_up, so assume there is a fault. */ sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT, @@ -48,7 +48,7 @@ Signed-off-by: Daniel Golle } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { init_done: sfp->sm_phy_retries = R_PHY_RETRY; -@@ -2535,10 +2541,12 @@ static void sfp_check_state(struct sfp * +@@ -2542,10 +2548,12 @@ static void sfp_check_state(struct sfp * mutex_lock(&sfp->st_mutex); state = sfp_get_state(sfp); changed = state ^ sfp->state; diff --git a/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch index 87537a13f5a5cf..378563a9e33bdd 100644 --- a/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch +++ b/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch @@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -2153,6 +2153,13 @@ static void sfp_sm_module(struct sfp *sf +@@ -2160,6 +2160,13 @@ static void sfp_sm_module(struct sfp *sf return; } diff --git a/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch index 1e203a2925a0f5..53ec0fa1da5208 100644 --- a/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch @@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -549,32 +549,72 @@ static int sfp_i2c_write(struct sfp *sfp +@@ -556,32 +556,72 @@ static int sfp_i2c_write(struct sfp *sfp return ret == ARRAY_SIZE(msgs) ? len : 0; } From 76758a8694cab59bd1f9cdba53420fd2ff8bb383 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 2 Oct 2023 22:13:10 +0200 Subject: [PATCH 0489/1171] yafut: add missing PKG_MIRROR_HASH Add missing PKG_MIRROR_HASH. This is always needed as is used to generate and use a tar instead of git clone and validate the hash of it. Signed-off-by: Christian Marangi (cherry picked from commit a181b9f0f9269525319024f53d83c7efe9da544b) --- package/utils/yafut/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/utils/yafut/Makefile b/package/utils/yafut/Makefile index fe27db97d22193..ef16404c3369da 100644 --- a/package/utils/yafut/Makefile +++ b/package/utils/yafut/Makefile @@ -5,6 +5,7 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/kempniu/yafut.git +PKG_MIRROR_HASH:=6eece622d1df99ffee1a18d162d36292f32bf2d5e514663a6b61fd82c2ecbcba PKG_SOURCE_DATE:=2023-03-31 PKG_SOURCE_VERSION:=16435e89d449f953712983315e1a89cdb678620d From 5b00873f5d14f623185388251e46850940c50383 Mon Sep 17 00:00:00 2001 From: Uwe Niethammer Date: Sun, 1 Oct 2023 12:26:51 +0200 Subject: [PATCH 0490/1171] uqmi: added timeout to fix hanging qmi.sh Modems which are using qmi do not reply on the 1st sync but they do on subsequent. So qmi.sh is hanging on the first call. Since 2020 uqmi supports a timeout parameter. Unfortunately qmi.sh didn't make use of this parameter. So qmi.sh is now invoking an early dummy access to unlock the modem Signed-off-by: Uwe Niethammer (cherry picked from commit 32a696f9e419ebec5b166847a16a5a45d030acbd) --- package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 6c5104bccd8347..eab7f1ea13d45d 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -83,6 +83,8 @@ proto_qmi_setup() { echo "Waiting for SIM initialization" local uninitialized_timeout=0 + # timeout 3s for first call to avoid hanging uqmi + uqmi -d "$device" --get-pin-status -t 3000 > /dev/null 2>&1 while uqmi -s -d "$device" --get-pin-status | grep '"UIM uninitialized"' > /dev/null; do [ -e "$device" ] || return 1 if [ "$uninitialized_timeout" -lt "$timeout" -o "$timeout" = "0" ]; then From 83e681e69e846bb1094fb7c6676e6e58334d57ed Mon Sep 17 00:00:00 2001 From: Rudolf Vesely Date: Mon, 2 Oct 2023 06:51:19 +0000 Subject: [PATCH 0491/1171] rtl83xx: fix STP by trapping BPDUs Fix Spanning Tree Protocol (STP) by changing COPY2CPU which currently makes switch to ignore Bridge Protocol Data Units (BPDUs). Tested on Zyxel GS1900-8, 24 and 48. Signed-off-by: Rudolf Vesely [ improve commit description and add new line in different sections ] Signed-off-by: Christian Marangi (cherry picked from commit 41fcc617f94601072d304f2f68e12cf1dd058707) --- target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index 6f55f1e892ed81..0af98e4470e56c 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -152,7 +152,7 @@ static void rtl83xx_vlan_setup(struct rtl838x_switch_priv *priv) static void rtl83xx_setup_bpdu_traps(struct rtl838x_switch_priv *priv) { for (int i = 0; i < priv->cpu_port; i++) - priv->r->set_receive_management_action(i, BPDU, COPY2CPU); + priv->r->set_receive_management_action(i, BPDU, TRAP2CPU); } static void rtl83xx_port_set_salrn(struct rtl838x_switch_priv *priv, From 4cbfbb2edaab71431bce6a228d16e9840b42ae2d Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Sat, 23 Sep 2023 13:46:40 +0200 Subject: [PATCH 0492/1171] realtek: 5.15: rtl93xx: support 2500baseT and 5000baseT on USXGMII links The USXGMII implementation of Realtek switches can not only support 10GbE but also 2.5Gb and 5Gb on top of the usual data rates. Mark those as supported to allow them to be negotiated. This change has been tested on a ZyXEL XGS1250-12 with the following link partners: - NWA50AX Pro (2.5Gb) - RTL8152 USB NIC (2.5Gb) - AQC111 USB NIC (2.5Gb & 5Gb) Gbit and 10GbE has also been tested to still work fine with a variety of devices. Signed-off-by: Tobias Schramm (cherry picked from commit cd56a682326f9de4d77ee3afb99d13d25c478c08) --- .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index 0af98e4470e56c..063ce9b8c5d0da 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -429,8 +429,11 @@ static void rtl93xx_phylink_validate(struct dsa_switch *ds, int port, phylink_set(mask, 10000baseCR_Full); } - if (state->interface == PHY_INTERFACE_MODE_USXGMII) + if (state->interface == PHY_INTERFACE_MODE_USXGMII) { + phylink_set(mask, 2500baseT_Full); + phylink_set(mask, 5000baseT_Full); phylink_set(mask, 10000baseT_Full); + } phylink_set(mask, 10baseT_Half); phylink_set(mask, 10baseT_Full); From e26947993f9f443fe58ddbb0534515383aaf5b6f Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 7 Oct 2023 12:29:57 +0200 Subject: [PATCH 0493/1171] toolchain: glibc: Update glibc 2.37 to recent HEAD This adds the following changes: b4f76ecc9e Ignore MAP_VARIABLE in tst-mman-consts.py f5d377c896 __check_pf: Add a cancellation cleanup handler [BZ #20975] 0e3e9dbb0e Document BZ #20975 fix e2974d26ce io: Fix record locking contants on 32 bit arch with 64 bit default time_t (BZ#30477) 3593050c27 io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64 8dcb1a5181 hppa: xfail debug/tst-ssp-1 when have-ssp is yes (gcc-12 and later) 0930ff8eb3 realloc: Limit chunk reuse to only growing requests [BZ #30579] 3f4b4e2cdd elf: _dl_find_object may return 1 during early startup (bug 30515) 260d4b742b nptl: Fix tst-cancel30 on sparc64 58f7431fd7 sparc: Fix la_symbind for bind-now (BZ 23734) 1caf955269 x86: Increase `non_temporal_threshold` to roughly `sizeof_L3 / 4` 80a8c858a5 x86: Fix slight bug in `shared_per_thread` cache size calculation. cc8243fb0b x86: Use `3/4*sizeof(per-thread-L3)` as low bound for NT threshold. f94ff95e93 x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745] 0d500bfdc0 hurd: Make exception subcode a long be26b29262 io: Fix record locking contants for powerpc64 with __USE_FILE_OFFSET64 3d24d1903d elf: Do not run constructors for proxy objects a7e34a6675 elf: Always call destructors in reverse constructor order (bug 30785) bdb594afa5 elf: Remove unused l_text_end field from struct link_map 1a7cbe52c8 elf: Move l_init_called_next to old place of l_text_end in link map b752934602 CVE-2023-4527: Stack read overflow with large TCP responses in no-aaaa mode 6529a7466c (HEAD) getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806) 79310b45af x86/dl-cacheinfo: remove unsused parameter from handle_amd 9d5c6e27ed x86: Fix for cache computation on AMD legacy cpus. 4473d1b87d Fix leak in getaddrinfo introduced by the fix for CVE-2023-4806 [BZ #30843] 94ef701365 Document CVE-2023-4806 and CVE-2023-5156 in NEWS 2dfd8c77b5 i686: Regenerate ulps b4e23c75ae tunables: Terminate if end of input is reached (CVE-2023-4911) Signed-off-by: Hauke Mehrtens (cherry picked from commit e66eed033f9f9d27fc839d81d3a03d4fad1b9b5b) --- toolchain/glibc/common.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index b80cb2678b8fad..18413cd271af54 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -12,8 +12,8 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=7c32cb7dd88cf100b0b412163896e30aa2ee671a -PKG_MIRROR_HASH:=92afa3672e4af0c3ba9d360e9aaac60c094a0aad9334ef78a1fd2ee49f5e1b64 +PKG_SOURCE_VERSION:=b4e23c75aea756b4bddc4abcf27a1c6dca8b6bd3 +PKG_MIRROR_HASH:=4d5b3de6ec7b47427700f74fdb529e32083b54a512f6ca86ec824a61092ecdd4 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz PKG_CPE_ID:=cpe:/a:gnu:glibc From 6d65f5ea2bd025f36b71cc0f4809bda4fcf005d2 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 23 Sep 2023 10:15:37 -0400 Subject: [PATCH 0494/1171] kernel: bump 5.15 to 5.15.133 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.133 Removed upstreamed: bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch[1] Cherry picked build fix.[2] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.133&id=56cf9f446b331414a15ef0e8dedf23583ec2c427 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/tree/queue-5.15/fix-up-backport-of-136191703038-interconnect-teach-l.patch Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 89895937dd4a24446b7bfd067398b4f7e73dc7b5) --- include/kernel-5.15 | 4 +- ...nand-Assign-soc-as-early-as-possible.patch | 8 +- ...-Allow-SoC-to-provide-I-O-operations.patch | 150 ------------------ ...mnand-Avoid-pdev-in-brcmnand_init_cs.patch | 6 +- ...F-operations-out-of-brcmnand_init_cs.patch | 6 +- ...and-Allow-working-without-interrupts.patch | 4 +- ...and-Allow-platform-data-instantation.patch | 14 +- ...A-controller-uses-command-shift-of-0.patch | 2 +- ...8-mtd-rawnand-brcmnand-Add-BCMA-shim.patch | 2 +- ...wnand-brcmnand-disable-WP-on-BCM4908.patch | 2 +- ...lti-gen-LRU-support-page-table-walks.patch | 6 +- .../894-Fix-up-backport-for-13619703038.patch | 31 ++++ .../pending-5.15/834-ledtrig-libata.patch | 2 +- ...move-drivers-from-strlcpy-to-strscpy.patch | 2 +- .../oxnas/patches-5.15/999-libata-hacks.patch | 4 +- 15 files changed, 62 insertions(+), 181 deletions(-) delete mode 100644 target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch create mode 100644 target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 96feed23e078d4..06bcb632e3367b 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .132 -LINUX_KERNEL_HASH-5.15.132 = 4177b5c4d6e749bb8339ac4aa68eb0932ead9490b956a80d9a597089959618ac +LINUX_VERSION-5.15 = .133 +LINUX_KERNEL_HASH-5.15.133 = ef845e7934897b88e4448378ea9daacac19e07f156fe904844fab0a7d8ff5ddd diff --git a/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch b/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch index ce14834fa71b63..30b6d97a8582dd 100644 --- a/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch +++ b/target/linux/bcm47xx/patches-5.15/100-v5.18-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.patch @@ -14,15 +14,15 @@ Signed-off-by: Florian Fainelli --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -3033,6 +3033,7 @@ int brcmnand_probe(struct platform_devic +@@ -3059,6 +3059,7 @@ int brcmnand_probe(struct platform_devic dev_set_drvdata(dev, ctrl); ctrl->dev = dev; + ctrl->soc = soc; - init_completion(&ctrl->done); - init_completion(&ctrl->dma_done); -@@ -3173,8 +3174,6 @@ int brcmnand_probe(struct platform_devic + /* Enable the static key if the soc provides I/O operations indicating + * that a non-memory mapped IO access path must be used +@@ -3205,8 +3206,6 @@ int brcmnand_probe(struct platform_devic * interesting ways */ if (soc) { diff --git a/target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch b/target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch deleted file mode 100644 index 60671658fedf85..00000000000000 --- a/target/linux/bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch +++ /dev/null @@ -1,150 +0,0 @@ -From: Florian Fainelli -Subject: [PATCH v3 2/9] mtd: rawnand: brcmnand: Allow SoC to provide I/O operations -Date: Fri, 07 Jan 2022 10:46:07 -0800 -Content-Type: text/plain; charset="utf-8" - -Allow a brcmnand_soc instance to provide a custom set of I/O operations -which we will require when using this driver on a BCMA bus which is not -directly memory mapped I/O. Update the nand_{read,write}_reg accordingly -to use the SoC operations if provided. - -To minimize the penalty on other SoCs which do support standard MMIO -accesses, we use a static key which is disabled by default and gets -enabled if a soc implementation does provide I/O operations. - -Signed-off-by: Florian Fainelli ---- - drivers/mtd/nand/raw/brcmnand/brcmnand.c | 28 +++++++++++++++++++++-- - drivers/mtd/nand/raw/brcmnand/brcmnand.h | 29 ++++++++++++++++++++++++ - 2 files changed, 55 insertions(+), 2 deletions(-) - ---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c -+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -207,6 +208,8 @@ enum { - - struct brcmnand_host; - -+static DEFINE_STATIC_KEY_FALSE(brcmnand_soc_has_ops_key); -+ - struct brcmnand_controller { - struct device *dev; - struct nand_controller controller; -@@ -592,15 +595,25 @@ enum { - INTFC_CTLR_READY = BIT(31), - }; - -+static inline bool brcmnand_non_mmio_ops(struct brcmnand_controller *ctrl) -+{ -+ return static_branch_unlikely(&brcmnand_soc_has_ops_key); -+} -+ - static inline u32 nand_readreg(struct brcmnand_controller *ctrl, u32 offs) - { -+ if (brcmnand_non_mmio_ops(ctrl)) -+ return brcmnand_soc_read(ctrl->soc, offs); - return brcmnand_readl(ctrl->nand_base + offs); - } - - static inline void nand_writereg(struct brcmnand_controller *ctrl, u32 offs, - u32 val) - { -- brcmnand_writel(val, ctrl->nand_base + offs); -+ if (brcmnand_non_mmio_ops(ctrl)) -+ brcmnand_soc_write(ctrl->soc, val, offs); -+ else -+ brcmnand_writel(val, ctrl->nand_base + offs); - } - - static int brcmnand_revision_init(struct brcmnand_controller *ctrl) -@@ -766,13 +779,18 @@ static inline void brcmnand_rmw_reg(stru - - static inline u32 brcmnand_read_fc(struct brcmnand_controller *ctrl, int word) - { -+ if (brcmnand_non_mmio_ops(ctrl)) -+ return brcmnand_soc_read(ctrl->soc, BRCMNAND_NON_MMIO_FC_ADDR); - return __raw_readl(ctrl->nand_fc + word * 4); - } - - static inline void brcmnand_write_fc(struct brcmnand_controller *ctrl, - int word, u32 val) - { -- __raw_writel(val, ctrl->nand_fc + word * 4); -+ if (brcmnand_non_mmio_ops(ctrl)) -+ brcmnand_soc_write(ctrl->soc, val, BRCMNAND_NON_MMIO_FC_ADDR); -+ else -+ __raw_writel(val, ctrl->nand_fc + word * 4); - } - - static inline void edu_writel(struct brcmnand_controller *ctrl, -@@ -3035,6 +3053,12 @@ int brcmnand_probe(struct platform_devic - ctrl->dev = dev; - ctrl->soc = soc; - -+ /* Enable the static key if the soc provides I/O operations indicating -+ * that a non-memory mapped IO access path must be used -+ */ -+ if (brcmnand_soc_has_ops(ctrl->soc)) -+ static_branch_enable(&brcmnand_soc_has_ops_key); -+ - init_completion(&ctrl->done); - init_completion(&ctrl->dma_done); - init_completion(&ctrl->edu_done); ---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.h -+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.h -@@ -11,12 +11,25 @@ - - struct platform_device; - struct dev_pm_ops; -+struct brcmnand_io_ops; -+ -+/* Special register offset constant to intercept a non-MMIO access -+ * to the flash cache register space. This is intentionally large -+ * not to overlap with an existing offset. -+ */ -+#define BRCMNAND_NON_MMIO_FC_ADDR 0xffffffff - - struct brcmnand_soc { - bool (*ctlrdy_ack)(struct brcmnand_soc *soc); - void (*ctlrdy_set_enabled)(struct brcmnand_soc *soc, bool en); - void (*prepare_data_bus)(struct brcmnand_soc *soc, bool prepare, - bool is_param); -+ const struct brcmnand_io_ops *ops; -+}; -+ -+struct brcmnand_io_ops { -+ u32 (*read_reg)(struct brcmnand_soc *soc, u32 offset); -+ void (*write_reg)(struct brcmnand_soc *soc, u32 val, u32 offset); - }; - - static inline void brcmnand_soc_data_bus_prepare(struct brcmnand_soc *soc, -@@ -58,6 +71,22 @@ static inline void brcmnand_writel(u32 v - writel_relaxed(val, addr); - } - -+static inline bool brcmnand_soc_has_ops(struct brcmnand_soc *soc) -+{ -+ return soc && soc->ops && soc->ops->read_reg && soc->ops->write_reg; -+} -+ -+static inline u32 brcmnand_soc_read(struct brcmnand_soc *soc, u32 offset) -+{ -+ return soc->ops->read_reg(soc, offset); -+} -+ -+static inline void brcmnand_soc_write(struct brcmnand_soc *soc, u32 val, -+ u32 offset) -+{ -+ soc->ops->write_reg(soc, val, offset); -+} -+ - int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc); - int brcmnand_remove(struct platform_device *pdev); - diff --git a/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch b/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch index d514998fd72ace..46cd377406ecfc 100644 --- a/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch +++ b/target/linux/bcm47xx/patches-5.15/102-v5.18-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.patch @@ -16,7 +16,7 @@ Signed-off-by: Florian Fainelli --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -2806,7 +2806,7 @@ static const struct nand_controller_ops +@@ -2814,7 +2814,7 @@ static const struct nand_controller_ops static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn) { struct brcmnand_controller *ctrl = host->ctrl; @@ -25,7 +25,7 @@ Signed-off-by: Florian Fainelli struct mtd_info *mtd; struct nand_chip *chip; int ret; -@@ -2814,7 +2814,7 @@ static int brcmnand_init_cs(struct brcmn +@@ -2822,7 +2822,7 @@ static int brcmnand_init_cs(struct brcmn ret = of_property_read_u32(dn, "reg", &host->cs); if (ret) { @@ -34,7 +34,7 @@ Signed-off-by: Florian Fainelli return -ENXIO; } -@@ -2823,13 +2823,13 @@ static int brcmnand_init_cs(struct brcmn +@@ -2831,13 +2831,13 @@ static int brcmnand_init_cs(struct brcmn nand_set_flash_node(chip, dn); nand_set_controller_data(chip, host); diff --git a/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch b/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch index 2e2c05a43244ad..6a17ea7182ab8e 100644 --- a/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch +++ b/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch @@ -17,7 +17,7 @@ Signed-off-by: Florian Fainelli --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -2803,7 +2803,7 @@ static const struct nand_controller_ops +@@ -2811,7 +2811,7 @@ static const struct nand_controller_ops .attach_chip = brcmnand_attach_chip, }; @@ -26,7 +26,7 @@ Signed-off-by: Florian Fainelli { struct brcmnand_controller *ctrl = host->ctrl; struct device *dev = ctrl->dev; -@@ -2812,16 +2812,9 @@ static int brcmnand_init_cs(struct brcmn +@@ -2820,16 +2820,9 @@ static int brcmnand_init_cs(struct brcmn int ret; u16 cfg_offs; @@ -43,7 +43,7 @@ Signed-off-by: Florian Fainelli nand_set_controller_data(chip, host); mtd->name = devm_kasprintf(dev, GFP_KERNEL, "brcmnand.%d", host->cs); -@@ -3228,7 +3221,16 @@ int brcmnand_probe(struct platform_devic +@@ -3236,7 +3229,16 @@ int brcmnand_probe(struct platform_devic host->pdev = pdev; host->ctrl = ctrl; diff --git a/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch b/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch index 0845a7bfa329aa..ecc3e954ce65bc 100644 --- a/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch +++ b/target/linux/bcm47xx/patches-5.15/104-v5.18-mtd-rawnand-brcmnand-Allow-working-without-interrupts.patch @@ -23,7 +23,7 @@ Signed-off-by: Florian Fainelli unsigned int dma_irq; int nand_version; -@@ -1642,7 +1642,7 @@ static bool brcmstb_nand_wait_for_comple +@@ -1650,7 +1650,7 @@ static bool brcmstb_nand_wait_for_comple bool err = false; int sts; @@ -32,7 +32,7 @@ Signed-off-by: Florian Fainelli /* switch to interrupt polling and PIO mode */ disable_ctrl_irqs(ctrl); sts = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, -@@ -3179,33 +3179,29 @@ int brcmnand_probe(struct platform_devic +@@ -3187,33 +3187,29 @@ int brcmnand_probe(struct platform_devic } /* IRQ */ diff --git a/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch b/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch index bf9b410102a38c..b9ad82ecf96465 100644 --- a/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch +++ b/target/linux/bcm47xx/patches-5.15/106-v5.18-mtd-rawnand-brcmnand-Allow-platform-data-instantation.patch @@ -23,7 +23,7 @@ Signed-off-by: Florian Fainelli #include #include #include -@@ -2803,7 +2804,8 @@ static const struct nand_controller_ops +@@ -2811,7 +2812,8 @@ static const struct nand_controller_ops .attach_chip = brcmnand_attach_chip, }; @@ -33,7 +33,7 @@ Signed-off-by: Florian Fainelli { struct brcmnand_controller *ctrl = host->ctrl; struct device *dev = ctrl->dev; -@@ -2856,7 +2858,7 @@ static int brcmnand_init_cs(struct brcmn +@@ -2864,7 +2866,7 @@ static int brcmnand_init_cs(struct brcmn if (ret) return ret; @@ -42,7 +42,7 @@ Signed-off-by: Florian Fainelli if (ret) nand_cleanup(chip); -@@ -3025,17 +3027,15 @@ static int brcmnand_edu_setup(struct pla +@@ -3033,17 +3035,15 @@ static int brcmnand_edu_setup(struct pla int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) { @@ -63,7 +63,7 @@ Signed-off-by: Florian Fainelli return -ENODEV; ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); -@@ -3062,7 +3062,7 @@ int brcmnand_probe(struct platform_devic +@@ -3070,7 +3070,7 @@ int brcmnand_probe(struct platform_devic /* NAND register range */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctrl->nand_base = devm_ioremap_resource(dev, res); @@ -72,7 +72,7 @@ Signed-off-by: Florian Fainelli return PTR_ERR(ctrl->nand_base); /* Enable clock before using NAND registers */ -@@ -3206,7 +3206,6 @@ int brcmnand_probe(struct platform_devic +@@ -3214,7 +3214,6 @@ int brcmnand_probe(struct platform_devic for_each_available_child_of_node(dn, child) { if (of_device_is_compatible(child, "brcm,nandcs")) { @@ -80,7 +80,7 @@ Signed-off-by: Florian Fainelli host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); if (!host) { -@@ -3226,7 +3225,7 @@ int brcmnand_probe(struct platform_devic +@@ -3234,7 +3233,7 @@ int brcmnand_probe(struct platform_devic nand_set_flash_node(&host->chip, child); @@ -89,7 +89,7 @@ Signed-off-by: Florian Fainelli if (ret) { devm_kfree(dev, host); continue; /* Try all chip-selects */ -@@ -3236,6 +3235,32 @@ int brcmnand_probe(struct platform_devic +@@ -3244,6 +3243,32 @@ int brcmnand_probe(struct platform_devic } } diff --git a/target/linux/bcm47xx/patches-5.15/107-v5.18-mtd-rawnand-brcmnand-BCMA-controller-uses-command-shift-of-0.patch b/target/linux/bcm47xx/patches-5.15/107-v5.18-mtd-rawnand-brcmnand-BCMA-controller-uses-command-shift-of-0.patch index 188d59b7d1665d..50cc4a6b22a6a2 100644 --- a/target/linux/bcm47xx/patches-5.15/107-v5.18-mtd-rawnand-brcmnand-BCMA-controller-uses-command-shift-of-0.patch +++ b/target/linux/bcm47xx/patches-5.15/107-v5.18-mtd-rawnand-brcmnand-BCMA-controller-uses-command-shift-of-0.patch @@ -14,7 +14,7 @@ Signed-off-by: Florian Fainelli --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -916,6 +916,12 @@ static void brcmnand_wr_corr_thresh(stru +@@ -951,6 +951,12 @@ static void brcmnand_wr_corr_thresh(stru static inline int brcmnand_cmd_shift(struct brcmnand_controller *ctrl) { diff --git a/target/linux/bcm47xx/patches-5.15/108-v5.18-mtd-rawnand-brcmnand-Add-BCMA-shim.patch b/target/linux/bcm47xx/patches-5.15/108-v5.18-mtd-rawnand-brcmnand-Add-BCMA-shim.patch index baa48ef5a0d7a5..38fd3a30a6573d 100644 --- a/target/linux/bcm47xx/patches-5.15/108-v5.18-mtd-rawnand-brcmnand-Add-BCMA-shim.patch +++ b/target/linux/bcm47xx/patches-5.15/108-v5.18-mtd-rawnand-brcmnand-Add-BCMA-shim.patch @@ -187,7 +187,7 @@ Signed-off-by: Florian Fainelli +MODULE_DESCRIPTION("NAND controller driver glue for BCMA chips"); --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -598,7 +598,11 @@ enum { +@@ -627,7 +627,11 @@ enum { static inline bool brcmnand_non_mmio_ops(struct brcmnand_controller *ctrl) { diff --git a/target/linux/bcm4908/patches-5.15/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch b/target/linux/bcm4908/patches-5.15/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch index 74dddb7f489503..65066236db929b 100644 --- a/target/linux/bcm4908/patches-5.15/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.15/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch @@ -20,7 +20,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -37,7 +37,11 @@ +@@ -38,7 +38,11 @@ * 1: NAND_WP is set by default, cleared for erase/write operations * 2: NAND_WP is always cleared */ diff --git a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch index c89d3c2542814b..754d97d84b42dd 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch @@ -382,7 +382,7 @@ Signed-off-by: Andrew Morton } --- a/kernel/fork.c +++ b/kernel/fork.c -@@ -1083,6 +1083,7 @@ static struct mm_struct *mm_init(struct +@@ -1091,6 +1091,7 @@ static struct mm_struct *mm_init(struct goto fail_nocontext; mm->user_ns = get_user_ns(user_ns); @@ -390,7 +390,7 @@ Signed-off-by: Andrew Morton return mm; fail_nocontext: -@@ -1125,6 +1126,7 @@ static inline void __mmput(struct mm_str +@@ -1133,6 +1134,7 @@ static inline void __mmput(struct mm_str } if (mm->binfmt) module_put(mm->binfmt->module); @@ -398,7 +398,7 @@ Signed-off-by: Andrew Morton mmdrop(mm); } -@@ -2617,6 +2619,13 @@ pid_t kernel_clone(struct kernel_clone_a +@@ -2625,6 +2627,13 @@ pid_t kernel_clone(struct kernel_clone_a get_task_struct(p); } diff --git a/target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch b/target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch new file mode 100644 index 00000000000000..674740eaac3bbe --- /dev/null +++ b/target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch @@ -0,0 +1,31 @@ +From 16c572ef0646f8b0fa19fbf81b302de8a03127f2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 24 Sep 2023 14:30:44 -0400 +Subject: Fix up backport of 136191703038 ("interconnect: Teach lockdep about + icc_bw_lock order") + +Add a missing include to fix the following build error: + +drivers/interconnect/core.c: In function 'icc_init': +drivers/interconnect/core.c:1148:9: error: implicit declaration of function 'fs_reclaim_acquire' [-Werror=implicit-function-declaration] + 1148 | fs_reclaim_acquire(GFP_KERNEL); + | ^~~~~~~~~~~~~~~~~~ +drivers/interconnect/core.c:1150:9: error: implicit declaration of function 'fs_reclaim_release' [-Werror=implicit-function-declaration] + 1150 | fs_reclaim_release(GFP_KERNEL); + | ^~~~~~~~~~~~~~~~~~ + +Signed-off-by: Sasha Levin +--- + drivers/interconnect/core.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/interconnect/core.c ++++ b/drivers/interconnect/core.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/target/linux/generic/pending-5.15/834-ledtrig-libata.patch b/target/linux/generic/pending-5.15/834-ledtrig-libata.patch index 9c85862a4bd822..d61e28b4c3880f 100644 --- a/target/linux/generic/pending-5.15/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-5.15/834-ledtrig-libata.patch @@ -134,7 +134,7 @@ Signed-off-by: Daniel Golle /* * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -894,6 +897,12 @@ struct ata_port { +@@ -898,6 +901,12 @@ struct ata_port { #ifdef CONFIG_ATA_ACPI struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ #endif diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index 79444e071e8443..e3ccef4403609b 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -72,7 +72,7 @@ Signed-off-by: Wolfram Sang idev->adapter.dev.parent = &pdev->dev; --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -1024,7 +1024,7 @@ static int aspeed_i2c_probe_bus(struct p +@@ -1027,7 +1027,7 @@ static int aspeed_i2c_probe_bus(struct p bus->adap.algo = &aspeed_i2c_algo; bus->adap.dev.parent = &pdev->dev; bus->adap.dev.of_node = pdev->dev.of_node; diff --git a/target/linux/oxnas/patches-5.15/999-libata-hacks.patch b/target/linux/oxnas/patches-5.15/999-libata-hacks.patch index f44f6b55ffe77c..27074071c2bcf5 100644 --- a/target/linux/oxnas/patches-5.15/999-libata-hacks.patch +++ b/target/linux/oxnas/patches-5.15/999-libata-hacks.patch @@ -36,7 +36,7 @@ --- a/include/linux/libata.h +++ b/include/linux/libata.h -@@ -923,6 +923,8 @@ struct ata_port_operations { +@@ -927,6 +927,8 @@ struct ata_port_operations { enum ata_completion_errors (*qc_prep)(struct ata_queued_cmd *qc); unsigned int (*qc_issue)(struct ata_queued_cmd *qc); bool (*qc_fill_rtf)(struct ata_queued_cmd *qc); @@ -45,7 +45,7 @@ /* * Configuration and exception handling -@@ -1013,6 +1015,9 @@ struct ata_port_operations { +@@ -1017,6 +1019,9 @@ struct ata_port_operations { void (*phy_reset)(struct ata_port *ap); void (*eng_timeout)(struct ata_port *ap); From fadbec8857efddf5d1b55b77af56afac8428a943 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 7 Oct 2023 10:00:03 -0400 Subject: [PATCH 0495/1171] kernel: bump 5.15 to 5.15.134 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.134 Removed upstreamed: generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch[1] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.134&id=d7acb7031758141225844bea073860b48fd92092 Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit ac3a5911daeaecc04c6ffd03027b6b75fa4472d2) --- include/kernel-5.15 | 4 +-- ...v6.1-10-mm-multi-gen-LRU-kill-switch.patch | 2 +- .../894-Fix-up-backport-for-13619703038.patch | 31 ------------------- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- ...-missing-linux-if_ether.h-for-ETH_AL.patch | 2 +- .../patches-5.15/410-bt-mtk-serial-fix.patch | 2 +- 6 files changed, 6 insertions(+), 37 deletions(-) delete mode 100644 target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 06bcb632e3367b..35a21308aab1dd 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .133 -LINUX_KERNEL_HASH-5.15.133 = ef845e7934897b88e4448378ea9daacac19e07f156fe904844fab0a7d8ff5ddd +LINUX_VERSION-5.15 = .134 +LINUX_KERNEL_HASH-5.15.134 = f37182aecb57ed6853d01e1074d3a60a653331e35f3115728381e08be050b9d3 diff --git a/target/linux/generic/backport-5.15/020-v6.1-10-mm-multi-gen-LRU-kill-switch.patch b/target/linux/generic/backport-5.15/020-v6.1-10-mm-multi-gen-LRU-kill-switch.patch index cf5b8f0e9f78db..8ee032fb0f0c35 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-10-mm-multi-gen-LRU-kill-switch.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-10-mm-multi-gen-LRU-kill-switch.patch @@ -116,7 +116,7 @@ Signed-off-by: Andrew Morton extern spinlock_t css_set_lock; #define task_css_set_check(task, __c) \ rcu_dereference_check((task)->cgroups, \ -@@ -708,6 +719,8 @@ struct cgroup; +@@ -709,6 +720,8 @@ struct cgroup; static inline u64 cgroup_id(const struct cgroup *cgrp) { return 1; } static inline void css_get(struct cgroup_subsys_state *css) {} static inline void css_put(struct cgroup_subsys_state *css) {} diff --git a/target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch b/target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch deleted file mode 100644 index 674740eaac3bbe..00000000000000 --- a/target/linux/generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 16c572ef0646f8b0fa19fbf81b302de8a03127f2 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 24 Sep 2023 14:30:44 -0400 -Subject: Fix up backport of 136191703038 ("interconnect: Teach lockdep about - icc_bw_lock order") - -Add a missing include to fix the following build error: - -drivers/interconnect/core.c: In function 'icc_init': -drivers/interconnect/core.c:1148:9: error: implicit declaration of function 'fs_reclaim_acquire' [-Werror=implicit-function-declaration] - 1148 | fs_reclaim_acquire(GFP_KERNEL); - | ^~~~~~~~~~~~~~~~~~ -drivers/interconnect/core.c:1150:9: error: implicit declaration of function 'fs_reclaim_release' [-Werror=implicit-function-declaration] - 1150 | fs_reclaim_release(GFP_KERNEL); - | ^~~~~~~~~~~~~~~~~~ - -Signed-off-by: Sasha Levin ---- - drivers/interconnect/core.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/interconnect/core.c -+++ b/drivers/interconnect/core.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index ba847d5f8a982e..b618c896136332 100644 --- a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -7729,7 +7729,7 @@ static int nft_register_flowtable_net_ho +@@ -7707,7 +7707,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); diff --git a/target/linux/generic/pending-5.15/780-ARM-kirkwood-add-missing-linux-if_ether.h-for-ETH_AL.patch b/target/linux/generic/pending-5.15/780-ARM-kirkwood-add-missing-linux-if_ether.h-for-ETH_AL.patch index fcf7892c04e70f..39ba71606ec235 100644 --- a/target/linux/generic/pending-5.15/780-ARM-kirkwood-add-missing-linux-if_ether.h-for-ETH_AL.patch +++ b/target/linux/generic/pending-5.15/780-ARM-kirkwood-add-missing-linux-if_ether.h-for-ETH_AL.patch @@ -51,7 +51,7 @@ Signed-off-by: Daniel Golle --- a/arch/arm/mach-mvebu/kirkwood.c +++ b/arch/arm/mach-mvebu/kirkwood.c -@@ -14,6 +14,7 @@ +@@ -11,6 +11,7 @@ #include #include #include diff --git a/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch index bfa90f3849c6c3..3f4597c65d68f8 100644 --- a/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch +++ b/target/linux/mediatek/patches-5.15/410-bt-mtk-serial-fix.patch @@ -19,7 +19,7 @@ }, [PORT_NPCM] = { .name = "Nuvoton 16550", -@@ -2763,6 +2763,11 @@ serial8250_do_set_termios(struct uart_po +@@ -2766,6 +2766,11 @@ serial8250_do_set_termios(struct uart_po unsigned long flags; unsigned int baud, quot, frac = 0; From 6637af95aa9085c8367ce8184b0fe6917365c3d3 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 7 Oct 2023 21:07:20 +0200 Subject: [PATCH 0496/1171] bsdiff: Add patches for CVEs Add two patches from Debian fixing CVEs in the bsdiff application. CVE-2014-9862: Heap vulnerability in bspatch CVE-2020-14315: Memory Corruption Vulnerability in bspatch Copied the patches from this location: https://salsa.debian.org/debian/bsdiff/-/blob/debian/latest/debian/patches/20-CVE-2014-9862.patch https://salsa.debian.org/debian/bsdiff/-/blob/debian/latest/debian/patches/33-CVE-2020-14315.patch Signed-off-by: Hauke Mehrtens (cherry picked from commit cac723e8b8748938b8d80603578c60189fc32b24) --- package/utils/bsdiff/Makefile | 2 +- package/utils/bsdiff/patches/001-musl.patch | 24 +- .../bsdiff/patches/020-CVE-2014-9862.patch | 37 ++ .../bsdiff/patches/033-CVE-2020-14315.patch | 383 ++++++++++++++++++ 4 files changed, 433 insertions(+), 13 deletions(-) create mode 100644 package/utils/bsdiff/patches/020-CVE-2014-9862.patch create mode 100644 package/utils/bsdiff/patches/033-CVE-2020-14315.patch diff --git a/package/utils/bsdiff/Makefile b/package/utils/bsdiff/Makefile index 32e59cea9c6965..d86be2dc0c6714 100644 --- a/package/utils/bsdiff/Makefile +++ b/package/utils/bsdiff/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bsdiff PKG_VERSION:=4.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.daemonology.net/bsdiff/ diff --git a/package/utils/bsdiff/patches/001-musl.patch b/package/utils/bsdiff/patches/001-musl.patch index 5232bc1fe78536..1eeb1140c007de 100644 --- a/package/utils/bsdiff/patches/001-musl.patch +++ b/package/utils/bsdiff/patches/001-musl.patch @@ -1,6 +1,6 @@ ---- a/bsdiff.c 2005-08-17 00:13:52.000000000 +0200 -+++ b/bsdiff.c 2016-02-21 01:39:31.157915765 +0100 -@@ -101,7 +101,7 @@ +--- a/bsdiff.c ++++ b/bsdiff.c +@@ -101,7 +101,7 @@ static void split(off_t *I,off_t *V,off_ if(start+len>kk) split(I,V,kk,start+len-kk,h); } @@ -9,7 +9,7 @@ { off_t buckets[256]; off_t i,h,len; -@@ -139,7 +139,7 @@ +@@ -139,7 +139,7 @@ static void qsufsort(off_t *I,off_t *V,u for(i=0;i #include @@ -71,7 +71,7 @@ { off_t y; -@@ -62,8 +62,8 @@ +@@ -62,8 +62,8 @@ int main(int argc,char * argv[]) int fd; ssize_t oldsize,newsize; ssize_t bzctrllen,bzdatalen; diff --git a/package/utils/bsdiff/patches/020-CVE-2014-9862.patch b/package/utils/bsdiff/patches/020-CVE-2014-9862.patch new file mode 100644 index 00000000000000..98a49312f3b473 --- /dev/null +++ b/package/utils/bsdiff/patches/020-CVE-2014-9862.patch @@ -0,0 +1,37 @@ +From: The FreeBSD Project +Bug: https://security-tracker.debian.org/tracker/CVE-2014-9862 +Subject: CVE-2014-9862 - check for a negative value on numbers of bytes + The implementation of bspatch does not check for a negative value on numbers + of bytes read from the diff and extra streams, allowing an attacker who + can control the patch file to write at arbitrary locations in the heap. + . + bspatch's main loop reads three numbers from the "control" stream in + the patch: X, Y and Z. The first two are the number of bytes to read + from "diff" and "extra" (and thus only non-negative), while the + third one could be positive or negative and moves the oldpos pointer + on the source image. These 3 values are 64bits signed ints (encoded + somehow on the file) that are later passed the function that reads + from the streams, but those values are not verified to be + non-negative. + . + Official report https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-9862 + The patch was downloaded from a link pointed by + https://security.freebsd.org/advisories/FreeBSD-SA-16:25.bsp + +--- + bspatch.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/bspatch.c ++++ b/bspatch.c +@@ -152,6 +152,10 @@ int main(int argc,char * argv[]) + }; + + /* Sanity-check */ ++ if ((ctrl[0] < 0) || (ctrl[1] < 0)) ++ errx(1,"Corrupt patch\n"); ++ ++ /* Sanity-check */ + if(newpos+ctrl[0]>newsize) + errx(1,"Corrupt patch\n"); + diff --git a/package/utils/bsdiff/patches/033-CVE-2020-14315.patch b/package/utils/bsdiff/patches/033-CVE-2020-14315.patch new file mode 100644 index 00000000000000..975cb181dcd9f9 --- /dev/null +++ b/package/utils/bsdiff/patches/033-CVE-2020-14315.patch @@ -0,0 +1,383 @@ +Description: patch for CVE-2020-14315 + A memory corruption vulnerability is present in bspatch as shipped in + Colin Percival’s bsdiff tools version 4.3. Insufficient checks when + handling external inputs allows an attacker to bypass the sanity checks + in place and write out of a dynamically allocated buffer boundaries. +Source: https://svnweb.freebsd.org/base/head/usr.bin/bsdiff/bspatch/bspatch.c?revision=352742&view=co +Author: tony mancill +Comment: The patch was created by comparing the Debian sources to the + "Confirmed Patched Version" [1] documented in the + X41 D-SEC GmbH Security Advisory: X41-2020-006 [2]. + References to FreeBSD capsicum have been dropped. Definitions for + TYPE_MINIMUM and TYPE_MAXIMUM have been borrowed from the Debian + coreutils package sources but originate in gnulib [3] and are used to + define OFF_MIN and OFF_MAX (limits of off_t). Whitespace changes from + the confirmed patched version are also included and keep the difference + between the Debian sources and the confirmed patched version minimal. + . + [1] https://svnweb.freebsd.org/base/head/usr.bin/bsdiff/bspatch/bspatch.c?revision=352742&view=co + [2] https://www.openwall.com/lists/oss-security/2020/07/09/2 + [3] https://www.gnu.org/software/gnulib/ +Last-Update: 2021-04-03 +Forwarded: not-needed +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964796 + +--- a/bspatch.c ++++ b/bspatch.c +@@ -1,4 +1,6 @@ + /*- ++ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD ++ * + * Copyright 2003-2005 Colin Percival + * All rights reserved + * +@@ -25,55 +27,147 @@ + */ + + #if 0 +-__FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:06 cperciva Exp $"); ++__FBSDID("$FreeBSD$"); + #endif + + #include +-#include ++#include ++#include ++#include ++#include ++#include + #include ++#include + #include +-#include + #include +-#include ++ ++#ifndef O_BINARY ++#define O_BINARY 0 ++#endif ++#define HEADER_SIZE 32 ++ ++/* TYPE_MINIMUM and TYPE_MAXIMUM taken from coreutils */ ++#ifndef TYPE_MINIMUM ++#define TYPE_MINIMUM(t) \ ++ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) ++#endif ++#ifndef TYPE_MAXIMUM ++#define TYPE_MAXIMUM(t) \ ++ ((t) ((t) 0 < (t) -1 \ ++ ? (t) -1 \ ++ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) ++#endif ++ ++#ifndef OFF_MAX ++#define OFF_MAX TYPE_MAXIMUM(off_t) ++#endif ++ ++#ifndef OFF_MIN ++#define OFF_MIN TYPE_MINIMUM(off_t) ++#endif ++ ++static char *newfile; ++static int dirfd = -1; ++ ++static void ++exit_cleanup(void) ++{ ++ ++ if (dirfd != -1 && newfile != NULL) ++ if (unlinkat(dirfd, newfile, 0)) ++ warn("unlinkat"); ++} ++ ++static inline off_t ++add_off_t(off_t a, off_t b) ++{ ++ off_t result; ++ ++#if __GNUC__ >= 5 || \ ++ (defined(__has_builtin) && __has_builtin(__builtin_add_overflow)) ++ if (__builtin_add_overflow(a, b, &result)) ++ errx(1, "Corrupt patch"); ++#else ++ if ((b > 0 && a > OFF_MAX - b) || (b < 0 && a < OFF_MIN - b)) ++ errx(1, "Corrupt patch"); ++ result = a + b; ++#endif ++ return result; ++} + + static off_t offtin(unsigned char *buf) + { + off_t y; + +- y=buf[7]&0x7F; +- y=y*256;y+=buf[6]; +- y=y*256;y+=buf[5]; +- y=y*256;y+=buf[4]; +- y=y*256;y+=buf[3]; +- y=y*256;y+=buf[2]; +- y=y*256;y+=buf[1]; +- y=y*256;y+=buf[0]; ++ y = buf[7] & 0x7F; ++ y = y * 256; y += buf[6]; ++ y = y * 256; y += buf[5]; ++ y = y * 256; y += buf[4]; ++ y = y * 256; y += buf[3]; ++ y = y * 256; y += buf[2]; ++ y = y * 256; y += buf[1]; ++ y = y * 256; y += buf[0]; + +- if(buf[7]&0x80) y=-y; ++ if (buf[7] & 0x80) ++ y = -y; + +- return y; ++ return (y); + } + +-int main(int argc,char * argv[]) ++static void ++usage(void) + { +- FILE * f, * cpf, * dpf, * epf; +- BZFILE * cpfbz2, * dpfbz2, * epfbz2; ++ ++ fprintf(stderr, "usage: bspatch oldfile newfile patchfile\n"); ++ exit(1); ++} ++ ++int main(int argc, char *argv[]) ++{ ++ FILE *f, *cpf, *dpf, *epf; ++ BZFILE *cpfbz2, *dpfbz2, *epfbz2; ++ char *directory, *namebuf; + int cbz2err, dbz2err, ebz2err; +- int fd; +- ssize_t oldsize,newsize; +- ssize_t bzctrllen,bzdatalen; +- unsigned char header[32],buf[8]; ++ int newfd, oldfd; ++ off_t oldsize, newsize; ++ off_t bzctrllen, bzdatalen; ++ unsigned char header[HEADER_SIZE], buf[8]; + unsigned char *old, *new; +- off_t oldpos,newpos; ++ off_t oldpos, newpos; + off_t ctrl[3]; +- off_t lenread; +- off_t i; ++ off_t i, lenread, offset; + +- if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]); ++ if (argc != 4) ++ usage(); + + /* Open patch file */ +- if ((f = fopen(argv[3], "r")) == NULL) ++ if ((f = fopen(argv[3], "rb")) == NULL) ++ err(1, "fopen(%s)", argv[3]); ++ /* Open patch file for control block */ ++ if ((cpf = fopen(argv[3], "rb")) == NULL) ++ err(1, "fopen(%s)", argv[3]); ++ /* open patch file for diff block */ ++ if ((dpf = fopen(argv[3], "rb")) == NULL) + err(1, "fopen(%s)", argv[3]); ++ /* open patch file for extra block */ ++ if ((epf = fopen(argv[3], "rb")) == NULL) ++ err(1, "fopen(%s)", argv[3]); ++ /* open oldfile */ ++ if ((oldfd = open(argv[1], O_RDONLY | O_BINARY, 0)) < 0) ++ err(1, "open(%s)", argv[1]); ++ /* open directory where we'll write newfile */ ++ if ((namebuf = strdup(argv[2])) == NULL || ++ (directory = dirname(namebuf)) == NULL || ++ (dirfd = open(directory, O_DIRECTORY)) < 0) ++ err(1, "open %s", argv[2]); ++ free(namebuf); ++ if ((newfile = basename(argv[2])) == NULL) ++ err(1, "basename"); ++ /* open newfile */ ++ if ((newfd = openat(dirfd, newfile, ++ O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) < 0) ++ err(1, "open(%s)", argv[2]); ++ atexit(exit_cleanup); + + /* + File format: +@@ -90,104 +184,104 @@ int main(int argc,char * argv[]) + */ + + /* Read header */ +- if (fread(header, 1, 32, f) < 32) { ++ if (fread(header, 1, HEADER_SIZE, f) < HEADER_SIZE) { + if (feof(f)) +- errx(1, "Corrupt patch\n"); ++ errx(1, "Corrupt patch"); + err(1, "fread(%s)", argv[3]); + } + + /* Check for appropriate magic */ + if (memcmp(header, "BSDIFF40", 8) != 0) +- errx(1, "Corrupt patch\n"); ++ errx(1, "Corrupt patch"); + + /* Read lengths from header */ +- bzctrllen=offtin(header+8); +- bzdatalen=offtin(header+16); +- newsize=offtin(header+24); +- if((bzctrllen<0) || (bzdatalen<0) || (newsize<0)) +- errx(1,"Corrupt patch\n"); ++ bzctrllen = offtin(header + 8); ++ bzdatalen = offtin(header + 16); ++ newsize = offtin(header + 24); ++ if (bzctrllen < 0 || bzctrllen > OFF_MAX - HEADER_SIZE || ++ bzdatalen < 0 || bzctrllen + HEADER_SIZE > OFF_MAX - bzdatalen || ++ newsize < 0 || newsize > SSIZE_MAX) ++ errx(1, "Corrupt patch"); + + /* Close patch file and re-open it via libbzip2 at the right places */ + if (fclose(f)) + err(1, "fclose(%s)", argv[3]); +- if ((cpf = fopen(argv[3], "r")) == NULL) +- err(1, "fopen(%s)", argv[3]); +- if (fseeko(cpf, 32, SEEK_SET)) +- err(1, "fseeko(%s, %lld)", argv[3], +- (long long)32); ++ offset = HEADER_SIZE; ++ if (fseeko(cpf, offset, SEEK_SET)) ++ err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset); + if ((cpfbz2 = BZ2_bzReadOpen(&cbz2err, cpf, 0, 0, NULL, 0)) == NULL) + errx(1, "BZ2_bzReadOpen, bz2err = %d", cbz2err); +- if ((dpf = fopen(argv[3], "r")) == NULL) +- err(1, "fopen(%s)", argv[3]); +- if (fseeko(dpf, 32 + bzctrllen, SEEK_SET)) +- err(1, "fseeko(%s, %lld)", argv[3], +- (long long)(32 + bzctrllen)); ++ offset = add_off_t(offset, bzctrllen); ++ if (fseeko(dpf, offset, SEEK_SET)) ++ err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset); + if ((dpfbz2 = BZ2_bzReadOpen(&dbz2err, dpf, 0, 0, NULL, 0)) == NULL) + errx(1, "BZ2_bzReadOpen, bz2err = %d", dbz2err); +- if ((epf = fopen(argv[3], "r")) == NULL) +- err(1, "fopen(%s)", argv[3]); +- if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET)) +- err(1, "fseeko(%s, %lld)", argv[3], +- (long long)(32 + bzctrllen + bzdatalen)); ++ offset = add_off_t(offset, bzdatalen); ++ if (fseeko(epf, offset, SEEK_SET)) ++ err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset); + if ((epfbz2 = BZ2_bzReadOpen(&ebz2err, epf, 0, 0, NULL, 0)) == NULL) + errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err); + +- if(((fd=open(argv[1],O_RDONLY,0))<0) || +- ((oldsize=lseek(fd,0,SEEK_END))==-1) || +- ((old=malloc(oldsize+1))==NULL) || +- (lseek(fd,0,SEEK_SET)!=0) || +- (read(fd,old,oldsize)!=oldsize) || +- (close(fd)==-1)) err(1,"%s",argv[1]); +- if((new=malloc(newsize+1))==NULL) err(1,NULL); +- +- oldpos=0;newpos=0; +- while(newpos SSIZE_MAX || ++ (old = malloc(oldsize)) == NULL || ++ lseek(oldfd, 0, SEEK_SET) != 0 || ++ read(oldfd, old, oldsize) != oldsize || ++ close(oldfd) == -1) ++ err(1, "%s", argv[1]); ++ if ((new = malloc(newsize)) == NULL) ++ err(1, NULL); ++ ++ oldpos = 0; ++ newpos = 0; ++ while (newpos < newsize) { + /* Read control data */ +- for(i=0;i<=2;i++) { ++ for (i = 0; i <= 2; i++) { + lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8); + if ((lenread < 8) || ((cbz2err != BZ_OK) && + (cbz2err != BZ_STREAM_END))) +- errx(1, "Corrupt patch\n"); +- ctrl[i]=offtin(buf); +- }; ++ errx(1, "Corrupt patch"); ++ ctrl[i] = offtin(buf); ++ } + + /* Sanity-check */ +- if ((ctrl[0] < 0) || (ctrl[1] < 0)) +- errx(1,"Corrupt patch\n"); ++ if (ctrl[0] < 0 || ctrl[0] > INT_MAX || ++ ctrl[1] < 0 || ctrl[1] > INT_MAX) ++ errx(1, "Corrupt patch"); + + /* Sanity-check */ +- if(newpos+ctrl[0]>newsize) +- errx(1,"Corrupt patch\n"); ++ if (add_off_t(newpos, ctrl[0]) > newsize) ++ errx(1, "Corrupt patch"); + + /* Read diff string */ + lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]); + if ((lenread < ctrl[0]) || + ((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END))) +- errx(1, "Corrupt patch\n"); ++ errx(1, "Corrupt patch"); + + /* Add old data to diff string */ +- for(i=0;i=0) && (oldpos+inewsize) +- errx(1,"Corrupt patch\n"); ++ if (add_off_t(newpos, ctrl[1]) > newsize) ++ errx(1, "Corrupt patch"); + + /* Read extra string */ + lenread = BZ2_bzRead(&ebz2err, epfbz2, new + newpos, ctrl[1]); + if ((lenread < ctrl[1]) || + ((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END))) +- errx(1, "Corrupt patch\n"); ++ errx(1, "Corrupt patch"); + + /* Adjust pointers */ +- newpos+=ctrl[1]; +- oldpos+=ctrl[2]; +- }; ++ newpos = add_off_t(newpos, ctrl[1]); ++ oldpos = add_off_t(oldpos, ctrl[2]); ++ } + + /* Clean up the bzip2 reads */ + BZ2_bzReadClose(&cbz2err, cpfbz2); +@@ -197,12 +291,13 @@ int main(int argc,char * argv[]) + err(1, "fclose(%s)", argv[3]); + + /* Write the new file */ +- if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY,0666))<0) || +- (write(fd,new,newsize)!=newsize) || (close(fd)==-1)) +- err(1,"%s",argv[2]); ++ if (write(newfd, new, newsize) != newsize || close(newfd) == -1) ++ err(1, "%s", argv[2]); ++ /* Disable atexit cleanup */ ++ newfile = NULL; + + free(new); + free(old); + +- return 0; ++ return (0); + } From bd4f415efacfc03bbe5b79ae1d39c1451f5f7385 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 11 Oct 2023 23:06:24 +0200 Subject: [PATCH 0497/1171] OpenWrt v23.05.0: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..b07c21080a2126 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^0da9f622975aa1e4efe452da4acbae15479bee63 +src-git luci https://git.openwrt.org/project/luci.git^257f54cb8bcd493d9be0a45a3c316668b793e8ae +src-git routing https://git.openwrt.org/feed/routing.git^2272106e0839ee06957e88e3596489e1b510d3c2 +src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..ff5ef944aef57e 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23497-6637af95aa) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..e93f03e27fe4e8 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.0" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..013b9a1d89b558 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23497-6637af95aa diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..add0152382cf0f --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1696887935 From 86e852bcd01c4e43423c03984ee431118d57f855 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 11 Oct 2023 23:06:34 +0200 Subject: [PATCH 0498/1171] OpenWrt v23.05.0: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index b07c21080a2126..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^0da9f622975aa1e4efe452da4acbae15479bee63 -src-git luci https://git.openwrt.org/project/luci.git^257f54cb8bcd493d9be0a45a3c316668b793e8ae -src-git routing https://git.openwrt.org/feed/routing.git^2272106e0839ee06957e88e3596489e1b510d3c2 -src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index ff5ef944aef57e..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.0) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23497-6637af95aa) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index e93f03e27fe4e8..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.0" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index 013b9a1d89b558..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23497-6637af95aa diff --git a/version.date b/version.date deleted file mode 100644 index add0152382cf0f..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1696887935 From 0bc33a6505e31d96a016c11be6b0fb37564b3e92 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Fri, 13 Oct 2023 17:47:11 +0200 Subject: [PATCH 0499/1171] ath79: wpj563: enable 2nd USB controller The compex WPJ563 actually has both usb controllers wired: usb0 --> pci-e slot usb1 --> pin header As the board exposes it for generic use, enable this controller too. fixes: #13650 Signed-off-by: Koen Vandeputte (cherry picked from commit 9188c77cbee55a933d0fa75c74e175fbc52c556d) --- target/linux/ath79/dts/qca9563_compex_wpj563.dts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/ath79/dts/qca9563_compex_wpj563.dts b/target/linux/ath79/dts/qca9563_compex_wpj563.dts index ceac53f415a498..407e912ad2693d 100644 --- a/target/linux/ath79/dts/qca9563_compex_wpj563.dts +++ b/target/linux/ath79/dts/qca9563_compex_wpj563.dts @@ -130,6 +130,14 @@ status = "okay"; }; +&usb_phy1 { + status = "okay"; +}; + +&usb1 { + status = "okay"; +}; + &wmac { status = "okay"; From 2ce5521bd20213a42bfa655a4ae178ee0a97baba Mon Sep 17 00:00:00 2001 From: Kevin Jilissen Date: Sun, 8 Oct 2023 16:56:40 +0200 Subject: [PATCH 0500/1171] realtek: rename hpe,1920-8g-poe to match hardware There are two hardware models of the HPE 1920-8g-poe switch. The version currently in the repository is the model with a PoE budget of 180W. In preparation of the addition of the 65W model, the existing model is renamed to clarify the hardware version it targets. As suggested by Pawel, the 'SUPPORTED_DEVICES' includes the old target name to enable an upgrade path of builds with the old name. Suggested-by: Pawel Dembicki Signed-off-by: Kevin Jilissen (cherry picked from commit 987c96e88927094ff61e83870f872f0560d8e5c1) --- target/linux/realtek/base-files/etc/board.d/02_network | 4 ++-- .../linux/realtek/base-files/etc/board.d/03_gpio_switches | 2 +- ...pe_1920-8g-poe.dts => rtl8380_hpe_1920-8g-poe-180w.dts} | 4 ++-- target/linux/realtek/image/rtl838x.mk | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) rename target/linux/realtek/dts-5.15/{rtl8380_hpe_1920-8g-poe.dts => rtl8380_hpe_1920-8g-poe-180w.dts} (55%) diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 90b45abf94baed..84d3e68e48f318 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -31,7 +31,7 @@ lan_mac_end="" label_mac="" case $board in hpe,1920-8g|\ -hpe,1920-8g-poe|\ +hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g) label_mac=$(mtd_get_mac_binary factory 0x68) @@ -67,7 +67,7 @@ done [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac case $board in -hpe,1920-8g-poe) +hpe,1920-8g-poe-180w) ucidef_set_poe 180 "$lan_list_rev" "lan9 lan10" ;; netgear,gs110tpp-v1) diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches index abfcb8e5924014..1e49d89c64a241 100644 --- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches @@ -6,7 +6,7 @@ board_config_update board=$(board_name) case "$board" in -hpe,1920-8g-poe) +hpe,1920-8g-poe-180w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" ;; esac diff --git a/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe.dts b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-180w.dts similarity index 55% rename from target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe.dts rename to target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-180w.dts index 3b00c31411917e..6398e6d034dee3 100644 --- a/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe.dts +++ b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-180w.dts @@ -3,8 +3,8 @@ #include "rtl8380_hpe_1920-8g.dtsi" / { - compatible = "hpe,1920-8g-poe", "realtek,rtl838x-soc"; - model = "HPE 1920-8G-PoE+ (JG922A)"; + compatible = "hpe,1920-8g-poe-180w", "realtek,rtl838x-soc"; + model = "HPE 1920-8G-PoE+ 180W (JG922A)"; }; &uart1 { diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 73930f4d6f41a4..c0b9c70bb6f7c2 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -99,13 +99,14 @@ define Device/hpe_1920-8g endef TARGET_DEVICES += hpe_1920-8g -define Device/hpe_1920-8g-poe +define Device/hpe_1920-8g-poe-180w $(Device/hpe_1920) SOC := rtl8380 - DEVICE_MODEL := 1920-8G-PoE+ (JG922A) + DEVICE_MODEL := 1920-8G-PoE+ 180W (JG922A) H3C_DEVICE_ID := 0x00010025 + SUPPORTED_DEVICES += hpe_1920-8g-poe endef -TARGET_DEVICES += hpe_1920-8g-poe +TARGET_DEVICES += hpe_1920-8g-poe-180w define Device/hpe_1920-16g $(Device/hpe_1920) From 4245adf4e0597c4a44c396dbe2206f26f73a1555 Mon Sep 17 00:00:00 2001 From: Kevin Jilissen Date: Sun, 8 Oct 2023 17:21:23 +0200 Subject: [PATCH 0501/1171] realtek: add support for HPE 1920-8g-poe+ (65W) Hardware information: --------------------- - RTL8380 SoC - 8 Gigabit RJ45 PoE ports (built-in RTL8218B) - 2 SFP ports (built-in SerDes) - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog - PoE chip - Fanless Known issues: --------------------- - PoE LEDs are uncontrolled. (Manual taken from f2f09bc) Booting initramfs image: ------------------------ - Prepare a FTP or TFTP server serving the OpenWrt initramfs image and connect the server to a switch port. - Connect to the console port of the device and enter the extended boot menu by typing Ctrl+B when prompted. - Choose the menu option "<3> Enter Ethernet SubMenu". - Set network parameters via the option "<5> Modify Ethernet Parameter". Enter the FTP/TFTP filename as "Load File Name" ("Target File Name" can be left blank, it is not required for booting from RAM). Note that the configuration is saved on flash, so it only needs to be done once. - Select "<1> Download Application Program To SDRAM And Run". Initial installation: --------------------- - Boot an initramfs image as described above, then use sysupgrade to install OpenWrt permanently. After initial installation, the bootloader needs to be configured to load the correct image file - Enter the extended boot menu again and choose "<4> File Control", then select "<2> Set Application File type". - Enter the number of the file "openwrt-kernel.bin" (should be 1), and use the option "<1> +Main" to select it as boot image. - Choose "<0> Exit To Main Menu" and then "<1> Boot System". NOTE: The bootloader on these devices can only boot from the VFS filesystem which normally spans most of the flash. With OpenWrt, only the first part of the firmware partition contains a valid filesystem, the rest is used for rootfs. As the bootloader does not know about this, you must not do any file operations in the bootloader, as this may corrupt the OpenWrt installation (selecting the boot image is an exception, as it only stores a flag in the bootloader data, but doesn't write to the filesystem). Example PoE config file (/etc/config/poe): --------------------- config global option budget '65' config port option enable '1' option id '1' option name 'lan8' option poe_plus '1' option priority '2' config port option enable '1' option id '2' option name 'lan7' option poe_plus '1' option priority '2' config port option enable '1' option id '3' option name 'lan6' option poe_plus '1' option priority '2' config port option enable '1' option id '4' option name 'lan5' option poe_plus '1' option priority '2' config port option enable '1' option id '5' option name 'lan4' option poe_plus '1' option priority '2' config port option enable '1' option id '6' option name 'lan3' option poe_plus '1' option priority '2' config port option enable '1' option id '7' option name 'lan2' option poe_plus '1' option priority '2' config port option enable '1' option id '8' option name 'lan1' option poe_plus '1' option priority '2' Signed-off-by: Kevin Jilissen (cherry picked from commit f4ee08677cdeefba7cfda40a830b6b747c6ea36e) --- .../linux/realtek/base-files/etc/board.d/02_network | 4 ++++ .../realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-65w.dts | 12 ++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 +++++++++ 3 files changed, 25 insertions(+) create mode 100644 target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-65w.dts diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 84d3e68e48f318..45bc2196d405a5 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -31,6 +31,7 @@ lan_mac_end="" label_mac="" case $board in hpe,1920-8g|\ +hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g) @@ -67,6 +68,9 @@ done [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac case $board in +hpe,1920-8g-poe-65w) + ucidef_set_poe 65 "$lan_list_rev" "lan9 lan10" + ;; hpe,1920-8g-poe-180w) ucidef_set_poe 180 "$lan_list_rev" "lan9 lan10" ;; diff --git a/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-65w.dts b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-65w.dts new file mode 100644 index 00000000000000..341f535e938aae --- /dev/null +++ b/target/linux/realtek/dts-5.15/rtl8380_hpe_1920-8g-poe-65w.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8380_hpe_1920-8g.dtsi" + +/ { + compatible = "hpe,1920-8g-poe-65w", "realtek,rtl838x-soc"; + model = "HPE 1920-8G-PoE+ 65W (JG921A)"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index c0b9c70bb6f7c2..09b4f3ebb03b73 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -99,6 +99,15 @@ define Device/hpe_1920-8g endef TARGET_DEVICES += hpe_1920-8g +define Device/hpe_1920-8g-poe-65w + $(Device/hpe_1920) + SOC := rtl8380 + DEVICE_MODEL := 1920-8G-PoE+ 65W (JG921A) + DEVICE_PACKAGES += realtek-poe + H3C_DEVICE_ID := 0x00010024 +endef +TARGET_DEVICES += hpe_1920-8g-poe-65w + define Device/hpe_1920-8g-poe-180w $(Device/hpe_1920) SOC := rtl8380 From 77061285e46baedd56469381bf41cf0927c40841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Sun, 15 Oct 2023 19:28:51 +0200 Subject: [PATCH 0502/1171] ramips: fix ZyXEL NR7101 bricking typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A typo snuck in with the addition of Cudy M1800, changing "nr7101" to "nt7101". The result is a default network config for NR7101 without the only ethernet interface on the NR7101, thereby soft bricking it. Fixes: f6d394e9f2fd ("ramips: add support for Cudy M1800") Signed-off-by: Bjørn Mork (cherry picked from commit 2e57028424d0e914490a80178cd729adb17ba09b) --- target/linux/ramips/mt7621/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index bd1d394892800e..839663bbd0df5b 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -91,7 +91,7 @@ ramips_setup_interfaces() ;; cudy,m1800|\ yuncore,ax820|\ - zyxel,nt7101) + zyxel,nr7101) ucidef_set_interfaces_lan_wan "lan" "wan" ;; gnubee,gb-pc1) From 72f7f18d2ba160f371c027ba4a60e82e19248340 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 14 Oct 2023 00:37:34 +0200 Subject: [PATCH 0503/1171] mbedtls: Update to version 2.28.5 This fixes some minor security problems. Changelog: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-2.28.5 Signed-off-by: Hauke Mehrtens (cherry picked from commit 9e1c5ad4b0c99c45927ccd44504cd8fdbbd03bb0) --- package/libs/mbedtls/Makefile | 4 ++-- .../mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 4c3cb965c55e21..6f0b5162ebf6a0 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=2.28.4 +PKG_VERSION:=2.28.5 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=578c4dcd15bbff3f5cd56aa07cd4f850fc733634e3d5947be4f7157d5bfd81ac +PKG_HASH:=849e86b626e42ded6bf67197b64aa771daa54e2a7e2868dc67e1e4711959e5e3 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=gpl-2.0.txt diff --git a/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch b/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch index 02632cdb4ba1d8..4ad2e8c7dbe4ae 100644 --- a/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch +++ b/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch @@ -33,7 +33,7 @@ Signed-off-by: Glenn Strauss #include #else #include -@@ -3001,6 +3005,61 @@ find_parent: +@@ -3002,6 +3006,61 @@ find_parent: } } @@ -95,7 +95,7 @@ Signed-off-by: Glenn Strauss /* * Check for CN match */ -@@ -3021,24 +3080,51 @@ static int x509_crt_check_cn(const mbedt +@@ -3022,24 +3081,51 @@ static int x509_crt_check_cn(const mbedt return -1; } @@ -158,7 +158,7 @@ Signed-off-by: Glenn Strauss } /* -@@ -3049,31 +3135,23 @@ static void x509_crt_verify_name(const m +@@ -3050,31 +3136,23 @@ static void x509_crt_verify_name(const m uint32_t *flags) { const mbedtls_x509_name *name; From c0c4a9bce42bea74fa9fa984cde149eac5e479bf Mon Sep 17 00:00:00 2001 From: Christian Buschau Date: Tue, 17 Oct 2023 14:51:53 +0200 Subject: [PATCH 0504/1171] armsr: preserve configuration during sysupgrade Copy configuration to boot partition (partition 1) instead of root partition (partition 2) because the root partition is not writable if it's a suqashfs image. Move configuration back to root during preinit. Fixes: https://github.com/openwrt/openwrt/issues/13695 Signed-off-by: Christian Buschau (cherry picked from commit 67ce60c5f961c4248fa108cd0f949e2bade4536e) --- .../base-files/lib/preinit/79_move_config | 19 +++++++++++++++++++ .../armsr/base-files/lib/upgrade/platform.sh | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 target/linux/armsr/base-files/lib/preinit/79_move_config diff --git a/target/linux/armsr/base-files/lib/preinit/79_move_config b/target/linux/armsr/base-files/lib/preinit/79_move_config new file mode 100644 index 00000000000000..864d4dfa644fc7 --- /dev/null +++ b/target/linux/armsr/base-files/lib/preinit/79_move_config @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-only + +move_config() { + local partdev parttype=ext4 + + . /lib/upgrade/common.sh + + if export_bootdevice && export_partdevice partdev 1; then + part_magic_fat "/dev/$partdev" && parttype=vfat + if mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt; then + if [ -f "/mnt/$BACKUP_FILE" ]; then + mv -f "/mnt/$BACKUP_FILE" / + fi + umount /mnt + fi + fi +} + +boot_hook_add preinit_mount_root move_config diff --git a/target/linux/armsr/base-files/lib/upgrade/platform.sh b/target/linux/armsr/base-files/lib/upgrade/platform.sh index 8263b9c7e3aa4d..e72c6955e5814a 100644 --- a/target/linux/armsr/base-files/lib/upgrade/platform.sh +++ b/target/linux/armsr/base-files/lib/upgrade/platform.sh @@ -36,7 +36,8 @@ platform_check_image() { platform_copy_config() { local partdev parttype=ext4 - if export_partdevice partdev 2; then + if export_partdevice partdev 1; then + part_magic_fat "/dev/$partdev" && parttype=vfat mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" umount /mnt From 0da199f60c47a4b861562ffec3842535eb56a67b Mon Sep 17 00:00:00 2001 From: Michael 'ASAP' Weinrich Date: Thu, 5 Oct 2023 19:39:58 -0700 Subject: [PATCH 0505/1171] base-files: fix wrong ucidef_set_network_device_mac network-device entry The ucidef_set_network_device_* functions in uci-defaults.sh disagree on whether to use "network-device" or "network_device" in board.json. With the additional caveat that jshn will translate hyphens (-) into underscores (_). This casues problems in netifd which expected "network_device" causing boards which depend on assigning MACs in board.json via uci-defaults.sh (or jshn in general) to fail. This commit addresses the issue by using network_device in uci-defaults.sh. The bug was uncovered in the forums here: https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/2596 This was exposed by commit 4ebba8a05d09 ("realtek: add support for HPE 1920-8g-poe+") where the board_config_load call from 03_gpio introduced the key normalization by jshn. Fixes: 9290539ca9c7 ("base-files: allow setting device and bridge macs") Tested-by: Stijn Segers Signed-off-by: Michael 'ASAP' Weinrich [ improve commit title, description and fix wrong Tested-by tag ] Signed-off-by: Christian Marangi (cherry picked from commit 12bc79d6d521581e37a8b067ce8a562429aeefbd) --- package/base-files/files/lib/functions/uci-defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index a37e8cf82416d3..6f395ec24b2a4e 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -107,7 +107,7 @@ ucidef_set_bridge_mac() { } ucidef_set_network_device_mac() { - json_select_object "network-device" + json_select_object "network_device" json_select_object "${1}" json_add_string macaddr "${2}" json_select .. From 1304234dd7e8e85266760b9694403f0160bd82ae Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 20 Oct 2023 13:00:00 +0200 Subject: [PATCH 0506/1171] netifd: update to latest git HEAD 5590a80e2566 config: fix incompatible with jshn network-device entry Signed-off-by: Christian Marangi (cherry picked from commit 53039bf7f5aa16d2f69394a86d04b8442c743e77) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index e60e5920983f2f..44d3a98d8fe45f 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-09-19 -PKG_SOURCE_VERSION:=7a58b995fdbecd9beed57e4d66d42cb3cf66aee2 -PKG_MIRROR_HASH:=a460a3b912047f8802eb24bb737084a08dad65b2dd520e5f5e7459379d1fcf8c +PKG_SOURCE_DATE:=2023-10-20 +PKG_SOURCE_VERSION:=5590a80e2566d378be955f61c287a63fb3bdf329 +PKG_MIRROR_HASH:=eef792b4e9fa7a5227cf8c2ec4ed5e6558dd04c119cd9f97561923821fd1aa92 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 4afff7b8b54c3b246fba30ed83dfac527e78e57d Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Tue, 12 Sep 2023 15:38:27 +0200 Subject: [PATCH 0507/1171] ipq40xx: switch to performance governor by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Doing a simple ping to my device shows this: 64 bytes from 10.0.253.101: icmp_seq=1 ttl=64 time=2.00 ms 64 bytes from 10.0.253.101: icmp_seq=2 ttl=64 time=2.02 ms 64 bytes from 10.0.253.101: icmp_seq=3 ttl=64 time=1.68 ms 64 bytes from 10.0.253.101: icmp_seq=4 ttl=64 time=1.91 ms 64 bytes from 10.0.253.101: icmp_seq=5 ttl=64 time=1.92 ms 64 bytes from 10.0.253.101: icmp_seq=6 ttl=64 time=2.04 ms Some users even report higher values on older kernels: 64 bytes from 192.168.1.10: seq=0 ttl=64 time=0.612 ms 64 bytes from 192.168.1.10: seq=1 ttl=64 time=2.852 ms 64 bytes from 192.168.1.10: seq=2 ttl=64 time=2.719 ms 64 bytes from 192.168.1.10: seq=3 ttl=64 time=2.741 ms 64 bytes from 192.168.1.10: seq=4 ttl=64 time=2.808 ms The problem is that the governor is set to Ondemand, which causes the CPU to clock all the way down to 48MHz in some cases. Switching to performance governor: 64 bytes from 10.0.253.101: icmp_seq=1 ttl=64 time=0.528 ms 64 bytes from 10.0.253.101: icmp_seq=2 ttl=64 time=0.561 ms 64 bytes from 10.0.253.101: icmp_seq=3 ttl=64 time=0.633 ms 64 bytes from 10.0.253.101: icmp_seq=4 ttl=64 time=0.526 ms In theory, using the Performance governor should increase power draw, but it looks like it really does not matter for this soc. Using a calibrated precision DC power supply (cpu idle): Ondemand 24.00V * 0.134A = 3.216 Watts 48.00V * 0.096A = 4.608 Watts Performance 24.00V * 0.135A = 3.240 Watts 48.00V * 0.096A = 4.608 Watts Let's simply switch to the Performance governor by default to fix the general jittery behaviour on devices using this soc. Tested on: MikroTik wAP ac Fixes: #13649 Reviewed-by: Robert Marko Reviewed-by: Thibaut VARÈNE Signed-off-by: Koen Vandeputte (cherry picked from commit b8e52852bd62236a2a84663b4592d221ebc64cb4) --- target/linux/ipq40xx/config-5.15 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/config-5.15 b/target/linux/ipq40xx/config-5.15 index 0acc013a813083..d08f4e0a24d7f1 100644 --- a/target/linux/ipq40xx/config-5.15 +++ b/target/linux/ipq40xx/config-5.15 @@ -67,8 +67,8 @@ CONFIG_CPU_COPY_V6=y CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y # CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set From 58d57f767374c18ff2ffe5a8d2a7ff80bc0e7649 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Mon, 16 Oct 2023 19:41:21 +0200 Subject: [PATCH 0508/1171] ipq40xx: wpj428: switch to zimage to fit kernel partition Like with some other ipq40xx devices, the kernel image size for the WPJ428 is limited in stock u-boot. For that reason, the current release doesn't include an image for the board. By switching to the zImage format, the kernel image size is reduced which re-enables the build process. The image boots and behaved normally through a few days of testing. Before the switch to kernel version 6.1, it was possible to reduce the image size by enough when disabling UBIFS and its otherwise unneeded dependencies. Signed-off-by: Leon M. Busch-George (cherry picked from commit 2657e8cab7f3d621b66cfdd4e228da3b912af32a) --- target/linux/ipq40xx/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 99a9b78b780958..ff5d5f26aad012 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -354,7 +354,7 @@ endef #TARGET_DEVICES += compex_wpj419 define Device/compex_wpj428 - $(call Device/FitImage) + $(call Device/FitzImage) DEVICE_VENDOR := Compex DEVICE_MODEL := WPJ428 SOC := qcom-ipq4028 From 03cb2d63f487a5d716711c2693f126c913e599cf Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 20 Oct 2023 16:20:27 +0200 Subject: [PATCH 0509/1171] apm821xx: WNDR4700: fix broken sysupgrade, factory images prepend-dtb got extended to handle the Meraki devices too, the problem here was that the Netgear WNDR4700 expects an u-boot header in front of the DTB, whereas Meraki devices don't. Since the header was dropped, the WNDR4700's uboot started to complain: Bad Magic Number,it is forbidden to be written to flash!! when flashing the factory.img since it expects an u-boot header there. Fixes: 5dece2d9355a ("apm821xx: switch over from DTB_SIZE to DEVICE_DTC_FLAGS") Fixes: #13716 Reported-by: @kisgezenguz Reported-by: Tamas Szabo Signed-off-by: Christian Lamparter (cherry picked from commit d6a11833ad67c33ad10dadf396f6c30bb44ef30f) --- target/linux/apm821xx/image/nand.mk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/image/nand.mk b/target/linux/apm821xx/image/nand.mk index bbc429c45db062..4681a7428d5b70 100644 --- a/target/linux/apm821xx/image/nand.mk +++ b/target/linux/apm821xx/image/nand.mk @@ -3,7 +3,12 @@ define Build/create-uImage-dtb -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) \ -O linux -T kernel -C none \ -n '$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)' \ - -d "$@.dtb" "$@.dtb.uimage" + -d "$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb" "$@.dtb.uimage" +endef + +define Build/prepend-dtb-uImage + cat "$@.dtb.uimage" "$@" > "$@.new" + mv "$@.new" "$@" endef define Build/meraki-header @@ -104,7 +109,7 @@ define Device/netgear_wndr4700 # append a fake/empty rootfs to fool netgear's uboot # CHECK_DNI_FIRMWARE_ROOTFS_INTEGRITY in do_chk_dniimg() KERNEL := kernel-bin | lzma -d16 | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | \ - append-uImage-fakehdr filesystem | create-uImage-dtb | prepend-dtb + append-uImage-fakehdr filesystem | create-uImage-dtb | prepend-dtb-uImage KERNEL_INITRAMFS := kernel-bin | libdeflate-gzip | MuImage-initramfs gzip IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ netgear-dni | check-size From 023f90fbc828a7d146bc1dce057c205a67e313a7 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 9 Oct 2023 00:26:18 +0200 Subject: [PATCH 0510/1171] Revert "lantiq: xrx200: mark subtarget as source-only" This reverts commit 0c117e1f6ccbee684ea0589d9024ca9dec4679c9. Activate the lantiq/xrx200 target again. There are still some problems with the GSWIP, but it is not leaking packets to the wrong bridge in normal operations. It shows some error messages at configuration like these: [ 54.308861] gswip 1e108000.switch: port 5 failed to add ce:9d:84:d1:81:f0 vid 1 to fdb: -22 [ 54.325633] gswip 1e108000.switch: port 5 failed to add e8:de:27:95:c1:b4 vid 0 to fdb: -22 [ 54.351242] gswip 1e108000.switch: port 5 failed to add e8:de:27:95:c1:b4 vid 1 to fdb: -22 [ 54.358311] gswip 1e108000.switch: port 5 failed to delete ce:9d:84:d1:81:f0 vid 1 from fdb: -2 The problems are described in this pull request: https://github.com/openwrt/openwrt/pull/13200 Signed-off-by: Hauke Mehrtens (cherry picked from commit e1aaa1defd2340be3544dc614f905795b4d52f81) --- target/linux/lantiq/xrx200/target.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/lantiq/xrx200/target.mk b/target/linux/lantiq/xrx200/target.mk index 6e01fc79e4759c..0f119edd6fa50a 100644 --- a/target/linux/lantiq/xrx200/target.mk +++ b/target/linux/lantiq/xrx200/target.mk @@ -1,7 +1,7 @@ ARCH:=mips SUBTARGET:=xrx200 BOARDNAME:=XRX200 -FEATURES+=atm nand ramdisk source-only +FEATURES+=atm nand ramdisk CPU_TYPE:=24kc DEFAULT_PACKAGES+=kmod-leds-gpio \ From ee3600a91efaad112d1fabffffeb371f6f3b8e7f Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 24 Oct 2023 13:10:51 +0200 Subject: [PATCH 0511/1171] image: Fix the CONFIG_EXTERNAL_CPIO logic Fix the qstrip call. Fixes: #13776. Signed-off-by: Luca Barbato (cherry picked from commit 330492a101cdb1608d1194496c1b620315ef8bd8) --- include/kernel-defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index 6a341c32255919..b17ff7f932a6fc 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -166,7 +166,7 @@ define Kernel/CompileImage/Initramfs $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR) $(TARGET_DIR)/init) rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio* ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) -ifneq ($(qstrip $(CONFIG_EXTERNAL_CPIO)),) +ifneq ($(call qstrip,$(CONFIG_EXTERNAL_CPIO)),) $(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio else ( cd $(TARGET_DIR); find . | LC_ALL=C sort | $(STAGING_DIR_HOST)/bin/cpio --reproducible -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio ) From 6420851c0c4241d075600662612b3ca4d8906bcd Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 27 May 2023 22:08:26 +0200 Subject: [PATCH 0512/1171] CI: build: drop redundant generate ccache hash job Drop redundant generare ccache hash job as that can be done by integrated github expressions to generate an hash. The only change is that the integrated way generate a sha256 hash instead of an md5 sum. Signed-off-by: Christian Marangi (cherry picked from commit 457f6b0b9c07772f529a9714a974f3eb74f9b99d) --- .github/workflows/build.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 816ef6ab3cafbf..eba4df7e91d4f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,6 @@ jobs: runs-on: ubuntu-latest outputs: owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }} container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} steps: @@ -76,13 +75,6 @@ jobs: echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - name: Generate ccache hash - id: ccache_hash - run: | - CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \ - | md5sum | awk '{ print $1 }') - echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT - # Per branch tools container tag # By default stick to latest # For official test targetting openwrt stable branch @@ -231,7 +223,7 @@ jobs: uses: actions/cache@v3 with: path: openwrt/.ccache - key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ needs.setup_build.outputs.ccache_hash }} + key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ hashFiles('openwrt/include/kernel-**') }} restore-keys: | ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}- From b98b3d42969742b29d965558262e903e3642be14 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 20 Dec 2022 20:02:35 +0100 Subject: [PATCH 0513/1171] CI: build: package external toolchain after build Package external toolchain after correct build. Signed-off-by: Christian Marangi (cherry picked from commit ce2e7c52f8ebc7ea92a1436ee2dbeecf149132dc) --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eba4df7e91d4f0..5ca6f4e32eb2e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,10 @@ on: mbedtls wolfssl openssl + build_external_toolchain: + type: boolean + upload_external_toolchain: + type: boolean permissions: contents: read @@ -368,6 +372,12 @@ jobs: working-directory: openwrt run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + - name: Build external toolchain + if: inputs.build_external_toolchain == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make target/toolchain/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + - name: Coverity prepare toolchain if: inputs.coverity_check_packages != '' shell: su buildbot -c "sh -e {0}" @@ -425,3 +435,19 @@ jobs: with: name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs path: "openwrt/logs" + + - name: Find external toolchain name + id: get-toolchain-name + if: inputs.upload_external_toolchain == true + working-directory: openwrt + run: | + TOOLCHAIN_NAME=$(ls bin/targets/${{inputs.target }}/${{ inputs.subtarget }} | grep toolchain) + echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT + + - name: Upload prebuilt toolchain + if: inputs.upload_external_toolchain == true + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.target }}-${{ inputs.subtarget }}-external-toolchain + path: openwrt/bin/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ steps.get-toolchain-name.outputs.toolchain-name }} + retention-days: 1 From 6c80c7533b7524bd333762523f089ff84cf64bdd Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 17 Dec 2022 02:02:26 +0100 Subject: [PATCH 0514/1171] CI: build: add option to configure container to use Add option to configure container to use for build test. By default the tools container is used if no option is provided. Signed-off-by: Christian Marangi (cherry picked from commit 803b0110485a12c1119a51044d17979795ede966) --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ca6f4e32eb2e3..da389e9cf86f5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ on: secrets: coverity_api_token: inputs: + container_name: + type: string + default: tools target: required: true type: string @@ -112,7 +115,7 @@ jobs: needs: setup_build runs-on: ubuntu-latest - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ inputs.container_name }}:${{ needs.setup_build.outputs.container_tag }} permissions: contents: read From 6099d083a656816847207c9cfcb4a1cf86e7aa00 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 23 May 2023 15:25:56 +0200 Subject: [PATCH 0515/1171] CI: build: add checks to test if toolchain container can be used Add checks to test if toolchain container can be used. This is to handle case of new target or migration of any sort. If the toolchain container can't be found, the tools container is used instead. Signed-off-by: Christian Marangi (cherry picked from commit 23a5c715a9296e828be5c32eadf68eacdb326a0a) --- .github/workflows/build.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da389e9cf86f5a..c3843d1dfcdcf9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,6 +65,7 @@ jobs: outputs: owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} + container_name: ${{ steps.determine_tools_container.outputs.container_name }} steps: - name: Checkout @@ -91,6 +92,7 @@ jobs: - name: Determine tools container tag id: determine_tools_container run: | + CONTAINER_NAME=${{ inputs.container_name }} CONTAINER_TAG=latest if [ -n "${{ github.base_ref }}" ]; then if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then @@ -107,15 +109,29 @@ jobs: CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" fi fi - echo "Tools container to use tools:$CONTAINER_TAG" + + if [ "$CONTAINER_NAME" = "toolchain" ]; then + GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) + GHCR_HEADER="Authorization: Bearer ${GHCR_TOKEN}" + GHCR_MANIFEST_LINK=https://ghcr.io/v2/${{ steps.lower_owner.outputs.owner_lc }}/${{ inputs.container_name }}/manifests/${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG" + # Check if container exist + if [ $(curl -s -o /dev/null -w "%{http_code}" -H "$GHCR_HEADER" -I "$GHCR_MANIFEST_LINK") = 200 ]; then + CONTAINER_TAG=${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG" + else + CONTAINER_NAME=tools + fi + fi + + echo "Tools container to use $CONTAINER_NAME:$CONTAINER_TAG" echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT + echo "container_name=$CONTAINER_NAME" >> $GITHUB_OUTPUT build: name: Build ${{ inputs.target }}/${{ inputs.subtarget }} needs: setup_build runs-on: ubuntu-latest - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ inputs.container_name }}:${{ needs.setup_build.outputs.container_tag }} + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ needs.setup_build.outputs.container_name }}:${{ needs.setup_build.outputs.container_tag }} permissions: contents: read From e2780cbb2feac4a5e5e7f010202a5e6eb92d8db3 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 17 Dec 2022 00:21:31 +0100 Subject: [PATCH 0516/1171] CI: push-containers: build and push container with external toolchain Build and push container with external toolchain embedded in the container image. Signed-off-by: Christian Marangi (cherry picked from commit e1370cdd497a07612413106d707973155ad3004b) --- .github/workflows/Dockerfile.toolchain | 8 ++ .github/workflows/push-containers.yml | 156 ++++++++++++++++++++++--- 2 files changed, 146 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/Dockerfile.toolchain diff --git a/.github/workflows/Dockerfile.toolchain b/.github/workflows/Dockerfile.toolchain new file mode 100644 index 00000000000000..949bc2bb5c2041 --- /dev/null +++ b/.github/workflows/Dockerfile.toolchain @@ -0,0 +1,8 @@ +ARG OWNER_LC +ARG CONTAINER_TAG + +FROM ghcr.io/$OWNER_LC/tools:$CONTAINER_TAG + +ARG TOOLCHAIN_NAME + +ADD $TOOLCHAIN_NAME /external-toolchain/ diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index e74e7c22167833..3cc08dbef88150 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -9,6 +9,10 @@ on: - '.github/workflows/build-tools.yml' - '.github/workflows/push-containers.yml' - '.github/workflows/Dockerfile.tools' + - 'toolchain/**' + - '.github/workflows/build.yml' + - '.github/workflows/toolchain.yml' + - '.github/workflows/Dockerfile.toolchain' permissions: contents: read @@ -18,29 +22,21 @@ concurrency: cancel-in-progress: true jobs: - build-linux-buildbot: - name: Build tools with buildbot container - if: ${{ github.repository_owner == 'openwrt' }} - uses: ./.github/workflows/build-tools.yml - with: - generate_prebuilt_artifacts: true - - push-tools-container: - needs: build-linux-buildbot - name: Push prebuilt tools container + determine-container-info: + name: Determine needed info to push containers if: ${{ github.repository_owner == 'openwrt' }} runs-on: ubuntu-latest - - permissions: - contents: read - packages: write + outputs: + owner-lc: ${{ steps.generate-owner-lc.outputs.owner-lc }} + container-tag: ${{ steps.determine-container-tag.outputs.container-tag }} steps: - name: Set lower case owner name + id: generate-owner-lc env: OWNER: ${{ github.repository_owner }} run: | - echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" + echo "owner-lc=${OWNER,,}" >> "$GITHUB_OUTPUT" # Per branch tools container tag # By default stick to latest @@ -51,6 +47,7 @@ jobs: # (example branch openwrt-22.03 -> tools:openwrt-22.03) # (example branch openwrt-22.03-test -> tools:openwrt-22.03) - name: Determine tools container tag + id: determine-container-tag run: | CONTAINER_TAG=latest @@ -64,9 +61,27 @@ jobs: fi fi - echo "Tools container to push tools:$CONTAINER_TAG" - echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV" + echo "Container tag to push for tools and toolchain is $CONTAINER_TAG" + echo "container-tag=$CONTAINER_TAG" >> "$GITHUB_OUTPUT" + + build-linux-buildbot: + name: Build tools with buildbot container + if: ${{ github.repository_owner == 'openwrt' }} + uses: ./.github/workflows/build-tools.yml + with: + generate_prebuilt_artifacts: true + push-tools-container: + needs: [ determine-container-info, build-linux-buildbot ] + if: ${{ github.repository_owner == 'openwrt' }} + name: Push prebuilt tools container + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: - name: Checkout uses: actions/checkout@v3 with: @@ -94,5 +109,110 @@ jobs: with: context: openwrt push: true - tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }} + tags: ghcr.io/${{ needs.determine-container-info.outputs.owner-lc }}/tools:${{ needs.determine-container-info.outputs.container-tag }} file: openwrt/.github/workflows/Dockerfile.tools + + determine-targets: + name: Set targets + if: ${{ github.repository_owner == 'openwrt' }} + runs-on: ubuntu-latest + outputs: + target: ${{ steps.find_targets.outputs.target }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set targets + id: find_targets + run: | + export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \ + | awk '{ print $1 }')" + + JSON='[' + FIRST=1 + for TARGET in $TARGETS; do + TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' + [[ $FIRST -ne 1 ]] && JSON="$JSON"',' + JSON="$JSON""$TUPLE" + FIRST=0 + done + JSON="$JSON"']' + + echo -e "\n---- targets ----\n" + echo "$JSON" + echo -e "\n---- targets ----\n" + + echo "target=$JSON" >> $GITHUB_OUTPUT + + build: + name: Build Target Toolchain + if: ${{ github.repository_owner == 'openwrt' }} + needs: [ determine-targets, push-tools-container ] + permissions: + contents: read + packages: read + strategy: + fail-fast: False + matrix: + include: ${{fromJson(needs.determine-targets.outputs.target)}} + uses: ./.github/workflows/build.yml + with: + target: ${{ matrix.target }} + subtarget: ${{ matrix.subtarget }} + build_toolchain: true + build_external_toolchain: true + upload_external_toolchain: true + + push-toolchain-container: + name: Push Target Toolchain container + if: ${{ github.repository_owner == 'openwrt' }} + needs: [ determine-container-info, determine-targets, build ] + runs-on: ubuntu-latest + + strategy: + fail-fast: False + matrix: + include: ${{fromJson(needs.determine-targets.outputs.target)}} + + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + path: 'openwrt' + + - name: Download external toolchain from build job + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.target }}-${{ matrix.subtarget }}-external-toolchain + path: openwrt + + - name: Find external toolchain name + id: get-toolchain-name + working-directory: openwrt + run: | + TOOLCHAIN_NAME=$(ls | grep toolchain-${{ matrix.target }}-${{ matrix.subtarget }}) + echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: openwrt + push: true + tags: ghcr.io/${{ needs.determine-container-info.outputs.owner-lc }}/toolchain:${{ matrix.target }}-${{ matrix.subtarget }}-${{ needs.determine-container-info.outputs.container-tag }} + file: openwrt/.github/workflows/Dockerfile.toolchain + build-args: | + OWNER_LC=${{ needs.determine-container-info.outputs.owner-lc }} + CONTAINER_TAG=${{ needs.determine-container-info.outputs.container-tag }} + TOOLCHAIN_NAME=${{ steps.get-toolchain-name.outputs.toolchain-name }} From e83384b87e2d3789800084bedc7ae3be2b203663 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 17 Dec 2022 15:07:28 +0100 Subject: [PATCH 0517/1171] CI: build: Add support to use container included external toolchain Add support to use container included external toolchain and skip redownloading external sdk for each test. Signed-off-by: Christian Marangi (cherry picked from commit 0fe5776f4a79a2b095912e258738e3203207e9dd) --- .github/workflows/build.yml | 21 ++++++++++++++++++++- .github/workflows/coverity.yml | 1 + .github/workflows/kernel.yml | 1 + .github/workflows/packages.yml | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3843d1dfcdcf9..6948caf11effb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,6 +176,11 @@ jobs: id: parse-toolchain working-directory: openwrt run: | + if [ -d /external-toolchain/ ]; then + echo "toolchain-type=external_container" >> $GITHUB_OUTPUT + exit 0 + fi + TOOLCHAIN_PATH=snapshots if [ -n "${{ github.base_ref }}" ]; then @@ -251,7 +256,7 @@ jobs: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}- - name: Download external toolchain/sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | @@ -288,6 +293,20 @@ jobs: echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config echo CONFIG_TARGET_ALL_PROFILES=y >> .config + - name: Configure external toolchain in container + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_container' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config + + ./scripts/ext-toolchain.sh \ + --toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \ + --overwrite-config \ + --config ${{ inputs.target }}/${{ inputs.subtarget }} + - name: Configure external toolchain if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain' shell: su buildbot -c "sh -e {0}" diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index db59ef8ca68e86..10355456321513 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -17,6 +17,7 @@ jobs: packages: read uses: ./.github/workflows/build.yml with: + container_name: toolchain target: x86 subtarget: 64 build_full: true diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 02aee8b27cc8ad..b918b2d88e431e 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -109,6 +109,7 @@ jobs: include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} uses: ./.github/workflows/build.yml with: + container_name: toolchain target: ${{ matrix.target }} subtarget: ${{ matrix.subtarget }} build_kernel: true diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index e2f932b1ba3d42..d8270cbb820747 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -43,6 +43,7 @@ jobs: subtarget: 64 uses: ./.github/workflows/build.yml with: + container_name: toolchain target: ${{ matrix.target }} subtarget: ${{ matrix.subtarget }} build_kernel: true From f666723f6d4b480da3ddce75f20fec965c72120c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 25 May 2023 13:52:03 +0200 Subject: [PATCH 0518/1171] CI: ignore master branch for push events Due to problem with migrating from master to main as the default branch and downstream project still requiring the master branch to be present, we currently have for push events double CI runs, one for main and one for master. To solve this ignore any push event to the master branch for every workflow that react on push events. Signed-off-by: Christian Marangi (cherry picked from commit f5a5ce8822e9add9627ecb6ea289c8de2b8a76a9) --- .github/workflows/kernel.yml | 2 ++ .github/workflows/packages.yml | 2 ++ .github/workflows/push-containers.yml | 2 ++ .github/workflows/toolchain.yml | 2 ++ .github/workflows/tools.yml | 2 ++ 5 files changed, 10 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index b918b2d88e431e..6be7ef28c2f4e0 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -17,6 +17,8 @@ on: - 'include/kernel*' - 'package/kernel/**' - 'target/linux/**' + branches-ignore: + - master permissions: contents: read diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index d8270cbb820747..d4d3565cd70b3d 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -19,6 +19,8 @@ on: - 'package/**' - 'target/linux/generic/**' - 'toolchain/**' + branches-ignore: + - master permissions: contents: read diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 3cc08dbef88150..71b9e472531523 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -13,6 +13,8 @@ on: - '.github/workflows/build.yml' - '.github/workflows/toolchain.yml' - '.github/workflows/Dockerfile.toolchain' + branches-ignore: + - master permissions: contents: read diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml index 5755ca25b9db4a..54e31069e6f7d2 100644 --- a/.github/workflows/toolchain.yml +++ b/.github/workflows/toolchain.yml @@ -11,6 +11,8 @@ on: - '.github/workflows/build.yml' - '.github/workflows/toolchain.yml' - 'toolchain/**' + branches-ignore: + - master permissions: contents: read diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 76ebdc664b89ae..83bf5e98f5ad0c 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -13,6 +13,8 @@ on: - 'tools/**' - '.github/workflows/build-tools.yml' - '.github/workflows/tools.yml' + branches-ignore: + - master permissions: contents: read From c5441d24d9c51e597fc01cdca860f6fe5f4794d9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 27 May 2023 17:25:29 +0200 Subject: [PATCH 0519/1171] CI: build: split cache ccache in separate restore and save jobs Split caching ccache in separate restore and save jobs to always refresh the ccache across different runs. Currently if a key is restored, cache is not saved resulting in a less useful ccache that benefits from multiple runs. Signed-off-by: Christian Marangi (cherry picked from commit 6321361c6b13a37b0cfa279a51a0cf8239a7852c) --- .github/workflows/build.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6948caf11effb1..31da7fa7ab5290 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -247,8 +247,9 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Cache ccache - uses: actions/cache@v3 + - name: Restore ccache cache + id: restore-ccache-cache + uses: actions/cache/restore@v3 with: path: openwrt/.ccache key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ hashFiles('openwrt/include/kernel-**') }} @@ -474,6 +475,12 @@ jobs: name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs path: "openwrt/logs" + - name: Save ccache cache + uses: actions/cache/save@v3 + with: + path: openwrt/.ccache + key: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} + - name: Find external toolchain name id: get-toolchain-name if: inputs.upload_external_toolchain == true From fad08e8e23bc1db8224a7f34c5f3775b59cfb577 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 28 May 2023 02:55:26 +0200 Subject: [PATCH 0520/1171] CI: build: add job to remove previous ccache cache if already exist Github Actions cache doesn't permit to overwrite cache if it does already exist. As a trick to refresh and have fresh ccache pool, delete the ccache cache if it does exist with the help of Github REST API. An additional permission is needed to access this API. Add this permittion to each user of the build workflow. Signed-off-by: Christian Marangi (cherry picked from commit 203cc0a7ef0bbf3b5a19db3caa96e91963ec154c) --- .github/workflows/build.yml | 11 +++++++++++ .github/workflows/coverity.yml | 1 + .github/workflows/kernel.yml | 1 + .github/workflows/label-kernel.yml | 2 ++ .github/workflows/label-target.yml | 1 + .github/workflows/packages.yml | 1 + .github/workflows/push-containers.yml | 1 + .github/workflows/toolchain.yml | 1 + 8 files changed, 19 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 31da7fa7ab5290..7ce8a7c034e70d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -136,6 +136,7 @@ jobs: permissions: contents: read packages: read + actions: write steps: - name: Checkout master directory @@ -475,6 +476,16 @@ jobs: name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs path: "openwrt/logs" + - name: Delete already present ccache cache + if: steps.restore-ccache-cache.outputs.cache-hit == 'true' + uses: octokit/request-action@v2.x + with: + route: DELETE /repos/{repository}/actions/caches?key={key} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + INPUT_REPOSITORY: ${{ github.repository }} + INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} + - name: Save ccache cache uses: actions/cache/save@v3 with: diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 10355456321513..363ce3a29a3020 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -15,6 +15,7 @@ jobs: permissions: contents: read packages: read + actions: write uses: ./.github/workflows/build.yml with: container_name: toolchain diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 6be7ef28c2f4e0..d9ab8581c9b455 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -105,6 +105,7 @@ jobs: permissions: contents: read packages: read + actions: write strategy: fail-fast: False matrix: diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index 67faaddfcdfce4..29a9d795588ac3 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -30,6 +30,7 @@ jobs: permissions: contents: read packages: read + actions: write uses: ./.github/workflows/build.yml with: container_name: toolchain @@ -44,6 +45,7 @@ jobs: permissions: contents: read packages: read + actions: write uses: ./.github/workflows/check-kernel-patches.yml with: target: ${{ needs.set_target.outputs.target }} diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml index 78aea28b106b80..610aab026aad43 100644 --- a/.github/workflows/label-target.yml +++ b/.github/workflows/label-target.yml @@ -30,6 +30,7 @@ jobs: permissions: contents: read packages: read + actions: write uses: ./.github/workflows/build.yml with: container_name: toolchain diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index d4d3565cd70b3d..8ab07f1f073c7e 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -35,6 +35,7 @@ jobs: permissions: contents: read packages: read + actions: write strategy: fail-fast: False matrix: diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 71b9e472531523..04a9b8d8e918cf 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -154,6 +154,7 @@ jobs: permissions: contents: read packages: read + actions: write strategy: fail-fast: False matrix: diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml index 54e31069e6f7d2..4f4d78f4f8aecf 100644 --- a/.github/workflows/toolchain.yml +++ b/.github/workflows/toolchain.yml @@ -61,6 +61,7 @@ jobs: permissions: contents: read packages: read + actions: write strategy: fail-fast: False matrix: From c8d4694d2c94fec836533b7a0635c9d41b4b7c3a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 28 May 2023 03:22:51 +0200 Subject: [PATCH 0521/1171] CI: build: add option to disable use of ccache Add option to disable use of ccache. This can be useful for some sensible test that should not use ccache as they can cause side effects of any sort. (example Coverity Scan) Signed-off-by: Christian Marangi (cherry picked from commit b9a41c1e84067bcc63aac633b72e7dc808bfe6fe) --- .github/workflows/build.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ce8a7c034e70d..27ed5cc218e370 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,6 +54,9 @@ on: type: boolean upload_external_toolchain: type: boolean + use_ccache_cache: + type: boolean + default: true permissions: contents: read @@ -250,6 +253,7 @@ jobs: - name: Restore ccache cache id: restore-ccache-cache + if: inputs.use_ccache_cache == true uses: actions/cache/restore@v3 with: path: openwrt/.ccache @@ -295,6 +299,13 @@ jobs: echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config echo CONFIG_TARGET_ALL_PROFILES=y >> .config + - name: Configure ccache + if: inputs.use_ccache_cache == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_CCACHE=y >> .config + - name: Configure external toolchain in container if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_container' shell: su buildbot -c "sh -e {0}" @@ -302,7 +313,6 @@ jobs: run: | echo CONFIG_DEVEL=y >> .config echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config ./scripts/ext-toolchain.sh \ --toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \ @@ -316,7 +326,6 @@ jobs: run: | echo CONFIG_DEVEL=y >> .config echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ @@ -358,7 +367,6 @@ jobs: run: | echo CONFIG_DEVEL=y >> .config echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ @@ -372,7 +380,6 @@ jobs: run: | echo CONFIG_DEVEL=y >> .config echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config @@ -477,7 +484,7 @@ jobs: path: "openwrt/logs" - name: Delete already present ccache cache - if: steps.restore-ccache-cache.outputs.cache-hit == 'true' + if: steps.restore-ccache-cache.outputs.cache-hit == 'true' && inputs.use_ccache_cache == true uses: octokit/request-action@v2.x with: route: DELETE /repos/{repository}/actions/caches?key={key} @@ -487,6 +494,7 @@ jobs: INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} - name: Save ccache cache + if: inputs.use_ccache_cache == true uses: actions/cache/save@v3 with: path: openwrt/.ccache From d7e2468e13fb871026e1969845a1c5ccb9a1dcee Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 28 May 2023 03:12:54 +0200 Subject: [PATCH 0522/1171] CI: build: add option to define custom ccache cache type Add new input to define custom ccache cache type. This is useful to use a different ccache cache for some special workflow that may do more test than simple kernel compilation. Signed-off-by: Christian Marangi (cherry picked from commit 07b52a8a25f261e3cee03f4980e4bc868e9ee5cc) --- .github/workflows/build.yml | 7 +++++-- .github/workflows/packages.yml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27ed5cc218e370..0fbeb5b0f5e517 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,9 @@ on: use_ccache_cache: type: boolean default: true + ccache_type: + type: string + default: kernel permissions: contents: read @@ -257,9 +260,9 @@ jobs: uses: actions/cache/restore@v3 with: path: openwrt/.ccache - key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ hashFiles('openwrt/include/kernel-**') }} + key: ccache-${{ inputs.ccache_type }}-${{ inputs.target }}/${{ inputs.subtarget }}-${{ hashFiles('openwrt/include/kernel-**') }} restore-keys: | - ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}- + ccache-${{ inputs.ccache_type }}-${{ inputs.target }}/${{ inputs.subtarget }}- - name: Download external toolchain/sdk if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 8ab07f1f073c7e..58bbcd01311275 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -53,4 +53,5 @@ jobs: build_all_kmods: true build_all_modules: true build_full: true + ccache_type: packages From 51adcb7cd223f56984abdc27b929d16bde4284cf Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 28 May 2023 03:15:50 +0200 Subject: [PATCH 0523/1171] CI: build: fix ccache cache usage CCache cache is currently broken due to a funny bug in ccache compiler type detection. It seems ccache compiler type detection is very fragile and with the use of external toolchain doesn't correctly detect the type. The type detected is set to other instead of gcc resulting in ccache complaining for unsupported compiler options. To handle this problem, force the compiler type to gcc to make ccache correctly work and speedup compilation. Signed-off-by: Christian Marangi (cherry picked from commit ae7b05328cf471780de8559fba845c4b564e059e) --- .github/workflows/build.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0fbeb5b0f5e517..0c0c05f402b704 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -302,11 +302,22 @@ jobs: echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config echo CONFIG_TARGET_ALL_PROFILES=y >> .config - - name: Configure ccache + # ccache for some reason have problem detecting compiler type + # with external toolchain. This cause the complete malfunction + # of ccache with the result of tons of unsupported compiler + # option error. + # To fix this force compiler type to gcc. + - name: Configure ccache and apply fixes if: inputs.use_ccache_cache == true shell: su buildbot -c "sh -e {0}" working-directory: openwrt + env: + SYSTEM_CCACHE_CONF: staging_dir/host/etc/ccache.conf run: | + touch $SYSTEM_CCACHE_CONF + + echo compiler_type=gcc >> $SYSTEM_CCACHE_CONF + echo CONFIG_CCACHE=y >> .config - name: Configure external toolchain in container From 15f4d6b2441e47ed63df961c43515cba11da3a7b Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 28 May 2023 03:30:12 +0200 Subject: [PATCH 0524/1171] CI: coverity: disable ccache usage Disable ccache usage for coverity workflow as it may cause side effect in the produced bins. Signed-off-by: Christian Marangi (cherry picked from commit 2129ee1879f564a9992a6761d4c9e77077c48e95) --- .github/workflows/coverity.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 363ce3a29a3020..72f39a729bb6e5 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -23,6 +23,7 @@ jobs: subtarget: 64 build_full: true include_feeds: true + use_ccache_cache: false coverity_compiler_template_list: >- x86_64-openwrt-linux-gcc x86_64-openwrt-linux-musl-gcc From 5bfa66bcf3bfcadea059bae1f1d18b388318caa4 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 28 May 2023 09:11:29 +0200 Subject: [PATCH 0525/1171] CI: build: limit cache save/delete only on push events Limit ccache cache save/delete only on push events. Saving ccache cache for pull request will result in bloat and refreshing ccache is not possible due to security measure on enforcing read permission on pull_request events. Signed-off-by: Christian Marangi (cherry picked from commit ff66a7c1c0f012324c0d2d90f047e6976c4fba11) --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c0c05f402b704..95d19f4c4e0b6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -498,7 +498,7 @@ jobs: path: "openwrt/logs" - name: Delete already present ccache cache - if: steps.restore-ccache-cache.outputs.cache-hit == 'true' && inputs.use_ccache_cache == true + if: steps.restore-ccache-cache.outputs.cache-hit == 'true' && inputs.use_ccache_cache == true && github.event_name == 'push' uses: octokit/request-action@v2.x with: route: DELETE /repos/{repository}/actions/caches?key={key} @@ -508,7 +508,7 @@ jobs: INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} - name: Save ccache cache - if: inputs.use_ccache_cache == true + if: inputs.use_ccache_cache == true && github.event_name == 'push' uses: actions/cache/save@v3 with: path: openwrt/.ccache From f7e4f8cbbf8c5ae8602a77112cb2aacb067fce05 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 30 May 2023 18:57:42 +0200 Subject: [PATCH 0526/1171] CI: add support for getting ccache cache from S3 Add support for getting ccache cache from S3. ccache is archieved in a tar and downloaded from S3 Cloud Storage. For push events, ccache is then uplodaed back to S3 to refresh and have a ccache cache always fresh. An additional workflow is added to upload files to an S3 Cloud Storage from artifacts uplodaed to github. The minio tool is used to upload files to S3. If the ccache can't be downloaded from s3, we fallback to github cache system. Also limit s3 upload to the openwrt repository since external fork won't have (obviously) the required secrtes to upload data to the S3 Cloud Storage. Signed-off-by: Christian Marangi (cherry picked from commit ebbc806d30502ff003ae7a19098c6afaaf1295a5) --- .github/workflows/build.yml | 40 ++++++++++++++++++++++-- .github/workflows/kernel.yml | 18 +++++++++++ .github/workflows/packages.yml | 23 ++++++++++++++ .github/workflows/upload-file-s3.yml | 46 ++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/upload-file-s3.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95d19f4c4e0b6e..efaf7594033f1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,8 @@ on: ccache_type: type: string default: kernel + upload_ccache_cache: + type: boolean permissions: contents: read @@ -232,6 +234,20 @@ jobs: echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" + - name: Download and extract ccache cache from s3 + id: restore-ccache-cache-s3 + if: inputs.use_ccache_cache == true + working-directory: openwrt + run: | + ENDPOINT=https://storage.googleapis.com + BUCKET=openwrt-ci-cache + CCACHE_TAR=ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar + + if curl -o /dev/null -s --head --fail $ENDPOINT/$BUCKET/$CCACHE_TAR; then + wget -O - $ENDPOINT/$BUCKET/$CCACHE_TAR | tar -xf - + echo "cache-hit=true" >> $GITHUB_OUTPUT + fi + - name: Fix permission run: | chown -R buildbot:buildbot openwrt @@ -256,7 +272,7 @@ jobs: - name: Restore ccache cache id: restore-ccache-cache - if: inputs.use_ccache_cache == true + if: inputs.use_ccache_cache == true && steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' uses: actions/cache/restore@v3 with: path: openwrt/.ccache @@ -498,7 +514,8 @@ jobs: path: "openwrt/logs" - name: Delete already present ccache cache - if: steps.restore-ccache-cache.outputs.cache-hit == 'true' && inputs.use_ccache_cache == true && github.event_name == 'push' + if: steps.restore-ccache-cache.outputs.cache-hit == 'true' && inputs.use_ccache_cache == true && + github.event_name == 'push' && steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' uses: octokit/request-action@v2.x with: route: DELETE /repos/{repository}/actions/caches?key={key} @@ -508,12 +525,29 @@ jobs: INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} - name: Save ccache cache - if: inputs.use_ccache_cache == true && github.event_name == 'push' + if: inputs.use_ccache_cache == true && github.event_name == 'push' && + steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' uses: actions/cache/save@v3 with: path: openwrt/.ccache key: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} + - name: Archive ccache + if: inputs.use_ccache_cache == true && github.event_name == 'push' && + inputs.upload_ccache_cache == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: tar -cf ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar .ccache + + - name: Upload ccache cache + if: inputs.use_ccache_cache == true && github.event_name == 'push' && + inputs.upload_ccache_cache == true + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.target }}-${{ inputs.subtarget }}-ccache-cache + path: openwrt/ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar + retention-days: 1 + - name: Find external toolchain name id: get-toolchain-name if: inputs.upload_external_toolchain == true diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index d9ab8581c9b455..5f18a39c553222 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -117,6 +117,7 @@ jobs: subtarget: ${{ matrix.subtarget }} build_kernel: true build_all_kmods: true + upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }} check-kernel-patches: name: Check Kernel patches @@ -133,3 +134,20 @@ jobs: target: ${{ matrix.target }} subtarget: ${{ matrix.subtarget }} + upload-ccache-cache-in-s3: + if: github.event_name == 'push' && github.repository_owner == 'openwrt' + name: Upload ccache cache to s3 + needs: [determine_targets, build] + strategy: + fail-fast: False + matrix: + include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} + secrets: + s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} + s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} + uses: ./.github/workflows/upload-file-s3.yml + with: + endpoint: https://storage.googleapis.com + bucket: openwrt-ci-cache + download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache + filename: ccache-kernel-${{ matrix.target }}-${{ matrix.subtarget }}.tar diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 58bbcd01311275..fe2898cacdb8cb 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -54,4 +54,27 @@ jobs: build_all_modules: true build_full: true ccache_type: packages + upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }} + + upload-ccache-cache-in-s3: + if: github.event_name == 'push' && github.repository_owner == 'openwrt' + name: Upload ccache cache to s3 + needs: build + strategy: + fail-fast: False + matrix: + include: + - target: malta + subtarget: be + - target: x86 + subtarget: 64 + secrets: + s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} + s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} + uses: ./.github/workflows/upload-file-s3.yml + with: + endpoint: https://storage.googleapis.com + bucket: openwrt-ci-cache + download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache + filename: ccache-packages-${{ matrix.target }}-${{ matrix.subtarget }}.tar diff --git a/.github/workflows/upload-file-s3.yml b/.github/workflows/upload-file-s3.yml new file mode 100644 index 00000000000000..6bcb172468da9c --- /dev/null +++ b/.github/workflows/upload-file-s3.yml @@ -0,0 +1,46 @@ +name: Upload File to S3 + +on: + workflow_call: + secrets: + s3_access_key: + s3_secret_key: + inputs: + endpoint: + required: true + type: string + bucket: + required: true + type: string + download_id: + required: true + type: string + filename: + required: true + type: string + +jobs: + upload-file-in-s3: + name: Upload file in S3 + runs-on: ubuntu-latest + + steps: + - name: Install minio + run: | + curl https://dl.min.io/client/mc/release/linux-amd64/mc \ + --create-dirs \ + -o $GITHUB_WORKSPACE/minio-binaries/mc + + chmod +x $GITHUB_WORKSPACE/minio-binaries/mc + echo $GITHUB_WORKSPACE/minio-binaries/ >> $GITHUB_PATH + + - name: Setup minio + run: mc alias set s3 ${{ inputs.endpoint }} ${{ secrets.s3_access_key }} ${{ secrets.s3_secret_key }} + + - name: Download file + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.download_id }} + + - name: Upload file to s3 + run: mc cp ${{ inputs.filename }} s3/${{ inputs.bucket }}/ From 05331f0ef8e9c9fd39e9062e44da3fc6c78563c2 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 30 May 2023 20:43:18 +0200 Subject: [PATCH 0527/1171] CI: kernel: test each subtarget on push events Test each subtarget on push events to improve testing and to refresh ccache of each subtarget. Signed-off-by: Christian Marangi (cherry picked from commit 5bafc4352fb543c03389b6237f0e2fe327f328fa) --- .github/workflows/kernel.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 5f18a39c553222..3aa46f5cd7cacf 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -54,10 +54,12 @@ jobs: TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')" TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')" - # On testing non-specific target, skip testing each subtarget - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic; then - TARGETS_SUBTARGETS=$TARGETS + # On testing non-specific target, skip testing each subtarget if we are testing pr + if [ ${{ github.event_name }} != 'push' ]; then + if echo "$CHANGED_FILES" | grep -v -q target/linux || + echo "$CHANGED_FILES" | grep -q target/linux/generic; then + TARGETS_SUBTARGETS=$TARGETS + fi fi JSON_TARGETS_SUBTARGETS='[' From 37395ecb3214f6c086668b9f1a3c3405e06acfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 26 May 2023 11:38:24 +0200 Subject: [PATCH 0528/1171] ci: bump buildworker container to version v6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Its being used by buildbot workers, adds g++-multilib to fix node cross-compilation from a 64-bit build machine to 32-bit host. References: https://github.com/openwrt/buildbot/pull/7 Signed-off-by: Petr Štetiar (cherry picked from commit 567784127e92ba6f9291adb1a546f567e50d9850) --- .github/workflows/Dockerfile.tools | 2 +- .github/workflows/build-tools.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Dockerfile.tools b/.github/workflows/Dockerfile.tools index df5892618a7820..5d365fc56d95ad 100644 --- a/.github/workflows/Dockerfile.tools +++ b/.github/workflows/Dockerfile.tools @@ -1,4 +1,4 @@ -FROM ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v2 +FROM ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v6 COPY --chown=buildbot staging_dir/host /prebuilt_tools/staging_dir/host COPY --chown=buildbot build_dir/host /prebuilt_tools/build_dir/host diff --git a/.github/workflows/build-tools.yml b/.github/workflows/build-tools.yml index 9b865f2608f9bd..0629b1b62ad819 100644 --- a/.github/workflows/build-tools.yml +++ b/.github/workflows/build-tools.yml @@ -13,7 +13,7 @@ jobs: build: name: Build tools runs-on: ubuntu-latest - container: ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v2 + container: ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v6 steps: - name: Checkout From 6cdd9a6de493cc9b8152a73d8449673b1190d1ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 26 May 2023 11:41:18 +0200 Subject: [PATCH 0529/1171] ci: build: verify downloaded toolchain tarball MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CDNs are known to ship outdated or corrupted files, if it unpacks correctly, it necessarily doesn't mean, that we're using the desired content. So lets fix it by checking the tarball as well. I'm adding GPG checking explicitly, its not needed, but just double checking, that everything is working as expected on build infrastructure. Signed-off-by: Petr Štetiar (cherry picked from commit 95dde523297c652072ee96ac32d22912a43ef761) --- .github/workflows/build.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index efaf7594033f1b..367a43383bb616 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -280,13 +280,23 @@ jobs: restore-keys: | ccache-${{ inputs.ccache_type }}-${{ inputs.target }}/${{ inputs.subtarget }}- + - name: Import GPG keys + shell: su buildbot -c "sh -e {0}" + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' + run: gpg --receive-keys 0xCD84BCED626471F1 0x1D53D1877742E911 0xCD54E82DADB3684D + - name: Download external toolchain/sdk if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | - wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ - | tar --xz -xf - + wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz + wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums.asc + wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums + gpg --with-fingerprint --verify sha256sums.asc + sha256sum --check --ignore-missing sha256sums + tar --xz -xf ${{ env.TOOLCHAIN_FILE }}.tar.xz + rm ${{ env.TOOLCHAIN_FILE }}.tar.xz sha256sums - name: Configure testing kernel if: inputs.testing == true From b00fcab13c663a8c85ff2a16f3225febfe5db0d9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 31 May 2023 17:40:11 +0200 Subject: [PATCH 0530/1171] CI: label-kernel: support compile testing kernel version and all target Add support to label-kernel for compiling testing kernel version and check patches. To trigger this special build appent :testing to the normal label. Example: - ci:kernel:ipq806x:generic:testing Test will fail if the requested target doesn't have a defined kernel testing version. Also add support for testing all target and subtarget. To trigger this some special pattern are added: - ci:kernel:all:all Trigger test for all target and subtarget - ci:kernel:all:first Trigger test for all target and the first subtarget in alphabetical order for the target. With these special case :testing can also be used and every target and subtarget that supports kernel testing version will be selected: - ci:kernel:all:all:testing Trigger test for all target and subtarget that have a kernel testing version defined. - ci:kernel:all:first:testing Trigger test for all target and the first subtarget in alphabetical order for the target that, if they have a kernel testing version defined. Signed-off-by: Christian Marangi (cherry picked from commit 218deba503f38e2f44f5012baf96af91b3e00c6a) --- .github/workflows/label-kernel.yml | 97 +++++++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 10 deletions(-) diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index 29a9d795588ac3..eab79cf0c0ca78 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -12,17 +12,84 @@ jobs: name: Set target runs-on: ubuntu-latest outputs: - target: ${{ steps.set_target.outputs.target }} - subtarget: ${{ steps.set_target.outputs.subtarget }} + targets_subtargets: ${{ steps.set_target.outputs.targets_subtargets }} + targets: ${{ steps.set_target.outputs.targets }} steps: - - name: Set target - id: set_target + - name: Checkout + uses: actions/checkout@v3 + + - name: Parse label + id: parse_label env: CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/testing=\3/p' | tee --append $GITHUB_OUTPUT + + - name: Set targets + id: set_target + run: | + ALL_TARGETS="$(perl ./scripts/dump-target-info.pl kernels 2>/dev/null)" + + TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1)" + TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1)" + + [ "${{ steps.parse_label.outputs.subtarget }}" = "first" ] && TARGETS_SUBTARGETS=$TARGETS + + JSON_TARGETS_SUBTARGETS='[' + FIRST=1 + while IFS= read -r line; do + TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1) + TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1) + SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2) + + [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != "$TARGET" ] && continue + [ "${{ steps.parse_label.outputs.subtarget }}" != "all" ] && [ "${{ steps.parse_label.outputs.subtarget }}" != "first" ] && + [ "${{ steps.parse_label.outputs.subtarget }}" != $SUBTARGET ] && continue + if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then + TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3) + [ -z "$TESTING_KERNEL_VER" ] && continue + fi + + TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}' + [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' + JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE" + FIRST=0 + done <<< "$TARGETS_SUBTARGETS" + JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']' + + JSON_TARGETS='[' + FIRST=1 + while IFS= read -r line; do + TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1) + TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1) + SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2) + + [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != $TARGET ] && continue + if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then + TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3) + [ -z "$TESTING_KERNEL_VER" ] && continue + fi + + TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}' + [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' + JSON_TARGETS="$JSON_TARGETS""$TUPLE" + FIRST=0 + done <<< "$TARGETS" + JSON_TARGETS="$JSON_TARGETS"']' + + echo -e "\n---- targets to build ----\n" + echo "$JSON_TARGETS_SUBTARGETS" + echo -e "\n---- targets to build ----\n" + + echo -e "\n---- targets to check patch ----\n" + echo "$JSON_TARGETS" + echo -e "\n---- targets to check patch ----\n" + + echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT + echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT build_kernel: name: Build Kernel with external toolchain @@ -32,10 +99,15 @@ jobs: packages: read actions: write uses: ./.github/workflows/build.yml + strategy: + fail-fast: False + matrix: + include: ${{fromJson(needs.set_target.outputs.targets_subtargets)}} with: container_name: toolchain - target: ${{ needs.set_target.outputs.target }} - subtarget: ${{ needs.set_target.outputs.subtarget }} + target: ${{ matrix.target }} + subtarget: ${{ matrix.subtarget }} + testing: ${{ matrix.testing != '' && true }} build_kernel: true build_all_kmods: true @@ -46,7 +118,12 @@ jobs: contents: read packages: read actions: write + strategy: + fail-fast: False + matrix: + include: ${{fromJson(needs.set_target.outputs.targets)}} uses: ./.github/workflows/check-kernel-patches.yml with: - target: ${{ needs.set_target.outputs.target }} - subtarget: ${{ needs.set_target.outputs.subtarget }} + target: ${{ matrix.target }} + subtarget: ${{ matrix.subtarget }} + testing: ${{ matrix.testing != '' && true }} From 3826ebbd181770d43a2a057611707d96ec90b550 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 3 Nov 2022 13:32:51 +0100 Subject: [PATCH 0531/1171] CI: build-tools: build all host tools Now that we build also core packages, we need more host tools. Compile all of them to reduce compile time on other actions. Signed-off-by: Christian Marangi (cherry picked from commit de9955a62f6aab6eafb2cfdffc4829ee97e69c04) --- .github/workflows/build-tools.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-tools.yml b/.github/workflows/build-tools.yml index 0629b1b62ad819..0212925c5000a7 100644 --- a/.github/workflows/build-tools.yml +++ b/.github/workflows/build-tools.yml @@ -32,6 +32,7 @@ jobs: echo CONFIG_DEVEL=y >> .config echo CONFIG_AUTOREMOVE=y >> .config echo CONFIG_CCACHE=y >> .config + echo CONFIG_BUILD_ALL_HOST_TOOLS=y >> .config - name: Make prereq shell: su buildbot -c "sh -e {0}" From 76a9b0e02a614ec15f4dc771df32de90ab30d779 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 19 Jun 2023 13:55:32 +0200 Subject: [PATCH 0532/1171] CI: migrate each workflow to use reusable workflow from dedicated repo Migrate each workflow to use reusable workflow from dedicated repo to skip pushing CI related commits to openwrt and better track versioning of CI workflow. Signed-off-by: Christian Marangi (cherry picked from commit 38cc09165fd11caa9599d960280bd91dbaba7a62) --- .github/workflows/coverity.yml | 51 +------ .github/workflows/kernel.yml | 121 +--------------- .github/workflows/label-kernel.yml | 119 +-------------- .github/workflows/label-target.yml | 32 +---- .github/workflows/packages.yml | 46 +----- .github/workflows/push-containers.yml | 199 +------------------------- .github/workflows/toolchain.yml | 50 +------ .github/workflows/tools.yml | 74 +--------- 8 files changed, 22 insertions(+), 670 deletions(-) diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 72f39a729bb6e5..f54695986daace 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -16,53 +16,4 @@ jobs: contents: read packages: read actions: write - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: x86 - subtarget: 64 - build_full: true - include_feeds: true - use_ccache_cache: false - coverity_compiler_template_list: >- - x86_64-openwrt-linux-gcc - x86_64-openwrt-linux-musl-gcc - # qosify fails to build with cov-build - coverity_check_packages: >- - cgi-io - dnsmasq - dropbear - firewall - fstools - fwtool - iwinfo - jsonfilter - libnl-tiny - libubox - mtd - netifd - odhcp6c - odhcpd - opkg - procd - relayd - rpcd - swconfig - ubox - ubus - ucert - uci - uclient - ucode - ugps - uhttpd - umbim - umdns - unetd - uqmi - urngd - usbmode - usign - usteer - ustp - ustream-ssl + uses: openwrt/actions-shared-workflows/.github/workflows/coverity.yml@main diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 3aa46f5cd7cacf..87b8a14293b1b8 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -28,128 +28,13 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - determine_targets: - name: Set targets - runs-on: ubuntu-latest - outputs: - targets_subtargets: ${{ steps.find_targets.outputs.targets_subtargets }} - targets: ${{ steps.find_targets.outputs.targets }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - - - name: Set targets - id: find_targets - run: | - ALL_TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null)" - CHANGED_FILES="$(echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ' ' '\n')" - - TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')" - TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')" - - # On testing non-specific target, skip testing each subtarget if we are testing pr - if [ ${{ github.event_name }} != 'push' ]; then - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic; then - TARGETS_SUBTARGETS=$TARGETS - fi - fi - - JSON_TARGETS_SUBTARGETS='[' - FIRST=1 - for TARGET in $TARGETS_SUBTARGETS; do - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic || - echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE" - FIRST=0 - fi - done - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']' - - JSON_TARGETS='[' - FIRST=1 - for TARGET in $TARGETS; do - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic || - echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' - JSON_TARGETS="$JSON_TARGETS""$TUPLE" - FIRST=0 - fi - done - JSON_TARGETS="$JSON_TARGETS"']' - - echo -e "\n---- targets to build ----\n" - echo "$JSON_TARGETS_SUBTARGETS" - echo -e "\n---- targets to build ----\n" - - echo -e "\n---- targets to check patch ----\n" - echo "$JSON_TARGETS" - echo -e "\n---- targets to check patch ----\n" - - echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT - echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT - - build: - name: Build Kernel with external toolchain - needs: determine_targets + build-kernels: + name: Build all affected Kernels permissions: contents: read packages: read actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_kernel: true - build_all_kmods: true - upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }} - - check-kernel-patches: - name: Check Kernel patches - needs: determine_targets - permissions: - contents: read - packages: read - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets)}} - uses: ./.github/workflows/check-kernel-patches.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - - upload-ccache-cache-in-s3: - if: github.event_name == 'push' && github.repository_owner == 'openwrt' - name: Upload ccache cache to s3 - needs: [determine_targets, build] - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} secrets: s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} - uses: ./.github/workflows/upload-file-s3.yml - with: - endpoint: https://storage.googleapis.com - bucket: openwrt-ci-cache - download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache - filename: ccache-kernel-${{ matrix.target }}-${{ matrix.subtarget }}.tar + uses: openwrt/actions-shared-workflows/.github/workflows/kernel.yml@main diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index eab79cf0c0ca78..655d7d6ff371b5 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -7,123 +7,10 @@ on: - labeled jobs: - set_target: - if: startsWith(github.event.label.name, 'ci:kernel:') - name: Set target - runs-on: ubuntu-latest - outputs: - targets_subtargets: ${{ steps.set_target.outputs.targets_subtargets }} - targets: ${{ steps.set_target.outputs.targets }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Parse label - id: parse_label - env: - CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} - run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/testing=\3/p' | tee --append $GITHUB_OUTPUT - - - name: Set targets - id: set_target - run: | - ALL_TARGETS="$(perl ./scripts/dump-target-info.pl kernels 2>/dev/null)" - - TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1)" - TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1)" - - [ "${{ steps.parse_label.outputs.subtarget }}" = "first" ] && TARGETS_SUBTARGETS=$TARGETS - - JSON_TARGETS_SUBTARGETS='[' - FIRST=1 - while IFS= read -r line; do - TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1) - TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1) - SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2) - - [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != "$TARGET" ] && continue - [ "${{ steps.parse_label.outputs.subtarget }}" != "all" ] && [ "${{ steps.parse_label.outputs.subtarget }}" != "first" ] && - [ "${{ steps.parse_label.outputs.subtarget }}" != $SUBTARGET ] && continue - if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then - TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3) - [ -z "$TESTING_KERNEL_VER" ] && continue - fi - - TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE" - FIRST=0 - done <<< "$TARGETS_SUBTARGETS" - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']' - - JSON_TARGETS='[' - FIRST=1 - while IFS= read -r line; do - TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1) - TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1) - SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2) - - [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != $TARGET ] && continue - if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then - TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3) - [ -z "$TESTING_KERNEL_VER" ] && continue - fi - - TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' - JSON_TARGETS="$JSON_TARGETS""$TUPLE" - FIRST=0 - done <<< "$TARGETS" - JSON_TARGETS="$JSON_TARGETS"']' - - echo -e "\n---- targets to build ----\n" - echo "$JSON_TARGETS_SUBTARGETS" - echo -e "\n---- targets to build ----\n" - - echo -e "\n---- targets to check patch ----\n" - echo "$JSON_TARGETS" - echo -e "\n---- targets to check patch ----\n" - - echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT - echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT - - build_kernel: - name: Build Kernel with external toolchain - needs: set_target - permissions: - contents: read - packages: read - actions: write - uses: ./.github/workflows/build.yml - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.set_target.outputs.targets_subtargets)}} - with: - container_name: toolchain - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - testing: ${{ matrix.testing != '' && true }} - build_kernel: true - build_all_kmods: true - - check-kernel-patches: - name: Check Kernel patches - needs: set_target + build-kernels-label: + name: Build all affected Kernels from defined label permissions: contents: read packages: read actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.set_target.outputs.targets)}} - uses: ./.github/workflows/check-kernel-patches.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - testing: ${{ matrix.testing != '' && true }} + uses: openwrt/actions-shared-workflows/.github/workflows/label-kernel.yml@main diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml index 610aab026aad43..989ee9fcb43491 100644 --- a/.github/workflows/label-target.yml +++ b/.github/workflows/label-target.yml @@ -7,36 +7,10 @@ on: - labeled jobs: - set_target: - if: startsWith(github.event.label.name, 'ci:target:') - name: Set target - runs-on: ubuntu-latest - outputs: - target: ${{ steps.set_target.outputs.target }} - subtarget: ${{ steps.set_target.outputs.subtarget }} - - steps: - - name: Set target - id: set_target - env: - CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} - run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT - - build_target: - name: Build target - needs: set_target + build-target-label: + name: Build target from defined label permissions: contents: read packages: read actions: write - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ needs.set_target.outputs.target }} - subtarget: ${{ needs.set_target.outputs.subtarget }} - build_full: true - build_all_kmods: true - build_all_boards: true - build_all_modules: true + uses: openwrt/actions-shared-workflows/.github/workflows/label-target.yml@main diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index fe2898cacdb8cb..07621dcb4ac4c1 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -3,7 +3,6 @@ name: Build all core packages on: pull_request: paths: - - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' @@ -12,7 +11,6 @@ on: - 'toolchain/**' push: paths: - - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' @@ -30,51 +28,13 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - build: - name: Build Packages with external toolchain + build-packages: + name: Build all core packages for selected target permissions: contents: read packages: read actions: write - strategy: - fail-fast: False - matrix: - include: - - target: malta - subtarget: be - - target: x86 - subtarget: 64 - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_kernel: true - build_all_kmods: true - build_all_modules: true - build_full: true - ccache_type: packages - upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }} - - upload-ccache-cache-in-s3: - if: github.event_name == 'push' && github.repository_owner == 'openwrt' - name: Upload ccache cache to s3 - needs: build - strategy: - fail-fast: False - matrix: - include: - - target: malta - subtarget: be - - target: x86 - subtarget: 64 secrets: s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} - uses: ./.github/workflows/upload-file-s3.yml - with: - endpoint: https://storage.googleapis.com - bucket: openwrt-ci-cache - download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache - filename: ccache-packages-${{ matrix.target }}-${{ matrix.subtarget }}.tar - + uses: openwrt/actions-shared-workflows/.github/workflows/packages.yml@main diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 04a9b8d8e918cf..74f534d57a4a40 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -6,13 +6,8 @@ on: - 'include/version.mk' - 'include/cmake.mk' - 'tools/**' - - '.github/workflows/build-tools.yml' - '.github/workflows/push-containers.yml' - - '.github/workflows/Dockerfile.tools' - 'toolchain/**' - - '.github/workflows/build.yml' - - '.github/workflows/toolchain.yml' - - '.github/workflows/Dockerfile.toolchain' branches-ignore: - master @@ -24,198 +19,10 @@ concurrency: cancel-in-progress: true jobs: - determine-container-info: - name: Determine needed info to push containers - if: ${{ github.repository_owner == 'openwrt' }} - runs-on: ubuntu-latest - outputs: - owner-lc: ${{ steps.generate-owner-lc.outputs.owner-lc }} - container-tag: ${{ steps.determine-container-tag.outputs.container-tag }} - - steps: - - name: Set lower case owner name - id: generate-owner-lc - env: - OWNER: ${{ github.repository_owner }} - run: | - echo "owner-lc=${OWNER,,}" >> "$GITHUB_OUTPUT" - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9] - # will refresh the tools container with the matching tag. - # (example branch openwrt-22.03 -> tools:openwrt-22.03) - # (example branch openwrt-22.03-test -> tools:openwrt-22.03) - - name: Determine tools container tag - id: determine-container-tag - run: | - CONTAINER_TAG=latest - - if [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - echo "Container tag to push for tools and toolchain is $CONTAINER_TAG" - echo "container-tag=$CONTAINER_TAG" >> "$GITHUB_OUTPUT" - - build-linux-buildbot: - name: Build tools with buildbot container - if: ${{ github.repository_owner == 'openwrt' }} - uses: ./.github/workflows/build-tools.yml - with: - generate_prebuilt_artifacts: true - - push-tools-container: - needs: [ determine-container-info, build-linux-buildbot ] - if: ${{ github.repository_owner == 'openwrt' }} - name: Push prebuilt tools container - runs-on: ubuntu-latest - + build-push-containers: + name: Build and Push all prebuilt containers permissions: contents: read packages: write - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: 'openwrt' - - - name: Download prebuilt tools from build job - uses: actions/download-artifact@v3 - with: - name: linux-buildbot-prebuilt-tools - path: openwrt - - - name: Extract prebuild tools - working-directory: openwrt - run: tar -xf tools.tar - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: openwrt - push: true - tags: ghcr.io/${{ needs.determine-container-info.outputs.owner-lc }}/tools:${{ needs.determine-container-info.outputs.container-tag }} - file: openwrt/.github/workflows/Dockerfile.tools - - determine-targets: - name: Set targets - if: ${{ github.repository_owner == 'openwrt' }} - runs-on: ubuntu-latest - outputs: - target: ${{ steps.find_targets.outputs.target }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set targets - id: find_targets - run: | - export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \ - | awk '{ print $1 }')" - - JSON='[' - FIRST=1 - for TARGET in $TARGETS; do - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON="$JSON"',' - JSON="$JSON""$TUPLE" - FIRST=0 - done - JSON="$JSON"']' - - echo -e "\n---- targets ----\n" - echo "$JSON" - echo -e "\n---- targets ----\n" - - echo "target=$JSON" >> $GITHUB_OUTPUT - - build: - name: Build Target Toolchain - if: ${{ github.repository_owner == 'openwrt' }} - needs: [ determine-targets, push-tools-container ] - permissions: - contents: read - packages: read actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine-targets.outputs.target)}} - uses: ./.github/workflows/build.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_toolchain: true - build_external_toolchain: true - upload_external_toolchain: true - - push-toolchain-container: - name: Push Target Toolchain container - if: ${{ github.repository_owner == 'openwrt' }} - needs: [ determine-container-info, determine-targets, build ] - runs-on: ubuntu-latest - - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine-targets.outputs.target)}} - - permissions: - contents: read - packages: write - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: 'openwrt' - - - name: Download external toolchain from build job - uses: actions/download-artifact@v3 - with: - name: ${{ matrix.target }}-${{ matrix.subtarget }}-external-toolchain - path: openwrt - - - name: Find external toolchain name - id: get-toolchain-name - working-directory: openwrt - run: | - TOOLCHAIN_NAME=$(ls | grep toolchain-${{ matrix.target }}-${{ matrix.subtarget }}) - echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: openwrt - push: true - tags: ghcr.io/${{ needs.determine-container-info.outputs.owner-lc }}/toolchain:${{ matrix.target }}-${{ matrix.subtarget }}-${{ needs.determine-container-info.outputs.container-tag }} - file: openwrt/.github/workflows/Dockerfile.toolchain - build-args: | - OWNER_LC=${{ needs.determine-container-info.outputs.owner-lc }} - CONTAINER_TAG=${{ needs.determine-container-info.outputs.container-tag }} - TOOLCHAIN_NAME=${{ steps.get-toolchain-name.outputs.toolchain-name }} + uses: openwrt/actions-shared-workflows/.github/workflows/push-containers.yml@main diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml index 4f4d78f4f8aecf..0bc9fec1795f76 100644 --- a/.github/workflows/toolchain.yml +++ b/.github/workflows/toolchain.yml @@ -3,12 +3,10 @@ name: Build Toolchains on: pull_request: paths: - - '.github/workflows/build.yml' - '.github/workflows/toolchain.yml' - 'toolchain/**' push: paths: - - '.github/workflows/build.yml' - '.github/workflows/toolchain.yml' - 'toolchain/**' branches-ignore: @@ -22,52 +20,10 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - determine_targets: - name: Set targets - runs-on: ubuntu-latest - outputs: - target: ${{ steps.find_targets.outputs.target }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set targets - id: find_targets - run: | - export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \ - | sort -u -t '/' -k1,1 \ - | awk '{ print $1 }')" - - JSON='[' - FIRST=1 - for TARGET in $TARGETS; do - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON="$JSON"',' - JSON="$JSON""$TUPLE" - FIRST=0 - done - JSON="$JSON"']' - - echo -e "\n---- targets ----\n" - echo "$JSON" - echo -e "\n---- targets ----\n" - - echo "target=$JSON" >> $GITHUB_OUTPUT - - build: - name: Build Target Toolchain - needs: determine_targets + build-toolchains: + name: Build Toolchains for each target permissions: contents: read packages: read actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.target)}} - uses: ./.github/workflows/build.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_toolchain: true + uses: openwrt/actions-shared-workflows/.github/workflows/toolchain.yml@main diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 83bf5e98f5ad0c..35904a5e564f65 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -5,13 +5,11 @@ on: paths: - 'include/**' - 'tools/**' - - '.github/workflows/build-tools.yml' - '.github/workflows/tools.yml' push: paths: - 'include/**' - 'tools/**' - - '.github/workflows/build-tools.yml' - '.github/workflows/tools.yml' branches-ignore: - master @@ -24,72 +22,6 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - build-macos-latest: - name: Build tools with macos latest - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Setup MacOS - run: | - echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV" - hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage - hdiutil attach OpenWrt.sparseimage - mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/ - - - name: Install required prereq on MacOS - working-directory: ${{ env.WORKPATH }}/openwrt - run: | - brew install \ - automake \ - coreutils \ - diffutils \ - findutils \ - gawk \ - git-extras \ - gnu-getopt \ - gnu-sed \ - grep \ - make - - echo "/bin" >> "$GITHUB_PATH" - echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH" - echo "/usr/bin" >> "$GITHUB_PATH" - echo "/usr/local/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/sbin" >> "$GITHUB_PATH" - - - name: Make prereq - working-directory: ${{ env.WORKPATH }}/openwrt - run: make defconfig - - - name: Build tools MacOS - working-directory: ${{ env.WORKPATH }}/openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: macos-latest-logs - path: ${{ env.WORKPATH }}/openwrt/logs - - - name: Upload config - if: always() - uses: actions/upload-artifact@v3 - with: - name: macos-latest-config - path: ${{ env.WORKPATH }}/openwrt/.config - - build-linux-buildbot: - name: Build tools with buildbot container - uses: ./.github/workflows/build-tools.yml + build-tools: + name: Build host tools for linux and macos based systems + uses: openwrt/actions-shared-workflows/.github/workflows/tools.yml@main From b63c6e3512077fa452a0736f5bec2169c8bef6cc Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 19 Jun 2023 13:39:42 +0200 Subject: [PATCH 0533/1171] CI: drop unused reusable workflow and dockerfiles Drop unused reusable workflow and dockerfiles now that we moved them to a dedicated repository. Signed-off-by: Christian Marangi (cherry picked from commit 14293dd901e5fdb0fd242945b5916ccbb33ab328) --- .github/workflows/Dockerfile.toolchain | 8 - .github/workflows/Dockerfile.tools | 4 - .github/workflows/build-tools.yml | 73 --- .github/workflows/build.yml | 575 --------------------- .github/workflows/check-kernel-patches.yml | 155 ------ .github/workflows/upload-file-s3.yml | 46 -- 6 files changed, 861 deletions(-) delete mode 100644 .github/workflows/Dockerfile.toolchain delete mode 100644 .github/workflows/Dockerfile.tools delete mode 100644 .github/workflows/build-tools.yml delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/check-kernel-patches.yml delete mode 100644 .github/workflows/upload-file-s3.yml diff --git a/.github/workflows/Dockerfile.toolchain b/.github/workflows/Dockerfile.toolchain deleted file mode 100644 index 949bc2bb5c2041..00000000000000 --- a/.github/workflows/Dockerfile.toolchain +++ /dev/null @@ -1,8 +0,0 @@ -ARG OWNER_LC -ARG CONTAINER_TAG - -FROM ghcr.io/$OWNER_LC/tools:$CONTAINER_TAG - -ARG TOOLCHAIN_NAME - -ADD $TOOLCHAIN_NAME /external-toolchain/ diff --git a/.github/workflows/Dockerfile.tools b/.github/workflows/Dockerfile.tools deleted file mode 100644 index 5d365fc56d95ad..00000000000000 --- a/.github/workflows/Dockerfile.tools +++ /dev/null @@ -1,4 +0,0 @@ -FROM ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v6 - -COPY --chown=buildbot staging_dir/host /prebuilt_tools/staging_dir/host -COPY --chown=buildbot build_dir/host /prebuilt_tools/build_dir/host diff --git a/.github/workflows/build-tools.yml b/.github/workflows/build-tools.yml deleted file mode 100644 index 0212925c5000a7..00000000000000 --- a/.github/workflows/build-tools.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Build host tools - -on: - workflow_call: - inputs: - generate_prebuilt_artifacts: - type: boolean - -permissions: - contents: read - -jobs: - build: - name: Build tools - runs-on: ubuntu-latest - container: ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v6 - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Fix permission - run: chown -R buildbot:buildbot openwrt - - - name: Set configs for tools container - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - touch .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - echo CONFIG_BUILD_ALL_HOST_TOOLS=y >> .config - - - name: Make prereq - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make defconfig - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-logs - path: openwrt/logs - - - name: Upload config - if: always() - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-config - path: openwrt/.config - - - name: Archive prebuilt tools - if: inputs.generate_prebuilt_artifacts == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: tar -cf tools.tar staging_dir/host build_dir/host - - - name: Upload prebuilt tools - if: inputs.generate_prebuilt_artifacts == true - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-prebuilt-tools - path: openwrt/tools.tar - retention-days: 1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 367a43383bb616..00000000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,575 +0,0 @@ -name: Build sub target - -on: - workflow_call: - secrets: - coverity_api_token: - inputs: - container_name: - type: string - default: tools - target: - required: true - type: string - subtarget: - required: true - type: string - testing: - type: boolean - build_toolchain: - type: boolean - include_feeds: - type: boolean - build_full: - type: boolean - build_kernel: - type: boolean - build_all_modules: - type: boolean - build_all_kmods: - type: boolean - build_all_boards: - type: boolean - use_openwrt_container: - type: boolean - default: true - coverity_project_name: - type: string - default: OpenWrt - coverity_check_packages: - type: string - coverity_compiler_template_list: - type: string - default: >- - arm-openwrt-linux-gcc - coverity_force_compile_packages: - type: string - default: >- - curl - libnl - mbedtls - wolfssl - openssl - build_external_toolchain: - type: boolean - upload_external_toolchain: - type: boolean - use_ccache_cache: - type: boolean - default: true - ccache_type: - type: string - default: kernel - upload_ccache_cache: - type: boolean - -permissions: - contents: read - -jobs: - setup_build: - name: Setup build ${{ inputs.target }}/${{ inputs.subtarget }} - runs-on: ubuntu-latest - outputs: - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} - container_name: ${{ steps.determine_tools_container.outputs.container_name }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - - if [ ${{ inputs.use_openwrt_container }} == "true" ]; then - OWNER_LC=openwrt - fi - - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # For local test to use the correct container for stable release testing - # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- - - name: Determine tools container tag - id: determine_tools_container - run: | - CONTAINER_NAME=${{ inputs.container_name }} - CONTAINER_TAG=latest - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG="${{ github.base_ref }}" - fi - elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG=${{ github.ref_name }} - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - if [ "$CONTAINER_NAME" = "toolchain" ]; then - GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) - GHCR_HEADER="Authorization: Bearer ${GHCR_TOKEN}" - GHCR_MANIFEST_LINK=https://ghcr.io/v2/${{ steps.lower_owner.outputs.owner_lc }}/${{ inputs.container_name }}/manifests/${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG" - # Check if container exist - if [ $(curl -s -o /dev/null -w "%{http_code}" -H "$GHCR_HEADER" -I "$GHCR_MANIFEST_LINK") = 200 ]; then - CONTAINER_TAG=${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG" - else - CONTAINER_NAME=tools - fi - fi - - echo "Tools container to use $CONTAINER_NAME:$CONTAINER_TAG" - echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT - echo "container_name=$CONTAINER_NAME" >> $GITHUB_OUTPUT - - build: - name: Build ${{ inputs.target }}/${{ inputs.subtarget }} - needs: setup_build - runs-on: ubuntu-latest - - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ needs.setup_build.outputs.container_name }}:${{ needs.setup_build.outputs.container_tag }} - - permissions: - contents: read - packages: read - actions: write - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Checkout packages feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/packages - path: openwrt/feeds/packages - - - name: Checkout luci feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/luci - path: openwrt/feeds/luci - - - name: Checkout routing feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/routing - path: openwrt/feeds/routing - - - name: Checkout telephony feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/telephony - path: openwrt/feeds/telephony - - - name: Parse toolchain file - if: inputs.build_toolchain == false - id: parse-toolchain - working-directory: openwrt - run: | - if [ -d /external-toolchain/ ]; then - echo "toolchain-type=external_container" >> $GITHUB_OUTPUT - exit 0 - fi - - TOOLCHAIN_PATH=snapshots - - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - major_ver="$(echo ${{ github.base_ref }} | sed 's/^openwrt-/v/')" - fi - elif [ "${{ github.ref_type }}" = "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-/v/')" - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')" - fi - elif [ "${{ github.ref_type }}" = "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - if [ -n "$major_ver" ]; then - git fetch --tags -f - latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)" - if [ -n "$latest_tag" ]; then - TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//') - fi - fi - - SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums" - if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then - TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - - echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT - elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then - TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p') - - echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT - else - echo "toolchain-type=internal" >> $GITHUB_OUTPUT - fi - - echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" - echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" - - - name: Download and extract ccache cache from s3 - id: restore-ccache-cache-s3 - if: inputs.use_ccache_cache == true - working-directory: openwrt - run: | - ENDPOINT=https://storage.googleapis.com - BUCKET=openwrt-ci-cache - CCACHE_TAR=ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar - - if curl -o /dev/null -s --head --fail $ENDPOINT/$BUCKET/$CCACHE_TAR; then - wget -O - $ENDPOINT/$BUCKET/$CCACHE_TAR | tar -xf - - echo "cache-hit=true" >> $GITHUB_OUTPUT - fi - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Prepare prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - mkdir -p staging_dir build_dir - ln -s /prebuilt_tools/staging_dir/host staging_dir/host - ln -s /prebuilt_tools/build_dir/host build_dir/host - - ./scripts/ext-tools.sh --refresh - - - name: Update & Install feeds - if: inputs.include_feeds == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - ./scripts/feeds update -a - ./scripts/feeds install -a - - - name: Restore ccache cache - id: restore-ccache-cache - if: inputs.use_ccache_cache == true && steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' - uses: actions/cache/restore@v3 - with: - path: openwrt/.ccache - key: ccache-${{ inputs.ccache_type }}-${{ inputs.target }}/${{ inputs.subtarget }}-${{ hashFiles('openwrt/include/kernel-**') }} - restore-keys: | - ccache-${{ inputs.ccache_type }}-${{ inputs.target }}/${{ inputs.subtarget }}- - - - name: Import GPG keys - shell: su buildbot -c "sh -e {0}" - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' - run: gpg --receive-keys 0xCD84BCED626471F1 0x1D53D1877742E911 0xCD54E82DADB3684D - - - name: Download external toolchain/sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz - wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums.asc - wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums - gpg --with-fingerprint --verify sha256sums.asc - sha256sum --check --ignore-missing sha256sums - tar --xz -xf ${{ env.TOOLCHAIN_FILE }}.tar.xz - rm ${{ env.TOOLCHAIN_FILE }}.tar.xz sha256sums - - - name: Configure testing kernel - if: inputs.testing == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TESTING_KERNEL=y >> .config - - - name: Configure all kernel modules - if: inputs.build_all_kmods == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - - - name: Configure all modules - if: inputs.build_all_modules == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL=y >> .config - - - name: Configure all boards - if: inputs.build_all_boards == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TARGET_MULTI_PROFILE=y >> .config - echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config - echo CONFIG_TARGET_ALL_PROFILES=y >> .config - - # ccache for some reason have problem detecting compiler type - # with external toolchain. This cause the complete malfunction - # of ccache with the result of tons of unsupported compiler - # option error. - # To fix this force compiler type to gcc. - - name: Configure ccache and apply fixes - if: inputs.use_ccache_cache == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - env: - SYSTEM_CCACHE_CONF: staging_dir/host/etc/ccache.conf - run: | - touch $SYSTEM_CCACHE_CONF - - echo compiler_type=gcc >> $SYSTEM_CCACHE_CONF - - echo CONFIG_CCACHE=y >> .config - - - name: Configure external toolchain in container - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_container' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Configure external toolchain - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Adapt external sdk to external toolchain format - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain) - TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin - OPENWRT_DIR=$(pwd) - - # Find target name from toolchain info.mk - GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/') - - cd $TOOLCHAIN_BIN - - # Revert sdk wrapper scripts applied to all the bins - for app in $(find . -name "*.bin"); do - TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/') - rm $TARGET_APP - mv .$TARGET_APP.bin $TARGET_APP - done - - # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build - cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh - for app in cc gcc g++ c++ cpp ld as ; do - [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin - ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app - done - - - name: Configure external toolchain with sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Configure internal toolchain - if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config - echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config - - make defconfig - - - name: Show configuration - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/diffconfig.sh - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build toolchain - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel - if: inputs.build_kernel == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel Kmods - if: inputs.build_kernel == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build everything - if: inputs.build_full == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build external toolchain - if: inputs.build_external_toolchain == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/toolchain/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Coverity prepare toolchain - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}" -O coverity.tar.gz - wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}&md5=1" -O coverity.tar.gz.md5 - echo ' coverity.tar.gz' >> coverity.tar.gz.md5 - md5sum -c coverity.tar.gz.md5 - - mkdir cov-analysis-linux64 - tar xzf coverity.tar.gz --strip 1 -C cov-analysis-linux64 - export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH - - for template in ${{ inputs.coverity_compiler_template_list }}; do - cov-configure --template --comptype gcc --compiler "$template" - done - - - name: Clean and recompile packages with Coverity toolchain - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "bash {0}" - working-directory: openwrt - run: | - set -o pipefail -o errexit - - coverity_check_packages=(${{ inputs.coverity_check_packages }}) - printf -v clean_packages "package/%s/clean " "${coverity_check_packages[@]}" - make -j$(nproc) BUILD_LOG=1 $clean_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - coverity_force_compile_packages=(${{ inputs.coverity_force_compile_packages }}) - printf -v force_compile_packages "package/%s/compile " "${coverity_force_compile_packages[@]}" - make -j$(nproc) BUILD_LOG=1 $force_compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - printf -v compile_packages "package/%s/compile " "${coverity_check_packages[@]}" - export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH - cov-build --dir cov-int make -j $(nproc) BUILD_LOG=1 $compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload build to Coverity for analysis - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - tar czf cov-int.tar.gz ./cov-int - curl \ - --form token="${{ secrets.coverity_api_token }}" \ - --form email="contact@openwrt.org" \ - --form file=@cov-int.tar.gz \ - --form version="${{ github.ref_name }}-${{ github.sha }}" \ - --form description="OpenWrt ${{ github.ref_name }}-${{ github.sha }}" \ - "https://scan.coverity.com/builds?project=${{ inputs.coverity_project_name }}" - - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs - path: "openwrt/logs" - - - name: Delete already present ccache cache - if: steps.restore-ccache-cache.outputs.cache-hit == 'true' && inputs.use_ccache_cache == true && - github.event_name == 'push' && steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' - uses: octokit/request-action@v2.x - with: - route: DELETE /repos/{repository}/actions/caches?key={key} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - INPUT_REPOSITORY: ${{ github.repository }} - INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} - - - name: Save ccache cache - if: inputs.use_ccache_cache == true && github.event_name == 'push' && - steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - path: openwrt/.ccache - key: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} - - - name: Archive ccache - if: inputs.use_ccache_cache == true && github.event_name == 'push' && - inputs.upload_ccache_cache == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: tar -cf ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar .ccache - - - name: Upload ccache cache - if: inputs.use_ccache_cache == true && github.event_name == 'push' && - inputs.upload_ccache_cache == true - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-ccache-cache - path: openwrt/ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar - retention-days: 1 - - - name: Find external toolchain name - id: get-toolchain-name - if: inputs.upload_external_toolchain == true - working-directory: openwrt - run: | - TOOLCHAIN_NAME=$(ls bin/targets/${{inputs.target }}/${{ inputs.subtarget }} | grep toolchain) - echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT - - - name: Upload prebuilt toolchain - if: inputs.upload_external_toolchain == true - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-external-toolchain - path: openwrt/bin/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ steps.get-toolchain-name.outputs.toolchain-name }} - retention-days: 1 diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml deleted file mode 100644 index 1ab4a361f5355e..00000000000000 --- a/.github/workflows/check-kernel-patches.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: Refresh kernel for target - -on: - workflow_call: - inputs: - target: - required: true - type: string - subtarget: - required: true - type: string - testing: - type: boolean - use_openwrt_container: - type: boolean - default: true - -permissions: - contents: read - -jobs: - setup_build: - name: Setup build - runs-on: ubuntu-latest - outputs: - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} - - steps: - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - - if [ ${{ inputs.use_openwrt_container }} == "true" ]; then - OWNER_LC=openwrt - fi - - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # For local test to use the correct container for stable release testing - # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- - - name: Determine tools container tag - id: determine_tools_container - run: | - CONTAINER_TAG=latest - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG="${{ github.base_ref }}" - fi - elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG=${{ github.ref_name }} - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - echo "Tools container to use tools:$CONTAINER_TAG" - echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT - - check-patch: - name: Check Kernel patches - needs: setup_build - runs-on: ubuntu-latest - - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} - - permissions: - contents: read - packages: read - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Prepare prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - mkdir -p staging_dir build_dir - ln -sf /prebuilt_tools/staging_dir/host staging_dir/host - ln -sf /prebuilt_tools/build_dir/host build_dir/host - - ./scripts/ext-tools.sh --refresh - - - name: Configure testing kernel - if: inputs.testing == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TESTING_KERNEL=y >> .config - - - name: Configure system - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config - echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config - - make defconfig - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Refresh Kernel patches - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/linux/refresh V=s - - - name: Validate Refreshed Kernel Patches - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - . .github/workflows/scripts/ci_helpers.sh - - if git diff --name-only --exit-code; then - success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok" - else - err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)" - err "You can also check the provided artifacts with the refreshed patch from this CI run." - mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed - for f in $(git diff --name-only); do - cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/ - done - exit 1 - fi - - - name: Upload Refreshed Patches - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed - path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed diff --git a/.github/workflows/upload-file-s3.yml b/.github/workflows/upload-file-s3.yml deleted file mode 100644 index 6bcb172468da9c..00000000000000 --- a/.github/workflows/upload-file-s3.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Upload File to S3 - -on: - workflow_call: - secrets: - s3_access_key: - s3_secret_key: - inputs: - endpoint: - required: true - type: string - bucket: - required: true - type: string - download_id: - required: true - type: string - filename: - required: true - type: string - -jobs: - upload-file-in-s3: - name: Upload file in S3 - runs-on: ubuntu-latest - - steps: - - name: Install minio - run: | - curl https://dl.min.io/client/mc/release/linux-amd64/mc \ - --create-dirs \ - -o $GITHUB_WORKSPACE/minio-binaries/mc - - chmod +x $GITHUB_WORKSPACE/minio-binaries/mc - echo $GITHUB_WORKSPACE/minio-binaries/ >> $GITHUB_PATH - - - name: Setup minio - run: mc alias set s3 ${{ inputs.endpoint }} ${{ secrets.s3_access_key }} ${{ secrets.s3_secret_key }} - - - name: Download file - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.download_id }} - - - name: Upload file to s3 - run: mc cp ${{ inputs.filename }} s3/${{ inputs.bucket }}/ From c53dda11a26ee360d2cab51d2a07c84d3b3a039c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 5 Aug 2023 01:55:11 +0200 Subject: [PATCH 0534/1171] CI: generilize S3 secret keys name and rename to proper name Generilize S3 secret keys and rename to make them not platform specific. Signed-off-by: Christian Marangi (cherry picked from commit f98dc5aa43e9d84b8ceef9414fd4f92e05c418d7) --- .github/workflows/kernel.yml | 4 ++-- .github/workflows/packages.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 87b8a14293b1b8..a96ece87093119 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -35,6 +35,6 @@ jobs: packages: read actions: write secrets: - s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} - s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} + ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }} + ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }} uses: openwrt/actions-shared-workflows/.github/workflows/kernel.yml@main diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 07621dcb4ac4c1..d9251ed2a0d0d0 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -35,6 +35,6 @@ jobs: packages: read actions: write secrets: - s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} - s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} + ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }} + ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }} uses: openwrt/actions-shared-workflows/.github/workflows/packages.yml@main From 263ef841d47414efe4586013bd0bf4b026936d2e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 5 Aug 2023 01:58:29 +0200 Subject: [PATCH 0535/1171] CI: provide new required secret for S3 endpoint and bucket name Provide new required secret for S3 endpoint and bucket name to permit an easier migration to new services. Signed-off-by: Christian Marangi (cherry picked from commit 881235c713fae8692190178561af4eb2dee4ead1) --- .github/workflows/kernel.yml | 2 ++ .github/workflows/packages.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index a96ece87093119..43c610ab4f00cb 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -35,6 +35,8 @@ jobs: packages: read actions: write secrets: + ccache_s3_endpoint: ${{ secrets.CCACHE_S3_ENDPOINT }} + ccache_s3_bucket: ${{ secrets.CCACHE_S3_BUCKET }} ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }} ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }} uses: openwrt/actions-shared-workflows/.github/workflows/kernel.yml@main diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index d9251ed2a0d0d0..f061c1cd371a5d 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -35,6 +35,8 @@ jobs: packages: read actions: write secrets: + ccache_s3_endpoint: ${{ secrets.CCACHE_S3_ENDPOINT }} + ccache_s3_bucket: ${{ secrets.CCACHE_S3_BUCKET }} ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }} ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }} uses: openwrt/actions-shared-workflows/.github/workflows/packages.yml@main From 75fe50defe20cf2536a083110f8910e2de5e409a Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Fri, 20 Oct 2023 16:15:38 +0300 Subject: [PATCH 0536/1171] ramips: TP-link archer A6/C6 device tree updates Set correct GPIO (10) for the WPS button. This matches GPIO settings in vendor GPL sources. Note that GPL sources also mention a USB indicator LED (GPIO 13) but the device has neither an external USB port nor a USB LED. In addition, prefixes (button-, led-) are added to relevant DT entries, as well as color and function specifications for LEDs. Closes: #13736 Reported-by: Waldemar Czabaj Signed-off-by: Rani Hod (added led mitigations for wifi leds) Signed-off-by: Christian Lamparter (cherry picked from commit fe5e4987776ef66c6788f70251dcbc0ca80a1c5f) --- .../dts/mt7621_tplink_archer-x6-v3.dtsi | 38 ++++++++++++------- .../etc/uci-defaults/04_led_migration | 17 +++++++++ 2 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration diff --git a/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi b/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi index 217c1b60fe429f..557003a08ac19c 100644 --- a/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi +++ b/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi @@ -4,6 +4,7 @@ #include #include +#include / { aliases { @@ -21,14 +22,14 @@ keys { compatible = "gpio-keys"; - wps { + button-wps { label = "wps"; - gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; debounce-interval = <60>; linux,code = ; }; - reset { + button-reset { label = "reset"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; debounce-interval = <60>; @@ -39,35 +40,44 @@ leds { compatible = "gpio-leds"; - led_power: power { + led_power: led-power { label = "green:power"; + color = ; + function = LED_FUNCTION_POWER; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; }; - wan_orange { - label = "orange:wan"; + led-wan-amber { + color = ; + function = LED_FUNCTION_WAN; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; }; - lan { - label = "green:lan"; + led-lan { + color = ; + function = LED_FUNCTION_LAN; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; }; - wifi5g { - label = "green:wifi5g"; + led-wifi5g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <5>; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy1tpt"; }; - wifi2g { - label = "green:wifi2g"; + led-wifi2g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; gpios = <&gpio 18 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; - wan_green { - label = "green:wan"; + led-wan-green { + color = ; + function = LED_FUNCTION_WAN; gpios = <&gpio 45 GPIO_ACTIVE_LOW>; }; }; diff --git a/target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration b/target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration new file mode 100644 index 00000000000000..b595ae6fd12eba --- /dev/null +++ b/target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration @@ -0,0 +1,17 @@ +. /lib/functions.sh +. /lib/functions/migrations.sh + +board=$(board_name) + +case "$board" in +tplink,archer-a6-v3|\ +tplink,archer-c6-v3) + migrate_leds ':wifi2g$=:wlan-2' ':wifi5g$=:wlan-5' + ;; +esac + +remove_devicename_leds + +migrations_apply system + +exit 0 From 6a1b92b0243246f0adb3e3207a1af2196b44942a Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Sun, 1 Oct 2023 02:05:19 +0300 Subject: [PATCH 0537/1171] bcm53xx: Linksys EA9200 nvram and 02_network fixes 1) clear nvram partialboots upon successful boot This behavior is already defined for EA9500; enabled for EA9200 too. 2) fix MAC address in board.d/02_network Use the correct nvram variable to derive lan/wan MAC address. Signed-off-by: Rani Hod (cherry picked from commit 9c42d23c5f7aa2b7f80af96921b2d5476626b8c6) --- package/utils/nvram/files/nvram-bcm53xx.init | 1 + target/linux/bcm53xx/base-files/etc/board.d/02_network | 1 + 2 files changed, 2 insertions(+) diff --git a/package/utils/nvram/files/nvram-bcm53xx.init b/package/utils/nvram/files/nvram-bcm53xx.init index 0502cd28b6e199..4319c761bba0ac 100755 --- a/package/utils/nvram/files/nvram-bcm53xx.init +++ b/package/utils/nvram/files/nvram-bcm53xx.init @@ -9,6 +9,7 @@ clear_partialboots() { # clear partialboots case $(board_name) in + linksys,ea9200|\ linksys,panamera) COMMIT=1 nvram set partialboots=0 diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network index 13e7311e797571..6d84442da441c7 100644 --- a/target/linux/bcm53xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network @@ -50,6 +50,7 @@ bcm53xx_setup_macs() offset=1 ;; dlink,dir-885l | \ + linksys,ea9200 | \ linksys,panamera | \ netgear,r7900 | \ netgear,r8000 | \ From cdf7c3a16e60a9ce6ba2b362b0c1a40c2fe4a17a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 24 Oct 2023 22:42:19 +0200 Subject: [PATCH 0538/1171] openssl: update to 3.0.12 Major changes between OpenSSL 3.0.11 and OpenSSL 3.0.12 [24 Oct 2023] * Mitigate incorrect resize handling for symmetric cipher keys and IVs. (CVE-2023-5363) Signed-off-by: Hauke Mehrtens (cherry picked from commit e4ebc7b5662d6436fcc84b8e1583204b96fb0503) --- package/libs/openssl/Makefile | 4 ++-- .../libs/openssl/patches/120-strip-cflags-from-binary.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 459d367372f749..4b1388e7af6d49 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl -PKG_VERSION:=3.0.11 +PKG_VERSION:=3.0.12 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto @@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=b3425d3bb4a2218d0697eb41f7fc0cdede016ed19ca49d168b78e8d947887f55 +PKG_HASH:=f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch index c4f2540395b415..ebdb940b426669 100644 --- a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch +++ b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch @@ -10,7 +10,7 @@ Signed-off-by: Eneas U de Queiroz --- a/crypto/build.info +++ b/crypto/build.info -@@ -111,7 +111,7 @@ DEFINE[../libcrypto]=$UPLINKDEF +@@ -109,7 +109,7 @@ DEFINE[../libcrypto]=$UPLINKDEF DEPEND[info.o]=buildinf.h DEPEND[cversion.o]=buildinf.h From 74dbee1ea0d1d0010cb2955e08708c8b2c04e40c Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Thu, 22 Jun 2023 00:33:16 +0200 Subject: [PATCH 0539/1171] bcm53xx: add Wavlink Quantum DAX/WL-WN538A8 as alt name As already documented in the wiki (https://openwrt.org/toh/wavlink/quantum_dax_wn538a8), this router is based on the Phicomm K3. Just the flashing method is different Signed-off-by: Davide Fioravanti (cherry picked from commit f1136fe1fd3e7539c4efb035efeffe77500dd9c0) --- target/linux/bcm53xx/image/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index defa68e59f981d..b1eb4277b79dfa 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -461,6 +461,10 @@ TARGET_DEVICES += smartrg_sr400ac define Device/phicomm_k3 DEVICE_VENDOR := PHICOMM DEVICE_MODEL := K3 + DEVICE_ALT0_VENDOR := Wavlink + DEVICE_ALT0_MODEL := QUANTUM DAX + DEVICE_ALT1_VENDOR := Wavlink + DEVICE_ALT1_MODEL := WL-WN538A8 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES) IMAGES := trx endef From 07d4455cee161a0372a53ca8557ae1c35798e2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Thu, 10 Aug 2023 15:23:08 +0300 Subject: [PATCH 0540/1171] bcm53xx: backport DT changes for ASUS RT-AC3100 queued for v6.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport the patch that adds the DT for ASUS RT-AC3100. Signed-off-by: Arınç ÜNAL (cherry picked from commit b7ee8c9f83ea0e3b861e6b71b08ed7a62066d149) --- ...s-BCM5301X-Add-DT-for-Asus-RT-AC3100.patch | 431 ++++++++++++++++++ ...RM-BCM5301X-Add-DT-for-Netgear-R7900.patch | 2 +- 2 files changed, 432 insertions(+), 1 deletion(-) create mode 100644 target/linux/bcm53xx/patches-5.15/037-v6.6-0016-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC3100.patch diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0016-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC3100.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0016-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC3100.patch new file mode 100644 index 00000000000000..6c2af02589c874 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/037-v6.6-0016-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC3100.patch @@ -0,0 +1,431 @@ +From 2900083269f7c0f0ff430bffc6ced2038aed9b6b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Thu, 3 Aug 2023 10:14:54 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Add DT for ASUS RT-AC3100 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +ASUS RT-AC3100 is ASUS RT-AC88U without the external switch. Move the +shared bindings to bcm47094-asus-rt-ac3100.dtsi. + +Remove the fixed-link node on port@7 as commit ba4aebce23b2 ("ARM: dts: +BCM5301X: Describe switch ports in the main DTS") states it's not +necessary. + +Replace the copyright notice with an author notice. + +Rename the model name from Asus to ASUS on bcm47094-asus-rt-ac88u.dts. + +Signed-off-by: Arınç ÜNAL +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20230803071454.5902-2-arinc.unal@arinc9.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 1 + + .../dts/bcm47094-asus-rt-ac3100.dts | 23 +++ + .../dts/bcm47094-asus-rt-ac3100.dtsi | 163 ++++++++++++++++++ + .../dts/bcm47094-asus-rt-ac88u.dts | 155 +---------------- + 4 files changed, 190 insertions(+), 152 deletions(-) + create mode 100644 arch/arm/boot/dts/bcm47094-asus-rt-ac3100.dts + create mode 100644 arch/arm/boot/dts/bcm47094-asus-rt-ac3100.dtsi + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -119,6 +119,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4709-netgear-r7000.dtb \ + bcm4709-netgear-r8000.dtb \ + bcm4709-tplink-archer-c9-v1.dtb \ ++ bcm47094-asus-rt-ac3100.dtb \ + bcm47094-asus-rt-ac88u.dtb \ + bcm47094-dlink-dir-885l.dtb \ + bcm47094-dlink-dir-890l.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac3100.dts +@@ -0,0 +1,23 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Author: Arınç ÜNAL ++ */ ++ ++/dts-v1/; ++ ++#include "bcm47094-asus-rt-ac3100.dtsi" ++ ++/ { ++ compatible = "asus,rt-ac3100", "brcm,bcm47094", "brcm,bcm4708"; ++ model = "ASUS RT-AC3100"; ++ ++ nvram@1c080000 { ++ et0macaddr: et0macaddr { ++ }; ++ }; ++}; ++ ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac3100.dtsi +@@ -0,0 +1,163 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Author: Arınç ÜNAL ++ */ ++ ++#include "bcm47094.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++ ++/ { ++ chosen { ++ bootargs = "earlycon"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; ++ }; ++ ++ nvram@1c080000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1c080000 0x00180000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-power { ++ label = "white:power"; ++ gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ led-wan-red { ++ label = "red:wan"; ++ gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led-lan { ++ label = "white:lan"; ++ gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-usb2 { ++ label = "white:usb2"; ++ gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ehci_port2>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ led-usb3 { ++ label = "white:usb3"; ++ gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ehci_port1>, <&xhci_port1>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ led-wps { ++ label = "white:wps"; ++ gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ button-wps { ++ label = "WPS"; ++ linux,code = ; ++ gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-reset { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-wifi { ++ label = "Wi-Fi"; ++ linux,code = ; ++ gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-led { ++ label = "Backlight"; ++ linux,code = ; ++ gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&srab { ++ compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab"; ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ label = "lan1"; ++ }; ++ ++ port@4 { ++ label = "wan"; ++ }; ++ ++ port@5 { ++ label = "cpu"; ++ }; ++ ++ port@7 { ++ label = "cpu"; ++ }; ++ ++ port@8 { ++ label = "cpu"; ++ }; ++ }; ++}; ++ ++&usb2 { ++ vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; ++}; ++ ++&usb3_phy { ++ status = "okay"; ++}; ++ ++&nandcs { ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "boot"; ++ reg = <0x00000000 0x00080000>; ++ read-only; ++ }; ++ ++ partition@80000 { ++ label = "nvram"; ++ reg = <0x00080000 0x00180000>; ++ }; ++ ++ partition@200000 { ++ label = "firmware"; ++ reg = <0x00200000 0x07e00000>; ++ compatible = "brcm,trx"; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -1,102 +1,21 @@ + // SPDX-License-Identifier: GPL-2.0-or-later OR MIT + /* +- * Copyright (C) 2021-2022 Arınç ÜNAL ++ * Author: Arınç ÜNAL + */ + + /dts-v1/; + +-#include "bcm47094.dtsi" +-#include "bcm5301x-nand-cs0-bch8.dtsi" ++#include "bcm47094-asus-rt-ac3100.dtsi" + + / { + compatible = "asus,rt-ac88u", "brcm,bcm47094", "brcm,bcm4708"; +- model = "Asus RT-AC88U"; +- +- chosen { +- bootargs = "earlycon"; +- }; +- +- memory@0 { +- device_type = "memory"; +- reg = <0x00000000 0x08000000>, +- <0x88000000 0x18000000>; +- }; ++ model = "ASUS RT-AC88U"; + + nvram@1c080000 { +- compatible = "brcm,nvram"; +- reg = <0x1c080000 0x00180000>; +- + et1macaddr: et1macaddr { + }; + }; + +- leds { +- compatible = "gpio-leds"; +- +- led-power { +- label = "white:power"; +- gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; +- linux,default-trigger = "default-on"; +- }; +- +- led-wan-red { +- label = "red:wan"; +- gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; +- }; +- +- led-lan { +- label = "white:lan"; +- gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>; +- }; +- +- led-usb2 { +- label = "white:usb2"; +- gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; +- trigger-sources = <&ehci_port2>; +- linux,default-trigger = "usbport"; +- }; +- +- led-usb3 { +- label = "white:usb3"; +- gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +- trigger-sources = <&ehci_port1>, <&xhci_port1>; +- linux,default-trigger = "usbport"; +- }; +- +- led-wps { +- label = "white:wps"; +- gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; +- }; +- }; +- +- gpio-keys { +- compatible = "gpio-keys"; +- +- button-wps { +- label = "WPS"; +- linux,code = ; +- gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; +- }; +- +- button-reset { +- label = "Reset"; +- linux,code = ; +- gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +- }; +- +- button-wifi { +- label = "Wi-Fi"; +- linux,code = ; +- gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; +- }; +- +- button-led { +- label = "Backlight"; +- linux,code = ; +- gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; +- }; +- }; +- + switch { + compatible = "realtek,rtl8365mb"; + /* 7 = MDIO (has input reads), 6 = MDC (clock, output only) */ +@@ -175,31 +94,9 @@ + }; + + &srab { +- compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab"; +- status = "okay"; + dsa,member = <0 0>; + + ports { +- port@0 { +- label = "lan4"; +- }; +- +- port@1 { +- label = "lan3"; +- }; +- +- port@2 { +- label = "lan2"; +- }; +- +- port@3 { +- label = "lan1"; +- }; +- +- port@4 { +- label = "wan"; +- }; +- + sw0_p5: port@5 { + /delete-property/ethernet; + +@@ -212,19 +109,6 @@ + pause; + }; + }; +- +- port@7 { +- label = "cpu"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; +- }; +- +- port@8 { +- label = "cpu"; +- }; + }; + }; + +@@ -236,36 +120,3 @@ + nvmem-cells = <&et1macaddr>; + nvmem-cell-names = "mac-address"; + }; +- +-&usb2 { +- vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; +-}; +- +-&usb3_phy { +- status = "okay"; +-}; +- +-&nandcs { +- partitions { +- compatible = "fixed-partitions"; +- #address-cells = <1>; +- #size-cells = <1>; +- +- partition@0 { +- label = "boot"; +- reg = <0x00000000 0x00080000>; +- read-only; +- }; +- +- partition@80000 { +- label = "nvram"; +- reg = <0x00080000 0x00180000>; +- }; +- +- partition@200000 { +- label = "firmware"; +- reg = <0x00200000 0x07e00000>; +- compatible = "brcm,trx"; +- }; +- }; +-}; diff --git a/target/linux/bcm53xx/patches-5.15/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch b/target/linux/bcm53xx/patches-5.15/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch index e76a12fe1b3346..bc04cbd2d62045 100644 --- a/target/linux/bcm53xx/patches-5.15/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch +++ b/target/linux/bcm53xx/patches-5.15/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch @@ -16,7 +16,7 @@ Signed-off-by: Rafał Miłecki + bcm4709-netgear-r7900.dtb \ bcm4709-netgear-r8000.dtb \ bcm4709-tplink-archer-c9-v1.dtb \ - bcm47094-asus-rt-ac88u.dtb \ + bcm47094-asus-rt-ac3100.dtb \ --- /dev/null +++ b/arch/arm/boot/dts/bcm4709-netgear-r7900.dts @@ -0,0 +1,42 @@ From 97980323efd2df1d229f846ddb8677b7ea7091ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Thu, 10 Aug 2023 15:23:09 +0300 Subject: [PATCH 0541/1171] bcm53xx: add support for ASUS RT-AC3100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ASUS RT-AC3100 is ASUS RT-AC88U without the external switch. OpenWrt forum users effortless and ktmakwana have confirmed that there are revisions with either 4366b1 or 4366c0 wireless chips. Therefore, include firmware for 4366b1 along with 4366c0. This way, all hardware revisions of the router will be supported by having brcmfmac use the firmware file for the wireless chip it detects. Signed-off-by: Arınç ÜNAL (cherry picked from commit 2214bab3503981fe6168746acd13044a9d5e89e7) --- target/linux/bcm53xx/image/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index b1eb4277b79dfa..5158b432b3b1db 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -159,6 +159,14 @@ define Device/asus IMAGE/trx := append-ubi | trx-nand | asus-trx endef +define Device/asus_rt-ac3100 + $(call Device/asus) + DEVICE_MODEL := RT-AC3100 + DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(BRCMFMAC_4366C0) $(USB3_PACKAGES) + ASUS_PRODUCTID := RT-AC3100 +endef +TARGET_DEVICES += asus_rt-ac3100 + define Device/asus_rt-ac56u $(call Device/asus) DEVICE_MODEL := RT-AC56U From ba300c8a1c807ecdd26545ca74285b81e972b718 Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Sat, 30 Sep 2023 22:22:13 +0300 Subject: [PATCH 0542/1171] bcm53xx: build a single device per profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far every build of a single bcm53xx Target Profile (it means: when NOT using CONFIG_TARGET_MULTI_PROFILE) resulted in all target devices images being built. Now it only builds the one matching selected profile. Fixes: #13572 Suggested-by: Jonas Gorski Signed-off-by: Rani Hod [rmilecki: update commit subject + body & move PROFILES line] Signed-off-by: Rafał Miłecki (cherry picked from commit 802a5f5cb4a7b42d25e82b787d7ab1323a20183f) --- target/linux/bcm53xx/image/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index 5158b432b3b1db..f3c1b89adf9f85 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -137,6 +137,7 @@ USB2_PACKAGES += kmod-usb-ledtrig-usbport USB3_PACKAGES := $(USB2_PACKAGES) kmod-usb3 kmod-phy-bcm-ns-usb3 define Device/Default + PROFILES = Generic $$(DEVICE_NAME) # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names # extract the full dtb name based on the device info DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(subst _,-,$(1)).dtb))) From a1e3ec0ff647adbb08580e68372b411d34a8f1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 13 Oct 2023 12:57:35 +0200 Subject: [PATCH 0543/1171] bcm53xx: simplify patch adding switch ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now have all raw ports defined in bcm-ns.dtsi. Leave only lables in custom device files. Signed-off-by: Rafał Miłecki (cherry picked from commit 08ce0c76d7d7daad5e9382d51960d69f4b8b8f3a) --- ...-Specify-switch-ports-for-remaining-.patch | 152 ++---------------- 1 file changed, 16 insertions(+), 136 deletions(-) diff --git a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch index e0832524f4ca7b..6779dfb8fe06d3 100644 --- a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch +++ b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts +++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts -@@ -92,3 +92,40 @@ +@@ -92,3 +92,33 @@ &usb3_phy { status = "okay"; }; @@ -20,40 +20,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts +++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts -@@ -83,3 +83,40 @@ +@@ -83,3 +83,33 @@ &usb3_phy { status = "okay"; }; @@ -63,40 +56,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "wan"; + }; + + port@1 { -+ reg = <1>; + label = "lan1"; + }; + + port@2 { -+ reg = <2>; + label = "lan2"; + }; + + port@3 { -+ reg = <3>; + label = "lan3"; + }; + + port@4 { -+ reg = <4>; + label = "lan4"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts -@@ -149,3 +149,40 @@ +@@ -149,3 +149,33 @@ &usb3_phy { status = "okay"; }; @@ -106,40 +92,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts +++ b/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts -@@ -46,3 +46,40 @@ +@@ -46,3 +46,33 @@ &usb3_phy { status = "okay"; }; @@ -149,40 +128,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts +++ b/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts -@@ -43,3 +43,40 @@ +@@ -43,3 +43,33 @@ &usb3_phy { status = "okay"; }; @@ -192,40 +164,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts +++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts -@@ -86,3 +86,40 @@ +@@ -86,3 +86,33 @@ &usb3_phy { status = "okay"; }; @@ -235,40 +200,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts +++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts -@@ -77,3 +77,40 @@ +@@ -77,3 +77,33 @@ &usb3_phy { status = "okay"; }; @@ -278,40 +236,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "wan"; + }; + + port@1 { -+ reg = <1>; + label = "lan1"; + }; + + port@2 { -+ reg = <2>; + label = "lan2"; + }; + + port@3 { -+ reg = <3>; + label = "lan3"; + }; + + port@4 { -+ reg = <4>; + label = "lan4"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts -@@ -66,6 +66,38 @@ +@@ -66,6 +66,32 @@ status = "okay"; }; @@ -320,29 +271,23 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "wan"; + }; + + port@1 { -+ reg = <1>; + label = "lan1"; + }; + + port@2 { -+ reg = <2>; + label = "lan2"; + }; + + port@3 { -+ reg = <3>; + label = "lan3"; + }; + + port@7 { -+ reg = <7>; + label = "cpu"; -+ ethernet = <&gmac1>; + }; + }; +}; @@ -352,7 +297,7 @@ Signed-off-by: Rafał Miłecki compatible = "fixed-partitions"; --- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts -@@ -130,3 +130,40 @@ +@@ -130,3 +130,33 @@ &usb3_phy { status = "okay"; }; @@ -362,40 +307,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts -@@ -47,3 +47,45 @@ +@@ -47,3 +47,33 @@ &usb3_phy { status = "okay"; }; @@ -405,45 +343,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@8 { -+ reg = <8>; + label = "cpu"; -+ ethernet = <&gmac2>; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; + }; + }; +}; --- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts -@@ -104,3 +104,40 @@ +@@ -104,3 +104,33 @@ &usb3_phy { status = "okay"; }; @@ -453,40 +379,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "wan"; + }; + + port@1 { -+ reg = <1>; + label = "lan1"; + }; + + port@2 { -+ reg = <2>; + label = "lan2"; + }; + + port@3 { -+ reg = <3>; + label = "lan3"; + }; + + port@4 { -+ reg = <4>; + label = "lan4"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; --- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts +++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts -@@ -94,3 +94,45 @@ +@@ -94,3 +94,33 @@ &usb3_phy { status = "okay"; }; @@ -496,45 +415,33 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "wan"; + }; + + port@1 { -+ reg = <1>; + label = "lan1"; + }; + + port@2 { -+ reg = <2>; + label = "lan2"; + }; + + port@3 { -+ reg = <3>; + label = "lan3"; + }; + + port@4 { -+ reg = <4>; + label = "lan4"; + }; + + port@8 { -+ reg = <8>; + label = "cpu"; -+ ethernet = <&gmac2>; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; + }; + }; +}; --- a/arch/arm/boot/dts/bcm47094-phicomm-k3.dts +++ b/arch/arm/boot/dts/bcm47094-phicomm-k3.dts -@@ -38,6 +38,38 @@ +@@ -38,6 +38,32 @@ status = "okay"; }; @@ -543,29 +450,23 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; @@ -575,7 +476,7 @@ Signed-off-by: Rafał Miłecki compatible = "fixed-partitions"; --- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts -@@ -91,6 +91,43 @@ +@@ -91,6 +91,36 @@ }; }; @@ -584,34 +485,27 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "wan"; + }; + + port@1 { -+ reg = <1>; + label = "lan1"; + }; + + port@2 { -+ reg = <2>; + label = "lan2"; + }; + + port@3 { -+ reg = <3>; + label = "lan3"; + }; + + port@4 { -+ reg = <4>; + label = "lan4"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; @@ -621,7 +515,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts -@@ -100,6 +100,43 @@ +@@ -100,6 +100,36 @@ vcc-gpio = <&chipcommon 12 GPIO_ACTIVE_HIGH>; }; @@ -630,34 +524,27 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "wan"; + }; + + port@1 { -+ reg = <1>; + label = "lan1"; + }; + + port@2 { -+ reg = <2>; + label = "lan2"; + }; + + port@3 { -+ reg = <3>; + label = "lan3"; + }; + + port@4 { -+ reg = <4>; + label = "lan4"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; @@ -667,7 +554,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts +++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts -@@ -107,3 +107,41 @@ +@@ -107,3 +107,34 @@ &usb3_phy { status = "okay"; }; @@ -677,34 +564,27 @@ Signed-off-by: Rafał Miłecki + + ports { + port@0 { -+ reg = <0>; + label = "lan1"; + }; + + port@1 { -+ reg = <1>; + label = "lan2"; + }; + + port@2 { -+ reg = <2>; + label = "lan3"; + }; + + port@3 { -+ reg = <3>; + label = "lan4"; + }; + + port@4 { -+ reg = <4>; + label = "wan"; + }; + + port@5 { -+ reg = <5>; + label = "cpu"; -+ ethernet = <&gmac0>; + }; + }; +}; From cd189cdefeac1c9375f6bb061f188bb358f31a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 24 Oct 2023 07:40:37 +0200 Subject: [PATCH 0544/1171] bcm53xx: backport DT changes queued for v6.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Among other changes this commit makes Linux use correct switch ports again. Fixes: a4792d79e899 ("bcm53xx: backport DT changes from v6.5") Signed-off-by: Rafał Miłecki (cherry picked from commit a67af19bc84e98588c307af9b08686bde9dd38d5) --- ...CM5301X-Set-MACs-for-D-Link-DIR-885L.patch | 56 +++ ...1X-Set-MAC-address-for-Asus-RT-AC87U.patch | 44 ++ ...-Relicense-Felix-s-code-to-the-GPL-2.patch | 57 +++ ...-Relicense-Vivek-s-code-to-the-GPL-2.patch | 104 +++++ ...-Explicitly-disable-unused-switch-CP.patch | 377 ++++++++++++++++++ ...-Set-fixed-link-for-extra-Netgear-R8.patch | 47 +++ ...-Specify-switch-ports-for-remaining-.patch | 2 +- 7 files changed, 686 insertions(+), 1 deletion(-) create mode 100644 target/linux/bcm53xx/patches-5.15/038-v6.7-0001-ARM-dts-BCM5301X-Set-MACs-for-D-Link-DIR-885L.patch create mode 100644 target/linux/bcm53xx/patches-5.15/038-v6.7-0002-ARM-dts-BCM5301X-Set-MAC-address-for-Asus-RT-AC87U.patch create mode 100644 target/linux/bcm53xx/patches-5.15/038-v6.7-0003-ARM-dts-BCM5301X-Relicense-Felix-s-code-to-the-GPL-2.patch create mode 100644 target/linux/bcm53xx/patches-5.15/038-v6.7-0004-ARM-dts-BCM5301X-Relicense-Vivek-s-code-to-the-GPL-2.patch create mode 100644 target/linux/bcm53xx/patches-5.15/038-v6.7-0005-ARM-dts-BCM5301X-Explicitly-disable-unused-switch-CP.patch create mode 100644 target/linux/bcm53xx/patches-5.15/038-v6.7-0006-ARM-dts-BCM5301X-Set-fixed-link-for-extra-Netgear-R8.patch diff --git a/target/linux/bcm53xx/patches-5.15/038-v6.7-0001-ARM-dts-BCM5301X-Set-MACs-for-D-Link-DIR-885L.patch b/target/linux/bcm53xx/patches-5.15/038-v6.7-0001-ARM-dts-BCM5301X-Set-MACs-for-D-Link-DIR-885L.patch new file mode 100644 index 00000000000000..78b8975f1fd89d --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/038-v6.7-0001-ARM-dts-BCM5301X-Set-MACs-for-D-Link-DIR-885L.patch @@ -0,0 +1,56 @@ +From 5cbee5828219c4f7b33e96b5d8ce5e467b2857c8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 1 Sep 2023 12:55:49 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Set MACs for D-Link DIR-885L +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Specify NVRAM access and use its "et2macaddr" NVMEM cell. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230901105549.7076-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + .../dts/broadcom/bcm47094-dlink-dir-885l.dts | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -25,6 +25,15 @@ + <0x88000000 0x08000000>; + }; + ++ nvram@1e3f0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1e3f0000 0x10000>; ++ ++ et2macaddr: et2macaddr { ++ #nvmem-cell-cells = <1>; ++ }; ++ }; ++ + nand_controller: nand-controller@18028000 { + nand@0 { + partitions { +@@ -112,6 +121,11 @@ + vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; + ++&gmac0 { ++ nvmem-cells = <&et2macaddr 0>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &spi_nor { + status = "okay"; + }; +@@ -142,6 +156,8 @@ + + port@4 { + label = "wan"; ++ nvmem-cells = <&et2macaddr 3>; ++ nvmem-cell-names = "mac-address"; + }; + + port@8 { diff --git a/target/linux/bcm53xx/patches-5.15/038-v6.7-0002-ARM-dts-BCM5301X-Set-MAC-address-for-Asus-RT-AC87U.patch b/target/linux/bcm53xx/patches-5.15/038-v6.7-0002-ARM-dts-BCM5301X-Set-MAC-address-for-Asus-RT-AC87U.patch new file mode 100644 index 00000000000000..11ce7acb5361b5 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/038-v6.7-0002-ARM-dts-BCM5301X-Set-MAC-address-for-Asus-RT-AC87U.patch @@ -0,0 +1,44 @@ +From a9e79863b62aaaefcdf469fc331bf482ae00db0d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 1 Sep 2023 14:43:11 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Set MAC address for Asus RT-AC87U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Specify NVRAM access and use its "et1macaddr" NVMEM cell. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20230901124311.31156-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm4709-asus-rt-ac87u.dts | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts ++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +@@ -25,6 +25,12 @@ + <0x88000000 0x08000000>; + }; + ++ nvram@1c080000 { ++ et1macaddr: et1macaddr { ++ #nvmem-cell-cells = <1>; ++ }; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -62,6 +68,11 @@ + }; + }; + ++&gmac0 { ++ nvmem-cells = <&et1macaddr 0>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &usb3_phy { + status = "okay"; + }; diff --git a/target/linux/bcm53xx/patches-5.15/038-v6.7-0003-ARM-dts-BCM5301X-Relicense-Felix-s-code-to-the-GPL-2.patch b/target/linux/bcm53xx/patches-5.15/038-v6.7-0003-ARM-dts-BCM5301X-Relicense-Felix-s-code-to-the-GPL-2.patch new file mode 100644 index 00000000000000..6df1e555e99c05 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/038-v6.7-0003-ARM-dts-BCM5301X-Relicense-Felix-s-code-to-the-GPL-2.patch @@ -0,0 +1,57 @@ +From 81ea360a16978a4df61df9db56b171909bd659c0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 16 Sep 2023 10:30:57 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Relicense Felix's code to the GPL 2.0+ / + MIT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move code added by Felix to the bcm-ns.dtsi which uses dual licensing. +That syncs more Northstar code to be based on the same licensing schema. + +This code was added in the commit 1ff80363524c ("ARM: BCM5301X: Add +profiling support"). + +Cc: Felix Fietkau +Signed-off-by: Rafał Miłecki +Acked-by: Felix Fietkau +Link: https://lore.kernel.org/r/20230916083057.10458-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm-ns.dtsi | 7 +++++++ + arch/arm/boot/dts/broadcom/bcm5301x.dtsi | 7 ------- + 2 files changed, 7 insertions(+), 7 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -14,6 +14,13 @@ + #address-cells = <1>; + #size-cells = <1>; + ++ pmu { ++ compatible = "arm,cortex-a9-pmu"; ++ interrupts = ++ , ++ ; ++ }; ++ + chipcommon-a-bus@18000000 { + compatible = "simple-bus"; + ranges = <0x00000000 0x18000000 0x00001000>; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -26,13 +26,6 @@ + }; + }; + +- pmu { +- compatible = "arm,cortex-a9-pmu"; +- interrupts = +- , +- ; +- }; +- + clocks { + #address-cells = <1>; + #size-cells = <1>; diff --git a/target/linux/bcm53xx/patches-5.15/038-v6.7-0004-ARM-dts-BCM5301X-Relicense-Vivek-s-code-to-the-GPL-2.patch b/target/linux/bcm53xx/patches-5.15/038-v6.7-0004-ARM-dts-BCM5301X-Relicense-Vivek-s-code-to-the-GPL-2.patch new file mode 100644 index 00000000000000..66db4a291fb924 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/038-v6.7-0004-ARM-dts-BCM5301X-Relicense-Vivek-s-code-to-the-GPL-2.patch @@ -0,0 +1,104 @@ +From b8d4f7c1be04d66c37c119c501c87bccc4197694 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 16 Sep 2023 10:58:55 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Relicense Vivek's code to the GPL 2.0+ / + MIT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move code added by Vivek to the bcm-ns.dtsi which uses dual licensing. +That syncs more Northstar code to be based on the same licensing schema. + +This code was added in the commit 37f6130ec39f ("ARM: dts: BCM5301X: +Make USB 3.0 PHY use MDIO PHY driver"). + +Cc: Vivek Unune +Signed-off-by: Rafał Miłecki +Acked-by: Vivek Unune +Link: https://lore.kernel.org/r/20230916085855.28375-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm-ns.dtsi | 27 ++++++++++++++++++++++++ + arch/arm/boot/dts/broadcom/bcm5301x.dtsi | 27 ------------------------ + 2 files changed, 27 insertions(+), 27 deletions(-) + +--- a/arch/arm/boot/dts/bcm-ns.dtsi ++++ b/arch/arm/boot/dts/bcm-ns.dtsi +@@ -327,6 +327,29 @@ + #address-cells = <1>; + }; + ++ mdio-mux@18003000 { ++ compatible = "mdio-mux-mmioreg", "mdio-mux"; ++ mdio-parent-bus = <&mdio>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x18003000 0x4>; ++ mux-mask = <0x200>; ++ ++ mdio@0 { ++ reg = <0x0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ usb3_phy: usb3-phy@10 { ++ compatible = "brcm,ns-ax-usb3-phy"; ++ reg = <0x10>; ++ usb3-dmp-syscon = <&usb3_dmp>; ++ #phy-cells = <0>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ + rng: rng@18004000 { + compatible = "brcm,bcm5301x-rng"; + reg = <0x18004000 0x14>; +@@ -467,6 +490,10 @@ + brcm,nand-has-wp; + }; + ++ usb3_dmp: syscon@18105000 { ++ reg = <0x18105000 0x1000>; ++ }; ++ + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <0>; +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -62,33 +62,6 @@ + }; + }; + +- mdio-mux@18003000 { +- compatible = "mdio-mux-mmioreg", "mdio-mux"; +- mdio-parent-bus = <&mdio>; +- #address-cells = <1>; +- #size-cells = <0>; +- reg = <0x18003000 0x4>; +- mux-mask = <0x200>; +- +- mdio@0 { +- reg = <0x0>; +- #address-cells = <1>; +- #size-cells = <0>; +- +- usb3_phy: usb3-phy@10 { +- compatible = "brcm,ns-ax-usb3-phy"; +- reg = <0x10>; +- usb3-dmp-syscon = <&usb3_dmp>; +- #phy-cells = <0>; +- status = "disabled"; +- }; +- }; +- }; +- +- usb3_dmp: syscon@18105000 { +- reg = <0x18105000 0x1000>; +- }; +- + i2c0: i2c@18009000 { + compatible = "brcm,iproc-i2c"; + reg = <0x18009000 0x50>; diff --git a/target/linux/bcm53xx/patches-5.15/038-v6.7-0005-ARM-dts-BCM5301X-Explicitly-disable-unused-switch-CP.patch b/target/linux/bcm53xx/patches-5.15/038-v6.7-0005-ARM-dts-BCM5301X-Explicitly-disable-unused-switch-CP.patch new file mode 100644 index 00000000000000..72e5c6b061412e --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/038-v6.7-0005-ARM-dts-BCM5301X-Explicitly-disable-unused-switch-CP.patch @@ -0,0 +1,377 @@ +From 473baeab929444295b0530f8766e4becb6a08973 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Oct 2023 12:33:13 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Explicitly disable unused switch CPU + ports +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When redescribing ports I assumed that missing "label" (like "cpu") +means switch port isn't used. That was incorrect and I realized my +change made Linux always use the first (5) CPU port (there are 3 of +them). + +While above should technically be possible it often isn't correct: +1. Non-default switch ports are often connected to Ethernet interfaces + not fully covered by vendor setup (they may miss MACs) +2. On some devices non-default ports require specifying fixed link + +This fixes network connectivity for some devices. It was reported & +tested for Netgear R8000. It also affects Linksys EA9200 with its +downstream DTS. + +Fixes: ba4aebce23b2 ("ARM: dts: BCM5301X: Describe switch ports in the main DTS") +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20231013103314.10306-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + .../dts/broadcom/bcm4708-buffalo-wzr-1166dhp-common.dtsi | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm4708-luxul-xap-1510.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm4708-luxul-xwc-1000.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm4708-netgear-r6250.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm4708-smartrg-sr400ac.dts | 8 ++++++++ + .../boot/dts/broadcom/bcm47081-buffalo-wzr-600dhp2.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47081-luxul-xap-1410.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47081-luxul-xwr-1200.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-dlink-dir-885l.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-dlink-dir-890l.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-luxul-abr-4500.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-luxul-xap-1610.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-luxul-xbr-4500.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-luxul-xwc-2000.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-luxul-xwr-3100.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm47094-luxul-xwr-3150-v1.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm53016-meraki-mr32.dts | 8 ++++++++ + arch/arm/boot/dts/broadcom/bcm953012er.dts | 8 ++++++++ + 20 files changed, 160 insertions(+) + +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi +@@ -181,5 +181,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -85,5 +85,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts +@@ -88,5 +88,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts +@@ -122,5 +122,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts ++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts +@@ -145,6 +145,14 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; + +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -145,5 +145,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -81,5 +81,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -148,5 +148,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -227,6 +227,14 @@ + label = "wan"; + }; + ++ port@5 { ++ status = "disabled"; ++ }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ + port@8 { + label = "cpu"; + }; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -160,6 +160,14 @@ + nvmem-cell-names = "mac-address"; + }; + ++ port@5 { ++ status = "disabled"; ++ }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ + port@8 { + label = "cpu"; + }; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts +@@ -192,6 +192,14 @@ + label = "wan"; + }; + ++ port@5 { ++ status = "disabled"; ++ }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ + port@8 { + label = "cpu"; + phy-mode = "rgmii"; +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -107,5 +107,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts +@@ -120,5 +120,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -107,5 +107,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -75,5 +75,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -147,5 +147,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -158,5 +158,13 @@ + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; +--- a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts +@@ -124,6 +124,14 @@ + full-duplex; + }; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; + +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -185,6 +185,14 @@ + full-duplex; + }; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; + +--- a/arch/arm/boot/dts/bcm953012er.dts ++++ b/arch/arm/boot/dts/bcm953012er.dts +@@ -84,6 +84,14 @@ + label = "cpu"; + ethernet = <&gmac0>; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; + }; + diff --git a/target/linux/bcm53xx/patches-5.15/038-v6.7-0006-ARM-dts-BCM5301X-Set-fixed-link-for-extra-Netgear-R8.patch b/target/linux/bcm53xx/patches-5.15/038-v6.7-0006-ARM-dts-BCM5301X-Set-fixed-link-for-extra-Netgear-R8.patch new file mode 100644 index 00000000000000..0b2b7b36a3fc29 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/038-v6.7-0006-ARM-dts-BCM5301X-Set-fixed-link-for-extra-Netgear-R8.patch @@ -0,0 +1,47 @@ +From d313b0e9070a7100ca55e64fe3b081d176d8806d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Oct 2023 12:33:14 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Set fixed-link for extra Netgear R8000 + CPU ports +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Ports 5 and 7 are disabled by default because the standard use case is +for port 8 to manage all CPU directed traffic. For experimentation +purposes however it is desirable to provide adequate properties such +that people can experiment with using different ports without having to +figure out their configuration. Some of the use cases include but are +not limited to doubling or tripling the bandwidth by leveraging the +additional ports/Ethernet MAC combinations. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20231013103314.10306-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -229,10 +229,20 @@ + + port@5 { + status = "disabled"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; + }; + + port@7 { + status = "disabled"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; + }; + + port@8 { diff --git a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch index 6779dfb8fe06d3..0efb2840395ba6 100644 --- a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch +++ b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -262,7 +262,7 @@ Signed-off-by: Rafał Miłecki +}; --- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts -@@ -66,6 +66,32 @@ +@@ -77,6 +77,32 @@ status = "okay"; }; From 7bd682bc58fbfab673290e9d150786946f0788fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 13 Oct 2023 13:25:33 +0200 Subject: [PATCH 0545/1171] bcm53xx: disable unused switch ports in downstream patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes Linux use correct switch ports again. Fixes: a4792d79e899 ("bcm53xx: backport DT changes from v6.5") Fixes: https://github.com/openwrt/openwrt/issues/13548 Signed-off-by: Rafał Miłecki (cherry picked from commit a912ee74d6ca08020933dcdb9ce791e74244c25b) --- ...-Specify-switch-ports-for-remaining-.patch | 160 ++++++++++++++++-- 1 file changed, 144 insertions(+), 16 deletions(-) diff --git a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch index 0efb2840395ba6..ed75623460ace4 100644 --- a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch +++ b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts +++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts -@@ -92,3 +92,33 @@ +@@ -92,3 +92,41 @@ &usb3_phy { status = "okay"; }; @@ -42,11 +42,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts +++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts -@@ -83,3 +83,33 @@ +@@ -83,3 +83,41 @@ &usb3_phy { status = "okay"; }; @@ -78,11 +86,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts -@@ -149,3 +149,33 @@ +@@ -149,3 +149,41 @@ &usb3_phy { status = "okay"; }; @@ -114,11 +130,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts +++ b/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts -@@ -46,3 +46,33 @@ +@@ -46,3 +46,41 @@ &usb3_phy { status = "okay"; }; @@ -150,11 +174,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts +++ b/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts -@@ -43,3 +43,33 @@ +@@ -43,3 +43,41 @@ &usb3_phy { status = "okay"; }; @@ -186,11 +218,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts +++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts -@@ -86,3 +86,33 @@ +@@ -86,3 +86,41 @@ &usb3_phy { status = "okay"; }; @@ -222,11 +262,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts +++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts -@@ -77,3 +77,33 @@ +@@ -77,3 +77,41 @@ &usb3_phy { status = "okay"; }; @@ -258,11 +306,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts -@@ -77,6 +77,32 @@ +@@ -77,6 +77,40 @@ status = "okay"; }; @@ -286,9 +342,17 @@ Signed-off-by: Rafał Miłecki + label = "lan3"; + }; + ++ port@5 { ++ status = "disabled"; ++ }; ++ + port@7 { + label = "cpu"; + }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; + @@ -297,7 +361,7 @@ Signed-off-by: Rafał Miłecki compatible = "fixed-partitions"; --- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts -@@ -130,3 +130,33 @@ +@@ -130,3 +130,41 @@ &usb3_phy { status = "okay"; }; @@ -329,11 +393,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts -@@ -47,3 +47,33 @@ +@@ -47,3 +47,41 @@ &usb3_phy { status = "okay"; }; @@ -362,6 +434,14 @@ Signed-off-by: Rafał Miłecki + label = "wan"; + }; + ++ port@5 { ++ status = "disabled"; ++ }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ + port@8 { + label = "cpu"; + }; @@ -369,7 +449,7 @@ Signed-off-by: Rafał Miłecki +}; --- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts -@@ -104,3 +104,33 @@ +@@ -104,3 +104,41 @@ &usb3_phy { status = "okay"; }; @@ -401,11 +481,19 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; --- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts +++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts -@@ -94,3 +94,33 @@ +@@ -94,3 +94,41 @@ &usb3_phy { status = "okay"; }; @@ -434,6 +522,14 @@ Signed-off-by: Rafał Miłecki + label = "lan4"; + }; + ++ port@5 { ++ status = "disabled"; ++ }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ + port@8 { + label = "cpu"; + }; @@ -441,7 +537,7 @@ Signed-off-by: Rafał Miłecki +}; --- a/arch/arm/boot/dts/bcm47094-phicomm-k3.dts +++ b/arch/arm/boot/dts/bcm47094-phicomm-k3.dts -@@ -38,6 +38,32 @@ +@@ -38,6 +38,40 @@ status = "okay"; }; @@ -468,6 +564,14 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; + @@ -476,7 +580,7 @@ Signed-off-by: Rafał Miłecki compatible = "fixed-partitions"; --- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts -@@ -91,6 +91,36 @@ +@@ -91,6 +91,44 @@ }; }; @@ -507,6 +611,14 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; + @@ -515,7 +627,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts -@@ -100,6 +100,36 @@ +@@ -100,6 +100,44 @@ vcc-gpio = <&chipcommon 12 GPIO_ACTIVE_HIGH>; }; @@ -546,6 +658,14 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; + @@ -554,7 +674,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts +++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts -@@ -107,3 +107,34 @@ +@@ -107,3 +107,42 @@ &usb3_phy { status = "okay"; }; @@ -586,6 +706,14 @@ Signed-off-by: Rafał Miłecki + port@5 { + label = "cpu"; + }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ status = "disabled"; ++ }; + }; +}; + From 6150df13a369850f0d99ad418c2d580f4af940fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 26 Oct 2023 07:12:36 +0200 Subject: [PATCH 0546/1171] bcm53xx: backport 1 more late DT patch accepted for v6.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 732ae343ffb3ad19978b75a8105d55f5e6d1d435) --- ...-Set-switch-ports-for-Linksys-EA9200.patch | 63 +++++++++++++++++++ ...-Specify-switch-ports-for-remaining-.patch | 44 ------------- 2 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 target/linux/bcm53xx/patches-5.15/038-v6.7-0007-ARM-dts-BCM5301X-Set-switch-ports-for-Linksys-EA9200.patch diff --git a/target/linux/bcm53xx/patches-5.15/038-v6.7-0007-ARM-dts-BCM5301X-Set-switch-ports-for-Linksys-EA9200.patch b/target/linux/bcm53xx/patches-5.15/038-v6.7-0007-ARM-dts-BCM5301X-Set-switch-ports-for-Linksys-EA9200.patch new file mode 100644 index 00000000000000..4528c95a5aa960 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/038-v6.7-0007-ARM-dts-BCM5301X-Set-switch-ports-for-Linksys-EA9200.patch @@ -0,0 +1,63 @@ +From 253358f373492608348136e569366d73cb969f6a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 24 Oct 2023 09:26:05 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Set switch ports for Linksys EA9200 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch was developed as OpenWrt downstream change and was recently +confirmed to work as expected. + +Tested-by: Rani Hod +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20231024072605.32517-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + .../dts/broadcom/bcm4709-linksys-ea9200.dts | 38 +++++++++++++++++++ + 1 file changed, 38 insertions(+) + +--- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts ++++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +@@ -47,3 +47,41 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ label = "lan1"; ++ }; ++ ++ port@1 { ++ label = "lan2"; ++ }; ++ ++ port@2 { ++ label = "lan3"; ++ }; ++ ++ port@3 { ++ label = "lan4"; ++ }; ++ ++ port@4 { ++ label = "wan"; ++ }; ++ ++ port@5 { ++ status = "disabled"; ++ }; ++ ++ port@7 { ++ status = "disabled"; ++ }; ++ ++ port@8 { ++ label = "cpu"; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch index ed75623460ace4..8039831a7874b5 100644 --- a/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch +++ b/target/linux/bcm53xx/patches-5.15/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -403,50 +403,6 @@ Signed-off-by: Rafał Miłecki + }; + }; +}; ---- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts -+++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts -@@ -47,3 +47,41 @@ - &usb3_phy { - status = "okay"; - }; -+ -+&srab { -+ status = "okay"; -+ -+ ports { -+ port@0 { -+ label = "lan1"; -+ }; -+ -+ port@1 { -+ label = "lan2"; -+ }; -+ -+ port@2 { -+ label = "lan3"; -+ }; -+ -+ port@3 { -+ label = "lan4"; -+ }; -+ -+ port@4 { -+ label = "wan"; -+ }; -+ -+ port@5 { -+ status = "disabled"; -+ }; -+ -+ port@7 { -+ status = "disabled"; -+ }; -+ -+ port@8 { -+ label = "cpu"; -+ }; -+ }; -+}; --- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts @@ -104,3 +104,41 @@ From 9eec4eb2684531ef146b9e4ff1a6c7545302fca9 Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Wed, 16 Aug 2023 11:22:30 +0200 Subject: [PATCH 0547/1171] prereq: make existing binary check work for sdk as well To avoid replacing host built binaries with symlinks again, a check for an appropriate stamp was added in 729909c07f ("prereq-build: do not replace binaries with symlinks"). Unfortunately the stamp directory does not exist in the SDK, so the fix was ineffective there. This caused the packages builders to e.g. use the host tar again, which in turn made the tarballs created different since it may lack reproducibility fixes, or implement these differently, causing spurious hash failures on source repository based packages. Fix this by dropping the stamp dir check, and just check that the file is usable. Fixes: 729909c07f ("prereq-build: do not replace binaries with symlinks") Signed-off-by: Jonas Gorski (cherry picked from commit c1ef10c8d873254ce7c1f3019d821c4a87227474) --- include/prereq.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/include/prereq.mk b/include/prereq.mk index 88ed1f406afdb2..5cb11021824d24 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -111,7 +111,6 @@ define SetupHostCommand [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ ;; \ "-"*) \ - find "$(STAGING_DIR_HOST)/stamp" | grep $(strip $(1)) && \ [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ ;; \ *" -> /"*) \ From c4c9f6133178f7e36ec3193be97326bbd037bd44 Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Wed, 23 Aug 2023 09:47:57 +0200 Subject: [PATCH 0548/1171] prereq: merge common cases in SetupHostCommand Now that most cases do the same thing in SetupHostCommand, merge them together into one. To allow moving the generic symlink check, invert the check and let it check for relative links by matching on link targets that do not start with a slash. This then allows us to also drop the absolute link case, shortening the case statement further. This reorders the check to * if it is not a symlink, do not change it * if it is a symlink and it points to the found command, do not change it * if it is a symlink with a relative path, do not change it * else, update/replace it Signed-off-by: Jonas Gorski (cherry picked from commit 3210aa8e0a113cc4354628b08b608c5c8f792941) --- include/prereq.mk | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/prereq.mk b/include/prereq.mk index 5cb11021824d24..9f1ff70eedd8b4 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -107,15 +107,9 @@ define SetupHostCommand bin="$$$$$$$$(command -v "$$$$$$$${cmd%% *}")"; \ if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \ case "$$$$$$$$(ls -dl -- $(STAGING_DIR_HOST)/bin/$(strip $(1)))" in \ - *" -> $$$$$$$$bin"*) \ - [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ - ;; \ - "-"*) \ - [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ - ;; \ - *" -> /"*) \ - ;; \ - *" -> "*) \ + "-"* | \ + *" -> $$$$$$$$bin"* | \ + *" -> "[!/]*) \ [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \ ;; \ esac; \ From 525adac8eec19f715a261277430f73fc6797daab Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 20 Oct 2023 15:14:15 +0200 Subject: [PATCH 0549/1171] uqmi: update to latest HEAD c8c9f10 uim: fix help formatting aac0776 uqmi: add APN profile commands ffc5eea uim: support SIM card power-up/down d6c963d uim: add application state to SIM status Signed-off-by: David Bauer (cherry picked from commit 0da74dbb453d739ee37bbdca75cac5e294b2cb56) --- package/network/utils/uqmi/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index 667171932161c3..e7de3ef77d191d 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uqmi -PKG_RELEASE:=5 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git -PKG_SOURCE_DATE:=2022-05-04 -PKG_SOURCE_VERSION:=56cb2d4056fef132ccf78dfb6f3074ae5d109992 -PKG_MIRROR_HASH:=cc832b5318805df8c8387a3650f250dee72d5f1dbda4e4866b5503e186b2210c +PKG_SOURCE_DATE:=2022-10-20 +PKG_SOURCE_VERSION:=c8c9f105aa2d03146664fa1cc1bd2c837aa4aadd +PKG_MIRROR_HASH:=5fd1b3c8f5e7c4b52ed81a0c69504fbf39e69c0ecd1f8278969cf22f57fdb2a9 PKG_MAINTAINER:=Matti Laakso PKG_LICENSE:=GPL-2.0 From 5368066e9b83bfc7529cba9d8890bf06c23b62bd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 19 Oct 2023 19:15:11 +0200 Subject: [PATCH 0550/1171] umdns: update to the latest version 479c7f8676d9 cache: make record/hostname lookup case-insensitive 26c97a5a50bf ubus: add a browse flag for suppressing cached ip addresses c286c51a9bd9 Fix AVL tree traversal in cache_record_find and cache_host_is_known 4035fe42df58 interface: use a global socket instead of per-interface ones c63d465698c7 cache: dump hostname target from srv records b42b22152d73 use hostname from SRV record to look up IP addresses d45c443aa1e6 ubus: add array flag support for the hosts method Signed-off-by: Felix Fietkau (cherry picked from commit 3e1ac00ccbdaa0c396b36429ddbe83d2e3f6276f) --- package/network/services/umdns/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile index b7564fa7c3e6d7..4510bdeb68873a 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=5 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-01-16 -PKG_SOURCE_VERSION:=65b3308d13de7d7975444d34389651612e2a4d38 -PKG_MIRROR_HASH:=945fdf51a299b68982aab74e8fba5614f2553a7b4c49a3a53b3093ea8aac0279 +PKG_SOURCE_DATE:=2023-10-19 +PKG_SOURCE_VERSION:=d45c443aa1e6514aab58bbbf9311913e484d31a6 +PKG_MIRROR_HASH:=20d91d867f4f34a37c7b2a600327884375f9f16c1ea9bbb3199347d8b617d856 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 From aaa1286b89a058bab2d23f55182453bf1f5a5e69 Mon Sep 17 00:00:00 2001 From: Matt Merhar Date: Sat, 28 Oct 2023 21:15:46 -0400 Subject: [PATCH 0551/1171] kernel: fix jffs2 compilation with GCC_PLUGIN_RANDSTRUCT enabled Designated initializers are required when using the randstruct GCC plugin, otherwise an error like the following is seen: ./include/linux/lzma.h:60:31: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init] This was originally applied via 55643e469c21, but was unintentionally reverted in 483503603cb2. Fixes: 483503603cb2 ("generic: 5.15: rework pending patch") Signed-off-by: Matt Merhar (cherry picked from commit b2068f4aac43754a681b675ff3814d9ca87ac986) [ drop change for unavailable kernel 6.1 ] Signed-off-by: Christian Marangi --- .../generic/pending-5.15/530-jffs2_make_lzma_available.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/pending-5.15/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-5.15/530-jffs2_make_lzma_available.patch index ac784d0b0bb73d..f236657b71602b 100644 --- a/target/linux/generic/pending-5.15/530-jffs2_make_lzma_available.patch +++ b/target/linux/generic/pending-5.15/530-jffs2_make_lzma_available.patch @@ -351,7 +351,7 @@ Signed-off-by: Alexandros C. Couloumbis + LZMA_FREE(address); +} + -+static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free}; ++static ISzAlloc lzma_alloc = { .Alloc = p_lzma_malloc, .Free = p_lzma_free }; + +#endif --- /dev/null From 269896fed0dfc079cee9447cd18624f931b2a738 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 11 Oct 2023 15:53:45 -0400 Subject: [PATCH 0552/1171] kernel: bump 5.15 to 5.15.135 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.135 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia [Refreshed on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens (cherry picked from commit 096bb8ed82cebeb8926a5b64466afec649385159) --- include/kernel-5.15 | 4 ++-- .../ath79/patches-5.15/910-unaligned_access_hacks.patch | 8 ++++---- .../711-net-dsa-mv88e6xxx-disable-ATU-violation.patch | 2 +- ...auto-attach-mtd-device-named-ubi-or-data-on-boot.patch | 4 ++-- ...-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 35a21308aab1dd..313e735a5430aa 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .134 -LINUX_KERNEL_HASH-5.15.134 = f37182aecb57ed6853d01e1074d3a60a653331e35f3115728381e08be050b9d3 +LINUX_VERSION-5.15 = .135 +LINUX_KERNEL_HASH-5.15.135 = 14835e629e237f136cfed484fdb533c95242429809bdcdb2a2d66dfcb7447170 diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 53f5b1472d9c5a..47216bee71f9f6 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -349,7 +349,7 @@ SVN-Revision: 35130 list_for_each_entry(p, head, list) { --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -610,48 +610,53 @@ static void tcp_options_write(__be32 *pt +@@ -609,48 +609,53 @@ static void tcp_options_write(__be32 *pt u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -426,7 +426,7 @@ SVN-Revision: 35130 } if (unlikely(opts->num_sack_blocks)) { -@@ -659,16 +664,17 @@ static void tcp_options_write(__be32 *pt +@@ -658,16 +663,17 @@ static void tcp_options_write(__be32 *pt tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -450,7 +450,7 @@ SVN-Revision: 35130 } tp->rx_opt.dsack = 0; -@@ -681,13 +687,14 @@ static void tcp_options_write(__be32 *pt +@@ -680,13 +686,14 @@ static void tcp_options_write(__be32 *pt if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -750,7 +750,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4157,14 +4157,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4170,14 +4170,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch b/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch index f6dacb6e503688..c5f86c030f8258 100644 --- a/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch +++ b/target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch @@ -9,7 +9,7 @@ Subject: [PATCH] net/dsa/mv88e6xxx: disable ATU violation --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -2993,6 +2993,9 @@ static int mv88e6xxx_setup_port(struct m +@@ -2995,6 +2995,9 @@ static int mv88e6xxx_setup_port(struct m else reg = 1 << port; diff --git a/target/linux/generic/pending-5.15/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-5.15/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch index 2751da541a0542..e8da36edba5bea 100644 --- a/target/linux/generic/pending-5.15/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ b/target/linux/generic/pending-5.15/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1200,6 +1200,73 @@ static struct mtd_info * __init open_mtd +@@ -1207,6 +1207,73 @@ static struct mtd_info * __init open_mtd return mtd; } @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle static int __init ubi_init(void) { int err, i, k; -@@ -1283,6 +1350,12 @@ static int __init ubi_init(void) +@@ -1290,6 +1357,12 @@ static int __init ubi_init(void) } } diff --git a/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch b/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch index 5aa540acf7772d..98d5d6d4f0640c 100644 --- a/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +++ b/target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch @@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -6341,6 +6341,7 @@ static int mv88e6xxx_register_switch(str +@@ -6343,6 +6343,7 @@ static int mv88e6xxx_register_switch(str ds->ops = &mv88e6xxx_switch_ops; ds->ageing_time_min = chip->info->age_time_coeff; ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; From 8ff92641773605346030b3b56c24a1d8ad5f76ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 26 Oct 2023 15:53:14 +0200 Subject: [PATCH 0553/1171] bcm53xx: backport XHCI patch modifying xhci_run_finished() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will help switching to newer 5.15 kernels. This backport required rebasing Northstar's USB host patch. Signed-off-by: Rafał Miłecki (cherry picked from commit c25c1e28b778e185da9253c4638db67952a84476) --- ...upt-disabled-in-initialization-until.patch | 87 +++++++++++++++++++ ...support-for-performing-fake-doorbell.patch | 36 ++------ 2 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch diff --git a/target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch b/target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch new file mode 100644 index 00000000000000..78b3aa85e3b57e --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch @@ -0,0 +1,87 @@ +From a808925075fb750804a60ff0710614466c396db4 Mon Sep 17 00:00:00 2001 +From: Hongyu Xie +Date: Thu, 23 Jun 2022 14:19:42 +0300 +Subject: [PATCH] xhci: Keep interrupt disabled in initialization until host is + running. + +irq is disabled in xhci_quiesce(called by xhci_halt, with bit:2 cleared +in USBCMD register), but xhci_run(called by usb_add_hcd) re-enable it. +It's possible that you will receive thousands of interrupt requests +after initialization for 2.0 roothub. And you will get a lot of +warning like, "xHCI dying, ignoring interrupt. Shouldn't IRQs be +disabled?". This amount of interrupt requests will cause the entire +system to freeze. +This problem was first found on a device with ASM2142 host controller +on it. + +[tidy up old code while moving it, reword header -Mathias] + +Cc: stable@kernel.org +Signed-off-by: Hongyu Xie +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20220623111945.1557702-2-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci.c | 35 ++++++++++++++++++++++------------- + 1 file changed, 22 insertions(+), 13 deletions(-) + +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -611,8 +611,27 @@ static int xhci_init(struct usb_hcd *hcd + + static int xhci_run_finished(struct xhci_hcd *xhci) + { ++ unsigned long flags; ++ u32 temp; ++ ++ /* ++ * Enable interrupts before starting the host (xhci 4.2 and 5.5.2). ++ * Protect the short window before host is running with a lock ++ */ ++ spin_lock_irqsave(&xhci->lock, flags); ++ ++ xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable interrupts"); ++ temp = readl(&xhci->op_regs->command); ++ temp |= (CMD_EIE); ++ writel(temp, &xhci->op_regs->command); ++ ++ xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable primary interrupter"); ++ temp = readl(&xhci->ir_set->irq_pending); ++ writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending); ++ + if (xhci_start(xhci)) { + xhci_halt(xhci); ++ spin_unlock_irqrestore(&xhci->lock, flags); + return -ENODEV; + } + xhci->shared_hcd->state = HC_STATE_RUNNING; +@@ -623,6 +642,9 @@ static int xhci_run_finished(struct xhci + + xhci_dbg_trace(xhci, trace_xhci_dbg_init, + "Finished xhci_run for USB3 roothub"); ++ ++ spin_unlock_irqrestore(&xhci->lock, flags); ++ + return 0; + } + +@@ -671,19 +693,6 @@ int xhci_run(struct usb_hcd *hcd) + temp |= (xhci->imod_interval / 250) & ER_IRQ_INTERVAL_MASK; + writel(temp, &xhci->ir_set->irq_control); + +- /* Set the HCD state before we enable the irqs */ +- temp = readl(&xhci->op_regs->command); +- temp |= (CMD_EIE); +- xhci_dbg_trace(xhci, trace_xhci_dbg_init, +- "// Enable interrupts, cmd = 0x%x.", temp); +- writel(temp, &xhci->op_regs->command); +- +- temp = readl(&xhci->ir_set->irq_pending); +- xhci_dbg_trace(xhci, trace_xhci_dbg_init, +- "// Enabling event ring interrupter %p by writing 0x%x to irq_pending", +- xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); +- writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending); +- + if (xhci->quirks & XHCI_NEC_HOST) { + struct xhci_command *command; + diff --git a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 17013c75bad8c9..49277ab251f647 100644 --- a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -90,41 +90,23 @@ it on BCM4708 family. /* * Reset a halted HC. * -@@ -611,10 +654,20 @@ static int xhci_init(struct usb_hcd *hcd - - static int xhci_run_finished(struct xhci_hcd *xhci) - { -- if (xhci_start(xhci)) { -- xhci_halt(xhci); -- return -ENODEV; -+ int err; -+ -+ err = xhci_start(xhci); -+ if (err) { -+ err = -ENODEV; -+ goto err_halt; +@@ -634,6 +677,16 @@ static int xhci_run_finished(struct xhci + spin_unlock_irqrestore(&xhci->lock, flags); + return -ENODEV; } + + if (xhci->quirks & XHCI_FAKE_DOORBELL) { -+ err = xhci_fake_doorbell(xhci, 1); -+ if (err) -+ goto err_halt; ++ int err = xhci_fake_doorbell(xhci, 1); ++ if (err) { ++ xhci_halt(xhci); ++ spin_unlock_irqrestore(&xhci->lock, flags); ++ return err; ++ } + } + xhci->shared_hcd->state = HC_STATE_RUNNING; xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; -@@ -624,6 +677,10 @@ static int xhci_run_finished(struct xhci - xhci_dbg_trace(xhci, trace_xhci_dbg_init, - "Finished xhci_run for USB3 roothub"); - return 0; -+ -+err_halt: -+ xhci_halt(xhci); -+ return err; - } - - /* --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1908,6 +1908,7 @@ struct xhci_hcd { From 06efc8027fb5066e818d9b4fd66a3c268c04dea4 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 20 Oct 2023 10:27:12 -0400 Subject: [PATCH 0554/1171] kernel: bump 5.15 to 5.15.136 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.136 Removed bcm53xx patch backported from 5.15.136: target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch [1] All other patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 1. https://github.com/openwrt/openwrt/pull/13751#issuecomment-1781206937 Signed-off-by: John Audia [rmilecki: updated commit description & tested on Luxul XWR-3150] Signed-off-by: Rafał Miłecki [Refreshed on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens (cherry picked from commit 5a6368e85deb1d751238447ea8b289576e701cb0) --- include/kernel-5.15 | 4 +- .../950-0064-Add-dwc_otg-driver.patch | 2 +- ...ware-emulation-of-deprecated-instruc.patch | 4 +- ...hci_fixup_endpoint-for-interval-adju.patch | 4 +- ...vice-quirks-for-A4Tech-FHD-1080p-web.patch | 2 +- ...t-TRBS_PER_SEGMENT-define-in-runtime.patch | 4 +- ...upt-disabled-in-initialization-until.patch | 87 ------------------- 7 files changed, 10 insertions(+), 97 deletions(-) delete mode 100644 target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 313e735a5430aa..3806ef18b47810 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .135 -LINUX_KERNEL_HASH-5.15.135 = 14835e629e237f136cfed484fdb533c95242429809bdcdb2a2d66dfcb7447170 +LINUX_VERSION-5.15 = .136 +LINUX_KERNEL_HASH-5.15.136 = c624b9fe7ee4708d34cfd0b7ebc58037afac7463338cc498641ea31c55eeacb8 diff --git a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch index aabb7415035424..49283f55630e7a 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch @@ -1123,7 +1123,7 @@ Signed-off-by: Jonathan Bell } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5640,7 +5640,7 @@ static void port_event(struct usb_hub *h +@@ -5659,7 +5659,7 @@ static void port_event(struct usb_hub *h port_dev->over_current_count++; port_over_current_notify(port_dev); diff --git a/target/linux/bcm27xx/patches-5.15/950-0090-ARM64-Force-hardware-emulation-of-deprecated-instruc.patch b/target/linux/bcm27xx/patches-5.15/950-0090-ARM64-Force-hardware-emulation-of-deprecated-instruc.patch index 3ab51b0f07cc63..33d3e3b7b6d9ab 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0090-ARM64-Force-hardware-emulation-of-deprecated-instruc.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0090-ARM64-Force-hardware-emulation-of-deprecated-instruc.patch @@ -10,9 +10,9 @@ Subject: [PATCH] ARM64: Force hardware emulation of deprecated --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c -@@ -183,10 +183,15 @@ static void __init register_insn_emulati +@@ -546,10 +546,15 @@ static void __init register_insn_emulati - switch (ops->status) { + switch (insn->status) { case INSN_DEPRECATED: +#if 0 insn->current_mode = INSN_EMULATE; diff --git a/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index f832fa126c3192..c1952de661f817 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1622,6 +1622,109 @@ command_cleanup: +@@ -1631,6 +1631,109 @@ command_cleanup: } /* @@ -125,7 +125,7 @@ Signed-off-by: Jonathan Bell * non-error returns are a promise to giveback() the urb later * we drop ownership so next owner (or urb unlink) can get it */ -@@ -5461,6 +5564,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5470,6 +5573,7 @@ static const struct hc_driver xhci_hc_dr .endpoint_reset = xhci_endpoint_reset, .check_bandwidth = xhci_check_bandwidth, .reset_bandwidth = xhci_reset_bandwidth, diff --git a/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch b/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch index d8ee96258d73d9..6dc533b3fe0b1b 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonathan Bell --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -1884,6 +1884,8 @@ static const struct usb_audio_quirk_flag +@@ -1888,6 +1888,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ QUIRK_FLAG_GENERIC_IMPLICIT_FB), diff --git a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch index 792f3bdf0fe76d..917e324a001023 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch @@ -226,7 +226,7 @@ Signed-off-by: Jonathan Bell } --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -880,8 +880,8 @@ static void xhci_clear_command_ring(stru +@@ -889,8 +889,8 @@ static void xhci_clear_command_ring(stru seg = ring->deq_seg; do { memset(seg->trbs, 0, @@ -237,7 +237,7 @@ Signed-off-by: Jonathan Bell cpu_to_le32(~TRB_CYCLE); seg = seg->next; } while (seg != ring->deq_seg); -@@ -892,7 +892,7 @@ static void xhci_clear_command_ring(stru +@@ -901,7 +901,7 @@ static void xhci_clear_command_ring(stru ring->enq_seg = ring->deq_seg; ring->enqueue = ring->dequeue; diff --git a/target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch b/target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch deleted file mode 100644 index 78b3aa85e3b57e..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/081-xhci-Keep-interrupt-disabled-in-initialization-until.patch +++ /dev/null @@ -1,87 +0,0 @@ -From a808925075fb750804a60ff0710614466c396db4 Mon Sep 17 00:00:00 2001 -From: Hongyu Xie -Date: Thu, 23 Jun 2022 14:19:42 +0300 -Subject: [PATCH] xhci: Keep interrupt disabled in initialization until host is - running. - -irq is disabled in xhci_quiesce(called by xhci_halt, with bit:2 cleared -in USBCMD register), but xhci_run(called by usb_add_hcd) re-enable it. -It's possible that you will receive thousands of interrupt requests -after initialization for 2.0 roothub. And you will get a lot of -warning like, "xHCI dying, ignoring interrupt. Shouldn't IRQs be -disabled?". This amount of interrupt requests will cause the entire -system to freeze. -This problem was first found on a device with ASM2142 host controller -on it. - -[tidy up old code while moving it, reword header -Mathias] - -Cc: stable@kernel.org -Signed-off-by: Hongyu Xie -Signed-off-by: Mathias Nyman -Link: https://lore.kernel.org/r/20220623111945.1557702-2-mathias.nyman@linux.intel.com -Signed-off-by: Greg Kroah-Hartman ---- - drivers/usb/host/xhci.c | 35 ++++++++++++++++++++++------------- - 1 file changed, 22 insertions(+), 13 deletions(-) - ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -611,8 +611,27 @@ static int xhci_init(struct usb_hcd *hcd - - static int xhci_run_finished(struct xhci_hcd *xhci) - { -+ unsigned long flags; -+ u32 temp; -+ -+ /* -+ * Enable interrupts before starting the host (xhci 4.2 and 5.5.2). -+ * Protect the short window before host is running with a lock -+ */ -+ spin_lock_irqsave(&xhci->lock, flags); -+ -+ xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable interrupts"); -+ temp = readl(&xhci->op_regs->command); -+ temp |= (CMD_EIE); -+ writel(temp, &xhci->op_regs->command); -+ -+ xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable primary interrupter"); -+ temp = readl(&xhci->ir_set->irq_pending); -+ writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending); -+ - if (xhci_start(xhci)) { - xhci_halt(xhci); -+ spin_unlock_irqrestore(&xhci->lock, flags); - return -ENODEV; - } - xhci->shared_hcd->state = HC_STATE_RUNNING; -@@ -623,6 +642,9 @@ static int xhci_run_finished(struct xhci - - xhci_dbg_trace(xhci, trace_xhci_dbg_init, - "Finished xhci_run for USB3 roothub"); -+ -+ spin_unlock_irqrestore(&xhci->lock, flags); -+ - return 0; - } - -@@ -671,19 +693,6 @@ int xhci_run(struct usb_hcd *hcd) - temp |= (xhci->imod_interval / 250) & ER_IRQ_INTERVAL_MASK; - writel(temp, &xhci->ir_set->irq_control); - -- /* Set the HCD state before we enable the irqs */ -- temp = readl(&xhci->op_regs->command); -- temp |= (CMD_EIE); -- xhci_dbg_trace(xhci, trace_xhci_dbg_init, -- "// Enable interrupts, cmd = 0x%x.", temp); -- writel(temp, &xhci->op_regs->command); -- -- temp = readl(&xhci->ir_set->irq_pending); -- xhci_dbg_trace(xhci, trace_xhci_dbg_init, -- "// Enabling event ring interrupter %p by writing 0x%x to irq_pending", -- xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); -- writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending); -- - if (xhci->quirks & XHCI_NEC_HOST) { - struct xhci_command *command; - From 64ab02aff86839dad65d97d38ed302c73b22ad40 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 25 Oct 2023 15:26:53 -0400 Subject: [PATCH 0555/1171] kernel: bump 5.15 to 5.15.137 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.137 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia [Refreshed on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens (cherry picked from commit 75aeb7ed627ba5ea6f10f365b232bed21e40b502) --- include/kernel-5.15 | 4 ++-- ...-fixup-modes-that-haven-t-been-reset.patch | 2 +- ...rs-remove-legacy_cursor_update-hacks.patch | 4 ++-- ...dsa-bcm_sf2-refactor-LED-regs-access.patch | 2 +- ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- ..._eth_soc-implement-flow-offloading-t.patch | 2 +- ...-users-of-bitmap_foo-to-linkmode_foo.patch | 4 ++-- ...ive-renaming-when-an-interface-is-up.patch | 4 ++-- .../721-net-add-packet-mangeling.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 4 ++-- .../generic/hack-5.15/902-debloat_proc.patch | 4 ++-- ...ng-with-source-address-failed-policy.patch | 2 +- ...T-skip-GRO-for-foreign-MAC-addresses.patch | 10 +++++----- ...ional-threading-for-backlog-processi.patch | 20 +++++++++---------- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 3806ef18b47810..47db849241d26b 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .136 -LINUX_KERNEL_HASH-5.15.136 = c624b9fe7ee4708d34cfd0b7ebc58037afac7463338cc498641ea31c55eeacb8 +LINUX_VERSION-5.15 = .137 +LINUX_KERNEL_HASH-5.15.137 = 9749b21609f9e7ad9c46160c2c107db823b99cef77fa6cb080b6c2dc685fb2f7 diff --git a/target/linux/bcm27xx/patches-5.15/950-0439-drm-atomic-Don-t-fixup-modes-that-haven-t-been-reset.patch b/target/linux/bcm27xx/patches-5.15/950-0439-drm-atomic-Don-t-fixup-modes-that-haven-t-been-reset.patch index 657e3969a63929..96a92663bddf2c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0439-drm-atomic-Don-t-fixup-modes-that-haven-t-been-reset.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0439-drm-atomic-Don-t-fixup-modes-that-haven-t-been-reset.patch @@ -10,7 +10,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c -@@ -431,6 +431,11 @@ mode_fixup(struct drm_atomic_state *stat +@@ -436,6 +436,11 @@ mode_fixup(struct drm_atomic_state *stat new_crtc_state = drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); diff --git a/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch b/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch index bfcbbe153b93de..c5380469e9b43e 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0806-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch @@ -59,7 +59,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c -@@ -1507,13 +1507,6 @@ drm_atomic_helper_wait_for_vblanks(struc +@@ -1516,13 +1516,6 @@ drm_atomic_helper_wait_for_vblanks(struc int i, ret; unsigned int crtc_mask = 0; @@ -73,7 +73,7 @@ Signed-off-by: Maxime Ripard for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { if (!new_crtc_state->active) continue; -@@ -2141,12 +2134,6 @@ int drm_atomic_helper_setup_commit(struc +@@ -2150,12 +2143,6 @@ int drm_atomic_helper_setup_commit(struc complete_all(&commit->flip_done); continue; } diff --git a/target/linux/bcm4908/patches-5.15/070-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.15/070-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch index fd0b13c17ba952..e01c1e4728bd34 100644 --- a/target/linux/bcm4908/patches-5.15/070-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch +++ b/target/linux/bcm4908/patches-5.15/070-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch @@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -1241,9 +1278,14 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1247,9 +1284,14 @@ static const u16 bcm_sf2_4908_reg_offset [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, [REG_RGMII_11_CNTRL] = 0x014c, diff --git a/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index ba09c562aebae6..165b02da0fa32a 100644 --- a/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1542,10 +1542,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1548,10 +1548,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index b5baa8717e4aab..ea0adca26f6c78 100644 --- a/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1556,6 +1556,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1562,6 +1562,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch b/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch index ef2f53aa3847d7..69113c2ffafc6f 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch @@ -256,7 +256,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -763,6 +763,10 @@ int dev_fill_forward_path(const struct n +@@ -769,6 +769,10 @@ int dev_fill_forward_path(const struct n if (WARN_ON_ONCE(last_dev == ctx.dev)) return -1; } diff --git a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch index 2f8128b3f30551..284a6d072255eb 100644 --- a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch +++ b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller } --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -686,7 +686,7 @@ static void bcm_sf2_sw_validate(struct d +@@ -692,7 +692,7 @@ static void bcm_sf2_sw_validate(struct d state->interface != PHY_INTERFACE_MODE_GMII && state->interface != PHY_INTERFACE_MODE_INTERNAL && state->interface != PHY_INTERFACE_MODE_MOCA) { @@ -313,7 +313,7 @@ Signed-off-by: David S. Miller if (port != core_readl(priv, CORE_IMP0_PRT_ID)) dev_err(ds->dev, "Unsupported interface: %d for port %d\n", -@@ -714,10 +714,8 @@ static void bcm_sf2_sw_validate(struct d +@@ -720,10 +720,8 @@ static void bcm_sf2_sw_validate(struct d phylink_set(mask, 100baseT_Half); phylink_set(mask, 100baseT_Full); diff --git a/target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch b/target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch index bd58db2e7787e1..582e1ce2efdd48 100644 --- a/target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch +++ b/target/linux/generic/backport-5.15/794-v6.2-net-core-Allow-live-renaming-when-an-interface-is-up.patch @@ -73,7 +73,7 @@ Signed-off-by: David S. Miller /* Specifies the type of the struct net_device::ml_priv pointer */ --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -1222,22 +1222,6 @@ int dev_change_name(struct net_device *d +@@ -1242,22 +1242,6 @@ int dev_change_name(struct net_device *d net = dev_net(dev); @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller down_write(&devnet_rename_sem); if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { -@@ -1254,7 +1238,8 @@ int dev_change_name(struct net_device *d +@@ -1274,7 +1258,8 @@ int dev_change_name(struct net_device *d } if (oldname[0] && !strchr(oldname, '%')) diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index fcaed01cad194d..ac9a161b5f5915 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3577,6 +3577,11 @@ static int xmit_one(struct sk_buff *skb, +@@ -3597,6 +3597,11 @@ static int xmit_one(struct sk_buff *skb, if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 5c1dbd69d3cdc7..e5667c17438d24 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -20,7 +20,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -244,6 +244,8 @@ static void option_instat_callback(struc +@@ -247,6 +247,8 @@ static void option_instat_callback(struc #define UBLOX_PRODUCT_R410M 0x90b2 /* These Yuga products use Qualcomm's vendor ID */ #define YUGA_PRODUCT_CLM920_NC5 0x9625 @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1180,6 +1182,11 @@ static const struct usb_device_id option +@@ -1185,6 +1187,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index 58c2026c48e2c8..768d3e1f0cfb76 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -341,7 +341,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -3025,11 +3025,13 @@ static const struct seq_operations fib_r +@@ -3029,11 +3029,13 @@ static const struct seq_operations fib_r int __net_init fib_proc_init(struct net *net) { @@ -357,7 +357,7 @@ Signed-off-by: Felix Fietkau fib_triestat_seq_show, NULL)) goto out2; -@@ -3040,17 +3042,21 @@ int __net_init fib_proc_init(struct net +@@ -3044,17 +3046,21 @@ int __net_init fib_proc_init(struct net return 0; out3: diff --git a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 351d5864a1f8b1..7aaac9653187b9 100644 --- a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski static void rt_fibinfo_free(struct rtable __rcu **rtp) --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -2773,6 +2773,7 @@ static const char *const rtn_type_names[ +@@ -2777,6 +2777,7 @@ static const char *const rtn_type_names[ [RTN_THROW] = "THROW", [RTN_NAT] = "NAT", [RTN_XRESOLVE] = "XRESOLVE", diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 71b3aac846967f..46856e1552fa06 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau __u8 inner_protocol_type:1; --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6054,6 +6054,9 @@ static enum gro_result dev_gro_receive(s +@@ -6074,6 +6074,9 @@ static enum gro_result dev_gro_receive(s int same_flow; int grow; @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -8068,6 +8071,48 @@ static void __netdev_adjacent_dev_unlink +@@ -8088,6 +8091,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info, -@@ -8119,6 +8164,7 @@ static int __netdev_upper_dev_link(struc +@@ -8139,6 +8184,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -8215,6 +8261,7 @@ static void __netdev_upper_dev_unlink(st +@@ -8235,6 +8281,7 @@ static void __netdev_upper_dev_unlink(st __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); -@@ -9034,6 +9081,7 @@ int dev_set_mac_address(struct net_devic +@@ -9054,6 +9101,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch index 8a65cbe021f7a0..62daef91b1506e 100644 --- a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch +++ b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau /** * napi_disable - prevent NAPI from scheduling -@@ -3362,6 +3363,7 @@ struct softnet_data { +@@ -3363,6 +3364,7 @@ struct softnet_data { unsigned int processed; unsigned int time_squeeze; unsigned int received_rps; @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #endif --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4563,7 +4563,7 @@ static int rps_ipi_queued(struct softnet +@@ -4583,7 +4583,7 @@ static int rps_ipi_queued(struct softnet #ifdef CONFIG_RPS struct softnet_data *mysd = this_cpu_ptr(&softnet_data); @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5744,6 +5744,8 @@ static DEFINE_PER_CPU(struct work_struct +@@ -5764,6 +5764,8 @@ static DEFINE_PER_CPU(struct work_struct /* Network device is going away, flush any packets still pending */ static void flush_backlog(struct work_struct *work) { @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau struct sk_buff *skb, *tmp; struct softnet_data *sd; -@@ -5759,9 +5761,18 @@ static void flush_backlog(struct work_st +@@ -5779,9 +5781,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->process_queue); -@@ -5769,7 +5780,18 @@ static void flush_backlog(struct work_st +@@ -5789,7 +5800,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau } static bool flush_required(int cpu) -@@ -6452,6 +6474,7 @@ static int process_backlog(struct napi_s +@@ -6472,6 +6494,7 @@ static int process_backlog(struct napi_s local_irq_disable(); rps_lock(sd); @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6461,7 +6484,8 @@ static int process_backlog(struct napi_s +@@ -6481,7 +6504,8 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6878,6 +6902,57 @@ int dev_set_threaded(struct net_device * +@@ -6898,6 +6922,57 @@ int dev_set_threaded(struct net_device * } EXPORT_SYMBOL(dev_set_threaded); @@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -11354,6 +11429,9 @@ static int dev_cpu_dead(unsigned int old +@@ -11378,6 +11453,9 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; oldsd->rps_ipi_list = NULL; -@@ -11693,6 +11771,7 @@ static int __init net_dev_init(void) +@@ -11717,6 +11795,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif From 982f85914479570d11afd98a5b2a362661da0e6c Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Sun, 15 Oct 2023 23:18:27 +0800 Subject: [PATCH 0556/1171] sunxi: fixes led for nanopi boards Kernel 5.15 already supports the NanoPi R1 and NanoPi R1S H5, and they use new LED bindings that do not match the existing settings in 01_leds. Update led settings to fixes that. List the led node on NanoPi R1S H5: root@OpenWrt:~# ls /sys/class/leds/ green:lan green:wan red:status Signed-off-by: Chukun Pan (cherry picked from commit b25c7548e07ad8775f8511ba8276bf3ecb4409ba) --- target/linux/sunxi/base-files/etc/board.d/01_leds | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/sunxi/base-files/etc/board.d/01_leds b/target/linux/sunxi/base-files/etc/board.d/01_leds index 60783363dee98a..da94e403737c8f 100644 --- a/target/linux/sunxi/base-files/etc/board.d/01_leds +++ b/target/linux/sunxi/base-files/etc/board.d/01_leds @@ -9,8 +9,8 @@ board_config_update case $board in friendlyarm,nanopi-r1|\ friendlyarm,nanopi-r1s-h5) - ucidef_set_led_netdev "wan" "WAN" "nanopi:green:wan" "eth0" - ucidef_set_led_netdev "lan" "LAN" "nanopi:green:lan" "eth1" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth1" ;; esac From 620721f642102818e06035720afe8adec9b8836e Mon Sep 17 00:00:00 2001 From: Furong Xu Date: Fri, 27 Oct 2023 23:22:49 +0800 Subject: [PATCH 0557/1171] uboot-mediatek: Sync phy-mode for Xiaomi Redmi Router AX6000 Commit 572ea6807053 ("uboot-mediatek: add patches for MT7988 and builds for RFB") renamed HSGMII to 2500basex, but forgot to update the dts of Redmi Router AX6000, makes the network unusable. This patch makes the network usable again. Fixes: #13724 Fixes: 572ea6807053 ("uboot-mediatek: add patches for MT7988 and builds for RFB") Signed-off-by: Furong Xu (cherry picked from commit 03987d2d11c4954e3e8afa3d44ba6213e774c742) --- .../uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch b/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch index 070456b2ee8862..88b2c63632d4c1 100644 --- a/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch +++ b/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch @@ -239,12 +239,12 @@ +ð { + status = "okay"; + mediatek,gmac-id = <0>; -+ phy-mode = "sgmii"; ++ phy-mode = "2500base-x"; + mediatek,switch = "mt7531"; + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + + fixed-link { -+ speed = <1000>; ++ speed = <2500>; + full-duplex; + }; +}; From 3d0a78add22754aa891529b6702b5e4c7b837446 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Thu, 26 Oct 2023 08:40:59 +0200 Subject: [PATCH 0558/1171] qualcommax: only build initramfs if CONFIG_TARGET_ROOTFS_INITRAMFS is set This makes it possible to build the ipq807x netgear-wax218 without initramfs - which is required for downstream projects (gluon) Signed-off-by: Florian Maurer (cherry picked from commit b3d2008f92f15ff776ad6c4f6d113b0cda1bd2d0) --- target/linux/ipq807x/image/generic.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index 124cdfc3b2a54e..fb991156d5de4b 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -80,15 +80,17 @@ TARGET_DEVICES += edimax_cax1800 define Device/netgear_wax218 $(call Device/FitImage) $(call Device/UbiFit) - ARTIFACTS := web-ui-factory.fit DEVICE_VENDOR := Netgear DEVICE_MODEL := WAX218 DEVICE_DTS_CONFIG := config@hk07 BLOCKSIZE := 128k PAGESIZE := 2048 SOC := ipq8072 +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := web-ui-factory.fit ARTIFACT/web-ui-factory.fit := append-image initramfs-uImage.itb | \ ubinize-kernel | qsdk-ipq-factory-nand +endif DEVICE_PACKAGES := kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 \ ipq-wifi-netgear_wax218 endef From 07e9c27bde133e7e05c691d71b9b1da0554cb5f2 Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Sun, 8 Oct 2023 18:18:13 +0300 Subject: [PATCH 0559/1171] build: hide kmod-zram config unless enabled Currently the zram default compressor choice is displayed whether or not zram is activated. Since the default choice is lzo-rle, this adds a false dependency on kmod-lib-lzo. With this patch, the choice options appear only when activating zram. Signed-off-by: Rani Hod (cherry picked from commit 62ada26de28e6c43a957b8f186ead1f45e6a5623) --- package/kernel/linux/modules/other.mk | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index cd827725bd5388..9c10b9750192d6 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -1013,31 +1013,33 @@ define KernelPackage/zram/description endef define KernelPackage/zram/config - choice - prompt "ZRAM Default compressor" - default ZRAM_DEF_COMP_LZORLE + if PACKAGE_kmod-zram + choice + prompt "ZRAM Default compressor" + default ZRAM_DEF_COMP_LZORLE - config ZRAM_DEF_COMP_LZORLE + config ZRAM_DEF_COMP_LZORLE bool "lzo-rle" select PACKAGE_kmod-lib-lzo - config ZRAM_DEF_COMP_LZO + config ZRAM_DEF_COMP_LZO bool "lzo" select PACKAGE_kmod-lib-lzo - config ZRAM_DEF_COMP_LZ4 + config ZRAM_DEF_COMP_LZ4 bool "lz4" select PACKAGE_kmod-lib-lz4 - config ZRAM_DEF_COMP_LZ4HC + config ZRAM_DEF_COMP_LZ4HC bool "lz4-hc" select PACKAGE_kmod-lib-lz4hc - config ZRAM_DEF_COMP_ZSTD + config ZRAM_DEF_COMP_ZSTD bool "zstd" select PACKAGE_kmod-lib-zstd - endchoice + endchoice + endif endef $(eval $(call KernelPackage,zram)) From fefa446127bb38f38b88d7296b022acef57db3d6 Mon Sep 17 00:00:00 2001 From: Anari Jalakas Date: Sat, 7 Oct 2023 15:10:50 +0300 Subject: [PATCH 0560/1171] iwinfo: opt-out of lto usage This fixes building with USE_LTO enabled. :(.text+0x400c): relocation R_MIPS16_26 against `iwinfo_close' cannot be used when making a shared object; recompile with -fPIC ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: non-dynamic relocations refer to dynamic symbol strcpy ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status Signed-off-by: Anari Jalakas (cherry picked from commit fbacc5ae52ec8fbe89b3a47850b4d6f62d4c4bf5) --- package/network/utils/iwinfo/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index e5add395ff90b8..c6a14956fd1c95 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -17,6 +17,8 @@ PKG_MIRROR_HASH:=5eddf584a1c3ed5637162d6bfc573ed1ce3691fcb38bdd55bf9f1e11e82ccc4 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=no-lto + IWINFO_ABI_VERSION:=20230701 include $(INCLUDE_DIR)/package.mk From b5817d14c9dbee1c0414c764e00540c26658b886 Mon Sep 17 00:00:00 2001 From: Anari Jalakas Date: Sat, 7 Oct 2023 16:43:09 +0300 Subject: [PATCH 0561/1171] libselinux: opt-out of lto usage This fixes building with USE_LTO enabled: :(.text.exit+0x6e): relocation R_MIPS16_26 against `pthread_key_delete' cannot be used when making a shared object; recompile with -fPIC ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: non-dynamic relocations refer to dynamic symbol stpcpy ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status Signed-off-by: Anari Jalakas (cherry picked from commit 2a33d26d2110a9332e343a1deb32c9eee486c0db) --- package/libs/libselinux/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/libs/libselinux/Makefile b/package/libs/libselinux/Makefile index 816e09f30ce877..f90d4993c836be 100644 --- a/package/libs/libselinux/Makefile +++ b/package/libs/libselinux/Makefile @@ -18,6 +18,8 @@ PKG_LICENSE_FILES:=LICENSE PKG_MAINTAINER:=Thomas Petazzoni PKG_CPE_ID:=cpe:/a:selinuxproject:libselinux +PKG_BUILD_FLAGS:=no-lto + HOST_BUILD_DEPENDS:=libsepol/host musl-fts/host pcre2/host include $(INCLUDE_DIR)/package.mk From 1d5d1493307ac0933df0cc8b88bf1666296b3382 Mon Sep 17 00:00:00 2001 From: Anari Jalakas Date: Sat, 7 Oct 2023 16:13:21 +0300 Subject: [PATCH 0562/1171] libsepol: opt-out of lto usage This fixes building with USE_LTO enabled. :(.text+0x4194): relocation R_MIPS16_26 against `cil_printf.lto_priv.0' cannot be used when making a shared object; recompile with -fPIC ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: non-dynamic relocations refer to dynamic symbol memcmp ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status Signed-off-by: Anari Jalakas (cherry picked from commit 1925a183a3f25d2db1f10addc85ed894df14c210) --- package/libs/libsepol/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/libs/libsepol/Makefile b/package/libs/libsepol/Makefile index 613d19388d5312..b1a34d293e058f 100644 --- a/package/libs/libsepol/Makefile +++ b/package/libs/libsepol/Makefile @@ -16,6 +16,8 @@ PKG_HASH:=78fdaf69924db780bac78546e43d9c44074bad798c2c415d0b9bb96d065ee8a2 PKG_MAINTAINER:=Thomas Petazzoni PKG_CPE_ID:=cpe:/a:selinuxproject:libsepol +PKG_BUILD_FLAGS:=no-lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk From f1ea45f85325490dd5c250bfc9b2ba927b49ac6e Mon Sep 17 00:00:00 2001 From: Anari Jalakas Date: Sat, 7 Oct 2023 15:16:47 +0300 Subject: [PATCH 0563/1171] lua: opt-out of lto usage This fixes building with USE_LTO enabled. :(.text+0xcc8): relocation R_MIPS16_26 against `luaL_argerror' cannot be used when making a shared object; recompile with -fPIC ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: non-dynamic relocations refer to dynamic symbol strcpy ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status Signed-off-by: Anari Jalakas (cherry picked from commit 246b97b607e316d6acae66a23fcdf6d12c02a786) --- package/utils/lua/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index 9496ffb366be97..46e7bb0dcdb6c3 100644 --- a/package/utils/lua/Makefile +++ b/package/utils/lua/Makefile @@ -21,6 +21,8 @@ PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYRIGHT PKG_CPE_ID:=cpe:/a:lua:lua +PKG_BUILD_FLAGS:=no-lto + HOST_PATCH_DIR := ./patches-host include $(INCLUDE_DIR)/package.mk From 26164312b44137630cfaeb36f8a7713fa8ecf0ea Mon Sep 17 00:00:00 2001 From: Anari Jalakas Date: Sat, 14 Oct 2023 15:18:34 +0300 Subject: [PATCH 0564/1171] iptables: opt-out of lto usage This fixes building with USE_LTO enabled. :(.text+0xc22): relocation R_MIPS16_26 against `libxt_DNAT_init' cannot be used when making a shared object; recompile with -fPIC ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: non-dynamic relocations refer to dynamic symbol printf ./openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/gcc/mips-openwrt-linux-musl/12.3.0/../../../../mips-openwrt-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status Signed-off-by: Anari Jalakas (cherry picked from commit 5dbdf3bb3af27993977aaaa72dca07d9251c1919) --- package/network/utils/iptables/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 0d6d76fc080fca..aded1b7b1fdda5 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -20,7 +20,7 @@ PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared PKG_INSTALL:=1 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections no-lto PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0 PKG_CPE_ID:=cpe:/a:netfilter_core_team:iptables From ed6e13649d5c8f82fed6d6e4ce5535a063f21caa Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 26 Sep 2023 20:12:45 +0800 Subject: [PATCH 0565/1171] ramips: fix Gigabit Ethernet port of the HiWiFi HC5861 HiWiFi HC5861 has a GbE port which connected to the RTL8211E PHY chip. This patch adds the missing Realtek PHY driver package and sets the correct external PHYs base address to make it work again. Signed-off-by: Shiji Yang (cherry picked from commit f025135f16e2b3e9398cfd87585d055a1ca31975) --- target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts | 6 +++++- target/linux/ramips/image/mt7620.mk | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts index 87eacb13d7802f..8b37162f26709f 100644 --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts @@ -70,7 +70,7 @@ ðernet { pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins &mdio_pins>; + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; @@ -93,6 +93,10 @@ }; }; +&gsw { + mediatek,ephy-base = /bits/ 8 <12>; +}; + &pcie { status = "okay"; }; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 7c2ff740f05726..897bbfd3920e60 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -549,7 +549,7 @@ define Device/hiwifi_hc5861 DEVICE_VENDOR := HiWiFi DEVICE_MODEL := HC5861 DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci kmod-sdhci-mt7620 \ - kmod-usb-ledtrig-usbport + kmod-phy-realtek kmod-usb-ledtrig-usbport SUPPORTED_DEVICES += hc5861 endef TARGET_DEVICES += hiwifi_hc5861 From 220ab83cd119463a288b2c234484e4a79ae4e305 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 14 Jul 2023 23:09:55 +0800 Subject: [PATCH 0566/1171] ath79: increase the rfkill debounce interval for TP-Link Archer C7 v2 Due to circuit issue or silicon defect, sometimes the WiFi switch button of the Archer C7 v2 can be accidentally triggered multiple times in one second. This will cause WiFi to be unexpectedly shut down and trigger 'irq 23: nobody cared'[1] warning. Increasing the key debounce interval to 1000 ms can fix this issue. This patch also add the missing rfkill key label. [1] Warning Log: ``` [87765.218511] irq 23: nobody cared (try booting with the "irqpoll" option) [87765.225331] CPU: 0 PID: 317 Comm: irq/23-keys Not tainted 5.15.118 #0 ... [87765.486246] handlers: [87765.488543] [<85257547>] 0x800c29a0 threaded [<5c6328a2>] 0x80ffe0b8 [gpio_button_hotplug@4cf73d00+0x1a00] [87765.498364] Disabling IRQ #23 ``` Fixes: https://github.com/openwrt/openwrt/issues/13010 Fixes: https://github.com/openwrt/openwrt/issues/12167 Fixes: https://github.com/openwrt/openwrt/issues/11191 Fixes: https://github.com/openwrt/openwrt/issues/7835 Tested-by: Hans Hasert Signed-off-by: Shiji Yang (cherry picked from commit e32f70e7066c3110694851eced3301f50019693b) --- target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts index b7ac902003cacb..1b860dbf2d5ff7 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts @@ -13,10 +13,11 @@ &keys { rfkill { + label = "rfkill"; gpios = <&gpio 23 GPIO_ACTIVE_LOW>; linux,code = ; linux,input-type = ; - debounce-interval = <60>; + debounce-interval = <1000>; }; }; From eaf44c56968495ea4e500ebaa11ab1932d550bcd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 30 Oct 2023 18:32:24 +0100 Subject: [PATCH 0567/1171] hostapd: do not trim trailing whitespace, except for newline Fixes adding SSID or key with trailing whitespace Signed-off-by: Felix Fietkau (cherry picked from commit a2d8226c4f45555f49542d6f047b70d44f23f7ec) --- package/network/services/hostapd/files/hostapd.uc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 88f01caa93ebfd..593840cca88fbe 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -571,7 +571,7 @@ function iface_load_config(filename) let bss; let line; - while ((line = trim(f.read("line"))) != null) { + while ((line = rtrim(f.read("line"), "\n")) != null) { let val = split(line, "=", 2); if (!val[0]) continue; @@ -593,7 +593,7 @@ function iface_load_config(filename) push(config.radio.data, line); } - while ((line = trim(f.read("line"))) != null) { + while ((line = rtrim(f.read("line"), "\n")) != null) { if (line == "#default_macaddr") bss.default_macaddr = true; From 6bb3c2eba80a04c0d6ba4e10891338f445669ee1 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 29 Oct 2023 19:10:23 +0000 Subject: [PATCH 0568/1171] ramips: enable wireless LEDs activity blinking for TP-Link EC330-G5u v1 This commit enables wireless LEDs activity blinking for TP-Link EC330-G5u v1 router. Signed-off-by: Mikhail Zhilkin (cherry picked from commit 7666940efea27c7d16bb0e329bb5dd7117fb5807) --- target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts index 6c9cc407015b38..7d2caf07691686 100644 --- a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts @@ -73,7 +73,7 @@ function = LED_FUNCTION_WLAN; function-enumerator = <0>; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1radio"; + linux,default-trigger = "phy1tpt"; }; led-6 { @@ -82,7 +82,7 @@ function = LED_FUNCTION_WLAN; function-enumerator = <1>; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0radio"; + linux,default-trigger = "phy0tpt"; }; led_power: led-7 { From 16fcad47a4d92d5055a2b33293248564a8ce0466 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 24 Oct 2023 03:07:48 +0200 Subject: [PATCH 0569/1171] hostapd: fix OWE association with mbedtls The code for hostapd-mbedtls did not work when used for OWE association. When handling association requests, the buffer offsets and length assumptions were incorrect, leading to never calculating the y point, thus denying association. Also when crafting the association response, the buffer contained the trailing key-type. Fix up both issues to adhere to the specification and make hostapd-mbedtls work with the OWE security type. Signed-off-by: David Bauer (cherry picked from commit 39341f422f895a37b405b753c3630b1bdc9b8c6e) --- package/network/services/hostapd/Makefile | 2 +- .../135-mbedtls-fix-owe-association.patch | 91 +++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 package/network/services/hostapd/patches/135-mbedtls-fix-owe-association.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 64048a963a480d..73ec5e198dad50 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/135-mbedtls-fix-owe-association.patch b/package/network/services/hostapd/patches/135-mbedtls-fix-owe-association.patch new file mode 100644 index 00000000000000..0c29432d3f83f3 --- /dev/null +++ b/package/network/services/hostapd/patches/135-mbedtls-fix-owe-association.patch @@ -0,0 +1,91 @@ +The code for hostapd-mbedtls did not work when used for OWE association. + +When handling association requests, the buffer offsets and length assumptions were incorrect, leading to never calculating the y point, thus denying association. + +Also when crafting the association response, the buffer contained the trailing key-type. + +Fix up both issues to adhere to the specification and make hostapd-mbedtls work with the OWE security type. + +--- a/src/crypto/crypto_mbedtls.c ++++ b/src/crypto/crypto_mbedtls.c +@@ -2299,25 +2299,30 @@ struct crypto_ecdh * crypto_ecdh_init2(i + struct wpabuf * crypto_ecdh_get_pubkey(struct crypto_ecdh *ecdh, int inc_y) + { + mbedtls_ecp_group *grp = &ecdh->grp; +- size_t len = CRYPTO_EC_plen(grp); ++ size_t prime_len = CRYPTO_EC_plen(grp); ++ size_t output_len = prime_len; ++ u8 output_offset = 0; ++ u8 buf[256]; ++ + #ifdef MBEDTLS_ECP_MONTGOMERY_ENABLED + /* len */ + #endif + #ifdef MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED +- if (mbedtls_ecp_get_type(grp) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS) +- len = inc_y ? len*2+1 : len+1; ++ if (mbedtls_ecp_get_type(grp) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS) { ++ output_len = inc_y ? prime_len * 2 + 1 : prime_len + 1; ++ output_offset = 1; ++ } + #endif +- struct wpabuf *buf = wpabuf_alloc(len); +- if (buf == NULL) ++ ++ if (output_len > sizeof(buf)) + return NULL; ++ + inc_y = inc_y ? MBEDTLS_ECP_PF_UNCOMPRESSED : MBEDTLS_ECP_PF_COMPRESSED; +- if (mbedtls_ecp_point_write_binary(grp, &ecdh->Q, inc_y, &len, +- wpabuf_mhead_u8(buf), len) == 0) { +- wpabuf_put(buf, len); +- return buf; ++ if (mbedtls_ecp_point_write_binary(grp, &ecdh->Q, inc_y, &output_len, ++ buf, output_len) == 0) { ++ return wpabuf_alloc_copy(buf + output_offset, output_len - output_offset); + } + +- wpabuf_free(buf); + return NULL; + } + +@@ -2379,10 +2384,7 @@ struct wpabuf * crypto_ecdh_set_peerkey( + os_memcpy(buf+2, key, len); + } + len >>= 1; /*(repurpose len to prime_len)*/ +- } +- else if (key[0] == 0x02 || key[0] == 0x03) { /* (inc_y == 0) */ +- --len; /*(repurpose len to prime_len)*/ +- ++ } else { /* (inc_y == 0) */ + /* mbedtls_ecp_point_read_binary() does not currently support + * MBEDTLS_ECP_PF_COMPRESSED format (buf[1] = 0x02 or 0x03) + * (returns MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE) */ +@@ -2390,22 +2392,21 @@ struct wpabuf * crypto_ecdh_set_peerkey( + /* derive y, amend buf[] with y for UNCOMPRESSED format */ + if (sizeof(buf)-2 < len*2 || len == 0) + return NULL; ++ + buf[0] = (u8)(1+len*2); + buf[1] = 0x04; ++ os_memcpy(buf+2, key, len); ++ + mbedtls_mpi bn; + mbedtls_mpi_init(&bn); +- int ret = mbedtls_mpi_read_binary(&bn, key+1, len) +- || crypto_mbedtls_short_weierstrass_derive_y(grp, &bn, +- key[0] & 1) ++ int ret = mbedtls_mpi_read_binary(&bn, key, len) ++ || crypto_mbedtls_short_weierstrass_derive_y(grp, &bn, 0) + || mbedtls_mpi_write_binary(&bn, buf+2+len, len); + mbedtls_mpi_free(&bn); + if (ret != 0) + return NULL; + } + +- if (key[0] == 0) /*(repurpose len to prime_len)*/ +- len = CRYPTO_EC_plen(grp); +- + if (mbedtls_ecdh_read_public(&ecdh->ctx, buf, buf[0]+1)) + return NULL; + } From 958817b1c339c3e4aab455433668eb8bf6d3a6bc Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 11 Sep 2023 22:49:59 +0100 Subject: [PATCH 0570/1171] kernel: serial: 8250_mtk: track busclk state to avoid bus error UARTs not used as boot console are currently broken on some MediaTek targets due to register access depending on the bus clock being enabled. Add patch to make sure this dependency is always met. Signed-off-by: Daniel Golle (cherry picked from commit 9f62abbb60b849c710cc7e40498d661827e8f852) --- ...rack-busclk-state-to-avoid-bus-error.patch | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 target/linux/generic/pending-5.15/860-serial-8250_mtk-track-busclk-state-to-avoid-bus-error.patch diff --git a/target/linux/generic/pending-5.15/860-serial-8250_mtk-track-busclk-state-to-avoid-bus-error.patch b/target/linux/generic/pending-5.15/860-serial-8250_mtk-track-busclk-state-to-avoid-bus-error.patch new file mode 100644 index 00000000000000..c5db5d9491d410 --- /dev/null +++ b/target/linux/generic/pending-5.15/860-serial-8250_mtk-track-busclk-state-to-avoid-bus-error.patch @@ -0,0 +1,61 @@ +From 629c701fc39f1ada9416e0766a86729e83bde86c Mon Sep 17 00:00:00 2001 +Message-ID: <629c701fc39f1ada9416e0766a86729e83bde86c.1694465766.git.daniel@makrotopia.org> +From: Daniel Golle +Date: Mon, 11 Sep 2023 21:27:44 +0100 +Subject: [PATCH] serial: 8250_mtk: track busclk state to avoid bus error +To: Greg Kroah-Hartman , + Jiri Slaby , + Matthias Brugger , + AngeloGioacchino Del Regno , + Daniel Golle , + John Ogness , + Chen-Yu Tsai , + Changqi Hu , + linux-kernel@vger.kernel.org, + linux-serial@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org + +Commit e32a83c70cf9 ("serial: 8250-mtk: modify mtk uart power and +clock management") introduced polling a debug register to make sure +the UART is idle before disabling the bus clock. However, at least on +some MediaTek SoCs access to that very debug register requires the bus +clock being enabled. Hence calling the suspend function while already +in suspended state results in that register access triggering a bus +error. In order to avoid that, track the state of the bus clock and +only poll the debug register if not already in suspended state. + +Fixes: e32a83c70cf9 ("serial: 8250-mtk: modify mtk uart power and clock management") +Signed-off-by: Daniel Golle +--- + drivers/tty/serial/8250/8250_mtk.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/8250/8250_mtk.c ++++ b/drivers/tty/serial/8250/8250_mtk.c +@@ -32,7 +32,7 @@ + #define MTK_UART_RXTRI_AD 0x14 /* RX Trigger address */ + #define MTK_UART_FRACDIV_L 0x15 /* Fractional divider LSB address */ + #define MTK_UART_FRACDIV_M 0x16 /* Fractional divider MSB address */ +-#define MTK_UART_DEBUG0 0x18 ++#define MTK_UART_DEBUG0 0x18 + #define MTK_UART_IER_XOFFI 0x20 /* Enable XOFF character interrupt */ + #define MTK_UART_IER_RTSI 0x40 /* Enable RTS Modem status interrupt */ + #define MTK_UART_IER_CTSI 0x80 /* Enable CTS Modem status interrupt */ +@@ -418,13 +418,12 @@ static int __maybe_unused mtk8250_runtim + struct mtk8250_data *data = dev_get_drvdata(dev); + struct uart_8250_port *up = serial8250_get_port(data->line); + +- /* wait until UART in idle status */ +- while +- (serial_in(up, MTK_UART_DEBUG0)); +- + if (data->clk_count == 0U) { + dev_dbg(dev, "%s clock count is 0\n", __func__); + } else { ++ /* wait until UART in idle status */ ++ while ++ (serial_in(up, MTK_UART_DEBUG0)); + clk_disable_unprepare(data->bus_clk); + data->clk_count--; + } From 3f6e28e39c0ac205edfb3615b4d571ab74dfc3bf Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 18 Sep 2023 16:40:30 +0100 Subject: [PATCH 0571/1171] arm-trusted-firmware-mediatek: fix copy&paste error in Makefile When adding builds for MT7981 the related Makefile sections for MT7986 have apparently been copied, but in one instance the rename from 7986 to 7981 has been omitted. Fix that now. Fixes: 602cb4f325 ("arm-trusted-firmware-mediatek: add build for MT7981 DDR3") Signed-off-by: Daniel Golle (cherry picked from commit be6e257fe6a248425fd390e9a2037a8432e644ea) --- package/boot/arm-trusted-firmware-mediatek/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 718ebf99e09498..f77f3059112f2e 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -118,7 +118,7 @@ define Trusted-Firmware-A/mt7981-sdmmc-ddr3 DDR_TYPE:=ddr3 endef -define Trusted-Firmware-A/mt7986-snand-ddr3 +define Trusted-Firmware-A/mt7981-snand-ddr3 NAME:=MediaTek MT7981 (SPI-NAND via SNFI, DDR3) BOOT_DEVICE:=snand BUILD_SUBTARGET:=filogic @@ -347,7 +347,7 @@ TFA_TARGETS:= \ mt7981-emmc-ddr3 \ mt7981-nor-ddr3 \ mt7981-sdmmc-ddr3 \ - mt7986-snand-ddr3 \ + mt7981-snand-ddr3 \ mt7981-spim-nand-ddr3 \ mt7986-emmc-ddr3 \ mt7986-nor-ddr3 \ From 25bb84e273f0a759f97a8e4135be855a8485fc07 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 13 Sep 2023 00:57:23 +0100 Subject: [PATCH 0572/1171] uboot-mediatek: add build for mt7981 rfb Improve and package builds for various boot media configurations of the MediaTek MT7981 reference board. Signed-off-by: Daniel Golle (cherry picked from commit 8428bed15d9b5a71a634c7f5639de31a09795bec) --- package/boot/uboot-mediatek/Makefile | 65 +++ .../106-configs-sync-mt7981-rfb-storage.patch | 129 +++++ ...igs-add-useful-options-to-mt7981-rfb.patch | 474 ++++++++++++++++++ ...-arm64-mt7981-rfb-add-mtd-partitions.patch | 140 ++++++ 4 files changed, 808 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/106-configs-sync-mt7981-rfb-storage.patch create mode 100644 package/boot/uboot-mediatek/patches/107-configs-add-useful-options-to-mt7981-rfb.patch create mode 100644 package/boot/uboot-mediatek/patches/108-dts-arm64-mt7981-rfb-add-mtd-partitions.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 66de3921852851..62199871e6b330 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -212,6 +212,66 @@ define U-Boot/mt7981_h3c_magic-nx30-pro DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_rfb-spim-nand + NAME:=MT7981 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7981-rfb + UBOOT_CONFIG:=mt7981_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + +define U-Boot/mt7981_rfb-emmc + NAME:=MT7981 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7981-rfb + UBOOT_CONFIG:=mt7981_emmc_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=emmc + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr3 +endef + +define U-Boot/mt7981_rfb-nor + NAME:=MT7981 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7981-rfb + UBOOT_CONFIG:=mt7981_nor_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr3 +endef + +define U-Boot/mt7981_rfb-sd + NAME:=MT7981 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7981-rfb + UBOOT_CONFIG:=mt7981_sd_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=sdmmc + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-sdmmc-ddr3 +endef + +define U-Boot/mt7981_rfb-snfi + NAME:=MT7981 Reference Board + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mediatek_mt7981-rfb + UBOOT_CONFIG:=mt7981_snfi_nand_rfb + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=snand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-snand-ddr3 +endef + define U-Boot/mt7981_qihoo_360t7 NAME:=Qihoo 360T7 BUILD_SUBTARGET:=filogic @@ -425,6 +485,11 @@ UBOOT_TARGETS := \ ravpower_rp-wd009 \ mt7629_rfb \ mt7981_h3c_magic-nx30-pro \ + mt7981_rfb-spim-nand \ + mt7981_rfb-emmc \ + mt7981_rfb-nor \ + mt7981_rfb-sd \ + mt7981_rfb-snfi \ mt7981_qihoo_360t7 \ mt7981_xiaomi_mi-router-wr30u \ mt7986_bananapi_bpi-r3-emmc \ diff --git a/package/boot/uboot-mediatek/patches/106-configs-sync-mt7981-rfb-storage.patch b/package/boot/uboot-mediatek/patches/106-configs-sync-mt7981-rfb-storage.patch new file mode 100644 index 00000000000000..3a3f8d0e1ede4a --- /dev/null +++ b/package/boot/uboot-mediatek/patches/106-configs-sync-mt7981-rfb-storage.patch @@ -0,0 +1,129 @@ +--- a/configs/mt7981_rfb_defconfig ++++ b/configs/mt7981_rfb_defconfig +@@ -30,6 +30,9 @@ CONFIG_CMD_MTD=y + CONFIG_CMD_SF_TEST=y + CONFIG_CMD_PING=y + CONFIG_CMD_SMC=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_ENV_OVERWRITE=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y + CONFIG_NET_RANDOM_ETHADDR=y + CONFIG_REGMAP=y +--- a/configs/mt7981_snfi_nand_rfb_defconfig ++++ b/configs/mt7981_snfi_nand_rfb_defconfig +@@ -1,11 +1,12 @@ + CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y + CONFIG_POSITION_INDEPENDENT=y + CONFIG_ARCH_MEDIATEK=y + CONFIG_TEXT_BASE=0x41e00000 + CONFIG_SYS_MALLOC_F_LEN=0x4000 + CONFIG_NR_DRAM_BANKS=1 +-CONFIG_ENV_SIZE=0x20000 + CONFIG_DEFAULT_DEVICE_TREE="mt7981-snfi-nand-rfb" ++CONFIG_SYS_PROMPT="MT7981> " + CONFIG_TARGET_MT7981=y + CONFIG_DEBUG_UART_BASE=0x11002000 + CONFIG_DEBUG_UART_CLOCK=40000000 +@@ -15,7 +16,6 @@ CONFIG_DEBUG_UART=y + CONFIG_DEFAULT_FDT_FILE="mt7981-snfi-nand-rfb" + CONFIG_LOGLEVEL=7 + CONFIG_LOG=y +-CONFIG_SYS_PROMPT="MT7981> " + CONFIG_SYS_CBSIZE=512 + CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_NETBSD is not set +@@ -29,8 +29,6 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_MTD=y + CONFIG_CMD_PING=y + CONFIG_CMD_SMC=y +-CONFIG_MTDIDS_DEFAULT="spi-nand0=spi-nand0" +-CONFIG_MTDPARTS_DEFAULT="spi-nand0:1024k(bl2),512k(u-boot-env),2048k(factory),2048k(fip),65536k(ubi)" + CONFIG_CMD_UBI=y + CONFIG_CMD_UBI_RENAME=y + CONFIG_ENV_OVERWRITE=y +@@ -45,7 +43,6 @@ CONFIG_DM_MTD=y + CONFIG_MTK_SPI_NAND=y + CONFIG_MTK_SPI_NAND_MTD=y + CONFIG_PHY_FIXED=y +-CONFIG_DM_ETH=y + CONFIG_MEDIATEK_ETH=y + CONFIG_PINCTRL=y + CONFIG_PINCONF=y +@@ -55,3 +52,4 @@ CONFIG_MTK_POWER_DOMAIN=y + CONFIG_DM_SERIAL=y + CONFIG_MTK_SERIAL=y + CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/configs/mt7981_nor_rfb_defconfig +@@ -0,0 +1,68 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-rfb" ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_TARGET_MT7981=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART=y ++# CONFIG_AUTOBOOT is not set ++CONFIG_DEFAULT_FDT_FILE="mt7981-rfb" ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++# CONFIG_BOOTM_NETBSD is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_CMD_ELF is not set ++# CONFIG_CMD_UNLZ4 is not set ++# CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_SMC=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_SPI_FLASH_SFDP_SUPPORT=y ++CONFIG_SPI_FLASH_EON=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_ISSI=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_SPI_FLASH_STMICRO=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XMC=y ++CONFIG_SPI_FLASH_XTX=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 diff --git a/package/boot/uboot-mediatek/patches/107-configs-add-useful-options-to-mt7981-rfb.patch b/package/boot/uboot-mediatek/patches/107-configs-add-useful-options-to-mt7981-rfb.patch new file mode 100644 index 00000000000000..f5234ea0859d23 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/107-configs-add-useful-options-to-mt7981-rfb.patch @@ -0,0 +1,474 @@ +--- a/configs/mt7981_emmc_rfb_defconfig ++++ b/configs/mt7981_emmc_rfb_defconfig +@@ -14,7 +14,22 @@ CONFIG_DEBUG_UART_BASE=0x11002000 + CONFIG_DEBUG_UART_CLOCK=40000000 + CONFIG_SYS_LOAD_ADDR=0x46000000 + CONFIG_DEBUG_UART=y +-# CONFIG_AUTOBOOT is not set ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_MMC_BOOT=y ++CONFIG_BOOTSTD_DEFAULTS=y ++CONFIG_BOOTSTD_FULL=y + CONFIG_DEFAULT_FDT_FILE="mt7981-emmc-rfb" + CONFIG_LOGLEVEL=7 + CONFIG_LOG=y +@@ -24,9 +39,23 @@ CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_PLAN9 is not set + # CONFIG_BOOTM_RTEMS is not set + # CONFIG_BOOTM_VXWORKS is not set +-# CONFIG_CMD_ELF is not set + # CONFIG_CMD_UNLZ4 is not set + # CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_ELF=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_UUID=y + CONFIG_CMD_GPIO=y + CONFIG_CMD_GPT=y + CONFIG_CMD_GPT_RENAME=y +@@ -36,13 +65,35 @@ CONFIG_CMD_PART=y + CONFIG_CMD_READ=y + CONFIG_CMD_PING=y + CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y + CONFIG_CMD_FAT=y + CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y + CONFIG_PARTITION_TYPE_GUID=y + CONFIG_ENV_OVERWRITE=y + CONFIG_ENV_IS_IN_MMC=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y + CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGEX=y + CONFIG_REGMAP=y + CONFIG_SYSCON=y + CONFIG_CLK=y +--- a/configs/mt7981_rfb_defconfig ++++ b/configs/mt7981_rfb_defconfig +@@ -12,7 +12,23 @@ CONFIG_DEBUG_UART_BASE=0x11002000 + CONFIG_DEBUG_UART_CLOCK=40000000 + CONFIG_SYS_LOAD_ADDR=0x46000000 + CONFIG_DEBUG_UART=y +-# CONFIG_AUTOBOOT is not set ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_SPI_BOOT=y ++CONFIG_NAND_BOOT=y ++CONFIG_BOOTSTD_DEFAULTS=y ++CONFIG_BOOTSTD_FULL=y + CONFIG_DEFAULT_FDT_FILE="mt7981-rfb" + CONFIG_LOGLEVEL=7 + CONFIG_LOG=y +@@ -22,23 +38,74 @@ CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_PLAN9 is not set + # CONFIG_BOOTM_RTEMS is not set + # CONFIG_BOOTM_VXWORKS is not set +-# CONFIG_CMD_ELF is not set + # CONFIG_CMD_UNLZ4 is not set + # CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_ELF=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y + CONFIG_CMD_GPIO=y + CONFIG_CMD_MTD=y +-CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++# CONFIG_MTD_RAW_NAND is not set ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 + CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_SF=y ++CONFIG_CMD_SF_TEST=y + CONFIG_CMD_SMC=y + CONFIG_CMD_UBI=y + CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y + CONFIG_ENV_OVERWRITE=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y + CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGEX=y + CONFIG_REGMAP=y + CONFIG_SYSCON=y + CONFIG_CLK=y + # CONFIG_MMC is not set ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_MTD=y + CONFIG_DM_MTD=y + CONFIG_MTD_SPI_NAND=y +--- a/configs/mt7981_sd_rfb_defconfig ++++ b/configs/mt7981_sd_rfb_defconfig +@@ -14,7 +14,22 @@ CONFIG_DEBUG_UART_BASE=0x11002000 + CONFIG_DEBUG_UART_CLOCK=40000000 + CONFIG_SYS_LOAD_ADDR=0x46000000 + CONFIG_DEBUG_UART=y +-# CONFIG_AUTOBOOT is not set ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_MMC_BOOT=y ++CONFIG_BOOTSTD_DEFAULTS=y ++CONFIG_BOOTSTD_FULL=y + CONFIG_DEFAULT_FDT_FILE="mt7981-sd-rfb" + CONFIG_LOGLEVEL=7 + CONFIG_LOG=y +@@ -24,9 +39,23 @@ CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_PLAN9 is not set + # CONFIG_BOOTM_RTEMS is not set + # CONFIG_BOOTM_VXWORKS is not set +-# CONFIG_CMD_ELF is not set + # CONFIG_CMD_UNLZ4 is not set + # CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_ELF=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_UUID=y + CONFIG_CMD_GPIO=y + CONFIG_CMD_GPT=y + CONFIG_CMD_GPT_RENAME=y +@@ -36,13 +65,35 @@ CONFIG_CMD_PART=y + CONFIG_CMD_READ=y + CONFIG_CMD_PING=y + CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y + CONFIG_CMD_FAT=y + CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y + CONFIG_PARTITION_TYPE_GUID=y + CONFIG_ENV_OVERWRITE=y + CONFIG_ENV_IS_IN_MMC=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y + CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGEX=y + CONFIG_REGMAP=y + CONFIG_SYSCON=y + CONFIG_CLK=y +--- a/configs/mt7981_snfi_nand_rfb_defconfig ++++ b/configs/mt7981_snfi_nand_rfb_defconfig +@@ -12,7 +12,23 @@ CONFIG_DEBUG_UART_BASE=0x11002000 + CONFIG_DEBUG_UART_CLOCK=40000000 + CONFIG_SYS_LOAD_ADDR=0x46000000 + CONFIG_DEBUG_UART=y +-# CONFIG_AUTOBOOT is not set ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_SPI_BOOT=y ++CONFIG_NAND_BOOT=y ++CONFIG_BOOTSTD_DEFAULTS=y ++CONFIG_BOOTSTD_FULL=y + CONFIG_DEFAULT_FDT_FILE="mt7981-snfi-nand-rfb" + CONFIG_LOGLEVEL=7 + CONFIG_LOG=y +@@ -22,22 +38,73 @@ CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_PLAN9 is not set + # CONFIG_BOOTM_RTEMS is not set + # CONFIG_BOOTM_VXWORKS is not set +-# CONFIG_CMD_ELF is not set + # CONFIG_CMD_UNLZ4 is not set + # CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_ELF=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y + CONFIG_CMD_GPIO=y + CONFIG_CMD_MTD=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++# CONFIG_MTD_RAW_NAND is not set ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF=y ++CONFIG_CMD_SF_TEST=y + CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y + CONFIG_CMD_SMC=y + CONFIG_CMD_UBI=y + CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y + CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y + CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGEX=y + CONFIG_REGMAP=y + CONFIG_SYSCON=y + CONFIG_CLK=y + # CONFIG_MMC is not set ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_MTD=y + CONFIG_DM_MTD=y + CONFIG_MTK_SPI_NAND=y +--- a/configs/mt7981_nor_rfb_defconfig ++++ b/configs/mt7981_nor_rfb_defconfig +@@ -12,7 +12,22 @@ CONFIG_DEBUG_UART_BASE=0x11002000 + CONFIG_DEBUG_UART_CLOCK=40000000 + CONFIG_SYS_LOAD_ADDR=0x46000000 + CONFIG_DEBUG_UART=y +-# CONFIG_AUTOBOOT is not set ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_SPI_BOOT=y ++CONFIG_BOOTSTD_DEFAULTS=y ++CONFIG_BOOTSTD_FULL=y + CONFIG_DEFAULT_FDT_FILE="mt7981-rfb" + CONFIG_LOGLEVEL=7 + CONFIG_LOG=y +@@ -22,21 +37,66 @@ CONFIG_SYS_PBSIZE=1049 + # CONFIG_BOOTM_PLAN9 is not set + # CONFIG_BOOTM_RTEMS is not set + # CONFIG_BOOTM_VXWORKS is not set +-# CONFIG_CMD_ELF is not set + # CONFIG_CMD_UNLZ4 is not set + # CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_ELF=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y + CONFIG_CMD_GPIO=y + CONFIG_CMD_MTD=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF=y + CONFIG_CMD_SF_TEST=y + CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y + CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y ++CONFIG_ENV_IS_IN_MTD=y ++CONFIG_ENV_MTD_NAME="u-boot-env" ++CONFIG_ENV_SIZE_REDUND=0x4000 ++CONFIG_ENV_SIZE=0x4000 ++CONFIG_ENV_OFFSET=0x0 + CONFIG_ENV_OVERWRITE=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y + CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGEX=y + CONFIG_REGMAP=y + CONFIG_SYSCON=y + CONFIG_CLK=y + # CONFIG_MMC is not set ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_MTD=y + CONFIG_DM_MTD=y + CONFIG_MTD_SPI_NAND=y diff --git a/package/boot/uboot-mediatek/patches/108-dts-arm64-mt7981-rfb-add-mtd-partitions.patch b/package/boot/uboot-mediatek/patches/108-dts-arm64-mt7981-rfb-add-mtd-partitions.patch new file mode 100644 index 00000000000000..a58c81b6568773 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/108-dts-arm64-mt7981-rfb-add-mtd-partitions.patch @@ -0,0 +1,140 @@ +--- a/arch/arm/dts/mt7981-rfb.dts ++++ b/arch/arm/dts/mt7981-rfb.dts +@@ -143,6 +143,37 @@ + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "BL2"; ++ reg = <0x00000 0x0100000>; ++ }; ++ ++ partition@100000 { ++ label = "u-boot-env"; ++ reg = <0x0100000 0x0080000>; ++ }; ++ ++ factory: partition@180000 { ++ label = "Factory"; ++ reg = <0x180000 0x0200000>; ++ }; ++ ++ partition@380000 { ++ label = "FIP"; ++ reg = <0x380000 0x0200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x4000000>; ++ }; ++ }; + }; + }; + +@@ -164,6 +195,37 @@ + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@00000 { ++ label = "BL2"; ++ reg = <0x00000 0x0040000>; ++ }; ++ ++ partition@40000 { ++ label = "u-boot-env"; ++ reg = <0x40000 0x0010000>; ++ }; ++ ++ partition@50000 { ++ label = "Factory"; ++ reg = <0x50000 0x00B0000>; ++ }; ++ ++ partition@100000 { ++ label = "FIP"; ++ reg = <0x100000 0x0080000>; ++ }; ++ ++ partition@180000 { ++ label = "firmware"; ++ reg = <0x180000 0xE00000>; ++ }; ++ }; + }; + }; + +--- a/arch/arm/dts/mt7981-snfi-nand-rfb.dts ++++ b/arch/arm/dts/mt7981-snfi-nand-rfb.dts +@@ -107,11 +107,11 @@ + }; + + mmc0_pins_default: mmc0default { +- mux { +- function = "flash"; +- groups = "emmc_45"; +- }; +- }; ++ mux { ++ function = "flash"; ++ groups = "emmc_45"; ++ }; ++ }; + }; + + &snand { +@@ -119,6 +119,42 @@ + pinctrl-0 = <&snfi_pins>; + status = "okay"; + quad-spi; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "BL2"; ++ reg = <0x00000 0x0100000>; ++ }; ++ ++ partition@100000 { ++ label = "u-boot-env"; ++ reg = <0x0100000 0x0080000>; ++ }; ++ ++ factory: partition@180000 { ++ label = "Factory"; ++ reg = <0x180000 0x0200000>; ++ }; ++ ++ partition@380000 { ++ label = "FIP"; ++ reg = <0x380000 0x0200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x4000000>; ++ }; ++ }; ++ }; + }; + + &pwm { From 89184b15cfce4aaffac8cda87c2fa74f829ace42 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 13 Sep 2023 00:57:49 +0100 Subject: [PATCH 0573/1171] mediatek: add build for MT7981 RFB Add build for the MTK3943 reference board for MT7981B+MT7976C. **Hardware specification:** - SoC: MediaTek MT7981B 2x A53 - Flash: various options - RAM: 256MB DDR3 - Ethernet: 4 x 10/100/1000 Mbps via MT7531AE switch EITHER 1 x 10/100/1000 Mbps built-in PHY OR 1 x 10/100/1000/2500 Mbps MaxLinear GPY211C - Switch: MediaTek MT7531AE - WiFi: MediaTek MT7976C - Button: RST, WPS **Flash instructions for SPIM-NAND:** - write *mt7981-rfb-spim-nand-preloader.bin to 'BL2' partition - write *mt7981-rfb-spim-nand-bl31-uboot.fip to 'FIP' partition - erase 'ubi' partition - reset board - create ubootenv and ubootenv2 UBI volumes in U-Boot - edit environment and set bootcmd, e.g. setenv bootconf 'config-1#mt7981-rfb-spim-nand#mt7981-rfb-mxl-2p5g-phy-eth1' setenv bootcmd 'ubi read $loadaddr fit; bootm $loadaddr#$bootconf' - load initramfs image via TFTP: setenv serverip 192.168.1.254 setenv ipaddr 192.168.1.1 setenv bootfile openwrt-mediatek-filogic-mediatek_mt7981-rfb-initramfs.itb saveenv ; saveenv tftpboot bootm $loadaddr#$bootconf - Now use sysupgrade to write OpenWrt firmware to flash. SNFI-NAND, SPIM-NOR and eMMC all work very similar, a bootable SD card image is also being generated. However, as the board I've been provided only comes with SPIM-NAND all other boot media are untested. Signed-off-by: Daniel Golle (cherry picked from commit ce7209bd21661e3daa4a7f2f58dafdff990da19f) --- .../mt7981-rfb-mxl-2p5g-phy-eth1.dtso | 32 +++ .../mt7981-rfb-mxl-2p5g-phy-swp5.dtso | 33 +++ .../dts/mediatek/mt7981-rfb-spim-nand.dtso | 66 ++++++ .../arm64/boot/dts/mediatek/mt7981-rfb.dts | 188 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 55 +++++ 7 files changed, 377 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-eth1.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-swp5.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-spim-nand.dtso create mode 100644 target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb.dts diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-eth1.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-eth1.dtso new file mode 100644 index 00000000000000..4d0e5c04067b39 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-eth1.dtso @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7981-rfb", "mediatek,mt7981"; + + fragment@0 { + target = <&gmac1>; + __overlay__ { + phy-mode = "2500base-x"; + phy-handle = <&phy5>; + }; + }; + + fragment@1 { + target = <&mdio_bus>; + __overlay__ { + reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>; + reset-delay-us = <600>; + reset-post-delay-us = <20000>; + + phy5: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + }; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-swp5.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-swp5.dtso new file mode 100644 index 00000000000000..710e6c0bcfbee2 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-mxl-2p5g-phy-swp5.dtso @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "mediatek,mt7981-rfb", "mediatek,mt7981"; + + fragment@0 { + target = <&sw_p5>; + __overlay__ { + phy-mode = "2500base-x"; + phy-handle = <&phy5>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&mdio_bus>; + __overlay__ { + reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>; + reset-delay-us = <600>; + reset-post-delay-us = <20000>; + + phy5: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + }; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-spim-nand.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-spim-nand.dtso new file mode 100644 index 00000000000000..5b51dfd671c228 --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb-spim-nand.dtso @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/dts-v1/; +/plugin/; + +/ { + compatible = "mediatek,mt7981-rfb", "mediatek,mt7981"; + + fragment@0 { + target = <&spi0>; + __overlay__ { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + spi_nand: spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <10000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x0200000>; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; + }; + }; + }; + }; + }; + + fragment@1 { + target = <&wifi>; + __overlay__ { + mediatek,mtd-eeprom = <&factory 0x0>; + status = "okay"; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb.dts new file mode 100644 index 00000000000000..b2bb6929562ebd --- /dev/null +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981-rfb.dts @@ -0,0 +1,188 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +#include "mt7981.dtsi" + +/ { + model = "MediaTek MT7981 RFB"; + compatible = "mediatek,mt7981-rfb", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + gpio-keys { + compatible = "gpio-keys"; + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + }; +}; + +&crypto { + status = "okay"; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; + +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + cs-gpios = <0>, <0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + sw_p5: port@5 { + reg = <5>; + label = "lan5"; + status = "disabled"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&xhci { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index e5872e7fe4db8e..60c0bbc7e9a1b0 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -11,7 +11,8 @@ mediatek_setup_interfaces() acer,predator-w6) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; - asus,tuf-ax4200) + asus,tuf-ax4200|\ + mediatek,mt7981-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; netgear,wax220|\ diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index b0585284cab239..c492f834bfdda0 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -89,6 +89,7 @@ platform_do_upgrade() { nand_do_upgrade "$1" ;; h3c,magic-nx30-pro|\ + mediatek,mt7981-rfb|\ qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 846fbcbf2cccac..46f8789b1750a5 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -250,6 +250,61 @@ define Device/netgear_wax220 endef TARGET_DEVICES += netgear_wax220 +define Device/mediatek_mt7981-rfb + DEVICE_VENDOR := MediaTek + DEVICE_MODEL := MT7981 rfb + DEVICE_DTS := mt7981-rfb + DEVICE_DTS_OVERLAY:= \ + mt7981-rfb-spim-nand \ + mt7981-rfb-mxl-2p5g-phy-eth1 \ + mt7981-rfb-mxl-2p5g-phy-swp5 + DEVICE_DTS_DIR := $(DTS_DIR)/ + DEVICE_DTC_FLAGS := --pad 4096 + DEVICE_DTS_LOADADDR := 0x43f00000 + DEVICE_PACKAGES := kmod-mt7981-firmware kmod-usb3 e2fsprogs f2fsck mkf2fs mt7981-wo-firmware + KERNEL_LOADADDR := 0x44000000 + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + KERNEL_INITRAMFS_SUFFIX := .itb + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m + IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata + ARTIFACTS := \ + emmc-preloader.bin emmc-bl31-uboot.fip \ + nor-preloader.bin nor-bl31-uboot.fip \ + sdcard.img.gz \ + snfi-nand-preloader.bin snfi-nand-bl31-uboot.fip \ + spim-nand-preloader.bin spim-nand-bl31-uboot.fip + ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr3 + ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot rfb-emmc + ARTIFACT/nor-preloader.bin := mt7981-bl2 nor-ddr3 + ARTIFACT/nor-bl31-uboot.fip := mt7981-bl31-uboot rfb-emmc + ARTIFACT/snfi-nand-preloader.bin := mt7981-bl2 snand-ddr3 + ARTIFACT/snfi-nand-bl31-uboot.fip := mt7981-bl31-uboot rfb-snfi + ARTIFACT/spim-nand-preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/spim-nand-bl31-uboot.fip := mt7981-bl31-uboot rfb-spim-nand + ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\ + pad-to 17k | mt7981-bl2 sdmmc-ddr3 |\ + pad-to 6656k | mt7981-bl31-uboot rfb-sd |\ + $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ + pad-to 12M | append-image-stage initramfs.itb | check-size 44m |\ + ) \ + pad-to 44M | mt7981-bl2 spim-nand-ddr3 |\ + pad-to 45M | mt7981-bl31-uboot rfb-spim-nand |\ + pad-to 49M | mt7981-bl2 nor-ddr3 |\ + pad-to 50M | mt7981-bl31-uboot rfb-nor |\ + pad-to 51M | mt7981-bl2 snand-ddr3 |\ + pad-to 53M | mt7981-bl31-uboot rfb-snfi |\ + $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ + pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ + ) \ + gzip +endef +TARGET_DEVICES += mediatek_mt7981-rfb + define Device/mediatek_mt7986a-rfb-nand DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7986 rfba AP (NAND) From 1157b8c1f1a37fe81fc652e4f7037ef5990fda4f Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Fri, 20 Oct 2023 11:59:34 +0800 Subject: [PATCH 0574/1171] uboot-mediatek: fix determine the size of an uImage.FIT using 'imsz' or 'imszb'. It must read the entire image for previous code of 'imsz' or 'imszb'. Signed-off-by: Jianhui Zhao Suggested-by: Chuanhong Guo (cherry picked from commit 3bbc1d5fba1d700917138334a48c16bafdf48de9) --- .../patches/200-cmd-add-imsz-and-imszb.patch | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch index 574259fb395764..ae7623086e4475 100644 --- a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch +++ b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch @@ -70,7 +70,7 @@ { --- a/boot/image-fit.c +++ b/boot/image-fit.c -@@ -2051,6 +2051,49 @@ static const char *fit_get_image_type_pr +@@ -2051,6 +2051,47 @@ static const char *fit_get_image_type_pr return "unknown"; } @@ -93,11 +93,8 @@ + max_size = hdrsize; + + images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); -+ if (images_noffset < 0) { -+ printf("Can't find images parent node '%s' (%s)\n", -+ FIT_IMAGES_PATH, fdt_strerror(images_noffset)); -+ return 0; -+ } ++ if (images_noffset < 0) ++ goto out; + + for (ndepth = 0, + noffset = fdt_next_node(fit, images_noffset, &ndepth); @@ -106,7 +103,7 @@ + if (ndepth == 1) { + ret = fit_image_get_data_and_size(fit, noffset, &data, &data_size); + if (ret) -+ return 0; ++ goto out; + + img_total = data_size + (data - fit); + @@ -114,6 +111,7 @@ + } + } + ++out: + return max_size; +} + From e46559215573c58fb35ccaceee5fcc961c0813b2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 1 Nov 2023 22:10:46 +0100 Subject: [PATCH 0575/1171] urngd: update to version 2023-11-01 Fix compilation with glibc 44365eb Deactivate _FORTIFY_SOURCE in jitterentropy-base.c Signed-off-by: Hauke Mehrtens (cherry picked from commit d62726b1e44f785d543e4625b19ca1f628adda6c) --- package/system/urngd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/urngd/Makefile b/package/system/urngd/Makefile index 818f06b210db1f..477c5f24059dac 100644 --- a/package/system/urngd/Makefile +++ b/package/system/urngd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/urngd.git -PKG_SOURCE_DATE:=2023-07-25 -PKG_SOURCE_VERSION:=7aefb47be57df0467d97d539f7fe9e23e607a3b4 -PKG_MIRROR_HASH:=427d4228fd65cf4320b8c212e710b86bcbfcdd4239f4e67132b3b471f7437202 +PKG_SOURCE_DATE:=2023-11-01 +PKG_SOURCE_VERSION:=44365eb1e1165f2a44cb31f404b04cf85031718e +PKG_MIRROR_HASH:=743bdfacf1f1e779047a55fe8f388aaf31f6e55e8a4d0a00fcabffb68af2202e PKG_LICENSE:=GPL-2.0 BSD-3-Clause PKG_LICENSE_FILES:= From b649b0bf7100bdc6adb7e857c74738cab7c47b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 13 Jul 2023 19:39:42 +0200 Subject: [PATCH 0576/1171] kernel: nvmem: fix "fixed-layout" & support "mac-base" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DT binding for MAC cells in fixed layout was upstream approved and accepted. Add support for it. This can replace quite some of our downstream hacks. Signed-off-by: Rafał Miłecki (cherry picked from commit 61f674df4f0ce2b1c53b0b7f6b0c1d03d99838c0) --- ...support-for-fixed-cells-NVMEM-layout.patch | 40 ++++++++ ...-support-mac-base-fixed-layout-cells.patch | 93 +++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch create mode 100644 target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch diff --git a/target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch b/target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch new file mode 100644 index 00000000000000..f77756b9cff03b --- /dev/null +++ b/target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch @@ -0,0 +1,40 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 13 Jul 2023 17:30:59 +0200 +Subject: [PATCH] nvmem: core: fix support for fixed cells NVMEM layout +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Returning -EPROBE_DEFER for "fixed-layout" makes nvmem_register() always +fail (that layout is supported internally with no external module). That +makes callers (e.g. mtd_nvmem_add()) fail as well and prevents booting +on devices with "fixed-layout" in DT. + +Add a quick workaround for it. + +Fixes: 6468a6f45148 ("nvmem: core: handle the absence of expected layouts") +Signed-off-by: Rafał Miłecki +--- + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -794,6 +794,19 @@ static struct nvmem_layout *nvmem_layout + return NULL; + + /* ++ * We should return -EPROBE_DEFER only when layout driver is expected to ++ * become available later. Otherwise NVMEM will never probe successfully ++ * for unsupported layouts. There is no known solution for that right ++ * now. ++ * ++ * This problem also affects "fixed-layout". It's supported in NVMEM ++ * core code so there never will be layout for it. We shouldn't return ++ * -EPROBE_DEFER in such case. Add a quick workaround for that. ++ */ ++ if (of_device_is_compatible(layout_np, "fixed-layout")) ++ return NULL; ++ ++ /* + * In case the nvmem device was built-in while the layout was built as a + * module, we shall manually request the layout driver loading otherwise + * we'll never have any match. diff --git a/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch b/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch new file mode 100644 index 00000000000000..6791b63ac09d90 --- /dev/null +++ b/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch @@ -0,0 +1,93 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 13 Jul 2023 18:29:19 +0200 +Subject: [PATCH] nvmem: core: support "mac-base" fixed layout cells + +Fixed layout binding allows specifying "mac-base" NVMEM cells. It's used +for base MAC address (that can be used for calculating relative +addresses). It can be stored in a raw binary format or as an ASCII +string. +--- + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + menuconfig NVMEM + bool "NVMEM Support" ++ select GENERIC_NET_UTILS + help + Support for NVMEM(Non Volatile Memory) devices like EEPROM, EFUSES... + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -7,9 +7,11 @@ + */ + + #include ++#include + #include + #include + #include ++#include + #include + #include + #include +@@ -696,6 +698,37 @@ static int nvmem_validate_keepouts(struc + return 0; + } + ++static int nvmem_mac_base_raw_read(void *context, const char *id, int index, unsigned int offset, ++ void *buf, size_t bytes) ++{ ++ if (WARN_ON(bytes != ETH_ALEN)) ++ return -EINVAL; ++ ++ if (index) ++ eth_addr_add(buf, index); ++ ++ return 0; ++} ++ ++static int nvmem_mac_base_ascii_read(void *context, const char *id, int index, unsigned int offset, ++ void *buf, size_t bytes) ++{ ++ u8 mac[ETH_ALEN]; ++ ++ if (WARN_ON(bytes != 3 * ETH_ALEN - 1)) ++ return -EINVAL; ++ ++ if (!mac_pton(buf, mac)) ++ return -EINVAL; ++ ++ if (index) ++ eth_addr_add(mac, index); ++ ++ ether_addr_copy(buf, mac); ++ ++ return 0; ++} ++ + static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) + { + struct nvmem_layout *layout = nvmem->layout; +@@ -731,6 +764,20 @@ static int nvmem_add_cells_from_dt(struc + if (layout && layout->fixup_cell_info) + layout->fixup_cell_info(nvmem, layout, &info); + ++ if (of_device_is_compatible(np, "fixed-layout")) { ++ if (of_device_is_compatible(child, "mac-base")) { ++ if (info.bytes == 6) { ++ info.raw_len = info.bytes; ++ info.bytes = ETH_ALEN; ++ info.read_post_process = nvmem_mac_base_raw_read; ++ } else if (info.bytes == 3 * ETH_ALEN - 1) { ++ info.raw_len = info.bytes; ++ info.bytes = ETH_ALEN; ++ info.read_post_process = nvmem_mac_base_ascii_read; ++ } ++ } ++ } ++ + ret = nvmem_add_one_cell(nvmem, &info); + kfree(info.name); + if (ret) { From 066971615ff66512bc542b09a90be34c2afe98bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 31 Aug 2023 00:28:58 +0200 Subject: [PATCH 0577/1171] kernel: backport v6.6 nvmem changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 52c365f055f62eb820cc42b0a1cfd037c68b01d0) --- ...Convert-to-devm_platform_ioremap_res.patch | 36 +++++ ...-Use-devm_platform_get_and_ioremap_r.patch | 30 ++++ ...p-Convert-to-devm_platform_ioremap_r.patch | 34 ++++ ...fuse-Convert-to-devm_platform_iorema.patch | 36 +++++ ...fuse-Use-devm_platform_get_and_iorem.patch | 31 ++++ ...m-Use-devm_platform_get_and_ioremap_.patch | 30 ++++ ....6-0007-nvmem-qfprom-do-some-cleanup.patch | 59 +++++++ ...se-devm_platform_get_and_ioremap_res.patch | 29 ++++ ...nvmem-add-new-NXP-QorIQ-eFuse-driver.patch | 133 +++++++++++++++ ...-nvmem-Kconfig-Fix-typo-drive-driver.patch | 37 +++++ ...m-Add-Qualcomm-secure-QFPROM-support.patch | 152 ++++++++++++++++++ ...-Replace-zero-length-array-with-DECL.patch | 30 ++++ ...e-all-cells-before-adding-the-nvmem-.patch | 40 +++++ ...n-NULL-when-no-nvmem-layout-is-found.patch | 35 ++++ ...-Do-not-open-code-existing-functions.patch | 29 ++++ ...tify-when-a-new-layout-is-registered.patch | 44 +++++ ...support-for-fixed-cells-NVMEM-layout.patch | 2 +- target/linux/ipq40xx/config-5.15 | 1 + target/linux/ipq806x/config-5.15 | 1 + target/linux/ipq807x/config-5.15 | 1 + target/linux/mpc85xx/config-5.15 | 1 + 21 files changed, 790 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0001-nvmem-sunxi_sid-Convert-to-devm_platform_ioremap_res.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0002-nvmem-brcm_nvram-Use-devm_platform_get_and_ioremap_r.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0003-nvmem-lpc18xx_otp-Convert-to-devm_platform_ioremap_r.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0004-nvmem-meson-mx-efuse-Convert-to-devm_platform_iorema.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0005-nvmem-rockchip-efuse-Use-devm_platform_get_and_iorem.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0006-nvmem-stm32-romem-Use-devm_platform_get_and_ioremap_.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0007-nvmem-qfprom-do-some-cleanup.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0008-nvmem-uniphier-Use-devm_platform_get_and_ioremap_res.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0009-nvmem-add-new-NXP-QorIQ-eFuse-driver.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0011-nvmem-Kconfig-Fix-typo-drive-driver.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0012-nvmem-sec-qfprom-Add-Qualcomm-secure-QFPROM-support.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0013-nvmem-u-boot-env-Replace-zero-length-array-with-DECL.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0014-nvmem-core-Create-all-cells-before-adding-the-nvmem-.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0015-nvmem-core-Return-NULL-when-no-nvmem-layout-is-found.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0016-nvmem-core-Do-not-open-code-existing-functions.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0017-nvmem-core-Notify-when-a-new-layout-is-registered.patch diff --git a/target/linux/generic/backport-5.15/819-v6.6-0001-nvmem-sunxi_sid-Convert-to-devm_platform_ioremap_res.patch b/target/linux/generic/backport-5.15/819-v6.6-0001-nvmem-sunxi_sid-Convert-to-devm_platform_ioremap_res.patch new file mode 100644 index 00000000000000..bf7a816bb225cc --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0001-nvmem-sunxi_sid-Convert-to-devm_platform_ioremap_res.patch @@ -0,0 +1,36 @@ +From 9ccfcbeb8f32ff89e99b36cb9cdebaa0d1b44ed1 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:24 +0100 +Subject: [PATCH] nvmem: sunxi_sid: Convert to devm_platform_ioremap_resource() + +Use devm_platform_ioremap_resource() to simplify code. + +Signed-off-by: Yangtao Li +Acked-by: Jernej Skrabec +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunxi_sid.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -125,7 +125,6 @@ static int sun8i_sid_read_by_reg(void *c + static int sunxi_sid_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +- struct resource *res; + struct nvmem_config *nvmem_cfg; + struct nvmem_device *nvmem; + struct sunxi_sid *sid; +@@ -142,8 +141,7 @@ static int sunxi_sid_probe(struct platfo + return -EINVAL; + sid->value_offset = cfg->value_offset; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- sid->base = devm_ioremap_resource(dev, res); ++ sid->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(sid->base)) + return PTR_ERR(sid->base); + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0002-nvmem-brcm_nvram-Use-devm_platform_get_and_ioremap_r.patch b/target/linux/generic/backport-5.15/819-v6.6-0002-nvmem-brcm_nvram-Use-devm_platform_get_and_ioremap_r.patch new file mode 100644 index 00000000000000..f142d735de38c0 --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0002-nvmem-brcm_nvram-Use-devm_platform_get_and_ioremap_r.patch @@ -0,0 +1,30 @@ +From cfadd0e7d9225566f320bc4dc716682be910be6c Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:25 +0100 +Subject: [PATCH] nvmem: brcm_nvram: Use + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +Signed-off-by: Yangtao Li +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/brcm_nvram.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/brcm_nvram.c ++++ b/drivers/nvmem/brcm_nvram.c +@@ -159,8 +159,7 @@ static int brcm_nvram_probe(struct platf + return -ENOMEM; + priv->dev = dev; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->base = devm_ioremap_resource(dev, res); ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0003-nvmem-lpc18xx_otp-Convert-to-devm_platform_ioremap_r.patch b/target/linux/generic/backport-5.15/819-v6.6-0003-nvmem-lpc18xx_otp-Convert-to-devm_platform_ioremap_r.patch new file mode 100644 index 00000000000000..0395bbf8bcef3e --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0003-nvmem-lpc18xx_otp-Convert-to-devm_platform_ioremap_r.patch @@ -0,0 +1,34 @@ +From 0b49178e2b6b4aac3c7fa3ce8d8c02208a13b988 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:26 +0100 +Subject: [PATCH] nvmem: lpc18xx_otp: Convert to + devm_platform_ioremap_resource() + +Use devm_platform_ioremap_resource() to simplify code. + +Signed-off-by: Yangtao Li +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lpc18xx_otp.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/nvmem/lpc18xx_otp.c ++++ b/drivers/nvmem/lpc18xx_otp.c +@@ -68,14 +68,12 @@ static int lpc18xx_otp_probe(struct plat + { + struct nvmem_device *nvmem; + struct lpc18xx_otp *otp; +- struct resource *res; + + otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); + if (!otp) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- otp->base = devm_ioremap_resource(&pdev->dev, res); ++ otp->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(otp->base)) + return PTR_ERR(otp->base); + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0004-nvmem-meson-mx-efuse-Convert-to-devm_platform_iorema.patch b/target/linux/generic/backport-5.15/819-v6.6-0004-nvmem-meson-mx-efuse-Convert-to-devm_platform_iorema.patch new file mode 100644 index 00000000000000..da077eb4b745f6 --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0004-nvmem-meson-mx-efuse-Convert-to-devm_platform_iorema.patch @@ -0,0 +1,36 @@ +From 0a223a097709b99a0ba738d6be5b4f52c04ffb64 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:27 +0100 +Subject: [PATCH] nvmem: meson-mx-efuse: Convert to + devm_platform_ioremap_resource() + +Use devm_platform_ioremap_resource() to simplify code. + +Signed-off-by: Yangtao Li +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/meson-mx-efuse.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/nvmem/meson-mx-efuse.c ++++ b/drivers/nvmem/meson-mx-efuse.c +@@ -194,7 +194,6 @@ static int meson_mx_efuse_probe(struct p + { + const struct meson_mx_efuse_platform_data *drvdata; + struct meson_mx_efuse *efuse; +- struct resource *res; + + drvdata = of_device_get_match_data(&pdev->dev); + if (!drvdata) +@@ -204,8 +203,7 @@ static int meson_mx_efuse_probe(struct p + if (!efuse) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- efuse->base = devm_ioremap_resource(&pdev->dev, res); ++ efuse->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(efuse->base)) + return PTR_ERR(efuse->base); + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0005-nvmem-rockchip-efuse-Use-devm_platform_get_and_iorem.patch b/target/linux/generic/backport-5.15/819-v6.6-0005-nvmem-rockchip-efuse-Use-devm_platform_get_and_iorem.patch new file mode 100644 index 00000000000000..dc144ddfbdfa86 --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0005-nvmem-rockchip-efuse-Use-devm_platform_get_and_iorem.patch @@ -0,0 +1,31 @@ +From 94904db28db49ac8fbb2a273d25156db26a3a985 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:28 +0100 +Subject: [PATCH] nvmem: rockchip-efuse: Use + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +Signed-off-by: Yangtao Li +Reviewed-by: Heiko Stuebner +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rockchip-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/rockchip-efuse.c ++++ b/drivers/nvmem/rockchip-efuse.c +@@ -267,8 +267,7 @@ static int rockchip_efuse_probe(struct p + if (!efuse) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- efuse->base = devm_ioremap_resource(dev, res); ++ efuse->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(efuse->base)) + return PTR_ERR(efuse->base); + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0006-nvmem-stm32-romem-Use-devm_platform_get_and_ioremap_.patch b/target/linux/generic/backport-5.15/819-v6.6-0006-nvmem-stm32-romem-Use-devm_platform_get_and_ioremap_.patch new file mode 100644 index 00000000000000..99e20939ccf09f --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0006-nvmem-stm32-romem-Use-devm_platform_get_and_ioremap_.patch @@ -0,0 +1,30 @@ +From 0a4a8c0d238fec1fa4b85591524ef42ad261cb97 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:29 +0100 +Subject: [PATCH] nvmem: stm32-romem: Use + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +Signed-off-by: Yangtao Li +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -196,8 +196,7 @@ static int stm32_romem_probe(struct plat + if (!priv) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->base = devm_ioremap_resource(dev, res); ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0007-nvmem-qfprom-do-some-cleanup.patch b/target/linux/generic/backport-5.15/819-v6.6-0007-nvmem-qfprom-do-some-cleanup.patch new file mode 100644 index 00000000000000..6d93752e27177f --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0007-nvmem-qfprom-do-some-cleanup.patch @@ -0,0 +1,59 @@ +From 0bc0d6dc2a9a05ae6729b4622f09782d9f230815 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:30 +0100 +Subject: [PATCH] nvmem: qfprom: do some cleanup + +Use devm_platform_ioremap_resource() and +devm_platform_get_and_ioremap_resource() to simplify code. +BTW convert to use dev_err_probe() instead of open it. + +Signed-off-by: Yangtao Li +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 17 +++++------------ + 1 file changed, 5 insertions(+), 12 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -374,8 +374,7 @@ static int qfprom_probe(struct platform_ + return -ENOMEM; + + /* The corrected section is always provided */ +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->qfpcorrected = devm_ioremap_resource(dev, res); ++ priv->qfpcorrected = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->qfpcorrected)) + return PTR_ERR(priv->qfpcorrected); + +@@ -402,12 +401,10 @@ static int qfprom_probe(struct platform_ + priv->qfpraw = devm_ioremap_resource(dev, res); + if (IS_ERR(priv->qfpraw)) + return PTR_ERR(priv->qfpraw); +- res = platform_get_resource(pdev, IORESOURCE_MEM, 2); +- priv->qfpconf = devm_ioremap_resource(dev, res); ++ priv->qfpconf = devm_platform_ioremap_resource(pdev, 2); + if (IS_ERR(priv->qfpconf)) + return PTR_ERR(priv->qfpconf); +- res = platform_get_resource(pdev, IORESOURCE_MEM, 3); +- priv->qfpsecurity = devm_ioremap_resource(dev, res); ++ priv->qfpsecurity = devm_platform_ioremap_resource(pdev, 3); + if (IS_ERR(priv->qfpsecurity)) + return PTR_ERR(priv->qfpsecurity); + +@@ -427,12 +424,8 @@ static int qfprom_probe(struct platform_ + return PTR_ERR(priv->vcc); + + priv->secclk = devm_clk_get(dev, "core"); +- if (IS_ERR(priv->secclk)) { +- ret = PTR_ERR(priv->secclk); +- if (ret != -EPROBE_DEFER) +- dev_err(dev, "Error getting clock: %d\n", ret); +- return ret; +- } ++ if (IS_ERR(priv->secclk)) ++ return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n"); + + /* Only enable writing if we have SoC data. */ + if (priv->soc_data) diff --git a/target/linux/generic/backport-5.15/819-v6.6-0008-nvmem-uniphier-Use-devm_platform_get_and_ioremap_res.patch b/target/linux/generic/backport-5.15/819-v6.6-0008-nvmem-uniphier-Use-devm_platform_get_and_ioremap_res.patch new file mode 100644 index 00000000000000..3e328a4c99914b --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0008-nvmem-uniphier-Use-devm_platform_get_and_ioremap_res.patch @@ -0,0 +1,29 @@ +From 6ac41c556e22a0d7d267c9b9d48681d73af4b368 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Wed, 23 Aug 2023 14:27:31 +0100 +Subject: [PATCH] nvmem: uniphier: Use devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +Signed-off-by: Yangtao Li +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230823132744.350618-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/uniphier-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/uniphier-efuse.c ++++ b/drivers/nvmem/uniphier-efuse.c +@@ -41,8 +41,7 @@ static int uniphier_efuse_probe(struct p + if (!priv) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->base = devm_ioremap_resource(dev, res); ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0009-nvmem-add-new-NXP-QorIQ-eFuse-driver.patch b/target/linux/generic/backport-5.15/819-v6.6-0009-nvmem-add-new-NXP-QorIQ-eFuse-driver.patch new file mode 100644 index 00000000000000..acbe18e270001f --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0009-nvmem-add-new-NXP-QorIQ-eFuse-driver.patch @@ -0,0 +1,133 @@ +From c8efcf7a86ebf2ff48584d270b3070a7075bc345 Mon Sep 17 00:00:00 2001 +From: Richard Alpe +Date: Mon, 10 Apr 2023 10:20:51 +0200 +Subject: [PATCH] nvmem: add new NXP QorIQ eFuse driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add SFP (Security Fuse Processor) read support for NXP (Freescale) +QorIQ series SOC's. + +This patch adds support for the T1023 SOC using the SFP offset from +the existing T1023 device tree. In theory this should also work for +T1024, T1014 and T1013 which uses the same SFP base offset. + +Signed-off-by: Richard Alpe +Reviewed-by: Niklas Söderlund +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/Kconfig | 12 ++++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/qoriq-efuse.c | 78 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 92 insertions(+) + create mode 100644 drivers/nvmem/qoriq-efuse.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -392,4 +392,16 @@ config NVMEM_ZYNQMP + + If sure, say yes. If unsure, say no. + ++config NVMEM_QORIQ_EFUSE ++ tristate "NXP QorIQ eFuse support" ++ depends on PPC_85xx || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides read support for the eFuses (SFP) on NXP QorIQ ++ series SoC's. This includes secure boot settings, the globally unique ++ NXP ID 'FUIDR' and the OEM unique ID 'OUIDR'. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_qoriq_efuse. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -77,3 +77,5 @@ obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvme + nvmem-vf610-ocotp-y := vf610-ocotp.o + obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o ++obj-$(CONFIG_NVMEM_QORIQ_EFUSE) += nvmem-qoriq-efuse.o ++nvmem-qoriq-efuse-y := qoriq-efuse.o +--- /dev/null ++++ b/drivers/nvmem/qoriq-efuse.c +@@ -0,0 +1,78 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2023 Westermo Network Technologies AB ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct qoriq_efuse_priv { ++ void __iomem *base; ++}; ++ ++static int qoriq_efuse_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct qoriq_efuse_priv *priv = context; ++ ++ /* .stride = 4 so offset is guaranteed to be aligned */ ++ __ioread32_copy(val, priv->base + offset, bytes / 4); ++ ++ /* Ignore trailing bytes (there shouldn't be any) */ ++ ++ return 0; ++} ++ ++static int qoriq_efuse_probe(struct platform_device *pdev) ++{ ++ struct nvmem_config config = { ++ .dev = &pdev->dev, ++ .read_only = true, ++ .reg_read = qoriq_efuse_read, ++ .stride = sizeof(u32), ++ .word_size = sizeof(u32), ++ .name = "qoriq_efuse_read", ++ .id = NVMEM_DEVID_AUTO, ++ .root_only = true, ++ }; ++ struct qoriq_efuse_priv *priv; ++ struct nvmem_device *nvmem; ++ struct resource *res; ++ ++ priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); ++ if (IS_ERR(priv->base)) ++ return PTR_ERR(priv->base); ++ ++ config.size = resource_size(res); ++ config.priv = priv; ++ nvmem = devm_nvmem_register(config.dev, &config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id qoriq_efuse_of_match[] = { ++ { .compatible = "fsl,t1023-sfp", }, ++ {/* sentinel */}, ++}; ++MODULE_DEVICE_TABLE(of, qoriq_efuse_of_match); ++ ++static struct platform_driver qoriq_efuse_driver = { ++ .probe = qoriq_efuse_probe, ++ .driver = { ++ .name = "qoriq-efuse", ++ .of_match_table = qoriq_efuse_of_match, ++ }, ++}; ++module_platform_driver(qoriq_efuse_driver); ++ ++MODULE_AUTHOR("Richard Alpe "); ++MODULE_DESCRIPTION("NXP QorIQ Security Fuse Processor (SFP) Reader"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/819-v6.6-0011-nvmem-Kconfig-Fix-typo-drive-driver.patch b/target/linux/generic/backport-5.15/819-v6.6-0011-nvmem-Kconfig-Fix-typo-drive-driver.patch new file mode 100644 index 00000000000000..67f30e34a2346f --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0011-nvmem-Kconfig-Fix-typo-drive-driver.patch @@ -0,0 +1,37 @@ +From 9d53d595f688c9837e88a919229cc61a165c7b9e Mon Sep 17 00:00:00 2001 +From: Diederik de Haas +Date: Mon, 24 Jul 2023 13:36:22 +0200 +Subject: [PATCH] nvmem: Kconfig: Fix typo "drive" -> "driver" + +Fix typo where "driver" was meant instead of "drive". +While at it, also capitalize "OTP". + +Signed-off-by: Diederik de Haas +Reviewed-by: Heiko Stuebner +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/Kconfig | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -247,7 +247,7 @@ config NVMEM_ROCKCHIP_EFUSE + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM + help +- This is a simple drive to dump specified values of Rockchip SoC ++ This is a simple driver to dump specified values of Rockchip SoC + from eFuse, such as cpu-leakage. + + This driver can also be built as a module. If so, the module +@@ -258,8 +258,8 @@ config NVMEM_ROCKCHIP_OTP + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM + help +- This is a simple drive to dump specified values of Rockchip SoC +- from otp, such as cpu-leakage. ++ This is a simple driver to dump specified values of Rockchip SoC ++ from OTP, such as cpu-leakage. + + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_otp. diff --git a/target/linux/generic/backport-5.15/819-v6.6-0012-nvmem-sec-qfprom-Add-Qualcomm-secure-QFPROM-support.patch b/target/linux/generic/backport-5.15/819-v6.6-0012-nvmem-sec-qfprom-Add-Qualcomm-secure-QFPROM-support.patch new file mode 100644 index 00000000000000..d24a624ddfa75a --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0012-nvmem-sec-qfprom-Add-Qualcomm-secure-QFPROM-support.patch @@ -0,0 +1,152 @@ +From 0a9ec38c47c1ca4528aa058e2b9ea61901a7e632 Mon Sep 17 00:00:00 2001 +From: Komal Bajaj +Date: Tue, 1 Aug 2023 12:10:25 +0530 +Subject: [PATCH] nvmem: sec-qfprom: Add Qualcomm secure QFPROM support + +For some of the Qualcomm SoC's, it is possible that +some of the fuse regions or entire qfprom region is +protected from non-secure access. In such situations, +the OS will have to use secure calls to read the region. +With that motivation, add secure qfprom driver. + +Signed-off-by: Komal Bajaj +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/Kconfig | 13 ++++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/sec-qfprom.c | 96 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 111 insertions(+) + create mode 100644 drivers/nvmem/sec-qfprom.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -226,6 +226,19 @@ config NVMEM_QCOM_QFPROM + This driver can also be built as a module. If so, the module + will be called nvmem_qfprom. + ++config NVMEM_QCOM_SEC_QFPROM ++ tristate "QCOM SECURE QFPROM Support" ++ depends on ARCH_QCOM || COMPILE_TEST ++ depends on HAS_IOMEM ++ depends on OF ++ select QCOM_SCM ++ help ++ Say y here to enable secure QFPROM support. The secure QFPROM provides access ++ functions for QFPROM data to rest of the drivers via nvmem interface. ++ ++ This driver can also be built as a module. If so, the module will be called ++ nvmem_sec_qfprom. ++ + config NVMEM_RAVE_SP_EEPROM + tristate "Rave SP EEPROM Support" + depends on RAVE_SP_CORE +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -46,6 +46,8 @@ obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvme + nvmem-nintendo-otp-y := nintendo-otp.o + obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o + nvmem_qfprom-y := qfprom.o ++obj-$(CONFIG_NVMEM_QCOM_SEC_QFPROM) += nvmem_sec_qfprom.o ++nvmem_sec_qfprom-y := sec-qfprom.o + obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o + nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o + obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o +--- /dev/null ++++ b/drivers/nvmem/sec-qfprom.c +@@ -0,0 +1,96 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++/** ++ * struct sec_qfprom - structure holding secure qfprom attributes ++ * ++ * @base: starting physical address for secure qfprom corrected address space. ++ * @dev: qfprom device structure. ++ */ ++struct sec_qfprom { ++ phys_addr_t base; ++ struct device *dev; ++}; ++ ++static int sec_qfprom_reg_read(void *context, unsigned int reg, void *_val, size_t bytes) ++{ ++ struct sec_qfprom *priv = context; ++ unsigned int i; ++ u8 *val = _val; ++ u32 read_val; ++ u8 *tmp; ++ ++ for (i = 0; i < bytes; i++, reg++) { ++ if (i == 0 || reg % 4 == 0) { ++ if (qcom_scm_io_readl(priv->base + (reg & ~3), &read_val)) { ++ dev_err(priv->dev, "Couldn't access fuse register\n"); ++ return -EINVAL; ++ } ++ tmp = (u8 *)&read_val; ++ } ++ ++ val[i] = tmp[reg & 3]; ++ } ++ ++ return 0; ++} ++ ++static int sec_qfprom_probe(struct platform_device *pdev) ++{ ++ struct nvmem_config econfig = { ++ .name = "sec-qfprom", ++ .stride = 1, ++ .word_size = 1, ++ .id = NVMEM_DEVID_AUTO, ++ .reg_read = sec_qfprom_reg_read, ++ }; ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct sec_qfprom *priv; ++ struct resource *res; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) ++ return -EINVAL; ++ ++ priv->base = res->start; ++ ++ econfig.size = resource_size(res); ++ econfig.dev = dev; ++ econfig.priv = priv; ++ ++ priv->dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &econfig); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id sec_qfprom_of_match[] = { ++ { .compatible = "qcom,sec-qfprom" }, ++ {/* sentinel */}, ++}; ++MODULE_DEVICE_TABLE(of, sec_qfprom_of_match); ++ ++static struct platform_driver qfprom_driver = { ++ .probe = sec_qfprom_probe, ++ .driver = { ++ .name = "qcom_sec_qfprom", ++ .of_match_table = sec_qfprom_of_match, ++ }, ++}; ++module_platform_driver(qfprom_driver); ++MODULE_DESCRIPTION("Qualcomm Secure QFPROM driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/819-v6.6-0013-nvmem-u-boot-env-Replace-zero-length-array-with-DECL.patch b/target/linux/generic/backport-5.15/819-v6.6-0013-nvmem-u-boot-env-Replace-zero-length-array-with-DECL.patch new file mode 100644 index 00000000000000..dab8ec2c241dfe --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0013-nvmem-u-boot-env-Replace-zero-length-array-with-DECL.patch @@ -0,0 +1,30 @@ +From c32f2186acc9abb4d766361255d7ddf07d15eeb2 Mon Sep 17 00:00:00 2001 +From: Atul Raut +Date: Sun, 30 Jul 2023 15:39:15 -0700 +Subject: [PATCH] nvmem: u-boot-env:: Replace zero-length array with + DECLARE_FLEX_ARRAY() helper + +We are moving toward replacing zero-length arrays with C99 flexible-array +members since they are deprecated. Therefore, the new DECLARE_FLEX_ARRAY() +helper macro should be used to replace the zero-length array declaration. + +This fixes warnings such as: +./drivers/nvmem/u-boot-env.c:50:9-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) + +Signed-off-by: Atul Raut +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/u-boot-env.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -47,7 +47,7 @@ struct u_boot_env_image_broadcom { + __le32 magic; + __le32 len; + __le32 crc32; +- uint8_t data[0]; ++ DECLARE_FLEX_ARRAY(uint8_t, data); + } __packed; + + static int u_boot_env_read(void *context, unsigned int offset, void *val, diff --git a/target/linux/generic/backport-5.15/819-v6.6-0014-nvmem-core-Create-all-cells-before-adding-the-nvmem-.patch b/target/linux/generic/backport-5.15/819-v6.6-0014-nvmem-core-Create-all-cells-before-adding-the-nvmem-.patch new file mode 100644 index 00000000000000..f9532f39c35bac --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0014-nvmem-core-Create-all-cells-before-adding-the-nvmem-.patch @@ -0,0 +1,40 @@ +From 104af6a5b199eb4dc7970d1304aef38ac5a6ed54 Mon Sep 17 00:00:00 2001 +From: Miquel Raynal +Date: Tue, 8 Aug 2023 08:29:26 +0200 +Subject: [PATCH] nvmem: core: Create all cells before adding the nvmem device + +Let's pack all the cells creation in one place, so they are all created +before we add the nvmem device. + +Signed-off-by: Miquel Raynal +Reviewed-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/core.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -998,17 +998,17 @@ struct nvmem_device *nvmem_register(cons + if (rval) + goto err_remove_cells; + +- dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); +- +- rval = device_add(&nvmem->dev); ++ rval = nvmem_add_cells_from_fixed_layout(nvmem); + if (rval) + goto err_remove_cells; + +- rval = nvmem_add_cells_from_fixed_layout(nvmem); ++ rval = nvmem_add_cells_from_layout(nvmem); + if (rval) + goto err_remove_cells; + +- rval = nvmem_add_cells_from_layout(nvmem); ++ dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); ++ ++ rval = device_add(&nvmem->dev); + if (rval) + goto err_remove_cells; + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0015-nvmem-core-Return-NULL-when-no-nvmem-layout-is-found.patch b/target/linux/generic/backport-5.15/819-v6.6-0015-nvmem-core-Return-NULL-when-no-nvmem-layout-is-found.patch new file mode 100644 index 00000000000000..8f64d0c28b8599 --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0015-nvmem-core-Return-NULL-when-no-nvmem-layout-is-found.patch @@ -0,0 +1,35 @@ +From 6c7f48ea2e663b679aa8e60d8d8e1e6306a644f9 Mon Sep 17 00:00:00 2001 +From: Miquel Raynal +Date: Tue, 8 Aug 2023 08:29:27 +0200 +Subject: [PATCH] nvmem: core: Return NULL when no nvmem layout is found + +Currently, of_nvmem_layout_get_container() returns NULL on error, or an +error pointer if either CONFIG_NVMEM or CONFIG_OF is turned off. We +should likely avoid this kind of mix for two reasons: to clarify the +intend and anyway fix the !CONFIG_OF which will likely always if we use +this helper somewhere else. Let's just return NULL when no layout is +found, we don't need an error value here. + +Link: https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/ +Fixes: 266570f496b9 ("nvmem: core: introduce NVMEM layouts") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/r/202308030002.DnSFOrMB-lkp@intel.com/ +Signed-off-by: Miquel Raynal +Reviewed-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +--- + include/linux/nvmem-consumer.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/nvmem-consumer.h ++++ b/include/linux/nvmem-consumer.h +@@ -256,7 +256,7 @@ static inline struct nvmem_device *of_nv + static inline struct device_node * + of_nvmem_layout_get_container(struct nvmem_device *nvmem) + { +- return ERR_PTR(-EOPNOTSUPP); ++ return NULL; + } + #endif /* CONFIG_NVMEM && CONFIG_OF */ + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0016-nvmem-core-Do-not-open-code-existing-functions.patch b/target/linux/generic/backport-5.15/819-v6.6-0016-nvmem-core-Do-not-open-code-existing-functions.patch new file mode 100644 index 00000000000000..28d8bba1949adf --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0016-nvmem-core-Do-not-open-code-existing-functions.patch @@ -0,0 +1,29 @@ +From b8257f61b4ddac6d7d0e19a5a4e8b07afb3b4ed3 Mon Sep 17 00:00:00 2001 +From: Miquel Raynal +Date: Tue, 8 Aug 2023 08:29:28 +0200 +Subject: [PATCH] nvmem: core: Do not open-code existing functions + +Use of_nvmem_layout_get_container() instead of hardcoding it. + +Signed-off-by: Miquel Raynal +Reviewed-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -786,10 +786,10 @@ EXPORT_SYMBOL_GPL(nvmem_layout_unregiste + + static struct nvmem_layout *nvmem_layout_get(struct nvmem_device *nvmem) + { +- struct device_node *layout_np, *np = nvmem->dev.of_node; ++ struct device_node *layout_np; + struct nvmem_layout *l, *layout = ERR_PTR(-EPROBE_DEFER); + +- layout_np = of_get_child_by_name(np, "nvmem-layout"); ++ layout_np = of_nvmem_layout_get_container(nvmem); + if (!layout_np) + return NULL; + diff --git a/target/linux/generic/backport-5.15/819-v6.6-0017-nvmem-core-Notify-when-a-new-layout-is-registered.patch b/target/linux/generic/backport-5.15/819-v6.6-0017-nvmem-core-Notify-when-a-new-layout-is-registered.patch new file mode 100644 index 00000000000000..b62a0e18daa74b --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0017-nvmem-core-Notify-when-a-new-layout-is-registered.patch @@ -0,0 +1,44 @@ +From 0991afbe4b1805e7f0113ef10d7c5f0698a739e4 Mon Sep 17 00:00:00 2001 +From: Miquel Raynal +Date: Tue, 8 Aug 2023 08:29:29 +0200 +Subject: [PATCH] nvmem: core: Notify when a new layout is registered + +Tell listeners a new layout was introduced and is now available. + +Signed-off-by: Miquel Raynal +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/core.c | 4 ++++ + include/linux/nvmem-consumer.h | 2 ++ + 2 files changed, 6 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -772,12 +772,16 @@ int __nvmem_layout_register(struct nvmem + list_add(&layout->node, &nvmem_layouts); + spin_unlock(&nvmem_layout_lock); + ++ blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_ADD, layout); ++ + return 0; + } + EXPORT_SYMBOL_GPL(__nvmem_layout_register); + + void nvmem_layout_unregister(struct nvmem_layout *layout) + { ++ blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_REMOVE, layout); ++ + spin_lock(&nvmem_layout_lock); + list_del(&layout->node); + spin_unlock(&nvmem_layout_lock); +--- a/include/linux/nvmem-consumer.h ++++ b/include/linux/nvmem-consumer.h +@@ -43,6 +43,8 @@ enum { + NVMEM_REMOVE, + NVMEM_CELL_ADD, + NVMEM_CELL_REMOVE, ++ NVMEM_LAYOUT_ADD, ++ NVMEM_LAYOUT_REMOVE, + }; + + #if IS_ENABLED(CONFIG_NVMEM) diff --git a/target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch b/target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch index f77756b9cff03b..f403bbec9b1b10 100644 --- a/target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch +++ b/target/linux/generic/pending-5.15/803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch @@ -18,7 +18,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -794,6 +794,19 @@ static struct nvmem_layout *nvmem_layout +@@ -798,6 +798,19 @@ static struct nvmem_layout *nvmem_layout return NULL; /* diff --git a/target/linux/ipq40xx/config-5.15 b/target/linux/ipq40xx/config-5.15 index d08f4e0a24d7f1..4966352271649f 100644 --- a/target/linux/ipq40xx/config-5.15 +++ b/target/linux/ipq40xx/config-5.15 @@ -308,6 +308,7 @@ CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y CONFIG_NVMEM_QCOM_QFPROM=y +# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 1f456b2ce9f150..8d69751b386818 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -300,6 +300,7 @@ CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y CONFIG_NVMEM_QCOM_QFPROM=y +# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/ipq807x/config-5.15 b/target/linux/ipq807x/config-5.15 index a3d0628be966ad..2e3555b3fe5c83 100644 --- a/target/linux/ipq807x/config-5.15 +++ b/target/linux/ipq807x/config-5.15 @@ -256,6 +256,7 @@ CONFIG_NR_CPUS=4 CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y CONFIG_NVMEM=y CONFIG_NVMEM_QCOM_QFPROM=y +# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_U_BOOT_ENV=y diff --git a/target/linux/mpc85xx/config-5.15 b/target/linux/mpc85xx/config-5.15 index 6f7db117d4ce89..86b300ffc39b81 100644 --- a/target/linux/mpc85xx/config-5.15 +++ b/target/linux/mpc85xx/config-5.15 @@ -152,6 +152,7 @@ CONFIG_NLS=y CONFIG_NR_CPUS=1 CONFIG_NR_IRQS=512 CONFIG_NVMEM=y +# CONFIG_NVMEM_QORIQ_EFUSE is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_DMA_DEFAULT_COHERENT=y From 20736013e91030005353b401bc4b757ba5e5fa98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 28 Oct 2023 14:07:40 +0200 Subject: [PATCH 0578/1171] kernel: backport nvmem v6.6 fixes and v6.7 changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit b5956700702b5649ec70bfa0d115af5b439ce6d1) --- ...nvmem-imx-correct-nregs-for-i.MX6SLL.patch | 28 ++ ...-nvmem-imx-correct-nregs-for-i.MX6UL.patch | 28 ++ ...nvmem-imx-correct-nregs-for-i.MX6ULL.patch | 28 ++ ...mem-qfprom-Mark-core-clk-as-optional.patch | 37 ++ ...it-config-option-to-read-old-syntax-.patch | 330 ++++++++++++++++++ ...0003-nvmem-Use-device_get_match_data.patch | 77 ++++ ...4-Revert-nvmem-add-new-config-option.patch | 77 ++++ ...rans-call-add-disks-after-mtd-device.patch | 2 +- 8 files changed, 606 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch create mode 100644 target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch create mode 100644 target/linux/generic/backport-5.15/820-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch create mode 100644 target/linux/generic/backport-5.15/820-v6.7-0002-nvmem-add-explicit-config-option-to-read-old-syntax-.patch create mode 100644 target/linux/generic/backport-5.15/820-v6.7-0003-nvmem-Use-device_get_match_data.patch create mode 100644 target/linux/generic/backport-5.15/820-v6.7-0004-Revert-nvmem-add-new-config-option.patch diff --git a/target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch b/target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch new file mode 100644 index 00000000000000..8901a41a644af5 --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch @@ -0,0 +1,28 @@ +From 414a98abbefd82d591f4e2d1efd2917bcd3b6f6d Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Fri, 13 Oct 2023 13:49:02 +0100 +Subject: [PATCH] nvmem: imx: correct nregs for i.MX6SLL + +The nregs for i.MX6SLL should be 80 per fuse map, correct it. + +Fixes: 6da27821a6f5 ("nvmem: imx-ocotp: add support for imx6sll") +Cc: Stable@vger.kernel.org +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231013124904.175782-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -499,7 +499,7 @@ static const struct ocotp_params imx6sl_ + }; + + static const struct ocotp_params imx6sll_params = { +- .nregs = 128, ++ .nregs = 80, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, diff --git a/target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch b/target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch new file mode 100644 index 00000000000000..db6b951d24542c --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch @@ -0,0 +1,28 @@ +From 7d6e10f5d254681983b53d979422c8de3fadbefb Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Fri, 13 Oct 2023 13:49:03 +0100 +Subject: [PATCH] nvmem: imx: correct nregs for i.MX6UL + +The nregs for i.MX6UL should be 144 per fuse map, correct it. + +Fixes: 4aa2b4802046 ("nvmem: octop: Add support for imx6ul") +Cc: Stable@vger.kernel.org +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231013124904.175782-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -513,7 +513,7 @@ static const struct ocotp_params imx6sx_ + }; + + static const struct ocotp_params imx6ul_params = { +- .nregs = 128, ++ .nregs = 144, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, diff --git a/target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch b/target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch new file mode 100644 index 00000000000000..10ce7cd9f28acb --- /dev/null +++ b/target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch @@ -0,0 +1,28 @@ +From 2382c1b044231fd49eaf9aa82bc7113fc55487b8 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Fri, 13 Oct 2023 13:49:04 +0100 +Subject: [PATCH] nvmem: imx: correct nregs for i.MX6ULL + +The nregs for i.MX6ULL should be 80 per fuse map, correct it. + +Fixes: ffbc34bf0e9c ("nvmem: imx-ocotp: Implement i.MX6ULL/ULZ support") +Cc: Stable@vger.kernel.org +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231013124904.175782-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -520,7 +520,7 @@ static const struct ocotp_params imx6ul_ + }; + + static const struct ocotp_params imx6ull_params = { +- .nregs = 64, ++ .nregs = 80, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, diff --git a/target/linux/generic/backport-5.15/820-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch b/target/linux/generic/backport-5.15/820-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch new file mode 100644 index 00000000000000..66d402814057c4 --- /dev/null +++ b/target/linux/generic/backport-5.15/820-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch @@ -0,0 +1,37 @@ +From 16724d6ea40a2c9315f5a0d81005dfa4d7a6da24 Mon Sep 17 00:00:00 2001 +From: Luca Weiss +Date: Fri, 20 Oct 2023 11:55:40 +0100 +Subject: [PATCH] nvmem: qfprom: Mark core clk as optional + +On some platforms like sc7280 on non-ChromeOS devices the core clock +cannot be touched by Linux so we cannot provide it. Mark it as optional +as accessing qfprom for reading works without it but we still prohibit +writing if we cannot provide the clock. + +Signed-off-by: Luca Weiss +Reviewed-by: Douglas Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231020105545.216052-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -423,12 +423,12 @@ static int qfprom_probe(struct platform_ + if (IS_ERR(priv->vcc)) + return PTR_ERR(priv->vcc); + +- priv->secclk = devm_clk_get(dev, "core"); ++ priv->secclk = devm_clk_get_optional(dev, "core"); + if (IS_ERR(priv->secclk)) + return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n"); + +- /* Only enable writing if we have SoC data. */ +- if (priv->soc_data) ++ /* Only enable writing if we have SoC data and a valid clock */ ++ if (priv->soc_data && priv->secclk) + econfig.reg_write = qfprom_reg_write; + } + diff --git a/target/linux/generic/backport-5.15/820-v6.7-0002-nvmem-add-explicit-config-option-to-read-old-syntax-.patch b/target/linux/generic/backport-5.15/820-v6.7-0002-nvmem-add-explicit-config-option-to-read-old-syntax-.patch new file mode 100644 index 00000000000000..d207ea4872811c --- /dev/null +++ b/target/linux/generic/backport-5.15/820-v6.7-0002-nvmem-add-explicit-config-option-to-read-old-syntax-.patch @@ -0,0 +1,330 @@ +From 2cc3b37f5b6df8189d55d0e812d9658ce256dfec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 20 Oct 2023 11:55:41 +0100 +Subject: [PATCH] nvmem: add explicit config option to read old syntax fixed OF + cells +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Binding for fixed NVMEM cells defined directly as NVMEM device subnodes +has been deprecated. It has been replaced by the "fixed-layout" NVMEM +layout binding. + +New syntax is meant to be clearer and should help avoiding imprecise +bindings. + +NVMEM subsystem already supports the new binding. It should be a good +idea to limit support for old syntax to existing drivers that actually +support & use it (we can't break backward compatibility!). That way we +additionally encourage new bindings & drivers to ignore deprecated +binding. + +It wasn't clear (to me) if rtc and w1 code actually uses old syntax +fixed cells. I enabled them to don't risk any breakage. + +Signed-off-by: Rafał Miłecki +[for meson-{efuse,mx-efuse}.c] +Acked-by: Martin Blumenstingl +[for mtk-efuse.c, nvmem/core.c, nvmem-provider.h] +Reviewed-by: AngeloGioacchino Del Regno +[MT8192, MT8195 Chromebooks] +Tested-by: AngeloGioacchino Del Regno +[for microchip-otpc.c] +Reviewed-by: Claudiu Beznea +[SAMA7G5-EK] +Tested-by: Claudiu Beznea +Acked-by: Jernej Skrabec +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231020105545.216052-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/mtdcore.c | 2 ++ + drivers/nvmem/apple-efuses.c | 1 + + drivers/nvmem/core.c | 8 +++++--- + drivers/nvmem/imx-ocotp-scu.c | 1 + + drivers/nvmem/imx-ocotp.c | 1 + + drivers/nvmem/meson-efuse.c | 1 + + drivers/nvmem/meson-mx-efuse.c | 1 + + drivers/nvmem/microchip-otpc.c | 1 + + drivers/nvmem/mtk-efuse.c | 1 + + drivers/nvmem/qcom-spmi-sdam.c | 1 + + drivers/nvmem/qfprom.c | 1 + + drivers/nvmem/rave-sp-eeprom.c | 1 + + drivers/nvmem/rockchip-efuse.c | 1 + + drivers/nvmem/sc27xx-efuse.c | 1 + + drivers/nvmem/sec-qfprom.c | 1 + + drivers/nvmem/sprd-efuse.c | 1 + + drivers/nvmem/stm32-romem.c | 1 + + drivers/nvmem/sunplus-ocotp.c | 1 + + drivers/nvmem/sunxi_sid.c | 1 + + drivers/nvmem/uniphier-efuse.c | 1 + + drivers/nvmem/zynqmp_nvmem.c | 1 + + drivers/rtc/nvmem.c | 1 + + drivers/w1/slaves/w1_ds250x.c | 1 + + include/linux/nvmem-provider.h | 2 ++ + 24 files changed, 30 insertions(+), 3 deletions(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -541,6 +541,7 @@ static int mtd_nvmem_add(struct mtd_info + config.dev = &mtd->dev; + config.name = dev_name(&mtd->dev); + config.owner = THIS_MODULE; ++ config.add_legacy_fixed_of_cells = of_device_is_compatible(node, "nvmem-cells"); + config.reg_read = mtd_nvmem_reg_read; + config.size = mtd->size; + config.word_size = 1; +@@ -898,6 +899,7 @@ static struct nvmem_device *mtd_otp_nvme + config.name = compatible; + config.id = NVMEM_DEVID_AUTO; + config.owner = THIS_MODULE; ++ config.add_legacy_fixed_of_cells = true; + config.type = NVMEM_TYPE_OTP; + config.root_only = true; + config.ignore_wp = true; +--- a/drivers/nvmem/apple-efuses.c ++++ b/drivers/nvmem/apple-efuses.c +@@ -36,6 +36,7 @@ static int apple_efuses_probe(struct pla + struct resource *res; + struct nvmem_config config = { + .dev = &pdev->dev, ++ .add_legacy_fixed_of_cells = true, + .read_only = true, + .reg_read = apple_efuses_read, + .stride = sizeof(u32), +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -998,9 +998,11 @@ struct nvmem_device *nvmem_register(cons + if (rval) + goto err_remove_cells; + +- rval = nvmem_add_cells_from_legacy_of(nvmem); +- if (rval) +- goto err_remove_cells; ++ if (config->add_legacy_fixed_of_cells) { ++ rval = nvmem_add_cells_from_legacy_of(nvmem); ++ if (rval) ++ goto err_remove_cells; ++ } + + rval = nvmem_add_cells_from_fixed_layout(nvmem); + if (rval) +--- a/drivers/nvmem/imx-ocotp-scu.c ++++ b/drivers/nvmem/imx-ocotp-scu.c +@@ -220,6 +220,7 @@ static int imx_scu_ocotp_write(void *con + + static struct nvmem_config imx_scu_ocotp_nvmem_config = { + .name = "imx-scu-ocotp", ++ .add_legacy_fixed_of_cells = true, + .read_only = false, + .word_size = 4, + .stride = 1, +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -616,6 +616,7 @@ static int imx_ocotp_probe(struct platfo + return PTR_ERR(priv->clk); + + priv->params = of_device_get_match_data(&pdev->dev); ++ imx_ocotp_nvmem_config.add_legacy_fixed_of_cells = true; + imx_ocotp_nvmem_config.size = 4 * priv->params->nregs; + imx_ocotp_nvmem_config.dev = dev; + imx_ocotp_nvmem_config.priv = priv; +--- a/drivers/nvmem/meson-efuse.c ++++ b/drivers/nvmem/meson-efuse.c +@@ -93,6 +93,7 @@ static int meson_efuse_probe(struct plat + + econfig->dev = dev; + econfig->name = dev_name(dev); ++ econfig->add_legacy_fixed_of_cells = true; + econfig->stride = 1; + econfig->word_size = 1; + econfig->reg_read = meson_efuse_read; +--- a/drivers/nvmem/meson-mx-efuse.c ++++ b/drivers/nvmem/meson-mx-efuse.c +@@ -211,6 +211,7 @@ static int meson_mx_efuse_probe(struct p + efuse->config.owner = THIS_MODULE; + efuse->config.dev = &pdev->dev; + efuse->config.priv = efuse; ++ efuse->config.add_legacy_fixed_of_cells = true; + efuse->config.stride = drvdata->word_size; + efuse->config.word_size = drvdata->word_size; + efuse->config.size = SZ_512; +--- a/drivers/nvmem/microchip-otpc.c ++++ b/drivers/nvmem/microchip-otpc.c +@@ -261,6 +261,7 @@ static int mchp_otpc_probe(struct platfo + return ret; + + mchp_nvmem_config.dev = otpc->dev; ++ mchp_nvmem_config.add_legacy_fixed_of_cells = true; + mchp_nvmem_config.size = size; + mchp_nvmem_config.priv = otpc; + nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config); +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -83,6 +83,7 @@ static int mtk_efuse_probe(struct platfo + return PTR_ERR(priv->base); + + pdata = device_get_match_data(dev); ++ econfig.add_legacy_fixed_of_cells = true; + econfig.stride = 1; + econfig.word_size = 1; + econfig.reg_read = mtk_reg_read; +--- a/drivers/nvmem/qcom-spmi-sdam.c ++++ b/drivers/nvmem/qcom-spmi-sdam.c +@@ -142,6 +142,7 @@ static int sdam_probe(struct platform_de + sdam->sdam_config.name = "spmi_sdam"; + sdam->sdam_config.id = NVMEM_DEVID_AUTO; + sdam->sdam_config.owner = THIS_MODULE; ++ sdam->sdam_config.add_legacy_fixed_of_cells = true; + sdam->sdam_config.stride = 1; + sdam->sdam_config.word_size = 1; + sdam->sdam_config.reg_read = sdam_read; +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -357,6 +357,7 @@ static int qfprom_probe(struct platform_ + { + struct nvmem_config econfig = { + .name = "qfprom", ++ .add_legacy_fixed_of_cells = true, + .stride = 1, + .word_size = 1, + .id = NVMEM_DEVID_AUTO, +--- a/drivers/nvmem/rave-sp-eeprom.c ++++ b/drivers/nvmem/rave-sp-eeprom.c +@@ -328,6 +328,7 @@ static int rave_sp_eeprom_probe(struct p + of_property_read_string(np, "zii,eeprom-name", &config.name); + config.priv = eeprom; + config.dev = dev; ++ config.add_legacy_fixed_of_cells = true; + config.size = size; + config.reg_read = rave_sp_eeprom_reg_read; + config.reg_write = rave_sp_eeprom_reg_write; +--- a/drivers/nvmem/rockchip-efuse.c ++++ b/drivers/nvmem/rockchip-efuse.c +@@ -205,6 +205,7 @@ static int rockchip_rk3399_efuse_read(vo + + static struct nvmem_config econfig = { + .name = "rockchip-efuse", ++ .add_legacy_fixed_of_cells = true, + .stride = 1, + .word_size = 1, + .read_only = true, +--- a/drivers/nvmem/sc27xx-efuse.c ++++ b/drivers/nvmem/sc27xx-efuse.c +@@ -248,6 +248,7 @@ static int sc27xx_efuse_probe(struct pla + econfig.reg_read = sc27xx_efuse_read; + econfig.priv = efuse; + econfig.dev = &pdev->dev; ++ econfig.add_legacy_fixed_of_cells = true; + nvmem = devm_nvmem_register(&pdev->dev, &econfig); + if (IS_ERR(nvmem)) { + dev_err(&pdev->dev, "failed to register nvmem config\n"); +--- a/drivers/nvmem/sec-qfprom.c ++++ b/drivers/nvmem/sec-qfprom.c +@@ -47,6 +47,7 @@ static int sec_qfprom_probe(struct platf + { + struct nvmem_config econfig = { + .name = "sec-qfprom", ++ .add_legacy_fixed_of_cells = true, + .stride = 1, + .word_size = 1, + .id = NVMEM_DEVID_AUTO, +--- a/drivers/nvmem/sprd-efuse.c ++++ b/drivers/nvmem/sprd-efuse.c +@@ -408,6 +408,7 @@ static int sprd_efuse_probe(struct platf + econfig.read_only = false; + econfig.name = "sprd-efuse"; + econfig.size = efuse->data->blk_nums * SPRD_EFUSE_BLOCK_WIDTH; ++ econfig.add_legacy_fixed_of_cells = true; + econfig.reg_read = sprd_efuse_read; + econfig.reg_write = sprd_efuse_write; + econfig.priv = efuse; +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -207,6 +207,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; + priv->cfg.type = NVMEM_TYPE_OTP; ++ priv->cfg.add_legacy_fixed_of_cells = true; + + priv->lower = 0; + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -145,6 +145,7 @@ disable_clk: + + static struct nvmem_config sp_ocotp_nvmem_config = { + .name = "sp-ocotp", ++ .add_legacy_fixed_of_cells = true, + .read_only = true, + .word_size = 1, + .size = QAC628_OTP_SIZE, +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -154,6 +154,7 @@ static int sunxi_sid_probe(struct platfo + nvmem_cfg->dev = dev; + nvmem_cfg->name = "sunxi-sid"; + nvmem_cfg->type = NVMEM_TYPE_OTP; ++ nvmem_cfg->add_legacy_fixed_of_cells = true; + nvmem_cfg->read_only = true; + nvmem_cfg->size = cfg->size; + nvmem_cfg->word_size = 1; +--- a/drivers/nvmem/uniphier-efuse.c ++++ b/drivers/nvmem/uniphier-efuse.c +@@ -52,6 +52,7 @@ static int uniphier_efuse_probe(struct p + econfig.size = resource_size(res); + econfig.priv = priv; + econfig.dev = dev; ++ econfig.add_legacy_fixed_of_cells = true; + nvmem = devm_nvmem_register(dev, &econfig); + + return PTR_ERR_OR_ZERO(nvmem); +--- a/drivers/nvmem/zynqmp_nvmem.c ++++ b/drivers/nvmem/zynqmp_nvmem.c +@@ -58,6 +58,7 @@ static int zynqmp_nvmem_probe(struct pla + + priv->dev = dev; + econfig.dev = dev; ++ econfig.add_legacy_fixed_of_cells = true; + econfig.reg_read = zynqmp_nvmem_read; + econfig.priv = priv; + +--- a/drivers/rtc/nvmem.c ++++ b/drivers/rtc/nvmem.c +@@ -21,6 +21,7 @@ int devm_rtc_nvmem_register(struct rtc_d + + nvmem_config->dev = dev; + nvmem_config->owner = rtc->owner; ++ nvmem_config->add_legacy_fixed_of_cells = true; + nvmem = devm_nvmem_register(dev, nvmem_config); + if (IS_ERR(nvmem)) + dev_err(dev, "failed to register nvmem device for RTC\n"); +--- a/drivers/w1/slaves/w1_ds250x.c ++++ b/drivers/w1/slaves/w1_ds250x.c +@@ -168,6 +168,7 @@ static int w1_eprom_add_slave(struct w1_ + struct nvmem_device *nvmem; + struct nvmem_config nvmem_cfg = { + .dev = &sl->dev, ++ .add_legacy_fixed_of_cells = true, + .reg_read = w1_nvmem_read, + .type = NVMEM_TYPE_OTP, + .read_only = true, +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -82,6 +82,7 @@ struct nvmem_cell_info { + * @owner: Pointer to exporter module. Used for refcounting. + * @cells: Optional array of pre-defined NVMEM cells. + * @ncells: Number of elements in cells. ++ * @add_legacy_fixed_of_cells: Read fixed NVMEM cells from old OF syntax. + * @keepout: Optional array of keepout ranges (sorted ascending by start). + * @nkeepout: Number of elements in the keepout array. + * @type: Type of the nvmem storage +@@ -112,6 +113,7 @@ struct nvmem_config { + struct module *owner; + const struct nvmem_cell_info *cells; + int ncells; ++ bool add_legacy_fixed_of_cells; + const struct nvmem_keepout *keepout; + unsigned int nkeepout; + enum nvmem_type type; diff --git a/target/linux/generic/backport-5.15/820-v6.7-0003-nvmem-Use-device_get_match_data.patch b/target/linux/generic/backport-5.15/820-v6.7-0003-nvmem-Use-device_get_match_data.patch new file mode 100644 index 00000000000000..84c0293982459f --- /dev/null +++ b/target/linux/generic/backport-5.15/820-v6.7-0003-nvmem-Use-device_get_match_data.patch @@ -0,0 +1,77 @@ +From 0720219f4d34a88a9badb4de70cfad7585687d48 Mon Sep 17 00:00:00 2001 +From: Rob Herring +Date: Fri, 20 Oct 2023 11:55:45 +0100 +Subject: [PATCH] nvmem: Use device_get_match_data() + +Use preferred device_get_match_data() instead of of_match_device() to +get the driver match data. With this, adjust the includes to explicitly +include the correct headers. + +Signed-off-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231020105545.216052-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/mxs-ocotp.c | 10 ++++------ + drivers/nvmem/stm32-romem.c | 7 ++++--- + 2 files changed, 8 insertions(+), 9 deletions(-) + +--- a/drivers/nvmem/mxs-ocotp.c ++++ b/drivers/nvmem/mxs-ocotp.c +@@ -13,8 +13,9 @@ + #include + #include + #include +-#include ++#include + #include ++#include + #include + #include + +@@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platfo + struct device *dev = &pdev->dev; + const struct mxs_data *data; + struct mxs_ocotp *otp; +- const struct of_device_id *match; + int ret; + +- match = of_match_device(dev->driver->of_match_table, dev); +- if (!match || !match->data) ++ data = device_get_match_data(dev); ++ if (!data) + return -EINVAL; + + otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); +@@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platfo + if (ret) + return ret; + +- data = match->data; +- + ocotp_config.size = data->size; + ocotp_config.priv = otp; + ocotp_config.dev = dev; +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -10,7 +10,9 @@ + #include + #include + #include +-#include ++#include ++#include ++#include + #include + + #include "stm32-bsec-optee-ta.h" +@@ -211,8 +213,7 @@ static int stm32_romem_probe(struct plat + + priv->lower = 0; + +- cfg = (const struct stm32_romem_cfg *) +- of_match_device(dev->driver->of_match_table, dev)->data; ++ cfg = device_get_match_data(dev); + if (!cfg) { + priv->cfg.read_only = true; + priv->cfg.size = resource_size(res); diff --git a/target/linux/generic/backport-5.15/820-v6.7-0004-Revert-nvmem-add-new-config-option.patch b/target/linux/generic/backport-5.15/820-v6.7-0004-Revert-nvmem-add-new-config-option.patch new file mode 100644 index 00000000000000..b23a23ef3affc0 --- /dev/null +++ b/target/linux/generic/backport-5.15/820-v6.7-0004-Revert-nvmem-add-new-config-option.patch @@ -0,0 +1,77 @@ +From f4cf4e5db331a5ce69e3f0b21d322cac0f4e4b5d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 23 Oct 2023 12:27:59 +0200 +Subject: [PATCH] Revert "nvmem: add new config option" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f. + +Config option "no_of_node" is no longer needed since adding a more +explicit and targeted option "add_legacy_fixed_of_cells". + +That "no_of_node" config option was needed *earlier* to help mtd's case. + +DT nodes of MTD partitions (that are also NVMEM devices) may contain +subnodes. Those SHOULD NOT be treated as NVMEM fixed cells. + +To prevent NVMEM core code from parsing subnodes a "no_of_node" option +was added (and set to true in mtd) to make for_each_child_of_node() in +NVMEM a no-op. That was a bit hacky because it was messing with +"of_node" pointer to achieve some side-effect. + +With the introduction of "add_legacy_fixed_of_cells" config option +things got more explicit. MTD subsystem simply tells NVMEM when to look +for fixed cells and there is no need to hack "of_node" pointer anymore. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Miquel Raynal +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231023102759.31529-1-zajec5@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/mtdcore.c | 1 - + drivers/nvmem/core.c | 2 +- + include/linux/nvmem-provider.h | 2 -- + 3 files changed, 1 insertion(+), 4 deletions(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -549,7 +549,6 @@ static int mtd_nvmem_add(struct mtd_info + config.read_only = true; + config.root_only = true; + config.ignore_wp = true; +- config.no_of_node = !of_device_is_compatible(node, "nvmem-cells"); + config.priv = mtd; + + mtd->nvmem = nvmem_register(&config); +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -936,7 +936,7 @@ struct nvmem_device *nvmem_register(cons + nvmem->nkeepout = config->nkeepout; + if (config->of_node) + nvmem->dev.of_node = config->of_node; +- else if (!config->no_of_node) ++ else + nvmem->dev.of_node = config->dev->of_node; + + switch (config->id) { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -89,7 +89,6 @@ struct nvmem_cell_info { + * @read_only: Device is read-only. + * @root_only: Device is accessibly to root only. + * @of_node: If given, this will be used instead of the parent's of_node. +- * @no_of_node: Device should not use the parent's of_node even if it's !NULL. + * @reg_read: Callback to read data. + * @reg_write: Callback to write data. + * @size: Device size. +@@ -122,7 +121,6 @@ struct nvmem_config { + bool ignore_wp; + struct nvmem_layout *layout; + struct device_node *of_node; +- bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; + int size; diff --git a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch index 32a7fb6266422f..62737aa779f3bc 100644 --- a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch +++ b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch @@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle #include "mtdcore.h" -@@ -1082,6 +1083,8 @@ int mtd_device_parse_register(struct mtd +@@ -1083,6 +1084,8 @@ int mtd_device_parse_register(struct mtd register_reboot_notifier(&mtd->reboot_notifier); } From 0dec0e0f1931bb6089daef6cfb5a3670bcaa64b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 31 Oct 2023 17:09:45 +0100 Subject: [PATCH 0579/1171] kernel: fix mtd/NVMEM regression affecting U-Boot env NVMEM driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 20736013e910 ("kernel: backport nvmem v6.6 fixes and v6.7 changes") Fixes: https://github.com/openwrt/openwrt/issues/13831 Signed-off-by: Rafał Miłecki (cherry picked from commit c997634c017294cb38cf6f9a0112860c7e736a53) --- ...or-support-mtd-name-from-device-tree.patch | 2 +- ...rans-call-add-disks-after-mtd-device.patch | 2 +- ...upport-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch | 2 +- ...er-NVMEM-devices-for-partitions-with.patch | 48 +++++++++++++++++++ ...or-support-mtd-name-from-device-tree.patch | 2 +- 5 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/pending-5.15/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch diff --git a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index 7db6346c37e418..36f5331bd017f9 100644 --- a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -847,6 +847,17 @@ out_error: +@@ -870,6 +870,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch index 62737aa779f3bc..1df6f2f18bfcfb 100644 --- a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch +++ b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch @@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle #include "mtdcore.h" -@@ -1083,6 +1084,8 @@ int mtd_device_parse_register(struct mtd +@@ -1106,6 +1107,8 @@ int mtd_device_parse_register(struct mtd register_reboot_notifier(&mtd->reboot_notifier); } diff --git a/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch b/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch index 947b2c262f3390..ed46301b0ee77c 100644 --- a/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch +++ b/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -761,7 +761,8 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -784,7 +784,8 @@ int add_mtd_device(struct mtd_info *mtd) mutex_unlock(&mtd_table_mutex); diff --git a/target/linux/generic/pending-5.15/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch b/target/linux/generic/pending-5.15/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch new file mode 100644 index 00000000000000..650e10a3a5d852 --- /dev/null +++ b/target/linux/generic/pending-5.15/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch @@ -0,0 +1,48 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 31 Oct 2023 15:51:01 +0100 +Subject: [PATCH] mtd: don't register NVMEM devices for partitions with custom + drivers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes issue exposed by upstream commit f4cf4e5db331 ("Revert +"nvmem: add new config option""). + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/mtdcore.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -537,6 +537,29 @@ static int mtd_nvmem_add(struct mtd_info + struct device_node *node = mtd_get_of_node(mtd); + struct nvmem_config config = {}; + ++ /* ++ * Do NOT register NVMEM device for any partition that is meant to be ++ * handled by a U-Boot env driver. That would result in associating two ++ * different NVMEM devices with the same OF node. ++ * ++ * An example of unwanted behaviour of above (forwardtrace): ++ * of_get_mac_addr_nvmem() ++ * of_nvmem_cell_get() ++ * __nvmem_device_get() ++ * ++ * We can't have __nvmem_device_get() return "mtdX" NVMEM device instead ++ * of U-Boot env NVMEM device. That would result in failing to find ++ * NVMEM cell. ++ * ++ * This issue seems to affect U-Boot env case only and will go away with ++ * switch to NVMEM layouts. ++ */ ++ if (of_device_is_compatible(node, "u-boot,env") || ++ of_device_is_compatible(node, "u-boot,env-redundant-bool") || ++ of_device_is_compatible(node, "u-boot,env-redundant-count") || ++ of_device_is_compatible(node, "brcm,env")) ++ return 0; ++ + config.id = -1; + config.dev = &mtd->dev; + config.name = dev_name(&mtd->dev); diff --git a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index 7db6346c37e418..36f5331bd017f9 100644 --- a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -847,6 +847,17 @@ out_error: +@@ -870,6 +870,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { From 41f27bbb6d0af2f37098b97cd28d5f514a6fc417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 2 Nov 2023 09:08:54 +0100 Subject: [PATCH 0580/1171] bcm53xx: add the latest fix version of brcm_nvram MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was just sent for upstream. Signed-off-by: Rafał Miłecki (cherry picked from commit 943bd3c9f6244c928cd168302d638a6a218fd4e6) --- ..._nvram-store-a-copy-of-NVRAM-content.patch | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.15/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch diff --git a/target/linux/bcm53xx/patches-5.15/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch b/target/linux/bcm53xx/patches-5.15/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch new file mode 100644 index 00000000000000..cceb3635ac5dc8 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.15/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch @@ -0,0 +1,256 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 14 Sep 2023 07:59:09 +0200 +Subject: [PATCH] nvmem: brcm_nvram: store a copy of NVRAM content +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This driver uses MMIO access for reading NVRAM from a flash device. +Underneath there is a flash controller that reads data and provides +mapping window. + +Using MMIO interface affects controller configuration and may break real +controller driver. It was reported by multiple users of devices with +NVRAM stored on NAND. + +Modify driver to read & cache NVRAM content during init and use that +copy to provide NVMEM data when requested. On NAND flashes due to their +alignment NVRAM partitions can be quite big (1 MiB and more) while +actual NVRAM content stays quite small (usually 16 to 32 KiB). To avoid +allocating so much memory check for actual data length. + +Link: https://lore.kernel.org/linux-mtd/CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com/ +Fixes: 3fef9ed0627a ("nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM") +Cc: Arınç ÜNAL +Cc: Florian Fainelli +Cc: Scott Branden +Signed-off-by: Rafał Miłecki +Acked-by: Arınç ÜNAL +--- + drivers/nvmem/brcm_nvram.c | 134 ++++++++++++++++++++++++++----------- + 1 file changed, 94 insertions(+), 40 deletions(-) + +--- a/drivers/nvmem/brcm_nvram.c ++++ b/drivers/nvmem/brcm_nvram.c +@@ -17,9 +17,23 @@ + + #define NVRAM_MAGIC "FLSH" + ++/** ++ * struct brcm_nvram - driver state internal struct ++ * ++ * @dev: NVMEM device pointer ++ * @nvmem_size: Size of the whole space available for NVRAM ++ * @data: NVRAM data copy stored to avoid poking underlaying flash controller ++ * @data_len: NVRAM data size ++ * @padding_byte: Padding value used to fill remaining space ++ * @cells: Array of discovered NVMEM cells ++ * @ncells: Number of elements in cells ++ */ + struct brcm_nvram { + struct device *dev; +- void __iomem *base; ++ size_t nvmem_size; ++ uint8_t *data; ++ size_t data_len; ++ uint8_t padding_byte; + struct nvmem_cell_info *cells; + int ncells; + }; +@@ -36,10 +50,47 @@ static int brcm_nvram_read(void *context + size_t bytes) + { + struct brcm_nvram *priv = context; +- u8 *dst = val; ++ size_t to_copy; ++ ++ if (offset + bytes > priv->data_len) ++ to_copy = max_t(ssize_t, (ssize_t)priv->data_len - offset, 0); ++ else ++ to_copy = bytes; ++ ++ memcpy(val, priv->data + offset, to_copy); ++ ++ memset((uint8_t *)val + to_copy, priv->padding_byte, bytes - to_copy); ++ ++ return 0; ++} ++ ++static int brcm_nvram_copy_data(struct brcm_nvram *priv, struct platform_device *pdev) ++{ ++ struct resource *res; ++ void __iomem *base; ++ ++ base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ priv->nvmem_size = resource_size(res); ++ ++ priv->padding_byte = readb(base + priv->nvmem_size - 1); ++ for (priv->data_len = priv->nvmem_size; ++ priv->data_len; ++ priv->data_len--) { ++ if (readb(base + priv->data_len - 1) != priv->padding_byte) ++ break; ++ } ++ WARN(priv->data_len > SZ_128K, "Unexpected (big) NVRAM size: %zu B\n", priv->data_len); + +- while (bytes--) +- *dst++ = readb(priv->base + offset++); ++ priv->data = devm_kzalloc(priv->dev, priv->data_len, GFP_KERNEL); ++ if (!priv->data) ++ return -ENOMEM; ++ ++ memcpy_fromio(priv->data, base, priv->data_len); ++ ++ bcm47xx_nvram_init_from_iomem(base, priv->data_len); + + return 0; + } +@@ -67,8 +118,13 @@ static int brcm_nvram_add_cells(struct b + size_t len) + { + struct device *dev = priv->dev; +- char *var, *value, *eq; ++ char *var, *value; ++ uint8_t tmp; + int idx; ++ int err = 0; ++ ++ tmp = priv->data[len - 1]; ++ priv->data[len - 1] = '\0'; + + priv->ncells = 0; + for (var = data + sizeof(struct brcm_nvram_header); +@@ -78,67 +134,68 @@ static int brcm_nvram_add_cells(struct b + } + + priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL); +- if (!priv->cells) +- return -ENOMEM; ++ if (!priv->cells) { ++ err = -ENOMEM; ++ goto out; ++ } + + for (var = data + sizeof(struct brcm_nvram_header), idx = 0; + var < (char *)data + len && *var; + var = value + strlen(value) + 1, idx++) { ++ char *eq, *name; ++ + eq = strchr(var, '='); + if (!eq) + break; + *eq = '\0'; ++ name = devm_kstrdup(dev, var, GFP_KERNEL); ++ *eq = '='; ++ if (!name) { ++ err = -ENOMEM; ++ goto out; ++ } + value = eq + 1; + +- priv->cells[idx].name = devm_kstrdup(dev, var, GFP_KERNEL); +- if (!priv->cells[idx].name) +- return -ENOMEM; ++ priv->cells[idx].name = name; + priv->cells[idx].offset = value - (char *)data; + priv->cells[idx].bytes = strlen(value); + priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name); +- if (!strcmp(var, "et0macaddr") || +- !strcmp(var, "et1macaddr") || +- !strcmp(var, "et2macaddr")) { ++ if (!strcmp(name, "et0macaddr") || ++ !strcmp(name, "et1macaddr") || ++ !strcmp(name, "et2macaddr")) { + priv->cells[idx].raw_len = strlen(value); + priv->cells[idx].bytes = ETH_ALEN; + priv->cells[idx].read_post_process = brcm_nvram_read_post_process_macaddr; + } + } + +- return 0; ++out: ++ priv->data[len - 1] = tmp; ++ return err; + } + + static int brcm_nvram_parse(struct brcm_nvram *priv) + { ++ struct brcm_nvram_header *header = (struct brcm_nvram_header *)priv->data; + struct device *dev = priv->dev; +- struct brcm_nvram_header header; +- uint8_t *data; + size_t len; + int err; + +- memcpy_fromio(&header, priv->base, sizeof(header)); +- +- if (memcmp(header.magic, NVRAM_MAGIC, 4)) { ++ if (memcmp(header->magic, NVRAM_MAGIC, 4)) { + dev_err(dev, "Invalid NVRAM magic\n"); + return -EINVAL; + } + +- len = le32_to_cpu(header.len); +- +- data = kzalloc(len, GFP_KERNEL); +- if (!data) +- return -ENOMEM; +- +- memcpy_fromio(data, priv->base, len); +- data[len - 1] = '\0'; +- +- err = brcm_nvram_add_cells(priv, data, len); +- if (err) { +- dev_err(dev, "Failed to add cells: %d\n", err); +- return err; ++ len = le32_to_cpu(header->len); ++ if (len > priv->nvmem_size) { ++ dev_err(dev, "NVRAM length (%zd) exceeds mapped size (%zd)\n", len, ++ priv->nvmem_size); ++ return -EINVAL; + } + +- kfree(data); ++ err = brcm_nvram_add_cells(priv, priv->data, len); ++ if (err) ++ dev_err(dev, "Failed to add cells: %d\n", err); + + return 0; + } +@@ -150,7 +207,6 @@ static int brcm_nvram_probe(struct platf + .reg_read = brcm_nvram_read, + }; + struct device *dev = &pdev->dev; +- struct resource *res; + struct brcm_nvram *priv; + int err; + +@@ -159,21 +215,19 @@ static int brcm_nvram_probe(struct platf + return -ENOMEM; + priv->dev = dev; + +- priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); +- if (IS_ERR(priv->base)) +- return PTR_ERR(priv->base); ++ err = brcm_nvram_copy_data(priv, pdev); ++ if (err) ++ return err; + + err = brcm_nvram_parse(priv); + if (err) + return err; + +- bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res)); +- + config.dev = dev; + config.cells = priv->cells; + config.ncells = priv->ncells; + config.priv = priv; +- config.size = resource_size(res); ++ config.size = priv->nvmem_size; + + return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); + } From b5498808155b73ede2a1e8fc3cd4b090bd31788d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 27 Oct 2023 00:15:58 +0200 Subject: [PATCH 0581/1171] ucode: update to latest Git HEAD - Introduces signal handling facilities - Fixes potentially incorrect object equality tests - Introduces debug library - Introduces log library - ABI version bump due to changed VM structure layout - Revised packaging Changelog: 07c0317 jsdoc: switch to own custom theme 6ca08b0 jsdoc: properly handle indented documentation blocks 2a67f22 lib: add/improve documentation for require(), loadfile(), loadstring() 9993ccb uci: fix potential memory leaks in `configs()` f56394f ci: re-trigger workflows on pull request pushes 1c18993 lib: various documentation fixes d25dcb1 uci: add module documentation 4a8ece2 docs: use CSS and local JavaScript fixups to improve formatting 8f21cfa lib: introduce log library 8a3aefe build: auto-enable module depending on present libraries 6a01adc build: convert CMakeLists.txt into lowercase 8700665 ci: don't skip pull request workflows for `master` branch 0184d23 include: fix execvpe compat function on macOS 8b23884 uloop: rename environ variable to avoid clashing with system macro on macOS 7c209d7 types: ensure double serializatiion with decimal places d150425 rtnl: update the link attr TODOs d394174 rtnl: add IFLA_TARGET_NETNSID for operating in other namespaces 1227733 lib: fix documented return value for `splice()` c9982de docs: add struct module documentation 7dde493 docs: add missing headline to debug module documentation 8f852ea types: improve comparison reliability of binary strings 6940c28 lib: introduce debug library be07107 treewide: consolidate platform specific code in platform.c 2593270 uloop: interrupt on VM signals 97a5292 lib: add `signal()` stdlib function 1dbbb6a main: enable signal dispatching in the standalone cli interpreter 1623245 types: treat signal handler array as GC root 29b1c0d vm: introduce basic signal handling infrastructure 093684d fs: explicitly compare isatty() result 4f4f38f types: don't rely on implicit type conversion in ucv_compare() 4bee0ef docs: disable GitHub Jekyll post processing 5efb7a0 docs: further rework 33bc7bf docs: fix markup quirks 9d5e420 docs: add information about memory management and operator precedence f1190ef docs: various improvements f0cc841 fs: use `fseeko()` and `ftello()` cba0c3c fs: complete function documentation coverage f9260f7 github: drop superfluous CNAME file c85bc74 Create CNAME 5309294 lib: add JSDoc documentation b0f2f90 fs: add JSDoc documentation fe086da math: add JSDoc documentation 70f9348 docs: add initial JSDoc infrastructure 24f1a56 source: fix source offset accounting 9df9160 lexer: don't count EOF token as newline b9d8f06 ci: switch to official openwrt/gh-action-sdk Signed-off-by: Jo-Philipp Wich (cherry picked from commit eacc885816fb46bf4054b0c3dd2cd1513322ad09) --- package/utils/ucode/Makefile | 211 +++++++++++------------------------ 1 file changed, 66 insertions(+), 145 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index e2fe4c8bad40da..c2f0607341f5b9 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,13 +12,13 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2023-06-06 -PKG_SOURCE_VERSION:=c7d84aae09691a99ae3db427c0b2463732ef84f4 -PKG_MIRROR_HASH:=38826ae70d886d1d7ada3fc6591ac807169aa28107f60f7f2e617520083525fb +PKG_SOURCE_DATE:=2023-10-19 +PKG_SOURCE_VERSION:=07c03173d4e6a30953f92fa88ed29b0b956c9106 +PKG_MIRROR_HASH:=fd770335f442ebfc0f4e28d94bb60d886c43aa239ab88e965be7c490b3283a82 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC -PKG_ABI_VERSION:=20220812 +PKG_ABI_VERSION:=20230711 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk @@ -35,7 +35,9 @@ CMAKE_HOST_OPTIONS += \ -DSTRUCT_SUPPORT=ON \ -DUBUS_SUPPORT=OFF \ -DUCI_SUPPORT=OFF \ - -DULOOP_SUPPORT=OFF + -DULOOP_SUPPORT=OFF \ + -DDEBUG_SUPPORT=ON \ + -DLOG_SUPPORT=OFF define Package/ucode/default @@ -70,105 +72,29 @@ define Package/libucode/description The libucode package provides the shared runtime library for the ucode interpreter. endef +# 1: name +# 2: cmake symbol +# 3: depends +# 4: description +define UcodeModule + UCODE_MODULES += ucode-mod-$(strip $(1)) + CMAKE_OPTIONS += -D$(strip $(2))=$(if $(CONFIG_PACKAGE_ucode-mod-$(strip $(1))),ON,OFF) + PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_ucode-mod-$(strip $(1)) -define Package/ucode-mod-fs + define Package/ucode-mod-$(strip $(1)) $(Package/ucode/default) - TITLE+= (filesystem module) - DEPENDS:=ucode -endef - -define Package/ucode-mod-fs/description - The filesystem plugin module allows interaction with the local file system. -endef - - -define Package/ucode-mod-math - $(Package/ucode/default) - TITLE+= (math module) - DEPENDS:=ucode -endef - -define Package/ucode-mod-math/description - The math plugin provides access to various procedures. -endef - - -define Package/ucode-mod-nl80211 - $(Package/ucode/default) - TITLE+= (nl80211 module) - DEPENDS:=ucode +libnl-tiny +libubox -endef - -define Package/ucode-mod-nl80211/description - The nl80211 plugin provides access to the Linux wireless 802.11 netlink API. -endef - - -define Package/ucode-mod-resolv - $(Package/ucode/default) - TITLE+= (resolv module) - DEPENDS:=ucode -endef - -define Package/ucode-mod-resolv/description - The resolv plugin implements simple DNS resolving. -endef - - -define Package/ucode-mod-rtnl - $(Package/ucode/default) - TITLE+= (rtnl module) - DEPENDS:=ucode +libnl-tiny +libubox -endef - -define Package/ucode-mod-rtnl/description - The rtnl plugin provides access to the Linux routing netlink API. -endef - - -define Package/ucode-mod-struct - $(Package/ucode/default) - TITLE+= (struct module) - DEPENDS:=ucode -endef - -define Package/ucode-mod-struct/description - The struct plugin implements Python 3 compatible struct.pack/unpack functionality. -endef - - -define Package/ucode-mod-ubus - $(Package/ucode/default) - TITLE+= (ubus module) - DEPENDS:=ucode +libubus +libblobmsg-json -endef - -define Package/ucode-mod-ubus/description - The ubus module allows ucode template scripts to enumerate and invoke ubus - procedures. -endef + TITLE+= ($(strip $(1)) module) + DEPENDS:=ucode $(3) + endef + define Package/ucode-mod-$(strip $(1))/description + $(strip $(4)) + endef -define Package/ucode-mod-uci - $(Package/ucode/default) - TITLE+= (uci module) - DEPENDS:=ucode +libuci -endef - -define Package/ucode-mod-uci/description - The uci module allows templates to read and modify uci configuration. -endef - - -define Package/ucode-mod-uloop - $(Package/ucode/default) - TITLE+= (uloop module) - DEPENDS:=ucode +libubox -endef - -define Package/ucode-mod-uloop/description - The uloop module allows ucode scripts to interact with OpenWrt uloop event - loop implementation. + define Package/ucode-mod-$(strip $(1))/install + $(INSTALL_DIR) $$(1)/usr/lib/ucode + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/$(strip $(1)).so $$(1)/usr/lib/ucode/ + endef endef @@ -189,60 +115,55 @@ define Package/libucode/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucode.so.* $(1)/usr/lib/ endef -define Package/ucode-mod-fs/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/fs.so $(1)/usr/lib/ucode/ -endef -define Package/ucode-mod-math/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/math.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + debug, DEBUG_SUPPORT, +libubox +libucode, \ + The debug plugin module provides runtime debugging and introspection facilities.)) -define Package/ucode-mod-nl80211/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/nl80211.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + fs, FS_SUPPORT, , \ + The filesystem plugin module allows interaction with the local file system.)) -define Package/ucode-mod-resolv/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/resolv.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + log, LOG_SUPPORT, +libubox, \ + The log plugin module provides access to the syslog and libubox ulog APIs.)) -define Package/ucode-mod-rtnl/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/rtnl.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + math, MATH_SUPPORT, , \ + The math plugin provides access to various procedures.)) -define Package/ucode-mod-struct/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/struct.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + nl80211, NL80211_SUPPORT, +libnl-tiny +libubox, \ + The nl80211 plugin provides access to the Linux wireless 802.11 netlink API.)) -define Package/ucode-mod-ubus/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/ubus.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + resolv, RESOLV_SUPPORT, , \ + The resolv plugin implements simple DNS resolving.)) -define Package/ucode-mod-uci/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/uci.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + rtnl, RTNL_SUPPORT, +libnl-tiny +libubox, \ + The rtnl plugin provides access to the Linux routing netlink API.)) -define Package/ucode-mod-uloop/install - $(INSTALL_DIR) $(1)/usr/lib/ucode - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/uloop.so $(1)/usr/lib/ucode/ -endef +$(eval $(call UcodeModule, \ + struct, STRUCT_SUPPORT, , \ + The struct plugin implements Python 3 compatible struct.pack/unpack functionality.)) + +$(eval $(call UcodeModule, \ + ubus, UBUS_SUPPORT, +libubus +libblobmsg-json, \ + The ubus module allows ucode template scripts to enumerate and invoke ubus procedures.)) + +$(eval $(call UcodeModule, \ + uci, UCI_SUPPORT, +libuci, \ + The uci module allows templates to read and modify uci configuration.)) + +$(eval $(call UcodeModule, \ + uloop, ULOOP_SUPPORT, +libubox, \ + The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.)) $(eval $(call BuildPackage,libucode)) $(eval $(call BuildPackage,ucode)) -$(eval $(call BuildPackage,ucode-mod-fs)) -$(eval $(call BuildPackage,ucode-mod-math)) -$(eval $(call BuildPackage,ucode-mod-nl80211)) -$(eval $(call BuildPackage,ucode-mod-resolv)) -$(eval $(call BuildPackage,ucode-mod-rtnl)) -$(eval $(call BuildPackage,ucode-mod-struct)) -$(eval $(call BuildPackage,ucode-mod-ubus)) -$(eval $(call BuildPackage,ucode-mod-uci)) -$(eval $(call BuildPackage,ucode-mod-uloop)) + +$(foreach mod,$(UCODE_MODULES), \ + $(eval $(call BuildPackage,$(mod)))) + $(eval $(call HostBuild)) From 51b1d5950e2428a303d703a8b7ac66ef61a10485 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 28 Oct 2023 14:58:46 +0200 Subject: [PATCH 0582/1171] ucode: fix build on macos Remove ABI version, since its format is not accepted by the linker. Enable rpath to avoid clash with system libraries Signed-off-by: Felix Fietkau (cherry picked from commit 5eb8a21ba5fe5e87c03f0361d1db989189be9c6d) --- package/utils/ucode/Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index c2f0607341f5b9..46112d31e88401 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -25,8 +25,18 @@ include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk CMAKE_OPTIONS += -DSOVERSION=$(PKG_ABI_VERSION) + +ifeq ($(HOST_OS),Darwin) + CMAKE_HOST_OPTIONS += \ + -DCMAKE_SKIP_RPATH=FALSE \ + -DCMAKE_MACOSX_RPATH=1 \ + -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib" +else + CMAKE_HOST_OPTIONS += \ + -DSOVERSION=$(PKG_ABI_VERSION) +endif + CMAKE_HOST_OPTIONS += \ - -DSOVERSION=$(PKG_ABI_VERSION) \ -DFS_SUPPORT=ON \ -DMATH_SUPPORT=ON \ -DNL80211_SUPPORT=OFF \ From f34ccb10dd9a8f8613584399eacd7e271e6cc967 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 2 Nov 2023 10:36:05 +0100 Subject: [PATCH 0583/1171] ucode: update to latest Git HEAD cfb24ea build: avoid redefining _FORTIFY_SOURCE 448c763 lib: enforce consistent `index()` behavior with empty needle argument cdc0203 nl80211: fix maybe uninitialized variable a69b5c8 vm: fix unused result warning ea046bd build: enable source fortification by default Signed-off-by: Jo-Philipp Wich (cherry picked from commit 262554f12cbcc4e3bea2440ce1e696ce8791e732) --- package/utils/ucode/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 46112d31e88401..b62633492aa810 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2023-10-19 -PKG_SOURCE_VERSION:=07c03173d4e6a30953f92fa88ed29b0b956c9106 -PKG_MIRROR_HASH:=fd770335f442ebfc0f4e28d94bb60d886c43aa239ab88e965be7c490b3283a82 +PKG_SOURCE_DATE:=2023-11-02 +PKG_SOURCE_VERSION:=cfb24ea4f12131dcefe4f1ede2f51d3d16b88dec +PKG_MIRROR_HASH:=f515a23ab438f92be5788c42b9f614a82e670de2df1c01cd63143cdc77fa24fe PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 40203cdbde5022ab7244c3a014184dedd013b740 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 1 Sep 2023 14:00:47 +0200 Subject: [PATCH 0584/1171] firewall4: update to the latest version 23a434d0d15d tests: fix expected test output 840ccdeeabce fw4: avoid emitting invalid rule jump targets 20da9933fd7e fw4: fix another instance of invalid rule jump targets 598d9fbb5179 fw4: remove special cases around hw flow offloading Signed-off-by: Felix Fietkau (cherry picked from commit 7049ea9e95b0aec461f585523b773e68db3ae304) --- package/network/config/firewall4/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index 809f3d3f0409f4..8764f5a401b185 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2023-03-23 -PKG_SOURCE_VERSION:=04a06bd70b9808b14444cae81a2faba4708ee231 -PKG_MIRROR_HASH:=37c34facb733c50d0fdbfa238765a23e667e4daaae9728aaccbaba87a2a07bb9 +PKG_SOURCE_DATE:=2023-09-01 +PKG_SOURCE_VERSION:=598d9fbb5179667aa0c525040eaa41bc7f2dc015 +PKG_MIRROR_HASH:=038b5b5611425e3c0fcc3ef4a0aea37296733300766d787909a689d16d4f39b4 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 21552a955ae6865dfe2062a86a6c6f5f0d31a32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 19 Oct 2022 15:43:37 +0200 Subject: [PATCH 0585/1171] package-dumpinfo: add CPE information to package index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Common Platform Enumeration (CPE) is a structured naming scheme for information technology systems, software, and packages. In order for the information to be processed further, it should also be available in package index files. Signed-off-by: Petr Štetiar (cherry picked from commit 33b3fea70245068030ef64b6d7c5b344d08ba9d8) --- include/package-dumpinfo.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index 597452e4b93074..afc325c1ed66e8 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -36,6 +36,7 @@ $(if $(USERID),Require-User: $(USERID) )Source: $(PKG_SOURCE) $(if $(LICENSE),License: $(LICENSE) )$(if $(LICENSE_FILES),LicenseFiles: $(LICENSE_FILES) +)$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID) )Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg)) $(if $(KCONFIG),Kernel-Config: $(KCONFIG) )$(if $(BUILDONLY),Build-Only: $(BUILDONLY) From fdeb7d6dd050a56ede48e29f9ebfb5fe351328a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 19 Oct 2022 15:46:45 +0200 Subject: [PATCH 0586/1171] package-metadata: add CPE information to JSON package manifests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Common Platform Enumeration (CPE) is a structured naming scheme for information technology systems, software, and packages. In order for the information to be processed further, it should also be available in JSON package manifests. Signed-off-by: Petr Štetiar (cherry picked from commit 8562c65ff8aae3899cdb190319709500b7651492) --- scripts/metadata.pm | 1 + scripts/package-metadata.pl | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/metadata.pm b/scripts/metadata.pm index ee5a2945ca71ff..e716f75d102214 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -256,6 +256,7 @@ sub parse_package_metadata($) { /^Source: \s*(.+)\s*$/ and $pkg->{source} = $1; /^License: \s*(.+)\s*$/ and $pkg->{license} = $1; /^LicenseFiles: \s*(.+)\s*$/ and $pkg->{licensefiles} = $1; + /^CPE-ID: \s*(.+)\s*$/ and $pkg->{cpe_id} = $1; /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1; /^Provides: \s*(.+)\s*$/ and do { my @vpkg = split /\s+/, $1; diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index 6288584d65f588..dfb28004531438 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -609,6 +609,7 @@ () "version":"$pkg->{version}", "category":"$pkg->{category}", "license":"$pkg->{license}", +"cpe_id":"$pkg->{cpe_id}", "maintainer": [$pkg_maintainer], "depends":[$pkg_deps]}, END_JSON From 4ef8899c7ab6ac9c69f7cc7138c3fc8a3fec777b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 26 Oct 2023 16:11:47 +0000 Subject: [PATCH 0587/1171] package-dumpinfo,metadata: add ABI version information to package index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no standard for ABI versioning, so its not possible to find out from `libext2fs2`, `libiwinfo20230701` or `libss2` package names if thats just package name or package name with ABI version included. To help with the decision, lets make ABI version aviable in package index. Signed-off-by: Petr Štetiar (cherry picked from commit 649655f427932fe79b96a41f883c8054b1806191) --- include/package-dumpinfo.mk | 1 + scripts/metadata.pm | 1 + 2 files changed, 2 insertions(+) diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index afc325c1ed66e8..6baf10225de888 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -37,6 +37,7 @@ $(if $(USERID),Require-User: $(USERID) $(if $(LICENSE),License: $(LICENSE) )$(if $(LICENSE_FILES),LicenseFiles: $(LICENSE_FILES) )$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID) +)$(if $(ABI_VERSION),ABI-Version: $(ABI_VERSION) )Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg)) $(if $(KCONFIG),Kernel-Config: $(KCONFIG) )$(if $(BUILDONLY),Build-Only: $(BUILDONLY) diff --git a/scripts/metadata.pm b/scripts/metadata.pm index e716f75d102214..a00d19f185a2bc 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -257,6 +257,7 @@ sub parse_package_metadata($) { /^License: \s*(.+)\s*$/ and $pkg->{license} = $1; /^LicenseFiles: \s*(.+)\s*$/ and $pkg->{licensefiles} = $1; /^CPE-ID: \s*(.+)\s*$/ and $pkg->{cpe_id} = $1; + /^ABI-Version: \s*(.+)\s*$/ and $pkg->{abi_version} = $1; /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1; /^Provides: \s*(.+)\s*$/ and do { my @vpkg = split /\s+/, $1; From 21e5db97c410f4008c8fe8515fb79a7cde368dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 24 Oct 2023 08:27:13 +0000 Subject: [PATCH 0588/1171] build: add CycloneDX SBOM JSON support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CycloneDX is an open source standard developed by the OWASP foundation. It supports a wide range of development ecosystems, a comprehensive set of use cases, and focuses on automation, ease of adoption, and progressive enhancement of SBOMs (Software Bill Of Materials) throughout build pipelines. So lets add support for CycloneDX SBOM for packages and images manifests. Signed-off-by: Petr Štetiar (cherry picked from commit d604a07225c5c82b942cd3374cc113ad676a2519) --- config/Config-build.in | 8 ++ include/image.mk | 5 + package/Makefile | 8 ++ scripts/metadata.pm | 40 +++++++- scripts/package-metadata.pl | 187 ++++++++++++++++++++++++++++++++++-- 5 files changed, 240 insertions(+), 8 deletions(-) diff --git a/config/Config-build.in b/config/Config-build.in index df2d9101ca99c9..fe16d81d36d622 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -26,6 +26,14 @@ menu "Global build settings" directory containing machine readable list of built profiles and resulting images. + config JSON_CYCLONEDX_SBOM + bool "Create CycloneDX SBOM JSON" + default BUILDBOT + help + Create a JSON files *.bom.cdx.json in the build + directory containing Software Bill Of Materials in CycloneDX + format. + config ALL_NONSHARED bool "Select all target specific packages by default" select ALL_KMODS diff --git a/include/image.mk b/include/image.mk index fae4d32a8bb99d..3d5d6c161316d5 100644 --- a/include/image.mk +++ b/include/image.mk @@ -277,6 +277,11 @@ endef define Image/Manifest $(call opkg,$(TARGET_DIR_ORIG)) list-installed > \ $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest + $(if $(CONFIG_JSON_CYCLONEDX_SBOM), \ + $(SCRIPT_DIR)/package-metadata.pl imgcyclonedxsbom \ + $(TMP_DIR)/.packageinfo \ + $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest > \ + $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).bom.cdx.json) endef define Image/gzip-ext4-padded-squashfs diff --git a/package/Makefile b/package/Makefile index 4b8df7f484de6e..8e72d4ec726dbc 100644 --- a/package/Makefile +++ b/package/Makefile @@ -106,6 +106,14 @@ ifdef CONFIG_SIGNED_PACKAGES $(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \ ); done endif +ifdef CONFIG_JSON_CYCLONEDX_SBOM + @echo Creating CycloneDX package SBOMs... + @for d in $(PACKAGE_SUBDIRS); do ( \ + [ -d $$d ] && \ + cd $$d || continue; \ + $(SCRIPT_DIR)/package-metadata.pl pkgcyclonedxsbom Packages.manifest > Packages.bom.cdx.json || true; \ + ); done +endif $(curdir)/flags-install:= -j1 diff --git a/scripts/metadata.pm b/scripts/metadata.pm index a00d19f185a2bc..587ce7207d2e69 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -2,7 +2,7 @@ package metadata; use base 'Exporter'; use strict; use warnings; -our @EXPORT = qw(%package %vpackage %srcpackage %category %overrides clear_packages parse_package_metadata parse_target_metadata get_multiline @ignore %usernames %groupnames); +our @EXPORT = qw(%package %vpackage %srcpackage %category %overrides clear_packages parse_package_metadata parse_package_manifest_metadata parse_target_metadata get_multiline @ignore %usernames %groupnames); our %package; our %vpackage; @@ -317,4 +317,42 @@ sub parse_package_metadata($) { return 1; } +sub parse_package_manifest_metadata($) { + my $file = shift; + my $pkg; + my %pkgs; + + open FILE, "<$file" or do { + warn "Cannot open '$file': $!\n"; + return undef; + }; + + while () { + chomp; + /^Package:\s*(.+?)\s*$/ and do { + $pkg = {}; + $pkg->{name} = $1; + $pkg->{depends} = []; + $pkgs{$1} = $pkg; + }; + /^Version:\s*(.+)\s*$/ and $pkg->{version} = $1; + /^Depends:\s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ]; + /^Source:\s*(.+)\s*$/ and $pkg->{source} = $1; + /^SourceName:\s*(.+)\s*$/ and $pkg->{sourcename} = $1; + /^License:\s*(.+)\s*$/ and $pkg->{license} = $1; + /^LicenseFiles:\s*(.+)\s*$/ and $pkg->{licensefiles} = $1; + /^Section:\s*(.+)\s*$/ and $pkg->{section} = $1; + /^SourceDateEpoch: \s*(.+)\s*$/ and $pkg->{sourcedateepoch} = $1; + /^CPE-ID:\s*(.+)\s*$/ and $pkg->{cpe_id} = $1; + /^Architecture:\s*(.+)\s*$/ and $pkg->{architecture} = $1; + /^Installed-Size:\s*(.+)\s*$/ and $pkg->{installedsize} = $1; + /^Filename:\s*(.+)\s*$/ and $pkg->{filename} = $1; + /^Size:\s*(\d+)\s*$/ and $pkg->{size} = $1; + /^SHA256sum:\s*(.*)\s*$/ and $pkg->{sha256sum} = $1; + } + + close FILE; + return %pkgs; +} + 1; diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index dfb28004531438..bc61577d2211d9 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -4,6 +4,8 @@ use strict; use metadata; use Getopt::Long; +use Time::Piece; +use JSON::PP; my %board; @@ -620,6 +622,173 @@ () print "[$json]"; } +sub image_manifest_packages($) +{ + my %packages; + my $imgmanifest = shift; + + open FILE, "<$imgmanifest" or return; + while () { + /^(.+?) - (.+)$/ and $packages{$1} = $2; + } + close FILE; + + return %packages; +} + +sub dump_cyclonedxsbom_json { + my (@components) = @_; + + my $uuid = sprintf( + "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", + rand(0xffff), rand(0xffff), rand(0xffff), + rand(0x0fff) | 0x4000, + rand(0x3fff) | 0x8000, + rand(0xffff), rand(0xffff), rand(0xffff) + ); + + my $cyclonedx = { + bomFormat => "CycloneDX", + specVersion => "1.4", + serialNumber => "urn:uuid:$uuid", + version => 1, + metadata => { + timestamp => gmtime->datetime, + }, + "components" => [@components], + }; + + return encode_json($cyclonedx); +} + +sub gen_image_cyclonedxsbom() { + my $pkginfo = shift @ARGV; + my $imgmanifest = shift @ARGV; + my @components; + my %image_packages; + + %image_packages = image_manifest_packages($imgmanifest); + %image_packages or exit 1; + parse_package_metadata($pkginfo) or exit 1; + + $package{"kernel"} = { + license => "GPL-2.0", + cpe_id => "cpe:/o:linux:linux_kernel", + name => "kernel", + }; + + my %abimap; + my @abipkgs = grep { defined $package{$_}->{abi_version} } keys %package; + foreach my $name (@abipkgs) { + my $pkg = $package{$name}; + my $abipkg = $name . $pkg->{abi_version}; + $abimap{$abipkg} = $name; + } + + foreach my $name (sort {uc($a) cmp uc($b)} keys %image_packages) { + my $pkg = $package{$name}; + if (!$pkg) { + $pkg = $package{$abimap{$name}}; + next if !$pkg; + } + + my @licenses; + my @license = split(/\s+/, $pkg->{license}); + foreach my $lic (@license) { + push @licenses, ( + { "license" => { "name" => $lic } } + ); + } + my $type; + if ($pkg->{category}) { + my $category = $pkg->{category}; + my %cat_type = ( + "Firmware" => "firmware", + "Libraries" => "library" + ); + + if ($cat_type{$category}) { + $type = $cat_type{$category}; + } else { + $type = "application"; + } + } + + my $version = $pkg->{version}; + if ($image_packages{$name}) { + $version = $image_packages{$name}; + } + $version =~ s/-\d+$// if $version; + if ($name =~ /^(kernel|kmod-)/ and $version =~ /^(\d+\.\d+\.\d+)/) { + $version = $1; + } + + push @components, { + name => $pkg->{name}, + version => $version, + @licenses > 0 ? (licenses => [ @licenses ]) : (), + $pkg->{cpe_id} ? (cpe => $pkg->{cpe_id}.":".$version) : (), + $type ? (type => $type) : (), + $version ? (version => $version) : (), + }; + } + + print dump_cyclonedxsbom_json(@components); +} + +sub gen_package_cyclonedxsbom() { + my $pkgmanifest = shift @ARGV; + my @components; + my %mpkgs; + + %mpkgs = parse_package_manifest_metadata($pkgmanifest); + %mpkgs or exit 1; + + foreach my $name (sort {uc($a) cmp uc($b)} keys %mpkgs) { + my $pkg = $mpkgs{$name}; + + my @licenses; + my @license = split(/\s+/, $pkg->{license}); + foreach my $lic (@license) { + push @licenses, ( + { "license" => { "name" => $lic } } + ); + } + + my $type; + if ($pkg->{section}) { + my $section = $pkg->{section}; + my %section_type = ( + "firmware" => "firmware", + "libs" => "library" + ); + + if ($section_type{$section}) { + $type = $section_type{$section}; + } else { + $type = "application"; + } + } + + my $version = $pkg->{version}; + $version =~ s/-\d+$// if $version; + if ($name =~ /^(kernel|kmod-)/ and $version =~ /^(\d+\.\d+\.\d+)/) { + $version = $1; + } + + push @components, { + name => $name, + version => $version, + @licenses > 0 ? (licenses => [ @licenses ]) : (), + $pkg->{cpe_id} ? (cpe => $pkg->{cpe_id}.":".$version) : (), + $type ? (type => $type) : (), + $version ? (version => $version) : (), + }; + } + + print dump_cyclonedxsbom_json(@components); +} + sub parse_command() { GetOptions("ignore=s", \@ignore); my $cmd = shift @ARGV; @@ -630,6 +799,8 @@ () /^source$/ and return gen_package_source(); /^pkgaux$/ and return gen_package_auxiliary(); /^pkgmanifestjson$/ and return gen_package_manifest_json(); + /^imgcyclonedxsbom$/ and return gen_image_cyclonedxsbom(); + /^pkgcyclonedxsbom$/ and return gen_package_cyclonedxsbom(); /^license$/ and return gen_package_license(0); /^licensefull$/ and return gen_package_license(1); /^usergroup$/ and return gen_usergroup_list(); @@ -637,15 +808,17 @@ () } die < [manifest] Image package manifest in CycloneDX SBOM JSON format + $0 pkgcyclonedxsbom Package manifest in CycloneDX SBOM JSON format + $0 license [file] Package license information $0 licensefull [file] Package license information (full list) - $0 usergroup [file] Package usergroup allocation list + $0 usergroup [file] Package usergroup allocation list $0 version_filter [patchver] [list...] Filter list of version tagged strings Options: From 65a10c82305a311f2359fad7792dfd4b7455cd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 27 Oct 2023 07:37:52 +0000 Subject: [PATCH 0589/1171] hostapd: fix broken WPS on broadcom-wl and ath11k MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl/ath11k based adapters. The reason for it is hostapd tries to install additional IEs for scanning while the driver does not support this. The kernel indicates the maximum number of bytes for additional scan IEs using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and only add additional scan IEs in case the driver can accommodate these additional IEs. Bug: http://lists.infradead.org/pipermail/hostap/2022-January/040178.html Bug-Debian: https://bugs.debian.org/1004524 Bug-ArchLinux: https://bugs.archlinux.org/task/73495 Upstream-Status: Changes Requested [https://patchwork.ozlabs.org/project/hostap/patch/20220130192200.10883-1-mail@david-bauer.net] Reported-by: Étienne Morice Tested-by: Étienne Morice Signed-off-by: David Bauer Signed-off-by: Petr Štetiar (cherry picked from commit 6dca88aa4acd60229147628cb920d05a1136666d) --- ...-extra-ies-only-if-allowed-by-driver.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/network/services/hostapd/patches/992-nl80211-add-extra-ies-only-if-allowed-by-driver.patch diff --git a/package/network/services/hostapd/patches/992-nl80211-add-extra-ies-only-if-allowed-by-driver.patch b/package/network/services/hostapd/patches/992-nl80211-add-extra-ies-only-if-allowed-by-driver.patch new file mode 100644 index 00000000000000..c7b595da57dd54 --- /dev/null +++ b/package/network/services/hostapd/patches/992-nl80211-add-extra-ies-only-if-allowed-by-driver.patch @@ -0,0 +1,62 @@ +From: David Bauer +To: hostap@lists.infradead.org +Cc: =?utf-8?q?=C3=89tienne_Morice?= +Subject: [PATCH] nl80211: add extra-ies only if allowed by driver +Date: Sun, 30 Jan 2022 20:22:00 +0100 +Message-Id: <20220130192200.10883-1-mail@david-bauer.net> +List-Id: + +Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl +based adapters. The reason for it is hostapd tries to install additional +IEs for scanning while the driver does not support this. + +The kernel indicates the maximum number of bytes for additional scan IEs +using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and +only add additional scan IEs in case the driver can accommodate these +additional IEs. + +Reported-by: Étienne Morice +Tested-by: Étienne Morice +Signed-off-by: David Bauer +--- + src/drivers/driver.h | 3 +++ + src/drivers/driver_nl80211_capa.c | 4 ++++ + src/drivers/driver_nl80211_scan.c | 2 +- + 3 files changed, 8 insertions(+), 1 deletion(-) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -2283,6 +2283,9 @@ struct wpa_driver_capa { + /** Maximum number of iterations in a single scan plan */ + u32 max_sched_scan_plan_iterations; + ++ /** Maximum number of extra IE bytes for scans */ ++ u16 max_scan_ie_len; ++ + /** Whether sched_scan (offloaded scanning) is supported */ + int sched_scan_supported; + +--- a/src/drivers/driver_nl80211_capa.c ++++ b/src/drivers/driver_nl80211_capa.c +@@ -949,6 +949,10 @@ static int wiphy_info_handler(struct nl_ + nla_get_u32(tb[NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS]); + } + ++ if (tb[NL80211_ATTR_MAX_SCAN_IE_LEN]) ++ capa->max_scan_ie_len = ++ nla_get_u16(tb[NL80211_ATTR_MAX_SCAN_IE_LEN]); ++ + if (tb[NL80211_ATTR_MAX_MATCH_SETS]) + capa->max_match_sets = + nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]); +--- a/src/drivers/driver_nl80211_scan.c ++++ b/src/drivers/driver_nl80211_scan.c +@@ -222,7 +222,7 @@ nl80211_scan_common(struct i802_bss *bss + wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested"); + } + +- if (params->extra_ies) { ++ if (params->extra_ies && drv->capa.max_scan_ie_len >= params->extra_ies_len) { + wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs", + params->extra_ies, params->extra_ies_len); + if (nla_put(msg, NL80211_ATTR_IE, params->extra_ies_len, From 592aacc3d9c08c5c61a0faa75729d6c27be80376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 19 Oct 2023 04:09:25 +0000 Subject: [PATCH 0590/1171] ci: add workflow for automated GitHub release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement a GitHub Actions workflow for automated project releases. The workflow triggers on Git tags, ensuring that a GitHub release is created whenever a new tag is pushed. That new release is going to be created in draft and pre-release mode and needs to be manually promoted to the proper release, once its decided, that its good enough and prepared. This is a start of a streamlined and consistent release process for GitHub, reducing manual intervention. Acked-by: Christian Marangi Signed-off-by: Petr Štetiar (cherry picked from commit 280d9dd75874ef4c4e2407366eda987cda8efd25) --- .github/workflows/github-release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/github-release.yml diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 00000000000000..55d01f85cbba2d --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,24 @@ +name: Create GitHub release + +permissions: + contents: write + +on: + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + prerelease: true From 250ab7b7a5349626e16b49721ff08e82cf79a793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 1 Nov 2023 16:49:20 +0100 Subject: [PATCH 0591/1171] build: fix pkg-config detection when inside of a nix-shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The output of command_all when inside a nix-shell looks like the below where /usr does not match: ➜ scripts/command_all.sh pkg-config /nix/store/ifr6srqgpvygd5vp14748d109ri31isv-pkg-config-wrapper-0.29.2/bin/pkg-config Signed-off-by: Sandro Jäckel (cherry picked from commit 86ca7199dfb132042ce3110acef23d74f4ef14a7) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c325034bb9da4f..9bdb03a443ff85 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir world: -DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1) +DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -e '/usr' -e '/nix/store' -m 1) export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH) From 8ed934f3719fe679f5cf78ee7c82f236d40ad463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Veronese?= Date: Mon, 2 Oct 2023 22:17:09 +0200 Subject: [PATCH 0592/1171] uboot-mediatek: fix global pll clock override on mtk_spim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With patch 101-03-spi-mtk_spim-get-spi-clk-rate-only-once.patch a new system to calculate the SPI clocks has been added. Unfortunately, the do_div macro overrides the global priv->pll_clk_rate field. This will cause to have a reduced clock rate on each subsequent SPI call. Signed-off-by: Valerio 'ftp21' Mancini Signed-off-by: Nicolò Veronese (cherry picked from commit 8849ccb9957e69d85c93ad4b58400573a181ad18) --- ...im-prevent-global-pll-clock-override.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/131-spi-mtk_spim-prevent-global-pll-clock-override.patch diff --git a/package/boot/uboot-mediatek/patches/131-spi-mtk_spim-prevent-global-pll-clock-override.patch b/package/boot/uboot-mediatek/patches/131-spi-mtk_spim-prevent-global-pll-clock-override.patch new file mode 100644 index 00000000000000..c4e0fff921f453 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/131-spi-mtk_spim-prevent-global-pll-clock-override.patch @@ -0,0 +1,47 @@ +From 41f225dae30ea6ddcff10f120a9e732f994d3a07 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nicol=C3=B2=20Veronese?= +Date: Tue, 3 Oct 2023 23:46:52 +0200 +Subject: [PATCH] spi: mtk_spim: prevent global pll clock override +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With commit 793e6230118032a099ec42a1ea67f434721edcc0 + a new system to calculate the SPI clocks has been added. + +Unfortunately, the do_div macro overrides the global + priv->pll_clk_rate field. This will cause to have a reduced + clock rate on each subsequent SPI call. + +Signed-off-by: Valerio 'ftp21' Mancini +Signed-off-by: Nicolò Veronese +--- + drivers/spi/mtk_spim.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/spi/mtk_spim.c ++++ b/drivers/spi/mtk_spim.c +@@ -409,7 +409,7 @@ static int mtk_spim_transfer_wait(struct + { + struct udevice *bus = dev_get_parent(slave->dev); + struct mtk_spim_priv *priv = dev_get_priv(bus); +- u32 sck_l, sck_h, clk_count, reg; ++ u32 pll_clk, sck_l, sck_h, clk_count, reg; + ulong us = 1; + int ret = 0; + +@@ -418,11 +418,12 @@ static int mtk_spim_transfer_wait(struct + else + clk_count = op->data.nbytes; + ++ pll_clk = priv->pll_clk_rate; + sck_l = readl(priv->base + SPI_CFG2_REG) >> SPI_CFG2_SCK_LOW_OFFSET; + sck_h = readl(priv->base + SPI_CFG2_REG) & SPI_CFG2_SCK_HIGH_MASK; +- do_div(priv->pll_clk_rate, sck_l + sck_h + 2); ++ do_div(pll_clk, sck_l + sck_h + 2); + +- us = CLK_TO_US(priv->pll_clk_rate, clk_count * 8); ++ us = CLK_TO_US(pll_clk, clk_count * 8); + us += 1000 * 1000; /* 1s tolerance */ + + if (us > UINT_MAX) From 610ae4d344bd283e5e77cbfda7bb28ccb9e99263 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Tue, 24 Oct 2023 17:21:27 +0100 Subject: [PATCH 0593/1171] odhcpd: Bump to latest commits d8118f6 config: make sure timer is not on the timeouts list before freeing 4bbc6e7 add hostsfile output in addition to statefile Signed-off-by: Kevin Darbyshire-Bryant (cherry picked from commit 0221b860321ca2dd2bdc6339c01aa9adb3ddb34e) --- package/network/services/odhcpd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index 0eadcc9a5d5b20..ba6358f7795a86 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git -PKG_MIRROR_HASH:=e2e00e2bb6b7bacda5dcb713e4f9a4b1e316d75b140a4aa77145471bf6fe5c17 -PKG_SOURCE_DATE:=2023-06-24 -PKG_SOURCE_VERSION:=52112643308bb02a3b4fa2894dd7d4340ba4a237 +PKG_MIRROR_HASH:=9936331b64880260cf969cc5656e1e1a8b7dc0e0843d64621242c500a330b4d6 +PKG_SOURCE_DATE:=2023-10-24 +PKG_SOURCE_VERSION:=d8118f6e76e5519881f9a37137c3a06b3cb60fd2 PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 From ec54022549f90ba4b72ac4f089ee46510c7127e4 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 3 Nov 2023 22:05:04 +0100 Subject: [PATCH 0594/1171] mediatek: add label-mac for GL.iNet GL-MT3000 The MAC-address of gmac0 matches the one printed on the bottom label. Signed-off-by: David Bauer (cherry picked from commit ae500e62e2938e112ae1fc6aa7389e8c7b784b13) --- target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts index d916ee49ef6ffe..27e7797b3b24ca 100644 --- a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts +++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts @@ -7,6 +7,7 @@ compatible = "glinet,gl-mt3000", "mediatek,mt7981"; aliases { + label-mac-device = &gmac0; led-boot = &led_lightblue; led-failsafe = &led_lightblue; led-running = &led_white; From 7c43ced160a01ad2300bf103d457d9f2b20c2772 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Wed, 5 Jul 2023 13:56:16 +0200 Subject: [PATCH 0595/1171] libnl: add support for cli Some packages (like wavemon >= 0.9.4) depend on libnl-cli. Add support for this part of the lib. libnl-cli itself depends on libnl-genl and libnl-nf. On MIPS, this component adds 81kB. Signed-off-by: Koen Vandeputte (punctuation correction and reorganisation of commit message) Signed-off-by: Nick Hainke (cherry picked from commit 4bdd1c1a135b5c816a01055f3cc9fc158bbc840a) --- package/libs/libnl/Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 56549dcc0a24a2..f8c7437668f195 100644 --- a/package/libs/libnl/Makefile +++ b/package/libs/libnl/Makefile @@ -55,10 +55,16 @@ $(call Package/libnl/default) DEPENDS:=+libnl-route endef +define Package/libnl-cli +$(call Package/libnl/default) + TITLE:=CLI Netlink Library + DEPENDS:=+libnl-genl +libnl-nf +endef + define Package/libnl $(call Package/libnl/default) TITLE:=Full Netlink Library - DEPENDS:=+libnl-genl +libnl-route +libnl-nf + DEPENDS:=+libnl-genl +libnl-route +libnl-nf +libnl-cli endef define Package/libnl-core/description @@ -77,6 +83,10 @@ define Package/libnl-nf/description Netfilter Netlink Library Functions endef +define Package/libnl-cli/description + CLI Netlink Library Functions +endef + define Package/libnl/description Socket handling, connection management, sending and receiving of data, message construction and parsing, object caching system, etc. @@ -98,6 +108,7 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-cli-3.so $(1)/usr/lib/libnl-cli.so endef define Package/libnl-core/install @@ -120,6 +131,11 @@ define Package/libnl-nf/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so.* $(1)/usr/lib/ endef +define Package/libnl-cli/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-cli-3.so.* $(1)/usr/lib/ +endef + define Package/libnl/install : endef @@ -128,4 +144,5 @@ $(eval $(call BuildPackage,libnl-core)) $(eval $(call BuildPackage,libnl-genl)) $(eval $(call BuildPackage,libnl-route)) $(eval $(call BuildPackage,libnl-nf)) +$(eval $(call BuildPackage,libnl-cli)) $(eval $(call BuildPackage,libnl)) From cfadbc090c3f2f886eecb20b0272a32de4b74194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 6 Nov 2023 08:52:24 +0000 Subject: [PATCH 0596/1171] image: fix image generation within ImageBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes introduced in commit d604a07225c5 ("build: add CycloneDX SBOM JSON support") broke ImageBuilder: Cannot open '/openwrt-imagebuilder-ath79-generic.Linux-x86_64/tmp/.packageinfo': No such file or directory So lets fix it by wrapping the BOM generation behind condition of IB feature check. Fixes: #13881 Fixes: d604a07225c5 ("build: add CycloneDX SBOM JSON support") Signed-off-by: Petr Štetiar (cherry picked from commit c4259a658673cc1a02ed17bfa8e94de17de00ad2) --- include/image.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/image.mk b/include/image.mk index 3d5d6c161316d5..62e05b2567b6ff 100644 --- a/include/image.mk +++ b/include/image.mk @@ -277,11 +277,13 @@ endef define Image/Manifest $(call opkg,$(TARGET_DIR_ORIG)) list-installed > \ $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest +ifndef IB $(if $(CONFIG_JSON_CYCLONEDX_SBOM), \ $(SCRIPT_DIR)/package-metadata.pl imgcyclonedxsbom \ $(TMP_DIR)/.packageinfo \ $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest > \ $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).bom.cdx.json) +endif endef define Image/gzip-ext4-padded-squashfs From 3223f31fd384c938c1a5aa01fb496cec64498704 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 5 Nov 2023 23:05:24 +0100 Subject: [PATCH 0597/1171] mbedtls: Activate secp521r1 curve by default Activate the secp521r1 ecliptic curve by default. This curve is allowed by the CA/Browser forum, see https://cabforum.org/wp-content/uploads/CA-Browser-Forum-BR-v2.0.1-redlined.pdf#page=110 This increases the size of libmbedtls12_2.28.5-1_aarch64_generic.ipk by about 400 bytes: Without: 252,696 libmbedtls12_2.28.5-1_aarch64_generic.ipk With: 253,088 libmbedtls12_2.28.5-2_aarch64_generic.ipk Fixes: #13774 Acked-by: Koen Vandeputte Signed-off-by: Hauke Mehrtens (cherry picked from commit 3c17cdbc369d89ff6a7911c3acff2e493778f6c1) --- package/libs/mbedtls/Config.in | 2 +- package/libs/mbedtls/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/mbedtls/Config.in b/package/libs/mbedtls/Config.in index ffabd799d32b64..9fbe9f8a4a0ff4 100644 --- a/package/libs/mbedtls/Config.in +++ b/package/libs/mbedtls/Config.in @@ -104,7 +104,7 @@ config MBEDTLS_ECP_DP_SECP384R1_ENABLED config MBEDTLS_ECP_DP_SECP521R1_ENABLED bool "MBEDTLS_ECP_DP_SECP521R1_ENABLED" - default n + default y config MBEDTLS_ECP_DP_SECP192K1_ENABLED bool "MBEDTLS_ECP_DP_SECP192K1_ENABLED" diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 6f0b5162ebf6a0..246b21a8531a1f 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls PKG_VERSION:=2.28.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz From 04cde73d56ebe83f3452c6e4f07cc39e19e8ea38 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 29 Oct 2023 14:51:32 +0000 Subject: [PATCH 0598/1171] treewide: fix MERCUSYS brand spelling This commit fixes MERCUSYS brand spelling. The proper name is capitalized. Link: https://www.mercusys.com/ Link: https://github.com/torvalds/linux/blob/master/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c#L7779 Signed-off-by: Mikhail Zhilkin (cherry picked from commit 45a50a06fb3f39ea70936dd967a74e6e96f0cd89) --- target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts | 2 +- target/linux/mediatek/image/filogic.mk | 2 +- target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts | 2 +- target/linux/ramips/image/mt7621.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts index 8b8858ccef7962..4e8cd7cf115738 100644 --- a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts @@ -8,7 +8,7 @@ / { compatible = "mercusys,mr90x-v1", "mediatek,mt7986b"; - model = "Mercusys MR90X v1"; + model = "MERCUSYS MR90X v1"; aliases { serial0 = &uart0; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 46f8789b1750a5..146218602880d4 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -408,7 +408,7 @@ endef TARGET_DEVICES += mediatek_mt7988a-rfb define Device/mercusys_mr90x-v1 - DEVICE_VENDOR := Mercusys + DEVICE_VENDOR := MERCUSYS DEVICE_MODEL := MR90X v1 DEVICE_DTS := mt7986b-mercusys-mr90x-v1 DEVICE_DTS_DIR := ../dts diff --git a/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts b/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts index 245d130a1fcdab..ebfc370caf37ce 100644 --- a/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts +++ b/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts @@ -7,7 +7,7 @@ / { compatible = "mercusys,mr70x-v1", "mediatek,mt7621-soc"; - model = "Mercusys MR70X v1"; + model = "MERCUSYS MR70X v1"; aliases { led-boot = &led_power_green; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 962d7ef44017d1..57adcb7da2ee4d 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1526,7 +1526,7 @@ TARGET_DEVICES += mediatek_mt7621-eval-board define Device/mercusys_mr70x-v1 $(Device/dsa-migration) $(Device/tplink-safeloader) - DEVICE_VENDOR := Mercusys + DEVICE_VENDOR := MERCUSYS DEVICE_MODEL := MR70X DEVICE_VARIANT := v1 DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools From b209f456404ca0a163d0f060945e0b9c9f2517d4 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 23 Sep 2023 15:00:41 +0800 Subject: [PATCH 0599/1171] arm-trusted-firmware-mediatek: add emmc/spim-nand ddr4 build for mt7981 They will be used on CMCC RAX3000M. Signed-off-by: Tianling Shen (cherry picked from commit 7d8ffe941dd06a5625f6608516a86938260b01fc) --- .../arm-trusted-firmware-mediatek/Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index f77f3059112f2e..50ca21e60f59e4 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -94,6 +94,22 @@ define Trusted-Firmware-A/mt7622-sdmmc-2ddr DDR3_FLYBY:=1 endef +define Trusted-Firmware-A/mt7981-emmc-ddr4 + NAME:=MediaTek MT7981 (eMMC, DDR4) + BOOT_DEVICE:=emmc + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr4 +endef + +define Trusted-Firmware-A/mt7981-spim-nand-ddr4 + NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR4) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr4 +endef + define Trusted-Firmware-A/mt7981-nor-ddr3 NAME:=MediaTek MT7981 (SPI-NOR, DDR3) BOOT_DEVICE:=nor @@ -349,6 +365,8 @@ TFA_TARGETS:= \ mt7981-sdmmc-ddr3 \ mt7981-snand-ddr3 \ mt7981-spim-nand-ddr3 \ + mt7981-emmc-ddr4 \ + mt7981-spim-nand-ddr4 \ mt7986-emmc-ddr3 \ mt7986-nor-ddr3 \ mt7986-sdmmc-ddr3 \ From 429715a2374e702d053076e216cee5759a8e4d86 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 23 Sep 2023 15:02:32 +0800 Subject: [PATCH 0600/1171] uboot-mediatek: add support for CMCC RAX3000M The OEM U-Boot uses dual boot and signature verification which does not support by OpenWrt. So add a custom U-Boot build for OpenWrt. Signed-off-by: Tianling Shen (cherry picked from commit fddd735dd54ded7d26df156eaa8d1cc53e668efb) --- package/boot/uboot-mediatek/Makefile | 26 + .../patches/437-add-cmcc_rax3000m.patch | 697 ++++++++++++++++++ 2 files changed, 723 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 62199871e6b330..d566714bb4ae5f 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -200,6 +200,30 @@ define U-Boot/mt7629_rfb UBOOT_CONFIG:=mt7629_rfb endef +define U-Boot/mt7981_cmcc_rax3000m-emmc + NAME:=CMCC RAX3000M + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=cmcc_rax3000m + UBOOT_CONFIG:=mt7981_cmcc_rax3000m-emmc + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=emmc + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr4 +endef + +define U-Boot/mt7981_cmcc_rax3000m-nand + NAME:=CMCC RAX3000M + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=cmcc_rax3000m + UBOOT_CONFIG:=mt7981_cmcc_rax3000m-nand + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4 +endef + define U-Boot/mt7981_h3c_magic-nx30-pro NAME:=H3C Magic NX30 Pro BUILD_SUBTARGET:=filogic @@ -484,6 +508,8 @@ UBOOT_TARGETS := \ mt7628_rfb \ ravpower_rp-wd009 \ mt7629_rfb \ + mt7981_cmcc_rax3000m-emmc \ + mt7981_cmcc_rax3000m-nand \ mt7981_h3c_magic-nx30-pro \ mt7981_rfb-spim-nand \ mt7981_rfb-emmc \ diff --git a/package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch b/package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch new file mode 100644 index 00000000000000..26e0e30a996628 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch @@ -0,0 +1,697 @@ +--- /dev/null ++++ b/configs/mt7981_cmcc_rax3000m-emmc_defconfig +@@ -0,0 +1,175 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-cmcc-rax3000m-emmc" ++CONFIG_DEFAULT_ENV_FILE="cmcc_rax3000m-emmc_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-rax3000m-emmc.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_MMC=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MMC=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_USB=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_AHCI=y ++CONFIG_AHCI_PCI=y ++CONFIG_SCSI_AHCI=y ++CONFIG_SCSI=y ++CONFIG_CMD_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_MMC=y ++CONFIG_MMC_DEFAULT_DEV=1 ++CONFIG_MMC_HS200_SUPPORT=y ++CONFIG_MMC_MTK=y ++CONFIG_MMC_SUPPORTS_TUNING=y ++CONFIG_SUPPORT_EMMC_BOOT=y ++CONFIG_SPI=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_USB=y ++CONFIG_USB_HOST=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_ENV_OFFSET_REDUND=0x440000 ++CONFIG_ENV_SIZE=0x40000 ++CONFIG_ENV_SIZE_REDUND=0x40000 ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_SUPPORT_EMMC_BOOT=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_HEXDUMP=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_CMD_SF=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/configs/mt7981_cmcc_rax3000m-nand_defconfig +@@ -0,0 +1,175 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-cmcc-rax3000m-nand" ++CONFIG_DEFAULT_ENV_FILE="cmcc_rax3000m-nand_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-rax3000m-nand.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_AHCI=y ++CONFIG_AHCI_PCI=y ++CONFIG_SCSI_AHCI=y ++CONFIG_SCSI=y ++CONFIG_CMD_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_HEXDUMP=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/arch/arm/dts/mt7981-cmcc-rax3000m.dtsi +@@ -0,0 +1,85 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "CMCC RAX3000M"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ button-reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-mesh { ++ label = "mesh"; ++ linux,code = ; ++ linux,input-type = ; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ label = "green:status"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-1 { ++ label = "blue:status"; ++ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2 { ++ label = "red:status"; ++ gpios = <&gpio 35 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "2500base-x"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/arch/arm/dts/mt7981-cmcc-rax3000m-emmc.dts +@@ -0,0 +1,53 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++/dts-v1/; ++#include "mt7981-cmcc-rax3000m.dtsi" ++ ++/ { ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++}; ++ ++&mmc0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc0_pins_default>; ++ max-frequency = <26000000>; ++ bus-width = <8>; ++ cap-mmc-hw-reset; ++ vmmc-supply = <®_3p3v>; ++ non-removable; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ mmc0_pins_default: mmc0default { ++ mux { ++ function = "flash"; ++ groups = "emmc_45"; ++ }; ++ conf-cmd-dat { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO", ++ "SPI0_CS", "SPI0_HOLD", "SPI0_WP", ++ "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO"; ++ input-enable; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ conf-clk { ++ pins = "SPI1_CS"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ conf-rst { ++ pins = "PWM0"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/dts/mt7981-cmcc-rax3000m-nand.dts +@@ -0,0 +1,77 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++/dts-v1/; ++#include "mt7981-cmcc-rax3000m.dtsi" ++ ++&pinctrl { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "orig-env"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@160000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x7200000>; ++ }; ++ }; ++ }; ++}; +--- /dev/null ++++ b/cmcc_rax3000m-emmc_env +@@ -0,0 +1,55 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootargs=root=/dev/mmcblk0p65 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi ++bootconf=config-1#mt7981b-cmcc-rax3000m-emmc ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb ++bootled_pwr=red:status ++bootled_rec=blue:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) [eMMC] ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to eMMC.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to eMMC.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_emmc=run boot_production ; run boot_recovery ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2 ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size ++mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 ++part_default=production ++part_recovery=recovery ++reset_factory=eraseenv && reset ++emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol ++emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol ++emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0 ++emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800 ++emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol ++emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol ++_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" +--- /dev/null ++++ b/cmcc_rax3000m-nand_env +@@ -0,0 +1,56 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootconf=config-1#mt7981b-cmcc-rax3000m-nand ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-cmcc_rax3000m-nand-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-cmcc_rax3000m-nand-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb ++bootled_pwr=red:status ++bootled_rec=blue:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) [SPI-NAND] ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++part_default=production ++part_recovery=recovery ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" From d3c193525e6210da2834050e92a077d408381320 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 23 Sep 2023 15:04:09 +0800 Subject: [PATCH 0601/1171] mediatek: add CMCC RAX3000M support Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: 64GB eMMC or 128 MB SPI-NAND RAM: 512MB Ethernet: 4x 10/100/1000 Mbps Switch: MediaTek MT7531AE WiFi: MediaTek MT7976C Button: Reset, Mesh Power: DC 12V 1A - UART: 3.3v, 115200n8 -------------------------- | Layout | | ----------------- | | 4 | GND TX VCC RX | <= | | ----------------- | -------------------------- Gain SSH access: 1. Login into web interface, and download the configuration. 2. Enter fakeroot, decompress the configuration: tar -zxf cfg_export_config_file.conf 3. Edit 'etc/config/dropbear', set 'enable' to '1'. 4. Edit 'etc/shadow', update (remove) root password: 'root::19523:0:99999:7:::' 5. Repack 'etc' directory: tar -zcf cfg_export_config_file.conf etc/ * If you find an error about 'etc/wireless/mediatek/DBDC_card0.dat', just ignore it. 6. Upload new configuration via web interface, now you can SSH to RAX3000M. Check stroage type: Check the label on the back of the device: "CH EC CMIIT ID: xxxx" is eMMC version "CH CMIIT ID: xxxx" is NAND version eMMC Flash instructions: 1. SSH to RAX3000M, and backup everything, especially 'factory' part. ('data' partition can be ignored, it's useless.) 2. Write new GPT table: dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-gpt.bin of=/dev/mmcblk0 bs=512 seek=0 count=34 conv=fsync 3. Erase and write new BL2: echo 0 > /sys/block/mmcblk0boot0/force_ro dd if=/dev/zero of=/dev/mmcblk0boot0 bs=512 count=8192 conv=fsync dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-preloader.bin of=/dev/mmcblk0boot0 bs=512 conv=fsync 4. Erase and write new FIP: dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=13312 count=8192 conv=fsync dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-bl31-uboot.fip of=/dev/mmcblk0 bs=512 seek=13312 conv=fsync 5. Set static IP on your PC: IP 192.168.1.254, GW 192.168.1.1 6. Serve OpenWrt initramfs image using TFTP server. 7. Cut off the power and re-engage, wait for TFTP recovery to complete. 8. After OpenWrt has booted, perform sysupgrade. 9. Additionally, if you want to have eMMC recovery boot feature: (Don't worry! You will always have TFTP recovery boot feature.) dd if=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb of=/dev/mmcblk0p4 bs=512 conv=fsync NAND Flash instructions: 1. SSH to RAX3000M, and backup everything, especially 'Factory' part. 2. Erase and write new BL2: mtd erase BL2 mtd write openwrt-mediatek-filogic-cmcc_rax3000m-nand-preloader.bin BL2 3. Erase and write new FIP: mtd erase FIP mtd write openwrt-mediatek-filogic-cmcc_rax3000m-nand-bl31-uboot.fip FIP 4. Set static IP on your PC: IP 192.168.1.254, GW 192.168.1.1 5. Serve OpenWrt initramfs image using TFTP server. 6. Cut off the power and re-engage, wait for TFTP recovery to complete. 7. After OpenWrt has booted, erase UBI volumes: ubidetach -p /dev/mtd0 ubiformat -y /dev/mtd0 ubiattach -p /dev/mtd0 8. Create new ubootenv volumes: ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB 9. Additionally, if you want to have NAND recovery boot feature: (Don't worry! You will always have TFTP recovery boot feature.) ubimkvol /dev/ubi0 -n 2 -N recovery -s 20MiB ubiupdatevol /dev/ubi0_2 openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb 10. Perform sysupgrade. Signed-off-by: Tianling Shen (cherry picked from commit 423186d7d8b4f23aee91fca4f1774a195eba00d8) [rebased to 23.05] Signed-off-by: Tianling Shen --- .../uboot-envtools/files/mediatek_filogic | 17 ++ .../dts/mt7981b-cmcc-rax3000m-emmc.dtso | 43 +++++ .../dts/mt7981b-cmcc-rax3000m-nand.dtso | 128 ++++++++++++++ .../mediatek/dts/mt7981b-cmcc-rax3000m.dts | 156 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 10 ++ .../etc/hotplug.d/firmware/11-mt76-caldata | 11 ++ .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 11 ++ .../base-files/lib/upgrade/platform.sh | 18 +- target/linux/mediatek/image/filogic.mk | 33 ++++ 9 files changed, 425 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso create mode 100644 target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso create mode 100644 target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index f13beed526d1da..6e39fac65742cb 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -37,6 +37,23 @@ bananapi,bpi-r3) ;; esac ;; +cmcc,rax3000m) + case "$(cmdline_get_var root)" in + /dev/mmc*) + local envdev=$(find_mmc_part "ubootenv" "mmcblk0") + ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1" + ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1" + ;; + *) + . /lib/upgrade/nand.sh + local envubi=$(nand_find_ubi ubi) + local envdev=/dev/$(nand_find_volume $envubi ubootenv) + local envdev2=/dev/$(nand_find_volume $envubi ubootenv2) + ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1" + ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1" + ;; + esac + ;; glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso new file mode 100644 index 00000000000000..c1c9c75c271ae3 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +/plugin/; + +/ { + compatible = "cmcc,rax3000m", "mediatek,mt7981"; + + fragment@0 { + target = <&mmc0>; + __overlay__ { + bus-width = <8>; + max-frequency = <26000000>; + no-sd; + no-sdio; + non-removable; + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + vmmc-supply = <®_3p3v>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&pio>; + __overlay__ { + mmc0_pins_default: mmc0-pins { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-uhs-pins { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso new file mode 100644 index 00000000000000..ff94a550fd624f --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +/plugin/; + +/ { + compatible = "cmcc,rax3000m", "mediatek,mt7981"; + + fragment@0 { + target = <&gmac0>; + __overlay__ { + nvmem-cells = <&macaddr_factory_2a 0>; + nvmem-cell-names = "mac-address"; + }; + }; + + fragment@1 { + target = <&gmac1>; + __overlay__ { + nvmem-cells = <&macaddr_factory_24 0>; + nvmem-cell-names = "mac-address"; + }; + }; + + fragment@2 { + target = <&pio>; + __overlay__ { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + }; + }; + }; + + fragment@3 { + target = <&spi0>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bl2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + + factory: partition@180000 { + label = "factory"; + reg = <0x180000 0x200000>; + read-only; + + compatible = "nvmem-cells"; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_24: macaddr@24 { + compatible = "mac-base"; + reg = <0x24 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_factory_2a: macaddr@2a { + compatible = "mac-base"; + reg = <0x2a 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "fip"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x7200000>; + }; + }; + }; + }; + }; + + fragment@4 { + target = <&wifi>; + __overlay__ { + mediatek,mtd-eeprom = <&factory 0x0>; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts new file mode 100644 index 00000000000000..e9c850e85b0172 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Copyright (C) 2023 Tianling Shen + */ + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "CMCC RAX3000M"; + compatible = "cmcc,rax3000m", "mediatek,mt7981"; + + aliases { + led-boot = &red_led; + led-failsafe = &red_led; + led-running = &green_led; + led-upgrade = &green_led; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + button-mesh { + label = "mesh"; + linux,code = ; + linux,input-type = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + green_led: led-0 { + label = "green:status"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-1 { + label = "blue:status"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + red_led: led-2 { + label = "red:status"; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan3"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan1"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; +}; + +&xhci { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 60c0bbc7e9a1b0..93e69e5c857248 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -28,6 +28,7 @@ mediatek_setup_interfaces() glinet,gl-mt3000) ucidef_set_interfaces_lan_wan eth1 eth0 ;; + cmcc,rax3000m|\ h3c,magic-nx30-pro) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 ;; @@ -83,6 +84,15 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + cmcc,rax3000m) + case "$(cmdline_get_var root)" in + /dev/mmc*) + wan_mac=$(mmc_get_mac_binary factory 0x2a) + lan_mac=$(mmc_get_mac_binary factory 0x24) + label_mac=$wan_mac + ;; + esac + ;; h3c,magic-nx30-pro) wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr) lan_mac=$(macaddr_add "$wan_mac" 1) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index c3d7c099740546..57e56705436272 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -14,6 +14,17 @@ case "$FIRMWARE" in ;; esac ;; +"mediatek/mt7981_eeprom_mt7976_dbdc.bin") + case "$board" in + cmcc,rax3000m) + case "$(cmdline_get_var root)" in + /dev/mmc*) + caldata_extract_mmc "factory" 0x0 0x1000 + ;; + esac + ;; + esac + ;; "mediatek/mt7986_eeprom_mt7976.bin") case "$board" in acer,predator-w6) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index ebf76640c876ec..a1d51a548ea98a 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -30,6 +30,17 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress ;; + cmcc,rax3000m) + case "$(cmdline_get_var root)" in + /dev/mmc*) + addr=$(mmc_get_mac_binary factory 0xa) + ;; + *) + addr=$(mtd_get_mac_binary factory 0xa) + ;; + esac + [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress + ;; cudy,wr3000-v1) addr=$(mtd_get_mac_binary bdinfo 0xde00) # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index c492f834bfdda0..201fd0cb5e813f 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -81,6 +81,18 @@ platform_do_upgrade() { ;; esac ;; + cmcc,rax3000m) + case "$(cmdline_get_var root)" in + /dev/mmc*) + CI_KERNPART="production" + emmc_do_upgrade "$1" + ;; + *) + CI_KERNPART="fit" + nand_do_upgrade "$1" + ;; + esac + ;; cudy,wr3000-v1) default_do_upgrade "$1" ;; @@ -121,7 +133,8 @@ platform_check_image() { [ "$#" -gt 1 ] && return 1 case "$board" in - bananapi,bpi-r3) + bananapi,bpi-r3|\ + cmcc,rax3000m) [ "$magic" != "d00dfeed" ] && { echo "Invalid image type." return 1 @@ -139,7 +152,8 @@ platform_check_image() { platform_copy_config() { case "$(board_name)" in - bananapi,bpi-r3) + bananapi,bpi-r3|\ + cmcc,rax3000m) case "$(cmdline_get_var root)" in /dev/mmc*) emmc_copy_config diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 146218602880d4..0f0f3119701787 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -172,6 +172,39 @@ define Device/bananapi_bpi-r3 endef TARGET_DEVICES += bananapi_bpi-r3 +define Device/cmcc_rax3000m + DEVICE_VENDOR := CMCC + DEVICE_MODEL := RAX3000M + DEVICE_DTS := mt7981b-cmcc-rax3000m + DEVICE_DTS_OVERLAY := mt7981b-cmcc-rax3000m-emmc mt7981b-cmcc-rax3000m-nand + DEVICE_DTS_DIR := ../dts + DEVICE_DTC_FLAGS := --pad 4096 + DEVICE_DTS_LOADADDR := 0x43f00000 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \ + e2fsprogs f2fsck mkf2fs + KERNEL_LOADADDR := 0x44000000 + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \ + pad-rootfs | append-metadata + ARTIFACTS := \ + emmc-gpt.bin emmc-preloader.bin emmc-bl31-uboot.fip \ + nand-preloader.bin nand-bl31-uboot.fip + ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc + ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr4 + ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-emmc + ARTIFACT/nand-preloader.bin := mt7981-bl2 spim-nand-ddr4 + ARTIFACT/nand-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-nand +endef +TARGET_DEVICES += cmcc_rax3000m + define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000 From f780cfb92f974c12232131137f2310b0c828cb18 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 7 Nov 2023 13:36:39 +0100 Subject: [PATCH 0602/1171] netifd: update to the latest version 383753dd65ae device/bridge: support passing extra vlans in the device_set_state call b6e75eafc1af device: send notifications for device events via ubus cab415c7aefd bridge: add auth-required bridge members with auth_status=0 if vlan is enabled 827a02f0343c bridge: add support for configuring vlans for auth=1,auth_status=false 40ed7363caf2 device: fix build error on 32 bit systems 516ab774cc16 system-linux: fix race condition on bringing up wireless devices Signed-off-by: Felix Fietkau (cherry picked from commit 41d7439af5a40a71a0deb2075fa133b61b0e478a) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 44d3a98d8fe45f..8d9795c0685ddf 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-10-20 -PKG_SOURCE_VERSION:=5590a80e2566d378be955f61c287a63fb3bdf329 -PKG_MIRROR_HASH:=eef792b4e9fa7a5227cf8c2ec4ed5e6558dd04c119cd9f97561923821fd1aa92 +PKG_SOURCE_DATE:=2023-11-07 +PKG_SOURCE_VERSION:=516ab774cc16d4b04b3b17a067cbf2649f1adaeb +PKG_MIRROR_HASH:=76dcc7988d8ade7e8a80af8a79e9b509093c5eea9e785b0e5f7aef845787118a PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From bbfb920e99672564ea244769e6636fab65511703 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 8 Nov 2023 10:45:55 +0100 Subject: [PATCH 0603/1171] wifi: fix applying mesh parameters when wpa_supplicant is in use Apply them directly using nl80211 after setting up the interface. Use the same method in wdev.uc as well Signed-off-by: Felix Fietkau (cherry picked from commit 531314260d2e50e984e1671f88662b469dffb16e) --- .../network/services/hostapd/files/common.uc | 52 ++++++++++++++++++- .../network/services/hostapd/files/wdev.uc | 26 +--------- .../services/hostapd/files/wpa_supplicant.uc | 19 ++++++- 3 files changed, 71 insertions(+), 26 deletions(-) diff --git a/package/network/services/hostapd/files/common.uc b/package/network/services/hostapd/files/common.uc index ccffe3eb436219..8399d3ff960abc 100644 --- a/package/network/services/hostapd/files/common.uc +++ b/package/network/services/hostapd/files/common.uc @@ -10,6 +10,36 @@ const iftypes = { monitor: nl80211.const.NL80211_IFTYPE_MONITOR, }; +const mesh_params = { + mesh_retry_timeout: "retry_timeout", + mesh_confirm_timeout: "confirm_timeout", + mesh_holding_timeout: "holding_timeout", + mesh_max_peer_links: "max_peer_links", + mesh_max_retries: "max_retries", + mesh_ttl: "ttl", + mesh_element_ttl: "element_ttl", + mesh_auto_open_plinks: "auto_open_plinks", + mesh_hwmp_max_preq_retries: "hwmp_max_preq_retries", + mesh_path_refresh_time: "path_refresh_time", + mesh_min_discovery_timeout: "min_discovery_timeout", + mesh_hwmp_active_path_timeout: "hwmp_active_path_timeout", + mesh_hwmp_preq_min_interval: "hwmp_preq_min_interval", + mesh_hwmp_net_diameter_traversal_time: "hwmp_net_diam_trvs_time", + mesh_hwmp_rootmode: "hwmp_rootmode", + mesh_hwmp_rann_interval: "hwmp_rann_interval", + mesh_gate_announcements: "gate_announcements", + mesh_sync_offset_max_neighor: "sync_offset_max_neighbor", + mesh_rssi_threshold: "rssi_threshold", + mesh_hwmp_active_path_to_root_timeout: "hwmp_path_to_root_timeout", + mesh_hwmp_root_interval: "hwmp_root_interval", + mesh_hwmp_confirmation_interval: "hwmp_confirmation_interval", + mesh_awake_window: "awake_window", + mesh_plink_timeout: "plink_timeout", + mesh_fwding: "forwarding", + mesh_power_mode: "power_mode", + mesh_nolearn: "nolearn" +}; + function wdev_remove(name) { nl80211.request(nl80211.const.NL80211_CMD_DEL_INTERFACE, 0, { dev: name }); @@ -94,6 +124,26 @@ function wdev_create(phy, name, data) return null; } +function wdev_set_mesh_params(name, data) +{ + let mesh_cfg = {}; + + for (let key in mesh_params) { + let val = data[key]; + if (val == null) + continue; + mesh_cfg[mesh_params[key]] = int(val); + } + + if (!length(mesh_cfg)) + return null; + + nl80211.request(nl80211.const.NL80211_CMD_SET_MESH_CONFIG, 0, + { dev: name, mesh_params: mesh_cfg }); + + return nl80211.error(); +} + function phy_sysfs_file(phy, name) { return trim(readfile(`/sys/class/ieee80211/${phy}/${name}`)); @@ -315,4 +365,4 @@ function vlist_new(cb) { }, vlist_proto); } -export { wdev_remove, wdev_create, is_equal, vlist_new, phy_is_fullmac, phy_open }; +export { wdev_remove, wdev_create, wdev_set_mesh_params, is_equal, vlist_new, phy_is_fullmac, phy_open }; diff --git a/package/network/services/hostapd/files/wdev.uc b/package/network/services/hostapd/files/wdev.uc index cf438f7715fc67..800bb32d24ffcb 100644 --- a/package/network/services/hostapd/files/wdev.uc +++ b/package/network/services/hostapd/files/wdev.uc @@ -1,6 +1,6 @@ #!/usr/bin/env ucode 'use strict'; -import { vlist_new, is_equal, wdev_create, wdev_remove, phy_open } from "/usr/share/hostap/common.uc"; +import { vlist_new, is_equal, wdev_create, wdev_set_mesh_params, wdev_remove, phy_open } from "/usr/share/hostap/common.uc"; import { readfile, writefile, basename, readlink, glob } from "fs"; let libubus = require("ubus"); @@ -9,17 +9,6 @@ let phy = shift(ARGV); let command = shift(ARGV); let phydev; -const mesh_params = [ - "mesh_retry_timeout", "mesh_confirm_timeout", "mesh_holding_timeout", "mesh_max_peer_links", - "mesh_max_retries", "mesh_ttl", "mesh_element_ttl", "mesh_hwmp_max_preq_retries", - "mesh_path_refresh_time", "mesh_min_discovery_timeout", "mesh_hwmp_active_path_timeout", - "mesh_hwmp_preq_min_interval", "mesh_hwmp_net_diameter_traversal_time", "mesh_hwmp_rootmode", - "mesh_hwmp_rann_interval", "mesh_gate_announcements", "mesh_sync_offset_max_neighor", - "mesh_rssi_threshold", "mesh_hwmp_active_path_to_root_timeout", "mesh_hwmp_root_interval", - "mesh_hwmp_confirmation_interval", "mesh_awake_window", "mesh_plink_timeout", - "mesh_auto_open_plinks", "mesh_fwding", "mesh_power_mode" -]; - function iface_stop(wdev) { if (keep_devices[wdev.ifname]) @@ -60,19 +49,8 @@ function iface_start(wdev) push(cmd, key, wdev[key]); system(cmd); - cmd = ["iw", "dev", ifname, "set", "mesh_param" ]; - let len = length(cmd); - - for (let param in mesh_params) - if (wdev[param]) - push(cmd, param, wdev[param]); - - if (len == length(cmd)) - return; - - system(cmd); + wdev_set_mesh_params(ifname, wdev); } - } function iface_cb(new_if, old_if) diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc index cb5f41b1af3ac0..c3fd73dfee8d55 100644 --- a/package/network/services/hostapd/files/wpa_supplicant.uc +++ b/package/network/services/hostapd/files/wpa_supplicant.uc @@ -1,6 +1,6 @@ let libubus = require("ubus"); import { open, readfile } from "fs"; -import { wdev_create, wdev_remove, is_equal, vlist_new, phy_open } from "common"; +import { wdev_create, wdev_set_mesh_params, wdev_remove, is_equal, vlist_new, phy_open } from "common"; let ubus = libubus.connect(); @@ -316,6 +316,23 @@ return { } iface_hostapd_notify(phy, ifname, iface, state); + + if (state != "COMPLETED") + return; + + let phy_data = wpas.data.config[phy]; + if (!phy_data) + return; + + let iface_data = phy_data.data[ifname]; + if (!iface_data) + return; + + let wdev_config = iface_data.config; + if (!wdev_config || wdev_config.mode != "mesh") + return; + + wdev_set_mesh_params(ifname, wdev_config); }, event: function(ifname, iface, ev, info) { let phy = wpas.data.iface_phy[ifname]; From 6de0e0d01aeafc1903396cf3265b5a444d132a8a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 8 Nov 2023 11:20:41 +0100 Subject: [PATCH 0604/1171] hostapd: use rtnl to set up interfaces In wpa_supplicant, set up wlan interfaces before adding them Signed-off-by: Felix Fietkau (cherry picked from commit c2a30b6e01aa756cd7d50c578ab4344c725ecc59) --- package/network/services/hostapd/files/common.uc | 7 ++++++- package/network/services/hostapd/files/wdev.uc | 6 +++--- package/network/services/hostapd/files/wpa_supplicant.uc | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package/network/services/hostapd/files/common.uc b/package/network/services/hostapd/files/common.uc index 8399d3ff960abc..4c33779af935e1 100644 --- a/package/network/services/hostapd/files/common.uc +++ b/package/network/services/hostapd/files/common.uc @@ -144,6 +144,11 @@ function wdev_set_mesh_params(name, data) return nl80211.error(); } +function wdev_set_up(name, up) +{ + rtnl.request(rtnl.const.RTM_SETLINK, 0, { dev: name, change: 1, flags: up ? 1 : 0 }); +} + function phy_sysfs_file(phy, name) { return trim(readfile(`/sys/class/ieee80211/${phy}/${name}`)); @@ -365,4 +370,4 @@ function vlist_new(cb) { }, vlist_proto); } -export { wdev_remove, wdev_create, wdev_set_mesh_params, is_equal, vlist_new, phy_is_fullmac, phy_open }; +export { wdev_remove, wdev_create, wdev_set_mesh_params, wdev_set_up, is_equal, vlist_new, phy_is_fullmac, phy_open }; diff --git a/package/network/services/hostapd/files/wdev.uc b/package/network/services/hostapd/files/wdev.uc index 800bb32d24ffcb..ff4d629fd64d0e 100644 --- a/package/network/services/hostapd/files/wdev.uc +++ b/package/network/services/hostapd/files/wdev.uc @@ -1,6 +1,6 @@ #!/usr/bin/env ucode 'use strict'; -import { vlist_new, is_equal, wdev_create, wdev_set_mesh_params, wdev_remove, phy_open } from "/usr/share/hostap/common.uc"; +import { vlist_new, is_equal, wdev_create, wdev_set_mesh_params, wdev_remove, wdev_set_up, phy_open } from "/usr/share/hostap/common.uc"; import { readfile, writefile, basename, readlink, glob } from "fs"; let libubus = require("ubus"); @@ -22,7 +22,7 @@ function iface_start(wdev) let ifname = wdev.ifname; if (readfile(`/sys/class/net/${ifname}/ifindex`)) { - system([ "ip", "link", "set", "dev", ifname, "down" ]); + wdev_set_up(ifname, false); wdev_remove(ifname); } let wdev_config = {}; @@ -31,7 +31,7 @@ function iface_start(wdev) if (!wdev_config.macaddr && wdev.mode != "monitor") wdev_config.macaddr = phydev.macaddr_next(); wdev_create(phy, ifname, wdev_config); - system([ "ip", "link", "set", "dev", ifname, "up" ]); + wdev_set_up(ifname, true); if (wdev.freq) system(`iw dev ${ifname} set freq ${wdev.freq} ${wdev.htmode}`); if (wdev.mode == "adhoc") { diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc index c3fd73dfee8d55..d624f27cddc1de 100644 --- a/package/network/services/hostapd/files/wpa_supplicant.uc +++ b/package/network/services/hostapd/files/wpa_supplicant.uc @@ -1,6 +1,6 @@ let libubus = require("ubus"); import { open, readfile } from "fs"; -import { wdev_create, wdev_set_mesh_params, wdev_remove, is_equal, vlist_new, phy_open } from "common"; +import { wdev_create, wdev_set_mesh_params, wdev_remove, is_equal, wdev_set_up, vlist_new, phy_open } from "common"; let ubus = libubus.connect(); @@ -40,6 +40,7 @@ function iface_start(phydev, iface, macaddr_list) let ret = wdev_create(phy, ifname, wdev_config); if (ret) wpas.printf(`Failed to create device ${ifname}: ${ret}`); + wdev_set_up(ifname, true); wpas.add_iface(iface.config); iface.running = true; } From 6fd16b0d2717a750368cc02fab3a10287c7e08f4 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 5 Nov 2023 23:05:24 +0100 Subject: [PATCH 0605/1171] px5g-mbedtls: Fix permission of private key Store the private key with read and write permission for the user only and not with read permissions for everyone. This converts the write_file() function from fopen() to open() because open allows to specify the permission mask of the newly created file. It also adds and fixes some existing error handling. OpenSSL does this in the same way already. With this change it looks like this: root@OpenWrt:/# ls -al /etc/uhttpd.crt /etc/uhttpd.key -rw-r--r-- 1 root root 519 Nov 6 22:58 /etc/uhttpd.crt -rw------- 1 root root 121 Nov 6 22:58 /etc/uhttpd.key Signed-off-by: Hauke Mehrtens (cherry picked from commit 929c9a58c9a17a3ca8d2a3be0c5dc4ac98e848e2) --- package/utils/px5g-mbedtls/Makefile | 2 +- package/utils/px5g-mbedtls/px5g-mbedtls.c | 35 +++++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/package/utils/px5g-mbedtls/Makefile b/package/utils/px5g-mbedtls/Makefile index 6de5e55d0666c0..14c9f684a96d93 100644 --- a/package/utils/px5g-mbedtls/Makefile +++ b/package/utils/px5g-mbedtls/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=px5g-mbedtls -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_LICENSE:=LGPL-2.1 PKG_BUILD_FLAGS:=no-mips16 diff --git a/package/utils/px5g-mbedtls/px5g-mbedtls.c b/package/utils/px5g-mbedtls/px5g-mbedtls.c index 4e0a73ab0a7034..85abe7dc73febf 100644 --- a/package/utils/px5g-mbedtls/px5g-mbedtls.c +++ b/package/utils/px5g-mbedtls/px5g-mbedtls.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -55,10 +56,13 @@ static int _urandom(void *ctx, unsigned char *out, size_t len) return 0; } -static void write_file(const char *path, int len, bool pem) +static void write_file(const char *path, size_t len, bool pem, bool cert) { - FILE *f = stdout; + mode_t mode = S_IRUSR | S_IWUSR; const char *buf_start = buf; + int fd = STDERR_FILENO; + ssize_t written; + int err; if (!pem) buf_start += sizeof(buf) - len; @@ -67,17 +71,30 @@ static void write_file(const char *path, int len, bool pem) fprintf(stderr, "No data to write\n"); exit(1); } + + if (cert) + mode |= S_IRGRP | S_IROTH; - if (!f) { + if (path) + fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode); + + if (fd < 0) { fprintf(stderr, "error: I/O error\n"); exit(1); } + written = write(fd, buf_start, len); + if (written != len) { + fprintf(stderr, "writing key failed with: %s\n", strerror(errno)); + exit(1); + } + err = fsync(fd); + if (err < 0) { + fprintf(stderr, "syncing key failed with: %s\n", strerror(errno)); + exit(1); + } if (path) - f = fopen(path, "w"); - - fwrite(buf_start, 1, len, f); - fclose(f); + close(fd); } static mbedtls_ecp_group_id ecp_curve(const char *name) @@ -110,7 +127,7 @@ static void write_key(mbedtls_pk_context *key, const char *path, bool pem) len = 0; } - write_file(path, len, pem); + write_file(path, len, pem, false); } static void gen_key(mbedtls_pk_context *key, bool rsa, int ksize, int exp, @@ -301,7 +318,7 @@ int selfsigned(char **arg) return 1; } } - write_file(certpath, len, pem); + write_file(certpath, len, pem, true); mbedtls_x509write_crt_free(&cert); mbedtls_mpi_free(&serial); From 5106f554bb9324be88c9bfb8bc2105ce098f359c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 7 Nov 2023 00:33:38 +0100 Subject: [PATCH 0606/1171] px5g-wolfssl: Fix permission of private key Store the private key with read and write permission for the user only and not with read permissions for everyone. This converts the write_file() function from fopen() to open() because open allows to specify the permission mask of the newly created file. It also adds and fixes some existing error handling. OpenSSL does this in the same way already. With this change it looks like this: root@OpenWrt:/# ls -al /etc/uhttpd.* -rw-r--r-- 1 root root 749 Nov 6 23:14 /etc/uhttpd.crt -rw------- 1 root root 121 Nov 6 23:14 /etc/uhttpd.key Signed-off-by: Hauke Mehrtens (cherry picked from commit 6aad5ab0992fefd88ce612bc0484e0115a004572) --- package/utils/px5g-wolfssl/Makefile | 2 +- package/utils/px5g-wolfssl/px5g-wolfssl.c | 45 +++++++++++++++-------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/package/utils/px5g-wolfssl/Makefile b/package/utils/px5g-wolfssl/Makefile index 843f03fcc11391..ba208f6ca590de 100644 --- a/package/utils/px5g-wolfssl/Makefile +++ b/package/utils/px5g-wolfssl/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=px5g-wolfssl -PKG_RELEASE:=8.2 +PKG_RELEASE:=9 PKG_LICENSE:=GPL-2.0-or-later PKG_BUILD_FLAGS:=no-mips16 diff --git a/package/utils/px5g-wolfssl/px5g-wolfssl.c b/package/utils/px5g-wolfssl/px5g-wolfssl.c index cd04a41dfb85a5..755d370ba2d3b6 100644 --- a/package/utils/px5g-wolfssl/px5g-wolfssl.c +++ b/package/utils/px5g-wolfssl/px5g-wolfssl.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include #include @@ -24,27 +26,38 @@ enum { RSA_KEY_TYPE = 1, }; -int write_file(byte *buf, int bufSz, char *path) { - int ret; - FILE *file; +int write_file(byte *buf, int bufSz, char *path, bool cert) { + mode_t mode = S_IRUSR | S_IWUSR; + ssize_t written; + int err; + int fd; + + if (cert) + mode |= S_IRGRP | S_IROTH; + if (path) { - file = fopen(path, "wb"); - if (file == NULL) { + fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode); + if (fd < 0) { perror("Error opening file"); exit(1); } } else { - file = stdout; + fd = STDERR_FILENO; } - ret = (int)fwrite(buf, 1, bufSz, file); - if (path) { - fclose(file); + written = write(fd, buf, bufSz); + if (written != bufSz) { + perror("Error write file"); + exit(1); } - if (ret > 0) { - /* ret > 0 indicates a successful file write, set to zero for return */ - ret = 0; + err = fsync(fd); + if (err < 0) { + perror("Error fsync file"); + exit(1); } - return ret; + if (path) { + close(fd); + } + return 0; } int write_key(ecc_key *ecKey, RsaKey *rsaKey, int type, int keySz, char *fName, @@ -73,9 +86,9 @@ int write_key(ecc_key *ecKey, RsaKey *rsaKey, int type, int keySz, char *fName, fprintf(stderr, "DER to PEM failed: %d\n", ret); } pemSz = ret; - ret = write_file(pem, pemSz, fName); + ret = write_file(pem, pemSz, fName, false); } else { - ret = write_file(der, derSz, fName); + ret = write_file(der, derSz, fName, false); } return ret; } @@ -281,7 +294,7 @@ int selfsigned(WC_RNG *rng, char **arg) { } pemSz = ret; - ret = write_file(pemBuf, pemSz, certpath); + ret = write_file(pemBuf, pemSz, certpath, true); if (ret != 0) { fprintf(stderr, "Write Cert failed: %d\n", ret); return ret; From 2ef625e7696058208e129087d155ce65b10a3109 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 8 Nov 2023 16:44:38 +0100 Subject: [PATCH 0607/1171] mac80211: fix not set noscan option for wpa_supplicant noscan option was changed to hostapd_noscan but the entry in wpa_supplicant was never updated resulting in the noscan option actually never set. Signed-off-by: Christian Marangi (cherry picked from commit 1070fbce6e496da2dacf17c6e842a4369c4be71b) --- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 860609305f4539..1bf4db6e5f0554 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -940,7 +940,7 @@ mac80211_setup_supplicant() { if [ "$mode" = "sta" ]; then wpa_supplicant_add_network "$ifname" else - wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan" + wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$hostapd_noscan" fi wpa_supplicant_add_interface "$ifname" "$mode" From c9e8453de705818f45e306135b2ab6ce77ee8da3 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 8 Nov 2023 16:46:12 +0100 Subject: [PATCH 0608/1171] hostapd: fix broke noscan option for mesh noscan option for mesh was broken and actually never applied. This is caused by a typo where ssid->noscan value is check instead of conf->noscan resulting in the logic swapped and broken. Signed-off-by: Christian Marangi (cherry picked from commit 1b5ea2e199fcf391f88afd0322de449459399be4) --- package/network/services/hostapd/Makefile | 2 +- .../network/services/hostapd/patches/301-mesh-noscan.patch | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 73ec5e198dad50..f46c6275ef62d7 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index 6b5416f0ea57ec..0e654febd5781c 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -24,8 +24,8 @@ frequency); goto out_free; } -+ if (ssid->noscan) -+ conf->noscan = 1; ++ if (conf->noscan) ++ ssid->noscan = 1; if (ssid->mesh_basic_rates == NULL) { /* From 1cab0d74b3c56fa99cc0fcf6dcd13aff7cb174ba Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 8 Nov 2023 16:48:05 +0100 Subject: [PATCH 0609/1171] hostapd: permit also channel 7 for 2.5GHz to be set to HT40PLUS Also channel 7 for 2.4GHz can be set to HT40PLUS. Permit this and add it to the list of the channels. Signed-off-by: Christian Marangi (cherry picked from commit b1c7b1bd67ca40289dfb7acd03e12ce43618d548) --- package/network/services/hostapd/patches/301-mesh-noscan.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index 0e654febd5781c..c50ffa8490c4e4 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -45,7 +45,7 @@ unsigned int j; static const int ht40plus[] = { - 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 165, 173, -+ 1, 2, 3, 4, 5, 6, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 165, 173, ++ 1, 2, 3, 4, 5, 6, 7, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 165, 173, 184, 192 }; int ht40 = -1; From 85d1b43be4efc588da64f3266c1788131ea42a0d Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 8 Nov 2023 16:48:57 +0100 Subject: [PATCH 0610/1171] hostapd: permit 40MHz in 802.1s only also for 2.4GHz g/n with noscan Currently for 802.1s only, for wifi 2.4GHz in g/n mode, 40MHz is never permitted. This is probably due to the complexity of setting periodic check for the intolerant bit. When noscan option is set, we ignore the presence of the intoleran bit in near AP, so we can enable 40MHz and ignore any complex logic for checking. Fixes: #13112 Signed-off-by: Christian Marangi (cherry picked from commit 6c9ac57d58ab0d2c71fb51120a2166b7e0bd7183) --- .../services/hostapd/patches/301-mesh-noscan.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index c50ffa8490c4e4..ceb6d0c161f50b 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -58,6 +58,15 @@ u8 channel; bool is_6ghz; bool dfs_enabled = wpa_s->conf->country[0] && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); +@@ -3080,6 +3080,8 @@ void ibss_mesh_setup_freq(struct wpa_sup + freq->he_enabled = ibss_mesh_can_use_he(wpa_s, ssid, mode, + ieee80211_mode); + freq->channel = channel; ++ if (mode->mode == HOSTAPD_MODE_IEEE80211G && ssid->noscan) ++ ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan, dfs_enabled); + /* Setup higher BW only for 5 GHz */ + if (mode->mode == HOSTAPD_MODE_IEEE80211A) { + ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan, dfs_enabled); --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -1035,6 +1035,8 @@ struct wpa_ssid { From f5e9fd624d1c839ee31bd850379afe01311e5d40 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 9 Nov 2023 16:07:55 +0100 Subject: [PATCH 0611/1171] hostapd: refresh patches Refresh patches for hostapd using make package/hostapd/refresh. Signed-off-by: Christian Marangi (cherry picked from commit 05e516b12d4463e40df6d97a03bc6aa621c245f5) --- .../hostapd/patches/310-rescan_immediately.patch | 2 +- ...plicant-add-new-config-params-to-be-used-with.patch | 2 +- .../services/hostapd/patches/600-ubus_support.patch | 6 +++--- .../services/hostapd/patches/601-ucode_support.patch | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index e12b2059b3e38c..6e0244bca29236 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5767,7 +5767,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -5769,7 +5769,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index c6fe54efed0220..dc19553e26ea87 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4175,6 +4175,12 @@ static void wpas_start_assoc_cb(struct w +@@ -4177,6 +4177,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index bc80ef0e813ae1..a6ccf83331fe3e 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -348,7 +348,7 @@ CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7593,6 +7593,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7595,6 +7595,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -357,7 +357,7 @@ return wpa_s; } -@@ -7619,6 +7621,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -7621,6 +7623,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -366,7 +366,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -7965,8 +7969,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -7967,8 +7971,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index de182b985d97b3..23f535b6852ded 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -196,7 +196,7 @@ #ifdef CONFIG_BGSCAN if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid) -@@ -7594,6 +7595,7 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7596,6 +7597,7 @@ struct wpa_supplicant * wpa_supplicant_a #endif /* CONFIG_P2P */ wpas_ubus_add_bss(wpa_s); @@ -204,7 +204,7 @@ return wpa_s; } -@@ -7621,6 +7623,7 @@ int wpa_supplicant_remove_iface(struct w +@@ -7623,6 +7625,7 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -212,7 +212,7 @@ wpas_ubus_free_bss(wpa_s); /* Remove interface from the global list of interfaces */ -@@ -7931,6 +7934,7 @@ struct wpa_global * wpa_supplicant_init( +@@ -7933,6 +7936,7 @@ struct wpa_global * wpa_supplicant_init( eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0, wpas_periodic, global, NULL); @@ -220,7 +220,7 @@ return global; } -@@ -7969,12 +7973,8 @@ int wpa_supplicant_run(struct wpa_global +@@ -7971,12 +7975,8 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -233,7 +233,7 @@ return 0; } -@@ -8007,6 +8007,8 @@ void wpa_supplicant_deinit(struct wpa_gl +@@ -8009,6 +8009,8 @@ void wpa_supplicant_deinit(struct wpa_gl wpas_notify_supplicant_deinitialized(global); From 2285eb732a03fb122d2c990d7a206cb826cf0bb8 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 9 Nov 2023 12:40:22 +0100 Subject: [PATCH 0612/1171] ucode: update to Git HEAD (2023-11-07) 0352a33 uloop: support new interval and signal APIs 1468cc4 syntax: don't treat `as` and `from` as reserved keywords Signed-off-by: Jo-Philipp Wich (cherry picked from commit 551963662b3c2d4a740a447855da410c0f217152) --- package/utils/ucode/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index b62633492aa810..067e56e02de827 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2023-11-02 -PKG_SOURCE_VERSION:=cfb24ea4f12131dcefe4f1ede2f51d3d16b88dec -PKG_MIRROR_HASH:=f515a23ab438f92be5788c42b9f614a82e670de2df1c01cd63143cdc77fa24fe +PKG_SOURCE_DATE:=2023-11-07 +PKG_SOURCE_VERSION:=a6e75e02528e36f3610a7f0073453018336def2e +PKG_MIRROR_HASH:=e1a0f98ba865ed5911d5db3bfca55a2f1b825992bf5f7c7e324928d9412d7ae2 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From f6a9f0c57b02766d0062f3a5e290b22c356e439c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Nov 2023 13:46:57 +0100 Subject: [PATCH 0613/1171] ipq-wifi: update to Git HEAD (2023-11-10) c9db9d0b3027 ipq8074: add Asus RT-AX89X BDF 33154283e54a ipq8074: update RegDB in new submitted BDF 2b034415ac3d ipq40xx: add YYeTs LE1 BDF a9c253ebe926 ipq8074: add Netgear WAX620 Board file for Netgear WAX620, extracted from stock (bdwlan.b290) firmware and repacked. ec0960967999 qca-wireless: ipq40xx: add BDFs for ZTE MF287 57aa1b1562ac ipq8174: Add Linksys MX4200 52a1c2940605 ipq8074: add Netgear WAX630 Board file for Netgear WAX630. Extracted from stock (WAX630_BDF.bin) firmware and repacked. e7701b85d46d ipq8074: update RegDB in new submitted BDF cd04ab7f984f qcn9074: update RegDB in new submitted BDF f70fdf9438ae ipq8074: add Arcadyan AW1000 BDF 21c4d976b1e6 ipq8074: add CMCC RM2-6 BDF f92fa0a2bdcf ipq8074: add ZTE MF269 BDF 371d4dce9b9a ipq8074: add Yuncore AX880 BDF 0c2e810e71ed qcn9074: fix prpl Foundation Haze BDF for old mac80211 version Signed-off-by: Christian Marangi --- package/firmware/ipq-wifi/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 19dd61af7570e7..166db07a860605 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/version.mk PKG_NAME:=ipq-wifi -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2023-06-03 -PKG_SOURCE_VERSION:=cd9c30ca47b8e5388b770c523a7f6b8b969e2f92 -PKG_MIRROR_HASH:=45e623fcc512b514ade0f22e217275536aa8de4afba7dfdb11696482b8fa71a2 +PKG_SOURCE_DATE:=2023-11-10 +PKG_SOURCE_VERSION:=0c2e810e71ed0a59fb00246c7fa2c236ff67a0ee +PKG_MIRROR_HASH:=fc6016540bd2c67484952d0e4432d740f0e022d9b688e851bb6321def8d36844 PKG_FLAGS:=nonshared From 11a41bc4b2ffa022fad5f0bcfcdd2b51567b7c1a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 9 Nov 2023 15:10:03 +0100 Subject: [PATCH 0614/1171] netifd: update to Git HEAD (2023-11-09) 841b05fbb91e system-linux: fix compilation error if IFLA_DSA_MASTER is not supported 5c9ecc1ff74f system-linux: make system_if_get_master_ifindex static 2dc7f450f3a2 system-linux: add option to configure DSA conduit device 838f815db5ef system-linux: add support for configurable GRO option Signed-off-by: Christian Marangi (cherry picked from commit 1714087442bb61591fe60a375f39b39abd657e25) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 8d9795c0685ddf..0209bb9ed9252f 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-11-07 -PKG_SOURCE_VERSION:=516ab774cc16d4b04b3b17a067cbf2649f1adaeb -PKG_MIRROR_HASH:=76dcc7988d8ade7e8a80af8a79e9b509093c5eea9e785b0e5f7aef845787118a +PKG_SOURCE_DATE:=2023-11-09 +PKG_SOURCE_VERSION:=841b05fbb91eb7076ec3170756693bd4f1e9708e +PKG_MIRROR_HASH:=b09afa32692c397284f739c9989892697628f82b2f2a10cca78e3358dc140998 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 46385eb7f88f13591dd85bacc07e56bb7d413835 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 10 Nov 2023 15:37:32 +0100 Subject: [PATCH 0615/1171] netifd: update to the latest version eee02ccca8c8 device: add support to configure eee bb28f6a291d9 wireless: fix sign comparison warning 35facc8306f5 wireless: fix premature removal of hotplug devices due to down state Signed-off-by: Felix Fietkau (cherry picked from commit d45d72a6da004a557a2b39793c84174b33f0500c) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 0209bb9ed9252f..826889aca6c2e3 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-11-09 -PKG_SOURCE_VERSION:=841b05fbb91eb7076ec3170756693bd4f1e9708e -PKG_MIRROR_HASH:=b09afa32692c397284f739c9989892697628f82b2f2a10cca78e3358dc140998 +PKG_SOURCE_DATE:=2023-11-10 +PKG_SOURCE_VERSION:=35facc8306f590a7330789ab6d5785c0d43073ef +PKG_MIRROR_HASH:=4f73591ae1873e18df235349e478f2196ca0d3123c313a04149dc9d5e2bfb403 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 3d006f95f26ca9f7caa8a153f56cc7f616bf2d8a Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Fri, 10 Nov 2023 09:01:56 +0100 Subject: [PATCH 0616/1171] wolfssl: update to 5.6.4 Releae Notes: https://github.com/wolfSSL/wolfssl/releases/tag/v5.6.4-stable Remove upstreamed patch: - 001-fix-detection-of-cut-tool-in-configure.ac.patch Signed-off-by: Nick Hainke (cherry picked from commit d83231603c60a1df7d0530c8766f0b71c6553b44) --- package/libs/wolfssl/Makefile | 4 +-- ...etection-of-cut-tool-in-configure.ac.patch | 25 ------------------- 2 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index ae802e210e7ca2..6451dca68d28d3 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=5.6.3-stable +PKG_VERSION:=5.6.4-stable PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) -PKG_HASH:=2e74a397fa797c2902d7467d500de904907666afb4ff80f6464f6efd5afb114a +PKG_HASH:=031691906794ff45e1e792561cf31759f5d29ac74936bc8dffb8b14f16d820b4 PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 diff --git a/package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch b/package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch deleted file mode 100644 index 0d0c8b54236ee1..00000000000000 --- a/package/libs/wolfssl/patches/001-fix-detection-of-cut-tool-in-configure.ac.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 41d248461bd9ad44193a4806ecb5361513e8944e Mon Sep 17 00:00:00 2001 -From: jordan -Date: Tue, 27 Jun 2023 13:18:25 -0500 -Subject: [PATCH] fix detection of cut tool in configure.ac - ---- - configure.ac | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/configure.ac -+++ b/configure.ac -@@ -8723,10 +8723,11 @@ echo "extern \"C\" {" >> $OPTION_FILE - echo "#endif" >> $OPTION_FILE - echo "" >> $OPTION_FILE - --# check for supported command to trim option with -+# Check for supported command to trim option with. -+# note: cut requires an argument to exit with success. - if colrm >/dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 Date: Sun, 12 Nov 2023 14:10:23 +0100 Subject: [PATCH 0617/1171] iptables: backport patch fixing bug with string module Backport patch fixing critical bug with string module merged upstream. Fixes: #13812 Signed-off-by: Christian Marangi (cherry picked from commit 3d6b89c5140acb9228ec89bde09b53dafdead070) --- package/network/utils/iptables/Makefile | 2 +- ...-string-Review-parse_string-function.patch | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index aded1b7b1fdda5..45a2b49070e3da 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables PKG_VERSION:=1.8.8 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch b/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch new file mode 100644 index 00000000000000..cfcb6c77f3864c --- /dev/null +++ b/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch @@ -0,0 +1,40 @@ +From da5b32fb4656ab69fe1156eb7e36c7c961839e8a Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 8 Jun 2022 13:45:13 +0200 +Subject: [PATCH] extensions: string: Review parse_string() function + +* Compare against sizeof(info->pattern) which is more clear than having + to know that this buffer is of size XT_STRING_MAX_PATTERN_SIZE + +* Invert the check and error early to reduce indenting + +* Pass info->patlen to memcpy() to avoid reading past end of 's' + +Signed-off-by: Phil Sutter +--- + extensions/libxt_string.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +--- a/extensions/libxt_string.c ++++ b/extensions/libxt_string.c +@@ -78,14 +78,13 @@ static void string_init(struct xt_entry_ + + static void + parse_string(const char *s, struct xt_string_info *info) +-{ ++{ + /* xt_string does not need \0 at the end of the pattern */ +- if (strlen(s) <= XT_STRING_MAX_PATTERN_SIZE) { +- memcpy(info->pattern, s, XT_STRING_MAX_PATTERN_SIZE); +- info->patlen = strnlen(s, XT_STRING_MAX_PATTERN_SIZE); +- return; +- } +- xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s); ++ if (strlen(s) > sizeof(info->pattern)) ++ xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s); ++ ++ info->patlen = strnlen(s, sizeof(info->pattern)); ++ memcpy(info->pattern, s, info->patlen); + } + + static void From 101988c61a50e5a8094e5d90f37b75a28bd3ddeb Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 16:15:07 +0100 Subject: [PATCH 0618/1171] scripts/getver.sh: prevent asking for negative rev-parse With the case of asking an invalid version that is too big, getver.sh might return an invalid output in the form of HEAD~-2260475641. This is caused by BASE_REV - GET_REV using a negative number. Prevent this by checking if BASE_REV - GET_REV actually return 0 or a positive number and set REV variable accordingly. With the following change, invalid revision number will result in unknown printed instead of the invalid HEAD~-NUMBERS output. Signed-off-by: Christian Marangi (cherry picked from commit 9e49e0a6c4535d345084cc62c594be5cad23b911) --- scripts/getver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/getver.sh b/scripts/getver.sh index 49260a22603fb0..61906040b18f97 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -21,7 +21,7 @@ try_git() { r*) GET_REV="$(echo $GET_REV | tr -d 'r')" BASE_REV="$(git rev-list ${REBOOT}..HEAD 2>/dev/null | wc -l | awk '{print $1}')" - REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))" + [ $((BASE_REV - GET_REV)) -ge 0 ] && REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))" ;; *) BRANCH="$(git rev-parse --abbrev-ref HEAD)" From a58a86693f8593974ff7c26bb42e280b62a8724c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 12 Nov 2023 21:20:49 +0100 Subject: [PATCH 0619/1171] OpenWrt v23.05.1: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..d93bbf792bef85 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^9671ba6eb02e0069ffec4da3c705af1e56cf93cd +src-git luci https://git.openwrt.org/project/luci.git^5a811622d8216fdae46e1b486b471f593dee222a +src-git routing https://git.openwrt.org/feed/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667 +src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..a22dbd422dc62c 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.1) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23619-101988c61a) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.1) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..f408f2530fdb85 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.1" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..e0460a5880d683 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23619-101988c61a diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..4af571f4f82538 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1699802379 From ce62c25c08010f81dd78748161dcc99457ee03b8 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 12 Nov 2023 21:21:21 +0100 Subject: [PATCH 0620/1171] OpenWrt v23.05.1: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d93bbf792bef85..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^9671ba6eb02e0069ffec4da3c705af1e56cf93cd -src-git luci https://git.openwrt.org/project/luci.git^5a811622d8216fdae46e1b486b471f593dee222a -src-git routing https://git.openwrt.org/feed/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667 -src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index a22dbd422dc62c..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.1) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23619-101988c61a) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.1) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index f408f2530fdb85..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.1" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index e0460a5880d683..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23619-101988c61a diff --git a/version.date b/version.date deleted file mode 100644 index 4af571f4f82538..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1699802379 From 65bf66f7274a0f992836516df9f6033c07aa6b27 Mon Sep 17 00:00:00 2001 From: Usama Nassir Date: Fri, 19 May 2023 03:35:51 +0300 Subject: [PATCH 0621/1171] ramips: Add support for ComFast CF-E390AX Add support for ComFast CF-E390AX. It is a 802.11 wifi6 cieling AP, based on MediaTek MT7261AT. Specifications: SoC: MediaTek MT7621AT RAM: 128 MiB Flash: 16 MiB NOR (Macronix mx25l12805d) Wireless: MT7915E (2.4G) 802.11ax/b/g/n MT7915E (5G) 802.11ac/ax/n Ethernet: 2 x 1Gbs Button: 1 x "Reset" button LED: 1x Blue LED + 1x Red LED + 1x green LED Power: PoE Manufacturer Page: http://en.comfast.com.cn/index.php?m=content&c=index&a=show&catid=84&id=75 Flash Layout: 0x000000000000-0x000000030000 : "bootloader" 0x000000030000-0x000000040000 : "config" 0x000000050000-0x000000060000 : "factory" 0x000000090000-0x000001000000 : "firmware" First install: 1. Set device into http firmware fail safe upload mode by pressing the reset button for 10 seconds while powering it on. Once the LED stops flashing, safe mode will be running. 2. Set PC IP address to 192.168.1.2 3. Browse to 192.168.1.1 and upload the factory image using the web interface. Signed-off-by: Usama Nassir (cherry picked from commit f24c9b9d863c2635e472e83028d28cc8d0a7c7c6) --- .../ramips/dts/mt7621_comfast_cf-e390ax.dts | 135 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 14 ++ .../mt7621/base-files/etc/board.d/02_network | 8 ++ .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 4 + 4 files changed, 161 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts diff --git a/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts b/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts new file mode 100644 index 00000000000000..80600470e77ec2 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "comfast,cf-e390ax", "mediatek,mt7621-soc"; + model = "COMFAST CF-E390AX"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + }; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_red; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&spi0 { + status = "okay"; + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <14000000>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@90000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x90000 0xf70000>; + }; + }; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + }; + + port@4 { + status = "okay"; + label = "lan"; + }; + }; +}; + diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 57adcb7da2ee4d..2b0b698514b71c 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -513,6 +513,20 @@ define Device/bolt_arion endef TARGET_DEVICES += bolt_arion +define Device/comfast_cf-e390ax + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 15808k + DEVICE_VENDOR := ComFast + DEVICE_MODEL := CF-E390AX + DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools + IMAGES += factory.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + check-size | append-metadata + IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size +endef +TARGET_DEVICES += comfast_cf-e390ax + define Device/cudy_m1800 $(Device/dsa-migration) DEVICE_VENDOR := Cudy diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 839663bbd0df5b..5990ee314d272f 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -145,6 +145,9 @@ ramips_setup_interfaces() ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" ;; + comfast,cf-e390ax) + ucidef_set_interfaces_lan_wan "lan" "wan" + ;; *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; @@ -198,6 +201,11 @@ ramips_setup_macs() lan_mac=$wan_mac label_mac=$wan_mac ;; + comfast,cf-e390ax) + lan_mac=$(cat /sys/class/net/eth0/address) + label_mac=$lan_mac + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; dlink,dir-860l-b1) lan_mac=$(mtd_get_mac_ascii factory lanmac) wan_mac=$(mtd_get_mac_ascii factory wanmac) diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 3467e783f04826..0443fd2ba73457 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -27,6 +27,10 @@ case "$board" in hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 28) [ "$PHYNBR" = "1" ] && macaddr_setbit_la $hw_mac_addr > /sys${DEVPATH}/macaddress ;; + comfast,cf-e390ax) + [ "$PHYNBR" = "0" ] && echo -n "$(mtd_get_mac_binary factory 0x0004)" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && echo -n "$(mtd_get_mac_binary factory 0x8004)" > /sys${DEVPATH}/macaddress + ;; cudy,x6-v1|\ cudy,x6-v2) hw_mac_addr="$(mtd_get_mac_binary bdinfo 0xde00)" From 275f7e07ee0ba4d0797cb8ef2ff2077fcc26f1ea Mon Sep 17 00:00:00 2001 From: "Alexey D. Filimonov" Date: Sat, 19 Aug 2023 00:26:59 +0300 Subject: [PATCH 0622/1171] ramips: cf-ew72-v2: Add support for COMFAST CF-EW72 V2 Add support for COMFAST CF-EW72 V2 Hardware: - SoC: Mediatek MT7621 (MT7621DAT or MT7621AT) - Flash: 16 MiB NOR - RAM: 128 MiB - Ethernet: Built-in, 2 x 1GbE - Power: only 802.3af PD on any port, injector supplied in the box - PoE passthrough: No - Wifi 2.4GHz: Mediatek MT7603BE 802.11b/g/b - Wifi 5GHz: Mediatek MT7613BEN 802.11ac/n/a - LEDs: 8x (only 1 is both visible and controllable, see below) - Buttons: 1x (RESET) Installing OpenWrt: Flashing is done using Mediatek U-Boot System Recovery Mode - make wired connection with 2 cables like this: - - PC (LAN) <-> PoE Injector (LAN) - - PoE Injector (POE) <-> CF-EW72 V2 (LAN). Leave unconnected to CF-EW72 V2 yet. - configure 192.168.1.(2-254)/24 static ip address on your PC LAN - press and keep pressed RESET button on device - power the device by plugging PoE Injector (POE) <-> CF-EW72 V2 (LAN) cable - wait for about 10 seconds until wifi led stops blinking and release RESET button - navigate from your PC to http://192.168.1.1 and upload OpenWrt *-factory.bin firmware file - proceed until router starts blinking with wifi led again (flashing) and stops (rebooting to OpenWrt) MAC addresses as verified by OEM firmware: vendor OpenWrt address LAN lan\eth0 label WAN wan label + 1 2g phy0 label + 2 5g phy1 label + 3 The label MAC address was found in 0xe000. LEDs detailed: The only both visible and controllable indicator is blue:wlan LED. It is not bound by default to indicate activity of any wireless interfaces. Place (WAN->ANT) | Num | GPIO | LED name (LuCI) | Note -----------------|-----|----------------------------------------------------------------------------------------- power | 1 | | | POWER LED. Not controlled with GPIO. hidden_led_2 | 2 | 13 | blue:hidden_led_2 | This LED does not have proper hole in shell. wan | 3 | | | WAN LED. Not controlled with GPIO. hidden_led_4 | 4 | 16 | blue:hidden_led_4 | This LED does not have proper hole in shell. lan | 5 | | | LAN LED. Not controlled with GPIO. noconn_led_6 | 6 | | | Not controlled with GPIO, possibly not connected wlan | 7 | 15 | blue:wlan | WLAN LED. Wireless indicator. noconn_led_8 | 8 | | | Not controlled with GPIO, possibly not connected mt76-phy0 and mt76-phy1 leds also exist in OpenWrt, but do not exist on board. Signed-off-by: Alexey D. Filimonov (cherry picked from commit ff95f859ebf710d2914472a3feeeb0d187d14459) --- .../ramips/dts/mt7621_comfast_cf-ew72-v2.dts | 192 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 15 ++ .../mt7621/base-files/etc/board.d/02_network | 3 +- 3 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts diff --git a/target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts b/target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts new file mode 100644 index 00000000000000..8b7b4a035ea2d3 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "comfast,cf-ew72-v2", "mediatek,mt7621-soc"; + model = "COMFAST CF-EW72 V2"; + + // There are at least two HW variants of cf-ew72-v2: + // With external RAM chip and with integrated RAM (RAM chip not soldered). + // Both act same. + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + // The only both visible and controllable indicator is wifi LED. + // CF-EW72 have 8 LEDs: + // "wlan" is the only LED is controllable with GPIO and have proper hole in shell. + // "power", "wan" and "lan" LEDs have proper holes in shell, but can not be controlled with GPIO + // "hidden_led_2" and "hidden_led_4" can be controlled with GPIO, but have no proper holes in shell + // "hidden_led_2" is between POWER and WAN LEDs + // "hidden_led_4" is between WAN and LAN LEDs + // "noconn_led_6" and "noconn_led_8" exist, but have no proper holes in shell and not controlled: + // "noconn_led_6" is between LAN and WLAN LEDs + // "noconn_led_8" is after WLAN LED + + // LED "hidden_led_2" between POWER and WAN LEDs is controllable with GPIO, but it has no proper hole in shell; + // LED "hidden_led_4" between WAN and LAN LEDs is controllable with GPIO, but it has no proper hole in shell; + + // TABLE of LEDs. All leds are blue. + // + // Place (WAN->ANT) | Num | GPIO | LED name (LuCI) | Note + // -----------------|-----|----------------------------------------------------------------------------------------- + // power | 1 | | | POWER LED. Not controlled with GPIO. + // hidden_led_2 | 2 | 13 | blue:hidden_led_2 | This LED does not have proper hole in shell. + // wan | 3 | | | WAN LED. Not controlled with GPIO. + // hidden_led_4 | 4 | 16 | blue:hidden_led_4 | This LED does not have proper hole in shell. + // lan | 5 | | | LAN LED. Not controlled with GPIO. + // noconn_led_6 | 6 | | | Not controlled with GPIO, possibly not connected + // wlan | 7 | 15 | blue:wlan | WLAN LED. Wireless indicator. + // noconn_led_8 | 8 | | | Not controlled with GPIO, possibly not connected + + hidden_led_2_blue { + label = "blue:hidden_led_2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + hidden_led_4_blue { + label = "blue:hidden_led_4"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + wlan_blue { + label = "blue:wlan"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + aliases { + label-mac-device = &wan; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "w25q128"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,fast-read; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "Config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + compatible = "nvmem-cells"; + reg = <0x40000 0x10000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + macaddr_factory_e000: macaddr@e000 { + compatible = "mac-base"; + reg = <0xe000 0x6>; + #nvmem-cell-cells = <1>; + }; + + // Serial number can be found in "factory" at 0xE100. + // it starts and ends with double quotes `"` and is ASCII string + }; + }; + + partition@50000 { + label = "firmware"; + compatible = "denx,uimage"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&gpio { + groups = "i2c", "uart2", "uart3", "sdhci", "jtag"; + function = "gpio"; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000 0>; + nvmem-cell-names = "mac-address"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi_2_4_ghz: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + // Wi-Fi device reads it's MAC address from EEPROM (&factory + 4) + // adding anything related to mac-address here will cause use random MAC + }; +}; + +&pcie1 { + wifi_5_0_ghz: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + // Wi-Fi device reads it's MAC address from EEPROM, (&factory + 0x8000 + 4) + // adding anything related to mac-address here will cause use random MAC. + }; +}; + +&pcie2 { + status = "disabled"; +}; + +&switch0 { + mediatek,mcm; + ports { + wan: port@0 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_e000 1>; + nvmem-cell-names = "mac-address"; + }; + + lan: port@1 { + status = "okay"; + label = "lan"; + nvmem-cells = <&macaddr_factory_e000 0>; + nvmem-cell-names = "mac-address"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2b0b698514b71c..a5e3828c390a00 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -527,6 +527,21 @@ define Device/comfast_cf-e390ax endef TARGET_DEVICES += comfast_cf-e390ax +define Device/comfast_cf-ew72-v2 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 15808k + DEVICE_VENDOR := ComFast + DEVICE_MODEL := CF-EW72 V2 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + -uboot-envtools + IMAGES += factory.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + check-size | append-metadata + IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size +endef +TARGET_DEVICES += comfast_cf-ew72-v2 + define Device/cudy_m1800 $(Device/dsa-migration) DEVICE_VENDOR := Cudy diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 5990ee314d272f..827d97e540e00f 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -145,7 +145,8 @@ ramips_setup_interfaces() ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" ;; - comfast,cf-e390ax) + comfast,cf-e390ax|\ + comfast,cf-ew72-v2) ucidef_set_interfaces_lan_wan "lan" "wan" ;; *) From a00fc406b9adb37039b3b6f7f8914477b1f8caae Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 26 Oct 2023 03:46:44 +0100 Subject: [PATCH 0623/1171] kernel: add support MeigLink SLM828 modem Another Qualcomm-based USB-connected modem, offering endpoints 0 : rndis_host (link to voip subsystem listening on 169.254.5.100) 1 : rndis_host (?) 2 : option (?) 3 : option (at) 4 : option (at) 5 : option (?) 6 : GobiNet (qmi) 7 : ? Add support for this modem in rndis_host, option and qmi_wwan driver which allows the modem to be used with ModemManager. Signed-off-by: Daniel Golle (cherry picked from commit f32baf6a65fbe294b9eb7b93f39b2aea1c3402ae) --- .../780-usb-net-MeigLink_modem_support.patch | 34 +++++++++-- .../781-usb-net-rndis-support-asr.patch | 56 +++++++++++++++++++ 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index e5667c17438d24..304f5480a3febf 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -10,26 +10,52 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c -@@ -1086,6 +1086,7 @@ static const struct usb_device_id produc +@@ -1080,12 +1080,18 @@ static const struct usb_device_id produc + USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7), + .driver_info = (unsigned long)&qmi_wwan_info, + }, ++ { /* Meiglink SGM828 */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d49, USB_CLASS_VENDOR_SPEC, 0x10, 0x05), ++ .driver_info = (unsigned long)&qmi_wwan_info, ++ }, ++ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0801)}, /* Quectel RM520N */ -+ {QMI_MATCH_FF_FF_FF(0x05c6, 0xf601)}, /* MeigLink SLM750 */ ++ {QMI_MATCH_FF_FF_FF(0x05c6, 0xf601)}, /* MeigLink SLM750 */ /* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -247,6 +247,8 @@ static void option_instat_callback(struc +@@ -247,6 +247,11 @@ static void option_instat_callback(struc #define UBLOX_PRODUCT_R410M 0x90b2 /* These Yuga products use Qualcomm's vendor ID */ #define YUGA_PRODUCT_CLM920_NC5 0x9625 +/* These MeigLink products use Qualcomm's vendor ID */ +#define MEIGLINK_PRODUCT_SLM750 0xf601 ++ ++#define MEIGLINK_VENDOR_ID 0x2dee ++#define MEIGLINK_PRODUCT_SLM828 0x4d49 #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1185,6 +1187,11 @@ static const struct usb_device_id option +@@ -1144,6 +1149,11 @@ static const struct usb_device_id option + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */ + .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) }, ++ /* MeiG */ ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x01) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x02) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x03) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x04) }, + /* Quectel products using Qualcomm vendor ID */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), +@@ -1185,6 +1195,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch b/target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch new file mode 100644 index 00000000000000..9934bb8078efe4 --- /dev/null +++ b/target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch @@ -0,0 +1,56 @@ +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -630,6 +630,16 @@ static const struct driver_info zte_rndi + .tx_fixup = rndis_tx_fixup, + }; + ++static const struct driver_info asr_rndis_info = { ++ .description = "Asr RNDIS device", ++ .flags = FLAG_WWAN | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT | FLAG_NOARP, ++ .bind = rndis_bind, ++ .unbind = rndis_unbind, ++ .status = rndis_status, ++ .rx_fixup = rndis_rx_fixup, ++ .tx_fixup = rndis_tx_fixup, ++}; ++ + /*-------------------------------------------------------------------------*/ + + static const struct usb_device_id products [] = { +@@ -666,6 +676,36 @@ static const struct usb_device_id produc + USB_INTERFACE_INFO(USB_CLASS_WIRELESS_CONTROLLER, 1, 3), + .driver_info = (unsigned long) &rndis_info, + }, { ++ /* Quectel EG060V rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6004, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Quectel EC200A rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6005, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Quectel EC200T rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6026, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Simcom A7906E rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x1e0e, 0x9011, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Meig SLM770A */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d57, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Meig SLM828 */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d49, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { + /* Novatel Verizon USB730L */ + USB_INTERFACE_INFO(USB_CLASS_MISC, 4, 1), + .driver_info = (unsigned long) &rndis_info, From 03e26f856fe3a7508436bbb3acc394708cf9ac8c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 26 Oct 2023 03:50:40 +0100 Subject: [PATCH 0624/1171] kernel: support reading hex MAC address from NVMEM In addition to binary and ASCII-formatted MAC addresses, add support for processing hexadecimal encoded MAC addresses from NVMEM. Signed-off-by: Daniel Golle (cherry picked from commit 7db87d7c6846977402899b27881824b3df4f50ab) --- ...-support-mac-base-fixed-layout-cells.patch | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch b/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch index 6791b63ac09d90..95f29b1865dd5f 100644 --- a/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch +++ b/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch @@ -20,10 +20,11 @@ string. --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -7,9 +7,11 @@ +@@ -7,9 +7,12 @@ */ #include ++#include +#include #include #include @@ -32,7 +33,7 @@ string. #include #include #include -@@ -696,6 +698,37 @@ static int nvmem_validate_keepouts(struc +@@ -696,6 +699,62 @@ static int nvmem_validate_keepouts(struc return 0; } @@ -66,25 +67,55 @@ string. + + return 0; +} ++ ++static int nvmem_mac_base_hex_read(void *context, const char *id, int index, unsigned int offset, ++ void *buf, size_t bytes) ++{ ++ u8 mac[ETH_ALEN], *hexstr; ++ int i; ++ ++ if (WARN_ON(bytes != 2 * ETH_ALEN)) ++ return -EINVAL; ++ ++ hexstr = (u8 *)buf; ++ for (i = 0; i < ETH_ALEN; i++) { ++ if (!isxdigit(hexstr[i * 2]) || !isxdigit(hexstr[i * 2 + 1])) ++ return -EINVAL; ++ ++ mac[i] = (hex_to_bin(hexstr[i * 2]) << 4) | hex_to_bin(hexstr[i * 2 + 1]); ++ } ++ ++ if (index) ++ eth_addr_add(mac, index); ++ ++ ether_addr_copy(buf, mac); ++ ++ return 0; ++} + static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) { struct nvmem_layout *layout = nvmem->layout; -@@ -731,6 +764,20 @@ static int nvmem_add_cells_from_dt(struc +@@ -731,6 +790,25 @@ static int nvmem_add_cells_from_dt(struc if (layout && layout->fixup_cell_info) layout->fixup_cell_info(nvmem, layout, &info); + if (of_device_is_compatible(np, "fixed-layout")) { + if (of_device_is_compatible(child, "mac-base")) { -+ if (info.bytes == 6) { ++ if (info.bytes == ETH_ALEN) { + info.raw_len = info.bytes; + info.bytes = ETH_ALEN; + info.read_post_process = nvmem_mac_base_raw_read; ++ } else if (info.bytes == 2 * ETH_ALEN) { ++ info.raw_len = info.bytes; ++ info.bytes = ETH_ALEN; ++ info.read_post_process = nvmem_mac_base_hex_read; + } else if (info.bytes == 3 * ETH_ALEN - 1) { + info.raw_len = info.bytes; + info.bytes = ETH_ALEN; + info.read_post_process = nvmem_mac_base_ascii_read; + } ++ + } + } + From ce62536aca9d0aae9b21c3d19cd8ad6acba7b029 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 29 Oct 2023 16:01:05 +0000 Subject: [PATCH 0625/1171] uboot-envtools: add environment config for MeiG SLT866 Add configuration to access U-Boot environment on MeiG SLT866. Signed-off-by: Daniel Golle (cherry picked from commit f8414f1a6fa0b784117353a93d821fa923da1aaf) --- package/boot/uboot-envtools/files/ramips | 1 + 1 file changed, 1 insertion(+) diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 8c7ce71c49f5dd..83b54388e3e731 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -20,6 +20,7 @@ alfa-network,tube-e4g|\ engenius,epg600|\ engenius,esr600h|\ linksys,re7000|\ +meig,slt866|\ sitecom,wlr-4100-v1-002|\ zyxel,keenetic-lite-iii-a) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" From b38b5c42997e527f91e653a4b6d77a5717d3cd14 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 24 Oct 2023 18:05:28 +0100 Subject: [PATCH 0626/1171] ramips: add support for MeiG SLT866 4G CPE Hardware: - SoC: Mediatek MT7621 (MT7621AT) - Flash: 32 MiB SPI-NOR (Macronix MX25L25635E) - RAM: 128 MiB - Ethernet: Built-in, 2 x 1GbE - 3G/4G Modem: MEIG SLM828 (currently only supported with ModemManager) - SLIC: Si32185 (unsupported) - Power: 12V via barrel connector - Wifi 2.4GHz: Mediatek MT7603BE 802.11b/g/b - Wifi 5GHz: Mediatek MT7613BE 802.11ac/n/a - LEDs: 8x (7 controllable) - Buttons: 2x (RESET, WPS) Installing OpenWrt: - sysupgrade image is compatible with vendor firmware. Recovery: - Connect to any of the Ethernet ports, configure local IP: 10.10.10.3/24 (or 192.168.10.19/24, depending on OEM) - Provide firmware file named 'mt7621.img' on TFTP server. - Hold down both, RESET and WPS, then power on the board. - Watch network traffic using tcpdump or wireshark in realtime to observe progress of device requesting firmware. Once download has completed, release both buttons and wait until firmware comes up. Signed-off-by: Daniel Golle (cherry picked from commit bc335f296740ac386e1ef09a49f1844419b0ccf9) --- .../linux/ramips/dts/mt7621_meig_slt866.dts | 245 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 11 + .../mt7621/base-files/etc/board.d/01_leds | 4 + .../mt7621/base-files/etc/board.d/02_network | 3 +- 4 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7621_meig_slt866.dts diff --git a/target/linux/ramips/dts/mt7621_meig_slt866.dts b/target/linux/ramips/dts/mt7621_meig_slt866.dts new file mode 100644 index 00000000000000..19d2f0f6fc42a6 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_meig_slt866.dts @@ -0,0 +1,245 @@ +#include "mt7621.dtsi" +#include +#include +#include + +/ { + compatible = "meig,slt866", "mediatek,mt7621-soc"; + model = "MeiG SLT866"; + + aliases { + led-boot = &led_internet; + led-failsafe = &led_internet; + led-upgrade = &led_internet; + label-mac-device = &gmac1; + }; + + leds { + compatible = "gpio-leds"; + + signal4 { + label = "blue:signal4"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + + lanwan { + label = "blue:lanwan"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + + led_internet: internet { + label = "blue:internet"; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + }; + + wifi { + label = "blue:wifi"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + signal3 { + label = "blue:signal3"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + + signal2 { + label = "blue:signal2"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + + signal1 { + label = "blue:signal1"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + regulator-pa-5g { + compatible = "regulator-fixed"; + regulator-name = "pa-5g"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 7 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + regulator-always-on; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <20000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "Config"; + reg = <0x30000 0x10000>; + }; + + partition@40000 { + label = "Factory"; + reg = <0x40000 0x10000>; + read-only; + compatible = "nvmem-cells"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x200>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + }; + }; + + partition@50000 { + label = "firmware"; + compatible = "denx,uimage"; + reg = <0x50000 0xf90000>; + }; + + partition@fe0000 { + label = "m_custom"; + reg = <0xfe0000 0x20000>; + read-only; + compatible = "nvmem-cells"; + + nvmem-layout { + compatible = "fixed-layout"; + + #address-cells = <1>; + #size-cells = <1>; + + macaddr_custom_0: macaddr@0 { + reg = <0x0 0xc>; + compatible = "mac-base"; + #nvmem-cell-cells = <1>; + }; + + macaddr_custom_40: macaddr@40 { + reg = <0x40 0xc>; + compatible = "mac-base"; + #nvmem-cell-cells = <1>; + }; + + macaddr_custom_100: macaddr@100 { + reg = <0x100 0xc>; + compatible = "mac-base"; + #nvmem-cell-cells = <1>; + }; + + macaddr_custom_140: macaddr@140 { + reg = <0x140 0xc>; + compatible = "mac-base"; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@1000000 { + label = "fota_bak"; + reg = <0x1000000 0x1000000>; + read-only; + }; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; +}; + +&gmac0 { + nvmem-cells = <&macaddr_custom_40 0>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_custom_0 0>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch0 { + ports { + port@3 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_0>, <&macaddr_custom_100 0>; + nvmem-cell-names = "eeprom", "mac-address"; + }; +}; + +&pcie1 { + mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + nvmem-cells = <&eeprom_factory_8000>, <&macaddr_custom_140 0>; + nvmem-cell-names = "eeprom", "mac-address"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index a5e3828c390a00..8a194d6bc1bee4 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1552,6 +1552,17 @@ define Device/mediatek_mt7621-eval-board endef TARGET_DEVICES += mediatek_mt7621-eval-board +define Device/meig_slt866 + $(Device/dsa-migration) + IMAGE_SIZE := 15104k + DEVICE_VENDOR := MeiG + DEVICE_MODEL := SLT866 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb3 \ + kmod-usb-net-rndis +endef +TARGET_DEVICES += meig_slt866 + define Device/mercusys_mr70x-v1 $(Device/dsa-migration) $(Device/tplink-safeloader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 3ceac604342cc2..784a4ba0d914e9 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -137,6 +137,10 @@ linksys,ea8100-v2) ucidef_set_led_netdev "lan4" "lan4 link" "green:lan4" "lan4" "link" ucidef_set_led_netdev "wan" "wan link" "green:wan" "wan" "link" ;; +meig,slt866) + ucidef_set_led_netdev "lan" "eth" "blue:lanwan" "lan" "link tx rx" + ucidef_set_led_netdev "wwan0" "net" "blue:internet" "wwan0" "link tx rx" + ;; mikrotik,routerboard-760igs) ucidef_set_led_netdev "sfp" "SFP" "blue:sfp" "sfp" ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 827d97e540e00f..4b23afc1cf2910 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -146,7 +146,8 @@ ramips_setup_interfaces() ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" ;; comfast,cf-e390ax|\ - comfast,cf-ew72-v2) + comfast,cf-ew72-v2|\ + meig,slt866) ucidef_set_interfaces_lan_wan "lan" "wan" ;; *) From 4637ba72b7f7e47ac3580fd013f287f9616e13f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 15 Jun 2023 16:11:26 +0200 Subject: [PATCH 0627/1171] scan.mk: do not silence output of dump phase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it easier to spot currently hidden issues: $ make defconfig V=sc ... Collecting target info: target/linux/airohabash: -c: line 1: syntax error near unexpected token `|' bash: -c: line 1: `echo 1686815253 | staging_dir/host/bin/mkhash md5 | cut -b1-8' bash: -c: line 1: syntax error near unexpected token `|' bash: -c: line 1: `echo 1686815253 | staging_dir/host/bin/mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/'' ... Signed-off-by: Petr Štetiar (cherry picked from commit b522da5b16c7e5952d364b933b921786198f9fe5) --- include/scan.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/scan.mk b/include/scan.mk index 33a5832ff5f237..2e0ee0c9609935 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -50,7 +50,8 @@ define PackageDir $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \ echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \ $(if $(3),echo Override: $(3),true); \ - $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),$(MAKE),$(NO_TRACE_MAKE) --no-print-dir) -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),,2>/dev/null) || { \ mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \ $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \ $$(call progress,ERROR: please fix $(SCAN_DIR)/$(2)/Makefile - see logs/$(SCAN_DIR)/$(2)/dump.txt for details\n) \ From 51bb178824f937b1f1988c9351e3586f81c18b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 15 Jun 2023 16:11:27 +0200 Subject: [PATCH 0628/1171] treewide: fix shell errors during dump stage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes following issues: bash: -c: line 1: `echo 1686820180 | /staging_dir/host/bin/mkhash md5 | cut -b1-8' bash: -c: line 1: `echo 1686820180 | /staging_dir/host/bin/mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/'' bash: -c: line 1: syntax error near unexpected token `|' bash: line 1: *1024*1024: syntax error: operand expected (error token is "*1024*1024") bash: line 1: (64 + ): syntax error: operand expected (error token is ")") expr: syntax error: missing argument after '+' Signed-off-by: Petr Štetiar (cherry picked from commit 8fc496be860192f8bd1f16913657626014c8863f) --- include/image.mk | 4 ++++ target/linux/layerscape/image/Makefile | 3 +++ target/linux/mediatek/image/filogic.mk | 2 ++ target/linux/mediatek/image/mt7622.mk | 2 ++ target/linux/mediatek/image/mt7623.mk | 4 ++++ 5 files changed, 15 insertions(+) diff --git a/include/image.mk b/include/image.mk index 62e05b2567b6ff..dc53fe8b25f268 100644 --- a/include/image.mk +++ b/include/image.mk @@ -40,8 +40,10 @@ IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) IMG_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_COMBINED:=$(IMG_PREFIX)-combined +ifeq ($(DUMP),) IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8) IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/') +endif MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt @@ -167,7 +169,9 @@ define Image/pad-to mv $(1).new $(1) endef +ifeq ($(DUMP),) ROOTFS_PARTSIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024))) +endif define Image/pad-root-squashfs $(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(ROOTFS_PARTSIZE))) diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile index dfbda85b3651bf..f2ac9b6f0482ad 100644 --- a/target/linux/layerscape/image/Makefile +++ b/target/linux/layerscape/image/Makefile @@ -8,8 +8,11 @@ include $(INCLUDE_DIR)/image.mk LS_SD_KERNELPART_SIZE = 40 LS_SD_KERNELPART_OFFSET = 16 LS_SD_ROOTFSPART_OFFSET = 64 + +ifeq ($(DUMP),) LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \ $(CONFIG_TARGET_ROOTFS_PARTSIZE))))) +endif # The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs LS_SYSUPGRADE_IMAGE_SIZE = 49m diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 0f0f3119701787..06cf3d7883ade3 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -161,7 +161,9 @@ define Device/bananapi_bpi-r3 pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ ) \ gzip +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 53f5bd9d14ba9d..8f29843f3cf238 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -94,7 +94,9 @@ define Device/bananapi_bpi-r64 pad-to 46080k | append-image squashfs-sysupgrade.itb | check-size |\ ) \ gzip +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 45 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 5828c4d763d937..2c4402da661949 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -96,7 +96,9 @@ define Device/bananapi_bpi-r2 KERNEL := kernel-bin | gzip KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata ARTIFACT/preloader.bin := mt7623-mbr emmc |\ pad-to 2k | append-preloader $$(UBOOT_TARGET) @@ -130,7 +132,9 @@ define Device/unielec_u7623-02 UBOOT_TARGET := mt7623a_unielec_u7623 UBOOT_IMAGE := u-boot-mtk.bin UBOOT_PATH := $(STAGING_DIR_IMAGE)/$$(UBOOT_TARGET)-$$(UBOOT_IMAGE) +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif IMAGES := sysupgrade.itb KERNEL := kernel-bin | gzip KERNEL_INITRAMFS_SUFFIX := -recovery.itb From 842932a63d8993150ff339f11f0cd0d5dc45e6cc Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 14 Nov 2023 14:38:11 +0100 Subject: [PATCH 0629/1171] netifd: fix IPv4 route target masking A previous commit supposed to mask out excess host bits in route targets failed to correctly calculate the mask value, causing it to produce improper results for certain mask lengths. Fixes: https://github.com/openwrt/netifd/issues/17 Signed-off-by: Jo-Philipp Wich --- package/network/config/netifd/Makefile | 2 +- ...ace-ip-fix-IPv4-route-target-masking.patch | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 826889aca6c2e3..d237ed181f4fff 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_RELEASE:=1 +PKG_RELEASE:=1.1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git diff --git a/package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch b/package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch new file mode 100644 index 00000000000000..dd9374a83cfd67 --- /dev/null +++ b/package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch @@ -0,0 +1,32 @@ +From 8587c074f1eb2064c42adb0a6aa5073f695ab89d Mon Sep 17 00:00:00 2001 +From: Jo-Philipp Wich +Date: Tue, 14 Nov 2023 14:01:44 +0100 +Subject: [PATCH] interface-ip: fix IPv4 route target masking + +A previous commit supposed to mask out excess host bits in route targets +failed to correctly calculate the mask value, causing it to produce +improper results for certain mask lengths. + +Fixes: #17 +Fixes: 76eb342 ("interface-ip: mask out host bits in IPv4 route targets") +Signed-off-by: Jo-Philipp Wich +--- + interface-ip.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/interface-ip.c b/interface-ip.c +index d2fe385..28e7106 100644 +--- a/interface-ip.c ++++ b/interface-ip.c +@@ -448,7 +448,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) + + /* Mask out IPv4 host bits to avoid "Invalid prefix for given prefix length" */ + if (af == AF_INET && route->mask < 32) +- route->addr.in.s_addr &= ((1u << route->mask) - 1); ++ clear_if_addr(&route->addr, route->mask); + } + + if ((cur = tb[ROUTE_GATEWAY]) != NULL) { +-- +2.39.1 + From 1c26bcb10819f072964a658e2cc29bb87613a6f5 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 15 Nov 2023 00:00:53 +0100 Subject: [PATCH 0630/1171] OpenWrt v23.05.2: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..035137eeba1346 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^8e3a1824645f5e73ec44c897ac0755c53fb4a1f8 +src-git luci https://git.openwrt.org/project/luci.git^7739e9f5b03b830f51d53c384be4baef95054cb3 +src-git routing https://git.openwrt.org/feed/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667 +src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..dc1d75cc1617b1 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.2) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23630-842932a63d) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.2) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..2f8b9f31b5e296 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.2" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..f949e81a30a997 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23630-842932a63d diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..9279736346a514 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1699969091 From 6cb1cb1b13fc767b4c488538220283600a3b2eec Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 15 Nov 2023 00:00:58 +0100 Subject: [PATCH 0631/1171] OpenWrt v23.05.2: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index 035137eeba1346..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^8e3a1824645f5e73ec44c897ac0755c53fb4a1f8 -src-git luci https://git.openwrt.org/project/luci.git^7739e9f5b03b830f51d53c384be4baef95054cb3 -src-git routing https://git.openwrt.org/feed/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667 -src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index dc1d75cc1617b1..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.2) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23630-842932a63d) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.2) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 2f8b9f31b5e296..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.2" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index f949e81a30a997..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23630-842932a63d diff --git a/version.date b/version.date deleted file mode 100644 index 9279736346a514..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1699969091 From c7b6cfac40ce1b5e8fb0d9e5ce2c56e089abfadb Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 19:14:46 +0100 Subject: [PATCH 0632/1171] scripts/dump-target-info.pl: add new function to DUMP devices Add new function to dump-targer-info.pl to DUMP devices provided a matching target/subtarget. Example: ./scripts/dump-targer-info.pl devices ipq806x/generic will produce the sorted list of devices defined in the following format: device_id device_name Devices may have alternative names, the script will dump each alternative name in the same line of device_id. Following the pattern: device_id "PRIMARY DEVICE NAME" "ALT0 DEVICE NAME" "ALT1 DEVICE NAME" ... Example: tplink_ad7200 "TP-Link AD7200 v1/v2" "TP-Link Talon AD7200 v1/v2" Signed-off-by: Christian Marangi (cherry picked from commit 943c153cdd695904b9b7fe44800fc3546644973e) --- scripts/dump-target-info.pl | 80 ++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/scripts/dump-target-info.pl b/scripts/dump-target-info.pl index 0e4af17fe049b6..eec06ed6c494a5 100755 --- a/scripts/dump-target-info.pl +++ b/scripts/dump-target-info.pl @@ -4,7 +4,7 @@ use warnings; use Cwd; -my (%targets, %architectures, %kernels); +my (%targets, %architectures, %kernels, %devices); $ENV{'TOPDIR'} = Cwd::getcwd(); @@ -56,6 +56,68 @@ sub parse_targetinfo { } } +sub parse_devices { + my ($target_dir, $subtarget) = @_; + + if (open M, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 SUBTARGET='$subtarget' V=s |") { + my ($device_profile, $device_name, @device_alt_names, $device_is_alt); + while (defined(my $line = readline M)) { + chomp $line; + + if ($line =~ /^Target-Profile-Name: (.+)$/) { + $device_name = $1; + } + elsif ($line =~ /^Target-Profile: DEVICE_(.+)$/) { + $device_profile = $1; + } + # Logic behind this. + # DUMP duplicate info for each alternative device name and + # the alternative device name are printed first before the + # primary device name + # Alternative device titles always have the full list of + # all the alternative device name. + # The device name pattern for an alternative device name is + # Target-Profile-Name: ALT_NAME (PRIMARY_NAME) + # We compare the detected device name and check if it does + # match the alternative device name pattern with one of + # the alternative device name in Alternative device titles: + # If an alternative device name is detected, + # alternative device is skipped. + elsif ($line =~ /^Alternative device titles:$/) { + while (defined($line = readline M)) { + if ($line =~ /^- (.+)$/) { + if ($device_name =~ /^\Q$1\E \((.+)\)$/) { + $device_is_alt = 1; + last; + } + push @device_alt_names, $1; + } + else { + last; + } + } + } + if ($line =~ /^@\@$/) { + if ($device_name && $device_profile && ! $device_is_alt) { + push @{$devices{$device_profile}}, $device_name; + + if (scalar @device_alt_names) { + foreach my $device_alt_name (sort values @device_alt_names) { + push @{$devices{$device_profile}}, $device_alt_name; + } + } + } + + undef $device_name; + undef $device_profile; + undef $device_is_alt; + @device_alt_names = (); + } + } + close M; + } +} + sub get_targetinfo { foreach my $target_makefile (glob "target/linux/*/Makefile") { my ($target_dir) = $target_makefile =~ m!^(.+)/Makefile$!; @@ -86,6 +148,15 @@ sub get_targetinfo { } } +sub get_devices { + my ($target_subtarget) = @_; + my ($target, $subtarget) = split /\//, $target_subtarget; + + my ($target_dir) = "target/linux/" . $target; + + parse_devices($target_dir, $subtarget) +} + if (@ARGV == 1 && $ARGV[0] eq 'targets') { get_targetinfo(); foreach my $target_name (sort keys %targets) { @@ -104,8 +175,15 @@ sub get_targetinfo { printf "%s %s\n", $target_name, join ' ', @{$kernels{$target_name}}; } } +elsif (@ARGV == 2 && $ARGV[0] eq 'devices') { + get_devices($ARGV[1]); + foreach my $device (sort keys %devices) { + printf "%s \"%s\"\n", $device, join '" "', @{$devices{$device}}; + } +} else { print "Usage: $0 targets\n"; print "Usage: $0 architectures\n"; print "Usage: $0 kernels\n"; + print "Usage: $0 devices \n"; } From a39dca7ead46754b9ae69baf9bec694944cde08f Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 8 Nov 2023 15:50:55 -0500 Subject: [PATCH 0633/1171] kernel: bump 5.15 to 5.15.138 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.138 Removed upstreamed: generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch[1] generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch[2] generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch[3] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.138&id=6e22bf6f00d593b0a7e0b2f418fde89317424671 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.138&id=6efd498009b987a92f57f3bdae476f0503364fb7 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.138&id=6e22bf6f00d593b0a7e0b2f418fde89317424671 Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia [Refreshed on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens (cherry picked from commit 573c8c3d78cdf494156f763c7182c0f16a8d7263) --- include/kernel-5.15 | 4 +-- .../910-unaligned_access_hacks.patch | 2 +- ...smsx95xx-fix-crimes-against-truesize.patch | 4 +-- ...ental-Enable-turbo_mode-and-packetsi.patch | 2 +- ...ow-mac-address-to-be-set-in-smsc95xx.patch | 4 +-- ...7-clk-Drop-the-rate-range-on-clk_put.patch | 2 +- ...nvmem-imx-correct-nregs-for-i.MX6SLL.patch | 28 ------------------- ...-nvmem-imx-correct-nregs-for-i.MX6UL.patch | 28 ------------------- ...nvmem-imx-correct-nregs-for-i.MX6ULL.patch | 28 ------------------- ...-r8152-add-LED-configuration-from-OF.patch | 8 +++--- .../810-pci_disable_common_quirks.patch | 6 ++-- .../0001-MIPS-lantiq-add-pcie-driver.patch | 2 +- ...move-drivers-from-strlcpy-to-strscpy.patch | 2 +- ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 2 +- 14 files changed, 19 insertions(+), 103 deletions(-) delete mode 100644 target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch delete mode 100644 target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch delete mode 100644 target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 47db849241d26b..6c2be5b3546a30 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .137 -LINUX_KERNEL_HASH-5.15.137 = 9749b21609f9e7ad9c46160c2c107db823b99cef77fa6cb080b6c2dc685fb2f7 +LINUX_VERSION-5.15 = .138 +LINUX_KERNEL_HASH-5.15.138 = af84e54164e1c01f59764ba528448ed36b377d22aafbd81b4b0cf47792ef4aaa diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 47216bee71f9f6..84723add3b8aaf 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -750,7 +750,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4170,14 +4170,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4171,14 +4171,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-5.15/950-0032-smsx95xx-fix-crimes-against-truesize.patch b/target/linux/bcm27xx/patches-5.15/950-0032-smsx95xx-fix-crimes-against-truesize.patch index 5178d8f3d65f0b..8d4423314db097 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0032-smsx95xx-fix-crimes-against-truesize.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0032-smsx95xx-fix-crimes-against-truesize.patch @@ -25,7 +25,7 @@ Signed-off-by: Steve Glendinning static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data, int in_pm) { -@@ -1843,7 +1847,8 @@ static int smsc95xx_rx_fixup(struct usbn +@@ -1845,7 +1849,8 @@ static int smsc95xx_rx_fixup(struct usbn if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(skb); skb_trim(skb, skb->len - 4); /* remove fcs */ @@ -35,7 +35,7 @@ Signed-off-by: Steve Glendinning return 1; } -@@ -1861,7 +1866,8 @@ static int smsc95xx_rx_fixup(struct usbn +@@ -1863,7 +1868,8 @@ static int smsc95xx_rx_fixup(struct usbn if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(ax_skb); skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0033-smsc95xx-Experimental-Enable-turbo_mode-and-packetsi.patch b/target/linux/bcm27xx/patches-5.15/950-0033-smsc95xx-Experimental-Enable-turbo_mode-and-packetsi.patch index fe9efa305cb9d4..52f76c12f8aa2e 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0033-smsc95xx-Experimental-Enable-turbo_mode-and-packetsi.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0033-smsc95xx-Experimental-Enable-turbo_mode-and-packetsi.patch @@ -22,7 +22,7 @@ See: http://forum.kodi.tv/showthread.php?tid=285288 static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data, int in_pm) { -@@ -915,13 +919,13 @@ static int smsc95xx_reset(struct usbnet +@@ -917,13 +921,13 @@ static int smsc95xx_reset(struct usbnet if (!turbo_mode) { burst_cap = 0; diff --git a/target/linux/bcm27xx/patches-5.15/950-0034-Allow-mac-address-to-be-set-in-smsc95xx.patch b/target/linux/bcm27xx/patches-5.15/950-0034-Allow-mac-address-to-be-set-in-smsc95xx.patch index 2983a0f1f061f2..e818e6c4acae3f 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0034-Allow-mac-address-to-be-set-in-smsc95xx.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0034-Allow-mac-address-to-be-set-in-smsc95xx.patch @@ -29,7 +29,7 @@ Signed-off-by: popcornmix static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data, int in_pm) { -@@ -771,6 +776,53 @@ static int smsc95xx_ioctl(struct net_dev +@@ -773,6 +778,53 @@ static int smsc95xx_ioctl(struct net_dev return phy_mii_ioctl(netdev->phydev, rq, cmd); } @@ -83,7 +83,7 @@ Signed-off-by: popcornmix static void smsc95xx_init_mac_address(struct usbnet *dev) { /* maybe the boot loader passed the MAC address in devicetree */ -@@ -793,6 +845,10 @@ static void smsc95xx_init_mac_address(st +@@ -795,6 +847,10 @@ static void smsc95xx_init_mac_address(st } } diff --git a/target/linux/bcm27xx/patches-5.15/950-0837-clk-Drop-the-rate-range-on-clk_put.patch b/target/linux/bcm27xx/patches-5.15/950-0837-clk-Drop-the-rate-range-on-clk_put.patch index f96e7408885cc6..b4af3d0eb2b0eb 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0837-clk-Drop-the-rate-range-on-clk_put.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0837-clk-Drop-the-rate-range-on-clk_put.patch @@ -92,7 +92,7 @@ Signed-off-by: Maxime Ripard clk_prepare_unlock(); return ret; -@@ -4359,9 +4375,10 @@ void __clk_put(struct clk *clk) +@@ -4362,9 +4378,10 @@ void __clk_put(struct clk *clk) } hlist_del(&clk->clks_node); diff --git a/target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch b/target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch deleted file mode 100644 index 8901a41a644af5..00000000000000 --- a/target/linux/generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 414a98abbefd82d591f4e2d1efd2917bcd3b6f6d Mon Sep 17 00:00:00 2001 -From: Peng Fan -Date: Fri, 13 Oct 2023 13:49:02 +0100 -Subject: [PATCH] nvmem: imx: correct nregs for i.MX6SLL - -The nregs for i.MX6SLL should be 80 per fuse map, correct it. - -Fixes: 6da27821a6f5 ("nvmem: imx-ocotp: add support for imx6sll") -Cc: Stable@vger.kernel.org -Signed-off-by: Peng Fan -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231013124904.175782-2-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/imx-ocotp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/nvmem/imx-ocotp.c -+++ b/drivers/nvmem/imx-ocotp.c -@@ -499,7 +499,7 @@ static const struct ocotp_params imx6sl_ - }; - - static const struct ocotp_params imx6sll_params = { -- .nregs = 128, -+ .nregs = 80, - .bank_address_words = 0, - .set_timing = imx_ocotp_set_imx6_timing, - .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, diff --git a/target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch b/target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch deleted file mode 100644 index db6b951d24542c..00000000000000 --- a/target/linux/generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 7d6e10f5d254681983b53d979422c8de3fadbefb Mon Sep 17 00:00:00 2001 -From: Peng Fan -Date: Fri, 13 Oct 2023 13:49:03 +0100 -Subject: [PATCH] nvmem: imx: correct nregs for i.MX6UL - -The nregs for i.MX6UL should be 144 per fuse map, correct it. - -Fixes: 4aa2b4802046 ("nvmem: octop: Add support for imx6ul") -Cc: Stable@vger.kernel.org -Signed-off-by: Peng Fan -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231013124904.175782-3-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/imx-ocotp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/nvmem/imx-ocotp.c -+++ b/drivers/nvmem/imx-ocotp.c -@@ -513,7 +513,7 @@ static const struct ocotp_params imx6sx_ - }; - - static const struct ocotp_params imx6ul_params = { -- .nregs = 128, -+ .nregs = 144, - .bank_address_words = 0, - .set_timing = imx_ocotp_set_imx6_timing, - .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, diff --git a/target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch b/target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch deleted file mode 100644 index 10ce7cd9f28acb..00000000000000 --- a/target/linux/generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2382c1b044231fd49eaf9aa82bc7113fc55487b8 Mon Sep 17 00:00:00 2001 -From: Peng Fan -Date: Fri, 13 Oct 2023 13:49:04 +0100 -Subject: [PATCH] nvmem: imx: correct nregs for i.MX6ULL - -The nregs for i.MX6ULL should be 80 per fuse map, correct it. - -Fixes: ffbc34bf0e9c ("nvmem: imx-ocotp: Implement i.MX6ULL/ULZ support") -Cc: Stable@vger.kernel.org -Signed-off-by: Peng Fan -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231013124904.175782-4-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/imx-ocotp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/nvmem/imx-ocotp.c -+++ b/drivers/nvmem/imx-ocotp.c -@@ -520,7 +520,7 @@ static const struct ocotp_params imx6ul_ - }; - - static const struct ocotp_params imx6ull_params = { -- .nregs = 64, -+ .nregs = 80, - .bank_address_words = 0, - .set_timing = imx_ocotp_set_imx6_timing, - .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, diff --git a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch index 383dfe397ff432..96525089ef5a9e 100644 --- a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch +++ b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch @@ -22,7 +22,7 @@ Signed-off-by: David Bauer #include #include #include -@@ -6889,6 +6890,22 @@ static void rtl_tally_reset(struct r8152 +@@ -6896,6 +6897,22 @@ static void rtl_tally_reset(struct r8152 ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data); } @@ -45,7 +45,7 @@ Signed-off-by: David Bauer static void r8152b_init(struct r8152 *tp) { u32 ocp_data; -@@ -6930,6 +6947,8 @@ static void r8152b_init(struct r8152 *tp +@@ -6937,6 +6954,8 @@ static void r8152b_init(struct r8152 *tp ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); @@ -54,7 +54,7 @@ Signed-off-by: David Bauer } static void r8153_init(struct r8152 *tp) -@@ -7070,6 +7089,8 @@ static void r8153_init(struct r8152 *tp) +@@ -7077,6 +7096,8 @@ static void r8153_init(struct r8152 *tp) tp->coalesce = COALESCE_SLOW; break; } @@ -63,7 +63,7 @@ Signed-off-by: David Bauer } static void r8153b_init(struct r8152 *tp) -@@ -7152,6 +7173,8 @@ static void r8153b_init(struct r8152 *tp +@@ -7159,6 +7180,8 @@ static void r8153b_init(struct r8152 *tp rtl_tally_reset(tp); tp->coalesce = 15000; /* 15 us */ diff --git a/target/linux/generic/pending-5.15/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-5.15/810-pci_disable_common_quirks.patch index 7edbd94f762469..153b5d06cfde42 100644 --- a/target/linux/generic/pending-5.15/810-pci_disable_common_quirks.patch +++ b/target/linux/generic/pending-5.15/810-pci_disable_common_quirks.patch @@ -33,7 +33,7 @@ Signed-off-by: Gabor Juhos /* * The Mellanox Tavor device gives false positive parity errors. Disable * parity error reporting. -@@ -3363,6 +3364,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I +@@ -3365,6 +3366,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); @@ -42,7 +42,7 @@ Signed-off-by: Gabor Juhos /* * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. * To work around this, query the size it should be configured to by the -@@ -3388,6 +3391,8 @@ static void quirk_intel_ntb(struct pci_d +@@ -3390,6 +3393,8 @@ static void quirk_intel_ntb(struct pci_d DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e08, quirk_intel_ntb); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e0d, quirk_intel_ntb); @@ -51,7 +51,7 @@ Signed-off-by: Gabor Juhos /* * Some BIOS implementations leave the Intel GPU interrupts enabled, even * though no one is handling them (e.g., if the i915 driver is never -@@ -3426,6 +3431,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN +@@ -3428,6 +3433,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); diff --git a/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch index 9cd3b08b8e1231..8063307c528db1 100644 --- a/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch +++ b/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch @@ -5490,7 +5490,7 @@ Signed-off-by: John Crispin unsigned long type); --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h -@@ -1085,6 +1085,12 @@ +@@ -1086,6 +1086,12 @@ #define PCI_DEVICE_ID_SGI_IOC3 0x0003 #define PCI_DEVICE_ID_SGI_LITHIUM 0x1002 diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index e3ccef4403609b..0d9fa0550b23d1 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -72,7 +72,7 @@ Signed-off-by: Wolfram Sang idev->adapter.dev.parent = &pdev->dev; --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -1027,7 +1027,7 @@ static int aspeed_i2c_probe_bus(struct p +@@ -1028,7 +1028,7 @@ static int aspeed_i2c_probe_bus(struct p bus->adap.algo = &aspeed_i2c_algo; bus->adap.dev.parent = &pdev->dev; bus->adap.dev.of_node = pdev->dev.of_node; diff --git a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch index 842bed4c427f7d..05eaa9aedfe7e8 100644 --- a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch +++ b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch @@ -22,7 +22,7 @@ Signed-off-by: Tim Harvey #include #include #include -@@ -5856,3 +5857,34 @@ static void nvidia_ion_ahci_fixup(struct +@@ -5858,3 +5859,34 @@ static void nvidia_ion_ahci_fixup(struct pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); From 40bd2bb3d6e1316dcb239461217e27db6cbdefe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 22 May 2023 10:31:33 +0200 Subject: [PATCH 0634/1171] firmware-utils: new package replacing otrx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of firmware utils may be required on target devices. It's useful e.g. for dealing with some firmware formats. That is often required (supporting specific format) to provide an option to revert to original firmware. So far we had packaged "otrx" util only for use on Broadcom targets. Refactor that to package the whole firmware-utils project so we can package any single util needed. Signed-off-by: Rafał Miłecki (cherry picked from commit 24d6abe2d7cd8b93ee5e390af8d90eda54611dd1) --- package/utils/firmware-utils/Makefile | 33 +++++++++++++++++++ package/utils/otrx/Makefile | 46 --------------------------- 2 files changed, 33 insertions(+), 46 deletions(-) create mode 100644 package/utils/firmware-utils/Makefile delete mode 100644 package/utils/otrx/Makefile diff --git a/package/utils/firmware-utils/Makefile b/package/utils/firmware-utils/Makefile new file mode 100644 index 00000000000000..4d830cac4906f0 --- /dev/null +++ b/package/utils/firmware-utils/Makefile @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk + +PKG_NAME:=firmware-utils +PKG_RELEASE:=2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git +PKG_SOURCE_DATE:=2023-05-18 +PKG_SOURCE_VERSION:=02cdbc6a4d61605c008efef09162f772f553fcde +PKG_MIRROR_HASH:=f5188fc38bb03ddbcc34763ff049597e2d8af98c0854910dc87f10e5927096e2 + +PKG_BUILD_DEPENDS:=openssl zlib + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/default + SECTION:=utils + CATEGORY:=Base system + TITLE:=Firmware utility $(1) + DEPENDS:=$(2) +endef + +Package/otrx = $(call Package/default,otrx,@(TARGET_bcm47xx||TARGET_bcm53xx)) + +define Package/otrx/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/otrx $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,otrx)) diff --git a/package/utils/otrx/Makefile b/package/utils/otrx/Makefile deleted file mode 100644 index 35c59e2730190c..00000000000000 --- a/package/utils/otrx/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (C) 2015 Rafał Miłecki -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=otrx -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2021-12-02 -PKG_SOURCE_VERSION:=56e8e19151743c923f48604c457850cf8eb52076 -PKG_MIRROR_HASH:=2a40ac73e8eab0a7a4474cb331b8e2fc972635314b0b5e02a9f2b9a32c5d5f3b - -include $(INCLUDE_DIR)/package.mk - -define Package/otrx - SECTION:=utils - CATEGORY:=Base system - TITLE:=Utility for opening (analyzing) TRX firmware images - MAINTAINER:=Rafał Miłecki - DEPENDS:=@(TARGET_bcm47xx||TARGET_bcm53xx) -endef - -define Package/otrx/description - This package contains an utility that allows validating TRX images. -endef - -TARGET_CFLAGS += -Wall - -define Build/Compile - $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \ - -o $(PKG_BUILD_DIR)/otrx \ - $(PKG_BUILD_DIR)/src/otrx.c -endef - -define Package/otrx/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/otrx $(1)/usr/bin/ -endef - -$(eval $(call BuildPackage,otrx)) From d6b62611b845ea90ad4c901e28fa1787c4b7e9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 22 May 2023 10:31:34 +0200 Subject: [PATCH 0635/1171] firmware-utils: package oseama MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's required by bcm53xx. This allows dropping separated oseama package and avoids some code duplication. Signed-off-by: Rafał Miłecki (cherry picked from commit 1d9d0ca376c616a2cede9d30f370aa0c2f7984e6) --- package/utils/firmware-utils/Makefile | 8 + package/utils/oseama/Makefile | 40 -- package/utils/oseama/src/Makefile | 7 - package/utils/oseama/src/md5.c | 296 -------------- package/utils/oseama/src/md5.h | 45 --- package/utils/oseama/src/oseama.c | 556 -------------------------- 6 files changed, 8 insertions(+), 944 deletions(-) delete mode 100644 package/utils/oseama/Makefile delete mode 100644 package/utils/oseama/src/Makefile delete mode 100644 package/utils/oseama/src/md5.c delete mode 100644 package/utils/oseama/src/md5.h delete mode 100644 package/utils/oseama/src/oseama.c diff --git a/package/utils/firmware-utils/Makefile b/package/utils/firmware-utils/Makefile index 4d830cac4906f0..1316fa5c6b1803 100644 --- a/package/utils/firmware-utils/Makefile +++ b/package/utils/firmware-utils/Makefile @@ -23,6 +23,13 @@ define Package/default DEPENDS:=$(2) endef +Package/oseama = $(call Package/default,oseama,@TARGET_bcm53xx) + +define Package/oseama/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/oseama $(1)/usr/bin/ +endef + Package/otrx = $(call Package/default,otrx,@(TARGET_bcm47xx||TARGET_bcm53xx)) define Package/otrx/install @@ -30,4 +37,5 @@ define Package/otrx/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/otrx $(1)/usr/bin/ endef +$(eval $(call BuildPackage,oseama)) $(eval $(call BuildPackage,otrx)) diff --git a/package/utils/oseama/Makefile b/package/utils/oseama/Makefile deleted file mode 100644 index 7d9303b92d58fb..00000000000000 --- a/package/utils/oseama/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (C) 2016 Rafał Miłecki -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=oseama -PKG_RELEASE:=1 - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/package.mk - -define Package/oseama - SECTION:=utils - CATEGORY:=Base system - TITLE:=Utility for handling Seama firmware images - MAINTAINER:=Rafał Miłecki - DEPENDS:=@TARGET_bcm53xx -endef - -define Package/oseama/description - This package contains an utility that allows handling Seama images. -endef - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - CC="$(TARGET_CC)" \ - CFLAGS="$(TARGET_CFLAGS) -Wall" -endef - -define Package/oseama/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/oseama $(1)/usr/bin/ -endef - -$(eval $(call BuildPackage,oseama)) diff --git a/package/utils/oseama/src/Makefile b/package/utils/oseama/src/Makefile deleted file mode 100644 index ca35e6ee99d0ca..00000000000000 --- a/package/utils/oseama/src/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: oseama - -oseama: - $(CC) $(CFLAGS) -Wall oseama.c md5.c -o $@ $^ - -clean: - rm -f oseama diff --git a/package/utils/oseama/src/md5.c b/package/utils/oseama/src/md5.c deleted file mode 100644 index 52d96accd30ea6..00000000000000 --- a/package/utils/oseama/src/md5.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. - * MD5 Message-Digest Algorithm (RFC 1321). - * - * Homepage: - * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 - * - * Author: - * Alexander Peslyak, better known as Solar Designer - * - * This software was written by Alexander Peslyak in 2001. No copyright is - * claimed, and the software is hereby placed in the public domain. - * In case this attempt to disclaim copyright and place the software in the - * public domain is deemed null and void, then the software is - * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the - * general public under the following terms: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted. - * - * There's ABSOLUTELY NO WARRANTY, express or implied. - * - * (This is a heavily cut-down "BSD license".) - * - * This differs from Colin Plumb's older public domain implementation in that - * no exactly 32-bit integer data type is required (any 32-bit or wider - * unsigned integer data type will do), there's no compile-time endianness - * configuration, and the function prototypes match OpenSSL's. No code from - * Colin Plumb's implementation has been reused; this comment merely compares - * the properties of the two independent implementations. - * - * The primary goals of this implementation are portability and ease of use. - * It is meant to be fast, but not as fast as possible. Some known - * optimizations are not included to reduce source code size and avoid - * compile-time configuration. - */ - -#ifndef HAVE_OPENSSL - -#include - -#include "md5.h" - -/* - * The basic MD5 functions. - * - * F and G are optimized compared to their RFC 1321 definitions for - * architectures that lack an AND-NOT instruction, just like in Colin Plumb's - * implementation. - */ -#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) -#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) -#define H(x, y, z) (((x) ^ (y)) ^ (z)) -#define H2(x, y, z) ((x) ^ ((y) ^ (z))) -#define I(x, y, z) ((y) ^ ((x) | ~(z))) - -/* - * The MD5 transformation for all four rounds. - */ -#define STEP(f, a, b, c, d, x, t, s) \ - (a) += f((b), (c), (d)) + (x) + (t); \ - (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ - (a) += (b); - -/* - * SET reads 4 input bytes in little-endian byte order and stores them - * in a properly aligned word in host byte order. - * - * The check for little-endian architectures that tolerate unaligned - * memory accesses is just an optimization. Nothing will break if it - * doesn't work. - */ -#if defined(__i386__) || defined(__x86_64__) || defined(__vax__) -#define SET(n) \ - (*(MD5_u32plus *)&ptr[(n) * 4]) -#define GET(n) \ - SET(n) -#else -#define SET(n) \ - (ctx->block[(n)] = \ - (MD5_u32plus)ptr[(n) * 4] | \ - ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ - ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ - ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) -#define GET(n) \ - (ctx->block[(n)]) -#endif - -/* - * This processes one or more 64-byte data blocks, but does NOT update - * the bit counters. There are no alignment requirements. - */ -static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) -{ - const unsigned char *ptr; - MD5_u32plus a, b, c, d; - MD5_u32plus saved_a, saved_b, saved_c, saved_d; - - ptr = (const unsigned char *)data; - - a = ctx->a; - b = ctx->b; - c = ctx->c; - d = ctx->d; - - do { - saved_a = a; - saved_b = b; - saved_c = c; - saved_d = d; - -/* Round 1 */ - STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) - STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) - STEP(F, c, d, a, b, SET(2), 0x242070db, 17) - STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) - STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) - STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) - STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) - STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) - STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) - STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) - STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) - STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) - STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) - STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) - STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) - STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) - -/* Round 2 */ - STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) - STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) - STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) - STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) - STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) - STEP(G, d, a, b, c, GET(10), 0x02441453, 9) - STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) - STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) - STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) - STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) - STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) - STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) - STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) - STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) - STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) - STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) - -/* Round 3 */ - STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) - STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11) - STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) - STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23) - STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) - STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11) - STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) - STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23) - STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) - STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11) - STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) - STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23) - STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) - STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11) - STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) - STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23) - -/* Round 4 */ - STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) - STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) - STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) - STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) - STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) - STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) - STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) - STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) - STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) - STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) - STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) - STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) - STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) - STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) - STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) - STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) - - a += saved_a; - b += saved_b; - c += saved_c; - d += saved_d; - - ptr += 64; - } while (size -= 64); - - ctx->a = a; - ctx->b = b; - ctx->c = c; - ctx->d = d; - - return ptr; -} - -void MD5_Init(MD5_CTX *ctx) -{ - ctx->a = 0x67452301; - ctx->b = 0xefcdab89; - ctx->c = 0x98badcfe; - ctx->d = 0x10325476; - - ctx->lo = 0; - ctx->hi = 0; -} - -void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) -{ - MD5_u32plus saved_lo; - unsigned long used, available; - - saved_lo = ctx->lo; - if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) - ctx->hi++; - ctx->hi += size >> 29; - - used = saved_lo & 0x3f; - - if (used) { - available = 64 - used; - - if (size < available) { - memcpy(&ctx->buffer[used], data, size); - return; - } - - memcpy(&ctx->buffer[used], data, available); - data = (const unsigned char *)data + available; - size -= available; - body(ctx, ctx->buffer, 64); - } - - if (size >= 64) { - data = body(ctx, data, size & ~(unsigned long)0x3f); - size &= 0x3f; - } - - memcpy(ctx->buffer, data, size); -} - -void MD5_Final(unsigned char *result, MD5_CTX *ctx) -{ - unsigned long used, available; - - used = ctx->lo & 0x3f; - - ctx->buffer[used++] = 0x80; - - available = 64 - used; - - if (available < 8) { - memset(&ctx->buffer[used], 0, available); - body(ctx, ctx->buffer, 64); - used = 0; - available = 64; - } - - memset(&ctx->buffer[used], 0, available - 8); - - ctx->lo <<= 3; - ctx->buffer[56] = ctx->lo; - ctx->buffer[57] = ctx->lo >> 8; - ctx->buffer[58] = ctx->lo >> 16; - ctx->buffer[59] = ctx->lo >> 24; - ctx->buffer[60] = ctx->hi; - ctx->buffer[61] = ctx->hi >> 8; - ctx->buffer[62] = ctx->hi >> 16; - ctx->buffer[63] = ctx->hi >> 24; - - body(ctx, ctx->buffer, 64); - - result[0] = ctx->a; - result[1] = ctx->a >> 8; - result[2] = ctx->a >> 16; - result[3] = ctx->a >> 24; - result[4] = ctx->b; - result[5] = ctx->b >> 8; - result[6] = ctx->b >> 16; - result[7] = ctx->b >> 24; - result[8] = ctx->c; - result[9] = ctx->c >> 8; - result[10] = ctx->c >> 16; - result[11] = ctx->c >> 24; - result[12] = ctx->d; - result[13] = ctx->d >> 8; - result[14] = ctx->d >> 16; - result[15] = ctx->d >> 24; - - memset(ctx, 0, sizeof(*ctx)); -} - -#endif diff --git a/package/utils/oseama/src/md5.h b/package/utils/oseama/src/md5.h deleted file mode 100644 index 2da44bf355a3a0..00000000000000 --- a/package/utils/oseama/src/md5.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. - * MD5 Message-Digest Algorithm (RFC 1321). - * - * Homepage: - * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 - * - * Author: - * Alexander Peslyak, better known as Solar Designer - * - * This software was written by Alexander Peslyak in 2001. No copyright is - * claimed, and the software is hereby placed in the public domain. - * In case this attempt to disclaim copyright and place the software in the - * public domain is deemed null and void, then the software is - * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the - * general public under the following terms: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted. - * - * There's ABSOLUTELY NO WARRANTY, express or implied. - * - * See md5.c for more information. - */ - -#ifdef HAVE_OPENSSL -#include -#elif !defined(_MD5_H) -#define _MD5_H - -/* Any 32-bit or wider unsigned integer data type will do */ -typedef unsigned int MD5_u32plus; - -typedef struct { - MD5_u32plus lo, hi; - MD5_u32plus a, b, c, d; - unsigned char buffer[64]; - MD5_u32plus block[16]; -} MD5_CTX; - -extern void MD5_Init(MD5_CTX *ctx); -extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); -extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); - -#endif diff --git a/package/utils/oseama/src/oseama.c b/package/utils/oseama/src/oseama.c deleted file mode 100644 index 4434b11162e227..00000000000000 --- a/package/utils/oseama/src/oseama.c +++ /dev/null @@ -1,556 +0,0 @@ -/* - * oseama - * - * Copyright (C) 2016 Rafał Miłecki - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "md5.h" - -#if !defined(__BYTE_ORDER) -#error "Unknown byte order" -#endif - -#if __BYTE_ORDER == __BIG_ENDIAN -#define cpu_to_be32(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_be16(x) (x) -#define be16_to_cpu(x) (x) -#elif __BYTE_ORDER == __LITTLE_ENDIAN -#define cpu_to_be32(x) bswap_32(x) -#define be32_to_cpu(x) bswap_32(x) -#define cpu_to_be16(x) bswap_16(x) -#define be16_to_cpu(x) bswap_16(x) -#else -#error "Unsupported endianness" -#endif - -#define SEAMA_MAGIC 0x5ea3a417 - -struct seama_seal_header { - uint32_t magic; - uint16_t reserved; - uint16_t metasize; - uint32_t imagesize; -} __attribute__ ((packed)); - -struct seama_entity_header { - uint32_t magic; - uint16_t reserved; - uint16_t metasize; - uint32_t imagesize; - uint8_t md5[16]; -} __attribute__ ((packed)); - -char *seama_path; -int entity_idx = -1; -char *out_path; - -static inline size_t oseama_min(size_t x, size_t y) { - return x < y ? x : y; -} - -/************************************************** - * Info - **************************************************/ - -static void oseama_info_parse_options(int argc, char **argv) { - int c; - - while ((c = getopt(argc, argv, "e:")) != -1) { - switch (c) { - case 'e': - entity_idx = atoi(optarg); - break; - } - } -} - -static int oseama_info_entities(FILE *seama) { - struct seama_entity_header hdr; - size_t bytes, metasize, imagesize; - uint8_t buf[1024]; - char *end, *tmp; - int i = 0; - int err = 0; - - while ((bytes = fread(&hdr, 1, sizeof(hdr), seama)) == sizeof(hdr)) { - if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC) { - fprintf(stderr, "Invalid Seama magic: 0x%08x\n", be32_to_cpu(hdr.magic)); - err = -EINVAL; - goto err_out; - } - metasize = be16_to_cpu(hdr.metasize); - imagesize = be32_to_cpu(hdr.imagesize); - - if (entity_idx >= 0 && i != entity_idx) { - fseek(seama, metasize + imagesize, SEEK_CUR); - i++; - continue; - } - - if (metasize >= sizeof(buf)) { - fprintf(stderr, "Too small buffer (%zu B) to read all meta info (%zd B)\n", sizeof(buf), metasize); - err = -EINVAL; - goto err_out; - } - - if (entity_idx < 0) - printf("\n"); - printf("Entity offset:\t%ld\n", ftell(seama) - sizeof(hdr)); - printf("Entity size:\t%zd\n", sizeof(hdr) + metasize + imagesize); - printf("Meta size:\t%zd\n", metasize); - printf("Image size:\t%zd\n", imagesize); - - bytes = fread(buf, 1, metasize, seama); - if (bytes != metasize) { - fprintf(stderr, "Couldn't read %zd B of meta\n", metasize); - err = -EIO; - goto err_out; - } - - end = (char *)&buf[metasize - 1]; - *end = '\0'; - for (tmp = (char *)buf; tmp < end && strlen(tmp); tmp += strlen(tmp) + 1) { - printf("Meta entry:\t%s\n", tmp); - } - - fseek(seama, imagesize, SEEK_CUR); - i++; - } - -err_out: - return err; -} - -static int oseama_info(int argc, char **argv) { - FILE *seama; - struct seama_seal_header hdr; - size_t bytes; - uint16_t metasize; - uint32_t imagesize; - uint8_t buf[1024]; - int err = 0; - - if (argc < 3) { - fprintf(stderr, "No Seama file passed\n"); - err = -EINVAL; - goto out; - } - seama_path = argv[2]; - - optind = 3; - oseama_info_parse_options(argc, argv); - - seama = fopen(seama_path, "r"); - if (!seama) { - fprintf(stderr, "Couldn't open %s\n", seama_path); - err = -EACCES; - goto out; - } - - bytes = fread(&hdr, 1, sizeof(hdr), seama); - if (bytes != sizeof(hdr)) { - fprintf(stderr, "Couldn't read %s header\n", seama_path); - err = -EIO; - goto err_close; - } - metasize = be16_to_cpu(hdr.metasize); - imagesize = be32_to_cpu(hdr.imagesize); - - if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC) { - fprintf(stderr, "Invalid Seama magic: 0x%08x\n", be32_to_cpu(hdr.magic)); - err = -EINVAL; - goto err_close; - } - - if (metasize >= sizeof(buf)) { - fprintf(stderr, "Too small buffer (%zu B) to read all meta info (%d B)\n", sizeof(buf), metasize); - err = -EINVAL; - goto err_close; - } - - if (imagesize) { - fprintf(stderr, "Invalid Seama image size: 0x%08x (should be 0)\n", imagesize); - err = -EINVAL; - goto err_close; - } - - bytes = fread(buf, 1, metasize, seama); - if (bytes != metasize) { - fprintf(stderr, "Couldn't read %d B of meta\n", metasize); - err = -EIO; - goto err_close; - } - - if (entity_idx < 0) { - char *end, *tmp; - - printf("Meta size:\t%d\n", metasize); - printf("Image size:\t%d\n", imagesize); - - end = (char *)&buf[metasize - 1]; - *end = '\0'; - for (tmp = (char *)buf; tmp < end && strlen(tmp); tmp += strlen(tmp) + 1) { - printf("Meta entry:\t%s\n", tmp); - } - } - - oseama_info_entities(seama); - -err_close: - fclose(seama); -out: - return err; -} - -/************************************************** - * Create - **************************************************/ - -static ssize_t oseama_entity_append_file(FILE *seama, const char *in_path) { - FILE *in; - size_t bytes; - ssize_t length = 0; - uint8_t buf[128]; - - in = fopen(in_path, "r"); - if (!in) { - fprintf(stderr, "Couldn't open %s\n", in_path); - return -EACCES; - } - - while ((bytes = fread(buf, 1, sizeof(buf), in)) > 0) { - if (fwrite(buf, 1, bytes, seama) != bytes) { - fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, seama_path); - length = -EIO; - break; - } - length += bytes; - } - - fclose(in); - - return length; -} - -static ssize_t oseama_entity_append_zeros(FILE *seama, size_t length) { - uint8_t *buf; - - buf = malloc(length); - if (!buf) - return -ENOMEM; - memset(buf, 0, length); - - if (fwrite(buf, 1, length, seama) != length) { - fprintf(stderr, "Couldn't write %zu B to %s\n", length, seama_path); - return -EIO; - } - - return length; -} - -static ssize_t oseama_entity_align(FILE *seama, size_t curr_offset, size_t alignment) { - if (curr_offset & (alignment - 1)) { - size_t length = alignment - (curr_offset % alignment); - - return oseama_entity_append_zeros(seama, length); - } - - return 0; -} - -static int oseama_entity_write_hdr(FILE *seama, size_t metasize, size_t imagesize) { - struct seama_entity_header hdr = {}; - uint8_t buf[128]; - size_t length = imagesize; - size_t bytes; - MD5_CTX ctx; - - fseek(seama, sizeof(hdr) + metasize, SEEK_SET); - MD5_Init(&ctx); - while ((bytes = fread(buf, 1, oseama_min(sizeof(buf), length), seama)) > 0) { - MD5_Update(&ctx, buf, bytes); - length -= bytes; - } - MD5_Final(hdr.md5, &ctx); - - hdr.magic = cpu_to_be32(SEAMA_MAGIC); - hdr.metasize = cpu_to_be16(metasize); - hdr.imagesize = cpu_to_be32(imagesize); - - fseek(seama, 0, SEEK_SET); - bytes = fwrite(&hdr, 1, sizeof(hdr), seama); - if (bytes != sizeof(hdr)) { - fprintf(stderr, "Couldn't write Seama entity header to %s\n", seama_path); - return -EIO; - } - - return 0; -} - -static int oseama_entity(int argc, char **argv) { - FILE *seama; - ssize_t sbytes; - size_t curr_offset = sizeof(struct seama_entity_header); - size_t metasize = 0, imagesize = 0; - int c; - int err = 0; - - if (argc < 3) { - fprintf(stderr, "No Seama file passed\n"); - err = -EINVAL; - goto out; - } - seama_path = argv[2]; - - seama = fopen(seama_path, "w+"); - if (!seama) { - fprintf(stderr, "Couldn't open %s\n", seama_path); - err = -EACCES; - goto out; - } - fseek(seama, curr_offset, SEEK_SET); - - optind = 3; - while ((c = getopt(argc, argv, "m:f:b:")) != -1) { - switch (c) { - case 'm': - sbytes = fwrite(optarg, 1, strlen(optarg) + 1, seama); - if (sbytes < 0) { - fprintf(stderr, "Failed to write meta %s\n", optarg); - } else { - curr_offset += sbytes; - metasize += sbytes; - } - - sbytes = oseama_entity_align(seama, curr_offset, 4); - if (sbytes < 0) { - fprintf(stderr, "Failed to append zeros\n"); - } else { - curr_offset += sbytes; - metasize += sbytes; - } - - break; - case 'f': - case 'b': - break; - } - } - - optind = 3; - while ((c = getopt(argc, argv, "m:f:b:")) != -1) { - switch (c) { - case 'm': - break; - case 'f': - sbytes = oseama_entity_append_file(seama, optarg); - if (sbytes < 0) { - fprintf(stderr, "Failed to append file %s\n", optarg); - } else { - curr_offset += sbytes; - imagesize += sbytes; - } - break; - case 'b': - sbytes = strtol(optarg, NULL, 0) - curr_offset; - if (sbytes < 0) { - fprintf(stderr, "Current Seama entity length is 0x%zx, can't pad it with zeros to 0x%lx\n", curr_offset, strtol(optarg, NULL, 0)); - } else { - sbytes = oseama_entity_append_zeros(seama, sbytes); - if (sbytes < 0) { - fprintf(stderr, "Failed to append zeros\n"); - } else { - curr_offset += sbytes; - imagesize += sbytes; - } - } - break; - } - if (err) - break; - } - - oseama_entity_write_hdr(seama, metasize, imagesize); - - fclose(seama); -out: - return err; -} - -/************************************************** - * Extract - **************************************************/ - -static void oseama_extract_parse_options(int argc, char **argv) { - int c; - - while ((c = getopt(argc, argv, "e:o:")) != -1) { - switch (c) { - case 'e': - entity_idx = atoi(optarg); - break; - case 'o': - out_path = optarg; - break; - } - } -} - -static int oseama_extract_entity(FILE *seama, FILE *out) { - struct seama_entity_header hdr; - size_t bytes, metasize, imagesize, length; - uint8_t buf[1024]; - int i = 0; - int err = 0; - - while ((bytes = fread(&hdr, 1, sizeof(hdr), seama)) == sizeof(hdr)) { - if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC) { - fprintf(stderr, "Invalid Seama magic: 0x%08x\n", be32_to_cpu(hdr.magic)); - err = -EINVAL; - break; - } - metasize = be16_to_cpu(hdr.metasize); - imagesize = be32_to_cpu(hdr.imagesize); - - if (i != entity_idx) { - fseek(seama, metasize + imagesize, SEEK_CUR); - i++; - continue; - } - - fseek(seama, -sizeof(hdr), SEEK_CUR); - - length = sizeof(hdr) + metasize + imagesize; - while ((bytes = fread(buf, 1, oseama_min(sizeof(buf), length), seama)) > 0) { - if (fwrite(buf, 1, bytes, out) != bytes) { - fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, out_path); - err = -EIO; - break; - } - length -= bytes; - } - - if (length) { - fprintf(stderr, "Couldn't extract whole entity %d from %s (%zu B left)\n", entity_idx, seama_path, length); - err = -EIO; - break; - } - - break; - } - - return err; -} - -static int oseama_extract(int argc, char **argv) { - FILE *seama; - FILE *out; - struct seama_seal_header hdr; - size_t bytes; - uint16_t metasize; - int err = 0; - - if (argc < 3) { - fprintf(stderr, "No Seama file passed\n"); - err = -EINVAL; - goto out; - } - seama_path = argv[2]; - - optind = 3; - oseama_extract_parse_options(argc, argv); - if (entity_idx < 0) { - fprintf(stderr, "No entity specified\n"); - err = -EINVAL; - goto out; - } else if (!out_path) { - fprintf(stderr, "No output file specified\n"); - err = -EINVAL; - goto out; - } - - seama = fopen(seama_path, "r"); - if (!seama) { - fprintf(stderr, "Couldn't open %s\n", seama_path); - err = -EACCES; - goto out; - } - - out = fopen(out_path, "w"); - if (!out) { - fprintf(stderr, "Couldn't open %s\n", out_path); - err = -EACCES; - goto err_close_seama; - } - - bytes = fread(&hdr, 1, sizeof(hdr), seama); - if (bytes != sizeof(hdr)) { - fprintf(stderr, "Couldn't read %s header\n", seama_path); - err = -EIO; - goto err_close_out; - } - metasize = be16_to_cpu(hdr.metasize); - - fseek(seama, metasize, SEEK_CUR); - - oseama_extract_entity(seama, out); - -err_close_out: - fclose(out); -err_close_seama: - fclose(seama); -out: - return err; -} - -/************************************************** - * Start - **************************************************/ - -static void usage() { - printf("Usage:\n"); - printf("\n"); - printf("Info about Seama seal (container):\n"); - printf("\toseama info [options]\n"); - printf("\t-e\t\t\t\tprint info about specified entity only\n"); - printf("\n"); - printf("Create Seama entity:\n"); - printf("\toseama entity [options]\n"); - printf("\t-m meta\t\t\t\tmeta into to put in header\n"); - printf("\t-f file\t\t\t\tappend content from file\n"); - printf("\t-b offset\t\t\tappend zeros till reaching absolute offset\n"); - printf("\n"); - printf("Extract from Seama seal (container):\n"); - printf("\toseama extract [options]\n"); - printf("\t-e\t\t\t\tindex of entity to extract\n"); - printf("\t-o file\t\t\t\toutput file\n"); -} - -int main(int argc, char **argv) { - if (argc > 1) { - if (!strcmp(argv[1], "info")) - return oseama_info(argc, argv); - else if (!strcmp(argv[1], "entity")) - return oseama_entity(argc, argv); - else if (!strcmp(argv[1], "extract")) - return oseama_extract(argc, argv); - } - - usage(); - return 0; -} From 95ebd609ae7bdcdb48c74ad93d747f24c94d4a07 Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 20 Nov 2023 08:23:17 -0500 Subject: [PATCH 0636/1171] kernel: bump 5.15 to 5.15.139 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.139 Removed upstreamed: x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch[3] All other patches automatically rebased. 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.139&id=a5c83c8043d70b9a28d1bd78a2dbbab340f43889 Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia [Refresh on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens (cherry picked from commit df167450a5094034bf4c5ad6fbfce502b09662bb) --- include/kernel-5.15 | 4 +- ...lti-gen-LRU-support-page-table-walks.patch | 2 +- ...configurable-downshift-for-addresses.patch | 8 ++-- ...efined-reg_base-to-be-added-to-every.patch | 8 ++-- ..._base-and-reg_downshift-for-single-r.patch | 6 +-- .../hack-5.15/259-regmap_dynamic.patch | 2 +- .../hack-5.15/904-debloat_dma_buf.patch | 2 +- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- ...-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch | 2 +- ...1-clk-qcom-clk-rcg2-add-rcg2-mux-ops.patch | 2 +- ...che-CFG-register-updates-for-parked-.patch | 16 +++---- ...2-introduce-support-for-multiple-con.patch | 12 ++--- ...a-support-HW-controlled-mode-via-pri.patch | 12 ++--- ...a-initialize-multi-intensity-to-full.patch | 2 +- ...a-change-max-brightness-from-255-to-.patch | 2 +- ...-hwrng-geode-fix-accessing-registers.patch | 47 ------------------- 16 files changed, 41 insertions(+), 88 deletions(-) delete mode 100644 target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 6c2be5b3546a30..30ee7cd866aac5 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .138 -LINUX_KERNEL_HASH-5.15.138 = af84e54164e1c01f59764ba528448ed36b377d22aafbd81b4b0cf47792ef4aaa +LINUX_VERSION-5.15 = .139 +LINUX_KERNEL_HASH-5.15.139 = 9c68c10dfe18e59b892e940436dea6a18d167160d55e62563cf7282244d8044e diff --git a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch index 754d97d84b42dd..43fd69ae7944e5 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch @@ -414,7 +414,7 @@ Signed-off-by: Andrew Morton /* forking complete and child started to run, tell ptracer */ --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -5010,6 +5010,7 @@ context_switch(struct rq *rq, struct tas +@@ -5014,6 +5014,7 @@ context_switch(struct rq *rq, struct tas * finish_task_switch()'s mmdrop(). */ switch_mm_irqs_off(prev->active_mm, next->mm, next); diff --git a/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch b/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch index 99cd89ea002f43..7bb328f3a6de9a 100644 --- a/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch +++ b/target/linux/generic/backport-5.15/350-v5.18-regmap-add-configurable-downshift-for-addresses.patch @@ -37,7 +37,7 @@ Signed-off-by: Mark Brown map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8); map->format.buf_size = DIV_ROUND_UP(config->reg_bits + config->val_bits + config->pad_bits, 8); -@@ -1735,6 +1736,7 @@ static int _regmap_raw_write_impl(struct +@@ -1737,6 +1738,7 @@ static int _regmap_raw_write_impl(struct return ret; } @@ -45,7 +45,7 @@ Signed-off-by: Mark Brown map->format.format_reg(map->work_buf, reg, map->reg_shift); regmap_set_work_buf_flag_mask(map, map->format.reg_bytes, map->write_flag_mask); -@@ -1905,6 +1907,7 @@ static int _regmap_bus_formatted_write(v +@@ -1907,6 +1909,7 @@ static int _regmap_bus_formatted_write(v return ret; } @@ -53,7 +53,7 @@ Signed-off-by: Mark Brown map->format.format_write(map, reg, val); trace_regmap_hw_write_start(map, reg, 1); -@@ -2346,6 +2349,7 @@ static int _regmap_raw_multi_reg_write(s +@@ -2348,6 +2351,7 @@ static int _regmap_raw_multi_reg_write(s unsigned int reg = regs[i].reg; unsigned int val = regs[i].def; trace_regmap_hw_write_start(map, reg, 1); @@ -61,7 +61,7 @@ Signed-off-by: Mark Brown map->format.format_reg(u8, reg, map->reg_shift); u8 += reg_bytes + pad_bytes; map->format.format_val(u8, val, 0); -@@ -2673,6 +2677,7 @@ static int _regmap_raw_read(struct regma +@@ -2675,6 +2679,7 @@ static int _regmap_raw_read(struct regma return ret; } diff --git a/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch b/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch index 0f32288fcab5b3..841f8d45286fe0 100644 --- a/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch +++ b/target/linux/generic/backport-5.15/351-v5.18-regmap-allow-a-defined-reg_base-to-be-added-to-every.patch @@ -42,7 +42,7 @@ Signed-off-by: Mark Brown map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8); map->format.pad_bytes = config->pad_bits / 8; map->format.reg_downshift = config->reg_downshift; -@@ -1736,6 +1738,7 @@ static int _regmap_raw_write_impl(struct +@@ -1738,6 +1740,7 @@ static int _regmap_raw_write_impl(struct return ret; } @@ -50,7 +50,7 @@ Signed-off-by: Mark Brown reg >>= map->format.reg_downshift; map->format.format_reg(map->work_buf, reg, map->reg_shift); regmap_set_work_buf_flag_mask(map, map->format.reg_bytes, -@@ -1907,6 +1910,7 @@ static int _regmap_bus_formatted_write(v +@@ -1909,6 +1912,7 @@ static int _regmap_bus_formatted_write(v return ret; } @@ -58,7 +58,7 @@ Signed-off-by: Mark Brown reg >>= map->format.reg_downshift; map->format.format_write(map, reg, val); -@@ -2349,6 +2353,7 @@ static int _regmap_raw_multi_reg_write(s +@@ -2351,6 +2355,7 @@ static int _regmap_raw_multi_reg_write(s unsigned int reg = regs[i].reg; unsigned int val = regs[i].def; trace_regmap_hw_write_start(map, reg, 1); @@ -66,7 +66,7 @@ Signed-off-by: Mark Brown reg >>= map->format.reg_downshift; map->format.format_reg(u8, reg, map->reg_shift); u8 += reg_bytes + pad_bytes; -@@ -2677,6 +2682,7 @@ static int _regmap_raw_read(struct regma +@@ -2679,6 +2684,7 @@ static int _regmap_raw_read(struct regma return ret; } diff --git a/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch b/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch index 804f68d23c50a5..bc3865c75b92af 100644 --- a/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch +++ b/target/linux/generic/backport-5.15/352-v6.3-regmap-apply-reg_base-and-reg_downshift-for-single-r.patch @@ -28,7 +28,7 @@ Signed-off-by: Mark Brown --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c -@@ -1929,6 +1929,8 @@ static int _regmap_bus_reg_write(void *c +@@ -1931,6 +1931,8 @@ static int _regmap_bus_reg_write(void *c { struct regmap *map = context; @@ -37,7 +37,7 @@ Signed-off-by: Mark Brown return map->bus->reg_write(map->bus_context, reg, val); } -@@ -2703,6 +2705,8 @@ static int _regmap_bus_reg_read(void *co +@@ -2705,6 +2707,8 @@ static int _regmap_bus_reg_read(void *co { struct regmap *map = context; @@ -46,7 +46,7 @@ Signed-off-by: Mark Brown return map->bus->reg_read(map->bus_context, reg, val); } -@@ -3078,6 +3082,8 @@ static int _regmap_update_bits(struct re +@@ -3080,6 +3084,8 @@ static int _regmap_update_bits(struct re *change = false; if (regmap_volatile(map, reg) && map->reg_update_bits) { diff --git a/target/linux/generic/hack-5.15/259-regmap_dynamic.patch b/target/linux/generic/hack-5.15/259-regmap_dynamic.patch index 76a5ace6f31536..e0820ccfc0dbf3 100644 --- a/target/linux/generic/hack-5.15/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-5.15/259-regmap_dynamic.patch @@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -3358,3 +3359,5 @@ static int __init regmap_initcall(void) +@@ -3360,3 +3361,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); diff --git a/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch b/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch index 0291a5e9bd8c42..71546bf942da4e 100644 --- a/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch @@ -72,7 +72,7 @@ Signed-off-by: Felix Fietkau +MODULE_LICENSE("GPL"); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -4216,6 +4216,7 @@ int wake_up_state(struct task_struct *p, +@@ -4220,6 +4220,7 @@ int wake_up_state(struct task_struct *p, { return try_to_wake_up(p, state, 0); } diff --git a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index b618c896136332..a15fc786a0ef88 100644 --- a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -7707,7 +7707,7 @@ static int nft_register_flowtable_net_ho +@@ -7703,7 +7703,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); diff --git a/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch b/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch index 7fcb1905783267..1f76866a434cb1 100644 --- a/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch +++ b/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch @@ -15,7 +15,7 @@ Link: https://lore.kernel.org/r/20220515210048.483898-9-robimarko@gmail.com --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig -@@ -166,6 +166,7 @@ config IPQ_LCC_806X +@@ -167,6 +167,7 @@ config IPQ_LCC_806X config IPQ_GCC_8074 tristate "IPQ8074 Global Clock Controller" diff --git a/target/linux/ipq807x/patches-5.15/0038-v6.1-clk-qcom-clk-rcg2-add-rcg2-mux-ops.patch b/target/linux/ipq807x/patches-5.15/0038-v6.1-clk-qcom-clk-rcg2-add-rcg2-mux-ops.patch index 451066099dd0f0..7462501e3db0aa 100644 --- a/target/linux/ipq807x/patches-5.15/0038-v6.1-clk-qcom-clk-rcg2-add-rcg2-mux-ops.patch +++ b/target/linux/ipq807x/patches-5.15/0038-v6.1-clk-qcom-clk-rcg2-add-rcg2-mux-ops.patch @@ -35,7 +35,7 @@ Link: https://lore.kernel.org/r/20220818220628.339366-1-robimarko@gmail.com extern const struct clk_ops clk_byte2_ops; --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c -@@ -477,6 +477,13 @@ const struct clk_ops clk_rcg2_floor_ops +@@ -471,6 +471,13 @@ const struct clk_ops clk_rcg2_floor_ops }; EXPORT_SYMBOL_GPL(clk_rcg2_floor_ops); diff --git a/target/linux/ipq807x/patches-5.15/0078-v5.19-clk-qcom-rcg2-Cache-CFG-register-updates-for-parked-.patch b/target/linux/ipq807x/patches-5.15/0078-v5.19-clk-qcom-rcg2-Cache-CFG-register-updates-for-parked-.patch index 5300c36dce70df..47e3cc1f3ec8b4 100644 --- a/target/linux/ipq807x/patches-5.15/0078-v5.19-clk-qcom-rcg2-Cache-CFG-register-updates-for-parked-.patch +++ b/target/linux/ipq807x/patches-5.15/0078-v5.19-clk-qcom-rcg2-Cache-CFG-register-updates-for-parked-.patch @@ -110,7 +110,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. static int update_config(struct clk_rcg2 *rcg) { int count, ret; -@@ -164,12 +174,10 @@ calc_rate(unsigned long rate, u32 m, u32 +@@ -158,12 +168,10 @@ calc_rate(unsigned long rate, u32 m, u32 } static unsigned long @@ -125,7 +125,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. if (rcg->mnd_width) { mask = BIT(rcg->mnd_width) - 1; -@@ -190,6 +198,17 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, +@@ -184,6 +192,17 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, return calc_rate(parent_rate, m, n, mode, hid_div); } @@ -143,7 +143,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, struct clk_rate_request *req, enum freq_policy policy) -@@ -263,7 +282,8 @@ static int clk_rcg2_determine_floor_rate +@@ -257,7 +276,8 @@ static int clk_rcg2_determine_floor_rate return _freq_tbl_determine_rate(hw, rcg->freq_tbl, req, FLOOR); } @@ -153,7 +153,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. { u32 cfg, mask, d_val, not2d_val, n_minus_m; struct clk_hw *hw = &rcg->clkr.hw; -@@ -305,15 +325,27 @@ static int __clk_rcg2_configure(struct c +@@ -299,15 +319,27 @@ static int __clk_rcg2_configure(struct c cfg |= rcg->parent_map[index].cfg << CFG_SRC_SEL_SHIFT; if (rcg->mnd_width && f->n && (f->m != f->n)) cfg |= CFG_MODE_DUAL_EDGE; @@ -184,7 +184,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. if (ret) return ret; -@@ -994,11 +1026,12 @@ static int clk_rcg2_shared_set_rate(stru +@@ -988,11 +1020,12 @@ static int clk_rcg2_shared_set_rate(stru return -EINVAL; /* @@ -201,7 +201,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. return clk_rcg2_shared_force_enable_clear(hw, f); } -@@ -1022,6 +1055,11 @@ static int clk_rcg2_shared_enable(struct +@@ -1016,6 +1049,11 @@ static int clk_rcg2_shared_enable(struct if (ret) return ret; @@ -213,7 +213,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. ret = update_config(rcg); if (ret) return ret; -@@ -1032,13 +1070,12 @@ static int clk_rcg2_shared_enable(struct +@@ -1026,13 +1064,12 @@ static int clk_rcg2_shared_enable(struct static void clk_rcg2_shared_disable(struct clk_hw *hw) { struct clk_rcg2 *rcg = to_clk_rcg2(hw); @@ -228,7 +228,7 @@ Link: https://lore.kernel.org/r/20220426212136.1543984-1-bjorn.andersson@linaro. /* * Park the RCG at a safe configuration - sourced off of safe source. -@@ -1056,17 +1093,52 @@ static void clk_rcg2_shared_disable(stru +@@ -1050,17 +1087,52 @@ static void clk_rcg2_shared_disable(stru update_config(rcg); clk_rcg2_clear_force_enable(hw); diff --git a/target/linux/ipq807x/patches-5.15/0100-clk-qcom-clk-rcg2-introduce-support-for-multiple-con.patch b/target/linux/ipq807x/patches-5.15/0100-clk-qcom-clk-rcg2-introduce-support-for-multiple-con.patch index 5713775948dca2..9aa0a7952c9f3c 100644 --- a/target/linux/ipq807x/patches-5.15/0100-clk-qcom-clk-rcg2-introduce-support-for-multiple-con.patch +++ b/target/linux/ipq807x/patches-5.15/0100-clk-qcom-clk-rcg2-introduce-support-for-multiple-con.patch @@ -64,7 +64,7 @@ Signed-off-by: Christian Marangi /** --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c -@@ -209,11 +209,60 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, +@@ -203,11 +203,60 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, return __clk_rcg2_recalc_rate(hw, parent_rate, cfg); } @@ -125,7 +125,7 @@ Signed-off-by: Christian Marangi struct clk_hw *p; struct clk_rcg2 *rcg = to_clk_rcg2(hw); int index; -@@ -232,7 +281,15 @@ static int _freq_tbl_determine_rate(stru +@@ -226,7 +275,15 @@ static int _freq_tbl_determine_rate(stru if (!f) return -EINVAL; @@ -142,7 +142,7 @@ Signed-off-by: Christian Marangi if (index < 0) return index; -@@ -242,18 +299,18 @@ static int _freq_tbl_determine_rate(stru +@@ -236,18 +293,18 @@ static int _freq_tbl_determine_rate(stru return -EINVAL; if (clk_flags & CLK_SET_RATE_PARENT) { @@ -167,7 +167,7 @@ Signed-off-by: Christian Marangi rate = tmp; } } else { -@@ -261,7 +318,7 @@ static int _freq_tbl_determine_rate(stru +@@ -255,7 +312,7 @@ static int _freq_tbl_determine_rate(stru } req->best_parent_hw = p; req->best_parent_rate = rate; @@ -176,7 +176,7 @@ Signed-off-by: Christian Marangi return 0; } -@@ -357,6 +414,7 @@ static int __clk_rcg2_set_rate(struct cl +@@ -351,6 +408,7 @@ static int __clk_rcg2_set_rate(struct cl { struct clk_rcg2 *rcg = to_clk_rcg2(hw); const struct freq_tbl *f; @@ -184,7 +184,7 @@ Signed-off-by: Christian Marangi switch (policy) { case FLOOR: -@@ -372,7 +430,15 @@ static int __clk_rcg2_set_rate(struct cl +@@ -366,7 +424,15 @@ static int __clk_rcg2_set_rate(struct cl if (!f) return -EINVAL; diff --git a/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch b/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch index c14469460a76cf..34e3ce9a13925c 100644 --- a/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch +++ b/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch @@ -54,9 +54,9 @@ Signed-off-by: Marek Behún side of CZ.NIC's Turris Omnia router. There are 12 RGB LEDs on the --- a/drivers/leds/leds-turris-omnia.c +++ b/drivers/leds/leds-turris-omnia.c -@@ -41,6 +41,39 @@ struct omnia_leds { - struct omnia_led leds[]; - }; +@@ -72,6 +72,39 @@ static int omnia_cmd_read_u8(const struc + return -EIO; + } +static struct led_hw_trigger_type omnia_hw_trigger_type; + @@ -94,7 +94,7 @@ Signed-off-by: Marek Behún static int omnia_led_brightness_set_blocking(struct led_classdev *cdev, enum led_brightness brightness) { -@@ -112,6 +145,8 @@ static int omnia_led_register(struct i2c +@@ -143,6 +176,8 @@ static int omnia_led_register(struct i2c cdev = &led->mc_cdev.led_cdev; cdev->max_brightness = 255; cdev->brightness_set_blocking = omnia_led_brightness_set_blocking; @@ -102,8 +102,8 @@ Signed-off-by: Marek Behún + cdev->default_trigger = omnia_hw_trigger.name; /* put the LED into software mode */ - ret = i2c_smbus_write_byte_data(client, CMD_LED_MODE, -@@ -228,6 +263,12 @@ static int omnia_leds_probe(struct i2c_c + ret = omnia_cmd_write_u8(client, CMD_LED_MODE, +@@ -249,6 +284,12 @@ static int omnia_leds_probe(struct i2c_c mutex_init(&leds->lock); diff --git a/target/linux/mvebu/patches-5.15/103-leds-turris-omnia-initialize-multi-intensity-to-full.patch b/target/linux/mvebu/patches-5.15/103-leds-turris-omnia-initialize-multi-intensity-to-full.patch index 1fe76b8f2cfcf4..b6f7da64a72214 100644 --- a/target/linux/mvebu/patches-5.15/103-leds-turris-omnia-initialize-multi-intensity-to-full.patch +++ b/target/linux/mvebu/patches-5.15/103-leds-turris-omnia-initialize-multi-intensity-to-full.patch @@ -17,7 +17,7 @@ Signed-off-by: Marek Behún --- a/drivers/leds/leds-turris-omnia.c +++ b/drivers/leds/leds-turris-omnia.c -@@ -131,10 +131,13 @@ static int omnia_led_register(struct i2c +@@ -162,10 +162,13 @@ static int omnia_led_register(struct i2c } led->subled_info[0].color_index = LED_COLOR_ID_RED; diff --git a/target/linux/mvebu/patches-5.15/104-leds-turris-omnia-change-max-brightness-from-255-to-.patch b/target/linux/mvebu/patches-5.15/104-leds-turris-omnia-change-max-brightness-from-255-to-.patch index fb8864dfd1d39f..6d6d4cec706738 100644 --- a/target/linux/mvebu/patches-5.15/104-leds-turris-omnia-change-max-brightness-from-255-to-.patch +++ b/target/linux/mvebu/patches-5.15/104-leds-turris-omnia-change-max-brightness-from-255-to-.patch @@ -20,7 +20,7 @@ Signed-off-by: Marek Behún --- a/drivers/leds/leds-turris-omnia.c +++ b/drivers/leds/leds-turris-omnia.c -@@ -146,7 +146,7 @@ static int omnia_led_register(struct i2c +@@ -177,7 +177,7 @@ static int omnia_led_register(struct i2c init_data.fwnode = &np->fwnode; cdev = &led->mc_cdev.led_cdev; diff --git a/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch b/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch deleted file mode 100644 index 4c8015013bc8a5..00000000000000 --- a/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 859bd2e0c0052967536f3f902716f204d5a978b1 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 8 Sep 2023 22:48:33 +0200 -Subject: [PATCH] hwrng: geode: fix accessing registers - -When the membase and pci_dev pointer were moved to a new struct in priv, -the actual membase users were left untouched, and they started reading -out arbitrary memory behind the struct instead of registers. This -unfortunately turned the RNG into a constant number generator, depending -on the content of what was at that offset. - -To fix this, update geode_rng_data_{read,present}() to also get the -membase via amd_geode_priv, and properly read from the right addresses -again. - -Fixes: 9f6ec8dc574e ("hwrng: geode - Fix PCI device refcount leak") -Reported-by: Timur I. Davletshin -Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217882 -Tested-by: Timur I. Davletshin -Suggested-by: Jo-Philipp Wich -Signed-off-by: Jonas Gorski ---- - drivers/char/hw_random/geode-rng.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/char/hw_random/geode-rng.c -+++ b/drivers/char/hw_random/geode-rng.c -@@ -58,7 +58,8 @@ struct amd_geode_priv { - - static int geode_rng_data_read(struct hwrng *rng, u32 *data) - { -- void __iomem *mem = (void __iomem *)rng->priv; -+ struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; -+ void __iomem *mem = priv->membase; - - *data = readl(mem + GEODE_RNG_DATA_REG); - -@@ -67,7 +68,8 @@ static int geode_rng_data_read(struct hw - - static int geode_rng_data_present(struct hwrng *rng, int wait) - { -- void __iomem *mem = (void __iomem *)rng->priv; -+ struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; -+ void __iomem *mem = priv->membase; - int data, i; - - for (i = 0; i < 20; i++) { From dae399196b5b0b84f0250a69e6de42abdebd71d7 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 12 Nov 2023 07:46:11 +0000 Subject: [PATCH 0637/1171] scripts: sercomm-pid.py: use uppercase hwid in pid Sercomm uses uppercase for hexadecimal representation of the device hardware IDs in factory image PID. This commit brings the sercomm-pid.py script into compliance with the original Sercomm algorithm. Example ------- +--------+-------------+-----------+-------------+ | Device | PID (before | PID | PID (after | | HWID | the commit) | (Sercomm) | the commit) | +--------+-------------+-----------+-------------+ | CPJ | 43 50 4a | 43 50 4A | 43 50 4A | +--------+-------------+-----------+-------------+ Signed-off-by: Mikhail Zhilkin (cherry picked from commit 28d32244e122051ec88551e831fb9cf34da7cd76) --- scripts/sercomm-pid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sercomm-pid.py b/scripts/sercomm-pid.py index 4d88a678396f1e..2c246fc298bd35 100755 --- a/scripts/sercomm-pid.py +++ b/scripts/sercomm-pid.py @@ -34,7 +34,7 @@ def get_pid(args): enc = args.hw_version.rjust(8, '0').encode('ascii') struct.pack_into('>8s', buf, 0x0, enc) - enc = binascii.hexlify(args.hw_id.encode()) + enc = binascii.hexlify(args.hw_id.encode()).upper() struct.pack_into('>6s', buf, 0x8, enc) enc = args.sw_version.rjust(4, '0').encode('ascii') From a8f31d2aa15ad940a75ddc99aa0e82d2a617f4eb Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 12 Nov 2023 07:52:45 +0000 Subject: [PATCH 0638/1171] ramips: sercomm.mk: make common recipe to set a bit in pid This commit makes a common recipe to set bit in Sercomm factory pid since this is necessary for several devices (WiFire S1500.nbn, Rostelecom RT-FL-1) at different offsets. Signed-off-by: Mikhail Zhilkin (cherry picked from commit e900c452112a2309681ed4ee12894f3a18ed650f) --- target/linux/ramips/image/common-sercomm.mk | 8 ++++---- target/linux/ramips/image/mt7621.mk | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/image/common-sercomm.mk b/target/linux/ramips/image/common-sercomm.mk index 4060da092357ef..182f2251ba78e0 100644 --- a/target/linux/ramips/image/common-sercomm.mk +++ b/target/linux/ramips/image/common-sercomm.mk @@ -38,10 +38,6 @@ define Build/sercomm-factory-cqr mv $@.fhdr $@ endef -define Build/sercomm-fix-buc-pid - printf 1 | dd seek=$$((0x13)) of=$@ bs=1 conv=notrunc 2>/dev/null -endef - define Build/sercomm-kernel $(TOPDIR)/scripts/sercomm-kernel-header.py \ --kernel-image $@ \ @@ -104,6 +100,10 @@ define Build/sercomm-payload rm $@.pid endef +define Build/sercomm-pid-setbit + printf 1 | dd seek=$$(($(1))) of=$@ bs=1 conv=notrunc 2>/dev/null +endef + define Build/sercomm-prepend-tagged-kernel $(CP) $(IMAGE_KERNEL) $(IMAGE_KERNEL).tagged $(call Build/sercomm-part-tag-common,$(word 1,$(1)) \ diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 8a194d6bc1bee4..d456176a0178ea 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2518,7 +2518,7 @@ define Device/wifire_s1500-nbn IMAGE_SIZE := 51200k IMAGE/factory.img := append-kernel | sercomm-kernel-factory | \ sercomm-reset-slot1-chksum | append-ubi | check-size | \ - sercomm-factory-cqr | sercomm-fix-buc-pid | sercomm-mkhash | \ + sercomm-factory-cqr | sercomm-pid-setbit 0x13 | sercomm-mkhash | \ sercomm-crypto SERCOMM_HWID := BUC SERCOMM_HWVER := 10000 From fd277ee49054584f9a064eb339c65ff492a53765 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 12 Nov 2023 07:56:08 +0000 Subject: [PATCH 0639/1171] ramips: mt7620: drop unnecessary trailing tabs Let's tidy up a bit (drop unnecessary trailing tabs). Signed-off-by: Mikhail Zhilkin (cherry picked from commit 25bab2b8bc1aff2b7e877865c5def74aa63daefe) --- target/linux/ramips/mt7620/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index e571dc1f6f5fea..0cc7e5f2f7942c 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -406,7 +406,7 @@ ramips_setup_macs() label_mac=$(mtd_get_mac_binary factory 0x4) ;; zyxel,keenetic-lite-iii-a) - lan_mac=$(mtd_get_mac_binary RF-EEPROM 0x4) + lan_mac=$(mtd_get_mac_binary RF-EEPROM 0x4) wan_mac=$(mtd_get_mac_binary RF-EEPROM 0x28) label_mac=$wan_mac ;; From ebdaee7194a30372d00b4675bfe9dfae0c59147f Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 12 Nov 2023 07:58:26 +0000 Subject: [PATCH 0640/1171] ramips: add support for Sercomm CPJ routers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds support for following wireless routers: - Rostelecom RT-FL-1 (Serсomm RT-FL-1) - Rostelecom S1010 (Serсomm S1010.RT) The devices are almost identical and the only difference is one bit in the factory image PID (thanks to Maximilian Weinmann (@MaxS0niX) for the info and idea to make one PR for two devices at once). Devices specification --------------------- SoC: MediaTek MT7620A, MIPS RAM: 64 MB Flash: 16 MB SPI NOR Wireless 2.4: MT7620 (b/g/n, 2x2) Wireless 5: MT7612EN (a/n/ac, 2x2) Ethernet: 5xFE (WAN, LAN1-4) BootLoader: U-Boot Buttons: 2 (wps, reset) LEDs: 1 amber and 1 green status GPIO leds 5 green ethernet GPIO leds 1 green GPIO 2.4 GHz WLAN led 1 green PHY 5 GHz WLAN led 1 green unmanaged power led USB ports: No Power: 12 VDC, 1 A Connector: Barrel OEM easy installation --------------------- 1. Remove all dots from the factory image filename (except the dot before file extension) 2. Upload and update the firmware via the original web interface 3. Wait until green status led stops blinking (can take several minutes) 4. Login to OpenWrt initramsfs. It's recommended to make a backup of the mtd partitions at this point. 4. Perform sysupgrade using the following command (or use Luci): sysupgrade -n sysupgrade.bin 5. Wait until green status les stops blinking (can take several minutes) 6. Mission acomplished Return to Stock --------------- Option 1. Restore firmware Slot1 from a backup (firmware2.bin): cd /tmp mtd -e Firmware2 write firmware2.bin Firmware2 printf 1 | dd bs=1 seek=$((0x18007)) count=1 of=/dev/mtdblock2 reboot Option 2. Decrypt, ungzip and split stock firmware image into the parts, take Slot1 parts (kernel2.bin, rootfs2.bin) and write them: cd /tmp mtd -e Kernel2 write kernel2.bin Kernel2 mtd -e RootFS2 write rootfs2.bin RootFS2 printf 1 | dd bs=1 seek=$((0x18007)) count=1 of=/dev/mtdblock2 reboot More about stock firmware decryption: Link: https://github.com/Psychotropos/sercomm_fwutils/ Debricking ---------- Use sercomm-recovery tool. You can use "ALL" mtd partition backup as a recovery image. Link: https://github.com/danitool/sercomm-recovery MAC addresses ------------- +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | label | 48:3e:xx:xx:xx:1e | label | | LAN | 48:3e:xx:xx:xx:1e | label | | WAN | 48:3e:xx:xx:xx:28 | label+10 | | WLAN 2g | 48:3e:xx:xx:xx:20 | label+2 | | WLAN 5g | 48:3e:xx:xx:xx:24 | label+6 | +---------+-------------------+-----------+ Co-authored-by: Vadzim Vabishchevich Signed-off-by: Mikhail Zhilkin (cherry picked from commit 1b091311aafc59db576a51b3d2b5febaac45d522) [fix rt2800_wmac eeprom load] Signed-off-by: Mikhail Zhilkin --- .../ramips/dts/mt7620a_rostelecom_rt-fl-1.dts | 8 + .../ramips/dts/mt7620a_rostelecom_s1010.dts | 8 + .../linux/ramips/dts/mt7620a_sercomm_cpj.dtsi | 307 ++++++++++++++++++ target/linux/ramips/image/common-sercomm.mk | 63 ++++ target/linux/ramips/image/mt7620.mk | 22 ++ .../mt7620/base-files/etc/board.d/01_leds | 8 + .../mt7620/base-files/etc/board.d/02_network | 7 + .../mt7620/base-files/lib/upgrade/platform.sh | 8 + 8 files changed, 431 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_rostelecom_rt-fl-1.dts create mode 100644 target/linux/ramips/dts/mt7620a_rostelecom_s1010.dts create mode 100644 target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi diff --git a/target/linux/ramips/dts/mt7620a_rostelecom_rt-fl-1.dts b/target/linux/ramips/dts/mt7620a_rostelecom_rt-fl-1.dts new file mode 100644 index 00000000000000..14081ba72efada --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_rostelecom_rt-fl-1.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620a_sercomm_cpj.dtsi" + +/ { + compatible = "rostelecom,rt-fl-1", "ralink,mt7620a-soc"; + model = "Rostelecom RT-FL-1"; +}; diff --git a/target/linux/ramips/dts/mt7620a_rostelecom_s1010.dts b/target/linux/ramips/dts/mt7620a_rostelecom_s1010.dts new file mode 100644 index 00000000000000..37ce9eda41f3a2 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_rostelecom_s1010.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620a_sercomm_cpj.dtsi" + +/ { + compatible = "rostelecom,s1010", "ralink,mt7620a-soc"; + model = "Rostelecom S1010"; +}; diff --git a/target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi b/target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi new file mode 100644 index 00000000000000..cb125052011c1b --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi @@ -0,0 +1,307 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620a.dtsi" + +#include +#include +#include + +/ { + aliases { + label-mac-device = ðernet; + + led-boot = &status_green; + led-failsafe = &status_amber; + led-running = &status_green; + led-upgrade = &status_amber; + }; + + keys { + compatible = "gpio-keys"; + + button-0 { + label = "reset"; + linux,code = ; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + button-1 { + label = "wps"; + linux,code = ; + gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + status_green: led-0 { + label = "green:status"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + status_amber: led-1 { + label = "amber:status"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + }; + + led-4 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + }; + + led-5 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + }; + + led-6 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + }; + + led-7 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <24>; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "openwrt,uimage"; + /* sercomm krnl hdr with fw chksums */ + openwrt,offset = <0x100>; + label = "firmware"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_label 0>; + nvmem-cell-names = "mac-address"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +/* mt7612 */ +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + + nvmem-cells = <&eeprom_factory_8000>, <&macaddr_label 6>; + nvmem-cell-names = "eeprom", "mac-address"; + + /* 5 GHz WLAN phy green led */ + led { + led-sources = <2>; + led-active-low; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <70000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* whole flash */ + partition@0_all { + label = "ALL"; + reg = <0x0 0x1000000>; + read-only; + }; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "ftd_and_bootflag"; + reg = <0x30000 0x20000>; + }; + + factory: partition@50000 { + label = "Factory"; + reg = <0x50000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x200>; + }; + }; + }; + + partition@60000 { + label = "SC Nvram(permanent data)"; + reg = <0x60000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_label: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + fwconcat0: partition@70000 { + label = "Firmware"; + reg = <0x70000 0x790000>; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Kernel"; + reg = <0x0 0x200000>; + }; + + partition@200000 { + label = "RootFS"; + reg = <0x200000 0x590000>; + }; + }; + + fwconcat1: partition@800000 { + label = "Firmware2"; + reg = <0x800000 0x790000>; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Kernel2"; + reg = <0x0 0x200000>; + }; + + partition@200000 { + label = "RootFS2"; + reg = <0x200000 0x590000>; + }; + }; + + partition@f90000 { + label = "MAC IP"; + reg = <0xf90000 0x10000>; + read-only; + }; + + partition@fa0000 { + label = "Critical Log"; + reg = <0xfa0000 0x10000>; + read-only; + }; + + partition@fb000 { + label = "Critical Log Bak"; + reg = <0xfb0000 0x10000>; + read-only; + }; + + partition@fc0000 { + label = "Xml Config"; + reg = <0xfc0000 0x20000>; + read-only; + }; + + partition@fe0000 { + label = "Xml Config Bak"; + reg = <0xfe0000 0x20000>; + read-only; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "ephy", "rgmii1", "uartf", "wled"; + function = "gpio"; + }; +}; + +/* mt7620 */ +&wmac { + nvmem-cells = <&macaddr_label 2>; + nvmem-cell-names = "mac-address"; + + ralink,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/ramips/image/common-sercomm.mk b/target/linux/ramips/image/common-sercomm.mk index 182f2251ba78e0..0987010911209a 100644 --- a/target/linux/ramips/image/common-sercomm.mk +++ b/target/linux/ramips/image/common-sercomm.mk @@ -23,6 +23,35 @@ define Build/sercomm-crypto rm -f $@.enc $@.key endef +define Build/sercomm-factory-cpj + dd bs=$$((0x1fff00)) count=1 if=$@ of=$@.kernel conv=notrunc \ + 2>/dev/null + dd bs=$$((0x1fff00)) skip=1 if=$@ of=$@.rootfs1 conv=notrunc \ + 2>/dev/null + cp $@.rootfs1 $@.rootfs2 + $(TOPDIR)/scripts/sercomm-kernel-header.py \ + --kernel-image $@.kernel \ + --kernel-offset $(SERCOMM_KERNEL_OFFSET) \ + --rootfs-image $@.rootfs1 \ + --rootfs-offset $(SERCOMM_ROOTFS_OFFSET) \ + --output-header $@.header1 + $(TOPDIR)/scripts/sercomm-kernel-header.py \ + --kernel-image $@.kernel \ + --kernel-offset $(SERCOMM_KERNEL2_OFFSET) \ + --rootfs-image $@.rootfs2 \ + --rootfs-offset $(SERCOMM_ROOTFS2_OFFSET) \ + --output-header $@.header2 + cat $@.header1 $@.kernel > $@.kernel1 + cat $@.header2 $@.kernel > $@.kernel2 + rm $@.header1 $@.header2 $@.kernel + $(call Build/sercomm-part-tag-common,kernel $@.kernel1) + $(call Build/sercomm-part-tag-common,kernel2 $@.kernel2) + $(call Build/sercomm-part-tag-common,rootfs $@.rootfs1) + $(call Build/sercomm-part-tag-common,rootfs2 $@.rootfs2) + cat $@.kernel2 $@.rootfs2 $@.kernel1 $@.rootfs1 > $@ + rm $@.kernel1 $@.rootfs1 $@.kernel2 $@.rootfs2 +endef + define Build/sercomm-factory-cqr $(TOPDIR)/scripts/sercomm-pid.py \ --hw-version $(SERCOMM_HWVER) \ @@ -117,12 +146,46 @@ define Build/sercomm-reset-slot1-chksum dd of=$@ seek=$$((0x118)) bs=1 conv=notrunc 2>/dev/null endef +define Build/sercomm-sysupgrade-cpj + dd bs=$$((0x1fff00)) count=1 if=$@ of=$@.kernel conv=notrunc \ + 2>/dev/null + dd bs=$$((0x1fff00)) skip=1 if=$@ of=$@.rootfs conv=notrunc \ + 2>/dev/null + $(TOPDIR)/scripts/sercomm-kernel-header.py \ + --kernel-image $@.kernel \ + --kernel-offset $(SERCOMM_KERNEL_OFFSET) \ + --rootfs-image $@.rootfs \ + --rootfs-offset $(SERCOMM_ROOTFS_OFFSET) \ + --output-header $@.header + cat $@.header $@.kernel $@.rootfs > $@ + rm $@.header $@.kernel $@.rootfs +endef + define Device/sercomm $(Device/nand) LOADER_TYPE := bin IMAGES += factory.img endef +define Device/sercomm_cpj + SOC := mt7620a + DEVICE_VENDOR := Rostelecom + DEVICE_ALT0_VENDOR := Sercomm + IMAGE_SIZE := 7743k + SERCOMM_HWID := CPJ + SERCOMM_HWVER := 10000 + SERCOMM_SWVER := 1001 + SERCOMM_KERNEL_OFFSET := 0x70100 + SERCOMM_ROOTFS_OFFSET := 0x270000 + SERCOMM_KERNEL2_OFFSET := 0x800100 + SERCOMM_ROOTFS2_OFFSET := 0xa00000 + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + sercomm-sysupgrade-cpj | pad-rootfs | check-size | \ + append-metadata + ARTIFACTS := initramfs-factory.img + DEVICE_PACKAGES := kmod-mt76x2 +endef + define Device/sercomm_cxx_dxx $(Device/sercomm) KERNEL_SIZE := 6144k diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 897bbfd3920e60..30b7aea32dd090 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -2,6 +2,7 @@ # MT7620A Profiles # +include ./common-sercomm.mk include ./common-tp-link.mk DEVICE_VARS += DLINK_ROM_ID DLINK_FAMILY_MEMBER DLINK_FIRMWARE_SIZE DLINK_IMAGE_OFFSET @@ -1071,6 +1072,27 @@ define Device/ravpower_rp-wd03 endef TARGET_DEVICES += ravpower_rp-wd03 +define Device/rostelecom_rt-fl-1 + $(Device/sercomm_cpj) + DEVICE_MODEL := RT-FL-1 + DEVICE_ALT0_MODEL := RT-FL-1 + ARTIFACT/initramfs-factory.img := \ + append-image-stage initramfs-kernel.bin | check-size | \ + sercomm-factory-cpj | gzip | sercomm-payload | \ + sercomm-pid-setbit 0x11 | sercomm-crypto +endef +TARGET_DEVICES += rostelecom_rt-fl-1 + +define Device/rostelecom_s1010 + $(Device/sercomm_cpj) + DEVICE_MODEL := S1010 + DEVICE_ALT0_MODEL := S1010.RT + ARTIFACT/initramfs-factory.img := \ + append-image-stage initramfs-kernel.bin | check-size | \ + sercomm-factory-cpj | gzip | sercomm-payload | sercomm-crypto +endef +TARGET_DEVICES += rostelecom_s1010 + define Device/sanlinking_d240 SOC := mt7620a IMAGE_SIZE := 16064k diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index 6a097ab8e3dc1d..41500d84a6b4e5 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -198,6 +198,14 @@ zbtlink,zbt-we826-e) ravpower,rp-wd03) ucidef_set_led_netdev "internet" "internet" "green:wifi" "eth0" ;; +rostelecom,rt-fl-1|\ +rostelecom,s1010) + ucidef_set_led_switch "lan-1" "lan-1" "green:lan-1" "switch0" "0x02" + ucidef_set_led_switch "lan-2" "lan-2" "green:lan-2" "switch0" "0x04" + ucidef_set_led_switch "lan-3" "lan-3" "green:lan-3" "switch0" "0x08" + ucidef_set_led_switch "lan-4" "lan-4" "green:lan-4" "switch0" "0x10" + ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x01" + ;; tplink,archer-c2-v1) ucidef_set_led_switch "lan" "lan" "green:lan" "switch1" "0x1e" ucidef_set_led_switch "wan" "wan" "green:wan" "switch1" "0x01" diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 0cc7e5f2f7942c..bbe8627c0f4817 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -118,6 +118,8 @@ ramips_setup_interfaces() netgear,jwnr2010-v5|\ phicomm,k2-v22.4|\ phicomm,k2-v22.5|\ + rostelecom,rt-fl-1|\ + rostelecom,s1010|\ trendnet,tew-810dr|\ zbtlink,zbt-we2026) ucidef_add_switch "switch0" \ @@ -386,6 +388,11 @@ ramips_setup_macs() linksys,e1700) wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR) ;; + rostelecom,rt-fl-1|\ + rostelecom,s1010) + label_mac=$(mtd_get_mac_binary "SC Nvram(permanent data)" 0x0) + wan_mac=$(macaddr_add "$label_mac" 10) + ;; snr,cpe-w4n-mt) lan_mac=$(mtd_get_mac_binary Factory 0x28) wan_mac=$(mtd_get_mac_binary Factory 0x2e) diff --git a/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh index 9f71dc918e50a2..6dd7fc7cef1af4 100755 --- a/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh @@ -30,6 +30,14 @@ platform_do_upgrade() { } default_do_upgrade "$1" ;; + rostelecom,rt-fl-1|\ + rostelecom,s1010) + idx="$(find_mtd_index ftd_and_bootflag)" + [ -n "$idx" ] && \ + printf 0 | dd bs=1 seek=$((0x18007)) count=1 \ + of=/dev/mtdblock$idx + default_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;; From 6264d12ed8e4beef6e3707837cb95f0e0d9e4e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 21 Nov 2023 16:30:22 +0100 Subject: [PATCH 0641/1171] firmware-utils: update to Git HEAD (2023-11-21) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1d42292d8063 tplink-safeloader: Add TP-Link Archer A6 V3.20 3338f5389d72 tplink-safeloader: add TL-WPA8635P v3 17ca5eeb1c10 tplink-safeloader: add TL-WPA8631P v4 f730ad2fa0b4 bcmblob: new tool for reading Broadcom's BLOBs cb1ddac98124 firmware-utils: fix typo in error message when no OpenSSL library found 916633160dc9 bcmclm: new tool for reading Broadcom's CLM data a2d49fb1e188 tplink-safeloader: add RU support-list entry for Archer C6U v1 bb12cf5c3fa9 tplink-safeloader: Add support for TP-Link Deco M5 The special_id values are the same for EU and Asian models, and they apply to all models: v1, v2, and v3. They are not sorted as they are currently in the same order as extracted from the official firmware image. 9e2de8515be1 tplink-safeloader: add EAP610 v3 and EAP613 v1 a170683c0e11 firmware-utils: fix use of NULL string progname 89875fc18b57 tplink-safeloader: CPE510: add Canadian support 9e211d2980fe mktplinkfw2: add support to extract bootloader images c18f662f3c74 mktplinkfw2: add support to pack bootloader 3dc133915f87 mktplinkfw2: show exact exceed bytes when the image is to big d16ff798d58a tplink-safeloader: WPA8631: add v4 AU, US 0fa1cc51013f zytrx: add LTE5398-M904 635466123429 firmware-utils: ptgen: add SiFive GPT partition support ba5bc4e1ae9d add dlink-sge-image for D-Link devices by SGE 3b114de29cf7 lxlfw: move code opening LXL to helper function 8e149e480391 lxlfw: move code copying data to helper function 16fa89076122 lxlfw: fix struct lxl_hdr attribute d770cab82e58 lxlfw: support embedding blobs eaf2ea28dbe6 lxlfw: support extracting image 12bf1a99bd6e lxlfw: support certificate & signature blobs Signed-off-by: Rafał Miłecki (cherry picked from commit b117e7244f9e85cc3e6f6845f81eb60c9c9331e1) --- package/utils/firmware-utils/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/utils/firmware-utils/Makefile b/package/utils/firmware-utils/Makefile index 1316fa5c6b1803..432d3797ac0181 100644 --- a/package/utils/firmware-utils/Makefile +++ b/package/utils/firmware-utils/Makefile @@ -3,13 +3,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=firmware-utils -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2023-05-18 -PKG_SOURCE_VERSION:=02cdbc6a4d61605c008efef09162f772f553fcde -PKG_MIRROR_HASH:=f5188fc38bb03ddbcc34763ff049597e2d8af98c0854910dc87f10e5927096e2 +PKG_SOURCE_DATE:=2023-11-21 +PKG_SOURCE_VERSION:=12bf1a99bd6eebae90caa144bb4d8b0cd763ff8f +PKG_MIRROR_HASH:=f711bf80123a6f14737da27ab8dfff87a4d429c74057de355b1693e89f223abc PKG_BUILD_DEPENDS:=openssl zlib From de37b56cdb21df164a32ffda0ee4383c9ab6d13e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 3 Dec 2023 08:03:57 +0100 Subject: [PATCH 0642/1171] mpc85xx: increase available RAM on Extreme Networks WS-AP3825i The system-mamory size was page-aligned prior to this commit, only enabling to use 192MB of system memory of the 256 available. This was due to the system-memory being manually shrinked to reserve the upper 1MB for the second-core bootpage in the loader as well as the OS. Fix this properly in the loader and in Linux using reserved-memory definitions. This enables the device to use 250MB of system memory. Signed-off-by: David Bauer (cherry picked from commit 57d7382cb159dbb15b8e281cad90a65d4c0201f6) --- .../arch/powerpc/boot/dts/ws-ap3825i.dts | 18 +++++++- ...pleboot-prevent-overwrite-of-CPU1-sp.patch | 41 +++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 target/linux/mpc85xx/patches-5.15/150-arch-powerpc-simpleboot-prevent-overwrite-of-CPU1-sp.patch diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts index a347900e5dfe3e..3cff69c689122c 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts @@ -9,6 +9,9 @@ model = "Extreme Networks WS-AP3825i"; compatible = "extreme-networks,ws-ap3825i"; + #address-cells = <2>; + #size-cells = <2>; + aliases { ethernet0 = &enet0; ethernet1 = &enet2; @@ -301,8 +304,19 @@ }; memory { - /* Reserve upper MB for second-core-bootpage */ - reg = <0x0 0x0 0x0 0xff00000>; + reg = <0x0 0x0 0x0 0x10000000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + cpu1-bootpage@e000000 { + /* Reserve upper 1 MB for second-core-bootpage */ + reg = <0x0 0xff00000 0x0 0x100000>; + no-map; + }; }; soc@ffe00000 { diff --git a/target/linux/mpc85xx/patches-5.15/150-arch-powerpc-simpleboot-prevent-overwrite-of-CPU1-sp.patch b/target/linux/mpc85xx/patches-5.15/150-arch-powerpc-simpleboot-prevent-overwrite-of-CPU1-sp.patch new file mode 100644 index 00000000000000..1ff80a5016e8f3 --- /dev/null +++ b/target/linux/mpc85xx/patches-5.15/150-arch-powerpc-simpleboot-prevent-overwrite-of-CPU1-sp.patch @@ -0,0 +1,41 @@ +From 5f856ccc34df25060d36a5a81b7b45b574d86e35 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Sun, 3 Dec 2023 20:09:24 +0100 +Subject: [PATCH] arch: powerpc: simpleboot: prevent overwrite of CPU1 + spin-table + +Don't overwrite the spin-table of additional CPU cores with loader-heap. + +U-Boot places the spin-table for CPU1 on P1020 SoCs in the top 1MB of +system-memory. Instead of parsing reserved-memory (which would be +considerable more work), reduce the available system-memory for the +loader by 1MB. + +This prevents the loader from overwriting the spin-table of +additional CPU cores on these platforms. + +Linux itself needs to be made aware by this using reserved-memory +definitions. + +This patch is required for using CPU1 on the Extreme Networks +WS-AP3825i. + +Signed-off-by: David Bauer +--- + arch/powerpc/boot/simpleboot.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/powerpc/boot/simpleboot.c ++++ b/arch/powerpc/boot/simpleboot.c +@@ -65,6 +65,11 @@ void platform_init(unsigned long r3, uns + if (sizeof(void *) == 4 && memsize64 >= 0x100000000ULL) + memsize64 = 0xffffffff; + ++ /* Reserve upper 1 MB of memory for CPU1 spin-table */ ++ if (memsize64 > 0x100000) { ++ memsize64 = memsize64 - 0x100000; ++ } ++ + /* finally, setup the timebase */ + node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type", + "cpu", sizeof("cpu")); From 6261ae12e1161ebefa94f61a1c96f9febd7ed985 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 4 Dec 2023 13:54:56 +0100 Subject: [PATCH 0643/1171] mpc85xx: allow mapping of cpu1 spin-table page The no-map property was incorrectly added, which kept the system-memory available on the WS-AP3825 limited to 190MB. We are allowed to map the page containing the CPU1 spin-table, we are just not allowed to write to it. Fixes: 57d7382cb159 ("mpc85xx: increase available RAM on Extreme Networks WS-AP3825i") Signed-off-by: David Bauer (cherry picked from commit d9271aa5b7ddcef20ebe64d1d80c8ddcd6cd7fb7) --- target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts index 3cff69c689122c..f3c8a4fe5c907f 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts @@ -315,7 +315,6 @@ cpu1-bootpage@e000000 { /* Reserve upper 1 MB for second-core-bootpage */ reg = <0x0 0xff00000 0x0 0x100000>; - no-map; }; }; From 7606dac661f60d378d2cf42c6434811e6234f252 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 31 Oct 2023 18:47:49 +0800 Subject: [PATCH 0644/1171] base-files: support parse DT LED color and function The 'label' property in led node has been deprecated and we'd better to avoid using it. This patch allows us to extract DT OF LED name from the newly introduced LED properties "color", "function" and "function-enumerator". Signed-off-by: Shiji Yang (cherry picked from commit e814acc59948943c776ac319a348f72c0d19f33c) --- .../base-files/files/lib/functions/leds.sh | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/package/base-files/files/lib/functions/leds.sh b/package/base-files/files/lib/functions/leds.sh index a7532faa2fd553..333d900df0cab2 100644 --- a/package/base-files/files/lib/functions/leds.sh +++ b/package/base-files/files/lib/functions/leds.sh @@ -11,6 +11,36 @@ get_dt_led_path() { echo "$ledpath" } +get_dt_led_color_func() { + local enum + local func + local idx + local label + + [ -e "$1/function" ] && func=$(cat "$1/function") + [ -e "$1/color" ] && idx=$((0x$(hexdump -n 4 -e '4/1 "%02x"' "$1/color"))) + [ -e "$1/function-enumerator" ] && \ + enum=$((0x$(hexdump -n 4 -e '4/1 "%02x"' "$1/function-enumerator"))) + + [ -z "$idx" ] && [ -z "$func" ] && return 2 + + if [ -n "$idx" ]; then + for color in "white" "red" "green" "blue" "amber" \ + "violet" "yellow" "ir" "multicolor" "rgb" \ + "purple" "orange" "pink" "cyan" "lime" + do + [ $idx -eq 0 ] && label="$color" && break + idx=$((idx-1)) + done + fi + + label="$label:$func" + [ -n "$enum" ] && label="$label-$enum" + echo "$label" + + return 0 +} + get_dt_led() { local label local ledpath=$(get_dt_led_path $1) @@ -18,6 +48,7 @@ get_dt_led() { [ -n "$ledpath" ] && \ label=$(cat "$ledpath/label" 2>/dev/null) || \ label=$(cat "$ledpath/chan-name" 2>/dev/null) || \ + label=$(get_dt_led_color_func "$ledpath") || \ label=$(basename "$ledpath") echo "$label" From 3846b6eb49e75cae52fd82a601238aa75cf82270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Tue, 28 Mar 2023 15:04:21 +0200 Subject: [PATCH 0645/1171] filogic: support Telenor branded ZyXEL EX5700 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Telenor quirks -------------- The operator specific firmware running on the Telenor branded ZyXEL EX5700 includes U-Boot modifications affecting the OpenWrt installation. Notable changes to U-Boot include - environment is stored in RAM and reset to defaults when power cycled - dual partition scheme with "nomimal" or "rescue" systems, falling back to "rescue" unless the OS signals success in 3 attempts - several runtime additions to the device-tree Some of these modifications have side effects requiring workarounds - U-Boot modifies /chosen/bootargs in an unsafe manner, and will crash unless this node exists - U-Boot verifies that the selected rootfs UBI volume exists, and refuses to boot if it doesn't. The chosen "rootfs" volume must contain a squashfs signature even for tftp or initramfs booting. - U-Boot parses the "factoryparams" UBI volume, setting the "ethaddr" variable to the label mac. But "factoryparams" does not always exist. Instead there is a "RIP" volume containing all the factory data. Copying the "RIP" volume to "factoryparams" will fix this Hardware -------- SOC: MediaTek MT7986 RAM: 1GB DDR4 FLASH: 512MB SPI-NAND (Mikron xxx) WIFI: Mediatek MT7986 802.11ax 5 GHz Mediatek MT7916 DBDC 802.11ax 2.4 + 6 GHz ETH: MediaTek MT7531 Switch + SoC 3 x builtin 1G phy (lan1, lan2, lan3) 2 x MaxLinear GPY211C 2.5 N-Base-T phy (lan4, wan) USB: 1 x USB 3.2 Enhanced SuperSpeed port UART: 3V3 115200 8N1 (Pinout: GND KEY RX TX VCC) Installation ------------ 1. Download the OpenWrt initramfs image. Copy the image to a TFTP server reachable at 192.168.1.2/24. Rename the image to C0A80101.img. 2. Connect the TFTP server to lan1, lan2 or lan3. Connect to the serial console, Interrupt the autoboot process by pressing ESC when prompted. 3. Download and boot the OpenWrt initramfs image. $ env set uboot_bootcount 0 $ env set firmware nominal $ tftpboot $ bootm 4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n Missing features ---------------- - The "lan1", "lan2" and "lan3" port LEDs are driven by the switch but OpenWrt does not correctly configure the output. - The "lan4" and "wan" port LEDs are driven by the GPH211C phys and not configured by OpenWrt. Signed-off-by: Bjørn Mork (cherry picked from commit 6cc14bf66aa924962b926ea9702b6153ae418a7d) --- .../uboot-envtools/files/mediatek_filogic | 3 + .../dts/mt7986a-zyxel-ex5700-telenor.dts | 374 ++++++++++++++++++ .../filogic/base-files/etc/init.d/bootcount | 12 + target/linux/mediatek/image/filogic.mk | 14 + 4 files changed, 403 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts create mode 100644 target/linux/mediatek/filogic/base-files/etc/init.d/bootcount diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 6e39fac65742cb..7bfdee24f32851 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -88,6 +88,9 @@ zyxel,ex5601-t0) local envdev=/dev/mtd$(find_mtd_index "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2" ;; +zyxel,ex5700-telenor) + ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1" + ;; esac config_load ubootenv diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts new file mode 100644 index 00000000000000..b6bd746ef30b60 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts @@ -0,0 +1,374 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "ZyXEL EX5700 (Telenor)"; + compatible = "zyxel,ex5700-telenor", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + ethernet0 = &gmac0; + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + }; + + chosen { + stdout-path = "serial0:115200n8"; + + // Stock U-Boot crashes unless /chosen/bootargs exists + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + + keys { + compatible = "gpio-keys"; + poll-interval = <20>; + + reset-button { + label = "reset"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps-button { + label = "wps"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + red1 { + label = "red:net"; + gpios = <&pio 23 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + green1 { + label = "green:net"; + gpios = <&pio 25 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + amber1 { + label = "amber:net"; + gpios = <&pio 29 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + white2 { + label = "white:status"; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + red2 { + label = "red:status"; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_status_green: green2 { + label = "green:status"; + gpios = <&pio 31 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_status_amber: amber2 { + label = "amber:status"; + gpios = <&pio 18 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + +}; + +ð { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + label = "wan"; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <50000>; + reset-post-delay-us = <20000>; + + phy5: phy@5 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + }; + + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan3"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan1"; + }; + + port@5 { + reg = <5>; + label = "lan4"; + phy-mode = "2500base-x"; + phy-handle = <&phy5>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + status = "okay"; + + pcie@0,0 { + reg = <0x0000 0 0 0 0>; + + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0xa0000>; + }; + }; +}; + +&pcie_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&wf_5g_pins>; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&pio { + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "switch_int", "mdc_mdio"; + }; + }; + + pcie_pins: pcie-pins { + mux { + function = "pcie"; + groups = "pcie_pereset"; // "pcie_clk" and "pcie_wake" is unused? + }; + }; + + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_5g_pins: wf_5g-pins { + mux { + function = "wifi"; + groups = "wf_5g"; + }; + conf { + pins = "WF1_HB1", "WF1_HB2", "WF1_HB3", "WF1_HB4", + "WF1_HB0", "WF1_HB5", "WF1_HB6", "WF1_HB7", + "WF1_HB8", "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + cs-gpios = <0>, <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; + }; + + flash@1 { + compatible = "spi-nand"; + reg = <1>; + + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + spi-max-frequency = <20000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x000000 0x100000>; + read-only; + }; + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + }; + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + partition@580000 { + label = "ubi"; + reg = <0x580000 0x1da80000>; + }; + }; + }; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount new file mode 100644 index 00000000000000..c52d004c639cd8 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# SPDX-License-Identifier: GPL-2.0-only + +START=99 + +boot() { + case $(board_name) in + zyxel,ex5700-telenor) + fw_setenv uboot_bootcount 0 + ;; + esac +} diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 06cf3d7883ade3..bf3ef599cf2171 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -653,6 +653,20 @@ define Device/zyxel_ex5601-t0-stock endef TARGET_DEVICES += zyxel_ex5601-t0-stock +define Device/zyxel_ex5700-telenor + DEVICE_VENDOR := ZyXEL + DEVICE_MODEL := EX5700 (Telenor) + DEVICE_DTS := mt7986a-zyxel-ex5700-telenor + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7916-firmware kmod-ubootenv-nvram kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += zyxel_ex5700-telenor + define Device/zyxel_nwa50ax-pro DEVICE_VENDOR := ZyXEL DEVICE_MODEL := NWA50AX Pro From e1d1c26c0fa28d7ce18cf4931a3351e51434a27e Mon Sep 17 00:00:00 2001 From: Patricia Lee Date: Wed, 30 Aug 2023 19:50:54 +0800 Subject: [PATCH 0646/1171] mediatek: add support for Cetron CT3003 **Hardware specification:** - SoC: MediaTek MT7981B 2x A53 - Flash: ESMT F50L1G41LB 128MB - RAM: Nanya NT5CC128M16JR-EK 256MB - Ethernet: 4 x 10/100/1000 Mbps - Switch: MediaTek MT7531AE - WiFi: MediaTek MT7976C - Button: Reset, Mesh - Power: DC 12V 1A - UART: 3.3v, 115200n8 | Layout: | | :-------- | | | | VCC | | GND | | Tx | | Rx | **Flash instructions:** 1. Rename `openwrt-mediatek-filogic-cetron_ct3003-squashfs-factory.bin` to `factory.bin`. 2. Upload the `factory.bin` using the device's Web interface. 3. Click the upgrade button and wait for the process to finish. 4. Access the OpenWrt interface using the same password. 5. Use the 'Restore' function to reset the firmware to its initial state. **Notes:** If you plan to recovery the stock firmware in the future, it's advisable to connect the device via the serial port and enter failsafe mode to back up all the MTD partitions before proceeding the steps above. Signed-off-by: Patricia Lee (cherry picked from commit 907e9e0bd3df456b32921893cf6ef1b54117d983) --- .../uboot-envtools/files/mediatek_filogic | 1 + .../mediatek/dts/mt7981b-cetron-ct3003.dts | 242 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + target/linux/mediatek/image/filogic.mk | 32 +++ 5 files changed, 286 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 7bfdee24f32851..3c68b15442acc7 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -61,6 +61,7 @@ mercusys,mr90x-v1) local envdev=/dev/mtd$(find_mtd_index "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" ;; +cetron,ct3003|\ netgear,wax220) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; diff --git a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts new file mode 100644 index 00000000000000..d39083ffb0d614 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts @@ -0,0 +1,242 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Cetron CT3003"; + compatible = "cetron,ct3003", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_HIGH>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: led_status_red { + label = "red:status"; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + }; + + led_status_green: led_status_green { + label = "green:status"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partition@0 { + label = "BL2"; + reg = <0x0000000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + partition@180000 { + label = "art"; + reg = <0x0180000 0x0100000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + factory: partition@280000 { + label = "Factory"; + reg = <0x0280000 0x0100000>; + read-only; + }; + + partition@380000 { + label = "FIP"; + reg = <0x0380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x0580000 0x2000000>; + }; + + partition@2580000 { + label = "ubi_backup"; + reg = <0x2580000 0x2000000>; + }; + + partition@4580000 { + label = "Config_backup"; + reg = <0x4580000 0x0400000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "wan"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 93e69e5c857248..a1eb3865a72fcb 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -44,6 +44,7 @@ mediatek_setup_interfaces() mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; + cetron,ct3003|\ qihoo,360t7) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; @@ -84,6 +85,11 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + cetron,ct3003) + lan_mac=$(mtd_get_mac_binary "art" 0) + wan_mac=$(macaddr_add "$lan_mac" 3) + label_mac=$lan_mac + ;; cmcc,rax3000m) case "$(cmdline_get_var root)" in /dev/mmc*) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index a1d51a548ea98a..27675dc97ef68e 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -30,6 +30,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress ;; + cetron,ct3003) + addr=$(mtd_get_mac_binary "art" 0) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 2) > /sys${DEVPATH}/macaddress + ;; cmcc,rax3000m) case "$(cmdline_get_var root)" in /dev/mmc*) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index bf3ef599cf2171..5befe88982b195 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -90,6 +90,21 @@ define Build/zyxel-nwa-fit-filogic @mv $@.new $@ endef +define Build/cetron-header + $(eval magic=$(word 1,$(1))) + $(eval model=$(word 2,$(1))) + ( \ + dd if=/dev/zero bs=856 count=1 2>/dev/null; \ + printf "$(model)," | dd bs=128 count=1 conv=sync 2>/dev/null; \ + md5sum $@ | cut -f1 -d" " | dd bs=32 count=1 2>/dev/null; \ + printf "$(magic)" | dd bs=4 count=1 conv=sync 2>/dev/null; \ + cat $@; \ + ) > $@.tmp + fw_crc=$$(gzip -c $@.tmp | tail -c 8 | od -An -N4 -tx4 --endian little | tr -d ' \n'); \ + printf "$$(echo $$fw_crc | sed 's/../\\x&/g')" | cat - $@.tmp > $@ + rm $@.tmp +endef + define Device/asus_tuf-ax4200 DEVICE_VENDOR := ASUS DEVICE_MODEL := TUF-AX4200 @@ -174,6 +189,23 @@ endif endef TARGET_DEVICES += bananapi_bpi-r3 +define Device/cetron_ct3003 + DEVICE_VENDOR := Cetron + DEVICE_MODEL := CT3003 + DEVICE_DTS := mt7981b-cetron-ct3003 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGES += factory.bin + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | cetron-header rd30 CT3003 +endef +TARGET_DEVICES += cetron_ct3003 + define Device/cmcc_rax3000m DEVICE_VENDOR := CMCC DEVICE_MODEL := RAX3000M From 28d15e2040971bdf7c8d2d40bbd406d6ba00a94e Mon Sep 17 00:00:00 2001 From: Elbert Mai Date: Sun, 17 Sep 2023 07:59:48 -0700 Subject: [PATCH 0647/1171] mediatek: filogic: add support for Ubiquiti UniFi 6 Plus (U6+) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ubiquiti U6+ is a dual-band WiFi 6 PoE access point. It is a drop-in upgrade of the U6 lite. Specifications --- - SoC: MediaTek MT7981A dual-core ARM Cortex-A53 1.3 GHz - RAM: 256 MB DDR3-2133 RAM - Flash: 16 MB SPI NOR and 4 GB eMMC - LAN: 1x Gigabit Ethernet with 802.3af/at support - WLAN: MediaTek MT7976C 2x2 MIMO dual-band WiFi 6 - LEDs: 1x blue and 1x white - Buttons: 1x reset button Installation --- 1. Power device using a PoE injector or switch 2. Connect via Ethernet to the device with static IP 192.168.1.2 3. SSH into the device with password: ubnt $ ssh ubnt@192.168.1.20 4. Unlock kernel partitions for writing $ echo 5edfacbf > /proc/ubnthal/.uf 5. Confirm correct partitions $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p6/uevent PARTNAME=kernel0 $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p7/uevent PARTNAME=kernel1 $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p8/uevent PARTNAME=bs 6. Set and confirm bootloader environment $ fw_setenv boot_openwrt "fdt addr \$(fdtcontroladdr); fdt rm /signature; bootubnt" $ fw_setenv bootcmd_real "run boot_openwrt" $ fw_printenv 7. Copy sysupgrade image to /tmp/openwrt.bin via scp 8. Copy kernel and rootfs to mmcblk0p6 and mmcblk0p7, respectively $ tar xf /tmp/openwrt.bin sysupgrade-ubnt_unifi-6-plus/kernel -O | dd of=/dev/mmcblk0p6 $ tar xf /tmp/openwrt.bin sysupgrade-ubnt_unifi-6-plus/root -O | dd of=/dev/mmcblk0p7 9. Ensure device boots from mmcblk0p6 $ echo -ne "\x00\x00\x00\x00\x2b\xe8\x4d\xa3" > /dev/mmcblk0p8 10. Reboot the device $ reboot Signed-off-by: Elbert Mai Signed-off-by: Bjørn Mork (cherry picked from commit 75ee5546e9b7cfa5bbfd6f844ab8c5fffd5bb594) --- .../uboot-envtools/files/mediatek_filogic | 3 + .../dts/mt7981a-ubnt-unifi-6-plus.dts | 168 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-mt76-caldata | 3 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 8 + target/linux/mediatek/image/filogic.mk | 10 ++ 7 files changed, 198 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 3c68b15442acc7..ddd663325fc9dc 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -65,6 +65,9 @@ cetron,ct3003|\ netgear,wax220) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; +ubnt,unifi-6-plus) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000" + ;; xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) diff --git a/target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts b/target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts new file mode 100644 index 00000000000000..ece78ee50ebc56 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981a-ubnt-unifi-6-plus.dts @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981.dtsi" + +/ { + model = "Ubiquiti UniFi 6 Plus"; + compatible = "ubnt,unifi-6-plus", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_white; + led-failsafe = &led_white; + led-running = &led_blue; + led-upgrade = &led_blue; + label-mac-device = &gmac1; + }; + + chosen { + bootargs-override = "console=ttyS0,115200n8 rootwait root=/dev/mmcblk0p7"; + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + + leds { + compatible = "gpio-leds"; + + led_blue: dome-blue { + label = "blue:dome"; + gpios = <&pio 9 GPIO_ACTIVE_HIGH>; + }; + + led_white: dome-white { + label = "white:dome"; + gpios = <&pio 34 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&pio { + spi2_flash_pins: spi2-pins { + mux { + function = "spi"; + groups = "spi2", "spi2_wp_hold"; + }; + + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + bias-pull-up = <103>; + }; + + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + bias-pull-down = <103>; + }; + }; + + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; +}; + +&spi2 { + pinctrl-names = "default"; + pinctrl-0 = <&spi2_flash_pins>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom: partition@00000 { + label = "EEPROM"; + reg = <0x00000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_eeprom_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_eeprom_6: macaddr@6 { + reg = <0x6 0x6>; + }; + }; + + partition@10000 { + label = "u-boot-env"; + reg = <0x10000 0x80000>; + }; + }; + }; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <8>; + max-frequency = <52000000>; + cap-mmc-highspeed; + vmmc-supply = <®_3p3v>; + non-removable; + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_eeprom_0>; + }; +}; + +&wifi { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index a1eb3865a72fcb..ef46bcdd6a169d 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -16,6 +16,7 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; netgear,wax220|\ + ubnt,unifi-6-plus|\ zyxel,nwa50ax-pro) ucidef_set_interface_lan "eth0" ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index 57e56705436272..b16829496044a8 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -23,6 +23,9 @@ case "$FIRMWARE" in ;; esac ;; + ubnt,unifi-6-plus) + caldata_extract_mmc "factory" 0x0 0x1000 + ;; esac ;; "mediatek/mt7986_eeprom_mt7976.bin") diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 27675dc97ef68e..12f16e6027e2fd 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -69,6 +69,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress ;; + ubnt,unifi-6-plus) + addr=$(mtd_get_mac_binary EEPROM 0x6) + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; qihoo,360t7) addr=$(mtd_get_mac_ascii factory lanMac) [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 201fd0cb5e813f..a9ec171a1b0a3b 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -100,6 +100,11 @@ platform_do_upgrade() { CI_UBIPART="ubi0" nand_do_upgrade "$1" ;; + ubnt,unifi-6-plus) + CI_KERNPART="kernel0" + EMMC_ROOT_DEV="$(cmdline_get_var root)" + emmc_do_upgrade "$1" + ;; h3c,magic-nx30-pro|\ mediatek,mt7981-rfb|\ qihoo,360t7|\ @@ -160,6 +165,9 @@ platform_copy_config() { ;; esac ;; + ubnt,unifi-6-plus) + emmc_copy_config + ;; esac } diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 5befe88982b195..067b5f13b0408e 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -556,6 +556,16 @@ define Device/tplink_tl-xdr6088 endef TARGET_DEVICES += tplink_tl-xdr6088 +define Device/ubnt_unifi-6-plus + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi 6 Plus + DEVICE_DTS := mt7981a-ubnt-unifi-6-plus + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware e2fsprogs f2fsck mkf2fs fdisk partx-utils + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += ubnt_unifi-6-plus + define Device/xiaomi_mi-router-wr30u-112m-nmbm DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router WR30U (112M UBI with NMBM-Enabled layout) From b530d492a9d933ca8fc4838a6ec65822c63258ab Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Sun, 24 Sep 2023 22:34:12 +0800 Subject: [PATCH 0648/1171] filogic: add support for GL.iNet GL-MT6000 Hardware specification: * SoC: MediaTek MT7986A 4x A53 * Flash: 8GB EMMC * RAM: 1GB DDR4 * Ethernet: * 2x2.5G RJ45 port (RTL8221B) * 4x1G RJ45 ports (MT7531AE) * WLAN: * 2.4GHz: MT7976GN 4T4R * 5GHz: MT7976AN 4T4R * Button: Reset * LED: 1 x dual color LED * USB: 1 x USB 3.0 * Power: DC 12V 4A * UART: 3V3 115200 8N1 (Pinout: GND TX RX VCC) * JTAG: 9 PIN If you want to use u-boot from OpenWrt, you can upgrade it safely. * bl2: openwrt-mediatek-filogic-glinet_gl-mt6000-preloader.bin * fip: openwrt-mediatek-filogic-glinet_gl-mt6000-bl31-uboot.fip `openwrt-mediatek-filogic-glinet_gl-mt6000-squashfs-factory.bin` is used in OpenWrt's u-boot. Signed-off-by: Jianhui Zhao (cherry picked from commit fe10f9743935d6986e80e7cb082469e6bc5a03f0) --- .../uboot-envtools/files/mediatek_filogic | 4 + package/boot/uboot-mediatek/Makefile | 13 + .../patches/436-add-glinet-mt6000.patch | 274 ++++++++++++++++ .../mediatek/dts/mt7986a-glinet-gl-mt6000.dts | 306 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/firmware/11-mt76-caldata | 7 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 6 + target/linux/mediatek/image/filogic.mk | 15 + 9 files changed, 636 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch create mode 100644 target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index ddd663325fc9dc..d4d0969b7af3a2 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -57,6 +57,10 @@ cmcc,rax3000m) glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; +glinet,gl-mt6000) + local envdev=$(find_mmc_part "u-boot-env") + ubootenv_add_uci_config "$envdev" "0x0" "0x80000" + ;; mercusys,mr90x-v1) local envdev=/dev/mtd$(find_mtd_index "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index d566714bb4ae5f..ad25d051fed90e 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -381,6 +381,18 @@ define U-Boot/mt7986_bananapi_bpi-r3-nor FIP_COMPRESS:=1 endef +define U-Boot/mt7986_glinet_gl-mt6000 + NAME:=GL.iNet GL-MT6000 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=glinet_gl-mt6000 + UBOOT_CONFIG:=mt7986a_glinet_gl-mt6000 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=emmc + BL2_SOC:=mt7986 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4 +endef + define U-Boot/mt7986_tplink_tl-xdr4288 NAME:=TP-LINK TL-XDR4288 BUILD_SUBTARGET:=filogic @@ -522,6 +534,7 @@ UBOOT_TARGETS := \ mt7986_bananapi_bpi-r3-sdmmc \ mt7986_bananapi_bpi-r3-snand \ mt7986_bananapi_bpi-r3-nor \ + mt7986_glinet_gl-mt6000 \ mt7986_tplink_tl-xdr4288 \ mt7986_tplink_tl-xdr6086 \ mt7986_tplink_tl-xdr6088 \ diff --git a/package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch b/package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch new file mode 100644 index 00000000000000..ad138acfd921d4 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch @@ -0,0 +1,274 @@ +--- /dev/null ++++ b/arch/arm/dts/mt7986a-glinet-gl-mt6000.dts +@@ -0,0 +1,135 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/dts-v1/; ++#include ++#include ++ ++#include "mt7986.dtsi" ++ ++/ { ++ model = "GL.iNet GL-MT6000"; ++ compatible = "glinet,gl-mt6000", "mediatek,mt7986-emmc-rfb", "mediatek,mt7986"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x40000000>; ++ }; ++ ++ reg_1p8v: regulator-1p8v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-1.8V"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ wps { ++ label = "reset"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led_status_blue: green { ++ label = "blue:status"; ++ gpios = <&gpio 28 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led_status_white: blue { ++ label = "white:status"; ++ gpios = <&gpio 27 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "2500base-x"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ mmc0_pins_default: mmc0default { ++ mux { ++ function = "flash"; ++ groups = "emmc_51"; ++ }; ++ ++ conf-cmd-dat { ++ pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", ++ "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", ++ "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; ++ input-enable; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-clk { ++ pins = "EMMC_CK"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ ++ conf-dsl { ++ pins = "EMMC_DSL"; ++ bias-pull-down = ; ++ }; ++ ++ conf-rst { ++ pins = "EMMC_RSTB"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ }; ++}; ++ ++&mmc0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc0_pins_default>; ++ bus-width = <8>; ++ max-frequency = <200000000>; ++ cap-mmc-highspeed; ++ cap-mmc-hw-reset; ++ vmmc-supply = <®_3p3v>; ++ vqmmc-supply = <®_1p8v>; ++ non-removable; ++ status = "okay"; ++}; ++ ++&wmcpu_emi { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/configs/mt7986a_glinet_gl-mt6000_defconfig +@@ -0,0 +1,105 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_ENV_SIZE=0x80000 ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_DEFAULT_DEVICE_TREE="mt7986a-glinet-gl-mt6000" ++CONFIG_SYS_PROMPT="MT7986> " ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7986=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART=y ++CONFIG_AHCI=y ++CONFIG_FIT=y ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-glinet-gl-mt6000.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="glinet_gl-mt6000_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_NETCONSOLE=y ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CLK=y ++CONFIG_GPIO_HOG=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_SUPPORT_EMMC_BOOT=y ++CONFIG_MMC_HS200_SUPPORT=y ++CONFIG_MMC_MTK=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7986=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/glinet_gl-mt6000_env +@@ -0,0 +1,25 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++bootdelay=3 ++bootfile_bl2=openwrt-mediatek-filogic-glinet_gl-mt6000-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-glinet_gl-mt6000-bl31-uboot.fip ++bootfile_firmware=openwrt-mediatek-filogic-glinet_gl-mt6000-squashfs-factory.bin ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_title= *** U-Boot Boot Menu for GL-iNet GL-MT6000 *** ++bootmenu_0=Startup system (Default).=run boot_system ++bootmenu_1=Load Firmware via TFTP then write to eMMC.=run boot_tftp_firmware ; run bootmenu_confirm_return ++bootmenu_2=Load BL31+U-Boot FIP via TFTP then write to eMMC.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_3=mLoad BL2 preloader via TFTP then write to eMMC.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_4=Reboot.=reset ++bootmenu_5=Reset all settings to factory defaults.=run reset_factory ; reset ++filesize_to_blk=setexpr cnt $filesize + 0x1ff && setexpr cnt $cnt / 0x200 ++mmc_read_kernel=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr $part_addr $image_size ++boot_system=part start mmc 0 kernel part_addr && part size mmc 0 kernel part_size && run mmc_read_kernel && bootm ++boot_tftp_firmware=tftpboot $loadaddr $bootfile_firmware && run emmc_write_firmware ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2 ++emmc_write_firmware=part start mmc 0 kernel part_addr && run filesize_to_blk && mmc write $loadaddr $part_addr $cnt ++emmc_write_bl2=run filesize_to_blk && test 0x$cnt -le 0x800 && mmc partconf 0 1 1 1 && && mmc write $loadaddr 0x0 0x800 ; mmc partconf 0 1 1 0 ++emmc_write_fip=part start mmc 0 fip part_addr && part size mmc 0 fip part_size && run filesize_to_blk && test 0x$cnt -le 0x$part_size && mmc write $loadaddr $part_addr $cnt ++reset_factory=eraseenv && reset diff --git a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts new file mode 100644 index 00000000000000..2be1907f632f12 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts @@ -0,0 +1,306 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "GL.iNet GL-MT6000"; + compatible = "glinet,gl-mt6000", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=PARTLABEL=rootfs rootwait"; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "1.8vd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_run: led@0 { + label = "blue:run"; + gpios = <&pio 38 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led@1 { + label = "white:system"; + gpios = <&pio 37 GPIO_ACTIVE_LOW>; + }; + }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&pio 24 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy1: phy@1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <1>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 10 GPIO_ACTIVE_LOW>; + interrupt-parent = <&pio>; + interrupts = <46 IRQ_TYPE_LEVEL_LOW>; + realtek,aldps-enable; + }; + + phy7: ethernet-phy@7 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <7>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 19 GPIO_ACTIVE_LOW>; + interrupt-parent = <&pio>; + interrupts = <47 IRQ_TYPE_LEVEL_LOW>; + realtek,aldps-enable; + }; + + switch: switch@31 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 18 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan2"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan4"; + }; + + port@3 { + reg = <3>; + label = "lan5"; + }; + + port@5 { + reg = <5>; + label = "lan1"; + phy-handle = <&phy7>; + phy-mode = "2500base-x"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&pio { + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + mmc0_pins_default: mmc0-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + mmc0_pins_uhs: mmc0-uhs-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; +}; + +&crypto { + status = "okay"; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <&usb_vbus>; + status = "okay"; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + pinctrl-names = "default"; + pinctrl-0 = <&wf_2g_5g_pins>; + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <8>; + max-frequency = <200000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + mmc-hs400-1_8v; + hs400-ds-delay = <0x14014>; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; + non-removable; + no-sd; + no-sdio; + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index ef46bcdd6a169d..d9fa4773535e5c 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -49,6 +49,7 @@ mediatek_setup_interfaces() qihoo,360t7) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; + glinet,gl-mt6000|\ tplink,tl-xdr4288|\ tplink,tl-xdr6088) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 @@ -100,6 +101,11 @@ mediatek_setup_macs() ;; esac ;; + glinet,gl-mt6000) + label_mac=$(mmc_get_mac_binary factory 0x0a) + wan_mac=$label_mac + lan_mac=$(macaddr_add "$label_mac" 2) + ;; h3c,magic-nx30-pro) wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr) lan_mac=$(macaddr_add "$wan_mac" 1) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index b16829496044a8..4f9b4dc17098a5 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -43,6 +43,13 @@ case "$FIRMWARE" in ;; esac ;; +"mediatek/mt7986_eeprom_mt7976_dual.bin") + case "$board" in + glinet,gl-mt6000) + caldata_extract_mmc "factory" 0x0 0x1000 + ;; + esac + ;; *) exit 1 ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 12f16e6027e2fd..5de4061c948be8 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -54,6 +54,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress ;; + glinet,gl-mt6000) + addr=$(mmc_get_mac_binary factory 0x04) + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; h3c,magic-nx30-pro) addr=$(mtd_get_mac_ascii pdt_data_1 ethaddr) [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index a9ec171a1b0a3b..c2a9c8f3b00cb7 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -96,6 +96,11 @@ platform_do_upgrade() { cudy,wr3000-v1) default_do_upgrade "$1" ;; + glinet,gl-mt6000) + CI_KERNPART="kernel" + CI_ROOTPART="rootfs" + emmc_do_upgrade "$1" + ;; mercusys,mr90x-v1) CI_UBIPART="ubi0" nand_do_upgrade "$1" @@ -165,6 +170,7 @@ platform_copy_config() { ;; esac ;; + glinet,gl-mt6000|\ ubnt,unifi-6-plus) emmc_copy_config ;; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 067b5f13b0408e..226908cd12edf2 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -274,6 +274,21 @@ define Device/glinet_gl-mt3000 endef TARGET_DEVICES += glinet_gl-mt3000 +define Device/glinet_gl-mt6000 + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-MT6000 + DEVICE_DTS := mt7986a-glinet-gl-mt6000 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb2 kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to 32M | append-rootfs + IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7986-bl2 emmc-ddr4 + ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot glinet_gl-mt6000 +endef +TARGET_DEVICES += glinet_gl-mt6000 + define Device/h3c_magic-nx30-pro DEVICE_VENDOR := H3C DEVICE_MODEL := Magic NX30 Pro From f3a8820959d1ae1361541a490507aae38348f954 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Fri, 17 Nov 2023 23:27:03 +0800 Subject: [PATCH 0649/1171] mediatek: filogic: remove kmod-usb2 for GL-MT6000 The usb driver requires kmod-usb3, not kmod-usb2. Remove the useless kmod-usb2 from default package. Signed-off-by: Chukun Pan (cherry picked from commit b74ae695967942849b9f68c68d05217e1420dc1d) --- target/linux/mediatek/image/filogic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 226908cd12edf2..932bf616c349e8 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -279,7 +279,7 @@ define Device/glinet_gl-mt6000 DEVICE_MODEL := GL-MT6000 DEVICE_DTS := mt7986a-glinet-gl-mt6000 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-usb2 kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs + DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to 32M | append-rootfs IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata From 6143b730fce6e27a1fd7c93b5300d752f5d13bee Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Tue, 10 Oct 2023 14:09:38 +0800 Subject: [PATCH 0650/1171] uboot-mediatek: fix typo in bootmenu for GL-MT6000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: b530d492a9d9 ("filogic: add support for GL.iNet GL-MT6000") Signed-off-by: Jianhui Zhao (cherry picked from commit 4536fb4c5c7b3564dae301529bb0ac4a3ce914b8) [rmilecki: fix commit hash in Fixes] Signed-off-by: Rafał Miłecki --- package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch b/package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch index ad138acfd921d4..e0a059eb7bd398 100644 --- a/package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch +++ b/package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch @@ -259,7 +259,7 @@ +bootmenu_0=Startup system (Default).=run boot_system +bootmenu_1=Load Firmware via TFTP then write to eMMC.=run boot_tftp_firmware ; run bootmenu_confirm_return +bootmenu_2=Load BL31+U-Boot FIP via TFTP then write to eMMC.=run boot_tftp_write_fip ; run bootmenu_confirm_return -+bootmenu_3=mLoad BL2 preloader via TFTP then write to eMMC.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_3=Load BL2 preloader via TFTP then write to eMMC.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return +bootmenu_4=Reboot.=reset +bootmenu_5=Reset all settings to factory defaults.=run reset_factory ; reset +filesize_to_blk=setexpr cnt $filesize + 0x1ff && setexpr cnt $cnt / 0x200 From cc285dc2b6f7699b689f8f9cb7ba582f176d921c Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Sun, 24 Sep 2023 22:15:00 +0800 Subject: [PATCH 0651/1171] generic: net: phy: realtek: add interrupt support for RTL8221B This commit introduces interrupt support for RTL8221B. Signed-off-by: Jianhui Zhao (cherry picked from commit 1db949a632607aa1df2987b7701da0be3e473260) --- ...ealtek-support-interrupt-of-RTL8221B.patch | 63 +++++++++++++++++++ ...ealtek-support-interrupt-of-RTL8221B.patch | 63 +++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 target/linux/generic/pending-5.15/731-net-phy-realtek-support-interrupt-of-RTL8221B.patch create mode 100644 target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch diff --git a/target/linux/generic/pending-5.15/731-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-5.15/731-net-phy-realtek-support-interrupt-of-RTL8221B.patch new file mode 100644 index 00000000000000..b2b41d9c61f74f --- /dev/null +++ b/target/linux/generic/pending-5.15/731-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -0,0 +1,63 @@ +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -971,6 +971,51 @@ static int rtl8221b_config_init(struct p + return 0; + } + ++static int rtl8221b_ack_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_read_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d4); ++ ++ return (err < 0) ? err : 0; ++} ++ ++static int rtl8221b_config_intr(struct phy_device *phydev) ++{ ++ int err; ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ err = rtl8221b_ack_interrupt(phydev); ++ if (err) ++ return err; ++ ++ err = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d2, 0x7ff); ++ } else { ++ err = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d2, 0x0); ++ if (err) ++ return err; ++ ++ err = rtl8221b_ack_interrupt(phydev); ++ } ++ ++ return err; ++} ++ ++static irqreturn_t rtl8221b_handle_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = rtl8221b_ack_interrupt(phydev); ++ if (err) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ + static struct phy_driver realtek_drvs[] = { + { + PHY_ID_MATCH_EXACT(0x00008201), +@@ -1119,6 +1164,8 @@ static struct phy_driver realtek_drvs[] + .get_features = rtl822x_get_features, + .config_init = rtl8221b_config_init, + .config_aneg = rtl822x_config_aneg, ++ .config_intr = rtl8221b_config_intr, ++ .handle_interrupt = rtl8221b_handle_interrupt, + .probe = rtl822x_probe, + .read_status = rtl822x_read_status, + .suspend = genphy_suspend, diff --git a/target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch new file mode 100644 index 00000000000000..55a9e3529d05b2 --- /dev/null +++ b/target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -0,0 +1,63 @@ +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -979,6 +979,51 @@ static int rtl8221b_config_init(struct p + return 0; + } + ++static int rtl8221b_ack_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_read_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d4); ++ ++ return (err < 0) ? err : 0; ++} ++ ++static int rtl8221b_config_intr(struct phy_device *phydev) ++{ ++ int err; ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ err = rtl8221b_ack_interrupt(phydev); ++ if (err) ++ return err; ++ ++ err = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d2, 0x7ff); ++ } else { ++ err = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d2, 0x0); ++ if (err) ++ return err; ++ ++ err = rtl8221b_ack_interrupt(phydev); ++ } ++ ++ return err; ++} ++ ++static irqreturn_t rtl8221b_handle_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = rtl8221b_ack_interrupt(phydev); ++ if (err) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ + static struct phy_driver realtek_drvs[] = { + { + PHY_ID_MATCH_EXACT(0x00008201), +@@ -1139,6 +1184,8 @@ static struct phy_driver realtek_drvs[] + .get_features = rtl822x_get_features, + .config_init = rtl8221b_config_init, + .config_aneg = rtl822x_config_aneg, ++ .config_intr = rtl8221b_config_intr, ++ .handle_interrupt = rtl8221b_handle_interrupt, + .probe = rtl822x_probe, + .read_status = rtl822x_read_status, + .suspend = genphy_suspend, From 5a0bdab24c0ff1e577669bc89cb8a277229780b8 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 4 May 2023 23:10:03 +0800 Subject: [PATCH 0652/1171] mt76: drop default eeprom file for mt7986-firmware The mt76 driver usually reads the eeprom on the mtd partition at dts. For emmc device we need to use caldata_extract script to read the eeprom. However, the default eeprom file breaks the caldata script execution, so remove it. Signed-off-by: Chukun Pan (cherry picked from commit e3aa645b267ca4f08773b5366583e9b0020fc3e9) --- package/kernel/mt76/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 78f01c119fbfda..42075daecd52e2 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -542,8 +542,6 @@ define KernelPackage/mt7986-firmware/install $(PKG_BUILD_DIR)/firmware/mt7986_wm.bin \ $(PKG_BUILD_DIR)/firmware/mt7986_rom_patch_mt7975.bin \ $(PKG_BUILD_DIR)/firmware/mt7986_rom_patch.bin \ - $(PKG_BUILD_DIR)/firmware/mt7986_eeprom_mt7975_dual.bin \ - $(PKG_BUILD_DIR)/firmware/mt7986_eeprom_mt7976_dual.bin \ $(1)/lib/firmware/mediatek endef From f8c149dcbd038f922c58050b9e7bbbf30edf7b41 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 30 Sep 2023 14:07:15 +0000 Subject: [PATCH 0653/1171] mediatek: fix eeprom loading (Mercusys MR90X v1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit mt76: drop default eeprom file for mt7986-firmware (e3aa645b267ca4f08773b5366583e9b0020fc3e9) breaks eeprom loading for Mercusys MR90X v1. As a result WiFi is not working at all. This commit adds Mercusus MR90x to the caldata script (it works after the commit mentioned above). And we can safely drop "81_fix_eeprom" script as it's no longer required. Fixes: 5a0bdab24c0f ("mt76: drop default eeprom file for mt7986-firmware") Signed-off-by: Mikhail Zhilkin (cherry picked from commit 85b0d7592c454f2e4e02be043a1e433c67df4e41) [rmilecki: fix commit hash in Fixes] Signed-off-by: Rafał Miłecki --- .../etc/hotplug.d/firmware/11-mt76-caldata | 8 ++++++++ .../filogic/base-files/lib/preinit/81_fix_eeprom | 16 ---------------- 2 files changed, 8 insertions(+), 16 deletions(-) delete mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index 4f9b4dc17098a5..e7826373489fb1 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -28,6 +28,14 @@ case "$FIRMWARE" in ;; esac ;; +"mediatek/mt7986_eeprom_mt7975_dual.bin") + case "$board" in + mercusys,mr90x-v1) + ln -sf /tmp/tp_data/MT7986_EEPROM.bin \ + /lib/firmware/$FIRMWARE + ;; + esac + ;; "mediatek/mt7986_eeprom_mt7976.bin") case "$board" in acer,predator-w6) diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom b/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom deleted file mode 100644 index 0a842facca8851..00000000000000 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom +++ /dev/null @@ -1,16 +0,0 @@ -. /lib/functions/system.sh - -preinit_fix_eeprom() { - case $(board_name) in - mercusys,mr90x-v1) - eeprom="/lib/firmware/mediatek/mt7986_eeprom_mt7975_dual.bin" - oem="/tmp/tp_data/MT7986_EEPROM.bin" - [ ! -L $eeprom -a -e $oem ] && \ - mv -f $eeprom $eeprom.bak && ln -s $oem $eeprom - ;; - *) - ;; - esac -} - -boot_hook_add preinit_main preinit_fix_eeprom From 982bfd98cbf08a7a4983763848e443f95e9abc76 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 7 Dec 2023 23:12:00 +0100 Subject: [PATCH 0654/1171] ucode: adjust module dependencies Let ucode-mod-* packages select the ucode interpreter instead of depending on it to avoid recursive dependency chains in unrelated packages. Fixes: https://github.com/openwrt/packages/issues/22837 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 01d1c1ad296cc71f87ea02b01b16a09fe5d933a1) --- package/utils/ucode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 067e56e02de827..8a6274739ed52d 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -94,7 +94,7 @@ define UcodeModule define Package/ucode-mod-$(strip $(1)) $(Package/ucode/default) TITLE+= ($(strip $(1)) module) - DEPENDS:=ucode $(3) + DEPENDS:=+ucode $(3) endef define Package/ucode-mod-$(strip $(1))/description From 557a32aba0aaaae860a0abae181c42df2cf39188 Mon Sep 17 00:00:00 2001 From: Patryk Kowalczyk Date: Sat, 16 Sep 2023 03:02:35 +0200 Subject: [PATCH 0655/1171] filogic: add support for ASUS TUF AX6000 Hardware ======== SOC: MediaTek MT7986 RAM: 512MB DDR3 FLASH: 256MB SPI-NAND WIFI: Mediatek MT7986 DBDC 802.11ax 2.4/5 GHz 4T4R ETH: MediaTek MT7530 Switch (LAN) MaxLinear GPY211C 2.5 N-Base-T PHY (WAN) MaxLinear GPY211C 2.5 N-Base-T PHY (LAN) UART: 3V3 115200 8N1 (Do not connect VCC) USB 3.1 Installation ============ Download the OpenWrt initramfs image. Copy the image to a TFTP server reachable at 192.168.1.70/24. Rename the image to TUF-AX6000.bin. Connect to the serial console, interrupt the auto boot process by pressing '4' when prompted or press '1' and set client IP, server IP and name of the image. yOU don't need to open the case or even soldering anything. use three goldpin wires, remove their plastic cover and connect them to the console pinout via the case holes. You can see three holes From Bottom: RX, TX, Ground - partially covered Download & Boot the OpenWrt initramfs image. In case of option '4' $ setenv ipaddr 192.168.1.1 $ setenv serverip 192.168.1.70 $ tftpboot 0x46000000 TUF-AX6000.bin $ bootm 0x46000000 In case of option '1' 1: Load System code to SDRAM via TFTP. Please Input new ones /or Ctrl-C to discard Input device IP (192.168.1.1) ==: Input server IP (192.168.1.70) ==: Input Linux Kernel filename (TUF-AX6000.trx) ==: Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n Missing features ================ 2.5Gb LAN port LED is ON during boot or when the LAN cable is disconnected The cover yellow light is not supported. (only blue one) Signed-off-by: Patryk Kowalczyk (cherry picked from commit d522ccecb28f941aadcaf7a50cd6daa861f468a7) --- .../mediatek/dts/mt7986a-asus-tuf-ax6000.dts | 382 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 6 +- .../etc/hotplug.d/firmware/11-mt76-caldata | 3 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 3 +- .../base-files/lib/preinit/10_fix_eth_mac.sh | 3 +- .../base-files/lib/upgrade/platform.sh | 3 +- target/linux/mediatek/image/filogic.mk | 16 + 7 files changed, 411 insertions(+), 5 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts new file mode 100644 index 00000000000000..2e9114f99c013e --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts @@ -0,0 +1,382 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "ASUS TUF-AX6000"; + compatible = "asus,tuf-ax6000", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = "ubi.mtd=UBI_DEV"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + mesh { + label = "wps"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wlan { + label = "white:wlan"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + + led_system: system { + label = "white:system"; + gpios = <&pio 11 GPIO_ACTIVE_HIGH>; + }; + + wan-red { + label = "red:wan"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + cover-blue { + label = "blue:cover"; + gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + }; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + /* LAN */ + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + /* WAN */ + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <50000>; + reset-post-delay-us = <20000>; + + phy5: phy@5 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + + mxl,led-config = <0x03f0 0x0 0x0 0x0>; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + + /* LED0: CONN (WAN white) */ + mxl,led-config = <0x03f0 0x0 0x0 0x0>; + }; + + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&pcie_phy { + status = "okay"; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <20000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x400000>; + read-only; + }; + + partition@400000 { + label = "UBI_DEV"; + reg = <0x400000 0xfc00000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <4>; + label = "lan1"; + }; + + port@2 { + reg = <3>; + label = "lan2"; + }; + + port@3 { + reg = <2>; + label = "lan3"; + }; + + port@4 { + reg = <1>; + label = "lan4"; + }; + + port@5 { + reg = <5>; + label = "lan5"; + phy-mode = "2500base-x"; + phy-handle = <&phy5>; + + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy@1 { + reg = <1>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@2 { + reg = <2>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@3 { + reg = <3>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@4 { + reg = <4>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; \ No newline at end of file diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index d9fa4773535e5c..aad1d67ff6fde5 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -15,6 +15,9 @@ mediatek_setup_interfaces() mediatek,mt7981-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; + asus,tuf-ax6000) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 + ;; netgear,wax220|\ ubnt,unifi-6-plus|\ zyxel,nwa50ax-pro) @@ -78,7 +81,8 @@ mediatek_setup_macs() local label_mac="" case $board in - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) wan_mac="${addr}" diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index e7826373489fb1..63c1ec31b7a09e 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -45,7 +45,8 @@ case "$FIRMWARE" in ;; "mediatek/mt7986_eeprom_mt7976_dbdc.bin") case "$board" in - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" caldata_extract_ubi "Factory" 0x0 0x1000 ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 5de4061c948be8..395cc0f2dc5466 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -16,7 +16,8 @@ case "$board" in [ "$PHYNBR" = "1" ] && cat $key_path/6gMAC > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "2" ] && cat $key_path/5gMAC > /sys${DEVPATH}/macaddress ;; - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index 69d0ab6c60c54f..d770b1364322af 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -10,7 +10,8 @@ preinit_set_mac_address() { ip link set dev game address "$(cat $key_path/LANMAC)" ip link set dev eth1 address "$(cat $key_path/WANMAC)" ;; - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) ip link set dev eth0 address "$addr" diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index c2a9c8f3b00cb7..1d8b6afb840963 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -56,7 +56,8 @@ platform_do_upgrade() { CI_ROOTPART="rootfs" emmc_do_upgrade "$1" ;; - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" CI_KERNPART="linux" nand_do_upgrade "$1" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 932bf616c349e8..f616f7a72d44b6 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -121,6 +121,22 @@ define Device/asus_tuf-ax4200 endef TARGET_DEVICES += asus_tuf-ax4200 +define Device/asus_tuf-ax6000 + DEVICE_VENDOR := ASUS + DEVICE_MODEL := TUF-AX6000 + DEVICE_DTS := mt7986a-asus-tuf-ax6000 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware + IMAGES := sysupgrade.bin + KERNEL := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += asus_tuf-ax6000 + define Device/acer_predator-w6 DEVICE_VENDOR := Acer DEVICE_MODEL := Predator W6 From 4f9c4113c40107d88df0dda57330474044e70497 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 15 Jun 2023 23:21:40 +0800 Subject: [PATCH 0656/1171] uboot-mediatek: add JCG Q30 PRO support The vendor uboot will verify firmware at boot. So add a custom uboot build for this device. Signed-off-by: Chukun Pan (cherry picked from commit b42c5272286ee248c698cc2cfac88df1bf51cbe3) --- .../uboot-envtools/files/mediatek_filogic | 1 + package/boot/uboot-mediatek/Makefile | 13 + .../patches/438-add-jcg_q30-pro.patch | 420 ++++++++++++++++++ 3 files changed, 434 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/438-add-jcg_q30-pro.patch diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index d4d0969b7af3a2..5cd63a46e612f5 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -79,6 +79,7 @@ xiaomi,redmi-router-ax6000-stock) ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000" ;; h3c,magic-nx30-pro|\ +jcg,q30-pro|\ qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index ad25d051fed90e..a06d323bae81d8 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -236,6 +236,18 @@ define U-Boot/mt7981_h3c_magic-nx30-pro DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_jcg_q30-pro + NAME:=JCG Q30 PRO + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=jcg_q30-pro + UBOOT_CONFIG:=mt7981_jcg_q30-pro + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + define U-Boot/mt7981_rfb-spim-nand NAME:=MT7981 Reference Board BUILD_SUBTARGET:=filogic @@ -523,6 +535,7 @@ UBOOT_TARGETS := \ mt7981_cmcc_rax3000m-emmc \ mt7981_cmcc_rax3000m-nand \ mt7981_h3c_magic-nx30-pro \ + mt7981_jcg_q30-pro \ mt7981_rfb-spim-nand \ mt7981_rfb-emmc \ mt7981_rfb-nor \ diff --git a/package/boot/uboot-mediatek/patches/438-add-jcg_q30-pro.patch b/package/boot/uboot-mediatek/patches/438-add-jcg_q30-pro.patch new file mode 100644 index 00000000000000..639cae174e752d --- /dev/null +++ b/package/boot/uboot-mediatek/patches/438-add-jcg_q30-pro.patch @@ -0,0 +1,420 @@ +--- /dev/null ++++ b/configs/mt7981_jcg_q30-pro_defconfig +@@ -0,0 +1,175 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981_jcg_q30-pro" ++CONFIG_DEFAULT_ENV_FILE="jcg_q30-pro_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_jcg_q30-pro.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_PCI=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_SCSI=y ++CONFIG_AHCI=y ++CONFIG_AHCI_PCI=y ++CONFIG_SCSI_AHCI=y ++CONFIG_SCSI=y ++CONFIG_CMD_SCSI=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_HEXDUMP=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/arch/arm/dts/mt7981_jcg_q30-pro.dts +@@ -0,0 +1,179 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "JCG Q30 PRO"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ factory { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status_red { ++ label = "red:status"; ++ gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ status_blue { ++ label = "blue:status"; ++ gpios = <&gpio 13 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "disabled"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "2500base-x"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++ ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_1"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++ ++ pwm_pins: pwm0-pins-func-1 { ++ mux { ++ function = "pwm"; ++ groups = "pwm0_1", "pwm1_0"; ++ }; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "orig-env"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@160000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x7000000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/jcg_q30-pro_env +@@ -0,0 +1,57 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-jcg_q30-pro-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-jcg_q30-pro-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-jcg_q30-pro-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-jcg_q30-pro-squashfs-sysupgrade.itb ++bootled_pwr=blue:status ++bootled_rec=red:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++part_default=production ++part_recovery=recovery ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++ethaddr_factory=mtd read factory 0x40080000 0xa0000 0x800 && env readmem -b ethaddr 0x4008002a 0x6 ; setenv ethaddr_factory ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" From 6df6f03396a42ef2cd03b8ec757974b6afd07afb Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Fri, 16 Jun 2023 23:16:30 +0800 Subject: [PATCH 0657/1171] mediatek: filogic: add JCG Q30 PRO support Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: Winbond 128MB RAM: DDR3 256MB Ethernet: 4x 10/100/1000 Mbps Switch: MediaTek MT7531AE WiFi: MediaTek MT7976C Button: Reset Power: DC 12V 1A Flash instructions: 1. Connect to your PC via the Gigabit port of the router, set a static ip on the ethernet interface of your PC. (ip 192.168.1.254, gateway 192.168.1.1) 2. Attach UART, pause at u-boot menu. 3. Select "Upgrade ATF BL2", then use preloader.bin 4. Select "Upgrade ATF FIP", then use bl31-uboot.fip 5. Download the initramfs image, and type "reset", waiting for tftp recovery to complete. 6. After openwrt boots up, perform sysupgrade. Note: 1. Since NMBM is disabled, we must back up all partitions. 2. Although we can upgrade new firmware in the stock firmware, we need the special fit image signature of MediaTek and dual boot (hack kernel) to make u-boot boot it. So just abandon these hacks and flash it via the serial port. Signed-off-by: Chukun Pan (cherry picked from commit 626344c9926dcf2db2e10681c19aab0328fee160) --- .../mediatek/dts/mt7981b-jcg-q30-pro.dts | 225 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 24 ++ 5 files changed, 256 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts diff --git a/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts b/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts new file mode 100644 index 00000000000000..adb86d9ebd06ff --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts @@ -0,0 +1,225 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "JCG Q30 PRO"; + compatible = "jcg,q30-pro", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + label-mac-device = &gmac0; + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: red { + label = "red:status"; + gpios = <&pio 8 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: blue { + label = "blue:status"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_lan>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bl2"; + reg = <0x0000000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x0180000 0x0200000>; + read-only; + }; + + partition@380000 { + label = "fip"; + reg = <0x0380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x0580000 0x7000000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + nvmem-cells = <&macaddr_wan>; + nvmem-cell-names = "mac-address"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_wan: macaddr@a0024 { + reg = <0xa0024 0x6>; + }; + + macaddr_lan: macaddr@a002a { + reg = <0xa002a 0x6>; + }; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index aad1d67ff6fde5..0760d17a8e276e 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -49,6 +49,7 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; cetron,ct3003|\ + jcg,q30-pro|\ qihoo,360t7) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 395cc0f2dc5466..a9de563a4bf099 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -65,6 +65,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress ;; + jcg,q30-pro) + # Originally, phy1 is phy0 mac with LA bit set. However, this would conflict + # addresses on multiple VIFs with the other radio. Use label mac to set LA bit. + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(get_mac_label) > /sys${DEVPATH}/macaddress + ;; mercusys,mr90x-v1) addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 1d8b6afb840963..bfe5ed830bdf0e 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -112,6 +112,7 @@ platform_do_upgrade() { emmc_do_upgrade "$1" ;; h3c,magic-nx30-pro|\ + jcg,q30-pro|\ mediatek,mt7981-rfb|\ qihoo,360t7|\ tplink,tl-xdr4288|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index f616f7a72d44b6..0ad8b3e728dcc9 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -330,6 +330,30 @@ define Device/h3c_magic-nx30-pro endef TARGET_DEVICES += h3c_magic-nx30-pro +define Device/jcg_q30-pro + DEVICE_VENDOR := JCG + DEVICE_MODEL := Q30 PRO + DEVICE_DTS := mt7981b-jcg-q30-pro + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot jcg_q30-pro +endef +TARGET_DEVICES += jcg_q30-pro + define Device/netgear_wax220 DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WAX220 From d9246902b047254ae5006215ccafbc9ccc87f5fd Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 9 Dec 2023 13:39:53 +0100 Subject: [PATCH 0658/1171] mediatek: add support for Zbtlink ZBT-Z8102AX Specifications: SoC: MediaTek MT7981B RAM: 1024MiB Flash: SPI-NAND 128 MiB Switch: 1 WAN, 4 LAN (Gigabit) USB: two M.2 slots for 5G modems via USB 3.0 hub, external USB 3.0 port Buttons: Reset, Mesh Power: DC 12V 1A WiFi: MT7976CN UART: 115200n8 UART Layout: VCC-RX-TX-GND Installation: A. Through OpenWrt Dashboard: If your router comes with OpenWrt preinstalled (modified by the seller), you can easily upgrade by going to the dashboard (192.168.1.1) and then navigate to System -> Backup/Flash firmware, then flash the firmware B. Through TFTP Standard installation via UART: 1. Connect USB Serial Adapter to the UART, (NOTE: Don't connect the VCC pin). 2. Power on the router. Make sure that you can access your router via UART. 3. Restart the router then repeatedly press ctrl + c to skip default boot. 4. Type > bootmenu 5. Press '2' to select upgrade firmware 6. Press 'Y' on 'Run image after upgrading?' 7. Press '0' and hit 'enter' to select TFTP client (default) 8. Fill the U-Boot's IP address and TFTP server's IP address. 9. Finally, enter the 'firmware' filename. Based on patch adding support for similar Zbtlink ZBT-Z8103AX device by Ian Ishmael C. Oderon. Signed-off-by: Daniel Golle (cherry picked from commit c8c2f522625c8d9eb5acad317e3de7a6b156decf) --- .../uboot-envtools/files/mediatek_filogic | 3 +- .../dts/mt7981b-zbtlink-zbt-z8102ax.dts | 331 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/etc/board.d/03_gpio_switches | 19 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/filogic/config-5.15 | 2 + target/linux/mediatek/image/filogic.mk | 17 + 7 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax.dts create mode 100644 target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 5cd63a46e612f5..8c7c5a85c025cf 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -66,7 +66,8 @@ mercusys,mr90x-v1) ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" ;; cetron,ct3003|\ -netgear,wax220) +netgear,wax220|\ +zbtlink,zbt-z8102ax) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; ubnt,unifi-6-plus) diff --git a/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax.dts b/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax.dts new file mode 100644 index 00000000000000..112fd777f05b51 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax.dts @@ -0,0 +1,331 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "Zbtlink ZBT-Z8102AX"; + compatible = "zbtlink,zbt-z8102ax", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_green; + label-mac-device = &gmac0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 loglevel=8"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + button-mesh { + label = "mesh"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_HIGH>; + }; + + button-hub { + label = "hub"; + linux,code = ; + gpios = <&pio 12 GPIO_ACTIVE_HIGH>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: red { + label = "red:status"; + gpios = <&pio 9 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_status_green: green { + label = "green:status"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + blue { + label = "blue:status"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + 4g { + label = "blue:4g"; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_USB; + function-enumerator = <0>; + }; + + 4g2 { + label = "blue:4g2"; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_USB; + function-enumerator = <1>; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <1000>; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + pcie { + gpio-export,name = "pcie_power"; + gpio-export,output = <1>; + gpios = <&pio 3 GPIO_ACTIVE_HIGH>; + }; + + 5g1 { + gpio-export,name = "5g1"; + gpio-export,output = <1>; + gpios = <&pio 4 GPIO_ACTIVE_HIGH>; + }; + + 5g2 { + gpio-export,name = "5g2"; + gpio-export,output = <1>; + gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + }; + + sim1 { + gpio-export,name = "sim1"; + gpio-export,output = <1>; + gpios = <&pio 6 GPIO_ACTIVE_HIGH>; + }; + + sim2 { + gpio-export,name = "sim2"; + gpio-export,output = <1>; + gpios = <&pio 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + /* LAN */ + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 2>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + /* WAN */ + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 3>; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <0x1f>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bl2"; + reg = <0x0000000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + + partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = <8>; + bias-pull-up = <103>; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = <8>; + bias-pull-down = <103>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; +}; + +&wifi { + status = "okay"; + + nvmem-cells = <&eeprom_factory>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 0760d17a8e276e..522e288ef54e57 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -12,7 +12,8 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; asus,tuf-ax4200|\ - mediatek,mt7981-rfb) + mediatek,mt7981-rfb|\ + zbtlink,zbt-z8102ax) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; asus,tuf-ax6000) diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches b/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches new file mode 100644 index 00000000000000..ff32a3650cdbaa --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches @@ -0,0 +1,19 @@ +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +zbtlink,zbt-z8103ax) + ucidef_add_gpio_switch "5g1" "Power 1st modem" "5g1" "1" + ucidef_add_gpio_switch "5g2" "Power 2nd modem" "5g2" "1" + ucidef_add_gpio_switch "pcie" "Power PCIe port" "pcie" "1" + ucidef_add_gpio_switch "sim1" "SIM 1" "sim1" "1" + ucidef_add_gpio_switch "sim2" "SIM 2" "sim2" "1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index a9de563a4bf099..b33d43c8c0dd47 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -95,6 +95,7 @@ case "$board" in tplink,tl-xdr6088) [ "$PHYNBR" = "0" ] && get_mac_label > /sys${DEVPATH}/macaddress ;; + zbtlink,zbt-z8102ax|\ zyxel,ex5601-t0) addr=$(mtd_get_mac_binary "Factory" 0x4) [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index 2ffc466b7c3344..8c46b9ad2c5c60 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -169,6 +169,8 @@ CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GLOB=y CONFIG_GPIO_CDEV=y +CONFIG_GPIO_WATCHDOG=y +CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y CONFIG_GRO_CELLS=y CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDIRQS_SW_RESEND=y diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 0ad8b3e728dcc9..300a7da9fb2aa7 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -728,6 +728,23 @@ endif endef TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod +define Device/zbtlink_zbt-z8102ax + DEVICE_VENDOR := Zbtlink + DEVICE_MODEL := ZBT-Z8102AX + DEVICE_DTS := mt7981b-zbtlink-zbt-z8102ax + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb-net-qmi-wwan kmod-usb-serial-option + KERNEL_IN_UBI := 1 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += zbtlink_zbt-z8102ax + define Device/zyxel_ex5601-t0-stock DEVICE_VENDOR := Zyxel DEVICE_MODEL := EX5601-T0 (stock layout) From 81b7da1052481f9854700895aa903094d7fe4c0c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 10 Dec 2023 11:43:45 +0100 Subject: [PATCH 0659/1171] lua5.3: fix typo calling lua53 instead of lua5.3 for Package Default Fix typo calling lua53 instead of lua5.3 for Package Default definition. This cause only missing description of the package and doesn't cause any build regression. Fixes: c52ca08d4008 ("lua5.3: build shared library") Signed-off-by: Christian Marangi (cherry picked from commit 25e215c14ee6c9f3d54cd1da46a48d9ffe6b254e) --- package/utils/lua5.3/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/lua5.3/Makefile b/package/utils/lua5.3/Makefile index d43ac59ed4285c..0a295040f2337a 100644 --- a/package/utils/lua5.3/Makefile +++ b/package/utils/lua5.3/Makefile @@ -30,7 +30,7 @@ define Package/lua5.3/Default SUBMENU:=Lua SECTION:=lang CATEGORY:=Languages - TITLE:=Lua programming language + TITLE:=Lua programming language (version 5.3) URL:=https://www.lua.org/ MAINTAINER:=Jo-Philipp Wich endef @@ -42,7 +42,7 @@ define Package/lua5.3/Default/description endef define Package/liblua5.3 -$(call Package/lua53/Default) +$(call Package/lua5.3/Default) SUBMENU:= SECTION:=libs CATEGORY:=Libraries @@ -51,7 +51,7 @@ $(call Package/lua53/Default) endef define Package/liblua5.3/description -$(call Package/lua53/Default/description) +$(call Package/lua5.3/Default/description) This package contains the Lua shared libraries, needed by other programs. endef From efdafcc9748973cd181100eda37a9bb0f61d7728 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 25 Nov 2023 18:06:41 +0100 Subject: [PATCH 0660/1171] mediatek: filogic: Fix GPIOs for Zbtlink ZBT-Z8102AX The PGIO configuration should be added for the ZBT-Z8102AX and not the ZBT-Z8103AX Fixes: c8c2f522625c ("mediatek: add support for Zbtlink ZBT-Z8102AX") Signed-off-by: Hauke Mehrtens (cherry picked from commit d99aed31a0e54f68cb26d2dfe814f51a3df31cc4) --- .../mediatek/filogic/base-files/etc/board.d/03_gpio_switches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches b/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches index ff32a3650cdbaa..4cbec1ef078db3 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches @@ -5,7 +5,7 @@ board_config_update board=$(board_name) case "$board" in -zbtlink,zbt-z8103ax) +zbtlink,zbt-z8102ax) ucidef_add_gpio_switch "5g1" "Power 1st modem" "5g1" "1" ucidef_add_gpio_switch "5g2" "Power 2nd modem" "5g2" "1" ucidef_add_gpio_switch "pcie" "Power PCIe port" "pcie" "1" From af740e9ef95406b137c2fb4e40ae36504fa7a70a Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Sat, 26 Aug 2023 06:38:18 +0800 Subject: [PATCH 0661/1171] mediatek: fix the name of buswidth to bus-width Fix the issue of dts buswidth cannot be applied properly with spi driver. Fix the name of buswidth to bus-width in dts in order to fit the format in linux spi kernel[1] so that spi-tx-bus-width & spi-rx-bus-width can be parsed properly. [1] Documentation/devicetree/bindings/spi/spi-controller.yaml Signed-off-by: Chen Minqiang (cherry picked from commit 36746893ac690796bf7aad00a793ff4bf739d066) --- target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts | 4 ++-- target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts | 4 ++-- target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts | 4 ++-- target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts | 4 ++-- target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi | 4 ++-- target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts | 4 ++-- target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts | 4 ++-- target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi | 4 ++-- .../mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi | 4 ++-- target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts | 4 ++-- target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts | 4 ++-- target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts | 4 ++-- target/linux/mediatek/dts/mt7986b-netgear-wax220.dts | 4 ++-- .../arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso | 4 ++-- .../arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts | 4 ++-- .../arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts | 4 ++-- .../arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso | 4 ++-- .../arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso | 4 ++-- 18 files changed, 36 insertions(+), 36 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts index 7c8a94d97c8e76..7975d247b15f2e 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts @@ -138,8 +138,8 @@ reg = <0>; spi-max-frequency = <25000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts index 27e7797b3b24ca..f9b8c16652e5ad 100644 --- a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts +++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt3000.dts @@ -152,8 +152,8 @@ spi-cal-addrlen = <5>; spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; diff --git a/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts b/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts index 358365adba44bd..671e1f1839ab49 100644 --- a/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts @@ -104,8 +104,8 @@ reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts b/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts index 87076d255cfdac..d897697ef2331e 100644 --- a/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts +++ b/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts @@ -97,8 +97,8 @@ reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi index 9467b18a7e02ad..7ab94f36230c2a 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi @@ -148,8 +148,8 @@ reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions: partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts index a7626d51a491f8..c6dc1e5c4e6c33 100644 --- a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts @@ -108,8 +108,8 @@ spi-cal-addrlen = <5>; spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts index 239be9645f38ff..ac854f10d13ae5 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts @@ -211,8 +211,8 @@ reg = <0>; spi-max-frequency = <20000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions: partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi index 94edfd121e42cf..a1910e36d24b6c 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi @@ -164,8 +164,8 @@ reg = <0>; spi-max-frequency = <20000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi index 13f37cd7630b8d..a9b44f8df99f4c 100644 --- a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi +++ b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi @@ -138,8 +138,8 @@ reg = <0>; spi-max-frequency = <20000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions: partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts index bc9f6688b39361..2469d3d77d1f12 100644 --- a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts @@ -445,8 +445,8 @@ compatible = "spi-nand"; reg = <1>; spi-max-frequency = <10000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts index b6bd746ef30b60..a486f29fec8fe3 100644 --- a/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts @@ -316,8 +316,8 @@ mediatek,bmt-max-reserved-blocks = <64>; spi-max-frequency = <20000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts index 4e8cd7cf115738..89ec613a8d9c3f 100644 --- a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts @@ -212,8 +212,8 @@ reg = <0>; spi-max-frequency = <20000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions: partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts index 09fdf677869e77..19419f593fb273 100644 --- a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts +++ b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts @@ -178,8 +178,8 @@ reg = <0>; spi-max-frequency = <20000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso index 15ee8c568f3c3f..0846d88f625aa5 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso @@ -19,8 +19,8 @@ compatible = "spi-nand"; reg = <0>; spi-max-frequency = <10000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts index 83a37150cf07ed..ce007099d2ba32 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nand.dts @@ -15,8 +15,8 @@ compatible = "spi-nand"; reg = <1>; spi-max-frequency = <10000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts index 868365a99429a7..ea148315f05534 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb-spim-nor.dts @@ -15,8 +15,8 @@ compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso index 61801651778516..86b0042f647768 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso @@ -19,8 +19,8 @@ compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso index e63436fa556de8..a9eca00d4416cb 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso @@ -21,8 +21,8 @@ compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; From b95e9dae43dfc7b6d3c1b4a031a23643a96246f6 Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Wed, 22 Nov 2023 19:38:06 +0200 Subject: [PATCH 0662/1171] mediatek: fiilogic: device tree `switch@1f` fix Quite a few `fiilogic` devices use the `mt7531` switch. Some of them have a DT node that looks like: ``` switch: switch@0 { compatible = "mediatek,mt7531"; reg = <31>; ... }; ``` This commit changes the DT node name to `switch@1f`. Signed-off-by: Rani Hod (cherry picked from commit aaeb379023daf9720303884f61748fe362b0a237) --- target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts | 2 +- target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts | 2 +- target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts | 2 +- target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts | 2 +- target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts | 2 +- target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts | 2 +- target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi | 2 +- target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts | 2 +- target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts | 4 ++-- target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts | 4 ++-- target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts | 2 +- target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi | 2 +- .../mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi | 2 +- target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts | 2 +- target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts | 2 +- .../arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 2 +- .../files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi | 2 +- .../files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts index d39083ffb0d614..ae4404466e8e64 100644 --- a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts +++ b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts @@ -77,7 +77,7 @@ }; &mdio_bus { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts index e9c850e85b0172..3f330f40fae43e 100644 --- a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts +++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts @@ -90,7 +90,7 @@ }; &mdio_bus { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts index 7975d247b15f2e..56e90b172289c2 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts @@ -112,7 +112,7 @@ }; &mdio_bus { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts b/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts index 671e1f1839ab49..de702d4a534c6f 100644 --- a/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts @@ -81,7 +81,7 @@ }; &mdio_bus { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts b/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts index adb86d9ebd06ff..d85c6e46510b2f 100644 --- a/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts @@ -72,7 +72,7 @@ }; &mdio_bus { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts b/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts index d897697ef2331e..cd6f6b30c3efed 100644 --- a/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts +++ b/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts @@ -74,7 +74,7 @@ }; &mdio_bus { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi index 7ab94f36230c2a..d09ae2a3e78111 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi @@ -86,7 +86,7 @@ }; &mdio_bus { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts index 35a2c30bb45476..6bff786558be9e 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts @@ -229,7 +229,7 @@ mxl,led-config = <0x0 0x0 0x370 0x80>; }; - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts index ac854f10d13ae5..2af18958bc517f 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts @@ -136,7 +136,7 @@ mxl,led-config = <0x03f0 0x0 0x0 0x0>; }; - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; @@ -361,4 +361,4 @@ &usb_phy { status = "okay"; -}; \ No newline at end of file +}; diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts index 2e9114f99c013e..41e6d2471d09f6 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts @@ -142,7 +142,7 @@ mxl,led-config = <0x03f0 0x0 0x0 0x0>; }; - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; @@ -379,4 +379,4 @@ &usb_phy { status = "okay"; -}; \ No newline at end of file +}; diff --git a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts index 2be1907f632f12..fded507039b269 100644 --- a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts +++ b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts @@ -122,7 +122,7 @@ realtek,aldps-enable; }; - switch: switch@31 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 18 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi index a1910e36d24b6c..ddf332a0dcc008 100644 --- a/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi +++ b/target/linux/mediatek/dts/mt7986a-tplink-tl-xdr-common.dtsi @@ -141,7 +141,7 @@ realtek,aldps-enable; }; - switch: switch@31 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi index a9b44f8df99f4c..b2711eb7d7ddab 100644 --- a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi +++ b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi @@ -72,7 +72,7 @@ }; &mdio { - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts index 2469d3d77d1f12..331150d85db6a4 100644 --- a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts @@ -199,7 +199,7 @@ reg = <6>; }; - switch@0 { + switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts index 89ec613a8d9c3f..42250be19ac845 100644 --- a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts @@ -120,7 +120,7 @@ reg = <6>; }; - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts index 1d3c575b7d4c42..d326c416a9d3ae 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts @@ -200,7 +200,7 @@ }; &mdio { - switch: switch@31 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; interrupt-controller; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi index 1ab56e37f741cd..26d560bd4bcb11 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi @@ -99,7 +99,7 @@ reg = <6>; }; - switch: switch@0 { + switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 5 0>; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts index 83d51916717fb9..8cd094f7c3eeb1 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts @@ -108,7 +108,7 @@ phy-mode = "2500base-x"; }; - switch@0 { + switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 5 0>; From 583e67222ec664abede83bbda667185afe2ce1ec Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Mon, 6 Nov 2023 23:06:05 +0800 Subject: [PATCH 0663/1171] mediatek: filogic: reorder alphabetically Reorder scripts and image recipes to keep alphabetical order. Signed-off-by: Chukun Pan (cherry picked from commit 07482d15af5dd79fc38dd0eb23319934fe4d7a7a) --- .../filogic/base-files/etc/board.d/02_network | 36 +++++----- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 10 +-- .../base-files/lib/upgrade/platform.sh | 18 ++--- target/linux/mediatek/image/filogic.mk | 66 +++++++++---------- 4 files changed, 64 insertions(+), 66 deletions(-) diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 522e288ef54e57..857cc4b77ee310 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -19,24 +19,27 @@ mediatek_setup_interfaces() asus,tuf-ax6000) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 ;; - netgear,wax220|\ - ubnt,unifi-6-plus|\ - zyxel,nwa50ax-pro) - ucidef_set_interface_lan "eth0" - ;; bananapi,bpi-r3) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan" ;; - cudy,wr3000-v1) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" - ;; - glinet,gl-mt3000) - ucidef_set_interfaces_lan_wan eth1 eth0 + cetron,ct3003|\ + cudy,wr3000-v1|\ + jcg,q30-pro|\ + qihoo,360t7) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; cmcc,rax3000m|\ h3c,magic-nx30-pro) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 ;; + glinet,gl-mt3000) + ucidef_set_interfaces_lan_wan eth1 eth0 + ;; + glinet,gl-mt6000|\ + tplink,tl-xdr4288|\ + tplink,tl-xdr6088) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 + ;; mediatek,mt7986a-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan6" "eth1 wan" ;; @@ -49,15 +52,10 @@ mediatek_setup_interfaces() mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; - cetron,ct3003|\ - jcg,q30-pro|\ - qihoo,360t7) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan - ;; - glinet,gl-mt6000|\ - tplink,tl-xdr4288|\ - tplink,tl-xdr6088) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 + netgear,wax220|\ + ubnt,unifi-6-plus|\ + zyxel,nwa50ax-pro) + ucidef_set_interface_lan "eth0" ;; tplink,tl-xdr6086) ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index b33d43c8c0dd47..b2b4f377a645af 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -80,11 +80,6 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress ;; - ubnt,unifi-6-plus) - addr=$(mtd_get_mac_binary EEPROM 0x6) - [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress - ;; qihoo,360t7) addr=$(mtd_get_mac_ascii factory lanMac) [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress @@ -95,6 +90,11 @@ case "$board" in tplink,tl-xdr6088) [ "$PHYNBR" = "0" ] && get_mac_label > /sys${DEVPATH}/macaddress ;; + ubnt,unifi-6-plus) + addr=$(mtd_get_mac_binary EEPROM 0x6) + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; zbtlink,zbt-z8102ax|\ zyxel,ex5601-t0) addr=$(mtd_get_mac_binary "Factory" 0x4) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index bfe5ed830bdf0e..e2683c8d554c70 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -102,15 +102,6 @@ platform_do_upgrade() { CI_ROOTPART="rootfs" emmc_do_upgrade "$1" ;; - mercusys,mr90x-v1) - CI_UBIPART="ubi0" - nand_do_upgrade "$1" - ;; - ubnt,unifi-6-plus) - CI_KERNPART="kernel0" - EMMC_ROOT_DEV="$(cmdline_get_var root)" - emmc_do_upgrade "$1" - ;; h3c,magic-nx30-pro|\ jcg,q30-pro|\ mediatek,mt7981-rfb|\ @@ -124,6 +115,15 @@ platform_do_upgrade() { CI_KERNPART="fit" nand_do_upgrade "$1" ;; + mercusys,mr90x-v1) + CI_UBIPART="ubi0" + nand_do_upgrade "$1" + ;; + ubnt,unifi-6-plus) + CI_KERNPART="kernel0" + EMMC_ROOT_DEV="$(cmdline_get_var root)" + emmc_do_upgrade "$1" + ;; xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) CI_KERN_UBIPART=ubi_kernel diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 300a7da9fb2aa7..01e4f94f667d9d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -105,6 +105,21 @@ define Build/cetron-header rm $@.tmp endef +define Device/acer_predator-w6 + DEVICE_VENDOR := Acer + DEVICE_MODEL := Predator W6 + DEVICE_DTS := mt7986a-acer-predator-w6 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware kmod-mt7916-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs + IMAGES := sysupgrade.bin + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += acer_predator-w6 + define Device/asus_tuf-ax4200 DEVICE_VENDOR := ASUS DEVICE_MODEL := TUF-AX4200 @@ -137,21 +152,6 @@ define Device/asus_tuf-ax6000 endef TARGET_DEVICES += asus_tuf-ax6000 -define Device/acer_predator-w6 - DEVICE_VENDOR := Acer - DEVICE_MODEL := Predator W6 - DEVICE_DTS := mt7986a-acer-predator-w6 - DEVICE_DTS_DIR := ../dts - DEVICE_DTS_LOADADDR := 0x47000000 - DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware kmod-mt7916-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs - IMAGES := sysupgrade.bin - KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata -endef -TARGET_DEVICES += acer_predator-w6 - define Device/bananapi_bpi-r3 DEVICE_VENDOR := Bananapi DEVICE_MODEL := BPi-R3 @@ -354,24 +354,6 @@ define Device/jcg_q30-pro endef TARGET_DEVICES += jcg_q30-pro -define Device/netgear_wax220 - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := WAX220 - DEVICE_DTS := mt7986b-netgear-wax220 - DEVICE_DTS_DIR := ../dts - NETGEAR_ENC_MODEL := WAX220 - NETGEAR_ENC_REGION := US - DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - IMAGE_SIZE := 32768k - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - IMAGES += factory.img - # Padding to 10M seems to be required by OEM web interface - IMAGE/factory.img := sysupgrade-tar | \ - pad-to 10M | check-size | netgear-encrypted-factory -endef -TARGET_DEVICES += netgear_wax220 - define Device/mediatek_mt7981-rfb DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7981 rfb @@ -543,6 +525,24 @@ define Device/mercusys_mr90x-v1 endef TARGET_DEVICES += mercusys_mr90x-v1 +define Device/netgear_wax220 + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := WAX220 + DEVICE_DTS := mt7986b-netgear-wax220 + DEVICE_DTS_DIR := ../dts + NETGEAR_ENC_MODEL := WAX220 + NETGEAR_ENC_REGION := US + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + IMAGE_SIZE := 32768k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGES += factory.img + # Padding to 10M seems to be required by OEM web interface + IMAGE/factory.img := sysupgrade-tar | \ + pad-to 10M | check-size | netgear-encrypted-factory +endef +TARGET_DEVICES += netgear_wax220 + define Device/qihoo_360t7 DEVICE_VENDOR := Qihoo DEVICE_MODEL := 360T7 From 0186032f6a273db6c3f00b7635b9aeb619e53a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 20 Nov 2023 11:46:26 +0100 Subject: [PATCH 0664/1171] mediatek: filogic: add Acelink EW-7886CAX support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acelink EW-7886CAX is an MT7986A (AKA Filogic 830) based access point. It has 512 MiB of RAM, one 2.5 Gbps PoE (802.3at) Ethernet port and on-SoC Wi-Fi. There is no printed MAC label (on my unit). My unit came with Mediatek's firmware (based on OpenWrt 21.02) installed. It was possible to simply upgrade using OpenWrt's sysupgrade tool. Another verified upgrade method is using U-Boot (requires UART). During every boot there is "U-Boot Boot Menu". Selecting option "2. Upgrade firmware" allows using U-Boot's tftp client to load and flash factory image. Signed-off-by: Rafał Miłecki (cherry picked from commit 07765f28b7911ca8207b6e7ec94508a5740c4697) --- .../dts/mt7986a-acelink-ew-7886cax.dts | 238 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 + target/linux/mediatek/image/filogic.mk | 17 ++ 3 files changed, 258 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts diff --git a/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts b/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts new file mode 100644 index 00000000000000..1bf5d7317e8471 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts @@ -0,0 +1,238 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + compatible = "acelink,ew-7886cax", "mediatek,mt7986a"; + model = "Acelink EW-7886CAX"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_blue; + led-running = &led_status_green; + led-upgrade = &led_status_red; + led-failsafe = &led_status_red; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x20000000>; + device_type = "memory"; + }; + + keys { + compatible = "gpio-keys"; + + key-restart { + label = "Reset"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 18 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: led-1 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: led-2 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + nvmem-cells = <&macaddr>; + nvmem-cell-names = "mac-address"; + }; + + mdio-bus { + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <50000>; + reset-post-delay-us = <20000>; + #address-cells = <1>; + #size-cells = <0>; + + /* Maxlinear GPY211C */ + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + }; + }; +}; + +&pcie_phy { + status = "okay"; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <52000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x100000>; + label = "bootloader"; + read-only; + }; + + partition@100000 { + reg = <0x100000 0x80000>; + label = "u-boot-env"; + }; + + partition@180000 { + compatible = "nvmem-cells"; + reg = <0x180000 0x200000>; + label = "factory"; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + }; + + partition@380000 { + reg = <0x380000 0x200000>; + label = "fip"; + }; + + partition@580000 { + reg = <0x580000 0x4000000>; + label = "ubi"; + }; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; + nvmem-cells = <&eeprom>; + nvmem-cell-names = "eeprom"; + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 857cc4b77ee310..901013aa5990a4 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -8,6 +8,9 @@ mediatek_setup_interfaces() local board="$1" case $board in + acelink,ew-7886cax) + ucidef_set_interface_lan "eth0" "dhcp" + ;; acer,predator-w6) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 01e4f94f667d9d..7249a2e2361e3d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -105,6 +105,23 @@ define Build/cetron-header rm $@.tmp endef +define Device/acelink_ew-7886cax + DEVICE_VENDOR := Acelink + DEVICE_MODEL := EW-7886CAX + DEVICE_DTS := mt7986a-acelink-ew-7886cax + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += acelink_ew-7886cax + define Device/acer_predator-w6 DEVICE_VENDOR := Acer DEVICE_MODEL := Predator W6 From fcf08d9db6a50a3ca6f0b64d105d975ab896cc35 Mon Sep 17 00:00:00 2001 From: Dirk Buchwalder Date: Fri, 24 Nov 2023 15:56:39 +0100 Subject: [PATCH 0665/1171] ipq807x: fix edgecore EAP102 lan/wan We have a report in the forum, that lan/wan is non-functional on the EAP102 (https://forum.openwrt.org/t/edgecore-eap102/178449) Fixing that by swapping label and phy-handle of the dp-nodes and updating the lan/wan bmp. Note: the original commiter of the device support seems absent for a long time in the forum and on the OpenWrt github group. Tested-by: Antonio Della Selva Signed-off-by: Dirk Buchwalder Reviewed-by: Robert Marko (cherry picked from commit 9b598ec8d5585ca81cd472ca1d1b4f93d18dc3d5) [ fix conflicts errors ] Signed-off-by: Christian Marangi --- .../arch/arm64/boot/dts/qcom/ipq8071-eap102.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts index 357b6368d9dc55..32ed6bd5afafdb 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts @@ -21,8 +21,8 @@ led-running = &led_system_green; led-upgrade = &led_system_green; /* Aliases as required by u-boot to patch MAC addresses */ - ethernet0 = &dp5; - ethernet1 = &dp6; + ethernet0 = &dp6; + ethernet1 = &dp5; label-mac-device = &dp5; }; @@ -372,14 +372,14 @@ &dp5 { status = "okay"; - phy-handle = <&qca8081_28>; - label = "wan"; + phy-handle = <&qca8081_24>; + label = "lan"; }; &dp6 { status = "okay"; - phy-handle = <&qca8081_24>; - label = "lan"; + phy-handle = <&qca8081_28>; + label = "wan"; }; &wifi { From ad363f691078c0825334d3dc9a2a75354fa51891 Mon Sep 17 00:00:00 2001 From: "Eric J. Anderson" Date: Mon, 4 Dec 2023 22:41:47 +0100 Subject: [PATCH 0666/1171] ath79: make boot-leds service executable This service was unfunctional due to not having its executable bit set. Fixes #13500. Signed-off-by: Eric J. Anderson (cherry picked from commit 807acbce66c34596ac80cad8ea2a3f170f58429c) --- target/linux/ath79/nand/base-files/etc/init.d/boot-leds | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 target/linux/ath79/nand/base-files/etc/init.d/boot-leds diff --git a/target/linux/ath79/nand/base-files/etc/init.d/boot-leds b/target/linux/ath79/nand/base-files/etc/init.d/boot-leds old mode 100644 new mode 100755 From 20615c410b1b57d23841266de739a2120118c806 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Fri, 8 Dec 2023 09:32:41 +0100 Subject: [PATCH 0667/1171] kirkwood: fix Ctera C200 V1 ubi part name In 749237967a12 downstream dts was replaced with upstream accepted patch. But in upstream version last partition was called "rootfs" instead "ubi". OpenWrt require "ubi" label for ubi rootfs. This patch restore proper label. Fixes: 749237967a12 ("kirkwood: Replace dtses with upstream accepted") Signed-off-by: Pawel Dembicki (cherry picked from commit 9075cfd609e905bc7162574a24a7fb457e65a374) --- .../linux/kirkwood/patches-5.15/114-ctera-c-200-v1.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/kirkwood/patches-5.15/114-ctera-c-200-v1.patch b/target/linux/kirkwood/patches-5.15/114-ctera-c-200-v1.patch index 23922b8d883b56..aed79d5dd5709d 100644 --- a/target/linux/kirkwood/patches-5.15/114-ctera-c-200-v1.patch +++ b/target/linux/kirkwood/patches-5.15/114-ctera-c-200-v1.patch @@ -49,3 +49,12 @@ function = LED_FUNCTION_STATUS; color = ; gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; +@@ -240,7 +252,7 @@ + }; + + partition@7a00000 { +- label = "rootfs"; ++ label = "ubi"; + reg = <0x7a00000 0x8600000>; + }; + }; From c9c35dca7add799a432d95d99821b2cb12430540 Mon Sep 17 00:00:00 2001 From: Daniel Danzberger Date: Fri, 13 Oct 2023 13:50:49 +0200 Subject: [PATCH 0668/1171] mt76: Add firmware package for MT7922 Adds the 2 required firmware files for MT7922 chips. Signed-off-by: Daniel Danzberger (cherry picked from commit 9eecf4905375777e2048177dbe4d83fee5da9ee1) Signed-off-by: Anya Lin --- package/kernel/mt76/Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 42075daecd52e2..c31631e6e5dfc2 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -262,6 +262,11 @@ define KernelPackage/mt7921-firmware TITLE:=MediaTek MT7921 firmware endef +define KernelPackage/mt7922-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7922 firmware +endef + define KernelPackage/mt792x-common $(KernelPackage/mt76-default) TITLE:=MediaTek MT792x wireless driver common code @@ -553,6 +558,14 @@ define KernelPackage/mt7921-firmware/install $(1)/lib/firmware/mediatek endef +define KernelPackage/mt7922-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin \ + $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7922_1.bin \ + $(1)/lib/firmware/mediatek +endef + define Package/mt76-test/install mkdir -p $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin @@ -586,6 +599,7 @@ $(eval $(call KernelPackage,mt7916-firmware)) $(eval $(call KernelPackage,mt7981-firmware)) $(eval $(call KernelPackage,mt7986-firmware)) $(eval $(call KernelPackage,mt7921-firmware)) +$(eval $(call KernelPackage,mt7922-firmware)) $(eval $(call KernelPackage,mt792x-common)) $(eval $(call KernelPackage,mt792x-usb)) $(eval $(call KernelPackage,mt7921-common)) From 9cf576963682c98a0183b2fd2408599bb6f69a36 Mon Sep 17 00:00:00 2001 From: Michael Trinidad Date: Tue, 21 Nov 2023 21:46:27 -0500 Subject: [PATCH 0669/1171] mwlwifi: update to version 10.4.10-20231120 Upstream PR 416 improvements: -AMPDU Optimization of priority calculation. (8864/8897) -8864/8897 fix wpa3 -Add cypher suite to driver capabilities (all chip) -Alignment of pcie_tx_ctrl* (all chip) -"feature" normalization for all chips (all chip) -Add modprobe parameters (all chip) -fix monitoring (all chip) -Code separation by chipset (8864/8897 <=> 8997) -dump_prob decommissioning (8864/8897/8997) -fix amsdu high ping latency (8864/8897/8997) -drop debug info in hostcmd_get_hw_spec() (8864/8897) -Add wcb_base in debug info (8864) -Rewrite AMSDU packets (8864/8897/8997) -debug rewrite output mwl_debugfs_sta_read (all chip) -Improved encryption interoperability (8864/8897/8997) -factorization encrypted packet test (8864/8897/8997) -Change 88W8864 firmware to 7.2.9.27 (8864/8897) -Fix the AMPDU session lifecycle (8864/8897/8997) -Remove the tx done packets mechanism (8864/8897) Signed-off-by: Michael Trinidad --- package/kernel/mwlwifi/Makefile | 6 +- ...mpilation-warning-with-64-bit-system.patch | 39 +- ...CIe-DT-node-null-pointer-dereference.patch | 2 +- .../mwlwifi/patches/005-mac80211_update.patch | 201 +++++----- ...nd-get_fs-calls-from-PCIe-for-Kenel-.patch | 51 +++ ...-the-deprecated-pci-dma-compat.h-API.patch | 352 ++++++++++++++++++ 6 files changed, 525 insertions(+), 126 deletions(-) create mode 100644 package/kernel/mwlwifi/patches/006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch create mode 100644 package/kernel/mwlwifi/patches/007-replace-usage-of-the-deprecated-pci-dma-compat.h-API.patch diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 130ed01fdc21ee..9244f656c8f027 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -15,9 +15,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-04-29 -PKG_SOURCE_VERSION:=6a436714d2ea0d0adf39fc4d7d45e6a17fcc9371 -PKG_MIRROR_HASH:=dcc320a8f859b732ff65c7ded0b5199a625bfba05a775a6bed15ed3c10cb2748 +PKG_SOURCE_DATE:=2023-11-20 +PKG_SOURCE_VERSION:=2a5a4ae31a2ad1b432a1dcb6ef6c3298e3330b2c +PKG_MIRROR_HASH:=b1151051ed6eba063c05916d8dbc4f03f804772d217e8c65b7baa263ded7a961 PKG_MAINTAINER:=Imre Kaloz PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch b/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch index 8e71918cf3f828..80e708a5e18ae6 100644 --- a/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch +++ b/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch @@ -117,11 +117,9 @@ Signed-off-by: Christian Marangi hif/pcie/tx_ndp.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) -diff --git a/debugfs.c b/debugfs.c -index 39b09fd..42efd28 100644 --- a/debugfs.c +++ b/debugfs.c -@@ -1332,7 +1332,7 @@ done: +@@ -1342,7 +1342,7 @@ done: priv->reg_value); else len += scnprintf(p + len, size - len, @@ -130,11 +128,9 @@ index 39b09fd..42efd28 100644 ret, priv->reg_type, priv->reg_offset, priv->reg_value); -diff --git a/hif/fwcmd.c b/hif/fwcmd.c -index 376b58f..582c8d2 100644 --- a/hif/fwcmd.c +++ b/hif/fwcmd.c -@@ -3604,7 +3604,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ieee80211_hw *hw, +@@ -3623,7 +3623,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ie core_dump->size_kb = pcmd->cmd_data.coredump.size_kb; core_dump->flags = pcmd->cmd_data.coredump.flags; memcpy(buff, @@ -143,11 +139,20 @@ index 376b58f..582c8d2 100644 sizeof(struct hostcmd_cmd_get_fw_core_dump) - sizeof(struct hostcmd_cmd_get_fw_core_dump_)), MAX_CORE_DUMP_BUFFER); -diff --git a/hif/pcie/pcie.c b/hif/pcie/pcie.c -index 24453b6..5b6c633 100644 +--- a/hif/pcie/8964/tx_ndp.c ++++ b/hif/pcie/8964/tx_ndp.c +@@ -336,7 +336,7 @@ int pcie_tx_init_ndp(struct ieee80211_hw + + if (sizeof(struct pcie_tx_ctrl_ndp) > + sizeof(tx_info->driver_data)) { +- wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n", ++ wiphy_err(hw->wiphy, "driver data is not enough: %zu (%zu)\n", + sizeof(struct pcie_tx_ctrl_ndp), + sizeof(tx_info->driver_data)); + return -ENOMEM; --- a/hif/pcie/pcie.c +++ b/hif/pcie/pcie.c -@@ -1320,8 +1320,8 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv, +@@ -1464,8 +1464,8 @@ static void pcie_bf_mimo_ctrl_decode(str &fp_data->f_pos); filp_close(fp_data, current->files); } else { @@ -158,19 +163,3 @@ index 24453b6..5b6c633 100644 } #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) -diff --git a/hif/pcie/tx_ndp.c b/hif/pcie/tx_ndp.c -index 6758cde..3140a2e 100644 ---- a/hif/pcie/tx_ndp.c -+++ b/hif/pcie/tx_ndp.c -@@ -335,7 +335,7 @@ int pcie_tx_init_ndp(struct ieee80211_hw *hw) - - if (sizeof(struct pcie_tx_ctrl_ndp) > - sizeof(tx_info->status.status_driver_data)) { -- wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n", -+ wiphy_err(hw->wiphy, "driver data is not enough: %zu (%zu)\n", - sizeof(struct pcie_tx_ctrl_ndp), - sizeof(tx_info->status.status_driver_data)); - return -ENOMEM; --- -2.39.2 - diff --git a/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch b/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch index 3d9ec4dcfb3ac2..f37d2f8171a8df 100644 --- a/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch +++ b/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch @@ -19,7 +19,7 @@ Signed-off-by: Robert Marko --- a/hif/pcie/pcie.c +++ b/hif/pcie/pcie.c -@@ -573,7 +573,8 @@ static struct device_node *pcie_get_devi +@@ -685,7 +685,8 @@ static struct device_node *pcie_get_devi struct device_node *dev_node; dev_node = pci_bus_to_OF_node(pcie_priv->pdev->bus); diff --git a/package/kernel/mwlwifi/patches/005-mac80211_update.patch b/package/kernel/mwlwifi/patches/005-mac80211_update.patch index c11cf8c9469d43..92a8f2f70fd9c1 100644 --- a/package/kernel/mwlwifi/patches/005-mac80211_update.patch +++ b/package/kernel/mwlwifi/patches/005-mac80211_update.patch @@ -1,6 +1,6 @@ --- a/core.c +++ b/core.c -@@ -706,7 +706,7 @@ static void mwl_chnl_switch_event(struct +@@ -718,7 +718,7 @@ static void mwl_chnl_switch_event(struct vif = container_of((void *)mwl_vif, struct ieee80211_vif, drv_priv); @@ -11,7 +11,7 @@ spin_unlock_bh(&priv->vif_lock); --- a/debugfs.c +++ b/debugfs.c -@@ -455,9 +455,9 @@ static ssize_t mwl_debugfs_vif_read(stru +@@ -498,9 +498,9 @@ static ssize_t mwl_debugfs_vif_read(stru switch (vif->type) { case NL80211_IFTYPE_AP: len += scnprintf(p + len, size - len, "type: ap\n"); @@ -24,7 +24,7 @@ len += scnprintf(p + len, size - len, "ssid: %s\n", ssid); len += scnprintf(p + len, size - len, -@@ -479,8 +479,8 @@ static ssize_t mwl_debugfs_vif_read(stru +@@ -522,8 +522,8 @@ static ssize_t mwl_debugfs_vif_read(stru "type: unknown\n"); break; } @@ -35,62 +35,58 @@ len += scnprintf(p + len, size - len, "channel: %d: width: %d\n", chan_def->chan->hw_value, -@@ -564,28 +564,28 @@ static ssize_t mwl_debugfs_sta_read(stru - "amsdu cap: 0x%02x\n", - sta_info->amsdu_ctrl.cap); - } -- if (sta->ht_cap.ht_supported) { -+ if (sta->deflink.ht_cap.ht_supported) { - len += scnprintf(p + len, size - len, - "ht_cap: 0x%04x, ampdu: %02x, %02x\n", -- sta->ht_cap.cap, -- sta->ht_cap.ampdu_factor, -- sta->ht_cap.ampdu_density); -+ sta->deflink.ht_cap.cap, -+ sta->deflink.ht_cap.ampdu_factor, -+ sta->deflink.ht_cap.ampdu_density); - len += scnprintf(p + len, size - len, - "rx_mask: 0x%02x, %02x, %02x, %02x\n", -- sta->ht_cap.mcs.rx_mask[0], -- sta->ht_cap.mcs.rx_mask[1], -- sta->ht_cap.mcs.rx_mask[2], -- sta->ht_cap.mcs.rx_mask[3]); -+ sta->deflink.ht_cap.mcs.rx_mask[0], -+ sta->deflink.ht_cap.mcs.rx_mask[1], -+ sta->deflink.ht_cap.mcs.rx_mask[2], -+ sta->deflink.ht_cap.mcs.rx_mask[3]); - } -- if (sta->vht_cap.vht_supported) { -+ if (sta->deflink.vht_cap.vht_supported) { - len += scnprintf(p + len, size - len, - "vht_cap: 0x%08x, mcs: %02x, %02x\n", -- sta->vht_cap.cap, -- sta->vht_cap.vht_mcs.rx_mcs_map, -- sta->vht_cap.vht_mcs.tx_mcs_map); -+ sta->deflink.vht_cap.cap, -+ sta->deflink.vht_cap.vht_mcs.rx_mcs_map, -+ sta->deflink.vht_cap.vht_mcs.tx_mcs_map); - } - len += scnprintf(p + len, size - len, "rx_bw: %d, rx_nss: %d\n", -- sta->bandwidth, sta->rx_nss); -+ sta->deflink.bandwidth, sta->deflink.rx_nss); - len += scnprintf(p + len, size - len, - "tdls: %d, tdls_init: %d\n", - sta->tdls, sta->tdls_initiator); +@@ -596,18 +596,18 @@ static ssize_t mwl_debugfs_sta_read(stru + sta_info->wds ? "true" : "false", + sta_info->ba_hist.enable ? "enable" : "disable", + sta_info->is_amsdu_allowed ? sta_info->amsdu_ctrl.cap : 0 , +- sta->ht_cap.ht_supported ? sta->ht_cap.cap : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.ampdu_factor : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.ampdu_density : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[0] : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[1] : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[2] : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[3] : 0, +- sta->vht_cap.vht_supported ? sta->vht_cap.cap : 0, +- sta->vht_cap.vht_supported ? sta->vht_cap.vht_mcs.rx_mcs_map : 0, +- sta->vht_cap.vht_supported ? sta->vht_cap.vht_mcs.tx_mcs_map : 0, +- sta->bandwidth, +- sta->rx_nss, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.cap : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.ampdu_factor : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.ampdu_density : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[0] : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[1] : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[2] : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[3] : 0, ++ sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.cap : 0, ++ sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.vht_mcs.rx_mcs_map : 0, ++ sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.vht_mcs.tx_mcs_map : 0, ++ sta->deflink.bandwidth, ++ sta->deflink.rx_nss, + sta->tdls, + sta->tdls_initiator, + sta->wme, --- a/hif/fwcmd.c +++ b/hif/fwcmd.c -@@ -634,8 +634,9 @@ einval: +@@ -633,11 +633,15 @@ einval: + } static int mwl_fwcmd_set_ap_beacon(struct mwl_priv *priv, - struct mwl_vif *mwl_vif, +- struct mwl_vif *mwl_vif, - struct ieee80211_bss_conf *bss_conf) + struct ieee80211_vif *vif) { -+ struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; struct hostcmd_cmd_ap_beacon *pcmd; struct ds_params *phy_ds_param_set; ++ struct mwl_vif *mwl_vif; ++ struct ieee80211_bss_conf *bss_conf; ++ ++ mwl_vif = mwl_dev_get_vif(vif); ++ bss_conf = &vif->bss_conf; -@@ -664,7 +665,7 @@ static int mwl_fwcmd_set_ap_beacon(struc + /* wmm structure of start command is defined less one byte, + * due to following field country is not used, add byte one +@@ -664,7 +668,7 @@ static int mwl_fwcmd_set_ap_beacon(struc pcmd->cmd_hdr.macid = mwl_vif->macid; ether_addr_copy(pcmd->start_cmd.sta_mac_addr, mwl_vif->bssid); @@ -99,16 +95,16 @@ if (priv->chip_type == MWL8997) ether_addr_copy(pcmd->start_cmd.bssid, mwl_vif->bssid); pcmd->start_cmd.bss_type = 1; -@@ -2091,7 +2092,7 @@ int mwl_fwcmd_set_beacon(struct ieee8021 +@@ -2090,7 +2094,7 @@ int mwl_fwcmd_set_beacon(struct ieee8021 if (mwl_fwcmd_set_wsc_ie(hw, b_inf->ie_wsc_len, b_inf->ie_wsc_ptr)) goto err; - if (mwl_fwcmd_set_ap_beacon(priv, mwl_vif, &vif->bss_conf)) -+ if (mwl_fwcmd_set_ap_beacon(priv, mwl_vif, vif)) ++ if (mwl_fwcmd_set_ap_beacon(priv, vif)) goto err; if (b_inf->cap_info & WLAN_CAPABILITY_SPECTRUM_MGMT) -@@ -2153,38 +2154,38 @@ int mwl_fwcmd_set_new_stn_add(struct iee +@@ -2152,38 +2156,38 @@ int mwl_fwcmd_set_new_stn_add(struct iee ether_addr_copy(pcmd->mac_addr, sta->addr); if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) @@ -161,7 +157,7 @@ } pcmd->is_qos_sta = sta->wme; -@@ -2240,38 +2241,38 @@ int mwl_fwcmd_set_new_stn_add_sc4(struct +@@ -2239,38 +2243,38 @@ int mwl_fwcmd_set_new_stn_add_sc4(struct ether_addr_copy(pcmd->mac_addr, sta->addr); if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) @@ -214,7 +210,7 @@ } pcmd->is_qos_sta = sta->wme; -@@ -2788,9 +2789,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 +@@ -2787,9 +2791,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 pcmd->ba_info.create_params.flags = cpu_to_le32(ba_flags); pcmd->ba_info.create_params.queue_id = stream->idx; pcmd->ba_info.create_params.param_info = @@ -226,7 +222,7 @@ IEEE80211_HT_AMPDU_PARM_DENSITY); if (direction == BA_FLAG_DIRECTION_UP) { pcmd->ba_info.create_params.reset_seq_no = 0; -@@ -2800,9 +2801,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 +@@ -2799,9 +2803,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 pcmd->ba_info.create_params.current_seq = cpu_to_le16(0); } if (priv->chip_type == MWL8964 && @@ -238,9 +234,51 @@ IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >> IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT); } +--- a/hif/pcie/8864/tx.c ++++ b/hif/pcie/8864/tx.c +@@ -743,7 +743,7 @@ void pcie_8864_tx_xmit(struct ieee80211_ + index = SYSADPT_TX_WMM_QUEUES - index - 1; + txpriority = index; + +- if (sta && sta->ht_cap.ht_supported && ++ if (sta && sta->deflink.ht_cap.ht_supported && + !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) && + ieee80211_is_data_qos(wh->frame_control)) { + tid = qos & 0xf; +--- a/hif/pcie/8964/tx_ndp.c ++++ b/hif/pcie/8964/tx_ndp.c +@@ -607,7 +607,7 @@ void pcie_tx_xmit_ndp(struct ieee80211_h + pcie_tx_encapsulate_frame(priv, skb, k_conf); + } else { + tid = qos & 0x7; +- if (sta && sta->ht_cap.ht_supported && !eapol_frame && ++ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && + qos != 0xFFFF) { + pcie_tx_count_packet(sta, tid); + spin_lock_bh(&priv->stream_lock); +--- a/hif/pcie/8997/tx.c ++++ b/hif/pcie/8997/tx.c +@@ -81,7 +81,7 @@ static int pcie_txbd_ring_create(struct + wiphy_info(priv->hw->wiphy, + "TX ring: - base: %p, pbase: 0x%x, len: %d\n", + pcie_priv->txbd_ring_vbase, +- pcie_priv->txbd_ring_pbase, ++ (u32)pcie_priv->txbd_ring_pbase, + pcie_priv->txbd_ring_size); + + for (num = 0; num < PCIE_MAX_TXRX_BD; num++) { +@@ -694,7 +694,7 @@ void pcie_8997_tx_xmit(struct ieee80211_ + index = SYSADPT_TX_WMM_QUEUES - index - 1; + txpriority = index; + +- if (sta && sta->ht_cap.ht_supported && ++ if (sta && sta->deflink.ht_cap.ht_supported && + !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) && + ieee80211_is_data_qos(wh->frame_control)) { + tid = qos & 0xf; --- a/mac80211.c +++ b/mac80211.c -@@ -371,15 +371,15 @@ static void mwl_mac80211_bss_info_change +@@ -368,15 +368,15 @@ static void mwl_mac80211_bss_info_change } } @@ -259,7 +297,7 @@ { struct mwl_priv *priv = hw->priv; struct mwl_vif *mwl_vif; -@@ -429,8 +429,8 @@ static void mwl_mac80211_bss_info_change +@@ -426,8 +426,8 @@ static void mwl_mac80211_bss_info_change if (changed & (BSS_CHANGED_BEACON_INT | BSS_CHANGED_BEACON)) { struct sk_buff *skb; @@ -270,7 +308,7 @@ (!info->hidden_ssid)) { if (mwl_vif->broadcast_ssid != true) { mwl_fwcmd_broadcast_ssid_enable(hw, vif, true); -@@ -444,7 +444,7 @@ static void mwl_mac80211_bss_info_change +@@ -441,7 +441,7 @@ static void mwl_mac80211_bss_info_change } if (!mwl_vif->set_beacon) { @@ -279,7 +317,7 @@ if (skb) { mwl_fwcmd_set_beacon(hw, vif, skb->data, skb->len); -@@ -461,7 +461,7 @@ static void mwl_mac80211_bss_info_change +@@ -458,7 +458,7 @@ static void mwl_mac80211_bss_info_change static void mwl_mac80211_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, @@ -288,7 +326,7 @@ { switch (vif->type) { case NL80211_IFTYPE_AP: -@@ -584,10 +584,10 @@ static int mwl_mac80211_sta_add(struct i +@@ -583,10 +583,10 @@ static int mwl_mac80211_sta_add(struct i if (vif->type == NL80211_IFTYPE_MESH_POINT) sta_info->is_mesh_node = true; @@ -296,12 +334,12 @@ + if (sta->deflink.ht_cap.ht_supported) { sta_info->is_ampdu_allowed = true; sta_info->is_amsdu_allowed = false; -- if (sta->ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) -+ if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) +- if (sta->ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) { ++ if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) { sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_8K; - else - sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_4K; -@@ -669,7 +669,7 @@ static int mwl_mac80211_sta_remove(struc + sta_info->amsdu_ctrl.amsdu_allow_size = SYSADPT_AMSDU_8K_MAX_SIZE; + } +@@ -670,7 +670,7 @@ static int mwl_mac80211_sta_remove(struc static int mwl_mac80211_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -310,7 +348,7 @@ const struct ieee80211_tx_queue_params *params) { struct mwl_priv *priv = hw->priv; -@@ -928,4 +928,5 @@ const struct ieee80211_ops mwl_mac80211_ +@@ -934,4 +934,5 @@ const struct ieee80211_ops mwl_mac80211_ .pre_channel_switch = mwl_mac80211_chnl_switch, .sw_scan_start = mwl_mac80211_sw_scan_start, .sw_scan_complete = mwl_mac80211_sw_scan_complete, @@ -360,34 +398,3 @@ switch (format) { case TX_RATE_FORMAT_LEGACY: ---- a/hif/pcie/tx.c -+++ b/hif/pcie/tx.c -@@ -153,7 +153,7 @@ static int pcie_txbd_ring_create(struct - wiphy_info(priv->hw->wiphy, - "TX ring: - base: %p, pbase: 0x%x, len: %d\n", - pcie_priv->txbd_ring_vbase, -- pcie_priv->txbd_ring_pbase, -+ (u32)pcie_priv->txbd_ring_pbase, - pcie_priv->txbd_ring_size); - - for (num = 0; num < PCIE_MAX_TXRX_BD; num++) { -@@ -1091,7 +1091,7 @@ void pcie_tx_xmit(struct ieee80211_hw *h - index = SYSADPT_TX_WMM_QUEUES - index - 1; - txpriority = index; - -- if (sta && sta->ht_cap.ht_supported && !eapol_frame && -+ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && - ieee80211_is_data_qos(wh->frame_control)) { - tid = qos & 0xf; - pcie_tx_count_packet(sta, tid); ---- a/hif/pcie/tx_ndp.c -+++ b/hif/pcie/tx_ndp.c -@@ -602,7 +602,7 @@ void pcie_tx_xmit_ndp(struct ieee80211_h - pcie_tx_encapsulate_frame(priv, skb, k_conf, NULL); - } else { - tid = qos & 0x7; -- if (sta && sta->ht_cap.ht_supported && !eapol_frame && -+ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && - qos != 0xFFFF) { - pcie_tx_count_packet(sta, tid); - spin_lock_bh(&priv->stream_lock); diff --git a/package/kernel/mwlwifi/patches/006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch b/package/kernel/mwlwifi/patches/006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch new file mode 100644 index 00000000000000..2a49daa94321ee --- /dev/null +++ b/package/kernel/mwlwifi/patches/006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch @@ -0,0 +1,51 @@ +From ad911365cac3723d1c00d048905a5e22ff4a10f3 Mon Sep 17 00:00:00 2001 +From: Stefan Kalscheuer +Date: Sun, 18 Jun 2023 17:53:27 +0200 +Subject: [PATCH 1/2] remove uaccess and get_fs calls from PCIe for Kenel >= + 5.18 + +Remove the calls to deprecated get_fs and force_uaccess_* API for modern +kernels. + +The get_fs functionality and the transitional force_uaccess_* calls have +been removed Kernel 5.18 [1] while read and write operations have been +refactored, so the code can work on kernel- and userspace data without +the need to shifting the boundary using set_fs(). + +[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=967747bbc084b93b54e66f9047d342232314cd25 + +Signed-off-by: Stefan Kalscheuer +--- + hif/pcie/pcie.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/hif/pcie/pcie.c ++++ b/hif/pcie/pcie.c +@@ -1439,7 +1439,9 @@ static void pcie_bf_mimo_ctrl_decode(str + const char filename[] = "/tmp/BF_MIMO_Ctrl_Field_Output.txt"; + char str_buf[256]; + char *buf = &str_buf[0]; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + mm_segment_t oldfs; ++#endif + + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) + oldfs = get_fs(); +@@ -1447,7 +1449,7 @@ static void pcie_bf_mimo_ctrl_decode(str + #elif LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) + oldfs = get_fs(); + set_fs(KERNEL_DS); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); + #endif + +@@ -1471,7 +1473,7 @@ static void pcie_bf_mimo_ctrl_decode(str + + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) + set_fs(oldfs); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); + #endif + } diff --git a/package/kernel/mwlwifi/patches/007-replace-usage-of-the-deprecated-pci-dma-compat.h-API.patch b/package/kernel/mwlwifi/patches/007-replace-usage-of-the-deprecated-pci-dma-compat.h-API.patch new file mode 100644 index 00000000000000..b752d72f782b6a --- /dev/null +++ b/package/kernel/mwlwifi/patches/007-replace-usage-of-the-deprecated-pci-dma-compat.h-API.patch @@ -0,0 +1,352 @@ +From 61c75dce424c180b633c64613a1948df5a41cf1e Mon Sep 17 00:00:00 2001 +From: Stefan Kalscheuer +Date: Sun, 18 Jun 2023 17:59:07 +0200 +Subject: [PATCH 2/2] replace usage of the deprecated "pci-dma-compat.h" API + +The pci-dma-compat API has been legacy for quite a while and was removed +with 5.18 [1]. Migrate all calls, so the module can be compiled against +modern kernel versions. + +Replace some compat calls: +* pci_set_dma_mask with dma_set_mask +* pci_(un)map_single with dma_(un)map_single +* pci_dma_mapping_error with dma_mapping_error +* PCI_DMA_{FROM,TO}DEVICE with DMA_{FOM,TO}_DEVICE + +[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7968778914e53788a01c2dee2692cab157de9ac0 + +Signed-off-by: Stefan Kalscheuer +--- + hif/pcie/pcie.c | 2 +- + hif/pcie/rx.c | 20 ++++++++++---------- + hif/pcie/rx_ndp.c | 20 ++++++++++---------- + hif/pcie/tx.c | 22 +++++++++++----------- + hif/pcie/tx_ndp.c | 14 +++++++------- + 5 files changed, 39 insertions(+), 39 deletions(-) + +--- a/hif/pcie/pcie.c ++++ b/hif/pcie/pcie.c +@@ -1701,7 +1701,7 @@ static int pcie_probe(struct pci_dev *pd + return rc; + } + +- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); ++ rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (rc) { + pr_err("%s: 32-bit PCI DMA not supported\n", + PCIE_DRV_NAME); +--- a/hif/pcie/8864/rx.c ++++ b/hif/pcie/8864/rx.c +@@ -107,11 +107,11 @@ static int pcie_rx_ring_init(struct mwl_ + desc->prx_ring[i].rssi = 0x00; + desc->prx_ring[i].pkt_len = + cpu_to_le16(SYSADPT_MAX_AGGR_SIZE); +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + rx_hndl->psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); + return -ENOMEM; +@@ -153,11 +153,11 @@ static void pcie_rx_ring_cleanup(struct + if (!rx_hndl->psk_buff) + continue; + +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu + (rx_hndl->pdesc->pphys_buff_data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + + dev_kfree_skb_any(rx_hndl->psk_buff); + +@@ -332,11 +332,11 @@ static inline int pcie_rx_refill(struct + rx_hndl->pdesc->rssi = 0x00; + rx_hndl->pdesc->pkt_len = cpu_to_le16(desc->rx_buf_size); + +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&pcie_priv->pdev->dev, + rx_hndl->psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(rx_hndl->psk_buff); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -410,10 +410,10 @@ void pcie_8864_rx_recv(unsigned long dat + prx_skb = curr_hndl->psk_buff; + if (!prx_skb) + goto out; +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(curr_hndl->pdesc->pphys_buff_data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + pkt_len = le16_to_cpu(curr_hndl->pdesc->pkt_len); + + if (skb_tailroom(prx_skb) < pkt_len) { +--- a/hif/pcie/8864/tx.c ++++ b/hif/pcie/8864/tx.c +@@ -171,11 +171,11 @@ static void pcie_tx_ring_cleanup(struct + desc->tx_hndl[i].psk_buff->data, + le32_to_cpu( + desc->ptx_ring[i].pkt_ptr)); +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu( + desc->ptx_ring[i].pkt_ptr), + desc->tx_hndl[i].psk_buff->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + dev_kfree_skb_any(desc->tx_hndl[i].psk_buff); + desc->ptx_ring[i].status = + cpu_to_le32(EAGLE_TXD_STATUS_IDLE); +@@ -291,9 +291,9 @@ static inline void pcie_tx_skb(struct mw + tx_desc->type = tx_ctrl->type; + tx_desc->xmit_control = tx_ctrl->xmit_control; + tx_desc->sap_pkt_info = 0; +- dma = pci_map_single(pcie_priv->pdev, tx_skb->data, +- tx_skb->len, PCI_DMA_TODEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, tx_skb->data, ++ tx_skb->len, DMA_TO_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(tx_skb); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -447,10 +447,10 @@ static void pcie_non_pfu_tx_done(struct + (tx_desc->status & cpu_to_le32(EAGLE_TXD_STATUS_OK)) && + (!(tx_desc->status & + cpu_to_le32(EAGLE_TXD_STATUS_FW_OWNED)))) { +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(tx_desc->pkt_ptr), + le16_to_cpu(tx_desc->pkt_len), +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + done_skb = tx_hndl->psk_buff; + rate = le32_to_cpu(tx_desc->rate_info); + tx_desc->pkt_ptr = 0; +@@ -925,4 +925,4 @@ void pcie_8864_tx_del_sta_amsdu_pkts(str + } + } + spin_unlock_bh(&sta_info->amsdu_lock); +-} +\ No newline at end of file ++} +--- a/hif/pcie/8964/rx_ndp.c ++++ b/hif/pcie/8964/rx_ndp.c +@@ -86,11 +86,11 @@ static int pcie_rx_ring_init_ndp(struct + } + skb_reserve(psk_buff, MIN_BYTES_RX_HEADROOM); + +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); + return -ENOMEM; +@@ -120,11 +120,11 @@ static void pcie_rx_ring_cleanup_ndp(str + if (desc->prx_ring) { + for (i = 0; i < MAX_NUM_RX_DESC; i++) { + if (desc->rx_vbuflist[i]) { +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu( + desc->prx_ring[i].data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + desc->rx_vbuflist[i] = NULL; + } + } +@@ -411,11 +411,11 @@ static inline int pcie_rx_refill_ndp(str + return -ENOMEM; + skb_reserve(psk_buff, MIN_BYTES_RX_HEADROOM); + +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + wiphy_err(priv->hw->wiphy, + "refill: failed to map pci memory!\n"); + return -ENOMEM; +@@ -520,10 +520,10 @@ recheck: + break; + } + +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(prx_desc->data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + + bad_mic = false; + ctrl = le32_to_cpu(prx_ring_done->ctrl); +--- a/hif/pcie/8964/tx_ndp.c ++++ b/hif/pcie/8964/tx_ndp.c +@@ -132,10 +132,10 @@ static void pcie_tx_ring_cleanup_ndp(str + for (i = 0; i < MAX_TX_RING_SEND_SIZE; i++) { + tx_skb = desc->tx_vbuflist[i]; + if (tx_skb) { +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + desc->pphys_tx_buflist[i], + tx_skb->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + dev_kfree_skb_any(tx_skb); + desc->pphys_tx_buflist[i] = 0; + desc->tx_vbuflist[i] = NULL; +@@ -267,9 +267,9 @@ static inline int pcie_tx_skb_ndp(struct + (TXRING_CTRL_TAG_MGMT << TXRING_CTRL_TAG_SHIFT)); + } + +- dma = pci_map_single(pcie_priv->pdev, tx_skb->data, +- tx_skb->len, PCI_DMA_TODEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, tx_skb->data, ++ tx_skb->len, DMA_TO_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(tx_skb); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -451,10 +451,10 @@ void pcie_tx_done_ndp(struct ieee80211_h + "buffer is NULL for tx done ring\n"); + break; + } +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + desc->pphys_tx_buflist[index], + skb->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + desc->pphys_tx_buflist[index] = 0; + desc->tx_vbuflist[index] = NULL; + +--- a/hif/pcie/8997/rx.c ++++ b/hif/pcie/8997/rx.c +@@ -107,11 +107,11 @@ static int pcie_rx_ring_init(struct mwl_ + desc->prx_ring[i].rssi = 0x00; + desc->prx_ring[i].pkt_len = + cpu_to_le16(SYSADPT_MAX_AGGR_SIZE); +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + rx_hndl->psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); + return -ENOMEM; +@@ -153,11 +153,11 @@ static void pcie_rx_ring_cleanup(struct + if (!rx_hndl->psk_buff) + continue; + +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu + (rx_hndl->pdesc->pphys_buff_data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + + dev_kfree_skb_any(rx_hndl->psk_buff); + +@@ -332,11 +332,11 @@ static inline int pcie_rx_refill(struct + rx_hndl->pdesc->rssi = 0x00; + rx_hndl->pdesc->pkt_len = cpu_to_le16(desc->rx_buf_size); + +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&pcie_priv->pdev->dev, + rx_hndl->psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(rx_hndl->psk_buff); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -410,10 +410,10 @@ void pcie_8997_rx_recv(unsigned long dat + prx_skb = curr_hndl->psk_buff; + if (!prx_skb) + goto out; +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(curr_hndl->pdesc->pphys_buff_data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + pkt_len = le16_to_cpu(curr_hndl->pdesc->pkt_len); + + if (skb_tailroom(prx_skb) < pkt_len) { +--- a/hif/pcie/8997/tx.c ++++ b/hif/pcie/8997/tx.c +@@ -139,10 +139,10 @@ static void pcie_txbd_ring_delete(struct + skb = pcie_priv->tx_buf_list[num]; + tx_desc = (struct pcie_tx_desc *)skb->data; + +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(tx_desc->pkt_ptr), + skb->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + dev_kfree_skb_any(skb); + } + pcie_priv->tx_buf_list[num] = NULL; +@@ -222,9 +222,9 @@ static inline void pcie_tx_skb(struct mw + tx_desc->type = tx_ctrl->type; + tx_desc->xmit_control = tx_ctrl->xmit_control; + tx_desc->sap_pkt_info = 0; +- dma = pci_map_single(pcie_priv->pdev, tx_skb->data, +- tx_skb->len, PCI_DMA_TODEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, tx_skb->data, ++ tx_skb->len, DMA_TO_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(tx_skb); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -401,10 +401,10 @@ static void pcie_pfu_tx_done(struct mwl_ + pfu_dma = (struct pcie_pfu_dma_data *)done_skb->data; + tx_desc = &pfu_dma->tx_desc; + dma_data = &pfu_dma->dma_data; +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(data_buf->paddr), + le16_to_cpu(data_buf->len), +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + tx_desc->pkt_ptr = 0; + tx_desc->pkt_len = 0; + tx_desc->status = cpu_to_le32(EAGLE_TXD_STATUS_IDLE); +@@ -875,4 +875,4 @@ void pcie_8997_tx_del_sta_amsdu_pkts(str + } + } + spin_unlock_bh(&sta_info->amsdu_lock); +-} +\ No newline at end of file ++} From 1598d87309bb410240963bfe538775e98953d578 Mon Sep 17 00:00:00 2001 From: Luis Mita Date: Wed, 22 Nov 2023 15:13:04 -0400 Subject: [PATCH 0670/1171] mediatek: add support for Confiabits MT7981 Confiabits MT7981 is a Wi-Fi 6 router based on MediaTek MT7981. Specification: - SoC: MediaTek MT7981B - CPU: 2x 1.3 GHz Cortex-A53 - Flash: 128 MiB SPI NAND - RAM: 256 MiB - WLAN: 2.4 GHz, 5 GHz (MediaTek MT7976CN, 802.11ax) - Ethernet: 4x 10/100/1000 Mbps MT7531AE (3xLAN, 1xWAN) - USB 2.0 port - Buttons: 1 Reset button, 1 Mesh button. - LEDs: 7x light-blue, 2x warm-white - Serial console: internal 4-pin header, 115200 8n1 - Power: 12 VDC, 1.5 A MAC addresses in stock firmware and in this commit: +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | WAN | 00:0c:43:xx:xx:e1 | label+1 | | LAN | 00:0c:43:xx:xx:e0 | label | | WLAN 2g | 00:0c:43:xx:xx:e0 | label | | WLAN 5g | 02:0c:43:xx:xx:e0 | | +---------+-------------------+-----------+ The label MAC was found in 'Factory', 0x4 Installation: The stock firmware is OpenWrt-based. If you can reach LuCI or SSH, just use the sysupgrade image with the 'Keep settings' option turned off. Signed-off-by: Luis Mita (cherry picked from commit 2af07eb85393689a74d32d6211663a0e5ec02a01) --- .../dts/mt7981b-confiabits-mt7981.dts | 296 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 6 + .../filogic/base-files/etc/board.d/02_network | 1 + target/linux/mediatek/image/filogic.mk | 16 + 4 files changed, 319 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts diff --git a/target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts b/target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts new file mode 100644 index 00000000000000..2824bbfc842156 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts @@ -0,0 +1,296 @@ +/dts-v1/; + +#include "mt7981.dtsi" +#include +#include +#include + +/ { + model = "Confiabits MT7981"; + compatible = "confiabits,mt7981", "mediatek,mt7981"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-mesh { + label = "mesh"; + linux,input-type = ; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_HIGH>; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-wlan5g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <5>; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-wan-red { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + }; + + led_power: led-power { + label = "blue:power"; // can be removed once #13837 is merged + color = ; + function = LED_FUNCTION_POWER; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-lan1 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-lan2 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led-lan3 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led-wan-blue { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led-wlan2g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-mesh { + color = ; + function = "mesh"; // no LED_FUNCTION_MESH yet + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 0>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + + +&mdio_bus { + #address-cells = <1>; + #size-cells = <0>; + + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@4 { + reg = <4>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 1>; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + mediatek,u3p-dis-msk = <0x1>; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index ea126bc46f9e40..546b7f6cd72fa4 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -6,6 +6,12 @@ board=$(board_name) board_config_update case $board in +confiabits,mt7981) + ucidef_set_led_netdev "lan1" "lan1" "blue:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "blue:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan3" "lan3" "blue:lan-3" "lan3" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" + ;; cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 901013aa5990a4..a53b66f7cbba23 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -26,6 +26,7 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan" ;; cetron,ct3003|\ + confiabits,mt7981|\ cudy,wr3000-v1|\ jcg,q30-pro|\ qihoo,360t7) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 7249a2e2361e3d..2a9449f3bb1fb2 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -272,6 +272,22 @@ define Device/cmcc_rax3000m endef TARGET_DEVICES += cmcc_rax3000m +define Device/confiabits_mt7981 + DEVICE_VENDOR := Confiabits + DEVICE_MODEL := MT7981 + DEVICE_DTS := mt7981b-confiabits-mt7981 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-2500wan-gmac2-rfb + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := kmod-usb3 kmod-mt7981-firmware +endef +TARGET_DEVICES += confiabits_mt7981 + define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000 From fd6831731b9bde3847c7d8fd8dae528d863017dd Mon Sep 17 00:00:00 2001 From: Luis Mita Date: Wed, 6 Dec 2023 09:30:10 -0400 Subject: [PATCH 0671/1171] mediatek: add SPDX header for Confiabits MT7981 DTS Fixing ambiguous licensing. Signed-off-by: Luis Mita (cherry picked from commit b1fd4b35bf784a9b5619e17c07389e79af113953) --- target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts b/target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts index 2824bbfc842156..520b8494eefd04 100644 --- a/target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts +++ b/target/linux/mediatek/dts/mt7981b-confiabits-mt7981.dts @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT /dts-v1/; #include "mt7981.dtsi" From 59fd8f08cf544a7f0fcaf700ca9af9292de3adcc Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 18 Dec 2023 21:22:12 +0000 Subject: [PATCH 0672/1171] mvebu: fix RTC of IEI-World Puzzle M90x devices The Puzzle devices come with an I2C-connected Epson RX8130 RTC. Disable the (dysfunctional) RTC units of the SoC and add driver kmod-rtc-ds1307 to support the Epson RX8130 instead. Tested-by: Thomas Huehn Signed-off-by: Daniel Golle (cherry picked from commit 6d546b3b4cdae3ffcdad71fb6cc414f3a39bc09e) --- .../arm64/boot/dts/marvell/cn9131-puzzle-m901.dts | 8 ++++++++ .../arm64/boot/dts/marvell/cn9132-puzzle-m902.dts | 12 ++++++++++++ target/linux/mvebu/image/cortexa72.mk | 6 ++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts index 0ad25fafbb8b2d..5bc3a846e0d5f8 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts @@ -244,6 +244,10 @@ }; }; +&cp0_rtc { + status = "disabled"; +}; + &cp0_syscon0 { cp0_pinctrl: pinctrl { compatible = "marvell,cp115-standalone-pinctrl"; @@ -367,6 +371,10 @@ clock-frequency = <100000>; }; +&cp1_rtc { + status = "disabled"; +}; + &cp1_syscon0 { cp1_pinctrl: pinctrl { compatible = "marvell,cp115-standalone-pinctrl"; diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts index 398e53a5f9a4f4..671b592e67a744 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts @@ -302,6 +302,10 @@ }; }; +&cp0_rtc { + status = "disabled"; +}; + &cp0_syscon0 { cp0_pinctrl: pinctrl { compatible = "marvell,cp115-standalone-pinctrl"; @@ -423,6 +427,10 @@ clock-frequency = <100000>; }; +&cp1_rtc { + status = "disabled"; +}; + &cp1_syscon0 { cp1_pinctrl: pinctrl { compatible = "marvell,cp115-standalone-pinctrl"; @@ -551,6 +559,10 @@ }; }; +&cp2_rtc { + status = "disabled"; +}; + &cp2_syscon0 { cp2_pinctrl: pinctrl { compatible = "marvell,cp115-standalone-pinctrl"; diff --git a/target/linux/mvebu/image/cortexa72.mk b/target/linux/mvebu/image/cortexa72.mk index 47d958b2fd1580..26b02e19247dcc 100644 --- a/target/linux/mvebu/image/cortexa72.mk +++ b/target/linux/mvebu/image/cortexa72.mk @@ -65,16 +65,18 @@ TARGET_DEVICES += marvell_clearfog-gt-8k define Device/iei_puzzle-m901 $(call Device/Default-arm64) + SOC := cn9131 DEVICE_VENDOR := iEi DEVICE_MODEL := Puzzle-M901 - SOC := cn9131 + DEVICE_PACKAGES += kmod-rtc-ds1307 endef TARGET_DEVICES += iei_puzzle-m901 define Device/iei_puzzle-m902 $(call Device/Default-arm64) + SOC := cn9132 DEVICE_VENDOR := iEi DEVICE_MODEL := Puzzle-M902 - SOC := cn9132 + DEVICE_PACKAGES += kmod-rtc-ds1307 endef TARGET_DEVICES += iei_puzzle-m902 From 60e49cf1703145f2613a807faf9c0e63f497bd73 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 26 Dec 2023 01:17:18 +0100 Subject: [PATCH 0673/1171] ramips: fix label-mac for Xiaomi RA75 The label-mac of the repeater is the address used on the 2.4 GHz radio, not the ethernet MAC. Signed-off-by: David Bauer (cherry picked from commit 47818fbc012d7b8ef4129bf702da2d6aae07266e) --- target/linux/ramips/dts/mt7628an_xiaomi_mi-ra75.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-ra75.dts b/target/linux/ramips/dts/mt7628an_xiaomi_mi-ra75.dts index 173bcd992d73e7..ecd04c3f77b5aa 100644 --- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-ra75.dts +++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-ra75.dts @@ -10,7 +10,7 @@ led-failsafe = &led_system_amber; led-running = &led_system_blue; led-upgrade = &led_system_amber; - label-mac-device = ðernet; + label-mac-device = &wmac; }; leds { From 5cc1918a7a0bed42eaf8a26afff6091336c62af5 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 28 Dec 2023 23:16:02 +0100 Subject: [PATCH 0674/1171] dropbear: increase default receive window size Increasing the receive window size improves throughout on higher-latency links such as WAN connections. The current default of 24KB caps out at around 500 KB/s. Increasing the receive buffer to 256KB increases the throughput to at least 11 MB/s. Signed-off-by: David Bauer (cherry picked from commit f95eecfb21ff08662e022accd30e8254028ff63b) --- package/network/services/dropbear/files/dropbear.init | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init index b82e967cbcedc4..a40b5f7baeea0f 100755 --- a/package/network/services/dropbear/files/dropbear.init +++ b/package/network/services/dropbear/files/dropbear.init @@ -155,6 +155,12 @@ dropbear_instance() PIDCOUNT="$(( ${PIDCOUNT} + 1))" local pid_file="/var/run/${NAME}.${PIDCOUNT}.pid" + # Increase default receive window size to increase + # throughput on high latency links + if [ "${RecvWindowSize}" -eq "0" ]; then + RecvWindowSize="262144" + fi + procd_open_instance procd_set_param command "$PROG" -F -P "$pid_file" [ "${PasswordAuth}" -eq 0 ] && procd_append_param command -s From b0fc8b47e0d808c57fcb82ef6eb965668c640c50 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 4 Jan 2024 13:46:34 +0100 Subject: [PATCH 0675/1171] netifd: update to Git openwrt-23.05 (2024-01-04) c739dee0a37b system-linux: refresh MAC address on DSA port conduit change 8587c074f1eb interface-ip: fix IPv4 route target masking 33d6c261aacb system-linux: fix bogus debug error messages on adding bridge members 0832e8f04778 wireless: add bridge_isolate option 5ca7a9058e98 bridge: fix reload on bridge vlan changes be4ffb3b78bc bridge: rework config change pvid handling 923c4370a1d4 system-linux: set master early on apply settings b9442415c785 system-linux: skip refreshing MAC on master change if custom MAC b635a09cdadf system-linux: set pending to 0 on ifindex found or error for if_get_master 2bbe49c36224 device: Log error message if device initialization failed 2703f740a23e Revert "system-linux: set pending to 0 on ifindex found or error for if_get_master" 9cb0cb418303 system-linux: fix race condition in netlink socket error handing c18cc79d5000 device: restore cleared flags on device down Signed-off-by: Felix Fietkau --- package/network/config/netifd/Makefile | 8 ++--- ...ace-ip-fix-IPv4-route-target-masking.patch | 32 ------------------- 2 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index d237ed181f4fff..b9f0e692d5386f 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_RELEASE:=1.1 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-11-10 -PKG_SOURCE_VERSION:=35facc8306f590a7330789ab6d5785c0d43073ef -PKG_MIRROR_HASH:=4f73591ae1873e18df235349e478f2196ca0d3123c313a04149dc9d5e2bfb403 +PKG_SOURCE_DATE:=2024-01-04 +PKG_SOURCE_VERSION:=c18cc79d50002ab8529c21184aceb016c61ac61c +PKG_MIRROR_HASH:=0a1080ade51dc4a55249c8899d4d384f665e0d21075adab24ea23a2808165e05 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch b/package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch deleted file mode 100644 index dd9374a83cfd67..00000000000000 --- a/package/network/config/netifd/patches/0001-interface-ip-fix-IPv4-route-target-masking.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 8587c074f1eb2064c42adb0a6aa5073f695ab89d Mon Sep 17 00:00:00 2001 -From: Jo-Philipp Wich -Date: Tue, 14 Nov 2023 14:01:44 +0100 -Subject: [PATCH] interface-ip: fix IPv4 route target masking - -A previous commit supposed to mask out excess host bits in route targets -failed to correctly calculate the mask value, causing it to produce -improper results for certain mask lengths. - -Fixes: #17 -Fixes: 76eb342 ("interface-ip: mask out host bits in IPv4 route targets") -Signed-off-by: Jo-Philipp Wich ---- - interface-ip.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/interface-ip.c b/interface-ip.c -index d2fe385..28e7106 100644 ---- a/interface-ip.c -+++ b/interface-ip.c -@@ -448,7 +448,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) - - /* Mask out IPv4 host bits to avoid "Invalid prefix for given prefix length" */ - if (af == AF_INET && route->mask < 32) -- route->addr.in.s_addr &= ((1u << route->mask) - 1); -+ clear_if_addr(&route->addr, route->mask); - } - - if ((cur = tb[ROUTE_GATEWAY]) != NULL) { --- -2.39.1 - From 9325da80ab5dbd7caf91b2f98117c5f6ae6fc7c2 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 3 Jan 2024 15:13:32 +0100 Subject: [PATCH 0676/1171] mac80211: fix a race condition related to enabling fast-xmit fast-xmit must only be enabled after the sta has been uploaded to the driver, otherwise it could end up passing the not-yet-uploaded sta via drv_tx calls to the driver, leading to potential crashes because of uninitialized drv_priv data. Add a missing sta->uploaded check and re-check fast xmit after inserting a sta. Signed-off-by: Felix Fietkau (cherry picked from commit 438a97fab69b41387e25cbec45271e7fe159a330) --- ...x-race-condition-on-enabling-fast-xm.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/337-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch diff --git a/package/kernel/mac80211/patches/subsys/337-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch b/package/kernel/mac80211/patches/subsys/337-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch new file mode 100644 index 00000000000000..0ef0aa2ef74a1d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/337-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch @@ -0,0 +1,34 @@ +From: Felix Fietkau +Date: Wed, 3 Jan 2024 15:10:18 +0100 +Subject: [PATCH] wifi: mac80211: fix race condition on enabling fast-xmit + +fast-xmit must only be enabled after the sta has been uploaded to the driver, +otherwise it could end up passing the not-yet-uploaded sta via drv_tx calls +to the driver, leading to potential crashes because of uninitialized drv_priv +data. +Add a missing sta->uploaded check and re-check fast xmit after inserting a sta. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -886,6 +886,7 @@ static int sta_info_insert_finish(struct + + if (ieee80211_vif_is_mesh(&sdata->vif)) + mesh_accept_plinks_update(sdata); ++ ieee80211_check_fast_xmit(sta); + + return 0; + out_remove: +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3041,7 +3041,7 @@ void ieee80211_check_fast_xmit(struct st + sdata->vif.type == NL80211_IFTYPE_STATION) + goto out; + +- if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED)) ++ if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) || !sta->uploaded) + goto out; + + if (test_sta_flag(sta, WLAN_STA_PS_STA) || From 9a7b14dcfeb211fb55fe64b9a7a0d76e17676a61 Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Sun, 10 Dec 2023 13:49:10 +0100 Subject: [PATCH 0677/1171] mediatek: enable mt7981-wo-firmware package by default Add support for wireless offload package in default configuration for -Cudy WR3000 -Confiabits MT7981 For some reason those ware missing. I confirm this work for my Cudy WR3000 Signed-off-by: Robert Senderek (cherry picked from commit b42eea0c2f68ea4903e952287a08511dd0a03072) --- target/linux/mediatek/image/filogic.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 2a9449f3bb1fb2..95bc760d3699f6 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -284,7 +284,7 @@ define Device/confiabits_mt7981 IMAGE_SIZE := 65536k KERNEL_IN_UBI := 1 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-usb3 kmod-mt7981-firmware + DEVICE_PACKAGES := kmod-usb3 kmod-mt7981-firmware mt7981-wo-firmware endef TARGET_DEVICES += confiabits_mt7981 @@ -303,7 +303,7 @@ define Device/cudy_wr3000-v1 KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata - DEVICE_PACKAGES := kmod-mt7981-firmware + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware endef TARGET_DEVICES += cudy_wr3000-v1 From f6fb6bb2ba67d0c6e43b1f8ee649ae6550661e79 Mon Sep 17 00:00:00 2001 From: Szabolcs Hubai Date: Wed, 8 Nov 2023 13:50:55 +0100 Subject: [PATCH 0678/1171] ramips: mt7621: use lzma-loader for Sercomm NA502 This fixes a well known "LZMA ERROR 1" error on Sercomm NA502, reported on the OpenWrt forum. [1] [1]: https://forum.openwrt.org/t/176942 Signed-off-by: Szabolcs Hubai (cherry picked from commit d41b8a570f209c352571f209c2c8f2b52b8d27af) --- target/linux/ramips/image/mt7621.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index d456176a0178ea..e20a3e99aa765f 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1973,6 +1973,7 @@ TARGET_DEVICES += samknows_whitebox-v8 define Device/sercomm_na502 $(Device/nand) + $(Device/uimage-lzma-loader) IMAGE_SIZE := 20480k DEVICE_VENDOR := SERCOMM DEVICE_MODEL := NA502 From 18d7962f7b130ac9b873d6bb2c00c3ea6e2fa95f Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 25 Nov 2023 12:14:57 +0000 Subject: [PATCH 0679/1171] ramips: add support for Rostelecom RT-FE-1A Rostelecom RT-FE-1A is a wireless WiFi 5 router manufactured by Sercomm company. Device specification -------------------- SoC Type: MediaTek MT7621AT RAM: 256 MiB Flash: 128 MiB Wireless 2.4 GHz (MT7603EN): b/g/n, 2x2 Wireless 5 GHz (MT7615E): a/n/ac, 4x4 Ethernet: 5x GbE (WAN, LAN1, LAN2, LAN3, LAN4) USB ports: No Button: 2 buttons (Reset & WPS) LEDs: - 1x Power (green, unmanaged) - 1x Status (green, gpio) - 1x 2.4G (green, hardware, mt76-phy0) - 1x 2.4G (blue, gpio) - 1x 5G (green, hardware, mt76-phy1) - 1x 5G (blue, gpio) - 5x Ethernet (green, hardware, 4x LAN & WAN) Power: 12 VDC, 1.5 A Connector type: barrel Bootloader: U-Boot Installation ----------------- 1. Login to the router web interface (default http://192.168.0.1/) under "admin" account 2. Navigate to Settings -> Configuration -> Save to Computer 3. Decode the configuration. For example, using cfgtool.py tool (see related section): cfgtool.py -u configurationBackup.cfg 4. Open configurationBackup.xml and find the following block: 5. Replace by a new superadmin password and add a line which enabling superadmin login after. For example, the block after the changes: 6. Encode the configuration. For example, using cfgtool.py tool: cfgtool.py -p configurationBackup.xml 7. Upload the changed configuration (configurationBackup_changed.cfg) to the router 8. Login to the router web interface (superadmin:xxxxxxxxxx, where xxxxxxxxxx is a new password from the p.5) 9. Enable SSH access to the router (Settings -> Access control -> SSH) 10. Connect to the router using SSH shell using superadmin account 11. Run in SSH shell: sh 12. Make a mtd backup (optional, see related section) 13. Change bootflag to Sercomm1 and reboot: printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3 reboot 14. Login to the router web interface under admin account 15. Remove dots from the OpenWrt factory image filename 16. Update firmware via web using OpenWrt factory image Revert to stock --------------- Change bootflag to Sercomm1 in OpenWrt CLI and then reboot: printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3 mtd backup ---------- 1. Set up a tftp server (e.g. tftpd64 for windows) 2. Connect to a router using SSH shell and run the following commands: cd /tmp for i in 0 1 2 3 4 5 6 7 8 9; do nanddump -f mtd$i /dev/mtd$i; \ tftp -l mtd$i -p 192.168.0.2; md5sum mtd$i >> mtd.md5; rm mtd$i; done tftp -l mtd.md5 -p 192.168.0.2 MAC Addresses ------------- +-----+------------+---------+ | use | address | example | +-----+------------+---------+ | LAN | label | f4:*:66 | | WAN | label + 11 | f4:*:71 | | 2g | label + 2 | f4:*:68 | | 5g | label + 3 | f4:*:69 | +-----+------------+---------+ The label MAC address was found in Factory, 0x21000 cfgtool.py ---------- A tool for decoding and encoding Sercomm configs. Link: https://github.com/r3d5ky/sercomm_cfg_unpacker Signed-off-by: Mikhail Zhilkin (cherry picked from commit f3cdc9f9881796794c06f784a2e4790f5ed75d1f) --- package/boot/uboot-envtools/files/ramips | 1 + .../ramips/dts/mt7621_rostelecom_rt-fe-1a.dts | 266 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 14 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 4 files changed, 282 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_rostelecom_rt-fe-1a.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 83b54388e3e731..1df42c22eff4a0 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -43,6 +43,7 @@ beeline,smartbox-giga|\ beeline,smartbox-turbo|\ beeline,smartbox-turbo-plus|\ etisalat,s3|\ +rostelecom,rt-fe-1a|\ rostelecom,rt-sf-1) ubootenv_add_uci_config "/dev/mtd0" "0x80000" "0x1000" "0x20000" ;; diff --git a/target/linux/ramips/dts/mt7621_rostelecom_rt-fe-1a.dts b/target/linux/ramips/dts/mt7621_rostelecom_rt-fe-1a.dts new file mode 100644 index 00000000000000..8afe5f54859605 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_rostelecom_rt-fe-1a.dts @@ -0,0 +1,266 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "rostelecom,rt-fe-1a", "mediatek,mt7621-soc"; + model = "Rostelecom RT-FE-1A"; + + aliases { + label-mac-device = &gmac0; + + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <50>; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <24>; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + led_status_green: led-2 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + button-0 { + label = "wps"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + + button-1 { + label = "reset"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + ubi-concat { + compatible = "mtd-concat"; + devices = <&ubiconcat0 &ubiconcat1 &ubiconcat2 \ + &ubiconcat3>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x5420000>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "sercomm,sc-partitions", "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x100000>; + sercomm,scpart-id = <0>; + read-only; + }; + + partition@100000 { + label = "dynamic partition map"; + reg = <0x100000 0x100000>; + sercomm,scpart-id = <1>; + read-only; + }; + + partition@200000 { + label = "Factory"; + reg = <0x200000 0x100000>; + sercomm,scpart-id = <2>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_2g: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_5g: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + + macaddr_label: macaddr@21000 { + compatible = "mac-base"; + reg = <0x21000 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@300000 { + label = "Boot Flag"; + reg = <0x300000 0x100000>; + sercomm,scpart-id = <3>; + }; + + partition@400000 { + label = "kernel"; + reg = <0x400000 0x600000>; + sercomm,scpart-id = <4>; + }; + + partition@a00000 { + label = "Kernel 2"; + reg = <0xa00000 0x600000>; + sercomm,scpart-id = <5>; + read-only; + }; + + ubiconcat0: partition@1000000 { + label = "File System 1"; + reg = <0x1000000 0x1800000>; + sercomm,scpart-id = <6>; + }; + + partition@2800000 { + label = "File System 2"; + reg = <0x2800000 0x1800000>; + sercomm,scpart-id = <7>; + read-only; + }; + + ubiconcat1: partition@4000000 { + label = "Configuration/log"; + reg = <0x4000000 0x800000>; + sercomm,scpart-id = <8>; + }; + + ubiconcat2: partition@4800000 { + label = "application tmp buffer (Ftool)"; + reg = <0x4800000 0xc00000>; + sercomm,scpart-id = <9>; + }; + + ubiconcat3: partition@5400000 { + label = "free space (in stock firmware)"; + reg = <0x5400000 0x2820000>; + sercomm,scpart-id = <10>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + + nvmem-cells = <&eeprom_5g>, <&macaddr_label 3>; + nvmem-cell-names = "eeprom", "mac-address"; + + led { + led-active-low; + }; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <2400000 2500000>; + + nvmem-cells = <&eeprom_2g>, <&macaddr_label 2>; + nvmem-cell-names = "eeprom", "mac-address"; + + led { + led-active-low; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_label 0>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_label 11>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan3"; + }; + + port@4 { + status = "okay"; + label = "lan4"; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index e20a3e99aa765f..52968b482f428a 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1947,6 +1947,20 @@ define Device/renkforce_ws-wn530hp3-a endef TARGET_DEVICES += renkforce_ws-wn530hp3-a +define Device/rostelecom_rt-fe-1a + $(Device/sercomm_dxx) + IMAGE_SIZE := 24576k + SERCOMM_HWID := CX4 + SERCOMM_HWVER := 11300 + SERCOMM_SWVER := 2010 + DEVICE_VENDOR := Rostelecom + DEVICE_MODEL := RT-FE-1A + DEVICE_ALT0_VENDOR := Sercomm + DEVICE_ALT0_MODEL := RT-FE-1A + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware +endef +TARGET_DEVICES += rostelecom_rt-fe-1a + define Device/rostelecom_rt-sf-1 $(Device/sercomm_dxx) IMAGE_SIZE := 32768k diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 5d8305b788cce3..e212c688ecb685 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -102,6 +102,7 @@ platform_do_upgrade() { netgear,wax202|\ netis,wf2881|\ raisecom,msg1500-x-00|\ + rostelecom,rt-fe-1a|\ rostelecom,rt-sf-1|\ sercomm,na502|\ sercomm,na502s|\ From 51881b2eb910d4adc6109b8d5abf0b23635a92ff Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 9 Dec 2023 17:17:02 +0000 Subject: [PATCH 0680/1171] mediatek: add support for Routerich AX3000 This PR is continuation of work under "mediatek: add support for Routerich AX3000" #13703 by the agreement with PR #13703 original author (Maximilian Weinmann ). All reviews from the previous PR were taken into into account. Routerich AX3000 is a wireless WiFi 6 router. Specification ------------- - SoC : MediaTek MT7981BA dual-core ARM Cortex-A53 1.3 GHz - RAM : DDR3 256 MiB (ESMT M15T2G16128A) - Flash : SPI-NAND 128 MiB (ESMT F50L1G41LB) - WLAN : MediaTek MT7976CN dual-band WiFi 6 - 2.4 GHz : b/g/n/ax, MIMO 2x2 - 5 GHz : a/n/ac/ax, MIMO 2x2 - Ethernet : 10/100/1000 Mbps x4 (MediaTek MT7531AE) - USB : 1x 2.0 - UART : through-hole on PCB - [J500] GND, TX, RX, 3.3V (115200n8) - Buttons : Mesh, Reset - LEDs : 1x Power (Blue) 1x WiFi 2.4 GHz (Blue) 1x WiFi 5 GHz (Red) 1x Mesh (Blue) 3x LAN activity (Blue) 1x WAN activity (Blue) 2x WAN no-internet (Red) - Power : 12 VDC, 1.5 A Installation ------------ Flash OpenWrt 'sysupgrade.bin' image using stock firmware web-interface (without keeping settings). Return to stock --------------- Install stock firmware image (without keeping settings) using OpenWrt sysupgrade method. Recovery -------- Connect uart, use u-boot menu to flash stock firmware image or boot OpenWrt initramfs image. MAC addresses ------------- +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | WAN | 24:0f:5e:xx:xx:b4 | label | | LAN | 24:0f:5e:xx:xx:b5 | label+1 | | WLAN 2g | 24:0f:5e:xx:xx:b6 | label+2 | | WLAN 5g | 24:0f:5e:xx:xx:b7 | label+3 | +---------+-------------------+-----------+ The WLAN 2g MAC was found in 'Factory', 0x4 Co-authored-by: Maximilian Weinmann Signed-off-by: Mikhail Zhilkin (cherry picked from commit 485adc9d3c436d31f9713a7d8d84adf266754e26) [Fix merge conflict in uboot-envtools] Signed-off-by: Mikhail Zhilkin --- .../uboot-envtools/files/mediatek_filogic | 3 +- .../mediatek/dts/mt7981b-routerich-ax3000.dts | 337 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 7 + .../filogic/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 11 + 6 files changed, 360 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 8c7c5a85c025cf..b3113d683c9840 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -61,7 +61,8 @@ glinet,gl-mt6000) local envdev=$(find_mmc_part "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x80000" ;; -mercusys,mr90x-v1) +mercusys,mr90x-v1|\ +routerich,ax3000) local envdev=/dev/mtd$(find_mtd_index "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" ;; diff --git a/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts b/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts new file mode 100644 index 00000000000000..1dc4d380b8c3e8 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts @@ -0,0 +1,337 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Routerich AX3000"; + compatible = "routerich,ax3000", "mediatek,mt7981"; + + aliases { + label-mac-device = &wan; + + led-boot = &led_power_blue; + led-failsafe = &led_power_blue; + led-running = &led_power_blue; + led-upgrade = &led_power_blue; + + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-0 { + label = "mesh"; + linux,input-type = ; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + button-1 { + label = "reset"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <50>; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 6 GPIO_ACTIVE_HIGH>; + }; + + led_power_blue: led-2 { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-4 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led-5 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led-6 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led-7 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <24>; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-8 { + color = ; + /* LED_FUNCTION_MESH isn't implemented yet */ + function = "mesh"; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + }; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 (-1)>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <0x1f>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + /* ESMT F50L1G41LB (128M) */ + spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4e 0x41 0x4e 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0_all { + label = "spi0.0"; + reg = <0x0 0x8000000>; + read-only; + }; + + partition@0 { + label = "BL2"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + + partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; + }; + + partition@4580000 { + label = "firmware_backup"; + reg = <0x4580000 0x2000000>; + read-only; + }; + + partition@6580000 { + label = "zrsave"; + reg = <0x6580000 0x100000>; + read-only; + }; + + partition@6680000 { + label = "config2"; + reg = <0x6680000 0x100000>; + read-only; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + wan: port@4 { + reg = <4>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 (-2)>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; +}; + +&xhci { + status = "okay"; + mediatek,u3p-dis-msk = <0x1>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 546b7f6cd72fa4..cdeaa6c5c52146 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -26,6 +26,13 @@ netgear,wax220) ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5g" "phy1-ap0" ;; +routerich,ax3000) + ucidef_set_led_netdev "lan-1" "lan-1" "blue:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan-2" "lan-2" "blue:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan-3" "lan-3" "blue:lan-3" "lan3" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" + ucidef_set_led_netdev "wan-off" "wan-off" "red:wan" "wan" "link" + ;; xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod) diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index a53b66f7cbba23..20a78b7b4b2e7a 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -29,7 +29,8 @@ mediatek_setup_interfaces() confiabits,mt7981|\ cudy,wr3000-v1|\ jcg,q30-pro|\ - qihoo,360t7) + qihoo,360t7|\ + routerich,ax3000) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; cmcc,rax3000m|\ diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index b2b4f377a645af..4911d5e85ec4e4 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -95,6 +95,7 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress ;; + routerich,ax3000|\ zbtlink,zbt-z8102ax|\ zyxel,ex5601-t0) addr=$(mtd_get_mac_binary "Factory" 0x4) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 95bc760d3699f6..add838c4bca839 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -600,6 +600,17 @@ define Device/qihoo_360t7 endef TARGET_DEVICES += qihoo_360t7 +define Device/routerich_ax3000 + DEVICE_VENDOR := Routerich + DEVICE_MODEL := AX3000 + DEVICE_DTS := mt7981b-routerich-ax3000 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb +endef +TARGET_DEVICES += routerich_ax3000 + define Device/tplink_tl-xdr-common DEVICE_VENDOR := TP-Link DEVICE_DTS_DIR := ../dts From 49bde576794af27a7472965ef0124570dfbe9323 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 5 Jan 2024 11:58:15 +0100 Subject: [PATCH 0681/1171] kernel: fix bridge proxyarp issue with some broken DHCP clients There are broken devices in the wild that handle duplicate IP address detection by sending out ARP requests for the IP that they received from a DHCP server and refuse the address if they get a reply. When proxyarp is enabled, they would go into a loop of requesting an address and then NAKing it again. Fixes: https://github.com/openwrt/openwrt/issues/14309 Signed-off-by: Felix Fietkau (cherry picked from commit c1ad78318c3e6421e60dd187477f38ca5f9a5752) --- ...t-send-arp-replies-if-src-and-target.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch diff --git a/target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch b/target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch new file mode 100644 index 00000000000000..f420d210c27cad --- /dev/null +++ b/target/linux/generic/pending-5.15/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch @@ -0,0 +1,37 @@ +From: Felix Fietkau +Date: Thu, 4 Jan 2024 15:21:21 +0100 +Subject: [PATCH] net: bridge: do not send arp replies if src and target hw + addr is the same + +There are broken devices in the wild that handle duplicate IP address +detection by sending out ARP requests for the IP that they received from a +DHCP server and refuse the address if they get a reply. +When proxyarp is enabled, they would go into a loop of requesting an address +and then NAKing it again. + +Link: https://github.com/openwrt/openwrt/issues/14309 +Signed-off-by: Felix Fietkau +--- + +--- a/net/bridge/br_arp_nd_proxy.c ++++ b/net/bridge/br_arp_nd_proxy.c +@@ -204,7 +204,10 @@ void br_do_proxy_suppress_arp(struct sk_ + if ((p && (p->flags & BR_PROXYARP)) || + (f->dst && (f->dst->flags & (BR_PROXYARP_WIFI | + BR_NEIGH_SUPPRESS)))) { +- if (!vid) ++ replied = true; ++ if (!memcmp(n->ha, sha, dev->addr_len)) ++ replied = false; ++ else if (!vid) + br_arp_send(br, p, skb->dev, sip, tip, + sha, n->ha, sha, 0, 0); + else +@@ -212,7 +215,6 @@ void br_do_proxy_suppress_arp(struct sk_ + sha, n->ha, sha, + skb->vlan_proto, + skb_vlan_tag_get(skb)); +- replied = true; + } + + /* If we have replied or as long as we know the From c6425bb5259856ff6df8a3cda3f926e5d1335056 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 5 Jan 2024 12:55:17 +0100 Subject: [PATCH 0682/1171] kernel: delete stray linux 6.1 patch Fixes: cc285dc2b6f7 ("generic: net: phy: realtek: add interrupt support for RTL8221B") Signed-off-by: Felix Fietkau --- ...ealtek-support-interrupt-of-RTL8221B.patch | 63 ------------------- 1 file changed, 63 deletions(-) delete mode 100644 target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch diff --git a/target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch deleted file mode 100644 index 55a9e3529d05b2..00000000000000 --- a/target/linux/generic/pending-6.1/741-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -979,6 +979,51 @@ static int rtl8221b_config_init(struct p - return 0; - } - -+static int rtl8221b_ack_interrupt(struct phy_device *phydev) -+{ -+ int err; -+ -+ err = phy_read_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d4); -+ -+ return (err < 0) ? err : 0; -+} -+ -+static int rtl8221b_config_intr(struct phy_device *phydev) -+{ -+ int err; -+ -+ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { -+ err = rtl8221b_ack_interrupt(phydev); -+ if (err) -+ return err; -+ -+ err = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d2, 0x7ff); -+ } else { -+ err = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL, 0xa4d2, 0x0); -+ if (err) -+ return err; -+ -+ err = rtl8221b_ack_interrupt(phydev); -+ } -+ -+ return err; -+} -+ -+static irqreturn_t rtl8221b_handle_interrupt(struct phy_device *phydev) -+{ -+ int err; -+ -+ err = rtl8221b_ack_interrupt(phydev); -+ if (err) { -+ phy_error(phydev); -+ return IRQ_NONE; -+ } -+ -+ phy_trigger_machine(phydev); -+ -+ return IRQ_HANDLED; -+} -+ - static struct phy_driver realtek_drvs[] = { - { - PHY_ID_MATCH_EXACT(0x00008201), -@@ -1139,6 +1184,8 @@ static struct phy_driver realtek_drvs[] - .get_features = rtl822x_get_features, - .config_init = rtl8221b_config_init, - .config_aneg = rtl822x_config_aneg, -+ .config_intr = rtl8221b_config_intr, -+ .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_probe, - .read_status = rtl822x_read_status, - .suspend = genphy_suspend, From 3aec71a176b43da5c4f1901ad423bacfb258f444 Mon Sep 17 00:00:00 2001 From: Rany Hany Date: Wed, 3 Jan 2024 18:43:33 +0200 Subject: [PATCH 0683/1171] mac80211: add missing newline for "min_tx_power" This prevents min_tx_power from functioning properly in some circumstances. Add the missing newline. Signed-off-by: Rany Hany (cherry picked from commit 6ca8752a9cadac810f8541ec1be67d02265175aa) --- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 1bf4db6e5f0554..b5378e556eb232 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -145,7 +145,7 @@ mac80211_hostapd_setup_base() { [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ channel_list="$channel" - [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" + [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N" set_default noscan 0 From 8ce87267ba1f79c3e6e358488ff7e1d4b976c7b7 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Fri, 15 Dec 2023 17:15:47 +0100 Subject: [PATCH 0684/1171] ramips: mtk_eth_soc: allow multiple resets Use devm_reset_control_array_get_exclusive to register multiple reset lines in FE driver. This is required to reattach ESW reset to FE driver again, based on device tree bindings. While at that, remove unused fe_priv.rst_ppe field, and add error message if getting the reset fails. Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Co-developed-by: Maxim Anisimov Signed-off-by: Maxim Anisimov [Split out of the bigger commit, provide commit mesage, refactor error handling] Signed-off-by: Lech Perczak (cherry picked from commit 3f1be8edee29fe79fc33c88cbd9d647a490410e5) Signed-off-by: Lech Perczak --- .../drivers/net/ethernet/ralink/mtk_eth_soc.c | 14 ++++++++------ .../drivers/net/ethernet/ralink/mtk_eth_soc.h | 3 +-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index b79b34893808c2..78b17605d276c7 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -143,12 +143,12 @@ void fe_reset(u32 reset_bits) void fe_reset_fe(struct fe_priv *priv) { - if (!priv->rst_fe) + if (!priv->resets) return; - reset_control_assert(priv->rst_fe); + reset_control_assert(priv->resets); usleep_range(60, 120); - reset_control_deassert(priv->rst_fe); + reset_control_deassert(priv->resets); usleep_range(60, 120); } @@ -1595,9 +1595,11 @@ static int fe_probe(struct platform_device *pdev) priv = netdev_priv(netdev); spin_lock_init(&priv->page_lock); - priv->rst_fe = devm_reset_control_get(&pdev->dev, "fe"); - if (IS_ERR(priv->rst_fe)) - priv->rst_fe = NULL; + priv->resets = devm_reset_control_array_get_exclusive(&pdev->dev); + if (IS_ERR(priv->resets)) { + dev_err(&pdev->dev, "Failed to get resets for FE and ESW cores: %pe\n", priv->resets); + priv->resets = NULL; + } if (soc->init_data) soc->init_data(soc, netdev); diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h index 968db366cfafd3..892ffb21262494 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h @@ -497,8 +497,7 @@ struct fe_priv { struct work_struct pending_work; DECLARE_BITMAP(pending_flags, FE_FLAG_MAX); - struct reset_control *rst_ppe; - struct reset_control *rst_fe; + struct reset_control *resets; struct mtk_foe_entry *foe_table; dma_addr_t foe_table_phys; struct flow_offload __rcu **foe_flow_table; From 289515e003d1b0b0c9d3f2650aff53e0962d0cea Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Sun, 10 Dec 2023 16:27:32 +0100 Subject: [PATCH 0685/1171] ramips: mtk_eth_soc: wait longer after FE core reset to settle Enabling the FE core too early causes the system to hang during boot uncondtionally, after the reset is released. Increate it to 1-1.2ms range. Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Signed-off-by: Maxim Anisimov [Split previous commit, provide rationale] Signed-off-by: Lech Perczak (cherry picked from commit 7eb0458c1f7e4f681b16d2721cfc3fcb69774c95) Signed-off-by: Lech Perczak --- .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index 78b17605d276c7..dab8a173f75e3a 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -149,7 +149,7 @@ void fe_reset_fe(struct fe_priv *priv) reset_control_assert(priv->resets); usleep_range(60, 120); reset_control_deassert(priv->resets); - usleep_range(60, 120); + usleep_range(1000, 1200); } static inline void fe_int_disable(u32 mask) From 88501f82f52a3186f676e8f49a4a92d90642f936 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Fri, 8 Dec 2023 08:34:30 +0300 Subject: [PATCH 0686/1171] ramips: dts: rt3352: reset FE and ESW cores together Failing to do so will cause the DMA engine to not initialize properly and fail to forward packets between them, and in some cases will cause spurious transmission with size exceeding allowed packet size, causing a kernel panic. Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Signed-off-by: Maxim Anisimov [Provide commit description, split into logical changes] Signed-off-by: Lech Perczak (cherry picked from commit 8d75b1de0ff7b9e9e0138f822a5475bb8ad7fedf) Signed-off-by: Lech Perczak --- target/linux/ramips/dts/rt3352.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/dts/rt3352.dtsi b/target/linux/ramips/dts/rt3352.dtsi index 608222cb5c96a5..f484d7816ce93f 100644 --- a/target/linux/ramips/dts/rt3352.dtsi +++ b/target/linux/ramips/dts/rt3352.dtsi @@ -318,8 +318,8 @@ compatible = "ralink,rt3352-eth", "ralink,rt3050-eth"; reg = <0x10100000 0x10000>; - resets = <&rstctrl 21>; - reset-names = "fe"; + resets = <&rstctrl 21>, <&rstctrl 23>; + reset-names = "fe", "esw"; interrupt-parent = <&cpuintc>; interrupts = <5>; @@ -331,8 +331,8 @@ compatible = "ralink,rt3352-esw", "ralink,rt3050-esw"; reg = <0x10110000 0x8000>; - resets = <&rstctrl 23 &rstctrl 24>; - reset-names = "esw", "ephy"; + resets = <&rstctrl 24>; + reset-names = "ephy"; interrupt-parent = <&intc>; interrupts = <17>; From 4e1bf2a50c43b48f9e47c7cdff87a0dcfa998bb8 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 12 Dec 2023 00:22:04 +0100 Subject: [PATCH 0687/1171] ramips: dts: rt3050: reset FE and ESW cores together Failing to do so will cause the DMA engine to not initialize properly and fail to forward packets between them, and in some cases will cause spurious transmission with size exceeding allowed packet size, causing a kernel panic. This is behaviour of downstream driver as well, however I haven't observed bug reports about this SoC in the wild, so this commit's purpose is to align this chip with all other SoC's - MT7620 were already using this arrangement. Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Signed-off-by: Lech Perczak (cherry picked from commit c5a399f372535886582f89f3da624ae7465c8ff4) Signed-off-by: Lech Perczak --- target/linux/ramips/dts/rt3050.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/dts/rt3050.dtsi b/target/linux/ramips/dts/rt3050.dtsi index 492474fdc43f74..6077dd50085c5f 100644 --- a/target/linux/ramips/dts/rt3050.dtsi +++ b/target/linux/ramips/dts/rt3050.dtsi @@ -306,8 +306,8 @@ compatible = "ralink,rt3050-eth"; reg = <0x10100000 0x10000>; - resets = <&rstctrl 21>; - reset-names = "fe"; + resets = <&rstctrl 21>, <&rstctrl 23>; + reset-names = "fe", "esw"; interrupt-parent = <&cpuintc>; interrupts = <5>; @@ -319,8 +319,8 @@ compatible = "ralink,rt3050-esw"; reg = <0x10110000 0x8000>; - resets = <&rstctrl 23 &rstctrl 24>; - reset-names = "esw", "ephy"; + resets = <&rstctrl 24>; + reset-names = "ephy"; interrupt-parent = <&intc>; interrupts = <17>; From ee4a042483d28f1c866614ea8e7307d18a74af73 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 12 Dec 2023 00:25:02 +0100 Subject: [PATCH 0688/1171] ramips: dts: rt5350: reset FE and ESW cores together Failing to do so will cause the DMA engine to not initialize properly and fail to forward packets between them, and in some cases will cause spurious transmission with size exceeding allowed packet size, causing a kernel panic. This is behaviour of downstream driver as well, however I haven't observed bug reports about this SoC in the wild, so this commit's purpose is to align this chip with all other SoC's - MT7620 were already using this arrangement. Fixes: #9284 Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Signed-off-by: Lech Perczak (cherry picked from commit fc92fecfc7ddf19bbfd7d1305a29c666f00543af) Signed-off-by: Lech Perczak --- target/linux/ramips/dts/rt5350.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/dts/rt5350.dtsi b/target/linux/ramips/dts/rt5350.dtsi index 090e755743bacd..fe43de87cae962 100644 --- a/target/linux/ramips/dts/rt5350.dtsi +++ b/target/linux/ramips/dts/rt5350.dtsi @@ -343,8 +343,8 @@ compatible = "ralink,rt5350-eth"; reg = <0x10100000 0x10000>; - resets = <&rstctrl 21>; - reset-names = "fe"; + resets = <&rstctrl 21>, <&rstctrl 23>; + reset-names = "fe", "esw"; interrupt-parent = <&cpuintc>; interrupts = <5>; @@ -356,8 +356,8 @@ compatible = "ralink,rt5350-esw", "ralink,rt3050-esw"; reg = <0x10110000 0x8000>; - resets = <&rstctrl 23 &rstctrl 24>; - reset-names = "esw", "ephy"; + resets = <&rstctrl 24>; + reset-names = "ephy"; interrupt-parent = <&intc>; interrupts = <17>; From 0128d860a0724514256e1a31e24f0515a7b7bd0e Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Sun, 10 Dec 2023 16:40:39 +0100 Subject: [PATCH 0689/1171] ramips: dts: mt7628an: reset FE and ESW cores together Failing to do so will cause the DMA engine to not initialize properly and fail to forward packets between them, and in some cases will cause spurious transmission with size exceeding allowed packet size, causing a kernel panic. Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Signed-off-by: Maxim Anisimov [Provide commit description, split into logical changes] Signed-off-by: Lech Perczak (cherry picked from commit f87b66507e9245e6e02dbc76e2e7b27c9e0bf364) Signed-off-by: Lech Perczak --- target/linux/ramips/dts/mt7628an.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an.dtsi b/target/linux/ramips/dts/mt7628an.dtsi index 8ef73dce80a406..788e24714f1ed5 100644 --- a/target/linux/ramips/dts/mt7628an.dtsi +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -429,8 +429,8 @@ interrupt-parent = <&cpuintc>; interrupts = <5>; - resets = <&rstctrl 21>; - reset-names = "fe"; + resets = <&rstctrl 21>, <&rstctrl 23>; + reset-names = "fe", "esw"; mediatek,switch = <&esw>; }; @@ -439,8 +439,8 @@ compatible = "mediatek,mt7628-esw", "ralink,rt3050-esw"; reg = <0x10110000 0x8000>; - resets = <&rstctrl 23 &rstctrl 24>; - reset-names = "esw", "ephy"; + resets = <&rstctrl 24>; + reset-names = "ephy"; interrupt-parent = <&intc>; interrupts = <17>; From 23506e7789ab4890abf1a6465df1352d459562d9 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Fri, 15 Dec 2023 17:25:05 +0100 Subject: [PATCH 0690/1171] raimps: mtk_eth_soc: drop rst_esw from ESW driver The ESW core needs to be reset together with FE core, so after the relevant reset controller lines are moved under FE, drop rst_esw and all related code, which would not execute anyway, because rst_esw would be NULL. While at that, ensure that if reset line for EPHY cannot be claimed, a proper error message is reported. Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Co-developed-by: Maxim Anisimov Signed-off-by: Maxim Anisimov [Split out of the bigger commit, provide commit mesage, refactor error handling] Signed-off-by: Lech Perczak (cherry picked from commit f393ffcac163926bf9dbbda47c25cc7809952609) Signed-off-by: Lech Perczak --- .../drivers/net/ethernet/ralink/esw_rt3050.c | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c index 47471eb1973e8e..5a36652a11679c 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c @@ -237,7 +237,6 @@ struct rt305x_esw { int led_frequency; struct esw_vlan vlans[RT305X_ESW_NUM_VLANS]; struct esw_port ports[RT305X_ESW_NUM_PORTS]; - struct reset_control *rst_esw; struct reset_control *rst_ephy; }; @@ -261,18 +260,6 @@ static inline void esw_rmw_raw(struct rt305x_esw *esw, unsigned reg, __raw_writel(t | val, esw->base + reg); } -static void esw_reset(struct rt305x_esw *esw) -{ - if (!esw->rst_esw) - return; - - reset_control_assert(esw->rst_esw); - usleep_range(60, 120); - reset_control_deassert(esw->rst_esw); - /* the esw takes long to reset otherwise the board hang */ - msleep(10); -} - static void esw_reset_ephy(struct rt305x_esw *esw) { if (!esw->rst_ephy) @@ -466,8 +453,6 @@ static void esw_hw_init(struct rt305x_esw *esw) u8 port_disable = 0; u8 port_map = RT305X_ESW_PMAP_LLLLLL; - esw_reset(esw); - /* vodoo from original driver */ esw_w32(esw, 0xC8A07850, RT305X_ESW_REG_FCT0); esw_w32(esw, 0x00000000, RT305X_ESW_REG_SGC2); @@ -1441,12 +1426,11 @@ static int esw_probe(struct platform_device *pdev) if (reg_init) esw->reg_led_source = be32_to_cpu(*reg_init); - esw->rst_esw = devm_reset_control_get(&pdev->dev, "esw"); - if (IS_ERR(esw->rst_esw)) - esw->rst_esw = NULL; - esw->rst_ephy = devm_reset_control_get(&pdev->dev, "ephy"); - if (IS_ERR(esw->rst_ephy)) + esw->rst_ephy = devm_reset_control_get_exclusive(&pdev->dev, "ephy"); + if (IS_ERR(esw->rst_ephy)) { + dev_err(esw->dev, "failed to get EPHY reset: %pe\n", esw->rst_ephy); esw->rst_ephy = NULL; + } spin_lock_init(&esw->reg_rw_lock); platform_set_drvdata(pdev, esw); From 76f7dd331222835983ebe570c1828c468cea95a5 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 5 Dec 2023 18:36:42 -0500 Subject: [PATCH 0691/1171] ramips: lzma-loader: use virtual memory segments for uart base address The native bus address for UART was entered for rt305x UART_BASE, but the bootloaders have memory space remapped with the same virtual memory map the kernel uses for program addressing at boot time. In UBoot, the remapped address is often defined as TEXT_BASE. In the kernel, for rt305x this remapped address is RT305X_SYSC_BASE. (arch/mips/include/asm/mach-ralink/rt305x.h) Because the ralink I/O busses begin at a low address of 0x10000000, they are remapped using KSEG0 or KSEG1, which for all 32-bit MIPS SOCs (arch/mips/include/asm/addrspace.h) are offsets of 0x80000000 and 0xa0000000 respectively. This is consistent with the other UART_BASE macros here and with MIPS memory map documentation. Before the recent rework of the lzma-loader for ramips, the original board-$(PLATFORM).c files also did not use KSEG1ADDR for UART_BASE despite being defined, which made this mistake easier to occur. Fix this by defining KSEG1ADDR again and actually use it. Copy and paste from the kernel's macros for consistency. Link: https://training.mips.com/basic_mips/PDF/Memory_Map.pdf Fixes: c31319b66 ("ramips: lzma-loader: Refactor loader") Reported-by: Lech Perczak Signed-off-by: Michael Pratt (cherry picked from commit 4c1e9bd8581e01793b26f3bc964975311450ece0) Signed-off-by: Lech Perczak --- .../ramips/image/lzma-loader/src/board.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/image/lzma-loader/src/board.c b/target/linux/ramips/image/lzma-loader/src/board.c index ae9da380738b90..050ef695f9a49e 100644 --- a/target/linux/ramips/image/lzma-loader/src/board.c +++ b/target/linux/ramips/image/lzma-loader/src/board.c @@ -11,19 +11,33 @@ */ #include +#include + +#define KSEG0 0x80000000 +#define KSEG1 0xa0000000 + +#define _ATYPE_ __PTRDIFF_TYPE__ +#define _ATYPE32_ int + +#define _ACAST32_ (_ATYPE_)(_ATYPE32_) + +#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) + +#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0) +#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1) #if defined(SOC_MT7620) || defined(SOC_RT3883) -#define UART_BASE 0xb0000c00 +#define UART_BASE KSEG1ADDR(0x10000c00) #define UART_THR (UART_BASE + 0x04) #define UART_LSR (UART_BASE + 0x1c) #define UART_LSR_THRE_MASK 0x40 #elif defined(SOC_MT7621) -#define UART_BASE 0xbe000c00 +#define UART_BASE KSEG1ADDR(0x1e000c00) #define UART_THR (UART_BASE + 0x00) #define UART_LSR (UART_BASE + 0x14) #define UART_LSR_THRE_MASK 0x20 #elif defined(SOC_RT305X) -#define UART_BASE 0x10000500 +#define UART_BASE KSEG1ADDR(0x10000500) #define UART_THR (UART_BASE + 0x04) #define UART_LSR (UART_BASE + 0x1c) #define UART_LSR_THRE_MASK 0x20 From 2216b10ebbf45849f69b46650d8bf4b59d729963 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 6 Dec 2023 14:12:03 -0500 Subject: [PATCH 0692/1171] ramips: lzma-loader: use proper register names Before this was reworked, in the file for mt7621 subtarget (target/linux/ramips/image/lzma-loader/src/board-mt7621.c) the "Transmitter shift register empty" bit TEMT was used instead of the "Transmitter holding register empty" bit THRE, but after the rework, this value was labeled as the THRE bit instead. Functionally there is no difference, but this is confusing to read, as it suggests that the subtargets have different bits for the same register in UART when in reality they are exactly the same. One can use either bit, or both, at user's descretion in order to determine whether the UART TX buffer is ready. The generic kernel early-printk uses both, (arch/mips/kernel/early_printk_8250.c) while the ralink-specific early-printk uses only THRE, (arch/mips/ralink/early_printk.c). Define both bits and rewrite macros for readability, keep the same values, as changing which to use should be tested first. Ref: c31319b66 ("ramips: lzma-loader: Refactor loader") Signed-off-by: Michael Pratt (cherry picked from commit 2e47913c644c59aa25fbac2bc6c4297956406b82) Signed-off-by: Lech Perczak --- target/linux/ramips/image/lzma-loader/src/board.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/image/lzma-loader/src/board.c b/target/linux/ramips/image/lzma-loader/src/board.c index 050ef695f9a49e..9f87cddec71ad3 100644 --- a/target/linux/ramips/image/lzma-loader/src/board.c +++ b/target/linux/ramips/image/lzma-loader/src/board.c @@ -26,21 +26,24 @@ #define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0) #define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1) +#define UART_LSR_THRE 0x20 +#define UART_LSR_TEMT 0x40 + #if defined(SOC_MT7620) || defined(SOC_RT3883) #define UART_BASE KSEG1ADDR(0x10000c00) #define UART_THR (UART_BASE + 0x04) #define UART_LSR (UART_BASE + 0x1c) -#define UART_LSR_THRE_MASK 0x40 +#define UART_LSR_MASK UART_LSR_TEMT #elif defined(SOC_MT7621) #define UART_BASE KSEG1ADDR(0x1e000c00) #define UART_THR (UART_BASE + 0x00) #define UART_LSR (UART_BASE + 0x14) -#define UART_LSR_THRE_MASK 0x20 +#define UART_LSR_MASK UART_LSR_THRE #elif defined(SOC_RT305X) #define UART_BASE KSEG1ADDR(0x10000500) #define UART_THR (UART_BASE + 0x04) #define UART_LSR (UART_BASE + 0x1c) -#define UART_LSR_THRE_MASK 0x20 +#define UART_LSR_MASK UART_LSR_THRE #else #error "Unsupported SOC..." #endif @@ -56,7 +59,7 @@ void board_init(void) void board_putc(int ch) { - while ((READREG(UART_LSR) & UART_LSR_THRE_MASK) == 0); + while ((READREG(UART_LSR) & UART_LSR_MASK) == 0); WRITEREG(UART_THR, ch); - while ((READREG(UART_LSR) & UART_LSR_THRE_MASK) == 0); + while ((READREG(UART_LSR) & UART_LSR_MASK) == 0); } From 9cd589bd79aa94050261abd02f652eabed9396e0 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 6 Dec 2023 14:29:26 -0500 Subject: [PATCH 0693/1171] ramips: lzma-loader: use default uart for rt305x The rt305x series SOC have two UART devices, and the one at bus address 0x500 is disabled by default. Some boards do not even have a pinout for the first one, so use the same one that the kernel uses at 0xc00 instead. This allows the lzma-loader printing to be visible alongside the kernel log in the same console. Tested-by: Lech Perczak # zte,mf283plus Signed-off-by: Michael Pratt (cherry picked from commit bc00c78b4338779ca1b7cd08411f76218d1f3205) Signed-off-by: Lech Perczak --- target/linux/ramips/image/lzma-loader/src/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/image/lzma-loader/src/board.c b/target/linux/ramips/image/lzma-loader/src/board.c index 9f87cddec71ad3..de02f58b9f4813 100644 --- a/target/linux/ramips/image/lzma-loader/src/board.c +++ b/target/linux/ramips/image/lzma-loader/src/board.c @@ -40,7 +40,7 @@ #define UART_LSR (UART_BASE + 0x14) #define UART_LSR_MASK UART_LSR_THRE #elif defined(SOC_RT305X) -#define UART_BASE KSEG1ADDR(0x10000500) +#define UART_BASE KSEG1ADDR(0x10000c00) #define UART_THR (UART_BASE + 0x04) #define UART_LSR (UART_BASE + 0x1c) #define UART_LSR_MASK UART_LSR_THRE From 80ef582deebd13e3a46718f4012947e4b56f31cf Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 25 Dec 2023 11:23:58 +0800 Subject: [PATCH 0694/1171] rockchip: configure eth pad driver strength for orangepi r1 plus lts The default strength is not enough to provide stable connection under 3.3v LDO voltage. Fixes: 3f3586a06d27 ("rockchip: add Orange Pi R1 Plus LTS support") Fixes: #13117 Fixes: #13759 Signed-off-by: Tianling Shen (cherry picked from commit 3645ac8a10d9abb1451343beaf7d65b53eeecffd) [rebased onto openwrt-23.05 branch] Signed-off-by: Tianling Shen --- ...m-Add-pad-drive-strength-cfg-support.patch | 170 ++++++++++++++++++ ...nfigure-eth-pad-driver-strength-for-.patch | 33 ++++ 2 files changed, 203 insertions(+) create mode 100644 target/linux/generic/backport-5.15/791-v6.6-11-net-phy-motorcomm-Add-pad-drive-strength-cfg-support.patch create mode 100644 target/linux/rockchip/patches-5.15/009-v6.8-arm64-dts-rockchip-configure-eth-pad-driver-strength-for-.patch diff --git a/target/linux/generic/backport-5.15/791-v6.6-11-net-phy-motorcomm-Add-pad-drive-strength-cfg-support.patch b/target/linux/generic/backport-5.15/791-v6.6-11-net-phy-motorcomm-Add-pad-drive-strength-cfg-support.patch new file mode 100644 index 00000000000000..010ca9b68aac75 --- /dev/null +++ b/target/linux/generic/backport-5.15/791-v6.6-11-net-phy-motorcomm-Add-pad-drive-strength-cfg-support.patch @@ -0,0 +1,170 @@ +From 7a561e9351ae7e3fb1f08584d40b49c1e55dde60 Mon Sep 17 00:00:00 2001 +From: Samin Guo +Date: Thu, 20 Jul 2023 19:15:09 +0800 +Subject: [PATCH] net: phy: motorcomm: Add pad drive strength cfg support + +The motorcomm phy (YT8531) supports the ability to adjust the drive +strength of the rx_clk/rx_data, and the default strength may not be +suitable for all boards. So add configurable options to better match +the boards.(e.g. StarFive VisionFive 2) + +When we configure the drive strength, we need to read the current +LDO voltage value to ensure that it is a legal value at that LDO +voltage. + +Reviewed-by: Hal Feng +Signed-off-by: Samin Guo +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/motorcomm.c | 118 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 118 insertions(+) + +--- a/drivers/net/phy/motorcomm.c ++++ b/drivers/net/phy/motorcomm.c +@@ -163,6 +163,10 @@ + + #define YT8521_CHIP_CONFIG_REG 0xA001 + #define YT8521_CCR_SW_RST BIT(15) ++#define YT8531_RGMII_LDO_VOL_MASK GENMASK(5, 4) ++#define YT8531_LDO_VOL_3V3 0x0 ++#define YT8531_LDO_VOL_1V8 0x2 ++ + /* 1b0 disable 1.9ns rxc clock delay *default* + * 1b1 enable 1.9ns rxc clock delay + */ +@@ -236,6 +240,12 @@ + */ + #define YTPHY_WCR_TYPE_PULSE BIT(0) + ++#define YTPHY_PAD_DRIVE_STRENGTH_REG 0xA010 ++#define YT8531_RGMII_RXC_DS_MASK GENMASK(15, 13) ++#define YT8531_RGMII_RXD_DS_HI_MASK BIT(12) /* Bit 2 of rxd_ds */ ++#define YT8531_RGMII_RXD_DS_LOW_MASK GENMASK(5, 4) /* Bit 1/0 of rxd_ds */ ++#define YT8531_RGMII_RX_DS_DEFAULT 0x3 ++ + #define YTPHY_SYNCE_CFG_REG 0xA012 + #define YT8521_SCR_SYNCE_ENABLE BIT(5) + /* 1b0 output 25m clock +@@ -835,6 +845,110 @@ static int ytphy_rgmii_clk_delay_config_ + } + + /** ++ * struct ytphy_ldo_vol_map - map a current value to a register value ++ * @vol: ldo voltage ++ * @ds: value in the register ++ * @cur: value in device configuration ++ */ ++struct ytphy_ldo_vol_map { ++ u32 vol; ++ u32 ds; ++ u32 cur; ++}; ++ ++static const struct ytphy_ldo_vol_map yt8531_ldo_vol[] = { ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 0, .cur = 1200}, ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 1, .cur = 2100}, ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 2, .cur = 2700}, ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 3, .cur = 2910}, ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 4, .cur = 3110}, ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 5, .cur = 3600}, ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 6, .cur = 3970}, ++ {.vol = YT8531_LDO_VOL_1V8, .ds = 7, .cur = 4350}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 0, .cur = 3070}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 1, .cur = 4080}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 2, .cur = 4370}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 3, .cur = 4680}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 4, .cur = 5020}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 5, .cur = 5450}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 6, .cur = 5740}, ++ {.vol = YT8531_LDO_VOL_3V3, .ds = 7, .cur = 6140}, ++}; ++ ++static u32 yt8531_get_ldo_vol(struct phy_device *phydev) ++{ ++ u32 val; ++ ++ val = ytphy_read_ext_with_lock(phydev, YT8521_CHIP_CONFIG_REG); ++ val = FIELD_GET(YT8531_RGMII_LDO_VOL_MASK, val); ++ ++ return val <= YT8531_LDO_VOL_1V8 ? val : YT8531_LDO_VOL_1V8; ++} ++ ++static int yt8531_get_ds_map(struct phy_device *phydev, u32 cur) ++{ ++ u32 vol; ++ int i; ++ ++ vol = yt8531_get_ldo_vol(phydev); ++ for (i = 0; i < ARRAY_SIZE(yt8531_ldo_vol); i++) { ++ if (yt8531_ldo_vol[i].vol == vol && yt8531_ldo_vol[i].cur == cur) ++ return yt8531_ldo_vol[i].ds; ++ } ++ ++ return -EINVAL; ++} ++ ++static int yt8531_set_ds(struct phy_device *phydev) ++{ ++ struct device_node *node = phydev->mdio.dev.of_node; ++ u32 ds_field_low, ds_field_hi, val; ++ int ret, ds; ++ ++ /* set rgmii rx clk driver strength */ ++ if (!of_property_read_u32(node, "motorcomm,rx-clk-drv-microamp", &val)) { ++ ds = yt8531_get_ds_map(phydev, val); ++ if (ds < 0) ++ return dev_err_probe(&phydev->mdio.dev, ds, ++ "No matching current value was found.\n"); ++ } else { ++ ds = YT8531_RGMII_RX_DS_DEFAULT; ++ } ++ ++ ret = ytphy_modify_ext_with_lock(phydev, ++ YTPHY_PAD_DRIVE_STRENGTH_REG, ++ YT8531_RGMII_RXC_DS_MASK, ++ FIELD_PREP(YT8531_RGMII_RXC_DS_MASK, ds)); ++ if (ret < 0) ++ return ret; ++ ++ /* set rgmii rx data driver strength */ ++ if (!of_property_read_u32(node, "motorcomm,rx-data-drv-microamp", &val)) { ++ ds = yt8531_get_ds_map(phydev, val); ++ if (ds < 0) ++ return dev_err_probe(&phydev->mdio.dev, ds, ++ "No matching current value was found.\n"); ++ } else { ++ ds = YT8531_RGMII_RX_DS_DEFAULT; ++ } ++ ++ ds_field_hi = FIELD_GET(BIT(2), ds); ++ ds_field_hi = FIELD_PREP(YT8531_RGMII_RXD_DS_HI_MASK, ds_field_hi); ++ ++ ds_field_low = FIELD_GET(GENMASK(1, 0), ds); ++ ds_field_low = FIELD_PREP(YT8531_RGMII_RXD_DS_LOW_MASK, ds_field_low); ++ ++ ret = ytphy_modify_ext_with_lock(phydev, ++ YTPHY_PAD_DRIVE_STRENGTH_REG, ++ YT8531_RGMII_RXD_DS_LOW_MASK | YT8531_RGMII_RXD_DS_HI_MASK, ++ ds_field_low | ds_field_hi); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++/** + * yt8521_probe() - read chip config then set suitable polling_mode + * @phydev: a pointer to a &struct phy_device + * +@@ -1518,6 +1632,10 @@ static int yt8531_config_init(struct phy + return ret; + } + ++ ret = yt8531_set_ds(phydev); ++ if (ret < 0) ++ return ret; ++ + return 0; + } + diff --git a/target/linux/rockchip/patches-5.15/009-v6.8-arm64-dts-rockchip-configure-eth-pad-driver-strength-for-.patch b/target/linux/rockchip/patches-5.15/009-v6.8-arm64-dts-rockchip-configure-eth-pad-driver-strength-for-.patch new file mode 100644 index 00000000000000..01efaa3a9dbe94 --- /dev/null +++ b/target/linux/rockchip/patches-5.15/009-v6.8-arm64-dts-rockchip-configure-eth-pad-driver-strength-for-.patch @@ -0,0 +1,33 @@ +From fc5a80a432607d05e85bba37971712405f75c546 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Sat, 16 Dec 2023 12:07:23 +0800 +Subject: [PATCH] arm64: dts: rockchip: configure eth pad driver strength + for orangepi r1 plus lts + +The default strength is not enough to provide stable connection +under 3.3v LDO voltage. + +Fixes: 387b3bbac5ea ("arm64: dts: rockchip: Add Xunlong OrangePi R1 Plus LTS") +Cc: stable@vger.kernel.org # 6.6+ +Signed-off-by: Tianling Shen +Link: https://lore.kernel.org/r/20231216040723.17864-1-cnsztl@gmail.com +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus-lts.dts | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus-lts.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus-lts.dts +@@ -26,9 +26,11 @@ + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + ++ motorcomm,auto-sleep-disabled; + motorcomm,clk-out-frequency-hz = <125000000>; + motorcomm,keep-pll-enabled; +- motorcomm,auto-sleep-disabled; ++ motorcomm,rx-clk-drv-microamp = <5020>; ++ motorcomm,rx-data-drv-microamp = <5020>; + + pinctrl-0 = <ð_phy_reset_pin>; + pinctrl-names = "default"; From e61d651053ceb901d360ce175b0b11dfbe4c054d Mon Sep 17 00:00:00 2001 From: David Bentham Date: Sat, 6 Jan 2024 11:58:08 +0000 Subject: [PATCH 0695/1171] ramips: correct the PCIe port number for Unielec u7621-01 MT7621 gets a new PCIe driver in the 5.15+ kernel. Allocating wrong PCIe port will cause the PCIe NIC to not work properly. This commit fixes the wrong port numbers on Unielec u7621-01. According to the bootlog, MT7612E (5 GHz) is connected to pcie2, and MT7603E (2 GHz) is connected to pcie1: [ 1.294844] mt7621-pci 1e140000.pcie: pcie0 no card, disable it (RST & CLK) [ 1.308635] mt7621-pci 1e140000.pcie: PCIE1 enabled [ 1.318277] mt7621-pci 1e140000.pcie: PCIE2 enabled Also correct the led activity for the MT7603e - not used on the MT7612e Signed-off-by: David Bentham (cherry picked from commit 39e55bdbe27a09579658178796a9b732e126e703) Signed-off-by: David Bentham --- .../linux/ramips/dts/mt7621_unielec_u7621-01.dtsi | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi b/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi index f2900e48060be2..863f091e553bdb 100644 --- a/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi @@ -50,25 +50,24 @@ status = "okay"; }; -&pcie0 { +&pcie1 { // MT7603EN wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; + + led { + led-active-low; + }; }; }; -&pcie1 { +&pcie2 { // MT7612E wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; - - led { - led-sources = <2>; - }; }; }; From 34e30fb53ac00f446431cb33a5439c6544527c51 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 7 Jan 2024 12:12:05 +0100 Subject: [PATCH 0696/1171] firmware-utils: bump to latest openwrt-23.05 Contains two backported device suppport updates: - 9afd8f42bd23 "tplink-safeloader: bump EAP615-Wall compat_level" - 8cad449bdb5c "add dlink-sge-image for D-Link devices by SGE" Signed-off-by: Sander Vanheule --- tools/firmware-utils/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 72103411677531..670aef2e68c0f8 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2023-06-29 -PKG_SOURCE_VERSION:=9e2de8515be15e2b61ae518ce592e5b446ef2d48 -PKG_MIRROR_HASH:=e43d1796dd482ec364e5196f224bb1563dbb0494f0f28fb4e206ef7ef31260fb +PKG_SOURCE_DATE:=2024-01-07 +PKG_SOURCE_VERSION:=9afd8f42bd2390ae95b30e756d310820393811ef +PKG_MIRROR_HASH:=ae30305d09f7e8d73d9004bb186f8e5e54055b26ce52cebb8d54beef71c93733 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From b54f7105df2b07b4d955a1e087d7637905a0ad95 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 7 Jan 2024 12:54:06 +0100 Subject: [PATCH 0697/1171] firmware-utils: move patch to maintaince branch Patch "firmware-utils: ptgen: add SiFive GPT partition support" was included as a separate change in 23.05. Now that we have a maintenance branch for firmware-utils, the patch can be backported there and included with other changes. Signed-off-by: Sander Vanheule --- tools/firmware-utils/Makefile | 4 +- .../patches/001-add-sifiveu-guid-types.patch | 38 ------------------- 2 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 670aef2e68c0f8..bec4f9fb0c903b 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -12,8 +12,8 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git PKG_SOURCE_DATE:=2024-01-07 -PKG_SOURCE_VERSION:=9afd8f42bd2390ae95b30e756d310820393811ef -PKG_MIRROR_HASH:=ae30305d09f7e8d73d9004bb186f8e5e54055b26ce52cebb8d54beef71c93733 +PKG_SOURCE_VERSION:=40da9034bb4926ef04ec95c3fd38d850aed68142 +PKG_MIRROR_HASH:=ee1694d4cddba32e32fcba85aeeaed6c5524e06ed29fca9d56cc466097aaa6f9 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk diff --git a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch b/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch deleted file mode 100644 index 45900e982c9c4c..00000000000000 --- a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff -ruN firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c firmware-utils-2022-02-28-002cfaf0/src/ptgen.c ---- firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c 2022-04-23 19:02:07.307896842 +0200 -+++ firmware-utils-2022-02-28-002cfaf0/src/ptgen.c 2022-04-22 18:48:54.477970950 +0200 -@@ -82,6 +82,14 @@ - GUID_INIT( 0x0fc63daf, 0x8483, 0x4772, \ - 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4) - -+#define GUID_PARTITION_SIFIVE_SPL \ -+ GUID_INIT( 0x5b193300, 0xfc78, 0x40cd, \ -+ 0x80, 0x02, 0xe8, 0x6c, 0x45, 0x58, 0x0b, 0x47) -+ -+#define GUID_PARTITION_SIFIVE_UBOOT \ -+ GUID_INIT( 0x2e54b353, 0x1271, 0x4842, \ -+ 0x80, 0x6f, 0xe4, 0x36, 0xd6, 0xaf, 0x69, 0x85) -+ - #define GPT_HEADER_SIZE 92 - #define GPT_ENTRY_SIZE 128 - #define GPT_ENTRY_MAX 128 -@@ -276,6 +284,19 @@ - (1ULL << 56); /* success=1 */ - return true; - } -+ -+ if (!strcmp(type, "sifiveu_spl")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_SPL; -+ return true; -+ } -+ -+ if (!strcmp(type, "sifiveu_uboot")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_UBOOT; -+ return true; -+ } -+ - return false; - } - From 67d998e25dbbd9c809cc50dfe750633ae5b9f84e Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 23 Dec 2023 06:52:06 -0500 Subject: [PATCH 0698/1171] kernel: bump 5.15 to 5.15.145 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.145 No patches needed a rebase. 23.05 backport: Rebased patch mediatek/100-dts-update-mt7622-rfb1.patch due to changes introduced in commit e37aa926447f ("arm64: dts: mediatek: mt7622: fix memory node warning check") in version v5.15.143 and we jumped over from v5.15.139 directly to v5.15.145. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 23.05 backport: Stijn: Compile-tested: ath79/generic, ipq40xx/generic, mvebu/cortexa72, ramips/mt{7621,7620,76x8}, realtek/rtl{838x,930x}, 86/64. Run-tested: cortexa72 (RB5009UG+S+IN), mt7621 (EAP615-Wall v1), rtl838x (GS1900-10HP, GS1900-8HP, GS108T v3). Petr: Compile-tested: ipq807x, mvebu/cortexa9 Run-tested: turris-omnia, prpl-haze Tested-by: Stijn Segers [23.05 testing] Signed-off-by: John Audia Signed-off-by: Petr Štetiar [23.05 refresh] (cherry picked from commit 8de4cc77a6d5c25e48566d0203f159287ac7f3fe) --- include/kernel-5.15 | 4 +- .../910-unaligned_access_hacks.patch | 8 +- ...1-Don-t-use-DT-aliases-for-numbering.patch | 2 +- ...0057-amba_pl011-Round-input-clock-up.patch | 10 +- ...-Insert-mb-for-correct-FIFO-handling.patch | 2 +- ...Add-cts-event-workaround-DT-property.patch | 2 +- ...011-Avoid-rare-write-when-full-error.patch | 2 +- ...070-MMC-added-alternative-MMC-driver.patch | 8 +- ...is7xx-Don-t-spin-if-no-data-received.patch | 4 +- ...ce-quirks-for-Freeway-Airmouse-T3-an.patch | 6 +- ...6is7xx-Fix-for-hardware-flow-control.patch | 4 +- ...-interface-in-mode6-for-18-bit-color.patch | 2 +- ...-Add-a-timing-for-the-Raspberry-Pi-7.patch | 4 +- ...nel-simple-add-Geekworm-MZP280-Panel.patch | 2 +- ...do-single-sector-reads-during-recove.patch | 2 +- ...-x86-arm64-add-arch_has_hw_pte_young.patch | 2 +- ...-v6.1-05-mm-multi-gen-LRU-groundwork.patch | 4 +- ...lti-gen-LRU-support-page-table-walks.patch | 4 +- ...-gen-LRU-per-node-lru_gen_page-lists.patch | 8 +- ...-users-of-bitmap_foo-to-linkmode_foo.patch | 6 +- ...mac_select_pcs-method-to-phylink_mac.patch | 4 +- ...-fix-DSA-mac_select_pcs-introduction.patch | 2 +- ...icro-stmmac-move-queue-reset-to-dedi.patch | 16 +- ...icro-stmmac-first-disable-all-queues.patch | 4 +- ...icro-stmmac-move-dma-conf-to-dedicat.patch | 196 +++---- ...icro-stmmac-generate-stmmac-dma-conf.patch | 114 ++-- ...icro-stmmac-permit-MTU-change-with-i.patch | 4 +- ...k-add-pcs_enable-pcs_disable-methods.patch | 10 +- ..._wwan-add-ZTE-MF286D-modem-19d2-1485.patch | 2 +- ...Support-public-address-configuration.patch | 4 +- ...Fix-application-of-sizeof-to-pointer.patch | 2 +- ...Add-a-new-PID-VID-13d3-3567-for-MT79.patch | 2 +- ...Add-a-new-PID-VID-0489-e0c8-for-MT79.patch | 2 +- ...Add-a-new-VID-PID-0e8d-0608-for-MT79.patch | 2 +- ...-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch | 2 +- ...-r8152-add-LED-configuration-from-OF.patch | 8 +- .../780-usb-net-MeigLink_modem_support.patch | 4 +- .../795-backport-phylink_pcs-helpers.patch | 4 +- .../800-GPIO-add-named-gpio-exports.patch | 6 +- .../300-mips_expose_boot_raw.patch | 4 +- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- .../pending-5.15/920-mangle_bootargs.patch | 4 +- .../420-firmware-qcom-scm-disable-SDI.patch | 4 +- ...-firmware-qcom-scm-cold-boot-address.patch | 2 +- ...qcom_scm-Clear-download-bit-during-r.patch | 2 +- ...Mangle-bootloader-s-kernel-arguments.patch | 2 +- ...stmmac-Use-hrtimer-for-TX-coalescing.patch | 22 +- ...lk-qcom-ipq8074-add-PPE-crypto-clock.patch | 4 +- ...-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch | 6 +- ...-qcom-ipq8074-convert-to-parent-data.patch | 516 +++++++++--------- ...pq8074-add-missing-networking-resets.patch | 2 +- ...074-populate-fw_name-for-all-parents.patch | 20 +- ...3_RELATED-DBI-definitions-to-common-.patch | 2 +- ...8074-rework-nss_port5-6-clock-to-mul.patch | 8 +- .../0118-clk-qcom-Add-WCSSAON-reset.patch | 2 +- ...q8074-populate-fw_name-for-usb3phy-s.patch | 4 +- .../lantiq/patches-5.15/0152-lantiq-VPE.patch | 2 +- ...001-Disable-write-buffer-functions-i.patch | 4 +- .../100-dts-update-mt7622-rfb1.patch | 2 +- .../113-dts-fix-bpi64-leds-and-buttons.patch | 2 +- ...move-drivers-from-strlcpy-to-strscpy.patch | 6 +- .../901-arm-add-cmdline-override.patch | 2 +- ...Mangle-bootloader-s-kernel-arguments.patch | 2 +- .../100-mips_image_cmdline_hack.patch | 2 +- ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 2 +- ...Mangle-bootloader-s-kernel-arguments.patch | 2 +- ...y-simplify-phy_link_change-arguments.patch | 2 +- .../300-mips-add-rtl838x-platform.patch | 2 +- ...vers-net-phy-eee-support-for-rtl838x.patch | 6 +- 69 files changed, 558 insertions(+), 558 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 30ee7cd866aac5..2948d10bdc34b5 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .139 -LINUX_KERNEL_HASH-5.15.139 = 9c68c10dfe18e59b892e940436dea6a18d167160d55e62563cf7282244d8044e +LINUX_VERSION-5.15 = .145 +LINUX_KERNEL_HASH-5.15.145 = b2a49d87605f3a9491581150315e22337c1afb599efc1e2737481be3a2d6d620 diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 84723add3b8aaf..7bd6ae8b5606a9 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -589,15 +589,15 @@ SVN-Revision: 35130 * XXX skbs on the gro_list have all been parsed and pulled --- a/include/net/addrconf.h +++ b/include/net/addrconf.h -@@ -47,7 +47,7 @@ struct prefix_info { +@@ -52,7 +52,7 @@ struct prefix_info { __be32 reserved2; struct in6_addr prefix; -}; +} __attribute__((packed, aligned(2))); - #include - #include + /* rfc4861 4.6.2: IPv6 PIO is 32 bytes in size */ + static_assert(sizeof(struct prefix_info) == 32); --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -138,9 +138,9 @@ static inline int IP6_ECN_set_ce(struct @@ -750,7 +750,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4171,14 +4171,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4175,14 +4175,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-5.15/950-0056-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch b/target/linux/bcm27xx/patches-5.15/950-0056-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch index 3c90882138f221..14f4ee66eff33f 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0056-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0056-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch @@ -14,7 +14,7 @@ use the same logic. --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -2756,7 +2756,12 @@ static int pl011_setup_port(struct devic +@@ -2752,7 +2752,12 @@ static int pl011_setup_port(struct devic if (IS_ERR(base)) return PTR_ERR(base); diff --git a/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch b/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch index 632862908d92b5..416df594accef6 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -1730,6 +1730,23 @@ static void pl011_put_poll_char(struct u +@@ -1726,6 +1726,23 @@ static void pl011_put_poll_char(struct u #endif /* CONFIG_CONSOLE_POLL */ @@ -50,7 +50,7 @@ Signed-off-by: Phil Elwell static int pl011_hwinit(struct uart_port *port) { struct uart_amba_port *uap = -@@ -1746,7 +1763,7 @@ static int pl011_hwinit(struct uart_port +@@ -1742,7 +1759,7 @@ static int pl011_hwinit(struct uart_port if (retval) return retval; @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell /* Clear pending error and receive interrupts */ pl011_write(UART011_OEIS | UART011_BEIS | UART011_PEIS | -@@ -2452,7 +2469,7 @@ static int pl011_console_setup(struct co +@@ -2448,7 +2465,7 @@ static int pl011_console_setup(struct co plat->init(); } @@ -68,7 +68,7 @@ Signed-off-by: Phil Elwell if (uap->vendor->fixed_options) { baud = uap->fixed_baud; -@@ -2669,6 +2686,7 @@ static struct uart_driver amba_reg = { +@@ -2665,6 +2682,7 @@ static struct uart_driver amba_reg = { .cons = AMBA_CONSOLE, }; @@ -76,7 +76,7 @@ Signed-off-by: Phil Elwell static int pl011_probe_dt_alias(int index, struct device *dev) { struct device_node *np; -@@ -2700,6 +2718,7 @@ static int pl011_probe_dt_alias(int inde +@@ -2696,6 +2714,7 @@ static int pl011_probe_dt_alias(int inde return ret; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch b/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch index beb2c67e39c3ae..90507846024898 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -1435,6 +1435,7 @@ static bool pl011_tx_char(struct uart_am +@@ -1431,6 +1431,7 @@ static bool pl011_tx_char(struct uart_am return false; /* unable to transmit character */ pl011_write(c, uap, REG_DR); diff --git a/target/linux/bcm27xx/patches-5.15/950-0059-amba_pl011-Add-cts-event-workaround-DT-property.patch b/target/linux/bcm27xx/patches-5.15/950-0059-amba_pl011-Add-cts-event-workaround-DT-property.patch index 1d4cdbca64755b..7e10f7931cd1d0 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0059-amba_pl011-Add-cts-event-workaround-DT-property.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0059-amba_pl011-Add-cts-event-workaround-DT-property.patch @@ -36,7 +36,7 @@ Signed-off-by: Phil Elwell - reg --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -2847,6 +2847,11 @@ static int pl011_probe(struct amba_devic +@@ -2843,6 +2843,11 @@ static int pl011_probe(struct amba_devic if (IS_ERR(uap->clk)) return PTR_ERR(uap->clk); diff --git a/target/linux/bcm27xx/patches-5.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch b/target/linux/bcm27xx/patches-5.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch index 431f588a4c5f59..82dc4f384f4462 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch @@ -29,7 +29,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -1496,6 +1496,10 @@ static bool pl011_tx_chars(struct uart_a +@@ -1492,6 +1492,10 @@ static bool pl011_tx_chars(struct uart_a if (likely(from_irq) && count-- == 0) break; diff --git a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch index d7368a0ba4eb1f..2f8829398588e1 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch @@ -244,7 +244,7 @@ bcm2835-mmc: uninitialized_var is no more static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, -@@ -2942,6 +2949,8 @@ static int mmc_blk_probe(struct mmc_card +@@ -2944,6 +2951,8 @@ static int mmc_blk_probe(struct mmc_card { struct mmc_blk_data *md; int ret = 0; @@ -253,7 +253,7 @@ bcm2835-mmc: uninitialized_var is no more /* * Check that the card supports the command class(es) we need. -@@ -2949,7 +2958,16 @@ static int mmc_blk_probe(struct mmc_card +@@ -2951,7 +2960,16 @@ static int mmc_blk_probe(struct mmc_card if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; @@ -271,7 +271,7 @@ bcm2835-mmc: uninitialized_var is no more card->complete_wq = alloc_workqueue("mmc_complete", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); -@@ -2964,6 +2982,17 @@ static int mmc_blk_probe(struct mmc_card +@@ -2966,6 +2984,17 @@ static int mmc_blk_probe(struct mmc_card goto out_free; } @@ -291,7 +291,7 @@ bcm2835-mmc: uninitialized_var is no more goto out; --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c -@@ -1812,7 +1812,8 @@ EXPORT_SYMBOL(mmc_erase); +@@ -1817,7 +1817,8 @@ EXPORT_SYMBOL(mmc_erase); int mmc_can_erase(struct mmc_card *card) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch b/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch index a7d7f211d4339a..711bd0025f3de4 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch @@ -12,8 +12,8 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c -@@ -696,6 +696,8 @@ static bool sc16is7xx_port_irq(struct sc - rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG); +@@ -708,6 +708,8 @@ static bool sc16is7xx_port_irq(struct sc + if (rxlen) sc16is7xx_handle_rx(port, rxlen, iir); + else diff --git a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index f00f2e7b23f3f4..0b6ff1a70a23cf 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch @@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell #define USB_VENDOR_ID_BELKIN 0x050d #define USB_DEVICE_ID_FLIP_KVM 0x3201 -@@ -1318,6 +1321,9 @@ +@@ -1322,6 +1325,9 @@ #define USB_VENDOR_ID_XAT 0x2505 #define USB_DEVICE_ID_XAT_CSR 0x0220 @@ -45,7 +45,7 @@ Signed-off-by: Jonathan Bell #define USB_DEVICE_ID_THT_2P_ARCADE 0x75e1 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c -@@ -41,6 +41,7 @@ static const struct hid_device_id hid_qu +@@ -42,6 +42,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS692), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM), HID_QUIRK_NOGET }, @@ -53,7 +53,7 @@ Signed-off-by: Jonathan Bell { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL }, -@@ -198,6 +199,7 @@ static const struct hid_device_id hid_qu +@@ -200,6 +201,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_GROUP_AUDIO), HID_QUIRK_NOGET }, diff --git a/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch b/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch index 37bea70db74245..88b3a6125efe77 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch @@ -38,7 +38,7 @@ Signed-off-by: Phil Elwell regcache_cache_bypass(s->regmap, false); /* Put LCR back to the normal mode */ -@@ -842,7 +843,7 @@ static unsigned int sc16is7xx_get_mctrl( +@@ -854,7 +855,7 @@ static unsigned int sc16is7xx_get_mctrl( /* DCD and DSR are not wired and CTS/RTS is handled automatically * so just indicate DSR and CAR asserted */ @@ -47,7 +47,7 @@ Signed-off-by: Phil Elwell } static void sc16is7xx_set_mctrl(struct uart_port *port, unsigned int mctrl) -@@ -929,14 +930,19 @@ static void sc16is7xx_set_termios(struct +@@ -941,14 +942,19 @@ static void sc16is7xx_set_termios(struct regcache_cache_bypass(s->regmap, true); sc16is7xx_port_write(port, SC16IS7XX_XON1_REG, termios->c_cc[VSTART]); sc16is7xx_port_write(port, SC16IS7XX_XOFF1_REG, termios->c_cc[VSTOP]); diff --git a/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch b/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch index 5e358ae39b5c4e..c39ae5b395ba9f 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch @@ -157,7 +157,7 @@ Signed-off-by: Joerg Quinten static const struct drm_display_mode innolux_at070tn92_mode = { .clock = 33333, .hdisplay = 800, -@@ -4666,6 +4698,9 @@ static const struct of_device_id platfor +@@ -4667,6 +4699,9 @@ static const struct of_device_id platfor .compatible = "innolux,at043tn24", .data = &innolux_at043tn24, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch b/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch index ee582fea80eeee..72cefe864e313e 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0479-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -3765,6 +3765,31 @@ static const struct panel_desc qishenglo +@@ -3766,6 +3766,31 @@ static const struct panel_desc qishenglo .connector_type = DRM_MODE_CONNECTOR_DPI, }; @@ -47,7 +47,7 @@ Signed-off-by: Dave Stevenson static const struct display_timing rocktech_rk070er9427_timing = { .pixelclock = { 26400000, 33300000, 46800000 }, .hactive = { 800, 800, 800 }, -@@ -4845,6 +4870,9 @@ static const struct of_device_id platfor +@@ -4846,6 +4871,9 @@ static const struct of_device_id platfor .compatible = "qishenglong,gopher2b-lcd", .data = &qishenglong_gopher2b_lcd, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch b/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch index f668c4db19c7cb..1d450282f2a67b 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0686-drm-panel-simple-add-Geekworm-MZP280-Panel.patch @@ -46,7 +46,7 @@ Acked-by: Maxime Ripard static const struct drm_display_mode giantplus_gpg482739qs5_mode = { .clock = 9000, .hdisplay = 480, -@@ -4708,6 +4734,9 @@ static const struct of_device_id platfor +@@ -4709,6 +4735,9 @@ static const struct of_device_id platfor .compatible = "friendlyarm,hd702e", .data = &friendlyarm_hd702e, }, { diff --git a/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch b/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch index 5c96783ed7d56b..2741660ee2ae9b 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch @@ -23,7 +23,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c -@@ -1886,7 +1886,11 @@ static void mmc_blk_mq_rw_recovery(struc +@@ -1888,7 +1888,11 @@ static void mmc_blk_mq_rw_recovery(struc return; } diff --git a/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch b/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch index 73acadd804c0bf..865da6b18284dd 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-01-mm-x86-arm64-add-arch_has_hw_pte_young.patch @@ -329,7 +329,7 @@ Signed-off-by: Andrew Morton --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h -@@ -999,23 +999,13 @@ static inline void update_mmu_cache(stru +@@ -1005,23 +1005,13 @@ static inline void update_mmu_cache(stru * page after fork() + CoW for pfn mappings. We don't always have a * hardware-managed access flag on arm64. */ diff --git a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch index 25457926a48973..769384f500f301 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multi-gen-LRU-groundwork.patch @@ -594,7 +594,7 @@ Signed-off-by: Andrew Morton VM_BUG_ON_PAGE(tail > 2 && page_tail->mapping != TAIL_MAPPING, --- a/mm/memcontrol.c +++ b/mm/memcontrol.c -@@ -5178,6 +5178,7 @@ static void __mem_cgroup_free(struct mem +@@ -5179,6 +5179,7 @@ static void __mem_cgroup_free(struct mem static void mem_cgroup_free(struct mem_cgroup *memcg) { @@ -602,7 +602,7 @@ Signed-off-by: Andrew Morton memcg_wb_domain_exit(memcg); __mem_cgroup_free(memcg); } -@@ -5241,6 +5242,7 @@ static struct mem_cgroup *mem_cgroup_all +@@ -5242,6 +5243,7 @@ static struct mem_cgroup *mem_cgroup_all memcg->deferred_split_queue.split_queue_len = 0; #endif idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); diff --git a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch index 43fd69ae7944e5..234dfd916f0887 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multi-gen-LRU-support-page-table-walks.patch @@ -424,7 +424,7 @@ Signed-off-by: Andrew Morton /* will mmdrop() in finish_task_switch(). */ --- a/mm/memcontrol.c +++ b/mm/memcontrol.c -@@ -6212,6 +6212,30 @@ static void mem_cgroup_move_task(void) +@@ -6213,6 +6213,30 @@ static void mem_cgroup_move_task(void) } #endif @@ -455,7 +455,7 @@ Signed-off-by: Andrew Morton static int seq_puts_memcg_tunable(struct seq_file *m, unsigned long value) { if (value == PAGE_COUNTER_MAX) -@@ -6555,6 +6579,7 @@ struct cgroup_subsys memory_cgrp_subsys +@@ -6556,6 +6580,7 @@ struct cgroup_subsys memory_cgrp_subsys .css_reset = mem_cgroup_css_reset, .css_rstat_flush = mem_cgroup_css_rstat_flush, .can_attach = mem_cgroup_can_attach, diff --git a/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch b/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch index 6010e617b863e4..8cc9abd84f09e2 100644 --- a/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch +++ b/target/linux/generic/backport-5.15/020-v6.3-26-mm-multi-gen-LRU-per-node-lru_gen_page-lists.patch @@ -318,7 +318,7 @@ Signed-off-by: Andrew Morton mctz = soft_limit_tree_from_page(page); if (!mctz) return; -@@ -3433,6 +3443,9 @@ unsigned long mem_cgroup_soft_limit_recl +@@ -3434,6 +3444,9 @@ unsigned long mem_cgroup_soft_limit_recl unsigned long excess; unsigned long nr_scanned; @@ -328,7 +328,7 @@ Signed-off-by: Andrew Morton if (order > 0) return 0; -@@ -5321,6 +5334,7 @@ static int mem_cgroup_css_online(struct +@@ -5322,6 +5335,7 @@ static int mem_cgroup_css_online(struct if (unlikely(mem_cgroup_is_root(memcg))) queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ); @@ -336,7 +336,7 @@ Signed-off-by: Andrew Morton return 0; } -@@ -5347,6 +5361,7 @@ static void mem_cgroup_css_offline(struc +@@ -5348,6 +5362,7 @@ static void mem_cgroup_css_offline(struc memcg_offline_kmem(memcg); reparent_shrinker_deferred(memcg); wb_memcg_offline(memcg); @@ -344,7 +344,7 @@ Signed-off-by: Andrew Morton drain_all_stock(memcg); -@@ -5358,6 +5373,7 @@ static void mem_cgroup_css_released(stru +@@ -5359,6 +5374,7 @@ static void mem_cgroup_css_released(stru struct mem_cgroup *memcg = mem_cgroup_from_css(css); invalidate_reclaim_iterators(memcg); diff --git a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch index 284a6d072255eb..eca3c7ff9fd187 100644 --- a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch +++ b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch @@ -554,7 +554,7 @@ Signed-off-by: David S. Miller static void xrs700x_mac_link_up(struct dsa_switch *ds, int port, --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c -@@ -369,9 +369,8 @@ static int xgbe_set_link_ksettings(struc +@@ -374,9 +374,8 @@ static int xgbe_set_link_ksettings(struc __ETHTOOL_LINK_MODE_MASK_NBITS, cmd->link_modes.advertising, __ETHTOOL_LINK_MODE_MASK_NBITS, lks->link_modes.supported); @@ -566,7 +566,7 @@ Signed-off-by: David S. Miller if ((cmd->base.autoneg == AUTONEG_ENABLE) && bitmap_empty(advertising, __ETHTOOL_LINK_MODE_MASK_NBITS)) { -@@ -384,8 +383,7 @@ static int xgbe_set_link_ksettings(struc +@@ -389,8 +388,7 @@ static int xgbe_set_link_ksettings(struc pdata->phy.autoneg = cmd->base.autoneg; pdata->phy.speed = speed; pdata->phy.duplex = cmd->base.duplex; @@ -747,7 +747,7 @@ Signed-off-by: David S. Miller static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode, --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c -@@ -1168,9 +1168,8 @@ static int otx2_set_link_ksettings(struc +@@ -1172,9 +1172,8 @@ static int otx2_set_link_ksettings(struc otx2_get_link_ksettings(netdev, &cur_ks); /* Check requested modes against supported modes by hardware */ diff --git a/target/linux/generic/backport-5.15/703-08-v5.17-net-phylink-add-mac_select_pcs-method-to-phylink_mac.patch b/target/linux/generic/backport-5.15/703-08-v5.17-net-phylink-add-mac_select_pcs-method-to-phylink_mac.patch index d826877e7dc693..5d5ac4b0094887 100644 --- a/target/linux/generic/backport-5.15/703-08-v5.17-net-phylink-add-mac_select_pcs-method-to-phylink_mac.patch +++ b/target/linux/generic/backport-5.15/703-08-v5.17-net-phylink-add-mac_select_pcs-method-to-phylink_mac.patch @@ -125,7 +125,7 @@ Signed-off-by: David S. Miller pl = kzalloc(sizeof(*pl), GFP_KERNEL); if (!pl) return ERR_PTR(-ENOMEM); -@@ -946,9 +987,10 @@ EXPORT_SYMBOL_GPL(phylink_create); +@@ -947,9 +988,10 @@ EXPORT_SYMBOL_GPL(phylink_create); * @pl: a pointer to a &struct phylink returned from phylink_create() * @pcs: a pointer to the &struct phylink_pcs * @@ -139,7 +139,7 @@ Signed-off-by: David S. Miller * * Please note that there are behavioural changes with the mac_config() * callback if a PCS is present (denoting a newer setup) so removing a PCS -@@ -959,6 +1001,14 @@ void phylink_set_pcs(struct phylink *pl, +@@ -960,6 +1002,14 @@ void phylink_set_pcs(struct phylink *pl, { pl->pcs = pcs; pl->pcs_ops = pcs->ops; diff --git a/target/linux/generic/backport-5.15/703-15-v5.18-net-phy-phylink-fix-DSA-mac_select_pcs-introduction.patch b/target/linux/generic/backport-5.15/703-15-v5.18-net-phy-phylink-fix-DSA-mac_select_pcs-introduction.patch index 9e5061aaed832b..924d0e954a9079 100644 --- a/target/linux/generic/backport-5.15/703-15-v5.18-net-phy-phylink-fix-DSA-mac_select_pcs-introduction.patch +++ b/target/linux/generic/backport-5.15/703-15-v5.18-net-phy-phylink-fix-DSA-mac_select_pcs-introduction.patch @@ -66,7 +66,7 @@ Signed-off-by: Jakub Kicinski phy_interface_empty(config->supported_interfaces)) { dev_err(config->dev, "phylink: error: empty supported_interfaces but mac_select_pcs() method present\n"); -@@ -1220,6 +1227,7 @@ struct phylink *phylink_create(struct ph +@@ -1221,6 +1228,7 @@ struct phylink *phylink_create(struct ph return ERR_PTR(-EINVAL); } diff --git a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch index 3c9d4e72e85271..3c10819b681375 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch @@ -27,7 +27,7 @@ Signed-off-by: Jakub Kicinski static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue); static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue); -@@ -1712,9 +1715,6 @@ static int __init_dma_rx_desc_rings(stru +@@ -1713,9 +1716,6 @@ static int __init_dma_rx_desc_rings(stru return -ENOMEM; } @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski /* Setup the chained descriptor addresses */ if (priv->mode == STMMAC_CHAIN_MODE) { if (priv->extend_desc) -@@ -1820,12 +1820,6 @@ static int __init_dma_tx_desc_rings(stru +@@ -1821,12 +1821,6 @@ static int __init_dma_tx_desc_rings(stru tx_q->tx_skbuff[i] = NULL; } @@ -50,7 +50,7 @@ Signed-off-by: Jakub Kicinski return 0; } -@@ -2694,10 +2688,7 @@ static void stmmac_tx_err(struct stmmac_ +@@ -2695,10 +2689,7 @@ static void stmmac_tx_err(struct stmmac_ stmmac_stop_tx_dma(priv, chan); dma_free_tx_skbufs(priv, chan); stmmac_clear_tx_descriptors(priv, chan); @@ -62,7 +62,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); stmmac_start_tx_dma(priv, chan); -@@ -3781,6 +3772,8 @@ static int stmmac_open(struct net_device +@@ -3782,6 +3773,8 @@ static int stmmac_open(struct net_device } } @@ -71,7 +71,7 @@ Signed-off-by: Jakub Kicinski ret = stmmac_hw_setup(dev, true); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); -@@ -6430,6 +6423,7 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6429,6 +6422,7 @@ void stmmac_enable_rx_queue(struct stmma return; } @@ -79,7 +79,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_rx_descriptors(priv, queue); stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -6491,6 +6485,7 @@ void stmmac_enable_tx_queue(struct stmma +@@ -6490,6 +6484,7 @@ void stmmac_enable_tx_queue(struct stmma return; } @@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_tx_descriptors(priv, queue); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -7411,6 +7406,25 @@ int stmmac_suspend(struct device *dev) +@@ -7414,6 +7409,25 @@ int stmmac_suspend(struct device *dev) } EXPORT_SYMBOL_GPL(stmmac_suspend); @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski /** * stmmac_reset_queues_param - reset queue parameters * @priv: device pointer -@@ -7421,22 +7435,11 @@ static void stmmac_reset_queues_param(st +@@ -7424,22 +7438,11 @@ static void stmmac_reset_queues_param(st u32 tx_cnt = priv->plat->tx_queues_to_use; u32 queue; diff --git a/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch b/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch index 8eca92a5c54dc2..6e115834eb8911 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -3833,8 +3833,6 @@ static int stmmac_release(struct net_dev +@@ -3834,8 +3834,6 @@ static int stmmac_release(struct net_dev struct stmmac_priv *priv = netdev_priv(dev); u32 chan; @@ -26,7 +26,7 @@ Signed-off-by: Jakub Kicinski if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); /* Stop and disconnect the PHY */ -@@ -3846,6 +3844,8 @@ static int stmmac_release(struct net_dev +@@ -3847,6 +3845,8 @@ static int stmmac_release(struct net_dev for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->tx_queue[chan].txtimer); diff --git a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch index 34b7e1fd8d199e..99518b11a040ef 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch @@ -189,7 +189,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->dirty_tx != tx_q->cur_tx) return -EBUSY; /* still unfinished work */ -@@ -1309,7 +1309,7 @@ static void stmmac_display_rx_rings(stru +@@ -1310,7 +1310,7 @@ static void stmmac_display_rx_rings(stru /* Display RX rings */ for (queue = 0; queue < rx_cnt; queue++) { @@ -198,7 +198,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tRX Queue %u rings\n", queue); -@@ -1322,7 +1322,7 @@ static void stmmac_display_rx_rings(stru +@@ -1323,7 +1323,7 @@ static void stmmac_display_rx_rings(stru } /* Display RX ring */ @@ -207,7 +207,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } } -@@ -1336,7 +1336,7 @@ static void stmmac_display_tx_rings(stru +@@ -1337,7 +1337,7 @@ static void stmmac_display_tx_rings(stru /* Display TX rings */ for (queue = 0; queue < tx_cnt; queue++) { @@ -216,7 +216,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tTX Queue %d rings\n", queue); -@@ -1351,7 +1351,7 @@ static void stmmac_display_tx_rings(stru +@@ -1352,7 +1352,7 @@ static void stmmac_display_tx_rings(stru desc_size = sizeof(struct dma_desc); } @@ -225,7 +225,7 @@ Signed-off-by: Jakub Kicinski tx_q->dma_tx_phy, desc_size); } } -@@ -1392,21 +1392,21 @@ static int stmmac_set_bfsize(int mtu, in +@@ -1393,21 +1393,21 @@ static int stmmac_set_bfsize(int mtu, in */ static void stmmac_clear_rx_descriptors(struct stmmac_priv *priv, u32 queue) { @@ -253,7 +253,7 @@ Signed-off-by: Jakub Kicinski } /** -@@ -1418,12 +1418,12 @@ static void stmmac_clear_rx_descriptors( +@@ -1419,12 +1419,12 @@ static void stmmac_clear_rx_descriptors( */ static void stmmac_clear_tx_descriptors(struct stmmac_priv *priv, u32 queue) { @@ -269,7 +269,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1471,7 +1471,7 @@ static void stmmac_clear_descriptors(str +@@ -1472,7 +1472,7 @@ static void stmmac_clear_descriptors(str static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, int i, gfp_t flags, u32 queue) { @@ -278,7 +278,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->page) { -@@ -1496,7 +1496,7 @@ static int stmmac_init_rx_buffers(struct +@@ -1497,7 +1497,7 @@ static int stmmac_init_rx_buffers(struct buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset; stmmac_set_desc_addr(priv, p, buf->addr); @@ -287,7 +287,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_desc3(priv, p); return 0; -@@ -1510,7 +1510,7 @@ static int stmmac_init_rx_buffers(struct +@@ -1511,7 +1511,7 @@ static int stmmac_init_rx_buffers(struct */ static void stmmac_free_rx_buffer(struct stmmac_priv *priv, u32 queue, int i) { @@ -296,7 +296,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (buf->page) -@@ -1530,7 +1530,7 @@ static void stmmac_free_rx_buffer(struct +@@ -1531,7 +1531,7 @@ static void stmmac_free_rx_buffer(struct */ static void stmmac_free_tx_buffer(struct stmmac_priv *priv, u32 queue, int i) { @@ -305,7 +305,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->tx_skbuff_dma[i].buf && tx_q->tx_skbuff_dma[i].buf_type != STMMAC_TXBUF_T_XDP_TX) { -@@ -1575,17 +1575,17 @@ static void dma_free_rx_skbufs(struct st +@@ -1576,17 +1576,17 @@ static void dma_free_rx_skbufs(struct st { int i; @@ -326,7 +326,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; int ret; -@@ -1612,10 +1612,10 @@ static int stmmac_alloc_rx_buffers(struc +@@ -1613,10 +1613,10 @@ static int stmmac_alloc_rx_buffers(struc */ static void dma_free_rx_xskbufs(struct stmmac_priv *priv, u32 queue) { @@ -339,7 +339,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->xdp) -@@ -1628,10 +1628,10 @@ static void dma_free_rx_xskbufs(struct s +@@ -1629,10 +1629,10 @@ static void dma_free_rx_xskbufs(struct s static int stmmac_alloc_rx_buffers_zc(struct stmmac_priv *priv, u32 queue) { @@ -352,7 +352,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf; dma_addr_t dma_addr; struct dma_desc *p; -@@ -1674,7 +1674,7 @@ static struct xsk_buff_pool *stmmac_get_ +@@ -1675,7 +1675,7 @@ static struct xsk_buff_pool *stmmac_get_ */ static int __init_dma_rx_desc_rings(struct stmmac_priv *priv, u32 queue, gfp_t flags) { @@ -361,7 +361,7 @@ Signed-off-by: Jakub Kicinski int ret; netif_dbg(priv, probe, priv->dev, -@@ -1720,11 +1720,11 @@ static int __init_dma_rx_desc_rings(stru +@@ -1721,11 +1721,11 @@ static int __init_dma_rx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, rx_q->dma_erx, rx_q->dma_rx_phy, @@ -375,7 +375,7 @@ Signed-off-by: Jakub Kicinski } return 0; -@@ -1751,7 +1751,7 @@ static int init_dma_rx_desc_rings(struct +@@ -1752,7 +1752,7 @@ static int init_dma_rx_desc_rings(struct err_init_rx_buffers: while (queue >= 0) { @@ -384,7 +384,7 @@ Signed-off-by: Jakub Kicinski if (rx_q->xsk_pool) dma_free_rx_xskbufs(priv, queue); -@@ -1780,7 +1780,7 @@ err_init_rx_buffers: +@@ -1781,7 +1781,7 @@ err_init_rx_buffers: */ static int __init_dma_tx_desc_rings(struct stmmac_priv *priv, u32 queue) { @@ -393,7 +393,7 @@ Signed-off-by: Jakub Kicinski int i; netif_dbg(priv, probe, priv->dev, -@@ -1792,16 +1792,16 @@ static int __init_dma_tx_desc_rings(stru +@@ -1793,16 +1793,16 @@ static int __init_dma_tx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, tx_q->dma_etx, tx_q->dma_tx_phy, @@ -413,7 +413,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1871,12 +1871,12 @@ static int init_dma_desc_rings(struct ne +@@ -1872,12 +1872,12 @@ static int init_dma_desc_rings(struct ne */ static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue) { @@ -428,7 +428,7 @@ Signed-off-by: Jakub Kicinski stmmac_free_tx_buffer(priv, queue, i); if (tx_q->xsk_pool && tx_q->xsk_frames_done) { -@@ -1906,7 +1906,7 @@ static void stmmac_free_tx_skbufs(struct +@@ -1907,7 +1907,7 @@ static void stmmac_free_tx_skbufs(struct */ static void __free_dma_rx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -437,7 +437,7 @@ Signed-off-by: Jakub Kicinski /* Release the DMA RX socket buffers */ if (rx_q->xsk_pool) -@@ -1919,11 +1919,11 @@ static void __free_dma_rx_desc_resources +@@ -1920,11 +1920,11 @@ static void __free_dma_rx_desc_resources /* Free DMA regions of consistent memory previously allocated */ if (!priv->extend_desc) @@ -451,7 +451,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), rx_q->dma_erx, rx_q->dma_rx_phy); -@@ -1952,7 +1952,7 @@ static void free_dma_rx_desc_resources(s +@@ -1953,7 +1953,7 @@ static void free_dma_rx_desc_resources(s */ static void __free_dma_tx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -460,7 +460,7 @@ Signed-off-by: Jakub Kicinski size_t size; void *addr; -@@ -1970,7 +1970,7 @@ static void __free_dma_tx_desc_resources +@@ -1971,7 +1971,7 @@ static void __free_dma_tx_desc_resources addr = tx_q->dma_tx; } @@ -469,7 +469,7 @@ Signed-off-by: Jakub Kicinski dma_free_coherent(priv->device, size, addr, tx_q->dma_tx_phy); -@@ -1999,7 +1999,7 @@ static void free_dma_tx_desc_resources(s +@@ -2000,7 +2000,7 @@ static void free_dma_tx_desc_resources(s */ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -478,7 +478,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; bool xdp_prog = stmmac_xdp_is_enabled(priv); struct page_pool_params pp_params = { 0 }; -@@ -2011,8 +2011,8 @@ static int __alloc_dma_rx_desc_resources +@@ -2012,8 +2012,8 @@ static int __alloc_dma_rx_desc_resources rx_q->priv_data = priv; pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; @@ -489,7 +489,7 @@ Signed-off-by: Jakub Kicinski pp_params.order = ilog2(num_pages); pp_params.nid = dev_to_node(priv->device); pp_params.dev = priv->device; -@@ -2027,7 +2027,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2028,7 +2028,7 @@ static int __alloc_dma_rx_desc_resources return ret; } @@ -498,7 +498,7 @@ Signed-off-by: Jakub Kicinski sizeof(*rx_q->buf_pool), GFP_KERNEL); if (!rx_q->buf_pool) -@@ -2035,7 +2035,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2036,7 +2036,7 @@ static int __alloc_dma_rx_desc_resources if (priv->extend_desc) { rx_q->dma_erx = dma_alloc_coherent(priv->device, @@ -507,7 +507,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2044,7 +2044,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2045,7 +2045,7 @@ static int __alloc_dma_rx_desc_resources } else { rx_q->dma_rx = dma_alloc_coherent(priv->device, @@ -516,7 +516,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2101,20 +2101,20 @@ err_dma: +@@ -2102,20 +2102,20 @@ err_dma: */ static int __alloc_dma_tx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -540,7 +540,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct sk_buff *), GFP_KERNEL); if (!tx_q->tx_skbuff) -@@ -2127,7 +2127,7 @@ static int __alloc_dma_tx_desc_resources +@@ -2128,7 +2128,7 @@ static int __alloc_dma_tx_desc_resources else size = sizeof(struct dma_desc); @@ -549,7 +549,7 @@ Signed-off-by: Jakub Kicinski addr = dma_alloc_coherent(priv->device, size, &tx_q->dma_tx_phy, GFP_KERNEL); -@@ -2371,7 +2371,7 @@ static void stmmac_dma_operation_mode(st +@@ -2372,7 +2372,7 @@ static void stmmac_dma_operation_mode(st /* configure all channels */ for (chan = 0; chan < rx_channels_count; chan++) { @@ -558,7 +558,7 @@ Signed-off-by: Jakub Kicinski u32 buf_size; qmode = priv->plat->rx_queues_cfg[chan].mode_to_use; -@@ -2386,7 +2386,7 @@ static void stmmac_dma_operation_mode(st +@@ -2387,7 +2387,7 @@ static void stmmac_dma_operation_mode(st chan); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -567,7 +567,7 @@ Signed-off-by: Jakub Kicinski chan); } } -@@ -2402,7 +2402,7 @@ static void stmmac_dma_operation_mode(st +@@ -2403,7 +2403,7 @@ static void stmmac_dma_operation_mode(st static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) { struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue); @@ -576,7 +576,7 @@ Signed-off-by: Jakub Kicinski struct xsk_buff_pool *pool = tx_q->xsk_pool; unsigned int entry = tx_q->cur_tx; struct dma_desc *tx_desc = NULL; -@@ -2477,7 +2477,7 @@ static bool stmmac_xdp_xmit_zc(struct st +@@ -2478,7 +2478,7 @@ static bool stmmac_xdp_xmit_zc(struct st stmmac_enable_dma_transmission(priv, priv->ioaddr); @@ -585,7 +585,7 @@ Signed-off-by: Jakub Kicinski entry = tx_q->cur_tx; } -@@ -2503,7 +2503,7 @@ static bool stmmac_xdp_xmit_zc(struct st +@@ -2504,7 +2504,7 @@ static bool stmmac_xdp_xmit_zc(struct st */ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) { @@ -594,7 +594,7 @@ Signed-off-by: Jakub Kicinski unsigned int bytes_compl = 0, pkts_compl = 0; unsigned int entry, xmits = 0, count = 0; -@@ -2516,7 +2516,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2517,7 +2517,7 @@ static int stmmac_tx_clean(struct stmmac entry = tx_q->dirty_tx; /* Try to clean all TX complete frame in 1 shot */ @@ -603,7 +603,7 @@ Signed-off-by: Jakub Kicinski struct xdp_frame *xdpf; struct sk_buff *skb; struct dma_desc *p; -@@ -2616,7 +2616,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2617,7 +2617,7 @@ static int stmmac_tx_clean(struct stmmac stmmac_release_tx_desc(priv, p, priv->mode); @@ -612,7 +612,7 @@ Signed-off-by: Jakub Kicinski } tx_q->dirty_tx = entry; -@@ -2681,7 +2681,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2682,7 +2682,7 @@ static int stmmac_tx_clean(struct stmmac */ static void stmmac_tx_err(struct stmmac_priv *priv, u32 chan) { @@ -621,7 +621,7 @@ Signed-off-by: Jakub Kicinski netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, chan)); -@@ -2748,8 +2748,8 @@ static int stmmac_napi_check(struct stmm +@@ -2749,8 +2749,8 @@ static int stmmac_napi_check(struct stmm { int status = stmmac_dma_interrupt_status(priv, priv->ioaddr, &priv->xstats, chan, dir); @@ -632,7 +632,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[chan]; struct napi_struct *rx_napi; struct napi_struct *tx_napi; -@@ -2925,7 +2925,7 @@ static int stmmac_init_dma_engine(struct +@@ -2926,7 +2926,7 @@ static int stmmac_init_dma_engine(struct /* DMA RX Channel Configuration */ for (chan = 0; chan < rx_channels_count; chan++) { @@ -641,7 +641,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, chan); -@@ -2939,7 +2939,7 @@ static int stmmac_init_dma_engine(struct +@@ -2940,7 +2940,7 @@ static int stmmac_init_dma_engine(struct /* DMA TX Channel Configuration */ for (chan = 0; chan < tx_channels_count; chan++) { @@ -650,7 +650,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -2954,7 +2954,7 @@ static int stmmac_init_dma_engine(struct +@@ -2955,7 +2955,7 @@ static int stmmac_init_dma_engine(struct static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue) { @@ -659,7 +659,7 @@ Signed-off-by: Jakub Kicinski hrtimer_start(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), -@@ -3004,7 +3004,7 @@ static void stmmac_init_coalesce(struct +@@ -3005,7 +3005,7 @@ static void stmmac_init_coalesce(struct u32 chan; for (chan = 0; chan < tx_channel_count; chan++) { @@ -668,7 +668,7 @@ Signed-off-by: Jakub Kicinski priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES; priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER; -@@ -3026,12 +3026,12 @@ static void stmmac_set_rings_length(stru +@@ -3027,12 +3027,12 @@ static void stmmac_set_rings_length(stru /* set TX ring length */ for (chan = 0; chan < tx_channels_count; chan++) stmmac_set_tx_ring_len(priv, priv->ioaddr, @@ -683,7 +683,7 @@ Signed-off-by: Jakub Kicinski } /** -@@ -3366,7 +3366,7 @@ static int stmmac_hw_setup(struct net_de +@@ -3367,7 +3367,7 @@ static int stmmac_hw_setup(struct net_de /* Enable TSO */ if (priv->tso) { for (chan = 0; chan < tx_cnt; chan++) { @@ -692,7 +692,7 @@ Signed-off-by: Jakub Kicinski /* TSO and TBS cannot co-exist */ if (tx_q->tbs & STMMAC_TBS_AVAIL) -@@ -3388,7 +3388,7 @@ static int stmmac_hw_setup(struct net_de +@@ -3389,7 +3389,7 @@ static int stmmac_hw_setup(struct net_de /* TBS */ for (chan = 0; chan < tx_cnt; chan++) { @@ -701,7 +701,7 @@ Signed-off-by: Jakub Kicinski int enable = tx_q->tbs & STMMAC_TBS_AVAIL; stmmac_enable_tbs(priv, priv->ioaddr, enable, chan); -@@ -3432,7 +3432,7 @@ static void stmmac_free_irq(struct net_d +@@ -3433,7 +3433,7 @@ static void stmmac_free_irq(struct net_d for (j = irq_idx - 1; j >= 0; j--) { if (priv->tx_irq[j] > 0) { irq_set_affinity_hint(priv->tx_irq[j], NULL); @@ -710,7 +710,7 @@ Signed-off-by: Jakub Kicinski } } irq_idx = priv->plat->rx_queues_to_use; -@@ -3441,7 +3441,7 @@ static void stmmac_free_irq(struct net_d +@@ -3442,7 +3442,7 @@ static void stmmac_free_irq(struct net_d for (j = irq_idx - 1; j >= 0; j--) { if (priv->rx_irq[j] > 0) { irq_set_affinity_hint(priv->rx_irq[j], NULL); @@ -719,7 +719,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -3574,7 +3574,7 @@ static int stmmac_request_irq_multi_msi( +@@ -3575,7 +3575,7 @@ static int stmmac_request_irq_multi_msi( sprintf(int_name, "%s:%s-%d", dev->name, "rx", i); ret = request_irq(priv->rx_irq[i], stmmac_msi_intr_rx, @@ -728,7 +728,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc rx-%d MSI %d (error: %d)\n", -@@ -3597,7 +3597,7 @@ static int stmmac_request_irq_multi_msi( +@@ -3598,7 +3598,7 @@ static int stmmac_request_irq_multi_msi( sprintf(int_name, "%s:%s-%d", dev->name, "tx", i); ret = request_irq(priv->tx_irq[i], stmmac_msi_intr_tx, @@ -737,7 +737,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc tx-%d MSI %d (error: %d)\n", -@@ -3728,21 +3728,21 @@ static int stmmac_open(struct net_device +@@ -3729,21 +3729,21 @@ static int stmmac_open(struct net_device bfsize = 0; if (bfsize < BUF_SIZE_16KiB) @@ -766,7 +766,7 @@ Signed-off-by: Jakub Kicinski int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en; /* Setup per-TXQ tbs flag before TX descriptor alloc */ -@@ -3800,7 +3800,7 @@ irq_error: +@@ -3801,7 +3801,7 @@ irq_error: phylink_stop(priv->phylink); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -775,7 +775,7 @@ Signed-off-by: Jakub Kicinski stmmac_hw_teardown(dev); init_error: -@@ -3842,7 +3842,7 @@ static int stmmac_release(struct net_dev +@@ -3843,7 +3843,7 @@ static int stmmac_release(struct net_dev stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -784,7 +784,7 @@ Signed-off-by: Jakub Kicinski netif_tx_disable(dev); -@@ -3906,7 +3906,7 @@ static bool stmmac_vlan_insert(struct st +@@ -3907,7 +3907,7 @@ static bool stmmac_vlan_insert(struct st return false; stmmac_set_tx_owner(priv, p); @@ -793,7 +793,7 @@ Signed-off-by: Jakub Kicinski return true; } -@@ -3924,7 +3924,7 @@ static bool stmmac_vlan_insert(struct st +@@ -3925,7 +3925,7 @@ static bool stmmac_vlan_insert(struct st static void stmmac_tso_allocator(struct stmmac_priv *priv, dma_addr_t des, int total_len, bool last_segment, u32 queue) { @@ -802,7 +802,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *desc; u32 buff_size; int tmp_len; -@@ -3935,7 +3935,7 @@ static void stmmac_tso_allocator(struct +@@ -3936,7 +3936,7 @@ static void stmmac_tso_allocator(struct dma_addr_t curr_addr; tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, @@ -811,7 +811,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]); if (tx_q->tbs & STMMAC_TBS_AVAIL) -@@ -3963,7 +3963,7 @@ static void stmmac_tso_allocator(struct +@@ -3964,7 +3964,7 @@ static void stmmac_tso_allocator(struct static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue) { @@ -820,7 +820,7 @@ Signed-off-by: Jakub Kicinski int desc_size; if (likely(priv->extend_desc)) -@@ -4025,7 +4025,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4026,7 +4026,7 @@ static netdev_tx_t stmmac_tso_xmit(struc dma_addr_t des; int i; @@ -829,7 +829,7 @@ Signed-off-by: Jakub Kicinski first_tx = tx_q->cur_tx; /* Compute header lengths */ -@@ -4065,7 +4065,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4066,7 +4066,7 @@ static netdev_tx_t stmmac_tso_xmit(struc stmmac_set_mss(priv, mss_desc, mss); tx_q->mss = mss; tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, @@ -838,7 +838,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]); } -@@ -4177,7 +4177,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4178,7 +4178,7 @@ static netdev_tx_t stmmac_tso_xmit(struc * ndo_start_xmit will fill this descriptor the next time it's * called and stmmac_tx_clean may clean up to this descriptor. */ @@ -847,7 +847,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 1))) { netif_dbg(priv, hw, priv->dev, "%s: stop transmitted packets\n", -@@ -4265,7 +4265,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4266,7 +4266,7 @@ static netdev_tx_t stmmac_xmit(struct sk int entry, first_tx; dma_addr_t des; @@ -856,7 +856,7 @@ Signed-off-by: Jakub Kicinski first_tx = tx_q->cur_tx; if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) -@@ -4328,7 +4328,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4329,7 +4329,7 @@ static netdev_tx_t stmmac_xmit(struct sk int len = skb_frag_size(frag); bool last_segment = (i == (nfrags - 1)); @@ -865,7 +865,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[entry]); if (likely(priv->extend_desc)) -@@ -4399,7 +4399,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4400,7 +4400,7 @@ static netdev_tx_t stmmac_xmit(struct sk * ndo_start_xmit will fill this descriptor the next time it's * called and stmmac_tx_clean may clean up to this descriptor. */ @@ -874,7 +874,7 @@ Signed-off-by: Jakub Kicinski tx_q->cur_tx = entry; if (netif_msg_pktdata(priv)) { -@@ -4514,7 +4514,7 @@ static void stmmac_rx_vlan(struct net_de +@@ -4512,7 +4512,7 @@ static void stmmac_rx_vlan(struct net_de */ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) { @@ -883,7 +883,7 @@ Signed-off-by: Jakub Kicinski int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; -@@ -4564,7 +4564,7 @@ static inline void stmmac_rx_refill(stru +@@ -4562,7 +4562,7 @@ static inline void stmmac_rx_refill(stru dma_wmb(); stmmac_set_rx_owner(priv, p, use_rx_wd); @@ -892,7 +892,7 @@ Signed-off-by: Jakub Kicinski } rx_q->dirty_rx = entry; rx_q->rx_tail_addr = rx_q->dma_rx_phy + -@@ -4592,12 +4592,12 @@ static unsigned int stmmac_rx_buf1_len(s +@@ -4590,12 +4590,12 @@ static unsigned int stmmac_rx_buf1_len(s /* First descriptor, not last descriptor and not split header */ if (status & rx_not_ls) @@ -907,7 +907,7 @@ Signed-off-by: Jakub Kicinski } static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv, -@@ -4613,7 +4613,7 @@ static unsigned int stmmac_rx_buf2_len(s +@@ -4611,7 +4611,7 @@ static unsigned int stmmac_rx_buf2_len(s /* Not last descriptor */ if (status & rx_not_ls) @@ -916,7 +916,7 @@ Signed-off-by: Jakub Kicinski plen = stmmac_get_rx_frame_len(priv, p, coe); -@@ -4624,7 +4624,7 @@ static unsigned int stmmac_rx_buf2_len(s +@@ -4622,7 +4622,7 @@ static unsigned int stmmac_rx_buf2_len(s static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, struct xdp_frame *xdpf, bool dma_map) { @@ -925,7 +925,7 @@ Signed-off-by: Jakub Kicinski unsigned int entry = tx_q->cur_tx; struct dma_desc *tx_desc; dma_addr_t dma_addr; -@@ -4687,7 +4687,7 @@ static int stmmac_xdp_xmit_xdpf(struct s +@@ -4685,7 +4685,7 @@ static int stmmac_xdp_xmit_xdpf(struct s stmmac_enable_dma_transmission(priv, priv->ioaddr); @@ -934,7 +934,7 @@ Signed-off-by: Jakub Kicinski tx_q->cur_tx = entry; return STMMAC_XDP_TX; -@@ -4861,7 +4861,7 @@ static void stmmac_dispatch_skb_zc(struc +@@ -4859,7 +4859,7 @@ static void stmmac_dispatch_skb_zc(struc static bool stmmac_rx_refill_zc(struct stmmac_priv *priv, u32 queue, u32 budget) { @@ -943,7 +943,7 @@ Signed-off-by: Jakub Kicinski unsigned int entry = rx_q->dirty_rx; struct dma_desc *rx_desc = NULL; bool ret = true; -@@ -4904,7 +4904,7 @@ static bool stmmac_rx_refill_zc(struct s +@@ -4902,7 +4902,7 @@ static bool stmmac_rx_refill_zc(struct s dma_wmb(); stmmac_set_rx_owner(priv, rx_desc, use_rx_wd); @@ -952,7 +952,7 @@ Signed-off-by: Jakub Kicinski } if (rx_desc) { -@@ -4919,7 +4919,7 @@ static bool stmmac_rx_refill_zc(struct s +@@ -4917,7 +4917,7 @@ static bool stmmac_rx_refill_zc(struct s static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue) { @@ -961,7 +961,7 @@ Signed-off-by: Jakub Kicinski unsigned int count = 0, error = 0, len = 0; int dirty = stmmac_rx_dirty(priv, queue); unsigned int next_entry = rx_q->cur_rx; -@@ -4941,7 +4941,7 @@ static int stmmac_rx_zc(struct stmmac_pr +@@ -4939,7 +4939,7 @@ static int stmmac_rx_zc(struct stmmac_pr desc_size = sizeof(struct dma_desc); } @@ -970,7 +970,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } while (count < limit) { -@@ -4988,7 +4988,7 @@ read_again: +@@ -4986,7 +4986,7 @@ read_again: /* Prefetch the next RX descriptor */ rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, @@ -979,7 +979,7 @@ Signed-off-by: Jakub Kicinski next_entry = rx_q->cur_rx; if (priv->extend_desc) -@@ -5109,7 +5109,7 @@ read_again: +@@ -5107,7 +5107,7 @@ read_again: */ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) { @@ -988,7 +988,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned int count = 0, error = 0, len = 0; int status = 0, coe = priv->hw->rx_csum; -@@ -5122,7 +5122,7 @@ static int stmmac_rx(struct stmmac_priv +@@ -5120,7 +5120,7 @@ static int stmmac_rx(struct stmmac_priv int buf_sz; dma_dir = page_pool_get_dma_dir(rx_q->page_pool); @@ -997,7 +997,7 @@ Signed-off-by: Jakub Kicinski if (netif_msg_rx_status(priv)) { void *rx_head; -@@ -5136,7 +5136,7 @@ static int stmmac_rx(struct stmmac_priv +@@ -5134,7 +5134,7 @@ static int stmmac_rx(struct stmmac_priv desc_size = sizeof(struct dma_desc); } @@ -1006,7 +1006,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } while (count < limit) { -@@ -5180,7 +5180,7 @@ read_again: +@@ -5178,7 +5178,7 @@ read_again: break; rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, @@ -1015,7 +1015,7 @@ Signed-off-by: Jakub Kicinski next_entry = rx_q->cur_rx; if (priv->extend_desc) -@@ -5314,7 +5314,7 @@ read_again: +@@ -5312,7 +5312,7 @@ read_again: buf1_len, dma_dir); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, buf->page, buf->page_offset, buf1_len, @@ -1024,7 +1024,7 @@ Signed-off-by: Jakub Kicinski /* Data payload appended into SKB */ page_pool_release_page(rx_q->page_pool, buf->page); -@@ -5326,7 +5326,7 @@ read_again: +@@ -5324,7 +5324,7 @@ read_again: buf2_len, dma_dir); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, buf->sec_page, 0, buf2_len, @@ -1033,7 +1033,7 @@ Signed-off-by: Jakub Kicinski /* Data payload appended into SKB */ page_pool_release_page(rx_q->page_pool, buf->sec_page); -@@ -5768,11 +5768,13 @@ static irqreturn_t stmmac_safety_interru +@@ -5767,11 +5767,13 @@ static irqreturn_t stmmac_safety_interru static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) { struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)data; @@ -1048,7 +1048,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); -@@ -5812,10 +5814,12 @@ static irqreturn_t stmmac_msi_intr_tx(in +@@ -5811,10 +5813,12 @@ static irqreturn_t stmmac_msi_intr_tx(in static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) { struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)data; @@ -1062,7 +1062,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); -@@ -5846,10 +5850,10 @@ static void stmmac_poll_controller(struc +@@ -5845,10 +5849,10 @@ static void stmmac_poll_controller(struc if (priv->plat->multi_msi_en) { for (i = 0; i < priv->plat->rx_queues_to_use; i++) @@ -1075,7 +1075,7 @@ Signed-off-by: Jakub Kicinski } else { disable_irq(dev->irq); stmmac_interrupt(dev->irq, dev); -@@ -6030,34 +6034,34 @@ static int stmmac_rings_status_show(stru +@@ -6029,34 +6033,34 @@ static int stmmac_rings_status_show(stru return 0; for (queue = 0; queue < rx_count; queue++) { @@ -1116,7 +1116,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -6404,7 +6408,7 @@ void stmmac_disable_rx_queue(struct stmm +@@ -6403,7 +6407,7 @@ void stmmac_disable_rx_queue(struct stmm void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1125,7 +1125,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned long flags; u32 buf_size; -@@ -6441,7 +6445,7 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6440,7 +6444,7 @@ void stmmac_enable_rx_queue(struct stmma rx_q->queue_index); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -1134,7 +1134,7 @@ Signed-off-by: Jakub Kicinski rx_q->queue_index); } -@@ -6467,7 +6471,7 @@ void stmmac_disable_tx_queue(struct stmm +@@ -6466,7 +6470,7 @@ void stmmac_disable_tx_queue(struct stmm void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1143,7 +1143,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned long flags; int ret; -@@ -6517,7 +6521,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6516,7 +6520,7 @@ void stmmac_xdp_release(struct net_devic stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1152,7 +1152,7 @@ Signed-off-by: Jakub Kicinski /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); -@@ -6576,7 +6580,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6575,7 +6579,7 @@ int stmmac_xdp_open(struct net_device *d /* DMA RX Channel Configuration */ for (chan = 0; chan < rx_cnt; chan++) { @@ -1161,7 +1161,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, chan); -@@ -6594,7 +6598,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6593,7 +6597,7 @@ int stmmac_xdp_open(struct net_device *d rx_q->queue_index); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -1170,7 +1170,7 @@ Signed-off-by: Jakub Kicinski rx_q->queue_index); } -@@ -6603,7 +6607,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6602,7 +6606,7 @@ int stmmac_xdp_open(struct net_device *d /* DMA TX Channel Configuration */ for (chan = 0; chan < tx_cnt; chan++) { @@ -1179,7 +1179,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -6636,7 +6640,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6635,7 +6639,7 @@ int stmmac_xdp_open(struct net_device *d irq_error: for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1188,7 +1188,7 @@ Signed-off-by: Jakub Kicinski stmmac_hw_teardown(dev); init_error: -@@ -6663,8 +6667,8 @@ int stmmac_xsk_wakeup(struct net_device +@@ -6662,8 +6666,8 @@ int stmmac_xsk_wakeup(struct net_device queue >= priv->plat->tx_queues_to_use) return -EINVAL; @@ -1199,7 +1199,7 @@ Signed-off-by: Jakub Kicinski ch = &priv->channel[queue]; if (!rx_q->xsk_pool && !tx_q->xsk_pool) -@@ -6924,8 +6928,8 @@ int stmmac_reinit_ringparam(struct net_d +@@ -6923,8 +6927,8 @@ int stmmac_reinit_ringparam(struct net_d if (netif_running(dev)) stmmac_release(dev); @@ -1210,7 +1210,7 @@ Signed-off-by: Jakub Kicinski if (netif_running(dev)) ret = stmmac_open(dev); -@@ -7357,7 +7361,7 @@ int stmmac_suspend(struct device *dev) +@@ -7359,7 +7363,7 @@ int stmmac_suspend(struct device *dev) stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1219,7 +1219,7 @@ Signed-off-by: Jakub Kicinski if (priv->eee_enabled) { priv->tx_path_in_lpi_mode = false; -@@ -7408,7 +7412,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); +@@ -7411,7 +7415,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1228,7 +1228,7 @@ Signed-off-by: Jakub Kicinski rx_q->cur_rx = 0; rx_q->dirty_rx = 0; -@@ -7416,7 +7420,7 @@ static void stmmac_reset_rx_queue(struct +@@ -7419,7 +7423,7 @@ static void stmmac_reset_rx_queue(struct static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1270,7 +1270,7 @@ Signed-off-by: Jakub Kicinski if (i >= priv->plat->tx_queues_to_use) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c -@@ -970,13 +970,13 @@ static int tc_setup_etf(struct stmmac_pr +@@ -971,13 +971,13 @@ static int tc_setup_etf(struct stmmac_pr return -EOPNOTSUPP; if (qopt->queue >= priv->plat->tx_queues_to_use) return -EINVAL; diff --git a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch index a7ee50ddd02b45..7336456c0c0e9b 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -1300,7 +1300,8 @@ static int stmmac_phy_setup(struct stmma +@@ -1301,7 +1301,8 @@ static int stmmac_phy_setup(struct stmma return 0; } @@ -27,7 +27,7 @@ Signed-off-by: Jakub Kicinski { u32 rx_cnt = priv->plat->rx_queues_to_use; unsigned int desc_size; -@@ -1309,7 +1310,7 @@ static void stmmac_display_rx_rings(stru +@@ -1310,7 +1311,7 @@ static void stmmac_display_rx_rings(stru /* Display RX rings */ for (queue = 0; queue < rx_cnt; queue++) { @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tRX Queue %u rings\n", queue); -@@ -1322,12 +1323,13 @@ static void stmmac_display_rx_rings(stru +@@ -1323,12 +1324,13 @@ static void stmmac_display_rx_rings(stru } /* Display RX ring */ @@ -52,7 +52,7 @@ Signed-off-by: Jakub Kicinski { u32 tx_cnt = priv->plat->tx_queues_to_use; unsigned int desc_size; -@@ -1336,7 +1338,7 @@ static void stmmac_display_tx_rings(stru +@@ -1337,7 +1339,7 @@ static void stmmac_display_tx_rings(stru /* Display TX rings */ for (queue = 0; queue < tx_cnt; queue++) { @@ -61,7 +61,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tTX Queue %d rings\n", queue); -@@ -1351,18 +1353,19 @@ static void stmmac_display_tx_rings(stru +@@ -1352,18 +1354,19 @@ static void stmmac_display_tx_rings(stru desc_size = sizeof(struct dma_desc); } @@ -85,7 +85,7 @@ Signed-off-by: Jakub Kicinski } static int stmmac_set_bfsize(int mtu, int bufsize) -@@ -1386,44 +1389,50 @@ static int stmmac_set_bfsize(int mtu, in +@@ -1387,44 +1390,50 @@ static int stmmac_set_bfsize(int mtu, in /** * stmmac_clear_rx_descriptors - clear RX descriptors * @priv: driver private structure @@ -147,7 +147,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1440,10 +1449,12 @@ static void stmmac_clear_tx_descriptors( +@@ -1441,10 +1450,12 @@ static void stmmac_clear_tx_descriptors( /** * stmmac_clear_descriptors - clear descriptors * @priv: driver private structure @@ -161,7 +161,7 @@ Signed-off-by: Jakub Kicinski { u32 rx_queue_cnt = priv->plat->rx_queues_to_use; u32 tx_queue_cnt = priv->plat->tx_queues_to_use; -@@ -1451,16 +1462,17 @@ static void stmmac_clear_descriptors(str +@@ -1452,16 +1463,17 @@ static void stmmac_clear_descriptors(str /* Clear the RX descriptors */ for (queue = 0; queue < rx_queue_cnt; queue++) @@ -181,7 +181,7 @@ Signed-off-by: Jakub Kicinski * @p: descriptor pointer * @i: descriptor index * @flags: gfp flag -@@ -1468,10 +1480,12 @@ static void stmmac_clear_descriptors(str +@@ -1469,10 +1481,12 @@ static void stmmac_clear_descriptors(str * Description: this function is called to allocate a receive buffer, perform * the DMA mapping and init the descriptor. */ @@ -196,7 +196,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->page) { -@@ -1496,7 +1510,7 @@ static int stmmac_init_rx_buffers(struct +@@ -1497,7 +1511,7 @@ static int stmmac_init_rx_buffers(struct buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset; stmmac_set_desc_addr(priv, p, buf->addr); @@ -205,7 +205,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_desc3(priv, p); return 0; -@@ -1505,12 +1519,13 @@ static int stmmac_init_rx_buffers(struct +@@ -1506,12 +1520,13 @@ static int stmmac_init_rx_buffers(struct /** * stmmac_free_rx_buffer - free RX dma buffers * @priv: private structure @@ -222,7 +222,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (buf->page) -@@ -1525,12 +1540,15 @@ static void stmmac_free_rx_buffer(struct +@@ -1526,12 +1541,15 @@ static void stmmac_free_rx_buffer(struct /** * stmmac_free_tx_buffer - free RX dma buffers * @priv: private structure @@ -240,7 +240,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->tx_skbuff_dma[i].buf && tx_q->tx_skbuff_dma[i].buf_type != STMMAC_TXBUF_T_XDP_TX) { -@@ -1569,23 +1587,28 @@ static void stmmac_free_tx_buffer(struct +@@ -1570,23 +1588,28 @@ static void stmmac_free_tx_buffer(struct /** * dma_free_rx_skbufs - free RX dma buffers * @priv: private structure @@ -276,7 +276,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; int ret; -@@ -1594,7 +1617,7 @@ static int stmmac_alloc_rx_buffers(struc +@@ -1595,7 +1618,7 @@ static int stmmac_alloc_rx_buffers(struc else p = rx_q->dma_rx + i; @@ -285,7 +285,7 @@ Signed-off-by: Jakub Kicinski queue); if (ret) return ret; -@@ -1608,14 +1631,17 @@ static int stmmac_alloc_rx_buffers(struc +@@ -1609,14 +1632,17 @@ static int stmmac_alloc_rx_buffers(struc /** * dma_free_rx_xskbufs - free RX dma buffers from XSK pool * @priv: private structure @@ -306,7 +306,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->xdp) -@@ -1626,12 +1652,14 @@ static void dma_free_rx_xskbufs(struct s +@@ -1627,12 +1653,14 @@ static void dma_free_rx_xskbufs(struct s } } @@ -324,7 +324,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf; dma_addr_t dma_addr; struct dma_desc *p; -@@ -1666,22 +1694,25 @@ static struct xsk_buff_pool *stmmac_get_ +@@ -1667,22 +1695,25 @@ static struct xsk_buff_pool *stmmac_get_ /** * __init_dma_rx_desc_rings - init the RX descriptor ring (per queue) * @priv: driver private structure @@ -353,7 +353,7 @@ Signed-off-by: Jakub Kicinski xdp_rxq_info_unreg_mem_model(&rx_q->xdp_rxq); -@@ -1708,9 +1739,9 @@ static int __init_dma_rx_desc_rings(stru +@@ -1709,9 +1740,9 @@ static int __init_dma_rx_desc_rings(stru /* RX XDP ZC buffer pool may not be populated, e.g. * xdpsock TX-only. */ @@ -365,7 +365,7 @@ Signed-off-by: Jakub Kicinski if (ret < 0) return -ENOMEM; } -@@ -1720,17 +1751,19 @@ static int __init_dma_rx_desc_rings(stru +@@ -1721,17 +1752,19 @@ static int __init_dma_rx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, rx_q->dma_erx, rx_q->dma_rx_phy, @@ -388,7 +388,7 @@ Signed-off-by: Jakub Kicinski { struct stmmac_priv *priv = netdev_priv(dev); u32 rx_count = priv->plat->rx_queues_to_use; -@@ -1742,7 +1775,7 @@ static int init_dma_rx_desc_rings(struct +@@ -1743,7 +1776,7 @@ static int init_dma_rx_desc_rings(struct "SKB addresses:\nskb\t\tskb data\tdma data\n"); for (queue = 0; queue < rx_count; queue++) { @@ -397,7 +397,7 @@ Signed-off-by: Jakub Kicinski if (ret) goto err_init_rx_buffers; } -@@ -1751,12 +1784,12 @@ static int init_dma_rx_desc_rings(struct +@@ -1752,12 +1785,12 @@ static int init_dma_rx_desc_rings(struct err_init_rx_buffers: while (queue >= 0) { @@ -413,7 +413,7 @@ Signed-off-by: Jakub Kicinski rx_q->buf_alloc_num = 0; rx_q->xsk_pool = NULL; -@@ -1773,14 +1806,17 @@ err_init_rx_buffers: +@@ -1774,14 +1807,17 @@ err_init_rx_buffers: /** * __init_dma_tx_desc_rings - init the TX descriptor ring (per queue) * @priv: driver private structure @@ -434,7 +434,7 @@ Signed-off-by: Jakub Kicinski int i; netif_dbg(priv, probe, priv->dev, -@@ -1792,16 +1828,16 @@ static int __init_dma_tx_desc_rings(stru +@@ -1793,16 +1829,16 @@ static int __init_dma_tx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, tx_q->dma_etx, tx_q->dma_tx_phy, @@ -454,7 +454,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1823,7 +1859,8 @@ static int __init_dma_tx_desc_rings(stru +@@ -1824,7 +1860,8 @@ static int __init_dma_tx_desc_rings(stru return 0; } @@ -464,7 +464,7 @@ Signed-off-by: Jakub Kicinski { struct stmmac_priv *priv = netdev_priv(dev); u32 tx_queue_cnt; -@@ -1832,7 +1869,7 @@ static int init_dma_tx_desc_rings(struct +@@ -1833,7 +1870,7 @@ static int init_dma_tx_desc_rings(struct tx_queue_cnt = priv->plat->tx_queues_to_use; for (queue = 0; queue < tx_queue_cnt; queue++) @@ -473,7 +473,7 @@ Signed-off-by: Jakub Kicinski return 0; } -@@ -1840,26 +1877,29 @@ static int init_dma_tx_desc_rings(struct +@@ -1841,26 +1878,29 @@ static int init_dma_tx_desc_rings(struct /** * init_dma_desc_rings - init the RX/TX descriptor rings * @dev: net device structure @@ -508,7 +508,7 @@ Signed-off-by: Jakub Kicinski return ret; } -@@ -1867,17 +1907,20 @@ static int init_dma_desc_rings(struct ne +@@ -1868,17 +1908,20 @@ static int init_dma_desc_rings(struct ne /** * dma_free_tx_skbufs - free TX dma buffers * @priv: private structure @@ -533,7 +533,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->xsk_pool && tx_q->xsk_frames_done) { xsk_tx_completed(tx_q->xsk_pool, tx_q->xsk_frames_done); -@@ -1896,34 +1939,37 @@ static void stmmac_free_tx_skbufs(struct +@@ -1897,34 +1940,37 @@ static void stmmac_free_tx_skbufs(struct u32 queue; for (queue = 0; queue < tx_queue_cnt; queue++) @@ -578,7 +578,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), rx_q->dma_erx, rx_q->dma_rx_phy); -@@ -1935,29 +1981,33 @@ static void __free_dma_rx_desc_resources +@@ -1936,29 +1982,33 @@ static void __free_dma_rx_desc_resources page_pool_destroy(rx_q->page_pool); } @@ -617,7 +617,7 @@ Signed-off-by: Jakub Kicinski if (priv->extend_desc) { size = sizeof(struct dma_extended_desc); -@@ -1970,7 +2020,7 @@ static void __free_dma_tx_desc_resources +@@ -1971,7 +2021,7 @@ static void __free_dma_tx_desc_resources addr = tx_q->dma_tx; } @@ -626,7 +626,7 @@ Signed-off-by: Jakub Kicinski dma_free_coherent(priv->device, size, addr, tx_q->dma_tx_phy); -@@ -1978,28 +2028,32 @@ static void __free_dma_tx_desc_resources +@@ -1979,28 +2029,32 @@ static void __free_dma_tx_desc_resources kfree(tx_q->tx_skbuff); } @@ -663,7 +663,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; bool xdp_prog = stmmac_xdp_is_enabled(priv); struct page_pool_params pp_params = { 0 }; -@@ -2011,8 +2065,8 @@ static int __alloc_dma_rx_desc_resources +@@ -2012,8 +2066,8 @@ static int __alloc_dma_rx_desc_resources rx_q->priv_data = priv; pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; @@ -674,7 +674,7 @@ Signed-off-by: Jakub Kicinski pp_params.order = ilog2(num_pages); pp_params.nid = dev_to_node(priv->device); pp_params.dev = priv->device; -@@ -2027,7 +2081,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2028,7 +2082,7 @@ static int __alloc_dma_rx_desc_resources return ret; } @@ -683,7 +683,7 @@ Signed-off-by: Jakub Kicinski sizeof(*rx_q->buf_pool), GFP_KERNEL); if (!rx_q->buf_pool) -@@ -2035,7 +2089,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2036,7 +2090,7 @@ static int __alloc_dma_rx_desc_resources if (priv->extend_desc) { rx_q->dma_erx = dma_alloc_coherent(priv->device, @@ -692,7 +692,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2044,7 +2098,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2045,7 +2099,7 @@ static int __alloc_dma_rx_desc_resources } else { rx_q->dma_rx = dma_alloc_coherent(priv->device, @@ -701,7 +701,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2069,7 +2123,8 @@ static int __alloc_dma_rx_desc_resources +@@ -2070,7 +2124,8 @@ static int __alloc_dma_rx_desc_resources return 0; } @@ -711,7 +711,7 @@ Signed-off-by: Jakub Kicinski { u32 rx_count = priv->plat->rx_queues_to_use; u32 queue; -@@ -2077,7 +2132,7 @@ static int alloc_dma_rx_desc_resources(s +@@ -2078,7 +2133,7 @@ static int alloc_dma_rx_desc_resources(s /* RX queues buffers and DMA */ for (queue = 0; queue < rx_count; queue++) { @@ -720,7 +720,7 @@ Signed-off-by: Jakub Kicinski if (ret) goto err_dma; } -@@ -2085,7 +2140,7 @@ static int alloc_dma_rx_desc_resources(s +@@ -2086,7 +2141,7 @@ static int alloc_dma_rx_desc_resources(s return 0; err_dma: @@ -729,7 +729,7 @@ Signed-off-by: Jakub Kicinski return ret; } -@@ -2093,28 +2148,31 @@ err_dma: +@@ -2094,28 +2149,31 @@ err_dma: /** * __alloc_dma_tx_desc_resources - alloc TX resources (per queue). * @priv: private structure @@ -765,7 +765,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct sk_buff *), GFP_KERNEL); if (!tx_q->tx_skbuff) -@@ -2127,7 +2185,7 @@ static int __alloc_dma_tx_desc_resources +@@ -2128,7 +2186,7 @@ static int __alloc_dma_tx_desc_resources else size = sizeof(struct dma_desc); @@ -774,7 +774,7 @@ Signed-off-by: Jakub Kicinski addr = dma_alloc_coherent(priv->device, size, &tx_q->dma_tx_phy, GFP_KERNEL); -@@ -2144,7 +2202,8 @@ static int __alloc_dma_tx_desc_resources +@@ -2145,7 +2203,8 @@ static int __alloc_dma_tx_desc_resources return 0; } @@ -784,7 +784,7 @@ Signed-off-by: Jakub Kicinski { u32 tx_count = priv->plat->tx_queues_to_use; u32 queue; -@@ -2152,7 +2211,7 @@ static int alloc_dma_tx_desc_resources(s +@@ -2153,7 +2212,7 @@ static int alloc_dma_tx_desc_resources(s /* TX queues buffers and DMA */ for (queue = 0; queue < tx_count; queue++) { @@ -793,7 +793,7 @@ Signed-off-by: Jakub Kicinski if (ret) goto err_dma; } -@@ -2160,27 +2219,29 @@ static int alloc_dma_tx_desc_resources(s +@@ -2161,27 +2220,29 @@ static int alloc_dma_tx_desc_resources(s return 0; err_dma: @@ -827,7 +827,7 @@ Signed-off-by: Jakub Kicinski return ret; } -@@ -2188,16 +2249,18 @@ static int alloc_dma_desc_resources(stru +@@ -2189,16 +2250,18 @@ static int alloc_dma_desc_resources(stru /** * free_dma_desc_resources - free dma desc resources * @priv: private structure @@ -849,7 +849,7 @@ Signed-off-by: Jakub Kicinski } /** -@@ -2686,8 +2749,8 @@ static void stmmac_tx_err(struct stmmac_ +@@ -2687,8 +2750,8 @@ static void stmmac_tx_err(struct stmmac_ netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, chan)); stmmac_stop_tx_dma(priv, chan); @@ -860,7 +860,7 @@ Signed-off-by: Jakub Kicinski stmmac_reset_tx_queue(priv, chan); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -3684,19 +3747,93 @@ static int stmmac_request_irq(struct net +@@ -3685,19 +3748,93 @@ static int stmmac_request_irq(struct net } /** @@ -957,7 +957,7 @@ Signed-off-by: Jakub Kicinski u32 chan; int ret; -@@ -3723,45 +3860,10 @@ static int stmmac_open(struct net_device +@@ -3724,45 +3861,10 @@ static int stmmac_open(struct net_device memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); priv->xstats.threshold = tc; @@ -1005,7 +1005,7 @@ Signed-off-by: Jakub Kicinski if (priv->plat->serdes_powerup) { ret = priv->plat->serdes_powerup(dev, priv->plat->bsp_priv); -@@ -3804,14 +3906,28 @@ irq_error: +@@ -3805,14 +3907,28 @@ irq_error: stmmac_hw_teardown(dev); init_error: @@ -1036,7 +1036,7 @@ Signed-off-by: Jakub Kicinski static void stmmac_fpe_stop_wq(struct stmmac_priv *priv) { set_bit(__FPE_REMOVING, &priv->fpe_task_state); -@@ -3858,7 +3974,7 @@ static int stmmac_release(struct net_dev +@@ -3859,7 +3975,7 @@ static int stmmac_release(struct net_dev stmmac_stop_all_dma(priv); /* Release and free the Rx/Tx resources */ @@ -1045,7 +1045,7 @@ Signed-off-by: Jakub Kicinski /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); -@@ -6403,7 +6519,7 @@ void stmmac_disable_rx_queue(struct stmm +@@ -6402,7 +6518,7 @@ void stmmac_disable_rx_queue(struct stmm spin_unlock_irqrestore(&ch->lock, flags); stmmac_stop_rx_dma(priv, queue); @@ -1054,7 +1054,7 @@ Signed-off-by: Jakub Kicinski } void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue) -@@ -6414,21 +6530,21 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6413,21 +6529,21 @@ void stmmac_enable_rx_queue(struct stmma u32 buf_size; int ret; @@ -1080,7 +1080,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, rx_q->queue_index); -@@ -6466,7 +6582,7 @@ void stmmac_disable_tx_queue(struct stmm +@@ -6465,7 +6581,7 @@ void stmmac_disable_tx_queue(struct stmm spin_unlock_irqrestore(&ch->lock, flags); stmmac_stop_tx_dma(priv, queue); @@ -1089,7 +1089,7 @@ Signed-off-by: Jakub Kicinski } void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue) -@@ -6476,21 +6592,21 @@ void stmmac_enable_tx_queue(struct stmma +@@ -6475,21 +6591,21 @@ void stmmac_enable_tx_queue(struct stmma unsigned long flags; int ret; @@ -1115,7 +1115,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, tx_q->queue_index); -@@ -6530,7 +6646,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6529,7 +6645,7 @@ void stmmac_xdp_release(struct net_devic stmmac_stop_all_dma(priv); /* Release and free the Rx/Tx resources */ @@ -1124,7 +1124,7 @@ Signed-off-by: Jakub Kicinski /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); -@@ -6555,14 +6671,14 @@ int stmmac_xdp_open(struct net_device *d +@@ -6554,14 +6670,14 @@ int stmmac_xdp_open(struct net_device *d u32 chan; int ret; @@ -1141,7 +1141,7 @@ Signed-off-by: Jakub Kicinski if (ret < 0) { netdev_err(dev, "%s: DMA descriptors initialization failed\n", __func__); -@@ -6644,7 +6760,7 @@ irq_error: +@@ -6643,7 +6759,7 @@ irq_error: stmmac_hw_teardown(dev); init_error: @@ -1150,7 +1150,7 @@ Signed-off-by: Jakub Kicinski dma_desc_error: return ret; } -@@ -7503,7 +7619,7 @@ int stmmac_resume(struct device *dev) +@@ -7506,7 +7622,7 @@ int stmmac_resume(struct device *dev) stmmac_reset_queues_param(priv); stmmac_free_tx_skbufs(priv); diff --git a/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch b/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch index 8fccc716597cf5..6ebb527726e440 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5626,18 +5626,15 @@ static int stmmac_change_mtu(struct net_ +@@ -5624,18 +5624,15 @@ static int stmmac_change_mtu(struct net_ { struct stmmac_priv *priv = netdev_priv(dev); int txfifosz = priv->plat->tx_fifo_size; @@ -40,7 +40,7 @@ Signed-off-by: Jakub Kicinski if (stmmac_xdp_is_enabled(priv) && new_mtu > ETH_DATA_LEN) { netdev_dbg(priv->dev, "Jumbo frames not supported for XDP\n"); return -EINVAL; -@@ -5649,8 +5646,29 @@ static int stmmac_change_mtu(struct net_ +@@ -5647,8 +5644,29 @@ static int stmmac_change_mtu(struct net_ if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) return -EINVAL; diff --git a/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch b/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch index ceec58466e19bf..c8176c90f526c1 100644 --- a/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch +++ b/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch @@ -75,7 +75,7 @@ Signed-off-by: David S. Miller if (pl->pcs_ops) { err = pl->pcs_ops->pcs_config(pl->pcs, pl->cur_link_an_mode, state->interface, -@@ -1260,6 +1285,7 @@ struct phylink *phylink_create(struct ph +@@ -1261,6 +1286,7 @@ struct phylink *phylink_create(struct ph pl->link_config.speed = SPEED_UNKNOWN; pl->link_config.duplex = DUPLEX_UNKNOWN; pl->link_config.an_enabled = true; @@ -83,7 +83,7 @@ Signed-off-by: David S. Miller pl->mac_ops = mac_ops; __set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); timer_setup(&pl->link_poll, phylink_fixed_poll, 0); -@@ -1651,6 +1677,8 @@ void phylink_start(struct phylink *pl) +@@ -1652,6 +1678,8 @@ void phylink_start(struct phylink *pl) if (pl->netdev) netif_carrier_off(pl->netdev); @@ -92,7 +92,7 @@ Signed-off-by: David S. Miller /* Apply the link configuration to the MAC when starting. This allows * a fixed-link to start with the correct parameters, and also * ensures that we set the appropriate advertisement for Serdes links. -@@ -1661,6 +1689,8 @@ void phylink_start(struct phylink *pl) +@@ -1662,6 +1690,8 @@ void phylink_start(struct phylink *pl) */ phylink_mac_initial_config(pl, true); @@ -101,7 +101,7 @@ Signed-off-by: David S. Miller clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); phylink_run_resolve(pl); -@@ -1680,16 +1710,9 @@ void phylink_start(struct phylink *pl) +@@ -1681,16 +1711,9 @@ void phylink_start(struct phylink *pl) poll = true; } @@ -120,7 +120,7 @@ Signed-off-by: David S. Miller if (poll) mod_timer(&pl->link_poll, jiffies + HZ); if (pl->phydev) -@@ -1726,6 +1749,10 @@ void phylink_stop(struct phylink *pl) +@@ -1727,6 +1750,10 @@ void phylink_stop(struct phylink *pl) } phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED); diff --git a/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch b/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch index 41d3e121de195f..dbd734e9cf43d5 100644 --- a/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch +++ b/target/linux/generic/backport-5.15/810-v5.17-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c -@@ -1316,6 +1316,7 @@ static const struct usb_device_id produc +@@ -1317,6 +1317,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ {QMI_FIXED_INTF(0x19d2, 0x1432, 3)}, /* ZTE ME3620 */ diff --git a/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch b/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch index b23f9a4b9e2205..725af4b52cf179 100644 --- a/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch +++ b/target/linux/generic/backport-5.15/821-v5.16-Bluetooth-btusb-Support-public-address-configuration.patch @@ -17,7 +17,7 @@ Signed-off-by: Marcel Holtmann --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -2275,6 +2275,23 @@ struct btmtk_section_map { +@@ -2287,6 +2287,23 @@ struct btmtk_section_map { }; } __packed; @@ -41,7 +41,7 @@ Signed-off-by: Marcel Holtmann static void btusb_mtk_wmt_recv(struct urb *urb) { struct hci_dev *hdev = urb->context; -@@ -3926,6 +3943,7 @@ static int btusb_probe(struct usb_interf +@@ -3941,6 +3958,7 @@ static int btusb_probe(struct usb_interf hdev->shutdown = btusb_mtk_shutdown; hdev->manufacturer = 70; hdev->cmd_timeout = btusb_mtk_cmd_timeout; diff --git a/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch b/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch index 6fe61a9defecd6..d72866eabf1490 100644 --- a/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch +++ b/target/linux/generic/backport-5.15/822-v5.17-Bluetooth-btusb-Fix-application-of-sizeof-to-pointer.patch @@ -18,7 +18,7 @@ Signed-off-by: Marcel Holtmann --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -2280,7 +2280,7 @@ static int btusb_set_bdaddr_mtk(struct h +@@ -2292,7 +2292,7 @@ static int btusb_set_bdaddr_mtk(struct h struct sk_buff *skb; long ret; diff --git a/target/linux/generic/backport-5.15/823-v5.18-Bluetooth-btusb-Add-a-new-PID-VID-13d3-3567-for-MT79.patch b/target/linux/generic/backport-5.15/823-v5.18-Bluetooth-btusb-Add-a-new-PID-VID-13d3-3567-for-MT79.patch index d670195da1f2fa..ebb6cc471768e5 100644 --- a/target/linux/generic/backport-5.15/823-v5.18-Bluetooth-btusb-Add-a-new-PID-VID-13d3-3567-for-MT79.patch +++ b/target/linux/generic/backport-5.15/823-v5.18-Bluetooth-btusb-Add-a-new-PID-VID-13d3-3567-for-MT79.patch @@ -58,7 +58,7 @@ Signed-off-by: Marcel Holtmann --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -464,6 +464,9 @@ static const struct usb_device_id blackl +@@ -476,6 +476,9 @@ static const struct usb_device_id blackl { USB_DEVICE(0x13d3, 0x3564), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH | BTUSB_VALID_LE_STATES }, diff --git a/target/linux/generic/backport-5.15/824-v5.19-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0c8-for-MT79.patch b/target/linux/generic/backport-5.15/824-v5.19-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0c8-for-MT79.patch index be9dc734215194..a8c7ca003a9cd8 100644 --- a/target/linux/generic/backport-5.15/824-v5.19-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0c8-for-MT79.patch +++ b/target/linux/generic/backport-5.15/824-v5.19-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0c8-for-MT79.patch @@ -56,7 +56,7 @@ Signed-off-by: Marcel Holtmann --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -455,6 +455,9 @@ static const struct usb_device_id blackl +@@ -467,6 +467,9 @@ static const struct usb_device_id blackl BTUSB_VALID_LE_STATES }, /* Additional MediaTek MT7921 Bluetooth devices */ diff --git a/target/linux/generic/backport-5.15/825-v6.1-Bluetooth-btusb-Add-a-new-VID-PID-0e8d-0608-for-MT79.patch b/target/linux/generic/backport-5.15/825-v6.1-Bluetooth-btusb-Add-a-new-VID-PID-0e8d-0608-for-MT79.patch index 24ec68a2ca50b8..b46e6926d1452e 100644 --- a/target/linux/generic/backport-5.15/825-v6.1-Bluetooth-btusb-Add-a-new-VID-PID-0e8d-0608-for-MT79.patch +++ b/target/linux/generic/backport-5.15/825-v6.1-Bluetooth-btusb-Add-a-new-VID-PID-0e8d-0608-for-MT79.patch @@ -54,7 +54,7 @@ Signed-off-by: Luiz Augusto von Dentz --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -473,6 +473,9 @@ static const struct usb_device_id blackl +@@ -485,6 +485,9 @@ static const struct usb_device_id blackl { USB_DEVICE(0x0489, 0xe0cd), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH | BTUSB_VALID_LE_STATES }, diff --git a/target/linux/generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch b/target/linux/generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch index c7d16e5c4c3261..bff41aa2a478e6 100644 --- a/target/linux/generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch +++ b/target/linux/generic/hack-5.15/726-net-eth-dpaa2-eth-do-not-hold-rtnl_lock.patch @@ -27,7 +27,7 @@ Signed-off-by: Russell King --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -@@ -4217,12 +4217,10 @@ static irqreturn_t dpni_irq0_handler_thr +@@ -4215,12 +4215,10 @@ static irqreturn_t dpni_irq0_handler_thr dpaa2_eth_set_mac_addr(netdev_priv(net_dev)); dpaa2_eth_update_tx_fqids(priv); diff --git a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch index 96525089ef5a9e..7442b7560f2f2c 100644 --- a/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch +++ b/target/linux/generic/hack-5.15/760-net-usb-r8152-add-LED-configuration-from-OF.patch @@ -22,7 +22,7 @@ Signed-off-by: David Bauer #include #include #include -@@ -6896,6 +6897,22 @@ static void rtl_tally_reset(struct r8152 +@@ -6910,6 +6911,22 @@ static void rtl_tally_reset(struct r8152 ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data); } @@ -45,7 +45,7 @@ Signed-off-by: David Bauer static void r8152b_init(struct r8152 *tp) { u32 ocp_data; -@@ -6937,6 +6954,8 @@ static void r8152b_init(struct r8152 *tp +@@ -6951,6 +6968,8 @@ static void r8152b_init(struct r8152 *tp ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); @@ -54,7 +54,7 @@ Signed-off-by: David Bauer } static void r8153_init(struct r8152 *tp) -@@ -7077,6 +7096,8 @@ static void r8153_init(struct r8152 *tp) +@@ -7091,6 +7110,8 @@ static void r8153_init(struct r8152 *tp) tp->coalesce = COALESCE_SLOW; break; } @@ -63,7 +63,7 @@ Signed-off-by: David Bauer } static void r8153b_init(struct r8152 *tp) -@@ -7159,6 +7180,8 @@ static void r8153b_init(struct r8152 *tp +@@ -7173,6 +7194,8 @@ static void r8153b_init(struct r8152 *tp rtl_tally_reset(tp); tp->coalesce = 15000; /* 15 us */ diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 304f5480a3febf..60f02f71436e6c 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -43,7 +43,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1144,6 +1149,11 @@ static const struct usb_device_id option +@@ -1146,6 +1151,11 @@ static const struct usb_device_id option { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */ .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) }, @@ -55,7 +55,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support /* Quectel products using Qualcomm vendor ID */ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), -@@ -1185,6 +1195,11 @@ static const struct usb_device_id option +@@ -1187,6 +1197,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch index 33c5c271212a3d..a463bf7c4eb4d5 100644 --- a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch +++ b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch @@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle static void phylink_mac_pcs_get_state(struct phylink *pl, struct phylink_link_state *state) { -@@ -3014,6 +3013,52 @@ void phylink_mii_c22_pcs_get_state(struc +@@ -3015,6 +3014,52 @@ void phylink_mii_c22_pcs_get_state(struc EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_get_state); /** @@ -118,7 +118,7 @@ Signed-off-by: Daniel Golle * phylink_mii_c22_pcs_set_advertisement() - configure the clause 37 PCS * advertisement * @pcs: a pointer to a &struct mdio_device. -@@ -3085,6 +3130,46 @@ int phylink_mii_c22_pcs_set_advertisemen +@@ -3086,6 +3131,46 @@ int phylink_mii_c22_pcs_set_advertisemen EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_set_advertisement); /** diff --git a/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch b/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch index 0a2c82cacbc11f..00ce48c38445a9 100644 --- a/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch +++ b/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch @@ -129,7 +129,7 @@ Signed-off-by: John Crispin { --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c -@@ -561,7 +561,7 @@ static struct class gpio_class = { +@@ -564,7 +564,7 @@ static struct class gpio_class = { * * Returns zero on success, else an error. */ @@ -138,7 +138,7 @@ Signed-off-by: John Crispin { struct gpio_chip *chip; struct gpio_device *gdev; -@@ -623,6 +623,8 @@ int gpiod_export(struct gpio_desc *desc, +@@ -626,6 +626,8 @@ int gpiod_export(struct gpio_desc *desc, offset = gpio_chip_hwgpio(desc); if (chip->names && chip->names[offset]) ioname = chip->names[offset]; @@ -147,7 +147,7 @@ Signed-off-by: John Crispin dev = device_create_with_groups(&gpio_class, &gdev->dev, MKDEV(0, 0), data, gpio_groups, -@@ -644,6 +646,12 @@ err_unlock: +@@ -647,6 +649,12 @@ err_unlock: gpiod_dbg(desc, "%s: status %d\n", __func__, status); return status; } diff --git a/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch index 0fcd415966ef90..be4dacf0945861 100644 --- a/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch +++ b/target/linux/generic/pending-5.15/300-mips_expose_boot_raw.patch @@ -9,7 +9,7 @@ Acked-by: Rob Landley --- --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1102,9 +1102,6 @@ config FW_ARC +@@ -1103,9 +1103,6 @@ config FW_ARC config ARCH_MAY_HAVE_PC_FDC bool @@ -19,7 +19,7 @@ Acked-by: Rob Landley config CEVT_BCM1480 bool -@@ -3184,6 +3181,18 @@ choice +@@ -3186,6 +3183,18 @@ choice bool "Extend builtin kernel arguments with bootloader arguments" endchoice diff --git a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index a15fc786a0ef88..723af247703fd4 100644 --- a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -7703,7 +7703,7 @@ static int nft_register_flowtable_net_ho +@@ -7709,7 +7709,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); diff --git a/target/linux/generic/pending-5.15/920-mangle_bootargs.patch b/target/linux/generic/pending-5.15/920-mangle_bootargs.patch index 7e1f26d243f027..5f2bb8c37f446a 100644 --- a/target/linux/generic/pending-5.15/920-mangle_bootargs.patch +++ b/target/linux/generic/pending-5.15/920-mangle_bootargs.patch @@ -31,7 +31,7 @@ Signed-off-by: Imre Kaloz help --- a/init/main.c +++ b/init/main.c -@@ -614,6 +614,29 @@ static inline void setup_nr_cpu_ids(void +@@ -618,6 +618,29 @@ static inline void setup_nr_cpu_ids(void static inline void smp_prepare_cpus(unsigned int maxcpus) { } #endif @@ -61,7 +61,7 @@ Signed-off-by: Imre Kaloz /* * We need to store the untouched command line for future reference. * We also need to store the touched command line since the parameter -@@ -953,6 +976,7 @@ asmlinkage __visible void __init __no_sa +@@ -957,6 +980,7 @@ asmlinkage __visible void __init __no_sa pr_notice("%s", linux_banner); early_security_init(); setup_arch(&command_line); diff --git a/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-disable-SDI.patch b/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-disable-SDI.patch index a0074103cc7a4a..78a72597e7b37d 100644 --- a/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-disable-SDI.patch +++ b/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-disable-SDI.patch @@ -1,6 +1,6 @@ --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c -@@ -404,6 +404,20 @@ static int __qcom_scm_set_dload_mode(str +@@ -411,6 +411,20 @@ static int __qcom_scm_set_dload_mode(str return qcom_scm_call_atomic(__scm->dev, &desc, NULL); } @@ -21,7 +21,7 @@ static void qcom_scm_set_download_mode(bool enable) { bool avail; -@@ -1314,6 +1328,13 @@ static int qcom_scm_probe(struct platfor +@@ -1321,6 +1335,13 @@ static int qcom_scm_probe(struct platfor if (download_mode) qcom_scm_set_download_mode(true); diff --git a/target/linux/ipq40xx/patches-5.15/421-firmware-qcom-scm-cold-boot-address.patch b/target/linux/ipq40xx/patches-5.15/421-firmware-qcom-scm-cold-boot-address.patch index 13ebb5b000aebe..aedad13aa2101c 100644 --- a/target/linux/ipq40xx/patches-5.15/421-firmware-qcom-scm-cold-boot-address.patch +++ b/target/linux/ipq40xx/patches-5.15/421-firmware-qcom-scm-cold-boot-address.patch @@ -101,7 +101,7 @@ } --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c -@@ -344,6 +344,17 @@ int qcom_scm_set_cold_boot_addr(void *en +@@ -351,6 +351,17 @@ int qcom_scm_set_cold_boot_addr(void *en desc.args[0] = flags; desc.args[1] = virt_to_phys(entry); diff --git a/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch b/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch index e24895deeca209..28bc338e3b38b2 100644 --- a/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch +++ b/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch @@ -15,7 +15,7 @@ Signed-off-by: Robert Marko --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c -@@ -1352,7 +1352,8 @@ static int qcom_scm_probe(struct platfor +@@ -1359,7 +1359,8 @@ static int qcom_scm_probe(struct platfor static void qcom_scm_shutdown(struct platform_device *pdev) { /* Clean shutdown, disable download mode to allow normal restart */ diff --git a/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch index 536a9dad205f23..9e77c0412a8efb 100644 --- a/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch @@ -259,7 +259,7 @@ Signed-off-by: Adrian Panella static int kernel_init(void *); extern void init_IRQ(void); -@@ -990,6 +994,18 @@ asmlinkage __visible void __init __no_sa +@@ -994,6 +998,18 @@ asmlinkage __visible void __init __no_sa pr_notice("Kernel command line: %s\n", saved_command_line); /* parameters may set static keys */ jump_label_init(); diff --git a/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch b/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch index 11360c92a66e2e..9703fa05189b9f 100644 --- a/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch +++ b/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch @@ -45,7 +45,7 @@ Signed-off-by: Oskari Lemmela int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled) { -@@ -2725,9 +2725,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2726,9 +2726,7 @@ static int stmmac_tx_clean(struct stmmac /* We still have pending packets, let's call for a new scheduling */ if (tx_q->dirty_tx != tx_q->cur_tx) @@ -56,7 +56,7 @@ Signed-off-by: Oskari Lemmela __netif_tx_unlock_bh(netdev_get_tx_queue(priv->dev, queue)); -@@ -3019,9 +3017,7 @@ static void stmmac_tx_timer_arm(struct s +@@ -3020,9 +3018,7 @@ static void stmmac_tx_timer_arm(struct s { struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; @@ -67,7 +67,7 @@ Signed-off-by: Oskari Lemmela } /** -@@ -3030,9 +3026,9 @@ static void stmmac_tx_timer_arm(struct s +@@ -3031,9 +3027,9 @@ static void stmmac_tx_timer_arm(struct s * Description: * This is the timer handler to directly invoke the stmmac_tx_clean. */ @@ -79,7 +79,7 @@ Signed-off-by: Oskari Lemmela struct stmmac_priv *priv = tx_q->priv_data; struct stmmac_channel *ch; struct napi_struct *napi; -@@ -3048,8 +3044,6 @@ static enum hrtimer_restart stmmac_tx_ti +@@ -3049,8 +3045,6 @@ static enum hrtimer_restart stmmac_tx_ti spin_unlock_irqrestore(&ch->lock, flags); __napi_schedule(napi); } @@ -88,7 +88,7 @@ Signed-off-by: Oskari Lemmela } /** -@@ -3072,8 +3066,7 @@ static void stmmac_init_coalesce(struct +@@ -3073,8 +3067,7 @@ static void stmmac_init_coalesce(struct priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES; priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER; @@ -98,7 +98,7 @@ Signed-off-by: Oskari Lemmela } for (chan = 0; chan < rx_channel_count; chan++) -@@ -3902,7 +3895,7 @@ irq_error: +@@ -3903,7 +3896,7 @@ irq_error: phylink_stop(priv->phylink); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -107,7 +107,7 @@ Signed-off-by: Oskari Lemmela stmmac_hw_teardown(dev); init_error: -@@ -3958,7 +3951,7 @@ static int stmmac_release(struct net_dev +@@ -3959,7 +3952,7 @@ static int stmmac_release(struct net_dev stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -116,7 +116,7 @@ Signed-off-by: Oskari Lemmela netif_tx_disable(dev); -@@ -6655,7 +6648,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6654,7 +6647,7 @@ void stmmac_xdp_release(struct net_devic stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -125,7 +125,7 @@ Signed-off-by: Oskari Lemmela /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); -@@ -6750,8 +6743,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6749,8 +6742,7 @@ int stmmac_xdp_open(struct net_device *d stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, chan); @@ -135,7 +135,7 @@ Signed-off-by: Oskari Lemmela } /* Enable the MAC Rx/Tx */ -@@ -6774,7 +6766,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6773,7 +6765,7 @@ int stmmac_xdp_open(struct net_device *d irq_error: for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -144,7 +144,7 @@ Signed-off-by: Oskari Lemmela stmmac_hw_teardown(dev); init_error: -@@ -7495,7 +7487,7 @@ int stmmac_suspend(struct device *dev) +@@ -7497,7 +7489,7 @@ int stmmac_suspend(struct device *dev) stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) diff --git a/target/linux/ipq807x/patches-5.15/0021-v6.0-clk-qcom-ipq8074-add-PPE-crypto-clock.patch b/target/linux/ipq807x/patches-5.15/0021-v6.0-clk-qcom-ipq8074-add-PPE-crypto-clock.patch index 71fd33331df15c..a0b171fd27a314 100644 --- a/target/linux/ipq807x/patches-5.15/0021-v6.0-clk-qcom-ipq8074-add-PPE-crypto-clock.patch +++ b/target/linux/ipq807x/patches-5.15/0021-v6.0-clk-qcom-ipq8074-add-PPE-crypto-clock.patch @@ -17,7 +17,7 @@ Link: https://lore.kernel.org/r/20220515210048.483898-5-robimarko@gmail.com --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c -@@ -3183,6 +3183,24 @@ static struct clk_branch gcc_nss_ptp_ref +@@ -3177,6 +3177,24 @@ static struct clk_branch gcc_nss_ptp_ref }, }; @@ -42,7 +42,7 @@ Link: https://lore.kernel.org/r/20220515210048.483898-5-robimarko@gmail.com static struct clk_branch gcc_nssnoc_ce_apb_clk = { .halt_reg = 0x6830c, .clkr = { -@@ -4655,6 +4673,7 @@ static struct clk_regmap *gcc_ipq8074_cl +@@ -4649,6 +4667,7 @@ static struct clk_regmap *gcc_ipq8074_cl [GCC_PCIE0_RCHNG_CLK_SRC] = &pcie0_rchng_clk_src.clkr, [GCC_PCIE0_RCHNG_CLK] = &gcc_pcie0_rchng_clk.clkr, [GCC_PCIE0_AXI_S_BRIDGE_CLK] = &gcc_pcie0_axi_s_bridge_clk.clkr, diff --git a/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch b/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch index 1f76866a434cb1..b200616c3fc280 100644 --- a/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch +++ b/target/linux/ipq807x/patches-5.15/0023-v6.0-clk-qcom-ipq8074-add-USB-GDSCs.patch @@ -33,7 +33,7 @@ Link: https://lore.kernel.org/r/20220515210048.483898-9-robimarko@gmail.com #include "reset.h" enum { -@@ -4408,6 +4409,22 @@ static struct clk_branch gcc_pcie0_axi_s +@@ -4402,6 +4403,22 @@ static struct clk_branch gcc_pcie0_axi_s }, }; @@ -56,7 +56,7 @@ Link: https://lore.kernel.org/r/20220515210048.483898-9-robimarko@gmail.com static const struct alpha_pll_config ubi32_pll_config = { .l = 0x4e, .config_ctl_val = 0x200d4aa8, -@@ -4811,6 +4828,11 @@ static const struct qcom_reset_map gcc_i +@@ -4805,6 +4822,11 @@ static const struct qcom_reset_map gcc_i [GCC_PCIE1_AXI_MASTER_STICKY_ARES] = { 0x76040, 6 }, }; @@ -68,7 +68,7 @@ Link: https://lore.kernel.org/r/20220515210048.483898-9-robimarko@gmail.com static const struct of_device_id gcc_ipq8074_match_table[] = { { .compatible = "qcom,gcc-ipq8074" }, { } -@@ -4833,6 +4855,8 @@ static const struct qcom_cc_desc gcc_ipq +@@ -4827,6 +4849,8 @@ static const struct qcom_cc_desc gcc_ipq .num_resets = ARRAY_SIZE(gcc_ipq8074_resets), .clk_hws = gcc_ipq8074_hws, .num_clk_hws = ARRAY_SIZE(gcc_ipq8074_hws), diff --git a/target/linux/ipq807x/patches-5.15/0047-v6.2-clk-qcom-ipq8074-convert-to-parent-data.patch b/target/linux/ipq807x/patches-5.15/0047-v6.2-clk-qcom-ipq8074-convert-to-parent-data.patch index 9162ea538d3805..c209adbc06f326 100644 --- a/target/linux/ipq807x/patches-5.15/0047-v6.2-clk-qcom-ipq8074-convert-to-parent-data.patch +++ b/target/linux/ipq807x/patches-5.15/0047-v6.2-clk-qcom-ipq8074-convert-to-parent-data.patch @@ -390,8 +390,8 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com + &gpll0_main.clkr.hw }, .num_parents = 1, .ops = &clk_fixed_factor_ops, - .flags = CLK_SET_RATE_PARENT, -@@ -429,9 +86,8 @@ static struct clk_alpha_pll_postdiv gpll + }, +@@ -428,9 +85,8 @@ static struct clk_alpha_pll_postdiv gpll .width = 4, .clkr.hw.init = &(struct clk_init_data){ .name = "gpll0", @@ -403,7 +403,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, }, -@@ -445,8 +101,9 @@ static struct clk_alpha_pll gpll2_main = +@@ -444,8 +100,9 @@ static struct clk_alpha_pll gpll2_main = .enable_mask = BIT(2), .hw.init = &(struct clk_init_data){ .name = "gpll2_main", @@ -415,7 +415,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com }, .num_parents = 1, .ops = &clk_alpha_pll_ops, -@@ -461,9 +118,8 @@ static struct clk_alpha_pll_postdiv gpll +@@ -460,9 +117,8 @@ static struct clk_alpha_pll_postdiv gpll .width = 4, .clkr.hw.init = &(struct clk_init_data){ .name = "gpll2", @@ -426,8 +426,8 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com + &gpll2_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, -@@ -478,8 +134,9 @@ static struct clk_alpha_pll gpll4_main = + }, +@@ -476,8 +132,9 @@ static struct clk_alpha_pll gpll4_main = .enable_mask = BIT(5), .hw.init = &(struct clk_init_data){ .name = "gpll4_main", @@ -439,7 +439,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com }, .num_parents = 1, .ops = &clk_alpha_pll_ops, -@@ -494,9 +151,8 @@ static struct clk_alpha_pll_postdiv gpll +@@ -492,9 +149,8 @@ static struct clk_alpha_pll_postdiv gpll .width = 4, .clkr.hw.init = &(struct clk_init_data){ .name = "gpll4", @@ -450,8 +450,8 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com + &gpll4_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, -@@ -512,8 +168,9 @@ static struct clk_alpha_pll gpll6_main = + }, +@@ -509,8 +165,9 @@ static struct clk_alpha_pll gpll6_main = .enable_mask = BIT(7), .hw.init = &(struct clk_init_data){ .name = "gpll6_main", @@ -463,7 +463,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com }, .num_parents = 1, .ops = &clk_alpha_pll_ops, -@@ -528,9 +185,8 @@ static struct clk_alpha_pll_postdiv gpll +@@ -525,9 +182,8 @@ static struct clk_alpha_pll_postdiv gpll .width = 2, .clkr.hw.init = &(struct clk_init_data){ .name = "gpll6", @@ -474,8 +474,8 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com + &gpll6_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, -@@ -542,9 +198,8 @@ static struct clk_fixed_factor gpll6_out + }, +@@ -538,9 +194,8 @@ static struct clk_fixed_factor gpll6_out .div = 2, .hw.init = &(struct clk_init_data){ .name = "gpll6_out_main_div2", @@ -486,8 +486,8 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com + &gpll6_main.clkr.hw }, .num_parents = 1, .ops = &clk_fixed_factor_ops, - .flags = CLK_SET_RATE_PARENT, -@@ -560,8 +215,9 @@ static struct clk_alpha_pll ubi32_pll_ma + }, +@@ -555,8 +210,9 @@ static struct clk_alpha_pll ubi32_pll_ma .enable_mask = BIT(6), .hw.init = &(struct clk_init_data){ .name = "ubi32_pll_main", @@ -499,7 +499,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com }, .num_parents = 1, .ops = &clk_alpha_pll_huayra_ops, -@@ -575,9 +231,8 @@ static struct clk_alpha_pll_postdiv ubi3 +@@ -570,9 +226,8 @@ static struct clk_alpha_pll_postdiv ubi3 .width = 2, .clkr.hw.init = &(struct clk_init_data){ .name = "ubi32_pll", @@ -511,7 +511,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, .flags = CLK_SET_RATE_PARENT, -@@ -592,8 +247,9 @@ static struct clk_alpha_pll nss_crypto_p +@@ -587,8 +242,9 @@ static struct clk_alpha_pll nss_crypto_p .enable_mask = BIT(4), .hw.init = &(struct clk_init_data){ .name = "nss_crypto_pll_main", @@ -523,7 +523,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com }, .num_parents = 1, .ops = &clk_alpha_pll_ops, -@@ -607,9 +263,8 @@ static struct clk_alpha_pll_postdiv nss_ +@@ -602,9 +258,8 @@ static struct clk_alpha_pll_postdiv nss_ .width = 4, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_crypto_pll", @@ -534,8 +534,8 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com + &nss_crypto_pll_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, -@@ -623,6 +278,18 @@ static const struct freq_tbl ftbl_pcnoc_ + }, +@@ -617,6 +272,18 @@ static const struct freq_tbl ftbl_pcnoc_ { } }; @@ -554,7 +554,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 pcnoc_bfdcd_clk_src = { .cmd_rcgr = 0x27000, .freq_tbl = ftbl_pcnoc_bfdcd_clk_src, -@@ -630,8 +297,8 @@ static struct clk_rcg2 pcnoc_bfdcd_clk_s +@@ -624,8 +291,8 @@ static struct clk_rcg2 pcnoc_bfdcd_clk_s .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "pcnoc_bfdcd_clk_src", @@ -565,7 +565,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, .flags = CLK_IS_CRITICAL, }, -@@ -642,9 +309,8 @@ static struct clk_fixed_factor pcnoc_clk +@@ -636,9 +303,8 @@ static struct clk_fixed_factor pcnoc_clk .div = 1, .hw.init = &(struct clk_init_data){ .name = "pcnoc_clk_src", @@ -577,7 +577,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_fixed_factor_ops, .flags = CLK_SET_RATE_PARENT, -@@ -658,8 +324,9 @@ static struct clk_branch gcc_sleep_clk_s +@@ -652,8 +318,9 @@ static struct clk_branch gcc_sleep_clk_s .enable_mask = BIT(1), .hw.init = &(struct clk_init_data){ .name = "gcc_sleep_clk_src", @@ -589,7 +589,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com }, .num_parents = 1, .ops = &clk_branch2_ops, -@@ -682,8 +349,8 @@ static struct clk_rcg2 blsp1_qup1_i2c_ap +@@ -676,8 +343,8 @@ static struct clk_rcg2 blsp1_qup1_i2c_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup1_i2c_apps_clk_src", @@ -600,7 +600,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -708,8 +375,8 @@ static struct clk_rcg2 blsp1_qup1_spi_ap +@@ -702,8 +369,8 @@ static struct clk_rcg2 blsp1_qup1_spi_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup1_spi_apps_clk_src", @@ -611,7 +611,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -721,8 +388,8 @@ static struct clk_rcg2 blsp1_qup2_i2c_ap +@@ -715,8 +382,8 @@ static struct clk_rcg2 blsp1_qup2_i2c_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup2_i2c_apps_clk_src", @@ -622,7 +622,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -735,8 +402,8 @@ static struct clk_rcg2 blsp1_qup2_spi_ap +@@ -729,8 +396,8 @@ static struct clk_rcg2 blsp1_qup2_spi_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup2_spi_apps_clk_src", @@ -633,7 +633,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -748,8 +415,8 @@ static struct clk_rcg2 blsp1_qup3_i2c_ap +@@ -742,8 +409,8 @@ static struct clk_rcg2 blsp1_qup3_i2c_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup3_i2c_apps_clk_src", @@ -644,7 +644,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -762,8 +429,8 @@ static struct clk_rcg2 blsp1_qup3_spi_ap +@@ -756,8 +423,8 @@ static struct clk_rcg2 blsp1_qup3_spi_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup3_spi_apps_clk_src", @@ -655,7 +655,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -775,8 +442,8 @@ static struct clk_rcg2 blsp1_qup4_i2c_ap +@@ -769,8 +436,8 @@ static struct clk_rcg2 blsp1_qup4_i2c_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup4_i2c_apps_clk_src", @@ -666,7 +666,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -789,8 +456,8 @@ static struct clk_rcg2 blsp1_qup4_spi_ap +@@ -783,8 +450,8 @@ static struct clk_rcg2 blsp1_qup4_spi_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup4_spi_apps_clk_src", @@ -677,7 +677,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -802,8 +469,8 @@ static struct clk_rcg2 blsp1_qup5_i2c_ap +@@ -796,8 +463,8 @@ static struct clk_rcg2 blsp1_qup5_i2c_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup5_i2c_apps_clk_src", @@ -688,7 +688,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -816,8 +483,8 @@ static struct clk_rcg2 blsp1_qup5_spi_ap +@@ -810,8 +477,8 @@ static struct clk_rcg2 blsp1_qup5_spi_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup5_spi_apps_clk_src", @@ -699,7 +699,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -829,8 +496,8 @@ static struct clk_rcg2 blsp1_qup6_i2c_ap +@@ -823,8 +490,8 @@ static struct clk_rcg2 blsp1_qup6_i2c_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup6_i2c_apps_clk_src", @@ -710,7 +710,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -843,8 +510,8 @@ static struct clk_rcg2 blsp1_qup6_spi_ap +@@ -837,8 +504,8 @@ static struct clk_rcg2 blsp1_qup6_spi_ap .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_qup6_spi_apps_clk_src", @@ -721,7 +721,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -877,8 +544,8 @@ static struct clk_rcg2 blsp1_uart1_apps_ +@@ -871,8 +538,8 @@ static struct clk_rcg2 blsp1_uart1_apps_ .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_uart1_apps_clk_src", @@ -732,7 +732,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -891,8 +558,8 @@ static struct clk_rcg2 blsp1_uart2_apps_ +@@ -885,8 +552,8 @@ static struct clk_rcg2 blsp1_uart2_apps_ .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_uart2_apps_clk_src", @@ -743,7 +743,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -905,8 +572,8 @@ static struct clk_rcg2 blsp1_uart3_apps_ +@@ -899,8 +566,8 @@ static struct clk_rcg2 blsp1_uart3_apps_ .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_uart3_apps_clk_src", @@ -754,7 +754,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -919,8 +586,8 @@ static struct clk_rcg2 blsp1_uart4_apps_ +@@ -913,8 +580,8 @@ static struct clk_rcg2 blsp1_uart4_apps_ .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_uart4_apps_clk_src", @@ -765,7 +765,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -933,8 +600,8 @@ static struct clk_rcg2 blsp1_uart5_apps_ +@@ -927,8 +594,8 @@ static struct clk_rcg2 blsp1_uart5_apps_ .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_uart5_apps_clk_src", @@ -776,7 +776,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -947,8 +614,8 @@ static struct clk_rcg2 blsp1_uart6_apps_ +@@ -941,8 +608,8 @@ static struct clk_rcg2 blsp1_uart6_apps_ .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "blsp1_uart6_apps_clk_src", @@ -787,7 +787,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -958,6 +625,11 @@ static const struct clk_parent_data gcc_ +@@ -952,6 +619,11 @@ static const struct clk_parent_data gcc_ { .hw = &gpll0.clkr.hw }, }; @@ -799,7 +799,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static const struct freq_tbl ftbl_pcie_axi_clk_src[] = { F(19200000, P_XO, 1, 0, 0), F(200000000, P_GPLL0, 4, 0, 0), -@@ -972,7 +644,7 @@ static struct clk_rcg2 pcie0_axi_clk_src +@@ -966,7 +638,7 @@ static struct clk_rcg2 pcie0_axi_clk_src .clkr.hw.init = &(struct clk_init_data){ .name = "pcie0_axi_clk_src", .parent_data = gcc_xo_gpll0, @@ -808,7 +808,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -981,6 +653,18 @@ static const struct freq_tbl ftbl_pcie_a +@@ -975,6 +647,18 @@ static const struct freq_tbl ftbl_pcie_a F(19200000, P_XO, 1, 0, 0), }; @@ -827,7 +827,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 pcie0_aux_clk_src = { .cmd_rcgr = 0x75024, .freq_tbl = ftbl_pcie_aux_clk_src, -@@ -989,12 +673,22 @@ static struct clk_rcg2 pcie0_aux_clk_src +@@ -983,12 +667,22 @@ static struct clk_rcg2 pcie0_aux_clk_src .parent_map = gcc_xo_gpll0_sleep_clk_map, .clkr.hw.init = &(struct clk_init_data){ .name = "pcie0_aux_clk_src", @@ -852,7 +852,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_regmap_mux pcie0_pipe_clk_src = { .reg = 0x7501c, .shift = 8, -@@ -1003,8 +697,8 @@ static struct clk_regmap_mux pcie0_pipe_ +@@ -997,8 +691,8 @@ static struct clk_regmap_mux pcie0_pipe_ .clkr = { .hw.init = &(struct clk_init_data){ .name = "pcie0_pipe_clk_src", @@ -863,7 +863,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_regmap_mux_closest_ops, .flags = CLK_SET_RATE_PARENT, }, -@@ -1019,7 +713,7 @@ static struct clk_rcg2 pcie1_axi_clk_src +@@ -1013,7 +707,7 @@ static struct clk_rcg2 pcie1_axi_clk_src .clkr.hw.init = &(struct clk_init_data){ .name = "pcie1_axi_clk_src", .parent_data = gcc_xo_gpll0, @@ -872,7 +872,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1032,12 +726,22 @@ static struct clk_rcg2 pcie1_aux_clk_src +@@ -1026,12 +720,22 @@ static struct clk_rcg2 pcie1_aux_clk_src .parent_map = gcc_xo_gpll0_sleep_clk_map, .clkr.hw.init = &(struct clk_init_data){ .name = "pcie1_aux_clk_src", @@ -897,7 +897,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_regmap_mux pcie1_pipe_clk_src = { .reg = 0x7601c, .shift = 8, -@@ -1046,8 +750,8 @@ static struct clk_regmap_mux pcie1_pipe_ +@@ -1040,8 +744,8 @@ static struct clk_regmap_mux pcie1_pipe_ .clkr = { .hw.init = &(struct clk_init_data){ .name = "pcie1_pipe_clk_src", @@ -908,7 +908,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_regmap_mux_closest_ops, .flags = CLK_SET_RATE_PARENT, }, -@@ -1066,6 +770,20 @@ static const struct freq_tbl ftbl_sdcc_a +@@ -1060,6 +764,20 @@ static const struct freq_tbl ftbl_sdcc_a { } }; @@ -929,7 +929,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 sdcc1_apps_clk_src = { .cmd_rcgr = 0x42004, .freq_tbl = ftbl_sdcc_apps_clk_src, -@@ -1074,8 +792,8 @@ static struct clk_rcg2 sdcc1_apps_clk_sr +@@ -1068,8 +786,8 @@ static struct clk_rcg2 sdcc1_apps_clk_sr .parent_map = gcc_xo_gpll0_gpll2_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "sdcc1_apps_clk_src", @@ -940,7 +940,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_floor_ops, }, }; -@@ -1086,6 +804,20 @@ static const struct freq_tbl ftbl_sdcc_i +@@ -1080,6 +798,20 @@ static const struct freq_tbl ftbl_sdcc_i F(308570000, P_GPLL6, 3.5, 0, 0), }; @@ -961,7 +961,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 sdcc1_ice_core_clk_src = { .cmd_rcgr = 0x5d000, .freq_tbl = ftbl_sdcc_ice_core_clk_src, -@@ -1094,8 +826,8 @@ static struct clk_rcg2 sdcc1_ice_core_cl +@@ -1088,8 +820,8 @@ static struct clk_rcg2 sdcc1_ice_core_cl .parent_map = gcc_xo_gpll0_gpll6_gpll0_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "sdcc1_ice_core_clk_src", @@ -972,7 +972,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1108,8 +840,8 @@ static struct clk_rcg2 sdcc2_apps_clk_sr +@@ -1102,8 +834,8 @@ static struct clk_rcg2 sdcc2_apps_clk_sr .parent_map = gcc_xo_gpll0_gpll2_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "sdcc2_apps_clk_src", @@ -983,7 +983,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_floor_ops, }, }; -@@ -1121,6 +853,18 @@ static const struct freq_tbl ftbl_usb_ma +@@ -1115,6 +847,18 @@ static const struct freq_tbl ftbl_usb_ma { } }; @@ -1002,7 +1002,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 usb0_master_clk_src = { .cmd_rcgr = 0x3e00c, .freq_tbl = ftbl_usb_master_clk_src, -@@ -1129,8 +873,8 @@ static struct clk_rcg2 usb0_master_clk_s +@@ -1123,8 +867,8 @@ static struct clk_rcg2 usb0_master_clk_s .parent_map = gcc_xo_gpll0_out_main_div2_gpll0_map, .clkr.hw.init = &(struct clk_init_data){ .name = "usb0_master_clk_src", @@ -1013,7 +1013,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1148,8 +892,8 @@ static struct clk_rcg2 usb0_aux_clk_src +@@ -1142,8 +886,8 @@ static struct clk_rcg2 usb0_aux_clk_src .parent_map = gcc_xo_gpll0_sleep_clk_map, .clkr.hw.init = &(struct clk_init_data){ .name = "usb0_aux_clk_src", @@ -1024,7 +1024,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1161,6 +905,20 @@ static const struct freq_tbl ftbl_usb_mo +@@ -1155,6 +899,20 @@ static const struct freq_tbl ftbl_usb_mo { } }; @@ -1045,7 +1045,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 usb0_mock_utmi_clk_src = { .cmd_rcgr = 0x3e020, .freq_tbl = ftbl_usb_mock_utmi_clk_src, -@@ -1169,12 +927,22 @@ static struct clk_rcg2 usb0_mock_utmi_cl +@@ -1163,12 +921,22 @@ static struct clk_rcg2 usb0_mock_utmi_cl .parent_map = gcc_xo_gpll6_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "usb0_mock_utmi_clk_src", @@ -1070,7 +1070,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_regmap_mux usb0_pipe_clk_src = { .reg = 0x3e048, .shift = 8, -@@ -1183,8 +951,8 @@ static struct clk_regmap_mux usb0_pipe_c +@@ -1177,8 +945,8 @@ static struct clk_regmap_mux usb0_pipe_c .clkr = { .hw.init = &(struct clk_init_data){ .name = "usb0_pipe_clk_src", @@ -1081,7 +1081,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_regmap_mux_closest_ops, .flags = CLK_SET_RATE_PARENT, }, -@@ -1199,8 +967,8 @@ static struct clk_rcg2 usb1_master_clk_s +@@ -1193,8 +961,8 @@ static struct clk_rcg2 usb1_master_clk_s .parent_map = gcc_xo_gpll0_out_main_div2_gpll0_map, .clkr.hw.init = &(struct clk_init_data){ .name = "usb1_master_clk_src", @@ -1092,7 +1092,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1213,8 +981,8 @@ static struct clk_rcg2 usb1_aux_clk_src +@@ -1207,8 +975,8 @@ static struct clk_rcg2 usb1_aux_clk_src .parent_map = gcc_xo_gpll0_sleep_clk_map, .clkr.hw.init = &(struct clk_init_data){ .name = "usb1_aux_clk_src", @@ -1103,7 +1103,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1227,12 +995,22 @@ static struct clk_rcg2 usb1_mock_utmi_cl +@@ -1221,12 +989,22 @@ static struct clk_rcg2 usb1_mock_utmi_cl .parent_map = gcc_xo_gpll6_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "usb1_mock_utmi_clk_src", @@ -1128,7 +1128,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_regmap_mux usb1_pipe_clk_src = { .reg = 0x3f048, .shift = 8, -@@ -1241,8 +1019,8 @@ static struct clk_regmap_mux usb1_pipe_c +@@ -1235,8 +1013,8 @@ static struct clk_regmap_mux usb1_pipe_c .clkr = { .hw.init = &(struct clk_init_data){ .name = "usb1_pipe_clk_src", @@ -1139,7 +1139,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_regmap_mux_closest_ops, .flags = CLK_SET_RATE_PARENT, }, -@@ -1256,8 +1034,9 @@ static struct clk_branch gcc_xo_clk_src +@@ -1250,8 +1028,9 @@ static struct clk_branch gcc_xo_clk_src .enable_mask = BIT(1), .hw.init = &(struct clk_init_data){ .name = "gcc_xo_clk_src", @@ -1151,7 +1151,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com }, .num_parents = 1, .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, -@@ -1271,9 +1050,8 @@ static struct clk_fixed_factor gcc_xo_di +@@ -1265,9 +1044,8 @@ static struct clk_fixed_factor gcc_xo_di .div = 4, .hw.init = &(struct clk_init_data){ .name = "gcc_xo_div4_clk_src", @@ -1163,7 +1163,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_fixed_factor_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1291,6 +1069,20 @@ static const struct freq_tbl ftbl_system +@@ -1285,6 +1063,20 @@ static const struct freq_tbl ftbl_system { } }; @@ -1184,7 +1184,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 system_noc_bfdcd_clk_src = { .cmd_rcgr = 0x26004, .freq_tbl = ftbl_system_noc_bfdcd_clk_src, -@@ -1298,8 +1090,8 @@ static struct clk_rcg2 system_noc_bfdcd_ +@@ -1292,8 +1084,8 @@ static struct clk_rcg2 system_noc_bfdcd_ .parent_map = gcc_xo_gpll0_gpll6_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "system_noc_bfdcd_clk_src", @@ -1195,7 +1195,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, .flags = CLK_IS_CRITICAL, }, -@@ -1310,9 +1102,8 @@ static struct clk_fixed_factor system_no +@@ -1304,9 +1096,8 @@ static struct clk_fixed_factor system_no .div = 1, .hw.init = &(struct clk_init_data){ .name = "system_noc_clk_src", @@ -1207,7 +1207,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_fixed_factor_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1333,7 +1124,7 @@ static struct clk_rcg2 nss_ce_clk_src = +@@ -1327,7 +1118,7 @@ static struct clk_rcg2 nss_ce_clk_src = .clkr.hw.init = &(struct clk_init_data){ .name = "nss_ce_clk_src", .parent_data = gcc_xo_gpll0, @@ -1216,7 +1216,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1344,6 +1135,20 @@ static const struct freq_tbl ftbl_nss_no +@@ -1338,6 +1129,20 @@ static const struct freq_tbl ftbl_nss_no { } }; @@ -1237,7 +1237,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_noc_bfdcd_clk_src = { .cmd_rcgr = 0x68088, .freq_tbl = ftbl_nss_noc_bfdcd_clk_src, -@@ -1351,8 +1156,8 @@ static struct clk_rcg2 nss_noc_bfdcd_clk +@@ -1345,8 +1150,8 @@ static struct clk_rcg2 nss_noc_bfdcd_clk .parent_map = gcc_xo_bias_pll_nss_noc_clk_gpll0_gpll2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_noc_bfdcd_clk_src", @@ -1248,7 +1248,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1362,9 +1167,8 @@ static struct clk_fixed_factor nss_noc_c +@@ -1356,9 +1161,8 @@ static struct clk_fixed_factor nss_noc_c .div = 1, .hw.init = &(struct clk_init_data){ .name = "nss_noc_clk_src", @@ -1260,7 +1260,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_fixed_factor_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1377,6 +1181,18 @@ static const struct freq_tbl ftbl_nss_cr +@@ -1371,6 +1175,18 @@ static const struct freq_tbl ftbl_nss_cr { } }; @@ -1279,7 +1279,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_crypto_clk_src = { .cmd_rcgr = 0x68144, .freq_tbl = ftbl_nss_crypto_clk_src, -@@ -1385,8 +1201,8 @@ static struct clk_rcg2 nss_crypto_clk_sr +@@ -1379,8 +1195,8 @@ static struct clk_rcg2 nss_crypto_clk_sr .parent_map = gcc_xo_nss_crypto_pll_gpll0_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_crypto_clk_src", @@ -1290,7 +1290,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1400,6 +1216,24 @@ static const struct freq_tbl ftbl_nss_ub +@@ -1394,6 +1210,24 @@ static const struct freq_tbl ftbl_nss_ub { } }; @@ -1315,7 +1315,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_ubi0_clk_src = { .cmd_rcgr = 0x68104, .freq_tbl = ftbl_nss_ubi_clk_src, -@@ -1407,8 +1241,8 @@ static struct clk_rcg2 nss_ubi0_clk_src +@@ -1401,8 +1235,8 @@ static struct clk_rcg2 nss_ubi0_clk_src .parent_map = gcc_xo_ubi32_gpll0_gpll2_gpll4_gpll6_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_ubi0_clk_src", @@ -1326,7 +1326,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, .flags = CLK_SET_RATE_PARENT, }, -@@ -1421,9 +1255,8 @@ static struct clk_regmap_div nss_ubi0_di +@@ -1415,9 +1249,8 @@ static struct clk_regmap_div nss_ubi0_di .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_ubi0_div_clk_src", @@ -1338,7 +1338,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ro_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1438,8 +1271,8 @@ static struct clk_rcg2 nss_ubi1_clk_src +@@ -1432,8 +1265,8 @@ static struct clk_rcg2 nss_ubi1_clk_src .parent_map = gcc_xo_ubi32_gpll0_gpll2_gpll4_gpll6_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_ubi1_clk_src", @@ -1349,7 +1349,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, .flags = CLK_SET_RATE_PARENT, }, -@@ -1452,9 +1285,8 @@ static struct clk_regmap_div nss_ubi1_di +@@ -1446,9 +1279,8 @@ static struct clk_regmap_div nss_ubi1_di .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_ubi1_div_clk_src", @@ -1361,7 +1361,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ro_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1468,6 +1300,16 @@ static const struct freq_tbl ftbl_ubi_mp +@@ -1462,6 +1294,16 @@ static const struct freq_tbl ftbl_ubi_mp { } }; @@ -1378,7 +1378,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 ubi_mpt_clk_src = { .cmd_rcgr = 0x68090, .freq_tbl = ftbl_ubi_mpt_clk_src, -@@ -1475,8 +1317,8 @@ static struct clk_rcg2 ubi_mpt_clk_src = +@@ -1469,8 +1311,8 @@ static struct clk_rcg2 ubi_mpt_clk_src = .parent_map = gcc_xo_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "ubi_mpt_clk_src", @@ -1389,7 +1389,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1487,6 +1329,18 @@ static const struct freq_tbl ftbl_nss_im +@@ -1481,6 +1323,18 @@ static const struct freq_tbl ftbl_nss_im { } }; @@ -1408,7 +1408,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_imem_clk_src = { .cmd_rcgr = 0x68158, .freq_tbl = ftbl_nss_imem_clk_src, -@@ -1494,8 +1348,8 @@ static struct clk_rcg2 nss_imem_clk_src +@@ -1488,8 +1342,8 @@ static struct clk_rcg2 nss_imem_clk_src .parent_map = gcc_xo_gpll0_gpll4_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_imem_clk_src", @@ -1419,7 +1419,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1506,6 +1360,24 @@ static const struct freq_tbl ftbl_nss_pp +@@ -1500,6 +1354,24 @@ static const struct freq_tbl ftbl_nss_pp { } }; @@ -1444,7 +1444,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_ppe_clk_src = { .cmd_rcgr = 0x68080, .freq_tbl = ftbl_nss_ppe_clk_src, -@@ -1513,8 +1385,8 @@ static struct clk_rcg2 nss_ppe_clk_src = +@@ -1507,8 +1379,8 @@ static struct clk_rcg2 nss_ppe_clk_src = .parent_map = gcc_xo_bias_gpll0_gpll4_nss_ubi32_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_ppe_clk_src", @@ -1455,7 +1455,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1524,9 +1396,8 @@ static struct clk_fixed_factor nss_ppe_c +@@ -1518,9 +1390,8 @@ static struct clk_fixed_factor nss_ppe_c .div = 4, .hw.init = &(struct clk_init_data){ .name = "nss_ppe_cdiv_clk_src", @@ -1467,7 +1467,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_fixed_factor_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1540,6 +1411,22 @@ static const struct freq_tbl ftbl_nss_po +@@ -1534,6 +1405,22 @@ static const struct freq_tbl ftbl_nss_po { } }; @@ -1490,7 +1490,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_port1_rx_clk_src = { .cmd_rcgr = 0x68020, .freq_tbl = ftbl_nss_port1_rx_clk_src, -@@ -1547,8 +1434,8 @@ static struct clk_rcg2 nss_port1_rx_clk_ +@@ -1541,8 +1428,8 @@ static struct clk_rcg2 nss_port1_rx_clk_ .parent_map = gcc_xo_uniphy0_rx_tx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port1_rx_clk_src", @@ -1501,7 +1501,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1560,9 +1447,8 @@ static struct clk_regmap_div nss_port1_r +@@ -1554,9 +1441,8 @@ static struct clk_regmap_div nss_port1_r .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port1_rx_div_clk_src", @@ -1513,7 +1513,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1577,6 +1463,22 @@ static const struct freq_tbl ftbl_nss_po +@@ -1571,6 +1457,22 @@ static const struct freq_tbl ftbl_nss_po { } }; @@ -1536,7 +1536,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_port1_tx_clk_src = { .cmd_rcgr = 0x68028, .freq_tbl = ftbl_nss_port1_tx_clk_src, -@@ -1584,8 +1486,8 @@ static struct clk_rcg2 nss_port1_tx_clk_ +@@ -1578,8 +1480,8 @@ static struct clk_rcg2 nss_port1_tx_clk_ .parent_map = gcc_xo_uniphy0_tx_rx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port1_tx_clk_src", @@ -1547,7 +1547,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1597,9 +1499,8 @@ static struct clk_regmap_div nss_port1_t +@@ -1591,9 +1493,8 @@ static struct clk_regmap_div nss_port1_t .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port1_tx_div_clk_src", @@ -1559,7 +1559,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1614,8 +1515,8 @@ static struct clk_rcg2 nss_port2_rx_clk_ +@@ -1608,8 +1509,8 @@ static struct clk_rcg2 nss_port2_rx_clk_ .parent_map = gcc_xo_uniphy0_rx_tx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port2_rx_clk_src", @@ -1570,7 +1570,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1627,9 +1528,8 @@ static struct clk_regmap_div nss_port2_r +@@ -1621,9 +1522,8 @@ static struct clk_regmap_div nss_port2_r .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port2_rx_div_clk_src", @@ -1582,7 +1582,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1644,8 +1544,8 @@ static struct clk_rcg2 nss_port2_tx_clk_ +@@ -1638,8 +1538,8 @@ static struct clk_rcg2 nss_port2_tx_clk_ .parent_map = gcc_xo_uniphy0_tx_rx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port2_tx_clk_src", @@ -1593,7 +1593,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1657,9 +1557,8 @@ static struct clk_regmap_div nss_port2_t +@@ -1651,9 +1551,8 @@ static struct clk_regmap_div nss_port2_t .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port2_tx_div_clk_src", @@ -1605,7 +1605,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1674,8 +1573,8 @@ static struct clk_rcg2 nss_port3_rx_clk_ +@@ -1668,8 +1567,8 @@ static struct clk_rcg2 nss_port3_rx_clk_ .parent_map = gcc_xo_uniphy0_rx_tx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port3_rx_clk_src", @@ -1616,7 +1616,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1687,9 +1586,8 @@ static struct clk_regmap_div nss_port3_r +@@ -1681,9 +1580,8 @@ static struct clk_regmap_div nss_port3_r .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port3_rx_div_clk_src", @@ -1628,7 +1628,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1704,8 +1602,8 @@ static struct clk_rcg2 nss_port3_tx_clk_ +@@ -1698,8 +1596,8 @@ static struct clk_rcg2 nss_port3_tx_clk_ .parent_map = gcc_xo_uniphy0_tx_rx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port3_tx_clk_src", @@ -1639,7 +1639,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1717,9 +1615,8 @@ static struct clk_regmap_div nss_port3_t +@@ -1711,9 +1609,8 @@ static struct clk_regmap_div nss_port3_t .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port3_tx_div_clk_src", @@ -1651,7 +1651,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1734,8 +1631,8 @@ static struct clk_rcg2 nss_port4_rx_clk_ +@@ -1728,8 +1625,8 @@ static struct clk_rcg2 nss_port4_rx_clk_ .parent_map = gcc_xo_uniphy0_rx_tx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port4_rx_clk_src", @@ -1662,7 +1662,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1747,9 +1644,8 @@ static struct clk_regmap_div nss_port4_r +@@ -1741,9 +1638,8 @@ static struct clk_regmap_div nss_port4_r .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port4_rx_div_clk_src", @@ -1674,7 +1674,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1764,8 +1660,8 @@ static struct clk_rcg2 nss_port4_tx_clk_ +@@ -1758,8 +1654,8 @@ static struct clk_rcg2 nss_port4_tx_clk_ .parent_map = gcc_xo_uniphy0_tx_rx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port4_tx_clk_src", @@ -1685,7 +1685,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1777,9 +1673,8 @@ static struct clk_regmap_div nss_port4_t +@@ -1771,9 +1667,8 @@ static struct clk_regmap_div nss_port4_t .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port4_tx_div_clk_src", @@ -1697,7 +1697,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1799,6 +1694,27 @@ static const struct freq_tbl ftbl_nss_po +@@ -1793,6 +1688,27 @@ static const struct freq_tbl ftbl_nss_po { } }; @@ -1725,7 +1725,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_port5_rx_clk_src = { .cmd_rcgr = 0x68060, .freq_tbl = ftbl_nss_port5_rx_clk_src, -@@ -1806,8 +1722,8 @@ static struct clk_rcg2 nss_port5_rx_clk_ +@@ -1800,8 +1716,8 @@ static struct clk_rcg2 nss_port5_rx_clk_ .parent_map = gcc_xo_uniphy0_rx_tx_uniphy1_rx_tx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port5_rx_clk_src", @@ -1736,7 +1736,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1819,9 +1735,8 @@ static struct clk_regmap_div nss_port5_r +@@ -1813,9 +1729,8 @@ static struct clk_regmap_div nss_port5_r .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port5_rx_div_clk_src", @@ -1748,7 +1748,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1841,6 +1756,27 @@ static const struct freq_tbl ftbl_nss_po +@@ -1835,6 +1750,27 @@ static const struct freq_tbl ftbl_nss_po { } }; @@ -1776,7 +1776,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_port5_tx_clk_src = { .cmd_rcgr = 0x68068, .freq_tbl = ftbl_nss_port5_tx_clk_src, -@@ -1848,8 +1784,8 @@ static struct clk_rcg2 nss_port5_tx_clk_ +@@ -1842,8 +1778,8 @@ static struct clk_rcg2 nss_port5_tx_clk_ .parent_map = gcc_xo_uniphy0_tx_rx_uniphy1_tx_rx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port5_tx_clk_src", @@ -1787,7 +1787,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1861,9 +1797,8 @@ static struct clk_regmap_div nss_port5_t +@@ -1855,9 +1791,8 @@ static struct clk_regmap_div nss_port5_t .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port5_tx_div_clk_src", @@ -1799,7 +1799,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1883,6 +1818,22 @@ static const struct freq_tbl ftbl_nss_po +@@ -1877,6 +1812,22 @@ static const struct freq_tbl ftbl_nss_po { } }; @@ -1822,7 +1822,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_port6_rx_clk_src = { .cmd_rcgr = 0x68070, .freq_tbl = ftbl_nss_port6_rx_clk_src, -@@ -1890,8 +1841,8 @@ static struct clk_rcg2 nss_port6_rx_clk_ +@@ -1884,8 +1835,8 @@ static struct clk_rcg2 nss_port6_rx_clk_ .parent_map = gcc_xo_uniphy2_rx_tx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port6_rx_clk_src", @@ -1833,7 +1833,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1903,9 +1854,8 @@ static struct clk_regmap_div nss_port6_r +@@ -1897,9 +1848,8 @@ static struct clk_regmap_div nss_port6_r .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port6_rx_div_clk_src", @@ -1845,7 +1845,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1925,6 +1875,22 @@ static const struct freq_tbl ftbl_nss_po +@@ -1919,6 +1869,22 @@ static const struct freq_tbl ftbl_nss_po { } }; @@ -1868,7 +1868,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 nss_port6_tx_clk_src = { .cmd_rcgr = 0x68078, .freq_tbl = ftbl_nss_port6_tx_clk_src, -@@ -1932,8 +1898,8 @@ static struct clk_rcg2 nss_port6_tx_clk_ +@@ -1926,8 +1892,8 @@ static struct clk_rcg2 nss_port6_tx_clk_ .parent_map = gcc_xo_uniphy2_tx_rx_ubi32_bias_map, .clkr.hw.init = &(struct clk_init_data){ .name = "nss_port6_tx_clk_src", @@ -1879,7 +1879,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1945,9 +1911,8 @@ static struct clk_regmap_div nss_port6_t +@@ -1939,9 +1905,8 @@ static struct clk_regmap_div nss_port6_t .clkr = { .hw.init = &(struct clk_init_data){ .name = "nss_port6_tx_div_clk_src", @@ -1891,7 +1891,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .ops = &clk_regmap_div_ops, .flags = CLK_SET_RATE_PARENT, -@@ -1970,8 +1935,8 @@ static struct clk_rcg2 crypto_clk_src = +@@ -1964,8 +1929,8 @@ static struct clk_rcg2 crypto_clk_src = .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map, .clkr.hw.init = &(struct clk_init_data){ .name = "crypto_clk_src", @@ -1902,7 +1902,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -1981,6 +1946,22 @@ static struct freq_tbl ftbl_gp_clk_src[] +@@ -1975,6 +1940,22 @@ static struct freq_tbl ftbl_gp_clk_src[] { } }; @@ -1925,7 +1925,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com static struct clk_rcg2 gp1_clk_src = { .cmd_rcgr = 0x08004, .freq_tbl = ftbl_gp_clk_src, -@@ -1989,8 +1970,8 @@ static struct clk_rcg2 gp1_clk_src = { +@@ -1983,8 +1964,8 @@ static struct clk_rcg2 gp1_clk_src = { .parent_map = gcc_xo_gpll0_gpll6_gpll0_sleep_clk_map, .clkr.hw.init = &(struct clk_init_data){ .name = "gp1_clk_src", @@ -1936,7 +1936,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -2003,8 +1984,8 @@ static struct clk_rcg2 gp2_clk_src = { +@@ -1997,8 +1978,8 @@ static struct clk_rcg2 gp2_clk_src = { .parent_map = gcc_xo_gpll0_gpll6_gpll0_sleep_clk_map, .clkr.hw.init = &(struct clk_init_data){ .name = "gp2_clk_src", @@ -1947,7 +1947,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -2017,8 +1998,8 @@ static struct clk_rcg2 gp3_clk_src = { +@@ -2011,8 +1992,8 @@ static struct clk_rcg2 gp3_clk_src = { .parent_map = gcc_xo_gpll0_gpll6_gpll0_sleep_clk_map, .clkr.hw.init = &(struct clk_init_data){ .name = "gp3_clk_src", @@ -1958,7 +1958,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .ops = &clk_rcg2_ops, }, }; -@@ -2030,9 +2011,8 @@ static struct clk_branch gcc_blsp1_ahb_c +@@ -2024,9 +2005,8 @@ static struct clk_branch gcc_blsp1_ahb_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_ahb_clk", @@ -1970,7 +1970,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2047,9 +2027,8 @@ static struct clk_branch gcc_blsp1_qup1_ +@@ -2041,9 +2021,8 @@ static struct clk_branch gcc_blsp1_qup1_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup1_i2c_apps_clk", @@ -1982,7 +1982,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2064,9 +2043,8 @@ static struct clk_branch gcc_blsp1_qup1_ +@@ -2058,9 +2037,8 @@ static struct clk_branch gcc_blsp1_qup1_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup1_spi_apps_clk", @@ -1994,7 +1994,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2081,9 +2059,8 @@ static struct clk_branch gcc_blsp1_qup2_ +@@ -2075,9 +2053,8 @@ static struct clk_branch gcc_blsp1_qup2_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup2_i2c_apps_clk", @@ -2006,7 +2006,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2098,9 +2075,8 @@ static struct clk_branch gcc_blsp1_qup2_ +@@ -2092,9 +2069,8 @@ static struct clk_branch gcc_blsp1_qup2_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup2_spi_apps_clk", @@ -2018,7 +2018,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2115,9 +2091,8 @@ static struct clk_branch gcc_blsp1_qup3_ +@@ -2109,9 +2085,8 @@ static struct clk_branch gcc_blsp1_qup3_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup3_i2c_apps_clk", @@ -2030,7 +2030,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2132,9 +2107,8 @@ static struct clk_branch gcc_blsp1_qup3_ +@@ -2126,9 +2101,8 @@ static struct clk_branch gcc_blsp1_qup3_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup3_spi_apps_clk", @@ -2042,7 +2042,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2149,9 +2123,8 @@ static struct clk_branch gcc_blsp1_qup4_ +@@ -2143,9 +2117,8 @@ static struct clk_branch gcc_blsp1_qup4_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup4_i2c_apps_clk", @@ -2054,7 +2054,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2166,9 +2139,8 @@ static struct clk_branch gcc_blsp1_qup4_ +@@ -2160,9 +2133,8 @@ static struct clk_branch gcc_blsp1_qup4_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup4_spi_apps_clk", @@ -2066,7 +2066,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2183,9 +2155,8 @@ static struct clk_branch gcc_blsp1_qup5_ +@@ -2177,9 +2149,8 @@ static struct clk_branch gcc_blsp1_qup5_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup5_i2c_apps_clk", @@ -2078,7 +2078,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2200,9 +2171,8 @@ static struct clk_branch gcc_blsp1_qup5_ +@@ -2194,9 +2165,8 @@ static struct clk_branch gcc_blsp1_qup5_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup5_spi_apps_clk", @@ -2090,7 +2090,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2217,9 +2187,8 @@ static struct clk_branch gcc_blsp1_qup6_ +@@ -2211,9 +2181,8 @@ static struct clk_branch gcc_blsp1_qup6_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup6_i2c_apps_clk", @@ -2102,7 +2102,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2234,9 +2203,8 @@ static struct clk_branch gcc_blsp1_qup6_ +@@ -2228,9 +2197,8 @@ static struct clk_branch gcc_blsp1_qup6_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_qup6_spi_apps_clk", @@ -2114,7 +2114,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2251,9 +2219,8 @@ static struct clk_branch gcc_blsp1_uart1 +@@ -2245,9 +2213,8 @@ static struct clk_branch gcc_blsp1_uart1 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_uart1_apps_clk", @@ -2126,7 +2126,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2268,9 +2235,8 @@ static struct clk_branch gcc_blsp1_uart2 +@@ -2262,9 +2229,8 @@ static struct clk_branch gcc_blsp1_uart2 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_uart2_apps_clk", @@ -2138,7 +2138,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2285,9 +2251,8 @@ static struct clk_branch gcc_blsp1_uart3 +@@ -2279,9 +2245,8 @@ static struct clk_branch gcc_blsp1_uart3 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_uart3_apps_clk", @@ -2150,7 +2150,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2302,9 +2267,8 @@ static struct clk_branch gcc_blsp1_uart4 +@@ -2296,9 +2261,8 @@ static struct clk_branch gcc_blsp1_uart4 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_uart4_apps_clk", @@ -2162,7 +2162,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2319,9 +2283,8 @@ static struct clk_branch gcc_blsp1_uart5 +@@ -2313,9 +2277,8 @@ static struct clk_branch gcc_blsp1_uart5 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_uart5_apps_clk", @@ -2174,7 +2174,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2336,9 +2299,8 @@ static struct clk_branch gcc_blsp1_uart6 +@@ -2330,9 +2293,8 @@ static struct clk_branch gcc_blsp1_uart6 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_blsp1_uart6_apps_clk", @@ -2186,7 +2186,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2354,9 +2316,8 @@ static struct clk_branch gcc_prng_ahb_cl +@@ -2348,9 +2310,8 @@ static struct clk_branch gcc_prng_ahb_cl .enable_mask = BIT(8), .hw.init = &(struct clk_init_data){ .name = "gcc_prng_ahb_clk", @@ -2198,7 +2198,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2371,9 +2332,8 @@ static struct clk_branch gcc_qpic_ahb_cl +@@ -2365,9 +2326,8 @@ static struct clk_branch gcc_qpic_ahb_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_qpic_ahb_clk", @@ -2210,7 +2210,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2388,9 +2348,8 @@ static struct clk_branch gcc_qpic_clk = +@@ -2382,9 +2342,8 @@ static struct clk_branch gcc_qpic_clk = .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_qpic_clk", @@ -2222,7 +2222,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2405,9 +2364,8 @@ static struct clk_branch gcc_pcie0_ahb_c +@@ -2399,9 +2358,8 @@ static struct clk_branch gcc_pcie0_ahb_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie0_ahb_clk", @@ -2234,7 +2234,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2422,9 +2380,8 @@ static struct clk_branch gcc_pcie0_aux_c +@@ -2416,9 +2374,8 @@ static struct clk_branch gcc_pcie0_aux_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie0_aux_clk", @@ -2246,7 +2246,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2439,9 +2396,8 @@ static struct clk_branch gcc_pcie0_axi_m +@@ -2433,9 +2390,8 @@ static struct clk_branch gcc_pcie0_axi_m .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie0_axi_m_clk", @@ -2258,7 +2258,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2456,9 +2412,8 @@ static struct clk_branch gcc_pcie0_axi_s +@@ -2450,9 +2406,8 @@ static struct clk_branch gcc_pcie0_axi_s .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie0_axi_s_clk", @@ -2270,7 +2270,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2474,9 +2429,8 @@ static struct clk_branch gcc_pcie0_pipe_ +@@ -2468,9 +2423,8 @@ static struct clk_branch gcc_pcie0_pipe_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie0_pipe_clk", @@ -2282,7 +2282,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2491,9 +2445,8 @@ static struct clk_branch gcc_sys_noc_pci +@@ -2485,9 +2439,8 @@ static struct clk_branch gcc_sys_noc_pci .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sys_noc_pcie0_axi_clk", @@ -2294,7 +2294,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2508,9 +2461,8 @@ static struct clk_branch gcc_pcie1_ahb_c +@@ -2502,9 +2455,8 @@ static struct clk_branch gcc_pcie1_ahb_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie1_ahb_clk", @@ -2306,7 +2306,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2525,9 +2477,8 @@ static struct clk_branch gcc_pcie1_aux_c +@@ -2519,9 +2471,8 @@ static struct clk_branch gcc_pcie1_aux_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie1_aux_clk", @@ -2318,7 +2318,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2542,9 +2493,8 @@ static struct clk_branch gcc_pcie1_axi_m +@@ -2536,9 +2487,8 @@ static struct clk_branch gcc_pcie1_axi_m .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie1_axi_m_clk", @@ -2330,7 +2330,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2559,9 +2509,8 @@ static struct clk_branch gcc_pcie1_axi_s +@@ -2553,9 +2503,8 @@ static struct clk_branch gcc_pcie1_axi_s .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie1_axi_s_clk", @@ -2342,7 +2342,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2577,9 +2526,8 @@ static struct clk_branch gcc_pcie1_pipe_ +@@ -2571,9 +2520,8 @@ static struct clk_branch gcc_pcie1_pipe_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie1_pipe_clk", @@ -2354,7 +2354,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2594,9 +2542,8 @@ static struct clk_branch gcc_sys_noc_pci +@@ -2588,9 +2536,8 @@ static struct clk_branch gcc_sys_noc_pci .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sys_noc_pcie1_axi_clk", @@ -2366,7 +2366,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2611,9 +2558,8 @@ static struct clk_branch gcc_usb0_aux_cl +@@ -2605,9 +2552,8 @@ static struct clk_branch gcc_usb0_aux_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb0_aux_clk", @@ -2378,7 +2378,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2628,9 +2574,8 @@ static struct clk_branch gcc_sys_noc_usb +@@ -2622,9 +2568,8 @@ static struct clk_branch gcc_sys_noc_usb .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sys_noc_usb0_axi_clk", @@ -2390,7 +2390,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2645,9 +2590,8 @@ static struct clk_branch gcc_usb0_master +@@ -2639,9 +2584,8 @@ static struct clk_branch gcc_usb0_master .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb0_master_clk", @@ -2402,7 +2402,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2662,9 +2606,8 @@ static struct clk_branch gcc_usb0_mock_u +@@ -2656,9 +2600,8 @@ static struct clk_branch gcc_usb0_mock_u .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb0_mock_utmi_clk", @@ -2414,7 +2414,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2679,9 +2622,8 @@ static struct clk_branch gcc_usb0_phy_cf +@@ -2673,9 +2616,8 @@ static struct clk_branch gcc_usb0_phy_cf .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb0_phy_cfg_ahb_clk", @@ -2426,7 +2426,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2697,9 +2639,8 @@ static struct clk_branch gcc_usb0_pipe_c +@@ -2691,9 +2633,8 @@ static struct clk_branch gcc_usb0_pipe_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb0_pipe_clk", @@ -2438,7 +2438,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2714,9 +2655,8 @@ static struct clk_branch gcc_usb0_sleep_ +@@ -2708,9 +2649,8 @@ static struct clk_branch gcc_usb0_sleep_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb0_sleep_clk", @@ -2450,7 +2450,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2731,9 +2671,8 @@ static struct clk_branch gcc_usb1_aux_cl +@@ -2725,9 +2665,8 @@ static struct clk_branch gcc_usb1_aux_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb1_aux_clk", @@ -2462,7 +2462,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2748,9 +2687,8 @@ static struct clk_branch gcc_sys_noc_usb +@@ -2742,9 +2681,8 @@ static struct clk_branch gcc_sys_noc_usb .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sys_noc_usb1_axi_clk", @@ -2474,7 +2474,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2765,9 +2703,8 @@ static struct clk_branch gcc_usb1_master +@@ -2759,9 +2697,8 @@ static struct clk_branch gcc_usb1_master .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb1_master_clk", @@ -2486,7 +2486,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2782,9 +2719,8 @@ static struct clk_branch gcc_usb1_mock_u +@@ -2776,9 +2713,8 @@ static struct clk_branch gcc_usb1_mock_u .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb1_mock_utmi_clk", @@ -2498,7 +2498,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2799,9 +2735,8 @@ static struct clk_branch gcc_usb1_phy_cf +@@ -2793,9 +2729,8 @@ static struct clk_branch gcc_usb1_phy_cf .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb1_phy_cfg_ahb_clk", @@ -2510,7 +2510,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2817,9 +2752,8 @@ static struct clk_branch gcc_usb1_pipe_c +@@ -2811,9 +2746,8 @@ static struct clk_branch gcc_usb1_pipe_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb1_pipe_clk", @@ -2522,7 +2522,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2834,9 +2768,8 @@ static struct clk_branch gcc_usb1_sleep_ +@@ -2828,9 +2762,8 @@ static struct clk_branch gcc_usb1_sleep_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_usb1_sleep_clk", @@ -2534,7 +2534,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2851,9 +2784,8 @@ static struct clk_branch gcc_sdcc1_ahb_c +@@ -2845,9 +2778,8 @@ static struct clk_branch gcc_sdcc1_ahb_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sdcc1_ahb_clk", @@ -2546,7 +2546,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2868,9 +2800,8 @@ static struct clk_branch gcc_sdcc1_apps_ +@@ -2862,9 +2794,8 @@ static struct clk_branch gcc_sdcc1_apps_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sdcc1_apps_clk", @@ -2558,7 +2558,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2885,9 +2816,8 @@ static struct clk_branch gcc_sdcc1_ice_c +@@ -2879,9 +2810,8 @@ static struct clk_branch gcc_sdcc1_ice_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sdcc1_ice_core_clk", @@ -2570,7 +2570,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2902,9 +2832,8 @@ static struct clk_branch gcc_sdcc2_ahb_c +@@ -2896,9 +2826,8 @@ static struct clk_branch gcc_sdcc2_ahb_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sdcc2_ahb_clk", @@ -2582,7 +2582,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2919,9 +2848,8 @@ static struct clk_branch gcc_sdcc2_apps_ +@@ -2913,9 +2842,8 @@ static struct clk_branch gcc_sdcc2_apps_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_sdcc2_apps_clk", @@ -2594,7 +2594,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2936,9 +2864,8 @@ static struct clk_branch gcc_mem_noc_nss +@@ -2930,9 +2858,8 @@ static struct clk_branch gcc_mem_noc_nss .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_mem_noc_nss_axi_clk", @@ -2606,7 +2606,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2953,9 +2880,8 @@ static struct clk_branch gcc_nss_ce_apb_ +@@ -2947,9 +2874,8 @@ static struct clk_branch gcc_nss_ce_apb_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_ce_apb_clk", @@ -2618,7 +2618,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2970,9 +2896,8 @@ static struct clk_branch gcc_nss_ce_axi_ +@@ -2964,9 +2890,8 @@ static struct clk_branch gcc_nss_ce_axi_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_ce_axi_clk", @@ -2630,7 +2630,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -2987,9 +2912,8 @@ static struct clk_branch gcc_nss_cfg_clk +@@ -2981,9 +2906,8 @@ static struct clk_branch gcc_nss_cfg_clk .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_cfg_clk", @@ -2642,7 +2642,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3004,9 +2928,8 @@ static struct clk_branch gcc_nss_crypto_ +@@ -2998,9 +2922,8 @@ static struct clk_branch gcc_nss_crypto_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_crypto_clk", @@ -2654,7 +2654,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3021,9 +2944,8 @@ static struct clk_branch gcc_nss_csr_clk +@@ -3015,9 +2938,8 @@ static struct clk_branch gcc_nss_csr_clk .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_csr_clk", @@ -2666,7 +2666,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3038,9 +2960,8 @@ static struct clk_branch gcc_nss_edma_cf +@@ -3032,9 +2954,8 @@ static struct clk_branch gcc_nss_edma_cf .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_edma_cfg_clk", @@ -2678,7 +2678,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3055,9 +2976,8 @@ static struct clk_branch gcc_nss_edma_cl +@@ -3049,9 +2970,8 @@ static struct clk_branch gcc_nss_edma_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_edma_clk", @@ -2690,7 +2690,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3072,9 +2992,8 @@ static struct clk_branch gcc_nss_imem_cl +@@ -3066,9 +2986,8 @@ static struct clk_branch gcc_nss_imem_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_imem_clk", @@ -2702,7 +2702,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3089,9 +3008,8 @@ static struct clk_branch gcc_nss_noc_clk +@@ -3083,9 +3002,8 @@ static struct clk_branch gcc_nss_noc_clk .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_noc_clk", @@ -2714,7 +2714,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3106,9 +3024,8 @@ static struct clk_branch gcc_nss_ppe_btq +@@ -3100,9 +3018,8 @@ static struct clk_branch gcc_nss_ppe_btq .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_ppe_btq_clk", @@ -2726,7 +2726,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3123,9 +3040,8 @@ static struct clk_branch gcc_nss_ppe_cfg +@@ -3117,9 +3034,8 @@ static struct clk_branch gcc_nss_ppe_cfg .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_ppe_cfg_clk", @@ -2738,7 +2738,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3140,9 +3056,8 @@ static struct clk_branch gcc_nss_ppe_clk +@@ -3134,9 +3050,8 @@ static struct clk_branch gcc_nss_ppe_clk .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_ppe_clk", @@ -2750,7 +2750,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3157,9 +3072,8 @@ static struct clk_branch gcc_nss_ppe_ipe +@@ -3151,9 +3066,8 @@ static struct clk_branch gcc_nss_ppe_ipe .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_ppe_ipe_clk", @@ -2762,7 +2762,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3174,9 +3088,8 @@ static struct clk_branch gcc_nss_ptp_ref +@@ -3168,9 +3082,8 @@ static struct clk_branch gcc_nss_ptp_ref .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_ptp_ref_clk", @@ -2774,7 +2774,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3192,9 +3105,8 @@ static struct clk_branch gcc_crypto_ppe_ +@@ -3186,9 +3099,8 @@ static struct clk_branch gcc_crypto_ppe_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_crypto_ppe_clk", @@ -2786,7 +2786,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3209,9 +3121,8 @@ static struct clk_branch gcc_nssnoc_ce_a +@@ -3203,9 +3115,8 @@ static struct clk_branch gcc_nssnoc_ce_a .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_ce_apb_clk", @@ -2798,7 +2798,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3226,9 +3137,8 @@ static struct clk_branch gcc_nssnoc_ce_a +@@ -3220,9 +3131,8 @@ static struct clk_branch gcc_nssnoc_ce_a .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_ce_axi_clk", @@ -2810,7 +2810,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3243,9 +3153,8 @@ static struct clk_branch gcc_nssnoc_cryp +@@ -3237,9 +3147,8 @@ static struct clk_branch gcc_nssnoc_cryp .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_crypto_clk", @@ -2822,7 +2822,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3260,9 +3169,8 @@ static struct clk_branch gcc_nssnoc_ppe_ +@@ -3254,9 +3163,8 @@ static struct clk_branch gcc_nssnoc_ppe_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_ppe_cfg_clk", @@ -2834,7 +2834,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3277,9 +3185,8 @@ static struct clk_branch gcc_nssnoc_ppe_ +@@ -3271,9 +3179,8 @@ static struct clk_branch gcc_nssnoc_ppe_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_ppe_clk", @@ -2846,7 +2846,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3294,9 +3201,8 @@ static struct clk_branch gcc_nssnoc_qosg +@@ -3288,9 +3195,8 @@ static struct clk_branch gcc_nssnoc_qosg .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_qosgen_ref_clk", @@ -2858,7 +2858,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3311,9 +3217,8 @@ static struct clk_branch gcc_nssnoc_snoc +@@ -3305,9 +3211,8 @@ static struct clk_branch gcc_nssnoc_snoc .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_snoc_clk", @@ -2870,7 +2870,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3328,9 +3233,8 @@ static struct clk_branch gcc_nssnoc_time +@@ -3322,9 +3227,8 @@ static struct clk_branch gcc_nssnoc_time .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_timeout_ref_clk", @@ -2882,7 +2882,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3345,9 +3249,8 @@ static struct clk_branch gcc_nssnoc_ubi0 +@@ -3339,9 +3243,8 @@ static struct clk_branch gcc_nssnoc_ubi0 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_ubi0_ahb_clk", @@ -2894,7 +2894,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3362,9 +3265,8 @@ static struct clk_branch gcc_nssnoc_ubi1 +@@ -3356,9 +3259,8 @@ static struct clk_branch gcc_nssnoc_ubi1 .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nssnoc_ubi1_ahb_clk", @@ -2906,7 +2906,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3380,9 +3282,8 @@ static struct clk_branch gcc_ubi0_ahb_cl +@@ -3374,9 +3276,8 @@ static struct clk_branch gcc_ubi0_ahb_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi0_ahb_clk", @@ -2918,7 +2918,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3398,9 +3299,8 @@ static struct clk_branch gcc_ubi0_axi_cl +@@ -3392,9 +3293,8 @@ static struct clk_branch gcc_ubi0_axi_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi0_axi_clk", @@ -2930,7 +2930,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3416,9 +3316,8 @@ static struct clk_branch gcc_ubi0_nc_axi +@@ -3410,9 +3310,8 @@ static struct clk_branch gcc_ubi0_nc_axi .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi0_nc_axi_clk", @@ -2942,7 +2942,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3434,9 +3333,8 @@ static struct clk_branch gcc_ubi0_core_c +@@ -3428,9 +3327,8 @@ static struct clk_branch gcc_ubi0_core_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi0_core_clk", @@ -2954,7 +2954,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3452,9 +3350,8 @@ static struct clk_branch gcc_ubi0_mpt_cl +@@ -3446,9 +3344,8 @@ static struct clk_branch gcc_ubi0_mpt_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi0_mpt_clk", @@ -2966,7 +2966,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3470,9 +3367,8 @@ static struct clk_branch gcc_ubi1_ahb_cl +@@ -3464,9 +3361,8 @@ static struct clk_branch gcc_ubi1_ahb_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi1_ahb_clk", @@ -2978,7 +2978,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3488,9 +3384,8 @@ static struct clk_branch gcc_ubi1_axi_cl +@@ -3482,9 +3378,8 @@ static struct clk_branch gcc_ubi1_axi_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi1_axi_clk", @@ -2990,7 +2990,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3506,9 +3401,8 @@ static struct clk_branch gcc_ubi1_nc_axi +@@ -3500,9 +3395,8 @@ static struct clk_branch gcc_ubi1_nc_axi .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi1_nc_axi_clk", @@ -3002,7 +3002,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3524,9 +3418,8 @@ static struct clk_branch gcc_ubi1_core_c +@@ -3518,9 +3412,8 @@ static struct clk_branch gcc_ubi1_core_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi1_core_clk", @@ -3014,7 +3014,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3542,9 +3435,8 @@ static struct clk_branch gcc_ubi1_mpt_cl +@@ -3536,9 +3429,8 @@ static struct clk_branch gcc_ubi1_mpt_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_ubi1_mpt_clk", @@ -3026,7 +3026,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3559,9 +3451,8 @@ static struct clk_branch gcc_cmn_12gpll_ +@@ -3553,9 +3445,8 @@ static struct clk_branch gcc_cmn_12gpll_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_cmn_12gpll_ahb_clk", @@ -3038,7 +3038,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3576,9 +3467,8 @@ static struct clk_branch gcc_cmn_12gpll_ +@@ -3570,9 +3461,8 @@ static struct clk_branch gcc_cmn_12gpll_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_cmn_12gpll_sys_clk", @@ -3050,7 +3050,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3593,9 +3483,8 @@ static struct clk_branch gcc_mdio_ahb_cl +@@ -3587,9 +3477,8 @@ static struct clk_branch gcc_mdio_ahb_cl .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_mdio_ahb_clk", @@ -3062,7 +3062,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3610,9 +3499,8 @@ static struct clk_branch gcc_uniphy0_ahb +@@ -3604,9 +3493,8 @@ static struct clk_branch gcc_uniphy0_ahb .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_ahb_clk", @@ -3074,7 +3074,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3627,9 +3515,8 @@ static struct clk_branch gcc_uniphy0_sys +@@ -3621,9 +3509,8 @@ static struct clk_branch gcc_uniphy0_sys .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_sys_clk", @@ -3086,7 +3086,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3644,9 +3531,8 @@ static struct clk_branch gcc_uniphy1_ahb +@@ -3638,9 +3525,8 @@ static struct clk_branch gcc_uniphy1_ahb .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy1_ahb_clk", @@ -3098,7 +3098,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3661,9 +3547,8 @@ static struct clk_branch gcc_uniphy1_sys +@@ -3655,9 +3541,8 @@ static struct clk_branch gcc_uniphy1_sys .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy1_sys_clk", @@ -3110,7 +3110,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3678,9 +3563,8 @@ static struct clk_branch gcc_uniphy2_ahb +@@ -3672,9 +3557,8 @@ static struct clk_branch gcc_uniphy2_ahb .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy2_ahb_clk", @@ -3122,7 +3122,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3695,9 +3579,8 @@ static struct clk_branch gcc_uniphy2_sys +@@ -3689,9 +3573,8 @@ static struct clk_branch gcc_uniphy2_sys .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy2_sys_clk", @@ -3134,7 +3134,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3712,9 +3595,8 @@ static struct clk_branch gcc_nss_port1_r +@@ -3706,9 +3589,8 @@ static struct clk_branch gcc_nss_port1_r .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port1_rx_clk", @@ -3146,7 +3146,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3729,9 +3611,8 @@ static struct clk_branch gcc_nss_port1_t +@@ -3723,9 +3605,8 @@ static struct clk_branch gcc_nss_port1_t .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port1_tx_clk", @@ -3158,7 +3158,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3746,9 +3627,8 @@ static struct clk_branch gcc_nss_port2_r +@@ -3740,9 +3621,8 @@ static struct clk_branch gcc_nss_port2_r .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port2_rx_clk", @@ -3170,7 +3170,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3763,9 +3643,8 @@ static struct clk_branch gcc_nss_port2_t +@@ -3757,9 +3637,8 @@ static struct clk_branch gcc_nss_port2_t .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port2_tx_clk", @@ -3182,7 +3182,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3780,9 +3659,8 @@ static struct clk_branch gcc_nss_port3_r +@@ -3774,9 +3653,8 @@ static struct clk_branch gcc_nss_port3_r .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port3_rx_clk", @@ -3194,7 +3194,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3797,9 +3675,8 @@ static struct clk_branch gcc_nss_port3_t +@@ -3791,9 +3669,8 @@ static struct clk_branch gcc_nss_port3_t .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port3_tx_clk", @@ -3206,7 +3206,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3814,9 +3691,8 @@ static struct clk_branch gcc_nss_port4_r +@@ -3808,9 +3685,8 @@ static struct clk_branch gcc_nss_port4_r .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port4_rx_clk", @@ -3218,7 +3218,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3831,9 +3707,8 @@ static struct clk_branch gcc_nss_port4_t +@@ -3825,9 +3701,8 @@ static struct clk_branch gcc_nss_port4_t .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port4_tx_clk", @@ -3230,7 +3230,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3848,9 +3723,8 @@ static struct clk_branch gcc_nss_port5_r +@@ -3842,9 +3717,8 @@ static struct clk_branch gcc_nss_port5_r .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port5_rx_clk", @@ -3242,7 +3242,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3865,9 +3739,8 @@ static struct clk_branch gcc_nss_port5_t +@@ -3859,9 +3733,8 @@ static struct clk_branch gcc_nss_port5_t .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port5_tx_clk", @@ -3254,7 +3254,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3882,9 +3755,8 @@ static struct clk_branch gcc_nss_port6_r +@@ -3876,9 +3749,8 @@ static struct clk_branch gcc_nss_port6_r .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port6_rx_clk", @@ -3266,7 +3266,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3899,9 +3771,8 @@ static struct clk_branch gcc_nss_port6_t +@@ -3893,9 +3765,8 @@ static struct clk_branch gcc_nss_port6_t .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_nss_port6_tx_clk", @@ -3278,7 +3278,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3916,9 +3787,8 @@ static struct clk_branch gcc_port1_mac_c +@@ -3910,9 +3781,8 @@ static struct clk_branch gcc_port1_mac_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_port1_mac_clk", @@ -3290,7 +3290,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3933,9 +3803,8 @@ static struct clk_branch gcc_port2_mac_c +@@ -3927,9 +3797,8 @@ static struct clk_branch gcc_port2_mac_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_port2_mac_clk", @@ -3302,7 +3302,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3950,9 +3819,8 @@ static struct clk_branch gcc_port3_mac_c +@@ -3944,9 +3813,8 @@ static struct clk_branch gcc_port3_mac_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_port3_mac_clk", @@ -3314,7 +3314,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3967,9 +3835,8 @@ static struct clk_branch gcc_port4_mac_c +@@ -3961,9 +3829,8 @@ static struct clk_branch gcc_port4_mac_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_port4_mac_clk", @@ -3326,7 +3326,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -3984,9 +3851,8 @@ static struct clk_branch gcc_port5_mac_c +@@ -3978,9 +3845,8 @@ static struct clk_branch gcc_port5_mac_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_port5_mac_clk", @@ -3338,7 +3338,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4001,9 +3867,8 @@ static struct clk_branch gcc_port6_mac_c +@@ -3995,9 +3861,8 @@ static struct clk_branch gcc_port6_mac_c .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_port6_mac_clk", @@ -3350,7 +3350,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4018,9 +3883,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4012,9 +3877,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port1_rx_clk", @@ -3362,7 +3362,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4035,9 +3899,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4029,9 +3893,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port1_tx_clk", @@ -3374,7 +3374,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4052,9 +3915,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4046,9 +3909,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port2_rx_clk", @@ -3386,7 +3386,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4069,9 +3931,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4063,9 +3925,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port2_tx_clk", @@ -3398,7 +3398,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4086,9 +3947,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4080,9 +3941,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port3_rx_clk", @@ -3410,7 +3410,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4103,9 +3963,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4097,9 +3957,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port3_tx_clk", @@ -3422,7 +3422,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4120,9 +3979,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4114,9 +3973,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port4_rx_clk", @@ -3434,7 +3434,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4137,9 +3995,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4131,9 +3989,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port4_tx_clk", @@ -3446,7 +3446,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4154,9 +4011,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4148,9 +4005,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port5_rx_clk", @@ -3458,7 +3458,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4171,9 +4027,8 @@ static struct clk_branch gcc_uniphy0_por +@@ -4165,9 +4021,8 @@ static struct clk_branch gcc_uniphy0_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy0_port5_tx_clk", @@ -3470,7 +3470,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4188,9 +4043,8 @@ static struct clk_branch gcc_uniphy1_por +@@ -4182,9 +4037,8 @@ static struct clk_branch gcc_uniphy1_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy1_port5_rx_clk", @@ -3482,7 +3482,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4205,9 +4059,8 @@ static struct clk_branch gcc_uniphy1_por +@@ -4199,9 +4053,8 @@ static struct clk_branch gcc_uniphy1_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy1_port5_tx_clk", @@ -3494,7 +3494,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4222,9 +4075,8 @@ static struct clk_branch gcc_uniphy2_por +@@ -4216,9 +4069,8 @@ static struct clk_branch gcc_uniphy2_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy2_port6_rx_clk", @@ -3506,7 +3506,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4239,9 +4091,8 @@ static struct clk_branch gcc_uniphy2_por +@@ -4233,9 +4085,8 @@ static struct clk_branch gcc_uniphy2_por .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_uniphy2_port6_tx_clk", @@ -3518,7 +3518,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4257,9 +4108,8 @@ static struct clk_branch gcc_crypto_ahb_ +@@ -4251,9 +4102,8 @@ static struct clk_branch gcc_crypto_ahb_ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_crypto_ahb_clk", @@ -3530,7 +3530,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4275,9 +4125,8 @@ static struct clk_branch gcc_crypto_axi_ +@@ -4269,9 +4119,8 @@ static struct clk_branch gcc_crypto_axi_ .enable_mask = BIT(1), .hw.init = &(struct clk_init_data){ .name = "gcc_crypto_axi_clk", @@ -3542,7 +3542,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4293,9 +4142,8 @@ static struct clk_branch gcc_crypto_clk +@@ -4287,9 +4136,8 @@ static struct clk_branch gcc_crypto_clk .enable_mask = BIT(2), .hw.init = &(struct clk_init_data){ .name = "gcc_crypto_clk", @@ -3554,7 +3554,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4310,9 +4158,8 @@ static struct clk_branch gcc_gp1_clk = { +@@ -4304,9 +4152,8 @@ static struct clk_branch gcc_gp1_clk = { .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_gp1_clk", @@ -3566,7 +3566,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4327,9 +4174,8 @@ static struct clk_branch gcc_gp2_clk = { +@@ -4321,9 +4168,8 @@ static struct clk_branch gcc_gp2_clk = { .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_gp2_clk", @@ -3578,7 +3578,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4344,9 +4190,8 @@ static struct clk_branch gcc_gp3_clk = { +@@ -4338,9 +4184,8 @@ static struct clk_branch gcc_gp3_clk = { .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_gp3_clk", @@ -3590,7 +3590,7 @@ Link: https://lore.kernel.org/r/20221030175703.1103224-1-robimarko@gmail.com .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, -@@ -4368,7 +4213,7 @@ static struct clk_rcg2 pcie0_rchng_clk_s +@@ -4362,7 +4207,7 @@ static struct clk_rcg2 pcie0_rchng_clk_s .clkr.hw.init = &(struct clk_init_data){ .name = "pcie0_rchng_clk_src", .parent_data = gcc_xo_gpll0, diff --git a/target/linux/ipq807x/patches-5.15/0051-v6.2-clk-qcom-ipq8074-add-missing-networking-resets.patch b/target/linux/ipq807x/patches-5.15/0051-v6.2-clk-qcom-ipq8074-add-missing-networking-resets.patch index 212fc84869c190..81014ab24c9bda 100644 --- a/target/linux/ipq807x/patches-5.15/0051-v6.2-clk-qcom-ipq8074-add-missing-networking-resets.patch +++ b/target/linux/ipq807x/patches-5.15/0051-v6.2-clk-qcom-ipq8074-add-missing-networking-resets.patch @@ -18,7 +18,7 @@ Link: https://lore.kernel.org/r/20221107132901.489240-3-robimarko@gmail.com --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c -@@ -4671,6 +4671,20 @@ static const struct qcom_reset_map gcc_i +@@ -4665,6 +4665,20 @@ static const struct qcom_reset_map gcc_i [GCC_PCIE1_AXI_SLAVE_ARES] = { 0x76040, 4 }, [GCC_PCIE1_AHB_ARES] = { 0x76040, 5 }, [GCC_PCIE1_AXI_MASTER_STICKY_ARES] = { 0x76040, 6 }, diff --git a/target/linux/ipq807x/patches-5.15/0052-v6.2-clk-qcom-ipq8074-populate-fw_name-for-all-parents.patch b/target/linux/ipq807x/patches-5.15/0052-v6.2-clk-qcom-ipq8074-populate-fw_name-for-all-parents.patch index 7372b1da8eda8f..35a0a07c70b272 100644 --- a/target/linux/ipq807x/patches-5.15/0052-v6.2-clk-qcom-ipq8074-populate-fw_name-for-all-parents.patch +++ b/target/linux/ipq807x/patches-5.15/0052-v6.2-clk-qcom-ipq8074-populate-fw_name-for-all-parents.patch @@ -22,7 +22,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c -@@ -680,7 +680,7 @@ static struct clk_rcg2 pcie0_aux_clk_src +@@ -674,7 +674,7 @@ static struct clk_rcg2 pcie0_aux_clk_src }; static const struct clk_parent_data gcc_pcie20_phy0_pipe_clk_xo[] = { @@ -31,7 +31,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com { .fw_name = "xo", .name = "xo" }, }; -@@ -733,7 +733,7 @@ static struct clk_rcg2 pcie1_aux_clk_src +@@ -727,7 +727,7 @@ static struct clk_rcg2 pcie1_aux_clk_src }; static const struct clk_parent_data gcc_pcie20_phy1_pipe_clk_xo[] = { @@ -40,7 +40,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com { .fw_name = "xo", .name = "xo" }, }; -@@ -1137,7 +1137,7 @@ static const struct freq_tbl ftbl_nss_no +@@ -1131,7 +1131,7 @@ static const struct freq_tbl ftbl_nss_no static const struct clk_parent_data gcc_xo_bias_pll_nss_noc_clk_gpll0_gpll2[] = { { .fw_name = "xo", .name = "xo" }, @@ -49,7 +49,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com { .hw = &gpll0.clkr.hw }, { .hw = &gpll2.clkr.hw }, }; -@@ -1362,7 +1362,7 @@ static const struct freq_tbl ftbl_nss_pp +@@ -1356,7 +1356,7 @@ static const struct freq_tbl ftbl_nss_pp static const struct clk_parent_data gcc_xo_bias_gpll0_gpll4_nss_ubi32[] = { { .fw_name = "xo", .name = "xo" }, @@ -58,7 +58,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com { .hw = &gpll0.clkr.hw }, { .hw = &gpll4.clkr.hw }, { .hw = &nss_crypto_pll.clkr.hw }, -@@ -1413,10 +1413,10 @@ static const struct freq_tbl ftbl_nss_po +@@ -1407,10 +1407,10 @@ static const struct freq_tbl ftbl_nss_po static const struct clk_parent_data gcc_xo_uniphy0_rx_tx_ubi32_bias[] = { { .fw_name = "xo", .name = "xo" }, @@ -72,7 +72,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com }; static const struct parent_map gcc_xo_uniphy0_rx_tx_ubi32_bias_map[] = { -@@ -1465,10 +1465,10 @@ static const struct freq_tbl ftbl_nss_po +@@ -1459,10 +1459,10 @@ static const struct freq_tbl ftbl_nss_po static const struct clk_parent_data gcc_xo_uniphy0_tx_rx_ubi32_bias[] = { { .fw_name = "xo", .name = "xo" }, @@ -86,7 +86,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com }; static const struct parent_map gcc_xo_uniphy0_tx_rx_ubi32_bias_map[] = { -@@ -1696,12 +1696,12 @@ static const struct freq_tbl ftbl_nss_po +@@ -1690,12 +1690,12 @@ static const struct freq_tbl ftbl_nss_po static const struct clk_parent_data gcc_xo_uniphy0_rx_tx_uniphy1_rx_tx_ubi32_bias[] = { { .fw_name = "xo", .name = "xo" }, @@ -104,7 +104,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com }; static const struct parent_map -@@ -1758,12 +1758,12 @@ static const struct freq_tbl ftbl_nss_po +@@ -1752,12 +1752,12 @@ static const struct freq_tbl ftbl_nss_po static const struct clk_parent_data gcc_xo_uniphy0_tx_rx_uniphy1_tx_rx_ubi32_bias[] = { { .fw_name = "xo", .name = "xo" }, @@ -122,7 +122,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com }; static const struct parent_map -@@ -1820,10 +1820,10 @@ static const struct freq_tbl ftbl_nss_po +@@ -1814,10 +1814,10 @@ static const struct freq_tbl ftbl_nss_po static const struct clk_parent_data gcc_xo_uniphy2_rx_tx_ubi32_bias[] = { { .fw_name = "xo", .name = "xo" }, @@ -136,7 +136,7 @@ Link: https://lore.kernel.org/r/20221116214655.1116467-1-robimarko@gmail.com }; static const struct parent_map gcc_xo_uniphy2_rx_tx_ubi32_bias_map[] = { -@@ -1877,10 +1877,10 @@ static const struct freq_tbl ftbl_nss_po +@@ -1871,10 +1871,10 @@ static const struct freq_tbl ftbl_nss_po static const struct clk_parent_data gcc_xo_uniphy2_tx_rx_ubi32_bias[] = { { .fw_name = "xo", .name = "xo" }, diff --git a/target/linux/ipq807x/patches-5.15/0074-v6.0-PCI-dwc-Move-GEN3_RELATED-DBI-definitions-to-common-.patch b/target/linux/ipq807x/patches-5.15/0074-v6.0-PCI-dwc-Move-GEN3_RELATED-DBI-definitions-to-common-.patch index 626507abb2dba8..93261ebfb37037 100644 --- a/target/linux/ipq807x/patches-5.15/0074-v6.0-PCI-dwc-Move-GEN3_RELATED-DBI-definitions-to-common-.patch +++ b/target/linux/ipq807x/patches-5.15/0074-v6.0-PCI-dwc-Move-GEN3_RELATED-DBI-definitions-to-common-.patch @@ -31,7 +31,7 @@ Reviewed-by: Rob Herring --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c -@@ -193,12 +193,6 @@ +@@ -194,12 +194,6 @@ #define GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC_MASK GENMASK(23, 8) #define GEN3_EQ_CONTROL_OFF_FB_MODE_MASK GENMASK(3, 0) diff --git a/target/linux/ipq807x/patches-5.15/0101-clk-qcom-gcc-ipq8074-rework-nss_port5-6-clock-to-mul.patch b/target/linux/ipq807x/patches-5.15/0101-clk-qcom-gcc-ipq8074-rework-nss_port5-6-clock-to-mul.patch index 32fb2d9d872735..62a30bbb228131 100644 --- a/target/linux/ipq807x/patches-5.15/0101-clk-qcom-gcc-ipq8074-rework-nss_port5-6-clock-to-mul.patch +++ b/target/linux/ipq807x/patches-5.15/0101-clk-qcom-gcc-ipq8074-rework-nss_port5-6-clock-to-mul.patch @@ -23,7 +23,7 @@ Signed-off-by: Christian Marangi --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c -@@ -1682,13 +1682,21 @@ static struct clk_regmap_div nss_port4_t +@@ -1676,13 +1676,21 @@ static struct clk_regmap_div nss_port4_t }, }; @@ -49,7 +49,7 @@ Signed-off-by: Christian Marangi F(156250000, P_UNIPHY1_RX, 2, 0, 0), F(312500000, P_UNIPHY1_RX, 1, 0, 0), { } -@@ -1744,13 +1752,21 @@ static struct clk_regmap_div nss_port5_r +@@ -1738,13 +1746,21 @@ static struct clk_regmap_div nss_port5_r }, }; @@ -75,7 +75,7 @@ Signed-off-by: Christian Marangi F(156250000, P_UNIPHY1_TX, 2, 0, 0), F(312500000, P_UNIPHY1_TX, 1, 0, 0), { } -@@ -1806,13 +1822,21 @@ static struct clk_regmap_div nss_port5_t +@@ -1800,13 +1816,21 @@ static struct clk_regmap_div nss_port5_t }, }; @@ -101,7 +101,7 @@ Signed-off-by: Christian Marangi F(156250000, P_UNIPHY2_RX, 2, 0, 0), F(312500000, P_UNIPHY2_RX, 1, 0, 0), { } -@@ -1863,13 +1887,21 @@ static struct clk_regmap_div nss_port6_r +@@ -1857,13 +1881,21 @@ static struct clk_regmap_div nss_port6_r }, }; diff --git a/target/linux/ipq807x/patches-5.15/0118-clk-qcom-Add-WCSSAON-reset.patch b/target/linux/ipq807x/patches-5.15/0118-clk-qcom-Add-WCSSAON-reset.patch index 791531775ef0f8..be0524338daf20 100644 --- a/target/linux/ipq807x/patches-5.15/0118-clk-qcom-Add-WCSSAON-reset.patch +++ b/target/linux/ipq807x/patches-5.15/0118-clk-qcom-Add-WCSSAON-reset.patch @@ -15,7 +15,7 @@ Acked-by: Stephen Boyd --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c -@@ -4717,6 +4717,7 @@ static const struct qcom_reset_map gcc_i +@@ -4711,6 +4711,7 @@ static const struct qcom_reset_map gcc_i [GCC_NSSPORT4_RESET] = { .reg = 0x68014, .bitmask = BIT(27) | GENMASK(9, 8) }, [GCC_NSSPORT5_RESET] = { .reg = 0x68014, .bitmask = BIT(28) | GENMASK(11, 10) }, [GCC_NSSPORT6_RESET] = { .reg = 0x68014, .bitmask = BIT(29) | GENMASK(13, 12) }, diff --git a/target/linux/ipq807x/patches-5.15/0131-clk-qcom-ipq8074-populate-fw_name-for-usb3phy-s.patch b/target/linux/ipq807x/patches-5.15/0131-clk-qcom-ipq8074-populate-fw_name-for-usb3phy-s.patch index eb772be4cee807..e0e8125ba654ad 100644 --- a/target/linux/ipq807x/patches-5.15/0131-clk-qcom-ipq8074-populate-fw_name-for-usb3phy-s.patch +++ b/target/linux/ipq807x/patches-5.15/0131-clk-qcom-ipq8074-populate-fw_name-for-usb3phy-s.patch @@ -18,7 +18,7 @@ Signed-off-by: Robert Marko --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c -@@ -934,7 +934,7 @@ static struct clk_rcg2 usb0_mock_utmi_cl +@@ -928,7 +928,7 @@ static struct clk_rcg2 usb0_mock_utmi_cl }; static const struct clk_parent_data gcc_usb3phy_0_cc_pipe_clk_xo[] = { @@ -27,7 +27,7 @@ Signed-off-by: Robert Marko { .fw_name = "xo", .name = "xo" }, }; -@@ -1002,7 +1002,7 @@ static struct clk_rcg2 usb1_mock_utmi_cl +@@ -996,7 +996,7 @@ static struct clk_rcg2 usb1_mock_utmi_cl }; static const struct clk_parent_data gcc_usb3phy_1_cc_pipe_clk_xo[] = { diff --git a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch index 25410e1fb7104f..e6a1361022776f 100644 --- a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch +++ b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch @@ -15,7 +15,7 @@ Signed-off-by: Stefan Koch --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -2431,6 +2431,12 @@ config MIPS_VPE_LOADER +@@ -2433,6 +2433,12 @@ config MIPS_VPE_LOADER Includes a loader for loading an elf relocatable object onto another VPE and running it. diff --git a/target/linux/lantiq/patches-5.15/0302-mtd-cfi_cmdset_0001-Disable-write-buffer-functions-i.patch b/target/linux/lantiq/patches-5.15/0302-mtd-cfi_cmdset_0001-Disable-write-buffer-functions-i.patch index 741011039eeb21..c43d9d4b355096 100644 --- a/target/linux/lantiq/patches-5.15/0302-mtd-cfi_cmdset_0001-Disable-write-buffer-functions-i.patch +++ b/target/linux/lantiq/patches-5.15/0302-mtd-cfi_cmdset_0001-Disable-write-buffer-functions-i.patch @@ -44,7 +44,7 @@ Signed-off-by: Aleksander Jan Bajkowski /* * Some chips power-up with all sectors locked by default. -@@ -1703,6 +1707,7 @@ static int cfi_intelext_write_words (str +@@ -1719,6 +1723,7 @@ static int cfi_intelext_write_words (str } @@ -52,7 +52,7 @@ Signed-off-by: Aleksander Jan Bajkowski static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, unsigned long adr, const struct kvec **pvec, unsigned long *pvec_seek, int len) -@@ -1931,6 +1936,7 @@ static int cfi_intelext_write_buffers (s +@@ -1947,6 +1952,7 @@ static int cfi_intelext_write_buffers (s return cfi_intelext_writev(mtd, &vec, 1, to, retlen); } diff --git a/target/linux/mediatek/patches-5.15/100-dts-update-mt7622-rfb1.patch b/target/linux/mediatek/patches-5.15/100-dts-update-mt7622-rfb1.patch index 7224a9882c02a7..1f9e24a4d29e77 100644 --- a/target/linux/mediatek/patches-5.15/100-dts-update-mt7622-rfb1.patch +++ b/target/linux/mediatek/patches-5.15/100-dts-update-mt7622-rfb1.patch @@ -40,7 +40,7 @@ }; }; - memory { + memory@40000000 { - reg = <0 0x40000000 0 0x20000000>; + reg = <0 0x40000000 0 0x40000000>; }; diff --git a/target/linux/mediatek/patches-5.15/113-dts-fix-bpi64-leds-and-buttons.patch b/target/linux/mediatek/patches-5.15/113-dts-fix-bpi64-leds-and-buttons.patch index f88dbc71955a02..f728b965642c7c 100644 --- a/target/linux/mediatek/patches-5.15/113-dts-fix-bpi64-leds-and-buttons.patch +++ b/target/linux/mediatek/patches-5.15/113-dts-fix-bpi64-leds-and-buttons.patch @@ -53,4 +53,4 @@ + */ }; - memory { + memory@40000000 { diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index 0d9fa0550b23d1..69f2d2a545dcf4 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -237,7 +237,7 @@ Signed-off-by: Wolfram Sang priv->adap.algo = &hix5hd2_i2c_algorithm; --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c -@@ -1111,7 +1111,7 @@ static void dmi_check_onboard_device(u8 +@@ -1110,7 +1110,7 @@ static void dmi_check_onboard_device(u8 memset(&info, 0, sizeof(struct i2c_board_info)); info.addr = dmi_devices[i].i2c_addr; @@ -246,7 +246,7 @@ Signed-off-by: Wolfram Sang i2c_new_client_device(adap, &info); break; } -@@ -1267,7 +1267,7 @@ static void register_dell_lis3lv02d_i2c_ +@@ -1266,7 +1266,7 @@ static void register_dell_lis3lv02d_i2c_ memset(&info, 0, sizeof(struct i2c_board_info)); info.addr = dell_lis3lv02d_devices[i].i2c_addr; @@ -403,7 +403,7 @@ Signed-off-by: Wolfram Sang /* Slow down if we can't sense SCL */ --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c -@@ -1403,7 +1403,7 @@ static int i2c_pxa_probe(struct platform +@@ -1463,7 +1463,7 @@ static int i2c_pxa_probe(struct platform spin_lock_init(&i2c->lock); init_waitqueue_head(&i2c->wait); diff --git a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch index 5ded06ff63f617..54901f5549ef46 100644 --- a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch @@ -37,7 +37,7 @@ * managed to set the command line, unless CONFIG_CMDLINE_FORCE --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig -@@ -2057,6 +2057,14 @@ config CMDLINE_FORCE +@@ -2059,6 +2059,14 @@ config CMDLINE_FORCE endchoice diff --git a/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch index d064b801ecfa7c..bedeea4784c4fe 100644 --- a/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/mvebu/patches-5.15/300-mvebu-Mangle-bootloader-s-kernel-arguments.patch @@ -258,7 +258,7 @@ Signed-off-by: Michael Gray static int kernel_init(void *); extern void init_IRQ(void); -@@ -988,6 +992,18 @@ asmlinkage __visible void __init __no_sa +@@ -992,6 +996,18 @@ asmlinkage __visible void __init __no_sa page_alloc_init(); pr_notice("Kernel command line: %s\n", saved_command_line); diff --git a/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch b/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch index 785fc1273c3faf..c88b864da56787 100644 --- a/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch +++ b/target/linux/octeon/patches-5.15/100-mips_image_cmdline_hack.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1182,6 +1182,10 @@ config MIPS_MSC +@@ -1183,6 +1183,10 @@ config MIPS_MSC config SYNC_R4K bool diff --git a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch index 05eaa9aedfe7e8..0400d1e9ddc841 100644 --- a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch +++ b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch @@ -22,7 +22,7 @@ Signed-off-by: Tim Harvey #include #include #include -@@ -5858,3 +5859,34 @@ static void nvidia_ion_ahci_fixup(struct +@@ -5879,3 +5880,34 @@ static void nvidia_ion_ahci_fixup(struct pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); diff --git a/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch index 1e04b9daf58fe9..f1fa6ca45fb28e 100644 --- a/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch @@ -239,7 +239,7 @@ Signed-off-by: Adrian Panella static int kernel_init(void *); extern void init_IRQ(void); -@@ -988,6 +992,18 @@ asmlinkage __visible void __init __no_sa +@@ -992,6 +996,18 @@ asmlinkage __visible void __init __no_sa page_alloc_init(); pr_notice("Kernel command line: %s\n", saved_command_line); diff --git a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch index b8461b0030ce16..437c7611321765 100644 --- a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch +++ b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch @@ -95,7 +95,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c phydev->mii_ts->link_state(phydev->mii_ts, phydev); --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1369,7 +1369,8 @@ void phylink_destroy(struct phylink *pl) +@@ -1370,7 +1370,8 @@ void phylink_destroy(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_destroy); diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index ed121a7ce72f48..eaeea0991d5e69 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1055,8 +1055,58 @@ config NLM_XLP_BOARD +@@ -1056,8 +1056,58 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. diff --git a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch index 183c9dda2fdae1..6b24df46748a69 100644 --- a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch +++ b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1990,6 +1990,11 @@ int phylink_ethtool_ksettings_set(struct +@@ -1991,6 +1991,11 @@ int phylink_ethtool_ksettings_set(struct * the presence of a PHY, this should not be changed as that * should be determined from the media side advertisement. */ @@ -33,7 +33,7 @@ Submitted-by: John Crispin return phy_ethtool_ksettings_set(pl->phydev, kset); } -@@ -2293,8 +2298,11 @@ int phylink_ethtool_get_eee(struct phyli +@@ -2294,8 +2299,11 @@ int phylink_ethtool_get_eee(struct phyli ASSERT_RTNL(); @@ -46,7 +46,7 @@ Submitted-by: John Crispin return ret; } -@@ -2311,8 +2319,11 @@ int phylink_ethtool_set_eee(struct phyli +@@ -2312,8 +2320,11 @@ int phylink_ethtool_set_eee(struct phyli ASSERT_RTNL(); From af7ef781aca5c36b1b63460c852803cc3e5357bf Mon Sep 17 00:00:00 2001 From: Alan Luck Date: Wed, 8 Nov 2023 09:10:35 +1100 Subject: [PATCH 0699/1171] ramips: add encrypted SGE factory image for D-Link devices creates SGE encrypted factory images to use via the D-Link web interface rename the old factory unencrypted images to recovery for use in the recovery console when recovery is needed adjusted to not touch unrelated devices Signed-off-by: Alan Luck (cherry picked and adjusted from commit 4c0dc68f466588bb2ef60b29a4d8052b34112ca6) Signed-off-by: Florian Maurer --- include/image-commands.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/image-commands.mk b/include/image-commands.mk index dc6ee6e7c160c0..6666eddf8f72d3 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -226,6 +226,11 @@ define Build/copy-file cat "$(1)" > "$@" endef +define Build/dlink-sge-image + $(STAGING_DIR_HOST)/bin/dlink-sge-image $(1) $@ $@.enc + mv $@.enc $@ +endef + define Build/edimax-header $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) @mv $@.new $@ From 6e39d2426b4ffa28cf5713df88f21e804f0c9e4c Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Fri, 3 Nov 2023 11:22:02 +0100 Subject: [PATCH 0700/1171] ramips: add support for D-Link COVR-X1860 A1 The COVR-X1860 are MT7621-based AX1800 devices (similar to DAP-X1860, but with two Ethernet ports and external power supply) that are sold in sets of two (COVR-X1862) and three (COVR-X1863). Specification: - MT7621 - MT7915 + MT7975 2x2 802.11ax (DBDC) - 256MB RAM - 128 MB flash - 3 LEDs (red, orange, white), routed to one indicator in the top of the device - 2 buttons (WPS in the back and Reset at the bottom of the device) MAC addresses: - LAN MAC (printed on the device) is stored in config2 partition as ASCII (entry factory_mac=xx:xx:xx:xx:xx:xx) - WAN MAC: LAN MAC + 3 - 2.4G MAC: LAN MAC + 1 - 5G MAC: LAN MAC + 2 The pins for the serial console are already labeled on the board (VCC, TX, RX, GND). Serial settings: 3.3V, 115200,8n1 Flashing via OEM Web Interface: - Download openwrt-ramips-mt7621-dlink_covr-x1860-a1-squashfs-factory.bin via the OEM web interface firmware update - The configuration wizard can be skipped by directly going to http://192.168.0.1/UpdateFirmware_Simple.html Flashing via Recovery Web Interface: - Set your IP address to 192.168.0.10, subnetmask 255.255.255.0 - Press the reset button while powering on the deivce - Keep the reset button pressed until the status LED blinks red - Open a Chromium based browser and goto http://192.168.0.1 - Download openwrt-ramips-mt7621-dlink_covr-x1860-a1-squashfs-recovery.bin Revert back to stock using the Recovery Web Interface: - Set your IP address to 192.168.0.10, subnetmask 255.255.255.25 - Press the reset button while powering on the deivce - Keep the reset button pressed until the status LED blinks red - Open a Chromium based browser and goto http://192.168.0.1 - Flash a decrypted firmware image from D-Link. Decrypting an firmware image is described below. Decrypting a D-Link firmware image: - Download https://github.com/openwrt/firmware-utils/blob/master/src/dlink-sge-image.c and https://raw.githubusercontent.com/openwrt/firmware-utils/master/src/dlink-sge-image.h - Compile a binary from the downloaded file, e.g. gcc dlink-sge-image.c -lcrypto -o dlink-sge-image - Run ./dlink-sge-image COVR-X1860 -d - Example for firmware 102b01: ./dlink-sge-image COVR-X1860 COVR-X1860_RevA_Firmware_102b01.bin COVR-X1860_RevA_Firmware_102b01_Decrypted.bin -d The pull request is based on the discussion in https://forum.openwrt.org/t/add-support-for-d-link-covr-x1860 Signed-off-by: Sebastian Schaper Signed-off-by: Roland Reinl (cherry picked from commit 0a18259e4aa361cd9e5848c038be4b9f4e3bfcc6) Signed-off-by: Florian Maurer --- .../ramips/dts/mt7621_dlink_covr-x1860-a1.dts | 186 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 33 ++++ .../mt7621/base-files/etc/board.d/02_network | 8 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 7 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 5 files changed, 235 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_dlink_covr-x1860-a1.dts diff --git a/target/linux/ramips/dts/mt7621_dlink_covr-x1860-a1.dts b/target/linux/ramips/dts/mt7621_dlink_covr-x1860-a1.dts new file mode 100644 index 00000000000000..c06c5e36baaeda --- /dev/null +++ b/target/linux/ramips/dts/mt7621_dlink_covr-x1860-a1.dts @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "dlink,covr-x1860-a1", "mediatek,mt7621-soc"; + model = "D-Link COVR-X1860 A1"; + + aliases { + led-boot = &status_orange; + led-failsafe = &status_red; + led-running = &status_white; + led-upgrade = &status_red; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + status_white: power { + label = "white:status"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + status_orange: status_orange { + label = "orange:status"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + status_red: status_red { + label = "red:status"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x80000>; + read-only; + }; + + partition@180000 { + label = "config2"; + reg = <0x180000 0x40000>; + read-only; + }; + + partition@1c0000 { + label = "kernel"; + reg = <0x1c0000 0x800000>; + }; + + fwconcat0: partition@9c0000 { + label = "fwconcat0"; + reg = <0x9c0000 0x2000000>; + }; + + partition@29c0000 { + label = "kernel2"; + reg = <0x29c0000 0x800000>; + read-only; + }; + + fwconcat1: partition@31c0000 { + label = "fwconcat1"; + reg = <0x31c0000 0x2a00000>; + }; + + partition@5bc0000 { + label = "private"; + reg = <0x5bc0000 0x1400000>; + read-only; + }; + + partition@6fc0000 { + label = "mydlink"; + reg = <0x6fc0000 0x600000>; + read-only; + }; + + partition@75c0000 { + label = "myconfig"; + reg = <0x75c0000 0xa00000>; + read-only; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + mediatek,disable-radar-background; + }; +}; + +&gmac1 { + status = "okay"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "internet"; + }; + + port@2 { + status = "okay"; + label = "ethernet"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 52968b482f428a..d25f91a0ed5190 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -9,6 +9,14 @@ DEFAULT_SOC := mt7621 DEVICE_VARS += ELECOM_HWNAME LINKSYS_HWNAME DLINK_HWID +define Build/append-dlink-covr-metadata + echo -ne '{"supported_devices": "$(1)", "firmware": "' > $@metadata.tmp + $(MKHASH) md5 "$@" | head -c32 >> $@metadata.tmp + echo '"}' >> $@metadata.tmp + fwtool -I $@metadata.tmp $@ + rm $@metadata.tmp +endef + define Build/arcadyan-trx echo -ne "hsqs" > $@.hsqs $(eval trx_magic=$(word 1,$(1))) @@ -610,6 +618,31 @@ define Device/cudy_x6-v2 endef TARGET_DEVICES += cudy_x6-v2 +define Device/dlink_covr-x1860-a1 + $(Device/dsa-migration) + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 8192k + IMAGE_SIZE := 40960k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := COVR-X1860 + DEVICE_VARIANT := A1 + DEVICE_PACKAGES := kmod-mt7915-firmware + UBINIZE_OPTS := -E 5 + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | \ + append-squashfs4-fakeroot + IMAGES += factory.bin recovery.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/recovery.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ + append-ubi | check-size + IMAGE/factory.bin := $$(IMAGE/recovery.bin) | \ + append-dlink-covr-metadata $$(DEVICE_MODEL) | \ + dlink-sge-image $$(DEVICE_MODEL) +endef +TARGET_DEVICES += dlink_covr-x1860-a1 + define Device/dlink_dap-1620-b1 DEVICE_VENDOR := D-Link DEVICE_MODEL := DAP-1620 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 4b23afc1cf2910..041df7677e3123 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -94,6 +94,9 @@ ramips_setup_interfaces() zyxel,nr7101) ucidef_set_interfaces_lan_wan "lan" "wan" ;; + dlink,covr-x1860-a1) + ucidef_set_interfaces_lan_wan "ethernet" "internet" + ;; gnubee,gb-pc1) ucidef_set_interface_lan "ethblack ethblue" ;; @@ -208,6 +211,11 @@ ramips_setup_macs() label_mac=$lan_mac wan_mac=$(macaddr_add "$lan_mac" 1) ;; + dlink,covr-x1860-a1) + label_mac=$(mtd_get_mac_ascii config2 factory_mac) + wan_mac=$(macaddr_add "$label_mac" 3) + lan_mac=$label_mac + ;; dlink,dir-860l-b1) lan_mac=$(mtd_get_mac_ascii factory lanmac) wan_mac=$(mtd_get_mac_ascii factory wanmac) diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 0443fd2ba73457..46d6b15af0f109 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -45,6 +45,13 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress ;; + dlink,covr-x1860-a1) + label_mac=$(mtd_get_mac_ascii config2 factory_mac) + [ "$PHYNBR" = "0" ] && \ + macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && \ + macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; dlink,dap-x1860-a1) hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" [ "$PHYNBR" = "0" ] && \ diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index e212c688ecb685..98d26cc904ad25 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -63,6 +63,7 @@ platform_do_upgrade() { beeline,smartbox-turbo|\ beeline,smartbox-turbo-plus|\ belkin,rt1800|\ + dlink,covr-x1860-a1|\ dlink,dap-x1860-a1|\ dlink,dir-1960-a1|\ dlink,dir-2640-a1|\ From 40cfdf5ffecbe1cf38426c340987c3787b56b123 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 5 Jan 2024 15:40:08 -0500 Subject: [PATCH 0701/1171] kernel: bump 5.15 to 5.15.146 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.146 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 37bb3893929fc3277e7d26ff0012d86526c98b77) [Refresh on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 ++-- ...h-Always-request-for-user-confirmatio.patch | 4 ++-- ...-CS_HIGH-if-GPIO-descriptors-are-used.patch | 4 ++-- .../209-b44-register-adm-switch.patch | 6 +++--- .../bcm47xx/patches-5.15/210-b44_phy_fix.patch | 6 +++--- ...st-fotg2-add-Gemini-specific-handling.patch | 4 ++-- ...-net-usb-ax88179_178a-add-TSO-feature.patch | 6 +++--- ...-v6.4-0003-of-Rename-of_modalias_node.patch | 2 +- .../721-net-add-packet-mangeling.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 4 ++-- ...ET-skip-GRO-for-foreign-MAC-addresses.patch | 10 +++++----- ...tional-threading-for-backlog-processi.patch | 18 +++++++++--------- ...i-Add-support-for-dynamic-calibration.patch | 6 +++--- ...-move-drivers-from-strlcpy-to-strscpy.patch | 2 +- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 2948d10bdc34b5..f8ecac57422bfe 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .145 -LINUX_KERNEL_HASH-5.15.145 = b2a49d87605f3a9491581150315e22337c1afb599efc1e2737481be3a2d6d620 +LINUX_VERSION-5.15 = .146 +LINUX_KERNEL_HASH-5.15.146 = 5a807a5fa2a80ada957d8079681dfb5cc196ec26f43244d1c8a4fd7af592d192 diff --git a/target/linux/bcm27xx/patches-5.15/950-0030-Revert-Bluetooth-Always-request-for-user-confirmatio.patch b/target/linux/bcm27xx/patches-5.15/950-0030-Revert-Bluetooth-Always-request-for-user-confirmatio.patch index 9541eb149f457d..c1925ba890c1d0 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0030-Revert-Bluetooth-Always-request-for-user-confirmatio.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0030-Revert-Bluetooth-Always-request-for-user-confirmatio.patch @@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c -@@ -2207,7 +2207,7 @@ mackey_and_ltk: +@@ -2214,7 +2214,7 @@ mackey_and_ltk: if (err) return SMP_UNSPECIFIED; @@ -33,7 +33,7 @@ Signed-off-by: Phil Elwell if (hcon->out) { sc_dhkey_check(smp); SMP_ALLOW_CMD(smp, SMP_CMD_DHKEY_CHECK); -@@ -2222,9 +2222,6 @@ mackey_and_ltk: +@@ -2229,9 +2229,6 @@ mackey_and_ltk: confirm_hint = 0; confirm: diff --git a/target/linux/bcm27xx/patches-5.15/950-0208-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch b/target/linux/bcm27xx/patches-5.15/950-0208-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch index b668a94790f9d2..c26aa9f1d2ca35 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0208-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0208-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch @@ -32,7 +32,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -3480,6 +3480,7 @@ static int __spi_validate_bits_per_word( +@@ -3492,6 +3492,7 @@ static int __spi_validate_bits_per_word( */ int spi_setup(struct spi_device *spi) { @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell unsigned bad_bits, ugly_bits; int status; -@@ -3501,6 +3502,14 @@ int spi_setup(struct spi_device *spi) +@@ -3513,6 +3514,14 @@ int spi_setup(struct spi_device *spi) (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL | SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL))) return -EINVAL; diff --git a/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch b/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch index 7728ec10942fd3..772e905ecb7602 100644 --- a/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch +++ b/target/linux/bcm47xx/patches-5.15/209-b44-register-adm-switch.patch @@ -19,7 +19,7 @@ Subject: [PATCH 210/210] b44: register adm switch #include #include -@@ -2243,6 +2245,69 @@ static void b44_adjust_link(struct net_d +@@ -2245,6 +2247,69 @@ static void b44_adjust_link(struct net_d } } @@ -89,7 +89,7 @@ Subject: [PATCH 210/210] b44: register adm switch static int b44_register_phy_one(struct b44 *bp) { __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -@@ -2279,6 +2344,9 @@ static int b44_register_phy_one(struct b +@@ -2281,6 +2346,9 @@ static int b44_register_phy_one(struct b if (!mdiobus_is_registered_device(bp->mii_bus, bp->phy_addr) && (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) { @@ -99,7 +99,7 @@ Subject: [PATCH 210/210] b44: register adm switch dev_info(sdev->dev, "could not find PHY at %i, use fixed one\n", bp->phy_addr); -@@ -2473,6 +2541,7 @@ static void b44_remove_one(struct ssb_de +@@ -2475,6 +2543,7 @@ static void b44_remove_one(struct ssb_de unregister_netdev(dev); if (bp->flags & B44_FLAG_EXTERNAL_PHY) b44_unregister_phy_one(bp); diff --git a/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch b/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch index bedebc415e73e5..ca7123f2a399c6 100644 --- a/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch +++ b/target/linux/bcm47xx/patches-5.15/210-b44_phy_fix.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c -@@ -429,10 +429,34 @@ static void b44_wap54g10_workaround(stru +@@ -430,10 +430,34 @@ static void b44_wap54g10_workaround(stru error: pr_warn("PHY: cannot reset MII transceiver isolate bit\n"); } @@ -35,7 +35,7 @@ #endif static int b44_setup_phy(struct b44 *bp) -@@ -441,6 +465,7 @@ static int b44_setup_phy(struct b44 *bp) +@@ -442,6 +466,7 @@ static int b44_setup_phy(struct b44 *bp) int err; b44_wap54g10_workaround(bp); @@ -43,7 +43,7 @@ if (bp->flags & B44_FLAG_EXTERNAL_PHY) return 0; -@@ -2173,6 +2198,8 @@ static int b44_get_invariants(struct b44 +@@ -2175,6 +2200,8 @@ static int b44_get_invariants(struct b44 * valid PHY address. */ bp->phy_addr &= 0x1F; diff --git a/target/linux/gemini/patches-5.15/0001-usb-host-fotg2-add-Gemini-specific-handling.patch b/target/linux/gemini/patches-5.15/0001-usb-host-fotg2-add-Gemini-specific-handling.patch index 6fb59efd1a3397..2d806e9191e1f3 100644 --- a/target/linux/gemini/patches-5.15/0001-usb-host-fotg2-add-Gemini-specific-handling.patch +++ b/target/linux/gemini/patches-5.15/0001-usb-host-fotg2-add-Gemini-specific-handling.patch @@ -43,7 +43,7 @@ Signed-off-by: Linus Walleij #include #include -@@ -5557,6 +5561,72 @@ static void fotg210_init(struct fotg210_ +@@ -5554,6 +5558,72 @@ static void fotg210_init(struct fotg210_ } /* @@ -116,7 +116,7 @@ Signed-off-by: Linus Walleij * fotg210_hcd_probe - initialize faraday FOTG210 HCDs * * Allocates basic resources for this USB host controller, and -@@ -5633,6 +5703,12 @@ static int fotg210_hcd_probe(struct plat +@@ -5630,6 +5700,12 @@ static int fotg210_hcd_probe(struct plat fotg210_init(fotg210); diff --git a/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch b/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch index a2168aaba5f645..598fa05e9bf00c 100644 --- a/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch +++ b/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c -@@ -1377,11 +1377,12 @@ static int ax88179_bind(struct usbnet *d +@@ -1363,11 +1363,12 @@ static int ax88179_bind(struct usbnet *d dev->mii.phy_id = 0x03; dev->mii.supports_gmii = 1; @@ -35,7 +35,7 @@ Signed-off-by: David S. Miller /* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | -@@ -1587,17 +1588,19 @@ ax88179_tx_fixup(struct usbnet *dev, str +@@ -1573,17 +1574,19 @@ ax88179_tx_fixup(struct usbnet *dev, str { u32 tx_hdr1, tx_hdr2; int frame_size = dev->maxpacket; @@ -57,7 +57,7 @@ Signed-off-by: David S. Miller if ((skb_header_cloned(skb) || headroom < 0) && pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) { dev_kfree_skb_any(skb); -@@ -1608,6 +1611,8 @@ ax88179_tx_fixup(struct usbnet *dev, str +@@ -1594,6 +1597,8 @@ ax88179_tx_fixup(struct usbnet *dev, str put_unaligned_le32(tx_hdr1, ptr); put_unaligned_le32(tx_hdr2, ptr + 4); diff --git a/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch b/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch index 6c205217018b52..855d45311e627a 100644 --- a/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch +++ b/target/linux/generic/backport-5.15/828-v6.4-0003-of-Rename-of_modalias_node.patch @@ -148,7 +148,7 @@ Signed-off-by: Greg Kroah-Hartman * of_find_node_by_phandle - Find a node given a phandle --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -2128,8 +2128,8 @@ of_register_spi_device(struct spi_contro +@@ -2140,8 +2140,8 @@ of_register_spi_device(struct spi_contro } /* Select device driver */ diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index ac9a161b5f5915..b5a20de21bf16d 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3597,6 +3597,11 @@ static int xmit_one(struct sk_buff *skb, +@@ -3600,6 +3600,11 @@ static int xmit_one(struct sk_buff *skb, if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 60f02f71436e6c..0060fbbd2addc2 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -43,7 +43,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1146,6 +1151,11 @@ static const struct usb_device_id option +@@ -1147,6 +1152,11 @@ static const struct usb_device_id option { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */ .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) }, @@ -55,7 +55,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support /* Quectel products using Qualcomm vendor ID */ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), -@@ -1187,6 +1197,11 @@ static const struct usb_device_id option +@@ -1188,6 +1198,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 46856e1552fa06..77d6f84256d680 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau __u8 inner_protocol_type:1; --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6074,6 +6074,9 @@ static enum gro_result dev_gro_receive(s +@@ -6077,6 +6077,9 @@ static enum gro_result dev_gro_receive(s int same_flow; int grow; @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -8088,6 +8091,48 @@ static void __netdev_adjacent_dev_unlink +@@ -8091,6 +8094,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info, -@@ -8139,6 +8184,7 @@ static int __netdev_upper_dev_link(struc +@@ -8142,6 +8187,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -8235,6 +8281,7 @@ static void __netdev_upper_dev_unlink(st +@@ -8238,6 +8284,7 @@ static void __netdev_upper_dev_unlink(st __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); -@@ -9054,6 +9101,7 @@ int dev_set_mac_address(struct net_devic +@@ -9057,6 +9104,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch index 62daef91b1506e..2f6e96b7687528 100644 --- a/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch +++ b/target/linux/generic/pending-5.15/760-net-core-add-optional-threading-for-backlog-processi.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #endif --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4583,7 +4583,7 @@ static int rps_ipi_queued(struct softnet +@@ -4586,7 +4586,7 @@ static int rps_ipi_queued(struct softnet #ifdef CONFIG_RPS struct softnet_data *mysd = this_cpu_ptr(&softnet_data); @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5764,6 +5764,8 @@ static DEFINE_PER_CPU(struct work_struct +@@ -5767,6 +5767,8 @@ static DEFINE_PER_CPU(struct work_struct /* Network device is going away, flush any packets still pending */ static void flush_backlog(struct work_struct *work) { @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau struct sk_buff *skb, *tmp; struct softnet_data *sd; -@@ -5779,9 +5781,18 @@ static void flush_backlog(struct work_st +@@ -5782,9 +5784,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->process_queue); -@@ -5789,7 +5800,18 @@ static void flush_backlog(struct work_st +@@ -5792,7 +5803,18 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau } static bool flush_required(int cpu) -@@ -6472,6 +6494,7 @@ static int process_backlog(struct napi_s +@@ -6475,6 +6497,7 @@ static int process_backlog(struct napi_s local_irq_disable(); rps_lock(sd); @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6481,7 +6504,8 @@ static int process_backlog(struct napi_s +@@ -6484,7 +6507,8 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6898,6 +6922,57 @@ int dev_set_threaded(struct net_device * +@@ -6901,6 +6925,57 @@ int dev_set_threaded(struct net_device * } EXPORT_SYMBOL(dev_set_threaded); @@ -162,7 +162,7 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -11378,6 +11453,9 @@ static int dev_cpu_dead(unsigned int old +@@ -11381,6 +11456,9 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; oldsd->rps_ipi_list = NULL; -@@ -11717,6 +11795,7 @@ static int __init net_dev_init(void) +@@ -11720,6 +11798,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif diff --git a/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch b/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch index 4c980e9438d1ee..e795eda3b2b77f 100644 --- a/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch +++ b/target/linux/mediatek/patches-5.15/432-drivers-spi-Add-support-for-dynamic-calibration.patch @@ -11,7 +11,7 @@ Signed-off-by: SkyLake.Huang --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -1234,6 +1234,70 @@ static int spi_transfer_wait(struct spi_ +@@ -1246,6 +1246,70 @@ static int spi_transfer_wait(struct spi_ return 0; } @@ -82,7 +82,7 @@ Signed-off-by: SkyLake.Huang static void _spi_transfer_delay_ns(u32 ns) { if (!ns) -@@ -2021,6 +2085,75 @@ void spi_flush_queue(struct spi_controll +@@ -2033,6 +2097,75 @@ void spi_flush_queue(struct spi_controll /*-------------------------------------------------------------------------*/ #if defined(CONFIG_OF) @@ -158,7 +158,7 @@ Signed-off-by: SkyLake.Huang static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, struct device_node *nc) { -@@ -2139,6 +2272,10 @@ of_register_spi_device(struct spi_contro +@@ -2151,6 +2284,10 @@ of_register_spi_device(struct spi_contro if (rc) goto err_out; diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index 69f2d2a545dcf4..d5c8a4e3008b59 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -72,7 +72,7 @@ Signed-off-by: Wolfram Sang idev->adapter.dev.parent = &pdev->dev; --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -1028,7 +1028,7 @@ static int aspeed_i2c_probe_bus(struct p +@@ -1044,7 +1044,7 @@ static int aspeed_i2c_probe_bus(struct p bus->adap.algo = &aspeed_i2c_algo; bus->adap.dev.parent = &pdev->dev; bus->adap.dev.of_node = pdev->dev.of_node; From 0cd6b3fd0c9e0d8a297bfbd47efa6afffe360697 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 27 Dec 2023 04:49:23 -0500 Subject: [PATCH 0702/1171] linux/modules: remove deprecated module Remove upstream deprecated module from our build, see[1] 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?h=v5.15.145&id=6cd90c01b032f335d18966b2d979eef43eb2cfc1 Suggested-by: Shiji Yang Signed-off-by: John Audia (cherry picked from commit 5067863d67e4585f166133e1b9d6e482fde4c80f) --- package/kernel/linux/modules/fs.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 1dddebfed73698..9724fa72007d3e 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -352,8 +352,7 @@ define KernelPackage/fs-ksmbd DEPENDS:= \ +kmod-nls-base \ +kmod-nls-utf8 \ - +kmod-crypto-md4 \ - +kmod-crypto-md5 \ + +kmod-crypto-md5 \ +kmod-crypto-hmac \ +kmod-crypto-ecb \ +kmod-crypto-des \ From d4a21d75a9be5cf048bef126ea567c7ec61079a5 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sat, 6 Jan 2024 19:59:13 +0200 Subject: [PATCH 0703/1171] mediatek: GL-MT6000: Add missing LED state definitions Adjust LED names and provide the OpenWrt status indicator aliases to actually use LEDs by the OpenWrt boot & sysupgrade processes. * Name both LEDs clearly by the color * Add the missing OpenWrt LED status indicator aliases and remove the now unnecessary default status from blue LED After this commit, the LEDs are used as: * bootloader, really early Linux boot: blue LED is on * preinit/failsafe: white LED blinks rapidly * late boot: white LED blinks slowly * boot completed, running normally: blue LED is on * sysupgrade: white LED blinks Signed-off-by: Hannu Nyman (cherry picked from commit 5a82bb909bf16786b85508d2e974ddf0a14bb10c) --- target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts index fded507039b269..9a7031df539ab8 100644 --- a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts +++ b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts @@ -13,6 +13,10 @@ aliases { serial0 = &uart0; + led-boot = &led_white; + led-failsafe = &led_white; + led-running = &led_blue; + led-upgrade = &led_white; }; chosen { @@ -51,13 +55,12 @@ leds { compatible = "gpio-leds"; - led_run: led@0 { + led_blue: led@0 { label = "blue:run"; gpios = <&pio 38 GPIO_ACTIVE_LOW>; - default-state = "on"; }; - led@1 { + led_white: led@1 { label = "white:system"; gpios = <&pio 37 GPIO_ACTIVE_LOW>; }; From 3bf602d740765db52d96733d172093a4b9a69915 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 30 Nov 2023 07:32:52 +0100 Subject: [PATCH 0704/1171] mac80211: avoid crashing on invalid band info Frequent crashes have been observed on MT7916 based platforms. While the root of these crashes are currently unknown, they happen when decoding rate information of connected STAs in AP mode. The rate-information is associated with a band which is not available on the PHY. Check for this condition in order to avoid crashing the whole system. This patch should be removed once the roout cause has been found and fixed. Link: https://github.com/freifunk-gluon/gluon/issues/2980 Signed-off-by: David Bauer (cherry picked from commit 1278d47beaabaa963b2956e81936269b7fea4003) --- .../780-avoid-crashing-missing-band.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch diff --git a/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch new file mode 100644 index 00000000000000..2bc11efd0047c7 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch @@ -0,0 +1,34 @@ +From: David Bauer +Date: Thu, 30 Nov 2023 07:32:52 +0100 +Subject: [PATCH] mac80211: avoid crashing on invalid band info + +Frequent crashes have been observed on MT7916 based platforms. While the +root of these crashes are currently unknown, they happen when decoding +rate information of connected STAs in AP mode. The rate-information is +associated with a band which is not available on the PHY. + +Check for this condition in order to avoid crashing the whole system. +This patch should be removed once the roout cause has been found and +fixed. + +Link: https://github.com/freifunk-gluon/gluon/issues/2980 + +Signed-off-by: David Bauer +--- + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -2422,6 +2422,13 @@ static void sta_stats_decode_rate(struct + + sband = local->hw.wiphy->bands[band]; + ++ if (!sband) { ++ wiphy_warn(local->hw.wiphy, ++ "Invalid band %d\n", ++ band); ++ break; ++ } ++ + if (WARN_ON_ONCE(!sband->bitrates)) + break; + From 9cd0023e54adf8b06762c58585b7cb225e5fb2d6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Jan 2024 11:05:45 +0100 Subject: [PATCH 0705/1171] hostapd: add missing NULL pointer check on radar notification Fixes a race condition that can lead to a hostapd crash Signed-off-by: Felix Fietkau (cherry picked from commit d864f68232e910f2c8ab06a66347fc08c257dfcc) --- package/network/services/hostapd/src/src/ap/ubus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 6ff2257c329b57..66eba999017268 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -1907,6 +1907,9 @@ void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequen struct hostapd_data *hapd; int i; + if (!ctx) + return; + blob_buf_init(&b, 0); blobmsg_add_u16(&b, "frequency", frequency); blobmsg_add_u16(&b, "width", chan_width); From 2fe497c4a514d09b6e8a9e5953b51d7f4da90b6b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Jan 2024 14:36:42 +0100 Subject: [PATCH 0706/1171] mac80211: do not emit VHT160 capabilities if channel width is less than 160 MHz Fixes compatibility issues with VHT160 capable clients Signed-off-by: Felix Fietkau (cherry picked from commit 80e4e2285fdf4a7b19c84532deafe2d1e690ed30) --- .../kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index b5378e556eb232..6ff627b03813bb 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -327,6 +327,11 @@ mac80211_hostapd_setup_base() { [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" + [ "$vht_oper_chwidth" -lt 2 ] && { + vht160=0 + short_gi_160=0 + } + mac80211_add_capabilities vht_capab $vht_cap \ RXLDPC:0x10::$rxldpc \ SHORT-GI-80:0x20::$short_gi_80 \ From 4103958e768d8bb0d8c640f48341838d8bf5724a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Jan 2024 15:15:08 +0100 Subject: [PATCH 0707/1171] mediatek: fix BPI-R3 wifi mac address Setting/clearing bits on the first byte of the mac address causes collisions when using multiple SSIDs on both PHYs. Change the allocation to alter the last byte instead. Signed-off-by: Felix Fietkau (cherry picked from commit 38bec08e87b69212daf34eac7b26d643a92d9353) --- .../base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 4911d5e85ec4e4..6111854e043438 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -27,9 +27,9 @@ case "$board" in [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress ;; bananapi,bpi-r3) - addr=$(macaddr_add $(cat /sys/class/net/eth0/address) 2) - [ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress + addr=$(cat /sys/class/net/eth0/address) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress ;; cetron,ct3003) addr=$(mtd_get_mac_binary "art" 0) From e21411814833a45b39ee94c85ed57b996c892ced Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 5 Jan 2024 17:02:01 +0100 Subject: [PATCH 0708/1171] ath79: move UniFi AC template into common This allows us to embrace alphabetical sorting for the UK-Ultra. Signed-off-by: David Bauer (cherry picked from commit c9e58f85f6e5d96711291f079413d2f34c36fdc3) --- target/linux/ath79/image/common-ubnt.mk | 7 +++++++ target/linux/ath79/image/generic-ubnt.mk | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/ath79/image/common-ubnt.mk b/target/linux/ath79/image/common-ubnt.mk index 76d6de000ba603..f44e06e1109865 100644 --- a/target/linux/ath79/image/common-ubnt.mk +++ b/target/linux/ath79/image/common-ubnt.mk @@ -121,6 +121,13 @@ define Device/ubnt-xw UBNT_VERSION := 6.0.4 endef +define Device/ubnt_unifiac + DEVICE_VENDOR := Ubiquiti + SOC := qca9563 + IMAGE_SIZE := 15488k + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef + define Device/ubnt-unifi-jffs2 $(Device/ubnt) KERNEL_SIZE := 3072k diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index fa4daa3aaafd28..92b764c389819c 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -244,13 +244,6 @@ define Device/ubnt_unifi-ap-lr endef TARGET_DEVICES += ubnt_unifi-ap-lr -define Device/ubnt_unifiac - DEVICE_VENDOR := Ubiquiti - SOC := qca9563 - IMAGE_SIZE := 15488k - DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct -endef - define Device/ubnt_unifiac-lite $(Device/ubnt_unifiac) DEVICE_MODEL := UniFi AC Lite From 5ad05681f2de00c8c6d6449df2b958b0838dbc1a Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 5 Jan 2024 17:18:09 +0100 Subject: [PATCH 0709/1171] ath79: add support for UniFi UK-Ultra Hardware -------- CPU: Qualcomm Atheros QCA9563 RAM: 128M DDR2 FLASH: 16MB SPI-NOR WiFi: Qualcomm Atheros QCA9563 2x2:2 802.11n 2.4GHz Qualcomm Atheros QCA9880 2x2:2 802.11ac 5GHz Antennas -------- The device features internal antennas as well as external antenna connectors. By default, the internal antennas are used. Two GPIOs are exported by name, which can be used to control the antenna-path mux. Writing a logical 0 enables the external antenna connectors. Installation ------------ 1. Download the OpenWrt sysupgrade image to the device. You can use scp for this task. The default username and password are "ubnt" and the device is reachable at 192.168.1.20. $ scp -O openwrt-sysupgrade.bin ubnt@192.168.1.20:/tmp/firmware.bin 2. Connect to the device using SSH. $ ssh ubnt@192.168.1.20 3. Disable the write-protect $ echo "5edfacbf" > /proc/ubnthal/.uf 4. Verify kernel0 and kernel1 match mtd2 and mtd3 $ cat /proc/mtd 5. Write the sysupgrade image to kernel0 and kernel1 $ dd if=/tmp/firmware.bin of=/dev/mtdblock2 $ dd if=/tmp/firmware.bin of=/dev/mtdblock3 6. Write the bootselect flag to boot from kernel0 $ dd if=/dev/zero bs=1 count=1 of=/dev/mtd4 7. Reboot the device $ reboot Signed-off-by: David Bauer (cherry picked from commit bf94e0a38389b2ce5d33be9c97d104d36dd5ebd6) --- .../linux/ath79/dts/qca9563_ubnt_uk-ultra.dts | 35 +++++++++++++++++++ .../linux/ath79/dts/qca9563_ubnt_unifiac.dtsi | 2 +- .../generic/base-files/etc/board.d/01_leds | 7 ++++ .../generic/base-files/etc/board.d/02_network | 1 + .../base-files/etc/board.d/03_gpio_switches | 4 +++ .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + target/linux/ath79/image/generic-ubnt.mk | 7 ++++ 7 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts diff --git a/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts b/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts new file mode 100644 index 00000000000000..1ba635117e7c30 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_ubnt_uk-ultra.dts @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_ubnt_unifiac-lite.dtsi" + +/ { + compatible = "ubnt,uk-ultra", "qca,qca9563"; + model = "Ubiquiti UniFi Swiss Army Knife Ultra"; +}; + +&leds { + led-rssi0 { + label = "white:rssi0"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + + led-rssi1 { + label = "white:rssi1"; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; + + led-rssi2 { + label = "white:rssi2"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + led-rssi3 { + label = "white:rssi3"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; +}; + +/** + * Antenna selection on GPIO5 and GPIO6 + * High = Internal ; Low = External + */ diff --git a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi index 6704ec983b0bee..14fbee8ab339bd 100644 --- a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi +++ b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi @@ -13,7 +13,7 @@ led-upgrade = &led_blue; }; - leds { + leds: leds { compatible = "gpio-leds"; led_white: led_white { 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 b5cc4abf65e832..aaa4ed94d50cfe 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -494,6 +494,13 @@ ubnt,rocket-m) ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:link3" "wlan0" "51" "100" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:link4" "wlan0" "76" "100" ;; +ubnt,uk-ultra) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "white:rssi0" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "white:rssi1" "wlan0" "26" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "white:rssi2" "wlan0" "51" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "white:rssi3" "wlan0" "76" "100" + ;; wallys,dr531) ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x2" 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 0d7396a04dca98..ca35bd32236cd9 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -113,6 +113,7 @@ ath79_setup_interfaces() ubnt,powerbridge-m|\ ubnt,rocket-5ac-lite|\ ubnt,rocket-m|\ + ubnt,uk-ultra|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ 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 899a8ba97ee43e..279f518409c9bd 100644 --- 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 @@ -92,6 +92,10 @@ ubnt,nanostation-m) ubnt,nanostation-m-xw) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "2" ;; +ubnt,uk-ultra) + ucidef_add_gpio_switch "ant0_internal" "ANT0 Internal" "5" "1" + ucidef_add_gpio_switch "ant1_internal" "ANT1 Internal" "6" "1" + ;; zbtlink,zbt-wd323) ucidef_add_gpio_switch "io0" "IO#0" "0" ucidef_add_gpio_switch "io1" "IO#1" "1" 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 f0a3755de91060..cdb1b2bd9d118b 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 @@ -36,6 +36,7 @@ case "$FIRMWARE" in sophos,ap100|\ sophos,ap100c|\ ubnt,bullet-ac|\ + ubnt,uk-ultra|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 92b764c389819c..68cef7d14b13a0 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -229,6 +229,13 @@ define Device/ubnt_routerstation-pro endef TARGET_DEVICES += ubnt_routerstation-pro +define Device/ubnt_uk-ultra + $(Device/ubnt_unifiac) + DEVICE_MODEL := UniFi Swiss Army Knife Ultra + DEVICE_PACKAGES += rssileds -swconfig +endef +TARGET_DEVICES += ubnt_uk-ultra + define Device/ubnt_unifi-ap $(Device/ubnt-bz) DEVICE_MODEL := UniFi AP From cdc907abedf1ad0d17cc88fd33d35a3ef3f8fc75 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 9 Jan 2024 20:52:56 +0100 Subject: [PATCH 0710/1171] ath79: read back reset register Read back the reset register in order to flush the cache. This fixes spurious reboot hangs on TP-Link TL-WDR3600 and TL-WDR4300 with Zentel DRAM chips. This issue was fixed in the past, but switching to the reset-driver specific implementation removed the cache barrier which was previously implicitly added by reading back the register in question. Link: https://github.com/freifunk-gluon/gluon/issues/2904 Link: https://github.com/openwrt/openwrt/issues/13043 Link: https://dev.archive.openwrt.org/ticket/17839 Link: f8a7bfe1cb2c ("MIPS: ath79: fix system restart") Signed-off-by: David Bauer (cherry picked from commit 2fe8ecd880396b5ae25fe9583aaa1d71be0b8468) --- ...reset-ath79-read-back-reset-register.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch diff --git a/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch b/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch new file mode 100644 index 00000000000000..7aa501514df8a6 --- /dev/null +++ b/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch @@ -0,0 +1,33 @@ +From 661edfc3dab943a67c8821353b63cc23057f7ce9 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Tue, 9 Jan 2024 20:48:46 +0100 +Subject: [PATCH] reset: ath79: read back reset register + +Read back the reset register in order to flush the cache. This fixes +spurious reboot hangs on TP-Link TL-WDR3600 and TL-WDR4300 with Zentel +DRAM chips. + +This issue was fixed in the past, but switching to the reset-driver +specific implementation removed the old fix. + +Link: https://github.com/freifunk-gluon/gluon/issues/2904 +Link: https://github.com/openwrt/openwrt/issues/13043 +Link: https://dev.archive.openwrt.org/ticket/17839 +Link: f8a7bfe1cb2c ("MIPS: ath79: fix system restart") + +Signed-off-by: David Bauer +--- + drivers/reset/reset-ath79.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/reset/reset-ath79.c ++++ b/drivers/reset/reset-ath79.c +@@ -37,6 +37,8 @@ static int ath79_reset_update(struct res + else + val &= ~BIT(id); + writel(val, ath79_reset->base); ++ /* Flush cache */ ++ readl(ath79_reset->base); + spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return 0; From f41f10f702bbd9f5f9813d236eff56639f9b86ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Schr=C3=B6der?= Date: Wed, 10 Jan 2024 11:12:10 +0100 Subject: [PATCH 0711/1171] mediatek: GL-MT6000: Change LED colors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fine tuning PR: openwrt/openwrt#14355 Ref: 5a82bb909bf1 ("mediatek: GL-MT6000: Add missing LED state definitions") As the only LED is using white in the stock firmware when the device is running and blue for the bootloader I suggest following changes: - Using blue for the BL and preinit+failsafe - White for normal operation (like the original FW) and sysupgrade With this changes it's clear by looking to the LED in which operation mode the device is and a possible BL stuck can be seen easily. Tested with [GL-MT6000](https://openwrt.org/toh/gl.inet/gl-mt6000). Signed-off-by: Thomas Schröder Tested-by: Hannu Nyman (cherry picked from commit 4d7bac1dcaae019fb4992bfb74348ef12c02daa4) --- target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts index 9a7031df539ab8..26996e7b4a5ab2 100644 --- a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts +++ b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts @@ -13,9 +13,9 @@ aliases { serial0 = &uart0; - led-boot = &led_white; - led-failsafe = &led_white; - led-running = &led_blue; + led-boot = &led_blue; + led-failsafe = &led_blue; + led-running = &led_white; led-upgrade = &led_white; }; From 64d8c277cde0259d9f65f97830d5c18d399aea3a Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Thu, 11 Jan 2024 23:05:39 +0100 Subject: [PATCH 0712/1171] Revert "lantiq: xway: kernel: enable SMP support" Enabling SMP on the xway target results in two issues: * some danube chipset-based devices fail on boot, * on devices based on the arx100 chipset, enabling smp results in a degradation of NAT performance. After these two issues are fixed, SMP can be re-enabled. This reverts commit 084c20f6c54180f2dc6b3efc1c5ba9b62afbaf26. Fixes: #13934 Fixes: #14283 Signed-off-by: Aleksander Jan Bajkowski --- target/linux/lantiq/xway/config-5.15 | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/target/linux/lantiq/xway/config-5.15 b/target/linux/lantiq/xway/config-5.15 index 5a6f15dafdc6a5..249af20bf6f4f2 100644 --- a/target/linux/lantiq/xway/config-5.15 +++ b/target/linux/lantiq/xway/config-5.15 @@ -4,9 +4,6 @@ CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_CPU_HAS_DIEI=y -CONFIG_CPU_MIPSR2_IRQ_EI=y -CONFIG_CPU_MIPSR2_IRQ_VI=y -CONFIG_CPU_RMAP=y CONFIG_CRC16=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_HASH_INFO=y @@ -25,11 +22,6 @@ CONFIG_LANTIQ_ETOP=y CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_MIPS_EBPF_JIT=y -CONFIG_MIPS_MT=y -CONFIG_MIPS_MT_FPAFF=y -CONFIG_MIPS_MT_SMP=y -CONFIG_MIPS_NR_CPU_NR_MAP=2 -CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y @@ -39,44 +31,26 @@ CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_SELFTESTS=y CONFIG_NLS=y -CONFIG_NR_CPUS=2 -CONFIG_PADATA=y CONFIG_PCI=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_LANTIQ=y CONFIG_PSB6970_PHY=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_RFS_ACCEL=y -CONFIG_RPS=y CONFIG_RTL8306_PHY=y CONFIG_RTL8366RB_PHY=y CONFIG_RTL8366_SMI=y -# CONFIG_SCHED_CORE is not set -CONFIG_SCHED_SMT=y CONFIG_SGL_ALLOC=y -CONFIG_SMP=y -CONFIG_SMP_UP=y -CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SOC_TYPE_XWAY=y CONFIG_SOC_XWAY=y CONFIG_SWCONFIG=y -CONFIG_SYNC_R4K=y -CONFIG_SYS_SUPPORTS_SCHED_SMT=y -CONFIG_SYS_SUPPORTS_SMP=y -CONFIG_TREE_RCU=y -CONFIG_TREE_SRCU=y CONFIG_UBIFS_FS=y CONFIG_USB=y CONFIG_USB_COMMON=y CONFIG_USB_SUPPORT=y -CONFIG_XPS=y CONFIG_XXHASH=y CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y From 2dfd1453da8ebdb07f008095e1329d95c2d31922 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 16 Jan 2024 19:29:52 +0100 Subject: [PATCH 0713/1171] mediatek: fix ethernet rx hang issue on MT7981/MT7986 Add patches by Lorenzo/Daniel to use QDMA instead of ADMAv2 Signed-off-by: Felix Fietkau (cherry picked from commit ede34465de2176229590028fba622d54841ab40c) --- ...iatek-split-tx-and-rx-fields-in-mtk_.patch | 599 ++++++++++++++++++ ...iatek-use-QDMA-instead-of-ADMAv2-on-.patch | 123 ++++ 2 files changed, 722 insertions(+) create mode 100644 target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch create mode 100644 target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch diff --git a/target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch b/target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch new file mode 100644 index 00000000000000..7b78033ffb7791 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch @@ -0,0 +1,599 @@ +From: Lorenzo Bianconi +Date: Thu, 2 Nov 2023 16:47:07 +0100 +Subject: [PATCH net-next 1/2] net: ethernet: mediatek: split tx and rx fields + in mtk_soc_data struct + +Split tx and rx fields in mtk_soc_data struct. This is a preliminary +patch to roll back to QDMA for MT7986 SoC in order to fix a hw hang +if the device receives a corrupted packet. + +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 210 ++++++++++++-------- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 29 +-- + 2 files changed, 139 insertions(+), 100 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1238,7 +1238,7 @@ static int mtk_init_fq_dma(struct mtk_et + eth->scratch_ring = eth->sram_base; + else + eth->scratch_ring = dma_alloc_coherent(eth->dma_dev, +- cnt * soc->txrx.txd_size, ++ cnt * soc->tx.desc_size, + ð->phy_scratch_ring, + GFP_KERNEL); + if (unlikely(!eth->scratch_ring)) +@@ -1254,16 +1254,16 @@ static int mtk_init_fq_dma(struct mtk_et + if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) + return -ENOMEM; + +- phy_ring_tail = eth->phy_scratch_ring + soc->txrx.txd_size * (cnt - 1); ++ phy_ring_tail = eth->phy_scratch_ring + soc->tx.desc_size * (cnt - 1); + + for (i = 0; i < cnt; i++) { + struct mtk_tx_dma_v2 *txd; + +- txd = eth->scratch_ring + i * soc->txrx.txd_size; ++ txd = eth->scratch_ring + i * soc->tx.desc_size; + txd->txd1 = dma_addr + i * MTK_QDMA_PAGE_SIZE; + if (i < cnt - 1) + txd->txd2 = eth->phy_scratch_ring + +- (i + 1) * soc->txrx.txd_size; ++ (i + 1) * soc->tx.desc_size; + + txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); + txd->txd4 = 0; +@@ -1510,7 +1510,7 @@ static int mtk_tx_map(struct sk_buff *sk + if (itxd == ring->last_free) + return -ENOMEM; + +- itx_buf = mtk_desc_to_tx_buf(ring, itxd, soc->txrx.txd_size); ++ itx_buf = mtk_desc_to_tx_buf(ring, itxd, soc->tx.desc_size); + memset(itx_buf, 0, sizeof(*itx_buf)); + + txd_info.addr = dma_map_single(eth->dma_dev, skb->data, txd_info.size, +@@ -1551,7 +1551,7 @@ static int mtk_tx_map(struct sk_buff *sk + + memset(&txd_info, 0, sizeof(struct mtk_tx_dma_desc_info)); + txd_info.size = min_t(unsigned int, frag_size, +- soc->txrx.dma_max_len); ++ soc->tx.dma_max_len); + txd_info.qid = queue; + txd_info.last = i == skb_shinfo(skb)->nr_frags - 1 && + !(frag_size - txd_info.size); +@@ -1564,7 +1564,7 @@ static int mtk_tx_map(struct sk_buff *sk + mtk_tx_set_dma_desc(dev, txd, &txd_info); + + tx_buf = mtk_desc_to_tx_buf(ring, txd, +- soc->txrx.txd_size); ++ soc->tx.desc_size); + if (new_desc) + memset(tx_buf, 0, sizeof(*tx_buf)); + tx_buf->data = (void *)MTK_DMA_DUMMY_DESC; +@@ -1607,7 +1607,7 @@ static int mtk_tx_map(struct sk_buff *sk + } else { + int next_idx; + +- next_idx = NEXT_DESP_IDX(txd_to_idx(ring, txd, soc->txrx.txd_size), ++ next_idx = NEXT_DESP_IDX(txd_to_idx(ring, txd, soc->tx.desc_size), + ring->dma_size); + mtk_w32(eth, next_idx, MT7628_TX_CTX_IDX0); + } +@@ -1616,7 +1616,7 @@ static int mtk_tx_map(struct sk_buff *sk + + err_dma: + do { +- tx_buf = mtk_desc_to_tx_buf(ring, itxd, soc->txrx.txd_size); ++ tx_buf = mtk_desc_to_tx_buf(ring, itxd, soc->tx.desc_size); + + /* unmap dma */ + mtk_tx_unmap(eth, tx_buf, false); +@@ -1641,7 +1641,7 @@ static int mtk_cal_txd_req(struct mtk_et + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + frag = &skb_shinfo(skb)->frags[i]; + nfrags += DIV_ROUND_UP(skb_frag_size(frag), +- eth->soc->txrx.dma_max_len); ++ eth->soc->tx.dma_max_len); + } + } else { + nfrags += skb_shinfo(skb)->nr_frags; +@@ -1782,7 +1782,7 @@ static struct mtk_rx_ring *mtk_get_rx_ri + + ring = ð->rx_ring[i]; + idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size); +- rxd = ring->dma + idx * eth->soc->txrx.rxd_size; ++ rxd = ring->dma + idx * eth->soc->rx.desc_size; + if (rxd->rxd2 & RX_DMA_DONE) { + ring->calc_idx_update = true; + return ring; +@@ -1950,7 +1950,7 @@ static int mtk_xdp_submit_frame(struct m + } + htxd = txd; + +- tx_buf = mtk_desc_to_tx_buf(ring, txd, soc->txrx.txd_size); ++ tx_buf = mtk_desc_to_tx_buf(ring, txd, soc->tx.desc_size); + memset(tx_buf, 0, sizeof(*tx_buf)); + htx_buf = tx_buf; + +@@ -1970,7 +1970,7 @@ static int mtk_xdp_submit_frame(struct m + goto unmap; + + tx_buf = mtk_desc_to_tx_buf(ring, txd, +- soc->txrx.txd_size); ++ soc->tx.desc_size); + memset(tx_buf, 0, sizeof(*tx_buf)); + n_desc++; + } +@@ -2007,7 +2007,7 @@ static int mtk_xdp_submit_frame(struct m + } else { + int idx; + +- idx = txd_to_idx(ring, txd, soc->txrx.txd_size); ++ idx = txd_to_idx(ring, txd, soc->tx.desc_size); + mtk_w32(eth, NEXT_DESP_IDX(idx, ring->dma_size), + MT7628_TX_CTX_IDX0); + } +@@ -2019,7 +2019,7 @@ static int mtk_xdp_submit_frame(struct m + unmap: + while (htxd != txd) { + txd_pdma = qdma_to_pdma(ring, htxd); +- tx_buf = mtk_desc_to_tx_buf(ring, htxd, soc->txrx.txd_size); ++ tx_buf = mtk_desc_to_tx_buf(ring, htxd, soc->tx.desc_size); + mtk_tx_unmap(eth, tx_buf, false); + + htxd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; +@@ -2147,7 +2147,7 @@ static int mtk_poll_rx(struct napi_struc + goto rx_done; + + idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size); +- rxd = ring->dma + idx * eth->soc->txrx.rxd_size; ++ rxd = ring->dma + idx * eth->soc->rx.desc_size; + data = ring->data[idx]; + + if (!mtk_rx_get_desc(eth, &trxd, rxd)) +@@ -2282,7 +2282,7 @@ static int mtk_poll_rx(struct napi_struc + rxdcsum = &trxd.rxd4; + } + +- if (*rxdcsum & eth->soc->txrx.rx_dma_l4_valid) ++ if (*rxdcsum & eth->soc->rx.dma_l4_valid) + skb->ip_summed = CHECKSUM_UNNECESSARY; + else + skb_checksum_none_assert(skb); +@@ -2403,7 +2403,7 @@ static int mtk_poll_tx_qdma(struct mtk_e + break; + + tx_buf = mtk_desc_to_tx_buf(ring, desc, +- eth->soc->txrx.txd_size); ++ eth->soc->tx.desc_size); + if (!tx_buf->data) + break; + +@@ -2451,7 +2451,7 @@ static int mtk_poll_tx_pdma(struct mtk_e + } + mtk_tx_unmap(eth, tx_buf, true); + +- desc = ring->dma + cpu * eth->soc->txrx.txd_size; ++ desc = ring->dma + cpu * eth->soc->tx.desc_size; + ring->last_free = desc; + atomic_inc(&ring->free_count); + +@@ -2540,7 +2540,7 @@ static int mtk_napi_rx(struct napi_struc + do { + int rx_done; + +- mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, ++ mtk_w32(eth, eth->soc->rx.irq_done_mask, + reg_map->pdma.irq_status); + rx_done = mtk_poll_rx(napi, budget - rx_done_total, eth); + rx_done_total += rx_done; +@@ -2556,10 +2556,10 @@ static int mtk_napi_rx(struct napi_struc + return budget; + + } while (mtk_r32(eth, reg_map->pdma.irq_status) & +- eth->soc->txrx.rx_irq_done_mask); ++ eth->soc->rx.irq_done_mask); + + if (napi_complete_done(napi, rx_done_total)) +- mtk_rx_irq_enable(eth, eth->soc->txrx.rx_irq_done_mask); ++ mtk_rx_irq_enable(eth, eth->soc->rx.irq_done_mask); + + return rx_done_total; + } +@@ -2568,7 +2568,7 @@ static int mtk_tx_alloc(struct mtk_eth * + { + const struct mtk_soc_data *soc = eth->soc; + struct mtk_tx_ring *ring = ð->tx_ring; +- int i, sz = soc->txrx.txd_size; ++ int i, sz = soc->tx.desc_size; + struct mtk_tx_dma_v2 *txd; + int ring_size; + u32 ofs, val; +@@ -2691,14 +2691,14 @@ static void mtk_tx_clean(struct mtk_eth + } + if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && ring->dma) { + dma_free_coherent(eth->dma_dev, +- ring->dma_size * soc->txrx.txd_size, ++ ring->dma_size * soc->tx.desc_size, + ring->dma, ring->phys); + ring->dma = NULL; + } + + if (ring->dma_pdma) { + dma_free_coherent(eth->dma_dev, +- ring->dma_size * soc->txrx.txd_size, ++ ring->dma_size * soc->tx.desc_size, + ring->dma_pdma, ring->phys_pdma); + ring->dma_pdma = NULL; + } +@@ -2753,15 +2753,15 @@ static int mtk_rx_alloc(struct mtk_eth * + if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM) || + rx_flag != MTK_RX_FLAGS_NORMAL) { + ring->dma = dma_alloc_coherent(eth->dma_dev, +- rx_dma_size * eth->soc->txrx.rxd_size, +- &ring->phys, GFP_KERNEL); ++ rx_dma_size * eth->soc->rx.desc_size, ++ &ring->phys, GFP_KERNEL); + } else { + struct mtk_tx_ring *tx_ring = ð->tx_ring; + + ring->dma = tx_ring->dma + tx_ring_size * +- eth->soc->txrx.txd_size * (ring_no + 1); ++ eth->soc->tx.desc_size * (ring_no + 1); + ring->phys = tx_ring->phys + tx_ring_size * +- eth->soc->txrx.txd_size * (ring_no + 1); ++ eth->soc->tx.desc_size * (ring_no + 1); + } + + if (!ring->dma) +@@ -2772,7 +2772,7 @@ static int mtk_rx_alloc(struct mtk_eth * + dma_addr_t dma_addr; + void *data; + +- rxd = ring->dma + i * eth->soc->txrx.rxd_size; ++ rxd = ring->dma + i * eth->soc->rx.desc_size; + if (ring->page_pool) { + data = mtk_page_pool_get_buff(ring->page_pool, + &dma_addr, GFP_KERNEL); +@@ -2861,7 +2861,7 @@ static void mtk_rx_clean(struct mtk_eth + if (!ring->data[i]) + continue; + +- rxd = ring->dma + i * eth->soc->txrx.rxd_size; ++ rxd = ring->dma + i * eth->soc->rx.desc_size; + if (!rxd->rxd1) + continue; + +@@ -2878,7 +2878,7 @@ static void mtk_rx_clean(struct mtk_eth + + if (!in_sram && ring->dma) { + dma_free_coherent(eth->dma_dev, +- ring->dma_size * eth->soc->txrx.rxd_size, ++ ring->dma_size * eth->soc->rx.desc_size, + ring->dma, ring->phys); + ring->dma = NULL; + } +@@ -3241,7 +3241,7 @@ static void mtk_dma_free(struct mtk_eth + netdev_reset_queue(eth->netdev[i]); + if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && eth->scratch_ring) { + dma_free_coherent(eth->dma_dev, +- MTK_QDMA_RING_SIZE * soc->txrx.txd_size, ++ MTK_QDMA_RING_SIZE * soc->tx.desc_size, + eth->scratch_ring, eth->phy_scratch_ring); + eth->scratch_ring = NULL; + eth->phy_scratch_ring = 0; +@@ -3291,7 +3291,7 @@ static irqreturn_t mtk_handle_irq_rx(int + + eth->rx_events++; + if (likely(napi_schedule_prep(ð->rx_napi))) { +- mtk_rx_irq_disable(eth, eth->soc->txrx.rx_irq_done_mask); ++ mtk_rx_irq_disable(eth, eth->soc->rx.irq_done_mask); + __napi_schedule(ð->rx_napi); + } + +@@ -3317,9 +3317,9 @@ static irqreturn_t mtk_handle_irq(int ir + const struct mtk_reg_map *reg_map = eth->soc->reg_map; + + if (mtk_r32(eth, reg_map->pdma.irq_mask) & +- eth->soc->txrx.rx_irq_done_mask) { ++ eth->soc->rx.irq_done_mask) { + if (mtk_r32(eth, reg_map->pdma.irq_status) & +- eth->soc->txrx.rx_irq_done_mask) ++ eth->soc->rx.irq_done_mask) + mtk_handle_irq_rx(irq, _eth); + } + if (mtk_r32(eth, reg_map->tx_irq_mask) & MTK_TX_DONE_INT) { +@@ -3337,10 +3337,10 @@ static void mtk_poll_controller(struct n + struct mtk_eth *eth = mac->hw; + + mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); +- mtk_rx_irq_disable(eth, eth->soc->txrx.rx_irq_done_mask); ++ mtk_rx_irq_disable(eth, eth->soc->rx.irq_done_mask); + mtk_handle_irq_rx(eth->irq[2], dev); + mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); +- mtk_rx_irq_enable(eth, eth->soc->txrx.rx_irq_done_mask); ++ mtk_rx_irq_enable(eth, eth->soc->rx.irq_done_mask); + } + #endif + +@@ -3505,7 +3505,7 @@ static int mtk_open(struct net_device *d + napi_enable(ð->tx_napi); + napi_enable(ð->rx_napi); + mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); +- mtk_rx_irq_enable(eth, soc->txrx.rx_irq_done_mask); ++ mtk_rx_irq_enable(eth, soc->rx.irq_done_mask); + refcount_set(ð->dma_refcnt, 1); + } + else +@@ -3588,7 +3588,7 @@ static int mtk_stop(struct net_device *d + mtk_gdm_config(eth, MTK_GDMA_DROP_ALL); + + mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); +- mtk_rx_irq_disable(eth, eth->soc->txrx.rx_irq_done_mask); ++ mtk_rx_irq_disable(eth, eth->soc->rx.irq_done_mask); + napi_disable(ð->tx_napi); + napi_disable(ð->rx_napi); + +@@ -4064,9 +4064,9 @@ static int mtk_hw_init(struct mtk_eth *e + + /* FE int grouping */ + mtk_w32(eth, MTK_TX_DONE_INT, reg_map->pdma.int_grp); +- mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->pdma.int_grp + 4); ++ mtk_w32(eth, eth->soc->rx.irq_done_mask, reg_map->pdma.int_grp + 4); + mtk_w32(eth, MTK_TX_DONE_INT, reg_map->qdma.int_grp); +- mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); ++ mtk_w32(eth, eth->soc->rx.irq_done_mask, reg_map->qdma.int_grp + 4); + mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); + + if (mtk_is_netsys_v3_or_greater(eth)) { +@@ -5163,11 +5163,15 @@ static const struct mtk_soc_data mt2701_ + .required_clks = MT7623_CLKS_BITMAP, + .required_pctl = true, + .version = 1, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma), +- .rxd_size = sizeof(struct mtk_rx_dma), +- .rx_irq_done_mask = MTK_RX_DONE_INT, +- .rx_dma_l4_valid = RX_DMA_L4_VALID, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, ++ .dma_l4_valid = RX_DMA_L4_VALID, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5183,11 +5187,15 @@ static const struct mtk_soc_data mt7621_ + .offload_version = 1, + .hash_offset = 2, + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma), +- .rxd_size = sizeof(struct mtk_rx_dma), +- .rx_irq_done_mask = MTK_RX_DONE_INT, +- .rx_dma_l4_valid = RX_DMA_L4_VALID, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, ++ .dma_l4_valid = RX_DMA_L4_VALID, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5205,11 +5213,15 @@ static const struct mtk_soc_data mt7622_ + .hash_offset = 2, + .has_accounting = true, + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma), +- .rxd_size = sizeof(struct mtk_rx_dma), +- .rx_irq_done_mask = MTK_RX_DONE_INT, +- .rx_dma_l4_valid = RX_DMA_L4_VALID, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, ++ .dma_l4_valid = RX_DMA_L4_VALID, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5226,11 +5238,15 @@ static const struct mtk_soc_data mt7623_ + .hash_offset = 2, + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, + .disable_pll_modes = true, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma), +- .rxd_size = sizeof(struct mtk_rx_dma), +- .rx_irq_done_mask = MTK_RX_DONE_INT, +- .rx_dma_l4_valid = RX_DMA_L4_VALID, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, ++ .dma_l4_valid = RX_DMA_L4_VALID, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5245,11 +5261,15 @@ static const struct mtk_soc_data mt7629_ + .required_pctl = false, + .has_accounting = true, + .version = 1, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma), +- .rxd_size = sizeof(struct mtk_rx_dma), +- .rx_irq_done_mask = MTK_RX_DONE_INT, +- .rx_dma_l4_valid = RX_DMA_L4_VALID, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, ++ .dma_l4_valid = RX_DMA_L4_VALID, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5267,11 +5287,15 @@ static const struct mtk_soc_data mt7981_ + .hash_offset = 4, + .has_accounting = true, + .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma_v2), +- .rxd_size = sizeof(struct mtk_rx_dma_v2), +- .rx_irq_done_mask = MTK_RX_DONE_INT_V2, +- .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma_v2), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, ++ .dma_len_offset = 8, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma_v2), ++ .irq_done_mask = MTK_RX_DONE_INT_V2, ++ .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, + .dma_len_offset = 8, + }, +@@ -5289,11 +5313,15 @@ static const struct mtk_soc_data mt7986_ + .hash_offset = 4, + .has_accounting = true, + .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma_v2), +- .rxd_size = sizeof(struct mtk_rx_dma_v2), +- .rx_irq_done_mask = MTK_RX_DONE_INT_V2, +- .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma_v2), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, ++ .dma_len_offset = 8, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma_v2), ++ .irq_done_mask = MTK_RX_DONE_INT_V2, ++ .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, + .dma_len_offset = 8, + }, +@@ -5311,11 +5339,15 @@ static const struct mtk_soc_data mt7988_ + .hash_offset = 4, + .has_accounting = true, + .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma_v2), +- .rxd_size = sizeof(struct mtk_rx_dma_v2), +- .rx_irq_done_mask = MTK_RX_DONE_INT_V2, +- .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma_v2), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, ++ .dma_len_offset = 8, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma_v2), ++ .irq_done_mask = MTK_RX_DONE_INT_V2, ++ .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, + .dma_len_offset = 8, + }, +@@ -5328,11 +5360,15 @@ static const struct mtk_soc_data rt5350_ + .required_clks = MT7628_CLKS_BITMAP, + .required_pctl = false, + .version = 1, +- .txrx = { +- .txd_size = sizeof(struct mtk_tx_dma), +- .rxd_size = sizeof(struct mtk_rx_dma), +- .rx_irq_done_mask = MTK_RX_DONE_INT, +- .rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA, ++ .tx = { ++ .desc_size = sizeof(struct mtk_tx_dma), ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, ++ }, ++ .rx = { ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, ++ .dma_l4_valid = RX_DMA_L4_VALID_PDMA, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -326,8 +326,8 @@ + /* QDMA descriptor txd3 */ + #define TX_DMA_OWNER_CPU BIT(31) + #define TX_DMA_LS0 BIT(30) +-#define TX_DMA_PLEN0(x) (((x) & eth->soc->txrx.dma_max_len) << eth->soc->txrx.dma_len_offset) +-#define TX_DMA_PLEN1(x) ((x) & eth->soc->txrx.dma_max_len) ++#define TX_DMA_PLEN0(x) (((x) & eth->soc->tx.dma_max_len) << eth->soc->tx.dma_len_offset) ++#define TX_DMA_PLEN1(x) ((x) & eth->soc->tx.dma_max_len) + #define TX_DMA_SWC BIT(14) + #define TX_DMA_PQID GENMASK(3, 0) + #define TX_DMA_ADDR64_MASK GENMASK(3, 0) +@@ -347,8 +347,8 @@ + /* QDMA descriptor rxd2 */ + #define RX_DMA_DONE BIT(31) + #define RX_DMA_LSO BIT(30) +-#define RX_DMA_PREP_PLEN0(x) (((x) & eth->soc->txrx.dma_max_len) << eth->soc->txrx.dma_len_offset) +-#define RX_DMA_GET_PLEN0(x) (((x) >> eth->soc->txrx.dma_len_offset) & eth->soc->txrx.dma_max_len) ++#define RX_DMA_PREP_PLEN0(x) (((x) & eth->soc->rx.dma_max_len) << eth->soc->rx.dma_len_offset) ++#define RX_DMA_GET_PLEN0(x) (((x) >> eth->soc->rx.dma_len_offset) & eth->soc->rx.dma_max_len) + #define RX_DMA_VTAG BIT(15) + #define RX_DMA_ADDR64_MASK GENMASK(3, 0) + #if IS_ENABLED(CONFIG_64BIT) +@@ -1279,10 +1279,9 @@ struct mtk_reg_map { + * @foe_entry_size Foe table entry size. + * @has_accounting Bool indicating support for accounting of + * offloaded flows. +- * @txd_size Tx DMA descriptor size. +- * @rxd_size Rx DMA descriptor size. +- * @rx_irq_done_mask Rx irq done register mask. +- * @rx_dma_l4_valid Rx DMA valid register mask. ++ * @desc_size Tx/Rx DMA descriptor size. ++ * @irq_done_mask Rx irq done register mask. ++ * @dma_l4_valid Rx DMA valid register mask. + * @dma_max_len Max DMA tx/rx buffer length. + * @dma_len_offset Tx/Rx DMA length field offset. + */ +@@ -1300,13 +1299,17 @@ struct mtk_soc_data { + bool has_accounting; + bool disable_pll_modes; + struct { +- u32 txd_size; +- u32 rxd_size; +- u32 rx_irq_done_mask; +- u32 rx_dma_l4_valid; ++ u32 desc_size; + u32 dma_max_len; + u32 dma_len_offset; +- } txrx; ++ } tx; ++ struct { ++ u32 desc_size; ++ u32 irq_done_mask; ++ u32 dma_l4_valid; ++ u32 dma_max_len; ++ u32 dma_len_offset; ++ } rx; + }; + + #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) diff --git a/target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch b/target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch new file mode 100644 index 00000000000000..df8e988eb5a76c --- /dev/null +++ b/target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch @@ -0,0 +1,123 @@ +From: Daniel Golle +Date: Tue, 10 Oct 2023 21:06:43 +0200 +Subject: [PATCH net-next 2/2] net: ethernet: mediatek: use QDMA instead of + ADMAv2 on MT7981 and MT7986 + +ADMA is plagued by RX hangs which can't easily detected and happen upon +receival of a corrupted package. +Use QDMA just like on netsys v1 which is also still present and usable, and +doesn't suffer from that problem. + +Co-developed-by: Lorenzo Bianconi +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 46 ++++++++++----------- + 1 file changed, 23 insertions(+), 23 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -108,16 +108,16 @@ static const struct mtk_reg_map mt7986_r + .tx_irq_mask = 0x461c, + .tx_irq_status = 0x4618, + .pdma = { +- .rx_ptr = 0x6100, +- .rx_cnt_cfg = 0x6104, +- .pcrx_ptr = 0x6108, +- .glo_cfg = 0x6204, +- .rst_idx = 0x6208, +- .delay_irq = 0x620c, +- .irq_status = 0x6220, +- .irq_mask = 0x6228, +- .adma_rx_dbg0 = 0x6238, +- .int_grp = 0x6250, ++ .rx_ptr = 0x4100, ++ .rx_cnt_cfg = 0x4104, ++ .pcrx_ptr = 0x4108, ++ .glo_cfg = 0x4204, ++ .rst_idx = 0x4208, ++ .delay_irq = 0x420c, ++ .irq_status = 0x4220, ++ .irq_mask = 0x4228, ++ .adma_rx_dbg0 = 0x4238, ++ .int_grp = 0x4250, + }, + .qdma = { + .qtx_cfg = 0x4400, +@@ -1206,7 +1206,7 @@ static bool mtk_rx_get_desc(struct mtk_e + rxd->rxd1 = READ_ONCE(dma_rxd->rxd1); + rxd->rxd3 = READ_ONCE(dma_rxd->rxd3); + rxd->rxd4 = READ_ONCE(dma_rxd->rxd4); +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { + rxd->rxd5 = READ_ONCE(dma_rxd->rxd5); + rxd->rxd6 = READ_ONCE(dma_rxd->rxd6); + } +@@ -2154,7 +2154,7 @@ static int mtk_poll_rx(struct napi_struc + break; + + /* find out which mac the packet come from. values start at 1 */ +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { + u32 val = RX_DMA_GET_SPORT_V2(trxd.rxd5); + + switch (val) { +@@ -2266,7 +2266,7 @@ static int mtk_poll_rx(struct napi_struc + skb->dev = netdev; + bytes += skb->len; + +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { + reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5); + hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY; + if (hash != MTK_RXD5_FOE_ENTRY) +@@ -2807,7 +2807,7 @@ static int mtk_rx_alloc(struct mtk_eth * + + rxd->rxd3 = 0; + rxd->rxd4 = 0; +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { + rxd->rxd5 = 0; + rxd->rxd6 = 0; + rxd->rxd7 = 0; +@@ -4010,7 +4010,7 @@ static int mtk_hw_init(struct mtk_eth *e + else + mtk_hw_reset(eth); + +- if (mtk_is_netsys_v2_or_greater(eth)) { ++ if (mtk_is_netsys_v3_or_greater(eth)) { + /* Set FE to PDMAv2 if necessary */ + val = mtk_r32(eth, MTK_FE_GLO_MISC); + mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); +@@ -5293,11 +5293,11 @@ static const struct mtk_soc_data mt7981_ + .dma_len_offset = 8, + }, + .rx = { +- .desc_size = sizeof(struct mtk_rx_dma_v2), +- .irq_done_mask = MTK_RX_DONE_INT_V2, ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID_V2, +- .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, +- .dma_len_offset = 8, ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, + }, + }; + +@@ -5319,11 +5319,11 @@ static const struct mtk_soc_data mt7986_ + .dma_len_offset = 8, + }, + .rx = { +- .desc_size = sizeof(struct mtk_rx_dma_v2), +- .irq_done_mask = MTK_RX_DONE_INT_V2, ++ .desc_size = sizeof(struct mtk_rx_dma), ++ .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID_V2, +- .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, +- .dma_len_offset = 8, ++ .dma_max_len = MTK_TX_DMA_BUF_LEN, ++ .dma_len_offset = 16, + }, + }; + From c909fdad1870361d5a6f0c0a2437d062e988f559 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 18 Jan 2024 22:47:17 +0100 Subject: [PATCH 0714/1171] hostapd: ACS: Fix typo in bw_40 frequency array [Upstream Backport] The range for the 5 GHz channel 118 was encoded with an incorrect channel number. Fixes: ed8e13decc71 (ACS: Extract bw40/80/160 freqs out of acs_usable_bwXXX_chan()) Signed-off-by: Michael Lee Signed-off-by: David Bauer (cherry picked from commit 56d7887917102877ed2f03414f7ed812a29d6b39) --- ...CS-Fix-typo-in-bw_40-frequency-array.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 package/network/services/hostapd/patches/993-2023-10-28-ACS-Fix-typo-in-bw_40-frequency-array.patch diff --git a/package/network/services/hostapd/patches/993-2023-10-28-ACS-Fix-typo-in-bw_40-frequency-array.patch b/package/network/services/hostapd/patches/993-2023-10-28-ACS-Fix-typo-in-bw_40-frequency-array.patch new file mode 100644 index 00000000000000..948c51b196beb3 --- /dev/null +++ b/package/network/services/hostapd/patches/993-2023-10-28-ACS-Fix-typo-in-bw_40-frequency-array.patch @@ -0,0 +1,25 @@ +From 7a733993211ad46cf3032038c1e7e6bdc2322336 Mon Sep 17 00:00:00 2001 +From: Michael-CY Lee +Date: Tue, 5 Sep 2023 09:43:25 +0800 +Subject: [PATCH] ACS: Fix typo in bw_40 frequency array + +The range for the 5 GHz channel 118 was encoded with an incorrect +channel number. + +Fixes: ed8e13decc71 (ACS: Extract bw40/80/160 freqs out of acs_usable_bwXXX_chan()) +Signed-off-by: Michael Lee +--- + src/ap/acs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/ap/acs.c ++++ b/src/ap/acs.c +@@ -256,7 +256,7 @@ struct bw_item { + static const struct bw_item bw_40[] = { + { 5180, 5200, 38 }, { 5220, 5240, 46 }, { 5260, 5280, 54 }, + { 5300, 5320, 62 }, { 5500, 5520, 102 }, { 5540, 5560, 110 }, +- { 5580, 5600, 110 }, { 5620, 5640, 126}, { 5660, 5680, 134 }, ++ { 5580, 5600, 118 }, { 5620, 5640, 126 }, { 5660, 5680, 134 }, + { 5700, 5720, 142 }, { 5745, 5765, 151 }, { 5785, 5805, 159 }, + { 5825, 5845, 167 }, { 5865, 5885, 175 }, + { 5955, 5975, 3 }, { 5995, 6015, 11 }, { 6035, 6055, 19 }, From 7338733dc94e3e3b5f3a32d98e9719af20be6cc0 Mon Sep 17 00:00:00 2001 From: Xavier Franquet Date: Mon, 20 Nov 2023 08:18:00 +0100 Subject: [PATCH 0715/1171] mediatek: filogic: add support ASUS RT-AX59U (based on support for ASUS RT-AX59U by liushiyou006) SOC: MediaTek MT7986 RAM: 512MB DDR4 FLASH: 128MB SPI-NAND (Winbond W25N01GV) WIFI: Mediatek MT7986 DBDC 802.11ax 2.4/5 GHz ETH: MediaTek MT7531 Switch UART: 3V3 115200 8N1 (Pinout silkscreened / Do not connect VCC) Upgrade from AsusWRT to OpenWRT using UART Download the OpenWrt initramfs image. Copy the image to a TFTP server reachable at 192.168.1.70/24. Rename the image to rtax59u.bin. Connect the PC with TFTP server to the RT-AX59U. Set a static ip on the ethernet interface of your PC. (ip address: 192.168.1.70, subnet mask:255.255.255.0) Conect to the serial console, interrupt the autoboot process by pressing '4' when prompted. Download & Boot the OpenWrt initramfs image. $ setenv ipaddr 192.168.1.1 $ setenv serverip 192.168.1.70 $ tftpboot 0x46000000 rtax59u.bin $ bootm 0x46000000 Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n Upgrade from AsusWRT to OpenWRT using WebUI Download transit TRX file from https://drive.google.com/drive/folders/1A20QdjK7Udagu31FSszpWAk8-cGlCwsq Upgrade firmware from WebUI (192.168.50.1) using downloaded TRX file Wait for OpenWRT to boot (192.168.1.1). Upgrade system with sysupgrade image using luci or uploading it through scp and executing sysupgrade command MAC Address for WLAN 5g is not following the same algorithm as in AsusWRT. We have increased by one the WLAN 5g to avoid collisions with other networks from WLAN 2g when bit 28 is already set. : Stock : OpenWrt WLAN 2g (1) : C8:xx:xx:0D:xx:D4 : C8:xx:xx:0D:xx:D4 WLAN 2g (2) : : CA:xx:xx:0D:xx:D4 WLAN 2g (3) : : CE:xx:xx:0D:xx:D4 WLAN 5g (1) : CA:xx:xx:1D:xx:D4 : CA:xx:xx:1D:xx:D5 WLAN 5g (2) : : CE:xx:xx:1D:xx:D5 WLAN 5g (3) : : C2:xx:xx:1D:xx:D5 WLAN 2g (1) : 08:xx:xx:76:xx:BE : 08:xx:xx:76:xx:BE WLAN 2g (2) : : 0A:xx:xx:76:xx:BE WLAN 2g (3) : : 0E:xx:xx:76:xx:BE WLAN 5g (1) : 0A:xx:xx:76:xx:BE : 0A:xx:xx:76:xx:BF WLAN 5g (2) : : 0E:xx:xx:76:xx:BF WLAN 5g (3) : : 02:xx:xx:76:xx:BF Signed-off-by: Xavier Franquet (cherry picked from commit 782eb050082acac93c2f9b3eb22348234bc93e99) --- .../uboot-envtools/files/mediatek_filogic | 3 + .../mediatek/dts/mt7986a-asus-rt-ax59u.dts | 263 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 18 +- .../etc/hotplug.d/firmware/11-mt76-caldata | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 10 + .../base-files/lib/upgrade/platform.sh | 17 ++ target/linux/mediatek/image/filogic.mk | 10 + 7 files changed, 314 insertions(+), 8 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index b3113d683c9840..65872b60f56258 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -12,6 +12,9 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in +asus,rt-ax59u) + ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000" + ;; bananapi,bpi-r3) rootdev="$(cmdline_get_var root)" rootdev="${rootdev##*/}" diff --git a/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts b/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts new file mode 100644 index 00000000000000..15cd69aaaeb16c --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts @@ -0,0 +1,263 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + + model = "ASUS RT-AX59U"; + compatible = "asus,rt-ax59u", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_blue; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = "ubi.mtd=UBI_DEV"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + keys { + compatible = "gpio-keys"; + + button-0 { + label = "wps"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + button-1 { + label = "reset"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_status_red: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led_status_blue: led-2 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + out { + gpio-export,name = "led-light"; + gpio-export,output = <0>; + gpios = <&pio 22 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + /* LAN */ + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "wan"; + }; + + port@2 { + reg = <2>; + label = "lan1"; + }; + + port@3 { + reg = <3>; + label = "lan2"; + }; + + port@4 { + reg = <4>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand: spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <20000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x400000>; + read-only; + }; + + partition@400000 { + label = "UBI_DEV"; + reg = <0x400000 0x7c00000>; + }; + }; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&ssusb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 20a78b7b4b2e7a..2e978be6804bf7 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -14,6 +14,15 @@ mediatek_setup_interfaces() acer,predator-w6) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; + asus,rt-ax59u|\ + cetron,ct3003|\ + confiabits,mt7981|\ + cudy,wr3000-v1|\ + jcg,q30-pro|\ + qihoo,360t7|\ + routerich,ax3000) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan + ;; asus,tuf-ax4200|\ mediatek,mt7981-rfb|\ zbtlink,zbt-z8102ax) @@ -25,14 +34,6 @@ mediatek_setup_interfaces() bananapi,bpi-r3) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan" ;; - cetron,ct3003|\ - confiabits,mt7981|\ - cudy,wr3000-v1|\ - jcg,q30-pro|\ - qihoo,360t7|\ - routerich,ax3000) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan - ;; cmcc,rax3000m|\ h3c,magic-nx30-pro) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 @@ -86,6 +87,7 @@ mediatek_setup_macs() local label_mac="" case $board in + asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax6000) CI_UBIPART="UBI_DEV" diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index 63c1ec31b7a09e..8eda14f82b51d0 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -45,6 +45,7 @@ case "$FIRMWARE" in ;; "mediatek/mt7986_eeprom_mt7976_dbdc.bin") case "$board" in + asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax6000) CI_UBIPART="UBI_DEV" diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 6111854e043438..f8ebc1da42fb13 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -16,6 +16,16 @@ case "$board" in [ "$PHYNBR" = "1" ] && cat $key_path/6gMAC > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "2" ] && cat $key_path/5gMAC > /sys${DEVPATH}/macaddress ;; + asus,rt-ax59u) + CI_UBIPART="UBI_DEV" + addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) + # Originally, phy1 is phy0 mac with LA and 28th bits set. However, this would conflict + # addresses on multiple VIFs with the other radio when bit 28 is already set. + # Set LA and 28 bits and increment mac-address instead. + [ "$PHYNBR" = "1" ] && \ + macaddr_setbit_la $(macaddr_setbit $(macaddr_add $addr 1) 28) > \ + /sys${DEVPATH}/macaddress + ;; asus,tuf-ax4200|\ asus,tuf-ax6000) CI_UBIPART="UBI_DEV" diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index e2683c8d554c70..e3b042c876d504 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -1,5 +1,16 @@ REQUIRE_IMAGE_METADATA=1 +asus_initial_setup() +{ + # initialize UBI if it's running on initramfs + [ "$(rootfs_type)" = "tmpfs" ] || return 0 + + ubirmvol /dev/ubi0 -N rootfs + ubirmvol /dev/ubi0 -N rootfs_data + ubirmvol /dev/ubi0 -N jffs2 + ubimkvol /dev/ubi0 -N jffs2 -s 0x3e000 +} + xiaomi_initial_setup() { # initialize UBI and setup uboot-env if it's running on initramfs @@ -56,6 +67,7 @@ platform_do_upgrade() { CI_ROOTPART="rootfs" emmc_do_upgrade "$1" ;; + asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax6000) CI_UBIPART="UBI_DEV" @@ -183,6 +195,11 @@ platform_pre_upgrade() { local board=$(board_name) case "$board" in + asus,rt-ax59u|\ + asus,tuf-ax4200|\ + asus,tuf-ax6000) + asus_initial_setup + ;; xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) xiaomi_initial_setup diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index add838c4bca839..194319a228aa58 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -137,6 +137,16 @@ define Device/acer_predator-w6 endef TARGET_DEVICES += acer_predator-w6 +define Device/asus_rt-ax59u + DEVICE_VENDOR := ASUS + DEVICE_MODEL := RT-AX59U + DEVICE_DTS := mt7986a-asus-rt-ax59u + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += asus_rt-ax59u + define Device/asus_tuf-ax4200 DEVICE_VENDOR := ASUS DEVICE_MODEL := TUF-AX4200 From c1615f314822ac698ab56778bd1d3ca4363a9c05 Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 15 Jan 2024 15:25:53 -0500 Subject: [PATCH 0716/1171] kernel: bump 5.15 to 5.15.147 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.147 Manually rebased: generic/backport-5.15/005-v5.17-01-Kbuild-use-Wdeclaration-after-statement.patch All other patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 389135501565a6544775e0c75828a11e536e64a2) [Refresh on top of OpenWrt 23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 ++-- ...0070-MMC-added-alternative-MMC-driver.patch | 6 +++--- ...-Better-coalescing-parameter-defaults.patch | 4 ++-- ...et-Workaround-2-for-Pi4-Ethernet-fail.patch | 2 +- ...net-bcmgenet-Reset-RBUF-on-first-open.patch | 8 ++++---- ...-do-single-sector-reads-during-recove.patch | 2 +- ...-net-usb-ax88179_178a-add-TSO-feature.patch | 10 +++++----- .../hack-5.15/901-debloat_sock_diag.patch | 2 +- .../generic/hack-5.15/902-debloat_proc.patch | 2 +- ...ing-with-source-address-failed-policy.patch | 18 +++++++++--------- ...bles-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index f8ecac57422bfe..5cc07434b2a6cd 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .146 -LINUX_KERNEL_HASH-5.15.146 = 5a807a5fa2a80ada957d8079681dfb5cc196ec26f43244d1c8a4fd7af592d192 +LINUX_VERSION-5.15 = .147 +LINUX_KERNEL_HASH-5.15.147 = 56c1e65625d201db431efda7a3816e7b424071e7cb0245b2ba594d15b1fdfcd4 diff --git a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch index 2f8829398588e1..848ac83e3a0618 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch @@ -244,7 +244,7 @@ bcm2835-mmc: uninitialized_var is no more static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, -@@ -2944,6 +2951,8 @@ static int mmc_blk_probe(struct mmc_card +@@ -2946,6 +2953,8 @@ static int mmc_blk_probe(struct mmc_card { struct mmc_blk_data *md; int ret = 0; @@ -253,7 +253,7 @@ bcm2835-mmc: uninitialized_var is no more /* * Check that the card supports the command class(es) we need. -@@ -2951,7 +2960,16 @@ static int mmc_blk_probe(struct mmc_card +@@ -2953,7 +2962,16 @@ static int mmc_blk_probe(struct mmc_card if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; @@ -271,7 +271,7 @@ bcm2835-mmc: uninitialized_var is no more card->complete_wq = alloc_workqueue("mmc_complete", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); -@@ -2966,6 +2984,17 @@ static int mmc_blk_probe(struct mmc_card +@@ -2968,6 +2986,17 @@ static int mmc_blk_probe(struct mmc_card goto out_free; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch b/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch index 69e99c5f99b84a..ebffb634cd5625 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -@@ -2616,7 +2616,7 @@ static void bcmgenet_init_tx_ring(struct +@@ -2618,7 +2618,7 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_PROD_INDEX); bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_CONS_INDEX); @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /* Disable rate control for now */ bcmgenet_tdma_ring_writel(priv, index, flow_period_val, TDMA_FLOW_PERIOD); -@@ -4084,9 +4084,12 @@ static int bcmgenet_probe(struct platfor +@@ -4086,9 +4086,12 @@ static int bcmgenet_probe(struct platfor netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); /* Set default coalescing parameters */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch b/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch index b18208276378e5..318681ff9101a0 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch @@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell static inline void bcmgenet_writel(u32 value, void __iomem *offset) { -@@ -2447,6 +2450,11 @@ static void reset_umac(struct bcmgenet_p +@@ -2449,6 +2452,11 @@ static void reset_umac(struct bcmgenet_p bcmgenet_rbuf_ctrl_set(priv, 0); udelay(10); diff --git a/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch b/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch index 254376ee052a69..21cd9dfc039849 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0292-net-bcmgenet-Reset-RBUF-on-first-open.patch @@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -@@ -3265,7 +3265,7 @@ static void bcmgenet_get_hw_addr(struct +@@ -3267,7 +3267,7 @@ static void bcmgenet_get_hw_addr(struct } /* Returns a reusable dma control register value */ @@ -33,7 +33,7 @@ Signed-off-by: Phil Elwell { unsigned int i; u32 reg; -@@ -3290,6 +3290,14 @@ static u32 bcmgenet_dma_disable(struct b +@@ -3292,6 +3292,14 @@ static u32 bcmgenet_dma_disable(struct b udelay(10); bcmgenet_umac_writel(priv, 0, UMAC_TX_FLUSH); @@ -48,7 +48,7 @@ Signed-off-by: Phil Elwell return dma_ctrl; } -@@ -3353,8 +3361,8 @@ static int bcmgenet_open(struct net_devi +@@ -3355,8 +3363,8 @@ static int bcmgenet_open(struct net_devi bcmgenet_set_hw_addr(priv, dev->dev_addr); @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell /* Reinitialize TDMA and RDMA and SW housekeeping */ ret = bcmgenet_init_dma(priv); -@@ -4213,7 +4221,7 @@ static int bcmgenet_resume(struct device +@@ -4215,7 +4223,7 @@ static int bcmgenet_resume(struct device bcmgenet_hfb_create_rxnfc_filter(priv, rule); /* Disable RX/TX DMA and flush TX queues */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch b/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch index 2741660ee2ae9b..604acfacc0f3d6 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch @@ -23,7 +23,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c -@@ -1888,7 +1888,11 @@ static void mmc_blk_mq_rw_recovery(struc +@@ -1890,7 +1890,11 @@ static void mmc_blk_mq_rw_recovery(struc return; } diff --git a/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch b/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch index 598fa05e9bf00c..698e524c3565ef 100644 --- a/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch +++ b/target/linux/generic/backport-5.15/797-v5.17-net-usb-ax88179_178a-add-TSO-feature.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c -@@ -1363,11 +1363,12 @@ static int ax88179_bind(struct usbnet *d +@@ -1333,11 +1333,12 @@ static int ax88179_bind(struct usbnet *d dev->mii.phy_id = 0x03; dev->mii.supports_gmii = 1; @@ -33,9 +33,9 @@ Signed-off-by: David S. Miller + + netif_set_gso_max_size(dev->net, 16384); - /* Enable checksum offload */ - *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | -@@ -1573,17 +1574,19 @@ ax88179_tx_fixup(struct usbnet *dev, str + ax88179_reset(dev); + +@@ -1507,17 +1508,19 @@ ax88179_tx_fixup(struct usbnet *dev, str { u32 tx_hdr1, tx_hdr2; int frame_size = dev->maxpacket; @@ -57,7 +57,7 @@ Signed-off-by: David S. Miller if ((skb_header_cloned(skb) || headroom < 0) && pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) { dev_kfree_skb_any(skb); -@@ -1594,6 +1597,8 @@ ax88179_tx_fixup(struct usbnet *dev, str +@@ -1528,6 +1531,8 @@ ax88179_tx_fixup(struct usbnet *dev, str put_unaligned_le32(tx_hdr1, ptr); put_unaligned_le32(tx_hdr2, ptr + 4); diff --git a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch index 11f4f556e86391..ab4d636956e3db 100644 --- a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch @@ -77,7 +77,7 @@ Signed-off-by: Felix Fietkau INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *, u32)); INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *, -@@ -1987,9 +2001,11 @@ static void __sk_free(struct sock *sk) +@@ -1994,9 +2008,11 @@ static void __sk_free(struct sock *sk) if (likely(sk->sk_net_refcnt)) sock_inuse_add(sock_net(sk), -1); diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index 768d3e1f0cfb76..dcdad4ca695df4 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3881,6 +3881,8 @@ static __net_initdata struct pernet_oper +@@ -3889,6 +3889,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { diff --git a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 7aaac9653187b9..071a2ed3e5e013 100644 --- a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -157,7 +157,7 @@ Signed-off-by: Jonas Gorski case RTN_THROW: case RTN_UNREACHABLE: default: -@@ -4560,6 +4579,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -4557,6 +4576,17 @@ static int ip6_pkt_prohibit_out(struct n return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); } @@ -175,7 +175,7 @@ Signed-off-by: Jonas Gorski /* * Allocate a dst for local (unicast / anycast) address. */ -@@ -5047,7 +5077,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -5044,7 +5074,8 @@ static int rtm_to_fib6_config(struct sk_ if (rtm->rtm_type == RTN_UNREACHABLE || rtm->rtm_type == RTN_BLACKHOLE || rtm->rtm_type == RTN_PROHIBIT || @@ -185,7 +185,7 @@ Signed-off-by: Jonas Gorski cfg->fc_flags |= RTF_REJECT; if (rtm->rtm_type == RTN_LOCAL) -@@ -6301,6 +6332,8 @@ static int ip6_route_dev_notify(struct n +@@ -6298,6 +6329,8 @@ static int ip6_route_dev_notify(struct n #ifdef CONFIG_IPV6_MULTIPLE_TABLES net->ipv6.ip6_prohibit_entry->dst.dev = dev; net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); @@ -194,7 +194,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_blk_hole_entry->dst.dev = dev; net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); #endif -@@ -6312,6 +6345,7 @@ static int ip6_route_dev_notify(struct n +@@ -6309,6 +6342,7 @@ static int ip6_route_dev_notify(struct n in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev); #ifdef CONFIG_IPV6_MULTIPLE_TABLES in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev); @@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev); #endif } -@@ -6503,6 +6537,8 @@ static int __net_init ip6_route_net_init +@@ -6500,6 +6534,8 @@ static int __net_init ip6_route_net_init #ifdef CONFIG_IPV6_MULTIPLE_TABLES net->ipv6.fib6_has_custom_rules = false; @@ -211,7 +211,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, sizeof(*net->ipv6.ip6_prohibit_entry), GFP_KERNEL); -@@ -6513,11 +6549,21 @@ static int __net_init ip6_route_net_init +@@ -6510,11 +6546,21 @@ static int __net_init ip6_route_net_init ip6_template_metrics, true); INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->rt6i_uncached); @@ -234,7 +234,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, ip6_template_metrics, true); -@@ -6544,6 +6590,8 @@ out: +@@ -6541,6 +6587,8 @@ out: return ret; #ifdef CONFIG_IPV6_MULTIPLE_TABLES @@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski out_ip6_prohibit_entry: kfree(net->ipv6.ip6_prohibit_entry); out_ip6_null_entry: -@@ -6563,6 +6611,7 @@ static void __net_exit ip6_route_net_exi +@@ -6560,6 +6608,7 @@ static void __net_exit ip6_route_net_exi kfree(net->ipv6.ip6_null_entry); #ifdef CONFIG_IPV6_MULTIPLE_TABLES kfree(net->ipv6.ip6_prohibit_entry); @@ -251,7 +251,7 @@ Signed-off-by: Jonas Gorski kfree(net->ipv6.ip6_blk_hole_entry); #endif dst_entries_destroy(&net->ipv6.ip6_dst_ops); -@@ -6646,6 +6695,9 @@ void __init ip6_route_init_special_entri +@@ -6643,6 +6692,9 @@ void __init ip6_route_init_special_entri init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); diff --git a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index 723af247703fd4..d2ca7c7b537008 100644 --- a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -7709,7 +7709,7 @@ static int nft_register_flowtable_net_ho +@@ -7736,7 +7736,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); From 78beef6aee72f7f3e862b3057d9ea2734f1d0fe9 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 23 Jan 2024 09:07:16 +0100 Subject: [PATCH 0717/1171] jsonfilter: update to Git HEAD (2024-01-23) 013b75ab0598 jsonfilter: drop legacy json-c support 594cfa86469c main: fix spurious premature parse aborts in array mode Fixes: https://bugs.openwrt.org/?task_id=3683 Fixes: https://github.com/openwrt/openwrt/issues/8703 Fixes: https://github.com/openwrt/openwrt/issues/11649 Fixes: https://github.com/openwrt/openwrt/issues/12344 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 33f15dd6d41873b02eb8895b8886763659f1390c) --- package/utils/jsonfilter/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/jsonfilter/Makefile b/package/utils/jsonfilter/Makefile index 56f96d52b55f72..fda66bbfb4b958 100644 --- a/package/utils/jsonfilter/Makefile +++ b/package/utils/jsonfilter/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/jsonpath.git -PKG_SOURCE_DATE:=2018-02-04 -PKG_SOURCE_VERSION:=c7e938d6582a436dddc938539e72dd1320625c54 -PKG_MIRROR_HASH:=0601b4d7aa5ee096e99388a57cb0701673ab58fccd6ed2984a2abbd4f846e045 +PKG_SOURCE_DATE:=2024-01-23 +PKG_SOURCE_VERSION:=594cfa86469c005972ba750614f5b3f1af84d0f6 +PKG_MIRROR_HASH:=70d2e0870b746920af4569631218c38c1dddfee4f5d029ec8ea0a67999bdafcd CMAKE_INSTALL:=1 PKG_MAINTAINER:=Jo-Philipp Wich From 72421d973e3e49a140d302cd42a2ecbdca59d6b0 Mon Sep 17 00:00:00 2001 From: Michel Thill Date: Tue, 23 Jan 2024 20:16:48 +0100 Subject: [PATCH 0718/1171] realtek: d-link dgs-1210-10p improve sfp support The current dts file of dgs-1210-10p doesn't support link states for the sfp ports (they are always up). This patch tries to give better support for this and was run tested on dgs-1210-10p. It was already commited to the main branch. Signed-off-by: Michel Thill (cherry picked from commit 135e10762077d96a976c0b00311ce95e77082a5d) --- .../dts-5.15/rtl8382_d-link_dgs-1210-10p.dts | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/dts-5.15/rtl8382_d-link_dgs-1210-10p.dts b/target/linux/realtek/dts-5.15/rtl8382_d-link_dgs-1210-10p.dts index 16934ede3b88a3..1aef88afd4e165 100644 --- a/target/linux/realtek/dts-5.15/rtl8382_d-link_dgs-1210-10p.dts +++ b/target/linux/realtek/dts-5.15/rtl8382_d-link_dgs-1210-10p.dts @@ -7,6 +7,42 @@ compatible = "d-link,dgs-1210-10p", "realtek,rtl838x-soc"; model = "D-Link DGS-1210-10P"; + /* i2c of the left SFP cage: port 9 */ + i2c0: i2c-gpio-0 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp0: sfp-p9 { + compatible = "sff,sfp"; + i2c-bus = <&i2c0>; + los-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + + /* i2c of the right SFP cage: port 10 */ + i2c1: i2c-gpio-1 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp1: sfp-p10 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>; + }; + keys { compatible = "gpio-keys-polled"; poll-interval = <20>; @@ -86,8 +122,24 @@ SWITCH_PORT(13, 6, internal) SWITCH_PORT(14, 7, internal) SWITCH_PORT(15, 8, internal) - SWITCH_SFP_PORT(24, 9, rgmii-id) - SWITCH_SFP_PORT(26, 10, rgmii-id) + + port@24 { + reg = <24>; + label = "lan9"; + phy-handle = <&phy24>; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp0>; + }; + + port@26 { + reg = <26>; + label = "lan10"; + phy-handle = <&phy26>; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp1>; + }; port@28 { ethernet = <ðernet0>; From c55aaa7c9a98e7c0a5e1ea8293a534dc5b395cf3 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 17 Dec 2023 18:25:55 +0100 Subject: [PATCH 0719/1171] ath79: generic: disable SPI-NOR write protect unconditionally Kernel 5.15 introduced a significant change to spi-nor subsystem [1], which would the SPI-NOR core to no longer unprotect the Flash chips if their protection bits are non-volatile, which is the case for MX25L6405D and MX25L12805D, used in Ubiquiti XW and WA lines of devices [2]. However, their bootloader forcibly enables this protection before continuing to boot, making the kernel not unprotect the flash upon boot, causing JFFS2 to be unable write to the filesystem. Because sysupgrade seems to unlock the flash explicitly, the upgrade will work, but the system will be unable to save configrationm showing the following symptom in the kernel log: [ 86.168016] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0 [ 86.192344] jffs2_build_filesystem(): unlocking the mtd device... [ 86.192443] done. [ 86.200669] jffs2_build_filesystem(): erasing all blocks after the end marker... [ 86.220646] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001e0000 [ 86.292388] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001d0000 [ 86.324867] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001c0000 [ 86.355316] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001b0000 [ 86.402855] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001a0000 Disable the write protection unconditionally for ath79/generic subtarget, so the XW and WA devices can function again. However, this is only a stopgap solution - it probably should be investigated if there is a way to selectively unlock the area used by rootfs_data - but given the lock granularity, this seems unlikely. With this patch in place, rootfs_data partition on my Nanostation Loco M5 XW is writable again. Fixes: #12882 Fixes: #13750 Fixes: 579703f38c14 ("ath79: switch to 5.15 as default kernel") Link: http://www.infradead.org/pipermail/linux-mtd/2020-October/082805.html Link: https://forum.openwrt.org/t/powerbeam-m5-xw-configuration-loss-after-reboot/141925 Signed-off-by: Lech Perczak (cherry picked from commit f024f4b1b0380b3b2e18115bd8e4f35393fccc70) Signed-off-by: Lech Perczak --- target/linux/ath79/generic/config-default | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default index 06f264b626a72b..09ea9d93d7a567 100644 --- a/target/linux/ath79/generic/config-default +++ b/target/linux/ath79/generic/config-default @@ -14,6 +14,8 @@ CONFIG_LEDS_RESET=y CONFIG_MARVELL_PHY=y CONFIG_MICREL_PHY=y CONFIG_MTD_REDBOOT_PARTS=y +CONFIG_MTD_SPI_NOR_SWP_DISABLE=y +# CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE is not set CONFIG_MTD_SPLIT_EVA_FW=y CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_U_BOOT_ENV=y From ac97ea1079fb35a387d8c47fc05fb0f83f4594fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 17 Jan 2024 10:39:37 +0100 Subject: [PATCH 0720/1171] bcm27xx: config: update documentation links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The documentation links have changed and are no longer valid. (cherry picked from commit 189838517e88dc5b519433949c945959d17b89f7) Signed-off-by: Álvaro Fernández Rojas --- target/linux/bcm27xx/image/config.txt | 2 +- target/linux/bcm27xx/image/distroconfig.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/bcm27xx/image/config.txt b/target/linux/bcm27xx/image/config.txt index f8ca1bf2d49278..db35d72ab7985e 100644 --- a/target/linux/bcm27xx/image/config.txt +++ b/target/linux/bcm27xx/image/config.txt @@ -4,7 +4,7 @@ ################################################################################ # For overclocking and various other settings, see: -# https://www.raspberrypi.org/documentation/configuration/config-txt/README.md +# https://www.raspberrypi.com/documentation/computers/config_txt.html ################################################################################ # OpenWrt config diff --git a/target/linux/bcm27xx/image/distroconfig.txt b/target/linux/bcm27xx/image/distroconfig.txt index 103c5d2e828470..b09e5b8466f50d 100644 --- a/target/linux/bcm27xx/image/distroconfig.txt +++ b/target/linux/bcm27xx/image/distroconfig.txt @@ -5,7 +5,7 @@ # Restore PL011 (ttyAMA0) to GPIOs 14 & 15, instead of Mini UART (ttyS0). # Mini UART is disabled by default unless "enable_uart=1" is specified, # which changes the core frequency to a fixed value and impacts performance. -# See https://www.raspberrypi.org/documentation/configuration/uart.md +# See https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency [pi0w] dtoverlay=disable-bt [pi3] From 5a4389f6abd15e9f8e966231a9850abb3c1c4c34 Mon Sep 17 00:00:00 2001 From: Yangyu Chen Date: Tue, 19 Dec 2023 03:21:53 +0800 Subject: [PATCH 0721/1171] bcm27xx: 5.15: turn on cpu erratum for A72 and disable A53 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original configuration might be copied from bcm2710 which uses cortex A53 rather than A72 in BCM2711, without errata might be harmful to system stability and security. Signed-off-by: Yangyu Chen (cherry picked from commit d549809c05997116823c1a1486d79cb8bda689b9) Signed-off-by: Álvaro Fernández Rojas --- target/linux/bcm27xx/bcm2711/config-5.15 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/target/linux/bcm27xx/bcm2711/config-5.15 b/target/linux/bcm27xx/bcm2711/config-5.15 index e18728e49d6622..42e749a883e509 100644 --- a/target/linux/bcm27xx/bcm2711/config-5.15 +++ b/target/linux/bcm27xx/bcm2711/config-5.15 @@ -19,14 +19,8 @@ CONFIG_ARM64_4K_PAGES=y CONFIG_ARM64_CNP=y CONFIG_ARM64_CRYPTO=y CONFIG_ARM64_EPAN=y -CONFIG_ARM64_ERRATUM_819472=y -CONFIG_ARM64_ERRATUM_824069=y -CONFIG_ARM64_ERRATUM_826319=y -CONFIG_ARM64_ERRATUM_827319=y -CONFIG_ARM64_ERRATUM_832075=y -CONFIG_ARM64_ERRATUM_843419=y +CONFIG_ARM64_ERRATUM_1319367=y CONFIG_ARM64_HW_AFDBM=y -CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y CONFIG_ARM64_PA_BITS=48 From e05659ef59efa14091bd5e59efedec0ad565a484 Mon Sep 17 00:00:00 2001 From: Marty Jones Date: Sun, 24 Dec 2023 19:03:31 -0500 Subject: [PATCH 0722/1171] bcm27xx-userland: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the last update for bcm27xx-userland as it has been deprecated but funcional up to raspberry pi 5. 96a7334 README: Update to make it clear that most code in this repo is deprecated 3c97f76 userland: dtoverlay: /boot/firmware is a valid path 153a235 Assorted clang static analysis fixes eca070c bcm_host: Update kms/fkms check for pi5 06a7618 dtoverlay: Support bcm2712 as a platform 0489c07 dtoverlay: Add dtoverlay_first/next_subnode a1c7f81 dtoverlay: Support literal assignments of path strings 44a3953 raspivid: Also flush PTS file if flush is enabled cc1ca18 userland: dtoverlay: Use os_prefix if set 9d5250f libfdt: Add null-ptr check for prop-data to resolve clang --analyzer warning 50527c6 mmal: Only include Videocore components if not running on Videocore df245ea tvservice: Update unsupported message to recommend kmsprint de0cfe8 dtoverlay: Fix clang warnings 0182f05 dtoverlay: Fix various compiler warnings 2a6306b dtoverlay: Fix path rebasing and exports d1e92d7 dtoverlay: Add support for string escape sequences b1ee39e gencmd: Add a fallback to mailbox interface if vchiq is not available 54fd97a hello_pi: Fix some build issues Signed-off-by: Marty Jones (cherry picked from commit 3df664101a18cf835c97ce5f0fbcc6357a16c101) Signed-off-by: Álvaro Fernández Rojas --- package/utils/bcm27xx-userland/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/utils/bcm27xx-userland/Makefile b/package/utils/bcm27xx-userland/Makefile index 9d7f6dd822f898..402c3dcd640a14 100644 --- a/package/utils/bcm27xx-userland/Makefile +++ b/package/utils/bcm27xx-userland/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bcm27xx-userland -PKG_VERSION:=c4fd1b8986c6d6d4ae5cd51e65a8bbeb495dfa4e +PKG_VERSION:=96a7334ae9d5fc9db7ac92e59852377df63f1848 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/userland/tar.gz/$(PKG_VERSION)? -PKG_HASH:=ab8a5b27c34cf1b97de87b895448a6355229f73b679866b47c51a723273cc8ae +PKG_HASH:=557ee8390de5db1ed90386c1ba0221e7f6f9dd87e858a00a34be3b1f9ede193f PKG_FLAGS:=nonshared From 1da896f706dbb240f99b8679a7401ccf81204dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 16 Jan 2024 11:58:01 +0100 Subject: [PATCH 0723/1171] bcm27xx-gpu-fw: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit raspberrypi/firmware is about 40G, so getting the full history log isn't an option. There have been multiple improvements and also support for the RPi 5 has been added. (cherry picked from commit e8f55817015112608155a6463ca2d8f5b4ca37b2) Signed-off-by: Álvaro Fernández Rojas --- package/kernel/bcm27xx-gpu-fw/Makefile | 30 +++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile b/package/kernel/bcm27xx-gpu-fw/Makefile index b3323c8b28fee6..048dd0d3a9d942 100644 --- a/package/kernel/bcm27xx-gpu-fw/Makefile +++ b/package/kernel/bcm27xx-gpu-fw/Makefile @@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=bcm27xx-gpu-fw -PKG_VERSION:=2022-05-16 -PKG_RELEASE:=3673be308132de102fdff491d1333d9d0f823557 +PKG_VERSION:=2024-01-11 +PKG_RELEASE:=0968de28716a9b1f106b8492646d0ed0a2800152 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE) @@ -26,7 +26,7 @@ define Download/bootcode_bin FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin URL:=$(RPI_FIRMWARE_URL) URL_FILE:=bootcode.bin - HASH:=69309823da13dc96b89e3d82b44f820e4f84efa79d207adad2c8784559794f03 + HASH:=af603ebd97e7b692c30195563f7b25656eb05d57838cf1a715ebb470d1614ce4 endef $(eval $(call Download,bootcode_bin)) @@ -34,7 +34,7 @@ define Download/fixup_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup.dat - HASH:=921f56c62ad1995addb984b156c869202dc5d46bbe9ebcbd02c20f0def9058e3 + HASH:=c28ea955e672e374016dca61d63afa026490f0473a98115908586ab48e324aeb endef $(eval $(call Download,fixup_dat)) @@ -42,7 +42,7 @@ define Download/fixup_cd_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup_cd.dat - HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c + HASH:=3cf1aef5f596ca106203ed5dac9ad45e85929ec55ce44c813588645e174442ec endef $(eval $(call Download,fixup_cd_dat)) @@ -50,7 +50,7 @@ define Download/fixup_x_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup_x.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup_x.dat - HASH:=8b00b00678adafe01e087240d156dbc87822e745b269be4f282596b69265cd1e + HASH:=56525c8feabde1ab86f36bb09bc55171659b2993f94132cf81ffc4293d62269d endef $(eval $(call Download,fixup_x_dat)) @@ -58,7 +58,7 @@ define Download/fixup4_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup4.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup4.dat - HASH:=ef2b5d2a0a95ca48e00a1ce78b7650ee9e947cc1c588704c8ae30c1623122e2f + HASH:=615f8595801bf52373039f73ad5ad9513f83400d355eb1b2c075c7ae907e927c endef $(eval $(call Download,fixup4_dat)) @@ -66,7 +66,7 @@ define Download/fixup4cd_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup4cd.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup4cd.dat - HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c + HASH:=3cf1aef5f596ca106203ed5dac9ad45e85929ec55ce44c813588645e174442ec endef $(eval $(call Download,fixup4cd_dat)) @@ -74,7 +74,7 @@ define Download/fixup4x_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup4x.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup4x.dat - HASH:=a6c4e30ada5a00fe7de83c460638ca824647651bb4a3644b8c65d7ba1d9f2d2b + HASH:=6d27a4b8ecb78cef9e1f03751b4aaec5ce8749d36988f381145a8a41dbf164ae endef $(eval $(call Download,fixup4x_dat)) @@ -82,7 +82,7 @@ define Download/start_elf FILE:=$(RPI_FIRMWARE_FILE)-start.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start.elf - HASH:=5455c148f4b8b04c553809bd22b995ee49ba5279ca3848df8bde6f80a388f7e0 + HASH:=e8348e88522e7a1d0e2b0944ab66d7d8f4f30da98f326e2b3c123522e45f71b2 endef $(eval $(call Download,start_elf)) @@ -90,7 +90,7 @@ define Download/start_cd_elf FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start_cd.elf - HASH:=168c0a9178d5a3b4bd89ef770826a85b4ea3132560ba3600c212c0cec4c575c6 + HASH:=c9b4de3f12bec7808868b898c49f656b5378ddc315f12ccab83d6519bad51680 endef $(eval $(call Download,start_cd_elf)) @@ -98,7 +98,7 @@ define Download/start_x_elf FILE:=$(RPI_FIRMWARE_FILE)-start_x.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start_x.elf - HASH:=30c6a7f32a25185053ca3ca9e4bcfe932246ed42a1b7c37f8803209f93d86404 + HASH:=0b5c06c109984361eeed0ab14d146f686d8aa8da2025689b887e9cb098636db9 endef $(eval $(call Download,start_x_elf)) @@ -106,7 +106,7 @@ define Download/start4_elf FILE:=$(RPI_FIRMWARE_FILE)-start4.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start4.elf - HASH:=be8bbff41dba2749b7b0e812f0a9d87a9122d18508f7b5ff3cd20f303d15bc07 + HASH:=fedc4ecd72c9d21018e210240dcd2e41a8bb5f936fb5674c3351f2a447a22203 endef $(eval $(call Download,start4_elf)) @@ -114,7 +114,7 @@ define Download/start4cd_elf FILE:=$(RPI_FIRMWARE_FILE)-start4cd.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start4cd.elf - HASH:=000372e9cf6815ade595948dbd6328665f2a535eeee44e74b0ec8e56b6fbbf90 + HASH:=ea22282a77666801378137a651e7e0b17cc186f63cdbdc8b9bb98749cd12b256 endef $(eval $(call Download,start4cd_elf)) @@ -122,7 +122,7 @@ define Download/start4x_elf FILE:=$(RPI_FIRMWARE_FILE)-start4x.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start4x.elf - HASH:=48895858f7936570dfab44c67bdcb0357ac8fcd630162c36ac9ed8f2de85c038 + HASH:=c509e73a9cba7af3223dea885f58294bd04845e822aa3d6278500fa4dcdb112f endef $(eval $(call Download,start4x_elf)) From 6b7c4739c407588865aaa0d6868cf6bfe216a987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 26 Nov 2023 21:24:28 +0100 Subject: [PATCH 0724/1171] base-files: execute package's "postinst" after executing uci-defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow "postinst" scripts to perform extra actions after applying all kind of fixups implemented using uci-defaults. This is needed e.g. by uhttpd-mod-ubus which after installation in a running systems needs to: 1. Update uhttpd config using its uci-defaults script 2. Reload uhttpd While this approach makes sense there is a risk it'll blow up some corner case postinst usages. There is only 1 way to find out. Cc: Hauke Mehrtens Signed-off-by: Rafał Miłecki (cherry picked from commit b799dd3c705dfd95745cdd94b13d1cd2ad2367a6) --- package/base-files/files/lib/functions.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 4b1b838572a0cd..50aed53b068b1c 100644 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -262,11 +262,6 @@ default_postinst() { add_group_and_user "${pkgname}" - if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then - ( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ) - ret=$? - fi - if [ -d "$root/rootfs-overlay" ]; then cp -R $root/rootfs-overlay/. $root/ rm -fR $root/rootfs-overlay/ @@ -292,6 +287,11 @@ default_postinst() { rm -f /tmp/luci-indexcache fi + if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then + ( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ) + ret=$? + fi + local shell="$(command -v bash)" for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do if [ -n "$root" ]; then From 1ca61b7b376e135f4a3e08c500e98563f66aa202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 27 Dec 2023 16:20:45 +0100 Subject: [PATCH 0725/1171] uhttpd: handle reload after uhttpd-mod-ubus installation using postinst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use postinst script to reload service instead of uci-defaults hack. It's possible thanks to recent base-files change that executes postinst after uci-defaults. This fixes support for uhttpd customizations. It's possible (again) to adjust uhttpd config with custom uci-defaults before it gets started. Cc: Hauke Mehrtens Fixes: d25d281fd668 ("uhttpd: Reload config after uhttpd-mod-ubus was added") Ref: b799dd3c705d ("base-files: execute package's "postinst" after executing uci-defaults") Signed-off-by: Rafał Miłecki (cherry picked from commit 1f11a4e28336c07aca61dd3b4fef01ef872a362d) --- package/network/services/uhttpd/Makefile | 9 ++++++++- package/network/services/uhttpd/files/ubus.default | 6 ------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 02a02405fd69ea..37117bf91192f4 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git @@ -107,6 +107,13 @@ define Package/uhttpd-mod-ubus/install $(INSTALL_DATA) ./files/ubus.default $(1)/etc/uci-defaults/00_uhttpd_ubus endef +define Package/uhttpd-mod-ubus/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + /etc/init.d/uhttpd reload +fi +endef + define Package/uhttpd-mod-ucode/install $(INSTALL_DIR) $(1)/usr/lib $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_ucode.so $(1)/usr/lib/ diff --git a/package/network/services/uhttpd/files/ubus.default b/package/network/services/uhttpd/files/ubus.default index 474016c1c55705..d0a218a0ad9d1e 100644 --- a/package/network/services/uhttpd/files/ubus.default +++ b/package/network/services/uhttpd/files/ubus.default @@ -1,17 +1,11 @@ #!/bin/sh -commit=0 - if [ -z "$(uci -q get uhttpd.main.ubus_prefix)" ]; then uci set uhttpd.main.ubus_prefix=/ubus - commit=1 fi [ "$(uci -q get uhttpd.main.ubus_socket)" = "/var/run/ubus.sock" ] && { uci set uhttpd.main.ubus_socket='/var/run/ubus/ubus.sock' - commit=1 } -[ "$commit" = 1 ] && uci commit uhttpd && /etc/init.d/uhttpd reload - exit 0 From b0f3fd550b1e9dd5149e18ffd5f47edc570f21a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 29 Jun 2023 14:29:02 +0200 Subject: [PATCH 0726/1171] ipq807x: prpl-haze: fix sysupgrade flashing from bootloader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While flashing sysupgrade image from U-Boot, then the rootfs_data overlay filesystem formatting is left for the fstools during firstboot, but that wont work as mkfs.f2fs is missing in the sysupgrade image: mount_root: overlay filesystem in /dev/loop0 has not been formatted yet mount_root: no usable overlay filesystem found, using tmpfs overlay sh: mkfs.f2fs: not found Filesystem Size Used Available Use% Mounted on /dev/loop0 139.6M 46.9M 92.6M 34% /overlay Number Start (sector) End (sector) Size Code Name 20 98850 406349 150.1 MiB FFFF rootfs So lets fix it by adding f2fs support to the sysupgrade image. Signed-off-by: Petr Štetiar (cherry picked from commit ba415af5706f0369e4d299e4dfe50541a4a8056b) --- target/linux/ipq807x/image/generic.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index fb991156d5de4b..104a6678945f6a 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -103,7 +103,8 @@ define Device/prpl_haze DEVICE_MODEL := Haze DEVICE_DTS_CONFIG := config@hk09 SOC := ipq8072 - DEVICE_PACKAGES += ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci + DEVICE_PACKAGES += ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci \ + mkf2fs f2fsck kmod-fs-f2fs endef TARGET_DEVICES += prpl_haze From b5c728948c976f0614c85aa5418af3a44424b511 Mon Sep 17 00:00:00 2001 From: orangepizza Date: Mon, 29 Jan 2024 11:37:43 +0900 Subject: [PATCH 0727/1171] mbedtls: security bump to version 2.28.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This release of Mbed TLS provides bug fixes and minor enhancements. This release includes fixes for following security issues: * Timing side channel in private key RSA operations (CVE-2024-23170) Mbed TLS is vulnerable to a timing side channel in private key RSA operations. This side channel could be sufficient for an attacker to recover the plaintext. A local attacker or a remote attacker who is close to the victim on the network might have precise enough timing measurements to exploit this. It requires the attacker to send a large number of messages for decryption. * Buffer overflow in mbedtls_x509_set_extension() (CVE-2024-23775) When writing x509 extensions we failed to validate inputs passed in to mbedtls_x509_set_extension(), which could result in an integer overflow, causing a zero-length buffer to be allocated to hold the extension. The extension would then be copied into the buffer, causing a heap buffer overflow. Fixes: CVE-2024-23170, CVE-2024-23775 References: https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2024-01-1/ References: https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2024-01-2/ Signed-off-by: orangepizza Signed-off-by: Petr Štetiar [formal fixes] (cherry picked from commit 920414ca8848fe1b430e436207b4f8c927819368) --- package/libs/mbedtls/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 246b21a8531a1f..ad13bbe846371c 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=2.28.5 +PKG_VERSION:=2.28.7 PKG_RELEASE:=2 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=849e86b626e42ded6bf67197b64aa771daa54e2a7e2868dc67e1e4711959e5e3 +PKG_HASH:=1df6073f0cf6a4e1953890bf5e0de2a8c7e6be50d6d6c69fa9fefcb1d14e981a PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=gpl-2.0.txt From 58c9308400849c8a29cc401991b5d9c64286ac3f Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Thu, 4 Jan 2024 01:22:26 +0100 Subject: [PATCH 0728/1171] ath79: ubnt,bullet-m-xw: set PHY max-speed to 100Mbps Onboard AR8035 PHY supports 1000Base-T operation, but onboard Ethernet magnetics do not. Reduce advertised link speeds to 100Mbps and lower. Signed-off-by: Lech Perczak (cherry picked from commit d406777fb14c84e82f51bab059631af70cf6d5c9) --- target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts index c448ac4e619965..a008b51130147e 100644 --- a/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts +++ b/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts @@ -13,6 +13,7 @@ phy4: ethernet-phy@4 { phy-mode = "rgmii"; reg = <4>; + max-speed = <100>; }; }; From e5af19e955a2a265abf7b7e9470443e8b82890c7 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Mon, 22 Jan 2024 00:14:16 +0100 Subject: [PATCH 0729/1171] ath79: ubnt-bullet-m-xw: fix Ethernet PHY traffic Since commit 6f2e1b7485f0 ("ath79: disable delays on AT803X config init") Ubiquiti XW boards equipped with AR8035 PHY suffered from lack of outbound traffic on the Ethernet port. This was caused by the fact, the U-boot has set this during boot and it wasn't reset by the PHY driver, and the corresponding setting in device tree was wrong. Set the 'phy-mode = "rgmii-txid"' at the ð0, and drop this property from PHY node, as it is not parsed there. This causes the device to connect using Ethernet once again. Fixes: db4b6535f837 ("ath79: Add support for Ubiquity Bullet M (XW)") Fixes: 6f2e1b7485f0 ("ath79: disable delays on AT803X config init") Signed-off-by: Lech Perczak (cherry picked from commit a9b2ba4d7ba06e1ac4ff7da3eb9b4038b94d9fbb) --- target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts index a008b51130147e..80d9e2d394522e 100644 --- a/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts +++ b/target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts @@ -11,7 +11,6 @@ status = "okay"; phy4: ethernet-phy@4 { - phy-mode = "rgmii"; reg = <4>; max-speed = <100>; }; @@ -20,7 +19,7 @@ ð0 { status = "okay"; - phy-mode = "rgmii"; + phy-mode = "rgmii-txid"; phy-handle = <&phy4>; gmac-config { From e302172258a588de9af63854fbee35554b1d3a95 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Mon, 22 Jan 2024 00:34:34 +0100 Subject: [PATCH 0730/1171] ath79: add Ubiquiti Rocket M XW as alternate name to Bullet M XW Ubiquiti Rocket M XW is a single-band, 2x2:2 external Wi-Fi AP, with optional GPS receiver, with two external RP-SMA antenna connections, based on AR9342 SoC. Two band variants exists, for 2.4GHz and 5GHz band, usable with the same image. Specs: - CPU: Atheros AR9342 MIPS SoC at 535MHz - RAM: 64MB DDR400 - ROM: 8MB SPI-NOR in SO16W package, MX25L6408E - Wi-Fi Atheros AR9342 built-in 2x2:2 radio - Ethernet: Atheros AR8035 PHY, limited to 100Mbps speeds due to magnetics - Power: 24V passive PoE input. Installation: please refer to Ubiquiti Bullet M2HP for documentation. The device runs with exactly same image as the Bullet, and after fixes in preceding commit, is fully functional again. Add the alternative name to the build system. Signed-off-by: Lech Perczak (cherry picked from commit 54387fddead1094774187cedfe07cc8a47f5fe2c) --- target/linux/ath79/image/generic-ubnt.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 68cef7d14b13a0..1d464361a0fa37 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -28,6 +28,9 @@ TARGET_DEVICES += ubnt_bullet-ac define Device/ubnt_bullet-m-xw $(Device/ubnt-xw) DEVICE_MODEL := Bullet M + DEVICE_ALT0_VENDOR := Ubiquiti + DEVICE_ALT0_MODEL := Rocket M + DEVICE_ALT0_VARIANT := XW DEVICE_PACKAGES += rssileds SUPPORTED_DEVICES += bullet-m-xw endef From 5eb578a4fb8d9a3bb153f6b20ce20b56be02c576 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 31 Jan 2024 09:18:01 +0100 Subject: [PATCH 0731/1171] firmware-utils: bump to latest openwrt-23.05 This version bump contains two patches improving compatibility with recent vendor firmware versions: - c46b4b4ad7e7 tplink-safeloader: bump EAP225-V3 compat_level - b6a7e813b61c tplink-safeloader: bump EAP225-Outdoor v1 compat Signed-off-by: Sander Vanheule --- tools/firmware-utils/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index bec4f9fb0c903b..2e5591ab4a9640 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2024-01-07 -PKG_SOURCE_VERSION:=40da9034bb4926ef04ec95c3fd38d850aed68142 -PKG_MIRROR_HASH:=ee1694d4cddba32e32fcba85aeeaed6c5524e06ed29fca9d56cc466097aaa6f9 +PKG_SOURCE_DATE:=2024-01-31 +PKG_SOURCE_VERSION:=c46b4b4ad7e77aab555bb41d6adc5554d11a83e8 +PKG_MIRROR_HASH:=666edb5e9ddb84b1eb54d5b978efdb29ace641d1fe12fc8e7db42130dceaf3aa include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From 6d962cabba812edcc7fed7124b902898eb495bc2 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 16 Dec 2023 17:12:33 -0800 Subject: [PATCH 0732/1171] kernel: backport ethtool_puts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will be used for conversions in later commits and is a requirement for PHY backports. Signed-off-by: Rosen Penev [rmilecki: update commit message for 23.05] Signed-off-by: Rafał Miłecki (cherry picked from commit 511c7ff03231752ea2adbdf7cc1af4be962c9b65) --- ...8-net-ethtool-implement-ethtool_puts.patch | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch diff --git a/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch b/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch new file mode 100644 index 00000000000000..ef9e706cb41d6c --- /dev/null +++ b/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch @@ -0,0 +1,139 @@ +From mboxrd@z Thu Jan 1 00:00:00 1970 +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sMUeie/T" +Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB8D6D + for ; Wed, 6 Dec 2023 15:16:16 -0800 (PST) +Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db5416d0fccso403298276.1 + for ; Wed, 06 Dec 2023 15:16:16 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20230601; t=1701904575; x=1702509375; darn=vger.kernel.org; + h=cc:to:from:subject:message-id:references:mime-version:in-reply-to + :date:from:to:cc:subject:date:message-id:reply-to; + bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=; + b=sMUeie/TxdytzC0EyT11QWi1TqTtiv7KCTs1F2vLmUUvPKNA3+1MHFo8ECW+0gQuDE + FGrgdZKGK5mXQgkF0N3JiSLvKO8tpQOIB57JLCG5IVy5dr2vVv0ExU3Dag2Cc4oBIBIO + w/cH95O1oPlvluIpATmAsxenVr7mFomU63BqYiRGLaEhWeb2hJ636GO8lubtsDfdFFoi + GPOL2tQwV93VnqmywBBpFaNAULN0UoCFhfkKv5prvpkXq19sWI7zyorVZ+rdTYem5m4T + dXsDaLXPtC3Dh2JOad1duSQIah/wCHYYUcV3IoFhwj2y0Uk/TTCrnZPORweSADcEy6Ho + vDrA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1701904575; x=1702509375; + h=cc:to:from:subject:message-id:references:mime-version:in-reply-to + :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; + bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=; + b=Dmc6aSntxPlxAk72zVO1G9WoZnFtLolxENlLscYYAHG3VE+PQ8gGN2rPzcGoKb2Btb + 4b0PvjOzSlPQyghahdhdlz04RtAeeGG/MkfNiYjFql5OifIoovb51kroiPYrVsa7Ps7Y + +Pxug0+NPdTm5s9TNz940ZKl3GRME8UTmVxpWJRX03XMOqb6Wgsh2SK9ahXKc4yRsi62 + 3a3J72WmmSgvimxwM/99fXwvoUQpiv2J1xCoqc1Ng4q4qSuZvzmHN7ZTGaUhLxOqLeLK + 3W4RKHW6rZ7UjppuB6I3NXW+D344By2rdKp1sRXpjdQ0GS3YUcvlRETcJBXJudHfQP5Y + CLOw== +X-Gm-Message-State: AOJu0YzdCTLdwny+N99zeMgyKqFsEZhfIhL2cbgKA6zC1U/OLkxxRLoM + XrYVBC9DmxCGmP4o+M/Z/kHUew/9faHlCiLGxw== +X-Google-Smtp-Source: AGHT+IFRXxBV6JuX5Cl/k2o1+WKkCwkR8j20MJSkmoGCedPAtqFttH8OVh1/6vdfnq8MPN++A2h89peZQhyG8OsJ8A== +X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) + (user=justinstitt job=sendgmr) by 2002:a25:dac7:0:b0:da0:3117:f35 with SMTP + id n190-20020a25dac7000000b00da031170f35mr28652ybf.3.1701904575576; Wed, 06 + Dec 2023 15:16:15 -0800 (PST) +Date: Wed, 06 Dec 2023 23:16:10 +0000 +In-Reply-To: <20231206-ethtool_puts_impl-v5-0-5a2528e17bf8@google.com> +Precedence: bulk +X-Mailing-List: bpf@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +Mime-Version: 1.0 +References: <20231206-ethtool_puts_impl-v5-0-5a2528e17bf8@google.com> +X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= +X-Developer-Signature: v=1; a=ed25519-sha256; t=1701904573; l=1840; + i=justinstitt@google.com; s=20230717; h=from:subject:message-id; + bh=UMdetIL2ZsPIkSodqhw2fM21NHJVjCu0lRImFuNhVoM=; b=a8rMnXfVVQ5gsxHWG4WRMwOLxZgflqXZtNuKx26vv4DwYvvCtCiYjl3f1frOjV/Ul2kaxq5g/ + b/UOv678JKCDASVokxG5GJifAnU7/kqRxdhcwfRkrD8RUfcsmiZOfyF +X-Mailer: b4 0.12.3 +Message-ID: <20231206-ethtool_puts_impl-v5-1-5a2528e17bf8@google.com> +Subject: [PATCH net-next v5 1/3] ethtool: Implement ethtool_puts() +From: justinstitt@google.com +To: "David S. Miller" , Eric Dumazet , + Jakub Kicinski , Paolo Abeni , Shay Agroskin , + Arthur Kiyanovski , David Arinzon , Noam Dagan , + Saeed Bishara , Rasesh Mody , + Sudarsana Kalluru , GR-Linux-NIC-Dev@marvell.com, + Dimitris Michailidis , Yisen Zhuang , + Salil Mehta , Jesse Brandeburg , + Tony Nguyen , Louis Peens , + Shannon Nelson , Brett Creeley , drivers@pensando.io, + "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , + Dexuan Cui , Ronak Doshi , + VMware PV-Drivers Reviewers , Andy Whitcroft , Joe Perches , + Dwaipayan Ray , Lukas Bulwahn , + Hauke Mehrtens , Andrew Lunn , + Florian Fainelli , Vladimir Oltean , + "=?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?=" , Daniel Golle , + Landen Chao , DENG Qingfang , + Sean Wang , Matthias Brugger , + AngeloGioacchino Del Regno , + Linus Walleij , + "=?utf-8?q?Alvin_=C5=A0ipraga?=" , Wei Fang , + Shenwei Wang , Clark Wang , + NXP Linux Team , Lars Povlsen , + Steen Hegelund , Daniel Machon , + UNGLinuxDriver@microchip.com, Jiawen Wu , + Mengyuan Lou , Heiner Kallweit , + Russell King , Alexei Starovoitov , + Daniel Borkmann , Jesper Dangaard Brouer , + John Fastabend +Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, + Nick Desaulniers , Nathan Chancellor , + Kees Cook , intel-wired-lan@lists.osuosl.org, + oss-drivers@corigine.com, linux-hyperv@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, + bpf@vger.kernel.org, Justin Stitt +Content-Type: text/plain; charset="utf-8" + +Use strscpy() to implement ethtool_puts(). + +Functionally the same as ethtool_sprintf() when it's used with two +arguments or with just "%s" format specifier. + +Signed-off-by: Justin Stitt +--- + include/linux/ethtool.h | 13 +++++++++++++ + net/ethtool/ioctl.c | 7 +++++++ + 2 files changed, 20 insertions(+) + +--- a/include/linux/ethtool.h ++++ b/include/linux/ethtool.h +@@ -788,4 +788,17 @@ int ethtool_get_phc_vclocks(struct net_d + * next string. + */ + extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); ++ ++/** ++ * ethtool_puts - Write string to ethtool string data ++ * @data: Pointer to a pointer to the start of string to update ++ * @str: String to write ++ * ++ * Write string to *data without a trailing newline. Update *data ++ * to point at start of next string. ++ * ++ * Prefer this function to ethtool_sprintf() when given only ++ * two arguments or if @fmt is just "%s". ++ */ ++extern void ethtool_puts(u8 **data, const char *str); + #endif /* _LINUX_ETHTOOL_H */ +--- a/net/ethtool/ioctl.c ++++ b/net/ethtool/ioctl.c +@@ -1953,6 +1953,13 @@ __printf(2, 3) void ethtool_sprintf(u8 * + } + EXPORT_SYMBOL(ethtool_sprintf); + ++void ethtool_puts(u8 **data, const char *str) ++{ ++ strscpy(*data, str, ETH_GSTRING_LEN); ++ *data += ETH_GSTRING_LEN; ++} ++EXPORT_SYMBOL(ethtool_puts); ++ + static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) + { + struct ethtool_value id; From 8a7f667fb53eb242b684e9c96124778bdee8b743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 26 Jan 2024 06:35:27 +0100 Subject: [PATCH 0733/1171] kernel: 5.15: backport v6.1 PHY changes required for Aquantia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 2df8a0ccb0b0461836e3ab88c7d4dc848664def4) --- ...1-net-phy-Introduce-QUSGMII-PHY-mode.patch | 99 ++++++ ...er-to-derive-the-number-of-ports-fro.patch | 93 ++++++ ...t-phy-Add-1000BASE-KX-interface-mode.patch | 96 ++++++ ...et-phy-Add-support-for-rate-matching.patch | 294 ++++++++++++++++++ ...ble-PCS-polling-over-major-configura.patch | 10 +- ...NULL-pl-pcs-dereference-during-phyli.patch | 2 +- ...k-add-pcs_enable-pcs_disable-methods.patch | 14 +- ...5-net-phy-Add-a-binding-for-PHY-LEDs.patch | 6 +- ...ce-Call-into-the-PHY-driver-to-set-L.patch | 4 +- ...ce-Call-into-the-PHY-driver-to-set-L.patch | 2 +- ...8-net-ethtool-implement-ethtool_puts.patch | 2 +- .../795-backport-phylink_pcs-helpers.patch | 6 +- ...detach-callback-to-struct-phy_driver.patch | 2 +- ...phy-define-PSGMII-PHY-interface-mode.patch | 10 +- ...02-phy-Add-2.5G-SGMII-interface-mode.patch | 26 +- ...y-simplify-phy_link_change-arguments.patch | 12 +- .../721-NET-no-auto-carrier-off-support.patch | 6 +- ...nclude-linux-add-phy-ops-for-rtl838x.patch | 2 +- ...vers-net-phy-eee-support-for-rtl838x.patch | 6 +- ...04-include-linux-add-phy-hsgmii-mode.patch | 18 +- ...rease-phy-address-number-for-rtl839x.patch | 2 +- ...rt-hardware-assisted-indirect-access.patch | 18 +- 22 files changed, 666 insertions(+), 64 deletions(-) create mode 100644 target/linux/generic/backport-5.15/731-v6.1-0001-net-phy-Introduce-QUSGMII-PHY-mode.patch create mode 100644 target/linux/generic/backport-5.15/731-v6.1-0002-net-phy-Add-helper-to-derive-the-number-of-ports-fro.patch create mode 100644 target/linux/generic/backport-5.15/731-v6.1-0003-net-phy-Add-1000BASE-KX-interface-mode.patch create mode 100644 target/linux/generic/backport-5.15/731-v6.1-0004-net-phy-Add-support-for-rate-matching.patch diff --git a/target/linux/generic/backport-5.15/731-v6.1-0001-net-phy-Introduce-QUSGMII-PHY-mode.patch b/target/linux/generic/backport-5.15/731-v6.1-0001-net-phy-Introduce-QUSGMII-PHY-mode.patch new file mode 100644 index 00000000000000..40b14fc36ae3c7 --- /dev/null +++ b/target/linux/generic/backport-5.15/731-v6.1-0001-net-phy-Introduce-QUSGMII-PHY-mode.patch @@ -0,0 +1,99 @@ +From 5e61fe157a27afc7c0d4f7bcbceefdca536c015f Mon Sep 17 00:00:00 2001 +From: Maxime Chevallier +Date: Wed, 17 Aug 2022 14:32:52 +0200 +Subject: [PATCH] net: phy: Introduce QUSGMII PHY mode + +The QUSGMII mode is a derivative of Cisco's USXGMII standard. This +standard is pretty similar to SGMII, but allows for faster speeds, and +has the build-in bits for Quad and Octa variants (like QSGMII). + +The main difference with SGMII/QSGMII is that USXGMII/QUSGMII re-uses +the preamble to carry various information, named 'Extensions'. + +As of today, the USXGMII standard only mentions the "PCH" extension, +which is used to convey timestamps, allowing in-band signaling of PTP +timestamps without having to modify the frame itself. + +This commit adds support for that mode. When no extension is in use, it +behaves exactly like QSGMII, although it's not compatible with QSGMII. + +Signed-off-by: Maxime Chevallier +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + Documentation/networking/phy.rst | 9 +++++++++ + drivers/net/phy/phylink.c | 3 +++ + include/linux/phy.h | 4 ++++ + 3 files changed, 16 insertions(+) + +--- a/Documentation/networking/phy.rst ++++ b/Documentation/networking/phy.rst +@@ -303,6 +303,15 @@ Some of the interface modes are describe + rate of 125Mpbs using a 4B/5B encoding scheme, resulting in an underlying + data rate of 100Mpbs. + ++``PHY_INTERFACE_MODE_QUSGMII`` ++ This defines the Cisco the Quad USGMII mode, which is the Quad variant of ++ the USGMII (Universal SGMII) link. It's very similar to QSGMII, but uses ++ a Packet Control Header (PCH) instead of the 7 bytes preamble to carry not ++ only the port id, but also so-called "extensions". The only documented ++ extension so-far in the specification is the inclusion of timestamps, for ++ PTP-enabled PHYs. This mode isn't compatible with QSGMII, but offers the ++ same capabilities in terms of link speed and negociation. ++ + Pause frames / flow control + =========================== + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -367,6 +367,7 @@ void phylink_get_linkmodes(unsigned long + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_QSGMII: ++ case PHY_INTERFACE_MODE_QUSGMII: + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_GMII: + caps |= MAC_1000HD | MAC_1000FD; +@@ -630,6 +631,7 @@ static int phylink_parse_mode(struct phy + switch (pl->link_config.interface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_QSGMII: ++ case PHY_INTERFACE_MODE_QUSGMII: + phylink_set(pl->supported, 10baseT_Half); + phylink_set(pl->supported, 10baseT_Full); + phylink_set(pl->supported, 100baseT_Half); +@@ -2956,6 +2958,7 @@ void phylink_mii_c22_pcs_get_state(struc + + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_QSGMII: ++ case PHY_INTERFACE_MODE_QUSGMII: + phylink_decode_sgmii_word(state, lpa); + break; + +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -115,6 +115,7 @@ extern const int phy_10gbit_features_arr + * @PHY_INTERFACE_MODE_25GBASER: 25G BaseR + * @PHY_INTERFACE_MODE_USXGMII: Universal Serial 10GE MII + * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN ++ * @PHY_INTERFACE_MODE_QUSGMII: Quad Universal SGMII + * @PHY_INTERFACE_MODE_MAX: Book keeping + * + * Describes the interface between the MAC and PHY. +@@ -152,6 +153,7 @@ typedef enum { + PHY_INTERFACE_MODE_USXGMII, + /* 10GBASE-KR - with Clause 73 AN */ + PHY_INTERFACE_MODE_10GKR, ++ PHY_INTERFACE_MODE_QUSGMII, + PHY_INTERFACE_MODE_MAX, + } phy_interface_t; + +@@ -267,6 +269,8 @@ static inline const char *phy_modes(phy_ + return "10gbase-kr"; + case PHY_INTERFACE_MODE_100BASEX: + return "100base-x"; ++ case PHY_INTERFACE_MODE_QUSGMII: ++ return "qusgmii"; + default: + return "unknown"; + } diff --git a/target/linux/generic/backport-5.15/731-v6.1-0002-net-phy-Add-helper-to-derive-the-number-of-ports-fro.patch b/target/linux/generic/backport-5.15/731-v6.1-0002-net-phy-Add-helper-to-derive-the-number-of-ports-fro.patch new file mode 100644 index 00000000000000..a9706af8937466 --- /dev/null +++ b/target/linux/generic/backport-5.15/731-v6.1-0002-net-phy-Add-helper-to-derive-the-number-of-ports-fro.patch @@ -0,0 +1,93 @@ +From c04ade27cb7b952b6b9b9a0efa0a6129cc63f2ae Mon Sep 17 00:00:00 2001 +From: Maxime Chevallier +Date: Wed, 17 Aug 2022 14:32:54 +0200 +Subject: [PATCH] net: phy: Add helper to derive the number of ports from a phy + mode + +Some phy modes such as QSGMII multiplex several MAC<->PHY links on one +single physical interface. QSGMII used to be the only one supported, but +other modes such as QUSGMII also carry multiple links. + +This helper allows getting the number of links that are multiplexed +on a given interface. + +Signed-off-by: Maxime Chevallier +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/phy-core.c | 52 ++++++++++++++++++++++++++++++++++++++ + include/linux/phy.h | 2 ++ + 2 files changed, 54 insertions(+) + +--- a/drivers/net/phy/phy-core.c ++++ b/drivers/net/phy/phy-core.c +@@ -74,6 +74,58 @@ const char *phy_duplex_to_str(unsigned i + } + EXPORT_SYMBOL_GPL(phy_duplex_to_str); + ++/** ++ * phy_interface_num_ports - Return the number of links that can be carried by ++ * a given MAC-PHY physical link. Returns 0 if this is ++ * unknown, the number of links else. ++ * ++ * @interface: The interface mode we want to get the number of ports ++ */ ++int phy_interface_num_ports(phy_interface_t interface) ++{ ++ switch (interface) { ++ case PHY_INTERFACE_MODE_NA: ++ return 0; ++ case PHY_INTERFACE_MODE_INTERNAL: ++ case PHY_INTERFACE_MODE_MII: ++ case PHY_INTERFACE_MODE_GMII: ++ case PHY_INTERFACE_MODE_TBI: ++ case PHY_INTERFACE_MODE_REVMII: ++ case PHY_INTERFACE_MODE_RMII: ++ case PHY_INTERFACE_MODE_REVRMII: ++ case PHY_INTERFACE_MODE_RGMII: ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ case PHY_INTERFACE_MODE_RTBI: ++ case PHY_INTERFACE_MODE_XGMII: ++ case PHY_INTERFACE_MODE_XLGMII: ++ case PHY_INTERFACE_MODE_MOCA: ++ case PHY_INTERFACE_MODE_TRGMII: ++ case PHY_INTERFACE_MODE_USXGMII: ++ case PHY_INTERFACE_MODE_SGMII: ++ case PHY_INTERFACE_MODE_SMII: ++ case PHY_INTERFACE_MODE_1000BASEX: ++ case PHY_INTERFACE_MODE_2500BASEX: ++ case PHY_INTERFACE_MODE_5GBASER: ++ case PHY_INTERFACE_MODE_10GBASER: ++ case PHY_INTERFACE_MODE_25GBASER: ++ case PHY_INTERFACE_MODE_10GKR: ++ case PHY_INTERFACE_MODE_100BASEX: ++ case PHY_INTERFACE_MODE_RXAUI: ++ case PHY_INTERFACE_MODE_XAUI: ++ return 1; ++ case PHY_INTERFACE_MODE_QSGMII: ++ case PHY_INTERFACE_MODE_QUSGMII: ++ return 4; ++ case PHY_INTERFACE_MODE_MAX: ++ WARN_ONCE(1, "PHY_INTERFACE_MODE_MAX isn't a valid interface mode"); ++ return 0; ++ } ++ return 0; ++} ++EXPORT_SYMBOL_GPL(phy_interface_num_ports); ++ + /* A mapping of all SUPPORTED settings to speed/duplex. This table + * must be grouped by speed and sorted in descending match priority + * - iow, descending speed. +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -964,6 +964,8 @@ struct phy_fixup { + const char *phy_speed_to_str(int speed); + const char *phy_duplex_to_str(unsigned int duplex); + ++int phy_interface_num_ports(phy_interface_t interface); ++ + /* A structure for mapping a particular speed and duplex + * combination to a particular SUPPORTED and ADVERTISED value + */ diff --git a/target/linux/generic/backport-5.15/731-v6.1-0003-net-phy-Add-1000BASE-KX-interface-mode.patch b/target/linux/generic/backport-5.15/731-v6.1-0003-net-phy-Add-1000BASE-KX-interface-mode.patch new file mode 100644 index 00000000000000..70669dde3a37c9 --- /dev/null +++ b/target/linux/generic/backport-5.15/731-v6.1-0003-net-phy-Add-1000BASE-KX-interface-mode.patch @@ -0,0 +1,96 @@ +From 05ad5d4581c3c1cc724fe50d4652833fb9f3037b Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 2 Sep 2022 18:02:39 -0400 +Subject: [PATCH] net: phy: Add 1000BASE-KX interface mode + +Add 1000BASE-KX interface mode. This 1G backplane ethernet as described in +clause 70. Clause 73 autonegotiation is mandatory, and only full duplex +operation is supported. + +Although at the PMA level this interface mode is identical to +1000BASE-X, it uses a different form of in-band autonegation. This +justifies a separate interface mode, since the interface mode (along +with the MLO_AN_* autonegotiation mode) sets the type of autonegotiation +which will be used on a link. This results in more than just electrical +differences between the link modes. + +With regard to 1000BASE-X, 1000BASE-KX holds a similar position to +SGMII: same signaling, but different autonegotiation. PCS drivers +(which typically handle in-band autonegotiation) may only support +1000BASE-X, and not 1000BASE-KX. Similarly, the phy mode is used to +configure serdes phys with phy_set_mode_ext. Due to the different +electrical standards (SFI or XFI vs Clause 70), they will likely want to +use different configuration. Adding a phy interface mode for +1000BASE-KX helps simplify configuration in these areas. + +Signed-off-by: Sean Anderson +Signed-off-by: David S. Miller +--- + Documentation/networking/phy.rst | 6 ++++++ + drivers/net/phy/phy-core.c | 1 + + drivers/net/phy/phylink.c | 1 + + include/linux/phy.h | 4 ++++ + 4 files changed, 12 insertions(+) + +--- a/Documentation/networking/phy.rst ++++ b/Documentation/networking/phy.rst +@@ -312,6 +312,12 @@ Some of the interface modes are describe + PTP-enabled PHYs. This mode isn't compatible with QSGMII, but offers the + same capabilities in terms of link speed and negociation. + ++``PHY_INTERFACE_MODE_1000BASEKX`` ++ This is 1000BASE-X as defined by IEEE 802.3 Clause 36 with Clause 73 ++ autonegotiation. Generally, it will be used with a Clause 70 PMD. To ++ contrast with the 1000BASE-X phy mode used for Clause 38 and 39 PMDs, this ++ interface mode has different autonegotiation and only supports full duplex. ++ + Pause frames / flow control + =========================== + +--- a/drivers/net/phy/phy-core.c ++++ b/drivers/net/phy/phy-core.c +@@ -114,6 +114,7 @@ int phy_interface_num_ports(phy_interfac + case PHY_INTERFACE_MODE_100BASEX: + case PHY_INTERFACE_MODE_RXAUI: + case PHY_INTERFACE_MODE_XAUI: ++ case PHY_INTERFACE_MODE_1000BASEKX: + return 1; + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_QUSGMII: +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -390,6 +390,7 @@ void phylink_get_linkmodes(unsigned long + case PHY_INTERFACE_MODE_1000BASEX: + caps |= MAC_1000HD; + fallthrough; ++ case PHY_INTERFACE_MODE_1000BASEKX: + case PHY_INTERFACE_MODE_TRGMII: + caps |= MAC_1000FD; + break; +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -116,6 +116,7 @@ extern const int phy_10gbit_features_arr + * @PHY_INTERFACE_MODE_USXGMII: Universal Serial 10GE MII + * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN + * @PHY_INTERFACE_MODE_QUSGMII: Quad Universal SGMII ++ * @PHY_INTERFACE_MODE_1000BASEKX: 1000Base-KX - with Clause 73 AN + * @PHY_INTERFACE_MODE_MAX: Book keeping + * + * Describes the interface between the MAC and PHY. +@@ -154,6 +155,7 @@ typedef enum { + /* 10GBASE-KR - with Clause 73 AN */ + PHY_INTERFACE_MODE_10GKR, + PHY_INTERFACE_MODE_QUSGMII, ++ PHY_INTERFACE_MODE_1000BASEKX, + PHY_INTERFACE_MODE_MAX, + } phy_interface_t; + +@@ -251,6 +253,8 @@ static inline const char *phy_modes(phy_ + return "trgmii"; + case PHY_INTERFACE_MODE_1000BASEX: + return "1000base-x"; ++ case PHY_INTERFACE_MODE_1000BASEKX: ++ return "1000base-kx"; + case PHY_INTERFACE_MODE_2500BASEX: + return "2500base-x"; + case PHY_INTERFACE_MODE_5GBASER: diff --git a/target/linux/generic/backport-5.15/731-v6.1-0004-net-phy-Add-support-for-rate-matching.patch b/target/linux/generic/backport-5.15/731-v6.1-0004-net-phy-Add-support-for-rate-matching.patch new file mode 100644 index 00000000000000..fc02d7a4eab595 --- /dev/null +++ b/target/linux/generic/backport-5.15/731-v6.1-0004-net-phy-Add-support-for-rate-matching.patch @@ -0,0 +1,294 @@ +From 0c3e10cb44232833a50cb8e3e784c432906a60c1 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Tue, 20 Sep 2022 18:12:31 -0400 +Subject: [PATCH] net: phy: Add support for rate matching + +This adds support for rate matching (also known as rate adaptation) to +the phy subsystem. The general idea is that the phy interface runs at +one speed, and the MAC throttles the rate at which it sends packets to +the link speed. There's a good overview of several techniques for +achieving this at [1]. This patch adds support for three: pause-frame +based (such as in Aquantia phys), CRS-based (such as in 10PASS-TS and +2BASE-TL), and open-loop-based (such as in 10GBASE-W). + +This patch makes a few assumptions and a few non assumptions about the +types of rate matching available. First, it assumes that different phys +may use different forms of rate matching. Second, it assumes that phys +can use rate matching for any of their supported link speeds (e.g. if a +phy supports 10BASE-T and XGMII, then it can adapt XGMII to 10BASE-T). +Third, it does not assume that all interface modes will use the same +form of rate matching. Fourth, it does not assume that all phy devices +will support rate matching (even if some do). Relaxing or strengthening +these (non-)assumptions could result in a different API. For example, if +all interface modes were assumed to use the same form of rate matching, +then a bitmask of interface modes supportting rate matching would +suffice. + +For some better visibility into the process, the current rate matching +mode is exposed as part of the ethtool ksettings. For the moment, only +read access is supported. I'm not sure what userspace might want to +configure yet (disable it altogether, disable just one mode, specify the +mode to use, etc.). For the moment, since only pause-based rate +adaptation support is added in the next few commits, rate matching can +be disabled altogether by adjusting the advertisement. + +802.3 calls this feature "rate adaptation" in clause 49 (10GBASE-R) and +"rate matching" in clause 61 (10PASS-TL and 2BASE-TS). Aquantia also calls +this feature "rate adaptation". I chose "rate matching" because it is +shorter, and because Russell doesn't think "adaptation" is correct in this +context. + +Signed-off-by: Sean Anderson +Signed-off-by: David S. Miller +--- + Documentation/networking/ethtool-netlink.rst | 2 ++ + drivers/net/phy/phy-core.c | 21 +++++++++++++++ + drivers/net/phy/phy.c | 28 ++++++++++++++++++++ + include/linux/phy.h | 22 ++++++++++++++- + include/uapi/linux/ethtool.h | 18 +++++++++++-- + include/uapi/linux/ethtool_netlink.h | 1 + + net/ethtool/ioctl.c | 1 + + net/ethtool/linkmodes.c | 5 ++++ + 8 files changed, 95 insertions(+), 3 deletions(-) + +--- a/Documentation/networking/ethtool-netlink.rst ++++ b/Documentation/networking/ethtool-netlink.rst +@@ -418,6 +418,7 @@ Kernel response contents: + ``ETHTOOL_A_LINKMODES_DUPLEX`` u8 duplex mode + ``ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG`` u8 Master/slave port mode + ``ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE`` u8 Master/slave port state ++ ``ETHTOOL_A_LINKMODES_RATE_MATCHING`` u8 PHY rate matching + ========================================== ====== ========================== + + For ``ETHTOOL_A_LINKMODES_OURS``, value represents advertised modes and mask +@@ -441,6 +442,7 @@ Request contents: + ``ETHTOOL_A_LINKMODES_SPEED`` u32 link speed (Mb/s) + ``ETHTOOL_A_LINKMODES_DUPLEX`` u8 duplex mode + ``ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG`` u8 Master/slave port mode ++ ``ETHTOOL_A_LINKMODES_RATE_MATCHING`` u8 PHY rate matching + ``ETHTOOL_A_LINKMODES_LANES`` u32 lanes + ========================================== ====== ========================== + +--- a/drivers/net/phy/phy-core.c ++++ b/drivers/net/phy/phy-core.c +@@ -75,6 +75,27 @@ const char *phy_duplex_to_str(unsigned i + EXPORT_SYMBOL_GPL(phy_duplex_to_str); + + /** ++ * phy_rate_matching_to_str - Return a string describing the rate matching ++ * ++ * @rate_matching: Type of rate matching to describe ++ */ ++const char *phy_rate_matching_to_str(int rate_matching) ++{ ++ switch (rate_matching) { ++ case RATE_MATCH_NONE: ++ return "none"; ++ case RATE_MATCH_PAUSE: ++ return "pause"; ++ case RATE_MATCH_CRS: ++ return "crs"; ++ case RATE_MATCH_OPEN_LOOP: ++ return "open-loop"; ++ } ++ return "Unsupported (update phy-core.c)"; ++} ++EXPORT_SYMBOL_GPL(phy_rate_matching_to_str); ++ ++/** + * phy_interface_num_ports - Return the number of links that can be carried by + * a given MAC-PHY physical link. Returns 0 if this is + * unknown, the number of links else. +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -127,6 +127,33 @@ void phy_print_status(struct phy_device + EXPORT_SYMBOL(phy_print_status); + + /** ++ * phy_get_rate_matching - determine if rate matching is supported ++ * @phydev: The phy device to return rate matching for ++ * @iface: The interface mode to use ++ * ++ * This determines the type of rate matching (if any) that @phy supports ++ * using @iface. @iface may be %PHY_INTERFACE_MODE_NA to determine if any ++ * interface supports rate matching. ++ * ++ * Return: The type of rate matching @phy supports for @iface, or ++ * %RATE_MATCH_NONE. ++ */ ++int phy_get_rate_matching(struct phy_device *phydev, ++ phy_interface_t iface) ++{ ++ int ret = RATE_MATCH_NONE; ++ ++ if (phydev->drv->get_rate_matching) { ++ mutex_lock(&phydev->lock); ++ ret = phydev->drv->get_rate_matching(phydev, iface); ++ mutex_unlock(&phydev->lock); ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(phy_get_rate_matching); ++ ++/** + * phy_config_interrupt - configure the PHY device for the requested interrupts + * @phydev: the phy_device struct + * @interrupts: interrupt flags to configure for this @phydev +@@ -268,6 +295,7 @@ void phy_ethtool_ksettings_get(struct ph + cmd->base.duplex = phydev->duplex; + cmd->base.master_slave_cfg = phydev->master_slave_get; + cmd->base.master_slave_state = phydev->master_slave_state; ++ cmd->base.rate_matching = phydev->rate_matching; + if (phydev->interface == PHY_INTERFACE_MODE_MOCA) + cmd->base.port = PORT_BNC; + else +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -280,7 +280,6 @@ static inline const char *phy_modes(phy_ + } + } + +- + #define PHY_INIT_TIMEOUT 100000 + #define PHY_FORCE_TIMEOUT 10 + +@@ -573,6 +572,7 @@ struct macsec_ops; + * @lp_advertising: Current link partner advertised linkmodes + * @eee_broken_modes: Energy efficient ethernet modes which should be prohibited + * @autoneg: Flag autoneg being used ++ * @rate_matching: Current rate matching mode + * @link: Current link state + * @autoneg_complete: Flag auto negotiation of the link has completed + * @mdix: Current crossover +@@ -639,6 +639,8 @@ struct phy_device { + unsigned irq_suspended:1; + unsigned irq_rerun:1; + ++ int rate_matching; ++ + enum phy_state state; + + u32 dev_flags; +@@ -801,6 +803,21 @@ struct phy_driver { + */ + int (*get_features)(struct phy_device *phydev); + ++ /** ++ * @get_rate_matching: Get the supported type of rate matching for a ++ * particular phy interface. This is used by phy consumers to determine ++ * whether to advertise lower-speed modes for that interface. It is ++ * assumed that if a rate matching mode is supported on an interface, ++ * then that interface's rate can be adapted to all slower link speeds ++ * supported by the phy. If iface is %PHY_INTERFACE_MODE_NA, and the phy ++ * supports any kind of rate matching for any interface, then it must ++ * return that rate matching mode (preferring %RATE_MATCH_PAUSE to ++ * %RATE_MATCH_CRS). If the interface is not supported, this should ++ * return %RATE_MATCH_NONE. ++ */ ++ int (*get_rate_matching)(struct phy_device *phydev, ++ phy_interface_t iface); ++ + /* PHY Power Management */ + /** @suspend: Suspend the hardware, saving state if needed */ + int (*suspend)(struct phy_device *phydev); +@@ -967,6 +984,7 @@ struct phy_fixup { + + const char *phy_speed_to_str(int speed); + const char *phy_duplex_to_str(unsigned int duplex); ++const char *phy_rate_matching_to_str(int rate_matching); + + int phy_interface_num_ports(phy_interface_t interface); + +@@ -1675,6 +1693,8 @@ int phy_disable_interrupts(struct phy_de + void phy_request_interrupt(struct phy_device *phydev); + void phy_free_interrupt(struct phy_device *phydev); + void phy_print_status(struct phy_device *phydev); ++int phy_get_rate_matching(struct phy_device *phydev, ++ phy_interface_t iface); + int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); + void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); + void phy_advertise_supported(struct phy_device *phydev); +--- a/include/uapi/linux/ethtool.h ++++ b/include/uapi/linux/ethtool.h +@@ -1809,6 +1809,20 @@ static inline int ethtool_validate_duple + #define MASTER_SLAVE_STATE_SLAVE 3 + #define MASTER_SLAVE_STATE_ERR 4 + ++/* These are used to throttle the rate of data on the phy interface when the ++ * native speed of the interface is higher than the link speed. These should ++ * not be used for phy interfaces which natively support multiple speeds (e.g. ++ * MII or SGMII). ++ */ ++/* No rate matching performed. */ ++#define RATE_MATCH_NONE 0 ++/* The phy sends pause frames to throttle the MAC. */ ++#define RATE_MATCH_PAUSE 1 ++/* The phy asserts CRS to prevent the MAC from transmitting. */ ++#define RATE_MATCH_CRS 2 ++/* The MAC is programmed with a sufficiently-large IPG. */ ++#define RATE_MATCH_OPEN_LOOP 3 ++ + /* Which connector port. */ + #define PORT_TP 0x00 + #define PORT_AUI 0x01 +@@ -2002,8 +2016,8 @@ enum ethtool_reset_flags { + * reported consistently by PHYLIB. Read-only. + * @master_slave_cfg: Master/slave port mode. + * @master_slave_state: Master/slave port state. ++ * @rate_matching: Rate adaptation performed by the PHY + * @reserved: Reserved for future use; see the note on reserved space. +- * @reserved1: Reserved for future use; see the note on reserved space. + * @link_mode_masks: Variable length bitmaps. + * + * If autonegotiation is disabled, the speed and @duplex represent the +@@ -2054,7 +2068,7 @@ struct ethtool_link_settings { + __u8 transceiver; + __u8 master_slave_cfg; + __u8 master_slave_state; +- __u8 reserved1[1]; ++ __u8 rate_matching; + __u32 reserved[7]; + __u32 link_mode_masks[0]; + /* layout of link_mode_masks fields: +--- a/include/uapi/linux/ethtool_netlink.h ++++ b/include/uapi/linux/ethtool_netlink.h +@@ -238,6 +238,7 @@ enum { + ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG, /* u8 */ + ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE, /* u8 */ + ETHTOOL_A_LINKMODES_LANES, /* u32 */ ++ ETHTOOL_A_LINKMODES_RATE_MATCHING, /* u8 */ + + /* add new constants above here */ + __ETHTOOL_A_LINKMODES_CNT, +--- a/net/ethtool/ioctl.c ++++ b/net/ethtool/ioctl.c +@@ -559,6 +559,7 @@ static int ethtool_get_link_ksettings(st + = __ETHTOOL_LINK_MODE_MASK_NU32; + link_ksettings.base.master_slave_cfg = MASTER_SLAVE_CFG_UNSUPPORTED; + link_ksettings.base.master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; ++ link_ksettings.base.rate_matching = RATE_MATCH_NONE; + + return store_link_ksettings_for_user(useraddr, &link_ksettings); + } +--- a/net/ethtool/linkmodes.c ++++ b/net/ethtool/linkmodes.c +@@ -70,6 +70,7 @@ static int linkmodes_reply_size(const st + + nla_total_size(sizeof(u32)) /* LINKMODES_SPEED */ + + nla_total_size(sizeof(u32)) /* LINKMODES_LANES */ + + nla_total_size(sizeof(u8)) /* LINKMODES_DUPLEX */ ++ + nla_total_size(sizeof(u8)) /* LINKMODES_RATE_MATCHING */ + + 0; + ret = ethnl_bitset_size(ksettings->link_modes.advertising, + ksettings->link_modes.supported, +@@ -143,6 +144,10 @@ static int linkmodes_fill_reply(struct s + lsettings->master_slave_state)) + return -EMSGSIZE; + ++ if (nla_put_u8(skb, ETHTOOL_A_LINKMODES_RATE_MATCHING, ++ lsettings->rate_matching)) ++ return -EMSGSIZE; ++ + return 0; + } + diff --git a/target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch b/target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch index cda77e3e2d83ad..a0cb367ba7de45 100644 --- a/target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch +++ b/target/linux/generic/backport-5.15/792-01-v6.0-net-phylink-disable-PCS-polling-over-major-configura.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -756,6 +756,18 @@ static void phylink_resolve_flow(struct +@@ -759,6 +759,18 @@ static void phylink_resolve_flow(struct } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static void phylink_mac_config(struct phylink *pl, const struct phylink_link_state *state) { -@@ -787,6 +799,7 @@ static void phylink_major_config(struct +@@ -790,6 +802,7 @@ static void phylink_major_config(struct const struct phylink_link_state *state) { struct phylink_pcs *pcs = NULL; @@ -44,7 +44,7 @@ Signed-off-by: Jakub Kicinski int err; phylink_dbg(pl, "major config %s\n", phy_modes(state->interface)); -@@ -799,8 +812,12 @@ static void phylink_major_config(struct +@@ -802,8 +815,12 @@ static void phylink_major_config(struct pcs); return; } @@ -57,7 +57,7 @@ Signed-off-by: Jakub Kicinski if (pl->mac_ops->mac_prepare) { err = pl->mac_ops->mac_prepare(pl->config, pl->cur_link_an_mode, state->interface); -@@ -814,8 +831,10 @@ static void phylink_major_config(struct +@@ -817,8 +834,10 @@ static void phylink_major_config(struct /* If we have a new PCS, switch to the new PCS after preparing the MAC * for the change. */ @@ -70,7 +70,7 @@ Signed-off-by: Jakub Kicinski phylink_mac_config(pl, state); -@@ -841,6 +860,8 @@ static void phylink_major_config(struct +@@ -844,6 +863,8 @@ static void phylink_major_config(struct phylink_err(pl, "mac_finish failed: %pe\n", ERR_PTR(err)); } diff --git a/target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch b/target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch index f1f359bad7ac0d..fec2fddfda85e2 100644 --- a/target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch +++ b/target/linux/generic/backport-5.15/792-02-v6.0-net-phylink-fix-NULL-pl-pcs-dereference-during-phyli.patch @@ -27,7 +27,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -764,7 +764,7 @@ static void phylink_pcs_poll_stop(struct +@@ -767,7 +767,7 @@ static void phylink_pcs_poll_stop(struct static void phylink_pcs_poll_start(struct phylink *pl) { diff --git a/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch b/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch index c8176c90f526c1..71b09cbe7592ee 100644 --- a/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch +++ b/target/linux/generic/backport-5.15/792-03-v6.6-net-phylink-add-pcs_enable-pcs_disable-methods.patch @@ -35,7 +35,7 @@ Signed-off-by: David S. Miller bool mac_link_dropped; bool using_mac_select_pcs; -@@ -795,6 +800,22 @@ static void phylink_mac_pcs_an_restart(s +@@ -798,6 +803,22 @@ static void phylink_mac_pcs_an_restart(s } } @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller static void phylink_major_config(struct phylink *pl, bool restart, const struct phylink_link_state *state) { -@@ -832,12 +853,16 @@ static void phylink_major_config(struct +@@ -835,12 +856,16 @@ static void phylink_major_config(struct * for the change. */ if (pcs_changed) { @@ -75,7 +75,7 @@ Signed-off-by: David S. Miller if (pl->pcs_ops) { err = pl->pcs_ops->pcs_config(pl->pcs, pl->cur_link_an_mode, state->interface, -@@ -1261,6 +1286,7 @@ struct phylink *phylink_create(struct ph +@@ -1264,6 +1289,7 @@ struct phylink *phylink_create(struct ph pl->link_config.speed = SPEED_UNKNOWN; pl->link_config.duplex = DUPLEX_UNKNOWN; pl->link_config.an_enabled = true; @@ -83,7 +83,7 @@ Signed-off-by: David S. Miller pl->mac_ops = mac_ops; __set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); timer_setup(&pl->link_poll, phylink_fixed_poll, 0); -@@ -1652,6 +1678,8 @@ void phylink_start(struct phylink *pl) +@@ -1655,6 +1681,8 @@ void phylink_start(struct phylink *pl) if (pl->netdev) netif_carrier_off(pl->netdev); @@ -92,7 +92,7 @@ Signed-off-by: David S. Miller /* Apply the link configuration to the MAC when starting. This allows * a fixed-link to start with the correct parameters, and also * ensures that we set the appropriate advertisement for Serdes links. -@@ -1662,6 +1690,8 @@ void phylink_start(struct phylink *pl) +@@ -1665,6 +1693,8 @@ void phylink_start(struct phylink *pl) */ phylink_mac_initial_config(pl, true); @@ -101,7 +101,7 @@ Signed-off-by: David S. Miller clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); phylink_run_resolve(pl); -@@ -1681,16 +1711,9 @@ void phylink_start(struct phylink *pl) +@@ -1684,16 +1714,9 @@ void phylink_start(struct phylink *pl) poll = true; } @@ -120,7 +120,7 @@ Signed-off-by: David S. Miller if (poll) mod_timer(&pl->link_poll, jiffies + HZ); if (pl->phydev) -@@ -1727,6 +1750,10 @@ void phylink_stop(struct phylink *pl) +@@ -1730,6 +1753,10 @@ void phylink_stop(struct phylink *pl) } phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED); diff --git a/target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch b/target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch index 3e60f91a2a9d4b..6e5ac8b249e486 100644 --- a/target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch +++ b/target/linux/generic/backport-5.15/815-v6.4-05-net-phy-Add-a-binding-for-PHY-LEDs.patch @@ -153,7 +153,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -582,6 +583,7 @@ struct macsec_ops; +@@ -590,6 +591,7 @@ struct macsec_ops; * @phy_num_led_triggers: Number of triggers in @phy_led_triggers * @led_link_trigger: LED trigger for link up/down * @last_triggered: last LED trigger for link speed @@ -161,7 +161,7 @@ Signed-off-by: David S. Miller * @master_slave_set: User requested master/slave configuration * @master_slave_get: Current master/slave advertisement * @master_slave_state: Current master/slave configuration -@@ -668,6 +670,7 @@ struct phy_device { +@@ -678,6 +680,7 @@ struct phy_device { struct phy_led_trigger *led_link_trigger; #endif @@ -169,7 +169,7 @@ Signed-off-by: David S. Miller /* * Interrupt number for this PHY -@@ -739,6 +742,19 @@ struct phy_tdr_config { +@@ -749,6 +752,19 @@ struct phy_tdr_config { #define PHY_PAIR_ALL -1 /** diff --git a/target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch b/target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch index f990557cc73ddf..3968a884b8b017 100644 --- a/target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch +++ b/target/linux/generic/backport-5.15/815-v6.4-06-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch @@ -59,7 +59,7 @@ Signed-off-by: David S. Miller init_data.fwnode = of_fwnode_handle(led); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -745,15 +745,19 @@ struct phy_tdr_config { +@@ -755,15 +755,19 @@ struct phy_tdr_config { * struct phy_led: An LED driven by the PHY * * @list: List of LEDs @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /** * struct phy_driver - Driver structure for a particular PHY type * -@@ -953,6 +957,15 @@ struct phy_driver { +@@ -978,6 +982,15 @@ struct phy_driver { int (*get_sqi)(struct phy_device *dev); /** @get_sqi_max: Get the maximum signal quality indication */ int (*get_sqi_max)(struct phy_device *dev); diff --git a/target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch b/target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch index 4814688de454f4..35e1a1c7238c43 100644 --- a/target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch +++ b/target/linux/generic/backport-5.15/815-v6.4-08-net-phy-phy_device-Call-into-the-PHY-driver-to-set-L.patch @@ -52,7 +52,7 @@ Signed-off-by: David S. Miller init_data.fwnode = of_fwnode_handle(led); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -966,6 +966,18 @@ struct phy_driver { +@@ -991,6 +991,18 @@ struct phy_driver { */ int (*led_brightness_set)(struct phy_device *dev, u8 index, enum led_brightness value); diff --git a/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch b/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch index ef9e706cb41d6c..283e226d16d37e 100644 --- a/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch +++ b/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch @@ -123,7 +123,7 @@ Signed-off-by: Justin Stitt #endif /* _LINUX_ETHTOOL_H */ --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c -@@ -1953,6 +1953,13 @@ __printf(2, 3) void ethtool_sprintf(u8 * +@@ -1954,6 +1954,13 @@ __printf(2, 3) void ethtool_sprintf(u8 * } EXPORT_SYMBOL(ethtool_sprintf); diff --git a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch index a463bf7c4eb4d5..f93d84c6a43c42 100644 --- a/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch +++ b/target/linux/generic/hack-5.15/795-backport-phylink_pcs-helpers.patch @@ -57,7 +57,7 @@ Signed-off-by: Daniel Golle const unsigned long *advertising); --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -931,7 +931,6 @@ static int phylink_change_inband_advert( +@@ -934,7 +934,6 @@ static int phylink_change_inband_advert( return 0; } @@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle static void phylink_mac_pcs_get_state(struct phylink *pl, struct phylink_link_state *state) { -@@ -3015,6 +3014,52 @@ void phylink_mii_c22_pcs_get_state(struc +@@ -3019,6 +3018,52 @@ void phylink_mii_c22_pcs_get_state(struc EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_get_state); /** @@ -118,7 +118,7 @@ Signed-off-by: Daniel Golle * phylink_mii_c22_pcs_set_advertisement() - configure the clause 37 PCS * advertisement * @pcs: a pointer to a &struct mdio_device. -@@ -3086,6 +3131,46 @@ int phylink_mii_c22_pcs_set_advertisemen +@@ -3090,6 +3135,46 @@ int phylink_mii_c22_pcs_set_advertisemen EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_set_advertisement); /** diff --git a/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch index 83587b5c931533..f93dca68141b6f 100644 --- a/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ b/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos sysfs_remove_link(&dev->dev.kobj, "phydev"); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -843,6 +843,12 @@ struct phy_driver { +@@ -868,6 +868,12 @@ struct phy_driver { /** @handle_interrupt: Override default interrupt handling */ irqreturn_t (*handle_interrupt)(struct phy_device *phydev); diff --git a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch index ed5b7b60fb9add..c707e5c8ff079a 100644 --- a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch +++ b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch @@ -38,19 +38,19 @@ Signed-off-by: Gabor Juhos case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_PSGMII: case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_QUSGMII: case PHY_INTERFACE_MODE_SGMII: - case PHY_INTERFACE_MODE_GMII: -@@ -634,6 +635,7 @@ static int phylink_parse_mode(struct phy +@@ -636,6 +637,7 @@ static int phylink_parse_mode(struct phy switch (pl->link_config.interface) { case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_PSGMII: case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_QUSGMII: phylink_set(pl->supported, 10baseT_Half); - phylink_set(pl->supported, 10baseT_Full); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -139,6 +139,7 @@ typedef enum { +@@ -141,6 +141,7 @@ typedef enum { PHY_INTERFACE_MODE_XGMII, PHY_INTERFACE_MODE_XLGMII, PHY_INTERFACE_MODE_MOCA, @@ -58,7 +58,7 @@ Signed-off-by: Gabor Juhos PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TRGMII, PHY_INTERFACE_MODE_100BASEX, -@@ -244,6 +245,8 @@ static inline const char *phy_modes(phy_ +@@ -248,6 +249,8 @@ static inline const char *phy_modes(phy_ return "xlgmii"; case PHY_INTERFACE_MODE_MOCA: return "moca"; diff --git a/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch b/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch index 46c304032db33b..f1ce7cc0ad0fcc 100644 --- a/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch +++ b/target/linux/layerscape/patches-5.15/702-phy-Add-2.5G-SGMII-interface-mode.patch @@ -11,9 +11,19 @@ Signed-off-by: Bhaskar Upadhaya include/linux/phy.h | 3 +++ 1 file changed, 3 insertions(+) +--- a/drivers/net/phy/phy-core.c ++++ b/drivers/net/phy/phy-core.c +@@ -136,6 +136,7 @@ int phy_interface_num_ports(phy_interfac + case PHY_INTERFACE_MODE_RXAUI: + case PHY_INTERFACE_MODE_XAUI: + case PHY_INTERFACE_MODE_1000BASEKX: ++ case PHY_INTERFACE_MODE_2500SGMII: + return 1; + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_QUSGMII: --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -398,6 +398,7 @@ void phylink_get_linkmodes(unsigned long +@@ -400,6 +400,7 @@ void phylink_get_linkmodes(unsigned long caps |= MAC_1000FD; break; @@ -21,7 +31,7 @@ Signed-off-by: Bhaskar Upadhaya case PHY_INTERFACE_MODE_2500BASEX: caps |= MAC_2500FD; break; -@@ -651,6 +652,10 @@ static int phylink_parse_mode(struct phy +@@ -654,6 +655,10 @@ static int phylink_parse_mode(struct phy phylink_set(pl->supported, 2500baseX_Full); break; @@ -34,18 +44,18 @@ Signed-off-by: Bhaskar Upadhaya break; --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -153,6 +153,7 @@ typedef enum { - PHY_INTERFACE_MODE_USXGMII, - /* 10GBASE-KR - with Clause 73 AN */ +@@ -157,6 +157,7 @@ typedef enum { PHY_INTERFACE_MODE_10GKR, + PHY_INTERFACE_MODE_QUSGMII, + PHY_INTERFACE_MODE_1000BASEKX, + PHY_INTERFACE_MODE_2500SGMII, PHY_INTERFACE_MODE_MAX, } phy_interface_t; -@@ -268,6 +269,8 @@ static inline const char *phy_modes(phy_ - return "10gbase-kr"; - case PHY_INTERFACE_MODE_100BASEX: +@@ -276,6 +277,8 @@ static inline const char *phy_modes(phy_ return "100base-x"; + case PHY_INTERFACE_MODE_QUSGMII: + return "qusgmii"; + case PHY_INTERFACE_MODE_2500SGMII: + return "sgmii-2500"; default: diff --git a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch index 437c7611321765..1262e9498d7658 100644 --- a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch +++ b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch @@ -33,7 +33,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c phy_led_trigger_change_speed(phydev); } -@@ -563,7 +563,7 @@ int phy_start_cable_test(struct phy_devi +@@ -591,7 +591,7 @@ int phy_start_cable_test(struct phy_devi goto out; /* Mark the carrier down until the test is complete */ @@ -42,7 +42,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c netif_testing_on(dev); err = phydev->drv->cable_test_start(phydev); -@@ -634,7 +634,7 @@ int phy_start_cable_test_tdr(struct phy_ +@@ -662,7 +662,7 @@ int phy_start_cable_test_tdr(struct phy_ goto out; /* Mark the carrier down until the test is complete */ @@ -51,7 +51,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c netif_testing_on(dev); err = phydev->drv->cable_test_tdr_start(phydev, config); -@@ -706,7 +706,7 @@ static int phy_check_link_status(struct +@@ -734,7 +734,7 @@ static int phy_check_link_status(struct phy_link_up(phydev); } else if (!phydev->link && phydev->state != PHY_NOLINK) { phydev->state = PHY_NOLINK; @@ -60,7 +60,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c } return 0; -@@ -1192,7 +1192,7 @@ void phy_state_machine(struct work_struc +@@ -1220,7 +1220,7 @@ void phy_state_machine(struct work_struc case PHY_HALTED: if (phydev->link) { phydev->link = 0; @@ -95,7 +95,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c phydev->mii_ts->link_state(phydev->mii_ts, phydev); --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1370,7 +1370,8 @@ void phylink_destroy(struct phylink *pl) +@@ -1373,7 +1373,8 @@ void phylink_destroy(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_destroy); @@ -107,7 +107,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c bool tx_pause, rx_pause; --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -706,7 +706,7 @@ struct phy_device { +@@ -716,7 +716,7 @@ struct phy_device { u8 mdix; u8 mdix_ctrl; diff --git a/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch b/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch index 5205a8f9367be4..fc7873a01bfcea 100644 --- a/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch +++ b/target/linux/ramips/patches-5.15/721-NET-no-auto-carrier-off-support.patch @@ -11,7 +11,7 @@ Signed-off-by: John Crispin --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c -@@ -706,7 +706,10 @@ static int phy_check_link_status(struct +@@ -734,7 +734,10 @@ static int phy_check_link_status(struct phy_link_up(phydev); } else if (!phydev->link && phydev->state != PHY_NOLINK) { phydev->state = PHY_NOLINK; @@ -23,7 +23,7 @@ Signed-off-by: John Crispin } return 0; -@@ -1192,7 +1195,10 @@ void phy_state_machine(struct work_struc +@@ -1220,7 +1223,10 @@ void phy_state_machine(struct work_struc case PHY_HALTED: if (phydev->link) { phydev->link = 0; @@ -37,7 +37,7 @@ Signed-off-by: John Crispin break; --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -622,6 +622,7 @@ struct phy_device { +@@ -630,6 +630,7 @@ struct phy_device { unsigned downshifted_rate:1; unsigned is_on_sfp_module:1; unsigned mac_managed_pm:1; diff --git a/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch index 04a110a2339486..bf4d35764e221a 100644 --- a/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch +++ b/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -984,6 +984,10 @@ struct phy_driver { +@@ -1009,6 +1009,10 @@ struct phy_driver { int (*led_blink_set)(struct phy_device *dev, u8 index, unsigned long *delay_on, unsigned long *delay_off); diff --git a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch index 6b24df46748a69..bf6e517cfb9282 100644 --- a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch +++ b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1991,6 +1991,11 @@ int phylink_ethtool_ksettings_set(struct +@@ -1994,6 +1994,11 @@ int phylink_ethtool_ksettings_set(struct * the presence of a PHY, this should not be changed as that * should be determined from the media side advertisement. */ @@ -33,7 +33,7 @@ Submitted-by: John Crispin return phy_ethtool_ksettings_set(pl->phydev, kset); } -@@ -2294,8 +2299,11 @@ int phylink_ethtool_get_eee(struct phyli +@@ -2297,8 +2302,11 @@ int phylink_ethtool_get_eee(struct phyli ASSERT_RTNL(); @@ -46,7 +46,7 @@ Submitted-by: John Crispin return ret; } -@@ -2312,8 +2320,11 @@ int phylink_ethtool_set_eee(struct phyli +@@ -2315,8 +2323,11 @@ int phylink_ethtool_set_eee(struct phyli ASSERT_RTNL(); diff --git a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch index 2048e22f2e5aba..700ec97be86e17 100644 --- a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch +++ b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch @@ -13,9 +13,19 @@ Submitted-by: Birger Koblitz include/linux/phy.h | 3 +++ 2 file changed, 5 insertions(+) +--- a/drivers/net/phy/phy-core.c ++++ b/drivers/net/phy/phy-core.c +@@ -124,6 +124,7 @@ int phy_interface_num_ports(phy_interfac + case PHY_INTERFACE_MODE_MOCA: + case PHY_INTERFACE_MODE_TRGMII: + case PHY_INTERFACE_MODE_USXGMII: ++ case PHY_INTERFACE_MODE_HSGMII: + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_SMII: + case PHY_INTERFACE_MODE_1000BASEX: --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -408,6 +408,7 @@ void phylink_get_linkmodes(unsigned long +@@ -410,6 +410,7 @@ void phylink_get_linkmodes(unsigned long case PHY_INTERFACE_MODE_XGMII: case PHY_INTERFACE_MODE_RXAUI: @@ -23,7 +33,7 @@ Submitted-by: Birger Koblitz case PHY_INTERFACE_MODE_XAUI: case PHY_INTERFACE_MODE_10GBASER: case PHY_INTERFACE_MODE_10GKR: -@@ -662,6 +663,7 @@ static int phylink_parse_mode(struct phy +@@ -665,6 +666,7 @@ static int phylink_parse_mode(struct phy fallthrough; case PHY_INTERFACE_MODE_USXGMII: case PHY_INTERFACE_MODE_10GKR: @@ -33,7 +43,7 @@ Submitted-by: Birger Koblitz phylink_set(pl->supported, 10baseT_Full); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -139,6 +139,7 @@ typedef enum { +@@ -141,6 +141,7 @@ typedef enum { PHY_INTERFACE_MODE_XGMII, PHY_INTERFACE_MODE_XLGMII, PHY_INTERFACE_MODE_MOCA, @@ -41,7 +51,7 @@ Submitted-by: Birger Koblitz PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TRGMII, PHY_INTERFACE_MODE_100BASEX, -@@ -244,6 +245,8 @@ static inline const char *phy_modes(phy_ +@@ -248,6 +249,8 @@ static inline const char *phy_modes(phy_ return "xlgmii"; case PHY_INTERFACE_MODE_MOCA: return "moca"; diff --git a/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch b/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch index 56ce80bb20bdb3..9a6b00d7c0e185 100644 --- a/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch +++ b/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -280,7 +280,7 @@ static inline const char *phy_modes(phy_ +@@ -287,7 +287,7 @@ static inline const char *phy_modes(phy_ #define PHY_INIT_TIMEOUT 100000 #define PHY_FORCE_TIMEOUT 10 diff --git a/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch b/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch index b0a8fadb5f4fbb..188d68b1219005 100644 --- a/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch +++ b/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch @@ -443,7 +443,7 @@ Signed-off-by: Daniel Golle * @dev: target MDIO device --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c -@@ -482,10 +482,16 @@ int __phy_read_mmd(struct phy_device *ph +@@ -557,10 +557,16 @@ int __phy_read_mmd(struct phy_device *ph struct mii_bus *bus = phydev->mdio.bus; int phy_addr = phydev->mdio.addr; @@ -464,7 +464,7 @@ Signed-off-by: Daniel Golle } return val; } -@@ -538,12 +544,18 @@ int __phy_write_mmd(struct phy_device *p +@@ -613,12 +619,18 @@ int __phy_write_mmd(struct phy_device *p struct mii_bus *bus = phydev->mdio.bus; int phy_addr = phydev->mdio.addr; @@ -487,7 +487,7 @@ Signed-off-by: Daniel Golle } return ret; } -@@ -749,6 +761,13 @@ EXPORT_SYMBOL_GPL(phy_modify_mmd); +@@ -824,6 +836,13 @@ EXPORT_SYMBOL_GPL(phy_modify_mmd); static int __phy_read_page(struct phy_device *phydev) { @@ -501,7 +501,7 @@ Signed-off-by: Daniel Golle if (WARN_ONCE(!phydev->drv->read_page, "read_page callback not available, PHY driver not loaded?\n")) return -EOPNOTSUPP; -@@ -757,6 +776,13 @@ static int __phy_read_page(struct phy_de +@@ -832,6 +851,13 @@ static int __phy_read_page(struct phy_de static int __phy_write_page(struct phy_device *phydev, int page) { @@ -515,7 +515,7 @@ Signed-off-by: Daniel Golle if (WARN_ONCE(!phydev->drv->write_page, "write_page callback not available, PHY driver not loaded?\n")) return -EOPNOTSUPP; -@@ -858,6 +884,18 @@ int phy_read_paged(struct phy_device *ph +@@ -933,6 +959,18 @@ int phy_read_paged(struct phy_device *ph { int ret = 0, oldpage; @@ -534,7 +534,7 @@ Signed-off-by: Daniel Golle oldpage = phy_select_page(phydev, page); if (oldpage >= 0) ret = __phy_read(phydev, regnum); -@@ -879,6 +917,18 @@ int phy_write_paged(struct phy_device *p +@@ -954,6 +992,18 @@ int phy_write_paged(struct phy_device *p { int ret = 0, oldpage; @@ -665,7 +665,7 @@ Signed-off-by: Daniel Golle #define MDIO_DEVICE_IS_PHY 0x80000000 /** -@@ -421,6 +422,22 @@ struct mii_bus { +@@ -428,6 +429,22 @@ struct mii_bus { /** @shared: shared state across different PHYs */ struct phy_package_shared *shared[PHY_MAX_ADDR]; @@ -688,7 +688,7 @@ Signed-off-by: Daniel Golle }; #define to_mii_bus(d) container_of(d, struct mii_bus, dev) -@@ -1795,6 +1812,66 @@ static inline int __phy_package_read(str +@@ -1825,6 +1842,66 @@ static inline int __phy_package_read(str return __mdiobus_read(phydev->mdio.bus, shared->addr, regnum); } @@ -755,7 +755,7 @@ Signed-off-by: Daniel Golle static inline int phy_package_write(struct phy_device *phydev, u32 regnum, u16 val) { -@@ -1817,6 +1894,72 @@ static inline int __phy_package_write(st +@@ -1847,6 +1924,72 @@ static inline int __phy_package_write(st return __mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val); } From c82ca6dc743f382533693de4826747ec0ee16ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 30 Jan 2024 21:41:26 +0100 Subject: [PATCH 0734/1171] bcm27xx: base-files: properly detect boot partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatically detect boot partition instead of forcing /dev/mmcblk0p1. This way users can still get /boot mounted when booting from USB. (cherry picked from commit a39176010299f3ad7d325b03d892fbf65e6dd23b) Signed-off-by: Álvaro Fernández Rojas --- .../bcm27xx/base-files/lib/preinit/79_move_config | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/linux/bcm27xx/base-files/lib/preinit/79_move_config b/target/linux/bcm27xx/base-files/lib/preinit/79_move_config index c9fb59a64fe62e..db5bf93b626b00 100644 --- a/target/linux/bcm27xx/base-files/lib/preinit/79_move_config +++ b/target/linux/bcm27xx/base-files/lib/preinit/79_move_config @@ -2,16 +2,20 @@ . /lib/upgrade/common.sh -BOOTPART=/dev/mmcblk0p1 - move_config() { - if [ -b $BOOTPART ]; then + local partdev + + export_bootdevice && export_partdevice partdev 1 || { + partdev=mmcblk0p1 + } + + if [ -b "/dev/$partdev" ]; then insmod nls_cp437 insmod nls_iso8859-1 insmod fat insmod vfat mkdir -p /boot - mount -t vfat -o rw,noatime $BOOTPART /boot + mount -t vfat -o rw,noatime /dev/$partdev /boot [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" / fi } From 9a869950c11e3701bee034b7ee398752be3bda22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 30 Jan 2024 20:12:25 +0100 Subject: [PATCH 0735/1171] bcm27xx: improve image generation script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Exit immediately on a non-zero status. - Remove empty lines. - Remove unused variables. - Add missing ptgen variables for readability. - Refactor SYNTAX if block. (cherry picked from commit 96b03ff2476edb4d08fb4b91fdf80be7aa95ddd8) Signed-off-by: Álvaro Fernández Rojas --- .../linux/bcm27xx/image/gen_rpi_sdcard_img.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh b/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh index 5e8fb2769c41ee..488a3517c735ae 100755 --- a/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh +++ b/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh @@ -1,10 +1,11 @@ #!/bin/sh -set -x -[ $# -eq 5 ] || { +set -e -x + +if [ $# -ne 5 ]; then echo "SYNTAX: $0 " exit 1 -} +fi OUTPUT="$1" BOOTFS="$2" @@ -12,18 +13,16 @@ ROOTFS="$3" BOOTFSSIZE="$4" ROOTFSSIZE="$5" +align=4096 head=4 +kernel_type=c +rootfs_type=83 sect=63 -set $(ptgen -o $OUTPUT -h $head -s $sect -l 4096 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M) +set $(ptgen -o $OUTPUT -h $head -s $sect -l $align -t $kernel_type -p ${BOOTFSSIZE}M -t $rootfs_type -p ${ROOTFSSIZE}M) BOOTOFFSET="$(($1 / 512))" -BOOTSIZE="$(($2 / 512))" ROOTFSOFFSET="$(($3 / 512))" -ROOTFSSIZE="$(($4 / 512))" dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc - - - From be7d9da7be19d26f7a6601aa7b822dd811dc3d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 31 Jan 2024 12:36:49 +0100 Subject: [PATCH 0736/1171] bcm27xx: base-files: fix platform_copy_config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only bcm2708 and bcm2709 use "kernel.img" file name. bcm2710 and bcm2711 use "kernel8.img" and bcm2712 uses "kernel_2712.img". (cherry picked from commit 1a5e51ab0011796fae5b08d03de3994c767517c1) Signed-off-by: Álvaro Fernández Rojas --- target/linux/bcm27xx/base-files/lib/upgrade/platform.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh index a48b7cc08a3ee5..956bc1c7886ae1 100644 --- a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh @@ -90,7 +90,7 @@ platform_copy_config() { if export_partdevice partdev 1; then mkdir -p /boot - [ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot + [ -f "/boot/kernel*.img" ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE" tar -C / -zxvf "$UPGRADE_BACKUP" boot/cmdline.txt boot/config.txt sync From 3a23eed4dcb3dddbe41812dd69f6956e86189205 Mon Sep 17 00:00:00 2001 From: Stijn Segers Date: Sun, 4 Feb 2024 13:20:32 +0100 Subject: [PATCH 0737/1171] realtek: fix zyxel-vers usage for XGS1250-12 Commit daefc646e6d4 ("realtek: fix ZyXEL initramfs image generation") fixed a shell expansion issue with zyxel-vers usage. Commit 045baca10b15 ("realtek: deduplicate GS1900 recipes") took care of this for the rtl838x and rtl839x subtargets, but the single device officially supported in rtl930x - the XGS1250-12 - was overlooked. This commit updates the XGS1250-12 build recipe as well. Signed-off-by: Stijn Segers (cherry picked from commit 557db5106ce7809a5b2f1ec6d2407c1f32d10ef7) --- target/linux/realtek/image/rtl930x.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/image/rtl930x.mk b/target/linux/realtek/image/rtl930x.mk index f55c5c002bf03d..891a18c517306a 100644 --- a/target/linux/realtek/image/rtl930x.mk +++ b/target/linux/realtek/image/rtl930x.mk @@ -11,7 +11,7 @@ define Device/zyxel_xgs1250-12 kernel-bin | \ append-dtb | \ gzip | \ - zyxel-vers $$$$(ZYXEL_VERS) | \ + zyxel-vers | \ uImage gzip endef TARGET_DEVICES += zyxel_xgs1250-12 From 9ee626f94505eeb71e9cdab19af216eb1c9f2a15 Mon Sep 17 00:00:00 2001 From: Chad Monroe Date: Tue, 16 Jan 2024 15:44:33 -0800 Subject: [PATCH 0738/1171] ucode: add libjson-c/host dependency ensure host libjson-c is built prior to ucode Signed-off-by: Chad Monroe (cherry picked from commit 5a3f6c50ef29c8b11fe6967e65277b8331be0ff0) --- package/utils/ucode/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 8a6274739ed52d..c1fadd817a4468 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -19,6 +19,7 @@ PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC PKG_ABI_VERSION:=20230711 +HOST_BUILD_DEPENDS:=libjson-c/host include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk From aa762ada8089e588f1734cd25dc8c236a867661f Mon Sep 17 00:00:00 2001 From: Ivan Pavlov Date: Fri, 2 Feb 2024 08:46:52 +0300 Subject: [PATCH 0739/1171] openssl: update to 3.0.13 Major changes between OpenSSL 3.0.12 and OpenSSL 3.0.13 [30 Jan 2024] * Fixed PKCS12 Decoding crashes ([CVE-2024-0727]) * Fixed Excessive time spent checking invalid RSA public keys ([CVE-2023-6237]) * Fixed POLY1305 MAC implementation corrupting vector registers on PowerPC CPUs which support PowerISA 2.07 ([CVE-2023-6129]) * Fix excessive time spent in DH check / generation with large Q parameter value ([CVE-2023-5678]) Signed-off-by: Ivan Pavlov (cherry picked from commit 44cd90c49a7457345c0fba186d5d762d3a04d854) --- package/libs/openssl/Makefile | 4 ++-- .../libs/openssl/patches/100-Configure-afalg-support.patch | 2 +- .../libs/openssl/patches/140-allow-prefer-chacha20.patch | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 4b1388e7af6d49..3bb60bc5ed7531 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl -PKG_VERSION:=3.0.12 +PKG_VERSION:=3.0.13 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto @@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 +PKG_HASH:=88525753f79d3bec27d2fa7c66aa0b92b3aa9498dafd93d7cfa4b3780cdae313 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/openssl/patches/100-Configure-afalg-support.patch b/package/libs/openssl/patches/100-Configure-afalg-support.patch index 307e23b80924da..e9cd7bf9c1afa6 100644 --- a/package/libs/openssl/patches/100-Configure-afalg-support.patch +++ b/package/libs/openssl/patches/100-Configure-afalg-support.patch @@ -10,7 +10,7 @@ Signed-off-by: Eneas U de Queiroz --- a/Configure +++ b/Configure -@@ -1674,7 +1674,9 @@ $config{CFLAGS} = [ map { $_ eq '--ossl- +@@ -1677,7 +1677,9 @@ $config{CFLAGS} = [ map { $_ eq '--ossl- unless ($disabled{afalgeng}) { $config{afalgeng}=""; diff --git a/package/libs/openssl/patches/140-allow-prefer-chacha20.patch b/package/libs/openssl/patches/140-allow-prefer-chacha20.patch index 43fd92e3886cff..fb7bc8436174c0 100644 --- a/package/libs/openssl/patches/140-allow-prefer-chacha20.patch +++ b/package/libs/openssl/patches/140-allow-prefer-chacha20.patch @@ -16,7 +16,7 @@ Signed-off-by: Eneas U de Queiroz --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c -@@ -1505,11 +1505,29 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ +@@ -1506,11 +1506,29 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail); @@ -46,7 +46,7 @@ Signed-off-by: Eneas U de Queiroz /* * ...and generally, our preferred cipher is AES. -@@ -1564,7 +1582,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ +@@ -1565,7 +1583,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ * Within each group, ciphers remain sorted by strength and previous * preference, i.e., * 1) ECDHE > DHE @@ -55,7 +55,7 @@ Signed-off-by: Eneas U de Queiroz * 3) AES > rest * 4) TLS 1.2 > legacy * -@@ -2235,7 +2253,13 @@ const char *OSSL_default_cipher_list(voi +@@ -2236,7 +2254,13 @@ const char *OSSL_default_cipher_list(voi */ const char *OSSL_default_ciphersuites(void) { From c51d49ba3974ff9e350261bc023970f1d809962e Mon Sep 17 00:00:00 2001 From: Yuu Toriyama Date: Sun, 4 Feb 2024 04:09:14 +0900 Subject: [PATCH 0740/1171] wireless-regdb: update to 2024.01.23 The maintainer and repository of wireless-regdb has changed. https://lore.kernel.org/all/CAGb2v657baNMPKU3QADijx7hZa=GUcSv2LEDdn6N=QQaFX8r-g@mail.gmail.com/ Changes: 37dcea0 wireless-regdb: Update keys and maintainer information 9e0aee6 wireless-regdb: Makefile: Reproducible signatures 8c784a1 wireless-regdb: Update regulatory rules for China (CN) 149c709 wireless-regdb: Update regulatory rules for Japan (JP) for December 2023 bd69898 wireless-regdb: Update regulatory rules for Singapore (SG) for September 2023 d695bf2 wireless-regdb: Update and disable 5470-5730MHz band according to TPC requirement for Singapore (SG) 4541300 wireless-regdb: update regulatory database based on preceding changes Signed-off-by: Yuu Toriyama (cherry picked from commit b463737826eaa6c519eba93e13757a0cd3e09d47) --- package/firmware/wireless-regdb/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/firmware/wireless-regdb/Makefile b/package/firmware/wireless-regdb/Makefile index dfff35ff4d7edc..431d07c35b8cac 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-regdb -PKG_VERSION:=2023.09.01 +PKG_VERSION:=2024.01.23 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/ -PKG_HASH:=26d4c2a727cc59239b84735aad856b7c7d0b04e30aa5c235c4f7f47f5f053491 +PKG_HASH:=c8a61c9acf76fa7eb4239e89f640dee3e87098d9f69b4d3518c9c60fc6d20c55 PKG_MAINTAINER:=Felix Fietkau @@ -16,7 +16,7 @@ define Package/wireless-regdb PKGARCH:=all SECTION:=firmware CATEGORY:=Firmware - URL:=https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git/ + URL:=https://git.kernel.org/pub/scm/linux/kernel/git/wens/wireless-regdb.git/ TITLE:=Wireless Regulatory Database endef From 9e41117953e31ffe355416e962ecf0e000dc594d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Feb 2024 09:17:50 +0100 Subject: [PATCH 0741/1171] ipq40xx: fix PHY subsystem compilation (phy_interface_num_ports()) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: drivers/net/phy/phy-core.c: In function 'phy_interface_num_ports': drivers/net/phy/phy-core.c:107:9: error: enumeration value 'PHY_INTERFACE_MODE_PSGMII' not handled in switch [-Werror=switch] 107 | switch (interface) { | ^~~~~~ Fixes: 8a7f667fb53e ("kernel: 5.15: backport v6.1 PHY changes required for Aquantia") Fixes: https://github.com/openwrt/openwrt/issues/14560 Signed-off-by: Rafał Miłecki --- ...704-net-phy-define-PSGMII-PHY-interface-mode.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch index c707e5c8ff079a..1cc8ec1f0340ca 100644 --- a/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch +++ b/target/linux/ipq40xx/patches-5.15/704-net-phy-define-PSGMII-PHY-interface-mode.patch @@ -30,6 +30,17 @@ Signed-off-by: Gabor Juhos - qsgmii - tbi - rev-mii +--- a/drivers/net/phy/phy-core.c ++++ b/drivers/net/phy/phy-core.c +@@ -140,6 +140,8 @@ int phy_interface_num_ports(phy_interfac + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_QUSGMII: + return 4; ++ case PHY_INTERFACE_MODE_PSGMII: ++ return 5; + case PHY_INTERFACE_MODE_MAX: + WARN_ONCE(1, "PHY_INTERFACE_MODE_MAX isn't a valid interface mode"); + return 0; --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -371,6 +371,7 @@ void phylink_get_linkmodes(unsigned long From b79583c97513bebcea1e4a47792b0cf112dcbd68 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 9 Feb 2024 12:18:57 +0100 Subject: [PATCH 0742/1171] wifi-scripts: fix fullmac phy detection Checking for AP_VLAN misdetects ath10k-ath12k as fullmac, because of software crypto limitations. Check for monitor mode support instead, which is more reliable. Fixes: https://github.com/openwrt/openwrt/issues/14575 Signed-off-by: Felix Fietkau (cherry picked from commit 2b4941a6f16fa1c045cb2f4a8fc09adc64fecd63) --- package/network/services/hostapd/files/common.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/files/common.uc b/package/network/services/hostapd/files/common.uc index 4c33779af935e1..750e3ae71c27da 100644 --- a/package/network/services/hostapd/files/common.uc +++ b/package/network/services/hostapd/files/common.uc @@ -49,7 +49,7 @@ function __phy_is_fullmac(phyidx) { let data = nl80211.request(nl80211.const.NL80211_CMD_GET_WIPHY, 0, { wiphy: phyidx }); - return !data.software_iftypes.ap_vlan; + return !data.software_iftypes.monitor; } function phy_is_fullmac(phy) From 633eb115b527654708639faeac22d1befbbc634e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 10 Feb 2024 12:44:08 +0100 Subject: [PATCH 0743/1171] firmware-utils: Fix PKG_MIRROR_HASH This fixes the PKG_MIRROR_HASH. Fixes: 5eb578a4fb8d ("firmware-utils: bump to latest openwrt-23.05") Signed-off-by: Hauke Mehrtens --- tools/firmware-utils/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 2e5591ab4a9640..4f948deaf764f3 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -13,7 +13,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git PKG_SOURCE_DATE:=2024-01-31 PKG_SOURCE_VERSION:=c46b4b4ad7e77aab555bb41d6adc5554d11a83e8 -PKG_MIRROR_HASH:=666edb5e9ddb84b1eb54d5b978efdb29ace641d1fe12fc8e7db42130dceaf3aa +PKG_MIRROR_HASH:=4affc0a85368ec8fc6df3719c628dd88b13ce6cc46ba2a52741a61d089e25e51 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From 80c8d659338526103a8f55a47ce744e0a02fcb32 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 7 Feb 2024 21:30:52 +0100 Subject: [PATCH 0744/1171] toolchain: glibc: Update glibc 2.37 to recent HEAD 512e30fd56 Revert "elf: Remove unused l_text_end field from struct link_map" 55d3dfadf8 Revert "elf: Always call destructors in reverse constructor order (bug 30785)" 8e20aedfd7 Revert "elf: Move l_init_called_next to old place of l_text_end in link map" 5014fb12f4 elf: Fix wrong break removal from 8ee878592c 874d418697 elf: Fix TLS modid reuse generation assignment (BZ 29039) 8bd00f5b6d x86-64: Fix the dtv field load for x32 [BZ #31184] d052665f35 x86-64: Fix the tcb field load for x32 [BZ #31185] 0ca9ba3a9e NEWS: Mention bug fixes for 29039/30745/30843 9b90e763db getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163) bd9f194c34 libio: Check remaining buffer size in _IO_wdo_write (bug 31183) 8b8a3f0aaf sunrpc: Fix netname build with older gcc 97a4292aa4 syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6246) 67062eccd9 syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6779) 2b58cba076 syslog: Fix integer overflow in __vsyslog_internal (CVE-2023-6780) 1d8bb622df i386: Use pthread_barrier for synchronization on tst-bz21269 32450f6e8d sysdeps: tst-bz21269: fix test parameter f7e97cea20 sysdeps: tst-bz21269: handle ENOSYS & skip appropriately d97929eadc sysdeps: tst-bz21269: fix -Wreturn-type 5bbe7e0da5 x86_64: Optimize ffsll function code size. 98ec3e004e sparc: Fix broken memset for sparc32 [BZ #31068] 2ce7abef67 sparc64: Remove unwind information from signal return stubs [BZ#31244] 18da90677c sparc: Fix sparc64 memmove length comparison (BZ 31266) 8b849f70b3 sparc: Remove unwind information from signal return stubs [BZ #31244] eee7525d35 arm: Remove wrong ldr from _dl_start_user (BZ 31339) Signed-off-by: Hauke Mehrtens (cherry picked from commit 2ef5714277ce32d0dc7d59e59f20591004f070c4) --- toolchain/glibc/common.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 18413cd271af54..c67187c1c16d95 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -12,8 +12,8 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=b4e23c75aea756b4bddc4abcf27a1c6dca8b6bd3 -PKG_MIRROR_HASH:=4d5b3de6ec7b47427700f74fdb529e32083b54a512f6ca86ec824a61092ecdd4 +PKG_SOURCE_VERSION:=eee7525d35ec16bbe81435e41079ab72519d825c +PKG_MIRROR_HASH:=fad5a67d9622b75bce5e3e8c91b07a6df0bf8b21cb001a6d06019a6ce4cff31f PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz PKG_CPE_ID:=cpe:/a:gnu:glibc From 183c0d530de3480917dafcffc1e5223ecff27935 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 8 Feb 2024 00:49:27 +0100 Subject: [PATCH 0745/1171] kernel-build.mk: add support for compiling only DTS Add support for compiling DTS for the selected target. This can be useful for testing if the DTS correctly compile and doesn't produce any error. This adds a new make target. To compile only DTS use: make target/linux/dtb Signed-off-by: Christian Marangi (cherry picked from commit c47532b1ea7f8459f05a223a71317a1461c6e750) --- include/image.mk | 10 ++++++---- include/kernel-build.mk | 4 ++++ include/subdir.mk | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/image.mk b/include/image.mk index dc53fe8b25f268..97cde011ce5da1 100644 --- a/include/image.mk +++ b/include/image.mk @@ -575,7 +575,7 @@ define Device/Build/dtb $(KDIR)/image-$(1).dtb: FORCE $(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@) - image_prepare: $(KDIR)/image-$(1).dtb + compile-dtb: $(KDIR)/image-$(1).dtb endif endef @@ -586,7 +586,7 @@ define Device/Build/dtbo $(KDIR)/image-$(1).dtbo: FORCE $(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@) - image_prepare: $(KDIR)/image-$(1).dtbo + compile-dtb: $(KDIR)/image-$(1).dtbo endif endef @@ -823,18 +823,20 @@ define BuildImage download: prepare: compile: + compile-dtb: clean: image_prepare: ifeq ($(IB),) - .PHONY: download prepare compile clean image_prepare kernel_prepare install install-images + .PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images compile: $(call Build/Compile) clean: $(call Build/Clean) - image_prepare: compile + compile-dtb: + image_prepare: compile compile-dtb mkdir -p $(BIN_DIR) $(KDIR)/tmp rm -rf $(BUILD_DIR)/json_info_files $(call Image/Prepare) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 5b332258f8b8c5..435a2fecea0e30 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -156,6 +156,10 @@ define BuildKernel compile: $(LINUX_DIR)/.modules $(MAKE) -C image compile TARGET_BUILD= + dtb: $(STAMP_CONFIGURED) + $(_SINGLE)$(KERNEL_MAKE) scripts_dtc + $(MAKE) -C image compile-dtb TARGET_BUILD= + oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE rm -f $(LINUX_DIR)/.config.prev rm -f $(STAMP_CONFIGURED) diff --git a/include/subdir.mk b/include/subdir.mk index 95009f814e29d4..b4edbf8b96c784 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -5,6 +5,9 @@ ifeq ($(MAKECMDGOALS),prereq) SUBTARGETS:=prereq PREREQ_ONLY:=1 +# For target/linux related target add dtb to selectively compile dtbs +else ifneq ($(filter target/linux/%,$(MAKECMDGOALS)),) + SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) dtb else SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) endif From fbe86d0e91b26a9526ff7f55e3ac5ed4543914c2 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 8 Feb 2024 23:04:55 +0100 Subject: [PATCH 0746/1171] linux: add dtb makefile target to targets list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add dtb makefile target to targets list to permit correct working of make target/linux/dtb Fixes: c47532b1ea7f ("kernel-buildOnmk: add support for compiling only DTS") Signed-off-by: Christian Marangi (cherry picked from commit c4910e9cb37c626ab9f4a47579bc8ec8981cdf4a) --- target/linux/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/Makefile b/target/linux/Makefile index 8eea40ee18a6dd..eaf31982229677 100644 --- a/target/linux/Makefile +++ b/target/linux/Makefile @@ -7,5 +7,5 @@ include $(INCLUDE_DIR)/target.mk export TARGET_BUILD=1 -prereq clean download prepare compile install oldconfig menuconfig nconfig xconfig update refresh: FORCE +prereq clean download prepare compile install oldconfig menuconfig nconfig xconfig update refresh dtb: FORCE @+$(NO_TRACE_MAKE) -C $(firstword $(wildcard feeds/$(BOARD) $(BOARD))) $@ From 1c28058710fd524054f364deb2b5efc754d695e4 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 26 Jan 2024 16:55:30 -0500 Subject: [PATCH 0747/1171] kernel: bump 5.15 to 5.15.148 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.148 Removed upstreamed: generic/hack-5.15/321-powerpc_crtsavres_prereq.patch[1] Manually rebased: target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch[2] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.148&id=0b11a145eb00d51f7ef18cfcae587b93f9adb1e9 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?h=v5.15.148&id=b67064bd372300a75293efbbc70624996dccffd4 Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia (cherry picked from commit 99c9d8abd6779d41b763108f877c068f16b19c17) [Refresh on OpenWrt 23.05] Signed-off-by: Hauke Mehrtens --- include/kernel-5.15 | 4 +- ...ds-add-reset-controller-based-driver.patch | 2 +- ...835-Support-setting-reboot-partition.patch | 6 +- ...is7xx-Don-t-spin-if-no-data-received.patch | 2 +- ...6is7xx-Fix-for-hardware-flow-control.patch | 6 +- ...-Ignore-params-after-the-partition-n.patch | 2 +- ...ved-syscon_regmap_lookup_by_pdevname.patch | 2 +- ...rt-for-Sercomm-MSP430-LED-controller.patch | 2 +- ...k-gate-Add-devm_clk_hw_register_gate.patch | 4 +- ...icro-stmmac-move-queue-reset-to-dedi.patch | 10 +- ...icro-stmmac-first-disable-all-queues.patch | 4 +- ...icro-stmmac-move-dma-conf-to-dedicat.patch | 98 +++++++++---------- ...icro-stmmac-generate-stmmac-dma-conf.patch | 24 ++--- ...icro-stmmac-permit-MTU-change-with-i.patch | 4 +- ...ll-of_parse_phandle-variants-static-.patch | 8 +- ...-of_parse_phandle_with_optional_args.patch | 2 +- ...0004-of-Move-of_modalias-to-module.c.patch | 2 +- ...uest-module-helper-logic-to-module.c.patch | 2 +- .../321-powerpc_crtsavres_prereq.patch | 38 ------- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- ...vm_-hw_register_mux_parent_data_tabl.patch | 2 +- ...stmmac-Use-hrtimer-for-TX-coalescing.patch | 12 +-- ...ert-PERST-for-100ms-for-power-and-cl.patch | 2 +- ...ediatek-add-support-for-coherent-DMA.patch | 2 +- ...move-drivers-from-strlcpy-to-strscpy.patch | 4 +- ...a-support-HW-controlled-mode-via-pri.patch | 2 +- ...d-the-IEI-WT61P803-PUZZLE-LED-driver.patch | 2 +- ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 2 +- ...IPS-ralink-add-sdhci-for-mt7620a-SoC.patch | 2 +- 29 files changed, 108 insertions(+), 146 deletions(-) delete mode 100644 target/linux/generic/hack-5.15/321-powerpc_crtsavres_prereq.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 5cc07434b2a6cd..d93ae194b8aa1c 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .147 -LINUX_KERNEL_HASH-5.15.147 = 56c1e65625d201db431efda7a3816e7b424071e7cb0245b2ba594d15b1fdfcd4 +LINUX_VERSION-5.15 = .148 +LINUX_KERNEL_HASH-5.15.148 = c48575c97fd9f4767cbe50a13b1b2b40ee42830aba3182fabd35a03259a6e5d8 diff --git a/target/linux/ath79/patches-5.15/0003-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-5.15/0003-leds-add-reset-controller-based-driver.patch index 7122756c526687..9daea4c95ab4b5 100644 --- a/target/linux/ath79/patches-5.15/0003-leds-add-reset-controller-based-driver.patch +++ b/target/linux/ath79/patches-5.15/0003-leds-add-reset-controller-based-driver.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -876,6 +876,17 @@ source "drivers/leds/blink/Kconfig" +@@ -877,6 +877,17 @@ source "drivers/leds/blink/Kconfig" comment "Flash and Torch LED drivers" source "drivers/leds/flash/Kconfig" diff --git a/target/linux/bcm27xx/patches-5.15/950-0043-watchdog-bcm2835-Support-setting-reboot-partition.patch b/target/linux/bcm27xx/patches-5.15/950-0043-watchdog-bcm2835-Support-setting-reboot-partition.patch index fde67981807a9b..44cfcd64e1cc64 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0043-watchdog-bcm2835-Support-setting-reboot-partition.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0043-watchdog-bcm2835-Support-setting-reboot-partition.patch @@ -36,7 +36,7 @@ Signed-off-by: Noralf Trønnes #define SECS_TO_WDOG_TICKS(x) ((x) << 16) #define WDOG_TICKS_TO_SECS(x) ((x) >> 16) -@@ -97,9 +91,24 @@ static unsigned int bcm2835_wdt_get_time +@@ -98,9 +92,24 @@ static unsigned int bcm2835_wdt_get_time return WDOG_TICKS_TO_SECS(ret & PM_WDOG_TIME_SET); } @@ -63,7 +63,7 @@ Signed-off-by: Noralf Trønnes /* use a timeout of 10 ticks (~150us) */ writel_relaxed(10 | PM_PASSWORD, wdt->base + PM_WDOG); -@@ -117,7 +126,13 @@ static int bcm2835_restart(struct watchd +@@ -118,7 +127,13 @@ static int bcm2835_restart(struct watchd { struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog); @@ -78,7 +78,7 @@ Signed-off-by: Noralf Trønnes return 0; } -@@ -152,19 +167,9 @@ static struct watchdog_device bcm2835_wd +@@ -153,19 +168,9 @@ static struct watchdog_device bcm2835_wd static void bcm2835_power_off(void) { struct bcm2835_wdt *wdt = bcm2835_power_off_wdt; diff --git a/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch b/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch index 711bd0025f3de4..f2016a48ad7c3c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0108-sc16is7xx-Don-t-spin-if-no-data-received.patch @@ -12,7 +12,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c -@@ -708,6 +708,8 @@ static bool sc16is7xx_port_irq(struct sc +@@ -709,6 +709,8 @@ static bool sc16is7xx_port_irq(struct sc if (rxlen) sc16is7xx_handle_rx(port, rxlen, iir); diff --git a/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch b/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch index 88b3a6125efe77..ce66193e7744f2 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0231-sc16is7xx-Fix-for-hardware-flow-control.patch @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c -@@ -523,8 +523,9 @@ static int sc16is7xx_set_baud(struct uar +@@ -524,8 +524,9 @@ static int sc16is7xx_set_baud(struct uar /* Enable enhanced features */ regcache_cache_bypass(s->regmap, true); @@ -38,7 +38,7 @@ Signed-off-by: Phil Elwell regcache_cache_bypass(s->regmap, false); /* Put LCR back to the normal mode */ -@@ -854,7 +855,7 @@ static unsigned int sc16is7xx_get_mctrl( +@@ -855,7 +856,7 @@ static unsigned int sc16is7xx_get_mctrl( /* DCD and DSR are not wired and CTS/RTS is handled automatically * so just indicate DSR and CAR asserted */ @@ -47,7 +47,7 @@ Signed-off-by: Phil Elwell } static void sc16is7xx_set_mctrl(struct uart_port *port, unsigned int mctrl) -@@ -941,14 +942,19 @@ static void sc16is7xx_set_termios(struct +@@ -942,14 +943,19 @@ static void sc16is7xx_set_termios(struct regcache_cache_bypass(s->regmap, true); sc16is7xx_port_write(port, SC16IS7XX_XON1_REG, termios->c_cc[VSTART]); sc16is7xx_port_write(port, SC16IS7XX_XOFF1_REG, termios->c_cc[VSTOP]); diff --git a/target/linux/bcm27xx/patches-5.15/950-0310-watchdog-bcm2835-Ignore-params-after-the-partition-n.patch b/target/linux/bcm27xx/patches-5.15/950-0310-watchdog-bcm2835-Ignore-params-after-the-partition-n.patch index 9f8eb271e7039c..48be442befef85 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0310-watchdog-bcm2835-Ignore-params-after-the-partition-n.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0310-watchdog-bcm2835-Ignore-params-after-the-partition-n.patch @@ -12,7 +12,7 @@ which are only relevant to other reboot notifiers. --- a/drivers/watchdog/bcm2835_wdt.c +++ b/drivers/watchdog/bcm2835_wdt.c -@@ -126,10 +126,12 @@ static int bcm2835_restart(struct watchd +@@ -127,10 +127,12 @@ static int bcm2835_restart(struct watchd { struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog); diff --git a/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regmap_lookup_by_pdevname.patch b/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regmap_lookup_by_pdevname.patch index 5a3e6b06798b83..71991663770ae8 100644 --- a/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regmap_lookup_by_pdevname.patch +++ b/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regmap_lookup_by_pdevname.patch @@ -16,7 +16,7 @@ Signed-off-by: Adrian Schmutzler --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c -@@ -205,6 +205,27 @@ struct regmap *syscon_regmap_lookup_by_c +@@ -209,6 +209,27 @@ struct regmap *syscon_regmap_lookup_by_c } EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible); diff --git a/target/linux/bmips/patches-5.15/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch b/target/linux/bmips/patches-5.15/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch index 8b91cac173281d..c6d2df9f8c133b 100644 --- a/target/linux/bmips/patches-5.15/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch +++ b/target/linux/bmips/patches-5.15/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch @@ -17,7 +17,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -288,6 +288,15 @@ config LEDS_COBALT_RAQ +@@ -289,6 +289,15 @@ config LEDS_COBALT_RAQ help This option enables support for the Cobalt Raq series LEDs. diff --git a/target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch b/target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch index 51c23b6e349501..819cc292e860ee 100644 --- a/target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch +++ b/target/linux/generic/backport-5.15/080-v5.17-clk-gate-Add-devm_clk_hw_register_gate.patch @@ -66,7 +66,7 @@ Link: https://lore.kernel.org/r/20211103085102.1656081-2-horatiu.vultur@microchi +EXPORT_SYMBOL_GPL(__devm_clk_hw_register_gate); --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h -@@ -490,6 +490,13 @@ struct clk_hw *__clk_hw_register_gate(st +@@ -517,6 +517,13 @@ struct clk_hw *__clk_hw_register_gate(st unsigned long flags, void __iomem *reg, u8 bit_idx, u8 clk_gate_flags, spinlock_t *lock); @@ -80,7 +80,7 @@ Link: https://lore.kernel.org/r/20211103085102.1656081-2-horatiu.vultur@microchi struct clk *clk_register_gate(struct device *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 bit_idx, -@@ -544,6 +551,22 @@ struct clk *clk_register_gate(struct dev +@@ -571,6 +578,22 @@ struct clk *clk_register_gate(struct dev __clk_hw_register_gate((dev), NULL, (name), NULL, NULL, (parent_data), \ (flags), (reg), (bit_idx), \ (clk_gate_flags), (lock)) diff --git a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch index 3c10819b681375..931c589cfa3908 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch @@ -62,7 +62,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); stmmac_start_tx_dma(priv, chan); -@@ -3782,6 +3773,8 @@ static int stmmac_open(struct net_device +@@ -3783,6 +3774,8 @@ static int stmmac_open(struct net_device } } @@ -71,7 +71,7 @@ Signed-off-by: Jakub Kicinski ret = stmmac_hw_setup(dev, true); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); -@@ -6429,6 +6422,7 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6430,6 +6423,7 @@ void stmmac_enable_rx_queue(struct stmma return; } @@ -79,7 +79,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_rx_descriptors(priv, queue); stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -6490,6 +6484,7 @@ void stmmac_enable_tx_queue(struct stmma +@@ -6491,6 +6485,7 @@ void stmmac_enable_tx_queue(struct stmma return; } @@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_tx_descriptors(priv, queue); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -7414,6 +7409,25 @@ int stmmac_suspend(struct device *dev) +@@ -7415,6 +7410,25 @@ int stmmac_suspend(struct device *dev) } EXPORT_SYMBOL_GPL(stmmac_suspend); @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski /** * stmmac_reset_queues_param - reset queue parameters * @priv: device pointer -@@ -7424,22 +7438,11 @@ static void stmmac_reset_queues_param(st +@@ -7425,22 +7439,11 @@ static void stmmac_reset_queues_param(st u32 tx_cnt = priv->plat->tx_queues_to_use; u32 queue; diff --git a/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch b/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch index 6e115834eb8911..8bdeef7a696f71 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -3834,8 +3834,6 @@ static int stmmac_release(struct net_dev +@@ -3835,8 +3835,6 @@ static int stmmac_release(struct net_dev struct stmmac_priv *priv = netdev_priv(dev); u32 chan; @@ -26,7 +26,7 @@ Signed-off-by: Jakub Kicinski if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); /* Stop and disconnect the PHY */ -@@ -3847,6 +3845,8 @@ static int stmmac_release(struct net_dev +@@ -3848,6 +3846,8 @@ static int stmmac_release(struct net_dev for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->tx_queue[chan].txtimer); diff --git a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch index 99518b11a040ef..c59a5d1fe1782d 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch @@ -719,7 +719,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -3575,7 +3575,7 @@ static int stmmac_request_irq_multi_msi( +@@ -3576,7 +3576,7 @@ static int stmmac_request_irq_multi_msi( sprintf(int_name, "%s:%s-%d", dev->name, "rx", i); ret = request_irq(priv->rx_irq[i], stmmac_msi_intr_rx, @@ -728,7 +728,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc rx-%d MSI %d (error: %d)\n", -@@ -3598,7 +3598,7 @@ static int stmmac_request_irq_multi_msi( +@@ -3599,7 +3599,7 @@ static int stmmac_request_irq_multi_msi( sprintf(int_name, "%s:%s-%d", dev->name, "tx", i); ret = request_irq(priv->tx_irq[i], stmmac_msi_intr_tx, @@ -737,7 +737,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc tx-%d MSI %d (error: %d)\n", -@@ -3729,21 +3729,21 @@ static int stmmac_open(struct net_device +@@ -3730,21 +3730,21 @@ static int stmmac_open(struct net_device bfsize = 0; if (bfsize < BUF_SIZE_16KiB) @@ -766,7 +766,7 @@ Signed-off-by: Jakub Kicinski int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en; /* Setup per-TXQ tbs flag before TX descriptor alloc */ -@@ -3801,7 +3801,7 @@ irq_error: +@@ -3802,7 +3802,7 @@ irq_error: phylink_stop(priv->phylink); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -775,7 +775,7 @@ Signed-off-by: Jakub Kicinski stmmac_hw_teardown(dev); init_error: -@@ -3843,7 +3843,7 @@ static int stmmac_release(struct net_dev +@@ -3844,7 +3844,7 @@ static int stmmac_release(struct net_dev stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -784,7 +784,7 @@ Signed-off-by: Jakub Kicinski netif_tx_disable(dev); -@@ -3907,7 +3907,7 @@ static bool stmmac_vlan_insert(struct st +@@ -3908,7 +3908,7 @@ static bool stmmac_vlan_insert(struct st return false; stmmac_set_tx_owner(priv, p); @@ -793,7 +793,7 @@ Signed-off-by: Jakub Kicinski return true; } -@@ -3925,7 +3925,7 @@ static bool stmmac_vlan_insert(struct st +@@ -3926,7 +3926,7 @@ static bool stmmac_vlan_insert(struct st static void stmmac_tso_allocator(struct stmmac_priv *priv, dma_addr_t des, int total_len, bool last_segment, u32 queue) { @@ -802,7 +802,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *desc; u32 buff_size; int tmp_len; -@@ -3936,7 +3936,7 @@ static void stmmac_tso_allocator(struct +@@ -3937,7 +3937,7 @@ static void stmmac_tso_allocator(struct dma_addr_t curr_addr; tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, @@ -811,7 +811,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]); if (tx_q->tbs & STMMAC_TBS_AVAIL) -@@ -3964,7 +3964,7 @@ static void stmmac_tso_allocator(struct +@@ -3965,7 +3965,7 @@ static void stmmac_tso_allocator(struct static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue) { @@ -820,7 +820,7 @@ Signed-off-by: Jakub Kicinski int desc_size; if (likely(priv->extend_desc)) -@@ -4026,7 +4026,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4027,7 +4027,7 @@ static netdev_tx_t stmmac_tso_xmit(struc dma_addr_t des; int i; @@ -829,7 +829,7 @@ Signed-off-by: Jakub Kicinski first_tx = tx_q->cur_tx; /* Compute header lengths */ -@@ -4066,7 +4066,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4067,7 +4067,7 @@ static netdev_tx_t stmmac_tso_xmit(struc stmmac_set_mss(priv, mss_desc, mss); tx_q->mss = mss; tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, @@ -838,7 +838,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]); } -@@ -4178,7 +4178,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4179,7 +4179,7 @@ static netdev_tx_t stmmac_tso_xmit(struc * ndo_start_xmit will fill this descriptor the next time it's * called and stmmac_tx_clean may clean up to this descriptor. */ @@ -847,7 +847,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 1))) { netif_dbg(priv, hw, priv->dev, "%s: stop transmitted packets\n", -@@ -4266,7 +4266,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4267,7 +4267,7 @@ static netdev_tx_t stmmac_xmit(struct sk int entry, first_tx; dma_addr_t des; @@ -856,7 +856,7 @@ Signed-off-by: Jakub Kicinski first_tx = tx_q->cur_tx; if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) -@@ -4329,7 +4329,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4330,7 +4330,7 @@ static netdev_tx_t stmmac_xmit(struct sk int len = skb_frag_size(frag); bool last_segment = (i == (nfrags - 1)); @@ -865,7 +865,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[entry]); if (likely(priv->extend_desc)) -@@ -4400,7 +4400,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4401,7 +4401,7 @@ static netdev_tx_t stmmac_xmit(struct sk * ndo_start_xmit will fill this descriptor the next time it's * called and stmmac_tx_clean may clean up to this descriptor. */ @@ -874,7 +874,7 @@ Signed-off-by: Jakub Kicinski tx_q->cur_tx = entry; if (netif_msg_pktdata(priv)) { -@@ -4512,7 +4512,7 @@ static void stmmac_rx_vlan(struct net_de +@@ -4513,7 +4513,7 @@ static void stmmac_rx_vlan(struct net_de */ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) { @@ -883,7 +883,7 @@ Signed-off-by: Jakub Kicinski int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; -@@ -4562,7 +4562,7 @@ static inline void stmmac_rx_refill(stru +@@ -4563,7 +4563,7 @@ static inline void stmmac_rx_refill(stru dma_wmb(); stmmac_set_rx_owner(priv, p, use_rx_wd); @@ -892,7 +892,7 @@ Signed-off-by: Jakub Kicinski } rx_q->dirty_rx = entry; rx_q->rx_tail_addr = rx_q->dma_rx_phy + -@@ -4590,12 +4590,12 @@ static unsigned int stmmac_rx_buf1_len(s +@@ -4591,12 +4591,12 @@ static unsigned int stmmac_rx_buf1_len(s /* First descriptor, not last descriptor and not split header */ if (status & rx_not_ls) @@ -907,7 +907,7 @@ Signed-off-by: Jakub Kicinski } static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv, -@@ -4611,7 +4611,7 @@ static unsigned int stmmac_rx_buf2_len(s +@@ -4612,7 +4612,7 @@ static unsigned int stmmac_rx_buf2_len(s /* Not last descriptor */ if (status & rx_not_ls) @@ -916,7 +916,7 @@ Signed-off-by: Jakub Kicinski plen = stmmac_get_rx_frame_len(priv, p, coe); -@@ -4622,7 +4622,7 @@ static unsigned int stmmac_rx_buf2_len(s +@@ -4623,7 +4623,7 @@ static unsigned int stmmac_rx_buf2_len(s static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, struct xdp_frame *xdpf, bool dma_map) { @@ -925,7 +925,7 @@ Signed-off-by: Jakub Kicinski unsigned int entry = tx_q->cur_tx; struct dma_desc *tx_desc; dma_addr_t dma_addr; -@@ -4685,7 +4685,7 @@ static int stmmac_xdp_xmit_xdpf(struct s +@@ -4686,7 +4686,7 @@ static int stmmac_xdp_xmit_xdpf(struct s stmmac_enable_dma_transmission(priv, priv->ioaddr); @@ -934,7 +934,7 @@ Signed-off-by: Jakub Kicinski tx_q->cur_tx = entry; return STMMAC_XDP_TX; -@@ -4859,7 +4859,7 @@ static void stmmac_dispatch_skb_zc(struc +@@ -4860,7 +4860,7 @@ static void stmmac_dispatch_skb_zc(struc static bool stmmac_rx_refill_zc(struct stmmac_priv *priv, u32 queue, u32 budget) { @@ -943,7 +943,7 @@ Signed-off-by: Jakub Kicinski unsigned int entry = rx_q->dirty_rx; struct dma_desc *rx_desc = NULL; bool ret = true; -@@ -4902,7 +4902,7 @@ static bool stmmac_rx_refill_zc(struct s +@@ -4903,7 +4903,7 @@ static bool stmmac_rx_refill_zc(struct s dma_wmb(); stmmac_set_rx_owner(priv, rx_desc, use_rx_wd); @@ -952,7 +952,7 @@ Signed-off-by: Jakub Kicinski } if (rx_desc) { -@@ -4917,7 +4917,7 @@ static bool stmmac_rx_refill_zc(struct s +@@ -4918,7 +4918,7 @@ static bool stmmac_rx_refill_zc(struct s static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue) { @@ -961,7 +961,7 @@ Signed-off-by: Jakub Kicinski unsigned int count = 0, error = 0, len = 0; int dirty = stmmac_rx_dirty(priv, queue); unsigned int next_entry = rx_q->cur_rx; -@@ -4939,7 +4939,7 @@ static int stmmac_rx_zc(struct stmmac_pr +@@ -4940,7 +4940,7 @@ static int stmmac_rx_zc(struct stmmac_pr desc_size = sizeof(struct dma_desc); } @@ -970,7 +970,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } while (count < limit) { -@@ -4986,7 +4986,7 @@ read_again: +@@ -4987,7 +4987,7 @@ read_again: /* Prefetch the next RX descriptor */ rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, @@ -979,7 +979,7 @@ Signed-off-by: Jakub Kicinski next_entry = rx_q->cur_rx; if (priv->extend_desc) -@@ -5107,7 +5107,7 @@ read_again: +@@ -5108,7 +5108,7 @@ read_again: */ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) { @@ -988,7 +988,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned int count = 0, error = 0, len = 0; int status = 0, coe = priv->hw->rx_csum; -@@ -5120,7 +5120,7 @@ static int stmmac_rx(struct stmmac_priv +@@ -5121,7 +5121,7 @@ static int stmmac_rx(struct stmmac_priv int buf_sz; dma_dir = page_pool_get_dma_dir(rx_q->page_pool); @@ -997,7 +997,7 @@ Signed-off-by: Jakub Kicinski if (netif_msg_rx_status(priv)) { void *rx_head; -@@ -5134,7 +5134,7 @@ static int stmmac_rx(struct stmmac_priv +@@ -5135,7 +5135,7 @@ static int stmmac_rx(struct stmmac_priv desc_size = sizeof(struct dma_desc); } @@ -1006,7 +1006,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } while (count < limit) { -@@ -5178,7 +5178,7 @@ read_again: +@@ -5179,7 +5179,7 @@ read_again: break; rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, @@ -1015,7 +1015,7 @@ Signed-off-by: Jakub Kicinski next_entry = rx_q->cur_rx; if (priv->extend_desc) -@@ -5312,7 +5312,7 @@ read_again: +@@ -5313,7 +5313,7 @@ read_again: buf1_len, dma_dir); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, buf->page, buf->page_offset, buf1_len, @@ -1024,7 +1024,7 @@ Signed-off-by: Jakub Kicinski /* Data payload appended into SKB */ page_pool_release_page(rx_q->page_pool, buf->page); -@@ -5324,7 +5324,7 @@ read_again: +@@ -5325,7 +5325,7 @@ read_again: buf2_len, dma_dir); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, buf->sec_page, 0, buf2_len, @@ -1033,7 +1033,7 @@ Signed-off-by: Jakub Kicinski /* Data payload appended into SKB */ page_pool_release_page(rx_q->page_pool, buf->sec_page); -@@ -5767,11 +5767,13 @@ static irqreturn_t stmmac_safety_interru +@@ -5768,11 +5768,13 @@ static irqreturn_t stmmac_safety_interru static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) { struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)data; @@ -1048,7 +1048,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); -@@ -5811,10 +5813,12 @@ static irqreturn_t stmmac_msi_intr_tx(in +@@ -5812,10 +5814,12 @@ static irqreturn_t stmmac_msi_intr_tx(in static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) { struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)data; @@ -1062,7 +1062,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); -@@ -5845,10 +5849,10 @@ static void stmmac_poll_controller(struc +@@ -5846,10 +5850,10 @@ static void stmmac_poll_controller(struc if (priv->plat->multi_msi_en) { for (i = 0; i < priv->plat->rx_queues_to_use; i++) @@ -1075,7 +1075,7 @@ Signed-off-by: Jakub Kicinski } else { disable_irq(dev->irq); stmmac_interrupt(dev->irq, dev); -@@ -6029,34 +6033,34 @@ static int stmmac_rings_status_show(stru +@@ -6030,34 +6034,34 @@ static int stmmac_rings_status_show(stru return 0; for (queue = 0; queue < rx_count; queue++) { @@ -1116,7 +1116,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -6403,7 +6407,7 @@ void stmmac_disable_rx_queue(struct stmm +@@ -6404,7 +6408,7 @@ void stmmac_disable_rx_queue(struct stmm void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1125,7 +1125,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned long flags; u32 buf_size; -@@ -6440,7 +6444,7 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6441,7 +6445,7 @@ void stmmac_enable_rx_queue(struct stmma rx_q->queue_index); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -1134,7 +1134,7 @@ Signed-off-by: Jakub Kicinski rx_q->queue_index); } -@@ -6466,7 +6470,7 @@ void stmmac_disable_tx_queue(struct stmm +@@ -6467,7 +6471,7 @@ void stmmac_disable_tx_queue(struct stmm void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1143,7 +1143,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned long flags; int ret; -@@ -6516,7 +6520,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6517,7 +6521,7 @@ void stmmac_xdp_release(struct net_devic stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1152,7 +1152,7 @@ Signed-off-by: Jakub Kicinski /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); -@@ -6575,7 +6579,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6576,7 +6580,7 @@ int stmmac_xdp_open(struct net_device *d /* DMA RX Channel Configuration */ for (chan = 0; chan < rx_cnt; chan++) { @@ -1161,7 +1161,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, chan); -@@ -6593,7 +6597,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6594,7 +6598,7 @@ int stmmac_xdp_open(struct net_device *d rx_q->queue_index); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -1170,7 +1170,7 @@ Signed-off-by: Jakub Kicinski rx_q->queue_index); } -@@ -6602,7 +6606,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6603,7 +6607,7 @@ int stmmac_xdp_open(struct net_device *d /* DMA TX Channel Configuration */ for (chan = 0; chan < tx_cnt; chan++) { @@ -1179,7 +1179,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -6635,7 +6639,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6636,7 +6640,7 @@ int stmmac_xdp_open(struct net_device *d irq_error: for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1188,7 +1188,7 @@ Signed-off-by: Jakub Kicinski stmmac_hw_teardown(dev); init_error: -@@ -6662,8 +6666,8 @@ int stmmac_xsk_wakeup(struct net_device +@@ -6663,8 +6667,8 @@ int stmmac_xsk_wakeup(struct net_device queue >= priv->plat->tx_queues_to_use) return -EINVAL; @@ -1199,7 +1199,7 @@ Signed-off-by: Jakub Kicinski ch = &priv->channel[queue]; if (!rx_q->xsk_pool && !tx_q->xsk_pool) -@@ -6923,8 +6927,8 @@ int stmmac_reinit_ringparam(struct net_d +@@ -6924,8 +6928,8 @@ int stmmac_reinit_ringparam(struct net_d if (netif_running(dev)) stmmac_release(dev); @@ -1210,7 +1210,7 @@ Signed-off-by: Jakub Kicinski if (netif_running(dev)) ret = stmmac_open(dev); -@@ -7359,7 +7363,7 @@ int stmmac_suspend(struct device *dev) +@@ -7360,7 +7364,7 @@ int stmmac_suspend(struct device *dev) stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1219,7 +1219,7 @@ Signed-off-by: Jakub Kicinski if (priv->eee_enabled) { priv->tx_path_in_lpi_mode = false; -@@ -7411,7 +7415,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); +@@ -7412,7 +7416,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1228,7 +1228,7 @@ Signed-off-by: Jakub Kicinski rx_q->cur_rx = 0; rx_q->dirty_rx = 0; -@@ -7419,7 +7423,7 @@ static void stmmac_reset_rx_queue(struct +@@ -7420,7 +7424,7 @@ static void stmmac_reset_rx_queue(struct static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue) { diff --git a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch index 7336456c0c0e9b..bdf8b8585e214e 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch @@ -860,7 +860,7 @@ Signed-off-by: Jakub Kicinski stmmac_reset_tx_queue(priv, chan); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -3685,19 +3748,93 @@ static int stmmac_request_irq(struct net +@@ -3686,19 +3749,93 @@ static int stmmac_request_irq(struct net } /** @@ -957,7 +957,7 @@ Signed-off-by: Jakub Kicinski u32 chan; int ret; -@@ -3724,45 +3861,10 @@ static int stmmac_open(struct net_device +@@ -3725,45 +3862,10 @@ static int stmmac_open(struct net_device memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); priv->xstats.threshold = tc; @@ -1005,7 +1005,7 @@ Signed-off-by: Jakub Kicinski if (priv->plat->serdes_powerup) { ret = priv->plat->serdes_powerup(dev, priv->plat->bsp_priv); -@@ -3805,14 +3907,28 @@ irq_error: +@@ -3806,14 +3908,28 @@ irq_error: stmmac_hw_teardown(dev); init_error: @@ -1036,7 +1036,7 @@ Signed-off-by: Jakub Kicinski static void stmmac_fpe_stop_wq(struct stmmac_priv *priv) { set_bit(__FPE_REMOVING, &priv->fpe_task_state); -@@ -3859,7 +3975,7 @@ static int stmmac_release(struct net_dev +@@ -3860,7 +3976,7 @@ static int stmmac_release(struct net_dev stmmac_stop_all_dma(priv); /* Release and free the Rx/Tx resources */ @@ -1045,7 +1045,7 @@ Signed-off-by: Jakub Kicinski /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); -@@ -6402,7 +6518,7 @@ void stmmac_disable_rx_queue(struct stmm +@@ -6403,7 +6519,7 @@ void stmmac_disable_rx_queue(struct stmm spin_unlock_irqrestore(&ch->lock, flags); stmmac_stop_rx_dma(priv, queue); @@ -1054,7 +1054,7 @@ Signed-off-by: Jakub Kicinski } void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue) -@@ -6413,21 +6529,21 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6414,21 +6530,21 @@ void stmmac_enable_rx_queue(struct stmma u32 buf_size; int ret; @@ -1080,7 +1080,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, rx_q->queue_index); -@@ -6465,7 +6581,7 @@ void stmmac_disable_tx_queue(struct stmm +@@ -6466,7 +6582,7 @@ void stmmac_disable_tx_queue(struct stmm spin_unlock_irqrestore(&ch->lock, flags); stmmac_stop_tx_dma(priv, queue); @@ -1089,7 +1089,7 @@ Signed-off-by: Jakub Kicinski } void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue) -@@ -6475,21 +6591,21 @@ void stmmac_enable_tx_queue(struct stmma +@@ -6476,21 +6592,21 @@ void stmmac_enable_tx_queue(struct stmma unsigned long flags; int ret; @@ -1115,7 +1115,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, tx_q->queue_index); -@@ -6529,7 +6645,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6530,7 +6646,7 @@ void stmmac_xdp_release(struct net_devic stmmac_stop_all_dma(priv); /* Release and free the Rx/Tx resources */ @@ -1124,7 +1124,7 @@ Signed-off-by: Jakub Kicinski /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); -@@ -6554,14 +6670,14 @@ int stmmac_xdp_open(struct net_device *d +@@ -6555,14 +6671,14 @@ int stmmac_xdp_open(struct net_device *d u32 chan; int ret; @@ -1141,7 +1141,7 @@ Signed-off-by: Jakub Kicinski if (ret < 0) { netdev_err(dev, "%s: DMA descriptors initialization failed\n", __func__); -@@ -6643,7 +6759,7 @@ irq_error: +@@ -6644,7 +6760,7 @@ irq_error: stmmac_hw_teardown(dev); init_error: @@ -1150,7 +1150,7 @@ Signed-off-by: Jakub Kicinski dma_desc_error: return ret; } -@@ -7506,7 +7622,7 @@ int stmmac_resume(struct device *dev) +@@ -7507,7 +7623,7 @@ int stmmac_resume(struct device *dev) stmmac_reset_queues_param(priv); stmmac_free_tx_skbufs(priv); diff --git a/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch b/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch index 6ebb527726e440..2576df45224db1 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5624,18 +5624,15 @@ static int stmmac_change_mtu(struct net_ +@@ -5625,18 +5625,15 @@ static int stmmac_change_mtu(struct net_ { struct stmmac_priv *priv = netdev_priv(dev); int txfifosz = priv->plat->tx_fifo_size; @@ -40,7 +40,7 @@ Signed-off-by: Jakub Kicinski if (stmmac_xdp_is_enabled(priv) && new_mtu > ETH_DATA_LEN) { netdev_dbg(priv->dev, "Jumbo frames not supported for XDP\n"); return -EINVAL; -@@ -5647,8 +5644,29 @@ static int stmmac_change_mtu(struct net_ +@@ -5648,8 +5645,29 @@ static int stmmac_change_mtu(struct net_ if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) return -EINVAL; diff --git a/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch b/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch index b00cf5741991d0..0ad89de56007bd 100644 --- a/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch +++ b/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch @@ -128,7 +128,7 @@ Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc /** * of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it -@@ -1684,47 +1612,6 @@ free: +@@ -1685,47 +1613,6 @@ free: EXPORT_SYMBOL(of_parse_phandle_with_args_map); /** @@ -200,7 +200,7 @@ Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc extern int of_count_phandle_with_args(const struct device_node *np, const char *list_name, const char *cells_name); -@@ -864,18 +858,12 @@ static inline int of_property_read_strin +@@ -714,18 +708,12 @@ static inline int of_property_read_strin return -ENOSYS; } @@ -225,7 +225,7 @@ Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc { return -ENOSYS; } -@@ -889,13 +877,6 @@ static inline int of_parse_phandle_with_ +@@ -739,13 +727,6 @@ static inline int of_parse_phandle_with_ return -ENOSYS; } @@ -239,7 +239,7 @@ Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc static inline int of_count_phandle_with_args(const struct device_node *np, const char *list_name, const char *cells_name) -@@ -1077,6 +1058,117 @@ static inline bool of_node_is_type(const +@@ -927,6 +908,117 @@ static inline bool of_node_is_type(const } /** diff --git a/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch b/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch index 2b2a60e096bef2..97f4c6981e211b 100644 --- a/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch +++ b/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch @@ -24,7 +24,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/include/linux/of.h +++ b/include/linux/of.h -@@ -1169,6 +1169,31 @@ static inline int of_parse_phandle_with_ +@@ -1019,6 +1019,31 @@ static inline int of_parse_phandle_with_ } /** diff --git a/target/linux/generic/backport-5.15/828-v6.4-0004-of-Move-of_modalias-to-module.c.patch b/target/linux/generic/backport-5.15/828-v6.4-0004-of-Move-of_modalias-to-module.c.patch index a70c6f2eec8cd7..b4554b2ecad28c 100644 --- a/target/linux/generic/backport-5.15/828-v6.4-0004-of-Move-of_modalias-to-module.c.patch +++ b/target/linux/generic/backport-5.15/828-v6.4-0004-of-Move-of_modalias-to-module.c.patch @@ -145,7 +145,7 @@ Signed-off-by: Greg Kroah-Hartman /* phandle iterator functions */ extern int of_phandle_iterator_init(struct of_phandle_iterator *it, const struct device_node *np, -@@ -885,6 +888,12 @@ static inline int of_count_phandle_with_ +@@ -735,6 +738,12 @@ static inline int of_count_phandle_with_ return -ENOSYS; } diff --git a/target/linux/generic/backport-5.15/828-v6.4-0005-of-Move-the-request-module-helper-logic-to-module.c.patch b/target/linux/generic/backport-5.15/828-v6.4-0005-of-Move-the-request-module-helper-logic-to-module.c.patch index 06bc24ca6e3753..ad42039e112aee 100644 --- a/target/linux/generic/backport-5.15/828-v6.4-0005-of-Move-the-request-module-helper-logic-to-module.c.patch +++ b/target/linux/generic/backport-5.15/828-v6.4-0005-of-Move-the-request-module-helper-logic-to-module.c.patch @@ -117,7 +117,7 @@ Signed-off-by: Greg Kroah-Hartman /* phandle iterator functions */ extern int of_phandle_iterator_init(struct of_phandle_iterator *it, -@@ -893,6 +894,11 @@ static inline ssize_t of_modalias(const +@@ -743,6 +744,11 @@ static inline ssize_t of_modalias(const { return -ENODEV; } diff --git a/target/linux/generic/hack-5.15/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/hack-5.15/321-powerpc_crtsavres_prereq.patch deleted file mode 100644 index f1942e2037598d..00000000000000 --- a/target/linux/generic/hack-5.15/321-powerpc_crtsavres_prereq.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 107c0964cb8db7ca28ac5199426414fdab3c274d Mon Sep 17 00:00:00 2001 -From: "Alexandros C. Couloumbis" -Date: Fri, 7 Jul 2017 17:14:51 +0200 -Subject: hack: arch: powerpc: drop register save/restore library from modules - -Upstream GCC uses a libgcc function for saving/restoring registers. This -makes the code bigger, and upstream kernels need to carry that function -for every single kernel module. Our GCC is patched to avoid those -references, so we can drop the extra bloat for modules. - -lede-commit: e8e1084654f50904e6bf77b70b2de3f137d7b3ec -Signed-off-by: Alexandros C. Couloumbis ---- - arch/powerpc/Makefile | 1 - - 1 file changed, 1 deletion(-) - ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -44,19 +44,6 @@ machine-$(CONFIG_PPC64) += 64 - machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le - UTS_MACHINE := $(subst $(space),,$(machine-y)) - --# XXX This needs to be before we override LD below --ifdef CONFIG_PPC32 --KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o --else --ifeq ($(call ld-ifversion, -ge, 22500, y),y) --# Have the linker provide sfpr if possible. --# There is a corresponding test in arch/powerpc/lib/Makefile --KBUILD_LDFLAGS_MODULE += --save-restore-funcs --else --KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o --endif --endif -- - ifdef CONFIG_CPU_LITTLE_ENDIAN - KBUILD_CFLAGS += -mlittle-endian - KBUILD_LDFLAGS += -EL diff --git a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index d2ca7c7b537008..892887c423663f 100644 --- a/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-5.15/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -7736,7 +7736,7 @@ static int nft_register_flowtable_net_ho +@@ -7752,7 +7752,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); diff --git a/target/linux/ipq806x/patches-5.15/118-v6.1-03-clk-introduce-devm_-hw_register_mux_parent_data_tabl.patch b/target/linux/ipq806x/patches-5.15/118-v6.1-03-clk-introduce-devm_-hw_register_mux_parent_data_tabl.patch index 8567d0802bcc6a..68538d14cbe41c 100644 --- a/target/linux/ipq806x/patches-5.15/118-v6.1-03-clk-introduce-devm_-hw_register_mux_parent_data_tabl.patch +++ b/target/linux/ipq806x/patches-5.15/118-v6.1-03-clk-introduce-devm_-hw_register_mux_parent_data_tabl.patch @@ -17,7 +17,7 @@ Signed-off-by: Christian Marangi --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h -@@ -955,12 +955,26 @@ struct clk *clk_register_mux_table(struc +@@ -989,12 +989,26 @@ struct clk *clk_register_mux_table(struc __clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, NULL, \ (parent_data), (flags), (reg), (shift), \ BIT((width)) - 1, (clk_mux_flags), NULL, (lock)) diff --git a/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch b/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch index 9703fa05189b9f..384f32a65c961b 100644 --- a/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch +++ b/target/linux/ipq806x/patches-5.15/700-Revert-net-stmmac-Use-hrtimer-for-TX-coalescing.patch @@ -98,7 +98,7 @@ Signed-off-by: Oskari Lemmela } for (chan = 0; chan < rx_channel_count; chan++) -@@ -3903,7 +3896,7 @@ irq_error: +@@ -3904,7 +3897,7 @@ irq_error: phylink_stop(priv->phylink); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -107,7 +107,7 @@ Signed-off-by: Oskari Lemmela stmmac_hw_teardown(dev); init_error: -@@ -3959,7 +3952,7 @@ static int stmmac_release(struct net_dev +@@ -3960,7 +3953,7 @@ static int stmmac_release(struct net_dev stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -116,7 +116,7 @@ Signed-off-by: Oskari Lemmela netif_tx_disable(dev); -@@ -6654,7 +6647,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6655,7 +6648,7 @@ void stmmac_xdp_release(struct net_devic stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -125,7 +125,7 @@ Signed-off-by: Oskari Lemmela /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); -@@ -6749,8 +6742,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6750,8 +6743,7 @@ int stmmac_xdp_open(struct net_device *d stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, chan); @@ -135,7 +135,7 @@ Signed-off-by: Oskari Lemmela } /* Enable the MAC Rx/Tx */ -@@ -6773,7 +6765,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6774,7 +6766,7 @@ int stmmac_xdp_open(struct net_device *d irq_error: for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -144,7 +144,7 @@ Signed-off-by: Oskari Lemmela stmmac_hw_teardown(dev); init_error: -@@ -7497,7 +7489,7 @@ int stmmac_suspend(struct device *dev) +@@ -7498,7 +7490,7 @@ int stmmac_suspend(struct device *dev) stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) diff --git a/target/linux/mediatek/patches-5.15/601-PCI-mediatek-Assert-PERST-for-100ms-for-power-and-cl.patch b/target/linux/mediatek/patches-5.15/601-PCI-mediatek-Assert-PERST-for-100ms-for-power-and-cl.patch index ff482272108307..b7311e042d8e78 100644 --- a/target/linux/mediatek/patches-5.15/601-PCI-mediatek-Assert-PERST-for-100ms-for-power-and-cl.patch +++ b/target/linux/mediatek/patches-5.15/601-PCI-mediatek-Assert-PERST-for-100ms-for-power-and-cl.patch @@ -18,7 +18,7 @@ Acked-by: Pali Rohár --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c -@@ -702,6 +702,13 @@ static int mtk_pcie_startup_port_v2(stru +@@ -708,6 +708,13 @@ static int mtk_pcie_startup_port_v2(stru */ writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL); diff --git a/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch b/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch index de64eda8277d5c..76ee2fc89abdad 100644 --- a/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch +++ b/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch @@ -52,7 +52,7 @@ Signed-off-by: Felix Fietkau struct mtk_pcie_port; /** -@@ -1054,6 +1060,27 @@ static int mtk_pcie_setup(struct mtk_pci +@@ -1060,6 +1066,27 @@ static int mtk_pcie_setup(struct mtk_pci struct mtk_pcie_port *port, *tmp; int err, slot; diff --git a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch index d5c8a4e3008b59..46e92a92f31354 100644 --- a/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch +++ b/target/linux/mediatek/patches-5.15/850-v6.0-i2c-move-drivers-from-strlcpy-to-strscpy.patch @@ -458,7 +458,7 @@ Signed-off-by: Wolfram Sang adap->dev.parent = &pdev->dev; --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c -@@ -1240,7 +1240,7 @@ static int rk3x_i2c_probe(struct platfor +@@ -1247,7 +1247,7 @@ static int rk3x_i2c_probe(struct platfor /* use common interface to get I2C timing properties */ i2c_parse_fw_timings(&pdev->dev, &i2c->t, true); @@ -469,7 +469,7 @@ Signed-off-by: Wolfram Sang i2c->adap.retries = 3; --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c -@@ -1076,7 +1076,7 @@ static int s3c24xx_i2c_probe(struct plat +@@ -1078,7 +1078,7 @@ static int s3c24xx_i2c_probe(struct plat else s3c24xx_i2c_parse_dt(pdev->dev.of_node, i2c); diff --git a/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch b/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch index 34e3ce9a13925c..ffec312ced75b6 100644 --- a/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch +++ b/target/linux/mvebu/patches-5.15/102-leds-turris-omnia-support-HW-controlled-mode-via-pri.patch @@ -44,7 +44,7 @@ Signed-off-by: Marek Behún --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -163,6 +163,7 @@ config LEDS_TURRIS_OMNIA +@@ -164,6 +164,7 @@ config LEDS_TURRIS_OMNIA depends on I2C depends on MACH_ARMADA_38X || COMPILE_TEST depends on OF diff --git a/target/linux/mvebu/patches-5.15/904-drivers-leds-Add-the-IEI-WT61P803-PUZZLE-LED-driver.patch b/target/linux/mvebu/patches-5.15/904-drivers-leds-Add-the-IEI-WT61P803-PUZZLE-LED-driver.patch index a3fc731c471967..8192d1998bfbc3 100644 --- a/target/linux/mvebu/patches-5.15/904-drivers-leds-Add-the-IEI-WT61P803-PUZZLE-LED-driver.patch +++ b/target/linux/mvebu/patches-5.15/904-drivers-leds-Add-the-IEI-WT61P803-PUZZLE-LED-driver.patch @@ -30,7 +30,7 @@ Cc: Robert Marko --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -306,6 +306,14 @@ config LEDS_IPAQ_MICRO +@@ -307,6 +307,14 @@ config LEDS_IPAQ_MICRO Choose this option if you want to use the notification LED on Compaq/HP iPAQ h3100 and h3600. diff --git a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch index 0400d1e9ddc841..6dd02bed54a5ce 100644 --- a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch +++ b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch @@ -22,7 +22,7 @@ Signed-off-by: Tim Harvey #include #include #include -@@ -5879,3 +5880,34 @@ static void nvidia_ion_ahci_fixup(struct +@@ -5883,3 +5884,34 @@ static void nvidia_ion_ahci_fixup(struct pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); diff --git a/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch b/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch index 2896002ed1aaee..9a0dbd7bb85c9a 100644 --- a/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch +++ b/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch @@ -25,7 +25,7 @@ Signed-off-by: John Crispin --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig -@@ -1093,3 +1093,5 @@ config MMC_OWL +@@ -1095,3 +1095,5 @@ config MMC_OWL config MMC_SDHCI_EXTERNAL_DMA bool From c90901f0880ae08fc71d3f68ed16238a0aeaaffe Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 11 Feb 2024 14:44:08 +0100 Subject: [PATCH 0748/1171] mediatek: fix failsafe ethernet for NWA50AX Pro The NWA50AX Pro only has a eth0 interface for its only ethernet port. Use this port for preinit. Fixes non-working network in failsafe mode. Signed-off-by: David Bauer (cherry picked from commit b589434a0b38435bd1ce3a9be3af75ed188e88e0) --- .../linux/mediatek/base-files/lib/preinit/05_set_preinit_iface | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface index 5e7fc81ad8263d..fd39b3f65f07db 100644 --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -4,7 +4,8 @@ set_preinit_iface() { ip link set eth1 up ifname=eth1 ;; - ubnt,unifi-6-lr) + ubnt,unifi-6-lr|\ + zyxel,nwa50ax-pro) ip link set eth0 up ifname=eth0 ;; From 277d97e0d9c2a426dbc80b283cf4a704465716eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 26 Jan 2024 06:19:42 +0100 Subject: [PATCH 0749/1171] kernel: 5.15: update Aquantia PHY driver to v6.1 code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport few upstream changes included between v5.15 and v6.1. Signed-off-by: Rafał Miłecki (cherry picked from commit 418aadaec9dd9c67b2a4fffb51dfa1fb5fdf5098) --- ...net-phy-Add-support-for-AQR113C-EPHY.patch | 58 +++++++ ...a-Add-some-additional-phy-interfaces.patch | 71 +++++++++ ...uantia-Add-support-for-rate-matching.patch | 148 ++++++++++++++++++ .../hack-5.15/720-net-phy-add-aqr-phys.patch | 56 ++----- ...hy-aquantia-enable-AQR112-and-AQR412.patch | 32 ++-- ...aquantia-fix-system-side-protocol-mi.patch | 2 +- ...y-aquantia-Add-AQR113-driver-support.patch | 26 +-- ...ntia-add-PHY_IDs-for-AQR112-variants.patch | 26 +-- 8 files changed, 334 insertions(+), 85 deletions(-) create mode 100644 target/linux/generic/backport-5.15/735-v6.0-0001-net-phy-Add-support-for-AQR113C-EPHY.patch create mode 100644 target/linux/generic/backport-5.15/736-v6.1-0001-net-phy-aquantia-Add-some-additional-phy-interfaces.patch create mode 100644 target/linux/generic/backport-5.15/736-v6.1-0002-net-phy-aquantia-Add-support-for-rate-matching.patch diff --git a/target/linux/generic/backport-5.15/735-v6.0-0001-net-phy-Add-support-for-AQR113C-EPHY.patch b/target/linux/generic/backport-5.15/735-v6.0-0001-net-phy-Add-support-for-AQR113C-EPHY.patch new file mode 100644 index 00000000000000..6090a40eaee41e --- /dev/null +++ b/target/linux/generic/backport-5.15/735-v6.0-0001-net-phy-Add-support-for-AQR113C-EPHY.patch @@ -0,0 +1,58 @@ +From 12cf1b89a66828719b2135891b65bd5d03eedea9 Mon Sep 17 00:00:00 2001 +From: Bhadram Varka +Date: Tue, 21 Jun 2022 09:10:27 +0530 +Subject: [PATCH] net: phy: Add support for AQR113C EPHY + +Add support multi-gigabit and single-port Ethernet +PHY transceiver (AQR113C). + +Signed-off-by: Bhadram Varka +Link: https://lore.kernel.org/r/20220621034027.56508-1-vbhadram@nvidia.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/aquantia_main.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/net/phy/aquantia_main.c ++++ b/drivers/net/phy/aquantia_main.c +@@ -22,6 +22,7 @@ + #define PHY_ID_AQR107 0x03a1b4e0 + #define PHY_ID_AQCS109 0x03a1b5c2 + #define PHY_ID_AQR405 0x03a1b4b0 ++#define PHY_ID_AQR113C 0x31c31c12 + + #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) +@@ -744,6 +745,24 @@ static struct phy_driver aqr_driver[] = + .handle_interrupt = aqr_handle_interrupt, + .read_status = aqr_read_status, + }, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), ++ .name = "Aquantia AQR113C", ++ .probe = aqr107_probe, ++ .config_init = aqr107_config_init, ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr107_read_status, ++ .get_tunable = aqr107_get_tunable, ++ .set_tunable = aqr107_set_tunable, ++ .suspend = aqr107_suspend, ++ .resume = aqr107_resume, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, ++ .link_change_notify = aqr107_link_change_notify, ++}, + }; + + module_phy_driver(aqr_driver); +@@ -756,6 +775,7 @@ static struct mdio_device_id __maybe_unu + { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, + { } + }; + diff --git a/target/linux/generic/backport-5.15/736-v6.1-0001-net-phy-aquantia-Add-some-additional-phy-interfaces.patch b/target/linux/generic/backport-5.15/736-v6.1-0001-net-phy-aquantia-Add-some-additional-phy-interfaces.patch new file mode 100644 index 00000000000000..ec8485e0a74370 --- /dev/null +++ b/target/linux/generic/backport-5.15/736-v6.1-0001-net-phy-aquantia-Add-some-additional-phy-interfaces.patch @@ -0,0 +1,71 @@ +From 7de26bf144f6a72858ab60afb2bd2b43265ee0ad Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Tue, 20 Sep 2022 18:12:34 -0400 +Subject: [PATCH] net: phy: aquantia: Add some additional phy interfaces + +These are documented in the AQR115 register reference. I haven't tested +them, but perhaps they'll be useful to someone. + +Signed-off-by: Sean Anderson +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/aquantia_main.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/aquantia_main.c ++++ b/drivers/net/phy/aquantia_main.c +@@ -27,9 +27,12 @@ + #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR 0 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX 1 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI 2 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII 3 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI 4 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII 6 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI 7 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII 10 + + #define MDIO_AN_VEND_PROV 0xc400 +@@ -401,15 +404,24 @@ static int aqr107_read_status(struct phy + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR: + phydev->interface = PHY_INTERFACE_MODE_10GKR; + break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX: ++ phydev->interface = PHY_INTERFACE_MODE_1000BASEKX; ++ break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI: + phydev->interface = PHY_INTERFACE_MODE_10GBASER; + break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII: + phydev->interface = PHY_INTERFACE_MODE_USXGMII; + break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI: ++ phydev->interface = PHY_INTERFACE_MODE_XAUI; ++ break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII: + phydev->interface = PHY_INTERFACE_MODE_SGMII; + break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI: ++ phydev->interface = PHY_INTERFACE_MODE_RXAUI; ++ break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII: + phydev->interface = PHY_INTERFACE_MODE_2500BASEX; + break; +@@ -522,11 +534,14 @@ static int aqr107_config_init(struct phy + + /* Check that the PHY interface type is compatible */ + if (phydev->interface != PHY_INTERFACE_MODE_SGMII && ++ phydev->interface != PHY_INTERFACE_MODE_1000BASEKX && + phydev->interface != PHY_INTERFACE_MODE_2500BASEX && + phydev->interface != PHY_INTERFACE_MODE_XGMII && + phydev->interface != PHY_INTERFACE_MODE_USXGMII && + phydev->interface != PHY_INTERFACE_MODE_10GKR && +- phydev->interface != PHY_INTERFACE_MODE_10GBASER) ++ phydev->interface != PHY_INTERFACE_MODE_10GBASER && ++ phydev->interface != PHY_INTERFACE_MODE_XAUI && ++ phydev->interface != PHY_INTERFACE_MODE_RXAUI) + return -ENODEV; + + WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, diff --git a/target/linux/generic/backport-5.15/736-v6.1-0002-net-phy-aquantia-Add-support-for-rate-matching.patch b/target/linux/generic/backport-5.15/736-v6.1-0002-net-phy-aquantia-Add-support-for-rate-matching.patch new file mode 100644 index 00000000000000..d5d58762ce377b --- /dev/null +++ b/target/linux/generic/backport-5.15/736-v6.1-0002-net-phy-aquantia-Add-support-for-rate-matching.patch @@ -0,0 +1,148 @@ +From 3c42563b30417afc8855a3b4c1b38c2f36f78657 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Tue, 20 Sep 2022 18:12:35 -0400 +Subject: [PATCH] net: phy: aquantia: Add support for rate matching + +This adds support for rate matching for phys similar to the AQR107. We +assume that all phys using aqr107_read_status support rate matching. +However, it could be possible to determine support based on the firmware +revision if there are phys discovered which do not support rate +matching. However, as rate matching is advertised in the datasheets for +these phys, I suspect it is supported most boards. + +Despite the name, the "config" registers are updated with the current +rate matching method (if any). Because they appear to be updated +automatically, I don't know if these registers can be used to disable +rate matching. + +Signed-off-by: Sean Anderson +Signed-off-by: David S. Miller +--- + drivers/net/phy/aquantia_main.c | 51 ++++++++++++++++++++++++++++++--- + 1 file changed, 47 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/aquantia_main.c ++++ b/drivers/net/phy/aquantia_main.c +@@ -97,6 +97,19 @@ + #define VEND1_GLOBAL_GEN_STAT2 0xc831 + #define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) + ++/* The following registers all have similar layouts; first the registers... */ ++#define VEND1_GLOBAL_CFG_10M 0x0310 ++#define VEND1_GLOBAL_CFG_100M 0x031b ++#define VEND1_GLOBAL_CFG_1G 0x031c ++#define VEND1_GLOBAL_CFG_2_5G 0x031d ++#define VEND1_GLOBAL_CFG_5G 0x031e ++#define VEND1_GLOBAL_CFG_10G 0x031f ++/* ...and now the fields */ ++#define VEND1_GLOBAL_CFG_RATE_ADAPT GENMASK(8, 7) ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_NONE 0 ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_USX 1 ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 ++ + #define VEND1_GLOBAL_RSVD_STAT1 0xc885 + #define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) + #define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) +@@ -347,40 +360,57 @@ static int aqr_read_status(struct phy_de + + static int aqr107_read_rate(struct phy_device *phydev) + { ++ u32 config_reg; + int val; + + val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_STATUS1); + if (val < 0) + return val; + ++ if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) ++ phydev->duplex = DUPLEX_FULL; ++ else ++ phydev->duplex = DUPLEX_HALF; ++ + switch (FIELD_GET(MDIO_AN_TX_VEND_STATUS1_RATE_MASK, val)) { + case MDIO_AN_TX_VEND_STATUS1_10BASET: + phydev->speed = SPEED_10; ++ config_reg = VEND1_GLOBAL_CFG_10M; + break; + case MDIO_AN_TX_VEND_STATUS1_100BASETX: + phydev->speed = SPEED_100; ++ config_reg = VEND1_GLOBAL_CFG_100M; + break; + case MDIO_AN_TX_VEND_STATUS1_1000BASET: + phydev->speed = SPEED_1000; ++ config_reg = VEND1_GLOBAL_CFG_1G; + break; + case MDIO_AN_TX_VEND_STATUS1_2500BASET: + phydev->speed = SPEED_2500; ++ config_reg = VEND1_GLOBAL_CFG_2_5G; + break; + case MDIO_AN_TX_VEND_STATUS1_5000BASET: + phydev->speed = SPEED_5000; ++ config_reg = VEND1_GLOBAL_CFG_5G; + break; + case MDIO_AN_TX_VEND_STATUS1_10GBASET: + phydev->speed = SPEED_10000; ++ config_reg = VEND1_GLOBAL_CFG_10G; + break; + default: + phydev->speed = SPEED_UNKNOWN; +- break; ++ return 0; + } + +- if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) +- phydev->duplex = DUPLEX_FULL; ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, config_reg); ++ if (val < 0) ++ return val; ++ ++ if (FIELD_GET(VEND1_GLOBAL_CFG_RATE_ADAPT, val) == ++ VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE) ++ phydev->rate_matching = RATE_MATCH_PAUSE; + else +- phydev->duplex = DUPLEX_HALF; ++ phydev->rate_matching = RATE_MATCH_NONE; + + return 0; + } +@@ -647,6 +677,16 @@ static int aqr107_wait_processor_intensi + return 0; + } + ++static int aqr107_get_rate_matching(struct phy_device *phydev, ++ phy_interface_t iface) ++{ ++ if (iface == PHY_INTERFACE_MODE_10GBASER || ++ iface == PHY_INTERFACE_MODE_2500BASEX || ++ iface == PHY_INTERFACE_MODE_NA) ++ return RATE_MATCH_PAUSE; ++ return RATE_MATCH_NONE; ++} ++ + static int aqr107_suspend(struct phy_device *phydev) + { + int err; +@@ -720,6 +760,7 @@ static struct phy_driver aqr_driver[] = + PHY_ID_MATCH_MODEL(PHY_ID_AQR107), + .name = "Aquantia AQR107", + .probe = aqr107_probe, ++ .get_rate_matching = aqr107_get_rate_matching, + .config_init = aqr107_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, +@@ -738,6 +779,7 @@ static struct phy_driver aqr_driver[] = + PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), + .name = "Aquantia AQCS109", + .probe = aqr107_probe, ++ .get_rate_matching = aqr107_get_rate_matching, + .config_init = aqcs109_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, +@@ -764,6 +806,7 @@ static struct phy_driver aqr_driver[] = + PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), + .name = "Aquantia AQR113C", + .probe = aqr107_probe, ++ .get_rate_matching = aqr107_get_rate_matching, + .config_init = aqr107_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, diff --git a/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch b/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch index 29050d38ea22b0..d8ec95b37478ab 100644 --- a/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch +++ b/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch @@ -9,18 +9,15 @@ Signed-off-by: Birger Koblitz --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c -@@ -20,8 +20,10 @@ - #define PHY_ID_AQR105 0x03a1b4a2 - #define PHY_ID_AQR106 0x03a1b4d0 - #define PHY_ID_AQR107 0x03a1b4e0 -+#define PHY_ID_AQR113C 0x31c31c12 +@@ -23,6 +23,7 @@ #define PHY_ID_AQCS109 0x03a1b5c2 #define PHY_ID_AQR405 0x03a1b4b0 + #define PHY_ID_AQR113C 0x31c31c12 +#define PHY_ID_AQR813 0x31c31cb2 #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -381,6 +383,49 @@ static int aqr107_read_rate(struct phy_d +@@ -415,6 +416,49 @@ static int aqr107_read_rate(struct phy_d return 0; } @@ -70,7 +67,7 @@ Signed-off-by: Birger Koblitz static int aqr107_read_status(struct phy_device *phydev) { int val, ret; -@@ -511,7 +556,7 @@ static void aqr107_chip_info(struct phy_ +@@ -554,7 +598,7 @@ static void aqr107_chip_info(struct phy_ build_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID, val); prov_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val); @@ -79,35 +76,19 @@ Signed-off-by: Birger Koblitz fw_major, fw_minor, build_id, prov_id); } -@@ -719,6 +764,24 @@ static struct phy_driver aqr_driver[] = +@@ -811,7 +855,7 @@ static struct phy_driver aqr_driver[] = + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, + .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr107_read_status, ++ .read_status = aqr113c_read_status, + .get_tunable = aqr107_get_tunable, + .set_tunable = aqr107_set_tunable, + .suspend = aqr107_suspend, +@@ -821,6 +865,24 @@ static struct phy_driver aqr_driver[] = + .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, }, - { -+ PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), -+ .name = "Aquantia AQR113C", -+ .probe = aqr107_probe, -+ .config_init = aqr107_config_init, -+ .config_aneg = aqr_config_aneg, -+ .config_intr = aqr_config_intr, -+ .handle_interrupt = aqr_handle_interrupt, -+ .read_status = aqr113c_read_status, -+ .get_tunable = aqr107_get_tunable, -+ .set_tunable = aqr107_set_tunable, -+ .suspend = aqr107_suspend, -+ .resume = aqr107_resume, -+ .get_sset_count = aqr107_get_sset_count, -+ .get_strings = aqr107_get_strings, -+ .get_stats = aqr107_get_stats, -+ .link_change_notify = aqr107_link_change_notify, -+}, -+{ - PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), - .name = "Aquantia AQCS109", - .probe = aqr107_probe, -@@ -744,6 +807,24 @@ static struct phy_driver aqr_driver[] = - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, - }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR813), + .name = "Aquantia AQR813", @@ -129,13 +110,10 @@ Signed-off-by: Birger Koblitz }; module_phy_driver(aqr_driver); -@@ -754,8 +835,10 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_MATCH_MODEL(PHY_ID_AQR105) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, -+ { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, +@@ -834,6 +896,7 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, { } }; diff --git a/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch b/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch index 211696c5688ec8..f80757cae94e75 100644 --- a/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch +++ b/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch @@ -15,19 +15,16 @@ Signed-off-by: Alex Marginean --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c -@@ -20,9 +20,11 @@ - #define PHY_ID_AQR105 0x03a1b4a2 - #define PHY_ID_AQR106 0x03a1b4d0 - #define PHY_ID_AQR107 0x03a1b4e0 -+#define PHY_ID_AQR112 0x03a1b662 - #define PHY_ID_AQR113C 0x31c31c12 - #define PHY_ID_AQCS109 0x03a1b5c2 +@@ -24,6 +24,8 @@ #define PHY_ID_AQR405 0x03a1b4b0 -+#define PHY_ID_AQR412 0x03a1b712 + #define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQR813 0x31c31cb2 ++#define PHY_ID_AQR112 0x03a1b662 ++#define PHY_ID_AQR412 0x03a1b712 #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 -@@ -135,6 +137,29 @@ + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) +@@ -151,6 +153,29 @@ #define AQR107_OP_IN_PROG_SLEEP 1000 #define AQR107_OP_IN_PROG_TIMEOUT 100000 @@ -57,7 +54,7 @@ Signed-off-by: Alex Marginean struct aqr107_hw_stat { const char *name; int reg; -@@ -266,6 +291,51 @@ static int aqr_config_aneg(struct phy_de +@@ -282,6 +307,51 @@ static int aqr_config_aneg(struct phy_de return genphy_c45_check_and_restart_aneg(phydev, changed); } @@ -109,7 +106,7 @@ Signed-off-by: Alex Marginean static int aqr_config_intr(struct phy_device *phydev) { bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; -@@ -825,6 +895,30 @@ static struct phy_driver aqr_driver[] = +@@ -883,6 +953,30 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, }, @@ -140,15 +137,12 @@ Signed-off-by: Alex Marginean }; module_phy_driver(aqr_driver); -@@ -835,9 +929,11 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_MATCH_MODEL(PHY_ID_AQR105) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, -+ { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, +@@ -897,6 +991,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, -+ { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) }, { } }; + diff --git a/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch b/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch index 7d16c8aa289a70..8e204cb146aa93 100644 --- a/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch +++ b/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch @@ -14,7 +14,7 @@ Signed-off-by: Alex Marginean --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c -@@ -324,10 +324,16 @@ static int aqr_config_aneg_set_prot(stru +@@ -340,10 +340,16 @@ static int aqr_config_aneg_set_prot(stru phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE, aquantia_syscfg[if_type].start_rate); diff --git a/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch b/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch index d03c3430fae296..f30e65101a2df6 100644 --- a/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch +++ b/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch @@ -10,15 +10,15 @@ Add a new entry for AQR113 PHY_ID --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c -@@ -21,6 +21,7 @@ - #define PHY_ID_AQR106 0x03a1b4d0 - #define PHY_ID_AQR107 0x03a1b4e0 +@@ -26,6 +26,7 @@ + #define PHY_ID_AQR813 0x31c31cb2 #define PHY_ID_AQR112 0x03a1b662 + #define PHY_ID_AQR412 0x03a1b712 +#define PHY_ID_AQR113 0x31c31c40 - #define PHY_ID_AQR113C 0x31c31c12 - #define PHY_ID_AQCS109 0x03a1b5c2 - #define PHY_ID_AQR405 0x03a1b4b0 -@@ -914,6 +915,14 @@ static struct phy_driver aqr_driver[] = + + #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) +@@ -972,6 +973,14 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, }, { @@ -33,11 +33,11 @@ Add a new entry for AQR113 PHY_ID PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name = "Aquantia AQR412", .probe = aqr107_probe, -@@ -936,6 +945,7 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, +@@ -999,6 +1008,7 @@ static struct mdio_device_id __maybe_unu + { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, + { } + }; + diff --git a/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch b/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch index 9821c0c86ee22c..ab674409d68fa4 100644 --- a/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch +++ b/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch @@ -12,16 +12,16 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c -@@ -21,6 +21,8 @@ - #define PHY_ID_AQR106 0x03a1b4d0 - #define PHY_ID_AQR107 0x03a1b4e0 +@@ -27,6 +27,8 @@ #define PHY_ID_AQR112 0x03a1b662 + #define PHY_ID_AQR412 0x03a1b712 + #define PHY_ID_AQR113 0x31c31c40 +#define PHY_ID_AQR112C 0x03a1b790 +#define PHY_ID_AQR112R 0x31c31d12 - #define PHY_ID_AQR113 0x31c31c40 - #define PHY_ID_AQR113C 0x31c31c12 - #define PHY_ID_AQCS109 0x03a1b5c2 -@@ -915,6 +917,30 @@ static struct phy_driver aqr_driver[] = + + #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 + #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) +@@ -973,6 +975,30 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, }, { @@ -52,12 +52,12 @@ Signed-off-by: Daniel Golle PHY_ID_MATCH_MODEL(PHY_ID_AQR113), .name = "Aquantia AQR113", .config_aneg = aqr_config_aneg, -@@ -945,6 +971,8 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, +@@ -1009,6 +1035,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR112C) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR112R) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, - { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, + { } + }; + From eda5930d431545bbdcd808657d50de999062fb81 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 19 Nov 2023 12:52:55 +0100 Subject: [PATCH 0750/1171] generic: 5.15: backport upstream Aquantia PHY firmware loader patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport merged upstream patch that adds support for firmware loader from NVMEM or attached filesystem for Aquantia PHYs. Refresh all kernel patches affected by this change. Also update the path for aquantia .ko that got moved to dedicated directory upstream. Signed-off-by: Christian Marangi [rmilecki: port to 5.15] Signed-off-by: Rafał Miłecki (cherry picked from commit 1b3259eb5cdcfecbfae7809b8a9febdbe22ac65f) --- package/kernel/linux/modules/netdevices.mk | 4 +- ...-aquantia-move-to-separate-directory.patch | 2310 +++++++++++++++++ ...antia-move-MMD_VEND-define-to-header.patch | 183 ++ ...y-aquantia-add-firmware-load-support.patch | 504 ++++ ...or-Motorcomm-yt8521-gigabit-ethernet.patch | 2 +- ...net-phy-add-Motorcomm-YT8531S-phy-id.patch | 2 +- ...or-Motorcomm-yt8531-gigabit-ethernet.patch | 2 +- .../hack-5.15/720-net-phy-add-aqr-phys.patch | 14 +- ...hy-aquantia-enable-AQR112-and-AQR412.patch | 14 +- ...aquantia-fix-system-side-protocol-mi.patch | 8 +- ...y-aquantia-Add-AQR113-driver-support.patch | 10 +- ...ntia-add-PHY_IDs-for-AQR112-variants.patch | 10 +- ...8-net-phy-Add-Qualcom-QCA807x-driver.patch | 4 +- .../500-gsw-rtl8367s-mt7622-support.patch | 4 +- ...er-for-MediaTek-SoC-built-in-GE-PHYs.patch | 4 +- ...phy-add-driver-for-MediaTek-2.5G-PHY.patch | 4 +- .../patches-5.15/705-add-rtl-phy.patch | 4 +- 17 files changed, 3040 insertions(+), 43 deletions(-) create mode 100644 target/linux/generic/backport-5.15/737-01-v6.7-net-phy-aquantia-move-to-separate-directory.patch create mode 100644 target/linux/generic/backport-5.15/737-02-v6.7-net-phy-aquantia-move-MMD_VEND-define-to-header.patch create mode 100644 target/linux/generic/backport-5.15/737-03-v6.7-net-phy-aquantia-add-firmware-load-support.patch diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index b8f2466cb48f7c..2a7cc65d60594d 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -361,9 +361,9 @@ $(eval $(call KernelPackage,phy-smsc)) define KernelPackage/phy-aquantia SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Aquantia Ethernet PHYs - DEPENDS:=+kmod-libphy +kmod-hwmon-core + DEPENDS:=+kmod-libphy +kmod-hwmon-core +kmod-lib-crc-ccitt KCONFIG:=CONFIG_AQUANTIA_PHY - FILES:=$(LINUX_DIR)/drivers/net/phy/aquantia.ko + FILES:=$(LINUX_DIR)/drivers/net/phy/aquantia/aquantia.ko AUTOLOAD:=$(call AutoLoad,18,aquantia,1) endef diff --git a/target/linux/generic/backport-5.15/737-01-v6.7-net-phy-aquantia-move-to-separate-directory.patch b/target/linux/generic/backport-5.15/737-01-v6.7-net-phy-aquantia-move-to-separate-directory.patch new file mode 100644 index 00000000000000..4bb786e7901020 --- /dev/null +++ b/target/linux/generic/backport-5.15/737-01-v6.7-net-phy-aquantia-move-to-separate-directory.patch @@ -0,0 +1,2310 @@ +From d2213db3f49bce8e7a87c8de05b9a091f78f654e Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 14 Nov 2023 15:08:41 +0100 +Subject: [PATCH 1/3] net: phy: aquantia: move to separate directory + +Move aquantia PHY driver to separate driectory in preparation for +firmware loading support to keep things tidy. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/Kconfig | 5 +---- + drivers/net/phy/Makefile | 6 +----- + drivers/net/phy/aquantia/Kconfig | 5 +++++ + drivers/net/phy/aquantia/Makefile | 6 ++++++ + drivers/net/phy/{ => aquantia}/aquantia.h | 0 + drivers/net/phy/{ => aquantia}/aquantia_hwmon.c | 0 + drivers/net/phy/{ => aquantia}/aquantia_main.c | 0 + 7 files changed, 13 insertions(+), 9 deletions(-) + create mode 100644 drivers/net/phy/aquantia/Kconfig + create mode 100644 drivers/net/phy/aquantia/Makefile + rename drivers/net/phy/{ => aquantia}/aquantia.h (100%) + rename drivers/net/phy/{ => aquantia}/aquantia_hwmon.c (100%) + rename drivers/net/phy/{ => aquantia}/aquantia_main.c (100%) + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -83,10 +83,7 @@ config ADIN_PHY + - ADIN1300 - Robust,Industrial, Low Latency 10/100/1000 Gigabit + Ethernet PHY + +-config AQUANTIA_PHY +- tristate "Aquantia PHYs" +- help +- Currently supports the Aquantia AQ1202, AQ2104, AQR105, AQR405 ++source "drivers/net/phy/aquantia/Kconfig" + + config AX88796B_PHY + tristate "Asix PHYs" +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -32,11 +32,7 @@ obj-y += $(sfp-obj-y) $(sfp-obj-m) + + obj-$(CONFIG_ADIN_PHY) += adin.o + obj-$(CONFIG_AMD_PHY) += amd.o +-aquantia-objs += aquantia_main.o +-ifdef CONFIG_HWMON +-aquantia-objs += aquantia_hwmon.o +-endif +-obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o ++obj-$(CONFIG_AQUANTIA_PHY) += aquantia/ + obj-$(CONFIG_AT803X_PHY) += at803x.o + obj-$(CONFIG_AX88796B_PHY) += ax88796b.o + obj-$(CONFIG_BCM54140_PHY) += bcm54140.o +--- /dev/null ++++ b/drivers/net/phy/aquantia/Kconfig +@@ -0,0 +1,5 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++config AQUANTIA_PHY ++ tristate "Aquantia PHYs" ++ help ++ Currently supports the Aquantia AQ1202, AQ2104, AQR105, AQR405 +--- /dev/null ++++ b/drivers/net/phy/aquantia/Makefile +@@ -0,0 +1,6 @@ ++# SPDX-License-Identifier: GPL-2.0 ++aquantia-objs += aquantia_main.o ++ifdef CONFIG_HWMON ++aquantia-objs += aquantia_hwmon.o ++endif ++obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o +--- a/drivers/net/phy/aquantia.h ++++ /dev/null +@@ -1,16 +0,0 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ +-/* HWMON driver for Aquantia PHY +- * +- * Author: Nikita Yushchenko +- * Author: Andrew Lunn +- * Author: Heiner Kallweit +- */ +- +-#include +-#include +- +-#if IS_REACHABLE(CONFIG_HWMON) +-int aqr_hwmon_probe(struct phy_device *phydev); +-#else +-static inline int aqr_hwmon_probe(struct phy_device *phydev) { return 0; } +-#endif +--- /dev/null ++++ b/drivers/net/phy/aquantia/aquantia.h +@@ -0,0 +1,16 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* HWMON driver for Aquantia PHY ++ * ++ * Author: Nikita Yushchenko ++ * Author: Andrew Lunn ++ * Author: Heiner Kallweit ++ */ ++ ++#include ++#include ++ ++#if IS_REACHABLE(CONFIG_HWMON) ++int aqr_hwmon_probe(struct phy_device *phydev); ++#else ++static inline int aqr_hwmon_probe(struct phy_device *phydev) { return 0; } ++#endif +--- /dev/null ++++ b/drivers/net/phy/aquantia/aquantia_hwmon.c +@@ -0,0 +1,250 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* HWMON driver for Aquantia PHY ++ * ++ * Author: Nikita Yushchenko ++ * Author: Andrew Lunn ++ * Author: Heiner Kallweit ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include "aquantia.h" ++ ++/* Vendor specific 1, MDIO_MMD_VEND2 */ ++#define VEND1_THERMAL_PROV_HIGH_TEMP_FAIL 0xc421 ++#define VEND1_THERMAL_PROV_LOW_TEMP_FAIL 0xc422 ++#define VEND1_THERMAL_PROV_HIGH_TEMP_WARN 0xc423 ++#define VEND1_THERMAL_PROV_LOW_TEMP_WARN 0xc424 ++#define VEND1_THERMAL_STAT1 0xc820 ++#define VEND1_THERMAL_STAT2 0xc821 ++#define VEND1_THERMAL_STAT2_VALID BIT(0) ++#define VEND1_GENERAL_STAT1 0xc830 ++#define VEND1_GENERAL_STAT1_HIGH_TEMP_FAIL BIT(14) ++#define VEND1_GENERAL_STAT1_LOW_TEMP_FAIL BIT(13) ++#define VEND1_GENERAL_STAT1_HIGH_TEMP_WARN BIT(12) ++#define VEND1_GENERAL_STAT1_LOW_TEMP_WARN BIT(11) ++ ++#if IS_REACHABLE(CONFIG_HWMON) ++ ++static umode_t aqr_hwmon_is_visible(const void *data, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel) ++{ ++ if (type != hwmon_temp) ++ return 0; ++ ++ switch (attr) { ++ case hwmon_temp_input: ++ case hwmon_temp_min_alarm: ++ case hwmon_temp_max_alarm: ++ case hwmon_temp_lcrit_alarm: ++ case hwmon_temp_crit_alarm: ++ return 0444; ++ case hwmon_temp_min: ++ case hwmon_temp_max: ++ case hwmon_temp_lcrit: ++ case hwmon_temp_crit: ++ return 0644; ++ default: ++ return 0; ++ } ++} ++ ++static int aqr_hwmon_get(struct phy_device *phydev, int reg, long *value) ++{ ++ int temp = phy_read_mmd(phydev, MDIO_MMD_VEND1, reg); ++ ++ if (temp < 0) ++ return temp; ++ ++ /* 16 bit value is 2's complement with LSB = 1/256th degree Celsius */ ++ *value = (s16)temp * 1000 / 256; ++ ++ return 0; ++} ++ ++static int aqr_hwmon_set(struct phy_device *phydev, int reg, long value) ++{ ++ int temp; ++ ++ if (value >= 128000 || value < -128000) ++ return -ERANGE; ++ ++ temp = value * 256 / 1000; ++ ++ /* temp is in s16 range and we're interested in lower 16 bits only */ ++ return phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, (u16)temp); ++} ++ ++static int aqr_hwmon_test_bit(struct phy_device *phydev, int reg, int bit) ++{ ++ int val = phy_read_mmd(phydev, MDIO_MMD_VEND1, reg); ++ ++ if (val < 0) ++ return val; ++ ++ return !!(val & bit); ++} ++ ++static int aqr_hwmon_status1(struct phy_device *phydev, int bit, long *value) ++{ ++ int val = aqr_hwmon_test_bit(phydev, VEND1_GENERAL_STAT1, bit); ++ ++ if (val < 0) ++ return val; ++ ++ *value = val; ++ ++ return 0; ++} ++ ++static int aqr_hwmon_read(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long *value) ++{ ++ struct phy_device *phydev = dev_get_drvdata(dev); ++ int reg; ++ ++ if (type != hwmon_temp) ++ return -EOPNOTSUPP; ++ ++ switch (attr) { ++ case hwmon_temp_input: ++ reg = aqr_hwmon_test_bit(phydev, VEND1_THERMAL_STAT2, ++ VEND1_THERMAL_STAT2_VALID); ++ if (reg < 0) ++ return reg; ++ if (!reg) ++ return -EBUSY; ++ ++ return aqr_hwmon_get(phydev, VEND1_THERMAL_STAT1, value); ++ ++ case hwmon_temp_lcrit: ++ return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_LOW_TEMP_FAIL, ++ value); ++ case hwmon_temp_min: ++ return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_LOW_TEMP_WARN, ++ value); ++ case hwmon_temp_max: ++ return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_WARN, ++ value); ++ case hwmon_temp_crit: ++ return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_FAIL, ++ value); ++ case hwmon_temp_lcrit_alarm: ++ return aqr_hwmon_status1(phydev, ++ VEND1_GENERAL_STAT1_LOW_TEMP_FAIL, ++ value); ++ case hwmon_temp_min_alarm: ++ return aqr_hwmon_status1(phydev, ++ VEND1_GENERAL_STAT1_LOW_TEMP_WARN, ++ value); ++ case hwmon_temp_max_alarm: ++ return aqr_hwmon_status1(phydev, ++ VEND1_GENERAL_STAT1_HIGH_TEMP_WARN, ++ value); ++ case hwmon_temp_crit_alarm: ++ return aqr_hwmon_status1(phydev, ++ VEND1_GENERAL_STAT1_HIGH_TEMP_FAIL, ++ value); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static int aqr_hwmon_write(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long value) ++{ ++ struct phy_device *phydev = dev_get_drvdata(dev); ++ ++ if (type != hwmon_temp) ++ return -EOPNOTSUPP; ++ ++ switch (attr) { ++ case hwmon_temp_lcrit: ++ return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_LOW_TEMP_FAIL, ++ value); ++ case hwmon_temp_min: ++ return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_LOW_TEMP_WARN, ++ value); ++ case hwmon_temp_max: ++ return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_WARN, ++ value); ++ case hwmon_temp_crit: ++ return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_FAIL, ++ value); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static const struct hwmon_ops aqr_hwmon_ops = { ++ .is_visible = aqr_hwmon_is_visible, ++ .read = aqr_hwmon_read, ++ .write = aqr_hwmon_write, ++}; ++ ++static u32 aqr_hwmon_chip_config[] = { ++ HWMON_C_REGISTER_TZ, ++ 0, ++}; ++ ++static const struct hwmon_channel_info aqr_hwmon_chip = { ++ .type = hwmon_chip, ++ .config = aqr_hwmon_chip_config, ++}; ++ ++static u32 aqr_hwmon_temp_config[] = { ++ HWMON_T_INPUT | ++ HWMON_T_MAX | HWMON_T_MIN | ++ HWMON_T_MAX_ALARM | HWMON_T_MIN_ALARM | ++ HWMON_T_CRIT | HWMON_T_LCRIT | ++ HWMON_T_CRIT_ALARM | HWMON_T_LCRIT_ALARM, ++ 0, ++}; ++ ++static const struct hwmon_channel_info aqr_hwmon_temp = { ++ .type = hwmon_temp, ++ .config = aqr_hwmon_temp_config, ++}; ++ ++static const struct hwmon_channel_info *aqr_hwmon_info[] = { ++ &aqr_hwmon_chip, ++ &aqr_hwmon_temp, ++ NULL, ++}; ++ ++static const struct hwmon_chip_info aqr_hwmon_chip_info = { ++ .ops = &aqr_hwmon_ops, ++ .info = aqr_hwmon_info, ++}; ++ ++int aqr_hwmon_probe(struct phy_device *phydev) ++{ ++ struct device *dev = &phydev->mdio.dev; ++ struct device *hwmon_dev; ++ char *hwmon_name; ++ int i, j; ++ ++ hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); ++ if (!hwmon_name) ++ return -ENOMEM; ++ ++ for (i = j = 0; hwmon_name[i]; i++) { ++ if (isalnum(hwmon_name[i])) { ++ if (i != j) ++ hwmon_name[j] = hwmon_name[i]; ++ j++; ++ } ++ } ++ hwmon_name[j] = '\0'; ++ ++ hwmon_dev = devm_hwmon_device_register_with_info(dev, hwmon_name, ++ phydev, &aqr_hwmon_chip_info, NULL); ++ ++ return PTR_ERR_OR_ZERO(hwmon_dev); ++} ++ ++#endif +--- /dev/null ++++ b/drivers/net/phy/aquantia/aquantia_main.c +@@ -0,0 +1,844 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Driver for Aquantia PHY ++ * ++ * Author: Shaohui Xie ++ * ++ * Copyright 2015 Freescale Semiconductor, Inc. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "aquantia.h" ++ ++#define PHY_ID_AQ1202 0x03a1b445 ++#define PHY_ID_AQ2104 0x03a1b460 ++#define PHY_ID_AQR105 0x03a1b4a2 ++#define PHY_ID_AQR106 0x03a1b4d0 ++#define PHY_ID_AQR107 0x03a1b4e0 ++#define PHY_ID_AQCS109 0x03a1b5c2 ++#define PHY_ID_AQR405 0x03a1b4b0 ++#define PHY_ID_AQR113C 0x31c31c12 ++ ++#define MDIO_PHYXS_VEND_IF_STATUS 0xe812 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR 0 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX 1 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI 2 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII 3 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI 4 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII 6 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI 7 ++#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII 10 ++ ++#define MDIO_AN_VEND_PROV 0xc400 ++#define MDIO_AN_VEND_PROV_1000BASET_FULL BIT(15) ++#define MDIO_AN_VEND_PROV_1000BASET_HALF BIT(14) ++#define MDIO_AN_VEND_PROV_5000BASET_FULL BIT(11) ++#define MDIO_AN_VEND_PROV_2500BASET_FULL BIT(10) ++#define MDIO_AN_VEND_PROV_DOWNSHIFT_EN BIT(4) ++#define MDIO_AN_VEND_PROV_DOWNSHIFT_MASK GENMASK(3, 0) ++#define MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT 4 ++ ++#define MDIO_AN_TX_VEND_STATUS1 0xc800 ++#define MDIO_AN_TX_VEND_STATUS1_RATE_MASK GENMASK(3, 1) ++#define MDIO_AN_TX_VEND_STATUS1_10BASET 0 ++#define MDIO_AN_TX_VEND_STATUS1_100BASETX 1 ++#define MDIO_AN_TX_VEND_STATUS1_1000BASET 2 ++#define MDIO_AN_TX_VEND_STATUS1_10GBASET 3 ++#define MDIO_AN_TX_VEND_STATUS1_2500BASET 4 ++#define MDIO_AN_TX_VEND_STATUS1_5000BASET 5 ++#define MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX BIT(0) ++ ++#define MDIO_AN_TX_VEND_INT_STATUS1 0xcc00 ++#define MDIO_AN_TX_VEND_INT_STATUS1_DOWNSHIFT BIT(1) ++ ++#define MDIO_AN_TX_VEND_INT_STATUS2 0xcc01 ++#define MDIO_AN_TX_VEND_INT_STATUS2_MASK BIT(0) ++ ++#define MDIO_AN_TX_VEND_INT_MASK2 0xd401 ++#define MDIO_AN_TX_VEND_INT_MASK2_LINK BIT(0) ++ ++#define MDIO_AN_RX_LP_STAT1 0xe820 ++#define MDIO_AN_RX_LP_STAT1_1000BASET_FULL BIT(15) ++#define MDIO_AN_RX_LP_STAT1_1000BASET_HALF BIT(14) ++#define MDIO_AN_RX_LP_STAT1_SHORT_REACH BIT(13) ++#define MDIO_AN_RX_LP_STAT1_AQRATE_DOWNSHIFT BIT(12) ++#define MDIO_AN_RX_LP_STAT1_AQ_PHY BIT(2) ++ ++#define MDIO_AN_RX_LP_STAT4 0xe823 ++#define MDIO_AN_RX_LP_STAT4_FW_MAJOR GENMASK(15, 8) ++#define MDIO_AN_RX_LP_STAT4_FW_MINOR GENMASK(7, 0) ++ ++#define MDIO_AN_RX_VEND_STAT3 0xe832 ++#define MDIO_AN_RX_VEND_STAT3_AFR BIT(0) ++ ++/* MDIO_MMD_C22EXT */ ++#define MDIO_C22EXT_STAT_SGMII_RX_GOOD_FRAMES 0xd292 ++#define MDIO_C22EXT_STAT_SGMII_RX_BAD_FRAMES 0xd294 ++#define MDIO_C22EXT_STAT_SGMII_RX_FALSE_CARRIER 0xd297 ++#define MDIO_C22EXT_STAT_SGMII_TX_GOOD_FRAMES 0xd313 ++#define MDIO_C22EXT_STAT_SGMII_TX_BAD_FRAMES 0xd315 ++#define MDIO_C22EXT_STAT_SGMII_TX_FALSE_CARRIER 0xd317 ++#define MDIO_C22EXT_STAT_SGMII_TX_COLLISIONS 0xd318 ++#define MDIO_C22EXT_STAT_SGMII_TX_LINE_COLLISIONS 0xd319 ++#define MDIO_C22EXT_STAT_SGMII_TX_FRAME_ALIGN_ERR 0xd31a ++#define MDIO_C22EXT_STAT_SGMII_TX_RUNT_FRAMES 0xd31b ++ ++/* Vendor specific 1, MDIO_MMD_VEND1 */ ++#define VEND1_GLOBAL_FW_ID 0x0020 ++#define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) ++#define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) ++ ++#define VEND1_GLOBAL_GEN_STAT2 0xc831 ++#define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) ++ ++/* The following registers all have similar layouts; first the registers... */ ++#define VEND1_GLOBAL_CFG_10M 0x0310 ++#define VEND1_GLOBAL_CFG_100M 0x031b ++#define VEND1_GLOBAL_CFG_1G 0x031c ++#define VEND1_GLOBAL_CFG_2_5G 0x031d ++#define VEND1_GLOBAL_CFG_5G 0x031e ++#define VEND1_GLOBAL_CFG_10G 0x031f ++/* ...and now the fields */ ++#define VEND1_GLOBAL_CFG_RATE_ADAPT GENMASK(8, 7) ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_NONE 0 ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_USX 1 ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 ++ ++#define VEND1_GLOBAL_RSVD_STAT1 0xc885 ++#define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) ++#define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) ++ ++#define VEND1_GLOBAL_RSVD_STAT9 0xc88d ++#define VEND1_GLOBAL_RSVD_STAT9_MODE GENMASK(7, 0) ++#define VEND1_GLOBAL_RSVD_STAT9_1000BT2 0x23 ++ ++#define VEND1_GLOBAL_INT_STD_STATUS 0xfc00 ++#define VEND1_GLOBAL_INT_VEND_STATUS 0xfc01 ++ ++#define VEND1_GLOBAL_INT_STD_MASK 0xff00 ++#define VEND1_GLOBAL_INT_STD_MASK_PMA1 BIT(15) ++#define VEND1_GLOBAL_INT_STD_MASK_PMA2 BIT(14) ++#define VEND1_GLOBAL_INT_STD_MASK_PCS1 BIT(13) ++#define VEND1_GLOBAL_INT_STD_MASK_PCS2 BIT(12) ++#define VEND1_GLOBAL_INT_STD_MASK_PCS3 BIT(11) ++#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS1 BIT(10) ++#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS2 BIT(9) ++#define VEND1_GLOBAL_INT_STD_MASK_AN1 BIT(8) ++#define VEND1_GLOBAL_INT_STD_MASK_AN2 BIT(7) ++#define VEND1_GLOBAL_INT_STD_MASK_GBE BIT(6) ++#define VEND1_GLOBAL_INT_STD_MASK_ALL BIT(0) ++ ++#define VEND1_GLOBAL_INT_VEND_MASK 0xff01 ++#define VEND1_GLOBAL_INT_VEND_MASK_PMA BIT(15) ++#define VEND1_GLOBAL_INT_VEND_MASK_PCS BIT(14) ++#define VEND1_GLOBAL_INT_VEND_MASK_PHY_XS BIT(13) ++#define VEND1_GLOBAL_INT_VEND_MASK_AN BIT(12) ++#define VEND1_GLOBAL_INT_VEND_MASK_GBE BIT(11) ++#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL1 BIT(2) ++#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1) ++#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0) ++ ++/* Sleep and timeout for checking if the Processor-Intensive ++ * MDIO operation is finished ++ */ ++#define AQR107_OP_IN_PROG_SLEEP 1000 ++#define AQR107_OP_IN_PROG_TIMEOUT 100000 ++ ++struct aqr107_hw_stat { ++ const char *name; ++ int reg; ++ int size; ++}; ++ ++#define SGMII_STAT(n, r, s) { n, MDIO_C22EXT_STAT_SGMII_ ## r, s } ++static const struct aqr107_hw_stat aqr107_hw_stats[] = { ++ SGMII_STAT("sgmii_rx_good_frames", RX_GOOD_FRAMES, 26), ++ SGMII_STAT("sgmii_rx_bad_frames", RX_BAD_FRAMES, 26), ++ SGMII_STAT("sgmii_rx_false_carrier_events", RX_FALSE_CARRIER, 8), ++ SGMII_STAT("sgmii_tx_good_frames", TX_GOOD_FRAMES, 26), ++ SGMII_STAT("sgmii_tx_bad_frames", TX_BAD_FRAMES, 26), ++ SGMII_STAT("sgmii_tx_false_carrier_events", TX_FALSE_CARRIER, 8), ++ SGMII_STAT("sgmii_tx_collisions", TX_COLLISIONS, 8), ++ SGMII_STAT("sgmii_tx_line_collisions", TX_LINE_COLLISIONS, 8), ++ SGMII_STAT("sgmii_tx_frame_alignment_err", TX_FRAME_ALIGN_ERR, 16), ++ SGMII_STAT("sgmii_tx_runt_frames", TX_RUNT_FRAMES, 22), ++}; ++#define AQR107_SGMII_STAT_SZ ARRAY_SIZE(aqr107_hw_stats) ++ ++struct aqr107_priv { ++ u64 sgmii_stats[AQR107_SGMII_STAT_SZ]; ++}; ++ ++static int aqr107_get_sset_count(struct phy_device *phydev) ++{ ++ return AQR107_SGMII_STAT_SZ; ++} ++ ++static void aqr107_get_strings(struct phy_device *phydev, u8 *data) ++{ ++ int i; ++ ++ for (i = 0; i < AQR107_SGMII_STAT_SZ; i++) ++ strscpy(data + i * ETH_GSTRING_LEN, aqr107_hw_stats[i].name, ++ ETH_GSTRING_LEN); ++} ++ ++static u64 aqr107_get_stat(struct phy_device *phydev, int index) ++{ ++ const struct aqr107_hw_stat *stat = aqr107_hw_stats + index; ++ int len_l = min(stat->size, 16); ++ int len_h = stat->size - len_l; ++ u64 ret; ++ int val; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_C22EXT, stat->reg); ++ if (val < 0) ++ return U64_MAX; ++ ++ ret = val & GENMASK(len_l - 1, 0); ++ if (len_h) { ++ val = phy_read_mmd(phydev, MDIO_MMD_C22EXT, stat->reg + 1); ++ if (val < 0) ++ return U64_MAX; ++ ++ ret += (val & GENMASK(len_h - 1, 0)) << 16; ++ } ++ ++ return ret; ++} ++ ++static void aqr107_get_stats(struct phy_device *phydev, ++ struct ethtool_stats *stats, u64 *data) ++{ ++ struct aqr107_priv *priv = phydev->priv; ++ u64 val; ++ int i; ++ ++ for (i = 0; i < AQR107_SGMII_STAT_SZ; i++) { ++ val = aqr107_get_stat(phydev, i); ++ if (val == U64_MAX) ++ phydev_err(phydev, "Reading HW Statistics failed for %s\n", ++ aqr107_hw_stats[i].name); ++ else ++ priv->sgmii_stats[i] += val; ++ ++ data[i] = priv->sgmii_stats[i]; ++ } ++} ++ ++static int aqr_config_aneg(struct phy_device *phydev) ++{ ++ bool changed = false; ++ u16 reg; ++ int ret; ++ ++ if (phydev->autoneg == AUTONEG_DISABLE) ++ return genphy_c45_pma_setup_forced(phydev); ++ ++ ret = genphy_c45_an_config_aneg(phydev); ++ if (ret < 0) ++ return ret; ++ if (ret > 0) ++ changed = true; ++ ++ /* Clause 45 has no standardized support for 1000BaseT, therefore ++ * use vendor registers for this mode. ++ */ ++ reg = 0; ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, ++ phydev->advertising)) ++ reg |= MDIO_AN_VEND_PROV_1000BASET_FULL; ++ ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, ++ phydev->advertising)) ++ reg |= MDIO_AN_VEND_PROV_1000BASET_HALF; ++ ++ /* Handle the case when the 2.5G and 5G speeds are not advertised */ ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, ++ phydev->advertising)) ++ reg |= MDIO_AN_VEND_PROV_2500BASET_FULL; ++ ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, ++ phydev->advertising)) ++ reg |= MDIO_AN_VEND_PROV_5000BASET_FULL; ++ ++ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV, ++ MDIO_AN_VEND_PROV_1000BASET_HALF | ++ MDIO_AN_VEND_PROV_1000BASET_FULL | ++ MDIO_AN_VEND_PROV_2500BASET_FULL | ++ MDIO_AN_VEND_PROV_5000BASET_FULL, reg); ++ if (ret < 0) ++ return ret; ++ if (ret > 0) ++ changed = true; ++ ++ return genphy_c45_check_and_restart_aneg(phydev, changed); ++} ++ ++static int aqr_config_intr(struct phy_device *phydev) ++{ ++ bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; ++ int err; ++ ++ if (en) { ++ /* Clear any pending interrupts before enabling them */ ++ err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2); ++ if (err < 0) ++ return err; ++ } ++ ++ err = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_MASK2, ++ en ? MDIO_AN_TX_VEND_INT_MASK2_LINK : 0); ++ if (err < 0) ++ return err; ++ ++ err = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_STD_MASK, ++ en ? VEND1_GLOBAL_INT_STD_MASK_ALL : 0); ++ if (err < 0) ++ return err; ++ ++ err = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_VEND_MASK, ++ en ? VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 | ++ VEND1_GLOBAL_INT_VEND_MASK_AN : 0); ++ if (err < 0) ++ return err; ++ ++ if (!en) { ++ /* Clear any pending interrupts after we have disabled them */ ++ err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2); ++ if (err < 0) ++ return err; ++ } ++ ++ return 0; ++} ++ ++static irqreturn_t aqr_handle_interrupt(struct phy_device *phydev) ++{ ++ int irq_status; ++ ++ irq_status = phy_read_mmd(phydev, MDIO_MMD_AN, ++ MDIO_AN_TX_VEND_INT_STATUS2); ++ if (irq_status < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ if (!(irq_status & MDIO_AN_TX_VEND_INT_STATUS2_MASK)) ++ return IRQ_NONE; ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ ++static int aqr_read_status(struct phy_device *phydev) ++{ ++ int val; ++ ++ if (phydev->autoneg == AUTONEG_ENABLE) { ++ val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_LP_STAT1); ++ if (val < 0) ++ return val; ++ ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, ++ phydev->lp_advertising, ++ val & MDIO_AN_RX_LP_STAT1_1000BASET_FULL); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, ++ phydev->lp_advertising, ++ val & MDIO_AN_RX_LP_STAT1_1000BASET_HALF); ++ } ++ ++ return genphy_c45_read_status(phydev); ++} ++ ++static int aqr107_read_rate(struct phy_device *phydev) ++{ ++ u32 config_reg; ++ int val; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_STATUS1); ++ if (val < 0) ++ return val; ++ ++ if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) ++ phydev->duplex = DUPLEX_FULL; ++ else ++ phydev->duplex = DUPLEX_HALF; ++ ++ switch (FIELD_GET(MDIO_AN_TX_VEND_STATUS1_RATE_MASK, val)) { ++ case MDIO_AN_TX_VEND_STATUS1_10BASET: ++ phydev->speed = SPEED_10; ++ config_reg = VEND1_GLOBAL_CFG_10M; ++ break; ++ case MDIO_AN_TX_VEND_STATUS1_100BASETX: ++ phydev->speed = SPEED_100; ++ config_reg = VEND1_GLOBAL_CFG_100M; ++ break; ++ case MDIO_AN_TX_VEND_STATUS1_1000BASET: ++ phydev->speed = SPEED_1000; ++ config_reg = VEND1_GLOBAL_CFG_1G; ++ break; ++ case MDIO_AN_TX_VEND_STATUS1_2500BASET: ++ phydev->speed = SPEED_2500; ++ config_reg = VEND1_GLOBAL_CFG_2_5G; ++ break; ++ case MDIO_AN_TX_VEND_STATUS1_5000BASET: ++ phydev->speed = SPEED_5000; ++ config_reg = VEND1_GLOBAL_CFG_5G; ++ break; ++ case MDIO_AN_TX_VEND_STATUS1_10GBASET: ++ phydev->speed = SPEED_10000; ++ config_reg = VEND1_GLOBAL_CFG_10G; ++ break; ++ default: ++ phydev->speed = SPEED_UNKNOWN; ++ return 0; ++ } ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, config_reg); ++ if (val < 0) ++ return val; ++ ++ if (FIELD_GET(VEND1_GLOBAL_CFG_RATE_ADAPT, val) == ++ VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE) ++ phydev->rate_matching = RATE_MATCH_PAUSE; ++ else ++ phydev->rate_matching = RATE_MATCH_NONE; ++ ++ return 0; ++} ++ ++static int aqr107_read_status(struct phy_device *phydev) ++{ ++ int val, ret; ++ ++ ret = aqr_read_status(phydev); ++ if (ret) ++ return ret; ++ ++ if (!phydev->link || phydev->autoneg == AUTONEG_DISABLE) ++ return 0; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_PHYXS, MDIO_PHYXS_VEND_IF_STATUS); ++ if (val < 0) ++ return val; ++ ++ switch (FIELD_GET(MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK, val)) { ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR: ++ phydev->interface = PHY_INTERFACE_MODE_10GKR; ++ break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX: ++ phydev->interface = PHY_INTERFACE_MODE_1000BASEKX; ++ break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI: ++ phydev->interface = PHY_INTERFACE_MODE_10GBASER; ++ break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII: ++ phydev->interface = PHY_INTERFACE_MODE_USXGMII; ++ break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI: ++ phydev->interface = PHY_INTERFACE_MODE_XAUI; ++ break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII: ++ phydev->interface = PHY_INTERFACE_MODE_SGMII; ++ break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI: ++ phydev->interface = PHY_INTERFACE_MODE_RXAUI; ++ break; ++ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII: ++ phydev->interface = PHY_INTERFACE_MODE_2500BASEX; ++ break; ++ default: ++ phydev->interface = PHY_INTERFACE_MODE_NA; ++ break; ++ } ++ ++ /* Read possibly downshifted rate from vendor register */ ++ return aqr107_read_rate(phydev); ++} ++ ++static int aqr107_get_downshift(struct phy_device *phydev, u8 *data) ++{ ++ int val, cnt, enable; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV); ++ if (val < 0) ++ return val; ++ ++ enable = FIELD_GET(MDIO_AN_VEND_PROV_DOWNSHIFT_EN, val); ++ cnt = FIELD_GET(MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, val); ++ ++ *data = enable && cnt ? cnt : DOWNSHIFT_DEV_DISABLE; ++ ++ return 0; ++} ++ ++static int aqr107_set_downshift(struct phy_device *phydev, u8 cnt) ++{ ++ int val = 0; ++ ++ if (!FIELD_FIT(MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, cnt)) ++ return -E2BIG; ++ ++ if (cnt != DOWNSHIFT_DEV_DISABLE) { ++ val = MDIO_AN_VEND_PROV_DOWNSHIFT_EN; ++ val |= FIELD_PREP(MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, cnt); ++ } ++ ++ return phy_modify_mmd(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV, ++ MDIO_AN_VEND_PROV_DOWNSHIFT_EN | ++ MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, val); ++} ++ ++static int aqr107_get_tunable(struct phy_device *phydev, ++ struct ethtool_tunable *tuna, void *data) ++{ ++ switch (tuna->id) { ++ case ETHTOOL_PHY_DOWNSHIFT: ++ return aqr107_get_downshift(phydev, data); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static int aqr107_set_tunable(struct phy_device *phydev, ++ struct ethtool_tunable *tuna, const void *data) ++{ ++ switch (tuna->id) { ++ case ETHTOOL_PHY_DOWNSHIFT: ++ return aqr107_set_downshift(phydev, *(const u8 *)data); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++/* If we configure settings whilst firmware is still initializing the chip, ++ * then these settings may be overwritten. Therefore make sure chip ++ * initialization has completed. Use presence of the firmware ID as ++ * indicator for initialization having completed. ++ * The chip also provides a "reset completed" bit, but it's cleared after ++ * read. Therefore function would time out if called again. ++ */ ++static int aqr107_wait_reset_complete(struct phy_device *phydev) ++{ ++ int val; ++ ++ return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, ++ VEND1_GLOBAL_FW_ID, val, val != 0, ++ 20000, 2000000, false); ++} ++ ++static void aqr107_chip_info(struct phy_device *phydev) ++{ ++ u8 fw_major, fw_minor, build_id, prov_id; ++ int val; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_FW_ID); ++ if (val < 0) ++ return; ++ ++ fw_major = FIELD_GET(VEND1_GLOBAL_FW_ID_MAJOR, val); ++ fw_minor = FIELD_GET(VEND1_GLOBAL_FW_ID_MINOR, val); ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_RSVD_STAT1); ++ if (val < 0) ++ return; ++ ++ build_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID, val); ++ prov_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val); ++ ++ phydev_dbg(phydev, "FW %u.%u, Build %u, Provisioning %u\n", ++ fw_major, fw_minor, build_id, prov_id); ++} ++ ++static int aqr107_config_init(struct phy_device *phydev) ++{ ++ int ret; ++ ++ /* Check that the PHY interface type is compatible */ ++ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && ++ phydev->interface != PHY_INTERFACE_MODE_1000BASEKX && ++ phydev->interface != PHY_INTERFACE_MODE_2500BASEX && ++ phydev->interface != PHY_INTERFACE_MODE_XGMII && ++ phydev->interface != PHY_INTERFACE_MODE_USXGMII && ++ phydev->interface != PHY_INTERFACE_MODE_10GKR && ++ phydev->interface != PHY_INTERFACE_MODE_10GBASER && ++ phydev->interface != PHY_INTERFACE_MODE_XAUI && ++ phydev->interface != PHY_INTERFACE_MODE_RXAUI) ++ return -ENODEV; ++ ++ WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, ++ "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n"); ++ ++ ret = aqr107_wait_reset_complete(phydev); ++ if (!ret) ++ aqr107_chip_info(phydev); ++ ++ return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT); ++} ++ ++static int aqcs109_config_init(struct phy_device *phydev) ++{ ++ int ret; ++ ++ /* Check that the PHY interface type is compatible */ ++ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && ++ phydev->interface != PHY_INTERFACE_MODE_2500BASEX) ++ return -ENODEV; ++ ++ ret = aqr107_wait_reset_complete(phydev); ++ if (!ret) ++ aqr107_chip_info(phydev); ++ ++ /* AQCS109 belongs to a chip family partially supporting 10G and 5G. ++ * PMA speed ability bits are the same for all members of the family, ++ * AQCS109 however supports speeds up to 2.5G only. ++ */ ++ ret = phy_set_max_speed(phydev, SPEED_2500); ++ if (ret) ++ return ret; ++ ++ return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT); ++} ++ ++static void aqr107_link_change_notify(struct phy_device *phydev) ++{ ++ u8 fw_major, fw_minor; ++ bool downshift, short_reach, afr; ++ int mode, val; ++ ++ if (phydev->state != PHY_RUNNING || phydev->autoneg == AUTONEG_DISABLE) ++ return; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_LP_STAT1); ++ /* call failed or link partner is no Aquantia PHY */ ++ if (val < 0 || !(val & MDIO_AN_RX_LP_STAT1_AQ_PHY)) ++ return; ++ ++ short_reach = val & MDIO_AN_RX_LP_STAT1_SHORT_REACH; ++ downshift = val & MDIO_AN_RX_LP_STAT1_AQRATE_DOWNSHIFT; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_LP_STAT4); ++ if (val < 0) ++ return; ++ ++ fw_major = FIELD_GET(MDIO_AN_RX_LP_STAT4_FW_MAJOR, val); ++ fw_minor = FIELD_GET(MDIO_AN_RX_LP_STAT4_FW_MINOR, val); ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_VEND_STAT3); ++ if (val < 0) ++ return; ++ ++ afr = val & MDIO_AN_RX_VEND_STAT3_AFR; ++ ++ phydev_dbg(phydev, "Link partner is Aquantia PHY, FW %u.%u%s%s%s\n", ++ fw_major, fw_minor, ++ short_reach ? ", short reach mode" : "", ++ downshift ? ", fast-retrain downshift advertised" : "", ++ afr ? ", fast reframe advertised" : ""); ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_RSVD_STAT9); ++ if (val < 0) ++ return; ++ ++ mode = FIELD_GET(VEND1_GLOBAL_RSVD_STAT9_MODE, val); ++ if (mode == VEND1_GLOBAL_RSVD_STAT9_1000BT2) ++ phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n"); ++} ++ ++static int aqr107_wait_processor_intensive_op(struct phy_device *phydev) ++{ ++ int val, err; ++ ++ /* The datasheet notes to wait at least 1ms after issuing a ++ * processor intensive operation before checking. ++ * We cannot use the 'sleep_before_read' parameter of read_poll_timeout ++ * because that just determines the maximum time slept, not the minimum. ++ */ ++ usleep_range(1000, 5000); ++ ++ err = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, ++ VEND1_GLOBAL_GEN_STAT2, val, ++ !(val & VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG), ++ AQR107_OP_IN_PROG_SLEEP, ++ AQR107_OP_IN_PROG_TIMEOUT, false); ++ if (err) { ++ phydev_err(phydev, "timeout: processor-intensive MDIO operation\n"); ++ return err; ++ } ++ ++ return 0; ++} ++ ++static int aqr107_get_rate_matching(struct phy_device *phydev, ++ phy_interface_t iface) ++{ ++ if (iface == PHY_INTERFACE_MODE_10GBASER || ++ iface == PHY_INTERFACE_MODE_2500BASEX || ++ iface == PHY_INTERFACE_MODE_NA) ++ return RATE_MATCH_PAUSE; ++ return RATE_MATCH_NONE; ++} ++ ++static int aqr107_suspend(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, ++ MDIO_CTRL1_LPOWER); ++ if (err) ++ return err; ++ ++ return aqr107_wait_processor_intensive_op(phydev); ++} ++ ++static int aqr107_resume(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, ++ MDIO_CTRL1_LPOWER); ++ if (err) ++ return err; ++ ++ return aqr107_wait_processor_intensive_op(phydev); ++} ++ ++static int aqr107_probe(struct phy_device *phydev) ++{ ++ phydev->priv = devm_kzalloc(&phydev->mdio.dev, ++ sizeof(struct aqr107_priv), GFP_KERNEL); ++ if (!phydev->priv) ++ return -ENOMEM; ++ ++ return aqr_hwmon_probe(phydev); ++} ++ ++static struct phy_driver aqr_driver[] = { ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), ++ .name = "Aquantia AQ1202", ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr_read_status, ++}, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQ2104), ++ .name = "Aquantia AQ2104", ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr_read_status, ++}, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQR105), ++ .name = "Aquantia AQR105", ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr_read_status, ++ .suspend = aqr107_suspend, ++ .resume = aqr107_resume, ++}, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQR106), ++ .name = "Aquantia AQR106", ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr_read_status, ++}, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQR107), ++ .name = "Aquantia AQR107", ++ .probe = aqr107_probe, ++ .get_rate_matching = aqr107_get_rate_matching, ++ .config_init = aqr107_config_init, ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr107_read_status, ++ .get_tunable = aqr107_get_tunable, ++ .set_tunable = aqr107_set_tunable, ++ .suspend = aqr107_suspend, ++ .resume = aqr107_resume, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, ++ .link_change_notify = aqr107_link_change_notify, ++}, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), ++ .name = "Aquantia AQCS109", ++ .probe = aqr107_probe, ++ .get_rate_matching = aqr107_get_rate_matching, ++ .config_init = aqcs109_config_init, ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr107_read_status, ++ .get_tunable = aqr107_get_tunable, ++ .set_tunable = aqr107_set_tunable, ++ .suspend = aqr107_suspend, ++ .resume = aqr107_resume, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, ++ .link_change_notify = aqr107_link_change_notify, ++}, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQR405), ++ .name = "Aquantia AQR405", ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr_read_status, ++}, ++{ ++ PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), ++ .name = "Aquantia AQR113C", ++ .probe = aqr107_probe, ++ .get_rate_matching = aqr107_get_rate_matching, ++ .config_init = aqr107_config_init, ++ .config_aneg = aqr_config_aneg, ++ .config_intr = aqr_config_intr, ++ .handle_interrupt = aqr_handle_interrupt, ++ .read_status = aqr107_read_status, ++ .get_tunable = aqr107_get_tunable, ++ .set_tunable = aqr107_set_tunable, ++ .suspend = aqr107_suspend, ++ .resume = aqr107_resume, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, ++ .link_change_notify = aqr107_link_change_notify, ++}, ++}; ++ ++module_phy_driver(aqr_driver); ++ ++static struct mdio_device_id __maybe_unused aqr_tbl[] = { ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQ1202) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQ2104) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR105) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, ++ { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, ++ { } ++}; ++ ++MODULE_DEVICE_TABLE(mdio, aqr_tbl); ++ ++MODULE_DESCRIPTION("Aquantia PHY driver"); ++MODULE_AUTHOR("Shaohui Xie "); ++MODULE_LICENSE("GPL v2"); +--- a/drivers/net/phy/aquantia_hwmon.c ++++ /dev/null +@@ -1,250 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0 +-/* HWMON driver for Aquantia PHY +- * +- * Author: Nikita Yushchenko +- * Author: Andrew Lunn +- * Author: Heiner Kallweit +- */ +- +-#include +-#include +-#include +-#include +- +-#include "aquantia.h" +- +-/* Vendor specific 1, MDIO_MMD_VEND2 */ +-#define VEND1_THERMAL_PROV_HIGH_TEMP_FAIL 0xc421 +-#define VEND1_THERMAL_PROV_LOW_TEMP_FAIL 0xc422 +-#define VEND1_THERMAL_PROV_HIGH_TEMP_WARN 0xc423 +-#define VEND1_THERMAL_PROV_LOW_TEMP_WARN 0xc424 +-#define VEND1_THERMAL_STAT1 0xc820 +-#define VEND1_THERMAL_STAT2 0xc821 +-#define VEND1_THERMAL_STAT2_VALID BIT(0) +-#define VEND1_GENERAL_STAT1 0xc830 +-#define VEND1_GENERAL_STAT1_HIGH_TEMP_FAIL BIT(14) +-#define VEND1_GENERAL_STAT1_LOW_TEMP_FAIL BIT(13) +-#define VEND1_GENERAL_STAT1_HIGH_TEMP_WARN BIT(12) +-#define VEND1_GENERAL_STAT1_LOW_TEMP_WARN BIT(11) +- +-#if IS_REACHABLE(CONFIG_HWMON) +- +-static umode_t aqr_hwmon_is_visible(const void *data, +- enum hwmon_sensor_types type, +- u32 attr, int channel) +-{ +- if (type != hwmon_temp) +- return 0; +- +- switch (attr) { +- case hwmon_temp_input: +- case hwmon_temp_min_alarm: +- case hwmon_temp_max_alarm: +- case hwmon_temp_lcrit_alarm: +- case hwmon_temp_crit_alarm: +- return 0444; +- case hwmon_temp_min: +- case hwmon_temp_max: +- case hwmon_temp_lcrit: +- case hwmon_temp_crit: +- return 0644; +- default: +- return 0; +- } +-} +- +-static int aqr_hwmon_get(struct phy_device *phydev, int reg, long *value) +-{ +- int temp = phy_read_mmd(phydev, MDIO_MMD_VEND1, reg); +- +- if (temp < 0) +- return temp; +- +- /* 16 bit value is 2's complement with LSB = 1/256th degree Celsius */ +- *value = (s16)temp * 1000 / 256; +- +- return 0; +-} +- +-static int aqr_hwmon_set(struct phy_device *phydev, int reg, long value) +-{ +- int temp; +- +- if (value >= 128000 || value < -128000) +- return -ERANGE; +- +- temp = value * 256 / 1000; +- +- /* temp is in s16 range and we're interested in lower 16 bits only */ +- return phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, (u16)temp); +-} +- +-static int aqr_hwmon_test_bit(struct phy_device *phydev, int reg, int bit) +-{ +- int val = phy_read_mmd(phydev, MDIO_MMD_VEND1, reg); +- +- if (val < 0) +- return val; +- +- return !!(val & bit); +-} +- +-static int aqr_hwmon_status1(struct phy_device *phydev, int bit, long *value) +-{ +- int val = aqr_hwmon_test_bit(phydev, VEND1_GENERAL_STAT1, bit); +- +- if (val < 0) +- return val; +- +- *value = val; +- +- return 0; +-} +- +-static int aqr_hwmon_read(struct device *dev, enum hwmon_sensor_types type, +- u32 attr, int channel, long *value) +-{ +- struct phy_device *phydev = dev_get_drvdata(dev); +- int reg; +- +- if (type != hwmon_temp) +- return -EOPNOTSUPP; +- +- switch (attr) { +- case hwmon_temp_input: +- reg = aqr_hwmon_test_bit(phydev, VEND1_THERMAL_STAT2, +- VEND1_THERMAL_STAT2_VALID); +- if (reg < 0) +- return reg; +- if (!reg) +- return -EBUSY; +- +- return aqr_hwmon_get(phydev, VEND1_THERMAL_STAT1, value); +- +- case hwmon_temp_lcrit: +- return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_LOW_TEMP_FAIL, +- value); +- case hwmon_temp_min: +- return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_LOW_TEMP_WARN, +- value); +- case hwmon_temp_max: +- return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_WARN, +- value); +- case hwmon_temp_crit: +- return aqr_hwmon_get(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_FAIL, +- value); +- case hwmon_temp_lcrit_alarm: +- return aqr_hwmon_status1(phydev, +- VEND1_GENERAL_STAT1_LOW_TEMP_FAIL, +- value); +- case hwmon_temp_min_alarm: +- return aqr_hwmon_status1(phydev, +- VEND1_GENERAL_STAT1_LOW_TEMP_WARN, +- value); +- case hwmon_temp_max_alarm: +- return aqr_hwmon_status1(phydev, +- VEND1_GENERAL_STAT1_HIGH_TEMP_WARN, +- value); +- case hwmon_temp_crit_alarm: +- return aqr_hwmon_status1(phydev, +- VEND1_GENERAL_STAT1_HIGH_TEMP_FAIL, +- value); +- default: +- return -EOPNOTSUPP; +- } +-} +- +-static int aqr_hwmon_write(struct device *dev, enum hwmon_sensor_types type, +- u32 attr, int channel, long value) +-{ +- struct phy_device *phydev = dev_get_drvdata(dev); +- +- if (type != hwmon_temp) +- return -EOPNOTSUPP; +- +- switch (attr) { +- case hwmon_temp_lcrit: +- return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_LOW_TEMP_FAIL, +- value); +- case hwmon_temp_min: +- return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_LOW_TEMP_WARN, +- value); +- case hwmon_temp_max: +- return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_WARN, +- value); +- case hwmon_temp_crit: +- return aqr_hwmon_set(phydev, VEND1_THERMAL_PROV_HIGH_TEMP_FAIL, +- value); +- default: +- return -EOPNOTSUPP; +- } +-} +- +-static const struct hwmon_ops aqr_hwmon_ops = { +- .is_visible = aqr_hwmon_is_visible, +- .read = aqr_hwmon_read, +- .write = aqr_hwmon_write, +-}; +- +-static u32 aqr_hwmon_chip_config[] = { +- HWMON_C_REGISTER_TZ, +- 0, +-}; +- +-static const struct hwmon_channel_info aqr_hwmon_chip = { +- .type = hwmon_chip, +- .config = aqr_hwmon_chip_config, +-}; +- +-static u32 aqr_hwmon_temp_config[] = { +- HWMON_T_INPUT | +- HWMON_T_MAX | HWMON_T_MIN | +- HWMON_T_MAX_ALARM | HWMON_T_MIN_ALARM | +- HWMON_T_CRIT | HWMON_T_LCRIT | +- HWMON_T_CRIT_ALARM | HWMON_T_LCRIT_ALARM, +- 0, +-}; +- +-static const struct hwmon_channel_info aqr_hwmon_temp = { +- .type = hwmon_temp, +- .config = aqr_hwmon_temp_config, +-}; +- +-static const struct hwmon_channel_info *aqr_hwmon_info[] = { +- &aqr_hwmon_chip, +- &aqr_hwmon_temp, +- NULL, +-}; +- +-static const struct hwmon_chip_info aqr_hwmon_chip_info = { +- .ops = &aqr_hwmon_ops, +- .info = aqr_hwmon_info, +-}; +- +-int aqr_hwmon_probe(struct phy_device *phydev) +-{ +- struct device *dev = &phydev->mdio.dev; +- struct device *hwmon_dev; +- char *hwmon_name; +- int i, j; +- +- hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); +- if (!hwmon_name) +- return -ENOMEM; +- +- for (i = j = 0; hwmon_name[i]; i++) { +- if (isalnum(hwmon_name[i])) { +- if (i != j) +- hwmon_name[j] = hwmon_name[i]; +- j++; +- } +- } +- hwmon_name[j] = '\0'; +- +- hwmon_dev = devm_hwmon_device_register_with_info(dev, hwmon_name, +- phydev, &aqr_hwmon_chip_info, NULL); +- +- return PTR_ERR_OR_ZERO(hwmon_dev); +-} +- +-#endif +--- a/drivers/net/phy/aquantia_main.c ++++ /dev/null +@@ -1,844 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0 +-/* +- * Driver for Aquantia PHY +- * +- * Author: Shaohui Xie +- * +- * Copyright 2015 Freescale Semiconductor, Inc. +- */ +- +-#include +-#include +-#include +-#include +-#include +- +-#include "aquantia.h" +- +-#define PHY_ID_AQ1202 0x03a1b445 +-#define PHY_ID_AQ2104 0x03a1b460 +-#define PHY_ID_AQR105 0x03a1b4a2 +-#define PHY_ID_AQR106 0x03a1b4d0 +-#define PHY_ID_AQR107 0x03a1b4e0 +-#define PHY_ID_AQCS109 0x03a1b5c2 +-#define PHY_ID_AQR405 0x03a1b4b0 +-#define PHY_ID_AQR113C 0x31c31c12 +- +-#define MDIO_PHYXS_VEND_IF_STATUS 0xe812 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR 0 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX 1 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI 2 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII 3 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI 4 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII 6 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI 7 +-#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII 10 +- +-#define MDIO_AN_VEND_PROV 0xc400 +-#define MDIO_AN_VEND_PROV_1000BASET_FULL BIT(15) +-#define MDIO_AN_VEND_PROV_1000BASET_HALF BIT(14) +-#define MDIO_AN_VEND_PROV_5000BASET_FULL BIT(11) +-#define MDIO_AN_VEND_PROV_2500BASET_FULL BIT(10) +-#define MDIO_AN_VEND_PROV_DOWNSHIFT_EN BIT(4) +-#define MDIO_AN_VEND_PROV_DOWNSHIFT_MASK GENMASK(3, 0) +-#define MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT 4 +- +-#define MDIO_AN_TX_VEND_STATUS1 0xc800 +-#define MDIO_AN_TX_VEND_STATUS1_RATE_MASK GENMASK(3, 1) +-#define MDIO_AN_TX_VEND_STATUS1_10BASET 0 +-#define MDIO_AN_TX_VEND_STATUS1_100BASETX 1 +-#define MDIO_AN_TX_VEND_STATUS1_1000BASET 2 +-#define MDIO_AN_TX_VEND_STATUS1_10GBASET 3 +-#define MDIO_AN_TX_VEND_STATUS1_2500BASET 4 +-#define MDIO_AN_TX_VEND_STATUS1_5000BASET 5 +-#define MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX BIT(0) +- +-#define MDIO_AN_TX_VEND_INT_STATUS1 0xcc00 +-#define MDIO_AN_TX_VEND_INT_STATUS1_DOWNSHIFT BIT(1) +- +-#define MDIO_AN_TX_VEND_INT_STATUS2 0xcc01 +-#define MDIO_AN_TX_VEND_INT_STATUS2_MASK BIT(0) +- +-#define MDIO_AN_TX_VEND_INT_MASK2 0xd401 +-#define MDIO_AN_TX_VEND_INT_MASK2_LINK BIT(0) +- +-#define MDIO_AN_RX_LP_STAT1 0xe820 +-#define MDIO_AN_RX_LP_STAT1_1000BASET_FULL BIT(15) +-#define MDIO_AN_RX_LP_STAT1_1000BASET_HALF BIT(14) +-#define MDIO_AN_RX_LP_STAT1_SHORT_REACH BIT(13) +-#define MDIO_AN_RX_LP_STAT1_AQRATE_DOWNSHIFT BIT(12) +-#define MDIO_AN_RX_LP_STAT1_AQ_PHY BIT(2) +- +-#define MDIO_AN_RX_LP_STAT4 0xe823 +-#define MDIO_AN_RX_LP_STAT4_FW_MAJOR GENMASK(15, 8) +-#define MDIO_AN_RX_LP_STAT4_FW_MINOR GENMASK(7, 0) +- +-#define MDIO_AN_RX_VEND_STAT3 0xe832 +-#define MDIO_AN_RX_VEND_STAT3_AFR BIT(0) +- +-/* MDIO_MMD_C22EXT */ +-#define MDIO_C22EXT_STAT_SGMII_RX_GOOD_FRAMES 0xd292 +-#define MDIO_C22EXT_STAT_SGMII_RX_BAD_FRAMES 0xd294 +-#define MDIO_C22EXT_STAT_SGMII_RX_FALSE_CARRIER 0xd297 +-#define MDIO_C22EXT_STAT_SGMII_TX_GOOD_FRAMES 0xd313 +-#define MDIO_C22EXT_STAT_SGMII_TX_BAD_FRAMES 0xd315 +-#define MDIO_C22EXT_STAT_SGMII_TX_FALSE_CARRIER 0xd317 +-#define MDIO_C22EXT_STAT_SGMII_TX_COLLISIONS 0xd318 +-#define MDIO_C22EXT_STAT_SGMII_TX_LINE_COLLISIONS 0xd319 +-#define MDIO_C22EXT_STAT_SGMII_TX_FRAME_ALIGN_ERR 0xd31a +-#define MDIO_C22EXT_STAT_SGMII_TX_RUNT_FRAMES 0xd31b +- +-/* Vendor specific 1, MDIO_MMD_VEND1 */ +-#define VEND1_GLOBAL_FW_ID 0x0020 +-#define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) +-#define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) +- +-#define VEND1_GLOBAL_GEN_STAT2 0xc831 +-#define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) +- +-/* The following registers all have similar layouts; first the registers... */ +-#define VEND1_GLOBAL_CFG_10M 0x0310 +-#define VEND1_GLOBAL_CFG_100M 0x031b +-#define VEND1_GLOBAL_CFG_1G 0x031c +-#define VEND1_GLOBAL_CFG_2_5G 0x031d +-#define VEND1_GLOBAL_CFG_5G 0x031e +-#define VEND1_GLOBAL_CFG_10G 0x031f +-/* ...and now the fields */ +-#define VEND1_GLOBAL_CFG_RATE_ADAPT GENMASK(8, 7) +-#define VEND1_GLOBAL_CFG_RATE_ADAPT_NONE 0 +-#define VEND1_GLOBAL_CFG_RATE_ADAPT_USX 1 +-#define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 +- +-#define VEND1_GLOBAL_RSVD_STAT1 0xc885 +-#define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) +-#define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) +- +-#define VEND1_GLOBAL_RSVD_STAT9 0xc88d +-#define VEND1_GLOBAL_RSVD_STAT9_MODE GENMASK(7, 0) +-#define VEND1_GLOBAL_RSVD_STAT9_1000BT2 0x23 +- +-#define VEND1_GLOBAL_INT_STD_STATUS 0xfc00 +-#define VEND1_GLOBAL_INT_VEND_STATUS 0xfc01 +- +-#define VEND1_GLOBAL_INT_STD_MASK 0xff00 +-#define VEND1_GLOBAL_INT_STD_MASK_PMA1 BIT(15) +-#define VEND1_GLOBAL_INT_STD_MASK_PMA2 BIT(14) +-#define VEND1_GLOBAL_INT_STD_MASK_PCS1 BIT(13) +-#define VEND1_GLOBAL_INT_STD_MASK_PCS2 BIT(12) +-#define VEND1_GLOBAL_INT_STD_MASK_PCS3 BIT(11) +-#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS1 BIT(10) +-#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS2 BIT(9) +-#define VEND1_GLOBAL_INT_STD_MASK_AN1 BIT(8) +-#define VEND1_GLOBAL_INT_STD_MASK_AN2 BIT(7) +-#define VEND1_GLOBAL_INT_STD_MASK_GBE BIT(6) +-#define VEND1_GLOBAL_INT_STD_MASK_ALL BIT(0) +- +-#define VEND1_GLOBAL_INT_VEND_MASK 0xff01 +-#define VEND1_GLOBAL_INT_VEND_MASK_PMA BIT(15) +-#define VEND1_GLOBAL_INT_VEND_MASK_PCS BIT(14) +-#define VEND1_GLOBAL_INT_VEND_MASK_PHY_XS BIT(13) +-#define VEND1_GLOBAL_INT_VEND_MASK_AN BIT(12) +-#define VEND1_GLOBAL_INT_VEND_MASK_GBE BIT(11) +-#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL1 BIT(2) +-#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1) +-#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0) +- +-/* Sleep and timeout for checking if the Processor-Intensive +- * MDIO operation is finished +- */ +-#define AQR107_OP_IN_PROG_SLEEP 1000 +-#define AQR107_OP_IN_PROG_TIMEOUT 100000 +- +-struct aqr107_hw_stat { +- const char *name; +- int reg; +- int size; +-}; +- +-#define SGMII_STAT(n, r, s) { n, MDIO_C22EXT_STAT_SGMII_ ## r, s } +-static const struct aqr107_hw_stat aqr107_hw_stats[] = { +- SGMII_STAT("sgmii_rx_good_frames", RX_GOOD_FRAMES, 26), +- SGMII_STAT("sgmii_rx_bad_frames", RX_BAD_FRAMES, 26), +- SGMII_STAT("sgmii_rx_false_carrier_events", RX_FALSE_CARRIER, 8), +- SGMII_STAT("sgmii_tx_good_frames", TX_GOOD_FRAMES, 26), +- SGMII_STAT("sgmii_tx_bad_frames", TX_BAD_FRAMES, 26), +- SGMII_STAT("sgmii_tx_false_carrier_events", TX_FALSE_CARRIER, 8), +- SGMII_STAT("sgmii_tx_collisions", TX_COLLISIONS, 8), +- SGMII_STAT("sgmii_tx_line_collisions", TX_LINE_COLLISIONS, 8), +- SGMII_STAT("sgmii_tx_frame_alignment_err", TX_FRAME_ALIGN_ERR, 16), +- SGMII_STAT("sgmii_tx_runt_frames", TX_RUNT_FRAMES, 22), +-}; +-#define AQR107_SGMII_STAT_SZ ARRAY_SIZE(aqr107_hw_stats) +- +-struct aqr107_priv { +- u64 sgmii_stats[AQR107_SGMII_STAT_SZ]; +-}; +- +-static int aqr107_get_sset_count(struct phy_device *phydev) +-{ +- return AQR107_SGMII_STAT_SZ; +-} +- +-static void aqr107_get_strings(struct phy_device *phydev, u8 *data) +-{ +- int i; +- +- for (i = 0; i < AQR107_SGMII_STAT_SZ; i++) +- strscpy(data + i * ETH_GSTRING_LEN, aqr107_hw_stats[i].name, +- ETH_GSTRING_LEN); +-} +- +-static u64 aqr107_get_stat(struct phy_device *phydev, int index) +-{ +- const struct aqr107_hw_stat *stat = aqr107_hw_stats + index; +- int len_l = min(stat->size, 16); +- int len_h = stat->size - len_l; +- u64 ret; +- int val; +- +- val = phy_read_mmd(phydev, MDIO_MMD_C22EXT, stat->reg); +- if (val < 0) +- return U64_MAX; +- +- ret = val & GENMASK(len_l - 1, 0); +- if (len_h) { +- val = phy_read_mmd(phydev, MDIO_MMD_C22EXT, stat->reg + 1); +- if (val < 0) +- return U64_MAX; +- +- ret += (val & GENMASK(len_h - 1, 0)) << 16; +- } +- +- return ret; +-} +- +-static void aqr107_get_stats(struct phy_device *phydev, +- struct ethtool_stats *stats, u64 *data) +-{ +- struct aqr107_priv *priv = phydev->priv; +- u64 val; +- int i; +- +- for (i = 0; i < AQR107_SGMII_STAT_SZ; i++) { +- val = aqr107_get_stat(phydev, i); +- if (val == U64_MAX) +- phydev_err(phydev, "Reading HW Statistics failed for %s\n", +- aqr107_hw_stats[i].name); +- else +- priv->sgmii_stats[i] += val; +- +- data[i] = priv->sgmii_stats[i]; +- } +-} +- +-static int aqr_config_aneg(struct phy_device *phydev) +-{ +- bool changed = false; +- u16 reg; +- int ret; +- +- if (phydev->autoneg == AUTONEG_DISABLE) +- return genphy_c45_pma_setup_forced(phydev); +- +- ret = genphy_c45_an_config_aneg(phydev); +- if (ret < 0) +- return ret; +- if (ret > 0) +- changed = true; +- +- /* Clause 45 has no standardized support for 1000BaseT, therefore +- * use vendor registers for this mode. +- */ +- reg = 0; +- if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, +- phydev->advertising)) +- reg |= MDIO_AN_VEND_PROV_1000BASET_FULL; +- +- if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, +- phydev->advertising)) +- reg |= MDIO_AN_VEND_PROV_1000BASET_HALF; +- +- /* Handle the case when the 2.5G and 5G speeds are not advertised */ +- if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, +- phydev->advertising)) +- reg |= MDIO_AN_VEND_PROV_2500BASET_FULL; +- +- if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, +- phydev->advertising)) +- reg |= MDIO_AN_VEND_PROV_5000BASET_FULL; +- +- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV, +- MDIO_AN_VEND_PROV_1000BASET_HALF | +- MDIO_AN_VEND_PROV_1000BASET_FULL | +- MDIO_AN_VEND_PROV_2500BASET_FULL | +- MDIO_AN_VEND_PROV_5000BASET_FULL, reg); +- if (ret < 0) +- return ret; +- if (ret > 0) +- changed = true; +- +- return genphy_c45_check_and_restart_aneg(phydev, changed); +-} +- +-static int aqr_config_intr(struct phy_device *phydev) +-{ +- bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; +- int err; +- +- if (en) { +- /* Clear any pending interrupts before enabling them */ +- err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2); +- if (err < 0) +- return err; +- } +- +- err = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_MASK2, +- en ? MDIO_AN_TX_VEND_INT_MASK2_LINK : 0); +- if (err < 0) +- return err; +- +- err = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_STD_MASK, +- en ? VEND1_GLOBAL_INT_STD_MASK_ALL : 0); +- if (err < 0) +- return err; +- +- err = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_VEND_MASK, +- en ? VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 | +- VEND1_GLOBAL_INT_VEND_MASK_AN : 0); +- if (err < 0) +- return err; +- +- if (!en) { +- /* Clear any pending interrupts after we have disabled them */ +- err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2); +- if (err < 0) +- return err; +- } +- +- return 0; +-} +- +-static irqreturn_t aqr_handle_interrupt(struct phy_device *phydev) +-{ +- int irq_status; +- +- irq_status = phy_read_mmd(phydev, MDIO_MMD_AN, +- MDIO_AN_TX_VEND_INT_STATUS2); +- if (irq_status < 0) { +- phy_error(phydev); +- return IRQ_NONE; +- } +- +- if (!(irq_status & MDIO_AN_TX_VEND_INT_STATUS2_MASK)) +- return IRQ_NONE; +- +- phy_trigger_machine(phydev); +- +- return IRQ_HANDLED; +-} +- +-static int aqr_read_status(struct phy_device *phydev) +-{ +- int val; +- +- if (phydev->autoneg == AUTONEG_ENABLE) { +- val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_LP_STAT1); +- if (val < 0) +- return val; +- +- linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, +- phydev->lp_advertising, +- val & MDIO_AN_RX_LP_STAT1_1000BASET_FULL); +- linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, +- phydev->lp_advertising, +- val & MDIO_AN_RX_LP_STAT1_1000BASET_HALF); +- } +- +- return genphy_c45_read_status(phydev); +-} +- +-static int aqr107_read_rate(struct phy_device *phydev) +-{ +- u32 config_reg; +- int val; +- +- val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_STATUS1); +- if (val < 0) +- return val; +- +- if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) +- phydev->duplex = DUPLEX_FULL; +- else +- phydev->duplex = DUPLEX_HALF; +- +- switch (FIELD_GET(MDIO_AN_TX_VEND_STATUS1_RATE_MASK, val)) { +- case MDIO_AN_TX_VEND_STATUS1_10BASET: +- phydev->speed = SPEED_10; +- config_reg = VEND1_GLOBAL_CFG_10M; +- break; +- case MDIO_AN_TX_VEND_STATUS1_100BASETX: +- phydev->speed = SPEED_100; +- config_reg = VEND1_GLOBAL_CFG_100M; +- break; +- case MDIO_AN_TX_VEND_STATUS1_1000BASET: +- phydev->speed = SPEED_1000; +- config_reg = VEND1_GLOBAL_CFG_1G; +- break; +- case MDIO_AN_TX_VEND_STATUS1_2500BASET: +- phydev->speed = SPEED_2500; +- config_reg = VEND1_GLOBAL_CFG_2_5G; +- break; +- case MDIO_AN_TX_VEND_STATUS1_5000BASET: +- phydev->speed = SPEED_5000; +- config_reg = VEND1_GLOBAL_CFG_5G; +- break; +- case MDIO_AN_TX_VEND_STATUS1_10GBASET: +- phydev->speed = SPEED_10000; +- config_reg = VEND1_GLOBAL_CFG_10G; +- break; +- default: +- phydev->speed = SPEED_UNKNOWN; +- return 0; +- } +- +- val = phy_read_mmd(phydev, MDIO_MMD_VEND1, config_reg); +- if (val < 0) +- return val; +- +- if (FIELD_GET(VEND1_GLOBAL_CFG_RATE_ADAPT, val) == +- VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE) +- phydev->rate_matching = RATE_MATCH_PAUSE; +- else +- phydev->rate_matching = RATE_MATCH_NONE; +- +- return 0; +-} +- +-static int aqr107_read_status(struct phy_device *phydev) +-{ +- int val, ret; +- +- ret = aqr_read_status(phydev); +- if (ret) +- return ret; +- +- if (!phydev->link || phydev->autoneg == AUTONEG_DISABLE) +- return 0; +- +- val = phy_read_mmd(phydev, MDIO_MMD_PHYXS, MDIO_PHYXS_VEND_IF_STATUS); +- if (val < 0) +- return val; +- +- switch (FIELD_GET(MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK, val)) { +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR: +- phydev->interface = PHY_INTERFACE_MODE_10GKR; +- break; +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX: +- phydev->interface = PHY_INTERFACE_MODE_1000BASEKX; +- break; +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI: +- phydev->interface = PHY_INTERFACE_MODE_10GBASER; +- break; +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII: +- phydev->interface = PHY_INTERFACE_MODE_USXGMII; +- break; +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI: +- phydev->interface = PHY_INTERFACE_MODE_XAUI; +- break; +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII: +- phydev->interface = PHY_INTERFACE_MODE_SGMII; +- break; +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI: +- phydev->interface = PHY_INTERFACE_MODE_RXAUI; +- break; +- case MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII: +- phydev->interface = PHY_INTERFACE_MODE_2500BASEX; +- break; +- default: +- phydev->interface = PHY_INTERFACE_MODE_NA; +- break; +- } +- +- /* Read possibly downshifted rate from vendor register */ +- return aqr107_read_rate(phydev); +-} +- +-static int aqr107_get_downshift(struct phy_device *phydev, u8 *data) +-{ +- int val, cnt, enable; +- +- val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV); +- if (val < 0) +- return val; +- +- enable = FIELD_GET(MDIO_AN_VEND_PROV_DOWNSHIFT_EN, val); +- cnt = FIELD_GET(MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, val); +- +- *data = enable && cnt ? cnt : DOWNSHIFT_DEV_DISABLE; +- +- return 0; +-} +- +-static int aqr107_set_downshift(struct phy_device *phydev, u8 cnt) +-{ +- int val = 0; +- +- if (!FIELD_FIT(MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, cnt)) +- return -E2BIG; +- +- if (cnt != DOWNSHIFT_DEV_DISABLE) { +- val = MDIO_AN_VEND_PROV_DOWNSHIFT_EN; +- val |= FIELD_PREP(MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, cnt); +- } +- +- return phy_modify_mmd(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV, +- MDIO_AN_VEND_PROV_DOWNSHIFT_EN | +- MDIO_AN_VEND_PROV_DOWNSHIFT_MASK, val); +-} +- +-static int aqr107_get_tunable(struct phy_device *phydev, +- struct ethtool_tunable *tuna, void *data) +-{ +- switch (tuna->id) { +- case ETHTOOL_PHY_DOWNSHIFT: +- return aqr107_get_downshift(phydev, data); +- default: +- return -EOPNOTSUPP; +- } +-} +- +-static int aqr107_set_tunable(struct phy_device *phydev, +- struct ethtool_tunable *tuna, const void *data) +-{ +- switch (tuna->id) { +- case ETHTOOL_PHY_DOWNSHIFT: +- return aqr107_set_downshift(phydev, *(const u8 *)data); +- default: +- return -EOPNOTSUPP; +- } +-} +- +-/* If we configure settings whilst firmware is still initializing the chip, +- * then these settings may be overwritten. Therefore make sure chip +- * initialization has completed. Use presence of the firmware ID as +- * indicator for initialization having completed. +- * The chip also provides a "reset completed" bit, but it's cleared after +- * read. Therefore function would time out if called again. +- */ +-static int aqr107_wait_reset_complete(struct phy_device *phydev) +-{ +- int val; +- +- return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, +- VEND1_GLOBAL_FW_ID, val, val != 0, +- 20000, 2000000, false); +-} +- +-static void aqr107_chip_info(struct phy_device *phydev) +-{ +- u8 fw_major, fw_minor, build_id, prov_id; +- int val; +- +- val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_FW_ID); +- if (val < 0) +- return; +- +- fw_major = FIELD_GET(VEND1_GLOBAL_FW_ID_MAJOR, val); +- fw_minor = FIELD_GET(VEND1_GLOBAL_FW_ID_MINOR, val); +- +- val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_RSVD_STAT1); +- if (val < 0) +- return; +- +- build_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID, val); +- prov_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val); +- +- phydev_dbg(phydev, "FW %u.%u, Build %u, Provisioning %u\n", +- fw_major, fw_minor, build_id, prov_id); +-} +- +-static int aqr107_config_init(struct phy_device *phydev) +-{ +- int ret; +- +- /* Check that the PHY interface type is compatible */ +- if (phydev->interface != PHY_INTERFACE_MODE_SGMII && +- phydev->interface != PHY_INTERFACE_MODE_1000BASEKX && +- phydev->interface != PHY_INTERFACE_MODE_2500BASEX && +- phydev->interface != PHY_INTERFACE_MODE_XGMII && +- phydev->interface != PHY_INTERFACE_MODE_USXGMII && +- phydev->interface != PHY_INTERFACE_MODE_10GKR && +- phydev->interface != PHY_INTERFACE_MODE_10GBASER && +- phydev->interface != PHY_INTERFACE_MODE_XAUI && +- phydev->interface != PHY_INTERFACE_MODE_RXAUI) +- return -ENODEV; +- +- WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, +- "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n"); +- +- ret = aqr107_wait_reset_complete(phydev); +- if (!ret) +- aqr107_chip_info(phydev); +- +- return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT); +-} +- +-static int aqcs109_config_init(struct phy_device *phydev) +-{ +- int ret; +- +- /* Check that the PHY interface type is compatible */ +- if (phydev->interface != PHY_INTERFACE_MODE_SGMII && +- phydev->interface != PHY_INTERFACE_MODE_2500BASEX) +- return -ENODEV; +- +- ret = aqr107_wait_reset_complete(phydev); +- if (!ret) +- aqr107_chip_info(phydev); +- +- /* AQCS109 belongs to a chip family partially supporting 10G and 5G. +- * PMA speed ability bits are the same for all members of the family, +- * AQCS109 however supports speeds up to 2.5G only. +- */ +- ret = phy_set_max_speed(phydev, SPEED_2500); +- if (ret) +- return ret; +- +- return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT); +-} +- +-static void aqr107_link_change_notify(struct phy_device *phydev) +-{ +- u8 fw_major, fw_minor; +- bool downshift, short_reach, afr; +- int mode, val; +- +- if (phydev->state != PHY_RUNNING || phydev->autoneg == AUTONEG_DISABLE) +- return; +- +- val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_LP_STAT1); +- /* call failed or link partner is no Aquantia PHY */ +- if (val < 0 || !(val & MDIO_AN_RX_LP_STAT1_AQ_PHY)) +- return; +- +- short_reach = val & MDIO_AN_RX_LP_STAT1_SHORT_REACH; +- downshift = val & MDIO_AN_RX_LP_STAT1_AQRATE_DOWNSHIFT; +- +- val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_LP_STAT4); +- if (val < 0) +- return; +- +- fw_major = FIELD_GET(MDIO_AN_RX_LP_STAT4_FW_MAJOR, val); +- fw_minor = FIELD_GET(MDIO_AN_RX_LP_STAT4_FW_MINOR, val); +- +- val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_RX_VEND_STAT3); +- if (val < 0) +- return; +- +- afr = val & MDIO_AN_RX_VEND_STAT3_AFR; +- +- phydev_dbg(phydev, "Link partner is Aquantia PHY, FW %u.%u%s%s%s\n", +- fw_major, fw_minor, +- short_reach ? ", short reach mode" : "", +- downshift ? ", fast-retrain downshift advertised" : "", +- afr ? ", fast reframe advertised" : ""); +- +- val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_RSVD_STAT9); +- if (val < 0) +- return; +- +- mode = FIELD_GET(VEND1_GLOBAL_RSVD_STAT9_MODE, val); +- if (mode == VEND1_GLOBAL_RSVD_STAT9_1000BT2) +- phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n"); +-} +- +-static int aqr107_wait_processor_intensive_op(struct phy_device *phydev) +-{ +- int val, err; +- +- /* The datasheet notes to wait at least 1ms after issuing a +- * processor intensive operation before checking. +- * We cannot use the 'sleep_before_read' parameter of read_poll_timeout +- * because that just determines the maximum time slept, not the minimum. +- */ +- usleep_range(1000, 5000); +- +- err = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, +- VEND1_GLOBAL_GEN_STAT2, val, +- !(val & VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG), +- AQR107_OP_IN_PROG_SLEEP, +- AQR107_OP_IN_PROG_TIMEOUT, false); +- if (err) { +- phydev_err(phydev, "timeout: processor-intensive MDIO operation\n"); +- return err; +- } +- +- return 0; +-} +- +-static int aqr107_get_rate_matching(struct phy_device *phydev, +- phy_interface_t iface) +-{ +- if (iface == PHY_INTERFACE_MODE_10GBASER || +- iface == PHY_INTERFACE_MODE_2500BASEX || +- iface == PHY_INTERFACE_MODE_NA) +- return RATE_MATCH_PAUSE; +- return RATE_MATCH_NONE; +-} +- +-static int aqr107_suspend(struct phy_device *phydev) +-{ +- int err; +- +- err = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, +- MDIO_CTRL1_LPOWER); +- if (err) +- return err; +- +- return aqr107_wait_processor_intensive_op(phydev); +-} +- +-static int aqr107_resume(struct phy_device *phydev) +-{ +- int err; +- +- err = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, +- MDIO_CTRL1_LPOWER); +- if (err) +- return err; +- +- return aqr107_wait_processor_intensive_op(phydev); +-} +- +-static int aqr107_probe(struct phy_device *phydev) +-{ +- phydev->priv = devm_kzalloc(&phydev->mdio.dev, +- sizeof(struct aqr107_priv), GFP_KERNEL); +- if (!phydev->priv) +- return -ENOMEM; +- +- return aqr_hwmon_probe(phydev); +-} +- +-static struct phy_driver aqr_driver[] = { +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), +- .name = "Aquantia AQ1202", +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr_read_status, +-}, +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQ2104), +- .name = "Aquantia AQ2104", +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr_read_status, +-}, +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQR105), +- .name = "Aquantia AQR105", +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr_read_status, +- .suspend = aqr107_suspend, +- .resume = aqr107_resume, +-}, +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQR106), +- .name = "Aquantia AQR106", +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr_read_status, +-}, +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQR107), +- .name = "Aquantia AQR107", +- .probe = aqr107_probe, +- .get_rate_matching = aqr107_get_rate_matching, +- .config_init = aqr107_config_init, +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr107_read_status, +- .get_tunable = aqr107_get_tunable, +- .set_tunable = aqr107_set_tunable, +- .suspend = aqr107_suspend, +- .resume = aqr107_resume, +- .get_sset_count = aqr107_get_sset_count, +- .get_strings = aqr107_get_strings, +- .get_stats = aqr107_get_stats, +- .link_change_notify = aqr107_link_change_notify, +-}, +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), +- .name = "Aquantia AQCS109", +- .probe = aqr107_probe, +- .get_rate_matching = aqr107_get_rate_matching, +- .config_init = aqcs109_config_init, +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr107_read_status, +- .get_tunable = aqr107_get_tunable, +- .set_tunable = aqr107_set_tunable, +- .suspend = aqr107_suspend, +- .resume = aqr107_resume, +- .get_sset_count = aqr107_get_sset_count, +- .get_strings = aqr107_get_strings, +- .get_stats = aqr107_get_stats, +- .link_change_notify = aqr107_link_change_notify, +-}, +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQR405), +- .name = "Aquantia AQR405", +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr_read_status, +-}, +-{ +- PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), +- .name = "Aquantia AQR113C", +- .probe = aqr107_probe, +- .get_rate_matching = aqr107_get_rate_matching, +- .config_init = aqr107_config_init, +- .config_aneg = aqr_config_aneg, +- .config_intr = aqr_config_intr, +- .handle_interrupt = aqr_handle_interrupt, +- .read_status = aqr107_read_status, +- .get_tunable = aqr107_get_tunable, +- .set_tunable = aqr107_set_tunable, +- .suspend = aqr107_suspend, +- .resume = aqr107_resume, +- .get_sset_count = aqr107_get_sset_count, +- .get_strings = aqr107_get_strings, +- .get_stats = aqr107_get_stats, +- .link_change_notify = aqr107_link_change_notify, +-}, +-}; +- +-module_phy_driver(aqr_driver); +- +-static struct mdio_device_id __maybe_unused aqr_tbl[] = { +- { PHY_ID_MATCH_MODEL(PHY_ID_AQ1202) }, +- { PHY_ID_MATCH_MODEL(PHY_ID_AQ2104) }, +- { PHY_ID_MATCH_MODEL(PHY_ID_AQR105) }, +- { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, +- { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, +- { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, +- { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, +- { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, +- { } +-}; +- +-MODULE_DEVICE_TABLE(mdio, aqr_tbl); +- +-MODULE_DESCRIPTION("Aquantia PHY driver"); +-MODULE_AUTHOR("Shaohui Xie "); +-MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/backport-5.15/737-02-v6.7-net-phy-aquantia-move-MMD_VEND-define-to-header.patch b/target/linux/generic/backport-5.15/737-02-v6.7-net-phy-aquantia-move-MMD_VEND-define-to-header.patch new file mode 100644 index 00000000000000..2b945227237762 --- /dev/null +++ b/target/linux/generic/backport-5.15/737-02-v6.7-net-phy-aquantia-move-MMD_VEND-define-to-header.patch @@ -0,0 +1,183 @@ +From e1fbfa4a995d42e02e22b0dff2f8b4fdee1504b3 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 14 Nov 2023 15:08:42 +0100 +Subject: [PATCH 2/3] net: phy: aquantia: move MMD_VEND define to header + +Move MMD_VEND define to header to clean things up and in preparation for +firmware loading support that require some define placed in +aquantia_main. + +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/aquantia/aquantia.h | 69 +++++++++++++++++++++++ + drivers/net/phy/aquantia/aquantia_hwmon.c | 14 ----- + drivers/net/phy/aquantia/aquantia_main.c | 55 ------------------ + 3 files changed, 69 insertions(+), 69 deletions(-) + +--- a/drivers/net/phy/aquantia/aquantia.h ++++ b/drivers/net/phy/aquantia/aquantia.h +@@ -9,6 +9,75 @@ + #include + #include + ++/* Vendor specific 1, MDIO_MMD_VEND1 */ ++#define VEND1_GLOBAL_FW_ID 0x0020 ++#define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) ++#define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) ++ ++/* The following registers all have similar layouts; first the registers... */ ++#define VEND1_GLOBAL_CFG_10M 0x0310 ++#define VEND1_GLOBAL_CFG_100M 0x031b ++#define VEND1_GLOBAL_CFG_1G 0x031c ++#define VEND1_GLOBAL_CFG_2_5G 0x031d ++#define VEND1_GLOBAL_CFG_5G 0x031e ++#define VEND1_GLOBAL_CFG_10G 0x031f ++/* ...and now the fields */ ++#define VEND1_GLOBAL_CFG_RATE_ADAPT GENMASK(8, 7) ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_NONE 0 ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_USX 1 ++#define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 ++ ++/* Vendor specific 1, MDIO_MMD_VEND2 */ ++#define VEND1_THERMAL_PROV_HIGH_TEMP_FAIL 0xc421 ++#define VEND1_THERMAL_PROV_LOW_TEMP_FAIL 0xc422 ++#define VEND1_THERMAL_PROV_HIGH_TEMP_WARN 0xc423 ++#define VEND1_THERMAL_PROV_LOW_TEMP_WARN 0xc424 ++#define VEND1_THERMAL_STAT1 0xc820 ++#define VEND1_THERMAL_STAT2 0xc821 ++#define VEND1_THERMAL_STAT2_VALID BIT(0) ++#define VEND1_GENERAL_STAT1 0xc830 ++#define VEND1_GENERAL_STAT1_HIGH_TEMP_FAIL BIT(14) ++#define VEND1_GENERAL_STAT1_LOW_TEMP_FAIL BIT(13) ++#define VEND1_GENERAL_STAT1_HIGH_TEMP_WARN BIT(12) ++#define VEND1_GENERAL_STAT1_LOW_TEMP_WARN BIT(11) ++ ++#define VEND1_GLOBAL_GEN_STAT2 0xc831 ++#define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) ++ ++#define VEND1_GLOBAL_RSVD_STAT1 0xc885 ++#define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) ++#define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) ++ ++#define VEND1_GLOBAL_RSVD_STAT9 0xc88d ++#define VEND1_GLOBAL_RSVD_STAT9_MODE GENMASK(7, 0) ++#define VEND1_GLOBAL_RSVD_STAT9_1000BT2 0x23 ++ ++#define VEND1_GLOBAL_INT_STD_STATUS 0xfc00 ++#define VEND1_GLOBAL_INT_VEND_STATUS 0xfc01 ++ ++#define VEND1_GLOBAL_INT_STD_MASK 0xff00 ++#define VEND1_GLOBAL_INT_STD_MASK_PMA1 BIT(15) ++#define VEND1_GLOBAL_INT_STD_MASK_PMA2 BIT(14) ++#define VEND1_GLOBAL_INT_STD_MASK_PCS1 BIT(13) ++#define VEND1_GLOBAL_INT_STD_MASK_PCS2 BIT(12) ++#define VEND1_GLOBAL_INT_STD_MASK_PCS3 BIT(11) ++#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS1 BIT(10) ++#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS2 BIT(9) ++#define VEND1_GLOBAL_INT_STD_MASK_AN1 BIT(8) ++#define VEND1_GLOBAL_INT_STD_MASK_AN2 BIT(7) ++#define VEND1_GLOBAL_INT_STD_MASK_GBE BIT(6) ++#define VEND1_GLOBAL_INT_STD_MASK_ALL BIT(0) ++ ++#define VEND1_GLOBAL_INT_VEND_MASK 0xff01 ++#define VEND1_GLOBAL_INT_VEND_MASK_PMA BIT(15) ++#define VEND1_GLOBAL_INT_VEND_MASK_PCS BIT(14) ++#define VEND1_GLOBAL_INT_VEND_MASK_PHY_XS BIT(13) ++#define VEND1_GLOBAL_INT_VEND_MASK_AN BIT(12) ++#define VEND1_GLOBAL_INT_VEND_MASK_GBE BIT(11) ++#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL1 BIT(2) ++#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1) ++#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0) ++ + #if IS_REACHABLE(CONFIG_HWMON) + int aqr_hwmon_probe(struct phy_device *phydev); + #else +--- a/drivers/net/phy/aquantia/aquantia_hwmon.c ++++ b/drivers/net/phy/aquantia/aquantia_hwmon.c +@@ -13,20 +13,6 @@ + + #include "aquantia.h" + +-/* Vendor specific 1, MDIO_MMD_VEND2 */ +-#define VEND1_THERMAL_PROV_HIGH_TEMP_FAIL 0xc421 +-#define VEND1_THERMAL_PROV_LOW_TEMP_FAIL 0xc422 +-#define VEND1_THERMAL_PROV_HIGH_TEMP_WARN 0xc423 +-#define VEND1_THERMAL_PROV_LOW_TEMP_WARN 0xc424 +-#define VEND1_THERMAL_STAT1 0xc820 +-#define VEND1_THERMAL_STAT2 0xc821 +-#define VEND1_THERMAL_STAT2_VALID BIT(0) +-#define VEND1_GENERAL_STAT1 0xc830 +-#define VEND1_GENERAL_STAT1_HIGH_TEMP_FAIL BIT(14) +-#define VEND1_GENERAL_STAT1_LOW_TEMP_FAIL BIT(13) +-#define VEND1_GENERAL_STAT1_HIGH_TEMP_WARN BIT(12) +-#define VEND1_GENERAL_STAT1_LOW_TEMP_WARN BIT(11) +- + #if IS_REACHABLE(CONFIG_HWMON) + + static umode_t aqr_hwmon_is_visible(const void *data, +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c +@@ -89,61 +89,6 @@ + #define MDIO_C22EXT_STAT_SGMII_TX_FRAME_ALIGN_ERR 0xd31a + #define MDIO_C22EXT_STAT_SGMII_TX_RUNT_FRAMES 0xd31b + +-/* Vendor specific 1, MDIO_MMD_VEND1 */ +-#define VEND1_GLOBAL_FW_ID 0x0020 +-#define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) +-#define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) +- +-#define VEND1_GLOBAL_GEN_STAT2 0xc831 +-#define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) +- +-/* The following registers all have similar layouts; first the registers... */ +-#define VEND1_GLOBAL_CFG_10M 0x0310 +-#define VEND1_GLOBAL_CFG_100M 0x031b +-#define VEND1_GLOBAL_CFG_1G 0x031c +-#define VEND1_GLOBAL_CFG_2_5G 0x031d +-#define VEND1_GLOBAL_CFG_5G 0x031e +-#define VEND1_GLOBAL_CFG_10G 0x031f +-/* ...and now the fields */ +-#define VEND1_GLOBAL_CFG_RATE_ADAPT GENMASK(8, 7) +-#define VEND1_GLOBAL_CFG_RATE_ADAPT_NONE 0 +-#define VEND1_GLOBAL_CFG_RATE_ADAPT_USX 1 +-#define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 +- +-#define VEND1_GLOBAL_RSVD_STAT1 0xc885 +-#define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) +-#define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) +- +-#define VEND1_GLOBAL_RSVD_STAT9 0xc88d +-#define VEND1_GLOBAL_RSVD_STAT9_MODE GENMASK(7, 0) +-#define VEND1_GLOBAL_RSVD_STAT9_1000BT2 0x23 +- +-#define VEND1_GLOBAL_INT_STD_STATUS 0xfc00 +-#define VEND1_GLOBAL_INT_VEND_STATUS 0xfc01 +- +-#define VEND1_GLOBAL_INT_STD_MASK 0xff00 +-#define VEND1_GLOBAL_INT_STD_MASK_PMA1 BIT(15) +-#define VEND1_GLOBAL_INT_STD_MASK_PMA2 BIT(14) +-#define VEND1_GLOBAL_INT_STD_MASK_PCS1 BIT(13) +-#define VEND1_GLOBAL_INT_STD_MASK_PCS2 BIT(12) +-#define VEND1_GLOBAL_INT_STD_MASK_PCS3 BIT(11) +-#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS1 BIT(10) +-#define VEND1_GLOBAL_INT_STD_MASK_PHY_XS2 BIT(9) +-#define VEND1_GLOBAL_INT_STD_MASK_AN1 BIT(8) +-#define VEND1_GLOBAL_INT_STD_MASK_AN2 BIT(7) +-#define VEND1_GLOBAL_INT_STD_MASK_GBE BIT(6) +-#define VEND1_GLOBAL_INT_STD_MASK_ALL BIT(0) +- +-#define VEND1_GLOBAL_INT_VEND_MASK 0xff01 +-#define VEND1_GLOBAL_INT_VEND_MASK_PMA BIT(15) +-#define VEND1_GLOBAL_INT_VEND_MASK_PCS BIT(14) +-#define VEND1_GLOBAL_INT_VEND_MASK_PHY_XS BIT(13) +-#define VEND1_GLOBAL_INT_VEND_MASK_AN BIT(12) +-#define VEND1_GLOBAL_INT_VEND_MASK_GBE BIT(11) +-#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL1 BIT(2) +-#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1) +-#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0) +- + /* Sleep and timeout for checking if the Processor-Intensive + * MDIO operation is finished + */ diff --git a/target/linux/generic/backport-5.15/737-03-v6.7-net-phy-aquantia-add-firmware-load-support.patch b/target/linux/generic/backport-5.15/737-03-v6.7-net-phy-aquantia-add-firmware-load-support.patch new file mode 100644 index 00000000000000..1ae5966df6cede --- /dev/null +++ b/target/linux/generic/backport-5.15/737-03-v6.7-net-phy-aquantia-add-firmware-load-support.patch @@ -0,0 +1,504 @@ +From e93984ebc1c82bd34f7a1b3391efaceee0a8ae96 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Tue, 14 Nov 2023 15:08:43 +0100 +Subject: [PATCH 3/3] net: phy: aquantia: add firmware load support + +Aquantia PHY-s require firmware to be loaded before they start operating. +It can be automatically loaded in case when there is a SPI-NOR connected +to Aquantia PHY-s or can be loaded from the host via MDIO. + +This patch adds support for loading the firmware via MDIO as in most cases +there is no SPI-NOR being used to save on cost. +Firmware loading code itself is ported from mainline U-boot with cleanups. + +The firmware has mixed values both in big and little endian. +PHY core itself is big-endian but it expects values to be in little-endian. +The firmware is little-endian but CRC-16 value for it is stored at the end +of firmware in big-endian. + +It seems the PHY does the conversion internally from firmware that is +little-endian to the PHY that is big-endian on using the mailbox +but mailbox returns a big-endian CRC-16 to verify the written data +integrity. + +Co-developed-by: Christian Marangi +Signed-off-by: Robert Marko +Signed-off-by: Christian Marangi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/aquantia/Kconfig | 1 + + drivers/net/phy/aquantia/Makefile | 2 +- + drivers/net/phy/aquantia/aquantia.h | 32 ++ + drivers/net/phy/aquantia/aquantia_firmware.c | 370 +++++++++++++++++++ + drivers/net/phy/aquantia/aquantia_main.c | 6 + + 5 files changed, 410 insertions(+), 1 deletion(-) + create mode 100644 drivers/net/phy/aquantia/aquantia_firmware.c + +--- a/drivers/net/phy/aquantia/Kconfig ++++ b/drivers/net/phy/aquantia/Kconfig +@@ -1,5 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0-only + config AQUANTIA_PHY + tristate "Aquantia PHYs" ++ select CRC_CCITT + help + Currently supports the Aquantia AQ1202, AQ2104, AQR105, AQR405 +--- a/drivers/net/phy/aquantia/Makefile ++++ b/drivers/net/phy/aquantia/Makefile +@@ -1,5 +1,5 @@ + # SPDX-License-Identifier: GPL-2.0 +-aquantia-objs += aquantia_main.o ++aquantia-objs += aquantia_main.o aquantia_firmware.o + ifdef CONFIG_HWMON + aquantia-objs += aquantia_hwmon.o + endif +--- a/drivers/net/phy/aquantia/aquantia.h ++++ b/drivers/net/phy/aquantia/aquantia.h +@@ -10,10 +10,35 @@ + #include + + /* Vendor specific 1, MDIO_MMD_VEND1 */ ++#define VEND1_GLOBAL_SC 0x0 ++#define VEND1_GLOBAL_SC_SOFT_RESET BIT(15) ++#define VEND1_GLOBAL_SC_LOW_POWER BIT(11) ++ + #define VEND1_GLOBAL_FW_ID 0x0020 + #define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) + #define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) + ++#define VEND1_GLOBAL_MAILBOX_INTERFACE1 0x0200 ++#define VEND1_GLOBAL_MAILBOX_INTERFACE1_EXECUTE BIT(15) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE1_WRITE BIT(14) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE1_CRC_RESET BIT(12) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE1_BUSY BIT(8) ++ ++#define VEND1_GLOBAL_MAILBOX_INTERFACE2 0x0201 ++#define VEND1_GLOBAL_MAILBOX_INTERFACE3 0x0202 ++#define VEND1_GLOBAL_MAILBOX_INTERFACE3_MSW_ADDR_MASK GENMASK(15, 0) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE3_MSW_ADDR(x) FIELD_PREP(VEND1_GLOBAL_MAILBOX_INTERFACE3_MSW_ADDR_MASK, (u16)((x) >> 16)) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE4 0x0203 ++#define VEND1_GLOBAL_MAILBOX_INTERFACE4_LSW_ADDR_MASK GENMASK(15, 2) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE4_LSW_ADDR(x) FIELD_PREP(VEND1_GLOBAL_MAILBOX_INTERFACE4_LSW_ADDR_MASK, (u16)(x)) ++ ++#define VEND1_GLOBAL_MAILBOX_INTERFACE5 0x0204 ++#define VEND1_GLOBAL_MAILBOX_INTERFACE5_MSW_DATA_MASK GENMASK(15, 0) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE5_MSW_DATA(x) FIELD_PREP(VEND1_GLOBAL_MAILBOX_INTERFACE5_MSW_DATA_MASK, (u16)((x) >> 16)) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE6 0x0205 ++#define VEND1_GLOBAL_MAILBOX_INTERFACE6_LSW_DATA_MASK GENMASK(15, 0) ++#define VEND1_GLOBAL_MAILBOX_INTERFACE6_LSW_DATA(x) FIELD_PREP(VEND1_GLOBAL_MAILBOX_INTERFACE6_LSW_DATA_MASK, (u16)(x)) ++ + /* The following registers all have similar layouts; first the registers... */ + #define VEND1_GLOBAL_CFG_10M 0x0310 + #define VEND1_GLOBAL_CFG_100M 0x031b +@@ -28,6 +53,11 @@ + #define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 + + /* Vendor specific 1, MDIO_MMD_VEND2 */ ++#define VEND1_GLOBAL_CONTROL2 0xc001 ++#define VEND1_GLOBAL_CONTROL2_UP_RUN_STALL_RST BIT(15) ++#define VEND1_GLOBAL_CONTROL2_UP_RUN_STALL_OVD BIT(6) ++#define VEND1_GLOBAL_CONTROL2_UP_RUN_STALL BIT(0) ++ + #define VEND1_THERMAL_PROV_HIGH_TEMP_FAIL 0xc421 + #define VEND1_THERMAL_PROV_LOW_TEMP_FAIL 0xc422 + #define VEND1_THERMAL_PROV_HIGH_TEMP_WARN 0xc423 +@@ -83,3 +113,5 @@ int aqr_hwmon_probe(struct phy_device *p + #else + static inline int aqr_hwmon_probe(struct phy_device *phydev) { return 0; } + #endif ++ ++int aqr_firmware_load(struct phy_device *phydev); +--- /dev/null ++++ b/drivers/net/phy/aquantia/aquantia_firmware.c +@@ -0,0 +1,370 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "aquantia.h" ++ ++#define UP_RESET_SLEEP 100 ++ ++/* addresses of memory segments in the phy */ ++#define DRAM_BASE_ADDR 0x3FFE0000 ++#define IRAM_BASE_ADDR 0x40000000 ++ ++/* firmware image format constants */ ++#define VERSION_STRING_SIZE 0x40 ++#define VERSION_STRING_OFFSET 0x0200 ++/* primary offset is written at an offset from the start of the fw blob */ ++#define PRIMARY_OFFSET_OFFSET 0x8 ++/* primary offset needs to be then added to a base offset */ ++#define PRIMARY_OFFSET_SHIFT 12 ++#define PRIMARY_OFFSET(x) ((x) << PRIMARY_OFFSET_SHIFT) ++#define HEADER_OFFSET 0x300 ++ ++struct aqr_fw_header { ++ u32 padding; ++ u8 iram_offset[3]; ++ u8 iram_size[3]; ++ u8 dram_offset[3]; ++ u8 dram_size[3]; ++} __packed; ++ ++enum aqr_fw_src { ++ AQR_FW_SRC_NVMEM = 0, ++ AQR_FW_SRC_FS, ++}; ++ ++static const char * const aqr_fw_src_string[] = { ++ [AQR_FW_SRC_NVMEM] = "NVMEM", ++ [AQR_FW_SRC_FS] = "FS", ++}; ++ ++/* AQR firmware doesn't have fixed offsets for iram and dram section ++ * but instead provide an header with the offset to use on reading ++ * and parsing the firmware. ++ * ++ * AQR firmware can't be trusted and each offset is validated to be ++ * not negative and be in the size of the firmware itself. ++ */ ++static bool aqr_fw_validate_get(size_t size, size_t offset, size_t get_size) ++{ ++ return offset + get_size <= size; ++} ++ ++static int aqr_fw_get_be16(const u8 *data, size_t offset, size_t size, u16 *value) ++{ ++ if (!aqr_fw_validate_get(size, offset, sizeof(u16))) ++ return -EINVAL; ++ ++ *value = get_unaligned_be16(data + offset); ++ ++ return 0; ++} ++ ++static int aqr_fw_get_le16(const u8 *data, size_t offset, size_t size, u16 *value) ++{ ++ if (!aqr_fw_validate_get(size, offset, sizeof(u16))) ++ return -EINVAL; ++ ++ *value = get_unaligned_le16(data + offset); ++ ++ return 0; ++} ++ ++static int aqr_fw_get_le24(const u8 *data, size_t offset, size_t size, u32 *value) ++{ ++ if (!aqr_fw_validate_get(size, offset, sizeof(u8) * 3)) ++ return -EINVAL; ++ ++ *value = get_unaligned_le24(data + offset); ++ ++ return 0; ++} ++ ++/* load data into the phy's memory */ ++static int aqr_fw_load_memory(struct phy_device *phydev, u32 addr, ++ const u8 *data, size_t len) ++{ ++ u16 crc = 0, up_crc; ++ size_t pos; ++ ++ /* PHY expect addr in LE */ ++ addr = (__force u32)cpu_to_le32(addr); ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, ++ VEND1_GLOBAL_MAILBOX_INTERFACE1, ++ VEND1_GLOBAL_MAILBOX_INTERFACE1_CRC_RESET); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, ++ VEND1_GLOBAL_MAILBOX_INTERFACE3, ++ VEND1_GLOBAL_MAILBOX_INTERFACE3_MSW_ADDR(addr)); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, ++ VEND1_GLOBAL_MAILBOX_INTERFACE4, ++ VEND1_GLOBAL_MAILBOX_INTERFACE4_LSW_ADDR(addr)); ++ ++ /* We assume and enforce the size to be word aligned. ++ * If a firmware that is not word aligned is found, please report upstream. ++ */ ++ for (pos = 0; pos < len; pos += sizeof(u32)) { ++ u32 word; ++ ++ /* FW data is always stored in little-endian */ ++ word = get_unaligned((const u32 *)(data + pos)); ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_MAILBOX_INTERFACE5, ++ VEND1_GLOBAL_MAILBOX_INTERFACE5_MSW_DATA(word)); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_MAILBOX_INTERFACE6, ++ VEND1_GLOBAL_MAILBOX_INTERFACE6_LSW_DATA(word)); ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_MAILBOX_INTERFACE1, ++ VEND1_GLOBAL_MAILBOX_INTERFACE1_EXECUTE | ++ VEND1_GLOBAL_MAILBOX_INTERFACE1_WRITE); ++ ++ /* calculate CRC as we load data to the mailbox. ++ * We convert word to big-endian as PHY is BE and mailbox will ++ * return a BE CRC. ++ */ ++ word = (__force u32)cpu_to_be32(word); ++ crc = crc_ccitt_false(crc, (u8 *)&word, sizeof(word)); ++ } ++ ++ up_crc = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_MAILBOX_INTERFACE2); ++ if (crc != up_crc) { ++ phydev_err(phydev, "CRC mismatch: calculated 0x%04x PHY 0x%04x\n", ++ crc, up_crc); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int aqr_fw_boot(struct phy_device *phydev, const u8 *data, size_t size, ++ enum aqr_fw_src fw_src) ++{ ++ u16 calculated_crc, read_crc, read_primary_offset; ++ u32 iram_offset = 0, iram_size = 0; ++ u32 dram_offset = 0, dram_size = 0; ++ char version[VERSION_STRING_SIZE]; ++ u32 primary_offset = 0; ++ int ret; ++ ++ /* extract saved CRC at the end of the fw ++ * CRC is saved in big-endian as PHY is BE ++ */ ++ ret = aqr_fw_get_be16(data, size - sizeof(u16), size, &read_crc); ++ if (ret) { ++ phydev_err(phydev, "bad firmware CRC in firmware\n"); ++ return ret; ++ } ++ calculated_crc = crc_ccitt_false(0, data, size - sizeof(u16)); ++ if (read_crc != calculated_crc) { ++ phydev_err(phydev, "bad firmware CRC: file 0x%04x calculated 0x%04x\n", ++ read_crc, calculated_crc); ++ return -EINVAL; ++ } ++ ++ /* Get the primary offset to extract DRAM and IRAM sections. */ ++ ret = aqr_fw_get_le16(data, PRIMARY_OFFSET_OFFSET, size, &read_primary_offset); ++ if (ret) { ++ phydev_err(phydev, "bad primary offset in firmware\n"); ++ return ret; ++ } ++ primary_offset = PRIMARY_OFFSET(read_primary_offset); ++ ++ /* Find the DRAM and IRAM sections within the firmware file. ++ * Make sure the fw_header is correctly in the firmware. ++ */ ++ if (!aqr_fw_validate_get(size, primary_offset + HEADER_OFFSET, ++ sizeof(struct aqr_fw_header))) { ++ phydev_err(phydev, "bad fw_header in firmware\n"); ++ return -EINVAL; ++ } ++ ++ /* offset are in LE and values needs to be converted to cpu endian */ ++ ret = aqr_fw_get_le24(data, primary_offset + HEADER_OFFSET + ++ offsetof(struct aqr_fw_header, iram_offset), ++ size, &iram_offset); ++ if (ret) { ++ phydev_err(phydev, "bad iram offset in firmware\n"); ++ return ret; ++ } ++ ret = aqr_fw_get_le24(data, primary_offset + HEADER_OFFSET + ++ offsetof(struct aqr_fw_header, iram_size), ++ size, &iram_size); ++ if (ret) { ++ phydev_err(phydev, "invalid iram size in firmware\n"); ++ return ret; ++ } ++ ret = aqr_fw_get_le24(data, primary_offset + HEADER_OFFSET + ++ offsetof(struct aqr_fw_header, dram_offset), ++ size, &dram_offset); ++ if (ret) { ++ phydev_err(phydev, "bad dram offset in firmware\n"); ++ return ret; ++ } ++ ret = aqr_fw_get_le24(data, primary_offset + HEADER_OFFSET + ++ offsetof(struct aqr_fw_header, dram_size), ++ size, &dram_size); ++ if (ret) { ++ phydev_err(phydev, "invalid dram size in firmware\n"); ++ return ret; ++ } ++ ++ /* Increment the offset with the primary offset. ++ * Validate iram/dram offset and size. ++ */ ++ iram_offset += primary_offset; ++ if (iram_size % sizeof(u32)) { ++ phydev_err(phydev, "iram size if not aligned to word size. Please report this upstream!\n"); ++ return -EINVAL; ++ } ++ if (!aqr_fw_validate_get(size, iram_offset, iram_size)) { ++ phydev_err(phydev, "invalid iram offset for iram size\n"); ++ return -EINVAL; ++ } ++ ++ dram_offset += primary_offset; ++ if (dram_size % sizeof(u32)) { ++ phydev_err(phydev, "dram size if not aligned to word size. Please report this upstream!\n"); ++ return -EINVAL; ++ } ++ if (!aqr_fw_validate_get(size, dram_offset, dram_size)) { ++ phydev_err(phydev, "invalid iram offset for iram size\n"); ++ return -EINVAL; ++ } ++ ++ phydev_dbg(phydev, "primary %d IRAM offset=%d size=%d DRAM offset=%d size=%d\n", ++ primary_offset, iram_offset, iram_size, dram_offset, dram_size); ++ ++ if (!aqr_fw_validate_get(size, dram_offset + VERSION_STRING_OFFSET, ++ VERSION_STRING_SIZE)) { ++ phydev_err(phydev, "invalid version in firmware\n"); ++ return -EINVAL; ++ } ++ strscpy(version, (char *)data + dram_offset + VERSION_STRING_OFFSET, ++ VERSION_STRING_SIZE); ++ if (version[0] == '\0') { ++ phydev_err(phydev, "invalid version in firmware\n"); ++ return -EINVAL; ++ } ++ phydev_info(phydev, "loading firmware version '%s' from '%s'\n", version, ++ aqr_fw_src_string[fw_src]); ++ ++ /* stall the microcprocessor */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_CONTROL2, ++ VEND1_GLOBAL_CONTROL2_UP_RUN_STALL | VEND1_GLOBAL_CONTROL2_UP_RUN_STALL_OVD); ++ ++ phydev_dbg(phydev, "loading DRAM 0x%08x from offset=%d size=%d\n", ++ DRAM_BASE_ADDR, dram_offset, dram_size); ++ ret = aqr_fw_load_memory(phydev, DRAM_BASE_ADDR, data + dram_offset, ++ dram_size); ++ if (ret) ++ return ret; ++ ++ phydev_dbg(phydev, "loading IRAM 0x%08x from offset=%d size=%d\n", ++ IRAM_BASE_ADDR, iram_offset, iram_size); ++ ret = aqr_fw_load_memory(phydev, IRAM_BASE_ADDR, data + iram_offset, ++ iram_size); ++ if (ret) ++ return ret; ++ ++ /* make sure soft reset and low power mode are clear */ ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_SC, ++ VEND1_GLOBAL_SC_SOFT_RESET | VEND1_GLOBAL_SC_LOW_POWER); ++ ++ /* Release the microprocessor. UP_RESET must be held for 100 usec. */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_CONTROL2, ++ VEND1_GLOBAL_CONTROL2_UP_RUN_STALL | ++ VEND1_GLOBAL_CONTROL2_UP_RUN_STALL_OVD | ++ VEND1_GLOBAL_CONTROL2_UP_RUN_STALL_RST); ++ usleep_range(UP_RESET_SLEEP, UP_RESET_SLEEP * 2); ++ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_CONTROL2, ++ VEND1_GLOBAL_CONTROL2_UP_RUN_STALL_OVD); ++ ++ return 0; ++} ++ ++static int aqr_firmware_load_nvmem(struct phy_device *phydev) ++{ ++ struct nvmem_cell *cell; ++ size_t size; ++ u8 *buf; ++ int ret; ++ ++ cell = nvmem_cell_get(&phydev->mdio.dev, "firmware"); ++ if (IS_ERR(cell)) ++ return PTR_ERR(cell); ++ ++ buf = nvmem_cell_read(cell, &size); ++ if (IS_ERR(buf)) { ++ ret = PTR_ERR(buf); ++ goto exit; ++ } ++ ++ ret = aqr_fw_boot(phydev, buf, size, AQR_FW_SRC_NVMEM); ++ if (ret) ++ phydev_err(phydev, "firmware loading failed: %d\n", ret); ++ ++ kfree(buf); ++exit: ++ nvmem_cell_put(cell); ++ ++ return ret; ++} ++ ++static int aqr_firmware_load_fs(struct phy_device *phydev) ++{ ++ struct device *dev = &phydev->mdio.dev; ++ const struct firmware *fw; ++ const char *fw_name; ++ int ret; ++ ++ ret = of_property_read_string(dev->of_node, "firmware-name", ++ &fw_name); ++ if (ret) ++ return ret; ++ ++ ret = request_firmware(&fw, fw_name, dev); ++ if (ret) { ++ phydev_err(phydev, "failed to find FW file %s (%d)\n", ++ fw_name, ret); ++ return ret; ++ } ++ ++ ret = aqr_fw_boot(phydev, fw->data, fw->size, AQR_FW_SRC_FS); ++ if (ret) ++ phydev_err(phydev, "firmware loading failed: %d\n", ret); ++ ++ release_firmware(fw); ++ ++ return ret; ++} ++ ++int aqr_firmware_load(struct phy_device *phydev) ++{ ++ int ret; ++ ++ /* Check if the firmware is not already loaded by pooling ++ * the current version returned by the PHY. If 0 is returned, ++ * no firmware is loaded. ++ */ ++ ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_FW_ID); ++ if (ret > 0) ++ goto exit; ++ ++ ret = aqr_firmware_load_nvmem(phydev); ++ if (!ret) ++ goto exit; ++ ++ ret = aqr_firmware_load_fs(phydev); ++ if (ret) ++ return ret; ++ ++exit: ++ return 0; ++} +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c +@@ -658,11 +658,17 @@ static int aqr107_resume(struct phy_devi + + static int aqr107_probe(struct phy_device *phydev) + { ++ int ret; ++ + phydev->priv = devm_kzalloc(&phydev->mdio.dev, + sizeof(struct aqr107_priv), GFP_KERNEL); + if (!phydev->priv) + return -ENOMEM; + ++ ret = aqr_firmware_load(phydev); ++ if (ret) ++ return ret; ++ + return aqr_hwmon_probe(phydev); + } + diff --git a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch index 7eb097f86d0212..7c0a49069577e7 100644 --- a/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch +++ b/target/linux/generic/backport-5.15/791-v6.2-01-net-phy-Add-driver-for-Motorcomm-yt8521-gigabit-ethernet.patch @@ -31,7 +31,7 @@ Signed-off-by: David S. Miller F: drivers/net/phy/motorcomm.c --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -245,7 +245,7 @@ config MOTORCOMM_PHY +@@ -242,7 +242,7 @@ config MOTORCOMM_PHY tristate "Motorcomm PHYs" help Enables support for Motorcomm network PHYs. diff --git a/target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch b/target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch index da60c63905d7f6..94d09092cfd201 100644 --- a/target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch +++ b/target/linux/generic/backport-5.15/791-v6.2-03-net-phy-add-Motorcomm-YT8531S-phy-id.patch @@ -22,7 +22,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -245,7 +245,7 @@ config MOTORCOMM_PHY +@@ -242,7 +242,7 @@ config MOTORCOMM_PHY tristate "Motorcomm PHYs" help Enables support for Motorcomm network PHYs. diff --git a/target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch b/target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch index 9dce5a8add95f4..a8b9e3d13b0041 100644 --- a/target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch +++ b/target/linux/generic/backport-5.15/791-v6.3-09-net-phy-Add-driver-for-Motorcomm-yt8531-gigabit-ethernet.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -245,7 +245,7 @@ config MOTORCOMM_PHY +@@ -242,7 +242,7 @@ config MOTORCOMM_PHY tristate "Motorcomm PHYs" help Enables support for Motorcomm network PHYs. diff --git a/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch b/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch index d8ec95b37478ab..c4a915956e9c9d 100644 --- a/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch +++ b/target/linux/generic/hack-5.15/720-net-phy-add-aqr-phys.patch @@ -7,8 +7,8 @@ PHYs AQR113C and AQR813. Signed-off-by: Birger Koblitz ---- a/drivers/net/phy/aquantia_main.c -+++ b/drivers/net/phy/aquantia_main.c +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -23,6 +23,7 @@ #define PHY_ID_AQCS109 0x03a1b5c2 #define PHY_ID_AQR405 0x03a1b4b0 @@ -17,7 +17,7 @@ Signed-off-by: Birger Koblitz #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -415,6 +416,49 @@ static int aqr107_read_rate(struct phy_d +@@ -360,6 +361,49 @@ static int aqr107_read_rate(struct phy_d return 0; } @@ -67,7 +67,7 @@ Signed-off-by: Birger Koblitz static int aqr107_read_status(struct phy_device *phydev) { int val, ret; -@@ -554,7 +598,7 @@ static void aqr107_chip_info(struct phy_ +@@ -499,7 +543,7 @@ static void aqr107_chip_info(struct phy_ build_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID, val); prov_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val); @@ -76,7 +76,7 @@ Signed-off-by: Birger Koblitz fw_major, fw_minor, build_id, prov_id); } -@@ -811,7 +855,7 @@ static struct phy_driver aqr_driver[] = +@@ -762,7 +806,7 @@ static struct phy_driver aqr_driver[] = .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, @@ -85,7 +85,7 @@ Signed-off-by: Birger Koblitz .get_tunable = aqr107_get_tunable, .set_tunable = aqr107_set_tunable, .suspend = aqr107_suspend, -@@ -821,6 +865,24 @@ static struct phy_driver aqr_driver[] = +@@ -772,6 +816,24 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, }, @@ -110,7 +110,7 @@ Signed-off-by: Birger Koblitz }; module_phy_driver(aqr_driver); -@@ -834,6 +896,7 @@ static struct mdio_device_id __maybe_unu +@@ -785,6 +847,7 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, diff --git a/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch b/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch index f80757cae94e75..6ec0db2526d625 100644 --- a/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch +++ b/target/linux/generic/hack-5.15/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch @@ -10,11 +10,11 @@ different firmware on the PHY. Signed-off-by: Alex Marginean --- - drivers/net/phy/aquantia_main.c | 88 +++++++++++++++++++++++++++++++++++++++++ + drivers/net/phy/aquantia/aquantia_main.c | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) ---- a/drivers/net/phy/aquantia_main.c -+++ b/drivers/net/phy/aquantia_main.c +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -24,6 +24,8 @@ #define PHY_ID_AQR405 0x03a1b4b0 #define PHY_ID_AQR113C 0x31c31c12 @@ -24,7 +24,7 @@ Signed-off-by: Alex Marginean #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -151,6 +153,29 @@ +@@ -96,6 +98,29 @@ #define AQR107_OP_IN_PROG_SLEEP 1000 #define AQR107_OP_IN_PROG_TIMEOUT 100000 @@ -54,7 +54,7 @@ Signed-off-by: Alex Marginean struct aqr107_hw_stat { const char *name; int reg; -@@ -282,6 +307,51 @@ static int aqr_config_aneg(struct phy_de +@@ -227,6 +252,51 @@ static int aqr_config_aneg(struct phy_de return genphy_c45_check_and_restart_aneg(phydev, changed); } @@ -106,7 +106,7 @@ Signed-off-by: Alex Marginean static int aqr_config_intr(struct phy_device *phydev) { bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; -@@ -883,6 +953,30 @@ static struct phy_driver aqr_driver[] = +@@ -834,6 +904,30 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, }, @@ -137,7 +137,7 @@ Signed-off-by: Alex Marginean }; module_phy_driver(aqr_driver); -@@ -897,6 +991,8 @@ static struct mdio_device_id __maybe_unu +@@ -848,6 +942,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, diff --git a/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch b/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch index 8e204cb146aa93..33b182eab92557 100644 --- a/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch +++ b/target/linux/generic/hack-5.15/723-net-phy-aquantia-fix-system-side-protocol-mi.patch @@ -9,12 +9,12 @@ these protocols leads to link issues on system side. Signed-off-by: Alex Marginean --- - drivers/net/phy/aquantia_main.c | 8 +++++++- + drivers/net/phy/aquantia/aquantia_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---- a/drivers/net/phy/aquantia_main.c -+++ b/drivers/net/phy/aquantia_main.c -@@ -340,10 +340,16 @@ static int aqr_config_aneg_set_prot(stru +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c +@@ -285,10 +285,16 @@ static int aqr_config_aneg_set_prot(stru phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE, aquantia_syscfg[if_type].start_rate); diff --git a/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch b/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch index f30e65101a2df6..a31b327f9e96ed 100644 --- a/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch +++ b/target/linux/generic/hack-5.15/724-net-phy-aquantia-Add-AQR113-driver-support.patch @@ -5,11 +5,11 @@ Subject: [PATCH] PONRTSYS-8842: aquantia: Add AQR113 driver support Add a new entry for AQR113 PHY_ID --- - drivers/net/phy/aquantia_main.c | 10 ++++++++++ + drivers/net/phy/aquantia/aquantia_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) ---- a/drivers/net/phy/aquantia_main.c -+++ b/drivers/net/phy/aquantia_main.c +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -26,6 +26,7 @@ #define PHY_ID_AQR813 0x31c31cb2 #define PHY_ID_AQR112 0x03a1b662 @@ -18,7 +18,7 @@ Add a new entry for AQR113 PHY_ID #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -972,6 +973,14 @@ static struct phy_driver aqr_driver[] = +@@ -923,6 +924,14 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, }, { @@ -33,7 +33,7 @@ Add a new entry for AQR113 PHY_ID PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name = "Aquantia AQR412", .probe = aqr107_probe, -@@ -999,6 +1008,7 @@ static struct mdio_device_id __maybe_unu +@@ -950,6 +959,7 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) }, diff --git a/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch b/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch index ab674409d68fa4..b2f79f4d5862c7 100644 --- a/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch +++ b/target/linux/generic/hack-5.15/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch @@ -7,11 +7,11 @@ As advised by Ian Chang this PHY is used in Puzzle devices. Signed-off-by: Daniel Golle --- - drivers/net/phy/aquantia_main.c | 10 ++++++++++ + drivers/net/phy/aquantia/aquantia_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) ---- a/drivers/net/phy/aquantia_main.c -+++ b/drivers/net/phy/aquantia_main.c +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -27,6 +27,8 @@ #define PHY_ID_AQR112 0x03a1b662 #define PHY_ID_AQR412 0x03a1b712 @@ -21,7 +21,7 @@ Signed-off-by: Daniel Golle #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -973,6 +975,30 @@ static struct phy_driver aqr_driver[] = +@@ -924,6 +926,30 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, }, { @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle PHY_ID_MATCH_MODEL(PHY_ID_AQR113), .name = "Aquantia AQR113", .config_aneg = aqr_config_aneg, -@@ -1009,6 +1035,8 @@ static struct mdio_device_id __maybe_unu +@@ -960,6 +986,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, diff --git a/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch b/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch index 6a92a103d644ba..d2179f19005ee0 100644 --- a/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch +++ b/target/linux/ipq40xx/patches-5.15/708-net-phy-Add-Qualcom-QCA807x-driver.patch @@ -25,7 +25,7 @@ Signed-off-by: Robert Marko --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -347,6 +347,12 @@ config AT803X_PHY +@@ -344,6 +344,12 @@ config AT803X_PHY Currently supports the AR8030, AR8031, AR8033, AR8035 and internal QCA8337(Internal qca8k PHY) model @@ -40,7 +40,7 @@ Signed-off-by: Robert Marko help --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -92,6 +92,7 @@ obj-$(CONFIG_NATIONAL_PHY) += national.o +@@ -88,6 +88,7 @@ obj-$(CONFIG_NATIONAL_PHY) += national.o obj-$(CONFIG_NXP_C45_TJA11XX_PHY) += nxp-c45-tja11xx.o obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o obj-$(CONFIG_QSEMI_PHY) += qsemi.o diff --git a/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch b/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch index b8964f4e765756..977bdeb5b18cdd 100644 --- a/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch +++ b/target/linux/mediatek/patches-5.15/500-gsw-rtl8367s-mt7622-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -367,6 +367,12 @@ config ROCKCHIP_PHY +@@ -364,6 +364,12 @@ config ROCKCHIP_PHY help Currently supports the integrated Ethernet PHY. @@ -15,7 +15,7 @@ help --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -95,6 +95,7 @@ obj-$(CONFIG_QSEMI_PHY) += qsemi.o +@@ -91,6 +91,7 @@ obj-$(CONFIG_QSEMI_PHY) += qsemi.o obj-$(CONFIG_REALTEK_PHY) += realtek.o obj-$(CONFIG_RENESAS_PHY) += uPD60620.o obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o diff --git a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch index 9da29755825cd1..72ad2a9846485f 100644 --- a/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch +++ b/target/linux/mediatek/patches-5.15/730-v6.5-net-phy-add-driver-for-MediaTek-SoC-built-in-GE-PHYs.patch @@ -42,7 +42,7 @@ Signed-off-by: David S. Miller L: linux-i2c@vger.kernel.org --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -293,6 +293,18 @@ config MEDIATEK_GE_PHY +@@ -290,6 +290,18 @@ config MEDIATEK_GE_PHY help Supports the MediaTek Gigabit Ethernet PHYs. @@ -63,7 +63,7 @@ Signed-off-by: David S. Miller help --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -81,6 +81,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o +@@ -77,6 +77,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o obj-$(CONFIG_MAXLINEAR_GPHY) += mxl-gpy.o obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o diff --git a/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch b/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch index 7151eb35cc0908..76008192469d7b 100644 --- a/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch +++ b/target/linux/mediatek/patches-5.15/733-net-phy-add-driver-for-MediaTek-2.5G-PHY.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -305,6 +305,13 @@ config MEDIATEK_GE_SOC_PHY +@@ -302,6 +302,13 @@ config MEDIATEK_GE_SOC_PHY present in the SoCs efuse and will dynamically calibrate VCM (common-mode voltage) during startup. @@ -29,7 +29,7 @@ Signed-off-by: Daniel Golle help --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -80,6 +80,7 @@ obj-$(CONFIG_MARVELL_10G_PHY) += marvell +@@ -76,6 +76,7 @@ obj-$(CONFIG_MARVELL_10G_PHY) += marvell obj-$(CONFIG_MARVELL_PHY) += marvell.o obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o obj-$(CONFIG_MAXLINEAR_GPHY) += mxl-gpy.o diff --git a/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch b/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch index 98c5e714b1946e..c6f8e6508b4481 100644 --- a/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch +++ b/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch @@ -14,7 +14,7 @@ Submitted-by: Birger Koblitz --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -357,6 +357,12 @@ config REALTEK_PHY +@@ -354,6 +354,12 @@ config REALTEK_PHY help Supports the Realtek 821x PHY. @@ -29,7 +29,7 @@ Submitted-by: Birger Koblitz help --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -93,6 +93,7 @@ obj-$(CONFIG_NXP_C45_TJA11XX_PHY) += nxp +@@ -89,6 +89,7 @@ obj-$(CONFIG_NXP_C45_TJA11XX_PHY) += nxp obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o obj-$(CONFIG_QSEMI_PHY) += qsemi.o obj-$(CONFIG_REALTEK_PHY) += realtek.o From 31ae9728ffca5d4ff8bf6b56b8e7f55e4ce749eb Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Sat, 3 Feb 2024 16:33:14 -0300 Subject: [PATCH 0751/1171] hostapd: fix FILS AKM selection with EAP-192 Fix netifd hostapd.sh selection of FILS-SHA384 algorithm with eap-192. Signed-off-by: Eneas U de Queiroz (cherry picked from commit 472312f83f886a0749672a634948726fda9c2401) --- package/network/services/hostapd/files/hostapd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 271c1f7becd270..5d588b3bde0126 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -77,7 +77,7 @@ hostapd_append_wpa_key_mgmt() { [ "$fils" -gt 0 ] && { case "$auth_type" in - eap-192) + eap192) append wpa_key_mgmt FILS-SHA384 [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt FT-FILS-SHA384 ;; From 79a719508704054b27e9302619dad5bd466a6831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Sat, 17 Feb 2024 15:03:40 +0100 Subject: [PATCH 0752/1171] realtek: fix Netgear GS110TPP OEM install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent OEM firmware versions test the version number embedded in the uimage "name" header field. The exact restricton is unknown, but "7.0.8.4" seems to be the lowest number accepted on a GS110TPPv1 which already has that version or higher. A "9.9.9.9" version is accepted as valid by the GS110TPPv1 OEM firmware, and considered both unique enough to identify an OpenWrt image and moderately future proof against OEM version bumps. This change is also boot tested on a GS108Tv3 with "BOOT Loader Version 1.0.0.2 (2018-08-31 17:05:26 UTC)" to verify that it doesn't break boot on older hardware. Link: https://forum.openwrt.org/t/72510/58 Signed-off-by: Bjørn Mork (cherry picked from commit 6da308f4de61676da448dda5690d45956d35b602) --- target/linux/realtek/image/rtl838x.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 09b4f3ebb03b73..75118aee43d5db 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -166,6 +166,7 @@ define Device/netgear_nge SOC := rtl8380 IMAGE_SIZE := 14848k UIMAGE_MAGIC := 0x4e474520 + UIMAGE_NAME := 9.9.9.9 DEVICE_VENDOR := NETGEAR endef From 60768064ce5d8801a82a00fe914e6068fbae86e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oto=20=C5=A0=C5=A5=C3=A1va?= Date: Fri, 16 Feb 2024 16:28:10 +0100 Subject: [PATCH 0753/1171] build: add explicit --no-show-signature for git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `log.showSignature` is set, it causes the `SOURCE_DATE_EPOCH` to include a textual signature description on OpenPGP-signed commits, because Git prints the description into stdout. This then causes some scripts to fail because they cannot parse the date from the variable. Adding an explicit `--no-show-signature` prevents the signatures from being displayed even when one has Git configured to show them by default, fixing the scripts. Signed-off-by: Oto Šťáva (cherry picked from commit 1e93208bd2c605704b19fe8b04025c20c17e808d) --- scripts/get_source_date_epoch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/get_source_date_epoch.sh b/scripts/get_source_date_epoch.sh index d122acf385326b..727cb0372b0c5f 100755 --- a/scripts/get_source_date_epoch.sh +++ b/scripts/get_source_date_epoch.sh @@ -15,8 +15,8 @@ try_version() { } try_git() { - SOURCE_DATE_EPOCH=$(git -C "$SOURCE" log -1 --format=format:%ct \ - "$SOURCE" 2>/dev/null) + SOURCE_DATE_EPOCH=$(git -C "$SOURCE" log -1 --no-show-signature \ + --format=format:%ct "$SOURCE" 2>/dev/null) [ -n "$SOURCE_DATE_EPOCH" ] } From 48c81b80b27731b41e882b992b5c7b0813073fba Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 17 Feb 2024 17:58:50 +0100 Subject: [PATCH 0754/1171] wifi-scripts: Support HE Iftypes with multiple entries With mac80211_hwsim I have seen such entries in OpenWrt 22.03: HE Iftypes: managed, AP The mac80211.sh script did not detect the entry and failed. Allow arbitrary other entries before to fix this problem. Signed-off-by: Hauke Mehrtens (cherry picked from commit 5df7a78e821cbdcc3beb80150798712a4c00b00e) --- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 6ff627b03813bb..6a37cbb22ea398 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -428,9 +428,9 @@ mac80211_hostapd_setup_base() { he_bss_color:128 \ he_bss_color_enabled:1 - he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) + he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) he_phy_cap=${he_phy_cap:2} - he_mac_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) + he_mac_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) he_mac_cap=${he_mac_cap:2} append base_cfg "ieee80211ax=1" "$N" From e94052bfee3cb14d22dfe678c3b2b1d8a55ea7e2 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 30 Nov 2023 23:29:09 +0800 Subject: [PATCH 0755/1171] mac80211: ath11k: sync with upstream Synchronize the ath11k backports with upstream linux. Most of them are changes in kernel 6.5, the rest are fixes for the ath11k_pci. The most important one is "Revert 'wifi: ath11k: Enable threaded NAPI'", which fixes the problem that QCN9074 cannot be used after restarting on the x86 platform. [ 23.462718] ath11k_pci 0000:02:00.0: failed to vdev 0 create peer for AP: -110 [ 28.503020] ath11k_pci 0000:02:00.0: Timeout in receiving vdev delete response Changes to ipq8074 coldboot part pick from commit b33bfcf ("mac80211: ath11k: sync with ath-next"). Signed-off-by: Chukun Pan --- ...ix-memory-leak-in-WMI-firmware-stats.patch | 51 +++++ ...ath11k-Add-missing-check-for-ioremap.patch | 38 ++++ ...dd-missing-ops-config-for-IPQ5018-in.patch | 30 +++ ...firmware-after-cold-boot-calibration.patch | 47 ++++ ...missing-hw_ops-get_ring_selector-for.patch | 58 +++++ ...ert-wifi-ath11k-Enable-threaded-NAPI.patch | 44 ++++ ...-Split-coldboot-calibration-hw_param.patch | 180 +++++++++++++++ ...coldboot-calibration-support-for-QCN.patch | 176 ++++++++++++++ ...k-Remove-cal_done-check-during-probe.patch | 33 +++ ...-add-a-warning-message-for-MHI_CB_EE.patch | 34 +++ ...chip-id-board-name-while-searching-b.patch | 214 ++++++++++++++++++ ...fix-boot-failure-with-one-MSI-vector.patch | 103 +++++++++ ...i-ath11k-use-unique-QRTR-instance-ID.patch | 4 +- ...ci-fix-compilation-in-5.16-and-older.patch | 2 +- ...ble-coldboot-calibration-for-IPQ8074.patch | 8 +- ...upport-setting-FW-memory-mode-via-DT.patch | 7 +- 16 files changed, 1020 insertions(+), 9 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath11k/0085-wifi-ath11k-fix-memory-leak-in-WMI-firmware-stats.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0086-wifi-ath11k-Add-missing-check-for-ioremap.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0087-wifi-ath11k-Add-missing-ops-config-for-IPQ5018-in.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0088-wifi-ath11k-Restart-firmware-after-cold-boot-calibration.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0089-wifi-ath11k-Add-missing-hw_ops-get_ring_selector-for.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0090-Revert-wifi-ath11k-Enable-threaded-NAPI.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0091-wifi-ath11k-Split-coldboot-calibration-hw_param.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0092-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0093-wifi-ath11k-Remove-cal_done-check-during-probe.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0094-wifi-ath11k-mhi-add-a-warning-message-for-MHI_CB_EE.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0095-wifi-ath11k-add-chip-id-board-name-while-searching-b.patch create mode 100644 package/kernel/mac80211/patches/ath11k/0096-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch diff --git a/package/kernel/mac80211/patches/ath11k/0085-wifi-ath11k-fix-memory-leak-in-WMI-firmware-stats.patch b/package/kernel/mac80211/patches/ath11k/0085-wifi-ath11k-fix-memory-leak-in-WMI-firmware-stats.patch new file mode 100644 index 00000000000000..dde30b962d4f87 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0085-wifi-ath11k-fix-memory-leak-in-WMI-firmware-stats.patch @@ -0,0 +1,51 @@ +From 6aafa1c2d3e3fea2ebe84c018003f2a91722e607 Mon Sep 17 00:00:00 2001 +From: P Praneesh +Date: Tue, 6 Jun 2023 14:41:28 +0530 +Subject: [PATCH] wifi: ath11k: fix memory leak in WMI firmware stats + +Memory allocated for firmware pdev, vdev and beacon statistics +are not released during rmmod. + +Fix it by calling ath11k_fw_stats_free() function before hardware +unregister. + +While at it, avoid calling ath11k_fw_stats_free() while processing +the firmware stats received in the WMI event because the local list +is getting spliced and reinitialised and hence there are no elements +in the list after splicing. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: P Praneesh +Signed-off-by: Aditya Kumar Singh +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230606091128.14202-1-quic_adisi@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 1 + + drivers/net/wireless/ath/ath11k/wmi.c | 5 +++++ + 2 files changed, 6 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -9792,6 +9792,7 @@ void ath11k_mac_destroy(struct ath11k_ba + if (!ar) + continue; + ++ ath11k_fw_stats_free(&ar->fw_stats); + ieee80211_free_hw(ar->hw); + pdev->ar = NULL; + } +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -8119,6 +8119,11 @@ complete: + rcu_read_unlock(); + spin_unlock_bh(&ar->data_lock); + ++ /* Since the stats's pdev, vdev and beacon list are spliced and reinitialised ++ * at this point, no need to free the individual list. ++ */ ++ return; ++ + free: + ath11k_fw_stats_free(&stats); + } diff --git a/package/kernel/mac80211/patches/ath11k/0086-wifi-ath11k-Add-missing-check-for-ioremap.patch b/package/kernel/mac80211/patches/ath11k/0086-wifi-ath11k-Add-missing-check-for-ioremap.patch new file mode 100644 index 00000000000000..e536c3bd644567 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0086-wifi-ath11k-Add-missing-check-for-ioremap.patch @@ -0,0 +1,38 @@ +From 16e0077e14a73866e9b0f4a6bf4ad3d4a5cb0f2a Mon Sep 17 00:00:00 2001 +From: Jiasheng Jiang +Date: Tue, 13 Jun 2023 12:19:40 +0300 +Subject: [PATCH] wifi: ath11k: Add missing check for ioremap + +Add check for ioremap() and return the error if it fails in order to +guarantee the success of ioremap(), same as in +ath11k_qmi_load_file_target_mem(). + +Fixes: 6ac04bdc5edb ("ath11k: Use reserved host DDR addresses from DT for PCI devices") +Signed-off-by: Jiasheng Jiang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230608022858.27405-1-jiasheng@iscas.ac.cn +--- + drivers/net/wireless/ath/ath11k/qmi.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -2061,6 +2061,9 @@ static int ath11k_qmi_assign_target_mem_ + ab->qmi.target_mem[idx].iaddr = + ioremap(ab->qmi.target_mem[idx].paddr, + ab->qmi.target_mem[i].size); ++ if (!ab->qmi.target_mem[idx].iaddr) ++ return -EIO; ++ + ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; + host_ddr_sz = ab->qmi.target_mem[i].size; + ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; +@@ -2086,6 +2089,8 @@ static int ath11k_qmi_assign_target_mem_ + ab->qmi.target_mem[idx].iaddr = + ioremap(ab->qmi.target_mem[idx].paddr, + ab->qmi.target_mem[i].size); ++ if (!ab->qmi.target_mem[idx].iaddr) ++ return -EIO; + } else { + ab->qmi.target_mem[idx].paddr = + ATH11K_QMI_CALDB_ADDRESS; diff --git a/package/kernel/mac80211/patches/ath11k/0087-wifi-ath11k-Add-missing-ops-config-for-IPQ5018-in.patch b/package/kernel/mac80211/patches/ath11k/0087-wifi-ath11k-Add-missing-ops-config-for-IPQ5018-in.patch new file mode 100644 index 00000000000000..fa539ef4591236 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0087-wifi-ath11k-Add-missing-ops-config-for-IPQ5018-in.patch @@ -0,0 +1,30 @@ +From 469ddb20cae61cad9c4f208a4c8682305905a511 Mon Sep 17 00:00:00 2001 +From: Ziyang Huang +Date: Thu, 15 Jun 2023 14:41:47 +0300 +Subject: [PATCH] wifi: ath11k: Add missing ops config for IPQ5018 in + ath11k_ahb_probe() + +Without this patch, the IPQ5018 WiFi will fail and print the following +logs: + + [ 11.033179] ath11k c000000.wifi: unsupported device type 7 + [ 11.033223] ath11k: probe of c000000.wifi failed with error -95 + +Fixes: 25edca7bb18a ("wifi: ath11k: add ipq5018 device support") +Signed-off-by: Ziyang Huang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYZPR01MB5556D7AA10ABEDDDD2D8F39EC953A@TYZPR01MB5556.apcprd01.prod.exchangelabs.com +--- + drivers/net/wireless/ath/ath11k/ahb.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -1127,6 +1127,7 @@ static int ath11k_ahb_probe(struct platf + switch (hw_rev) { + case ATH11K_HW_IPQ8074: + case ATH11K_HW_IPQ6018_HW10: ++ case ATH11K_HW_IPQ5018_HW10: + hif_ops = &ath11k_ahb_hif_ops_ipq8074; + pci_ops = NULL; + break; diff --git a/package/kernel/mac80211/patches/ath11k/0088-wifi-ath11k-Restart-firmware-after-cold-boot-calibration.patch b/package/kernel/mac80211/patches/ath11k/0088-wifi-ath11k-Restart-firmware-after-cold-boot-calibration.patch new file mode 100644 index 00000000000000..4a9385218042c6 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0088-wifi-ath11k-Restart-firmware-after-cold-boot-calibration.patch @@ -0,0 +1,47 @@ +From 80c5390e1f5e5b16d820512265530ef26073d8e0 Mon Sep 17 00:00:00 2001 +From: Ziyang Huang +Date: Thu, 15 Jun 2023 14:41:48 +0300 +Subject: [PATCH] wifi: ath11k: Restart firmware after cold boot calibration + for IPQ5018 + +Restart is required after cold boot calibration on IPQ5018. Otherwise, +we get the following exception: + + [ 14.412829] qcom-q6-mpd cd00000.remoteproc: fatal error received: err_smem_ver.2.1: + [ 14.412829] QC Image Version : QC_IMAGE_VERSION_STRING=WLAN.HK.2.6.0.1-00974-QCAHKSWPL_SILICONZ-1 + [ 14.412829] Image Variant : IMAGE_VARIANT_STRING=5018.wlanfw2.map_spr_spr_evalQ + [ 14.412829] DALSysLogEvent.c:174 Assertion 0 failed param0 :zero,param1 :zero,param2 :zero + [ 14.412829] Thread ID : 0x00000048 Thread name : WLAN RT0 Process ID : 0x00000001 Process name :wlan0 + [ 14.412829] + [ 14.412829] Registers: + [ 14.412829] SP : 0x4c81c120 + [ 14.412829] FP : 0x4c81c138 + [ 14.412829] PC : 0xb022c590 + [ 14.412829] SSR : 0x00000000 + [ 14.412829] BADVA : 0x00000000 + [ 14.412829] LR : 0xb0008490 + [ 14.412829] + [ 14.412829] StackDump + [ 14.412829] from:0x4c81c120 + [ 14.412829] to: 0x00000000: + [ 14.412829] + [ 14.463006] remoteproc remoteproc0: crash detected in cd00000.remoteproc: type fatal error + +Fixes: 8dfe875aa24a ("wifi: ath11k: update hw params for IPQ5018") +Signed-off-by: Ziyang Huang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYZPR01MB55566969818BD4B49E770445C953A@TYZPR01MB5556.apcprd01.prod.exchangelabs.com +--- + drivers/net/wireless/ath/ath11k/core.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -668,6 +668,7 @@ static const struct ath11k_hw_params ath + .hal_params = &ath11k_hw_hal_params_ipq8074, + .single_pdev_only = false, + .cold_boot_calib = true, ++ .cbcal_restart_fw = true, + .fix_l1ss = true, + .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = true, diff --git a/package/kernel/mac80211/patches/ath11k/0089-wifi-ath11k-Add-missing-hw_ops-get_ring_selector-for.patch b/package/kernel/mac80211/patches/ath11k/0089-wifi-ath11k-Add-missing-hw_ops-get_ring_selector-for.patch new file mode 100644 index 00000000000000..cb6667f14ad915 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0089-wifi-ath11k-Add-missing-hw_ops-get_ring_selector-for.patch @@ -0,0 +1,58 @@ +From ce282d8de71f07f0056ea319541141152c65f552 Mon Sep 17 00:00:00 2001 +From: Ziyang Huang +Date: Thu, 15 Jun 2023 14:41:48 +0300 +Subject: [PATCH] wifi: ath11k: Add missing hw_ops->get_ring_selector() for + IPQ5018 + +During sending data after clients connected, hw_ops->get_ring_selector() +will be called. But for IPQ5018, this member isn't set, and the +following NULL pointer exception will be occurred: + + [ 38.840478] 8<--- cut here --- + [ 38.840517] Unable to handle kernel NULL pointer dereference at virtual address 00000000 + ... + [ 38.923161] PC is at 0x0 + [ 38.927930] LR is at ath11k_dp_tx+0x70/0x730 [ath11k] + ... + [ 39.063264] Process hostapd (pid: 1034, stack limit = 0x801ceb3d) + [ 39.068994] Stack: (0x856a9a68 to 0x856aa000) + ... + [ 39.438467] [<7f323804>] (ath11k_dp_tx [ath11k]) from [<7f314e6c>] (ath11k_mac_op_tx+0x80/0x190 [ath11k]) + [ 39.446607] [<7f314e6c>] (ath11k_mac_op_tx [ath11k]) from [<7f17dbe0>] (ieee80211_handle_wake_tx_queue+0x7c/0xc0 [mac80211]) + [ 39.456162] [<7f17dbe0>] (ieee80211_handle_wake_tx_queue [mac80211]) from [<7f174450>] (ieee80211_probereq_get+0x584/0x704 [mac80211]) + [ 39.467443] [<7f174450>] (ieee80211_probereq_get [mac80211]) from [<7f178c40>] (ieee80211_tx_prepare_skb+0x1f8/0x248 [mac80211]) + [ 39.479334] [<7f178c40>] (ieee80211_tx_prepare_skb [mac80211]) from [<7f179e28>] (__ieee80211_subif_start_xmit+0x32c/0x3d4 [mac80211]) + [ 39.491053] [<7f179e28>] (__ieee80211_subif_start_xmit [mac80211]) from [<7f17af08>] (ieee80211_tx_control_port+0x19c/0x288 [mac80211]) + [ 39.502946] [<7f17af08>] (ieee80211_tx_control_port [mac80211]) from [<7f0fc704>] (nl80211_tx_control_port+0x174/0x1d4 [cfg80211]) + [ 39.515017] [<7f0fc704>] (nl80211_tx_control_port [cfg80211]) from [<808ceac4>] (genl_rcv_msg+0x154/0x340) + [ 39.526814] [<808ceac4>] (genl_rcv_msg) from [<808cdb74>] (netlink_rcv_skb+0xb8/0x11c) + [ 39.536446] [<808cdb74>] (netlink_rcv_skb) from [<808ce1d0>] (genl_rcv+0x28/0x34) + [ 39.544344] [<808ce1d0>] (genl_rcv) from [<808cd234>] (netlink_unicast+0x174/0x274) + [ 39.551895] [<808cd234>] (netlink_unicast) from [<808cd510>] (netlink_sendmsg+0x1dc/0x440) + [ 39.559362] [<808cd510>] (netlink_sendmsg) from [<808596e0>] (____sys_sendmsg+0x1a8/0x1fc) + [ 39.567697] [<808596e0>] (____sys_sendmsg) from [<8085b1a8>] (___sys_sendmsg+0xa4/0xdc) + [ 39.575941] [<8085b1a8>] (___sys_sendmsg) from [<8085b310>] (sys_sendmsg+0x44/0x74) + [ 39.583841] [<8085b310>] (sys_sendmsg) from [<80300060>] (ret_fast_syscall+0x0/0x40) + ... + [ 39.620734] Code: bad PC value + [ 39.625869] ---[ end trace 8aef983ad3cbc032 ]--- + +Fixes: ba60f2793d3a ("wifi: ath11k: initialize hw_ops for IPQ5018") +Signed-off-by: Ziyang Huang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYZPR01MB5556D6E3F63EAB5129D11420C953A@TYZPR01MB5556.apcprd01.prod.exchangelabs.com +--- + drivers/net/wireless/ath/ath11k/hw.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/hw.c ++++ b/drivers/net/wireless/ath/ath11k/hw.c +@@ -1178,7 +1178,7 @@ const struct ath11k_hw_ops ipq5018_ops = + .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, + .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, + .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2, +- ++ .get_ring_selector = ath11k_hw_ipq8074_get_tcl_ring_selector, + }; + + #define ATH11K_TX_RING_MASK_0 BIT(0) diff --git a/package/kernel/mac80211/patches/ath11k/0090-Revert-wifi-ath11k-Enable-threaded-NAPI.patch b/package/kernel/mac80211/patches/ath11k/0090-Revert-wifi-ath11k-Enable-threaded-NAPI.patch new file mode 100644 index 00000000000000..313c18c557fdc7 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0090-Revert-wifi-ath11k-Enable-threaded-NAPI.patch @@ -0,0 +1,44 @@ +From d265ebe41c911314bd273c218a37088835959fa1 Mon Sep 17 00:00:00 2001 +From: Kalle Valo +Date: Thu, 20 Jul 2023 18:14:44 +0300 +Subject: [PATCH] Revert "wifi: ath11k: Enable threaded NAPI" + +This reverts commit 13aa2fb692d3717767303817f35b3e650109add3. + +This commit broke QCN9074 initialisation: + +[ 358.960477] ath11k_pci 0000:04:00.0: ce desc not available for wmi command 36866 +[ 358.960481] ath11k_pci 0000:04:00.0: failed to send WMI_STA_POWERSAVE_PARAM_CMDID +[ 358.960484] ath11k_pci 0000:04:00.0: could not set uapsd params -105 + +As there's no fix available let's just revert it to get QCN9074 working again. + +Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217536 +Signed-off-by: Kalle Valo +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230720151444.2016637-1-kvalo@kernel.org +--- + drivers/net/wireless/ath/ath11k/ahb.c | 1 - + drivers/net/wireless/ath/ath11k/pcic.c | 1 - + 2 files changed, 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -376,7 +376,6 @@ static void ath11k_ahb_ext_irq_enable(st + struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + + if (!irq_grp->napi_enabled) { +- dev_set_threaded(&irq_grp->napi_ndev, true); + napi_enable(&irq_grp->napi); + irq_grp->napi_enabled = true; + } +--- a/drivers/net/wireless/ath/ath11k/pcic.c ++++ b/drivers/net/wireless/ath/ath11k/pcic.c +@@ -466,7 +466,6 @@ void ath11k_pcic_ext_irq_enable(struct a + struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + + if (!irq_grp->napi_enabled) { +- dev_set_threaded(&irq_grp->napi_ndev, true); + napi_enable(&irq_grp->napi); + irq_grp->napi_enabled = true; + } diff --git a/package/kernel/mac80211/patches/ath11k/0091-wifi-ath11k-Split-coldboot-calibration-hw_param.patch b/package/kernel/mac80211/patches/ath11k/0091-wifi-ath11k-Split-coldboot-calibration-hw_param.patch new file mode 100644 index 00000000000000..47053546860ddf --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0091-wifi-ath11k-Split-coldboot-calibration-hw_param.patch @@ -0,0 +1,180 @@ +From 011e5a3052a22d3758d17442bf0c04c68bf79bea Mon Sep 17 00:00:00 2001 +From: Seevalamuthu Mariappan +Date: Wed, 26 Jul 2023 19:40:30 +0530 +Subject: [PATCH 3/5] wifi: ath11k: Split coldboot calibration hw_param + +QCN9074 enables coldboot calibration only in Factory Test Mode (FTM). +Hence, split cold_boot_calib to two hw_params for mission and FTM +mode. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Seevalamuthu Mariappan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726141032.3061-2-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/ahb.c | 3 +-- + drivers/net/wireless/ath/ath11k/core.c | 36 ++++++++++++++++++++------ + drivers/net/wireless/ath/ath11k/core.h | 1 + + drivers/net/wireless/ath/ath11k/hw.h | 3 ++- + drivers/net/wireless/ath/ath11k/qmi.c | 6 ++--- + 5 files changed, 35 insertions(+), 14 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -422,8 +422,7 @@ static int ath11k_ahb_fwreset_from_cold_ + { + int timeout; + +- if (ath11k_cold_boot_cal == 0 || ab->qmi.cal_done || +- ab->hw_params.cold_boot_calib == 0 || ++ if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || + ab->hw_params.cbcal_restart_fw == 0) + return 0; + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -86,7 +86,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = false, + .idle_ps = false, + .supports_sta_ps = false, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = true, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -167,7 +168,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = false, + .idle_ps = false, + .supports_sta_ps = false, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = true, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -248,7 +250,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -332,7 +335,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = false, + .idle_ps = false, + .supports_sta_ps = false, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 2, + .num_vdevs = 8, +@@ -413,7 +417,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -495,7 +500,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -578,7 +584,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -667,7 +674,8 @@ static const struct ath11k_hw_params ath + .supports_suspend = false, + .hal_params = &ath11k_hw_hal_params_ipq8074, + .single_pdev_only = false, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = true, + .fix_l1ss = true, + .supports_dynamic_smps_6ghz = false, +@@ -749,6 +757,18 @@ void ath11k_fw_stats_free(struct ath11k_ + ath11k_fw_stats_bcn_free(&stats->bcn); + } + ++bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab) ++{ ++ if (!ath11k_cold_boot_cal) ++ return false; ++ ++ if (ath11k_ftm_mode) ++ return ab->hw_params.coldboot_cal_ftm; ++ ++ else ++ return ab->hw_params.coldboot_cal_mm; ++} ++ + int ath11k_core_suspend(struct ath11k_base *ab) + { + int ret; +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -1186,6 +1186,7 @@ void ath11k_core_halt(struct ath11k *ar) + int ath11k_core_resume(struct ath11k_base *ab); + int ath11k_core_suspend(struct ath11k_base *ab); + void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab); ++bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab); + + const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, + const char *filename); +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -187,7 +187,8 @@ struct ath11k_hw_params { + bool supports_shadow_regs; + bool idle_ps; + bool supports_sta_ps; +- bool cold_boot_calib; ++ bool coldboot_cal_mm; ++ bool coldboot_cal_ftm; + bool cbcal_restart_fw; + int fw_mem_mode; + u32 num_vdevs; +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -2082,7 +2082,7 @@ static int ath11k_qmi_assign_target_mem_ + return -EINVAL; + } + +- if (ath11k_cold_boot_cal && ab->hw_params.cold_boot_calib) { ++ if (ath11k_core_coldboot_cal_support(ab)) { + if (hremote_node) { + ab->qmi.target_mem[idx].paddr = + res.start + host_ddr_sz; +@@ -3212,8 +3212,8 @@ static void ath11k_qmi_driver_event_work + break; + } + +- if (ath11k_cold_boot_cal && ab->qmi.cal_done == 0 && +- ab->hw_params.cold_boot_calib) { ++ if (ab->qmi.cal_done == 0 && ++ ath11k_core_coldboot_cal_support(ab)) { + ath11k_qmi_process_coldboot_calibration(ab); + } else { + clear_bit(ATH11K_FLAG_CRASH_FLUSH, diff --git a/package/kernel/mac80211/patches/ath11k/0092-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch b/package/kernel/mac80211/patches/ath11k/0092-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch new file mode 100644 index 00000000000000..31b11ddee4bbdf --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0092-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch @@ -0,0 +1,176 @@ +From bdfc967bf5fcd762473a01d39edb81f1165ba290 Mon Sep 17 00:00:00 2001 +From: Anilkumar Kolli +Date: Wed, 26 Jul 2023 19:40:31 +0530 +Subject: [PATCH 4/5] wifi: ath11k: Add coldboot calibration support for + QCN9074 + +QCN9074 supports 6 GHz, which has increased number of channels +compared to 5 GHz/2 GHz. So, to support coldboot calibration in +QCN9074 ATH11K_COLD_BOOT_FW_RESET_DELAY extended to 60 seconds. To +avoid code redundancy, fwreset_from_cold_boot moved to QMI and made +common for both ahb and pci. Coldboot calibration is enabled only in +FTM mode for QCN9074. QCN9074 requires firmware restart after coldboot, +hence enable cbcal_restart_fw in hw_params. + +This support can be enabled/disabled using hw params for different +hardware. Currently it is not enabled for QCA6390. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Anilkumar Kolli +Signed-off-by: Seevalamuthu Mariappan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726141032.3061-3-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/ahb.c | 28 ++------------------------ + drivers/net/wireless/ath/ath11k/core.c | 4 ++-- + drivers/net/wireless/ath/ath11k/pci.c | 2 ++ + drivers/net/wireless/ath/ath11k/qmi.c | 28 ++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/qmi.h | 3 ++- + 5 files changed, 36 insertions(+), 29 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -14,6 +14,7 @@ + #include "ahb.h" + #include "debug.h" + #include "hif.h" ++#include "qmi.h" + #include + #include "pcic.h" + #include +@@ -418,31 +419,6 @@ static void ath11k_ahb_power_down(struct + rproc_shutdown(ab_ahb->tgt_rproc); + } + +-static int ath11k_ahb_fwreset_from_cold_boot(struct ath11k_base *ab) +-{ +- int timeout; +- +- if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || +- ab->hw_params.cbcal_restart_fw == 0) +- return 0; +- +- ath11k_dbg(ab, ATH11K_DBG_AHB, "wait for cold boot done\n"); +- timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, +- (ab->qmi.cal_done == 1), +- ATH11K_COLD_BOOT_FW_RESET_DELAY); +- if (timeout <= 0) { +- ath11k_cold_boot_cal = 0; +- ath11k_warn(ab, "Coldboot Calibration failed timed out\n"); +- } +- +- /* reset the firmware */ +- ath11k_ahb_power_down(ab); +- ath11k_ahb_power_up(ab); +- +- ath11k_dbg(ab, ATH11K_DBG_AHB, "exited from cold boot mode\n"); +- return 0; +-} +- + static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab) + { + struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; +@@ -1225,7 +1201,7 @@ static int ath11k_ahb_probe(struct platf + goto err_ce_free; + } + +- ath11k_ahb_fwreset_from_cold_boot(ab); ++ ath11k_qmi_fwreset_from_cold_boot(ab); + + return 0; + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -336,8 +336,8 @@ static const struct ath11k_hw_params ath + .idle_ps = false, + .supports_sta_ps = false, + .coldboot_cal_mm = false, +- .coldboot_cal_ftm = false, +- .cbcal_restart_fw = false, ++ .coldboot_cal_ftm = true, ++ .cbcal_restart_fw = true, + .fw_mem_mode = 2, + .num_vdevs = 8, + .num_peers = 128, +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -15,6 +15,7 @@ + #include "mhi.h" + #include "debug.h" + #include "pcic.h" ++#include "qmi.h" + + #define ATH11K_PCI_BAR_NUM 0 + #define ATH11K_PCI_DMA_MASK 32 +@@ -897,6 +898,7 @@ unsupported_wcn6855_soc: + ath11k_err(ab, "failed to init core: %d\n", ret); + goto err_irq_affinity_cleanup; + } ++ ath11k_qmi_fwreset_from_cold_boot(ab); + return 0; + + err_irq_affinity_cleanup: +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -9,6 +9,7 @@ + #include "qmi.h" + #include "core.h" + #include "debug.h" ++#include "hif.h" + #include + #include + #include +@@ -2842,6 +2843,33 @@ int ath11k_qmi_firmware_start(struct ath + return 0; + } + ++int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab) ++{ ++ int timeout; ++ ++ if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || ++ ab->hw_params.cbcal_restart_fw == 0) ++ return 0; ++ ++ ath11k_dbg(ab, ATH11K_DBG_QMI, "wait for cold boot done\n"); ++ ++ timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, ++ (ab->qmi.cal_done == 1), ++ ATH11K_COLD_BOOT_FW_RESET_DELAY); ++ ++ if (timeout <= 0) { ++ ath11k_warn(ab, "Coldboot Calibration timed out\n"); ++ return -ETIMEDOUT; ++ } ++ ++ /* reset the firmware */ ++ ath11k_hif_power_down(ab); ++ ath11k_hif_power_up(ab); ++ ath11k_dbg(ab, ATH11K_DBG_QMI, "exit wait for cold boot done\n"); ++ return 0; ++} ++EXPORT_SYMBOL(ath11k_qmi_fwreset_from_cold_boot); ++ + static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab) + { + int timeout; +--- a/drivers/net/wireless/ath/ath11k/qmi.h ++++ b/drivers/net/wireless/ath/ath11k/qmi.h +@@ -37,7 +37,7 @@ + + #define QMI_WLANFW_MAX_DATA_SIZE_V01 6144 + #define ATH11K_FIRMWARE_MODE_OFF 4 +-#define ATH11K_COLD_BOOT_FW_RESET_DELAY (40 * HZ) ++#define ATH11K_COLD_BOOT_FW_RESET_DELAY (60 * HZ) + + #define ATH11K_QMI_DEVICE_BAR_SIZE 0x200000 + +@@ -519,5 +519,6 @@ void ath11k_qmi_msg_recv_work(struct wor + void ath11k_qmi_deinit_service(struct ath11k_base *ab); + int ath11k_qmi_init_service(struct ath11k_base *ab); + void ath11k_qmi_free_resource(struct ath11k_base *ab); ++int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab); + + #endif diff --git a/package/kernel/mac80211/patches/ath11k/0093-wifi-ath11k-Remove-cal_done-check-during-probe.patch b/package/kernel/mac80211/patches/ath11k/0093-wifi-ath11k-Remove-cal_done-check-during-probe.patch new file mode 100644 index 00000000000000..513ea3f0b9af44 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0093-wifi-ath11k-Remove-cal_done-check-during-probe.patch @@ -0,0 +1,33 @@ +From 13329d0cb7212b058bd8451a99d215a8f97645ea Mon Sep 17 00:00:00 2001 +From: Seevalamuthu Mariappan +Date: Wed, 26 Jul 2023 19:40:32 +0530 +Subject: [PATCH] wifi: ath11k: Remove cal_done check during probe + +In some race conditions, calibration done QMI message is received even +before host wait starts for calibration to be done. +Due to this, resetting firmware was not performed after calibration. + +Hence, remove cal_done check in ath11k_qmi_fwreset_from_cold_boot() +as this is called only from probe. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Seevalamuthu Mariappan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726141032.3061-4-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/qmi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -2847,7 +2847,7 @@ int ath11k_qmi_fwreset_from_cold_boot(st + { + int timeout; + +- if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || ++ if (!ath11k_core_coldboot_cal_support(ab) || + ab->hw_params.cbcal_restart_fw == 0) + return 0; + diff --git a/package/kernel/mac80211/patches/ath11k/0094-wifi-ath11k-mhi-add-a-warning-message-for-MHI_CB_EE.patch b/package/kernel/mac80211/patches/ath11k/0094-wifi-ath11k-mhi-add-a-warning-message-for-MHI_CB_EE.patch new file mode 100644 index 00000000000000..e1286c9537ce7f --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0094-wifi-ath11k-mhi-add-a-warning-message-for-MHI_CB_EE.patch @@ -0,0 +1,34 @@ +From 4a93b554cf9fa64faa7cf164c0d32fc3ce67108b Mon Sep 17 00:00:00 2001 +From: Arowa Suliman +Date: Sat, 26 Aug 2023 08:42:42 +0300 +Subject: [PATCH] wifi: ath11k: mhi: add a warning message for MHI_CB_EE_RDDM + crash + +Currently, the ath11k driver does not print a crash signature when a +MHI_CB_EE_RDDM crash happens. Checked by triggering a simulated crash using the +command and checking dmesg for logs: + +echo assert > /sys/kernel/debug/ath11k/../simulate_fw_crash + +Add a warning when firmware crash MHI_CB_EE_RDDM happens. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 + +Signed-off-by: Arowa Suliman +Reviewed-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230714001126.463127-1-arowa@chromium.org +--- + drivers/net/wireless/ath/ath11k/mhi.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -333,6 +333,7 @@ static void ath11k_mhi_op_status_cb(stru + ath11k_warn(ab, "firmware crashed: MHI_CB_SYS_ERROR\n"); + break; + case MHI_CB_EE_RDDM: ++ ath11k_warn(ab, "firmware crashed: MHI_CB_EE_RDDM\n"); + if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags))) + queue_work(ab->workqueue_aux, &ab->reset_work); + break; diff --git a/package/kernel/mac80211/patches/ath11k/0095-wifi-ath11k-add-chip-id-board-name-while-searching-b.patch b/package/kernel/mac80211/patches/ath11k/0095-wifi-ath11k-add-chip-id-board-name-while-searching-b.patch new file mode 100644 index 00000000000000..662e28f4ef8d18 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0095-wifi-ath11k-add-chip-id-board-name-while-searching-b.patch @@ -0,0 +1,214 @@ +From 1133af5aea588a58043244a4ecb5ce511b310356 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Wed, 30 Aug 2023 02:02:26 -0400 +Subject: [PATCH] wifi: ath11k: add chip id board name while searching + board-2.bin for WCN6855 + +Sometimes board-2.bin does not have the board data which matched the +parameters such as bus type, vendor, device, subsystem-vendor, +subsystem-device, qmi-chip-id and qmi-board-id, then wlan will load fail. + +Hence add another type which only matches the bus type and qmi-chip-id, +then the ratio of missing board data reduced. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230830060226.18664-1-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 108 ++++++++++++++++++++----- + 1 file changed, 87 insertions(+), 21 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -985,9 +985,15 @@ int ath11k_core_check_dt(struct ath11k_b + return 0; + } + ++enum ath11k_bdf_name_type { ++ ATH11K_BDF_NAME_FULL, ++ ATH11K_BDF_NAME_BUS_NAME, ++ ATH11K_BDF_NAME_CHIP_ID, ++}; ++ + static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name, + size_t name_len, bool with_variant, +- bool bus_type_mode) ++ enum ath11k_bdf_name_type name_type) + { + /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */ + char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 }; +@@ -998,11 +1004,8 @@ static int __ath11k_core_create_board_na + + switch (ab->id.bdf_search) { + case ATH11K_BDF_SEARCH_BUS_AND_BOARD: +- if (bus_type_mode) +- scnprintf(name, name_len, +- "bus=%s", +- ath11k_bus_str(ab->hif.bus)); +- else ++ switch (name_type) { ++ case ATH11K_BDF_NAME_FULL: + scnprintf(name, name_len, + "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", + ath11k_bus_str(ab->hif.bus), +@@ -1012,6 +1015,19 @@ static int __ath11k_core_create_board_na + ab->qmi.target.chip_id, + ab->qmi.target.board_id, + variant); ++ break; ++ case ATH11K_BDF_NAME_BUS_NAME: ++ scnprintf(name, name_len, ++ "bus=%s", ++ ath11k_bus_str(ab->hif.bus)); ++ break; ++ case ATH11K_BDF_NAME_CHIP_ID: ++ scnprintf(name, name_len, ++ "bus=%s,qmi-chip-id=%d", ++ ath11k_bus_str(ab->hif.bus), ++ ab->qmi.target.chip_id); ++ break; ++ } + break; + default: + scnprintf(name, name_len, +@@ -1030,19 +1046,29 @@ static int __ath11k_core_create_board_na + static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, true, false); ++ return __ath11k_core_create_board_name(ab, name, name_len, true, ++ ATH11K_BDF_NAME_FULL); + } + + static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, false, false); ++ return __ath11k_core_create_board_name(ab, name, name_len, false, ++ ATH11K_BDF_NAME_FULL); + } + + static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, false, true); ++ return __ath11k_core_create_board_name(ab, name, name_len, false, ++ ATH11K_BDF_NAME_BUS_NAME); ++} ++ ++static int ath11k_core_create_chip_id_board_name(struct ath11k_base *ab, char *name, ++ size_t name_len) ++{ ++ return __ath11k_core_create_board_name(ab, name, name_len, false, ++ ATH11K_BDF_NAME_CHIP_ID); + } + + const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, +@@ -1289,16 +1315,21 @@ int ath11k_core_fetch_board_data_api_1(s + #define BOARD_NAME_SIZE 200 + int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) + { +- char boardname[BOARD_NAME_SIZE], fallback_boardname[BOARD_NAME_SIZE]; ++ char *boardname = NULL, *fallback_boardname = NULL, *chip_id_boardname = NULL; + char *filename, filepath[100]; +- int ret; ++ int ret = 0; + + filename = ATH11K_BOARD_API2_FILE; ++ boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); ++ if (!boardname) { ++ ret = -ENOMEM; ++ goto exit; ++ } + +- ret = ath11k_core_create_board_name(ab, boardname, sizeof(boardname)); ++ ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); + if (ret) { + ath11k_err(ab, "failed to create board name: %d", ret); +- return ret; ++ goto exit; + } + + ab->bd_api = 2; +@@ -1307,13 +1338,19 @@ int ath11k_core_fetch_bdf(struct ath11k_ + ATH11K_BD_IE_BOARD_NAME, + ATH11K_BD_IE_BOARD_DATA); + if (!ret) +- goto success; ++ goto exit; ++ ++ fallback_boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); ++ if (!fallback_boardname) { ++ ret = -ENOMEM; ++ goto exit; ++ } + + ret = ath11k_core_create_fallback_board_name(ab, fallback_boardname, +- sizeof(fallback_boardname)); ++ BOARD_NAME_SIZE); + if (ret) { + ath11k_err(ab, "failed to create fallback board name: %d", ret); +- return ret; ++ goto exit; + } + + ret = ath11k_core_fetch_board_data_api_n(ab, bd, fallback_boardname, +@@ -1321,7 +1358,28 @@ int ath11k_core_fetch_bdf(struct ath11k_ + ATH11K_BD_IE_BOARD_NAME, + ATH11K_BD_IE_BOARD_DATA); + if (!ret) +- goto success; ++ goto exit; ++ ++ chip_id_boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); ++ if (!chip_id_boardname) { ++ ret = -ENOMEM; ++ goto exit; ++ } ++ ++ ret = ath11k_core_create_chip_id_board_name(ab, chip_id_boardname, ++ BOARD_NAME_SIZE); ++ if (ret) { ++ ath11k_err(ab, "failed to create chip id board name: %d", ret); ++ goto exit; ++ } ++ ++ ret = ath11k_core_fetch_board_data_api_n(ab, bd, chip_id_boardname, ++ ATH11K_BD_IE_BOARD, ++ ATH11K_BD_IE_BOARD_NAME, ++ ATH11K_BD_IE_BOARD_DATA); ++ ++ if (!ret) ++ goto exit; + + ab->bd_api = 1; + ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_DEFAULT_BOARD_FILE); +@@ -1334,14 +1392,22 @@ int ath11k_core_fetch_bdf(struct ath11k_ + ath11k_err(ab, "failed to fetch board data for %s from %s\n", + fallback_boardname, filepath); + ++ ath11k_err(ab, "failed to fetch board data for %s from %s\n", ++ chip_id_boardname, filepath); ++ + ath11k_err(ab, "failed to fetch board.bin from %s\n", + ab->hw_params.fw.dir); +- return ret; + } + +-success: +- ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", ab->bd_api); +- return 0; ++exit: ++ kfree(boardname); ++ kfree(fallback_boardname); ++ kfree(chip_id_boardname); ++ ++ if (!ret) ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", ab->bd_api); ++ ++ return ret; + } + + int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd) diff --git a/package/kernel/mac80211/patches/ath11k/0096-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch b/package/kernel/mac80211/patches/ath11k/0096-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch new file mode 100644 index 00000000000000..9101a1ea1ce557 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0096-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch @@ -0,0 +1,103 @@ +From 39564b475ac5a589e6c22c43a08cbd283c295d2c Mon Sep 17 00:00:00 2001 +From: Baochen Qiang +Date: Thu, 7 Sep 2023 09:56:06 +0800 +Subject: [PATCH] wifi: ath11k: fix boot failure with one MSI vector + +Commit 5b32b6dd96633 ("ath11k: Remove core PCI references from +PCI common code") breaks with one MSI vector because it moves +affinity setting after IRQ request, see below log: + +[ 1417.278835] ath11k_pci 0000:02:00.0: failed to receive control response completion, polling.. +[ 1418.302829] ath11k_pci 0000:02:00.0: Service connect timeout +[ 1418.302833] ath11k_pci 0000:02:00.0: failed to connect to HTT: -110 +[ 1418.303669] ath11k_pci 0000:02:00.0: failed to start core: -110 + +The detail is, if do affinity request after IRQ activated, +which is done in request_irq(), kernel caches that request and +returns success directly. Later when a subsequent MHI interrupt is +fired, kernel will do the real affinity setting work, as a result, +changs the MSI vector. However at that time host has configured +old vector to hardware, so host never receives CE or DP interrupts. + +Fix it by setting affinity before registering MHI controller +where host is, for the first time, doing IRQ request. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 +Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 +Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-01160-QCAMSLSWPLZ-1 + +Fixes: 5b32b6dd9663 ("ath11k: Remove core PCI references from PCI common code") +Signed-off-by: Baochen Qiang +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230907015606.16297-1-quic_bqiang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/pci.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -852,10 +852,16 @@ unsupported_wcn6855_soc: + if (ret) + goto err_pci_disable_msi; + ++ ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); ++ if (ret) { ++ ath11k_err(ab, "failed to set irq affinity %d\n", ret); ++ goto err_pci_disable_msi; ++ } ++ + ret = ath11k_mhi_register(ab_pci); + if (ret) { + ath11k_err(ab, "failed to register mhi: %d\n", ret); +- goto err_pci_disable_msi; ++ goto err_irq_affinity_cleanup; + } + + ret = ath11k_hal_srng_init(ab); +@@ -876,12 +882,6 @@ unsupported_wcn6855_soc: + goto err_ce_free; + } + +- ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); +- if (ret) { +- ath11k_err(ab, "failed to set irq affinity %d\n", ret); +- goto err_free_irq; +- } +- + /* kernel may allocate a dummy vector before request_irq and + * then allocate a real vector when request_irq is called. + * So get msi_data here again to avoid spurious interrupt +@@ -890,20 +890,17 @@ unsupported_wcn6855_soc: + ret = ath11k_pci_config_msi_data(ab_pci); + if (ret) { + ath11k_err(ab, "failed to config msi_data: %d\n", ret); +- goto err_irq_affinity_cleanup; ++ goto err_free_irq; + } + + ret = ath11k_core_init(ab); + if (ret) { + ath11k_err(ab, "failed to init core: %d\n", ret); +- goto err_irq_affinity_cleanup; ++ goto err_free_irq; + } + ath11k_qmi_fwreset_from_cold_boot(ab); + return 0; + +-err_irq_affinity_cleanup: +- ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); +- + err_free_irq: + ath11k_pcic_free_irq(ab); + +@@ -916,6 +913,9 @@ err_hal_srng_deinit: + err_mhi_unregister: + ath11k_mhi_unregister(ab_pci); + ++err_irq_affinity_cleanup: ++ ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); ++ + err_pci_disable_msi: + ath11k_pci_free_msi(ab_pci); + diff --git a/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch b/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch index 39d5a61d5a1ed8..30472b322987d1 100644 --- a/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch +++ b/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch @@ -93,7 +93,7 @@ Signed-off-by: Robert Marko default: return "UNKNOWN"; } -@@ -336,27 +366,14 @@ static void ath11k_mhi_op_status_cb(stru +@@ -337,27 +367,14 @@ static void ath11k_mhi_op_status_cb(stru if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags))) queue_work(ab->workqueue_aux, &ab->reset_work); break; @@ -138,7 +138,7 @@ Signed-off-by: Robert Marko int ath11k_mhi_register(struct ath11k_pci *ar_pci); --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -370,13 +370,20 @@ static void ath11k_pci_sw_reset(struct a +@@ -371,13 +371,20 @@ static void ath11k_pci_sw_reset(struct a static void ath11k_pci_init_qmi_ce_config(struct ath11k_base *ab) { struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; diff --git a/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch b/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch index 72156563899370..9a0ca80090da8d 100644 --- a/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch +++ b/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch @@ -15,7 +15,7 @@ Signed-off-by: Robert Marko --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -458,7 +458,11 @@ static int ath11k_pci_alloc_msi(struct a +@@ -459,7 +459,11 @@ static int ath11k_pci_alloc_msi(struct a pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, &ab->pci.msi.addr_lo); diff --git a/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch b/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch index 5454fa75e4c62d..0c92fa914f7cd3 100644 --- a/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch +++ b/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch @@ -13,12 +13,14 @@ Signed-off-by: Robert Marko --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -86,7 +86,7 @@ static const struct ath11k_hw_params ath +@@ -86,8 +86,8 @@ static const struct ath11k_hw_params ath .supports_shadow_regs = false, .idle_ps = false, .supports_sta_ps = false, -- .cold_boot_calib = true, -+ .cold_boot_calib = false, +- .coldboot_cal_mm = true, +- .coldboot_cal_ftm = true, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, .cbcal_restart_fw = true, .fw_mem_mode = 0, .num_vdevs = 16 + 1, diff --git a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch index 22c2493ca9d1e0..71373b2136f76a 100644 --- a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch +++ b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch @@ -31,7 +31,7 @@ Signed-off-by: Robert Marko { .hw_rev = ATH11K_HW_IPQ8074, .name = "ipq8074 hw2.0", -@@ -1953,7 +1953,8 @@ static void ath11k_core_reset(struct wor +@@ -2040,7 +2040,8 @@ static void ath11k_core_reset(struct wor static int ath11k_init_hw_params(struct ath11k_base *ab) { const struct ath11k_hw_params *hw_params = NULL; @@ -41,7 +41,7 @@ Signed-off-by: Robert Marko for (i = 0; i < ARRAY_SIZE(ath11k_hw_params); i++) { hw_params = &ath11k_hw_params[i]; -@@ -1969,7 +1970,30 @@ static int ath11k_init_hw_params(struct +@@ -2056,7 +2057,31 @@ static int ath11k_init_hw_params(struct ab->hw_params = *hw_params; @@ -62,7 +62,8 @@ Signed-off-by: Robert Marko + ab->hw_params.fw_mem_mode = 2; + ab->hw_params.num_vdevs = 8; + ab->hw_params.num_peers = 128; -+ ab->hw_params.cold_boot_calib = false; ++ ab->hw_params.coldboot_cal_mm = false; ++ ab->hw_params.coldboot_cal_ftm = false; + } else + ath11k_info(ab, "Unsupported FW memory mode: %u\n", fw_mem_mode); + } From b30b1d3685f04afe182f10793085c3da3b6e7792 Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Thu, 22 Feb 2024 16:42:21 +0100 Subject: [PATCH 0756/1171] mediatek: filogic: Cudy WR3000 v1 wps button fix WPS button activation method is wrong . It should be active low Signed-off-by: Robert Senderek (cherry picked from commit 611a9894b23c5c2261d607cc0ccfd8dcd1fb2bcf) --- target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts index 56e90b172289c2..d2aacbfb6916cd 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts @@ -34,7 +34,7 @@ wps { label = "wps"; linux,code = ; - gpios = <&pio 0 GPIO_ACTIVE_HIGH>; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; }; From a2943e379571a72cd7c08b1c6b1db9bddd9cc0a9 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 17 Feb 2024 22:37:05 +0100 Subject: [PATCH 0757/1171] generic vxlan: don't learn non-unicast L2 destinations This patch avoids learning non-unicast targets in the vxlan FDB. They are non-unicast and thus should be sent to the broadcast-IPv6 instead of a unicast address Link: https://lore.kernel.org/netdev/15ee0cc7-9252-466b-8ce7-5225d605dde8@david-bauer.net/ Link: https://github.com/freifunk-gluon/gluon/issues/3191 Signed-off-by: David Bauer (cherry picked from commit 0985262fd0f0b9c33e1fb559e71c041379199a91) --- ...-t-learn-non-unicast-L2-destinations.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 target/linux/generic/pending-5.15/779-net-vxlan-don-t-learn-non-unicast-L2-destinations.patch diff --git a/target/linux/generic/pending-5.15/779-net-vxlan-don-t-learn-non-unicast-L2-destinations.patch b/target/linux/generic/pending-5.15/779-net-vxlan-don-t-learn-non-unicast-L2-destinations.patch new file mode 100644 index 00000000000000..6c1f5967590078 --- /dev/null +++ b/target/linux/generic/pending-5.15/779-net-vxlan-don-t-learn-non-unicast-L2-destinations.patch @@ -0,0 +1,30 @@ +From 3f1a227cb071f65f6ecc4db9f399649869735a7c Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Sat, 17 Feb 2024 22:34:59 +0100 +Subject: [PATCH] net vxlan: don't learn non-unicast L2 destinations + +This patch avoids learning non-unicast targets in the vxlan FDB. +They are non-unicast and thus should be sent to the broadcast-IPv6 +instead of a unicast address. + +Link: https://lore.kernel.org/netdev/15ee0cc7-9252-466b-8ce7-5225d605dde8@david-bauer.net/ +Link: https://github.com/freifunk-gluon/gluon/issues/3191 + +Signed-off-by: David Bauer +--- + drivers/net/vxlan.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/vxlan/vxlan_core.c ++++ b/drivers/net/vxlan/vxlan_core.c +@@ -1493,6 +1493,10 @@ static bool vxlan_snoop(struct net_devic + struct vxlan_fdb *f; + u32 ifindex = 0; + ++ /* Don't learn broadcast packets */ ++ if (is_multicast_ether_addr(src_mac) || is_zero_ether_addr(src_mac)) ++ return false; ++ + #if IS_ENABLED(CONFIG_IPV6) + if (src_ip->sa.sa_family == AF_INET6 && + (ipv6_addr_type(&src_ip->sin6.sin6_addr) & IPV6_ADDR_LINKLOCAL)) From 78d493af229c2e20a81f01b1d87685da4a897822 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 26 Feb 2024 14:43:09 +0100 Subject: [PATCH 0758/1171] generic l2tp: drop flow hash on forward Drop the flow-hash of the skb when forwarding to the L2TP netdev. This avoids the L2TP qdisc from using the flow-hash from the outer packet, which is identical for every flow within the tunnel. This does not affect every platform but is specific for the ethernet driver. It depends on the platform including L4 information in the flow-hash. Signed-off-by: David Bauer (cherry picked from commit 35a5e62da7275a4a1423df6238340dd08eeff3c9) --- ...8-net-l2tp-drop-flow-hash-on-forward.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 target/linux/generic/pending-5.15/778-net-l2tp-drop-flow-hash-on-forward.patch diff --git a/target/linux/generic/pending-5.15/778-net-l2tp-drop-flow-hash-on-forward.patch b/target/linux/generic/pending-5.15/778-net-l2tp-drop-flow-hash-on-forward.patch new file mode 100644 index 00000000000000..a2c0edcbbf5808 --- /dev/null +++ b/target/linux/generic/pending-5.15/778-net-l2tp-drop-flow-hash-on-forward.patch @@ -0,0 +1,31 @@ +From 4a44a52f16ccd3d03e0cb5fb437a5eb31a5f9f05 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Mon, 26 Feb 2024 21:39:34 +0100 +Subject: [PATCH] net l2tp: drop flow hash on forward + +Drop the flow-hash of the skb when forwarding to the L2TP netdev. + +This avoids the L2TP qdisc from using the flow-hash from the outer +packet, which is identical for every flow within the tunnel. + +This does not affect every platform but is specific for the ethernet +driver. It depends on the platform including L4 information in the +flow-hash. + +Signed-off-by: David Bauer +--- + net/l2tp/l2tp_eth.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/net/l2tp/l2tp_eth.c ++++ b/net/l2tp/l2tp_eth.c +@@ -136,6 +136,9 @@ static void l2tp_eth_dev_recv(struct l2t + /* checksums verified by L2TP */ + skb->ip_summed = CHECKSUM_NONE; + ++ /* drop outer flow-hash */ ++ skb_clear_hash(skb); ++ + skb_dst_drop(skb); + nf_reset_ct(skb); + From 91ef14a487a51b5f6d20f8f2cc9d1b485535fddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20M?= Date: Tue, 31 Oct 2023 16:15:06 +0100 Subject: [PATCH 0759/1171] mediatek: mt7981: improve fan behaviour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doubles the number of cooling-levels. In addition the fan is turned on with a low speed at lower temperatures and with a higher speed at higher temperatures. This also attempts to reduce the likelihood of constant start-stop actions. The change only affects the GL.iNet MT3000 and has been tested with it. Signed-off-by: Łukasz M (cherry picked from commit 5a603c7a316c3fb4bae4c7cb5c666232864126f2) --- .../arch/arm64/boot/dts/mediatek/mt7981.dtsi | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi index 05d4b7d91da112..cb161df81e9d57 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7981.dtsi @@ -55,8 +55,8 @@ fan: pwm-fan { compatible = "pwm-fan"; - /* cooling level (0, 1, 2, 3) : (0% duty, 50% duty, 75% duty, 100% duty) */ - cooling-levels = <0 128 192 255>; + /* cooling level (0, 1, 2, 3, 4, 5, 6, 7) : (0%/25%/37.5%/50%/62.5%/75%/87.5%/100% duty) */ + cooling-levels = <0 63 95 127 159 191 223 255>; #cooling-cells = <2>; status = "disabled"; }; @@ -67,55 +67,67 @@ polling-delay = <1000>; thermal-sensors = <&thermal 0>; trips { - cpu_trip_crit: crit { - temperature = <125000>; + cpu_trip_active_highest: active-highest { + temperature = <70000>; hysteresis = <2000>; - type = "critical"; - }; - - cpu_trip_hot: hot { - temperature = <120000>; - hysteresis = <2000>; - type = "hot"; + type = "active"; }; cpu_trip_active_high: active-high { - temperature = <115000>; + temperature = <60000>; hysteresis = <2000>; type = "active"; }; cpu_trip_active_med: active-med { - temperature = <85000>; + temperature = <50000>; hysteresis = <2000>; type = "active"; }; cpu_trip_active_low: active-low { - temperature = <60000>; + temperature = <45000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_trip_active_lowest: active-lowest { + temperature = <40000>; hysteresis = <2000>; type = "active"; }; }; cooling-maps { + cpu-active-highest { + /* active: set fan to cooling level 7 */ + cooling-device = <&fan 7 7>; + trip = <&cpu_trip_active_highest>; + }; + cpu-active-high { - /* active: set fan to cooling level 3 */ - cooling-device = <&fan 3 3>; + /* active: set fan to cooling level 5 */ + cooling-device = <&fan 5 5>; trip = <&cpu_trip_active_high>; }; cpu-active-med { - /* active: set fan to cooling level 2 */ - cooling-device = <&fan 2 2>; + /* active: set fan to cooling level 3 */ + cooling-device = <&fan 3 3>; trip = <&cpu_trip_active_med>; }; cpu-active-low { - /* passive: set fan to cooling level 1 */ - cooling-device = <&fan 1 1>; + /* active: set fan to cooling level 2 */ + cooling-device = <&fan 2 2>; trip = <&cpu_trip_active_low>; }; + + cpu-active-lowest { + /* active: set fan to cooling level 1 */ + cooling-device = <&fan 1 1>; + trip = <&cpu_trip_active_lowest>; + }; }; }; }; From 04ec453970eab87b90725df959d7f3caa21de590 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 14:49:41 +0900 Subject: [PATCH 0760/1171] mediatek: update LED/Key bindings for Buffalo WSR-2533DHP2 Update LED and key nodes with newer DeviceTree bindings for WSR-2533DHP2. - LED - use led-[0-9] for node name of LEDs - add "color" and "function" properties - drop default-state = "on" from green:power LED - this LED will be turned on by led-running alias - key - drop unnecessary poll-interval property - use key-[0-9] for node name of keys Signed-off-by: INAGAKI Hiroshi (cherry picked from commit 6b8e7144c8863686a8ddef6f4fcebb3b8cf85f36) --- .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index 6d77be532b1488..fec559c8af5e58 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -2,6 +2,7 @@ /dts-v1/; #include #include +#include #include "mt7622.dtsi" #include "mt6380.dtsi" @@ -29,43 +30,53 @@ leds { compatible = "gpio-leds"; - wireless_amber { + led-0 { label = "amber:wireless"; gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; }; - power_amber: power_amber { + power_amber: led-1 { label = "amber:power"; gpios = <&pio 3 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; }; - power_green: power_green { + power_green: led-2 { label = "green:power"; gpios = <&pio 4 GPIO_ACTIVE_LOW>; - default-state = "on"; + color = ; + function = LED_FUNCTION_POWER; }; - wireless_green { + led-3 { label = "green:wireless"; gpios = <&pio 15 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; }; - internet { + led-4 { label = "green:internet"; gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WAN; }; - router { + led-5 { label = "green:router"; gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_INDICATOR; }; }; keys { compatible = "gpio-keys"; - poll-interval = <100>; - reset { + key-reset { label = "reset"; gpios = <&pio 0 GPIO_ACTIVE_LOW>; linux,code = ; @@ -74,14 +85,14 @@ /* GPIO 1 and 16 are a tri-state switch button with * ROUTER / AP / WB. */ - router { + key-router { label = "router"; gpios = <&pio 1 GPIO_ACTIVE_LOW>; linux,code = ; linux,input-type = ; }; - bridge { + key-bridge { label = "wb"; gpios = <&pio 16 GPIO_ACTIVE_LOW>; linux,code = ; @@ -89,14 +100,14 @@ }; /* GPIO 18 is a switch button with AUTO / MANUAL. */ - manual { + key-manual { label = "manual"; gpios = <&pio 18 GPIO_ACTIVE_LOW>; linux,code = ; linux,input-type = ; }; - wps { + key-wps { label = "wps"; gpios = <&pio 102 GPIO_ACTIVE_LOW>; linux,code = ; From 7e47913ef66fc01337f8b909c4b5811deee2cf85 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 15:10:53 +0900 Subject: [PATCH 0761/1171] mediatek: update NVMEM bindings for Buffalo WSR-2533DHP2 Update NVMEM-related nodes and use newer binding for MAC addresses on Buffalo WSR-2533DHP2. Signed-off-by: INAGAKI Hiroshi (cherry picked from commit de62e0165264fb2872e87116ddceb8c7e12c5a5a) --- .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index fec559c8af5e58..9a44152a911db3 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -229,9 +229,8 @@ phy-connection-type = "2500base-x"; - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 (-1)>; nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; fixed-link { speed = <2500>; @@ -284,9 +283,22 @@ }; factory: partition@1c0000 { + compatible = "nvmem-cells"; label = "factory"; reg = <0x1c0000 0x40000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; }; partition@200000 { @@ -349,13 +361,3 @@ &rtc { status = "disabled"; }; - -&factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; - }; -}; From 9c793c44c98d37f210072d4c60cb3255160e8c95 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 18:04:04 +0900 Subject: [PATCH 0762/1171] mediatek: add label-mac-device for Buffalo WSR-2533DHP2 Add label-mac-device with "&gmac0" phandle for Buffalo WSR-2533DHP2. Signed-off-by: INAGAKI Hiroshi (cherry picked from commit 94606abf63c22dfda9b9a63c603339505ed5f5b4) --- target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index 9a44152a911db3..f8990b25cf48eb 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -17,6 +17,7 @@ led-failsafe = &power_amber; led-running = &power_green; led-upgrade = &power_green; + label-mac-device = &gmac0; }; chosen { From a26ea172946c407d8cefdccd34b738b9e12691c5 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 23:26:01 +0900 Subject: [PATCH 0763/1171] mediatek: drop pwm7_pins from Buffalo WSR-2533DHP2 MediaTek MT7622 doesn't support ch7 of PWM and pinctrl groups were dropped from driver source[0]. So pwm7-related groups are unavailable now, then, kernel shows a warning. [ 0.370264] mt7622-pinctrl 10211000.pinctrl: invalid group "pwm_ch7_2" for function "pwm" Drop that pinmux from pinctrl node. [0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/pinctrl/mediatek/pinctrl-mt7622.c?id=57972641810a97566ffd13e4be3f6a66d61eb3b5 Signed-off-by: INAGAKI Hiroshi (cherry picked from commit 4d9113017b2d401e821fb008518cdd660dafb8a3) --- .../linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index f8990b25cf48eb..8b0dc1aa98dfbb 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -193,13 +193,6 @@ }; }; - pwm7_pins: pwm1-2-pins { - mux { - function = "pwm"; - groups = "pwm_ch7_2"; - }; - }; - uart0_pins: uart0-pins { mux { function = "uart"; @@ -330,8 +323,6 @@ }; &pwm { - pinctrl-names = "default"; - pinctrl-0 = <&pwm7_pins>; status = "okay"; }; From 882d20e25b574024442284c433d26f33cbac76f9 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 17:29:12 +0900 Subject: [PATCH 0764/1171] mediatek: merge trx helpers in image/mt7622.mk Merge similar helpers of trx image generation, "buffalo-kernel-trx" and "trx-nand". Signed-off-by: INAGAKI Hiroshi (cherry picked from commit d0929006f2290307f6b9ba37d221f44a145d8d1b) --- target/linux/mediatek/image/mt7622.mk | 42 ++++++++++++--------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 8f29843f3cf238..2a5e60989ff659 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -6,19 +6,24 @@ define Image/Prepare echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark endef -define Build/buffalo-kernel-trx +define Build/buffalo-trx $(eval magic=$(word 1,$(1))) - $(eval dummy=$(word 2,$(1))) + $(eval kern_bin=$(if $(1),$(IMAGE_KERNEL),$@)) + $(eval rtfs_bin=$(word 2,$(1))) + $(eval apnd_bin=$(word 3,$(1))) $(eval kern_size=$(if $(KERNEL_SIZE),$(KERNEL_SIZE),0x400000)) - $(if $(dummy),touch $(dummy)) + $(if $(rtfs_bin),touch $(rtfs_bin)) $(STAGING_DIR_HOST)/bin/otrx create $@.new \ $(if $(magic),-M $(magic),) \ - -f $@ \ - $(if $(dummy),\ + -f $(kern_bin) \ + $(if $(rtfs_bin),\ -a 0x20000 \ -b $$(( $(subst k, * 1024,$(kern_size)) )) \ - -f $(dummy),) + -f $(rtfs_bin),) \ + $(if $(apnd_bin),\ + -A $(apnd_bin) \ + -a 0x20000) mv $@.new $@ endef @@ -51,19 +56,6 @@ define Build/mt7622-gpt rm $@.tmp endef -define Build/trx-nand - # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even - # if it grows up between releases - # root: UBI with one extra block containing UBI mark to trigger erasing - # rest of partition - $(STAGING_DIR_HOST)/bin/otrx create $@.new \ - -M 0x32504844 \ - -f $(IMAGE_KERNEL) -a 0x20000 -b 0x400000 \ - -f $@ \ - -A $(KDIR)/ubi_mark -a 0x20000 - mv $@.new $@ -endef - define Device/bananapi_bpi-r64 DEVICE_VENDOR := Bananapi DEVICE_MODEL := BPi-R64 @@ -122,13 +114,15 @@ define Device/buffalo_wsr-2533dhp2 IMAGES += factory.bin factory-uboot.bin KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \ - buffalo-kernel-trx - IMAGE/factory.bin := append-ubi | trx-nand | \ + buffalo-trx + IMAGE/factory.bin := append-ubi | \ + buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark | \ buffalo-enc WSR-2533DHP2 $$(BUFFALO_TAG_VERSION) -l | \ buffalo-tag-dhp WSR-2533DHP2 JP JP | buffalo-enc-tag -l | buffalo-dhp-image - IMAGE/factory-uboot.bin := append-ubi | trx-nand - IMAGE/sysupgrade.bin := append-kernel | \ - buffalo-kernel-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ + IMAGE/factory-uboot.bin := append-ubi | \ + buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark + IMAGE/sysupgrade.bin := \ + buffalo-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata DEVICE_PACKAGES := kmod-mt7615-firmware swconfig endef From 65f9f3131e63908672456aa7f628466eb2367017 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 18:21:28 +0900 Subject: [PATCH 0765/1171] mediatek: separate dts/dtsi for Buffalo WSR series Separate dts/dtsi from the dts of Buffalo WSR-2533DHP2 to prepare adding suppport for WSR-3200AX4S. Signed-off-by: INAGAKI Hiroshi (cherry picked from commit 9f640cae75ec987f29bf697cee559a0a4ff497e0) --- .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 230 +---------------- .../mediatek/dts/mt7622-buffalo-wsr.dtsi | 236 ++++++++++++++++++ 2 files changed, 240 insertions(+), 226 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts index 8b0dc1aa98dfbb..a9f29591912c54 100644 --- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts @@ -1,120 +1,20 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include -#include -#include "mt7622.dtsi" -#include "mt6380.dtsi" +#include "mt7622-buffalo-wsr.dtsi" / { model = "Buffalo WSR-2533DHP2"; compatible = "buffalo,wsr-2533dhp2", "mediatek,mt7622"; aliases { - serial0 = &uart0; - led-boot = &power_green; - led-failsafe = &power_amber; - led-running = &power_green; - led-upgrade = &power_green; label-mac-device = &gmac0; }; - chosen { - bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 swiotlb=512"; - }; - memory { reg = <0 0x40000000 0 0x0F000000>; }; - leds { - compatible = "gpio-leds"; - - led-0 { - label = "amber:wireless"; - gpios = <&pio 2 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_WLAN; - }; - - power_amber: led-1 { - label = "amber:power"; - gpios = <&pio 3 GPIO_ACTIVE_LOW>; - color = ; - function = LED_FUNCTION_POWER; - }; - - power_green: led-2 { - label = "green:power"; - gpios = <&pio 4 GPIO_ACTIVE_LOW>; - color = ; - function = LED_FUNCTION_POWER; - }; - - led-3 { - label = "green:wireless"; - gpios = <&pio 15 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_WLAN; - }; - - led-4 { - label = "green:internet"; - gpios = <&pio 19 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_WAN; - }; - - led-5 { - label = "green:router"; - gpios = <&pio 20 GPIO_ACTIVE_HIGH>; - color = ; - function = LED_FUNCTION_INDICATOR; - }; - }; - - keys { - compatible = "gpio-keys"; - - key-reset { - label = "reset"; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - /* GPIO 1 and 16 are a tri-state switch button with - * ROUTER / AP / WB. - */ - key-router { - label = "router"; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - - key-bridge { - label = "wb"; - gpios = <&pio 16 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - - /* GPIO 18 is a switch button with AUTO / MANUAL. */ - key-manual { - label = "manual"; - gpios = <&pio 18 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - - key-wps { - label = "wps"; - gpios = <&pio 102 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - rtkgsw: rtkgsw@0 { compatible = "mediatek,rtk-gsw"; mediatek,ethsys = <ðsys>; @@ -123,41 +23,7 @@ }; }; -&cpu0 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; -}; - -&cpu1 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; -}; - -&pcie0 { - pinctrl-names = "default"; - pinctrl-0 = <&pcie0_pins>; - status = "okay"; -}; - -&slot0 { - status = "okay"; - - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x5000>; - ieee80211-freq-limit = <5000000 6000000>; - }; -}; - &pio { - eth_pins: eth-pins { - mux { - function = "eth"; - groups = "mdc_mdio", "rgmii_via_gmac2"; - }; - }; - /* Parallel nand is shared pin with eMMC */ parallel_nand_pins: parallel-nand-pins { mux { @@ -176,67 +42,11 @@ bias-pull-up; }; }; - - pcie0_pins: pcie0-pins { - mux { - function = "pcie"; - groups = "pcie0_pad_perst", - "pcie0_1_waken", - "pcie0_1_clkreq"; - }; - }; - - pmic_bus_pins: pmic-bus-pins { - mux { - function = "pmic"; - groups = "pmic_bus"; - }; - }; - - uart0_pins: uart0-pins { - mux { - function = "uart"; - groups = "uart0_0_tx_rx" ; - }; - }; - - watchdog_pins: watchdog-pins { - mux { - function = "watchdog"; - groups = "watchdog"; - }; - }; -}; - -&bch { - status = "okay"; }; -ð { - pinctrl-names = "default"; - pinctrl-0 = <ð_pins>; - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - - phy-connection-type = "2500base-x"; - - nvmem-cells = <&macaddr_factory_4 (-1)>; - nvmem-cell-names = "mac-address"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - }; +&gmac0 { + nvmem-cells = <&macaddr_factory_4 (-1)>; + nvmem-cell-names = "mac-address"; }; &nandc { @@ -321,35 +131,3 @@ }; }; }; - -&pwm { - status = "okay"; -}; - -&pwrap { - pinctrl-names = "default"; - pinctrl-0 = <&pmic_bus_pins>; - status = "okay"; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins>; - status = "okay"; -}; - -&watchdog { - pinctrl-names = "default"; - pinctrl-0 = <&watchdog_pins>; - status = "okay"; -}; - -&wmac { - status = "okay"; - - mediatek,mtd-eeprom = <&factory 0x0>; -}; - -&rtc { - status = "disabled"; -}; diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi b/target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi new file mode 100644 index 00000000000000..e77f83d354bb0c --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr.dtsi @@ -0,0 +1,236 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include +#include + +#include "mt7622.dtsi" +#include "mt6380.dtsi" + +/ { + aliases { + serial0 = &uart0; + led-boot = &power_green; + led-failsafe = &power_amber; + led-running = &power_green; + led-upgrade = &power_green; + }; + + chosen { + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 swiotlb=512"; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "amber:wireless"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; + }; + + power_amber: led-1 { + label = "amber:power"; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + }; + + power_green: led-2 { + label = "green:power"; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + }; + + led-3 { + label = "green:wireless"; + gpios = <&pio 15 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; + }; + + led-4 { + label = "green:internet"; + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led-5 { + label = "green:router"; + gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_INDICATOR; + }; + }; + + keys { + compatible = "gpio-keys"; + + key-reset { + label = "reset"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + /* GPIO 1 and 16 are a tri-state switch button with + * ROUTER / AP / WB. + */ + key-router { + label = "router"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + key-bridge { + label = "wb"; + gpios = <&pio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + /* GPIO 18 is a switch button with AUTO / MANUAL. */ + key-manual { + label = "manual"; + gpios = <&pio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + key-wps { + label = "wps"; + gpios = <&pio 102 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&cpu0 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; +}; + +&cpu1 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; +}; + +&pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; +}; + +&slot0 { + status = "okay"; + + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x5000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&pio { + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio", "rgmii_via_gmac2"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie0_pad_perst", + "pcie0_1_waken", + "pcie0_1_clkreq"; + }; + }; + + pmic_bus_pins: pmic-bus-pins { + mux { + function = "pmic"; + groups = "pmic_bus"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_0_tx_rx" ; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + + phy-connection-type = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&bch { + status = "okay"; +}; + +&pwm { + status = "okay"; +}; + +&pwrap { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_bus_pins>; + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&rtc { + status = "disabled"; +}; From 5b4df9a27e842e4f02c3591300ce92f7b494cec3 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 27 Aug 2023 23:23:20 +0900 Subject: [PATCH 0766/1171] mediatek: add support for Buffalo WSR-3200AX4S MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Buffalo WSR-3200AX4S is a 2.4/5 GHz band 11ax (Wi-Fi 6) router, based on MT7622B. Specification: - SoC : MediaTek MT7622B - RAM : DDR3 512 MiB - Flash : SPI-NAND 128 MiB (Winbond W25N01GVZEIG) - WLAN : 2.4/5 GHz 4T4R - 2.4 GHz : MediaTek MT7622B (SoC) - 5 GHz : MediaTek MT7915 - Ethernet : 5x 10/100/1000 Mbps - Switch : MediaTek MT7531 - LEDs/Keys : 6x/5x (2x: buttons, 3x: slide-switches) - UART : through-hole on PCB (J4) - assignment: 3.3V, GND, TX, RX from tri-angle marking - settings : 115200n8 - Power : 12 VDC, 1.5 A Flash instruction using factory.bin image: 1. Boot WSR-3200AX4S with "Router" mode 2. Access to "http://192.168.11.1/" and open firmware update page ("ファームウェア更新") 3. Select the OpenWrt factory.bin image and click update ("更新実行") button 4. Wait ~120 seconds to complete flashing Note: - This device has 2x OS images on flash. The first one will always be used for booting and the secondary is for backup. - This support generates multiple factory*.bin image: - factory.bin : for flashing from OEM WebUI - factory-uboot.bin: for flashing from U-Boot or clean installation via sysupgrade (don't use for normal sysupgrade) Known issues: - Wi-Fi MAC addresses won't be applied to each adapter. MAC Addresses: LAN : C4:3C:EA:xx:xx:60 (board_data, mac (text)) WAN : C4:3C:EA:xx:xx:60 (board_data, mac (text)) 2.4 GHz: C4:3C:EA:xx:xx:61 5 GHz : C4:3C:EA:xx:xx:68 Signed-off-by: INAGAKI Hiroshi (cherry picked from commit 7383eb266b64f374c7109ad1db5360bf91dc11c3) --- .../dts/mt7622-buffalo-wsr-3200ax4s.dts | 175 ++++++++++++++++++ target/linux/mediatek/image/mt7622.mk | 31 ++++ .../mt7622/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/etc/uci-defaults/09_fix_crc | 4 + .../mt7622/base-files/lib/upgrade/platform.sh | 6 +- 6 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts new file mode 100644 index 00000000000000..678c31b711b741 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-3200ax4s.dts @@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7622-buffalo-wsr.dtsi" + +/ { + model = "Buffalo WSR-3200AX4S"; + compatible = "buffalo,wsr-3200ax4s", "mediatek,mt7622"; + + memory { + reg = <0 0x40000000 0 0x1f000000>; + }; +}; + +&pio { + /* Serial NAND is shared pin with SPI-NOR */ + serial_nand_pins: serial-nand-pins { + mux { + function = "flash"; + groups = "snfi"; + }; + + conf-cmd-dat { + pins = "SPI_WP", "SPI_HOLD", "SPI_MOSI", + "SPI_MISO", "SPI_CS"; + input-enable; + drive-strength = <16>; + bias-pull-up; + }; + + conf-clk { + pins = "SPI_CLK"; + drive-strength = <16>; + bias-pull-down; + }; + }; +}; + +&mdio { + switch@1f { + compatible = "mediatek,mt7531"; + reg = <0x1f>; + reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan4"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-connection-type = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; +}; + +&snfi { + pinctrl-names = "default"; + pinctrl-0 = <&serial_nand_pins>; + status = "okay"; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <104000000>; + nand-ecc-engine = <&snfi>; + mediatek,bmt-v2; + mediatek,bmt-table-size = <0x1000>; + /* + * - Preloader - (kernel (6MiB, in firmware)) + * - Kernel2 - WTB + */ + mediatek,bmt-remap-range = <0x0 0x8c0000>, + <0x1ac0000 0x5200000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "ATF"; + reg = <0x80000 0x40000>; + read-only; + }; + + partition@c0000 { + label = "u-boot"; + reg = <0xc0000 0x80000>; + read-only; + }; + + partition@140000 { + label = "u-boot-env"; + reg = <0x140000 0x80000>; + read-only; + }; + + factory: partition@1c0000 { + label = "factory"; + reg = <0x1c0000 0x100000>; + read-only; + }; + + partition@2c0000 { + compatible = "brcm,trx"; + brcm,trx-magic = <0x33504844>; + label = "firmware"; + reg = <0x2c0000 0x1800000>; + }; + + partition@1ac0000 { + label = "Kernel2"; + reg = <0x1ac0000 0x1800000>; + }; + + partition@32c0000 { + label = "glbcfg"; + reg = <0x32c0000 0x200000>; + read-only; + }; + + partition@34c0000 { + label = "board_data"; + reg = <0x34c0000 0x200000>; + read-only; + }; + + partition@36c0000 { + label = "WTB"; + reg = <0x36c0000 0x3600000>; + read-only; + }; + }; + }; +}; diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 2a5e60989ff659..50166669e2ece7 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -128,6 +128,37 @@ define Device/buffalo_wsr-2533dhp2 endef TARGET_DEVICES += buffalo_wsr-2533dhp2 +define Device/buffalo_wsr-3200ax4s + DEVICE_VENDOR := Buffalo + DEVICE_MODEL := WSR-3200AX4S + DEVICE_DTS := mt7622-buffalo-wsr-3200ax4s + IMAGE_SIZE := 24576k + BUFFALO_TRX_MAGIC := 0x33504844 + DEVICE_PACKAGES := kmod-mt7915-firmware + DEVICE_DTS_DIR := ../dts + KERNEL_SIZE := 6144k + BLOCKSIZE := 128k + PAGESIZE := 2048 + UBINIZE_OPTS := -E 5 + BUFFALO_TAG_PLATFORM := MTK + BUFFALO_TAG_VERSION := 9.99 + BUFFALO_TAG_MINOR := 9.99 + IMAGES += factory.bin factory-uboot.bin + KERNEL_INITRAMFS = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \ + buffalo-trx + IMAGE/factory.bin = append-ubi | \ + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $$$$@ $(KDIR)/ubi_mark | \ + buffalo-enc $$(DEVICE_MODEL) $$(BUFFALO_TAG_VERSION) -l | \ + buffalo-tag-dhp $$(DEVICE_MODEL) JP JP | buffalo-enc-tag -l | buffalo-dhp-image + IMAGE/factory-uboot.bin := append-ubi | \ + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $$$$@ $(KDIR)/ubi_mark + IMAGE/sysupgrade.bin := \ + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $(KDIR)/tmp/$$(DEVICE_NAME).null | \ + sysupgrade-tar kernel=$$$$@ | append-metadata +endef +TARGET_DEVICES += buffalo_wsr-3200ax4s + define Device/elecom_wrc-2533gent DEVICE_VENDOR := Elecom DEVICE_MODEL := WRC-2533GENT diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network index 38db921f5c58e9..d1341099bc8d41 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -9,6 +9,7 @@ mediatek_setup_interfaces() case $board in bananapi,bpi-r64|\ + buffalo,wsr-3200ax4s|\ elecom,wrc-x3200gst3|\ linksys,e8450|\ linksys,e8450-ubi|\ @@ -55,6 +56,11 @@ mediatek_setup_macs() local label_mac="" case $board in + buffalo,wsr-3200ax4s) + lan_mac=$(mtd_get_mac_ascii board_data "mac") + wan_mac=$lan_mac + label_mac=$lan_mac + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) lan_mac=$(macaddr_add $(get_mac_label) 1) diff --git a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index f8639e9f409147..7ee9f24071c598 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -13,6 +13,11 @@ case "$board" in bananapi,bpi-r64) [ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress ;; + buffalo,wsr-3200ax4s) + basemac=$(mtd_get_mac_ascii board_data "mac") + [ "$PHYNBR" = "0" ] && macaddr_add $basemac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $basemac 8 > /sys${DEVPATH}/macaddress + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc index 81cb6b18b7a80b..59b00a6e69b00b 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc @@ -7,4 +7,8 @@ buffalo,wsr-2533dhp2) mtd -M 0x44485032 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 exit 1 ;; +buffalo,wsr-3200ax4s) + mtd -M 0x44485033 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 + exit 1 + ;; esac diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index b37b7b1c6e5772..ea3176d2d1e79f 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -21,7 +21,8 @@ platform_do_upgrade() { ;; esac ;; - buffalo,wsr-2533dhp2) + buffalo,wsr-2533dhp2|\ + buffalo,wsr-3200ax4s) local magic="$(get_magic_long "$1")" # use "mtd write" if the magic is "DHP2 (0x44485032)" @@ -67,7 +68,8 @@ platform_check_image() { [ "$#" -gt 1 ] && return 1 case "$board" in - buffalo,wsr-2533dhp2) + buffalo,wsr-2533dhp2|\ + buffalo,wsr-3200ax4s) buffalo_check_image "$board" "$magic" "$1" || return 1 ;; elecom,wrc-x3200gst3|\ From f555fa6fd07bd9715d70a447eb92c75ade59e24b Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Thu, 20 Jul 2023 16:00:50 +0200 Subject: [PATCH 0767/1171] mediatek: Add support for D-Link EAGLE PRO AI M32 Specification: - MT7622BV SoC with 2.4GHz wifi - MT7975AN + MT7915AN for 5GHz - MT7531BE Switch - 512MB RAM - 128 MB flash - 3 LEDs (red, orange, white) - 2 buttons (WPS and Reset) MAC addresses: - WAN MAC is stored in partition "Odm" at offset 0x83 - LAN (as printed on the device) is WAN MAC + 1 - WLAN MAC (2.4 GHz) is WAN MAC + 2 - WLAN MAC (5GHz) is WAN MAC + 3 Disassembly: Remove 4 screws in the bottom and 2 screws in the top (after removing the blue cover on the top), then the board can be pulled out. The pins for the serial console are already labeled on the board (VCC, TX, RX, GND). Serial settings: 3.3V, 115200,8n1 Flashing via Recovery Web Interface: - Set your IP address to 192.168.0.10, subnetmask 255.255.255.25 - Press the reset button while powering on the deivce - Keep the reset button pressed until the status LED blinks fast - Open a Chromium based and goto http://192.168.0.1 - Download openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-a1-squashfs-recovery.bin Flashing via uBoot: - Open the case, connect to the UART console - Set your IP address to 10.10.10.3, subnet mask 255.255.255.0. Connect to one of the LAN interfaces of the router - Run a tftp server which provides openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-initramfs-kernel.bin. You can rename the file to iverson_uImage (no extension), then you don't have to enter the whole file name in uboot later. - Power on the device and select "1. System Load Linux to SDRAM via TFTP." in the boot menu - Enter image file, tftp server IP and device IP (if they differ from the default). - TFTP download to RAM will start. After a few seconds OpenWrt initramfs should start - The initramfs is accessible via 192.168.1.1, change your IP address accordingly (or use multiple IP addresses on your interface) - Create a backup of the Kernel1 partition, this file is required if a revert to stock should be done later - Perform a sysupgrade using openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-squashfs-sysupgrade.bin - Reboot the device. OpenWrt should start from flash now Revert back to stock using the Recovery Web Interface: - Set your IP address to 192.168.0.10, subnetmask 255.255.255.25 - Press the reset button while powering on the deivce - Keep the reset button pressed until the status LED blinks fast - Open a Chromium based and goto http://192.168.0.1 - Flash a decrypted firmware image from D-Link. Decrypting an firmware image is described below. Decrypting a D-Link firmware image: - Download https://github.com/RolandoMagico/firmware-utils/blob/M32/src/m32-firmware-util.c - Compile a binary from the downloaded file, e.g. gcc m32-firmware-util.c -lcrypto -o m32-firmware-util - Run ./m32-firmware-util M32 --DecryptFactoryImage - Example for firmware 1.03.01_HOTFIX: ./m32-firmware-util M32 --DecryptFactoryImage M32-REVA_1.03.01_HOTFIX.enc.bin M32-REVA_1.03.01_HOTFIX.decrypted.bin Revert back to stock using uBoot: - Open the case, connect to the UART console - Set your IP address to 10.10.10.3, subnet mask 255.255.255.0. Connect to one of the LAN interfaces of the router - Run a tftp server which provides the previously created backup of the Kernel1 partition. You can rename the file to iverson_uImage (no extension), then you don't have to enter the whole file name in uboot later. - Power on the device and select "2. System Load Linux Kernel then write to Flash via TFTP." in the boot menu - Enter image file, tftp server IP and device IP (if they differ from the default). - TFTP download to FLASH will start. After a few seconds the stock firmware should start again There is also an image openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-a1-squashfs-tftp.bin which can directly be flashed via U-Boot and TFTP. It can be used if no backup of the Kernel1 partition is reuqired. Flahsing via OEM web interface is currently not possible, the OEM images are encrypted and require a specific memory layout which is not compatible to the partition layout of OpenWrt. Signed-off-by: Roland Reinl (cherry picked from commit e3a6945b58daf0cda1db1b356bed304404cb77f5) --- .../dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts | 399 ++++++++++++++++++ target/linux/mediatek/image/mt7622.mk | 38 ++ .../mt7622/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 4 + .../mt7622/base-files/lib/upgrade/platform.sh | 2 + 5 files changed, 450 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts diff --git a/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts b/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts new file mode 100644 index 00000000000000..ca680e4c29f66c --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts @@ -0,0 +1,399 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7622.dtsi" +#include "mt6380.dtsi" +#include +#include + +/ { + model = "D-Link EAGLE PRO AI M32 A1"; + compatible = "dlink,eagle-pro-ai-m32-a1", "mediatek,mt7622"; + + aliases { + led-boot = &status_orange; + led-failsafe = &status_red; + led-running = &status_white; + led-upgrade = &status_red; + serial0 = &uart0; + label-mac-device = &gmac0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 swiotlb=512"; + }; + + cpus { + cpu@0 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + + cpu@1 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + }; + + wps { + gpios = <&pio 102 GPIO_ACTIVE_LOW>; + label = "wps"; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + status_white: status_white { + label = "white:status"; + gpios = <&pio 85 GPIO_ACTIVE_LOW>; + }; + + status_orange: status_orange { + label = "orange:status"; + gpios = <&pio 20 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + status_red: status_red { + label = "red:status"; + gpios = <&pio 17 GPIO_ACTIVE_LOW>; + }; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +&bch { + status = "okay"; +}; + +&btif { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + nvmem-cells = <&macaddr_odm_83>; + nvmem-cell-names = "mac-address"; + phy-mode = "2500base-x"; + reg = <0>; + + fixed-link { + full-duplex; + pause; + speed = <2500>; + }; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + wan: port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; +}; + +&pcie1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie1_pins>; + status = "okay"; +}; + +&pio { + epa_elna_pins: epa-elna-pins { + mux { + function = "antsel"; + groups = "antsel0", "antsel1", "antsel2", "antsel3", + "antsel4", "antsel5", "antsel6", "antsel7", + "antsel8", "antsel9", "antsel12", "antsel13", + "antsel14", "antsel15", "antsel16", "antsel17"; + }; + }; + + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio", "rgmii_via_gmac2"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie0_pad_perst", + "pcie0_1_waken", + "pcie0_1_clkreq"; + }; + }; + + pcie1_pins: pcie1-pins { + mux { + function = "pcie"; + groups = "pcie1_pad_perst", + "pcie1_0_waken", + "pcie1_0_clkreq"; + }; + }; + + pmic_bus_pins: pmic-bus-pins { + mux { + function = "pmic"; + groups = "pmic_bus"; + }; + }; + + /* Serial NAND is shared pin with SPI-NOR */ + serial_nand_pins: serial-nand-pins { + mux { + function = "flash"; + groups = "snfi"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_0_tx_rx"; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&pwrap { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_bus_pins>; + status = "okay"; +}; + +&rtc { + status = "disabled"; +}; + +&sata { + status = "disabled"; +}; + +&sata_phy { + status = "disabled"; +}; + +&slot0 { + wmac1: mt7915@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,mtd-eeprom = <&factory 0x05000>; + }; +}; + +&snfi { + pinctrl-names = "default"; + pinctrl-0 = <&serial_nand_pins>; + status = "okay"; + + snand: flash@0 { + compatible = "spi-nand"; + mediatek,bmt-table-size = <0x1000>; + mediatek,bmt-v2; + nand-ecc-engine = <&snfi>; + reg = <0>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x00000000 0x00080000>; + read-only; + }; + + partition@80000 { + label = "ATF"; + reg = <0x00080000 0x00040000>; + read-only; + }; + + partition@C0000 { + label = "Bootloader"; + reg = <0x000C0000 0x00080000>; + read-only; + }; + + partition@140000 { + label = "BootConfig"; + reg = <0x00140000 0x00040000>; + read-only; + }; + + odm: partition@180000 { + compatible = "nvmem-cells"; + label = "Odm"; + reg = <0x00180000 0x00040000>; + read-only; + + macaddr_odm_83: macaddr@83 { + reg = <0x83 0x6>; + }; + }; + + config1: partition@1C0000 { + compatible = "nvmem-cells"; + label = "Config1"; + reg = <0x001C0000 0x00080000>; + #address-cells = <1>; + #size-cells = <1>; + read-only; + }; + + partition@240000 { + label = "Config2"; + reg = <0x00240000 0x00080000>; + read-only; + }; + + partition@2C0000 { + label = "Kernel1"; + reg = <0x002C0000 0x02D00000>; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + label = "kernel"; + reg = <0x00000000 0x00800000>; + }; + + partition@800000 { + label = "ubi"; + reg = <0x00800000 0x02500000>; + }; + }; + + partition@2FC0000 { + label = "Kernel2"; + reg = <0x02FC0000 0x02D00000>; + read-only; + }; + + factory: partition@5CC0000 { + label = "Factory"; + reg = <0x05CC0000 0x00100000>; + read-only; + }; + + partition@5DC0000 { + label = "Mydlink"; + reg = <0x05DC0000 0x00200000>; + read-only; + }; + + partition@5FC0000 { + label = "Storage"; + reg = <0x05FC0000 0x00300000>; + read-only; + }; + }; + }; +}; + +&ssusb { + status = "disabled"; +}; + +&u3phy { + status = "disabled"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; + +&wmac { + pinctrl-names = "default"; + pinctrl-0 = <&epa_elna_pins>; + mediatek,mtd-eeprom = <&factory 0x0000>; + status = "okay"; +}; + diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 50166669e2ece7..294e23c8552298 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -35,6 +35,25 @@ define Build/bl31-uboot cat $(STAGING_DIR_IMAGE)/mt7622_$1-u-boot.fip >> $@ endef +# Append header to a D-Link M32 Kernel 1 partition +define Build/m32-recovery-header-kernel1 + echo -en "DLK6E6010001\x00\x00\xCF\x33" > "$@.header" + echo -en "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8D\x57\x30\x0B" >> "$@.header" +# Byte 0-3: Erase Start 0x002C0000 +# Byte 4-7: Erase Length 0x02D00000 +# Byte 8-11: Data offset: 0x002C0000 +# Byte 12-15: Data Length: 0x02D00000 + echo -en "\x00\x00\x2C\x00\x00\x00\xD0\x02\x00\x00\x2C\x00\x00\x00\xD0\x02" >> "$@.header" +# Only zeros + echo -en "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" >> "$@.header" +# Note: The last 2 bytes of the following line are the checksum of the header +# If any data in the header will be changed, the checksum must be re-calculated + echo -en "\x42\x48\x02\x00\x00\x00\x08\x00\x00\x00\x00\x00\x60\x6E\x68\x61" >> "$@.header" + cat "$@.header" "$@" > "$@.new" + mv "$@.new" "$@" + rm "$@.header" +endef + define Build/mt7622-gpt cp $@ $@.tmp 2>/dev/null || true ptgen -g -o $@.tmp -a 1 -l 1024 \ @@ -159,6 +178,25 @@ define Device/buffalo_wsr-3200ax4s endef TARGET_DEVICES += buffalo_wsr-3200ax4s +define Device/dlink_eagle-pro-ai-m32-a1 + IMAGE_SIZE := 46080k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := EAGLE PRO AI M32 + DEVICE_VARIANT := A1 + DEVICE_DTS := mt7622-dlink-eagle-pro-ai-m32-a1 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915-firmware + KERNEL_SIZE := 8192k + BLOCKSIZE := 128k + PAGESIZE := 2048 + UBINIZE_OPTS := -E 5 + IMAGES += tftp.bin recovery.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/tftp.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size + IMAGE/recovery.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | pad-to $$(IMAGE_SIZE) | m32-recovery-header-kernel1 +endef +TARGET_DEVICES += dlink_eagle-pro-ai-m32-a1 + define Device/elecom_wrc-2533gent DEVICE_VENDOR := Elecom DEVICE_MODEL := WRC-2533GENT diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network index d1341099bc8d41..75c5e37be14c54 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -24,6 +24,9 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ;; + dlink,eagle-pro-ai-m32-a1) + ucidef_set_interfaces_lan_wan "lan1 lan2" wan + ;; ubnt,unifi-6-lr*) ucidef_set_interface_lan "eth0" ;; @@ -61,6 +64,10 @@ mediatek_setup_macs() wan_mac=$lan_mac label_mac=$lan_mac ;; + dlink,eagle-pro-ai-m32-a1) + wan_mac=$(get_mac_label) + lan_mac=$(macaddr_add $(get_mac_label) 1) + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) lan_mac=$(macaddr_add $(get_mac_label) 1) diff --git a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 7ee9f24071c598..e9cc5922375ba7 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -18,6 +18,10 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $basemac 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $basemac 8 > /sys${DEVPATH}/macaddress ;; + dlink,eagle-pro-ai-m32-a1) + [ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $(cat /sys/class/net/eth0/address) 3 > /sys${DEVPATH}/macaddress + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index ea3176d2d1e79f..e256d2b53325e3 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -34,6 +34,7 @@ platform_do_upgrade() { nand_do_upgrade "$1" fi ;; + dlink,eagle-pro-ai-m32-a1|\ elecom,wrc-x3200gst3|\ mediatek,mt7622-rfb1-ubi|\ netgear,wax206|\ @@ -72,6 +73,7 @@ platform_check_image() { buffalo,wsr-3200ax4s) buffalo_check_image "$board" "$magic" "$1" || return 1 ;; + dlink,eagle-pro-ai-m32-a1|\ elecom,wrc-x3200gst3|\ mediatek,mt7622-rfb1-ubi|\ netgear,wax206|\ From e2954a1e1b6825e9a8f8ad2a39b77a93292eb202 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Sun, 1 Oct 2023 11:25:40 +0200 Subject: [PATCH 0768/1171] mediatek: Add support for TP-Link EAP225v5 Device specification: - MT7629 with 16MB NOR flash W25Q128 and 128 MB DDR3 RAM. - MT7761N and MT7762N wireless chips (currenlty no driver in OpenWrt available) - WiFi is NOT working on this device - Dual core but second CPU doesn't seem to work (Error message during boot: "CPU1: failed to come online") There are two similar merge requests for similar devices with the same issues: - https://github.com/openwrt/openwrt/pull/12286 - https://github.com/openwrt/openwrt/pull/5084 UART interface is next to the reset button, pinout: - 1: TX (the pin with the arrow marker) - 2: RX - 3: GND - 4: VCC UART settings: 115200,8n1, 3.3V U-Boot menu can be entered by pressing Ctrl+B during startup. Booting initramfs: - Set your computers IP adress to 192.168.1.110 - Run a TFTP server providing the initramfs image - Power on the AP, press Ctrl+B to get to the U-Boot menu - Select "1. System Load Linux to SDRAM via TFTP" - Update kernel file name, input server IP and input device IP (if they deviate from the defaults) - After booting, create a backup of all partitions, especially for kernel and root_fs. They are required for reverting back to stock firmware - The sysupgrade image can be flashed now MAC adresses: - LAN and 2.4GHz use the same MAC (the one printed on the device) - 5GHz WiFi MAC is LAN MAC + 1 GPIOs: - GPIO 21 is the reset pin (low active) - GPIO 55 is for the green LED (active high) - GPIO 56 is for the yellow/amber LED (active high) Signed-off-by: Roland Reinl (cherry picked from commit 44cd32d764fe1daed3b6d0595530df0c4d1c3464) --- .../mediatek/dts/mt7629-tplink_eap225-v5.dts | 188 ++++++++++++++++++ target/linux/mediatek/image/mt7629.mk | 9 + .../mt7629/base-files/etc/board.d/02_network | 3 +- 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts diff --git a/target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts b/target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts new file mode 100644 index 00000000000000..52e22541faf341 --- /dev/null +++ b/target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts @@ -0,0 +1,188 @@ +// SPDX-License-Identifier: GPL-2.0 + +/dts-v1/; +#include +#include "mt7629.dtsi" + +/ { + model = "TP-Link EAP225 v5"; + compatible = "tplink,eap225-v5", "mediatek,mt7629"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 21 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&pio 55 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_status_amber: status_amber { + label = "amber:status"; + gpios = <&pio 56 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + pinctrl-1 = <&ephy_leds_pins>; + status = "okay"; + + mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&phy0>; + nvmem-cells = <&macaddr_factory_8>; + nvmem-cell-names = "mac-address"; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + }; +}; + +&qspi { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&qspi_pins>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x00080000>; + read-only; + }; + + partition@80000 { + label = "Partition"; + reg = <0x00080000 0x00010000>; + read-only; + }; + + partition@90000 { + label = "Factory"; + reg = <0x00090000 0x00010000>; + compatible = "nvmem-cells"; + read-only; + + macaddr_factory_8: macaddr@8 { + reg = <0x8 0x6>; + }; + }; + + partition@A0000 { + label = "Radio"; + reg = <0x000A0000 0x00010000>; + read-only; + }; + + partition@B0000 { + label = "Extra"; + reg = <0x000B0000 0x00010000>; + read-only; + }; + + /* Vendor layout: kernel (0x000C0000 0x001A0000) - rootfs (0x00260000 0x00BE0000) */ + /* OpenWrt flash layout: combine kernel and rootfs from OEM layout */ + partition@C0000 { + label = "firmware"; + reg = <0x000C0000 0x00D80000>; + }; + + partition@E40000 { + label = "Config"; + reg = <0x00E40000 0x0001B0000>; + read-only; + }; + }; + }; +}; + +&pio { + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio"; + }; + }; + + ephy_leds_pins: ephy-leds-pins { + mux { + function = "led"; + groups = "ephy_leds"; + }; + }; + + qspi_pins: qspi-pins { + mux { + function = "flash"; + groups = "spi_nor"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_txd_rxd" ; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; diff --git a/target/linux/mediatek/image/mt7629.mk b/target/linux/mediatek/image/mt7629.mk index 33c557190f64d3..9374228808c8f8 100644 --- a/target/linux/mediatek/image/mt7629.mk +++ b/target/linux/mediatek/image/mt7629.mk @@ -48,3 +48,12 @@ define Device/netgear_ex6250-v2 pad-rootfs | check-size | netgear-encrypted-factory endef TARGET_DEVICES += netgear_ex6250-v2 + +define Device/tplink_eap225-v5 + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := EAP225 + DEVICE_VARIANT := v5 + DEVICE_DTS := mt7629-tplink_eap225-v5 + DEVICE_DTS_DIR := ../dts +endef +TARGET_DEVICES += tplink_eap225-v5 diff --git a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network index db931c8334e962..df042f8ad27d4f 100644 --- a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network @@ -16,7 +16,8 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "6@eth0" ;; - netgear,ex6250-v2) + netgear,ex6250-v2|\ + tplink,eap225-v5) ucidef_set_interface_lan "eth0" ;; esac From 6bec68062b83b86ed65a96fe4a7e1ed30e5423b9 Mon Sep 17 00:00:00 2001 From: Valerio 'ftp21' Mancini Date: Wed, 4 Oct 2023 11:43:25 +0200 Subject: [PATCH 0769/1171] mediatek: add Zyxel EX5601-T0 with uboot custom partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The flash procedure is similar to the Xiaomi AX6000 router. Load openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb from original Zyxel U-Boot: tftpboot openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb bootm 0x46000000 Load mtd-rw insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1 Format ubi and create ubootenv partitions ubidetach -p /dev/mtd5; ubiformat /dev/mtd5 -y; ubiattach -p /dev/mtd5 ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB Copy openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb to /tmp and create recovery partition. If your recovery image is larger than 10MiB, size the recovery partition accordingly to make it fit. ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB ubiupdatevol /dev/ubi0_2 openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb Copy preloader and uboot to /tmp and write them in the mtd mtd write /tmp/openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-preloader.bin bl2 mtd write /tmp/openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-bl31-uboot.fip fip Now write the firmware: sysupgrade -n /tmp/openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-squashfs-sysupgrade.itb To create a correct BL2, I had to add a profile for 'spim:4k+256' as I could not find a way to value the variable 'NAND_TYPE'. Features and fixes from hitech95 tree has been squashed, I'm attaching his commit message: The Power LED was not working correctly and not reacting to the boot process and statuses. The board has space (footprint) for an unpopulated Zigbee chip, while we dont know the device model having this chip populated we have to assure that the common dts doesnt enable interfaces that share pins with such device. In this instance the PCIe and the uart1 and uart2 are disabled. Some of the control PCIE pins seems to be used for the Zigbee chip, UART1 seems to be used as a flash port while UART2 should be the main comunication interface of Zigbee chip. The Zigbee chip should be a EFR32MG21. But the pins used for UART seems to be not on standard PINS used by other adapters. So it cannot run firmwares shared on the web. But it should be possible to build a custom firmware with the corrtect pinmux. This commit also contains the following squashed commit from hitech95 - mediatek: fix sysupgrade for Zyxel EX7601-T0 ubootmod Changes and fixes added in common board: - added aliases for boot status leds. - added aliases for the mac-label-device. - added pin claims for core features (MDIO and UART 0) - added default LEDs configuration (01_leds) - added default network configuration (02_network) - added missing kmod-usb3 module for USB3 - fixed LED names - fixed reset pin for SLIC chip - removed unused pinmux configurations and devices - fix LAN (switch) port numbering - using nvmem cells for wifi eeprom, dropping deprecated "mediatek,mtd-eeprom" - proper factory partition and mac address handling - cleaned up spi_nand sections and partition Changes and fixxes added in stock layout: - added NMBM, if u-boot has it, the kernel must be informed. Co-authored-by: Nicolò Veronese Co-developed-by: Nicolò Veronese Signed-off-by: Nicolò Veronese Signed-off-by: Valerio 'ftp21' Mancini (cherry picked from commit b5df398a36f153f036c0a5ff9b221abb0f6f240a) --- .../dts/mt7986a-zyxel-ex5601-t0-common.dtsi | 433 +++++++++++++ .../dts/mt7986a-zyxel-ex5601-t0-stock.dts | 582 +++--------------- .../dts/mt7986a-zyxel-ex5601-t0-ubootmod.dts | 106 ++++ .../filogic/base-files/etc/board.d/01_leds | 7 + .../filogic/base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 3 +- .../base-files/lib/upgrade/platform.sh | 5 + target/linux/mediatek/image/filogic.mk | 34 +- 8 files changed, 658 insertions(+), 516 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-common.dtsi create mode 100644 target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-ubootmod.dts diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-common.dtsi b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-common.dtsi new file mode 100644 index 00000000000000..04e86a737d1d01 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-common.dtsi @@ -0,0 +1,433 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Author: Sam.Shih + */ + +#include "mt7986a.dtsi" +#include +#include + +/ { + aliases { + serial0 = &uart0; + label-mac-device = &gmac0; + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + gpio-keys { + compatible = "gpio-keys"; + poll-interval = <20>; + + reset-button { + label = "reset"; + gpios = <&pio 21 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wlan-button { + label = "wlan"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps-button { + label = "wps"; + gpios = <&pio 56 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_green_wifi24g { + label = "green:wifi24g"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_wifi5g { + label = "green:wifi5g"; + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_inet { + label = "green:inet"; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_red_inet { + label = "red:inet"; + gpios = <&pio 15 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_status_green: led_green_pwr { + label = "green:pwr"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; /* Default blinking */ + led-pattern = <125 125>; /* Fast blink is 4 HZ */ + }; + + led_status_red: led_red_pwr { + label = "red:pwr"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green_fxs { + label = "green:fxs"; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_fxs { + label = "amber:fxs"; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_wps24g { + label = "amber:wps24g"; + gpios = <&pio 18 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_amber_wps5g { + label = "amber:wps5g"; + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_green_lan { + label = "green:lan"; + gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led_green_sfp { + label = "green:sfp"; + gpios = <&pio 24 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + cs-gpios = <0>, <0>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + spi_nand: spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <10000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + nand_partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy = <&phy6>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <1500000>; + reset-post-delay-us = <1000000>; + + phy5: phy@5 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + mxl,led-config = <0x03f0 0x0 0x0 0x0>; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + mxl,led-config = <0x00f0 0x0 0x0 0x0>; + }; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@5 { + reg = <5>; + label = "lan1"; + phy-mode = "2500base-x"; + phy = <&phy5>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; +}; + +&crypto { + status = "okay"; +}; + +&pio { + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "switch_int", "mdc_mdio"; + }; + }; + + spic_pins_g2: spic-pins-29-to-32 { + mux { + function = "spi"; + groups = "spi1_2"; + }; + }; + + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0"; + }; + }; + + uart1_pins: uart1-pins { + mux { + function = "uart"; + groups = "uart1"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart"; + groups = "uart2"; + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf_dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + usb-oc-hog { + gpio-hog; + gpios = <7 GPIO_ACTIVE_LOW>; + input; + line-name = "usb-oc"; + }; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spic_pins_g2>; + status = "okay"; + + proslic_spi: proslic_spi@0 { + compatible = "silabs,proslic_spi"; + reg = <0>; + spi-max-frequency = <10000000>; + spi-cpha = <1>; + spi-cpol = <1>; + channel_count = <1>; + debug_level = <4>; /* 1 = TRC, 2 = DBG, 4 = ERR */ + reset_gpio = <&pio 25 GPIO_ACTIVE_HIGH>; + ig,enable-spi = <1>; /* 1: Enable, 0: Disable */ + }; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "disabled"; + + /* EFR32MG21 Zigbee (BOOT)*/ +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + status = "disabled"; + + /* EFR32MG21 Zigbee */ +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts index 331150d85db6a4..987510d4869308 100644 --- a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts @@ -6,6 +6,7 @@ /dts-v1/; #include "mt7986a.dtsi" +#include "mt7986a-zyxel-ex5601-t0-common.dtsi" #include #include @@ -13,556 +14,111 @@ model = "Zyxel EX5601-T0"; compatible = "zyxel,ex5601-t0", "mediatek,mt7986a-rfb-snand"; - aliases { - serial0 = &uart0; + memory@40000000 { + device_type = "memory"; + reg = <0x40000000 0x20000000>; }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory { - reg = <0 0x40000000 0 0x40000000>; - }; - - reg_1p8v: regulator-1p8v { - compatible = "regulator-fixed"; - regulator-name = "fixed-1.8V"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-boot-on; - regulator-always-on; - }; - - reg_3p3v: regulator-3p3v { - compatible = "regulator-fixed"; - regulator-name = "fixed-3.3V"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - - reg_5v: regulator-5v { - compatible = "regulator-fixed"; - regulator-name = "fixed-5V"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - regulator-boot-on; - regulator-always-on; - }; - - gpio-keys { - compatible = "gpio-keys"; - poll-interval = <20>; - - reset-button { - label = "reset"; - gpios = <&pio 21 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wlan-button { - label = "wlan"; - gpios = <&pio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - wps-button { - label = "wps"; - gpios = <&pio 56 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - zyleds { - compatible = "gpio-leds"; - - led_green_wifi24g { - label = "zyled-green-wifi24g"; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_wifi5g { - label = "zyled-green-wifi5g"; - gpios = <&pio 2 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_inet { - label = "zyled-green-inet"; - gpios = <&pio 14 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_red_inet { - label = "zyled-red-inet"; - gpios = <&pio 15 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_pwr { - label = "zyled-green-pwr"; - gpios = <&pio 13 GPIO_ACTIVE_LOW>; - linux,default-trigger = "timer"; /* Default blinking */ - led-pattern = <125 125>; /* Fast blink is 4 HZ */ - }; - - led_red_pwr { - label = "zyled-red-pwr"; - gpios = <&pio 12 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led_green_fxs { - label = "zyled-green-fxs"; - gpios = <&pio 16 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_amber_fxs { - label = "zyled-amber-fxs"; - gpios = <&pio 17 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_amber_wps24g { - label = "zyled-amber-wps24g"; - gpios = <&pio 18 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_amber_wps5g { - label = "zyled-amber-wps5g"; - gpios = <&pio 19 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_green_lan { - label = "zyled-green-lan"; - gpios = <&pio 20 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - led_green_sfp { - label = "zyled-green-sfp"; - gpios = <&pio 24 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - }; - }; -ð { - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "2500base-x"; - - nvmem-cells = <&macaddr_factory_002a>; - nvmem-cell-names = "mac-address"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - phy-mode = "2500base-x"; - phy = <&phy6>; - - nvmem-cells = <&macaddr_factory_0024>; - nvmem-cell-names = "mac-address"; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; - reset-delay-us = <1500000>; - reset-post-delay-us = <1000000>; - - phy5: phy@5 { - compatible = "ethernet-phy-ieee802.3-c45"; - reg = <5>; - }; - - phy6: phy@6 { - compatible = "ethernet-phy-ieee802.3-c45"; - reg = <6>; - }; - - switch@1f { - compatible = "mediatek,mt7531"; - reg = <31>; - reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@1 { - reg = <1>; - label = "lan1"; - }; - - port@2 { - reg = <2>; - label = "lan2"; - }; - - port@3 { - reg = <3>; - label = "lan3"; - }; - - port@5 { - reg = <5>; - label = "lan4"; - phy-mode = "2500base-x"; - phy = <&phy5>; - }; - - port@6 { - reg = <6>; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - }; - }; - }; +&spi_nand { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; }; -&watchdog { - status = "okay"; -}; +&nand_partitions { -&wifi { - status = "okay"; - pinctrl-names = "default", "dbdc"; - pinctrl-0 = <&wf_2g_5g_pins>; - pinctrl-1 = <&wf_dbdc_pins>; - mediatek,mtd-eeprom = <&factory 0x0>; - nvmem-cells = <&macaddr_factory_0004>; - nvmem-cell-names = "mac-address"; -}; - -&crypto { - status = "okay"; -}; - -&mmc0 { - pinctrl-names = "default", "state_uhs"; - pinctrl-0 = <&mmc0_pins_default>; - pinctrl-1 = <&mmc0_pins_uhs>; - bus-width = <8>; - max-frequency = <200000000>; - cap-mmc-highspeed; - mmc-hs200-1_8v; - mmc-hs400-1_8v; - hs400-ds-delay = <0x14014>; - vmmc-supply = <®_3p3v>; - vqmmc-supply = <®_1p8v>; - non-removable; - no-sd; - no-sdio; - status = "disabled"; -}; - -&pcie { - pinctrl-names = "default"; - pinctrl-0 = <&pcie_pins>; - status = "okay"; -}; - -&pcie_phy { - status = "okay"; -}; - -&pio { - mmc0_pins_default: mmc0-pins { - mux { - function = "emmc"; - groups = "emmc_51"; - }; - conf-cmd-dat { - pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", - "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", - "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; - input-enable; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - conf-clk { - pins = "EMMC_CK"; - drive-strength = <6>; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-ds { - pins = "EMMC_DSL"; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-rst { - pins = "EMMC_RSTB"; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; }; - mmc0_pins_uhs: mmc0-uhs-pins { - mux { - function = "emmc"; - groups = "emmc_51"; - }; - conf-cmd-dat { - pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", - "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", - "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; - input-enable; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; - conf-clk { - pins = "EMMC_CK"; - drive-strength = <6>; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-ds { - pins = "EMMC_DSL"; - mediatek,pull-down-adv = <2>; /* pull-down 50K */ - }; - conf-rst { - pins = "EMMC_RSTB"; - drive-strength = <4>; - mediatek,pull-up-adv = <1>; /* pull-up 10K */ - }; + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; }; - pcie_pins: pcie-pins { - mux { - function = "pcie"; - groups = "pcie_clk", "pcie_wake", "pcie_pereset"; - }; + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; }; - spic_pins_g2: spic-pins-29-to-32 { - mux { - function = "spi"; - groups = "spi1_2"; - }; + partition@380000 { + label = "FIP"; + reg = <0x380000 0x01C0000>; + read-only; }; - spi_flash_pins: spi-flash-pins-33-to-38 { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - conf-pu { - pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; - drive-strength = <8>; - mediatek,pull-up-adv = <0>; /* bias-disable */ - }; - conf-pd { - pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; - drive-strength = <8>; - mediatek,pull-down-adv = <0>; /* bias-disable */ - }; + partition@540000 { + label = "zloader"; + reg = <0x540000 0x0040000>; + read-only; }; - uart1_pins: uart1-pins { - mux { - function = "uart"; - groups = "uart1"; - }; + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; }; - uart2_pins: uart2-pins { - mux { - function = "uart"; - groups = "uart2"; - }; - }; - - wf_2g_5g_pins: wf_2g_5g-pins { - mux { - function = "wifi"; - groups = "wf_2g", "wf_5g"; - }; - conf { - pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", - "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", - "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", - "WF1_TOP_CLK", "WF1_TOP_DATA"; - drive-strength = <4>; - }; + partition@4580000 { + label = "ubi2"; + reg = <0x4580000 0x4000000>; + read-only; }; - wf_dbdc_pins: wf_dbdc-pins { - mux { - function = "wifi"; - groups = "wf_dbdc"; - }; - conf { - pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", - "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", - "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", - "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", - "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", - "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", - "WF1_TOP_CLK", "WF1_TOP_DATA"; - drive-strength = <4>; - }; + partition@8580000 { + label = "zyubi"; + reg = <0x8580000 0x15A80000>; }; }; -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi_flash_pins>; - cs-gpios = <0>, <0>; +&factory { + compatible = "nvmem-cells"; #address-cells = <1>; - #size-cells = <0>; - status = "okay"; + #size-cells = <1>; - spi_nand: spi_nand@0 { + nvmem-layout { + compatible = "fixed-layout"; #address-cells = <1>; - #size-cells = <1>; - compatible = "spi-nand"; - reg = <1>; - spi-max-frequency = <10000000>; - spi-tx-bus-width = <4>; - spi-rx-bus-width = <4>; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; + eeprom_factory: eeprom@0 { #size-cells = <1>; + reg = <0x0 0x1000>; + }; - partition@0 { - label = "BL2"; - reg = <0x00000 0x0100000>; - read-only; - }; - - partition@100000 { - label = "u-boot-env"; - reg = <0x0100000 0x0080000>; - }; - - factory: partition@180000 { - label = "Factory"; - reg = <0x180000 0x0200000>; - read-only; - }; - - partition@380000 { - label = "FIP"; - reg = <0x380000 0x01C0000>; - read-only; - }; - - partition@540000 { - label = "zloader"; - reg = <0x540000 0x0040000>; - read-only; - }; - - partition@580000 { - label = "ubi"; - reg = <0x580000 0x4000000>; - }; - - partition@4580000 { - label = "ubi2"; - reg = <0x4580000 0x4000000>; - read-only; - }; - - partition@8580000 { - label = "zyubi"; - reg = <0x8580000 0x15A80000>; - }; + macaddr_factory_0004: macaddr@0004 { + compatible = "mac-base"; + reg = <0x0004 0x6>; + #nvmem-cell-cells = <1>; }; - }; -}; -&spi1 { - pinctrl-names = "default"; - pinctrl-0 = <&spic_pins_g2>; - status = "okay"; + macaddr_factory_0024: macaddr@0024 { + compatible = "mac-base"; + reg = <0x0024 0x6>; + #nvmem-cell-cells = <1>; + }; - proslic_spi: proslic_spi@0 { - compatible = "silabs,proslic_spi"; - reg = <0>; - spi-max-frequency = <10000000>; - spi-cpha = <1>; - spi-cpol = <1>; - channel_count = <1>; - debug_level = <4>; /* 1 = TRC, 2 = DBG, 4 = ERR */ - reset_gpio = <&pio 7 GPIO_ACTIVE_HIGH>; - ig,enable-spi = <1>; /* 1: Enable, 0: Disable */ + macaddr_factory_002a: macaddr@002a { + compatible = "mac-base"; + reg = <0x002a 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; -&ssusb { - vusb33-supply = <®_3p3v>; - vbus-supply = <®_5v>; - status = "okay"; -}; - -&trng { - status = "okay"; -}; - -&uart0 { - status = "okay"; -}; - -&uart1 { - pinctrl-names = "default"; - pinctrl-0 = <&uart1_pins>; - status = "okay"; -}; - -&uart2 { - pinctrl-names = "default"; - pinctrl-0 = <&uart2_pins>; - status = "okay"; +&gmac0 { + nvmem-cells = <&macaddr_factory_002a 0>; + nvmem-cell-names = "mac-address"; }; -&usb_phy { - status = "okay"; +&gmac1 { + nvmem-cells = <&macaddr_factory_0024 0>; + nvmem-cell-names = "mac-address"; }; -&factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_0004: macaddr@0004 { - reg = <0x0004 0x6>; - }; - - macaddr_factory_0024: macaddr@0024 { - reg = <0x0024 0x6>; - }; - - macaddr_factory_002a: macaddr@002a { - reg = <0x002a 0x6>; - }; +&wifi { + nvmem-cells = <&eeprom_factory>; + nvmem-cell-names = "eeprom"; }; diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-ubootmod.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-ubootmod.dts new file mode 100644 index 00000000000000..a300e2052d97a6 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-ubootmod.dts @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Author: Sam.Shih + */ + +/dts-v1/; +#include "mt7986a.dtsi" +#include "mt7986a-zyxel-ex5601-t0-common.dtsi" +#include +#include + +/ { + model = "Zyxel EX5601-T0 ubootmod"; + compatible = "zyxel,ex5601-t0-ubootmod", "mediatek,mt7986a"; + memory@40000000 { + device_type = "memory"; + reg = <0x40000000 0x20000000>; + }; +}; + +&nand_partitions { + partition@0 { + label = "bl2"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + }; + + partition@380000 { + label = "fip"; + reg = <0x380000 0x0200000>; + read-only; + }; + + partition@540000 { + label = "zloader"; + reg = <0x540000 0x0040000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x1da80000>; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + + eeprom_factory: eeprom@0 { + #size-cells = <1>; + reg = <0x0 0x1000>; + }; + + macaddr_factory_0004: macaddr@0004 { + compatible = "mac-base"; + reg = <0x0004 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_factory_0024: macaddr@0024 { + compatible = "mac-base"; + reg = <0x0024 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_factory_002a: macaddr@002a { + compatible = "mac-base"; + reg = <0x002a 0x6>; + #nvmem-cell-cells = <1>; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_002a 0>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + nvmem-cells = <&macaddr_factory_0024 0>; + nvmem-cell-names = "mac-address"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index cdeaa6c5c52146..75c8fcda9b8cc2 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -42,6 +42,13 @@ xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_led_netdev "wan" "wan" "rgb:network" "wan" ;; +zyxel_ex5601-t0-stock|\ +zyxel,ex5601-t0-ubootmod) + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" "link tx rx" + ucidef_set_led_netdev "wan" "WAN" "green:inet" "eth1" "link tx rx" + ucidef_set_led_netdev "wifi-24g" "WIFI-2.4G" "green:wifi24g" "phy0-ap0" "link tx rx" + ucidef_set_led_netdev "wifi-5g" "WIFI-5G" "green:wifi5g" "phy1-ap0" "link tx rx" + ;; esac board_config_flush diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 2e978be6804bf7..a48fbbc79c0ea3 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -73,6 +73,10 @@ mediatek_setup_interfaces() xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" wan ;; + zyxel,ex5601-t0-stock|\ + zyxel,ex5601-t0-ubootmod) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 + ;; *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index f8ebc1da42fb13..e6378dd49809ee 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -107,7 +107,8 @@ case "$board" in ;; routerich,ax3000|\ zbtlink,zbt-z8102ax|\ - zyxel,ex5601-t0) + zyxel,ex5601-t0|\ + zyxel,ex5601-t0-ubootmod) addr=$(mtd_get_mac_binary "Factory" 0x4) [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress ;; diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index e3b042c876d504..9b3ebe92f15cb1 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -142,6 +142,11 @@ platform_do_upgrade() { CI_ROOT_UBIPART=ubi nand_do_upgrade "$1" ;; + zyxel,ex5601-t0-ubootmod) + CI_KERNPART="fit" + CI_ROOTPART="ubi_rootfs" + nand_do_upgrade "$1" + ;; *) nand_do_upgrade "$1" ;; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 194319a228aa58..7daac6a1fac9ba 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -801,10 +801,11 @@ TARGET_DEVICES += zbtlink_zbt-z8102ax define Device/zyxel_ex5601-t0-stock DEVICE_VENDOR := Zyxel - DEVICE_MODEL := EX5601-T0 (stock layout) + DEVICE_MODEL := EX5601-T0 + DEVICE_VARIANT := (stock layout) DEVICE_DTS := mt7986a-zyxel-ex5601-t0-stock DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware kmod-usb3 SUPPORTED_DEVICES := mediatek,mt7986a-rfb-snand UBINIZE_OPTS := -E 5 BLOCKSIZE := 256k @@ -821,6 +822,35 @@ define Device/zyxel_ex5601-t0-stock endef TARGET_DEVICES += zyxel_ex5601-t0-stock +define Device/zyxel_ex5601-t0-ubootmod + DEVICE_VENDOR := Zyxel + DEVICE_MODEL := EX5601-T0 + DEVICE_VARIANT := (OpenWrt U-Boot layout) + DEVICE_DTS := mt7986a-zyxel-ex5601-t0-ubootmod + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware kmod-usb3 + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + IMAGES := sysupgrade.itb + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 256k + PAGESIZE := 4096 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + KERNEL := kernel-bin | lzma + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd + IMAGE/sysupgrade.itb := append-kernel | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-4k-ddr4 + ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot zyxel_ex5601-t0 +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS += initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel +endif +endef +TARGET_DEVICES += zyxel_ex5601-t0-ubootmod + define Device/zyxel_ex5700-telenor DEVICE_VENDOR := ZyXEL DEVICE_MODEL := EX5700 (Telenor) From 9627654277ca307597028e0b8c2c449ab35bbd5e Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Sat, 4 Nov 2023 23:50:20 +0800 Subject: [PATCH 0770/1171] mediatek: Cetron CT3003: fixes typo for spi properties Same as commit 3674689, correct 'buswidth' to 'bus-width'. Also move the nmbm properties outside the partition definition. Signed-off-by: Chukun Pan (cherry picked from commit 1be6347b7d5cbbe944c9e5bab29aea4ec7de6349) --- target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts index ae4404466e8e64..aea6f02da24a7f 100644 --- a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts +++ b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts @@ -100,18 +100,18 @@ reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - mediatek,nmbm; - mediatek,bmt-max-ratio = <1>; - mediatek,bmt-max-reserved-blocks = <64>; - partition@0 { label = "BL2"; reg = <0x0000000 0x0100000>; From 37c2bc4397c1f7152ab9cb2f4235cb65a6d501bb Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 24 Jan 2024 05:01:43 +0000 Subject: [PATCH 0771/1171] mediatek: fixes for Ethernet on MT7988 SoC * fix switch ports with modes other than 1000M/Full * set 32-bit dma_coherent_mask to get PPE to work with 4 GiB of RAM * sync driver for built-in 1GE PHY with MediaTek SDK sources Signed-off-by: Daniel Golle (cherry picked from commit 4ae2f43b3a24e8a74963852f9d2fb8fee0872f31) --- ..._eth_soc-set-coherent-mask-to-get-PP.patch | 46 +++ ...-fix-10M-100M-speed-on-MT7988-switch.patch | 45 +++ ...-ge-soc-sync-driver-with-MediaTek-SD.patch | 270 ++++++++++++++++++ ...iatek-split-tx-and-rx-fields-in-mtk_.patch | 18 +- ...iatek-use-QDMA-instead-of-ADMAv2-on-.patch | 4 +- 5 files changed, 372 insertions(+), 11 deletions(-) create mode 100644 target/linux/generic/pending-5.15/738-net-ethernet-mtk_eth_soc-set-coherent-mask-to-get-PP.patch create mode 100644 target/linux/generic/pending-5.15/796-net-dsa-mt7530-fix-10M-100M-speed-on-MT7988-switch.patch create mode 100644 target/linux/mediatek/patches-5.15/734-net-phy-mediatek-ge-soc-sync-driver-with-MediaTek-SD.patch diff --git a/target/linux/generic/pending-5.15/738-net-ethernet-mtk_eth_soc-set-coherent-mask-to-get-PP.patch b/target/linux/generic/pending-5.15/738-net-ethernet-mtk_eth_soc-set-coherent-mask-to-get-PP.patch new file mode 100644 index 00000000000000..29dca260180937 --- /dev/null +++ b/target/linux/generic/pending-5.15/738-net-ethernet-mtk_eth_soc-set-coherent-mask-to-get-PP.patch @@ -0,0 +1,46 @@ +From dee3f591103910c8d8b2a6d57879ccd2a4be4b10 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Daniel Golle +Date: Wed, 24 Jan 2024 03:19:49 +0000 +Subject: [PATCH net] net: ethernet: mtk_eth_soc: set coherent mask to get PPE + working +To: Felix Fietkau , + Sean Wang , + Mark Lee , + Lorenzo Bianconi , + David S. Miller , + Eric Dumazet , + Jakub Kicinski , + Paolo Abeni , + Matthias Brugger , + AngeloGioacchino Del Regno , + Daniel Golle , + netdev@vger.kernel.org, + linux-kernel@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org + +Set DMA coherent mask to 32-bit which makes PPE offloading engine start +working on BPi-R4 which got 4 GiB of RAM. + +Fixes: 2d75891ebc09 ("net: ethernet: mtk_eth_soc: support 36-bit DMA addressing on MT7988") +Suggested-by: Elad Yifee +Signed-off-by: Daniel Golle +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4830,7 +4830,10 @@ static int mtk_probe(struct platform_dev + } + + if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) { +- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36)); ++ err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(36)); ++ if (!err) ++ err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); ++ + if (err) { + dev_err(&pdev->dev, "Wrong DMA config\n"); + return -EINVAL; diff --git a/target/linux/generic/pending-5.15/796-net-dsa-mt7530-fix-10M-100M-speed-on-MT7988-switch.patch b/target/linux/generic/pending-5.15/796-net-dsa-mt7530-fix-10M-100M-speed-on-MT7988-switch.patch new file mode 100644 index 00000000000000..f2e91d3fe5fe23 --- /dev/null +++ b/target/linux/generic/pending-5.15/796-net-dsa-mt7530-fix-10M-100M-speed-on-MT7988-switch.patch @@ -0,0 +1,45 @@ +From a444877c10a665cd8a869e6d37facdb89fd95f79 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Daniel Golle +Date: Wed, 24 Jan 2024 04:17:11 +0000 +Subject: [PATCH net] net: dsa: mt7530: fix 10M/100M speed on MT7988 switch +To: Arınç ÜNAL , + Daniel Golle , + DENG Qingfang , + Sean Wang , + Andrew Lunn , + Florian Fainelli , + Vladimir Oltean , + David S. Miller , + Eric Dumazet , + Jakub Kicinski , + Paolo Abeni , + Matthias Brugger , + AngeloGioacchino Del Regno , + netdev@vger.kernel.org, + linux-kernel@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org + +Setup PMCR port register for actual speed and duplex on internally +connected PHYs of the MT7988 built-in switch. This fixes links with +speeds other than 1000M. + +Fixes: ("110c18bfed414 net: dsa: mt7530: introduce driver for MT7988 built-in switch") +Signed-off-by: Daniel Golle +--- + drivers/net/dsa/mt7530.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -2832,8 +2832,7 @@ static void mt753x_phylink_mac_link_up(s + /* MT753x MAC works in 1G full duplex mode for all up-clocked + * variants. + */ +- if (interface == PHY_INTERFACE_MODE_INTERNAL || +- interface == PHY_INTERFACE_MODE_TRGMII || ++ if (interface == PHY_INTERFACE_MODE_TRGMII || + (phy_interface_mode_is_8023z(interface))) { + speed = SPEED_1000; + duplex = DUPLEX_FULL; diff --git a/target/linux/mediatek/patches-5.15/734-net-phy-mediatek-ge-soc-sync-driver-with-MediaTek-SD.patch b/target/linux/mediatek/patches-5.15/734-net-phy-mediatek-ge-soc-sync-driver-with-MediaTek-SD.patch new file mode 100644 index 00000000000000..f983be4e445c45 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/734-net-phy-mediatek-ge-soc-sync-driver-with-MediaTek-SD.patch @@ -0,0 +1,270 @@ +From f2195279c234c0f618946424b8236026126bc595 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Daniel Golle +Date: Wed, 24 Jan 2024 02:27:04 +0000 +Subject: [PATCH net] net: phy: mediatek-ge-soc: sync driver with MediaTek SDK +To: Daniel Golle , + Qingfang Deng , + SkyLake Huang , + Andrew Lunn , + Heiner Kallweit , + Russell King , + David S. Miller , + Eric Dumazet , + Jakub Kicinski , + Paolo Abeni , + Matthias Brugger , + AngeloGioacchino Del Regno , + netdev@vger.kernel.org, + linux-kernel@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org + +Sync initialization and calibration routines with MediaTek's reference +driver. Improves compliance and resolves link stability issues with +CH340 IoT devices connected to MT798x built-in PHYs. + +Fixes: 98c485eaf509 ("net: phy: add driver for MediaTek SoC built-in GE PHYs") +Signed-off-by: Daniel Golle +--- + drivers/net/phy/mediatek-ge-soc.c | 147 ++++++++++++++++-------------- + 1 file changed, 81 insertions(+), 66 deletions(-) + +--- a/drivers/net/phy/mediatek-ge-soc.c ++++ b/drivers/net/phy/mediatek-ge-soc.c +@@ -479,7 +479,7 @@ static int tx_r50_fill_result(struct phy + u16 reg, val; + + if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988) +- bias = -2; ++ bias = -1; + + val = clamp_val(bias + tx_r50_cal_val, 0, 63); + +@@ -695,6 +695,11 @@ restore: + static void mt798x_phy_common_finetune(struct phy_device *phydev) + { + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); ++ /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */ ++ __phy_write(phydev, 0x11, 0xc71); ++ __phy_write(phydev, 0x12, 0xc); ++ __phy_write(phydev, 0x10, 0x8fae); ++ + /* EnabRandUpdTrig = 1 */ + __phy_write(phydev, 0x11, 0x2f00); + __phy_write(phydev, 0x12, 0xe); +@@ -705,15 +710,56 @@ static void mt798x_phy_common_finetune(s + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x83aa); + +- /* TrFreeze = 0 */ ++ /* FfeUpdGainForce = 1(Enable), FfeUpdGainForceVal = 4 */ ++ __phy_write(phydev, 0x11, 0x240); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x9680); ++ ++ /* TrFreeze = 0 (mt7988 default) */ + __phy_write(phydev, 0x11, 0x0); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x9686); + ++ /* SSTrKp100 = 5 */ ++ /* SSTrKf100 = 6 */ ++ /* SSTrKp1000Mas = 5 */ ++ /* SSTrKf1000Mas = 6 */ + /* SSTrKp1000Slv = 5 */ ++ /* SSTrKf1000Slv = 6 */ + __phy_write(phydev, 0x11, 0xbaef); + __phy_write(phydev, 0x12, 0x2e); + __phy_write(phydev, 0x10, 0x968c); ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++} ++ ++static void mt7981_phy_finetune(struct phy_device *phydev) ++{ ++ u16 val[8] = { 0x01ce, 0x01c1, ++ 0x020f, 0x0202, ++ 0x03d0, 0x03c0, ++ 0x0013, 0x0005 }; ++ int i, k; ++ ++ /* 100M eye finetune: ++ * Keep middle level of TX MLT3 shapper as default. ++ * Only change TX MLT3 overshoot level here. ++ */ ++ for (k = 0, i = 1; i < 12; i++) { ++ if (i % 3 == 0) ++ continue; ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]); ++ } ++ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); ++ /* ResetSyncOffset = 6 */ ++ __phy_write(phydev, 0x11, 0x600); ++ __phy_write(phydev, 0x12, 0x0); ++ __phy_write(phydev, 0x10, 0x8fc0); ++ ++ /* VgaDecRate = 1 */ ++ __phy_write(phydev, 0x11, 0x4c2a); ++ __phy_write(phydev, 0x12, 0x3e); ++ __phy_write(phydev, 0x10, 0x8fa4); + + /* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2, + * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2 +@@ -728,7 +774,7 @@ static void mt798x_phy_common_finetune(s + __phy_write(phydev, 0x10, 0x8ec0); + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); + +- /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/ ++ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9 */ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234, + MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK, + BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9)); +@@ -761,48 +807,6 @@ static void mt798x_phy_common_finetune(s + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222); + } + +-static void mt7981_phy_finetune(struct phy_device *phydev) +-{ +- u16 val[8] = { 0x01ce, 0x01c1, +- 0x020f, 0x0202, +- 0x03d0, 0x03c0, +- 0x0013, 0x0005 }; +- int i, k; +- +- /* 100M eye finetune: +- * Keep middle level of TX MLT3 shapper as default. +- * Only change TX MLT3 overshoot level here. +- */ +- for (k = 0, i = 1; i < 12; i++) { +- if (i % 3 == 0) +- continue; +- phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]); +- } +- +- phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); +- /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */ +- __phy_write(phydev, 0x11, 0xc71); +- __phy_write(phydev, 0x12, 0xc); +- __phy_write(phydev, 0x10, 0x8fae); +- +- /* ResetSyncOffset = 6 */ +- __phy_write(phydev, 0x11, 0x600); +- __phy_write(phydev, 0x12, 0x0); +- __phy_write(phydev, 0x10, 0x8fc0); +- +- /* VgaDecRate = 1 */ +- __phy_write(phydev, 0x11, 0x4c2a); +- __phy_write(phydev, 0x12, 0x3e); +- __phy_write(phydev, 0x10, 0x8fa4); +- +- /* FfeUpdGainForce = 4 */ +- __phy_write(phydev, 0x11, 0x240); +- __phy_write(phydev, 0x12, 0x0); +- __phy_write(phydev, 0x10, 0x9680); +- +- phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); +-} +- + static void mt7988_phy_finetune(struct phy_device *phydev) + { + u16 val[12] = { 0x0187, 0x01cd, 0x01c8, 0x0182, +@@ -817,17 +821,7 @@ static void mt7988_phy_finetune(struct p + /* TCT finetune */ + phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5); + +- /* Disable TX power saving */ +- phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7, +- MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8); +- + phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); +- +- /* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */ +- __phy_write(phydev, 0x11, 0x671); +- __phy_write(phydev, 0x12, 0xc); +- __phy_write(phydev, 0x10, 0x8fae); +- + /* ResetSyncOffset = 5 */ + __phy_write(phydev, 0x11, 0x500); + __phy_write(phydev, 0x12, 0x0); +@@ -835,13 +829,27 @@ static void mt7988_phy_finetune(struct p + + /* VgaDecRate is 1 at default on mt7988 */ + +- phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++ /* MrvlTrFix100Kp = 6, MrvlTrFix100Kf = 7, ++ * MrvlTrFix1000Kp = 6, MrvlTrFix1000Kf = 7 ++ */ ++ __phy_write(phydev, 0x11, 0xb90a); ++ __phy_write(phydev, 0x12, 0x6f); ++ __phy_write(phydev, 0x10, 0x8f82); ++ ++ /* RemAckCntLimitCtrl = 1 */ ++ __phy_write(phydev, 0x11, 0xfbba); ++ __phy_write(phydev, 0x12, 0xc3); ++ __phy_write(phydev, 0x10, 0x87f8); + +- phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30); +- /* TxClkOffset = 2 */ +- __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK, +- FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2)); + phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++ ++ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 10 */ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234, ++ MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK, ++ BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0xa)); ++ ++ /* rg_tr_lpf_cnt_val = 1023 */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x3ff); + } + + static void mt798x_phy_eee(struct phy_device *phydev) +@@ -874,11 +882,11 @@ static void mt798x_phy_eee(struct phy_de + MTK_PHY_LPI_SLV_SEND_TX_EN, + FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120)); + +- phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239, +- MTK_PHY_LPI_SEND_LOC_TIMER_MASK | +- MTK_PHY_LPI_TXPCS_LOC_RCV, +- FIELD_PREP(MTK_PHY_LPI_SEND_LOC_TIMER_MASK, 0x117)); ++ /* Keep MTK_PHY_LPI_SEND_LOC_TIMER as 375 */ ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239, ++ MTK_PHY_LPI_TXPCS_LOC_RCV); + ++ /* This also fixes some IoT issues, such as CH340 */ + phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7, + MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK, + FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) | +@@ -912,7 +920,7 @@ static void mt798x_phy_eee(struct phy_de + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x9690); + +- /* REG_EEE_st2TrKf1000 = 3 */ ++ /* REG_EEE_st2TrKf1000 = 2 */ + __phy_write(phydev, 0x11, 0x114f); + __phy_write(phydev, 0x12, 0x2); + __phy_write(phydev, 0x10, 0x969a); +@@ -937,7 +945,7 @@ static void mt798x_phy_eee(struct phy_de + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x96b8); + +- /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */ ++ /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 0 */ + __phy_write(phydev, 0x11, 0x1463); + __phy_write(phydev, 0x12, 0x0); + __phy_write(phydev, 0x10, 0x96ca); +@@ -1198,6 +1206,13 @@ static int mt7988_phy_probe(struct phy_d + + mt798x_phy_setup_led(phydev, mt7988_phy_get_boottrap_polarity(phydev)); + ++ /* Disable TX power saving at probing to: ++ * 1. Meet common mode compliance test criteria ++ * 2. Make sure that TX-VCM calibration works fine ++ */ ++ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7, ++ MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8); ++ + return mt798x_phy_calibration(phydev); + } + diff --git a/target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch b/target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch index 7b78033ffb7791..af95dcf8d299af 100644 --- a/target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch +++ b/target/linux/mediatek/patches-5.15/961-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch @@ -347,7 +347,7 @@ Signed-off-by: Lorenzo Bianconi mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); if (mtk_is_netsys_v3_or_greater(eth)) { -@@ -5163,11 +5163,15 @@ static const struct mtk_soc_data mt2701_ +@@ -5166,11 +5166,15 @@ static const struct mtk_soc_data mt2701_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .version = 1, @@ -368,7 +368,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5183,11 +5187,15 @@ static const struct mtk_soc_data mt7621_ +@@ -5186,11 +5190,15 @@ static const struct mtk_soc_data mt7621_ .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -389,7 +389,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5205,11 +5213,15 @@ static const struct mtk_soc_data mt7622_ +@@ -5208,11 +5216,15 @@ static const struct mtk_soc_data mt7622_ .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -410,7 +410,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5226,11 +5238,15 @@ static const struct mtk_soc_data mt7623_ +@@ -5229,11 +5241,15 @@ static const struct mtk_soc_data mt7623_ .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, @@ -431,7 +431,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5245,11 +5261,15 @@ static const struct mtk_soc_data mt7629_ +@@ -5248,11 +5264,15 @@ static const struct mtk_soc_data mt7629_ .required_pctl = false, .has_accounting = true, .version = 1, @@ -452,7 +452,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5267,11 +5287,15 @@ static const struct mtk_soc_data mt7981_ +@@ -5270,11 +5290,15 @@ static const struct mtk_soc_data mt7981_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -473,7 +473,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5289,11 +5313,15 @@ static const struct mtk_soc_data mt7986_ +@@ -5292,11 +5316,15 @@ static const struct mtk_soc_data mt7986_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -494,7 +494,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5311,11 +5339,15 @@ static const struct mtk_soc_data mt7988_ +@@ -5314,11 +5342,15 @@ static const struct mtk_soc_data mt7988_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, @@ -515,7 +515,7 @@ Signed-off-by: Lorenzo Bianconi .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5328,11 +5360,15 @@ static const struct mtk_soc_data rt5350_ +@@ -5331,11 +5363,15 @@ static const struct mtk_soc_data rt5350_ .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, .version = 1, diff --git a/target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch b/target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch index df8e988eb5a76c..ea94bb5e05642f 100644 --- a/target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch +++ b/target/linux/mediatek/patches-5.15/962-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch @@ -89,7 +89,7 @@ Signed-off-by: Daniel Golle /* Set FE to PDMAv2 if necessary */ val = mtk_r32(eth, MTK_FE_GLO_MISC); mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); -@@ -5293,11 +5293,11 @@ static const struct mtk_soc_data mt7981_ +@@ -5296,11 +5296,11 @@ static const struct mtk_soc_data mt7981_ .dma_len_offset = 8, }, .rx = { @@ -105,7 +105,7 @@ Signed-off-by: Daniel Golle }, }; -@@ -5319,11 +5319,11 @@ static const struct mtk_soc_data mt7986_ +@@ -5322,11 +5322,11 @@ static const struct mtk_soc_data mt7986_ .dma_len_offset = 8, }, .rx = { From c8898f46f9d35b2b5a82a689a3d87f9afe517c50 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 3 Mar 2024 15:22:54 +0000 Subject: [PATCH 0772/1171] kernel: lantiq: ltq-vmmc: introduce user group for vmmc asterisk-chan-lantiq is by now the only user of the VMMC interface. And asterisk runs as user 'asterisk' which doesn't give it permission to open the /dev/vmmc* devices. Introduce a new user group 'vmmc' and give permission to access the /dev/vmmc* devices to that group. Another commit for asterisk-chan-lantiq will add the 'asterisk' user to that group. Signed-off-by: Daniel Golle (cherry picked from commit 37bbed6f95856a507d727ffc863b20f8a8b35332) --- package/kernel/lantiq/ltq-vmmc/Makefile | 1 + package/kernel/lantiq/ltq-vmmc/files/vmmc.init | 1 + 2 files changed, 2 insertions(+) diff --git a/package/kernel/lantiq/ltq-vmmc/Makefile b/package/kernel/lantiq/ltq-vmmc/Makefile index c96cee819b6030..4972f1c374a98f 100644 --- a/package/kernel/lantiq/ltq-vmmc/Makefile +++ b/package/kernel/lantiq/ltq-vmmc/Makefile @@ -29,6 +29,7 @@ define KernelPackage/ltq-vmmc DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xrx200) +kmod-ltq-tapi FILES:=$(PKG_BUILD_DIR)/src/drv_vmmc.ko AUTOLOAD:=$(call AutoProbe,drv_vmmc) + USERID:=:vmmc=386 endef define KernelPackage/ltq-vmmc/description diff --git a/package/kernel/lantiq/ltq-vmmc/files/vmmc.init b/package/kernel/lantiq/ltq-vmmc/files/vmmc.init index 402376e2942690..78efe80b980838 100644 --- a/package/kernel/lantiq/ltq-vmmc/files/vmmc.init +++ b/package/kernel/lantiq/ltq-vmmc/files/vmmc.init @@ -8,6 +8,7 @@ start() { for i in 10 11 12 13 14 15 16 17 18; do if ! [ -e /dev/vmmc$i ]; then mknod -m 664 /dev/vmmc$i c 122 $i + chown root:vmmc /dev/vmmc$i fi done } From 81f8b93e3600953fc03d227c25e88919a6768b8c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 2 Feb 2024 00:46:58 +0100 Subject: [PATCH 0773/1171] build: add $(STAGING_DIR) and $(BIN_DIR) preparation to target and package subdir compile dependencies In a pristine build, these directories are created as dependencies of the tools subdir compile, however this step never runs when the tools compile stamp already exists. Since commit ed6ba2801c0a ("tools: keep stamp file in $(STAGING_DIR_HOST)"), this will happen after `make clean`: $(STAGING_DIR) has been deleted, but the tools stamp still exists, so the next build will fail because $(STAGING_DIR) has not been set up correctly. Fix builds after `make clean` by adding the preparation as dependencies for the target and package directories as well. Fixes: ed6ba2801c0a ("tools: keep stamp file in $(STAGING_DIR_HOST)") Signed-off-by: Matthias Schiffer (cherry picked from commit fbb924abff8af9e69ec90d7bf099046c24145b74) --- package/Makefile | 2 ++ target/Makefile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/package/Makefile b/package/Makefile index 8e72d4ec726dbc..4663b41de4aea0 100644 --- a/package/Makefile +++ b/package/Makefile @@ -117,6 +117,8 @@ endif $(curdir)/flags-install:= -j1 +$(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR) + $(eval $(call stampfile,$(curdir),package,prereq,.config)) $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build)) diff --git a/target/Makefile b/target/Makefile index 83f9c4b0934a58..3bbb9f4131336d 100644 --- a/target/Makefile +++ b/target/Makefile @@ -19,6 +19,8 @@ $(curdir)/builddirs-install:=\ $(curdir)/sdk/install:=$(curdir)/linux/install $(curdir)/imagebuilder/install:=$(curdir)/linux/install +$(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR) + $(eval $(call stampfile,$(curdir),target,prereq,.config)) $(eval $(call stampfile,$(curdir),target,compile,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),target,install,$(TMP_DIR)/.build)) From e87be1bc0e024040cc452f1e4ae956a1204f6f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 4 Mar 2024 16:20:55 +0100 Subject: [PATCH 0774/1171] bcm27xx: base-files: fix platform_copy_config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /boot/kernel*.img wildcard only works without quotation marks. (cherry picked from commit 552c6b24724d81a9651a0e64a01135c18c6487ea) Fixes: 1a5e51ab0011 ("bcm27xx: base-files: fix platform_copy_config") Signed-off-by: Álvaro Fernández Rojas --- target/linux/bcm27xx/base-files/lib/upgrade/platform.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh index 956bc1c7886ae1..3182a555a96bf4 100644 --- a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh @@ -90,7 +90,7 @@ platform_copy_config() { if export_partdevice partdev 1; then mkdir -p /boot - [ -f "/boot/kernel*.img" ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot + [ -f /boot/kernel*.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE" tar -C / -zxvf "$UPGRADE_BACKUP" boot/cmdline.txt boot/config.txt sync From a527b34390f1cbe9b0bcffbc3b6e4e0059b0e251 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 4 Mar 2024 23:45:15 +0100 Subject: [PATCH 0775/1171] build: do not depend on $(STAGING_DIR)/.prepared when in SDK The dependency can't be satisfied when building using the SDK, breaking package builds. As the staging and bin dirs are distributed with the SDK archive, ignoring the dependency is fine when SDK is set. Fixes: fbb924abff8a ("build: add $(STAGING_DIR) and $(BIN_DIR) ...") Signed-off-by: Matthias Schiffer (cherry picked from commit 2b46cbef8179b4a131bd008c520339441bc87c97) --- package/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/Makefile b/package/Makefile index 4663b41de4aea0..d72ce09a816b42 100644 --- a/package/Makefile +++ b/package/Makefile @@ -59,6 +59,7 @@ $(curdir)/merge-index: $(curdir)/merge (cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; ) ifndef SDK + $(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR) $(curdir)/compile: $(curdir)/system/opkg/host/compile endif @@ -117,8 +118,6 @@ endif $(curdir)/flags-install:= -j1 -$(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR) - $(eval $(call stampfile,$(curdir),package,prereq,.config)) $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build)) From e5a12edb883fe246afdb6bf897286865b0d4eeb5 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Manzano Date: Mon, 22 Jan 2024 13:52:18 +0100 Subject: [PATCH 0776/1171] hostapd: fix 11r defaults when using SAE When using WPA3-SAE or WPA2/WPA3 Personal Mixed, we can not use ft_psk_generate_local because it will break FT for SAE. Instead use the r0kh and r1kh configuration approach. Signed-off-by: Jesus Fernandez Manzano (cherry picked from commit e2f6bfb833a1ba099e1dcf0e569e4ef11c31c391) Fixes: https://github.com/openwrt/luci/issues/6930 Signed-off-by: Jo-Philipp Wich --- package/network/services/hostapd/files/hostapd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 5d588b3bde0126..73bd1bbeeb912d 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -909,7 +909,7 @@ hostapd_set_bss_options() { set_default reassociation_deadline 1000 case "$auth_type" in - psk|sae|psk-sae) + psk) set_default ft_psk_generate_local 1 ;; *) From 503f78f91cddd4ba77731b5fc872b23455d45264 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Manzano Date: Mon, 22 Jan 2024 13:46:14 +0100 Subject: [PATCH 0777/1171] hostapd: fix 11r defaults when using WPA 802.11r can not be used when selecting WPA. It needs at least WPA2. This is because 802.11r advertises FT support in-part through the Authentication and Key Management (AKM) suites in the Robust Security Network (RSN) Information Element, which was included in the 802.11i amendment and WPA2 certification program. Pre-standard WPA did not include the RSN IE, but the WPA IE. This IE can not advertise the AKM suite for FT. Signed-off-by: Jesus Fernandez Manzano (cherry picked from commit cdc4c551755115e0e1047a0c90a658e6238e96ee) --- .../network/services/hostapd/files/hostapd.sh | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 73bd1bbeeb912d..8e0cf4f091242e 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -43,7 +43,7 @@ hostapd_append_wpa_key_mgmt() { case "$auth_type" in psk|eap) append wpa_key_mgmt "WPA-$auth_type_l" - [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type_l}" + [ "${wpa:-2}" -ge 2 ] && [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type_l}" [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256" ;; eap192) @@ -897,10 +897,21 @@ hostapd_set_bss_options() { } fi + json_get_vars ieee80211r + set_default ieee80211r 0 if [ "$wpa" -ge "1" ]; then - json_get_vars ieee80211r - set_default ieee80211r 0 + if [ "$fils" -gt 0 ]; then + json_get_vars fils_realm + set_default fils_realm "$(echo "$ssid" | md5sum | head -c 8)" + fi + + append bss_conf "wpa_disable_eapol_key_retries=$wpa_disable_eapol_key_retries" "$N" + + hostapd_append_wpa_key_mgmt + [ -n "$wpa_key_mgmt" ] && append bss_conf "wpa_key_mgmt=$wpa_key_mgmt" "$N" + fi + if [ "$wpa" -ge "2" ]; then if [ "$ieee80211r" -gt "0" ]; then json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline @@ -950,18 +961,7 @@ hostapd_set_bss_options() { done fi fi - if [ "$fils" -gt 0 ]; then - json_get_vars fils_realm - set_default fils_realm "$(echo "$ssid" | md5sum | head -c 8)" - fi - - append bss_conf "wpa_disable_eapol_key_retries=$wpa_disable_eapol_key_retries" "$N" - hostapd_append_wpa_key_mgmt - [ -n "$wpa_key_mgmt" ] && append bss_conf "wpa_key_mgmt=$wpa_key_mgmt" "$N" - fi - - if [ "$wpa" -ge "2" ]; then if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then set_default auth_cache 1 append bss_conf "rsn_preauth=1" "$N" From 97f6a6bfaafa7a55ce319cad41879681737e46a6 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 7 Mar 2024 09:24:20 +0100 Subject: [PATCH 0778/1171] ath11k-firmware: Move to new upstream repository for board-2.bin It was announced [1] that the original staging repositories are no longer used for staging of new firmware binaries. And that the old repository will be removed [2] in June 2024. The ath11k-firmware package must therefore point to the new repository before the old one is no longer accessible. [1] https://lore.kernel.org/r/bac97f31-4a70-4c4c-8179-4ede0b32f869@quicinc.com [2] https://github.com/kvalo/ath11k-firmware/commit/8d2cc160f390badd62970a66483214773c3fbea1 Signed-off-by: Sven Eckelmann --- package/firmware/ath11k-firmware/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/firmware/ath11k-firmware/Makefile b/package/firmware/ath11k-firmware/Makefile index fc7968a95764a4..318ed90b65c03c 100644 --- a/package/firmware/ath11k-firmware/Makefile +++ b/package/firmware/ath11k-firmware/Makefile @@ -50,7 +50,7 @@ QCN9074_BOARD_REV:=8e140c65f36137714b6d8934e09dcd73cb05c2f6 QCN9074_BOARD_FILE:=board-2.bin.$(QCN9074_BOARD_REV) define Download/qcn9074-board - URL:=https://github.com/kvalo/ath11k-firmware/raw/master/QCN9074/hw1.0/ + URL:=https://git.codelinaro.org/clo/ath-firmware/ath11k-firmware/-/raw/main/QCN9074/hw1.0/ URL_FILE:=board-2.bin FILE:=$(QCN9074_BOARD_FILE) HASH:=dbf0ca14aa1229eccd48f26f1026901b9718b143bd30b51b8ea67c84ba6207f1 From 6f70e09a00740e6ffc941247a1ccf3483696cebd Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Fri, 16 Feb 2024 14:04:40 +0100 Subject: [PATCH 0779/1171] mediatek: filogic: add support for Cudy RE3000 v1 MT7981B /256MB /16MB SPI (XM25QH128C) AX 2.4Ghz AX 5Ghz 160Mhz wide 1Gbit LAN OEM: root@RE3000:~# ifconfig |grep HWaddr br-lan Link encap:Ethernet HWaddr 80:XX:XX:08:XX:X0 (label) br-wan Link encap:Ethernet HWaddr 80:XX:XX:08:XX:X0 eth0 Link encap:Ethernet HWaddr 80:XX:XX:08:XX:X0 ra0 Link encap:Ethernet HWaddr 80:XX:XX:08:XX:X0 ra2 Link encap:Ethernet HWaddr 82:XX:XX:28:XX:X0 rax0 Link encap:Ethernet HWaddr 82:XX:XX:38:XX:X0 rax2 Link encap:Ethernet HWaddr 82:XX:XX:58:XX:X0 OpenWrt root@OpenWrt:/# ifconfig |grep HW br-lan Link encap:Ethernet HWaddr 80:XX:XX:08:XX:X0 eth0 Link encap:Ethernet HWaddr 80:XX:XX:08:XX:X0 phy0-ap0 Link encap:Ethernet HWaddr 80:XX:XX:08:XX:X0 phy1-ap0 Link encap:Ethernet HWaddr 82:XX:XX:08:XX:X1 tftp Installation via u-boot: Connect TTL3.3V converter connector is under the radiator Set speed 115200 8 N 1 Interrupt boot process by holding down-arrow key during boot then >> 6. Load image >> 0 - TFTP client (Default) enter IP adresses and initramfs-kernel.bin write to flash via sysupgrade or gui Signed-off-by: Robert Senderek (cherry picked from commit e8f75973172749874afa13e4f746acd8cb515de2) --- .../lib/preinit/05_set_preinit_iface | 1 + .../mediatek/dts/mt7981b-cudy-re3000-v1.dts | 221 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 3 + .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/upgrade/platform.sh | 3 +- target/linux/mediatek/image/filogic.mk | 19 ++ 7 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-re3000-v1.dts diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface index fd39b3f65f07db..d45f20fe620721 100644 --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -4,6 +4,7 @@ set_preinit_iface() { ip link set eth1 up ifname=eth1 ;; + cudy,re3000-v1|\ ubnt,unifi-6-lr|\ zyxel,nwa50ax-pro) ip link set eth0 up diff --git a/target/linux/mediatek/dts/mt7981b-cudy-re3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-re3000-v1.dts new file mode 100644 index 00000000000000..4025e5aaa3908b --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-re3000-v1.dts @@ -0,0 +1,221 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Cudy RE3000 v1"; + compatible = "cudy,re3000-v1", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + label-mac-device = &gmac1; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led@0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led@1 { + label = "red:wifi5"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led@2 { + label = "white:wifi2"; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led@3 { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led@4 { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 0>; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + }; +}; + +&spi0 { + status = "disabled"; +}; + +&spi2 { + pinctrl-names = "default"; + pinctrl-0 = <&spi2_flash_pins>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + + compatible = "jedec,spi-nor"; + reg = <0>; + + spi-max-frequency = <25000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@00000 { + label = "BL2"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "Factory"; + reg = <0x50000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + bdinfo: partition@60000 { + label = "bdinfo"; + reg = <0x60000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_de00: macaddr@de00 { + compatible = "mac-base"; + reg = <0xde00 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@70000 { + label = "FIP"; + reg = <0x70000 0x80000>; + read-only; + }; + + partition@f0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0xf0000 0xf10000>; + }; + }; + }; +}; + +&pio { + spi2_flash_pins: spi2-pins { + mux { + function = "spi"; + groups = "spi2", "spi2_wp_hold"; + }; + + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + bias-pull-up = <103>; + }; + + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + bias-pull-down = <103>; + }; + }; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 75c8fcda9b8cc2..96793e39cd89eb 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -12,6 +12,9 @@ confiabits,mt7981) ucidef_set_led_netdev "lan3" "lan3" "blue:lan-3" "lan3" "link tx rx" ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" ;; +cudy,re3000-v1) + ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" "link tx rx" + ;; cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index a48fbbc79c0ea3..566a5ca82fef36 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -58,6 +58,7 @@ mediatek_setup_interfaces() mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; + cudy,re3000-v1|\ netgear,wax220|\ ubnt,unifi-6-plus|\ zyxel,nwa50ax-pro) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index e6378dd49809ee..3441b41861d4d3 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -57,6 +57,11 @@ case "$board" in esac [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress ;; + cudy,re3000-v1) + addr=$(mtd_get_mac_binary bdinfo 0xde00) + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress + ;; cudy,wr3000-v1) addr=$(mtd_get_mac_binary bdinfo 0xde00) # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 9b3ebe92f15cb1..25cbf98f3374b3 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -106,7 +106,8 @@ platform_do_upgrade() { ;; esac ;; - cudy,wr3000-v1) + cudy,wr3000-v1|\ + cudy,re3000-v1) default_do_upgrade "$1" ;; glinet,gl-mt6000) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 7daac6a1fac9ba..5598a70acae18c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -298,6 +298,25 @@ define Device/confiabits_mt7981 endef TARGET_DEVICES += confiabits_mt7981 +define Device/cudy_re3000-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := RE3000 + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-re3000-v1 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + IMAGES := sysupgrade.bin + IMAGE_SIZE := 15424k + SUPPORTED_DEVICES += R36 + KERNEL := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_re3000-v1 + define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000 From 0844937947ec1c9124dbb332b5fb5d1e3616b1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 4 Mar 2024 16:12:05 +0000 Subject: [PATCH 0780/1171] umdns: update to Git 7c675979 (2024-03-04) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of single commit 9040335e102 ("interface: fix interface memory corruption"). Fixes: openwrt/openwrt/issues/14120 Signed-off-by: Petr Štetiar --- package/network/services/umdns/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile index 4510bdeb68873a..8684c80596f4a5 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=umdns -PKG_RELEASE:=5 +PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-10-19 -PKG_SOURCE_VERSION:=d45c443aa1e6514aab58bbbf9311913e484d31a6 -PKG_MIRROR_HASH:=20d91d867f4f34a37c7b2a600327884375f9f16c1ea9bbb3199347d8b617d856 +PKG_SOURCE_DATE:=2024-03-04 +PKG_SOURCE_VERSION:=7c6759792502fa45ac1e38aa5644f8cf8f290894 +PKG_MIRROR_HASH:=7314ac31559b16d34d381f001037d9679c48778d2738948c8bd361aeab491c22 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 From 4c1d13e995c3f19054caba8b51b9114f664e3f84 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 2 Mar 2024 19:14:22 +0100 Subject: [PATCH 0781/1171] kernel: bump 5.15 to 5.15.149 Removed because it is upstream: generic/pending-5.15/540-ksmbd-only-v2-leases-handle-the-directory.patch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=81ea755b8fa57ce186f56f14b709cf491c2a5505 Manually Adapted the following patches: ath79/patches-5.15/900-unaligned_access_hacks.patch ipq806x/patches-5.15/113-v5.19-03-PM-devfreq-Rework-freq_table-to-be-local-to-devfr.patch Signed-off-by: Hauke Mehrtens (cherry picked from commit 26d1d5240356e2c286ca87dbaea3308c0e9bc97f) --- include/kernel-5.15 | 4 +- .../910-unaligned_access_hacks.patch | 7 +- .../patches-5.15/920-mikrotik-rb4xx.patch | 2 +- .../950-0064-Add-dwc_otg-driver.patch | 2 +- ...070-MMC-added-alternative-MMC-driver.patch | 6 +- ...Better-coalescing-parameter-defaults.patch | 4 +- ...-link-energy-detect-powerdown-for-ex.patch | 2 +- ...ce-quirks-for-Freeway-Airmouse-T3-an.patch | 4 +- ...t-Workaround-2-for-Pi4-Ethernet-fail.patch | 2 +- ...tft-Add-support-for-display-variants.patch | 6 +- ...et-bcmgenet-Reset-RBUF-on-first-open.patch | 8 +-- ...-interface-in-mode6-for-18-bit-color.patch | 2 +- ...vice-quirks-for-A4Tech-FHD-1080p-web.patch | 2 +- ...-Add-a-timing-for-the-Raspberry-Pi-7.patch | 2 +- ...nel-simple-add-Geekworm-MZP280-Panel.patch | 2 +- ...789-drm-Add-chroma-siting-properties.patch | 2 +- ...-unregistering-of-framebuffers-witho.patch | 2 +- ...-unplug-firmware-fb-devices-on-force.patch | 6 +- ...do-single-sector-reads-during-recove.patch | 2 +- ...dd-CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG.patch | 2 +- ...xhci-mvebu-make-USB-3.0-PHY-optional.patch | 2 +- ...-users-of-bitmap_foo-to-linkmode_foo.patch | 2 +- ...icro-stmmac-move-queue-reset-to-dedi.patch | 4 +- ...icro-stmmac-move-dma-conf-to-dedicat.patch | 6 +- ...icro-stmmac-generate-stmmac-dma-conf.patch | 2 +- .../410-block-fit-partition-parser.patch | 2 +- .../203-kallsyms_uncompressed.patch | 2 +- ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 28 ++++---- ...ow_offload-handle-netdevice-events-f.patch | 2 +- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- ...pool-and-page-referenced-frags-in-GR.patch | 2 +- ...-bus-mhi-core-add-SBL-state-callback.patch | 2 +- .../810-pci_disable_common_quirks.patch | 6 +- ...t-devfreq_get_freq_range-symbol-with.patch | 10 +-- ...work-freq_table-to-be-local-to-devfr.patch | 64 ++++++++++--------- ...Mute-warning-on-governor-PROBE_DEFER.patch | 2 +- ...stmmac-Use-hrtimer-for-TX-coalescing.patch | 2 +- ...move-drivers-from-strlcpy-to-strscpy.patch | 4 +- ...a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch | 2 +- ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 2 +- 40 files changed, 110 insertions(+), 107 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index d93ae194b8aa1c..9ab2d04fc65cca 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .148 -LINUX_KERNEL_HASH-5.15.148 = c48575c97fd9f4767cbe50a13b1b2b40ee42830aba3182fabd35a03259a6e5d8 +LINUX_VERSION-5.15 = .149 +LINUX_KERNEL_HASH-5.15.149 = bd84809a367eb400eb04e0e70294e6ba12fc03b6bfb5a7dfaca548f8947501b0 diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 7bd6ae8b5606a9..3c15a016ff8fa6 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -86,7 +86,7 @@ SVN-Revision: 35130 } while (word != stop); return csum_fold(csum); -@@ -182,73 +186,6 @@ static inline __sum16 ip_compute_csum(co +@@ -182,74 +186,6 @@ static inline __sum16 ip_compute_csum(co return csum_fold(csum_partial(buff, len, 0)); } @@ -152,7 +152,8 @@ SVN-Revision: 35130 - " .set pop" - : "=&r" (sum), "=&r" (tmp) - : "r" (saddr), "r" (daddr), -- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); +- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum) +- : "memory"); - - return csum_fold(sum); -} @@ -336,7 +337,7 @@ SVN-Revision: 35130 #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1477,8 +1477,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1480,8 +1480,8 @@ struct sk_buff *inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; diff --git a/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch b/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch index 4743ad46e2522e..16c8f11af75317 100644 --- a/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch +++ b/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch @@ -45,7 +45,7 @@ Submitted-by: Christopher Hill --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig -@@ -2176,6 +2176,14 @@ config RAVE_SP_CORE +@@ -2177,6 +2177,14 @@ config RAVE_SP_CORE Select this to get support for the Supervisory Processor device found on several devices in RAVE line of hardware. diff --git a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch index 49283f55630e7a..b07d81aa2e5c31 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch @@ -1123,7 +1123,7 @@ Signed-off-by: Jonathan Bell } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5659,7 +5659,7 @@ static void port_event(struct usb_hub *h +@@ -5667,7 +5667,7 @@ static void port_event(struct usb_hub *h port_dev->over_current_count++; port_over_current_notify(port_dev); diff --git a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch index 848ac83e3a0618..bc655e92743a1c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch @@ -244,7 +244,7 @@ bcm2835-mmc: uninitialized_var is no more static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, -@@ -2946,6 +2953,8 @@ static int mmc_blk_probe(struct mmc_card +@@ -2986,6 +2993,8 @@ static int mmc_blk_probe(struct mmc_card { struct mmc_blk_data *md; int ret = 0; @@ -253,7 +253,7 @@ bcm2835-mmc: uninitialized_var is no more /* * Check that the card supports the command class(es) we need. -@@ -2953,7 +2962,16 @@ static int mmc_blk_probe(struct mmc_card +@@ -2993,7 +3002,16 @@ static int mmc_blk_probe(struct mmc_card if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; @@ -271,7 +271,7 @@ bcm2835-mmc: uninitialized_var is no more card->complete_wq = alloc_workqueue("mmc_complete", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); -@@ -2968,6 +2986,17 @@ static int mmc_blk_probe(struct mmc_card +@@ -3008,6 +3026,17 @@ static int mmc_blk_probe(struct mmc_card goto out_free; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch b/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch index ebffb634cd5625..56804764e812ce 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0144-bcmgenet-Better-coalescing-parameter-defaults.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -@@ -2618,7 +2618,7 @@ static void bcmgenet_init_tx_ring(struct +@@ -2615,7 +2615,7 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_PROD_INDEX); bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_CONS_INDEX); @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /* Disable rate control for now */ bcmgenet_tdma_ring_writel(priv, index, flow_period_val, TDMA_FLOW_PERIOD); -@@ -4086,9 +4086,12 @@ static int bcmgenet_probe(struct platfor +@@ -4083,9 +4083,12 @@ static int bcmgenet_probe(struct platfor netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); /* Set default coalescing parameters */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0145-net-genet-enable-link-energy-detect-powerdown-for-ex.patch b/target/linux/bcm27xx/patches-5.15/950-0145-net-genet-enable-link-energy-detect-powerdown-for-ex.patch index cde33a576e8437..0e1640304b7c47 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0145-net-genet-enable-link-energy-detect-powerdown-for-ex.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0145-net-genet-enable-link-energy-detect-powerdown-for-ex.patch @@ -20,7 +20,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c -@@ -286,6 +286,8 @@ int bcmgenet_mii_probe(struct net_device +@@ -292,6 +292,8 @@ int bcmgenet_mii_probe(struct net_device /* Communicate the integrated PHY revision */ if (priv->internal_phy) phy_flags = priv->gphy_rev; diff --git a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 0b6ff1a70a23cf..4ec54a03ee321c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0163-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch @@ -23,7 +23,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h -@@ -225,6 +225,9 @@ +@@ -226,6 +226,9 @@ #define USB_VENDOR_ID_BAANTO 0x2453 #define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 @@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell #define USB_VENDOR_ID_BELKIN 0x050d #define USB_DEVICE_ID_FLIP_KVM 0x3201 -@@ -1322,6 +1325,9 @@ +@@ -1323,6 +1326,9 @@ #define USB_VENDOR_ID_XAT 0x2505 #define USB_DEVICE_ID_XAT_CSR 0x0220 diff --git a/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch b/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch index 318681ff9101a0..1598ffef2ded86 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0165-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch @@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell static inline void bcmgenet_writel(u32 value, void __iomem *offset) { -@@ -2449,6 +2452,11 @@ static void reset_umac(struct bcmgenet_p +@@ -2446,6 +2449,11 @@ static void reset_umac(struct bcmgenet_p bcmgenet_rbuf_ctrl_set(priv, 0); udelay(10); diff --git a/target/linux/bcm27xx/patches-5.15/950-0290-staging-fbtft-Add-support-for-display-variants.patch b/target/linux/bcm27xx/patches-5.15/950-0290-staging-fbtft-Add-support-for-display-variants.patch index ec3b301be15fab..aa39f9f7de1ca1 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0290-staging-fbtft-Add-support-for-display-variants.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0290-staging-fbtft-Add-support-for-display-variants.patch @@ -95,7 +95,7 @@ Signed-off-by: Phil Elwell #include